Re: [RFC PATCH 3/3] pseries/iommu: Enable DDW for VFIO TCE create

From: Shivaprasad G Bhat
Date: Tue Mar 26 2024 - 00:57:22 EST


Hi Michael,

On 3/13/24 18:23, Michael Ellerman wrote:
Hi Shivaprasad,

Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxx> writes:
The commit 9d67c9433509 ("powerpc/iommu: Add \"borrowing\"
iommu_table_group_ops") implemented the "borrow" mechanism for
the pSeries SPAPR TCE. It did implement this support partially
that it left out creating the DDW if not present already.

The patch here attempts to fix the missing gaps.
- Expose the DDW info to user by collecting it during probe.
- Create the window and the iommu table if not present during
VFIO_SPAPR_TCE_CREATE.
- Remove and recreate the window if the pageshift and window sizes
do not match.
- Restore the original window in enable_ddw() if the user had
created/modified the DDW. As there is preference for DIRECT mapping
on the host driver side, the user created window is removed.

The changes work only for the non-SRIOV-VF scenarios for PEs having
2 DMA windows.
This crashes on powernv.


Thanks for pointing this out.  I will take care of this in v2 of this RFC.


Regards,

Shivaprasad