Skip to contentSkip to conversation

remove the nvlink2 pci_vfio subdriver v2

PATCH In review Christoph Hellwig 8 participants 19 messages Mar 26, 2021 – May 4, 2021

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

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -
 drivers/vfio/pci/vfio_pci_nvlink2.c          |  490 ------------------
 16 files changed, 12 insertions(+), 1511 deletions(-)
#1 lore raw

PATCH 1/2 vfio/pci: remove vfio_pci_nvlink2

This driver never had any open userspace (which for VFIO would include VM kernel drivers) that use it, and thus should never have been added by our normal userspace ABI rules.

---
 drivers/vfio/pci/Kconfig            |   6 -
 drivers/vfio/pci/Makefile           |   1 -
 drivers/vfio/pci/vfio_pci.c         |  18 -
 drivers/vfio/pci/vfio_pci_nvlink2.c | 490 ----------------------------
 drivers/vfio/pci/vfio_pci_private.h |  14 -
 include/uapi/linux/vfio.h           |  38 +--
 6 files changed, 4 insertions(+), 563 deletions(-)
 delete mode 100644 drivers/vfio/pci/vfio_pci_nvlink2.c
drivers/vfio/pci/Kconfig +0 -6
index ac3c1dd3edeff1..53ce78d7d07be0 100644
@@ -39,9 +39,3 @@ config VFIO_PCI_IGD
 	  and LPC bridge config space.
 
 	  To enable Intel IGD assignment through vfio-pci, say Y.
-
-config VFIO_PCI_NVLINK2
-	def_bool y
-	depends on VFIO_PCI && PPC_POWERNV
-	help
-	  VFIO PCI support for P9 Witherspoon machine with NVIDIA V100 GPUs
drivers/vfio/pci/Makefile +0 -1
index eff97a7cd9f139..3ff42093962f6f 100644
@@ -2,7 +2,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_S390) += vfio_pci_zdev.o
 
 obj-$(CONFIG_VFIO_PCI) += vfio-pci.o
drivers/vfio/pci/vfio_pci.c +0 -18
index 65e7e6b44578c2..d691006b642839 100644
@@ -389,24 +389,6 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev)
 		}
 	}
 
-	if (pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
-	    IS_ENABLED(CONFIG_VFIO_PCI_NVLINK2)) {
-		ret = vfio_pci_nvdia_v100_nvlink2_init(vdev);
-		if (ret && ret != -ENODEV) {
-			pci_warn(pdev, "Failed to setup NVIDIA NV2 RAM region\n");
-			goto disable_exit;
-		}
-	}
-
-	if (pdev->vendor == PCI_VENDOR_ID_IBM &&
-	    IS_ENABLED(CONFIG_VFIO_PCI_NVLINK2)) {
-		ret = vfio_pci_ibm_npu2_init(vdev);
-		if (ret && ret != -ENODEV) {
-			pci_warn(pdev, "Failed to setup NVIDIA NV2 ATSD region\n");
-			goto disable_exit;
-		}
-	}
-
 	vfio_pci_probe_mmaps(vdev);
 
 	return 0;
drivers/vfio/pci/vfio_pci_nvlink2.c deleted +0 -490

490 lines not on this page · raw message

drivers/vfio/pci/vfio_pci_private.h +0 -14
index 9cd1882a05af69..cdae2e4cf11cca 100644
@@ -199,20 +199,6 @@ static inline int vfio_pci_igd_init(struct vfio_pci_device *vdev)
 	return -ENODEV;
 }
 #endif
-#ifdef CONFIG_VFIO_PCI_NVLINK2
-extern int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev);
-extern int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev);
-#else
-static inline int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev)
-{
-	return -ENODEV;
-}
-
-static inline int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
-{
-	return -ENODEV;
-}
-#endif
 
 #ifdef CONFIG_S390
 extern int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
include/uapi/linux/vfio.h +4 -34
index 8ce36c1d53ca11..34b1f53a3901cb 100644
@@ -333,17 +333,10 @@ struct vfio_region_info_cap_type {
 #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG	(3)
 
 /* 10de vendor PCI sub-types */
-/*
- * NVIDIA GPU NVlink2 RAM is coherent RAM mapped onto the host address space.
- */
-#define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM	(1)
+/* subtype 1 was VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM, don't use */
 
 /* 1014 vendor PCI sub-types */
-/*
- * IBM NPU NVlink2 ATSD (Address Translation Shootdown) register of NPU
- * to do TLB invalidation on a GPU.
- */
-#define VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD	(1)
+/* subtype 1 was VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD, don't use */
 
 /* sub-types for VFIO_REGION_TYPE_GFX */
 #define VFIO_REGION_SUBTYPE_GFX_EDID            (1)
@@ -637,32 +630,9 @@ struct vfio_device_migration_info {
  */
 #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE	3
 
-/*
- * Capability with compressed real address (aka SSA - small system address)
- * where GPU RAM is mapped on a system bus. Used by a GPU for DMA routing
- * and by the userspace to associate a NVLink bridge with a GPU.
- */
-#define VFIO_REGION_INFO_CAP_NVLINK2_SSATGT	4
-
-struct vfio_region_info_cap_nvlink2_ssatgt {
-	struct vfio_info_cap_header header;
-	__u64 tgt;
-};
+/* subtype 4 was VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, don't use */
 
-/*
- * Capability with an NVLink link speed. The value is read by
- * the NVlink2 bridge driver from the bridge's "ibm,nvlink-speed"
- * property in the device tree. The value is fixed in the hardware
- * and failing to provide the correct value results in the link
- * not working with no indication from the driver why.
- */
-#define VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD	5
-
-struct vfio_region_info_cap_nvlink2_lnkspd {
-	struct vfio_info_cap_header header;
-	__u32 link_speed;
-	__u32 __pad;
-};
+/* subtype 5 was VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD, don't use */
 
 /**
  * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
Signature · 1 line
2.30.1
#2 lore raw

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

Quoted 6 lines · On Fri, 26 Mar 2021 07:13:10 +0100 Christoph Hellwig <[email protected]> wrote:

This driver never had any open userspace (which for VFIO would include VM kernel drivers) that use it, and thus should never have been added by our normal userspace ABI rules.

Quoted 9 lines
---
 drivers/vfio/pci/Kconfig            |   6 -
 drivers/vfio/pci/Makefile           |   1 -
 drivers/vfio/pci/vfio_pci.c         |  18 -
 drivers/vfio/pci/vfio_pci_nvlink2.c | 490 ----------------------------
 drivers/vfio/pci/vfio_pci_private.h |  14 -
 include/uapi/linux/vfio.h           |  38 +--
 6 files changed, 4 insertions(+), 563 deletions(-)
 delete mode 100644 drivers/vfio/pci/vfio_pci_nvlink2.c

Hearing no objections, applied to vfio next branch for v5.13. Thanks,

Alex

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

Quoted 19 lines · Alex Williamson
Quoted 6 lines · On Fri, 26 Mar 2021 07:13:10 +0100 Christoph Hellwig <[email protected]> wrote:

This driver never had any open userspace (which for VFIO would include VM kernel drivers) that use it, and thus should never have been added by our normal userspace ABI rules.

Quoted 9 lines
---
 drivers/vfio/pci/Kconfig            |   6 -
 drivers/vfio/pci/Makefile           |   1 -
 drivers/vfio/pci/vfio_pci.c         |  18 -
 drivers/vfio/pci/vfio_pci_nvlink2.c | 490 ----------------------------
 drivers/vfio/pci/vfio_pci_private.h |  14 -
 include/uapi/linux/vfio.h           |  38 +--
 6 files changed, 4 insertions(+), 563 deletions(-)
 delete mode 100644 drivers/vfio/pci/vfio_pci_nvlink2.c
Quoted 1 line

Hearing no objections, applied to vfio next branch for v5.13. Thanks,

Looks like you only took patch 1?

I can't take patch 2 on its own, that would break the build.

Do you want to take both patches? There's currently no conflicts against my tree. It's possible one could appear before the v5.13 merge window, though it would probably just be something minor.

Or I could apply both patches to my tree, which means patch 1 would appear as two commits in the git history, but that's not a big deal.

cheers

#4 lore raw

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

Quoted 24 lines · On Mon, 12 Apr 2021 19:41:41 +1000 Michael Ellerman <[email protected]> wrote:
Quoted 19 lines · Alex Williamson
Quoted 6 lines · On Fri, 26 Mar 2021 07:13:10 +0100 Christoph Hellwig <[email protected]> wrote:

This driver never had any open userspace (which for VFIO would include VM kernel drivers) that use it, and thus should never have been added by our normal userspace ABI rules.

Quoted 9 lines
---
 drivers/vfio/pci/Kconfig            |   6 -
 drivers/vfio/pci/Makefile           |   1 -
 drivers/vfio/pci/vfio_pci.c         |  18 -
 drivers/vfio/pci/vfio_pci_nvlink2.c | 490 ----------------------------
 drivers/vfio/pci/vfio_pci_private.h |  14 -
 include/uapi/linux/vfio.h           |  38 +--
 6 files changed, 4 insertions(+), 563 deletions(-)
 delete mode 100644 drivers/vfio/pci/vfio_pci_nvlink2.c  
Quoted 1 line

Hearing no objections, applied to vfio next branch for v5.13. Thanks,

Looks like you only took patch 1?

Quoted 8 lines

I can't take patch 2 on its own, that would break the build.

Do you want to take both patches? There's currently no conflicts against my tree. It's possible one could appear before the v5.13 merge window, though it would probably just be something minor.

Or I could apply both patches to my tree, which means patch 1 would appear as two commits in the git history, but that's not a big deal.

I've already got a conflict in my next branch with patch 1, so it's best to go through my tree. Seems like a shared branch would be easiest to allow you to merge and manage potential conflicts against patch 2, I've pushed a branch here:

https://github.com/awilliam/linux-vfio.git v5.13/vfio/nvlink

Thanks,
Alex

#5 lore raw

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

Quoted 36 lines · Alex Williamson
Quoted 24 lines · On Mon, 12 Apr 2021 19:41:41 +1000 Michael Ellerman <[email protected]> wrote:
Quoted 19 lines · Alex Williamson
Quoted 6 lines · On Fri, 26 Mar 2021 07:13:10 +0100 Christoph Hellwig <[email protected]> wrote:

This driver never had any open userspace (which for VFIO would include VM kernel drivers) that use it, and thus should never have been added by our normal userspace ABI rules.

Quoted 9 lines
---
 drivers/vfio/pci/Kconfig            |   6 -
 drivers/vfio/pci/Makefile           |   1 -
 drivers/vfio/pci/vfio_pci.c         |  18 -
 drivers/vfio/pci/vfio_pci_nvlink2.c | 490 ----------------------------
 drivers/vfio/pci/vfio_pci_private.h |  14 -
 include/uapi/linux/vfio.h           |  38 +--
 6 files changed, 4 insertions(+), 563 deletions(-)
 delete mode 100644 drivers/vfio/pci/vfio_pci_nvlink2.c  
Quoted 1 line

Hearing no objections, applied to vfio next branch for v5.13. Thanks,

Looks like you only took patch 1?

Quoted 8 lines

I can't take patch 2 on its own, that would break the build.

Do you want to take both patches? There's currently no conflicts against my tree. It's possible one could appear before the v5.13 merge window, though it would probably just be something minor.

Or I could apply both patches to my tree, which means patch 1 would appear as two commits in the git history, but that's not a big deal.

Quoted 6 lines

I've already got a conflict in my next branch with patch 1, so it's best to go through my tree. Seems like a shared branch would be easiest to allow you to merge and manage potential conflicts against patch 2, I've pushed a branch here:

https://github.com/awilliam/linux-vfio.git v5.13/vfio/nvlink

Thanks.

My next is based on rc2, so I won't pull that in directly, because I don't want to pull all of rc6 in with it.

I'll put it in a topic branch and merge it into my next after my first pull has gone to Linus.

cheers

#6 lore raw

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

Quoted 41 lines · Michael Ellerman
Quoted 40 lines · Alex Williamson
Quoted 23 lines · On Mon, 12 Apr 2021 19:41:41 +1000 Michael Ellerman <[email protected]> wrote:
Quoted 18 lines · Alex Williamson
Quoted 6 lines · On Fri, 26 Mar 2021 07:13:10 +0100 Christoph Hellwig <[email protected]> wrote:

This driver never had any open userspace (which for VFIO would include VM kernel drivers) that use it, and thus should never have been added by our normal userspace ABI rules.

Quoted 8 lines
 drivers/vfio/pci/Kconfig            |   6 -
 drivers/vfio/pci/Makefile           |   1 -
 drivers/vfio/pci/vfio_pci.c         |  18 -
 drivers/vfio/pci/vfio_pci_nvlink2.c | 490 ----------------------------
 drivers/vfio/pci/vfio_pci_private.h |  14 -
 include/uapi/linux/vfio.h           |  38 +--
 6 files changed, 4 insertions(+), 563 deletions(-)
 delete mode 100644 drivers/vfio/pci/vfio_pci_nvlink2.c  
Quoted 1 line

Hearing no objections, applied to vfio next branch for v5.13. Thanks,

Looks like you only took patch 1?

Quoted 8 lines

I can't take patch 2 on its own, that would break the build.

Do you want to take both patches? There's currently no conflicts against my tree. It's possible one could appear before the v5.13 merge window, though it would probably just be something minor.

Or I could apply both patches to my tree, which means patch 1 would appear as two commits in the git history, but that's not a big deal.

I've already got a conflict in my next branch with patch 1, so it's best to go through my tree. Seems like a shared branch would be easiest to allow you to merge and manage potential conflicts against patch 2, I've pushed a branch here:

Quoted 6 lines
Quoted 1 line

https://github.com/awilliam/linux-vfio.git v5.13/vfio/nvlink

Thanks.

My next is based on rc2, so I won't pull that in directly, because I don't want to pull all of rc6 in with it.

Linus is fine if you merge in rc's for development reasons. He doesn't like it when people just merge rc's without a purpose.

Merge rc7 to your tree then pull the nvlink topic is acceptable.

Or just do nothing because Alex will send it through his tree - this extra co-ordination is really only necessary if there are conflicts.

Jason

#7 lore raw

PATCH 2/2 powerpc/powernv: remove the nvlink support

In reply to Christoph Hellwig

This code was only used by the vfio-nvlink2 code, which itself had no proper use. Drop this huge chunk of code build into every powernv or generic build.

---
 arch/powerpc/include/asm/opal.h            |   3 -
 arch/powerpc/include/asm/pci-bridge.h      |   1 -
 arch/powerpc/include/asm/pci.h             |   7 -
 arch/powerpc/platforms/powernv/Makefile    |   2 +-
 arch/powerpc/platforms/powernv/npu-dma.c   | 705 ---------------------
 arch/powerpc/platforms/powernv/opal-call.c |   2 -
 arch/powerpc/platforms/powernv/pci-ioda.c  | 185 +-----
 arch/powerpc/platforms/powernv/pci.c       |  11 -
 arch/powerpc/platforms/powernv/pci.h       |  17 +-
 arch/powerpc/platforms/pseries/pci.c       |  23 -
 10 files changed, 8 insertions(+), 948 deletions(-)
 delete mode 100644 arch/powerpc/platforms/powernv/npu-dma.c
arch/powerpc/include/asm/opal.h +0 -3
index 9986ac34b8e224..06eaa231697344 100644
@@ -28,9 +28,6 @@ extern struct device_node *opal_node;
 
 /* API functions */
 int64_t opal_invalid_call(void);
-int64_t opal_npu_destroy_context(uint64_t phb_id, uint64_t pid, uint64_t bdf);
-int64_t opal_npu_init_context(uint64_t phb_id, int pasid, uint64_t msr,
-			uint64_t bdf);
 int64_t opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid,
 			uint64_t lpcr);
 int64_t opal_npu_spa_setup(uint64_t phb_id, uint32_t bdfn,
arch/powerpc/include/asm/pci-bridge.h +0 -1
index d2a2a14e56f91e..74424c14515ce0 100644
@@ -126,7 +126,6 @@ struct pci_controller {
 #endif	/* CONFIG_PPC64 */
 
 	void *private_data;
-	struct npu *npu;
 };
 
 /* These are used for config access before all the PCI probing
arch/powerpc/include/asm/pci.h +0 -7
index 6436f0b41539e3..d1f53260725ca7 100644
@@ -119,11 +119,4 @@ extern void pcibios_scan_phb(struct pci_controller *hose);
 
 #endif	/* __KERNEL__ */
 
-extern struct pci_dev *pnv_pci_get_gpu_dev(struct pci_dev *npdev);
-extern struct pci_dev *pnv_pci_get_npu_dev(struct pci_dev *gpdev, int index);
-extern int pnv_npu2_init(struct pci_controller *hose);
-extern int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid,
-		unsigned long msr);
-extern int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev);
-
 #endif /* __ASM_POWERPC_PCI_H */
arch/powerpc/platforms/powernv/Makefile +1 -1
index 2eb6ae150d1fd5..be2546b968165e 100644
@@ -10,7 +10,7 @@ obj-$(CONFIG_SMP)	+= smp.o subcore.o subcore-asm.o
 obj-$(CONFIG_FA_DUMP)	+= opal-fadump.o
 obj-$(CONFIG_PRESERVE_FA_DUMP)	+= opal-fadump.o
 obj-$(CONFIG_OPAL_CORE)	+= opal-core.o
-obj-$(CONFIG_PCI)	+= pci.o pci-ioda.o npu-dma.o pci-ioda-tce.o
+obj-$(CONFIG_PCI)	+= pci.o pci-ioda.o pci-ioda-tce.o
 obj-$(CONFIG_PCI_IOV)   += pci-sriov.o
 obj-$(CONFIG_CXL_BASE)	+= pci-cxl.o
 obj-$(CONFIG_EEH)	+= eeh-powernv.o
arch/powerpc/platforms/powernv/npu-dma.c deleted +0 -705

705 lines not on this page · raw message

arch/powerpc/platforms/powernv/opal-call.c +0 -2
index 5cd0f52d258f64..01401e3da7ca14 100644
@@ -267,8 +267,6 @@ OPAL_CALL(opal_xive_get_queue_state,		OPAL_XIVE_GET_QUEUE_STATE);
 OPAL_CALL(opal_xive_set_queue_state,		OPAL_XIVE_SET_QUEUE_STATE);
 OPAL_CALL(opal_xive_get_vp_state,		OPAL_XIVE_GET_VP_STATE);
 OPAL_CALL(opal_signal_system_reset,		OPAL_SIGNAL_SYSTEM_RESET);
-OPAL_CALL(opal_npu_init_context,		OPAL_NPU_INIT_CONTEXT);
-OPAL_CALL(opal_npu_destroy_context,		OPAL_NPU_DESTROY_CONTEXT);
 OPAL_CALL(opal_npu_map_lpar,			OPAL_NPU_MAP_LPAR);
 OPAL_CALL(opal_imc_counters_init,		OPAL_IMC_COUNTERS_INIT);
 OPAL_CALL(opal_imc_counters_start,		OPAL_IMC_COUNTERS_START);
arch/powerpc/platforms/powernv/pci-ioda.c +4 -181

275 lines not on this page · raw message

arch/powerpc/platforms/powernv/pci.c +0 -11
index 9b9bca169275a8..b18468dc31ff5b 100644
@@ -926,17 +926,6 @@ void __init pnv_pci_init(void)
 	for_each_compatible_node(np, NULL, "ibm,ioda3-phb")
 		pnv_pci_init_ioda2_phb(np);
 
-	/* Look for NPU PHBs */
-	for_each_compatible_node(np, NULL, "ibm,ioda2-npu-phb")
-		pnv_pci_init_npu_phb(np);
-
-	/*
-	 * Look for NPU2 PHBs which we treat mostly as NPU PHBs with
-	 * the exception of TCE kill which requires an OPAL call.
-	 */
-	for_each_compatible_node(np, NULL, "ibm,ioda2-npu2-phb")
-		pnv_pci_init_npu_phb(np);
-
 	/* Look for NPU2 OpenCAPI PHBs */
 	for_each_compatible_node(np, NULL, "ibm,ioda2-npu2-opencapi-phb")
 		pnv_pci_init_npu2_opencapi_phb(np);
arch/powerpc/platforms/powernv/pci.h +3 -14
index 36d22920f5a3cb..c8d4f222a86fe3 100644
@@ -10,10 +10,9 @@
 struct pci_dn;
 
 enum pnv_phb_type {
-	PNV_PHB_IODA1		= 0,
-	PNV_PHB_IODA2		= 1,
-	PNV_PHB_NPU_NVLINK	= 2,
-	PNV_PHB_NPU_OCAPI	= 3,
+	PNV_PHB_IODA1,
+	PNV_PHB_IODA2,
+	PNV_PHB_NPU_OCAPI,
 };
 
 /* Precise PHB model for error management */
@@ -21,8 +20,6 @@ enum pnv_phb_model {
 	PNV_PHB_MODEL_UNKNOWN,
 	PNV_PHB_MODEL_P7IOC,
 	PNV_PHB_MODEL_PHB3,
-	PNV_PHB_MODEL_NPU,
-	PNV_PHB_MODEL_NPU2,
 };
 
 #define PNV_PCI_DIAG_BUF_SIZE	8192
@@ -81,7 +78,6 @@ struct pnv_ioda_pe {
 
 	/* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
 	struct iommu_table_group table_group;
-	struct npu_comp		*npucomp;
 
 	/* 64-bit TCE bypass region */
 	bool			tce_bypass_enabled;
@@ -289,9 +285,7 @@ extern struct iommu_table *pnv_pci_table_alloc(int nid);
 
 extern void pnv_pci_init_ioda_hub(struct device_node *np);
 extern void pnv_pci_init_ioda2_phb(struct device_node *np);
-extern void pnv_pci_init_npu_phb(struct device_node *np);
 extern void pnv_pci_init_npu2_opencapi_phb(struct device_node *np);
-extern void pnv_npu2_map_lpar(struct pnv_ioda_pe *gpe, unsigned long msr);
 extern void pnv_pci_reset_secondary_bus(struct pci_dev *dev);
 extern int pnv_eeh_phb_reset(struct pci_controller *hose, int option);
 
@@ -314,11 +308,6 @@ extern void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
 #define pe_info(pe, fmt, ...)					\
 	pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
 
-/* Nvlink functions */
-extern void pnv_npu_try_dma_set_bypass(struct pci_dev *gpdev, bool bypass);
-extern void pnv_pci_ioda2_tce_invalidate_entire(struct pnv_phb *phb, bool rm);
-extern void pnv_pci_npu_setup_iommu_groups(void);
-
 /* pci-ioda-tce.c */
 #define POWERNV_IOMMU_DEFAULT_LEVELS	2
 #define POWERNV_IOMMU_MAX_LEVELS	5
arch/powerpc/platforms/pseries/pci.c +0 -23
index 1bffbd1c9a94b1..3b6800f774c241 100644
@@ -224,8 +224,6 @@ static void __init pSeries_request_regions(void)
 
 void __init pSeries_final_fixup(void)
 {
-	struct pci_controller *hose;
-
 	pSeries_request_regions();
 
 	eeh_show_enabled();
@@ -234,27 +232,6 @@ void __init pSeries_final_fixup(void)
 	ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable;
 	ppc_md.pcibios_sriov_disable = pseries_pcibios_sriov_disable;
 #endif
-	list_for_each_entry(hose, &hose_list, list_node) {
-		struct device_node *dn = hose->dn, *nvdn;
-
-		while (1) {
-			dn = of_find_all_nodes(dn);
-			if (!dn)
-				break;
-			nvdn = of_parse_phandle(dn, "ibm,nvlink", 0);
-			if (!nvdn)
-				continue;
-			if (!of_device_is_compatible(nvdn, "ibm,npu-link"))
-				continue;
-			if (!of_device_is_compatible(nvdn->parent,
-						"ibm,power9-npu"))
-				continue;
-#ifdef CONFIG_PPC_POWERNV
-			WARN_ON_ONCE(pnv_npu2_init(hose));
-#endif
-			break;
-		}
-	}
 }
 
 /*
Signature · 1 line
2.30.1
#8 lore raw
In reply to Christoph Hellwig
Quoted 18 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

Quoted 15 lines
 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -

Hi Christoph,

FYI, these uapi changes break build of QEMU.

I guess QEMU people should take some action before this percolates to the QEMU source tree.

Cc'ing relevant QEMU lists to bring the discussion there.

Cheers,

--
Greg

Quoted 2 lines
 drivers/vfio/pci/vfio_pci_nvlink2.c          |  490 ------------------
 16 files changed, 12 insertions(+), 1511 deletions(-)
#9 lore raw
Quoted 38 lines · Greg Kurz
Quoted 18 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

Quoted 15 lines
 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

What exactly breaks?

Why does QEMU require kernel driver stuff?

thanks,

greg k-h

#10 lore raw
Quoted 9 lines · Greg Kroah-Hartman
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

What exactly breaks?

Why does QEMU require kernel driver stuff?

Looks like it pull in the uapi struct definitions unconditionally instead of having a local copy. We could fix that by just putting them back, but to me this seems like a rather broken configuration in qemu when it pulls in headers from the running/installed kernel without any feature checks before using them.

#11 lore raw
Quoted 9 lines · On Tue, 4 May 2021 15:00:39 +0200 Christoph Hellwig <[email protected]> wrote:
Quoted 8 lines · Greg Kroah-Hartman
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

What exactly breaks?

Quoted 8 lines
Quoted 1 line

Why does QEMU require kernel driver stuff?

Looks like it pull in the uapi struct definitions unconditionally instead of having a local copy. We could fix that by just putting them back, but to me this seems like a rather broken configuration in qemu when it pulls in headers from the running/installed kernel without any feature checks before using them.

It is not pulling them from the installed kernel, but from a development version to get new definitions. Removing things in the kernel requires workarounds in QEMU until it can remove those things as well. It is not a dumb update...

#12 lore raw
In reply to Greg Kroah-Hartman
Quoted 39 lines · On Tue, 4 May 2021 14:59:07 +0200 Greg Kroah-Hartman…
Quoted 38 lines · Greg Kurz
Quoted 33 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -
Quoted 6 lines
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

All macros and structure definitions that are being removed from include/uapi/linux/vfio.h by patch 1.

Quoted 2 lines

What exactly breaks?

These macros and types are used by the current QEMU code base. Next time the QEMU source tree updates its copy of the kernel headers, the compilation of affected code will fail.

Quoted 2 lines

Why does QEMU require kernel driver stuff?

Not sure to understand the question... is there a problem with QEMU using an already published uapi ?

Quoted 3 lines

thanks,

greg k-h

#13 lore raw
Quoted 52 lines · Greg Kurz
Quoted 39 lines · On Tue, 4 May 2021 14:59:07 +0200 Greg Kroah-Hartman…
Quoted 38 lines · Greg Kurz
Quoted 33 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -
Quoted 6 lines
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

All macros and structure definitions that are being removed from include/uapi/linux/vfio.h by patch 1.

Quoted 6 lines
Quoted 2 lines

What exactly breaks?

These macros and types are used by the current QEMU code base. Next time the QEMU source tree updates its copy of the kernel headers, the compilation of affected code will fail.

So does QEMU use this api that is being removed, or does it just have some odd build artifacts of the uapi things?

What exactly is the error messages here?

And if we put the uapi .h file stuff back, is that sufficient for qemu to work, as it should be checking at runtime what the kernel has / has not anyway, right?

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#14 lore raw
Quoted 56 lines · On Tue, 4 May 2021 15:30:15 +0200 Greg Kroah-Hartman…
Quoted 55 lines · Greg Kurz
Quoted 39 lines · On Tue, 4 May 2021 14:59:07 +0200 Greg Kroah-Hartman…
Quoted 38 lines · Greg Kurz
Quoted 33 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -
Quoted 6 lines
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

All macros and structure definitions that are being removed from include/uapi/linux/vfio.h by patch 1.

Quoted 2 lines

What exactly breaks?

Quoted 7 lines
Quoted 3 lines

These macros and types are used by the current QEMU code base. Next time the QEMU source tree updates its copy of the kernel headers, the compilation of affected code will fail.

So does QEMU use this api that is being removed, or does it just have some odd build artifacts of the uapi things?

These are region subtypes definition and associated capabilities. QEMU basically gets information on VFIO regions from the kernel driver and for those regions with a nvlink2 subtype, it tries to extract some more nvlink2 related info.

Quoted 2 lines

What exactly is the error messages here?

[55/143] Compiling C object libqemu-ppc64-softmmu.fa.p/hw_vfio_pci-quirks.c.o
FAILED: libqemu-ppc64-softmmu.fa.p/hw_vfio_pci-quirks.c.o
cc -Ilibqemu-ppc64-softmmu.fa.p -I. -I../.. -Itarget/ppc -I../../target/ppc -I../../capstone/include/capstone -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/pixman-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fdiagnostics-color=auto -pipe -Wall -Winvalid-pch -Werror -std=gnu99 -O2 -g -isystem /home/greg/Work/qemu/qemu-virtiofs/linux-headers -isystem linux-headers -iquote . -iquote /home/greg/Work/qemu/qemu-virtiofs -iquote /home/greg/Work/qemu/qemu-virtiofs/include -iquote /home/greg/Work/qemu/qemu-virtiofs/disas/libvixl -iquote /home/greg/Work/qemu/qemu-virtiofs/tcg/ppc -iquote /home/greg/Work/qemu/qemu-virtiofs/accel/tcg -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -W
empty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -fPIC -isystem../../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="ppc64-softmmu-config-target.h"' '-DCONFIG_DEVICES="ppc64-softmmu-config-devices.h"' -MD -MQ libqemu-ppc64-softmmu.fa.p/hw_vfio_pci-quirks.c.o -MF libqemu-ppc64-softmmu.fa.p/hw_vfio_pci-quirks.c.o.d -o libqemu-ppc64-softmmu.fa.p/hw_vfio_pci-quirks.c.o -c ../../hw/vfio/pci-quirks.c
../../hw/vfio/pci-quirks.c: In function ‘vfio_pci_nvidia_v100_ram_init’:
../../hw/vfio/pci-quirks.c:1597:36: error: ‘VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM’ undeclared (first use in this function); did you mean ‘VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD’?

                                    VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM,
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD
../../hw/vfio/pci-quirks.c:1597:36: note: each undeclared identifier is reported only once for each function it appears in
../../hw/vfio/pci-quirks.c:1603:44: error: ‘VFIO_REGION_INFO_CAP_NVLINK2_SSATGT’ undeclared (first use in this function); did you mean ‘VFIO_REGION_INFO_CAP_SPARSE_MMAP’?
     hdr = vfio_get_region_info_cap(nv2reg, VFIO_REGION_INFO_CAP_NVLINK2_SSATGT);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                            VFIO_REGION_INFO_CAP_SPARSE_MMAP
../../hw/vfio/pci-quirks.c:1624:49: error: dereferencing pointer to incomplete type ‘struct vfio_region_info_cap_nvlink2_ssatgt’
                         (void *) (uintptr_t) cap->tgt);
                                                 ^~
../../hw/vfio/pci-quirks.c: In function ‘vfio_pci_nvlink2_init’:
../../hw/vfio/pci-quirks.c:1646:36: error: ‘VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD’ undeclared (first use in this function); did you mean ‘VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD’?
                                    VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD,
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD
../../hw/vfio/pci-quirks.c:1653:36: error: ‘VFIO_REGION_INFO_CAP_NVLINK2_SSATGT’ undeclared (first use in this function); did you mean ‘VFIO_REGION_INFO_CAP_SPARSE_MMAP’?
                                    VFIO_REGION_INFO_CAP_NVLINK2_SSATGT);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    VFIO_REGION_INFO_CAP_SPARSE_MMAP
../../hw/vfio/pci-quirks.c:1661:36: error: ‘VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD’ undeclared (first use in this function); did you mean ‘VFIO_REGION_INFO_CAP_SPARSE_MMAP’?
                                    VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    VFIO_REGION_INFO_CAP_SPARSE_MMAP
../../hw/vfio/pci-quirks.c:1685:52: error: dereferencing pointer to incomplete type ‘struct vfio_region_info_cap_nvlink2_ssatgt’
                         (void *) (uintptr_t) captgt->tgt);
                                                    ^~
../../hw/vfio/pci-quirks.c:1691:54: error: dereferencing pointer to incomplete type ‘struct vfio_region_info_cap_nvlink2_lnkspd’
                         (void *) (uintptr_t) capspeed->link_speed);
                                                      ^~
Quoted 4 lines

And if we put the uapi .h file stuff back, is that sufficient for qemu to work, as it should be checking at runtime what the kernel has / has not anyway, right?

Right. This will just be dead code in QEMU for newer kernels.

Anyway, as said in some other mail, it is probably time for QEMU to start deprecating this code as well.

Quoted 3 lines

thanks,

greg k-h

#15 lore raw
Quoted 63 lines · On Tue, 4 May 2021 16:11:31 +0200 Greg Kurz <[email protected]> wrote:
Quoted 60 lines · On Tue, 4 May 2021 15:30:15 +0200 Greg Kroah-Hartman…
Quoted 58 lines · Greg Kurz
Quoted 39 lines · On Tue, 4 May 2021 14:59:07 +0200 Greg Kroah-Hartman…
Quoted 38 lines · Greg Kurz
Quoted 33 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -  
Quoted 6 lines
Quoted 3 lines

Hi Christoph,

FYI, these uapi changes break build of QEMU.

What uapi changes?

All macros and structure definitions that are being removed from include/uapi/linux/vfio.h by patch 1.

Quoted 2 lines

What exactly breaks?

These macros and types are used by the current QEMU code base. Next time the QEMU source tree updates its copy of the kernel headers, the compilation of affected code will fail.

Quoted 8 lines
Quoted 3 lines

So does QEMU use this api that is being removed, or does it just have some odd build artifacts of the uapi things?

These are region subtypes definition and associated capabilities. QEMU basically gets information on VFIO regions from the kernel driver and for those regions with a nvlink2 subtype, it tries to extract some more nvlink2 related info.

Urgh, let's put the uapi header back in place with a deprecation notice. Userspace should never have a dependency on the existence of a given region, but clearly will have code to parse the data structure describing that region. I'll post a patch. Thanks,

Alex

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#16 lore raw
In reply to Greg Kurz
Quoted 44 lines · Greg Kurz
Quoted 41 lines · On Tue, 4 May 2021 14:59:07 +0200 Greg Kroah-Hartman…
Quoted 40 lines · Greg Kurz
Quoted 18 lines · On Fri, 26 Mar 2021 07:13:09 +0100 Christoph Hellwig <[email protected]> wrote:

Hi all,

the nvlink2 vfio subdriver is a weird beast. It supports a hardware feature without any open source component - what would normally be the normal open source userspace that we require for kernel drivers, although in this particular case user space could of course be a kernel driver in a VM. It also happens to be a complete mess that does not properly bind to PCI IDs, is hacked into the vfio_pci driver and also pulles in over 1000 lines of code always build into powerpc kernels that have Power NV support enabled. Because of all these issues and the lack of breaking userspace when it is removed I think the best idea is to simply kill.

Changes since v1:
- document the removed subtypes as reserved
- add the ACK from Greg

Diffstat:

Quoted 15 lines
 arch/powerpc/platforms/powernv/npu-dma.c     |  705 ---------------------------
 b/arch/powerpc/include/asm/opal.h            |    3 
 b/arch/powerpc/include/asm/pci-bridge.h      |    1 
 b/arch/powerpc/include/asm/pci.h             |    7 
 b/arch/powerpc/platforms/powernv/Makefile    |    2 
 b/arch/powerpc/platforms/powernv/opal-call.c |    2 
 b/arch/powerpc/platforms/powernv/pci-ioda.c  |  185 -------
 b/arch/powerpc/platforms/powernv/pci.c       |   11 
 b/arch/powerpc/platforms/powernv/pci.h       |   17 
 b/arch/powerpc/platforms/pseries/pci.c       |   23 
 b/drivers/vfio/pci/Kconfig                   |    6 
 b/drivers/vfio/pci/Makefile                  |    1 
 b/drivers/vfio/pci/vfio_pci.c                |   18 
 b/drivers/vfio/pci/vfio_pci_private.h        |   14 
 b/include/uapi/linux/vfio.h                  |   38 -

Hi Christoph,

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

FYI, these uapi changes break build of QEMU.

What uapi changes?

All macros and structure definitions that are being removed from include/uapi/linux/vfio.h by patch 1.

Just my 2cents from drm (where we deprecate old gunk uapi quite often):
Imo it's best to keep the uapi headers as-is, but exchange the documentation with a big "this is removed, never use again" warning:

- it occasionally serves as a good lesson for how to not do uapi (whatever the reasons really are in the specific case)

- it's good to know which uapi numbers (like parameter extensions or whatever they are in this case) are defacto reserved, because there are binaries (qemu in this) that have code acting on them out there.

The only exception where we completely nuke the structs and #defines is when uapi has been only used by testcases. Which we know, since we defacto limit our stable uapi guarantee to the canonical open&upstream userspace drivers only (for at least the driver-specific stuff, the cross-driver interfaces are hopeless).

Anyway feel free to ignore since this might be different than drivers/gpu.

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#17 lore raw
Quoted 3 lines · Daniel Vetter

Just my 2cents from drm (where we deprecate old gunk uapi quite often):
Imo it's best to keep the uapi headers as-is, but exchange the documentation with a big "this is removed, never use again" warning:

We in RDMA have been doing the opposite, the uapi headers are supposed to reflect the current kernel. This helps make the kernel understandable.

When userspace needs backwards compat to ABI that the current kernel doesn't support then userspace has distinct copies of that information in some compat location. It has happened a few times over the last 15 years.

We keep full copies of the current kernel headers in the userspace source tree, when the kernel headers change in a compile incompatible way we fix everything while updating to the new kernel headers.

Quoted 3 lines

- it's good to know which uapi numbers (like parameter extensions or whatever they are in this case) are defacto reserved, because there are binaries (qemu in this) that have code acting on them out there.

Numbers and things get marked reserved or the like

Quoted 1 line

Anyway feel free to ignore since this might be different than drivers/gpu.

AFAIK drives/gpu has a lot wider userspace, rdma manages this OK because we only have one library package that provides the user/kernel interface.

Jason

#18 lore raw
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Daniel Vetter

Just my 2cents from drm (where we deprecate old gunk uapi quite often):
Imo it's best to keep the uapi headers as-is, but exchange the documentation with a big "this is removed, never use again" warning:

We in RDMA have been doing the opposite, the uapi headers are supposed to reflect the current kernel. This helps make the kernel understandable.

Quoted 8 lines

When userspace needs backwards compat to ABI that the current kernel doesn't support then userspace has distinct copies of that information in some compat location. It has happened a few times over the last 15 years.

We keep full copies of the current kernel headers in the userspace source tree, when the kernel headers change in a compile incompatible way we fix everything while updating to the new kernel headers.

Yeah we do the same since forever (it's either from libdrm package, or directly in the corresponding userspace header). So largely include/uapi is for documentation

Quoted 11 lines
Quoted 3 lines

- it's good to know which uapi numbers (like parameter extensions or whatever they are in this case) are defacto reserved, because there are binaries (qemu in this) that have code acting on them out there.

Numbers and things get marked reserved or the like

Quoted 1 line

Anyway feel free to ignore since this might be different than drivers/gpu.

AFAIK drives/gpu has a lot wider userspace, rdma manages this OK because we only have one library package that provides the user/kernel interface.

But since we have some many projects we've started asking all the userspace projects to directly take the kernel ones (after the make step to filter them) so that there's only one source of truth. And also to make sure they don't merge stuff before the kernel side is reviewed&landed. Which also means we can't ditch anything userspace might still need on older trees and stuff.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch