qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/ppc: Only set PCR in kvm if actually in a compat mode
@ 2017-06-29  4:59 Suraj Jitindar Singh
  2017-06-30  4:03 ` David Gibson
  2017-07-06 23:49 ` [Qemu-devel] " no-reply
  0 siblings, 2 replies; 13+ messages in thread
From: Suraj Jitindar Singh @ 2017-06-29  4:59 UTC (permalink / raw)
  To: qemu-ppc; +Cc: david, agraf, qemu-devel, Suraj Jitindar Singh

The Processor Compatibility Register (PCR) I used to set the
compatibility mode of the processor using the SET_ONE_REG ioctl on
KVM_REG_PPC_ARCH_COMPAT. Previously this was only called when a compat
mode was actually in use, however a recent patch made it unconditional.
Calling this in KVM_PR fails as there is no handler for that call and it
is thus impossible to start a machine with KVM_PR.

Change ppc_set_compat() so that the ioctl is only actually called if a
compat mode is in use. This means that a KVM_PR guest can boot.
Additionally the current behaviour for KVM_HV is preserved where a compat
mode of 0 set pcr and arch_compat in the vcore struct to zero, both of
which are initialised to zero anyway.

Fixes: 37f516defa2e ("pseries: Reset CPU compatibility mode")

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>

---

Based on: dwg/ppc-for-2.10

 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 f1b67fa..4482206 100644
--- a/target/ppc/compat.c
+++ b/target/ppc/compat.c
@@ -143,7 +143,7 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp)
     cpu->compat_pvr = compat_pvr;
     env->spr[SPR_PCR] = pcr & pcc->pcr_mask;
 
-    if (kvm_enabled()) {
+    if (kvm_enabled() && compat_pvr) {
         int ret = kvmppc_set_compat(cpu, cpu->compat_pvr);
         if (ret < 0) {
             error_setg_errno(errp, -ret,
-- 
2.9.4

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

end of thread, other threads:[~2017-08-08  9:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-29  4:59 [Qemu-devel] [PATCH] target/ppc: Only set PCR in kvm if actually in a compat mode Suraj Jitindar Singh
2017-06-30  4:03 ` David Gibson
2017-07-03  3:18   ` Suraj Jitindar Singh
2017-07-03  9:20     ` David Gibson
2017-07-12  6:45       ` Suraj Jitindar Singh
2017-07-13  1:21         ` David Gibson
2017-08-03 17:28           ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-08-04  2:35             ` David Gibson
2017-08-07  9:00               ` Greg Kurz
2017-08-08  6:21                 ` David Gibson
2017-08-08  9:21                   ` Greg Kurz
2017-07-06 23:49 ` [Qemu-devel] " no-reply
2017-07-07  0:03   ` Fam Zheng

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