Re: [PATCH v2 1/3] drivers/s390/char: Add Ultravisor io device

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

 



On 2/23/22 15:48, Steffen Eiden wrote:
This patch adds a new miscdevice to expose some Ultravisor functions
to userspace. Userspace can send IOCTLs to the uvdevice that will then
emit a corresponding Ultravisor Call and hands the result over to
userspace. The uvdevice is available if the Ultravisor Call facility is
present.

Userspace is now able to call the Query Ultravisor Information
Ultravisor Command through the uvdevice.

Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
---
  MAINTAINERS                           |   2 +
  arch/s390/include/uapi/asm/uvdevice.h |  27 +++++
  drivers/s390/char/Kconfig             |  11 ++
  drivers/s390/char/Makefile            |   1 +
  drivers/s390/char/uvdevice.c          | 145 ++++++++++++++++++++++++++
  5 files changed, 186 insertions(+)
  create mode 100644 arch/s390/include/uapi/asm/uvdevice.h
  create mode 100644 drivers/s390/char/uvdevice.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 777cd6fa2b3d..f32e876f45c2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10577,9 +10577,11 @@ F:	Documentation/virt/kvm/s390*
  F:	arch/s390/include/asm/gmap.h
  F:	arch/s390/include/asm/kvm*
  F:	arch/s390/include/uapi/asm/kvm*
+F:	arch/s390/include/uapi/asm/uvdevice.h
  F:	arch/s390/kernel/uv.c
  F:	arch/s390/kvm/
  F:	arch/s390/mm/gmap.c
+F:	drivers/s390/char/uvdevice.c
  F:	tools/testing/selftests/kvm/*/s390x/
  F:	tools/testing/selftests/kvm/s390x/
diff --git a/arch/s390/include/uapi/asm/uvdevice.h b/arch/s390/include/uapi/asm/uvdevice.h
new file mode 100644
index 000000000000..60956f8d2dc0
--- /dev/null
+++ b/arch/s390/include/uapi/asm/uvdevice.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ *  Copyright IBM Corp. 2022
+ *  Author(s): Steffen Eiden <seiden@xxxxxxxxxxxxx>
+ */
+#ifndef __S390X_ASM_UVDEVICE_H
+#define __S390X_ASM_UVDEVICE_H
+
+#include <linux/types.h>
+
+struct uvio_ioctl_cb {
+	__u32 flags;
+	__u16 uv_rc;			/* UV header rc value */
+	__u16 uv_rrc;			/* UV header rrc value */
+	__u64 argument_addr;		/* Userspace address of uvio argument */
+	__u32 argument_len;
+	__u8  reserved14[0x40 - 0x14];	/* must be zero */
+};
+
+#define UVIO_QUI_MAX_LEN		0x8000
+
+#define UVIO_DEVICE_NAME "uv"
+#define UVIO_TYPE_UVC 'u'
+
+#define UVIO_IOCTL_QUI _IOWR(UVIO_TYPE_UVC, 0x01, struct uvio_ioctl_cb)
+
+#endif  /* __S390X_ASM_UVDEVICE_H */
diff --git a/drivers/s390/char/Kconfig b/drivers/s390/char/Kconfig
index 6cc4b19acf85..2a828274257a 100644
--- a/drivers/s390/char/Kconfig
+++ b/drivers/s390/char/Kconfig
@@ -184,3 +184,14 @@ config S390_VMUR
  	depends on S390
  	help
  	  Character device driver for z/VM reader, puncher and printer.
+
+config S390_UV_UAPI
+	def_tristate y
+	prompt "Ultravisor userspace API"
+	depends on PROTECTED_VIRTUALIZATION_GUEST

Please drop the dependency.
We want this to be available to both guest and host as QUI is available in both environments and more calls like this could follow.

We could put an option around the attestation but the savings are not worth the effort.



[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