Message ID | 1491957874-31600-17-git-send-email-andre.przywara@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, On 12/04/17 01:44, Andre Przywara wrote: > The INT command sets a given LPI identified by a DeviceID/EventID pair > as pending and thus triggers it to be injected. > > Signed-off-by: Andre Przywara <andre.przywara@arm.com> > --- > xen/arch/arm/vgic-v3-its.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c > index e24ab60..eeb1306 100644 > --- a/xen/arch/arm/vgic-v3-its.c > +++ b/xen/arch/arm/vgic-v3-its.c > @@ -342,6 +342,24 @@ static int its_handle_clear(struct virt_its *its, uint64_t *cmdptr) > return 0; > } > > +static int its_handle_int(struct virt_its *its, uint64_t *cmdptr) > +{ > + uint32_t devid = its_cmd_get_deviceid(cmdptr); > + uint32_t eventid = its_cmd_get_id(cmdptr); > + struct vcpu *vcpu; > + uint32_t vlpi; > + > + if ( !read_itte(its, devid, eventid, &vcpu, &vlpi) ) > + return -1; Same problem as we patch #2, the vcpu may have changed by MOVI and pending_irq would be protected by the wrong lock. > + > + if ( vlpi == INVALID_LPI ) > + return -1; > + > + vgic_vcpu_inject_irq(vcpu, vlpi); > + > + return 0; > +} > + > #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) > #define ITS_CMD_OFFSET(reg) ((reg) & GENMASK(19, 5)) > > @@ -374,6 +392,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its) > case GITS_CMD_CLEAR: > ret = its_handle_clear(its, command); > break; > + case GITS_CMD_INT: > + ret = its_handle_int(its, command); > + break; > case GITS_CMD_SYNC: > /* We handle ITS commands synchronously, so we ignore SYNC. */ > break; > Cheers,
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index e24ab60..eeb1306 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -342,6 +342,24 @@ static int its_handle_clear(struct virt_its *its, uint64_t *cmdptr) return 0; } +static int its_handle_int(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t devid = its_cmd_get_deviceid(cmdptr); + uint32_t eventid = its_cmd_get_id(cmdptr); + struct vcpu *vcpu; + uint32_t vlpi; + + if ( !read_itte(its, devid, eventid, &vcpu, &vlpi) ) + return -1; + + if ( vlpi == INVALID_LPI ) + return -1; + + vgic_vcpu_inject_irq(vcpu, vlpi); + + return 0; +} + #define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12) #define ITS_CMD_OFFSET(reg) ((reg) & GENMASK(19, 5)) @@ -374,6 +392,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its) case GITS_CMD_CLEAR: ret = its_handle_clear(its, command); break; + case GITS_CMD_INT: + ret = its_handle_int(its, command); + break; case GITS_CMD_SYNC: /* We handle ITS commands synchronously, so we ignore SYNC. */ break;
The INT command sets a given LPI identified by a DeviceID/EventID pair as pending and thus triggers it to be injected. Signed-off-by: Andre Przywara <andre.przywara@arm.com> --- xen/arch/arm/vgic-v3-its.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)