[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+VbUrpPQWkOVyW/@nvidia.com>
Date: Thu, 9 Feb 2023 16:45:06 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Yi Liu <yi.l.liu@...el.com>
Cc: joro@...tes.org, alex.williamson@...hat.com, kevin.tian@...el.com,
robin.murphy@....com, cohuck@...hat.com, eric.auger@...hat.com,
nicolinc@...dia.com, kvm@...r.kernel.org, mjrosato@...ux.ibm.com,
chao.p.peng@...ux.intel.com, yi.y.sun@...ux.intel.com,
peterx@...hat.com, jasowang@...hat.com,
shameerali.kolothum.thodi@...wei.com, lulu@...hat.com,
suravee.suthikulpanit@....com, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
baolu.lu@...ux.intel.com
Subject: Re: [PATCH 09/17] iommufd: Add kernel-managed hw_pagetable
allocation for userspace
On Wed, Feb 08, 2023 at 08:31:45PM -0800, Yi Liu wrote:
> Today iommufd allocates the kernel-managed hw_pagetabe implicitly when
> device is attached to an IOAS. This links the hw_pagetable to IOPT within
> IOAS.
>
> However, this is not the perfect way. It makes much sense to let userspace
> explicitly request hw_pagtable allocation via iommufd. The reason is even
> though the hw_pagetable is kernel-managed, the mappings are feed by
> userspace. Also, this makes the lifecircle of kernel-managed hw_pagetable
> more clear during usage. This is very important in the usage of nested
> translation, in which the kernel-managed hw_pagetable would be used as the
> stage-2 hw_pagetable. In such case, both stage-1 and stage-2 hw_pagetable
> should be allocated by userspace to ensure the life-circle.
>
> This adds an ioctl IOMMU_HWPT_ALLOC for the hw_pagetable allocation. For
> kernel-managed hw_pagetable, userspace should provide an IOAS ID in the
> allocation request.
>
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
> Signed-off-by: Yi Liu <yi.l.liu@...el.com>
> ---
> drivers/iommu/iommufd/device.c | 11 ++-
> drivers/iommu/iommufd/hw_pagetable.c | 116 ++++++++++++++++++++++++
> drivers/iommu/iommufd/iommufd_private.h | 15 +++
> drivers/iommu/iommufd/main.c | 3 +
> include/uapi/linux/iommufd.h | 48 ++++++++++
> 5 files changed, 191 insertions(+), 2 deletions(-)
This patch and its requirements should all be first in the series. A
mini series who's only job is to add IOMMU_HWPT_ALLOC
Then patches to add IOMMU_HWPT_INVALIDATE
Then the vt-d implementation of all this, including the vt-d specific
changes to the uapi/etc.
Jason
Powered by blists - more mailing lists