public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] iommufd support allocating nested parent domain
@ 2023-09-19  9:25 Yi Liu
  2023-09-19  9:25 ` [PATCH 1/6] iommu: Add new iommu op to create domains owned by userspace Yi Liu
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: Yi Liu @ 2023-09-19  9:25 UTC (permalink / raw)
  To: joro, alex.williamson, jgg, kevin.tian, robin.murphy, baolu.lu
  Cc: cohuck, eric.auger, nicolinc, kvm, mjrosato, chao.p.peng,
	yi.l.liu, yi.y.sun, peterx, jasowang, shameerali.kolothum.thodi,
	lulu, suravee.suthikulpanit, iommu, linux-kernel, linux-kselftest,
	zhenzhong.duan, joao.m.martins

IOMMU hardwares that support nested translation would have two stages
address translation (normally mentioned as stage-1 and stage-2). The page
table formats of the stage-1 and stage-2 can be different. e.g., VT-d has
different page table formats for stage-1 and stage-2.

Nested parent domain is the iommu domain used to represent the stage-2
translation. In IOMMUFD, both stage-1 and stage-2 translation are tracked
as HWPT (a.k.a. iommu domain). Stage-2 HWPT is parent of stage-1 HWPT as
stage-1 cannot work alone in nested translation. In the cases of stage-1 and
stage-2 page table format are different, the parent HWPT should use exactly
the stage-2 page table format. However, the existing kernel hides the format
selection in iommu drivers, so the domain allocated via IOMMU_HWPT_ALLOC can
use either stage-1 page table format or stage-2 page table format, there is
no guarantees for it.

To enforce the page table format of the nested parent domain, this series
introduces a new iommu op (domain_alloc_user) which can accept user flags
to allocate domain as userspace requires. It also converts IOMMUFD to use
the new domain_alloc_user op for domain allocation if supported, then extends
the IOMMU_HWPT_ALLOC ioctl to pass down a NEST_PARENT flag to allocate a HWPT
which can be used as parent. This series implements the new op in Intel iommu
driver to have a complete picture. It is a preparation for adding nesting
support in IOMMUFD/IOMMU.

Complete code can be found:
https://github.com/yiliu1765/iommufd/tree/iommufd_alloc_user_v1

Regards,
	Yi Liu

Yi Liu (6):
  iommu: Add new iommu op to create domains owned by userspace
  iommufd/hw_pagetable: Use domain_alloc_user op for domain allocation
  iommufd/hw_pagetable: Accepts user flags for domain allocation
  iommufd/hw_pagetable: Support allocating nested parent domain
  iommufd/selftest: Add domain_alloc_user() support in iommu mock
  iommu/vt-d: Add domain_alloc_user op

 drivers/iommu/intel/iommu.c                   | 20 ++++++++++++
 drivers/iommu/iommufd/device.c                |  2 +-
 drivers/iommu/iommufd/hw_pagetable.c          | 31 ++++++++++++++-----
 drivers/iommu/iommufd/iommufd_private.h       |  3 +-
 drivers/iommu/iommufd/selftest.c              | 16 ++++++++++
 include/linux/iommu.h                         |  8 +++++
 include/uapi/linux/iommufd.h                  | 12 ++++++-
 tools/testing/selftests/iommu/iommufd.c       | 24 +++++++++++---
 .../selftests/iommu/iommufd_fail_nth.c        |  2 +-
 tools/testing/selftests/iommu/iommufd_utils.h | 11 +++++--
 10 files changed, 111 insertions(+), 18 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-09-26  5:50 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19  9:25 [PATCH 0/6] iommufd support allocating nested parent domain Yi Liu
2023-09-19  9:25 ` [PATCH 1/6] iommu: Add new iommu op to create domains owned by userspace Yi Liu
2023-09-26  5:28   ` Tian, Kevin
2023-09-26  5:52     ` Yi Liu
2023-09-19  9:25 ` [PATCH 2/6] iommufd/hw_pagetable: Use domain_alloc_user op for domain allocation Yi Liu
2023-09-19  9:25 ` [PATCH 3/6] iommufd/hw_pagetable: Accepts user flags " Yi Liu
2023-09-26  5:29   ` Tian, Kevin
2023-09-19  9:25 ` [PATCH 4/6] iommufd/hw_pagetable: Support allocating nested parent domain Yi Liu
2023-09-20  5:05   ` Baolu Lu
2023-09-25  6:39     ` Yi Liu
2023-09-26  5:32   ` Tian, Kevin
2023-09-26  5:50     ` Yi Liu
2023-09-19  9:25 ` [PATCH 5/6] iommufd/selftest: Add domain_alloc_user() support in iommu mock Yi Liu
2023-09-26  5:33   ` Tian, Kevin
2023-09-19  9:25 ` [PATCH 6/6] iommu/vt-d: Add domain_alloc_user op Yi Liu
2023-09-20  5:28   ` Baolu Lu
2023-09-20 13:05     ` Jason Gunthorpe
2023-09-20 13:10       ` Liu, Yi L
2023-09-20 13:18         ` Jason Gunthorpe
2023-09-25  6:37           ` Yi Liu
2023-09-21  1:31         ` Baolu Lu
2023-09-25  6:36           ` Yi Liu
2023-09-26  5:36           ` Tian, Kevin
2023-09-20 13:18     ` Liu, Yi L
2023-09-20  5:41   ` Yang, Weijiang
2023-09-20 13:06     ` Jason Gunthorpe
2023-09-20 13:15     ` Liu, Yi L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox