From: Tim Deegan <tim@xen.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH] xen: get GIC addresses from DT
Date: Fri, 30 Nov 2012 12:18:55 +0000 [thread overview]
Message-ID: <20121130121855.GA95877@ocelot.phlegethon.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1211301147000.5310@kaball.uk.xensource.com>
At 12:08 +0000 on 30 Nov (1354277311), Stefano Stabellini wrote:
> arm: add few checks to gic_init
>
> Check for:
> - uninitialized GIC interface addresses;
> - non-page aligned GIC interface addresses.
>
> Return in both cases with an error message.
> Also remove the code from GICH and GICC to handle non-page aligned
> interfaces.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index 8efbeb3..301d223 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -34,10 +34,8 @@
>
> /* Access to the GIC Distributor registers through the fixmap */
> #define GICD ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICD))
> -#define GICC ((volatile uint32_t *) (FIXMAP_ADDR(FIXMAP_GICC1) \
> - + ((uint32_t) gic.cbase & 0xfff)))
> -#define GICH ((volatile uint32_t *) (FIXMAP_ADDR(FIXMAP_GICH) \
> - + ((uint32_t) gic.hbase & 0xfff)))
> +#define GICC ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICC1))
> +#define GICH ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICH))
> static void gic_restore_pending_irqs(struct vcpu *v);
>
> /* Global state */
> @@ -308,6 +306,23 @@ static void __cpuinit gic_hyp_disable(void)
> /* Set up the GIC */
> void __init gic_init(void)
> {
> + if ( !early_info.gic.gic_dist_addr ||
Some hard tabs have snuck in here.
> + !early_info.gic.gic_cpu_addr ||
> + !early_info.gic.gic_hyp_addr ||
> + !early_info.gic.gic_vcpu_addr )
> + {
> + printk("error: incorrect physical address of the GIC interfaces.\n");
> + return;
Maybe panic() here (and below) rather than printk?
> + }
> + if ( (early_info.gic.gic_dist_addr & ((1 << PAGE_SHIFT) - 1)) ||
(foo & ~PAGE_MASK) is usual for that.
Cheers,
Tim.
> + (early_info.gic.gic_cpu_addr & ((1 << PAGE_SHIFT) - 1)) ||
> + (early_info.gic.gic_hyp_addr & ((1 << PAGE_SHIFT) - 1)) ||
> + (early_info.gic.gic_vcpu_addr & ((1 << PAGE_SHIFT) - 1)) )
> + {
> + printk("error: GIC interfaces not page aligned.\n");
> + return;
> + }
> +
> gic.dbase = early_info.gic.gic_dist_addr;
> gic.cbase = early_info.gic.gic_cpu_addr;
> gic.hbase = early_info.gic.gic_hyp_addr;
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2012-11-30 12:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 15:21 [PATCH] xen: get GIC addresses from DT Stefano Stabellini
2012-11-29 10:40 ` Ian Campbell
2012-11-30 12:08 ` Stefano Stabellini
2012-11-30 12:18 ` Tim Deegan [this message]
2012-11-30 12:19 ` Ian Campbell
2012-11-30 11:26 ` David Vrabel
2012-11-30 12:25 ` Stefano Stabellini
2012-11-30 12:29 ` Ian Campbell
2012-11-30 12:48 ` Stefano Stabellini
2012-11-30 14:02 ` Stefano Stabellini
2012-11-30 14:08 ` Ian Campbell
2012-11-30 14:10 ` Stefano Stabellini
2012-11-30 13:15 ` David Vrabel
2012-11-30 14:08 ` Stefano Stabellini
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=20121130121855.GA95877@ocelot.phlegethon.org \
--to=tim@xen.org \
--cc=Ian.Campbell@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.