Skip to content

Commit

Permalink
xive: Add opal_xive_sync() to sync IRQ sources and queues
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ozbenh authored and stewartsmith committed Mar 16, 2017
1 parent d569e3a commit 7980f5e
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
47 changes: 46 additions & 1 deletion hw/xive.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

7 changes: 7 additions & 0 deletions include/opal-api.h
Expand Up @@ -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,
Expand Down

0 comments on commit 7980f5e

Please sign in to comment.