From nobody Tue Feb 10 10:20:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1620829601; cv=none; d=zohomail.com; s=zohoarc; b=YoR3XRPh0ftTkrMhkgCu8wL2T4HIizC633yEhhSZc3+Q9mPMq0JPsqTLEln77d0wF6DbLfBQiS1zsf22AG+F28iHr3P8BrzUZP9yKzhXAtHzR+gCjyrwhvjmB82XgC7nr1Z5oB25TH85IT3nixYFX3mrgCoE46He17gdxFUZrVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620829601; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=XRE0XwsQw96E9kIviw9ruyKQ/X0VZF4JmcqoquPTjJ0=; b=beUmom/Bg6iCvp9Ckt0LYTwh+mR+J1dZ98TVkZRVQ/Kco2ELYckBAal5w0/s710rfARFM+e9ZbgEsFS//LcEG/KrrP4Mef9ooUWDPmsj5Q1b1bOX+sUuNEW5JlwQlX/LmNNWJKRQYFMkx2NbIcOlP49Qh5UauZgeNsFkhbihgrE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620829601893881.122107443518; Wed, 12 May 2021 07:26:41 -0700 (PDT) Received: from localhost ([::1]:43184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgpou-00010K-6a for importer@patchew.org; Wed, 12 May 2021 10:26:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgpZ9-00064F-1Z; Wed, 12 May 2021 10:10:23 -0400 Received: from [201.28.113.2] (port=32758 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgpZ5-0000Pm-3d; Wed, 12 May 2021 10:10:22 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Wed, 12 May 2021 11:08:39 -0300 Received: from eldorado.org.br (unknown [10.10.71.235]) by power9a (Postfix) with ESMTP id 3CA828000C2; Wed, 12 May 2021 11:08:39 -0300 (-03) From: "Bruno Larsen (billionai)" To: qemu-devel@nongnu.org Subject: [PATCH 07/11] target/ppc: added KVM fallback to fpscr manipulation Date: Wed, 12 May 2021 11:08:09 -0300 Message-Id: <20210512140813.112884-8-bruno.larsen@eldorado.org.br> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210512140813.112884-1-bruno.larsen@eldorado.org.br> References: <20210512140813.112884-1-bruno.larsen@eldorado.org.br> X-OriginalArrivalTime: 12 May 2021 14:08:39.0384 (UTC) FILETIME=[4EA42580:01D74738] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=bruno.larsen@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: farosas@linux.ibm.com, richard.henderson@linaro.org, luis.pires@eldorado.org.br, lucas.araujo@eldorado.org.br, fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org, "Bruno Larsen \(billionai\)" , matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" some common code needs to store information in fpscr, but this function relies on TCG cde to work. This patch adds a kvm way to do it, and a transparent way to call it when TCG is not compiled Signed-off-by: Bruno Larsen (billionai) --- target/ppc/gdbstub.c | 1 + target/ppc/kvm.c | 14 ++++++++++++++ target/ppc/kvm_ppc.h | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 17e41fc113..65759e0c1c 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -23,6 +23,7 @@ #include "exec/helper-proto.h" #include "internal.h" #include "helper_regs.h" +#include "kvm_ppc.h" =20 static int ppc_gdb_register_len_apple(int n) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 104a308abb..a8a720eb48 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2947,3 +2947,17 @@ bool kvm_arch_cpu_check_are_resettable(void) { return true; } + +void kvmppc_store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask) +{ + CPUState *cs =3D env_cpu(env); + struct kvm_one_reg reg; + int ret; + reg.id =3D KVM_REG_PPC_FPSCR; + reg.addr =3D (uintptr_t) &env->fpscr; + ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); + if (ret < 0) + { + fprintf(stderr, "Unable to set FPSCR to KVM: %s", strerror(errno)); + } +} diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 989f61ace0..ff365e57a6 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -86,6 +86,12 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t t= b_offset); =20 int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run); =20 +#ifndef CONFIG_TCG +# define store_fpscr kvmppc_store_fpscr +#endif +void kvmppc_store_fpscr(CPUPPCState *env, uint64_t arg, uint32_t mask); + + #else =20 static inline uint32_t kvmppc_get_tbfreq(void) --=20 2.17.1