Skip to content

iommu/arm-smmu-v3: Allocate vmid per vsmmu instead of s2_parent

Nicolin Chen linux-arm-kernel linux-iommu lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 4 repliesIn review
  2. v14 patches 21 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11iommu/arm-smmu-v3: Pass in vmid to arm_smmu_make_s2_domain_ste()drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 more+12 -70 replies
2/11iommu/arm-smmu-v3: Pass in smmu/iommu_domain to __arm_smmu_tlb_inv_range()drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+13 -81 reply
3/11iommu/arm-smmu-v3: Share cmdq/cmd helpers with arm-smmu-v3-iommufddrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+24 -130 replies
4/11iommu/arm-smmu-v3: Add an inline arm_smmu_tlb_inv_vmid helperdrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+13 -70 replies
5/11iommu/arm-smmu-v3: Rename arm_smmu_attach_prepare_vmasterdrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+11 -110 replies
6/11iommu/arm-smmu-v3: Introduce arm_smmu_s2_parent_tlb_ invalidation helpersdrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+77 -03 replies
7/11iommu/arm-smmu-v3: Introduce arm_vsmmu_atc_inv_domain()drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+51 -00 replies
8/11iommu/arm-smmu-v3: Use vSMMU helpers for S2 and ATC invalidationsdrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+55 -240 replies
9/11iommu/arm-smmu-v3: Clean up nested_ats_flush from master_domaindrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+4 -210 replies
10/11iommu/arm-smmu-v3: Decouple vmid from S2 nest_parent domaindrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h+24 -120 replies
11/11iommu/arm-smmu-v3: Allow to share S2 nest_parent domain across vSMMUsdrivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c+20 -10 replies

Reviews trailers per patch

1 of 11 patches has a Reviewed-by or Acked-by.

PatchJason GunthorpePranjal Shrivastava
1/11R-b R-b
2/11
3/11
4/11
5/11
6/11
7/11
8/11
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/11] iommu/arm-smmu-v3: Allocate vmid per vsmmu instead of s2_parent

With a system having multiple SMMU physical instances, multiple vSMMUs can be allocated for a VM that deivces behind different SMMUs are assigned to. In such a use case, the IPA->PA mappings (i.e. the stage-2 I/O page table) can be shared across the vSMMU instances.

With a shareable S2 parent domain, it is more natural to store a vmid per vSMMU instance v.s. a shared S2 domain, since each physical SMMU instance maintains its own vmid bitmap.

Have a few patches to get the functions ready for the vmid migration. And decouple the vmid from S2 parent domains and move its allocation to vSMMU instances. Note that a regular S2 domain (!nest_parent) has to retain the s2_cfg and vmid for non-nesting use cases, if the SMMU HW doesn't support stage 1. Maintain a per-S2-domain vsmmus list and a per-vSMMU ats_devices list to iterate for S2 cache invalidation cmds and ATC invalidation cmds.

This is on Github:
https://github.com/nicolinc/iommufd/commits/smmuv3_vmid-v2

Changelog
v2
* Add Reviewed-by from Jason and Pranjal
* Add WARN_ON_ONCE(!vmid) in arm_smmu_make_s2_domain_ste()
* Add arm_smmu_s2_parent_can_share() for a compatibility check
* Introduce arm_smmu_s2_parent_tlb_inv_* helpers replacing the non-nesting routines
* Introduce arm_vsmmu_atc_inv_domain() using a per-vSMMU ats_devices list, replacing the nested_ats_flush in struct arm_smmu_master_domain
v1
https://lore.kernel.org/all/[email protected]/

Thanks
Nicolin

Nicolin Chen (11):
iommu/arm-smmu-v3: Pass in vmid to arm_smmu_make_s2_domain_ste() iommu/arm-smmu-v3: Pass in smmu/iommu_domain to

    __arm_smmu_tlb_inv_range()

iommu/arm-smmu-v3: Share cmdq/cmd helpers with arm-smmu-v3-iommufd iommu/arm-smmu-v3: Add an inline arm_smmu_tlb_inv_vmid helper iommu/arm-smmu-v3: Rename arm_smmu_attach_prepare_vmaster iommu/arm-smmu-v3: Introduce arm_smmu_s2_parent_tlb_ invalidation
helpers
iommu/arm-smmu-v3: Introduce arm_vsmmu_atc_inv_domain() iommu/arm-smmu-v3: Use vSMMU helpers for S2 and ATC invalidations iommu/arm-smmu-v3: Clean up nested_ats_flush from master_domain iommu/arm-smmu-v3: Decouple vmid from S2 nest_parent domain iommu/arm-smmu-v3: Allow to share S2 nest_parent domain across vSMMUs

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h   |  77 +++++++-
 .../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c     | 175 ++++++++++++++++--
 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-test.c  |   3 +-
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c   | 139 +++++++-------
 4 files changed, 297 insertions(+), 97 deletions(-)
Signature · 1 line
2.43.0