[RFC PATCH v2 3/5] RDMA/hns: Size the doorbell bitmaps for PAGE_SIZE_MAX
From: Eric Curtin
Date: Tue Dec 01 2026 - 22:21:13 EST
From: Eric Curtin <eric.curtin@xxxxxxxxxx>
With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant. HNS_ROCE_DB_PER_PAGE was an enum constant and
sized the order0 and order1 bitmaps in struct hns_roce_db_pgdir.
Turn HNS_ROCE_DB_PER_PAGE into a macro that is evaluated at run time,
add HNS_ROCE_DB_PER_PAGE_MAX based on PAGE_SIZE_MAX, and use the latter
to declare the bitmaps so they are large enough for any page size.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
drivers/infiniband/hw/hns/hns_roce_device.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 5890ee69247c..1cd57a0477fa 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -166,9 +166,8 @@ enum {
#define HNS_ROCE_DB_TYPE_COUNT 2
#define HNS_ROCE_DB_UNIT_SIZE 4
-enum {
- HNS_ROCE_DB_PER_PAGE = PAGE_SIZE / 4
-};
+#define HNS_ROCE_DB_PER_PAGE (PAGE_SIZE / 4)
+#define HNS_ROCE_DB_PER_PAGE_MAX (PAGE_SIZE_MAX / 4)
enum hns_roce_reset_stage {
HNS_ROCE_STATE_NON_RST,
@@ -395,8 +394,9 @@ struct hns_roce_buf {
struct hns_roce_db_pgdir {
struct list_head list;
- DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE);
- DECLARE_BITMAP(order1, HNS_ROCE_DB_PER_PAGE / HNS_ROCE_DB_TYPE_COUNT);
+ DECLARE_BITMAP(order0, HNS_ROCE_DB_PER_PAGE_MAX);
+ DECLARE_BITMAP(order1,
+ HNS_ROCE_DB_PER_PAGE_MAX / HNS_ROCE_DB_TYPE_COUNT);
unsigned long *bits[HNS_ROCE_DB_TYPE_COUNT];
u32 *page;
dma_addr_t db_dma;