Re: [PATCH v2 18/31] iommu/vt-d: Cache max domain ID to avoid redundant calculation

Baolu Lu <[email protected]> Mon, 27 Jul 2026 11:07:25 +0800
Newsgroups dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <[email protected]>
On 3/28/26 00:01, Xu Yilun wrote:
> From: Lu Baolu<[email protected]>
> 
> The cap_ndoms() helper calculates the maximum available domain ID from
> the value of capability register, which can be inefficient if called
> repeatedly. Cache the maximum supported domain ID in max_domain_id field
> during initialization to avoid redundant calls to cap_ndoms() throughout
> the IOMMU driver.
> 
> No functionality change.
> 
> Signed-off-by: Lu Baolu<[email protected]>
> Signed-off-by: Xu Yilun<[email protected]>
> ---
>   drivers/iommu/intel/iommu.h |  1 +
>   drivers/iommu/intel/dmar.c  |  1 +
>   drivers/iommu/intel/iommu.c | 10 +++++-----
>   3 files changed, 7 insertions(+), 5 deletions(-)

This patch has been queued for iommu/next. Thanks!