Re: [PATCH v2 18/31] iommu/vt-d: Cache max domain ID to avoid redundant calculation
From: Baolu Lu
Date: Sun Jul 26 2026 - 23:09:51 EST
On 3/28/26 00:01, Xu Yilun wrote:
From: Lu Baolu<baolu.lu@xxxxxxxxxxxxxxx>
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<baolu.lu@xxxxxxxxxxxxxxx>
Signed-off-by: Xu Yilun<yilun.xu@xxxxxxxxxxxxxxx>
---
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!