@@ -262,6 +262,33 @@ static int its_handle_int(struct virt_its *its, uint64_t *cmdptr)
return 0;
}
+static int its_handle_mapc(struct virt_its *its, uint64_t *cmdptr)
+{
+ uint32_t collid = its_cmd_get_collection(cmdptr);
+ uint64_t rdbase = its_cmd_mask_field(cmdptr, 2, 16, 44);
+ int ret = -1;
+
+ if ( collid >= its->max_collections )
+ return ret;
+
+ if ( rdbase >= its->d->max_vcpus )
+ return ret;
+
+ spin_lock(&its->its_lock);
+ if ( its->coll_table )
+ {
+ if ( its_cmd_get_validbit(cmdptr) )
+ its->coll_table[collid] = rdbase;
+ else
+ its->coll_table[collid] = UNMAPPED_COLLECTION;
+
+ ret = 0;
+ }
+ spin_unlock(&its->its_lock);
+
+ return ret;
+}
+
#define ITS_CMD_BUFFER_SIZE(baser) ((((baser) & 0xff) + 1) << 12)
static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its,
@@ -288,6 +315,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its,
case GITS_CMD_INT:
its_handle_int(its, cmdptr);
break;
+ case GITS_CMD_MAPC:
+ its_handle_mapc(its, cmdptr);
+ break;
case GITS_CMD_SYNC:
/* We handle ITS commands synchronously, so we ignore SYNC. */
break;
The MAPC command associates a given collection ID with a given redistributor, thus mapping collections to VCPUs. We just store the vcpu_id in the collection table for that. Signed-off-by: Andre Przywara <andre.przywara@arm.com> --- xen/arch/arm/vgic-v3-its.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)