[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 09/24] xen/arm: route_irq_to_guest: Check validity of the IRQ



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.