diff mbox

[Xen-devel,v8,09/10] xen: introduce bit access macros for the IRQ line status flags

Message ID 1405016003-19131-9-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini July 10, 2014, 6:13 p.m. UTC
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/irq.c                 |    8 ++++----
 xen/drivers/passthrough/arm/smmu.c |    4 ++--
 xen/include/xen/irq.h              |   27 ++++++++++++++++++---------
 3 files changed, 24 insertions(+), 15 deletions(-)

Comments

Julien Grall July 11, 2014, 1:15 p.m. UTC | #1
On 07/10/2014 07:13 PM, Stefano Stabellini wrote:
> diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h
> index 40c0f3f..af5b247 100644
> --- a/xen/include/xen/irq.h
> +++ b/xen/include/xen/irq.h
> @@ -22,15 +22,24 @@ struct irqaction {
>  /*
>   * IRQ line status.
>   */
> -#define IRQ_INPROGRESS    (1u<<0) /* IRQ handler active - do not enter! */
> -#define IRQ_DISABLED      (1u<<1) /* IRQ disabled - do not enter! */
> -#define IRQ_PENDING       (1u<<2) /* IRQ pending - replay on enable */
> -#define IRQ_REPLAY        (1u<<3) /* IRQ has been replayed but not acked yet */
> -#define IRQ_GUEST         (1u<<4) /* IRQ is handled by guest OS(es) */
> -#define IRQ_MOVE_PENDING  (1u<<5) /* IRQ is migrating to another CPUs */
> -#define IRQ_PER_CPU       (1u<<6) /* IRQ is per CPU */
> -#define IRQ_GUEST_EOI_PENDING (1u<<7) /* IRQ was disabled, pending a guest EOI */
> -#define IRQF_SHARED       (1<<8)  /* IRQ is shared */
> +#define _IRQ_INPROGRESS         0 /* IRQ handler active - do not enter! */
> +#define _IRQ_DISABLED           1 /* IRQ disabled - do not enter! */
> +#define _IRQ_PENDING            2 /* IRQ pending - replay on enable */
> +#define _IRQ_REPLAY             3 /* IRQ has been replayed but not acked yet */
> +#define _IRQ_GUEST              4 /* IRQ is handled by guest OS(es) */
> +#define _IRQ_MOVE_PENDING       5 /* IRQ is migrating to another CPUs */
> +#define _IRQ_PER_CPU            6 /* IRQ is per CPU */
> +#define _IRQ_GUEST_EOI_PENDING  7 /* IRQ was disabled, pending a guest EOI */
> +#define _IRQ_SHARED             8 /* IRQ is shared */
> +#define IRQ_INPROGRESS          (1u<<_IRQ_INPROGRESS)
> +#define IRQ_DISABLED            (1u<<_IRQ_DISABLED)
> +#define IRQ_PENDING             (1u<<_IRQ_PENDING)
> +#define IRQ_REPLAY              (1u<<_IRQ_REPLAY)
> +#define IRQ_GUEST               (1u<<_IRQ_GUEST)
> +#define IRQ_MOVE_PENDING        (1u<<_IRQ_MOVE_PENDING)
> +#define IRQ_PER_CPU             (1u<<_IRQ_PER_CPU)
> +#define IRQ_GUEST_EOI_PENDING   (1u<<_IRQ_GUEST_EOI_PENDING)
> +#define IRQ_SHARED              (1u<<_IRQ_SHARED)

Why did you rename IRQF_SHARED into IRQ_SHARED?

The F was request by Jan Beulich to differentiate input flags for
{setup,request}_irq from IRQ status.

Regards,
Stefano Stabellini July 23, 2014, 2:52 p.m. UTC | #2
On Fri, 11 Jul 2014, Julien Grall wrote:
> On 07/10/2014 07:13 PM, Stefano Stabellini wrote:
> > diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h
> > index 40c0f3f..af5b247 100644
> > --- a/xen/include/xen/irq.h
> > +++ b/xen/include/xen/irq.h
> > @@ -22,15 +22,24 @@ struct irqaction {
> >  /*
> >   * IRQ line status.
> >   */
> > -#define IRQ_INPROGRESS    (1u<<0) /* IRQ handler active - do not enter! */
> > -#define IRQ_DISABLED      (1u<<1) /* IRQ disabled - do not enter! */
> > -#define IRQ_PENDING       (1u<<2) /* IRQ pending - replay on enable */
> > -#define IRQ_REPLAY        (1u<<3) /* IRQ has been replayed but not acked yet */
> > -#define IRQ_GUEST         (1u<<4) /* IRQ is handled by guest OS(es) */
> > -#define IRQ_MOVE_PENDING  (1u<<5) /* IRQ is migrating to another CPUs */
> > -#define IRQ_PER_CPU       (1u<<6) /* IRQ is per CPU */
> > -#define IRQ_GUEST_EOI_PENDING (1u<<7) /* IRQ was disabled, pending a guest EOI */
> > -#define IRQF_SHARED       (1<<8)  /* IRQ is shared */
> > +#define _IRQ_INPROGRESS         0 /* IRQ handler active - do not enter! */
> > +#define _IRQ_DISABLED           1 /* IRQ disabled - do not enter! */
> > +#define _IRQ_PENDING            2 /* IRQ pending - replay on enable */
> > +#define _IRQ_REPLAY             3 /* IRQ has been replayed but not acked yet */
> > +#define _IRQ_GUEST              4 /* IRQ is handled by guest OS(es) */
> > +#define _IRQ_MOVE_PENDING       5 /* IRQ is migrating to another CPUs */
> > +#define _IRQ_PER_CPU            6 /* IRQ is per CPU */
> > +#define _IRQ_GUEST_EOI_PENDING  7 /* IRQ was disabled, pending a guest EOI */
> > +#define _IRQ_SHARED             8 /* IRQ is shared */
> > +#define IRQ_INPROGRESS          (1u<<_IRQ_INPROGRESS)
> > +#define IRQ_DISABLED            (1u<<_IRQ_DISABLED)
> > +#define IRQ_PENDING             (1u<<_IRQ_PENDING)
> > +#define IRQ_REPLAY              (1u<<_IRQ_REPLAY)
> > +#define IRQ_GUEST               (1u<<_IRQ_GUEST)
> > +#define IRQ_MOVE_PENDING        (1u<<_IRQ_MOVE_PENDING)
> > +#define IRQ_PER_CPU             (1u<<_IRQ_PER_CPU)
> > +#define IRQ_GUEST_EOI_PENDING   (1u<<_IRQ_GUEST_EOI_PENDING)
> > +#define IRQ_SHARED              (1u<<_IRQ_SHARED)
> 
> Why did you rename IRQF_SHARED into IRQ_SHARED?
> 
> The F was request by Jan Beulich to differentiate input flags for
> {setup,request}_irq from IRQ status.

That was a mistake, I'll keep IRQF_SHARED.
diff mbox

Patch

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 7150c7a..695c69f 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -297,21 +297,21 @@  void release_irq(unsigned int irq, const void *dev_id)
 static int __setup_irq(struct irq_desc *desc, unsigned int irqflags,
                        struct irqaction *new)
 {
-    bool_t shared = !!(irqflags & IRQF_SHARED);
+    bool_t shared = !!(irqflags & IRQ_SHARED);
 
     ASSERT(new != NULL);
 
     /* Sanity checks:
      *  - if the IRQ is marked as shared
-     *  - dev_id is not NULL when IRQF_SHARED is set
+     *  - dev_id is not NULL when IRQ_SHARED is set
      */
-    if ( desc->action != NULL && (!(desc->status & IRQF_SHARED) || !shared) )
+    if ( desc->action != NULL && (!(desc->status & IRQ_SHARED) || !shared) )
         return -EINVAL;
     if ( shared && new->dev_id == NULL )
         return -EINVAL;
 
     if ( shared )
-        desc->status |= IRQF_SHARED;
+        desc->status |= IRQ_SHARED;
 
     new->next = desc->action;
     dsb(ish);
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index f4eb2a2..f9b87d0 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1060,7 +1060,7 @@  arm_smmu_alloc_domain_context(struct domain *d,
         cfg->irptndx = cfg->cbndx;
 
     irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx];
-    ret = request_irq(irq, IRQF_SHARED, arm_smmu_context_fault,
+    ret = request_irq(irq, IRQ_SHARED, arm_smmu_context_fault,
                       "arm-smmu-context-fault", cfg);
     if ( ret )
     {
@@ -1713,7 +1713,7 @@  static int __init smmu_init(struct dt_device_node *dev,
     for ( i = 0; i < smmu->num_global_irqs; ++i )
     {
         smmu_dbg(smmu, "\t- global IRQ %u\n", smmu->irqs[i]);
-        res = request_irq(smmu->irqs[i], IRQF_SHARED, arm_smmu_global_fault,
+        res = request_irq(smmu->irqs[i], IRQ_SHARED, arm_smmu_global_fault,
                           "arm-smmu global fault", smmu);
         if ( res )
         {
diff --git a/xen/include/xen/irq.h b/xen/include/xen/irq.h
index 40c0f3f..af5b247 100644
--- a/xen/include/xen/irq.h
+++ b/xen/include/xen/irq.h
@@ -22,15 +22,24 @@  struct irqaction {
 /*
  * IRQ line status.
  */
-#define IRQ_INPROGRESS    (1u<<0) /* IRQ handler active - do not enter! */
-#define IRQ_DISABLED      (1u<<1) /* IRQ disabled - do not enter! */
-#define IRQ_PENDING       (1u<<2) /* IRQ pending - replay on enable */
-#define IRQ_REPLAY        (1u<<3) /* IRQ has been replayed but not acked yet */
-#define IRQ_GUEST         (1u<<4) /* IRQ is handled by guest OS(es) */
-#define IRQ_MOVE_PENDING  (1u<<5) /* IRQ is migrating to another CPUs */
-#define IRQ_PER_CPU       (1u<<6) /* IRQ is per CPU */
-#define IRQ_GUEST_EOI_PENDING (1u<<7) /* IRQ was disabled, pending a guest EOI */
-#define IRQF_SHARED       (1<<8)  /* IRQ is shared */
+#define _IRQ_INPROGRESS         0 /* IRQ handler active - do not enter! */
+#define _IRQ_DISABLED           1 /* IRQ disabled - do not enter! */
+#define _IRQ_PENDING            2 /* IRQ pending - replay on enable */
+#define _IRQ_REPLAY             3 /* IRQ has been replayed but not acked yet */
+#define _IRQ_GUEST              4 /* IRQ is handled by guest OS(es) */
+#define _IRQ_MOVE_PENDING       5 /* IRQ is migrating to another CPUs */
+#define _IRQ_PER_CPU            6 /* IRQ is per CPU */
+#define _IRQ_GUEST_EOI_PENDING  7 /* IRQ was disabled, pending a guest EOI */
+#define _IRQ_SHARED             8 /* IRQ is shared */
+#define IRQ_INPROGRESS          (1u<<_IRQ_INPROGRESS)
+#define IRQ_DISABLED            (1u<<_IRQ_DISABLED)
+#define IRQ_PENDING             (1u<<_IRQ_PENDING)
+#define IRQ_REPLAY              (1u<<_IRQ_REPLAY)
+#define IRQ_GUEST               (1u<<_IRQ_GUEST)
+#define IRQ_MOVE_PENDING        (1u<<_IRQ_MOVE_PENDING)
+#define IRQ_PER_CPU             (1u<<_IRQ_PER_CPU)
+#define IRQ_GUEST_EOI_PENDING   (1u<<_IRQ_GUEST_EOI_PENDING)
+#define IRQ_SHARED              (1u<<_IRQ_SHARED)
 
 /* Special IRQ numbers. */
 #define AUTO_ASSIGN_IRQ         (-1)