diff mbox

[for-1.4?] target-i386: Pass X86CPU to cpu_x86_set_a20()

Message ID 1359644924-29389-1-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Jan. 31, 2013, 3:08 p.m. UTC
Prepares for cpu_interrupt() changing argument to CPUState.

While touching it, rename to x86_cpu_...() now that it takes an X86CPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 Extracted from my qom-cpu-8 queue.

 hw/pc.c              |    7 ++++---
 target-i386/cpu.h    |    2 +-
 target-i386/helper.c |    4 +++-
 3 Dateien geändert, 8 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)

Comments

Eduardo Habkost Jan. 31, 2013, 3:49 p.m. UTC | #1
On Thu, Jan 31, 2013 at 04:08:44PM +0100, Andreas Färber wrote:
> Prepares for cpu_interrupt() changing argument to CPUState.
> 
> While touching it, rename to x86_cpu_...() now that it takes an X86CPU.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

Why the "for-1.4?"? Is there a for-1.4 bug fix that depends on this?


> ---
>  Extracted from my qom-cpu-8 queue.
> 
>  hw/pc.c              |    7 ++++---
>  target-i386/cpu.h    |    2 +-
>  target-i386/helper.c |    4 +++-
>  3 Dateien geändert, 8 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
> 
> diff --git a/hw/pc.c b/hw/pc.c
> index 34b6dff..53cc173 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -527,11 +527,11 @@ type_init(port92_register_types)
>  
>  static void handle_a20_line_change(void *opaque, int irq, int level)
>  {
> -    CPUX86State *cpu = opaque;
> +    X86CPU *cpu = opaque;
>  
>      /* XXX: send to all CPUs ? */
>      /* XXX: add logic to handle multiple A20 line sources */
> -    cpu_x86_set_a20(cpu, level);
> +    x86_cpu_set_a20(cpu, level);
>  }
>  
>  int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
> @@ -1085,7 +1085,8 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
>          }
>      }
>  
> -    a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
> +    a20_line = qemu_allocate_irqs(handle_a20_line_change,
> +                                  x86_env_get_cpu(first_cpu), 2);
>      i8042 = isa_create_simple(isa_bus, "i8042");
>      i8042_setup_a20_line(i8042, &a20_line[0]);
>      if (!no_vmport) {
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index 62508dc..9e6e1a6 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -1011,7 +1011,7 @@ void host_cpuid(uint32_t function, uint32_t count,
>  int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
>                               int is_write, int mmu_idx);
>  #define cpu_handle_mmu_fault cpu_x86_handle_mmu_fault
> -void cpu_x86_set_a20(CPUX86State *env, int a20_state);
> +void x86_cpu_set_a20(X86CPU *cpu, int a20_state);
>  
>  static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index)
>  {
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index bf43d6a..29217ef 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -366,8 +366,10 @@ void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
>  /* x86 mmu */
>  /* XXX: add PGE support */
>  
> -void cpu_x86_set_a20(CPUX86State *env, int a20_state)
> +void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
>  {
> +    CPUX86State *env = &cpu->env;
> +
>      a20_state = (a20_state != 0);
>      if (a20_state != ((env->a20_mask >> 20) & 1)) {
>  #if defined(DEBUG_MMU)
> -- 
> 1.7.10.4
>
Andreas Färber Jan. 31, 2013, 4:11 p.m. UTC | #2
Am 31.01.2013 16:49, schrieb Eduardo Habkost:
> On Thu, Jan 31, 2013 at 04:08:44PM +0100, Andreas Färber wrote:
>> Prepares for cpu_interrupt() changing argument to CPUState.
>>
>> While touching it, rename to x86_cpu_...() now that it takes an X86CPU.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
> 
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> Why the "for-1.4?"?

I'm suggesting it for 1.4 as a non-intrusive cleanup, for Igor and you
to rebase property etc. work on to avoid merge conflicts (being my sole
such i386-only patch currently). If there are any concerns, I can put it
into qom-cpu-next instead (where the cpu_init changes are queued).

> Is there a for-1.4 bug fix that depends on this?

No, it is not strictly needed, I'm just flushing my queue of preparatory
patches to get my upcoming qom-cpu-8 patchset shorter - I probably need
to split off a qom-cpu-9 though.

Andreas

>> ---
>>  Extracted from my qom-cpu-8 queue.
[snip]
Andreas Färber Jan. 31, 2013, 11:52 p.m. UTC | #3
Am 31.01.2013 16:49, schrieb Eduardo Habkost:
> On Thu, Jan 31, 2013 at 04:08:44PM +0100, Andreas Färber wrote:
>> Prepares for cpu_interrupt() changing argument to CPUState.
>>
>> While touching it, rename to x86_cpu_...() now that it takes an X86CPU.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
> 
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas
diff mbox

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 34b6dff..53cc173 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -527,11 +527,11 @@  type_init(port92_register_types)
 
 static void handle_a20_line_change(void *opaque, int irq, int level)
 {
-    CPUX86State *cpu = opaque;
+    X86CPU *cpu = opaque;
 
     /* XXX: send to all CPUs ? */
     /* XXX: add logic to handle multiple A20 line sources */
-    cpu_x86_set_a20(cpu, level);
+    x86_cpu_set_a20(cpu, level);
 }
 
 int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
@@ -1085,7 +1085,8 @@  void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
         }
     }
 
-    a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
+    a20_line = qemu_allocate_irqs(handle_a20_line_change,
+                                  x86_env_get_cpu(first_cpu), 2);
     i8042 = isa_create_simple(isa_bus, "i8042");
     i8042_setup_a20_line(i8042, &a20_line[0]);
     if (!no_vmport) {
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 62508dc..9e6e1a6 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1011,7 +1011,7 @@  void host_cpuid(uint32_t function, uint32_t count,
 int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                              int is_write, int mmu_idx);
 #define cpu_handle_mmu_fault cpu_x86_handle_mmu_fault
-void cpu_x86_set_a20(CPUX86State *env, int a20_state);
+void x86_cpu_set_a20(X86CPU *cpu, int a20_state);
 
 static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index)
 {
diff --git a/target-i386/helper.c b/target-i386/helper.c
index bf43d6a..29217ef 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -366,8 +366,10 @@  void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
 /* x86 mmu */
 /* XXX: add PGE support */
 
-void cpu_x86_set_a20(CPUX86State *env, int a20_state)
+void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
 {
+    CPUX86State *env = &cpu->env;
+
     a20_state = (a20_state != 0);
     if (a20_state != ((env->a20_mask >> 20) & 1)) {
 #if defined(DEBUG_MMU)