From: Ian Campbell Subject: Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout Date: Fri, 22 Nov 2013 17:03:45 +0000 Message-ID: <1385139825.25845.125.camel@kazak.uk.xensource.com> References: <1385137474-31245-4-git-send-email-ian.campbell@citrix.com> <528F8A64.4040807@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <528F8A64.4040807@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: stefano.stabellini@eu.citrix.com, pranavkumar@linaro.org, tim@xen.org, Anup Patel , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, 2013-11-22 at 16:46 +0000, Julien Grall wrote: > > On 11/22/2013 04:24 PM, Ian Campbell wrote: > > Use this quirk on the xgene platform. > > With this quirk you only fix xen GIC. What about dom0/guest GIC ? I know > that Linux is not using the secondary page, but we expose 2 pages > contiguous page. With this quirk the first page is valid ... but the > second page could belong to another device. Damn, good point. > Can we remove the second page when the quirk is enabled? I think what I will do is make gicv_setup map the two discontiguous 4K regions contiguously into the guest space. This is consistent with the DTB we expose to the guest. The reason for the discontinuity at the h/w level is (AFAICT) to support OSes using 64K pages and/or granules. I think we can live without these for the time being. Ian. > > > This should ideally be fixed by an extension to the device tree bindings as > > described in http://www.spinics.net/lists/devicetree/msg10473.html especially > > http://www.spinics.net/lists/devicetree/msg10478.html. However for the time > > being a platform specific quirk will do. > > Signed-off-by: Ian Campbell > > --- > > v2: This replaces "xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000" > > --- > > xen/arch/arm/gic.c | 6 +++++- > > xen/arch/arm/platforms/xgene-storm.c | 2 +- > > xen/include/asm-arm/platform.h | 5 +++++ > > 3 files changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c > > index ab49106..9711f5d 100644 > > --- a/xen/arch/arm/gic.c > > +++ b/xen/arch/arm/gic.c > > @@ -30,6 +30,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -444,7 +445,10 @@ void __init gic_init(void) > > BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) != > > FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE); > > set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED); > > - set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED); > > + if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) ) > > + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x10, DEV_SHARED); > > + else > > + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x1, DEV_SHARED); > > set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED); > > > > /* Global settings: interrupt distributor */ > > diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c > > index 727ac2b..d185a4a 100644 > > --- a/xen/arch/arm/platforms/xgene-storm.c > > +++ b/xen/arch/arm/platforms/xgene-storm.c > > @@ -27,7 +27,7 @@ > > > > static uint32_t xgene_storm_quirks(void) > > { > > - return PLATFORM_QUIRK_DOM0_MAPPING_11; > > + return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE; > > } > > > > > > diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h > > index c282b30..c9314e5 100644 > > --- a/xen/include/asm-arm/platform.h > > +++ b/xen/include/asm-arm/platform.h > > @@ -44,6 +44,11 @@ struct platform_desc { > > * Useful on platform where System MMU is not yet implemented > > */ > > #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0) > > +/* > > + * Quirk for platforms where the 4K GIC register ranges are placed at > > + * 64K stride. > > + */ > > +#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 1) > > > > void __init platform_init(void); > > int __init platform_init_time(void); > > >