[PATCH 16/19] iommu/amd: Use roundup_pow_two() instead of get_order()
Jason Gunthorpe
jgg at nvidia.com
Tue Feb 4 10:34:57 PST 2025
1 << (get_order(x) + PAGE_SHIFT) == roundup_pow_two()
Use the shorter version.
Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
---
drivers/iommu/amd/init.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index f1c5041647173c..7d77929bc63af3 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -247,10 +247,7 @@ static void init_translation_status(struct amd_iommu *iommu)
static inline unsigned long tbl_size(int entry_size, int last_bdf)
{
- unsigned shift = PAGE_SHIFT +
- get_order((last_bdf + 1) * entry_size);
-
- return 1UL << shift;
+ return roundup_pow_of_two((last_bdf + 1) * entry_size);
}
int amd_iommu_get_num_iommus(void)
--
2.43.0
More information about the linux-arm-kernel
mailing list