From: Julien Grall Subject: [PATCH for-4.6] xen/arm: vgic-v2: Map the GIC virtual CPU interface with the correct size Date: Thu, 17 Sep 2015 19:00:03 +0100 Message-ID: <1442512803-798-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZcdUx-0005Y2-Ln for xen-devel@lists.xenproject.org; Thu, 17 Sep 2015 18:01:31 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Julien Grall , Wei.Liu2@citrix.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On GICv2, the GIC virtual CPU interface is at minimum 8KB. Due some to some necessary quirk for GIC using 64KB stride, we are mapping the region in 2 time. The first mapping is 4KB and the second one is 8KB, i.e 12KB in total. Although the minimum supported size (and widely used) is 8KB. This means that we are mapping 4KB more to any guest using GICv2. While this looks scary at first glance, the GIC virtual CPU interface is most frequently at the end the GIC I/O region. So we will most likely map an an unused I/O region or a mirrored version of GICV for platform using 64KB stride. Nonetheless, fix the second mapping to only map 4KB. Signed-off-by: Julien Grall --- This is a candidate for Xen 4.6 and backport to Xen 4.5. Without this patch we are mapping 4KB more than we should to any guest. While this looks scary at first glance, in pratice there is always space after the GIC I/O region. So we would just expose unused I/O range. Boot tested on midway (ARM32) and x-gene (ARM64). --- xen/arch/arm/vgic-v2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index 524787b..fa71598 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -576,10 +576,10 @@ static int vgic_v2_domain_init(struct domain *d) if ( !platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) ) ret = map_mmio_regions(d, paddr_to_pfn(d->arch.vgic.cbase + PAGE_SIZE), - 2, paddr_to_pfn(vgic_v2_hw.vbase + PAGE_SIZE)); + 1, paddr_to_pfn(vgic_v2_hw.vbase + PAGE_SIZE)); else ret = map_mmio_regions(d, paddr_to_pfn(d->arch.vgic.cbase + PAGE_SIZE), - 2, paddr_to_pfn(vgic_v2_hw.vbase + SZ_64K)); + 1, paddr_to_pfn(vgic_v2_hw.vbase + SZ_64K)); if ( ret ) return ret; -- 2.1.4