[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen stable-4.10] ppc: fix setting of compat mode



commit 3342fd02863fac6a05db7f956abfc43341b190ab
Author:     Greg Kurz <groug@xxxxxxxx>
AuthorDate: Tue Oct 17 21:49:14 2017 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Wed Dec 6 09:38:59 2017 -0600

    ppc: fix setting of compat mode
    
    While trying to make KVM PR usable again, commit 5dfaa532ae introduced a
    regression: the current compat_pvr value is passed to KVM instead of the
    new one. This means that we always pass 0 instead of the max-cpu-compat
    PVR during the initial machine reset. And at CAS time, we either pass
    the PVR from the command line or even don't call kvmppc_set_compat() at
    all, ie, the PCR will not be set as expected.
    
    For example if we start a big endian fedora26 guest in power7 compat
    mode on a POWER8 host, we get this in the guest:
    
    $ cat /proc/cpuinfo
    processor       : 0
    cpu             : POWER7 (architected), altivec supported
    clock           : 4024.000000MHz
    revision        : 2.0 (pvr 004d 0200)
    
    timebase        : 512000000
    platform        : pSeries
    model           : IBM pSeries (emulated by qemu)
    machine         : CHRP IBM pSeries (emulated by qemu)
    MMU             : Hash
    
    but the guest can still execute POWER8 instructions, and the following
    program succeeds:
    
    int main()
    {
            asm("vncipher 0,0,0"); // ISA 2.07 instruction
    }
    
    Let's pass the new compat_pvr to kvmppc_set_compat() and the program fails
    with SIGILL as expected.
    
    Reported-by: Nageswara R Sastry <rnsastry@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Greg Kurz <groug@xxxxxxxx>
    Signed-off-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>
    (cherry picked from commit e4f0c6bb1a9f72ad9e32c3171d36bae17ea1cd67)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 target/ppc/compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/compat.c b/target/ppc/compat.c
index f8729fe..ad8f93c 100644
--- a/target/ppc/compat.c
+++ b/target/ppc/compat.c
@@ -141,7 +141,7 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, 
Error **errp)
     cpu_synchronize_state(CPU(cpu));
 
     if (kvm_enabled() && cpu->compat_pvr != compat_pvr) {
-        int ret = kvmppc_set_compat(cpu, cpu->compat_pvr);
+        int ret = kvmppc_set_compat(cpu, compat_pvr);
         if (ret < 0) {
             error_setg_errno(errp, -ret,
                              "Unable to set CPU compatibility mode in KVM");
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.