summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-03-15 20:58:51 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-03-16 17:18:01 +1100
commit7980f5e49b4e43152b02cb60ba4742b10839c3f4 (patch)
treeea80dd83bb1f28e679be63131428bd1743c20d7c /hw
parentd569e3a93767b85bc03cca082ca9b3dca351c988 (diff)
downloadblackbird-skiboot-7980f5e49b4e43152b02cb60ba4742b10839c3f4.tar.gz
blackbird-skiboot-7980f5e49b4e43152b02cb60ba4742b10839c3f4.zip
xive: Add opal_xive_sync() to sync IRQ sources and queues
For now support two sync options, source and target queue, we'll add sync'ing the presentation layer later. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xive.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/hw/xive.c b/hw/xive.c
index 9ccf7e71..6553e9b2 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -2330,7 +2330,7 @@ static void xive_update_irq_mask(struct xive_src *s, uint32_t idx, bool masked)
in_be64(mmio_base + offset);
}
-static void xive_sync(struct xive *x)
+static int64_t xive_sync(struct xive *x)
{
uint64_t r;
void *p;
@@ -2367,6 +2367,8 @@ static void xive_sync(struct xive *x)
xive_regr(x, VC_GLOBAL_CONFIG);
unlock(&x->lock);
+
+ return 0;
}
static int64_t xive_source_set_xive(struct irq_source *is, uint32_t isn,
@@ -4228,6 +4230,48 @@ static int64_t opal_xive_dump_emu(uint32_t pir)
return OPAL_SUCCESS;
}
+static int64_t opal_xive_sync_irq_src(uint32_t girq)
+{
+ struct xive *x = xive_from_isn(girq);
+
+ if (!x)
+ return OPAL_PARAMETER;
+ return xive_sync(x);
+}
+
+static int64_t opal_xive_sync_irq_target(uint32_t girq)
+{
+ uint32_t target, vp_blk;
+ struct xive *x;
+
+ if (!xive_get_irq_targetting(girq, &target, NULL, NULL))
+ return OPAL_PARAMETER;
+ if (!xive_decode_vp(target, &vp_blk, NULL, NULL, NULL))
+ return OPAL_PARAMETER;
+ x = xive_from_pc_blk(vp_blk);
+ if (!x)
+ return OPAL_PARAMETER;
+ return xive_sync(x);
+}
+
+static int64_t opal_xive_sync(uint32_t type, uint32_t id)
+{
+ int64_t rc = OPAL_SUCCESS;;
+
+ if (type & XIVE_SYNC_EAS)
+ rc = opal_xive_sync_irq_src(id);
+ if (rc)
+ return rc;
+ if (type & XIVE_SYNC_QUEUE)
+ rc = opal_xive_sync_irq_target(id);
+ if (rc)
+ return rc;
+
+ /* Add more ... */
+
+ return rc;
+}
+
static int64_t opal_xive_dump(uint32_t type, uint32_t id)
{
switch (type) {
@@ -4328,6 +4372,7 @@ void init_xive(void)
opal_register(OPAL_XIVE_FREE_VP_BLOCK, opal_xive_free_vp_block, 1);
opal_register(OPAL_XIVE_GET_VP_INFO, opal_xive_get_vp_info, 5);
opal_register(OPAL_XIVE_SET_VP_INFO, opal_xive_set_vp_info, 3);
+ opal_register(OPAL_XIVE_SYNC, opal_xive_sync, 2);
opal_register(OPAL_XIVE_DUMP, opal_xive_dump, 2);
}
OpenPOWER on IntegriCloud