Skip to contentSkip to conversation

target-sh4: SuperHCPU fixups

PATCH In review Andreas Färber 3 participants 7 messages Apr 9, 2013 – Apr 13, 2013

lore
Share & tools
lore
#0 lore raw

cover target-sh4: SuperHCPU fixups

Hello Peter and Aurélien,

This mini-series fixes fallout from my last qom-cpu pull:
A patch relocating class-level fields had been cherry-picked without the necessary prerequisites.
This series redoes those type changes; follow-up cleanups are left out for time reasons.

Regards,
Andreas

Cc Peter Maydell <[email protected]>
Cc Aurélien Jarno <[email protected]>

Andreas Färber (2):
shix: Catch CPU initialization errors
sh7750: Change cpu field type to SuperHCPU

 hw/sh4/r2d.c        |  2 +-
 hw/sh4/sh7750.c     | 91 +++++++++++++++++++++++++++--------------------------
 hw/sh4/shix.c       | 10 ++++--
 include/hw/sh4/sh.h |  2 +-
 4 files changed, 55 insertions(+), 50 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/2 shix: Catch CPU initialization errors

Print an error message as done for the r2d machine and exit.

---
 hw/sh4/shix.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/sh4/shix.c +4 -0
index c23d4af..f5cfef9 100644
@@ -52,6 +52,10 @@ static void shix_init(QEMUMachineInitArgs *args)
 
     printf("Initializing CPU\n");
     env = cpu_init(cpu_model);
+    if (env == NULL) {
+        fprintf(stderr, "Unable to find CPU definition\n");
+        exit(1);
+    }
 
     /* Allocate memory space */
     printf("Allocating ROM\n");
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 2/2 sh7750: Change cpu field type to SuperHCPU

In reply to Andreas Färber

This brings us a step closer to QOM'ified SH7750 SoC and fixes b350ab75 (target-sh4: Move PVR/PRR/CVR into SuperHCPUClass) assuming SuperHCPU type for SUPERH_CPU_GET_CLASS().

Fix Coding Style issues while at it (indentation, braces).

---
 hw/sh4/r2d.c        |  2 +-
 hw/sh4/sh7750.c     | 91 +++++++++++++++++++++++++++--------------------------
 hw/sh4/shix.c       |  8 ++---
 include/hw/sh4/sh.h |  2 +-
 4 files changed, 52 insertions(+), 51 deletions(-)
hw/sh4/r2d.c +1 -1
index 256a58c..fe82bd62 100644
@@ -258,7 +258,7 @@ static void r2d_init(QEMUMachineInitArgs *args)
     vmstate_register_ram_global(sdram);
     memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram);
     /* Register peripherals */
-    s = sh7750_init(env, address_space_mem);
+    s = sh7750_init(cpu, address_space_mem);
     irq = r2d_fpga_init(address_space_mem, 0x04000000, sh7750_irl(s));
 
     dev = qdev_create(NULL, "sh_pci");
hw/sh4/sh7750.c +46 -45

204 lines not on this page · raw message

hw/sh4/shix.c +4 -4
index f5cfef9..ffac621 100644
@@ -41,7 +41,7 @@ static void shix_init(QEMUMachineInitArgs *args)
 {
     const char *cpu_model = args->cpu_model;
     int ret;
-    CPUSH4State *env;
+    SuperHCPU *cpu;
     struct SH7750State *s;
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *rom = g_new(MemoryRegion, 1);
@@ -51,8 +51,8 @@ static void shix_init(QEMUMachineInitArgs *args)
         cpu_model = "any";
 
     printf("Initializing CPU\n");
-    env = cpu_init(cpu_model);
-    if (env == NULL) {
+    cpu = cpu_sh4_init(cpu_model);
+    if (cpu == NULL) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
@@ -85,7 +85,7 @@ static void shix_init(QEMUMachineInitArgs *args)
     }
 
     /* Register peripherals */
-    s = sh7750_init(env, sysmem);
+    s = sh7750_init(cpu, sysmem);
     /* XXXXX Check success */
     tc58128_init(s, "shix_linux_nand.bin", NULL);
     fprintf(stderr, "initialization terminated\n");
include/hw/sh4/sh.h +1 -1
index 87c378f..e61de9a 100644
@@ -11,7 +11,7 @@
 struct SH7750State;
 struct MemoryRegion;
 
-struct SH7750State *sh7750_init(CPUSH4State * cpu, struct MemoryRegion *sysmem);
+struct SH7750State *sh7750_init(SuperHCPU *cpu, struct MemoryRegion *sysmem);
 
 typedef struct {
     /* The callback will be triggered if any of the designated lines change */
Signature · 1 line
1.8.1.4
Reviewed-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH qom-cpu 2/2] sh7750: Change cpu field type to SuperHCPU

Quoted 8 lines · Andreas Färber

This brings us a step closer to QOM'ified SH7750 SoC and fixes b350ab75 (target-sh4: Move PVR/PRR/CVR into SuperHCPUClass) assuming SuperHCPU type for SUPERH_CPU_GET_CLASS().

Fix Coding Style issues while at it (indentation, braces).

My test sh4 image boots again now.

thanks
-- PMM

author Applied
#5 lore raw

Re: [Qemu-devel] [PATCH qom-cpu 2/2] sh7750: Change cpu field type to SuperHCPU

Am 09.04.2013 17:29, schrieb Peter Maydell:

Quoted 5 lines · Andreas Färber
Quoted 4 lines

This brings us a step closer to QOM'ified SH7750 SoC and fixes b350ab75 (target-sh4: Move PVR/PRR/CVR into SuperHCPUClass) assuming SuperHCPU type for SUPERH_CPU_GET_CLASS().

Quoted 8 lines
Quoted 4 lines

Fix Coding Style issues while at it (indentation, braces).

My test sh4 image boots again now.

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

If Aurélien wants to apply these directly, that should work, too.

Andreas

Quoted 3 lines

thanks
-- PMM

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#6 lore raw

Re: [Qemu-devel] [PATCH qom-cpu 2/2] sh7750: Change cpu field type to SuperHCPU

Quoted 11 lines · Andreas Färber

Am 09.04.2013 17:29, schrieb Peter Maydell:

Quoted 10 lines · Andreas Färber
Quoted 8 lines

This brings us a step closer to QOM'ified SH7750 SoC and fixes b350ab75 (target-sh4: Move PVR/PRR/CVR into SuperHCPUClass) assuming SuperHCPU type for SUPERH_CPU_GET_CLASS().

Fix Coding Style issues while at it (indentation, braces).

Quoted 9 lines
Quoted 3 lines

My test sh4 image boots again now.

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

If Aurélien wants to apply these directly, that should work, too.

Thanks for the patches. Given the soft-freeze is approaching and we want it to be fixed for the release, I have applied them.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net