Skip to contentSkip to conversation

target-sparc: Preparations for CPUState part 4b series

PATCH Applied Andreas Färber 2 participants 7 messages Oct 12, 2012 – Oct 13, 2012

lore
Share & tools
lore
#0 lore raw

v2 cover target-sparc: Preparations for CPUState part 4b series

Hello Blue,

These patches from my QOM CPUState part 4 series still apply to master. In whatever way we solve the TLB flushing (needed for CPU VMState), we'll need these. Can you please ack/apply?

As a reminder, SPARCCPU and CPUState are the same pointer, whereas CPUSPARCState has been embedded into SPARCCPU. Therefore SPARCCPU is being used as quickest way to get to both.

Available from:
git://github.com/afaerber/qemu-cpu.git qom-cpu-sparc
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-sparc

Regards,
Andreas

Cc Blue Swirl <[email protected]>
Cc Richard Henderson <[email protected]>

v1 -> v2:
* Cherry-picked sparc patches from QOM CPUState part 4 series.
* Expanded commit messages, no functional changes.

Andreas Färber (5):
sun4m: Pass SPARCCPU to cpu_set_irq()
sun4m: Pass SPARCCPU to cpu_kick_irq()
sun4u: Pass SPARCCPU to {,s,hs}tick_irq() and cpu_timer_create()
sun4u: Pass SPARCCPU to cpu_kick_irq()
sun4u: Pass SPARCCPU to cpu_set_ivec_irq()

 hw/sun4m.c |   11 +++++++----
 hw/sun4u.c |   36 ++++++++++++++++++++----------------

2 Dateien geändert, 27 Zeilen hinzugefügt(+), 20 Zeilen entfernt(-)

Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/5 sun4m: Pass SPARCCPU to cpu_set_irq()

Needed for changing cpu_kick_irq() argument type to SPARCCPU.

---
 hw/sun4m.c |    5 +++--

1 Datei geändert, 3 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

hw/sun4m.c +3 -2
index c98cd5e..c1ee8bd 100644
@@ -262,7 +262,8 @@ static void cpu_kick_irq(CPUSPARCState *env)
 
 static void cpu_set_irq(void *opaque, int irq, int level)
 {
-    CPUSPARCState *env = opaque;
+    SPARCCPU *cpu = opaque;
+    CPUSPARCState *env = &cpu->env;
 
     if (level) {
         trace_sun4m_cpu_set_irq_raise(irq);
@@ -840,7 +841,7 @@ static void cpu_devinit(const char *cpu_model, unsigned int id,
         qemu_register_reset(secondary_cpu_reset, cpu);
         env->halted = 1;
     }
-    *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS);
+    *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS);
     env->prom_addr = prom_addr;
 }
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/5 sun4m: Pass SPARCCPU to cpu_kick_irq()

In reply to Andreas Färber

Needed for changing qemu_cpu_kick() argument type to CPUState.

---
 hw/sun4m.c |    6 ++++--

1 Datei geändert, 4 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

hw/sun4m.c +4 -2
index c1ee8bd..a04b485 100644
@@ -253,8 +253,10 @@ void cpu_check_irqs(CPUSPARCState *env)
     }
 }
 
-static void cpu_kick_irq(CPUSPARCState *env)
+static void cpu_kick_irq(SPARCCPU *cpu)
 {
+    CPUSPARCState *env = &cpu->env;
+
     env->halted = 0;
     cpu_check_irqs(env);
     qemu_cpu_kick(env);
@@ -268,7 +270,7 @@ static void cpu_set_irq(void *opaque, int irq, int level)
     if (level) {
         trace_sun4m_cpu_set_irq_raise(irq);
         env->pil_in |= 1 << irq;
-        cpu_kick_irq(env);
+        cpu_kick_irq(cpu);
     } else {
         trace_sun4m_cpu_set_irq_lower(irq);
         env->pil_in &= ~(1 << irq);
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v2 3/5 sun4u: Pass SPARCCPU to {, s, hs}tick_irq() and cpu_timer_create()

In reply to Andreas Färber

Needed for changing cpu_kick_irq() argument type to SPARCCPU.

---
 hw/sun4u.c |   19 +++++++++++--------

1 Datei geändert, 11 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)

hw/sun4u.c +11 -8
index 137a7c6..4cea102 100644
@@ -366,7 +366,7 @@ void cpu_get_timer(QEMUFile *f, CPUTimer *s)
     qemu_get_timer(f, s->qtimer);
 }
 
-static CPUTimer* cpu_timer_create(const char* name, CPUSPARCState *env,
+static CPUTimer *cpu_timer_create(const char *name, SPARCCPU *cpu,
                                   QEMUBHFunc *cb, uint32_t frequency,
                                   uint64_t disabled_mask)
 {
@@ -379,7 +379,7 @@ static CPUTimer* cpu_timer_create(const char* name, CPUSPARCState *env,
     timer->disabled = 1;
     timer->clock_offset = qemu_get_clock_ns(vm_clock);
 
-    timer->qtimer = qemu_new_timer_ns(vm_clock, cb, env);
+    timer->qtimer = qemu_new_timer_ns(vm_clock, cb, cpu);
 
     return timer;
 }
@@ -418,7 +418,8 @@ static void main_cpu_reset(void *opaque)
 
 static void tick_irq(void *opaque)
 {
-    CPUSPARCState *env = opaque;
+    SPARCCPU *cpu = opaque;
+    CPUSPARCState *env = &cpu->env;
 
     CPUTimer* timer = env->tick;
 
@@ -435,7 +436,8 @@ static void tick_irq(void *opaque)
 
 static void stick_irq(void *opaque)
 {
-    CPUSPARCState *env = opaque;
+    SPARCCPU *cpu = opaque;
+    CPUSPARCState *env = &cpu->env;
 
     CPUTimer* timer = env->stick;
 
@@ -452,7 +454,8 @@ static void stick_irq(void *opaque)
 
 static void hstick_irq(void *opaque)
 {
-    CPUSPARCState *env = opaque;
+    SPARCCPU *cpu = opaque;
+    CPUSPARCState *env = &cpu->env;
 
     CPUTimer* timer = env->hstick;
 
@@ -772,13 +775,13 @@ static SPARCCPU *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef)
     }
     env = &cpu->env;
 
-    env->tick = cpu_timer_create("tick", env, tick_irq,
+    env->tick = cpu_timer_create("tick", cpu, tick_irq,
                                   tick_frequency, TICK_NPT_MASK);
 
-    env->stick = cpu_timer_create("stick", env, stick_irq,
+    env->stick = cpu_timer_create("stick", cpu, stick_irq,
                                    stick_frequency, TICK_INT_DIS);
 
-    env->hstick = cpu_timer_create("hstick", env, hstick_irq,
+    env->hstick = cpu_timer_create("hstick", cpu, hstick_irq,
                                     hstick_frequency, TICK_INT_DIS);
 
     reset_info = g_malloc0(sizeof(ResetData));
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v2 4/5 sun4u: Pass SPARCCPU to cpu_kick_irq()

In reply to Andreas Färber

Needed for changing qemu_cpu_kick() argument type to CPUState.

---
 hw/sun4u.c |   10 ++++++----

1 Datei geändert, 6 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

hw/sun4u.c +6 -4
index 4cea102..0453522 100644
@@ -310,8 +310,10 @@ void cpu_check_irqs(CPUSPARCState *env)
     }
 }
 
-static void cpu_kick_irq(CPUSPARCState *env)
+static void cpu_kick_irq(SPARCCPU *cpu)
 {
+    CPUSPARCState *env = &cpu->env;
+
     env->halted = 0;
     cpu_check_irqs(env);
     qemu_cpu_kick(env);
@@ -431,7 +433,7 @@ static void tick_irq(void *opaque)
     }
 
     env->softint |= SOFTINT_TIMER;
-    cpu_kick_irq(env);
+    cpu_kick_irq(cpu);
 }
 
 static void stick_irq(void *opaque)
@@ -449,7 +451,7 @@ static void stick_irq(void *opaque)
     }
 
     env->softint |= SOFTINT_STIMER;
-    cpu_kick_irq(env);
+    cpu_kick_irq(cpu);
 }
 
 static void hstick_irq(void *opaque)
@@ -467,7 +469,7 @@ static void hstick_irq(void *opaque)
     }
 
     env->softint |= SOFTINT_STIMER;
-    cpu_kick_irq(env);
+    cpu_kick_irq(cpu);
 }
 
 static int64_t cpu_to_timer_ticks(int64_t cpu_ticks, uint32_t frequency)
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH v2 5/5 sun4u: Pass SPARCCPU to cpu_set_ivec_irq()

In reply to Andreas Färber

Needed for moving halted field to CPUState.

---
 hw/sun4u.c |    7 +++----

1 Datei geändert, 3 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

hw/sun4u.c +3 -4
index 0453522..940db33 100644
@@ -321,7 +321,8 @@ static void cpu_kick_irq(SPARCCPU *cpu)
 
 static void cpu_set_ivec_irq(void *opaque, int irq, int level)
 {
-    CPUSPARCState *env = opaque;
+    SPARCCPU *cpu = opaque;
+    CPUSPARCState *env = &cpu->env;
 
     if (level) {
         if (!(env->ivec_status & 0x20)) {
@@ -802,7 +803,6 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
                         const struct hwdef *hwdef)
 {
     SPARCCPU *cpu;
-    CPUSPARCState *env;
     M48t59State *nvram;
     unsigned int i;
     uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_entry;
@@ -815,14 +815,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
     /* init CPUs */
     cpu = cpu_devinit(cpu_model, hwdef);
-    env = &cpu->env;
 
     /* set up devices */
     ram_init(0, RAM_size);
 
     prom_init(hwdef->prom_addr, bios_name);
 
-    ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, env, IVEC_MAX);
+    ivec_irqs = qemu_allocate_irqs(cpu_set_ivec_irq, cpu, IVEC_MAX);
     pci_bus = pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &pci_bus2,
                            &pci_bus3, &pbm_irqs);
     pci_vga_init(pci_bus);
Signature · 1 line
1.7.10.4
Applied
#6 lore raw
In reply to Andreas Färber
Quoted 5 lines · Andreas Färber

Hello Blue,

These patches from my QOM CPUState part 4 series still apply to master. In whatever way we solve the TLB flushing (needed for CPU VMState), we'll need these. Can you please ack/apply?

Thanks, applied all.

Quoted 34 lines

As a reminder, SPARCCPU and CPUState are the same pointer, whereas CPUSPARCState has been embedded into SPARCCPU. Therefore SPARCCPU is being used as quickest way to get to both.

Available from:
git://github.com/afaerber/qemu-cpu.git qom-cpu-sparc
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-sparc

Regards,
Andreas

Cc Blue Swirl <[email protected]>
Cc Richard Henderson <[email protected]>

v1 -> v2:
* Cherry-picked sparc patches from QOM CPUState part 4 series.
* Expanded commit messages, no functional changes.

Andreas Färber (5):
sun4m: Pass SPARCCPU to cpu_set_irq()
sun4m: Pass SPARCCPU to cpu_kick_irq()
sun4u: Pass SPARCCPU to {,s,hs}tick_irq() and cpu_timer_create()
sun4u: Pass SPARCCPU to cpu_kick_irq()
sun4u: Pass SPARCCPU to cpu_set_ivec_irq()

 hw/sun4m.c |   11 +++++++----
 hw/sun4u.c |   36 ++++++++++++++++++++----------------

2 Dateien geändert, 27 Zeilen hinzugefügt(+), 20 Zeilen entfernt(-)

--
1.7.10.4