Ian Campbell
2013-Nov-22 16:24 UTC
[PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
Use this quirk on the xgene platform. 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 <ian.campbell@citrix.com> --- 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 <xen/device_tree.h> #include <asm/p2m.h> #include <asm/domain.h> +#include <asm/platform.h> #include <asm/gic.h> @@ -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); -- 1.7.10.4
Julien Grall
2013-Nov-22 16:46 UTC
Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
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. Can we remove the second page when the quirk is enabled?> 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 <ian.campbell@citrix.com> > --- > 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 <xen/device_tree.h> > #include <asm/p2m.h> > #include <asm/domain.h> > +#include <asm/platform.h> > > #include <asm/gic.h> > > @@ -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); >-- Julien Grall
George Dunlap
2013-Nov-22 16:46 UTC
Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
On Fri, Nov 22, 2013 at 4:24 PM, Ian Campbell <ian.campbell@citrix.com> wrote:> Use this quirk on the xgene platform. > > 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 <ian.campbell@citrix.com>Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>> --- > 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 <xen/device_tree.h> > #include <asm/p2m.h> > #include <asm/domain.h> > +#include <asm/platform.h> > > #include <asm/gic.h> > > @@ -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); > -- > 1.7.10.4 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Ian Campbell
2013-Nov-22 17:03 UTC
Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
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 <ian.campbell@citrix.com> > > --- > > 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 <xen/device_tree.h> > > #include <asm/p2m.h> > > #include <asm/domain.h> > > +#include <asm/platform.h> > > > > #include <asm/gic.h> > > > > @@ -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); > > >
Julien Grall
2013-Nov-22 17:10 UTC
Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
On 11/22/2013 05:03 PM, Ian Campbell wrote:> 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.I''m fine with this solution as long as we are sure there is no device memory just after the first page. -- Julien Grall
Ian Campbell
2013-Nov-22 17:16 UTC
Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
On Fri, 2013-11-22 at 17:10 +0000, Julien Grall wrote:> > On 11/22/2013 05:03 PM, Ian Campbell wrote: > > 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. > > I''m fine with this solution as long as we are sure there is no device > memory just after the first page.The way the GIC memory map is defined that isn''t possible and it''s not the case on this platform. Ian.