RE: [PATCH 09/17] iommufd: Add kernel-managed hw_pagetable allocation for userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Friday, February 10, 2023 4:45 AM
> 
> 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@xxxxxxxxxx>
> > Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>
> > ---
> >  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.

Ok. will reorder in next version.

Regards,
Yi Liu




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux