]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-ppc: KVMPPC_H_CAS fix cpu-version endianess
authorLaurent Dufour <ldufour@linux.vnet.ibm.com>
Fri, 27 Jun 2014 13:47:37 +0000 (15:47 +0200)
committerAlexander Graf <agraf@suse.de>
Tue, 8 Jul 2014 10:10:36 +0000 (12:10 +0200)
During KVMPPC_H_CAS processing, the cpu-version updated value is stored
without taking care of the current endianess. As a consequence, the guest
may not switch to the right CPU model, leading to unexpected results.

If needed, the value is now converted.

Fixes: 6d9412ea8132 ("target-ppc: Implement "compat" CPU option")
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/ppc/spapr.c

index a8ba916970cb5aca48dda48878908b9414efda22..a23c0f080e954720541a3333eb0ce10695b98a86 100644 (file)
@@ -160,8 +160,7 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,
     int index = ppc_get_vcpu_dt_id(cpu);
 
     if (cpu->cpu_version) {
-        ret = fdt_setprop(fdt, offset, "cpu-version",
-                          &cpu->cpu_version, sizeof(cpu->cpu_version));
+        ret = fdt_setprop_cell(fdt, offset, "cpu-version", cpu->cpu_version);
         if (ret < 0) {
             return ret;
         }