From patchwork Mon Jan 29 16:45:06 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: 767409 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp981321wro; Mon, 29 Jan 2024 08:50:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMpQmUPSrVz8HCa544ah6CGWz9zUSgfeVJubd1IrU0Ip8x6NuWVX5UDaF5YO4lj5Vu2CrZ X-Received: by 2002:a05:6902:188a:b0:dc2:2f50:b510 with SMTP id cj10-20020a056902188a00b00dc22f50b510mr3826619ybb.37.1706547039735; Mon, 29 Jan 2024 08:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706547039; cv=none; d=google.com; s=arc-20160816; b=O4N9ljUhHmUyKwvxu8v7yKTUbjNvYsIQWNr6B/9JGLGBKsnBCLVkWOmKywaegSXdDf djVmt41xnCmnYuH3zQiugJDSpN2vrgOrEt0+mvC6NtMo+Ltv7tUJr34wgkOXCmS39FC7 bPX9lIiWXG7yirvWKtrnsanTqlBEnQN8yvmmbZAvq8cbbn8+oIpciukBpbWqCx3o78L/ ENjwiFTc4cqN/I3Za64Xq7Qa0Ax3F2SOA/70QO4EQ/dqVnspB3hK7yKPRMGOeY12a4Dc eWcslPT9AJ+Hm6tujaIhl9yyEFl5rKvE154jq30G3QoMeHhxL93mG2+ujAfd+PHVU8GA fdng== 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=s/zDxvb98/B1ERutMsrHfGwo048VXZrRTuyvepC4E0w=; fh=eeVa7dYgnzuJS4yUXISyXDOO2tisYtFgcMq6bzbeuhk=; b=h/UhZl4cgaWaOsefT8SRiCG+xGDCymVy2nw9L0DXrOPUrJ21HzbfdHJQUuCjwX4Eln itUSzL2cXorxkawBUYlnoV4+5vOk7pqHWfk2JCdht6EyGJlPtgEqpKDBHwgPW2c0xE8W 8Wt3v7B2txrwK7wY9RJvqdZwask51+tGd0SUNDzLb3p+o6WjkQ1/RLzCyMWv+r9zVekL mE30qeXPkXj8TRPDthGLB7hP2IWqD6k4b+zd1SymquSVwbvG+ytgkTOIOkO6/5WRauAV 8ON6sJgHMsV5MW2RHL0g9Eg0WzPEjUtA19liFO0Cr3iczrouCmBHI6+Fibcl7/aMRq7A hKfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ALCwUdVx; 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 c12-20020a05620a268c00b00783fa2f6dd4si3452890qkp.186.2024.01.29.08.50.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jan 2024 08:50:39 -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=ALCwUdVx; 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 1rUUoV-0006ux-OP; Mon, 29 Jan 2024 11:48:51 -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 1rUUnX-00027g-Te for qemu-devel@nongnu.org; Mon, 29 Jan 2024 11:47:52 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUUnT-0004Px-Qs for qemu-devel@nongnu.org; Mon, 29 Jan 2024 11:47:51 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40ef6f10b56so8564535e9.2 for ; Mon, 29 Jan 2024 08:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706546866; x=1707151666; 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=s/zDxvb98/B1ERutMsrHfGwo048VXZrRTuyvepC4E0w=; b=ALCwUdVx5ABnmsdfjS07bA4t9KjAftsNHd+/1PkoZP/0p/Vn8XBGIiQyRcJ3RxewVu 3f4FnTtWym1BAWbZ/scM7hvX3UgLyUzATeHDG2jqLYBMRkMt+epcyVB9VCTn2/UI+oaH TWs67x/w2OoPO5GesmPMLX1cqixrVikcwPPRnKo5FenkWb8mAQBatp0oB3onFWxhYSh7 35fFSjlQQQqd5mMbSVmAwRNIos1U2fKGlOO3fBtePhGDWX8QTvVDhdMZii+5190dOjE7 JLrtf34gdRZvlpnw9koyyaqIHo/c0skFFnWXyuRAaS0yDTMmaQeehwpXuxX5Qwjmszta Eh6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706546866; x=1707151666; 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=s/zDxvb98/B1ERutMsrHfGwo048VXZrRTuyvepC4E0w=; b=wuJe0hZ9vsUqB6pTBTPkER5NQfbWI7IFOxKHzy3CmbkR3BxhgH9blL5yRPY1NNqJnS mu+nEDMywm/kXTbM9wg/mFA32BwiccCEiNLiC/f/AFidRbmZmVNzPM1URDAyJdWgORz9 Wyd2VqpMY5euGlxsNvvsQ55eZV9jC3dn34nP7r75sX22z60S+2F+1zh7NROmBCQmjPjY 1iQy05dTz9VL+Q/nROCp9pUnK5+d/8jZjisFDL+Jo8dPQPwI24cetSvFVcOUIk7UJUUi V+kiYQ0r9w2GETtoq8RD7Orzv2jLN5q5V8rDMFb1BjUMi+zvbuSrRUvKOhWfrwhp721k M+TQ== X-Gm-Message-State: AOJu0YxtT44RjaQBi0C+MvW+jQ1w8ZGUnUzJ9FYjVEOTEFNAyUHi70G0 Znm7K205obDO1i4cO3OaYumdFuCscjq4DsfUAabdlTiTu9ZJm9kRTTMLNDRwZyYlpm+LTQ6cNV3 D X-Received: by 2002:a05:600c:3547:b0:40e:f681:b7b6 with SMTP id i7-20020a05600c354700b0040ef681b7b6mr2655551wmq.37.1706546865930; Mon, 29 Jan 2024 08:47:45 -0800 (PST) Received: from m1x-phil.lan ([176.187.219.39]) by smtp.gmail.com with ESMTPSA id ay12-20020a5d6f0c000000b0033ad47d7b86sm8556726wrb.27.2024.01.29.08.47.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Jan 2024 08:47:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Paolo Bonzini , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Thomas Huth , David Hildenbrand , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger Subject: [PATCH v3 24/29] target/s390x: Prefer fast cpu_env() over slower CPU QOM cast macro Date: Mon, 29 Jan 2024 17:45:06 +0100 Message-ID: <20240129164514.73104-25-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240129164514.73104-1-philmd@linaro.org> References: <20240129164514.73104-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: Thomas Huth --- target/s390x/cpu-dump.c | 3 +-- target/s390x/gdbstub.c | 6 ++---- target/s390x/helper.c | 3 +-- target/s390x/kvm/kvm.c | 6 ++---- target/s390x/tcg/excp_helper.c | 11 +++-------- target/s390x/tcg/misc_helper.c | 4 +--- target/s390x/tcg/translate.c | 3 +-- 7 files changed, 11 insertions(+), 25 deletions(-) diff --git a/target/s390x/cpu-dump.c b/target/s390x/cpu-dump.c index ffa9e94d84..69cc9f7746 100644 --- a/target/s390x/cpu-dump.c +++ b/target/s390x/cpu-dump.c @@ -27,8 +27,7 @@ void s390_cpu_dump_state(CPUState *cs, FILE *f, int flags) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); int i; qemu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64, diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c index 6fbfd41bc8..f02fa316e5 100644 --- a/target/s390x/gdbstub.c +++ b/target/s390x/gdbstub.c @@ -30,8 +30,7 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); switch (n) { case S390_PSWM_REGNUM: @@ -46,8 +45,7 @@ int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); target_ulong tmpl = ldtul_p(mem_buf); switch (n) { diff --git a/target/s390x/helper.c b/target/s390x/helper.c index d76c06381b..00d5d403f3 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -139,8 +139,7 @@ void do_restart_interrupt(CPUS390XState *env) void s390_cpu_recompute_watchpoints(CPUState *cs) { const int wp_flags = BP_CPU | BP_MEM_WRITE | BP_STOP_BEFORE_ACCESS; - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); /* We are called when the watchpoints have changed. First remove them all. */ diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 888d6c1a1c..4ce809c5d4 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -474,8 +474,7 @@ static int can_sync_regs(CPUState *cs, int regs) int kvm_arch_put_registers(CPUState *cs, int level) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); struct kvm_fpu fpu = {}; int r; int i; @@ -601,8 +600,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) int kvm_arch_get_registers(CPUState *cs) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); struct kvm_fpu fpu; int i, r; diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c index b875bf14e5..f1c33f7967 100644 --- a/target/s390x/tcg/excp_helper.c +++ b/target/s390x/tcg/excp_helper.c @@ -90,10 +90,7 @@ void HELPER(data_exception)(CPUS390XState *env, uint32_t dxc) static G_NORETURN void do_unaligned_access(CPUState *cs, uintptr_t retaddr) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; - - tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr); + tcg_s390_program_interrupt(cpu_env(cs), PGM_SPECIFICATION, retaddr); } #if defined(CONFIG_USER_ONLY) @@ -146,8 +143,7 @@ bool s390_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); target_ulong vaddr, raddr; uint64_t asc, tec; int prot, excp; @@ -600,8 +596,7 @@ bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) void s390x_cpu_debug_excp_handler(CPUState *cs) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); CPUWatchpoint *wp_hit = cs->watchpoint_hit; if (wp_hit && wp_hit->flags & BP_CPU) { diff --git a/target/s390x/tcg/misc_helper.c b/target/s390x/tcg/misc_helper.c index 89b5268fd4..8764846ce8 100644 --- a/target/s390x/tcg/misc_helper.c +++ b/target/s390x/tcg/misc_helper.c @@ -214,9 +214,7 @@ void HELPER(sckc)(CPUS390XState *env, uint64_t ckc) void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque) { - S390CPU *cpu = S390_CPU(cs); - - update_ckc_timer(&cpu->env); + update_ckc_timer(cpu_env(cs)); } /* Set Clock */ diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 8df00b7df9..9995689bc8 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6558,8 +6558,7 @@ void s390x_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb, const uint64_t *data) { - S390CPU *cpu = S390_CPU(cs); - CPUS390XState *env = &cpu->env; + CPUS390XState *env = cpu_env(cs); int cc_op = data[1]; env->psw.addr = data[0];