From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3 09/24] xen/arm: route_irq_to_guest: Check validity of the IRQ Date: Wed, 28 Jan 2015 18:05:00 +0000 Message-ID: <54C924CC.80802@linaro.org> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> <1421159133-31526-10-git-send-email-julien.grall@linaro.org> 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 1YGWza-0000q6-Hw for xen-devel@lists.xenproject.org; Wed, 28 Jan 2015 18:05:30 +0000 Received: by mail-wi0-f174.google.com with SMTP id n3so13854464wiv.1 for ; Wed, 28 Jan 2015 10:05:29 -0800 (PST) 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.xenproject.org, tim@xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On 28/01/15 17:55, Stefano Stabellini wrote: >> --- >> xen/arch/arm/irq.c | 58 +++++++++++++++++++++++++++++++++++++++++++---- >> xen/include/asm-arm/irq.h | 2 ++ >> 2 files changed, 56 insertions(+), 4 deletions(-) >> >> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c >> index 830832c..af408ac 100644 >> --- a/xen/arch/arm/irq.c >> +++ b/xen/arch/arm/irq.c >> @@ -379,6 +379,15 @@ err: >> return rc; >> } >> >> +bool_t is_assignable_irq(unsigned int irq) > > static inline? It's exported (will be used later) and not possible to inline in irq.h because of interdependency between irq.h and gic.h [..] >> @@ -418,13 +460,21 @@ int route_irq_to_guest(struct domain *d, unsigned int virq, >> struct domain *ad = irq_get_domain(desc); >> >> if ( test_bit(_IRQ_GUEST, &desc->status) && d == ad ) >> + { >> + if ( irq_get_guest_info(desc)->virq != virq ) >> + { >> + dprintk(XENLOG_G_ERR, "d%u: IRQ %u is already assigned to vIRQ %u\n", >> + d->domain_id, irq, irq_get_guest_info(desc)->virq); >> + retval = -EPERM; > > I don't think that EPERM is the right error for this. Maybe EBUSY? Right. > >> + } > > Should we return error for this too? Maybe EEXIST? No, this is a valid use case especially for DOM0. The device tree may expose twice the same IRQ. Regards, -- Julien Grall