]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/uvdevice: autoload module based on CPU facility
authorSteffen Eiden <seiden@linux.ibm.com>
Wed, 13 Jul 2022 12:56:44 +0000 (14:56 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Tue, 19 Jul 2022 14:18:49 +0000 (16:18 +0200)
Make sure the uvdevice driver will be automatically loaded when
facility 158 is available.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20220713125644.16121-4-seiden@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/include/asm/cpufeature.h
arch/s390/kernel/cpufeature.c
drivers/s390/char/uvdevice.c

index 771caf5281e576563e47ad2e1cc0b34cb52bf568..9312046137531646a0fc05997699bac954788ecb 100644 (file)
@@ -12,6 +12,7 @@
 enum {
        S390_CPU_FEATURE_MSA,
        S390_CPU_FEATURE_VXRS,
+       S390_CPU_FEATURE_UV,
        MAX_CPU_FEATURES
 };
 
index 8b5072b335f4c56be555d0bdf2d195638335d1f3..1b2ae42a0c156e1656cbd145138928b1ebeaafde 100644 (file)
@@ -20,6 +20,7 @@ struct s390_cpu_feature {
 static struct s390_cpu_feature s390_cpu_features[MAX_CPU_FEATURES] = {
        [S390_CPU_FEATURE_MSA]  = {.type = TYPE_HWCAP, .num = HWCAP_NR_MSA},
        [S390_CPU_FEATURE_VXRS] = {.type = TYPE_HWCAP, .num = HWCAP_NR_VXRS},
+       [S390_CPU_FEATURE_UV]   = {.type = TYPE_FACILITY, .num = 158},
 };
 
 /*
index 66505d7166a6a52a2660d16ad4e30f1b07d8faad..1d40457c7b10e9376c771eed3931c73d05002228 100644 (file)
@@ -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(S390_CPU_FEATURE_UV, uvio_dev_init);
 module_exit(uvio_dev_exit);
 
 MODULE_AUTHOR("IBM Corporation");