diff mbox series

[1/4] xive/p9: Use local_alloc() to allocate the XIVE bitmaps

Message ID 20201104222057.590816-2-clg@kaod.org
State Accepted
Headers show
Series xive/p9: small cleanups | expand

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (89a32b4930be829f37e6967354a759e38048d01f)

Commit Message

Cédric Le Goater Nov. 4, 2020, 10:20 p.m. UTC
These bitmaps are big (128K). On systems with multiple sockets, we
will run out of heap.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/xive.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/xive.c b/hw/xive.c
index c1786f288c90..34e211c3bf1a 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -2636,15 +2636,19 @@  static struct xive *init_one_xive(struct dt_node *np)
 		x->int_ipi_top = XIVE_INT_FIRST;
 
 	/* Allocate a few bitmaps */
-	x->eq_map = zalloc(BITMAP_BYTES(XIVE_EQ_COUNT >> 3));
+	x->eq_map = local_alloc(x->chip_id, BITMAP_BYTES(XIVE_EQ_COUNT >> 3), PAGE_SIZE);
 	assert(x->eq_map);
+	memset(x->eq_map, 0, BITMAP_BYTES(XIVE_EQ_COUNT >> 3));
+
 	/* Make sure we don't hand out 0 */
 	bitmap_set_bit(*x->eq_map, 0);
 
-	x->int_enabled_map = zalloc(BITMAP_BYTES(XIVE_INT_COUNT));
+	x->int_enabled_map = local_alloc(x->chip_id, BITMAP_BYTES(XIVE_INT_COUNT), PAGE_SIZE);
 	assert(x->int_enabled_map);
-	x->ipi_alloc_map = zalloc(BITMAP_BYTES(XIVE_INT_COUNT));
+	memset(x->int_enabled_map, 0, BITMAP_BYTES(XIVE_INT_COUNT));
+	x->ipi_alloc_map = local_alloc(x->chip_id, BITMAP_BYTES(XIVE_INT_COUNT), PAGE_SIZE);
 	assert(x->ipi_alloc_map);
+	memset(x->ipi_alloc_map, 0, BITMAP_BYTES(XIVE_INT_COUNT));
 
 	xive_dbg(x, "Handling interrupts [%08x..%08x]\n",
 		 x->int_base, x->int_max - 1);