From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH for-4.5 3/8] xen/arm: IRQ: Protect IRQ to be shared between domains and XEN Date: Wed, 19 Feb 2014 13:59:04 +0000 Message-ID: <5304B8A8.3000202@linaro.org> References: <1390581822-32624-1-git-send-email-julien.grall@linaro.org> <1390581822-32624-4-git-send-email-julien.grall@linaro.org> <1392809725.29739.5.camel@kazak.uk.xensource.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 1WG7g6-0002to-PX for xen-devel@lists.xenproject.org; Wed, 19 Feb 2014 13:59:10 +0000 Received: by mail-ea0-f177.google.com with SMTP id h14so366775eaj.8 for ; Wed, 19 Feb 2014 05:59:09 -0800 (PST) In-Reply-To: <1392809725.29739.5.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: xen-devel@lists.xenproject.org, tim@xen.org, stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org Hi Ian, On 02/19/2014 11:35 AM, Ian Campbell wrote: > On Fri, 2014-01-24 at 16:43 +0000, Julien Grall wrote: >> The current dt_route_irq_to_guest implementation set IRQ_GUEST no matter if the >> IRQ is correctly setup. >> >> As IRQ can be shared between devices, if the devices are not assigned to the >> same domain or Xen, this could result to IRQ route to the domain instead of >> Xen ... >> >> Also avoid to rely on wrong behaviour when Xen is routing an IRQ to DOM0. >> >> Signed-off-by: Julien Grall >> >> --- >> Hopefully, none of the supported platforms have UARTs (the only device > > ^shared? Hmmm ... I don't remember what I was trying to say here :/. Anyway, this part was for argue to push it for Xen 4.4. It doesn't make sense anymore. I will remove it. > > Other than wondering if EBUSY might be more natural than EADDRINUSE and > some grammar nits (below) I think this patch looks good. Right, I will use EBUSY for the next version. > >> currently used by Xen). It would be nice to have this patch for Xen 4.4 to >> avoid waste of time for developer. >> >> The downside of this patch is if someone wants to support a such platform >> (eg IRQ shared between device assigned to different domain/XEN), it will >> end up to a error message and a panic. >> --- >> xen/arch/arm/domain_build.c | 8 ++++++-- >> xen/arch/arm/gic.c | 40 +++++++++++++++++++++++++++++++++++++++- >> 2 files changed, 45 insertions(+), 3 deletions(-) >> >> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c >> index 47b781b..1fc359a 100644 >> --- a/xen/arch/arm/domain_build.c >> +++ b/xen/arch/arm/domain_build.c >> @@ -712,8 +712,12 @@ static int map_device(struct domain *d, const struct dt_device_node *dev) >> } >> >> DPRINT("irq %u = %u type = 0x%x\n", i, irq.irq, irq.type); >> - /* Don't check return because the IRQ can be use by multiple device */ >> - gic_route_irq_to_guest(d, &irq, dt_node_name(dev)); >> + res = gic_route_irq_to_guest(d, &irq, dt_node_name(dev)); >> + if ( res ) >> + { >> + printk(XENLOG_ERR "Unable to route the IRQ %u to dom0\n", irq.irq); > > "Unable to route IRQ %u..." and I think you want to use d->domain_id > rather than hardcoding 0. I will fix it. At the same time, the error message when Xen is unable to map the range also use "dom0". I will send a separate patch for that. Cheers, -- Julien Grall