qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2.1] target-ppc: Add MMU model check for booke machines
@ 2017-01-26 10:15 Valentin Plotkin
  2017-01-26 12:40 ` Edgar E. Iglesias
  2017-02-01  0:19 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Valentin Plotkin @ 2017-01-26 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Valentin Plotkin, Edgar E . Iglesias, Alexander Graf,
	David Gibson, Scott Wood, qemu-ppc

From: Valentin Plotkin <caliborn@sdf.org>

Machines bamboo, e500 and virtex-ml507 assume a certain MMU model,
otherwise resulting in unpredictable behavior. Add apropriate checks
into *_init functions.

Signed-off-by: Valentin Plotkin <caliborn@sdf.org>
---
 hw/ppc/e500.c          | 6 ++++++
 hw/ppc/ppc440_bamboo.c | 6 ++++++
 hw/ppc/virtex_ml507.c  | 7 +++++++
 3 files changed, 19 insertions(+)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index cf8b122..5b1958c 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -827,6 +827,12 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
         env = &cpu->env;
         cs = CPU(cpu);
 
+        if (env->mmu_model != POWERPC_MMU_BOOKE206) {
+            fprintf(stderr, "MMU model %i not supported by this machine.\n",
+                env->mmu_model);
+            exit(1);
+        }
+
         if (!firstenv) {
             firstenv = env;
         }
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index 5c535b1..9d997bf 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -193,6 +193,12 @@ static void bamboo_init(MachineState *machine)
     }
     env = &cpu->env;
 
+    if (env->mmu_model != POWERPC_MMU_BOOKE) {
+        fprintf(stderr, "MMU model %i not supported by this machine.\n",
+            env->mmu_model);
+        exit(1);
+    }
+
     qemu_register_reset(main_cpu_reset, cpu);
     ppc_booke_timers_init(cpu, 400000000, 0);
     ppc_dcr_init(env, NULL, NULL);
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index b97d966..fdbcf22 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -221,6 +221,13 @@ static void virtex_init(MachineState *machine)
 
     cpu = ppc440_init_xilinx(&ram_size, 1, machine->cpu_model, 400000000);
     env = &cpu->env;
+
+    if (env->mmu_model != POWERPC_MMU_BOOKE) {
+        fprintf(stderr, "MMU model %i not supported by this machine.\n",
+            env->mmu_model);
+        exit(1);
+    }
+
     qemu_register_reset(main_cpu_reset, cpu);
 
     memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size);
-- 
2.5.5


This fixes 'qemu-system-ppc -nographic -cpu G2leGP3 -M ppce500; bug from
BiteSizedTasks.

Version 2: fixed style, moved checks from mmubooke_create_initial_mapping
to *_init. Thanks to Thomas Huth <thuth@redhat.com>.

Version 2.1: seems like my mailer added linebreaks without ever notyfing.
Sorry for the mess, will use git send-mail from now on.

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

* Re: [Qemu-devel] [PATCH v2.1] target-ppc: Add MMU model check for booke machines
  2017-01-26 10:15 [Qemu-devel] [PATCH v2.1] target-ppc: Add MMU model check for booke machines Valentin Plotkin
@ 2017-01-26 12:40 ` Edgar E. Iglesias
  2017-02-01  0:19 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Edgar E. Iglesias @ 2017-01-26 12:40 UTC (permalink / raw)
  To: Valentin Plotkin
  Cc: qemu-devel, Valentin Plotkin, Alexander Graf, David Gibson,
	Scott Wood, qemu-ppc

On Thu, Jan 26, 2017 at 10:15:59AM +0000, Valentin Plotkin wrote:
> From: Valentin Plotkin <caliborn@sdf.org>
> 
> Machines bamboo, e500 and virtex-ml507 assume a certain MMU model,
> otherwise resulting in unpredictable behavior. Add apropriate checks
> into *_init functions.

Thanks Valentin.

Regarding the virtex parts:
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>


> 
> Signed-off-by: Valentin Plotkin <caliborn@sdf.org>
> ---
>  hw/ppc/e500.c          | 6 ++++++
>  hw/ppc/ppc440_bamboo.c | 6 ++++++
>  hw/ppc/virtex_ml507.c  | 7 +++++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index cf8b122..5b1958c 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -827,6 +827,12 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
>          env = &cpu->env;
>          cs = CPU(cpu);
>  
> +        if (env->mmu_model != POWERPC_MMU_BOOKE206) {
> +            fprintf(stderr, "MMU model %i not supported by this machine.\n",
> +                env->mmu_model);
> +            exit(1);
> +        }
> +
>          if (!firstenv) {
>              firstenv = env;
>          }
> diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
> index 5c535b1..9d997bf 100644
> --- a/hw/ppc/ppc440_bamboo.c
> +++ b/hw/ppc/ppc440_bamboo.c
> @@ -193,6 +193,12 @@ static void bamboo_init(MachineState *machine)
>      }
>      env = &cpu->env;
>  
> +    if (env->mmu_model != POWERPC_MMU_BOOKE) {
> +        fprintf(stderr, "MMU model %i not supported by this machine.\n",
> +            env->mmu_model);
> +        exit(1);
> +    }
> +
>      qemu_register_reset(main_cpu_reset, cpu);
>      ppc_booke_timers_init(cpu, 400000000, 0);
>      ppc_dcr_init(env, NULL, NULL);
> diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
> index b97d966..fdbcf22 100644
> --- a/hw/ppc/virtex_ml507.c
> +++ b/hw/ppc/virtex_ml507.c
> @@ -221,6 +221,13 @@ static void virtex_init(MachineState *machine)
>  
>      cpu = ppc440_init_xilinx(&ram_size, 1, machine->cpu_model, 400000000);
>      env = &cpu->env;
> +
> +    if (env->mmu_model != POWERPC_MMU_BOOKE) {
> +        fprintf(stderr, "MMU model %i not supported by this machine.\n",
> +            env->mmu_model);
> +        exit(1);
> +    }
> +
>      qemu_register_reset(main_cpu_reset, cpu);
>  
>      memory_region_allocate_system_memory(phys_ram, NULL, "ram", ram_size);
> -- 
> 2.5.5
> 
> 
> This fixes 'qemu-system-ppc -nographic -cpu G2leGP3 -M ppce500; bug from
> BiteSizedTasks.
> 
> Version 2: fixed style, moved checks from mmubooke_create_initial_mapping
> to *_init. Thanks to Thomas Huth <thuth@redhat.com>.
> 
> Version 2.1: seems like my mailer added linebreaks without ever notyfing.
> Sorry for the mess, will use git send-mail from now on.

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

* Re: [Qemu-devel] [PATCH v2.1] target-ppc: Add MMU model check for booke machines
  2017-01-26 10:15 [Qemu-devel] [PATCH v2.1] target-ppc: Add MMU model check for booke machines Valentin Plotkin
  2017-01-26 12:40 ` Edgar E. Iglesias
@ 2017-02-01  0:19 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2017-02-01  0:19 UTC (permalink / raw)
  To: Valentin Plotkin
  Cc: qemu-devel, Valentin Plotkin, Edgar E . Iglesias, Alexander Graf,
	Scott Wood, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

On Thu, Jan 26, 2017 at 10:15:59AM +0000, Valentin Plotkin wrote:
> From: Valentin Plotkin <caliborn@sdf.org>
> 
> Machines bamboo, e500 and virtex-ml507 assume a certain MMU model,
> otherwise resulting in unpredictable behavior. Add apropriate checks
> into *_init functions.
> 
> Signed-off-by: Valentin Plotkin <caliborn@sdf.org>

Applied to ppc-for-2.9.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2017-02-01  0:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-26 10:15 [Qemu-devel] [PATCH v2.1] target-ppc: Add MMU model check for booke machines Valentin Plotkin
2017-01-26 12:40 ` Edgar E. Iglesias
2017-02-01  0:19 ` David Gibson

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