From nobody Mon May 6 06:48:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498712483138520.1781290907525; Wed, 28 Jun 2017 22:01:23 -0700 (PDT) Received: from localhost ([::1]:36810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQRZx-0006Gl-F5 for importer@patchew.org; Thu, 29 Jun 2017 01:01:21 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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_pv= r, Error **errp) cpu->compat_pvr =3D compat_pvr; env->spr[SPR_PCR] =3D pcr & pcc->pcr_mask; =20 - if (kvm_enabled()) { + if (kvm_enabled() && compat_pvr) { int ret =3D kvmppc_set_compat(cpu, cpu->compat_pvr); if (ret < 0) { error_setg_errno(errp, -ret, --=20 2.9.4