From: Ian Campbell Subject: Re: [PATCH v2] arm: add few checks to gic_init Date: Tue, 4 Dec 2012 14:53:19 +0000 Message-ID: <1354632799.15296.19.camel@zakaz.uk.xensource.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "xen-devel@lists.xensource.com" , "Tim (Xen.org)" List-Id: xen-devel@lists.xenproject.org On Fri, 2012-11-30 at 12:38 +0000, Stefano Stabellini wrote: > Check for: > - uninitialized GIC interface addresses; > - non-page aligned GIC interface addresses. > > Panic in both cases. > Also remove the code from GICH and GICC to handle non-page aligned > interfaces. > > Signed-off-by: Stefano Stabellini Acked-by: Ian Campbell I tried to apply but I got rejects. I thought this came before "xen: get GIC addresses from DT", have I got it backwards? > / > @@ -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 || > + !early_info.gic.gic_cpu_addr || > + !early_info.gic.gic_hyp_addr || > + !early_info.gic.gic_vcpu_addr ) > + panic("the physical address of one of the GIC interfaces is missing:\n" > + " gic_dist_addr=%"PRIpaddr"\n" > + " gic_cpu_addr=%"PRIpaddr"\n" > + " gic_hyp_addr=%"PRIpaddr"\n" > + " gic_vcpu_addr=%"PRIpaddr"\n", > + early_info.gic.gic_dist_addr, early_info.gic.gic_cpu_addr, > + early_info.gic.gic_hyp_addr, early_info.gic.gic_vcpu_addr); Might be worth printing these out unconditionally as part of a message about initialising the GIC (which could include version, number of interrupts etc too). Useful in its own right but better than duplicating them in the next panic message too. > + if ( (early_info.gic.gic_dist_addr & ~PAGE_MASK) || > + (early_info.gic.gic_cpu_addr & ~PAGE_MASK) || > + (early_info.gic.gic_hyp_addr & ~PAGE_MASK) || > + (early_info.gic.gic_vcpu_addr & ~PAGE_MASK) ) > + panic("error: GIC interfaces not page aligned.\n"); "error: " seems a bit redundant in a panic message ;-) > + > gic.dbase = early_info.gic.gic_dist_addr; > gic.cbase = early_info.gic.gic_cpu_addr; > gic.hbase = early_info.gic.gic_hyp_addr;