* [Qemu-devel] [PATCH] target-ppc: KVMPPC_H_CAS fix cpu-version endianess
@ 2014-06-27 13:47 Laurent Dufour
2014-06-27 15:16 ` Greg Kurz
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Dufour @ 2014-06-27 13:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf
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>
---
hw/ppc/spapr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 82f183f173ee..85e9f4a74933 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -228,8 +228,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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: KVMPPC_H_CAS fix cpu-version endianess
2014-06-27 13:47 [Qemu-devel] [PATCH] target-ppc: KVMPPC_H_CAS fix cpu-version endianess Laurent Dufour
@ 2014-06-27 15:16 ` Greg Kurz
2014-06-27 16:13 ` Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kurz @ 2014-06-27 15:16 UTC (permalink / raw)
To: Laurent Dufour; +Cc: Alexey Kardashevskiy, qemu-ppc, qemu-devel, Alexander Graf
On Fri, 27 Jun 2014 15:47:37 +0200
Laurent Dufour <ldufour@linux.vnet.ibm.com> wrote:
> 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>
> hw/ppc/spapr.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 82f183f173ee..85e9f4a74933 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -228,8 +228,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;
> }
>
>
--
Gregory Kurz kurzgreg@fr.ibm.com
gkurz@linux.vnet.ibm.com
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)562 165 496
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-ppc: KVMPPC_H_CAS fix cpu-version endianess
2014-06-27 15:16 ` Greg Kurz
@ 2014-06-27 16:13 ` Alexander Graf
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2014-06-27 16:13 UTC (permalink / raw)
To: Greg Kurz, Laurent Dufour; +Cc: Alexey Kardashevskiy, qemu-ppc, qemu-devel
On 27.06.14 17:16, Greg Kurz wrote:
> On Fri, 27 Jun 2014 15:47:37 +0200
> Laurent Dufour <ldufour@linux.vnet.ibm.com> wrote:
>
>> 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>
Good catch! Thanks, applied to ppc-next.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-27 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-27 13:47 [Qemu-devel] [PATCH] target-ppc: KVMPPC_H_CAS fix cpu-version endianess Laurent Dufour
2014-06-27 15:16 ` Greg Kurz
2014-06-27 16:13 ` Alexander Graf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.