From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v4 14/16] xen/arm: Add virtual GICv3 support Date: Mon, 02 Jun 2014 17:46:42 +0100 Message-ID: <538CAA72.4070504@linaro.org> 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> <1401727094.8841.25.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1401727094.8841.25.camel@kazak.uk.xensource.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: Ian Campbell 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 06/02/2014 05:38 PM, Ian Campbell wrote: > 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. Assuming we correctly validated the version given by the toolstack. I'm not very confident with a BUG_ON/panic in hypercall (this function is called during domain creation) when we can just return an error code and safely come back in a valid state (i.e nothing will leak...) Regards, -- Julien Grall