* [PATCH v3 1/5] s390/pci: stash version in the zpci_dev
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
@ 2020-10-07 18:56 ` Matthew Rosato
2020-10-07 18:56 ` [PATCH v3 2/5] s390/pci: track whether util_str is valid " Matthew Rosato
` (5 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Matthew Rosato @ 2020-10-07 18:56 UTC (permalink / raw)
To: alex.williamson, cohuck, schnelle
Cc: pmorel, borntraeger, hca, gor, gerald.schaefer, linux-s390, kvm,
linux-kernel
In preparation for passing the info on to vfio-pci devices, stash the
supported PCI version for the target device in the zpci_dev.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Niklas Schnelle <schnelle@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
---
arch/s390/include/asm/pci.h | 1 +
arch/s390/pci/pci_clp.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 99b92c3..882e233 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -179,6 +179,7 @@ struct zpci_dev {
atomic64_t mapped_pages;
atomic64_t unmapped_pages;
+ u8 version;
enum pci_bus_speed max_bus_speed;
struct dentry *debugfs_dev;
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index 7e735f4..48bf316 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -102,6 +102,7 @@ static void clp_store_query_pci_fngrp(struct zpci_dev *zdev,
zdev->msi_addr = response->msia;
zdev->max_msi = response->noi;
zdev->fmb_update = response->mui;
+ zdev->version = response->version;
switch (response->version) {
case 1:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 2/5] s390/pci: track whether util_str is valid in the zpci_dev
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
2020-10-07 18:56 ` [PATCH v3 1/5] s390/pci: stash version in the zpci_dev Matthew Rosato
@ 2020-10-07 18:56 ` Matthew Rosato
2020-10-07 18:56 ` [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO Matthew Rosato
` (4 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Matthew Rosato @ 2020-10-07 18:56 UTC (permalink / raw)
To: alex.williamson, cohuck, schnelle
Cc: pmorel, borntraeger, hca, gor, gerald.schaefer, linux-s390, kvm,
linux-kernel
We'll need to keep track of whether or not the byte string in util_str is
valid and thus needs to be passed to a vfio-pci passthrough device.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Niklas Schnelle <schnelle@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
---
arch/s390/include/asm/pci.h | 3 ++-
arch/s390/pci/pci_clp.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 882e233..fa1fed4 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -132,7 +132,8 @@ struct zpci_dev {
u8 rid_available : 1;
u8 has_hp_slot : 1;
u8 is_physfn : 1;
- u8 reserved : 5;
+ u8 util_str_avail : 1;
+ u8 reserved : 4;
unsigned int devfn; /* DEVFN part of the RID*/
struct mutex lock;
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index 48bf316..322689b 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -168,6 +168,7 @@ static int clp_store_query_pci_fn(struct zpci_dev *zdev,
if (response->util_str_avail) {
memcpy(zdev->util_str, response->util_str,
sizeof(zdev->util_str));
+ zdev->util_str_avail = 1;
}
zdev->mio_capable = response->mio_addr_avail;
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
2020-10-07 18:56 ` [PATCH v3 1/5] s390/pci: stash version in the zpci_dev Matthew Rosato
2020-10-07 18:56 ` [PATCH v3 2/5] s390/pci: track whether util_str is valid " Matthew Rosato
@ 2020-10-07 18:56 ` Matthew Rosato
2020-10-07 20:21 ` Alex Williamson
2020-10-09 9:38 ` Cornelia Huck
2020-10-07 18:56 ` [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO Matthew Rosato
` (3 subsequent siblings)
6 siblings, 2 replies; 16+ messages in thread
From: Matthew Rosato @ 2020-10-07 18:56 UTC (permalink / raw)
To: alex.williamson, cohuck, schnelle
Cc: pmorel, borntraeger, hca, gor, gerald.schaefer, linux-s390, kvm,
linux-kernel
Allow the VFIO_DEVICE_GET_INFO ioctl to include a capability chain.
Add a flag indicating capability chain support, and introduce the
definitions for the first set of capabilities which are specified to
s390 zPCI devices.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
include/uapi/linux/vfio.h | 11 ++++++
include/uapi/linux/vfio_zdev.h | 78 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+)
create mode 100644 include/uapi/linux/vfio_zdev.h
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 9204705..836a25b 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -201,8 +201,10 @@ struct vfio_device_info {
#define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */
#define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */
#define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */
+#define VFIO_DEVICE_FLAGS_CAPS (1 << 6) /* Info supports caps */
__u32 num_regions; /* Max region index + 1 */
__u32 num_irqs; /* Max IRQ index + 1 */
+ __u32 cap_offset; /* Offset within info struct of first cap */
};
#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
@@ -218,6 +220,15 @@ struct vfio_device_info {
#define VFIO_DEVICE_API_CCW_STRING "vfio-ccw"
#define VFIO_DEVICE_API_AP_STRING "vfio-ap"
+/*
+ * The following capabilities are unique to s390 zPCI devices. Their contents
+ * are further-defined in vfio_zdev.h
+ */
+#define VFIO_DEVICE_INFO_CAP_ZPCI_BASE 1
+#define VFIO_DEVICE_INFO_CAP_ZPCI_GROUP 2
+#define VFIO_DEVICE_INFO_CAP_ZPCI_UTIL 3
+#define VFIO_DEVICE_INFO_CAP_ZPCI_PFIP 4
+
/**
* VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
* struct vfio_region_info)
diff --git a/include/uapi/linux/vfio_zdev.h b/include/uapi/linux/vfio_zdev.h
new file mode 100644
index 0000000..b430939
--- /dev/null
+++ b/include/uapi/linux/vfio_zdev.h
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * VFIO Region definitions for ZPCI devices
+ *
+ * Copyright IBM Corp. 2020
+ *
+ * Author(s): Pierre Morel <pmorel@linux.ibm.com>
+ * Matthew Rosato <mjrosato@linux.ibm.com>
+ */
+
+#ifndef _VFIO_ZDEV_H_
+#define _VFIO_ZDEV_H_
+
+#include <linux/types.h>
+#include <linux/vfio.h>
+
+/**
+ * VFIO_DEVICE_INFO_CAP_ZPCI_BASE - Base PCI Function information
+ *
+ * This capability provides a set of descriptive information about the
+ * associated PCI function.
+ */
+struct vfio_device_info_cap_zpci_base {
+ struct vfio_info_cap_header header;
+ __u64 start_dma; /* Start of available DMA addresses */
+ __u64 end_dma; /* End of available DMA addresses */
+ __u16 pchid; /* Physical Channel ID */
+ __u16 vfn; /* Virtual function number */
+ __u16 fmb_length; /* Measurement Block Length (in bytes) */
+ __u8 pft; /* PCI Function Type */
+ __u8 gid; /* PCI function group ID */
+};
+
+/**
+ * VFIO_DEVICE_INFO_CAP_ZPCI_GROUP - Base PCI Function Group information
+ *
+ * This capability provides a set of descriptive information about the group of
+ * PCI functions that the associated device belongs to.
+ */
+struct vfio_device_info_cap_zpci_group {
+ struct vfio_info_cap_header header;
+ __u64 dasm; /* DMA Address space mask */
+ __u64 msi_addr; /* MSI address */
+ __u64 flags;
+#define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1 /* Program-specified TLB refresh */
+ __u16 mui; /* Measurement Block Update Interval */
+ __u16 noi; /* Maximum number of MSIs */
+ __u16 maxstbl; /* Maximum Store Block Length */
+ __u8 version; /* Supported PCI Version */
+};
+
+/**
+ * VFIO_DEVICE_INFO_CAP_ZPCI_UTIL - Utility String
+ *
+ * This capability provides the utility string for the associated device, which
+ * is a device identifier string made up of EBCDID characters. 'size' specifies
+ * the length of 'util_str'.
+ */
+struct vfio_device_info_cap_zpci_util {
+ struct vfio_info_cap_header header;
+ __u32 size;
+ __u8 util_str[];
+};
+
+/**
+ * VFIO_DEVICE_INFO_CAP_ZPCI_PFIP - PCI Function Path
+ *
+ * This capability provides the PCI function path string, which is an identifier
+ * that describes the internal hardware path of the device. 'size' specifies
+ * the length of 'pfip'.
+ */
+struct vfio_device_info_cap_zpci_pfip {
+ struct vfio_info_cap_header header;
+ __u32 size;
+ __u8 pfip[];
+};
+
+#endif
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO
2020-10-07 18:56 ` [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO Matthew Rosato
@ 2020-10-07 20:21 ` Alex Williamson
2020-10-09 9:38 ` Cornelia Huck
1 sibling, 0 replies; 16+ messages in thread
From: Alex Williamson @ 2020-10-07 20:21 UTC (permalink / raw)
To: Matthew Rosato
Cc: cohuck, schnelle, pmorel, borntraeger, hca, gor, gerald.schaefer,
linux-s390, kvm, linux-kernel
On Wed, 7 Oct 2020 14:56:22 -0400
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> Allow the VFIO_DEVICE_GET_INFO ioctl to include a capability chain.
> Add a flag indicating capability chain support, and introduce the
> definitions for the first set of capabilities which are specified to
> s390 zPCI devices.
>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
> include/uapi/linux/vfio.h | 11 ++++++
> include/uapi/linux/vfio_zdev.h | 78 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 89 insertions(+)
> create mode 100644 include/uapi/linux/vfio_zdev.h
>
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index 9204705..836a25b 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
> @@ -201,8 +201,10 @@ struct vfio_device_info {
> #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */
> #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */
> #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */
> +#define VFIO_DEVICE_FLAGS_CAPS (1 << 6) /* Info supports caps */
FYI, I'm going to change this to (1 << 7) because the new fsl-mc bus
driver patches are claiming a new device type with (1 << 6) and I don't
want the conflict to be magically resolved on merge. Thanks,
Alex
> __u32 num_regions; /* Max region index + 1 */
> __u32 num_irqs; /* Max IRQ index + 1 */
> + __u32 cap_offset; /* Offset within info struct of first cap */
> };
> #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
>
> @@ -218,6 +220,15 @@ struct vfio_device_info {
> #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw"
> #define VFIO_DEVICE_API_AP_STRING "vfio-ap"
>
> +/*
> + * The following capabilities are unique to s390 zPCI devices. Their contents
> + * are further-defined in vfio_zdev.h
> + */
> +#define VFIO_DEVICE_INFO_CAP_ZPCI_BASE 1
> +#define VFIO_DEVICE_INFO_CAP_ZPCI_GROUP 2
> +#define VFIO_DEVICE_INFO_CAP_ZPCI_UTIL 3
> +#define VFIO_DEVICE_INFO_CAP_ZPCI_PFIP 4
> +
> /**
> * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
> * struct vfio_region_info)
> diff --git a/include/uapi/linux/vfio_zdev.h b/include/uapi/linux/vfio_zdev.h
> new file mode 100644
> index 0000000..b430939
> --- /dev/null
> +++ b/include/uapi/linux/vfio_zdev.h
> @@ -0,0 +1,78 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +/*
> + * VFIO Region definitions for ZPCI devices
> + *
> + * Copyright IBM Corp. 2020
> + *
> + * Author(s): Pierre Morel <pmorel@linux.ibm.com>
> + * Matthew Rosato <mjrosato@linux.ibm.com>
> + */
> +
> +#ifndef _VFIO_ZDEV_H_
> +#define _VFIO_ZDEV_H_
> +
> +#include <linux/types.h>
> +#include <linux/vfio.h>
> +
> +/**
> + * VFIO_DEVICE_INFO_CAP_ZPCI_BASE - Base PCI Function information
> + *
> + * This capability provides a set of descriptive information about the
> + * associated PCI function.
> + */
> +struct vfio_device_info_cap_zpci_base {
> + struct vfio_info_cap_header header;
> + __u64 start_dma; /* Start of available DMA addresses */
> + __u64 end_dma; /* End of available DMA addresses */
> + __u16 pchid; /* Physical Channel ID */
> + __u16 vfn; /* Virtual function number */
> + __u16 fmb_length; /* Measurement Block Length (in bytes) */
> + __u8 pft; /* PCI Function Type */
> + __u8 gid; /* PCI function group ID */
> +};
> +
> +/**
> + * VFIO_DEVICE_INFO_CAP_ZPCI_GROUP - Base PCI Function Group information
> + *
> + * This capability provides a set of descriptive information about the group of
> + * PCI functions that the associated device belongs to.
> + */
> +struct vfio_device_info_cap_zpci_group {
> + struct vfio_info_cap_header header;
> + __u64 dasm; /* DMA Address space mask */
> + __u64 msi_addr; /* MSI address */
> + __u64 flags;
> +#define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1 /* Program-specified TLB refresh */
> + __u16 mui; /* Measurement Block Update Interval */
> + __u16 noi; /* Maximum number of MSIs */
> + __u16 maxstbl; /* Maximum Store Block Length */
> + __u8 version; /* Supported PCI Version */
> +};
> +
> +/**
> + * VFIO_DEVICE_INFO_CAP_ZPCI_UTIL - Utility String
> + *
> + * This capability provides the utility string for the associated device, which
> + * is a device identifier string made up of EBCDID characters. 'size' specifies
> + * the length of 'util_str'.
> + */
> +struct vfio_device_info_cap_zpci_util {
> + struct vfio_info_cap_header header;
> + __u32 size;
> + __u8 util_str[];
> +};
> +
> +/**
> + * VFIO_DEVICE_INFO_CAP_ZPCI_PFIP - PCI Function Path
> + *
> + * This capability provides the PCI function path string, which is an identifier
> + * that describes the internal hardware path of the device. 'size' specifies
> + * the length of 'pfip'.
> + */
> +struct vfio_device_info_cap_zpci_pfip {
> + struct vfio_info_cap_header header;
> + __u32 size;
> + __u8 pfip[];
> +};
> +
> +#endif
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO
2020-10-07 18:56 ` [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO Matthew Rosato
2020-10-07 20:21 ` Alex Williamson
@ 2020-10-09 9:38 ` Cornelia Huck
1 sibling, 0 replies; 16+ messages in thread
From: Cornelia Huck @ 2020-10-09 9:38 UTC (permalink / raw)
To: Matthew Rosato
Cc: alex.williamson, schnelle, pmorel, borntraeger, hca, gor,
gerald.schaefer, linux-s390, kvm, linux-kernel
On Wed, 7 Oct 2020 14:56:22 -0400
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> Allow the VFIO_DEVICE_GET_INFO ioctl to include a capability chain.
> Add a flag indicating capability chain support, and introduce the
> definitions for the first set of capabilities which are specified to
> s390 zPCI devices.
>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
> include/uapi/linux/vfio.h | 11 ++++++
> include/uapi/linux/vfio_zdev.h | 78 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 89 insertions(+)
> create mode 100644 include/uapi/linux/vfio_zdev.h
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
` (2 preceding siblings ...)
2020-10-07 18:56 ` [PATCH v3 3/5] vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO Matthew Rosato
@ 2020-10-07 18:56 ` Matthew Rosato
2020-10-07 21:32 ` Alex Williamson
` (3 more replies)
2020-10-07 18:56 ` [PATCH v3 5/5] MAINTAINERS: Add entry for s390 vfio-pci Matthew Rosato
` (2 subsequent siblings)
6 siblings, 4 replies; 16+ messages in thread
From: Matthew Rosato @ 2020-10-07 18:56 UTC (permalink / raw)
To: alex.williamson, cohuck, schnelle
Cc: pmorel, borntraeger, hca, gor, gerald.schaefer, linux-s390, kvm,
linux-kernel
Define a new configuration entry VFIO_PCI_ZDEV for VFIO/PCI.
When this s390-only feature is configured we add capabilities to the
VFIO_DEVICE_GET_INFO ioctl that describe features of the associated
zPCI device and its underlying hardware.
This patch is based on work previously done by Pierre Morel.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
drivers/vfio/pci/Kconfig | 13 ++++
drivers/vfio/pci/Makefile | 1 +
drivers/vfio/pci/vfio_pci.c | 37 ++++++++++
drivers/vfio/pci/vfio_pci_private.h | 12 +++
drivers/vfio/pci/vfio_pci_zdev.c | 143 ++++++++++++++++++++++++++++++++++++
5 files changed, 206 insertions(+)
create mode 100644 drivers/vfio/pci/vfio_pci_zdev.c
diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig
index ac3c1dd..6adf37a 100644
--- a/drivers/vfio/pci/Kconfig
+++ b/drivers/vfio/pci/Kconfig
@@ -45,3 +45,16 @@ config VFIO_PCI_NVLINK2
depends on VFIO_PCI && PPC_POWERNV
help
VFIO PCI support for P9 Witherspoon machine with NVIDIA V100 GPUs
+
+config VFIO_PCI_ZDEV
+ bool "VFIO PCI ZPCI device CLP support"
+ depends on VFIO_PCI && S390
+ default y
+ help
+ Enabling this option exposes VFIO capabilities containing hardware
+ configuration for zPCI devices. This enables userspace (e.g. QEMU)
+ to supply proper configuration values instead of hard-coded defaults
+ for zPCI devices passed through via VFIO on s390.
+
+ Say Y here.
+
diff --git a/drivers/vfio/pci/Makefile b/drivers/vfio/pci/Makefile
index f027f8a..781e080 100644
--- a/drivers/vfio/pci/Makefile
+++ b/drivers/vfio/pci/Makefile
@@ -3,5 +3,6 @@
vfio-pci-y := vfio_pci.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o
vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o
vfio-pci-$(CONFIG_VFIO_PCI_NVLINK2) += vfio_pci_nvlink2.o
+vfio-pci-$(CONFIG_VFIO_PCI_ZDEV) += vfio_pci_zdev.o
obj-$(CONFIG_VFIO_PCI) += vfio-pci.o
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 1ab1f5c..208dea5 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -807,15 +807,25 @@ static long vfio_pci_ioctl(void *device_data,
if (cmd == VFIO_DEVICE_GET_INFO) {
struct vfio_device_info info;
+ struct vfio_info_cap caps = { .buf = NULL, .size = 0 };
+ unsigned long capsz;
minsz = offsetofend(struct vfio_device_info, num_irqs);
+ /* For backward compatibility, cannot require this */
+ capsz = offsetofend(struct vfio_iommu_type1_info, cap_offset);
+
if (copy_from_user(&info, (void __user *)arg, minsz))
return -EFAULT;
if (info.argsz < minsz)
return -EINVAL;
+ if (info.argsz >= capsz) {
+ minsz = capsz;
+ info.cap_offset = 0;
+ }
+
info.flags = VFIO_DEVICE_FLAGS_PCI;
if (vdev->reset_works)
@@ -824,6 +834,33 @@ static long vfio_pci_ioctl(void *device_data,
info.num_regions = VFIO_PCI_NUM_REGIONS + vdev->num_regions;
info.num_irqs = VFIO_PCI_NUM_IRQS;
+ if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV)) {
+ int ret = vfio_pci_info_zdev_add_caps(vdev, &caps);
+
+ if (ret && ret != -ENODEV) {
+ pci_warn(vdev->pdev, "Failed to setup zPCI info capabilities\n");
+ return ret;
+ }
+ }
+
+ if (caps.size) {
+ info.flags |= VFIO_DEVICE_FLAGS_CAPS;
+ if (info.argsz < sizeof(info) + caps.size) {
+ info.argsz = sizeof(info) + caps.size;
+ } else {
+ vfio_info_cap_shift(&caps, sizeof(info));
+ if (copy_to_user((void __user *)arg +
+ sizeof(info), caps.buf,
+ caps.size)) {
+ kfree(caps.buf);
+ return -EFAULT;
+ }
+ info.cap_offset = sizeof(info);
+ }
+
+ kfree(caps.buf);
+ }
+
return copy_to_user((void __user *)arg, &info, minsz) ?
-EFAULT : 0;
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index 61ca8ab..9d28484 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -213,4 +213,16 @@ static inline int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
return -ENODEV;
}
#endif
+
+#ifdef CONFIG_VFIO_PCI_ZDEV
+extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps);
+#else
+static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps);
+{
+ return -ENODEV;
+}
+#endif
+
#endif /* VFIO_PCI_PRIVATE_H */
diff --git a/drivers/vfio/pci/vfio_pci_zdev.c b/drivers/vfio/pci/vfio_pci_zdev.c
new file mode 100644
index 0000000..2296856
--- /dev/null
+++ b/drivers/vfio/pci/vfio_pci_zdev.c
@@ -0,0 +1,143 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * VFIO ZPCI devices support
+ *
+ * Copyright (C) IBM Corp. 2020. All rights reserved.
+ * Author(s): Pierre Morel <pmorel@linux.ibm.com>
+ * Matthew Rosato <mjrosato@linux.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#include <linux/io.h>
+#include <linux/pci.h>
+#include <linux/uaccess.h>
+#include <linux/vfio.h>
+#include <linux/vfio_zdev.h>
+#include <asm/pci_clp.h>
+#include <asm/pci_io.h>
+
+#include "vfio_pci_private.h"
+
+/*
+ * Add the Base PCI Function information to the device info region.
+ */
+static int zpci_base_cap(struct zpci_dev *zdev, struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps)
+{
+ struct vfio_device_info_cap_zpci_base cap = {
+ .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_BASE,
+ .header.version = 1,
+ .start_dma = zdev->start_dma,
+ .end_dma = zdev->end_dma,
+ .pchid = zdev->pchid,
+ .vfn = zdev->vfn,
+ .fmb_length = zdev->fmb_length,
+ .pft = zdev->pft,
+ .gid = zdev->pfgid
+ };
+
+ return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
+}
+
+/*
+ * Add the Base PCI Function Group information to the device info region.
+ */
+static int zpci_group_cap(struct zpci_dev *zdev, struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps)
+{
+ struct vfio_device_info_cap_zpci_group cap = {
+ .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_GROUP,
+ .header.version = 1,
+ .dasm = zdev->dma_mask,
+ .msi_addr = zdev->msi_addr,
+ .flags = VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH,
+ .mui = zdev->fmb_update,
+ .noi = zdev->max_msi,
+ .maxstbl = ZPCI_MAX_WRITE_SIZE,
+ .version = zdev->version
+ };
+
+ return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
+}
+
+/*
+ * Add the device utility string to the device info region.
+ */
+static int zpci_util_cap(struct zpci_dev *zdev, struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps)
+{
+ struct vfio_device_info_cap_zpci_util *cap;
+ int cap_size = sizeof(*cap) + CLP_UTIL_STR_LEN;
+ int ret;
+
+ cap = kmalloc(cap_size, GFP_KERNEL);
+
+ cap->header.id = VFIO_DEVICE_INFO_CAP_ZPCI_UTIL;
+ cap->header.version = 1;
+ cap->size = CLP_UTIL_STR_LEN;
+ memcpy(cap->util_str, zdev->util_str, cap->size);
+
+ ret = vfio_info_add_capability(caps, &cap->header, cap_size);
+
+ kfree(cap);
+
+ return ret;
+}
+
+/*
+ * Add the function path string to the device info region.
+ */
+static int zpci_pfip_cap(struct zpci_dev *zdev, struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps)
+{
+ struct vfio_device_info_cap_zpci_pfip *cap;
+ int cap_size = sizeof(*cap) + CLP_PFIP_NR_SEGMENTS;
+ int ret;
+
+ cap = kmalloc(cap_size, GFP_KERNEL);
+
+ cap->header.id = VFIO_DEVICE_INFO_CAP_ZPCI_PFIP;
+ cap->header.version = 1;
+ cap->size = CLP_PFIP_NR_SEGMENTS;
+ memcpy(cap->pfip, zdev->pfip, cap->size);
+
+ ret = vfio_info_add_capability(caps, &cap->header, cap_size);
+
+ kfree(cap);
+
+ return ret;
+}
+
+/*
+ * Add all supported capabilities to the VFIO_DEVICE_GET_INFO capability chain.
+ */
+int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
+ struct vfio_info_cap *caps)
+{
+ struct zpci_dev *zdev = to_zpci(vdev->pdev);
+ int ret;
+
+ if (!zdev)
+ return -ENODEV;
+
+ ret = zpci_base_cap(zdev, vdev, caps);
+ if (ret)
+ return ret;
+
+ ret = zpci_group_cap(zdev, vdev, caps);
+ if (ret)
+ return ret;
+
+ if (zdev->util_str_avail) {
+ ret = zpci_util_cap(zdev, vdev, caps);
+ if (ret)
+ return ret;
+ }
+
+ ret = zpci_pfip_cap(zdev, vdev, caps);
+
+ return ret;
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
2020-10-07 18:56 ` [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO Matthew Rosato
@ 2020-10-07 21:32 ` Alex Williamson
2020-10-07 23:03 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Alex Williamson @ 2020-10-07 21:32 UTC (permalink / raw)
To: Matthew Rosato
Cc: cohuck, schnelle, pmorel, borntraeger, hca, gor, gerald.schaefer,
linux-s390, kvm, linux-kernel
On Wed, 7 Oct 2020 14:56:23 -0400
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
> index 61ca8ab..9d28484 100644
> --- a/drivers/vfio/pci/vfio_pci_private.h
> +++ b/drivers/vfio/pci/vfio_pci_private.h
> @@ -213,4 +213,16 @@ static inline int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
> return -ENODEV;
> }
> #endif
> +
> +#ifdef CONFIG_VFIO_PCI_ZDEV
> +extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
> + struct vfio_info_cap *caps);
> +#else
> +static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
> + struct vfio_info_cap *caps);
Ooops......................................................................^
Fixed. Thanks,
Alex
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
2020-10-07 18:56 ` [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO Matthew Rosato
@ 2020-10-07 23:03 ` kernel test robot
2020-10-07 23:03 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-10-07 23:03 UTC (permalink / raw)
To: Matthew Rosato, alex.williamson, cohuck, schnelle
Cc: kbuild-all, pmorel, borntraeger, hca, gor, gerald.schaefer,
linux-s390, kvm
[-- Attachment #1: Type: text/plain, Size: 2885 bytes --]
Hi Matthew,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on s390/features linus/master kvms390/next v5.9-rc8 next-20201007]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
base: https://github.com/awilliam/linux-vfio.git next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
git checkout c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
In file included from drivers/vfio/pci/vfio_pci.c:31:
>> drivers/vfio/pci/vfio_pci_private.h:223:1: error: expected identifier or '(' before '{' token
223 | {
| ^
>> drivers/vfio/pci/vfio_pci_private.h:221:19: warning: 'vfio_pci_info_zdev_add_caps' used but never defined
221 | static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from drivers/vfio/pci/vfio_pci_intrs.c:23:
>> drivers/vfio/pci/vfio_pci_private.h:223:1: error: expected identifier or '(' before '{' token
223 | {
| ^
drivers/vfio/pci/vfio_pci_private.h:221:19: warning: 'vfio_pci_info_zdev_add_caps' declared 'static' but never defined [-Wunused-function]
221 | static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +223 drivers/vfio/pci/vfio_pci_private.h
216
217 #ifdef CONFIG_VFIO_PCI_ZDEV
218 extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
219 struct vfio_info_cap *caps);
220 #else
> 221 static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
222 struct vfio_info_cap *caps);
> 223 {
224 return -ENODEV;
225 }
226 #endif
227
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65045 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
@ 2020-10-07 23:03 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-10-07 23:03 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2950 bytes --]
Hi Matthew,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on s390/features linus/master kvms390/next v5.9-rc8 next-20201007]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
base: https://github.com/awilliam/linux-vfio.git next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
git checkout c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
In file included from drivers/vfio/pci/vfio_pci.c:31:
>> drivers/vfio/pci/vfio_pci_private.h:223:1: error: expected identifier or '(' before '{' token
223 | {
| ^
>> drivers/vfio/pci/vfio_pci_private.h:221:19: warning: 'vfio_pci_info_zdev_add_caps' used but never defined
221 | static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from drivers/vfio/pci/vfio_pci_intrs.c:23:
>> drivers/vfio/pci/vfio_pci_private.h:223:1: error: expected identifier or '(' before '{' token
223 | {
| ^
drivers/vfio/pci/vfio_pci_private.h:221:19: warning: 'vfio_pci_info_zdev_add_caps' declared 'static' but never defined [-Wunused-function]
221 | static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +223 drivers/vfio/pci/vfio_pci_private.h
216
217 #ifdef CONFIG_VFIO_PCI_ZDEV
218 extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
219 struct vfio_info_cap *caps);
220 #else
> 221 static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
222 struct vfio_info_cap *caps);
> 223 {
224 return -ENODEV;
225 }
226 #endif
227
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 65045 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
2020-10-07 18:56 ` [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO Matthew Rosato
@ 2020-10-08 5:08 ` kernel test robot
2020-10-07 23:03 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-10-08 5:08 UTC (permalink / raw)
To: Matthew Rosato, alex.williamson, cohuck, schnelle
Cc: kbuild-all, clang-built-linux, pmorel, borntraeger, hca, gor,
gerald.schaefer, linux-s390, kvm
[-- Attachment #1: Type: text/plain, Size: 2332 bytes --]
Hi Matthew,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on s390/features linus/master kvms390/next v5.9-rc8 next-20201007]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
base: https://github.com/awilliam/linux-vfio.git next
config: x86_64-randconfig-a016-20201008 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4d1d8ae7100ec3c7e1709addb7b3ec6f9ad0b44f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
git checkout c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/vfio/pci/vfio_pci.c:31:
>> drivers/vfio/pci/vfio_pci_private.h:223:1: error: expected identifier or '('
{
^
1 error generated.
vim +223 drivers/vfio/pci/vfio_pci_private.h
216
217 #ifdef CONFIG_VFIO_PCI_ZDEV
218 extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
219 struct vfio_info_cap *caps);
220 #else
221 static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
222 struct vfio_info_cap *caps);
> 223 {
224 return -ENODEV;
225 }
226 #endif
227
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32180 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
@ 2020-10-08 5:08 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-10-08 5:08 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2389 bytes --]
Hi Matthew,
I love your patch! Yet something to improve:
[auto build test ERROR on vfio/next]
[also build test ERROR on s390/features linus/master kvms390/next v5.9-rc8 next-20201007]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
base: https://github.com/awilliam/linux-vfio.git next
config: x86_64-randconfig-a016-20201008 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4d1d8ae7100ec3c7e1709addb7b3ec6f9ad0b44f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matthew-Rosato/Pass-zPCI-hardware-information-via-VFIO/20201008-034906
git checkout c09b4427b95cc448fb0ed2a4b3125643dea2bc7b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/vfio/pci/vfio_pci.c:31:
>> drivers/vfio/pci/vfio_pci_private.h:223:1: error: expected identifier or '('
{
^
1 error generated.
vim +223 drivers/vfio/pci/vfio_pci_private.h
216
217 #ifdef CONFIG_VFIO_PCI_ZDEV
218 extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
219 struct vfio_info_cap *caps);
220 #else
221 static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
222 struct vfio_info_cap *caps);
> 223 {
224 return -ENODEV;
225 }
226 #endif
227
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32180 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
2020-10-07 18:56 ` [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO Matthew Rosato
` (2 preceding siblings ...)
2020-10-08 5:08 ` kernel test robot
@ 2020-10-09 9:44 ` Cornelia Huck
3 siblings, 0 replies; 16+ messages in thread
From: Cornelia Huck @ 2020-10-09 9:44 UTC (permalink / raw)
To: Matthew Rosato
Cc: alex.williamson, schnelle, pmorel, borntraeger, hca, gor,
gerald.schaefer, linux-s390, kvm, linux-kernel
On Wed, 7 Oct 2020 14:56:23 -0400
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> Define a new configuration entry VFIO_PCI_ZDEV for VFIO/PCI.
>
> When this s390-only feature is configured we add capabilities to the
> VFIO_DEVICE_GET_INFO ioctl that describe features of the associated
> zPCI device and its underlying hardware.
>
> This patch is based on work previously done by Pierre Morel.
>
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
> drivers/vfio/pci/Kconfig | 13 ++++
> drivers/vfio/pci/Makefile | 1 +
> drivers/vfio/pci/vfio_pci.c | 37 ++++++++++
> drivers/vfio/pci/vfio_pci_private.h | 12 +++
> drivers/vfio/pci/vfio_pci_zdev.c | 143 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 206 insertions(+)
> create mode 100644 drivers/vfio/pci/vfio_pci_zdev.c
With the compilation fix,
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 5/5] MAINTAINERS: Add entry for s390 vfio-pci
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
` (3 preceding siblings ...)
2020-10-07 18:56 ` [PATCH v3 4/5] vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO Matthew Rosato
@ 2020-10-07 18:56 ` Matthew Rosato
2020-10-07 19:18 ` [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
2020-10-07 19:39 ` Alex Williamson
6 siblings, 0 replies; 16+ messages in thread
From: Matthew Rosato @ 2020-10-07 18:56 UTC (permalink / raw)
To: alex.williamson, cohuck, schnelle
Cc: pmorel, borntraeger, hca, gor, gerald.schaefer, linux-s390, kvm,
linux-kernel
Add myself to cover s390-specific items related to vfio-pci.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
---
MAINTAINERS | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9a54806..a0e8d14 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15170,6 +15170,14 @@ F: Documentation/s390/vfio-ccw.rst
F: drivers/s390/cio/vfio_ccw*
F: include/uapi/linux/vfio_ccw.h
+S390 VFIO-PCI DRIVER
+M: Matthew Rosato <mjrosato@linux.ibm.com>
+L: linux-s390@vger.kernel.org
+L: kvm@vger.kernel.org
+S: Supported
+F: drivers/vfio/pci/vfio_pci_zdev.c
+F: include/uapi/linux/vfio_zdev.h
+
S390 ZCRYPT DRIVER
M: Harald Freudenberger <freude@linux.ibm.com>
L: linux-s390@vger.kernel.org
--
1.8.3.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/5] Pass zPCI hardware information via VFIO
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
` (4 preceding siblings ...)
2020-10-07 18:56 ` [PATCH v3 5/5] MAINTAINERS: Add entry for s390 vfio-pci Matthew Rosato
@ 2020-10-07 19:18 ` Matthew Rosato
2020-10-07 19:39 ` Alex Williamson
6 siblings, 0 replies; 16+ messages in thread
From: Matthew Rosato @ 2020-10-07 19:18 UTC (permalink / raw)
To: alex.williamson, cohuck, schnelle
Cc: pmorel, borntraeger, hca, gor, gerald.schaefer, linux-s390, kvm,
linux-kernel
On 10/7/20 2:56 PM, Matthew Rosato wrote:
> This patchset provides a means by which hardware information about the
> underlying PCI device can be passed up to userspace (ie, QEMU) so that
> this hardware information can be used rather than previously hard-coded
> assumptions. The VFIO_DEVICE_GET_INFO ioctl is extended to allow capability
> chains and zPCI devices provide the hardware information via capabilities.
>
> A form of these patches saw some rounds last year but has been back-
> tabled for a while. The original work for this feature was done by Pierre
> Morel. I'd like to refresh the discussion on this and get this finished up
> so that we can move forward with better-supporting additional types of
> PCI-attached devices.
>
> This feature is toggled via the CONFIG_VFIO_PCI_ZDEV configuration entry.
>
> Changes since v2:
> - Added ACKs (thanks!)
> - Patch 3+4: Re-write to use VFIO_DEVICE_GET_INFO capabilities rather than
> a vfio device region.
Link to latest QEMU patch set:
https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg01948.html
>
> Matthew Rosato (5):
> s390/pci: stash version in the zpci_dev
> s390/pci: track whether util_str is valid in the zpci_dev
> vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO
> vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
> MAINTAINERS: Add entry for s390 vfio-pci
>
> MAINTAINERS | 8 ++
> arch/s390/include/asm/pci.h | 4 +-
> arch/s390/pci/pci_clp.c | 2 +
> drivers/vfio/pci/Kconfig | 13 ++++
> drivers/vfio/pci/Makefile | 1 +
> drivers/vfio/pci/vfio_pci.c | 37 ++++++++++
> drivers/vfio/pci/vfio_pci_private.h | 12 +++
> drivers/vfio/pci/vfio_pci_zdev.c | 143 ++++++++++++++++++++++++++++++++++++
> include/uapi/linux/vfio.h | 11 +++
> include/uapi/linux/vfio_zdev.h | 78 ++++++++++++++++++++
> 10 files changed, 308 insertions(+), 1 deletion(-)
> create mode 100644 drivers/vfio/pci/vfio_pci_zdev.c
> create mode 100644 include/uapi/linux/vfio_zdev.h
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v3 0/5] Pass zPCI hardware information via VFIO
2020-10-07 18:56 [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
` (5 preceding siblings ...)
2020-10-07 19:18 ` [PATCH v3 0/5] Pass zPCI hardware information via VFIO Matthew Rosato
@ 2020-10-07 19:39 ` Alex Williamson
6 siblings, 0 replies; 16+ messages in thread
From: Alex Williamson @ 2020-10-07 19:39 UTC (permalink / raw)
To: Matthew Rosato
Cc: cohuck, schnelle, pmorel, borntraeger, hca, gor, gerald.schaefer,
linux-s390, kvm, linux-kernel
On Wed, 7 Oct 2020 14:56:19 -0400
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> This patchset provides a means by which hardware information about the
> underlying PCI device can be passed up to userspace (ie, QEMU) so that
> this hardware information can be used rather than previously hard-coded
> assumptions. The VFIO_DEVICE_GET_INFO ioctl is extended to allow capability
> chains and zPCI devices provide the hardware information via capabilities.
>
> A form of these patches saw some rounds last year but has been back-
> tabled for a while. The original work for this feature was done by Pierre
> Morel. I'd like to refresh the discussion on this and get this finished up
> so that we can move forward with better-supporting additional types of
> PCI-attached devices.
>
> This feature is toggled via the CONFIG_VFIO_PCI_ZDEV configuration entry.
>
> Changes since v2:
> - Added ACKs (thanks!)
> - Patch 3+4: Re-write to use VFIO_DEVICE_GET_INFO capabilities rather than
> a vfio device region.
Looks good to me, I'll let Connie and others double check and throw in
their reviews, but I'll plan to include this for v5.10. Thanks,
Alex
> Matthew Rosato (5):
> s390/pci: stash version in the zpci_dev
> s390/pci: track whether util_str is valid in the zpci_dev
> vfio: Introduce capability definitions for VFIO_DEVICE_GET_INFO
> vfio-pci/zdev: Add zPCI capabilities to VFIO_DEVICE_GET_INFO
> MAINTAINERS: Add entry for s390 vfio-pci
>
> MAINTAINERS | 8 ++
> arch/s390/include/asm/pci.h | 4 +-
> arch/s390/pci/pci_clp.c | 2 +
> drivers/vfio/pci/Kconfig | 13 ++++
> drivers/vfio/pci/Makefile | 1 +
> drivers/vfio/pci/vfio_pci.c | 37 ++++++++++
> drivers/vfio/pci/vfio_pci_private.h | 12 +++
> drivers/vfio/pci/vfio_pci_zdev.c | 143 ++++++++++++++++++++++++++++++++++++
> include/uapi/linux/vfio.h | 11 +++
> include/uapi/linux/vfio_zdev.h | 78 ++++++++++++++++++++
> 10 files changed, 308 insertions(+), 1 deletion(-)
> create mode 100644 drivers/vfio/pci/vfio_pci_zdev.c
> create mode 100644 include/uapi/linux/vfio_zdev.h
>
^ permalink raw reply [flat|nested] 16+ messages in thread