From patchwork Fri Jan 26 22:04:03 2024 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: 766399 Delivered-To: patch@linaro.org Received: by 2002:adf:a314:0:b0:337:62d3:c6d5 with SMTP id c20csp454520wrb; Fri, 26 Jan 2024 14:11:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyYc2ic/NeWfq+scwFLgJ96jtng79Eb1ae+XB7Zn1oKnjffUSUhPo78gF7TTbXgA03qIVj X-Received: by 2002:a9d:61d1:0:b0:6e1:5dd:72aa with SMTP id h17-20020a9d61d1000000b006e105dd72aamr605986otk.68.1706307078610; Fri, 26 Jan 2024 14:11:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706307078; cv=none; d=google.com; s=arc-20160816; b=c8ZD9wKmWGERUKPVSlA+SUVobzJGG+S42rWvoINR1sx9vQfp+7xevTSiAVm7jzSym5 R/sruTfdVBTHSyxm5YrnWU9XZLosnacN1OdCZ4iPN2Tl5SPpKlVmgT8Vutt8BQ2oe9N3 +VyYiZDz4q4AvZK4BXs6cOgQMuJjpcFNV4jTUzcXacKLFcJTTZmBGhWk+l6TL5H2Wq8U +8qyN+5zBoUYDB+GAyYM9ist9Q8yHjkP1tt4JFkLez4G00c7mBsJuA9aHTT3MSOeJg2K vkQOG9PWpabs/vJ1sYEnrY8rJ1YdA/PaxaD1HNty82WCg8SbLCS6ytDaEzyNhN8kL4uh rjIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vV6dlj18pAtxWLV4KcwUuJD4lVU4OiaIF5yNARG5Efc=; fh=Vox//9eCt8pDAfzs70Ob3VgxSZnsBM3cPewB/LFmMXA=; b=JLpAP0BfeIj5pMTKHAIXu1uiHKovKu1rslnfdn96CEWI1i2eH8Lfh5+I4TTlo40+HU G2YzzFptxe6ctYD0QMAgGiiXek/Eer2uUVhYjBbpyMESiHJj11x9L5EWlSbj1eARzZAO Cb7zSRMAGcFF7ogtGRnlq8VZ9X9ZkzVIyVwn9yQP7OMRBwNfuK1fN636uAxr/u4P8v1K QOYabbVbXvvyhzjyKKyljBI4HiHTdsDn7cwxFaKLS61/iSk3QZ29kNCHFi/xOivjXTUh uAYvbZB4ksvqiV/Wdg3lR9E4lSNkoMxJSrUygw5VUEEpKeZm0TTUs2dPXmHV8+9nH5aQ D4Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dFDrlOcY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g12-20020ac87f4c000000b0042a7e98a003si1864672qtk.376.2024.01.26.14.11.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2024 14:11:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dFDrlOcY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTULY-0004V1-WC; Fri, 26 Jan 2024 17:06:49 -0500 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 1rTULL-0002dx-4c for qemu-devel@nongnu.org; Fri, 26 Jan 2024 17:06:35 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTULG-0004dI-SE for qemu-devel@nongnu.org; Fri, 26 Jan 2024 17:06:34 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3394dc75eadso908731f8f.2 for ; Fri, 26 Jan 2024 14:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706306781; x=1706911581; 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=vV6dlj18pAtxWLV4KcwUuJD4lVU4OiaIF5yNARG5Efc=; b=dFDrlOcYYCoLUKhTfrwwk1wY5LRwJkzicRrnq0GD+iXPvehlhRHZOKU8Z0Pg8UGgRG 3ZY4BIidofq/JKdtHChBY0Eao6n4Bf+tJO5UNYSIRq8pPxJZBfucz9gLw5BValfRM4mr Fq/F/WCA7XPXN3z4i9VLgXeOSa1pQOXPT5hcUWNatVn1DlUljHfMOoCUaOxhAXufeOjm LI0ozefW5BXighfvNHf3b1qk6BQw2w+yJbFa+xveUZ3yVGddgoFWbF8+i7sKoxtNNf7L miRo9+gyZS34CUQXI9VoHHze5YHJjMyklcaf10oQyXMIiRJNgZC1XYZvZDZw7ycmpACc k58w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706306781; x=1706911581; 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=vV6dlj18pAtxWLV4KcwUuJD4lVU4OiaIF5yNARG5Efc=; b=MkDi97Rai61v49/UfMnuatCGZD/yc0Cyr1JErs5TjzGZAru4YihaAcQNcfZLhTuUCB ixKef2C0wLgRL1IlnVLtPcP9dBxsyH9F/ezHdF34DGqgL0WJa3EORKvEVNkySvatg7ui axsI9YMfn5Eudi4NiiWkArVUCNCCwK3DT08fQgHOi6yCiVjGOEirPk0/h/h2fDa42IDP 4iStWgDSfMkv36FnmazsllBOjkDqFuqkzFeggoim4j00LG27Nn8BJmAwF6LISKfE8faC H0RQuUWxbgDeNbLbicit213S59Bf4JPw9pv0DYEvgmDa9vQbEEcipiuZ4MXZGfN6SA9q Txxg== X-Gm-Message-State: AOJu0YzryBhTWG9Q2iPUBETCWmfQTeyg20UwuumbVkO5bMXVR4ozW+zQ dTXBpYa3eWP3o94Izs42CfQnttxU+PkZjDlygUHZuSsYvYfiSsH/qMYtctm2yE+YFzNvLOl1o8E w X-Received: by 2002:adf:f48d:0:b0:337:bfdb:5b8d with SMTP id l13-20020adff48d000000b00337bfdb5b8dmr216861wro.115.1706306781480; Fri, 26 Jan 2024 14:06:21 -0800 (PST) Received: from m1x-phil.lan ([176.176.142.39]) by smtp.gmail.com with ESMTPSA id n14-20020a5d6b8e000000b0033ade016ba5sm1380477wrx.4.2024.01.26.14.06.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 26 Jan 2024 14:06:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Thomas Huth , qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, Eduardo Habkost , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Richard Henderson , Vladimir Sementsov-Ogievskiy , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bastian Koppelmann Subject: [PATCH v2 21/23] target/tricore: Prefer fast cpu_env() over slower CPU QOM cast macro Date: Fri, 26 Jan 2024 23:04:03 +0100 Message-ID: <20240126220407.95022-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240126220407.95022-1-philmd@linaro.org> References: <20240126220407.95022-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Mechanical patch produced running the command documented in scripts/coccinelle/cpu_env.cocci_template header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Bastian Koppelmann --- target/tricore/cpu.c | 20 ++++---------------- target/tricore/gdbstub.c | 6 ++---- target/tricore/helper.c | 3 +-- target/tricore/translate.c | 3 +-- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 8acacdf0c0..7f0609090c 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -36,38 +36,26 @@ static const gchar *tricore_gdb_arch_name(CPUState *cs) static void tricore_cpu_set_pc(CPUState *cs, vaddr value) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; - - env->PC = value & ~(target_ulong)1; + cpu_env(cs)->PC = value & ~(target_ulong)1; } static vaddr tricore_cpu_get_pc(CPUState *cs) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; - - return env->PC; + return cpu_env(cs)->PC; } static void tricore_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; - tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL)); - env->PC = tb->pc; + cpu_env(cs)->PC = tb->pc; } static void tricore_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb, const uint64_t *data) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; - - env->PC = data[0]; + cpu_env(cs)->PC = data[0]; } static void tricore_cpu_reset_hold(Object *obj) diff --git a/target/tricore/gdbstub.c b/target/tricore/gdbstub.c index e8f8e5e6ea..f9309c5e27 100644 --- a/target/tricore/gdbstub.c +++ b/target/tricore/gdbstub.c @@ -106,8 +106,7 @@ static void tricore_cpu_gdb_write_csfr(CPUTriCoreState *env, int n, int tricore_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; + CPUTriCoreState *env = cpu_env(cs); if (n < 16) { /* data registers */ return gdb_get_reg32(mem_buf, env->gpr_d[n]); @@ -121,8 +120,7 @@ int tricore_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int tricore_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; + CPUTriCoreState *env = cpu_env(cs); uint32_t tmp; tmp = ldl_p(mem_buf); diff --git a/target/tricore/helper.c b/target/tricore/helper.c index 174f666e1e..d328414c99 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -67,8 +67,7 @@ bool tricore_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType rw, int mmu_idx, bool probe, uintptr_t retaddr) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; + CPUTriCoreState *env = cpu_env(cs); hwaddr physical; int prot; int ret = 0; diff --git a/target/tricore/translate.c b/target/tricore/translate.c index 66553d1be0..ad314bdf3c 100644 --- a/target/tricore/translate.c +++ b/target/tricore/translate.c @@ -95,8 +95,7 @@ enum { void tricore_cpu_dump_state(CPUState *cs, FILE *f, int flags) { - TriCoreCPU *cpu = TRICORE_CPU(cs); - CPUTriCoreState *env = &cpu->env; + CPUTriCoreState *env = cpu_env(cs); uint32_t psw; int i;