From nobody Sat Apr 27 06:00:35 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.zohomail.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 1502172593101320.0483197633929; Mon, 7 Aug 2017 23:09:53 -0700 (PDT) Received: from localhost ([::1]:40941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dexiB-0002aA-S7 for importer@patchew.org; Tue, 08 Aug 2017 02:09:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dexgt-0001tS-7c for qemu-devel@nongnu.org; Tue, 08 Aug 2017 02:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dexgo-000349-AL for qemu-devel@nongnu.org; Tue, 08 Aug 2017 02:08:31 -0400 Received: from ozlabs.org ([103.22.144.67]:56689) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dexgn-00031o-T6; Tue, 08 Aug 2017 02:08:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xRP8j0FcHz9s81; Tue, 8 Aug 2017 16:08:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502172501; bh=9B7z0M0rPWa2AkZ9BJNEJI2CK39LTqCHh4uD4usfDAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNkqKc1vNuV/wRJhvlBkSZBQInDMORxYtlPlUKiXEHKY6QnTOMryAG2uK2BvNTg5y ZIuhtuYKjjLwHtk0hAkyTiMSiRBB3xxiXHZWQ6RfdkiUKsJ5sNpHCrFb6LeO1ESGVH +3cFb9Z8+yiqh6FFuKryE32lu+H/bMynIH3T1Drc= From: David Gibson To: groug@kaod.org, clg@kaod.org Date: Tue, 8 Aug 2017 16:08:16 +1000 Message-Id: <20170808060817.2832-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170808060817.2832-1-david@gibson.dropbear.id.au> References: <20170808060817.2832-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PATCH for-2.10 1/2] target/ppc: Implement TIDR 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, aik@ozlabs.ru, agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, David Gibson 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" This adds a trivial implementation of the TIDR register added in POWER9. This isn't particularly important to qemu directly - it's used by accelerator modules that we don't emulate. However, since qemu isn't aware of it, its state is not synchronized with KVM and therefore not migrated, which can be a problem. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Thomas Huth --- target/ppc/cpu.h | 1 + target/ppc/translate_init.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 6ee2a26a96..f6e5413fad 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1451,6 +1451,7 @@ void ppc_compat_add_property(Object *obj, const char = *name, #define SPR_TEXASR (0x082) #define SPR_TEXASRU (0x083) #define SPR_UCTRL (0x088) +#define SPR_TIDR (0x090) #define SPR_MPC_CMPA (0x090) #define SPR_MPC_CMPB (0x091) #define SPR_MPC_CMPC (0x092) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 01723bdfec..94800cd29d 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8841,6 +8841,11 @@ static void init_proc_POWER9(CPUPPCState *env) gen_spr_power8_book4(env); gen_spr_power8_rpr(env); =20 + /* POWER9 Specific registers */ + spr_register_kvm(env, SPR_TIDR, "TIDR", NULL, NULL, + spr_read_generic, spr_write_generic, + KVM_REG_PPC_TIDR, 0); + /* env variables */ #if !defined(CONFIG_USER_ONLY) env->slb_nr =3D 32; --=20 2.13.4 From nobody Sat Apr 27 06:00:35 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.zohomail.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 1502172595825400.75473824773417; Mon, 7 Aug 2017 23:09:55 -0700 (PDT) Received: from localhost ([::1]:40942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dexiD-0002bS-Mn for importer@patchew.org; Tue, 08 Aug 2017 02:09:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dexgt-0001tT-8C for qemu-devel@nongnu.org; Tue, 08 Aug 2017 02:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dexgo-000344-AC for qemu-devel@nongnu.org; Tue, 08 Aug 2017 02:08:31 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:34127) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dexgn-00031p-T2; Tue, 08 Aug 2017 02:08:26 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xRP8j1Y31z9s8w; Tue, 8 Aug 2017 16:08:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502172501; bh=RNCDdk2gcaybOIJqgjXkwx/PyFZeleWTAu6cfPKymLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9+dOHH34aCIP9tTAAlL8IB71zlUHOlroeFxTnZYbTWhE2zIC1dHIh3P81fQupwcO OK38hIeQI5ZzUAak8Z8tpHMP7XEzIjZb3LMsyXt8YrFGX6wRT7QJ/C4bs/aM4F6aS5 1/FkDjOazVj5H0HOc9UNwzXbEth/7R+vXD66mSzc= From: David Gibson To: groug@kaod.org, clg@kaod.org Date: Tue, 8 Aug 2017 16:08:17 +1000 Message-Id: <20170808060817.2832-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170808060817.2832-1-david@gibson.dropbear.id.au> References: <20170808060817.2832-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PATCH for-2.10 2/2] target/ppc: Add stub implementation of the PSSCR 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, aik@ozlabs.ru, agraf@suse.de, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, David Gibson 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 PSSCR register added in POWER9 controls certain power saving mode behaviours. Mostly, it's not relevant to TCG, however because qemu doesn't know about it yet, it doesn't synchronize the state with KVM, and thus it doesn't get migrated. To fix that, this adds a minimal stub implementation of the register. This isn't complete, even to the extent that an implementation is possible in TCG, just enough to get migration working. We need to come back later and at least properly filter the various fields in the register based on privilege level. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Thomas Huth --- target/ppc/cpu.h | 1 + target/ppc/translate_init.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index f6e5413fad..46d3dd88f6 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1771,6 +1771,7 @@ void ppc_compat_add_property(Object *obj, const char = *name, #define SPR_IC (0x350) #define SPR_VTB (0x351) #define SPR_MMCRC (0x353) +#define SPR_PSSCR (0x357) #define SPR_440_INV0 (0x370) #define SPR_440_INV1 (0x371) #define SPR_440_INV2 (0x372) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 94800cd29d..8fb407ed73 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8846,6 +8846,11 @@ static void init_proc_POWER9(CPUPPCState *env) spr_read_generic, spr_write_generic, KVM_REG_PPC_TIDR, 0); =20 + /* FIXME: Filter fields properly based on privilege level */ + spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL, + spr_read_generic, spr_write_generic, + KVM_REG_PPC_PSSCR, 0); + /* env variables */ #if !defined(CONFIG_USER_ONLY) env->slb_nr =3D 32; --=20 2.13.4