For SMMUv3 a IOMMU_DOMAIN_NESTED is composed of a S2 iommu_domain acting as the parent and a user provided STE fragment that defines the CD table and related data with addresses translated by the S2 iommu_domain. The kernel only permits userspace to control certain allowed bits of the STE that are safe for user/guest control. IOTLB maintenance is a bit subtle here, the S1 implicitly includes the S2 translation, but there is no way of knowing which S1 entries refer to a range of S2. For the IOTLB we follow ARM's guidance and issue a CMDQ_OP_TLBI_NH_ALL to flush all ASIDs from the VMID after flushing the S2 on any change to the S2. The IOMMU_DOMAIN_NESTED can only be created from inside a VIOMMU as the invalidation path relies on the VIOMMU to translate virtual stream ID used in the invalidation commands for the CD table and ATS.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -421,6 +421,26 @@ struct iommu_hwpt_vtd_s1 { · 420 unmodified lines | |||
| 421 | __u32 __reserved; | 421 | __u32 __reserved; |
| 422 | }; | 422 | }; |
| 423 | 423 | ||
| 424 | /** | ||
| 425 | * struct iommu_hwpt_arm_smmuv3 - ARM SMMUv3 nested STE | ||
| 426 | * (IOMMU_HWPT_DATA_ARM_SMMUV3) | ||
| 427 | * | ||
| 428 | * @ste: The first two double words of the user space Stream Table Entry for | ||
| 429 | * the translation. Must be little-endian. | ||
| 430 | * Allowed fields: (Refer to "5.2 Stream Table Entry" in SMMUv3 HW Spec) | ||
| 431 | * - word-0: V, Cfg, S1Fmt, S1ContextPtr, S1CDMax | ||
| 432 | * - word-1: S1DSS, S1CIR, S1COR, S1CSH, S1STALLD | ||
| 433 | * | ||
| 434 | * -EIO will be returned if @ste is not legal or contains any non-allowed field. | ||
| 435 | * Cfg can be used to select a S1, Bypass or Abort configuration. A Bypass | ||
| 436 | * nested domain will translate the same as the nesting parent. The S1 will | ||
| 437 | * install a Context Descriptor Table pointing at userspace memory translated | ||
| 438 | * by the nesting parent. | ||
| 439 | */ | ||
| 440 | struct iommu_hwpt_arm_smmuv3 { | ||
| 441 | __aligned_le64 ste[2]; | ||
| 442 | }; | ||
| 443 | |||
| 424 | /** | 444 | /** |
| 425 | * enum iommu_hwpt_data_type - IOMMU HWPT Data Type | 445 | * enum iommu_hwpt_data_type - IOMMU HWPT Data Type |
| 426 | * @IOMMU_HWPT_DATA_NONE: no data | 446 | * @IOMMU_HWPT_DATA_NONE: no data |