diff mbox series

[v19,16/21] hw/rx: Restrict the RX62N microcontroller to the RX62N CPU core

Message ID 20190611113731.16940-17-philmd@redhat.com
State New
Headers show
Series Add RX archtecture support | expand

Commit Message

Philippe Mathieu-Daudé June 11, 2019, 11:37 a.m. UTC
While the VIRT machine can use different microcontrollers,
the RX62N microcontroller is tied to the RX62N CPU core.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/rx/rx-virt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Yoshinori Sato June 11, 2019, 1:21 p.m. UTC | #1
On Tue, 11 Jun 2019 20:37:26 +0900,
Philippe Mathieu-Daudé wrote:
> 
> While the VIRT machine can use different microcontrollers,
> the RX62N microcontroller is tied to the RX62N CPU core.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>

> ---
>  hw/rx/rx-virt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/hw/rx/rx-virt.c b/hw/rx/rx-virt.c
> index ed0a3a1da0..797a090173 100644
> --- a/hw/rx/rx-virt.c
> +++ b/hw/rx/rx-virt.c
> @@ -17,6 +17,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
>  #include "cpu.h"
> @@ -34,6 +35,7 @@
>  
>  static void rxvirt_init(MachineState *machine)
>  {
> +    MachineClass *mc = MACHINE_GET_CLASS(machine);
>      RX62NState *s = g_new(RX62NState, 1);
>      MemoryRegion *sysmem = get_system_memory();
>      MemoryRegion *sdram = g_new(MemoryRegion, 1);
> @@ -42,6 +44,12 @@ static void rxvirt_init(MachineState *machine)
>      void *dtb = NULL;
>      int dtb_size;
>  
> +    if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) {
> +        error_report("This board can only be used with CPU %s",
> +                     mc->default_cpu_type);
> +        exit(1);
> +    }
> +
>      /* Allocate memory space */
>      memory_region_init_ram(sdram, NULL, "sdram", 16 * MiB,
>                             &error_fatal);
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/hw/rx/rx-virt.c b/hw/rx/rx-virt.c
index ed0a3a1da0..797a090173 100644
--- a/hw/rx/rx-virt.c
+++ b/hw/rx/rx-virt.c
@@ -17,6 +17,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
@@ -34,6 +35,7 @@ 
 
 static void rxvirt_init(MachineState *machine)
 {
+    MachineClass *mc = MACHINE_GET_CLASS(machine);
     RX62NState *s = g_new(RX62NState, 1);
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *sdram = g_new(MemoryRegion, 1);
@@ -42,6 +44,12 @@  static void rxvirt_init(MachineState *machine)
     void *dtb = NULL;
     int dtb_size;
 
+    if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) {
+        error_report("This board can only be used with CPU %s",
+                     mc->default_cpu_type);
+        exit(1);
+    }
+
     /* Allocate memory space */
     memory_region_init_ram(sdram, NULL, "sdram", 16 * MiB,
                            &error_fatal);