From patchwork Thu Jun 29 04:59:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 9815937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 043D4602B1 for ; Thu, 29 Jun 2017 05:01:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 024FA285E0 for ; Thu, 29 Jun 2017 05:01:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA491285F1; Thu, 29 Jun 2017 05:01:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 84631285E0 for ; Thu, 29 Jun 2017 05:01:07 +0000 (UTC) Received: from localhost ([::1]:36807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQRZg-0005xT-A1 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 29 Jun 2017 01:01:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQRZ2-0005vg-48 for qemu-devel@nongnu.org; Thu, 29 Jun 2017 01:00:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQRZ1-0006a4-AW for qemu-devel@nongnu.org; Thu, 29 Jun 2017 01:00:24 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:36446) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQRYg-00060R-7G; Thu, 29 Jun 2017 01:00:18 -0400 Received: by mail-pf0-x241.google.com with SMTP id z6so11571283pfk.3; Wed, 28 Jun 2017 22:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=b9BXlBowCd2dqT6xg0yWT3lBhS5MWq4DRGdakiAF74w=; b=hs4N77n4CtOENPXsrXpJ4nJNWPJNhVC4xQ0RaFGtpN75XP2H5MS5ue3CTqRwqZBBhu tMuHb6D3dpb2F3R1JO+hMxtOnQMiVIeK8gS8RCDuKXv3rO0GQpOJkPn1BGxykF/UP5V+ R930y9ls+Sok8Cr/gb4FI5vTul+bX04Omh88hehVluh88TP8H/iJU2x0ejhAQXi6RgrQ RbJ6p7PEJjw8aVJl50dQIxCY4FwT2R/yrEnXE9PefqZsXQ1SdcnGfOcgaSY5OzfAhNyJ ZPSPh4756Kt3fE+bBxsKXsBwS5NeNcO3M5UkB3QSP7Dmktak4IH9VCT0C/I5ZIleuQ63 Pm+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=b9BXlBowCd2dqT6xg0yWT3lBhS5MWq4DRGdakiAF74w=; b=VCfVPCO2NTpx9bTcUnWiTGLpGu18L+YOeWxX8ZskfheKWc73zh39+GYbM6ieDW1874 E4ihFmTtW2fOqEjMGw9QL1MycmQBMgiyQzOUvsbtdpW6FMMiGOQ8gFSy/HU8lOO+Vcy0 ywyJz5IOs2Gbzy3Z+vP3tB/yQ7iJLWUdcS+TQIqMMWEg+roboZZb6X47nrI5oQmSAuCS NvdQ8Vydi8cb6iknARGsNH1bno3qOj90B3JUzY+qlEjUgK2TeGMUzQwfFT9Dtob677br 0M+1Kko++OXvUyV2Vo8w7sNwMwP+u5J+OUxdOr5+W+IhD5ziBBb2VB4/XAlu8Uuk93PO x8Mw== X-Gm-Message-State: AKS2vOz2ehIHCkMyt2bC7UzuY0USX3lQeSvVtIs/dU1hCWUrpqEGlje5 3+L/MB5FtfoEVihw X-Received: by 10.98.69.76 with SMTP id s73mr14252900pfa.94.1498712399558; Wed, 28 Jun 2017 21:59:59 -0700 (PDT) Received: from surajjs1.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id u2sm9646926pgn.28.2017.06.28.21.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 21:59:58 -0700 (PDT) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Thu, 29 Jun 2017 14:59:39 +1000 Message-Id: <20170629045940.11242-1-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.9.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH] target/ppc: Only set PCR in kvm if actually in a compat mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, agraf@suse.de, Suraj Jitindar Singh , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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,