lkml.org 
[lkml]   [2022]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH] s390: Autoload uvdevice module based on CPU feature
Date
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@linux.ibm.com>
---
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
\
 
 \ /
  Last update: 2022-06-29 17:39    [W:0.035 / U:1.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site