Re: [Xen-devel] [PATCH v6 05/31] xen/arm: Rename NR_IRQs and vgic_num_irqs helper function

2015-09-09 Thread Ian Campbell
On Mon, 2015-08-31 at 15:40 +0100, Julien Grall wrote:
> [...]
> > +#define nr_irqs NR_LINE_IRQS
> > +#define nr_static_irqs NR_LINE_IRQS
> > +#define arch_hwdom_irqs(domid) NR_LINE_IRQS

An aside: While looking at this patch I realised that all of these are used
by common code solely in relation to d->nr_pirqs. Since we don't have pirqs
on ARM really that field ought to be 0 (or even non-existent) and all of
these should then go away.

(Actually nr_irqs is used in flask, but the above is true for the rest for
sure).

Nothing to do with this patch and no action for you to take Vijay.


Ian.

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


Re: [Xen-devel] [PATCH v6 05/31] xen/arm: Rename NR_IRQs and vgic_num_irqs helper function

2015-09-09 Thread Julien Grall
On 09/09/15 14:08, Ian Campbell wrote:
> On Mon, 2015-08-31 at 15:40 +0100, Julien Grall wrote:
>> [...]
>>> +#define nr_irqs NR_LINE_IRQS
>>> +#define nr_static_irqs NR_LINE_IRQS
>>> +#define arch_hwdom_irqs(domid) NR_LINE_IRQS
> 
> An aside: While looking at this patch I realised that all of these are used
> by common code solely in relation to d->nr_pirqs. Since we don't have pirqs
> on ARM really that field ought to be 0 (or even non-existent) and all of
> these should then go away.

nr_pirqs is used in DOMCTL_irq_permission to know the last IRQ number
suported. It's working correctly domain_pirq_to_irq is an identity mapping.

Regards,

-- 
Julien Grall

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


Re: [Xen-devel] [PATCH v6 05/31] xen/arm: Rename NR_IRQs and vgic_num_irqs helper function

2015-08-31 Thread Julien Grall

Hi Vijay,

On 31/08/2015 12:06, vijay.kil...@gmail.com wrote:

From: Vijaya Kumar K 

NR_IRQS define signifies number of SGIs, PPIs and SPIs.


I don' think signifies is the right word here. And I would mention that 
SGIs/PPIs/SPIs are an IRQ lines in order to make clear why we change the 
name. I.e:


"NR_IRQS represents the number of lines (i.e SGIs, PPIs and SPIs)".



With introduction of LPIs, NR_IRQs is renamed to NR_LINE_IRQs.

  ^ the


Similarly vgic_num_irqs() is renamed as vgic_num_line_irqs().


The proper name is "interrupt line" or "irq line" but not "line irq" 
which doesn't make sense.


So I would prefer to see NR_IRQ_LINES or NR_ITLINES. Note that the 
latter is the best given that it's the name used within the spec.



Signed-off-by: Vijaya Kumar K 
---


[...]


diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index f33c331..cbdc1ab 100644
--- a/xen/include/asm-arm/irq.h
+++ b/xen/include/asm-arm/irq.h
@@ -19,11 +19,12 @@ struct arch_irq_desc {
  };

  #define NR_LOCAL_IRQS 32
-#define NR_IRQS1024
+/* Number of SGIs+PPIs+SPIs */


Space before and after each '+'


+#define NR_LINE_IRQS   1024

-#define nr_irqs NR_IRQS
-#define nr_static_irqs NR_IRQS
-#define arch_hwdom_irqs(domid) NR_IRQS
+#define nr_irqs NR_LINE_IRQS
+#define nr_static_irqs NR_LINE_IRQS
+#define arch_hwdom_irqs(domid) NR_LINE_IRQS


Regards,

--
Julien Grall

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


[Xen-devel] [PATCH v6 05/31] xen/arm: Rename NR_IRQs and vgic_num_irqs helper function

2015-08-31 Thread vijay . kilari
From: Vijaya Kumar K 

NR_IRQS define signifies number of SGIs, PPIs and SPIs.
With introduction of LPIs, NR_IRQs is renamed to NR_LINE_IRQs.
Similarly vgic_num_irqs() is renamed as vgic_num_line_irqs().

Signed-off-by: Vijaya Kumar K 
---
 xen/arch/arm/gic.c |2 +-
 xen/arch/arm/irq.c |   10 +-
 xen/arch/arm/vgic-v3.c |2 +-
 xen/arch/arm/vgic.c|   10 +-
 xen/include/asm-arm/irq.h  |9 +
 xen/include/asm-arm/vgic.h |2 +-
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 1757193..758678d 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -140,7 +140,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int 
virq,
 ASSERT(spin_is_locked(>lock));
 /* Caller has already checked that the IRQ is an SPI */
 ASSERT(virq >= 32);
-ASSERT(virq < vgic_num_irqs(d));
+ASSERT(virq < vgic_num_line_irqs(d));
 
 vgic_lock_rank(v_target, rank, flags);
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 1f38605..d8080c7 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -55,7 +55,7 @@ hw_irq_controller no_irq_type = {
 .end = end_none
 };
 
-static irq_desc_t irq_desc[NR_IRQS];
+static irq_desc_t irq_desc[NR_LINE_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
 irq_desc_t *__irq_to_desc(int irq)
@@ -75,7 +75,7 @@ static int __init init_irq_data(void)
 {
 int irq;
 
-for (irq = NR_LOCAL_IRQS; irq < NR_IRQS; irq++) {
+for (irq = NR_LOCAL_IRQS; irq < NR_LINE_IRQS; irq++) {
 struct irq_desc *desc = irq_to_desc(irq);
 init_one_irq_desc(desc);
 desc->irq = irq;
@@ -407,11 +407,11 @@ int route_irq_to_guest(struct domain *d, unsigned int 
virq,
 unsigned long flags;
 int retval = 0;
 
-if ( virq >= vgic_num_irqs(d) )
+if ( virq >= vgic_num_line_irqs(d) )
 {
 printk(XENLOG_G_ERR
"the vIRQ number %u is too high for domain %u (max = %u)\n",
-   irq, d->domain_id, vgic_num_irqs(d));
+   irq, d->domain_id, vgic_num_line_irqs(d));
 return -EINVAL;
 }
 
@@ -523,7 +523,7 @@ int release_guest_irq(struct domain *d, unsigned int virq)
 int ret;
 
 /* Only SPIs are supported */
-if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_irqs(d) )
+if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_line_irqs(d) )
 return -EINVAL;
 
 p = spi_to_pending(d, virq);
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index daa510a..f161248 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -721,7 +721,7 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, 
mmio_info_t *info)
  * Number of interrupt identifier bits supported by the GIC
  * Stream Protocol Interface
  */
-unsigned int irq_bits = get_count_order(vgic_num_irqs(v->domain));
+unsigned int irq_bits = get_count_order(vgic_num_line_irqs(v->domain));
 /*
  * Number of processors that may be used as interrupt targets when ARE
  * bit is zero. The maximum is 8.
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index a6835a8..01c1867 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -122,7 +122,7 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis)
 return ret;
 
 d->arch.vgic.allocated_irqs =
-xzalloc_array(unsigned long, BITS_TO_LONGS(vgic_num_irqs(d)));
+xzalloc_array(unsigned long, BITS_TO_LONGS(vgic_num_line_irqs(d)));
 if ( !d->arch.vgic.allocated_irqs )
 return -ENOMEM;
 
@@ -254,7 +254,7 @@ void arch_move_irqs(struct vcpu *v)
 struct vcpu *v_target;
 int i;
 
-for ( i = 32; i < vgic_num_irqs(d); i++ )
+for ( i = 32; i < vgic_num_line_irqs(d); i++ )
 {
 v_target = vgic_get_target_vcpu(v, i);
 p = irq_to_pending(v_target, i);
@@ -465,7 +465,7 @@ void vgic_vcpu_inject_spi(struct domain *d, unsigned int 
virq)
 struct vcpu *v;
 
 /* the IRQ needs to be an SPI */
-ASSERT(virq >= 32 && virq <= vgic_num_irqs(d));
+ASSERT(virq >= 32 && virq <= vgic_num_line_irqs(d));
 
 v = vgic_get_target_vcpu(d->vcpu[0], virq);
 vgic_vcpu_inject_irq(v, virq);
@@ -487,7 +487,7 @@ int vgic_emulate(struct cpu_user_regs *regs, union hsr hsr)
 
 bool_t vgic_reserve_virq(struct domain *d, unsigned int virq)
 {
-if ( virq >= vgic_num_irqs(d) )
+if ( virq >= vgic_num_line_irqs(d) )
 return 0;
 
 return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs);
@@ -507,7 +507,7 @@ int vgic_allocate_virq(struct domain *d, bool_t spi)
 else
 {
 first = 32;
-end = vgic_num_irqs(d);
+end = vgic_num_line_irqs(d);
 }
 
 /*
diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index f33c331..cbdc1ab 100644
--- a/xen/include/asm-arm/irq.h
+++