[PATCH v2 0/2] iommu/vt-d: Use ida for domain ID management

Lu Baolu posted 2 patches 9 months, 1 week ago
drivers/iommu/intel/dmar.c  |  4 ++
drivers/iommu/intel/iommu.c | 90 ++++++++-----------------------------
drivers/iommu/intel/iommu.h | 21 +++++++--
3 files changed, 40 insertions(+), 75 deletions(-)
[PATCH v2 0/2] iommu/vt-d: Use ida for domain ID management
Posted by Lu Baolu 9 months, 1 week ago
This converts the Intel iommu driver's domain ID management from a
fixed-size bitmap to the dynamic ida allocator. This improves memory
efficiency by only allocating resources for the domain IDs actually in
use, rather than the maximum possible number.

The also includes necessary cleanups after the ida conversion, including
locking adjustment for the ida.

---
Change log:
v2:
 - Drop the last patch which simplified the code with __free(). There
   needs a helper like xa_store_or_{reset,kfree}(). Thus I plan to put
   it a separated series with broader reviewers.

v1: https://lore.kernel.org/linux-iommu/20250423031020.2189546-1-baolu.lu@linux.intel.com/

Lu Baolu (2):
  iommu/vt-d: Use ida to manage domain id
  iommu/vt-d: Replace spin_lock with mutex to protect domain ida

 drivers/iommu/intel/dmar.c  |  4 ++
 drivers/iommu/intel/iommu.c | 90 ++++++++-----------------------------
 drivers/iommu/intel/iommu.h | 21 +++++++--
 3 files changed, 40 insertions(+), 75 deletions(-)

-- 
2.43.0
Re: [PATCH v2 0/2] iommu/vt-d: Use ida for domain ID management
Posted by Baolu Lu 9 months ago
On 4/30/25 10:11, Lu Baolu wrote:
> This converts the Intel iommu driver's domain ID management from a
> fixed-size bitmap to the dynamic ida allocator. This improves memory
> efficiency by only allocating resources for the domain IDs actually in
> use, rather than the maximum possible number.
> 
> The also includes necessary cleanups after the ida conversion, including
> locking adjustment for the ida.
> 
> ---
> Change log:
> v2:
>   - Drop the last patch which simplified the code with __free(). There
>     needs a helper like xa_store_or_{reset,kfree}(). Thus I plan to put
>     it a separated series with broader reviewers.
> 
> v1:https://lore.kernel.org/linux-iommu/20250423031020.2189546-1- 
> baolu.lu@linux.intel.com/
> 
> Lu Baolu (2):
>    iommu/vt-d: Use ida to manage domain id
>    iommu/vt-d: Replace spin_lock with mutex to protect domain ida

Queued for v6.16-rc1.