* [PATCH 0/2] s390: Autoload uvdevice module based on CPU feature
@ 2022-07-01 10:02 Steffen Eiden
2022-07-01 10:02 ` [PATCH 1/2] s390/hwcaps: Add HWCAP_UV Steffen Eiden
2022-07-01 10:02 ` [PATCH 2/2] drivers/s390/char/uvdevice: Autoload module based on CPU feature Steffen Eiden
0 siblings, 2 replies; 6+ messages in thread
From: Steffen Eiden @ 2022-07-01 10:02 UTC (permalink / raw)
To: Heiko Carstens, Alexander Gordeev, Christian Borntraeger,
Janosch Frank, Claudio Imbrenda, Vasily Gorbik, linux-s390,
linux-kernel, linux-mm
Cc: nrb
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 606 bytes --]
Currently, the uvdevice (drivers/s390/char/uvdevice) must be loaded
manually. We can, however, determine if the Ultravisor is available
by observing facility 158.
This series, first, introduces the HWCAP_UV connected to facility 158.
And, second, it automatically loads the uvdevice if HWCAP_UV is present.
Steffen Eiden (2):
s390/hwcaps: Add HWCAP_UV
drivers/s390/char/uvdevice: Autoload module based on CPU feature
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(-)
--
2.35.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] s390/hwcaps: Add HWCAP_UV
2022-07-01 10:02 [PATCH 0/2] s390: Autoload uvdevice module based on CPU feature Steffen Eiden
@ 2022-07-01 10:02 ` Steffen Eiden
2022-07-01 10:10 ` Christian Borntraeger
2022-07-01 10:02 ` [PATCH 2/2] drivers/s390/char/uvdevice: Autoload module based on CPU feature Steffen Eiden
1 sibling, 1 reply; 6+ messages in thread
From: Steffen Eiden @ 2022-07-01 10:02 UTC (permalink / raw)
To: Heiko Carstens, Alexander Gordeev, Christian Borntraeger,
Janosch Frank, Claudio Imbrenda, Vasily Gorbik, linux-s390,
linux-kernel, linux-mm
Cc: nrb
This patch adds a hardware capability for the Ultravisor.
This capability will be present if facility 158 is enabled.
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
---
arch/s390/include/asm/elf.h | 2 ++
arch/s390/kernel/processor.c | 5 +++++
2 files changed, 7 insertions(+)
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..80ccd57a2b00 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;
+ /* ultravisor-call (secure execution) */
+ if (test_facility(158))
+ elf_hwcap |= HWCAP_UV;
+
return 0;
}
arch_initcall(setup_hwcaps);
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drivers/s390/char/uvdevice: Autoload module based on CPU feature
2022-07-01 10:02 [PATCH 0/2] s390: Autoload uvdevice module based on CPU feature Steffen Eiden
2022-07-01 10:02 ` [PATCH 1/2] s390/hwcaps: Add HWCAP_UV Steffen Eiden
@ 2022-07-01 10:02 ` Steffen Eiden
1 sibling, 0 replies; 6+ messages in thread
From: Steffen Eiden @ 2022-07-01 10:02 UTC (permalink / raw)
To: Heiko Carstens, Alexander Gordeev, Christian Borntraeger,
Janosch Frank, Claudio Imbrenda, Vasily Gorbik, linux-s390,
linux-kernel, linux-mm
Cc: nrb
With this patch the uvdevice will be automatically loaded when the
HWCAP_UV bit is set.
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
---
drivers/s390/char/uvdevice.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] s390/hwcaps: Add HWCAP_UV
2022-07-01 10:02 ` [PATCH 1/2] s390/hwcaps: Add HWCAP_UV Steffen Eiden
@ 2022-07-01 10:10 ` Christian Borntraeger
2022-07-04 10:00 ` Heiko Carstens
0 siblings, 1 reply; 6+ messages in thread
From: Christian Borntraeger @ 2022-07-01 10:10 UTC (permalink / raw)
To: Steffen Eiden, Heiko Carstens, Alexander Gordeev, Janosch Frank,
Claudio Imbrenda, Vasily Gorbik, linux-s390, linux-kernel,
linux-mm
Cc: nrb
Am 01.07.22 um 12:02 schrieb Steffen Eiden:
> This patch adds a hardware capability for the Ultravisor.
> This capability will be present if facility 158 is enabled.
>
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
> arch/s390/include/asm/elf.h | 2 ++
> arch/s390/kernel/processor.c | 5 +++++
> 2 files changed, 7 insertions(+)
>
> 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
> };
question for Heiko, Vasily, Alexander. This certainly works.
An alternative implementation would be to separate module_cpu_feature_match
from HWCAP. (so uv would not be shown in /proc/cpuinfo and it would be
seen in the aux vector). I would imagine that we might have more drivers
in the future that depend on a facility but this facility is not really
useful for userspace to know.
See arch/s390/include/asm/cpufeature.h
* Restrict the set of exposed CPU features to ELF hardware capabilities for
* now. Additional machine flags can be indicated by values larger than
* MAX_ELF_HWCAP_FEATURES.
Any preference from your side?
>
> @@ -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..80ccd57a2b00 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;
>
> + /* ultravisor-call (secure execution) */
> + if (test_facility(158))
> + elf_hwcap |= HWCAP_UV;
> +
> return 0;
> }
> arch_initcall(setup_hwcaps);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] s390/hwcaps: Add HWCAP_UV
2022-07-01 10:10 ` Christian Borntraeger
@ 2022-07-04 10:00 ` Heiko Carstens
2022-07-04 11:35 ` Steffen Eiden
0 siblings, 1 reply; 6+ messages in thread
From: Heiko Carstens @ 2022-07-04 10:00 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Steffen Eiden, Alexander Gordeev, Janosch Frank,
Claudio Imbrenda, Vasily Gorbik, linux-s390, linux-kernel,
linux-mm, nrb
On Fri, Jul 01, 2022 at 12:10:18PM +0200, Christian Borntraeger wrote:
> Am 01.07.22 um 12:02 schrieb Steffen Eiden:
> > This patch adds a hardware capability for the Ultravisor.
> > This capability will be present if facility 158 is enabled.
> >
> > Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> > ---
> > arch/s390/include/asm/elf.h | 2 ++
> > arch/s390/kernel/processor.c | 5 +++++
> > 2 files changed, 7 insertions(+)
> >
> > 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
> > };
>
> question for Heiko, Vasily, Alexander. This certainly works.
> An alternative implementation would be to separate module_cpu_feature_match
> from HWCAP. (so uv would not be shown in /proc/cpuinfo and it would be
> seen in the aux vector). I would imagine that we might have more drivers
> in the future that depend on a facility but this facility is not really
> useful for userspace to know.
>
> See arch/s390/include/asm/cpufeature.h
> * Restrict the set of exposed CPU features to ELF hardware capabilities for
> * now. Additional machine flags can be indicated by values larger than
> * MAX_ELF_HWCAP_FEATURES.
>
> Any preference from your side?
I mentioned already before this RFC that my preferred solution would
be to have a solution which extends the existing method to work (also)
with facility bits - haven't checked if all existing users could be
converted to facility bits, but making it more flexible would work
certainly.
If Steffen is willing to do that, that would be very welcome.
Otherwise I'll put that on my todo list.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] s390/hwcaps: Add HWCAP_UV
2022-07-04 10:00 ` Heiko Carstens
@ 2022-07-04 11:35 ` Steffen Eiden
0 siblings, 0 replies; 6+ messages in thread
From: Steffen Eiden @ 2022-07-04 11:35 UTC (permalink / raw)
To: Heiko Carstens, Christian Borntraeger
Cc: Alexander Gordeev, Janosch Frank, Claudio Imbrenda,
Vasily Gorbik, linux-s390, linux-kernel, linux-mm, nrb
On 7/4/22 12:00, Heiko Carstens wrote:
> On Fri, Jul 01, 2022 at 12:10:18PM +0200, Christian Borntraeger wrote:
[ snip ]
>> Any preference from your side?
>
> I mentioned already before this RFC that my preferred solution would
> be to have a solution which extends the existing method to work (also)
> with facility bits - haven't checked if all existing users could be
> converted to facility bits, but making it more flexible would work
> certainly.
>
> If Steffen is willing to do that, that would be very welcome.
> Otherwise I'll put that on my todo list.
I'll have a look on that.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-04 11:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 10:02 [PATCH 0/2] s390: Autoload uvdevice module based on CPU feature Steffen Eiden
2022-07-01 10:02 ` [PATCH 1/2] s390/hwcaps: Add HWCAP_UV Steffen Eiden
2022-07-01 10:10 ` Christian Borntraeger
2022-07-04 10:00 ` Heiko Carstens
2022-07-04 11:35 ` Steffen Eiden
2022-07-01 10:02 ` [PATCH 2/2] drivers/s390/char/uvdevice: Autoload module based on CPU feature Steffen Eiden
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.