[1/2] vfio: use ifdef's for ppc64 spapr code
Checks
Commit Message
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
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?
>> 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
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?
>>> 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
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 :)
@@ -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)