vfio: fix compile on older kernels
PATCH 1/1 vfio: fix compile on older kernels
From: "Burakov, Anatoly" <[email protected]>
Fixing compile failures for kernels without sPAPR IOMMU support.
--- lib/librte_eal/linuxapp/eal/eal_vfio.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
lib/librte_eal/linuxapp/eal/eal_vfio.h +13 -0
@@ -59,6 +59,7 @@#define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17)#define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19)#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) +#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)struct vfio_iommu_spapr_register_memory {uint32_t argsz;uint32_t flags;
@@ -75,6 +76,18 @@ struct vfio_iommu_spapr_tce_remove {uint32_t argsz; uint64_t start_addr; }; +struct vfio_iommu_spapr_tce_ddw_info { +uint64_t pgsizes; +uint32_t max_dynamic_windows_supported; +uint32_t levels; +}; +struct vfio_iommu_spapr_tce_info { +uint32_t argsz; +uint32_t flags; +uint32_t dma32_window_start; +uint32_t dma32_window_size; +struct vfio_iommu_spapr_tce_ddw_info ddw; +};#else #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU#endif
Signature · 1 line
2.9.3
Super trivial comment inline:
Quoted 15 lines · Anatoly Burakov
From: "Burakov, Anatoly" <[email protected]>
Fixing compile failures for kernels without sPAPR IOMMU support.
Fixes 0fe9830b5345 ("eal/ppc: support sPAPR IOMMU for vfio-pci")Signed-off-by Burakov, Anatoly <[email protected]>--- lib/librte_eal/linuxapp/eal/eal_vfio.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)lib/librte_eal/linuxapp/eal/eal_vfio.h +0
-0
lib/librte_eal/linuxapp/eal/eal_vfio.h line 62
Quoted 4 lines
lib/librte_eal/linuxapp/eal/eal_vfio.h +1
-0@@ -59,6 +59,7 @@#define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17)#define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19)#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) +#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
I guess a new line should be added here and ...
lib/librte_eal/linuxapp/eal/eal_vfio.h struct vfio_iommu_spapr_tce_remove { · line 78
Quoted 7 lines
lib/librte_eal/linuxapp/eal/eal_vfio.h +0
-0struct vfio_iommu_spapr_register_memory {uint32_t argsz;uint32_t flags;@@ -75,6 +76,18 @@ struct vfio_iommu_spapr_tce_remove {uint32_t argsz;uint64_t start_addr; };
and here...
lib/librte_eal/linuxapp/eal/eal_vfio.h struct vfio_iommu_spapr_tce_remove { · line 83
Quoted 5 lines
lib/librte_eal/linuxapp/eal/eal_vfio.h +5
-0+struct vfio_iommu_spapr_tce_ddw_info { +uint64_t pgsizes; +uint32_t max_dynamic_windows_supported; +uint32_t levels; +};
and here.
Quoted 11 lines
lib/librte_eal/linuxapp/eal/eal_vfio.h +7
-0+struct vfio_iommu_spapr_tce_info { +uint32_t argsz; +uint32_t flags; +uint32_t dma32_window_start; +uint32_t dma32_window_size; +struct vfio_iommu_spapr_tce_ddw_info ddw; +};#else #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU#endif
Quoted 1 line
Super trivial comment inline:
Thanks, I'll add those and do a v2. I'll wait a bit in case there are more comments.
Thanks,
Anatoly
PATCH v2 1/1 vfio: fix compile on older kernels
In reply to Anatoly BurakovFrom: "Burakov, Anatoly" <[email protected]>
Fixing compile failures for kernels without sPAPR IOMMU support.
---
v2: Fixed whitespace and newlines
lib/librte_eal/linuxapp/eal/eal_vfio.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
lib/librte_eal/linuxapp/eal/eal_vfio.h +18 -0
@@ -59,22 +59,40 @@#define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17)#define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19)#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) +#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) +struct vfio_iommu_spapr_register_memory {uint32_t argsz;uint32_t flags;uint64_t vaddr;uint64_t size; }; +struct vfio_iommu_spapr_tce_create {uint32_t argsz;uint32_t page_shift;uint64_t window_size;uint32_t levels; }; +struct vfio_iommu_spapr_tce_remove {uint32_t argsz;uint64_t start_addr; }; + +struct vfio_iommu_spapr_tce_ddw_info { +uint64_t pgsizes; +uint32_t max_dynamic_windows_supported; +uint32_t levels; +}; + +struct vfio_iommu_spapr_tce_info { +uint32_t argsz; +uint32_t flags; +uint32_t dma32_window_start; +uint32_t dma32_window_size; +struct vfio_iommu_spapr_tce_ddw_info ddw; +};#else #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU#endif
Signature · 1 line
2.9.3
2017-03-23 12:56, Anatoly Burakov:
Quoted 5 lines
From: "Burakov, Anatoly" <[email protected]>
Fixing compile failures for kernels without sPAPR IOMMU support.
Fixes 0fe9830b5345 ("eal/ppc: support sPAPR IOMMU for vfio-pci")
A blank line is missing also here ;)
Quoted 6 lines
Signed-off-by Burakov, Anatoly <[email protected]>---
v2: Fixed whitespace and newlineslib/librte_eal/linuxapp/eal/eal_vfio.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
When building for ARM, I see this error:
error: redefinition of 'struct vfio_iommu_spapr_tce_info'
PATCH v3 1/1 vfio: fix compile on older kernels
In reply to Anatoly BurakovFrom: "Burakov, Anatoly" <[email protected]>
Fixing compile failures for kernels without sPAPR IOMMU support.
---
v3: fixed compile on kernels where SPAPR_v2 is not present but SPAPR is
v2: fixed newlines
lib/librte_eal/linuxapp/eal/eal_vfio.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
lib/librte_eal/linuxapp/eal/eal_vfio.h +22 -0
@@ -59,22 +59,44 @@#define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17)#define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19)#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) + +/* SPAPR_v2 is not present, but SPAPR might be */ +#ifndef VFIO_SPAPR_TCE_IOMMU +#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) + +struct vfio_iommu_spapr_tce_info { +uint32_t argsz; +uint32_t flags; +uint32_t dma32_window_start; +uint32_t dma32_window_size; +struct vfio_iommu_spapr_tce_ddw_info ddw; +}; +#endif +struct vfio_iommu_spapr_register_memory {uint32_t argsz;uint32_t flags;uint64_t vaddr;uint64_t size; }; +struct vfio_iommu_spapr_tce_create {uint32_t argsz;uint32_t page_shift;uint64_t window_size;uint32_t levels; }; +struct vfio_iommu_spapr_tce_remove {uint32_t argsz;uint64_t start_addr; }; + +struct vfio_iommu_spapr_tce_ddw_info { +uint64_t pgsizes; +uint32_t max_dynamic_windows_supported; +uint32_t levels; +};#else #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU#endif
Signature · 1 line
2.9.3
Thomas Monjalon
Applied2017-03-28 16:53, Anatoly Burakov:
Quoted 7 lines
From: "Burakov, Anatoly" <[email protected]>
Fixing compile failures for kernels without sPAPR IOMMU support.
Fixes 0fe9830b5345 ("eal/ppc: support sPAPR IOMMU for vfio-pci")Signed-off-by Burakov, Anatoly <[email protected]>
Applied, thanks