[Skiboot] [PATCH 43/60] xive: Add more checks for exploitation mode
Benjamin Herrenschmidt
benh at kernel.crashing.org
Thu Dec 22 14:16:51 AEDT 2016
All the exploitation mode APIs should return an error
if the XIVE is configured for XICS emulation.
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
hw/xive.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/xive.c b/hw/xive.c
index 481fc28..c2fe95f 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -3163,6 +3163,9 @@ static int64_t opal_xive_get_irq_config(uint32_t girq,
{
uint32_t vp;
+ if (xive_mode != XIVE_MODE_EXPL)
+ return OPAL_WRONG_STATE;
+
if (xive_get_irq_targetting(girq, &vp, out_prio, out_lirq)) {
*out_vp = vp;
return OPAL_SUCCESS;
@@ -3183,6 +3186,9 @@ static int64_t opal_xive_set_irq_config(uint32_t girq,
* WARNING: See comment in set_xive()
*/
+ if (xive_mode != XIVE_MODE_EXPL)
+ return OPAL_WRONG_STATE;
+
/* Let XIVE configure the EQ. We do the update without the
* synchronous flag, thus a cache update failure will result
* in us returning OPAL_BUSY
@@ -3273,6 +3279,8 @@ static int64_t opal_xive_set_queue_info(uint64_t vp, uint32_t prio,
bool group;
int64_t rc;
+ if (xive_mode != XIVE_MODE_EXPL)
+ return OPAL_WRONG_STATE;
if (!xive_eq_for_target(vp, prio, &blk, &idx))
return OPAL_PARAMETER;
@@ -3347,6 +3355,8 @@ static int64_t opal_xive_donate_page(uint32_t chip_id, uint64_t addr)
struct proc_chip *c = get_chip(chip_id);
struct list_node *n __unused;
+ if (xive_mode != XIVE_MODE_EXPL)
+ return OPAL_WRONG_STATE;
if (!c)
return OPAL_PARAMETER;
if (!c->xive)
@@ -3518,6 +3528,8 @@ static int64_t opal_xive_allocate_irq(uint32_t chip_id)
struct xive_ive *ive;
struct xive *x;
+ if (xive_mode != XIVE_MODE_EXPL)
+ return OPAL_WRONG_STATE;
if (!chip)
return OPAL_PARAMETER;
if (!chip->xive)
@@ -3561,6 +3573,8 @@ static int64_t opal_xive_free_irq(uint32_t girq)
struct xive_ive *ive;
uint32_t idx;
+ if (xive_mode != XIVE_MODE_EXPL)
+ return OPAL_WRONG_STATE;
if (!x || !is)
return OPAL_PARAMETER;
--
2.9.3
More information about the Skiboot
mailing list