Re: [PATCH v12 01/13] vfio: VFIO_IOMMU_SET_PASID_TABLE

2021-04-07 Thread Zenghui Yu
Hi Eric, On 2021/2/24 5:06, Eric Auger wrote: +/* + * VFIO_IOMMU_SET_PASID_TABLE - _IOWR(VFIO_TYPE, VFIO_BASE + 18, + * struct vfio_iommu_type1_set_pasid_table) + * + * The SET operation passes a PASID table to the host while the + * UNSET operation detaches the one

[PATCH] iommu/arm-smmu-v3: Remove the unused fields for PREFETCH_CONFIG command

2021-04-07 Thread Zenghui Yu
Per SMMUv3 spec, there is no Size and Addr field in the PREFETCH_CONFIG command and they're not used by the driver. Remove them. We can add them back if we're going to use PREFETCH_ADDR in the future. Signed-off-by: Zenghui Yu --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 -- drivers

Re: [PATCH v14 08/13] dma-iommu: Implement NESTED_MSI cookie

2021-04-07 Thread Zenghui Yu
Hi Eric, On 2021/2/24 4:56, Eric Auger wrote: Up to now, when the type was UNMANAGED, we used to allocate IOVA pages within a reserved IOVA MSI range. If both the host and the guest are exposed with SMMUs, each would allocate an IOVA. The guest allocates an IOVA (gIOVA) to map onto the guest

Re: [PATCH v14 07/13] iommu/smmuv3: Implement cache_invalidate

2021-04-01 Thread Zenghui Yu
Hi Eric, On 2021/2/24 4:56, Eric Auger wrote: +static int +arm_smmu_cache_invalidate(struct iommu_domain *domain, struct device *dev, + struct iommu_cache_invalidate_info *inv_info) +{ + struct arm_smmu_cmdq_ent cmd = {.opcode = CMDQ_OP_TLBI_NSNH_ALL}; +

Re: [PATCH v14 13/13] iommu/smmuv3: Accept configs with more than one context descriptor

2021-03-30 Thread Zenghui Yu
Hi Eric, On 2021/2/24 4:56, Eric Auger wrote: In preparation for vSVA, let's accept userspace provided configs with more than one CD. We check the max CD against the host iommu capability and also the format (linear versus 2 level). Signed-off-by: Eric Auger Signed-off-by: Shameer Kolothum

Re: [PATCH v14 06/13] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2021-03-30 Thread Zenghui Yu
On 2021/2/24 4:56, Eric Auger wrote: @@ -1936,7 +1950,12 @@ static void arm_smmu_tlb_inv_range_domain(unsigned long iova, size_t size, }, }; - if (smmu_domain->stage == ARM_SMMU_DOMAIN_S1) { + if (ext_asid >= 0) { /* guest stage 1 invalidation */ +

[PATCH] iommu/vt-d: Fix status code for Allocate/Free PASID command

2021-02-26 Thread Zenghui Yu
e will otherwise see confusing kernel log under the command failure from guest side. Fix it. Fixes: 24f27d32ab6b ("iommu/vt-d: Enlightened PASID allocation") Signed-off-by: Zenghui Yu --- drivers/iommu/intel/pasid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dri

[PATCH] dma-debug: Delete outdated comment of the hash function

2020-12-29 Thread Zenghui Yu
We actually use dev_addr[26:13] as the index into dma_entry_hash. Given that the code itself is clear enough, let's drop the hardcoded comment so that we won't need to revisit it every time HASH_FN_{SHIFT,MASK} gets updated. Signed-off-by: Zenghui Yu --- kernel/dma/debug.c | 5 + 1 file

Re: [PATCH v10 11/11] vfio: Document nested stage control

2020-09-24 Thread Zenghui Yu
Hi Eric, On 2020/3/21 0:19, Eric Auger wrote: The VFIO API was enhanced to support nested stage control: a bunch of new iotcls, one DMA FAULT region and an associated specific IRQ. Let's document the process to follow to set up nested mode. Signed-off-by: Eric Auger [...] +The userspace

Re: [PATCH v10 05/11] vfio/pci: Register an iommu fault handler

2020-09-24 Thread Zenghui Yu
Hi Eric, On 2020/3/21 0:19, Eric Auger wrote: Register an IOMMU fault handler which records faults in the DMA FAULT region ring buffer. In a subsequent patch, we will add the signaling of a specific eventfd to allow the userspace to be notified whenever a new fault as shown up. Signed-off-by:

Re: [PATCH v10 04/11] vfio/pci: Add VFIO_REGION_TYPE_NESTED region type

2020-09-24 Thread Zenghui Yu
Hi Eric, On 2020/3/21 0:19, Eric Auger wrote: Add a new specific DMA_FAULT region aiming to exposed nested mode translation faults. The region has a ring buffer that contains the actual fault records plus a header allowing to handle it (tail/head indices, max capacity, entry size). At the

Re: [PATCH v10 01/11] vfio: VFIO_IOMMU_SET_PASID_TABLE

2020-09-23 Thread Zenghui Yu
Hi Eric, On 2020/3/21 0:19, Eric Auger wrote: From: "Liu, Yi L" This patch adds an VFIO_IOMMU_SET_PASID_TABLE ioctl which aims to pass the virtual iommu guest configuration to the host. This latter takes the form of the so-called PASID table. Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi

Re: [PATCH v7 18/24] iommu/arm-smmu-v3: Add support for Hardware Translation Table Update

2020-08-28 Thread Zenghui Yu
On 2020/5/20 1:54, Jean-Philippe Brucker wrote: @@ -4454,6 +4470,12 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) smmu->features |= ARM_SMMU_FEAT_E2H; } + if (reg & (IDR0_HA | IDR0_HD)) { + smmu->features |=

[PATCH] iommu/arm-smmu-v3: Fix l1 stream table size in the error message

2020-08-26 Thread Zenghui Yu
hing worse would happen. But let's be careful. Signed-off-by: Zenghui Yu --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index c1