From: Ian Campbell Subject: Re: [PATCH v4 14/16] xen/arm: Add virtual GICv3 support Date: Mon, 2 Jun 2014 17:38:14 +0100 Message-ID: <1401727094.8841.25.camel@kazak.uk.xensource.com> References: <1401100009-7326-1-git-send-email-vijay.kilari@gmail.com> <1401100009-7326-15-git-send-email-vijay.kilari@gmail.com> <538CA1F7.1060603@linaro.org> <1401725749.8841.14.camel@kazak.uk.xensource.com> <538CA3E6.7050007@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <538CA3E6.7050007@linaro.org> 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 Cc: vijay.kilari@gmail.com, stefano.stabellini@eu.citrix.com, Prasun.Kapoor@caviumnetworks.com, vijaya.kumar@caviumnetworks.com, xen-devel@lists.xen.org, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, 2014-06-02 at 17:18 +0100, Julien Grall wrote: > On 06/02/2014 05:15 PM, Ian Campbell wrote: > > On Mon, 2014-06-02 at 17:10 +0100, Julien Grall wrote: > >> > >>> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c > >>> index 3fa0857..787c547 100644 > >>> --- a/xen/arch/arm/vgic.c > >>> +++ b/xen/arch/arm/vgic.c > >>> @@ -264,10 +264,19 @@ int domain_vgic_init(struct domain *d) > >>> else > >>> d->arch.vgic.nr_lines = 0; /* We don't need SPIs for the guest */ > >>> > >>> - if ( gic_hw_version() == GIC_V2 ) > >>> + switch ( gic_hw_version() ) > >>> + { > >>> +#ifdef CONFIG_ARM_64 > >>> + case GIC_V3: > >>> + vgic_v3_init(d); > >>> + break; > >>> +#endif > >>> + case GIC_V2: > >>> vgic_v2_init(d); > >>> - else > >>> + break; > >>> + default: > >>> panic("No VGIC found\n"); > >> > >> I think I've already said in an earlier patch. Please avoid to use panic > >> when this function is called by a VM. > > > > Whether called from a guest or not, gic_hw_version's result is, I think, > > completely under hypervisor control, if it returns a gic version which > > we don't support then that is worthy of a panic() I think, or a > > BUG_ON(), since that is a hypervisor coding issue. > > It won't be under hypervisor control if we add an hypercall to choose > whether we want to use GICv2 or GICv3. That (tools only) hypercall should obviously validate that it knows about the gic that is being asked for at the time. If on retrieval it is not something we understand then that is still a hypervisor bug. Ian.