[Skiboot] [PATCH 48/60] xive: Add *any chip* for allocating interrupts

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Dec 22 14:16:56 AEDT 2016


Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 hw/xive.c          | 8 +++++++-
 include/opal-api.h | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/hw/xive.c b/hw/xive.c
index b9956ca..acb0c8b 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -3782,13 +3782,19 @@ static int64_t opal_xive_alloc_vp_block(uint32_t alloc_order)
 
 static int64_t opal_xive_allocate_irq(uint32_t chip_id)
 {
-	struct proc_chip *chip = get_chip(chip_id);
+	struct proc_chip *chip;
 	int idx, base_idx, max_count, girq;
 	struct xive_ive *ive;
 	struct xive *x;
 
 	if (xive_mode != XIVE_MODE_EXPL)
 		return OPAL_WRONG_STATE;
+
+	/* XXX Make this try multiple chips ... */
+	if (chip_id == OPAL_XIVE_ANY_CHIP)
+		chip_id = this_cpu()->chip_id;
+
+	chip = get_chip(chip_id);
 	if (!chip)
 		return OPAL_PARAMETER;
 	if (!chip->xive)
diff --git a/include/opal-api.h b/include/opal-api.h
index 8d3382b..62b52d6 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -1117,6 +1117,11 @@ enum {
 	OPAL_XIVE_VP_ENABLED		= 0x00000001,
 };
 
+/* "Any chip" replacement for chip ID for allocation functions */
+enum {
+	OPAL_XIVE_ANY_CHIP		= 0xffffffff,
+};
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __OPAL_API_H */
-- 
2.9.3



More information about the Skiboot mailing list