[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 18/24] ARM: vITS: handle MOVI command
The MOVI command moves the interrupt affinity from one redistributor (read: VCPU) to another. For now migration of "live" LPIs is not yet implemented, but we store the changed affinity in the host LPI structure and in our virtual ITTE. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/gic-its.c | 16 +++++++++++++++ xen/arch/arm/vgic-its.c | 46 +++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/gic-its.h | 1 + 3 files changed, 63 insertions(+) diff --git a/xen/arch/arm/gic-its.c b/xen/arch/arm/gic-its.c index 6bac422..d1b1cbb 100644 --- a/xen/arch/arm/gic-its.c +++ b/xen/arch/arm/gic-its.c @@ -618,6 +618,22 @@ int gicv3_lpi_drop_host_lpi(struct host_its *its, return 0; } +/* Changes the target VCPU for a given host LPI assigned to a domain. */ +int gicv3_lpi_change_vcpu(struct domain *d, uint32_t host_lpi, int new_vcpu_id) +{ + union host_lpi *hlpip, hlpi; + + hlpip = gic_find_host_lpi(host_lpi, d); + if ( !hlpip ) + return -1; + + hlpi.data = hlpip->data; + hlpi.vcpu_id = new_vcpu_id; + hlpip->data = hlpi.data; + + return 0; +} + void gicv3_its_dt_init(const struct dt_device_node *node) { const struct dt_device_node *its = NULL; diff --git a/xen/arch/arm/vgic-its.c b/xen/arch/arm/vgic-its.c index 70897dd..c0a60ad 100644 --- a/xen/arch/arm/vgic-its.c +++ b/xen/arch/arm/vgic-its.c @@ -327,6 +327,46 @@ out_unlock: return ret; } +static int its_handle_movi(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t devid = its_cmd_get_deviceid(cmdptr); + uint32_t eventid = its_cmd_get_id(cmdptr); + int collid = its_cmd_get_collection(cmdptr); + struct vits_itte *itte; + struct vcpu *vcpu; + uint32_t host_lpi = 0; + + if ( collid >= its->max_collections ) + return -1; + + spin_lock(&its->its_lock); + + vcpu = get_vcpu_from_collection(its, collid); + if ( !vcpu ) + goto out_unlock; + + itte = get_devid_evid(its, devid, eventid); + if ( !itte ) + goto out_unlock; + + itte->collection = collid; + host_lpi = itte->hlpi; + + /* TODO: lookup currently-in-guest virtual IRQs and migrate them */ + + put_devid_evid(its, itte); + +out_unlock: + spin_unlock(&its->its_lock); + + if ( !host_lpi ) + return -1; + + gicv3_lpi_change_vcpu(its->d, host_lpi, vcpu->vcpu_id); + + return 0; +} + #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its, @@ -363,6 +403,12 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its, case GITS_CMD_MAPTI: its_handle_mapti(its, cmdptr); break; + case GITS_CMD_MOVALL: + gdprintk(XENLOG_G_INFO, "ITS: ignoring MOVALL command\n"); + break; + case GITS_CMD_MOVI: + its_handle_movi(its, cmdptr); + break; case GITS_CMD_SYNC: /* We handle ITS commands synchronously, so we ignore SYNC. */ break; diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h index 3b2e5c0..7e1142f 100644 --- a/xen/include/asm-arm/gic-its.h +++ b/xen/include/asm-arm/gic-its.h @@ -133,6 +133,7 @@ int gicv3_its_map_device(struct host_its *hw_its, struct domain *d, int gicv3_lpi_allocate_host_lpi(struct host_its *its, uint32_t devid, uint32_t eventid, struct vcpu *v, int virt_lpi); +int gicv3_lpi_change_vcpu(struct domain *d, uint32_t host_lpi, int new_vcpu_id); int gicv3_lpi_drop_host_lpi(struct host_its *its, uint32_t devid, uint32_t eventid, uint32_t host_lpi); -- 2.9.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |