From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19625C432BE for ; Tue, 31 Aug 2021 12:45:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA8EC6103D for ; Tue, 31 Aug 2021 12:45:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AA8EC6103D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL38g-0000HA-P2 for qemu-devel@archiver.kernel.org; Tue, 31 Aug 2021 08:45:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL2jC-00088Z-Aj for qemu-devel@nongnu.org; Tue, 31 Aug 2021 08:18:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL2j9-0006l4-Nu for qemu-devel@nongnu.org; Tue, 31 Aug 2021 08:18:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630412335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1FX/az27XaMeHUvM8QQkgGCCE/jWAwmUfVJoWBRI9Wg=; b=B4wSE++P4vv40nk831JgoU/ZA38uI+9s7+pNxIxKbbcrEO4GGgGmhx9kzLXitBMjLUbsyY ZBXy6/V4Kg8LLqTYwuSdj/JLxBVY1AKbByqumCw/gQrNtH7vP/YJiDNUPd9W54z7Zz4jsv AIZdB5rU7KHalCzM9+lY3pyTry18kQM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-hhaxD5rUMbGlAywzxULgFw-1; Tue, 31 Aug 2021 08:18:53 -0400 X-MC-Unique: hhaxD5rUMbGlAywzxULgFw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DE6C18C9F42; Tue, 31 Aug 2021 12:18:50 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24F6627CB1; Tue, 31 Aug 2021 12:18:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CCB7E18009E6; Tue, 31 Aug 2021 14:15:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 22/29] tcg_i386_funcs: Add update_fp_status to TCGI386ModuleOps Date: Tue, 31 Aug 2021 14:15:38 +0200 Message-Id: <20210831121545.2874233-23-kraxel@redhat.com> In-Reply-To: <20210831121545.2874233-1-kraxel@redhat.com> References: <20210831121545.2874233-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: Peter Maydell , "Michael S. Tsirkin" , Bin Meng , David Hildenbrand , Aleksandar Rikalo , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Filippov , Alistair Francis , Gerd Hoffmann , "Edgar E. Iglesias" , Alexandre Iooss , Huacai Chen , Halil Pasic , Christian Borntraeger , Palmer Dabbelt , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stafford Horne , =?UTF-8?q?Alex=20Benn=C3=A9e?= , David Gibson , qemu-riscv@nongnu.org, Bastian Koppelmann , Cornelia Huck , Laurent Vivier , qemu-ppc@nongnu.org, Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Also add TCGI386ModuleOps struct, which works like TCGModuleOps but for i386-specific functions. Signed-off-by: Gerd Hoffmann --- include/tcg/tcg-module-i386.h | 9 +++++++++ target/i386/cpu.h | 4 ++-- accel/tcg/tcg-module-i386.c | 10 ++++++++++ target/i386/machine.c | 2 +- target/i386/tcg/fpu_helper.c | 9 ++++++++- accel/tcg/meson.build | 6 ++++++ 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 include/tcg/tcg-module-i386.h create mode 100644 accel/tcg/tcg-module-i386.c diff --git a/include/tcg/tcg-module-i386.h b/include/tcg/tcg-module-i386.h new file mode 100644 index 000000000000..3854b506d5dc --- /dev/null +++ b/include/tcg/tcg-module-i386.h @@ -0,0 +1,9 @@ +#ifndef TCG_MODULE_I386_H +#define TCG_MODULE_I386_H + +struct TCGI386ModuleOps { + void (*update_fp_status)(CPUX86State *env); +}; +extern struct TCGI386ModuleOps tcg_i386; + +#endif /* TCG_MODULE_I386_H */ diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 6c50d3ab4f1d..5769c1292683 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1802,6 +1802,7 @@ struct X86CPU { int32_t hv_max_vps; }; +#include "tcg/tcg-module-i386.h" #ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_x86_cpu; @@ -2127,7 +2128,6 @@ static inline bool cpu_vmx_maybe_enabled(CPUX86State *env) int get_pg_mode(CPUX86State *env); /* fpu_helper.c */ -void update_fp_status(CPUX86State *env); void update_mxcsr_status(CPUX86State *env); void update_mxcsr_from_sse_status(CPUX86State *env); @@ -2143,7 +2143,7 @@ static inline void cpu_set_fpuc(CPUX86State *env, uint16_t fpuc) { env->fpuc = fpuc; if (tcg_enabled()) { - update_fp_status(env); + tcg_i386.update_fp_status(env); } } diff --git a/accel/tcg/tcg-module-i386.c b/accel/tcg/tcg-module-i386.c new file mode 100644 index 000000000000..41ce2ba4eb76 --- /dev/null +++ b/accel/tcg/tcg-module-i386.c @@ -0,0 +1,10 @@ +#include "qemu/osdep.h" +#include "cpu.h" + +static void i386_update_cpu_stub(CPUX86State *cpu) +{ +} + +struct TCGI386ModuleOps tcg_i386 = { + .update_fp_status = i386_update_cpu_stub, +}; diff --git a/target/i386/machine.c b/target/i386/machine.c index 571e98853c64..7f5d80766f28 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -371,7 +371,7 @@ static int cpu_post_load(void *opaque, int version_id) } if (tcg_enabled()) { target_ulong dr7; - update_fp_status(env); + tcg_i386.update_fp_status(env); update_mxcsr_status(env); cpu_breakpoint_remove_all(cs, BP_CPU); diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index eddf0bb9dfc4..0f7206e834fd 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -672,7 +672,7 @@ uint32_t helper_fnstcw(CPUX86State *env) return env->fpuc; } -void update_fp_status(CPUX86State *env) +static void update_fp_status(CPUX86State *env) { FloatRoundMode rnd_mode; FloatX80RoundPrec rnd_prec; @@ -3039,3 +3039,10 @@ void helper_movq(CPUX86State *env, void *d, void *s) #define SHIFT 1 #include "ops_sse.h" + +static void tcgi386_module_ops_fpu(void) +{ + tcg_i386.update_fp_status = update_fp_status; +} + +type_init(tcgi386_module_ops_fpu); diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build index 93cbbf9f3926..7f1fdd68233b 100644 --- a/accel/tcg/meson.build +++ b/accel/tcg/meson.build @@ -1,6 +1,12 @@ specific_ss.add(files( 'tcg-module.c', )) +specific_ss.add(when: 'TARGET_I386', if_true: files( + 'tcg-module-i386.c', +)) +specific_ss.add(when: 'TARGET_X86_64', if_true: files( + 'tcg-module-i386.c', +)) specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'cpu-exec-common.c', -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mL2jP-0008JK-G7 for mharc-qemu-riscv@gnu.org; Tue, 31 Aug 2021 08:19:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL2jE-00089i-4D for qemu-riscv@nongnu.org; Tue, 31 Aug 2021 08:19:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59428) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL2jA-0006l9-1K for qemu-riscv@nongnu.org; Tue, 31 Aug 2021 08:18:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630412335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1FX/az27XaMeHUvM8QQkgGCCE/jWAwmUfVJoWBRI9Wg=; b=B4wSE++P4vv40nk831JgoU/ZA38uI+9s7+pNxIxKbbcrEO4GGgGmhx9kzLXitBMjLUbsyY ZBXy6/V4Kg8LLqTYwuSdj/JLxBVY1AKbByqumCw/gQrNtH7vP/YJiDNUPd9W54z7Zz4jsv AIZdB5rU7KHalCzM9+lY3pyTry18kQM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-hhaxD5rUMbGlAywzxULgFw-1; Tue, 31 Aug 2021 08:18:53 -0400 X-MC-Unique: hhaxD5rUMbGlAywzxULgFw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DE6C18C9F42; Tue, 31 Aug 2021 12:18:50 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24F6627CB1; Tue, 31 Aug 2021 12:18:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CCB7E18009E6; Tue, 31 Aug 2021 14:15:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Laurent Vivier , Peter Xu , Peter Maydell , Marcel Apfelbaum , Cornelia Huck , qemu-ppc@nongnu.org, Bastian Koppelmann , Thomas Huth , Eduardo Habkost , qemu-riscv@nongnu.org, David Gibson , Aleksandar Rikalo , Stafford Horne , Huacai Chen , Halil Pasic , Palmer Dabbelt , Bin Meng , Mahmoud Mandour , Max Filippov , Alexandre Iooss , Greg Kurz , "Edgar E. Iglesias" , Richard Henderson , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" , Paolo Bonzini , Alistair Francis , qemu-s390x@nongnu.org, Christian Borntraeger , Jiaxun Yang , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH 22/29] tcg_i386_funcs: Add update_fp_status to TCGI386ModuleOps Date: Tue, 31 Aug 2021 14:15:38 +0200 Message-Id: <20210831121545.2874233-23-kraxel@redhat.com> In-Reply-To: <20210831121545.2874233-1-kraxel@redhat.com> References: <20210831121545.2874233-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) DKIMWL_WL_HIGH=-0.391, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2021 12:19:01 -0000 Also add TCGI386ModuleOps struct, which works like TCGModuleOps but for i386-specific functions. Signed-off-by: Gerd Hoffmann --- include/tcg/tcg-module-i386.h | 9 +++++++++ target/i386/cpu.h | 4 ++-- accel/tcg/tcg-module-i386.c | 10 ++++++++++ target/i386/machine.c | 2 +- target/i386/tcg/fpu_helper.c | 9 ++++++++- accel/tcg/meson.build | 6 ++++++ 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 include/tcg/tcg-module-i386.h create mode 100644 accel/tcg/tcg-module-i386.c diff --git a/include/tcg/tcg-module-i386.h b/include/tcg/tcg-module-i386.h new file mode 100644 index 000000000000..3854b506d5dc --- /dev/null +++ b/include/tcg/tcg-module-i386.h @@ -0,0 +1,9 @@ +#ifndef TCG_MODULE_I386_H +#define TCG_MODULE_I386_H + +struct TCGI386ModuleOps { + void (*update_fp_status)(CPUX86State *env); +}; +extern struct TCGI386ModuleOps tcg_i386; + +#endif /* TCG_MODULE_I386_H */ diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 6c50d3ab4f1d..5769c1292683 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1802,6 +1802,7 @@ struct X86CPU { int32_t hv_max_vps; }; +#include "tcg/tcg-module-i386.h" #ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_x86_cpu; @@ -2127,7 +2128,6 @@ static inline bool cpu_vmx_maybe_enabled(CPUX86State *env) int get_pg_mode(CPUX86State *env); /* fpu_helper.c */ -void update_fp_status(CPUX86State *env); void update_mxcsr_status(CPUX86State *env); void update_mxcsr_from_sse_status(CPUX86State *env); @@ -2143,7 +2143,7 @@ static inline void cpu_set_fpuc(CPUX86State *env, uint16_t fpuc) { env->fpuc = fpuc; if (tcg_enabled()) { - update_fp_status(env); + tcg_i386.update_fp_status(env); } } diff --git a/accel/tcg/tcg-module-i386.c b/accel/tcg/tcg-module-i386.c new file mode 100644 index 000000000000..41ce2ba4eb76 --- /dev/null +++ b/accel/tcg/tcg-module-i386.c @@ -0,0 +1,10 @@ +#include "qemu/osdep.h" +#include "cpu.h" + +static void i386_update_cpu_stub(CPUX86State *cpu) +{ +} + +struct TCGI386ModuleOps tcg_i386 = { + .update_fp_status = i386_update_cpu_stub, +}; diff --git a/target/i386/machine.c b/target/i386/machine.c index 571e98853c64..7f5d80766f28 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -371,7 +371,7 @@ static int cpu_post_load(void *opaque, int version_id) } if (tcg_enabled()) { target_ulong dr7; - update_fp_status(env); + tcg_i386.update_fp_status(env); update_mxcsr_status(env); cpu_breakpoint_remove_all(cs, BP_CPU); diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c index eddf0bb9dfc4..0f7206e834fd 100644 --- a/target/i386/tcg/fpu_helper.c +++ b/target/i386/tcg/fpu_helper.c @@ -672,7 +672,7 @@ uint32_t helper_fnstcw(CPUX86State *env) return env->fpuc; } -void update_fp_status(CPUX86State *env) +static void update_fp_status(CPUX86State *env) { FloatRoundMode rnd_mode; FloatX80RoundPrec rnd_prec; @@ -3039,3 +3039,10 @@ void helper_movq(CPUX86State *env, void *d, void *s) #define SHIFT 1 #include "ops_sse.h" + +static void tcgi386_module_ops_fpu(void) +{ + tcg_i386.update_fp_status = update_fp_status; +} + +type_init(tcgi386_module_ops_fpu); diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build index 93cbbf9f3926..7f1fdd68233b 100644 --- a/accel/tcg/meson.build +++ b/accel/tcg/meson.build @@ -1,6 +1,12 @@ specific_ss.add(files( 'tcg-module.c', )) +specific_ss.add(when: 'TARGET_I386', if_true: files( + 'tcg-module-i386.c', +)) +specific_ss.add(when: 'TARGET_X86_64', if_true: files( + 'tcg-module-i386.c', +)) specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'cpu-exec-common.c', -- 2.31.1