Skip to contentSkip to conversation

vfio/pci: remove CONFIG_VFIO_PCI_ZDEV from Kconfig

PATCH In review Max Gurtovoy 3 participants 3 messages Feb 18, 2021 – Feb 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio/pci: remove CONFIG_VFIO_PCI_ZDEV from Kconfig

In case we're running on s390 system always expose the capabilities for configuration of zPCI devices. In case we're running on different platform, continue as usual.

---
 drivers/vfio/pci/Kconfig            | 12 ------------
 drivers/vfio/pci/Makefile           |  2 +-
 drivers/vfio/pci/vfio_pci.c         | 12 +++++-------
 drivers/vfio/pci/vfio_pci_private.h |  2 +-
 4 files changed, 7 insertions(+), 21 deletions(-)
drivers/vfio/pci/Kconfig +0 -12
index 40a223381ab6..ac3c1dd3edef 100644
@@ -45,15 +45,3 @@ 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.
drivers/vfio/pci/Makefile +1 -1
index 781e0809d6ee..eff97a7cd9f1 100644
@@ -3,6 +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
+vfio-pci-$(CONFIG_S390) += vfio_pci_zdev.o
 
 obj-$(CONFIG_VFIO_PCI) += vfio-pci.o
drivers/vfio/pci/vfio_pci.c +5 -7
index 706de3ef94bb..65e7e6b44578 100644
@@ -807,6 +807,7 @@ static long vfio_pci_ioctl(void *device_data,
 		struct vfio_device_info info;
 		struct vfio_info_cap caps = { .buf = NULL, .size = 0 };
 		unsigned long capsz;
+		int ret;
 
 		minsz = offsetofend(struct vfio_device_info, num_irqs);
 
@@ -832,13 +833,10 @@ 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;
-			}
+		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) {
drivers/vfio/pci/vfio_pci_private.h +1 -1
index 5c90e560c5c7..9cd1882a05af 100644
@@ -214,7 +214,7 @@ static inline int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
 }
 #endif
 
-#ifdef CONFIG_VFIO_PCI_ZDEV
+#ifdef CONFIG_S390
 extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
 				       struct vfio_info_cap *caps);
 #else
Signature · 1 line
2.25.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Max Gurtovoy

In case we're running on s390 system always expose the capabilities for configuration of zPCI devices. In case we're running on different platform, continue as usual.

Sanity-tested on s390 to verify that zdev caps are still available after CONFIG_VFIO_PCI_ZDEV is removed.

Quoted 83 lines
---
  drivers/vfio/pci/Kconfig            | 12 ------------
  drivers/vfio/pci/Makefile           |  2 +-
  drivers/vfio/pci/vfio_pci.c         | 12 +++++-------
  drivers/vfio/pci/vfio_pci_private.h |  2 +-
  4 files changed, 7 insertions(+), 21 deletions(-)
drivers/vfio/pci/Kconfig +0 -12
index 40a223381ab6..ac3c1dd3edef 100644
@@ -45,15 +45,3 @@ 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.
drivers/vfio/pci/Makefile +1 -1
index 781e0809d6ee..eff97a7cd9f1 100644
@@ -3,6 +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
+vfio-pci-$(CONFIG_S390) += vfio_pci_zdev.o
 
  obj-$(CONFIG_VFIO_PCI) += vfio-pci.o
drivers/vfio/pci/vfio_pci.c +5 -7
index 706de3ef94bb..65e7e6b44578 100644
@@ -807,6 +807,7 @@ static long vfio_pci_ioctl(void *device_data,
  		struct vfio_device_info info;
  		struct vfio_info_cap caps = { .buf = NULL, .size = 0 };
  		unsigned long capsz;
+		int ret;
 
  		minsz = offsetofend(struct vfio_device_info, num_irqs);
 
@@ -832,13 +833,10 @@ 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;
-			}
+		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) {
drivers/vfio/pci/vfio_pci_private.h +1 -1
index 5c90e560c5c7..9cd1882a05af 100644
@@ -214,7 +214,7 @@ static inline int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
  }
  #endif
 
-#ifdef CONFIG_VFIO_PCI_ZDEV
+#ifdef CONFIG_S390
  extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
  				       struct vfio_info_cap *caps);
  #else
Reviewed-by on v1 1/1
#2 lore raw
In reply to Max Gurtovoy
Quoted 11 lines · On Thu, 18 Feb 2021 10:44:35 +0000 Max Gurtovoy <[email protected]> wrote:

In case we're running on s390 system always expose the capabilities for configuration of zPCI devices. In case we're running on different platform, continue as usual.

---
 drivers/vfio/pci/Kconfig            | 12 ------------
 drivers/vfio/pci/Makefile           |  2 +-
 drivers/vfio/pci/vfio_pci.c         | 12 +++++-------
 drivers/vfio/pci/vfio_pci_private.h |  2 +-
 4 files changed, 7 insertions(+), 21 deletions(-)