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

Re: [Xen-devel] [PATCH 05/15] xen: remove nr_irqs_gsi from generic code



On Tue, 2012-12-04 at 13:43 +0000, Jan Beulich wrote:
> >>> On 04.12.12 at 12:56, Ian Campbell <ian.campbell@xxxxxxxxxx> wrote:
> > The concept is X86 specific.
> > 
> > AFAICT the generic concept here is the number of physical IRQs which
> > the current hardware has, so call this nr_hw_irqs.
> 
> Hmm, I don't particularly like this name, as (at least to me) it
> gives the appearance to include MSI ones, which isn't correct.

Ah, I wondered about this then forgot to mention it.

> How about nr_fixed_irqs or nr_static_irqs or some such?

Static would be a nice counter to "dynamic" which is how I tend to think
of MSIs.

> 
> Jan
> 
> > Also using "defined NR_IRQS" as a standin for x86 might have made
> > sense at one point but its just cleaner to push the necessary
> > definitions into asm/irq.h.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > Cc: Keir (Xen.org) <keir@xxxxxxx>
> > Cc: Jan Beulich <JBeulich@xxxxxxxx>
> > Cc: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
> > ---
> >  xen/arch/arm/dummy.S      |    1 -
> >  xen/common/domain.c       |    4 ++--
> >  xen/include/asm-arm/irq.h |    3 +++
> >  xen/include/asm-x86/irq.h |    4 ++++
> >  xen/include/xen/irq.h     |    8 --------
> >  xen/xsm/flask/hooks.c     |    4 ++--
> >  6 files changed, 11 insertions(+), 13 deletions(-)
> > 
> > diff --git a/xen/arch/arm/dummy.S b/xen/arch/arm/dummy.S
> > index 66eb314..5d9bcff 100644
> > --- a/xen/arch/arm/dummy.S
> > +++ b/xen/arch/arm/dummy.S
> > @@ -8,7 +8,6 @@ x:  mov pc, lr
> >     
> >  /* PIRQ support */
> >  DUMMY(alloc_pirq_struct);
> > -DUMMY(nr_irqs_gsi);
> >  DUMMY(pirq_guest_bind);
> >  DUMMY(pirq_guest_unbind);
> >  DUMMY(pirq_set_affinity);
> > diff --git a/xen/common/domain.c b/xen/common/domain.c
> > index 12c8e24..d80461d 100644
> > --- a/xen/common/domain.c
> > +++ b/xen/common/domain.c
> > @@ -259,9 +259,9 @@ struct domain *domain_create(
> >          atomic_inc(&d->pause_count);
> >  
> >          if ( domid )
> > -            d->nr_pirqs = nr_irqs_gsi + extra_domU_irqs;
> > +            d->nr_pirqs = nr_hw_irqs + extra_domU_irqs;
> >          else
> > -            d->nr_pirqs = nr_irqs_gsi + extra_dom0_irqs;
> > +            d->nr_pirqs = nr_hw_irqs + extra_dom0_irqs;
> >          if ( d->nr_pirqs > nr_irqs )
> >              d->nr_pirqs = nr_irqs;
> >  
> > diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
> > index abde839..4facaf0 100644
> > --- a/xen/include/asm-arm/irq.h
> > +++ b/xen/include/asm-arm/irq.h
> > @@ -21,6 +21,9 @@ struct irq_cfg {
> >  #define NR_IRQS            1024
> >  #define nr_irqs NR_IRQS
> >  
> > +#define nr_irqs NR_IRQS
> > +#define nr_hw_irqs NR_IRQS
> > +
> >  struct irq_desc;
> >  
> >  struct irq_desc *__irq_to_desc(int irq);
> > diff --git a/xen/include/asm-x86/irq.h b/xen/include/asm-x86/irq.h
> > index 5eefb94..6ea5f53 100644
> > --- a/xen/include/asm-x86/irq.h
> > +++ b/xen/include/asm-x86/irq.h
> > @@ -11,6 +11,10 @@
> >  #include <irq_vectors.h>
> >  #include <asm/percpu.h>
> >  
> > +extern unsigned int nr_irqs_gsi;
> > +extern unsigned int nr_irqs;
> > +#define nr_hw_irqs nr_irqs_gsi
> > +
> >  #define IO_APIC_IRQ(irq)    (platform_legacy_irq(irq) ?    \
> >                          (1 << (irq)) & io_apic_irqs : \
> >                          (irq) < nr_irqs_gsi)
> > diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h
> > index 5973cce..7386358 100644
> > --- a/xen/include/xen/irq.h
> > +++ b/xen/include/xen/irq.h
> > @@ -58,14 +58,6 @@ typedef const struct hw_interrupt_type hw_irq_controller;
> >  
> >  #include <asm/irq.h>
> >  
> > -#ifdef NR_IRQS
> > -# define nr_irqs NR_IRQS
> > -# define nr_irqs_gsi NR_IRQS
> > -#else
> > -extern unsigned int nr_irqs_gsi;
> > -extern unsigned int nr_irqs;
> > -#endif
> > -
> >  struct msi_desc;
> >  /*
> >   * This is the "IRQ descriptor", which contains various information
> > diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
> > index 0ca10d0..595c31e 100644
> > --- a/xen/xsm/flask/hooks.c
> > +++ b/xen/xsm/flask/hooks.c
> > @@ -72,7 +72,7 @@ static int get_irq_sid(int irq, u32 *sid, struct 
> > avc_audit_data *ad)
> >      struct irq_desc *desc = irq_to_desc(irq);
> >      if ( irq >= nr_irqs || irq < 0 )
> >          return -EINVAL;
> > -    if ( irq < nr_irqs_gsi ) {
> > +    if ( irq < nr_hw_irqs ) {
> >          if (ad) {
> >              AVC_AUDIT_DATA_INIT(ad, IRQ);
> >              ad->irq = irq;
> > @@ -699,7 +699,7 @@ static int flask_map_domain_pirq (struct domain *d, int 
> > irq, void *data)
> >      if ( rc )
> >          return rc;
> >  
> > -    if ( irq >= nr_irqs_gsi && msi ) {
> > +    if ( irq >= nr_hw_irqs && msi ) {
> >          u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
> >          AVC_AUDIT_DATA_INIT(&ad, DEV);
> >          ad.device = machine_bdf;
> > -- 
> > 1.7.9.1
> 
> 



_______________________________________________
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®.