From patchwork Tue Aug 8 06:08:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9886635 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 C7D1460352 for ; Tue, 8 Aug 2017 06:09:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA9B527FA1 for ; Tue, 8 Aug 2017 06:09:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFBC12879C; Tue, 8 Aug 2017 06:09:32 +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_SIGNED, 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 6693A27FA1 for ; Tue, 8 Aug 2017 06:09:32 +0000 (UTC) Received: from localhost ([::1]:40938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dexhr-0001vl-Ne for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Aug 2017 02:09:31 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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édric 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); + /* 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 = 32;