aboutsummaryrefslogtreecommitdiff
path: root/hw/xive.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2020-06-12 13:37:31 +0200
committerOliver O'Halloran <oohall@gmail.com>2020-06-30 11:47:38 +1000
commita182665b962e9ac6ea1f287852b958778e60c0ed (patch)
treebd6f6d2ffb63d3c90ff35de118c2132dea90a352 /hw/xive.c
parentc5e43bf19bb3249f38d37e977cded8c234714dd7 (diff)
downloadskiboot-a182665b962e9ac6ea1f287852b958778e60c0ed.zip
skiboot-a182665b962e9ac6ea1f287852b958778e60c0ed.tar.gz
skiboot-a182665b962e9ac6ea1f287852b958778e60c0ed.tar.bz2
xive/p9: Modify the size of the VP space
The VP space is 19bits wide but the number of XIVE VPs software can use depends on the configured number of EQs. We have 1M EQs and we use 8 priorities per VP. Therefore, our VP space is limited to 128k. Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'hw/xive.c')
-rw-r--r--hw/xive.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/hw/xive.c b/hw/xive.c
index 960f74d..ccdb20b 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -201,15 +201,19 @@
* we will allocate half of the above. We might add support for
* 2 blocks per chip later if necessary.
*
- * XXX Adjust that based on BAR value ?
+ * TODO: adjust the PC BAR range
*/
#define VP_PER_PAGE (0x10000 / sizeof(struct xive_vp))
#define NVT_SHIFT 19 /* in sync with EQ_W6_NVT_INDEX */
-#define MAX_VP_ORDER NVT_SHIFT /* 512k */
-#define MAX_VP_COUNT (1ul << MAX_VP_ORDER)
-#define XIVE_VP_TABLE_SIZE ((MAX_VP_COUNT / VP_PER_PAGE) * XIVE_VSD_SIZE)
+/*
+ * We use 8 priorities per VP and the number of EQs is configured to
+ * 1M. Therefore, our VP space is limited to 128k.
+ */
+#define XIVE_VP_ORDER (XIVE_EQ_ORDER - 3) /* 128k */
+#define XIVE_VP_COUNT (1ul << XIVE_VP_ORDER)
+#define XIVE_VP_TABLE_SIZE ((XIVE_VP_COUNT / VP_PER_PAGE) * XIVE_VSD_SIZE)
/* Initial number of VPs (XXX Make it a variable ?). Round things
* up to a max of 32 cores per chip
@@ -385,7 +389,7 @@ struct xive {
* table (ie, pages of pointers) and populate enough of the pages
* for our basic setup using 64K pages.
*
- * The size of the indirect tables are driven by MAX_VP_COUNT and
+ * The size of the indirect tables are driven by XIVE_VP_COUNT and
* XIVE_EQ_COUNT. The number of pre-allocated ones are driven by
* INITIAL_VP_COUNT (number of EQ depends on number of VP) in block
* mode, otherwise we only preallocate INITIAL_BLK0_VP_COUNT on
@@ -971,12 +975,12 @@ static void xive_init_vp_allocator(void)
prlog(PR_INFO, "XIVE: %d chips considered for VP allocations\n",
1 << xive_chips_alloc_bits);
- /* Allocate a buddy big enough for MAX_VP_ORDER allocations.
+ /* Allocate a buddy big enough for XIVE_VP_ORDER allocations.
*
* each bit in the buddy represents 1 << xive_chips_alloc_bits
* VPs.
*/
- xive_vp_buddy = buddy_create(MAX_VP_ORDER);
+ xive_vp_buddy = buddy_create(XIVE_VP_ORDER);
assert(xive_vp_buddy);
/* We reserve the whole range of VPs representing HW chips.
@@ -4470,7 +4474,7 @@ static void xive_reset_one(struct xive *x)
* either keep a bitmap of allocated VPs or add an iterator to
* the buddy which is trickier but doable.
*/
- for (i = 0; i < MAX_VP_COUNT; i++) {
+ for (i = 0; i < XIVE_VP_COUNT; i++) {
struct xive_vp *vp;
struct xive_vp vp0 = {0};