qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH Trivial] hw/intc/arm_gic: Remove the definition of NUM_CPU
@ 2015-11-05 17:11 Wei Huang
  2015-11-05 17:13 ` Andreas Färber
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Huang @ 2015-11-05 17:11 UTC (permalink / raw)
  To: qemu-arm; +Cc: qemu-trivial, peter.maydell, afaerber, qemu-devel

arm_gic.c retrieves CPU number using either NUM_CPU(s) or s->num_cpu.
Such mixed-uses make source code inconsistent. This patch removes
NUM_CPU(s), which was defined for MPCore tweak long ago, and instead
favors s->num_cpu. The source is more consistent after this tweak.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/intc/arm_gic.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 8bad132..2f76f0b 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -35,8 +35,6 @@ static const uint8_t gic_id[] = {
     0x90, 0x13, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1
 };
 
-#define NUM_CPU(s) ((s)->num_cpu)
-
 static inline int gic_get_current_cpu(GICState *s)
 {
     if (s->num_cpu > 1) {
@@ -64,7 +62,7 @@ void gic_update(GICState *s)
     int cpu;
     int cm;
 
-    for (cpu = 0; cpu < NUM_CPU(s); cpu++) {
+    for (cpu = 0; cpu < s->num_cpu; cpu++) {
         cm = 1 << cpu;
         s->current_pending[cpu] = 1023;
         if (!(s->ctlr & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1))
@@ -567,7 +565,7 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr offset, MemTxAttrs attrs)
         if (offset == 4)
             /* Interrupt Controller Type Register */
             return ((s->num_irq / 32) - 1)
-                    | ((NUM_CPU(s) - 1) << 5)
+                    | (s->num_cpu - 1) << 5)
                     | (s->security_extn << 10);
         if (offset < 0x08)
             return 0;
@@ -1284,7 +1282,7 @@ static void arm_gic_realize(DeviceState *dev, Error **errp)
      * GIC v2 defines a larger memory region (0x1000) so this will need
      * to be extended when we implement A15.
      */
-    for (i = 0; i < NUM_CPU(s); i++) {
+    for (i = 0; i < s->num_cpu; i++) {
         s->backref[i] = s;
         memory_region_init_io(&s->cpuiomem[i+1], OBJECT(s), &gic_cpu_ops,
                               &s->backref[i], "gic_cpu", 0x100);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH Trivial] hw/intc/arm_gic: Remove the definition of NUM_CPU
  2015-11-05 17:11 [Qemu-devel] [PATCH Trivial] hw/intc/arm_gic: Remove the definition of NUM_CPU Wei Huang
@ 2015-11-05 17:13 ` Andreas Färber
  2015-11-05 17:22   ` Wei Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Färber @ 2015-11-05 17:13 UTC (permalink / raw)
  To: Wei Huang, qemu-arm; +Cc: qemu-trivial, peter.maydell, qemu-devel

Am 05.11.2015 um 18:11 schrieb Wei Huang:
> arm_gic.c retrieves CPU number using either NUM_CPU(s) or s->num_cpu.
> Such mixed-uses make source code inconsistent. This patch removes
> NUM_CPU(s), which was defined for MPCore tweak long ago, and instead
> favors s->num_cpu. The source is more consistent after this tweak.
> 
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  hw/intc/arm_gic.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

I don't mind either way, and it'll go through Peter's queue I guess,

Reviewed-by: Andreas Färber <afaerber@suse.de>

Cheers,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH Trivial] hw/intc/arm_gic: Remove the definition of NUM_CPU
  2015-11-05 17:13 ` Andreas Färber
@ 2015-11-05 17:22   ` Wei Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Huang @ 2015-11-05 17:22 UTC (permalink / raw)
  To: Andreas Färber, qemu-arm; +Cc: qemu-trivial, peter.maydell, qemu-devel



On 11/05/2015 11:13 AM, Andreas Färber wrote:
> Am 05.11.2015 um 18:11 schrieb Wei Huang:
>> arm_gic.c retrieves CPU number using either NUM_CPU(s) or s->num_cpu.
>> Such mixed-uses make source code inconsistent. This patch removes
>> NUM_CPU(s), which was defined for MPCore tweak long ago, and instead
>> favors s->num_cpu. The source is more consistent after this tweak.
>>
>> Signed-off-by: Wei Huang <wei@redhat.com>
>> ---
>>  hw/intc/arm_gic.c | 8 +++-----
>>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> I don't mind either way, and it'll go through Peter's queue I guess,
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>

Thanks. I sent out a wrong file which failed the compilation. So please
ignore this file.

Yeah, maybe through Peter's tree given that he is the maintainer of this
file.

-Wei

> 
> Cheers,
> Andreas
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-05 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-05 17:11 [Qemu-devel] [PATCH Trivial] hw/intc/arm_gic: Remove the definition of NUM_CPU Wei Huang
2015-11-05 17:13 ` Andreas Färber
2015-11-05 17:22   ` Wei Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).