Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-20 Thread Joel Granados
On Tue, Dec 19, 2023 at 05:26:21PM +0800, Yi Liu wrote: > On 2023/12/17 19:21, Joel Granados wrote: > > Hey Yi > > > > I have been working with > > https://protect2.fireeye.com/v1/url?k=b58750ce-ea1c9eaa-b586db81-000babda0201-365207d33731a099&q=1&e=ee73b69d-5c35-49ef-9e62-2355fb797f21&u=https%3A%

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-19 Thread Yi Liu
On 2023/12/17 19:21, Joel Granados wrote: Hey Yi I have been working with https://github.com/yiliu1765/qemu/tree/zhenzhong/wip/iommufd_nesting_rfcv1 good to know about it. and have some questions regarding one of the commits in that series. I however cannot find it in lore.kernel.org. Can y

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-17 Thread Joel Granados
Hey Yi I have been working with https://github.com/yiliu1765/qemu/tree/zhenzhong/wip/iommufd_nesting_rfcv1 and have some questions regarding one of the commits in that series. I however cannot find it in lore.kernel.org. Can you please direct me to where the rfc was posted? If it has not been pos

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-13 Thread Nicolin Chen
On Wed, Dec 13, 2023 at 08:40:55AM -0400, Jason Gunthorpe wrote: > On Tue, Dec 12, 2023 at 12:05:41PM -0800, Nicolin Chen wrote: > > > > // iommufd_private.h > > > > > > > > enum iommufd_object_type { > > > > ... > > > > + IOMMUFD_OBJ_VIOMMU, > > > > ... > > > > }; > > > > >

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-13 Thread Jason Gunthorpe
On Tue, Dec 12, 2023 at 12:05:41PM -0800, Nicolin Chen wrote: > > > // iommufd_private.h > > > > > > enum iommufd_object_type { > > > ... > > > + IOMMUFD_OBJ_VIOMMU, > > > ... > > > }; > > > > > > +struct iommufd_viommu { > > > + struct iommufd_object obj; > > > + struct iommufd_hwpt_paging *

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-12 Thread Nicolin Chen
On Tue, Dec 12, 2023 at 03:21:00PM -0400, Jason Gunthorpe wrote: > On Tue, Dec 12, 2023 at 11:13:37AM -0800, Nicolin Chen wrote: > > On Tue, Dec 12, 2023 at 10:44:21AM -0400, Jason Gunthorpe wrote: > > > On Mon, Dec 11, 2023 at 11:30:00PM -0800, Nicolin Chen wrote: > > > > > > > > > Could the stru

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-12 Thread Jason Gunthorpe
On Tue, Dec 12, 2023 at 11:13:37AM -0800, Nicolin Chen wrote: > On Tue, Dec 12, 2023 at 10:44:21AM -0400, Jason Gunthorpe wrote: > > On Mon, Dec 11, 2023 at 11:30:00PM -0800, Nicolin Chen wrote: > > > > > > > Could the structure just look like this? > > > > > struct iommu_dev_assign_virtual_id { >

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-12 Thread Nicolin Chen
On Tue, Dec 12, 2023 at 10:44:21AM -0400, Jason Gunthorpe wrote: > On Mon, Dec 11, 2023 at 11:30:00PM -0800, Nicolin Chen wrote: > > > > > Could the structure just look like this? > > > > struct iommu_dev_assign_virtual_id { > > > >__u32 size; > > > >__u32 dev_id; > > > >__

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-12 Thread Jason Gunthorpe
On Mon, Dec 11, 2023 at 11:30:00PM -0800, Nicolin Chen wrote: > > > Could the structure just look like this? > > > struct iommu_dev_assign_virtual_id { > > >__u32 size; > > >__u32 dev_id; > > >__u32 id_type; > > >__u32 id; > > > }; > > > > It needs to take in the v

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Nicolin Chen
On Mon, Dec 11, 2023 at 05:57:38PM -0400, Jason Gunthorpe wrote: > On Mon, Dec 11, 2023 at 01:27:49PM -0800, Nicolin Chen wrote: > > On Fri, Dec 08, 2023 at 09:47:26PM -0400, Jason Gunthorpe wrote: > > > What is in a Nested domain: > > > ARM: A CD table pointer > > > Nesting domains are crea

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Jason Gunthorpe
On Mon, Dec 11, 2023 at 01:27:49PM -0800, Nicolin Chen wrote: > On Fri, Dec 08, 2023 at 09:47:26PM -0400, Jason Gunthorpe wrote: > > What is in a Nested domain: > > ARM: A CD table pointer > > Nesting domains are created for every unique CD table top pointer. > > I think we basically implem

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Jason Gunthorpe
On Mon, Dec 11, 2023 at 12:11:25PM -0800, Nicolin Chen wrote: > On Mon, Dec 11, 2023 at 09:20:41AM -0400, Jason Gunthorpe wrote: > > On Mon, Dec 11, 2023 at 08:35:09PM +0800, Yi Liu wrote: > > > > So.. In short.. Invalidation is a PITA. The idea is the same but > > > > annoying little details inter

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Nicolin Chen
On Fri, Dec 08, 2023 at 09:47:26PM -0400, Jason Gunthorpe wrote: > What is in a Nested domain: > ARM: A CD table pointer > Nesting domains are created for every unique CD table top pointer. I think we basically implemented in a way of syncing STE, i,e, vSTE.Config must be "S1 Translate" bes

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Nicolin Chen
On Mon, Dec 11, 2023 at 09:20:41AM -0400, Jason Gunthorpe wrote: > On Mon, Dec 11, 2023 at 08:35:09PM +0800, Yi Liu wrote: > > > So.. In short.. Invalidation is a PITA. The idea is the same but > > > annoying little details interfere with actually having a compltely > > > common API here. IMHO the

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Jason Gunthorpe
On Tue, Dec 12, 2023 at 12:35:26AM +0700, Suthikulpanit, Suravee wrote: > > > On 12/9/2023 8:47 AM, Jason Gunthorpe wrote: > > On Fri, Nov 17, 2023 at 05:07:11AM -0800, Yi Liu wrote: > > > > > Take Intel VT-d as an example, the stage-1 translation table is I/O page > > > table. As the below diag

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Suthikulpanit, Suravee
On 12/9/2023 8:47 AM, Jason Gunthorpe wrote: On Fri, Nov 17, 2023 at 05:07:11AM -0800, Yi Liu wrote: Take Intel VT-d as an example, the stage-1 translation table is I/O page table. As the below diagram shows, guest I/O page table pointer in GPA (guest physical address) is passed to host and

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Jason Gunthorpe
On Mon, Dec 11, 2023 at 10:34:09PM +0700, Suthikulpanit, Suravee wrote: > Currently, the AMD IOMMU driver allocates a DomainId per IOMMU group. > One issue with this is when we have nested translation where we could end up > with multiple devices (RIDs) sharing same PASID and the same hDomainID.

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Suthikulpanit, Suravee
On 12/11/2023 8:05 PM, Jason Gunthorpe wrote: On Mon, Dec 11, 2023 at 08:36:46PM +0800, Yi Liu wrote: On 2023/12/11 10:29, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Saturday, December 9, 2023 9:47 AM What is in a Nested domain: Intel: A single IO page table refereed to by a PASID e

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Jason Gunthorpe
On Mon, Dec 11, 2023 at 08:35:09PM +0800, Yi Liu wrote: > > What iommufd object should receive the IOTLB invalidation command list: > > Intel: The Nesting domain. The command list has to be broken up per > > (vDomain-ID,PASID) and that batch delivered to the single > > nesting domai

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Jason Gunthorpe
On Mon, Dec 11, 2023 at 08:36:46PM +0800, Yi Liu wrote: > On 2023/12/11 10:29, Tian, Kevin wrote: > > > From: Jason Gunthorpe > > > Sent: Saturday, December 9, 2023 9:47 AM > > > > > > What is in a Nested domain: > > > Intel: A single IO page table refereed to by a PASID entry > > > Ea

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Yi Liu
On 2023/12/11 10:29, Tian, Kevin wrote: From: Jason Gunthorpe Sent: Saturday, December 9, 2023 9:47 AM What is in a Nested domain: Intel: A single IO page table refereed to by a PASID entry Each vDomain-ID,PASID allocates a unique nesting domain AMD: A GCR3 table pointer Nes

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-11 Thread Yi Liu
On 2023/12/9 09:47, Jason Gunthorpe wrote: On Fri, Nov 17, 2023 at 05:07:11AM -0800, Yi Liu wrote: Take Intel VT-d as an example, the stage-1 translation table is I/O page table. As the below diagram shows, guest I/O page table pointer in GPA (guest physical address) is passed to host and be us

RE: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-10 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Saturday, December 9, 2023 9:47 AM > > What is in a Nested domain: > Intel: A single IO page table refereed to by a PASID entry > Each vDomain-ID,PASID allocates a unique nesting domain > AMD: A GCR3 table pointer > Nesting domains are created for e

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-08 Thread Jason Gunthorpe
On Fri, Nov 17, 2023 at 05:07:11AM -0800, Yi Liu wrote: > Take Intel VT-d as an example, the stage-1 translation table is I/O page > table. As the below diagram shows, guest I/O page table pointer in GPA > (guest physical address) is passed to host and be used to perform the stage-1 > address tran

[PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-11-17 Thread Yi Liu
Nested translation is a hardware feature that is supported by many modern IOMMU hardwares. It has two stages (stage-1, stage-2) address translation to get access to the physical address. stage-1 translation table is owned by userspace (e.g. by a guest OS), while stage-2 is owned by kernel. Changes