diff mbox

[01/13] xive: Fix PIR2VP_BLK for 2-chip systems

Message ID 20170116043635.25849-1-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt Jan. 16, 2017, 4:36 a.m. UTC
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/xive.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Stewart Smith Feb. 2, 2017, 7:28 a.m. UTC | #1
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

series (except patch 9, as discussed on irc) merged to master as of 48dee7a
diff mbox

Patch

diff --git a/hw/xive.c b/hw/xive.c
index 41aee34..3d29e0e 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -413,6 +413,15 @@  static struct dt_node *xive_dt_node;
 static uint32_t xive_block_to_chip[XIVE_MAX_CHIPS];
 static uint32_t xive_block_count;
 
+static uint32_t xive_chip_to_block(uint32_t chip_id)
+{
+	struct proc_chip *c = get_chip(chip_id);
+
+	assert(c);
+	assert(c->xive);
+	return c->xive->block_id;
+}
+
 /* Conversion between GIRQ and block/index.
  *
  * ------------------------------------
@@ -443,7 +452,7 @@  static uint32_t xive_block_count;
 /* Routing of physical processors to VPs */
 #ifdef USE_BLOCK_GROUP_MODE
 #define PIR2VP_IDX(__pir)	(0x80 | P9_PIR2LOCALCPU(__pir))
-#define PIR2VP_BLK(__pir)	(P9_PIR2GCID(__pir))
+#define PIR2VP_BLK(__pir)	(xive_chip_to_block(P9_PIR2GCID(__pir)))
 #define VP2PIR(__blk, __idx)	(P9_PIRFROMLOCALCPU(VC_BLK_TO_CHIP(__blk), (__idx) & 0x7f))
 #else
 #define PIR2VP_IDX(__pir)	(0x800 | (P9_PIR2GCID(__pir) << 7) | P9_PIR2LOCALCPU(__pir))