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

2024-06-24 Thread Baolu Lu
On 6/24/24 7:09 PM, Robin Murphy wrote: On 2024-06-23 4:21 am, Baolu Lu wrote: On 6/21/24 11:09 PM, Teddy Astie wrote: Le 19/06/2024 à 18:30, Jason Gunthorpe a écrit : On Thu, Jun 13, 2024 at 01:50:22PM +, Teddy Astie wrote: +struct iommu_domain *xen_iommu_domain_alloc(unsigned type) +{

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

2024-06-24 Thread Robin Murphy
On 2024-06-23 4:21 am, Baolu Lu wrote: On 6/21/24 11:09 PM, Teddy Astie wrote: Le 19/06/2024 à 18:30, Jason Gunthorpe a écrit : On Thu, Jun 13, 2024 at 01:50:22PM +, Teddy Astie wrote: +struct iommu_domain *xen_iommu_domain_alloc(unsigned type) +{ +    struct xen_iommu_domain *domain; +  

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

2024-06-22 Thread Baolu Lu
On 6/21/24 11:09 PM, Teddy Astie wrote: Le 19/06/2024 à 18:30, Jason Gunthorpe a écrit : On Thu, Jun 13, 2024 at 01:50:22PM +, Teddy Astie wrote: +struct iommu_domain *xen_iommu_domain_alloc(unsigned type) +{ + struct xen_iommu_domain *domain; + u16 ctx_no; + int ret; + +

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

2024-06-21 Thread Teddy Astie
Hello Jason, Le 19/06/2024 à 18:30, Jason Gunthorpe a écrit : > On Thu, Jun 13, 2024 at 01:50:22PM +, Teddy Astie wrote: > >> +struct iommu_domain *xen_iommu_domain_alloc(unsigned type) >> +{ >> +struct xen_iommu_domain *domain; >> +u16 ctx_no; >> +int ret; >> + >> +if (type &

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

2024-06-19 Thread Jason Gunthorpe
On Thu, Jun 13, 2024 at 01:50:22PM +, Teddy Astie wrote: > +struct iommu_domain *xen_iommu_domain_alloc(unsigned type) > +{ > + struct xen_iommu_domain *domain; > + u16 ctx_no; > + int ret; > + > + if (type & IOMMU_DOMAIN_IDENTITY) { > + /* use default domain */ > +

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

2024-06-17 Thread Jan Beulich
On 17.06.2024 15:36, Teddy Astie wrote: > Le 13/06/2024 à 16:32, Jan Beulich a écrit : >> On 13.06.2024 15:50, Teddy Astie wrote: >>> @@ -214,6 +215,38 @@ struct xen_add_to_physmap_range { >>> }; >>> DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range); >>> >>> +/* >>> + * With some legacy d

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

2024-06-17 Thread Teddy Astie
Le 13/06/2024 à 16:32, Jan Beulich a écrit : > On 13.06.2024 15:50, Teddy Astie wrote: >> @@ -214,6 +215,38 @@ struct xen_add_to_physmap_range { >> }; >> DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range); >> >> +/* >> + * With some legacy devices, certain guest-physical addresses cannot safe

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

2024-06-13 Thread Jan Beulich
On 13.06.2024 15:50, Teddy Astie wrote: > @@ -214,6 +215,38 @@ struct xen_add_to_physmap_range { > }; > DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap_range); > > +/* > + * With some legacy devices, certain guest-physical addresses cannot safely > + * be used for other purposes, e.g. to map gues

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

2024-06-13 Thread 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 implement such feature. This