diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-03-15 20:58:51 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-03-16 17:18:01 +1100 |
commit | 7980f5e49b4e43152b02cb60ba4742b10839c3f4 (patch) | |
tree | ea80dd83bb1f28e679be63131428bd1743c20d7c | |
parent | d569e3a93767b85bc03cca082ca9b3dca351c988 (diff) | |
download | skiboot-7980f5e49b4e43152b02cb60ba4742b10839c3f4.zip skiboot-7980f5e49b4e43152b02cb60ba4742b10839c3f4.tar.gz skiboot-7980f5e49b4e43152b02cb60ba4742b10839c3f4.tar.bz2 |
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>
-rw-r--r-- | hw/xive.c | 47 | ||||
-rw-r--r-- | include/opal-api.h | 7 |
2 files changed, 53 insertions, 1 deletions
@@ -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); } diff --git a/include/opal-api.h b/include/opal-api.h index b814060..6adb564 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1128,6 +1128,13 @@ enum { OPAL_XIVE_ANY_CHIP = 0xffffffff, }; +/* Xive sync options */ +enum { + /* This bits are cumulative, arg is a girq */ + XIVE_SYNC_EAS = 0x00000001, /* Sync irq source */ + XIVE_SYNC_QUEUE = 0x00000002, /* Sync irq target */ +}; + /* Dump options */ enum { XIVE_DUMP_TM_HYP = 0, |