[1/2] vfio: use ifdef's for ppc64 spapr code
diff mbox series

Message ID 20200429232931.87233-2-drc@linux.vnet.ibm.com
State Superseded
Delegated to: David Marchand
Headers show
Series
  • vfio: change spapr DMA window sizing operation
Related show

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

David Christensen April 29, 2020, 11:29 p.m. UTC
Enclose ppc64 specific SPAPR VFIO support with ifdef's.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 lib/librte_eal/linux/eal_vfio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Burakov, Anatoly April 30, 2020, 11:14 a.m. UTC | #1
On 30-Apr-20 12:29 AM, David Christensen wrote:
> Enclose ppc64 specific SPAPR VFIO support with ifdef's.
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---

Why is this needed?
David Christensen April 30, 2020, 4:22 p.m. UTC | #2
>> Enclose ppc64 specific SPAPR VFIO support with ifdef's.
>>
>> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
>> ---
> 
> Why is this needed?

It's hardware specific to the PPC64 platform.  I don't know of a 
situation where the IOMMU would be present on other hardware.  Even 
running a VM in KVM/QEMU on a PPC64 platform results in a SPAPR V1 IOMMU 
which isn't supported in DPDK.

Dave
Burakov, Anatoly April 30, 2020, 4:24 p.m. UTC | #3
On 30-Apr-20 5:22 PM, David Christensen wrote:
>>> Enclose ppc64 specific SPAPR VFIO support with ifdef's.
>>>
>>> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
>>> ---
>>
>> Why is this needed?
> 
> It's hardware specific to the PPC64 platform.  I don't know of a 
> situation where the IOMMU would be present on other hardware.  Even 
> running a VM in KVM/QEMU on a PPC64 platform results in a SPAPR V1 IOMMU 
> which isn't supported in DPDK.
> 
> Dave

Yes, but generally #ifdef's are there for detecting compile-time 
conditions. Is there anything specific to that code that would cause 
trouble when compiled on other platforms?
David Christensen April 30, 2020, 5:38 p.m. UTC | #4
>>> Why is this needed?
>>
>> It's hardware specific to the PPC64 platform.  I don't know of a 
>> situation where the IOMMU would be present on other hardware.  Even 
>> running a VM in KVM/QEMU on a PPC64 platform results in a SPAPR V1 
>> IOMMU which isn't supported in DPDK.
>>
>> Dave
> 
> Yes, but generally #ifdef's are there for detecting compile-time 
> conditions. Is there anything specific to that code that would cause 
> trouble when compiled on other platforms?

No, I can't say that's the case, it's been operating this way for a while.

Dave
Burakov, Anatoly May 1, 2020, 8:49 a.m. UTC | #5
On 30-Apr-20 6:38 PM, David Christensen wrote:
>>>> Why is this needed?
>>>
>>> It's hardware specific to the PPC64 platform.  I don't know of a 
>>> situation where the IOMMU would be present on other hardware.  Even 
>>> running a VM in KVM/QEMU on a PPC64 platform results in a SPAPR V1 
>>> IOMMU which isn't supported in DPDK.
>>>
>>> Dave
>>
>> Yes, but generally #ifdef's are there for detecting compile-time 
>> conditions. Is there anything specific to that code that would cause 
>> trouble when compiled on other platforms?
> 
> No, I can't say that's the case, it's been operating this way for a while.
> 
> Dave

So no #ifdef's necessary then :)

Patch
diff mbox series

diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c
index d26e1649a..953397984 100644
--- a/lib/librte_eal/linux/eal_vfio.c
+++ b/lib/librte_eal/linux/eal_vfio.c
@@ -56,8 +56,10 @@  static struct vfio_config *default_vfio_cfg = &vfio_cfgs[0];
 
 static int vfio_type1_dma_map(int);
 static int vfio_type1_dma_mem_map(int, uint64_t, uint64_t, uint64_t, int);
+#ifdef RTE_ARCH_PPC_64
 static int vfio_spapr_dma_map(int);
 static int vfio_spapr_dma_mem_map(int, uint64_t, uint64_t, uint64_t, int);
+#endif
 static int vfio_noiommu_dma_map(int);
 static int vfio_noiommu_dma_mem_map(int, uint64_t, uint64_t, uint64_t, int);
 static int vfio_dma_mem_map(struct vfio_config *vfio_cfg, uint64_t vaddr,
@@ -72,6 +74,7 @@  static const struct vfio_iommu_type iommu_types[] = {
 		.dma_map_func = &vfio_type1_dma_map,
 		.dma_user_map_func = &vfio_type1_dma_mem_map
 	},
+#ifdef RTE_ARCH_PPC_64
 	/* ppc64 IOMMU, otherwise known as spapr */
 	{
 		.type_id = RTE_VFIO_SPAPR,
@@ -79,6 +82,7 @@  static const struct vfio_iommu_type iommu_types[] = {
 		.dma_map_func = &vfio_spapr_dma_map,
 		.dma_user_map_func = &vfio_spapr_dma_mem_map
 	},
+#endif
 	/* IOMMU-less mode */
 	{
 		.type_id = RTE_VFIO_NOIOMMU,
@@ -1407,6 +1411,7 @@  vfio_type1_dma_map(int vfio_container_fd)
 	return rte_memseg_walk(type1_map, &vfio_container_fd);
 }
 
+#ifdef RTE_ARCH_PPC_64
 static int
 vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		uint64_t len, int do_map)
@@ -1578,7 +1583,6 @@  vfio_spapr_create_new_dma_window(int vfio_container_fd,
 	/* create new DMA window */
 	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_CREATE, create);
 	if (ret) {
-#ifdef VFIO_IOMMU_SPAPR_INFO_DDW
 		/* try possible page_shift and levels for workaround */
 		uint32_t levels;
 
@@ -1588,7 +1592,6 @@  vfio_spapr_create_new_dma_window(int vfio_container_fd,
 			ret = ioctl(vfio_container_fd,
 				VFIO_IOMMU_SPAPR_TCE_CREATE, create);
 		}
-#endif
 		if (ret) {
 			RTE_LOG(ERR, EAL, "  cannot create new DMA window, "
 					"error %i (%s)\n", errno, strerror(errno));
@@ -1747,6 +1750,7 @@  vfio_spapr_dma_map(int vfio_container_fd)
 
 	return 0;
 }
+#endif /* RTE_ARCH_PPC_64 */
 
 static int
 vfio_noiommu_dma_map(int __rte_unused vfio_container_fd)