From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v3 1/3] xen/arm: gic: Check the size of the CPU and vCPU interface retrieved from DT Date: Tue, 6 Oct 2015 15:11:28 +0100 Message-ID: <1444140688.5302.193.camel@citrix.com> References: <1444054656-28261-1-git-send-email-julien.grall@citrix.com> <1444054656-28261-2-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZjSxo-00028c-5p for xen-devel@lists.xenproject.org; Tue, 06 Oct 2015 14:11:32 +0000 In-Reply-To: <1444054656-28261-2-git-send-email-julien.grall@citrix.com> 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 , xen-devel@lists.xenproject.org Cc: Zoltan Kiss , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, 2015-10-05 at 15:17 +0100, Julien Grall wrote: > @@ -641,7 +643,29 @@ static int __init gicv2_init(void) > panic("GICv2: Cannot find the maintenance IRQ"); > gicv2_info.maintenance_irq = res; > > - /* TODO: Add check on distributor, cpu size */ > + /* TODO: Add check on distributor */ > + > + /* > + * The GICv2 CPU interface should at least be 8KB. Although, most of the DT > + * doesn't correctly set it and use the GICv1 CPU interface size (i.e 4KB). > + * Warn and then fixup. > + */ > + if ( csize < SZ_8K ) > + { > + printk(XENLOG_WARNING "GICv2: WARNING: " > + "The GICC size is wrong: %#"PRIx64" expected %#x\n", > + csize, SZ_8K); "is too small"? > + csize = SZ_8K; > + } > + > + /* > + * Check if the CPU interface and virtual CPU interface have the > + * same size. > + */ > + if ( csize != vsize ) > + printk(XENLOG_WARNING "GICv2: WARNING: " > + "Sizes of GICC (%#"PRIpaddr") and GICV (%#"PRIpaddr") don't match\n", > + csize, vsize); Should we also force them to be equal? Either csize = vsize = min(csize,vsize) or vsize = csize (probably the first)? > + /* > + * Only allow support of GICv2 compatible when the CPU interface > + * and virtual CPU interface are 8KB > + * XXX: Handle other size? > + */ > + if ( csize != SZ_8K && vsize != SZ_8K ) I think you meant || ? Otherwise this is happy so long as one of them is right rather than requiring both of them to be 8K. WRT to the XXX I think I'd be happier if this was < SZ_8K for each. Otherwise some future GIC which is compatible but has extensions to the register space would needlessly require changes here. But I can live with this.