Re: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode

2021-09-26 Thread Lu Baolu
On 9/27/21 9:33 AM, Tian, Kevin wrote: From: Tian, Kevin Sent: Monday, September 27, 2021 9:30 AM From: Tian, Kevin Sent: Monday, September 27, 2021 9:12 AM From: Lu Baolu Sent: Sunday, September 26, 2021 7:46 PM An iommu domain could be allocated and mapped before it's attached to any devi

RE: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode

2021-09-26 Thread Tian, Kevin
> From: Tian, Kevin > Sent: Monday, September 27, 2021 9:30 AM > > > From: Tian, Kevin > > Sent: Monday, September 27, 2021 9:12 AM > > > > > From: Lu Baolu > > > Sent: Sunday, September 26, 2021 7:46 PM > > > > > > An iommu domain could be allocated and mapped before it's attached to > > > any >

RE: [PATCH v2 3/3] iommu/vt-d: Use second level for GPA->HPA translation

2021-09-26 Thread Tian, Kevin
> From: Lu Baolu > Sent: Sunday, September 26, 2021 7:46 PM > > The IOMMU VT-d implementation uses the first level for GPA->HPA > translation > by default. Although both the first level and the second level could handle > the DMA translation, they're different in some way. For example, the second

RE: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode

2021-09-26 Thread Tian, Kevin
> From: Tian, Kevin > Sent: Monday, September 27, 2021 9:12 AM > > > From: Lu Baolu > > Sent: Sunday, September 26, 2021 7:46 PM > > > > An iommu domain could be allocated and mapped before it's attached to > > any > > device. This requires that in scalable mode, when the domain is allocated, > >

RE: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode

2021-09-26 Thread Tian, Kevin
> From: Lu Baolu > Sent: Sunday, September 26, 2021 7:46 PM > > An iommu domain could be allocated and mapped before it's attached to > any > device. This requires that in scalable mode, when the domain is allocated, > the format (FL or SL) of the page table must be determined. In order to > achi

RE: [PATCH v2 1/3] iommu/vt-d: Remove duplicate identity domain flag

2021-09-26 Thread Tian, Kevin
> From: Lu Baolu > Sent: Sunday, September 26, 2021 7:46 PM > > The iommu_domain data structure already has the "type" field to keep the > type of a domain. It's unnecessary to have the > DOMAIN_FLAG_STATIC_IDENTITY > flag in the vt-d implementation. This cleans it up with no functionality > chan

[PATCH v2] iommu/arm-smmu-v3: poll cmdq until it has space

2021-09-26 Thread Fernand Sieber via iommu
When a thread sends commands to the SMMU, it needs to allocate some space to write its commands in a ring buffer. The allocation algorithms works as follows: until enough free spaced is available in the queue, repeat the following outer loop. First, try to acquire an exclusive lock to read the con

[PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable

2021-09-26 Thread Christophe JAILLET
'smmu->asids' is a bitmap. So use 'devm_kzalloc()' to simplify code, improve the semantic of the code and avoid some open-coded arithmetic in allocator arguments. Signed-off-by: Christophe JAILLET --- drivers/iommu/tegra-smmu.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --gi

[PATCH v2 1/3] iommu/vt-d: Remove duplicate identity domain flag

2021-09-26 Thread Lu Baolu
The iommu_domain data structure already has the "type" field to keep the type of a domain. It's unnecessary to have the DOMAIN_FLAG_STATIC_IDENTITY flag in the vt-d implementation. This cleans it up with no functionality change. Signed-off-by: Lu Baolu --- include/linux/intel-iommu.h | 3 --- dr

[PATCH v2 3/3] iommu/vt-d: Use second level for GPA->HPA translation

2021-09-26 Thread Lu Baolu
The IOMMU VT-d implementation uses the first level for GPA->HPA translation by default. Although both the first level and the second level could handle the DMA translation, they're different in some way. For example, the second level translation has separate controls for the Access/Dirty page track

[PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode

2021-09-26 Thread Lu Baolu
An iommu domain could be allocated and mapped before it's attached to any device. This requires that in scalable mode, when the domain is allocated, the format (FL or SL) of the page table must be determined. In order to achieve this, the platform should support consistent SL or FL capabilities on

[PATCH v2 0/3] iommu/t-d: Use SL for GPA->HPA translation

2021-09-26 Thread Lu Baolu
v1: https://lore.kernel.org/linux-iommu/20210924022931.780963-1-baolu...@linux.intel.com/ Change log: v1->v2: - Split the cleanup into a separated patch - Add a patch to check sanity of capabilities - Consider capabilities when determining FL or SL Best regards, Baolu Lu Baolu (3): iommu/vt