From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: pranavkumar@linaro.org, stefano.stabellini@eu.citrix.com,
tim@xen.org, Anup Patel <anup.patel@linaro.org>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v3 04/13] xen: arm: add a quirk to handle platforms with unusual GIC layout
Date: Mon, 25 Nov 2013 12:39:35 +0000 [thread overview]
Message-ID: <52934507.8090009@linaro.org> (raw)
In-Reply-To: <1385383091.22002.51.camel@kazak.uk.xensource.com>
On 11/25/2013 12:38 PM, Ian Campbell wrote:
> On Mon, 2013-11-25 at 12:36 +0000, Ian Campbell wrote:
>> On Mon, 2013-11-25 at 12:34 +0000, Julien Grall wrote:
>>>> + if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
>>>> + ret = map_mmio_regions(d, d->arch.vgic.cbase + PAGE_SIZE,
>>>> + d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
>>>> + gic.vbase + PAGE_SIZE);
>>>> + else
>>>> + ret = map_mmio_regions(d, d->arch.vgic.cbase + PAGE_SIZE,
>>>> + d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
>>>> + gic.vbase + 16*PAGE_SIZE);
>>>
>>> The condition needs to be inverted here ... the CPU second page is at
>>> 64K only on platform where the quirk is enabled.
>>
>> Doh! Shows how much use Linux makes of the secnd page of registers (i.e.
>> none!)
>
> Here is what would be in v4:
>
> 8>------------
>
> From 5221157d3b9986cdfede8b1299f35569e6e29670 Mon Sep 17 00:00:00 2001
> From: Ian Campbell <ian.campbell@citrix.com>
> Date: Thu, 21 Nov 2013 15:55:37 +0000
> Subject: [PATCH] xen: arm: add a quirk to handle platforms with unusual GIC
> layout
>
> On some platforms the pages are placed at a 64K stride instead of as
> contiguous 4K pages.
>
> This is because the ARM64 architecture allows for page sizes of 4/16/64K in
> the MMU so a larger stride allow more granular control of mappings. We only
> currently support 4K.
>
> 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.
>
> Note that we always map the GICV to the guest (including dom0) at a 4K stride
> length and this is reflected in the DTB passed to the guest.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
For V4:
Acked-by: Julien Grall <julien.grall@linaro.org>
> ---
> v4: FIx the condition when mapping the GIC to the guest.
> v3: Always map the GICV to the guest as contiguous 4k pages.
> v2: This replaces "xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000"
> ---
> xen/arch/arm/gic.c | 37 ++++++++++++++++++++++++++++------
> xen/arch/arm/platforms/xgene-storm.c | 2 +-
> xen/include/asm-arm/platform.h | 5 +++++
> 3 files changed, 37 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index ab49106..0084f50 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 */
> @@ -823,6 +827,8 @@ void gic_interrupt(struct cpu_user_regs *regs, int is_fiq)
>
> int gicv_setup(struct domain *d)
> {
> + int ret;
> +
> /*
> * Domain 0 gets the hardware address.
> * Guests get the virtual platform layout.
> @@ -840,11 +846,30 @@ int gicv_setup(struct domain *d)
>
> d->arch.vgic.nr_lines = 0;
>
> - /* map the gic virtual cpu interface in the gic cpu interface region of
> - * the guest */
> - return map_mmio_regions(d, d->arch.vgic.cbase,
> - d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
> - gic.vbase);
> + /*
> + * Map the gic virtual cpu interface in the gic cpu interface
> + * region of the guest.
> + *
> + * The second page is always mapped at +4K irrespective of the
> + * GIC_64K_STRIDE quirk. The DTB passed to the guest reflects this.
> + */
> + ret = map_mmio_regions(d, d->arch.vgic.cbase,
> + d->arch.vgic.cbase + PAGE_SIZE - 1,
> + gic.vbase);
> + if (ret)
> + return ret;
> +
> + if ( !platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
> + ret = map_mmio_regions(d, d->arch.vgic.cbase + PAGE_SIZE,
> + d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
> + gic.vbase + PAGE_SIZE);
> + else
> + ret = map_mmio_regions(d, d->arch.vgic.cbase + PAGE_SIZE,
> + d->arch.vgic.cbase + (2 * PAGE_SIZE) - 1,
> + gic.vbase + 16*PAGE_SIZE);
> +
> + return ret;
> +
> }
>
> static void gic_irq_eoi(void *info)
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 0198cec..23ec46d 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -23,7 +23,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
next prev parent reply other threads:[~2013-11-25 12:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 11:06 [PATCH v3 00/13] xen: arm initial support for xgene arm64 platform Ian Campbell
2013-11-25 11:06 ` [PATCH v3 01/13] xen: arm64: Add 8250 earlyprintk support Ian Campbell
2013-11-25 12:29 ` Julien Grall
2013-11-25 12:35 ` Ian Campbell
2013-11-25 11:06 ` [PATCH v3 02/13] xen: arm64: Add Basic Platform support for APM X-Gene Storm Ian Campbell
2013-11-25 11:06 ` [PATCH v3 03/13] xen: arm64: Add APM implementor id to processor implementers Ian Campbell
2013-11-25 11:06 ` [PATCH v3 04/13] xen: arm: add a quirk to handle platforms with unusual GIC layout Ian Campbell
2013-11-25 12:34 ` Julien Grall
2013-11-25 12:36 ` Ian Campbell
2013-11-25 12:38 ` Ian Campbell
2013-11-25 12:39 ` Julien Grall [this message]
2013-11-25 11:06 ` [PATCH v3 05/13] xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
2013-11-25 11:06 ` [PATCH v3 06/13] xen: arm64: Map xgene PCI memory regions and interrupts to dom0 Ian Campbell
2013-11-25 11:06 ` [PATCH v3 07/13] xen: arm: include ns16550 driver on arm64 too Ian Campbell
2013-11-25 11:07 ` [PATCH v3 08/13] xen: arm: Handle cpus nodes with #address-cells > 1 Ian Campbell
2013-11-25 12:35 ` Julien Grall
2013-11-25 11:07 ` [PATCH v3 09/13] xen: arm: Make register bit definitions unsigned Ian Campbell
2013-11-25 11:07 ` [PATCH v3 10/13] xen: arm: explicitly map 64 bit release address Ian Campbell
2013-11-25 11:07 ` [PATCH v3 11/13] xen: arm: enable synchronous console while starting secondary CPUs Ian Campbell
2013-11-25 12:37 ` Julien Grall
2013-11-25 11:07 ` [PATCH v3 12/13] xen: arm: improve early memory map readability Ian Campbell
2013-11-25 11:07 ` [PATCH v3 13/13] xen: arm: handle 40-bit addresses in the p2m Ian Campbell
2013-11-28 13:07 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52934507.8090009@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=anup.patel@linaro.org \
--cc=pranavkumar@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.