|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v2 20/26] 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 | 14 ++++++++++++++
xen/arch/arm/vgic-its.c | 41 +++++++++++++++++++++++++++++++++++++++++
xen/include/asm-arm/gic-its.h | 2 ++
3 files changed, 57 insertions(+)
diff --git a/xen/arch/arm/gic-its.c b/xen/arch/arm/gic-its.c
index 0acbd83..1da28b9 100644
--- a/xen/arch/arm/gic-its.c
+++ b/xen/arch/arm/gic-its.c
@@ -799,6 +799,20 @@ int gicv3_assign_guest_event(struct domain *d, uint32_t
devid, uint32_t eventid,
hlpi.vcpu_id = v->vcpu_id;
hlpip->data = hlpi.data;
+ 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 devid, uint32_t eventid, int vcpu_id)
+{
+ union host_lpi *hlpip;
+
+ hlpip = find_guest_lpi(d, devid, eventid);
+ if ( !hlpip )
+ return -1;
+
+ hlpip->vcpu_id = vcpu_id;
return 0;
}
diff --git a/xen/arch/arm/vgic-its.c b/xen/arch/arm/vgic-its.c
index f9f438a..7c80c17 100644
--- a/xen/arch/arm/vgic-its.c
+++ b/xen/arch/arm/vgic-its.c
@@ -316,6 +316,41 @@ 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;
+
+ 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;
+
+ /* TODO: lookup currently-in-guest virtual IRQs and migrate them */
+
+ put_devid_evid(its, itte);
+
+out_unlock:
+ spin_unlock(&its->its_lock);
+
+ gicv3_lpi_change_vcpu(its->d, devid, eventid, 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,
@@ -352,6 +387,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 9843674..c5355f9 100644
--- a/xen/include/asm-arm/gic-its.h
+++ b/xen/include/asm-arm/gic-its.h
@@ -140,6 +140,8 @@ int gicv3_its_map_device(struct domain *d, int host_devid,
int guest_devid,
int gicv3_assign_guest_event(struct domain *d,
uint32_t devid, uint32_t eventid,
struct vcpu *v, uint32_t virt_lpi);
+int gicv3_lpi_change_vcpu(struct domain *d,
+ uint32_t devid, uint32_t eventid, int vcpu_id);
#else
--
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 |