diff mbox series

[35/61] xive/p10: Add option flags to the XIVE exploitation mode

Message ID 20210719132012.150948-36-hegdevasant@linux.vnet.ibm.com
State Superseded
Headers show
Series P10 Enablement | expand

Commit Message

Vasant Hegde July 19, 2021, 1:19 p.m. UTC
From: Cédric Le Goater <clg@kaod.org>

Change sligthly the semantic of the parameter of the opal_xive_reset()
OPAL call to configure the interrupt mode of the machine and, at the
same time, to configure the associated options. These options only
apply to the XIVE exploitation mode.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hw/xive2.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/hw/xive2.c b/hw/xive2.c
index 1204c865c..d0a098009 100644
--- a/hw/xive2.c
+++ b/hw/xive2.c
@@ -172,6 +172,14 @@  static enum {
 	XIVE_MODE_NONE,
 } xive_mode = XIVE_MODE_NONE;
 
+/*
+ * The XIVE exploitation mode options indicates the active features and
+ * is part of the mode parameter of the opal_xive_reset() call
+ */
+static uint64_t xive_expl_options;
+
+#define XIVE_EXPL_ALL_OPTIONS 0
+
 /*
  * Each source controller has one of these. There's one embedded in
  * the XIVE struct for IPIs
@@ -3927,11 +3935,11 @@  void xive2_cpu_reset(void)
 	in_be64(xs->tm_ring1 + TM_SPC_PULL_POOL_CTX);
 }
 
-static int64_t __xive_reset(uint64_t version)
+static int64_t __xive_reset(uint64_t mode)
 {
 	struct proc_chip *chip;
 
-	xive_mode = version;
+	xive_mode = mode;
 
 	/* Mask all interrupt sources */
 	irq_for_each_source(xive_reset_mask_source_cb, NULL);
@@ -3969,13 +3977,20 @@  int64_t xive2_reset(void)
 	return __xive_reset(XIVE_MODE_EXPL);
 }
 
-static int64_t opal_xive_reset(uint64_t version)
+static int64_t opal_xive_reset(uint64_t mode)
 {
-	prlog(PR_DEBUG, "XIVE reset, version: %d...\n", (int)version);
+	prlog(PR_DEBUG, "XIVE reset. mode = %llx\n", mode);
 
-	if (version != XIVE_MODE_EXPL) {
-		prerror("ignoring version %lld at reset. "
-			"XIVE exploitation mode is the default\n", version);
+	if (!(mode & XIVE_MODE_EXPL)) {
+		prlog(PR_NOTICE, "No emulation mode. XIVE exploitation mode "
+		      "is the default\n");
+	}
+
+	xive_expl_options = mode & ~XIVE_MODE_EXPL;
+	if (xive_expl_options & ~XIVE_EXPL_ALL_OPTIONS) {
+		prerror("invalid XIVE exploitation mode option %016llx\n",
+			xive_expl_options);
+		return OPAL_PARAMETER;
 	}
 
 	return __xive_reset(XIVE_MODE_EXPL);