From patchwork Mon Oct 9 11:02:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1845188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Aw5tUoRg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3x3h25pdz1yq1 for ; Mon, 9 Oct 2023 22:03:44 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo2g-0006N3-CS; Mon, 09 Oct 2023 07:03:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2J-0006Dc-JZ for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:02:56 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2F-0003Jt-3v for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:02:55 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-99357737980so766942766b.2 for ; Mon, 09 Oct 2023 04:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849369; x=1697454169; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xiQptftwL5VXY8hh/NkEc1RQ3pCoaIPPTThM9LhP2mg=; b=Aw5tUoRgV8P+/v9SSopyIDHpta/YJBaKTMhWlf9KEZxznniKi41piBogxj8m8eZqEb G3UCfVDrGY+Ew8kLzQNuZk68EIHdIbfjtp0lICMaPW3bL3q9YbEvPjZal74oOhZl2ATr jdWi+a+/iMXckmxzlj0h/fTBDB908qiQqkRepvskv1Zk1tUzhHuAS6HCAPeNH03T5gxb 1e4BJpnV0NoPBE06xvEEvEowsQcfFVwD7gNXa8euPaedn/7GqUzahF0DqQfqneWYwYpY /8EkiY9owJX/mMgoeGuiEL3WgbSTqFrqfNVoXTE2A5+ty806IpEulZkca+cyFzOlIbV+ Mm1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849369; x=1697454169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xiQptftwL5VXY8hh/NkEc1RQ3pCoaIPPTThM9LhP2mg=; b=pxPETXDDH1m+lOEJ1uxBALTmGAHuzyi4w4mBxBHEHOFFrbxow0mBlMJnaUyFEqlAnf l2GsYpqvgToHJJ+1mTwa4tkpnMXBY/Wlh9VZdAlR2ONjw5YTcEFBgp1pGhMUWJJLKFvH PXwFCXPUXMGb44MiW4L9E5cePS2BB944+B34Q4tx2asUhQbshh1RTkcFzGBRsjGoyzqg wfV7O5xuS8ggEf5vx7jl0noxlm+mahZ0BxfH3qgsKASRJT8gSt1IDk3LqWn2LeSVi4bn raSarD11I4trpqZcc4Z0qHkRZpUy6f6nfiiHFJHJJ0MqghN4v7z8sxVeDVjjFlpYRahp LYuA== X-Gm-Message-State: AOJu0YxBwIUUjfKkHjlPBvo0fVTAZj+Mfu7Ai/tVeKNJRQIw5ngAKoeq a9f0+15DU2yeYpmsaV0YargLV6nmaUROzC3bkV0= X-Google-Smtp-Source: AGHT+IH51i2YmgVDgqsz7gMnBc7EgMntzrFIvbCRnz+yd2esZN+fsrmx9f5I5pkTsF8wHPzj1WV+jQ== X-Received: by 2002:a17:906:257:b0:9b8:8bcf:8739 with SMTP id 23-20020a170906025700b009b88bcf8739mr12523747ejl.75.1696849369471; Mon, 09 Oct 2023 04:02:49 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id m22-20020a1709066d1600b009adc77fe165sm6581447ejr.118.2023.10.09.04.02.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:02:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/6] target/ppc: Use env_archcpu() in helper_book3s_msgsndp() Date: Mon, 9 Oct 2023 13:02:34 +0200 Message-ID: <20231009110239.66778-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=philmd@linaro.org; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When CPUArchState* is available (here CPUPPCState*), we can use the fast env_archcpu() macro to get ArchCPU* (here PowerPCCPU*). The QOM cast POWERPC_CPU() macro will be slower when building with --enable-qom-cast-debug. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Acked-by: Alistair Francis --- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 7926114d5c..a42743a3e0 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -3136,7 +3136,7 @@ void helper_book3s_msgclrp(CPUPPCState *env, target_ulong rb) void helper_book3s_msgsndp(CPUPPCState *env, target_ulong rb) { CPUState *cs = env_cpu(env); - PowerPCCPU *cpu = POWERPC_CPU(cs); + PowerPCCPU *cpu = env_archcpu(env); CPUState *ccs; uint32_t nr_threads = cs->nr_threads; int ttir = rb & PPC_BITMASK(57, 63); From patchwork Mon Oct 9 11:02:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1845197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=INvojKDd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3x5S3rqjz1yqP for ; Mon, 9 Oct 2023 22:05:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo2n-0006Xf-Uu; Mon, 09 Oct 2023 07:03:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2S-0006IM-FS for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:06 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2M-0003N7-PH for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:01 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-99c1c66876aso797702366b.2 for ; Mon, 09 Oct 2023 04:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849376; x=1697454176; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y/GrMBIMGrTYySZAmzh8zKw+DxTy0unUed7WlZuT/J4=; b=INvojKDd9QmyIFhMnCKSaTj9DMmu6US/JLwSPhix28eesJzzWNjkIn7qwuhhkdXXyX Ob6jpY7ZgBjZa3bi9nZm5K7gDQVP5nD12ICTszBcSmNXQvZh5k9Gm5IWfyP+ZUoqftvf D66xReS5plsakXH5RP7QQPJVqfWNRBzFAT6qPsnj3K1dp2eSs6IeG/6QZtJJ6wn8rabZ i+OcfQwgvY5NNm+2p4jCM/N1NUKREWBqdEX02hgrR9gTct5GbKR7SUikKzSQ/NPLPLGM pkJbn1TV1aB4GeGk4u5K42ObbYMD90V2spFT0CgNa2xNTlWNpuA8Ib6u9FFyd83ZafWM CChA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849376; x=1697454176; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y/GrMBIMGrTYySZAmzh8zKw+DxTy0unUed7WlZuT/J4=; b=EzF0rxC+AjnpM+wAJkj3pTPxTlBp+cZPcdeANF/PcNleW2eCcoiXdyufZC0FwnmaWl Mgs/nMljsZ2KFTtygxshrthwwRHIHM3Ci/V2fzYU1im4DXVwYnuSB7bEXRa0SzlTCPCR irCudgVwJAUqx82uCXOI/PeoQ+jjwTM9AqZPLuKuKSZfYSPbV9nLOtEr5OkID6jvuPNL 2HGxGh0DVw+7EnHDbOHonRWAJgGrJALmpNkOdP+buVQClYl03+NtYNq4qEwvQLAi2SDw 58XR/AnZUIG4LbmBGjO321TZz4zLn5MWTdrMn95vRtU/ZJiJpnEEtg5RwMYvCKq62TcK 2B5Q== X-Gm-Message-State: AOJu0YzqzVu6jcYtMK4Bo5bcfqEEG4m3ObGDXG32RE2LXHxq3bx2U6Qh rH+EWv3EivbR8tCWRqua8JRC6BLs0BPc5CIx1WI= X-Google-Smtp-Source: AGHT+IGnINi+5cyo8pytak7nK9KzZnXI8RvYmk+G5v7/14aCQY1lgL7JuC76CZ9aUHM4aRNzwjspoQ== X-Received: by 2002:a17:906:845c:b0:9b8:f17a:fbc3 with SMTP id e28-20020a170906845c00b009b8f17afbc3mr11624536ejy.64.1696849375915; Mon, 09 Oct 2023 04:02:55 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id y18-20020a170906559200b009ad75d318ffsm6699191ejp.17.2023.10.09.04.02.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:02:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Richard W . M . Jones" Subject: [PATCH 2/6] target/riscv: Use env_archcpu() in [check_]nanbox() Date: Mon, 9 Oct 2023 13:02:35 +0200 Message-ID: <20231009110239.66778-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When CPUArchState* is available (here CPURISCVState*), we can use the fast env_archcpu() macro to get ArchCPU* (here RISCVCPU*). The QOM cast RISCV_CPU() macro will be slower when building with --enable-qom-cast-debug. Inspired-by: Richard W.M. Jones Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: LIU Zhiwei Reviewed-by: Richard W.M. Jones Reviewed-by: Alistair Francis --- target/riscv/internals.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/riscv/internals.h b/target/riscv/internals.h index b5f823c7ec..8239ae83cc 100644 --- a/target/riscv/internals.h +++ b/target/riscv/internals.h @@ -87,7 +87,7 @@ enum { static inline uint64_t nanbox_s(CPURISCVState *env, float32 f) { /* the value is sign-extended instead of NaN-boxing for zfinx */ - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) { + if (env_archcpu(env)->cfg.ext_zfinx) { return (int32_t)f; } else { return f | MAKE_64BIT_MASK(32, 32); @@ -97,7 +97,7 @@ static inline uint64_t nanbox_s(CPURISCVState *env, float32 f) static inline float32 check_nanbox_s(CPURISCVState *env, uint64_t f) { /* Disable NaN-boxing check when enable zfinx */ - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) { + if (env_archcpu(env)->cfg.ext_zfinx) { return (uint32_t)f; } @@ -113,7 +113,7 @@ static inline float32 check_nanbox_s(CPURISCVState *env, uint64_t f) static inline uint64_t nanbox_h(CPURISCVState *env, float16 f) { /* the value is sign-extended instead of NaN-boxing for zfinx */ - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) { + if (env_archcpu(env)->cfg.ext_zfinx) { return (int16_t)f; } else { return f | MAKE_64BIT_MASK(16, 48); @@ -123,7 +123,7 @@ static inline uint64_t nanbox_h(CPURISCVState *env, float16 f) static inline float16 check_nanbox_h(CPURISCVState *env, uint64_t f) { /* Disable nanbox check when enable zfinx */ - if (RISCV_CPU(env_cpu(env))->cfg.ext_zfinx) { + if (env_archcpu(env)->cfg.ext_zfinx) { return (uint16_t)f; } From patchwork Mon Oct 9 11:02:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1845198 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=avMliAXb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3x5S4TD5z20Vh for ; Mon, 9 Oct 2023 22:05:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo2n-0006XG-Rx; Mon, 09 Oct 2023 07:03:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2c-0006MK-1D for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:15 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2S-0003OO-8x for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:11 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5362bcc7026so7758666a12.1 for ; Mon, 09 Oct 2023 04:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849382; x=1697454182; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/xL54zgpI4nEx7Yl6kW+m7mCJYstREJ1f9hvJxDP1UE=; b=avMliAXbQLZgauO4GnN8+8MXtBsJX1/xEE576ipv6ITdbcaMiobQbD+skZ/Hkoon+v VooEb4c8AlGiEIf/p1YmsdYUqvOeKGEU8Db11tw+wrrBQn/vKrrKR5i9ROLW4ZBlDXx+ cD8zW2k6nN4cowAqj1p+PEt7PwfS+Yw6r9bW9wIKwXpYkeT+Bdsj27kwzk72p/85OrQt s2Rctyw2LujFEheeCwNQ+oN3/G7N62tp05f5Q0v/y6NQT74mdO8OXqUB4SBLhlWiS7Wv SEQuax3T/aoR7zGS+VGbTuBWdHmFCw5fALN5EPzye3G1iqgjMkX+vLn5ZNgWIqcHA7JR o16A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849382; x=1697454182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/xL54zgpI4nEx7Yl6kW+m7mCJYstREJ1f9hvJxDP1UE=; b=hSv+2bUt3GssOREquXDWm1Xc3KbiY0+cu6ZlXYFAkjee8gkfrygPQUXYPV47hRVa2w ZhsuEJVm2Q4YIFnuRsHehAJNXdPmUFukOuM86kUlWNjMknM8TRNBT+EU5jZv2FQPWDp3 YX3Lvo9EnSYWYuW21UjgIDbxWG31V2DbxAgSPMHYAWH0mH+6kqCCqqTVI+Cfqs5YCAGD Bwsu+1bQXT42zKcOx93bLkVyL6C72cxC3nOfqPqt08GcRK0Z8sYf55HbXS2ioeWz3d6T y7e62/wN6GD9PBf/e4EYJ2/Lkct4r5pCluw5oLkXqtDXORB7HJsdhvFQJ7lV1DbKgWLl tuUA== X-Gm-Message-State: AOJu0Yw794Q8t4p6dlk8v/xq7EBqVF4hz3ic4hoytqs37E4zZ78+RfoI A9dCGi/LRGAf+5oCp/hdT1DIlPU16aVh0+wO4Go= X-Google-Smtp-Source: AGHT+IEefebTk5Qmy9jCOLkszVMi9NaRJRvfEmB0R/xOj91bCWL6pVDZYQ6gcYX6EXYLDpHaKqT/EQ== X-Received: by 2002:a05:6402:28a:b0:538:8d4:2077 with SMTP id l10-20020a056402028a00b0053808d42077mr12461170edv.13.1696849382603; Mon, 09 Oct 2023 04:03:02 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id j17-20020aa7c411000000b0053635409213sm6014873edq.34.2023.10.09.04.03.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:03:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 3/6] target/s390x: Use env_archcpu() in handle_diag_308() Date: Mon, 9 Oct 2023 13:02:36 +0200 Message-ID: <20231009110239.66778-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=philmd@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When CPUArchState* is available (here CPUS390XState*), we can use the fast env_archcpu() macro to get ArchCPU* (here S390CPU*). The QOM cast S390_CPU() macro will be slower when building with --enable-qom-cast-debug. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Alistair Francis --- target/s390x/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/diag.c b/target/s390x/diag.c index 8ce18e08f3..27ffd48576 100644 --- a/target/s390x/diag.c +++ b/target/s390x/diag.c @@ -77,7 +77,7 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) { bool valid; CPUState *cs = env_cpu(env); - S390CPU *cpu = S390_CPU(cs); + S390CPU *cpu = env_archcpu(env); uint64_t addr = env->regs[r1]; uint64_t subcode = env->regs[r3]; IplParameterBlock *iplb; From patchwork Mon Oct 9 11:02:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1845191 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=RQ+OULPH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3x4F2m7Nz1yq1 for ; Mon, 9 Oct 2023 22:04:13 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo2o-0006bV-LR; Mon, 09 Oct 2023 07:03:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2e-0006Ol-97 for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:16 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2b-0003PR-PT for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:16 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9a645e54806so748323966b.0 for ; Mon, 09 Oct 2023 04:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849389; x=1697454189; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V78g9jhuJwuu3XH3up4N6OXq/ULujlSA7fdJ/xZ8gEw=; b=RQ+OULPH/jae5EyalmRTnYY2y1PiomgrGPnqS9QRDVRwhNGbHHVNLNO9zXYjqKi+JU iGgzNmxuB1AzEgVTORIrJEpi1nrp4xBbETy+ayZ86ps1ahUpBsAOOPtniDcy6i7Gqk7F xUZkOw74yUFLOZ5CGiwccuQFKzBSs9r6dnn/r5a8T2wpk9zD5c4xVuIZaCQiU/r3tm2/ J1ODZVBudu3nkq0um1gBtN8CeCEskWBpxpoCqsOsFgnTAeQkNKJy7ZtpivrT9rIEe1Of aK6/gU62yuNeRWOGX+KQnVlsdcBt1YDgK4InnM3f0FRSh4akkBK0NqVZCMMr7drPjomD /tYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849389; x=1697454189; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V78g9jhuJwuu3XH3up4N6OXq/ULujlSA7fdJ/xZ8gEw=; b=SJMZQpUZO6DJdqOXZGfOByqcaQcVEpMmm3YubkdMlC8m1DammS5uh96hv16pD+Cd7D doIJs9/LD8AptlafzcRltO0dGc+VqsBtD9q//w7FiX8Aw/T6odGpDk0ZfykwbbLN76El GulaX+FNdkI+WUa0UqJs3jnZtJiM9JzWk3zemT7inZ0He2QOdnOT+ZNJtyViowLej23D a8buvcMkwSZe4aQ7IJbi2sweu6dQJhdeKVjTo+P4Nse+hYRyYdZunE5mToU+kzzvIx2/ dd3a5oSkDqlyl5rqECT6QuuLY5TD8bYLJ7vckBhzS45VEiThCI/FRZ4yOHkRa1YfYSNS tkfw== X-Gm-Message-State: AOJu0Yxx4bBDw9S3CAC/aKW7iw8nwamNw5SduW+Gidl6xJ0Zs1YVp9rQ Ex8BUGEQvEsvTwh3sGE4XMsDOBRN+R0oIA+DJd8= X-Google-Smtp-Source: AGHT+IEcNwxVZqRuOS5msdhnG1M0Nje61e749+OicUXZAaRVWxzCHpr70xl3BdSEcOOgS8SbhCgXWA== X-Received: by 2002:a17:907:763b:b0:9ad:c132:b93b with SMTP id jy27-20020a170907763b00b009adc132b93bmr12534458ejc.5.1696849388833; Mon, 09 Oct 2023 04:03:08 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id u16-20020a1709064ad000b009ae54585aebsm6489905ejt.89.2023.10.09.04.03.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:03:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 4/6] target/xtensa: Use env_archcpu() in update_c[compare|count]() Date: Mon, 9 Oct 2023 13:02:37 +0200 Message-ID: <20231009110239.66778-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When CPUArchState* is available (here CPUXtensaState*), we can use the fast env_archcpu() macro to get ArchCPU* (here XtensaCPU*). The QOM cast XTENSA_CPU() macro will be slower when building with --enable-qom-cast-debug. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Alistair Francis --- target/xtensa/op_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c index 7bb8cd6726..496754ba57 100644 --- a/target/xtensa/op_helper.c +++ b/target/xtensa/op_helper.c @@ -37,7 +37,7 @@ void HELPER(update_ccount)(CPUXtensaState *env) { - XtensaCPU *cpu = XTENSA_CPU(env_cpu(env)); + XtensaCPU *cpu = env_archcpu(env); uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); env->ccount_time = now; @@ -58,7 +58,7 @@ void HELPER(wsr_ccount)(CPUXtensaState *env, uint32_t v) void HELPER(update_ccompare)(CPUXtensaState *env, uint32_t i) { - XtensaCPU *cpu = XTENSA_CPU(env_cpu(env)); + XtensaCPU *cpu = env_archcpu(env); uint64_t dcc; qatomic_and(&env->sregs[INTSET], From patchwork Mon Oct 9 11:02:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1845190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ecKA4V1F; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3x4507nPz1yq1 for ; Mon, 9 Oct 2023 22:04:05 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo2s-0006ep-H4; Mon, 09 Oct 2023 07:03:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2i-0006Pn-BV for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:22 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2e-0003QZ-Tl for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:19 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9b29186e20aso752256966b.2 for ; Mon, 09 Oct 2023 04:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849395; x=1697454195; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1+J1wI69+igLibXDQf0PHgHIzLfY8D41JYZfyX16+G8=; b=ecKA4V1F9DPFs2cwjQ8AZKNzG4WOYVOH9X1FZpaV4IShxeIXvgSeDINqWXqYU8N/bq Lx5Qd0nQfPmG7MmfQmYO96C45YrDzxFuFxUYRc4VFXrg8otxwpYjRP9hymX7vntH3BfI /ibdVEnZDFTMpVDi25+7p+hsOZAHp2TYOXfmKepyt8bHJAFrTmHr0CO6D8pCwzFtJXnm XaLPjI3Cvnpo8QLaPGrS6/drLMWgSMrtfFGRQdzA2ZOrp7VL4Ba8JN20H1T4zWL1qOFH RLXYQEKdVvQKnqaHewoUAJK93xXY4USRW5a0kF2krnJdxT2kgw+VHICVQs7qSo1zkwRZ N8jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849395; x=1697454195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1+J1wI69+igLibXDQf0PHgHIzLfY8D41JYZfyX16+G8=; b=MwLwpSsAEZ4R5qbuUV9ekHR65asazgb4a1eOnb9cv0ZBXmID2nFL0vV/9BZpOIOOUM W+5xKofbJYeKKK2irgFkPlc9Q0QwEI0CWCqi94xKGunJhnCyTHT0G75E2jNsuhWUQXKO hy5iiJHtDSNXOIdgp0IZCeI3WxhkDGAVf9TaqrSUBZg7VhOkP3tnoQdiyslzzu8eCtjx R8HdBNjs+l5tj+vZvtk0GYBWAy4R+odEq2mNQ5zqfV8dAsXuP4Cv+Ek/2miJ/PNRyaMQ GyJlAKuBc4OFSO/khTG4FoCnyc+opHhzaVDb1ktthDdLI19t9B7D6stYquXpi6DY6UD2 GWcg== X-Gm-Message-State: AOJu0YzRJ+QC3W4RZyAEVCRmBkf/KVm8rypG+hLFH4DBjvW5rlf+uifZ 2ykclSDaf6vlowj3nR0y+vxF9haZ9naYonjlaOw= X-Google-Smtp-Source: AGHT+IEnwQIfXK0PSpcUquHgDcrZc+NXC/pJVOCtuYwXpIu5y20njwFFRWuyfel+p9KZo0y0JdqV8Q== X-Received: by 2002:a17:906:3081:b0:9ae:73ca:bbad with SMTP id 1-20020a170906308100b009ae73cabbadmr13579817ejv.43.1696849395170; Mon, 09 Oct 2023 04:03:15 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id n17-20020a170906379100b009b957d5237asm6543236ejc.80.2023.10.09.04.03.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:03:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 5/6] target/i386/hvf: Use x86_cpu in simulate_[rdmsr|wrmsr]() Date: Mon, 9 Oct 2023 13:02:38 +0200 Message-ID: <20231009110239.66778-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We already have 'x86_cpu = X86_CPU(cpu)'. Use the variable instead of doing another QOM cast with X86_CPU(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Roman Bolshakov Reviewed-by: Zhao Liu --- target/i386/hvf/x86_emu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index ccda568478..af1f205ecf 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -676,7 +676,7 @@ void simulate_rdmsr(struct CPUState *cpu) val = rdtscp() + rvmcs(cpu->accel->fd, VMCS_TSC_OFFSET); break; case MSR_IA32_APICBASE: - val = cpu_get_apic_base(X86_CPU(cpu)->apic_state); + val = cpu_get_apic_base(x86_cpu->apic_state); break; case MSR_IA32_UCODE_REV: val = x86_cpu->ucode_rev; @@ -776,7 +776,7 @@ void simulate_wrmsr(struct CPUState *cpu) case MSR_IA32_TSC: break; case MSR_IA32_APICBASE: - cpu_set_apic_base(X86_CPU(cpu)->apic_state, data); + cpu_set_apic_base(x86_cpu->apic_state, data); break; case MSR_FSBASE: wvmcs(cpu->accel->fd, VMCS_GUEST_FS_BASE, data); From patchwork Mon Oct 9 11:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1845194 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=feS1yhHp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S3x4l14Wyz1yq1 for ; Mon, 9 Oct 2023 22:04:39 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpo30-0006vD-4i; Mon, 09 Oct 2023 07:03:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpo2p-0006df-2n for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:27 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpo2m-0003SG-4H for qemu-devel@nongnu.org; Mon, 09 Oct 2023 07:03:26 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-53b8f8c6b1fso2683984a12.0 for ; Mon, 09 Oct 2023 04:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696849402; x=1697454202; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w1sigiR4LmduP3UlaMwnqexR3h3qqvWr4C29unZHhf0=; b=feS1yhHpaN/5U+Bw8svx9lFsQu4zG4Pk9bQtg/uP6dh6UWQQbueHoO6WjIxoXKQ81m UotfSriSUVNh4pHFndcupqUB0qFSKe96CO6xYrC03V5P4kKiReO60S2jNbUYHaXDQw/H Uq1kT5HS0H6BG07jmpq0AVTLaQog1A7f1LeeCgdwQHfVf0PUmPKwZEt7FQvNqaY9hdb0 /9mA+acRi0JETuSmZlyvhhAe+PKZq5IgLo0Hw5OBYO2B2Est2VQOCntJ0+9YK7jXimdC MrBxW+SKhurn2E2p4M328xMIM+Bm5TXoWKOOU+PS74+Js4VJS2BPzxmK27l4737L0ZJO 6tRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696849402; x=1697454202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w1sigiR4LmduP3UlaMwnqexR3h3qqvWr4C29unZHhf0=; b=aWh9tqG/KlZQnEb0Y1U/IGYJb83cydniLvEscwnMxnC9jbs8d8jAcOdptpOVWngchN xlG/0aNzypv9aPEEzj/rYOjRmH3Xhj98GZkKM0Glo2WquTIIveWV6PmzgFFpAP4C5RjZ ZKk3RYhLkgCUky/pTT/7OfPNRGJz1IC8+FUPJoqEAxnPSpqwAmIpdOk78AJmYrjMwj3P mrn7OX+96IEccsKMJlx8vLzB7PLqalPUtGUsQ1D4TxGZKzI/0O/HzqKoLbcAJ4ECQ0Rl u+zhAdhEqiIgS6lez446kGvDPIxqOXdpiE4Ap2VeGQ0dIT5g/RScCwSXew3mEi4HbU15 DuhQ== X-Gm-Message-State: AOJu0YwVS50p8CRAmwOW5p6TlCXn84wwWydWCHs3I5mX3l863Sp7LMpx FlD5F0Q+v3uaQ+J3Ch+H35JKU/QQqqfnzW13LeM= X-Google-Smtp-Source: AGHT+IGTB5TvG49uVveL5d3xAMI/z69k2NeO2JEO2Qp2YaFn1vMnclHMmnkxW7Dx7nIMpam3RZLDhQ== X-Received: by 2002:a05:6402:1adb:b0:538:7787:2d62 with SMTP id ba27-20020a0564021adb00b0053877872d62mr14085875edb.1.1696849401649; Mon, 09 Oct 2023 04:03:21 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id f22-20020a056402151600b0052febc781bfsm6010828edw.36.2023.10.09.04.03.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 04:03:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Weiwei Li , qemu-s390x@nongnu.org, Ilya Leoshkevich , Bin Meng , Alistair Francis , Cameron Esfahani , qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-riscv@nongnu.org, Max Filippov , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Liu Zhiwei , Richard Henderson , Thomas Huth , Roman Bolshakov , Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/6] target/i386: Use env_archcpu() in simulate_[rdmsr/wrmsr]() Date: Mon, 9 Oct 2023 13:02:39 +0200 Message-ID: <20231009110239.66778-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009110239.66778-1-philmd@linaro.org> References: <20231009110239.66778-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=philmd@linaro.org; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When CPUArchState* is available (here CPUX86State*), we can use the fast env_archcpu() macro to get ArchCPU* (here X86CPU*). The QOM cast X86_CPU() macro will be slower when building with --enable-qom-cast-debug. Pass CPUX86State* as argument to simulate_rdmsr / simulate_wrmsr instead of a CPUState* to avoid an extra cast. simulate_rdmsr/simulate_rdmsr(CPUX86State Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Roman Bolshakov Tested-by: Roman Bolshakov Reviewed-by: Zhao Liu --- RFC: Not even build-tested. --- target/i386/hvf/x86_emu.h | 4 ++-- target/i386/hvf/hvf.c | 4 ++-- target/i386/hvf/x86_emu.c | 21 ++++++++++----------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/target/i386/hvf/x86_emu.h b/target/i386/hvf/x86_emu.h index 640da90b30..4b846ba80e 100644 --- a/target/i386/hvf/x86_emu.h +++ b/target/i386/hvf/x86_emu.h @@ -29,8 +29,8 @@ bool exec_instruction(CPUX86State *env, struct x86_decode *ins); void load_regs(struct CPUState *cpu); void store_regs(struct CPUState *cpu); -void simulate_rdmsr(struct CPUState *cpu); -void simulate_wrmsr(struct CPUState *cpu); +void simulate_rdmsr(CPUX86State *env); +void simulate_wrmsr(CPUX86State *env); target_ulong read_reg(CPUX86State *env, int reg, int size); void write_reg(CPUX86State *env, int reg, target_ulong val, int size); diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index cb2cd0b02f..20b9ca3ef5 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -591,9 +591,9 @@ int hvf_vcpu_exec(CPUState *cpu) { load_regs(cpu); if (exit_reason == EXIT_REASON_RDMSR) { - simulate_rdmsr(cpu); + simulate_rdmsr(env); } else { - simulate_wrmsr(cpu); + simulate_wrmsr(env); } env->eip += ins_len; store_regs(cpu); diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index af1f205ecf..b1f8a685d1 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -663,11 +663,10 @@ static void exec_lods(CPUX86State *env, struct x86_decode *decode) env->eip += decode->len; } -void simulate_rdmsr(struct CPUState *cpu) +void simulate_rdmsr(CPUX86State *env) { - X86CPU *x86_cpu = X86_CPU(cpu); - CPUX86State *env = &x86_cpu->env; - CPUState *cs = env_cpu(env); + X86CPU *x86_cpu = env_archcpu(env); + CPUState *cpu = env_cpu(env); uint32_t msr = ECX(env); uint64_t val = 0; @@ -746,8 +745,8 @@ void simulate_rdmsr(struct CPUState *cpu) val = env->mtrr_deftype; break; case MSR_CORE_THREAD_COUNT: - val = cs->nr_threads * cs->nr_cores; /* thread count, bits 15..0 */ - val |= ((uint32_t)cs->nr_cores << 16); /* core count, bits 31..16 */ + val = cpu->nr_threads * cpu->nr_cores; /* thread count, bits 15..0 */ + val |= ((uint32_t)cpu->nr_cores << 16); /* core count, bits 31..16 */ break; default: /* fprintf(stderr, "%s: unknown msr 0x%x\n", __func__, msr); */ @@ -761,14 +760,14 @@ void simulate_rdmsr(struct CPUState *cpu) static void exec_rdmsr(CPUX86State *env, struct x86_decode *decode) { - simulate_rdmsr(env_cpu(env)); + simulate_rdmsr(env); env->eip += decode->len; } -void simulate_wrmsr(struct CPUState *cpu) +void simulate_wrmsr(CPUX86State *env) { - X86CPU *x86_cpu = X86_CPU(cpu); - CPUX86State *env = &x86_cpu->env; + X86CPU *x86_cpu = env_archcpu(env); + CPUState *cpu = env_cpu(env); uint32_t msr = ECX(env); uint64_t data = ((uint64_t)EDX(env) << 32) | EAX(env); @@ -856,7 +855,7 @@ void simulate_wrmsr(struct CPUState *cpu) static void exec_wrmsr(CPUX86State *env, struct x86_decode *decode) { - simulate_wrmsr(env_cpu(env)); + simulate_wrmsr(env); env->eip += decode->len; }