From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v3 09/24] xen/arm: route_irq_to_guest: Check validity of the IRQ Date: Thu, 29 Jan 2015 11:52:01 +0000 Message-ID: References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> <1421159133-31526-10-git-send-email-julien.grall@linaro.org> <54C924CC.80802@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 1YGne5-0005yn-2H for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 11:52:25 +0000 In-Reply-To: <54C924CC.80802@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: xen-devel@lists.xenproject.org, tim@xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 28 Jan 2015, Julien Grall wrote: > 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. OK