[RFC XEN PATCH v2 1/5] docs/designs: Add a design document for PV-IOMMU

2024-06-26 Thread TSnake41
From: Teddy Astie Some operating systems want to use IOMMU to implement various features (e.g VFIO) or DMA protection. This patch introduce a proposal for IOMMU paravirtualization for Dom0. Signed-off-by Teddy Astie --- docs/designs/pv-iommu.md | 105 +++ 1

[RFC XEN PATCH v2 5/5] xen/public: Introduce PV-IOMMU hypercall interface

2024-06-26 Thread TSnake41
From: Teddy Astie Introduce a new pv interface to manage the underlying IOMMU and manage contexts and devices. This interface allows creation of new contexts from Dom0 and addition of IOMMU mappings using guest PoV. This interface doesn't allow creation of mapping to other domains. Signed-off-b

[RFC XEN PATCH v2 0/5] IOMMU subsystem redesign and PV-IOMMU interface

2024-06-26 Thread TSnake41
This work has been presented at Xen Summit 2024 during the IOMMU paravirtualization and Xen IOMMU subsystem rework design session. Operating systems may want to have access to a IOMMU in order to do DMA protection or implement certain features (e.g VFIO on Linux). VFIO support is mandatory for

[RFC XEN PATCH v2 2/5] docs/designs: Add a design document for IOMMU subsystem redesign

2024-06-26 Thread TSnake41
From: Teddy Astie Current IOMMU subsystem has some limitations that make PV-IOMMU practically impossible. One of them is the assumtion that each domain is bound to a single "IOMMU domain", which also causes complications with quarantine implementation. Moreover, current IOMMU subsystem is not

[RFC XEN PATCH v2 4/5] VT-d: Port IOMMU driver to new subsystem

2024-06-26 Thread TSnake41
From: Teddy Astie Port the driver with guidances specified in iommu-contexts.md. Add a arena-based allocator for allocating a fixed chunk of memory and split it into 4k pages for use by the IOMMU contexts. This chunk size is configurable with X86_ARENA_ORDER and dom0-iommu=arena-order=N. Signed

[RFC XEN PATCH v2 3/5] IOMMU: Introduce redesigned IOMMU subsystem

2024-06-26 Thread TSnake41
From: Teddy Astie Based on docs/designs/iommu-contexts.md, implement the redesigned IOMMU subsystem. Signed-off-by Teddy Astie --- Changed in V2: * cleanup some unneeded includes * fix dangling devices in context on detach --- xen/arch/x86/domain.c| 2 +- xen/arch/x86/mm/p2m

[RFC PATCH v2] iommu/xen: Add Xen PV-IOMMU driver

2024-06-21 Thread TSnake41
From: Teddy Astie In the context of Xen, Linux runs as Dom0 and doesn't have access to the machine IOMMU. Although, a IOMMU is mandatory to use some kernel features such as VFIO or DMA protection. In Xen, we added a paravirtualized IOMMU with iommu_op hypercall in order to allow Dom0 to implemen