qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/unicore32/puv3: Simplify puv3_soc_init()
@ 2020-02-21 16:23 Philippe Mathieu-Daudé
  2020-03-03  9:56 ` Laurent Vivier
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-21 16:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Alistair Francis, Guan Xuetao, Richard Henderson,
	Philippe Mathieu-Daudé

Since commit d8ed887bdc, the puv3_intc_cpu_handler handler takes
a pointer to UniCore32CPU in its opaque argument.  Directly pass
the cpu pointer.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/unicore32/puv3.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index 7e933de228..eec7f561eb 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -48,7 +48,7 @@ static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
     }
 }
 
-static void puv3_soc_init(CPUUniCore32State *env)
+static void puv3_soc_init(UniCore32CPU *cpu)
 {
     qemu_irq cpu_intc, irqs[PUV3_IRQS_NR];
     DeviceState *dev;
@@ -56,8 +56,7 @@ static void puv3_soc_init(CPUUniCore32State *env)
     int i;
 
     /* Initialize interrupt controller */
-    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler,
-                                 env_archcpu(env), 0);
+    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler, cpu, 0);
     dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, cpu_intc);
     for (i = 0; i < PUV3_IRQS_NR; i++) {
         irqs[i] = qdev_get_gpio_in(dev, i);
@@ -131,7 +130,7 @@ static void puv3_init(MachineState *machine)
     cpu = UNICORE32_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
 
-    puv3_soc_init(env);
+    puv3_soc_init(cpu);
     puv3_board_init(env, ram_size);
     puv3_load_kernel(kernel_filename);
 }
-- 
2.21.1



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

* Re: [PATCH] hw/unicore32/puv3: Simplify puv3_soc_init()
  2020-02-21 16:23 [PATCH] hw/unicore32/puv3: Simplify puv3_soc_init() Philippe Mathieu-Daudé
@ 2020-03-03  9:56 ` Laurent Vivier
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2020-03-03  9:56 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Richard Henderson, Guan Xuetao, Alistair Francis

Le 21/02/2020 à 17:23, Philippe Mathieu-Daudé a écrit :
> Since commit d8ed887bdc, the puv3_intc_cpu_handler handler takes
> a pointer to UniCore32CPU in its opaque argument.  Directly pass
> the cpu pointer.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/unicore32/puv3.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7e933de228..eec7f561eb 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -48,7 +48,7 @@ static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
>      }
>  }
>  
> -static void puv3_soc_init(CPUUniCore32State *env)
> +static void puv3_soc_init(UniCore32CPU *cpu)
>  {
>      qemu_irq cpu_intc, irqs[PUV3_IRQS_NR];
>      DeviceState *dev;
> @@ -56,8 +56,7 @@ static void puv3_soc_init(CPUUniCore32State *env)
>      int i;
>  
>      /* Initialize interrupt controller */
> -    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler,
> -                                 env_archcpu(env), 0);
> +    cpu_intc = qemu_allocate_irq(puv3_intc_cpu_handler, cpu, 0);
>      dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, cpu_intc);
>      for (i = 0; i < PUV3_IRQS_NR; i++) {
>          irqs[i] = qdev_get_gpio_in(dev, i);
> @@ -131,7 +130,7 @@ static void puv3_init(MachineState *machine)
>      cpu = UNICORE32_CPU(cpu_create(machine->cpu_type));
>      env = &cpu->env;
>  
> -    puv3_soc_init(env);
> +    puv3_soc_init(cpu);
>      puv3_board_init(env, ram_size);
>      puv3_load_kernel(kernel_filename);
>  }
> 

I think you can remove totally env as puv3_board_init() doesn't use it.

Thanks,
Laurent


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

end of thread, other threads:[~2020-03-03  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 16:23 [PATCH] hw/unicore32/puv3: Simplify puv3_soc_init() Philippe Mathieu-Daudé
2020-03-03  9:56 ` Laurent Vivier

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).