[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v10 20/32] ARM: vITS: handle INT command



Hi Andre,

On 05/26/2017 06:35 PM, 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@xxxxxxx > ---
  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 8f4a9e1..80a4625 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -286,6 +286,24 @@ static uint64_t its_cmd_mask_field(uint64_t *its_cmd, 
unsigned int word,
  #define its_cmd_get_validbit(cmd)       its_cmd_mask_field(cmd, 2, 63,  1)
  #define its_cmd_get_ittaddr(cmd)        (its_cmd_mask_field(cmd, 2, 8, 44) << 
8)
+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);

Should no you call the newly introduced vgic_vcpu_inject_lpi here? This would avoid on relying the vcpu in the ITTE.

But I guess this is not strictly important if the table is protected. So:

Reviewed-by: Julien Grall <julien.grall@xxxxxxx>

+
+    return 0;
+}
+
  #define ITS_CMD_BUFFER_SIZE(baser)      ((((baser) & 0xff) + 1) << 12)
  #define ITS_CMD_OFFSET(reg)             ((reg) & GENMASK(19, 5))
@@ -315,6 +333,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its) switch ( its_cmd_get_command(command) )
          {
+        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,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.