diff mbox

[5/7] xen/arm: Fix assert in send_SGI_one

Message ID 1377869433-15385-6-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall Aug. 30, 2013, 1:30 p.m. UTC
The GIC can handle maximum 8 cpus (0...7). The CPU id 7 is still valid.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/gic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ian Campbell Sept. 9, 2013, 1:30 p.m. UTC | #1
On Fri, 2013-08-30 at 14:30 +0100, Julien Grall wrote:
> The GIC can handle maximum 8 cpus (0...7). The CPU id 7 is still valid.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> ---
>  xen/arch/arm/gic.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index 4f3a8a5..6dcefd7 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -481,7 +481,7 @@ void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
>  
>  void send_SGI_one(unsigned int cpu, enum gic_sgi sgi)
>  {
> -    ASSERT(cpu < 7);  /* Targets bitmap only supports 8 CPUs */
> +    ASSERT(cpu < NR_GIC_CPU_IF);  /* Targets bitmap only supports 8 CPUs */

cpu here is a logical cpu id, not a gic id, I think?

In which case although 8 happens to be correct: NR_GIC_CPU_IF is the
wrong thing to be using and in any case this seems against the general
principals of this series.

>      send_SGI_mask(cpumask_of(cpu), sgi);
>  }
>
Julien Grall Sept. 10, 2013, 3:47 p.m. UTC | #2
On 09/09/2013 02:30 PM, Ian Campbell wrote:
> On Fri, 2013-08-30 at 14:30 +0100, Julien Grall wrote:
>> The GIC can handle maximum 8 cpus (0...7). The CPU id 7 is still valid.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> ---
>>  xen/arch/arm/gic.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
>> index 4f3a8a5..6dcefd7 100644
>> --- a/xen/arch/arm/gic.c
>> +++ b/xen/arch/arm/gic.c
>> @@ -481,7 +481,7 @@ void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
>>  
>>  void send_SGI_one(unsigned int cpu, enum gic_sgi sgi)
>>  {
>> -    ASSERT(cpu < 7);  /* Targets bitmap only supports 8 CPUs */
>> +    ASSERT(cpu < NR_GIC_CPU_IF);  /* Targets bitmap only supports 8 CPUs */
> 
> cpu here is a logical cpu id, not a gic id, I think?

Right.

> In which case although 8 happens to be correct: NR_GIC_CPU_IF is the
> wrong thing to be using and in any case this seems against the general
> principals of this series.

NR_GIC_CPU_IF indicates the number of cpu interface handled by the GIC.
Xen won't be able to register more than 8 CPUs, ie logical cpu id 0..7.

>>      send_SGI_mask(cpumask_of(cpu), sgi);
>>  }
>>  
> 
>
diff mbox

Patch

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 4f3a8a5..6dcefd7 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -481,7 +481,7 @@  void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
 
 void send_SGI_one(unsigned int cpu, enum gic_sgi sgi)
 {
-    ASSERT(cpu < 7);  /* Targets bitmap only supports 8 CPUs */
+    ASSERT(cpu < NR_GIC_CPU_IF);  /* Targets bitmap only supports 8 CPUs */
     send_SGI_mask(cpumask_of(cpu), sgi);
 }