iommu/arm-smmu-v3: Change vmid alloc strategy from bitmap to ida
authorDawei Li <set_pte_at@outlook.com>
Sat, 15 Jul 2023 16:16:21 +0000 (00:16 +0800)
committerWill Deacon <will@kernel.org>
Tue, 1 Aug 2023 08:37:24 +0000 (09:37 +0100)
commit1672730cffaf56ea3f7b697d499d9697a34b77f1
treeaaf99acbf21333ad0a39b75ec1a59540aaadfbe4
parent6eaae198076080886b9e7d57f4ae06fa782f90ef
iommu/arm-smmu-v3: Change vmid alloc strategy from bitmap to ida

For current implementation of vmid allocation of arm smmu-v3, a per-smmu
devide bitmap of 64K bits(8K bytes) is allocated on behalf of possible VMID
range, which is two pages for some architectures. Besides that, its memory
consumption is 'static', despite of how many VMIDs are allocated actually.

That's memory inefficient and lack of scalability.

So an IDA based implementation is introduced to address this issue, which
is capable of self-expanding on the actual need of VMID allocation.

Signed-off-by: Dawei Li <set_pte_at@outlook.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/TYCP286MB2323E0C525FF9F94E3B07C7ACA35A@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h