Patchwork [qom-cpu,4/4] target-ppc: Error out for -cpu host on unknown PVR

login
register
mail settings
Submitter Andreas Färber
Date Dec. 18, 2012, 7:53 a.m.
Message ID <1355817223-13076-5-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/207041/
State New
Headers show

Comments

Andreas Färber - Dec. 18, 2012, 7:53 a.m.
Previously we silently exited, with subclasses we got an opcode warning.
Instead explicitly tell the user what's wrong.

An indication for this is -cpu ? showing "host" with an all-zero PVR.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-ppc/kvm.c |    7 +++++++
 1 Datei geändert, 7 Zeilen hinzugefügt(+)
Alexander Graf - Jan. 3, 2013, 12:26 p.m.
On 18.12.2012, at 08:53, Andreas Färber wrote:

> Previously we silently exited, with subclasses we got an opcode warning.
> Instead explicitly tell the user what's wrong.
> 
> An indication for this is -cpu ? showing "host" with an all-zero PVR.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> target-ppc/kvm.c |    7 +++++++
> 1 Datei geändert, 7 Zeilen hinzugefügt(+)
> 
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index f115892..8998d0f 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -1186,7 +1186,14 @@ static void alter_insns(uint64_t *word, uint64_t flags, bool on)
> 
> static void kvmppc_host_cpu_initfn(Object *obj)
> {
> +    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(obj);
> +
>     assert(kvm_enabled());
> +
> +    if (pcc->info->pvr != mfpvr()) {
> +        fprintf(stderr, "Host PVR unsupported.\n");

This should probably rather say "Host CPU unsupported for -cpu host" or so :). Not everyone who invokes qemu-system-ppc knows what a PVR is.


Alex

Patch

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index f115892..8998d0f 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1186,7 +1186,14 @@  static void alter_insns(uint64_t *word, uint64_t flags, bool on)
 
 static void kvmppc_host_cpu_initfn(Object *obj)
 {
+    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(obj);
+
     assert(kvm_enabled());
+
+    if (pcc->info->pvr != mfpvr()) {
+        fprintf(stderr, "Host PVR unsupported.\n");
+        exit(1);
+    }
 }
 
 static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)