[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v2 18/26] ARM: vITS: handle MAPD command
The MAPD command maps a device by associating a memory region for storing ITTEs with a certain device ID. We just store the given guest physical address in the device table. We don't map the device tables permanently, as their alignment requirement is only 256 Bytes, thus making mapping of several tables complicated. We map the device tables on demand when we need them later. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/vgic-its.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xen/arch/arm/vgic-its.c b/xen/arch/arm/vgic-its.c index b425776..918b504 100644 --- a/xen/arch/arm/vgic-its.c +++ b/xen/arch/arm/vgic-its.c @@ -255,6 +255,27 @@ static int its_handle_mapc(struct virt_its *its, uint64_t *cmdptr) return ret; } +static int its_handle_mapd(struct virt_its *its, uint64_t *cmdptr) +{ + uint32_t devid = its_cmd_get_deviceid(cmdptr); + int size = its_cmd_get_size(cmdptr); + bool valid = its_cmd_get_validbit(cmdptr); + paddr_t itt_addr = its_cmd_mask_field(cmdptr, 2, 0, 52) & GENMASK(51, 8); + + if ( !its->dev_table ) + return -1; + + spin_lock(&its->its_lock); + if ( valid ) + its->dev_table[devid] = DEV_TABLE_ENTRY(itt_addr, size + 1); + else + its->dev_table[devid] = 0; + + spin_unlock(&its->its_lock); + + 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, @@ -284,6 +305,9 @@ static int vgic_its_handle_cmds(struct domain *d, struct virt_its *its, case GITS_CMD_MAPC: its_handle_mapc(its, cmdptr); break; + case GITS_CMD_MAPD: + its_handle_mapd(its, cmdptr); + break; case GITS_CMD_SYNC: /* We handle ITS commands synchronously, so we ignore SYNC. */ break; -- 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 |