[RFC PATCH] s390: Autoload uvdevice module based on CPU feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch the uvdevice will be automatically loaded when the
facility 158 is present. This is accomplished by using
``module_cpu_feature_match`` and adding HWCAP_UV
connected to to facility 158.

Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
---
 arch/s390/include/asm/elf.h  | 2 ++
 arch/s390/kernel/processor.c | 5 +++++
 drivers/s390/char/uvdevice.c | 5 ++---
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 70a30ae258b7..3a5e89ce4fd0 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -115,6 +115,7 @@ enum {
 	HWCAP_NR_NNPA		= 20,
 	HWCAP_NR_PCI_MIO	= 21,
 	HWCAP_NR_SIE		= 22,
+	HWCAP_NR_UV		= 23,
 	HWCAP_NR_MAX
 };
 
@@ -142,6 +143,7 @@ enum {
 #define HWCAP_NNPA		BIT(HWCAP_NR_NNPA)
 #define HWCAP_PCI_MIO		BIT(HWCAP_NR_PCI_MIO)
 #define HWCAP_SIE		BIT(HWCAP_NR_SIE)
+#define HWCAP_UV		BIT(HWCAP_NR_UV)
 
 /*
  * These are used to set parameters in the core dumps.
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index aa0e0e7fc773..3ca528cb3819 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -141,6 +141,7 @@ static void show_cpu_summary(struct seq_file *m, void *v)
 		[HWCAP_NR_NNPA]		= "nnpa",
 		[HWCAP_NR_PCI_MIO]	= "pcimio",
 		[HWCAP_NR_SIE]		= "sie",
+		[HWCAP_NR_UV]		= "uv",
 	};
 	int i, cpu;
 
@@ -249,6 +250,10 @@ static int __init setup_hwcaps(void)
 	if (sclp.has_sief2)
 		elf_hwcap |= HWCAP_SIE;
 
+	/* IBM Secure Execution (Ultravisor) support */
+	if (test_facility(158)) {
+		elf_hwcap |= HWCAP_UV;
+
 	return 0;
 }
 arch_initcall(setup_hwcaps);
diff --git a/drivers/s390/char/uvdevice.c b/drivers/s390/char/uvdevice.c
index 66505d7166a6..fddbfc1e27a2 100644
--- a/drivers/s390/char/uvdevice.c
+++ b/drivers/s390/char/uvdevice.c
@@ -27,6 +27,7 @@
 #include <linux/stddef.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
+#include <linux/cpufeature.h>
 
 #include <asm/uvdevice.h>
 #include <asm/uv.h>
@@ -244,12 +245,10 @@ static void __exit uvio_dev_exit(void)
 
 static int __init uvio_dev_init(void)
 {
-	if (!test_facility(158))
-		return -ENXIO;
 	return misc_register(&uvio_dev_miscdev);
 }
 
-module_init(uvio_dev_init);
+module_cpu_feature_match(UV, uvio_dev_init);
 module_exit(uvio_dev_exit);
 
 MODULE_AUTHOR("IBM Corporation");
-- 
2.35.3




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux