From patchwork Tue Mar 12 12:43:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 779718 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2002283wrt; Tue, 12 Mar 2024 05:54:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZlP+nx+yaemd2URBnuLfOcxb1n9a4QtJhKe99dUtrWt9069YIcfwj+p9/vGJG7oDVX9F/NeKkt5zUULx9tGbJ X-Google-Smtp-Source: AGHT+IGBZfHpXDltB48I/BDYfkS4So+p33Vce/KgRd82tQqowlGHM8YOxcPz8/66/vcQj4m+FguT X-Received: by 2002:a0d:d8c9:0:b0:609:546a:4ae6 with SMTP id a192-20020a0dd8c9000000b00609546a4ae6mr9558294ywe.0.1710248072042; Tue, 12 Mar 2024 05:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710248072; cv=none; d=google.com; s=arc-20160816; b=kb4KDJdKp0VVZER5GV9mOLZrhHyNr/vke6RdFnnxvCCOnZa9yQf9a4mIUecSlbyinV UN8TzOLBPob4EIGCCgdDCqTBkDFVIAOvQa0soRcf3t9Asd6fPZx+hPTLGYHVaAmuavIn 55pCdBWFNckKCVNq+ZZpc8zyoeEQlqG6LMRd1gE3HxnAtA3wSnYVURWt6Hh8L2dN9PkW SZoH99wV7jgk+txWbQBdwQ3ls74CAsGbPD+GH8wTvdY4w9u2Nh6i17NxS2rOa2VPDCsl LHu6/jeukAXsTqFveWt0eUbwSvaqfdKg2gakZ8YQu0CZ4mRn8ox+DnoAiLH8nMbZ5WZU GI9A== 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=y6ZbGTCAWeBMMZ2CTH7Cqh0akX4u3D/q5yzE4MTVwog=; fh=MVtmONGgcwaswePOsQaFbzD/JigNLxHXgB5l4X9593E=; b=FQCHhqx6aHoMnGuw00DLkuDbdpAqBxdcTA7vZI3BFFss/+uTlf+bxPM68w3Ku9YGMH ChtY/30QOmeXOrKYW2bQB6/yCz2wwIwCwrmTk2qhbuXMfNu65DgSNh8GLby/tGcG+FH4 zi+wTHYYHVEGY+nV0J4xg4kBPhZRevm0JrJFJwCjCcml4S0h8Hq3AhpSmEwy9pZUQMSn xhIN9fTyO84+YWq/CNZSJQ24Svi+g58lFQrGnMDcJTVW69z65JHrfR9kpuxyufU5qM1Y SA3i4A45jwuTkq+B3so5hs1u2LDK9yNegrCctc5P9OPAKG+lU7z8VCzr6dJhycobtLLv RYLg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A0kvg1FW; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u13-20020ac858cd000000b0042ef1c1c10fsi7659394qta.402.2024.03.12.05.54.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 05:54:32 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=A0kvg1FW; 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=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk1Y3-0000tm-25; Tue, 12 Mar 2024 08:48:03 -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 1rk1VQ-0004yU-1J for qemu-devel@nongnu.org; Tue, 12 Mar 2024 08:45:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk1VN-0000eU-4K for qemu-devel@nongnu.org; Tue, 12 Mar 2024 08:45:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710247516; 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=y6ZbGTCAWeBMMZ2CTH7Cqh0akX4u3D/q5yzE4MTVwog=; b=A0kvg1FWVuvTo6N6dB0Yd/lI3oy9ui0jw7J24tBUDc4m6vSw84Rr0lTpqDN8p551HzgNbS vzq5sWQvUhbpZ3P4RoCst1t0mrGgAA9O9Dc9i945tdo4FP1QaQ1ZbVm/U17vArAzQrPJEp 0qUweNuJRpEvCtelrXBg34OelHprMIk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-404-iSGEBXR4PX61l84jtGLlwg-1; Tue, 12 Mar 2024 08:45:13 -0400 X-MC-Unique: iSGEBXR4PX61l84jtGLlwg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1EFD386A0B7; Tue, 12 Mar 2024 12:45:12 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB59C492BD0; Tue, 12 Mar 2024 12:45:11 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson Subject: [PULL 50/55] target/rx: Prefer fast cpu_env() over slower CPU QOM cast macro Date: Tue, 12 Mar 2024 13:43:34 +0100 Message-ID: <20240312124339.761630-51-thuth@redhat.com> In-Reply-To: <20240312124339.761630-1-thuth@redhat.com> References: <20240312124339.761630-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé 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 Message-ID: <20240129164514.73104-24-philmd@linaro.org> Signed-off-by: Thomas Huth --- target/rx/cpu.c | 4 ++-- target/rx/gdbstub.c | 6 ++---- target/rx/helper.c | 6 ++---- target/rx/translate.c | 3 +-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 26ff822e71..da673a595d 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -71,9 +71,9 @@ static int riscv_cpu_mmu_index(CPUState *cs, bool ifunc) static void rx_cpu_reset_hold(Object *obj) { - RXCPU *cpu = RX_CPU(obj); + CPUState *cs = CPU(obj); RXCPUClass *rcc = RX_CPU_GET_CLASS(obj); - CPURXState *env = &cpu->env; + CPURXState *env = cpu_env(cs); uint32_t *resetvec; if (rcc->parent_phases.hold) { diff --git a/target/rx/gdbstub.c b/target/rx/gdbstub.c index d7e0e6689b..f222bf003b 100644 --- a/target/rx/gdbstub.c +++ b/target/rx/gdbstub.c @@ -21,8 +21,7 @@ int rx_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { - RXCPU *cpu = RX_CPU(cs); - CPURXState *env = &cpu->env; + CPURXState *env = cpu_env(cs); switch (n) { case 0 ... 15: @@ -53,8 +52,7 @@ int rx_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) int rx_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { - RXCPU *cpu = RX_CPU(cs); - CPURXState *env = &cpu->env; + CPURXState *env = cpu_env(cs); uint32_t psw; switch (n) { case 0 ... 15: diff --git a/target/rx/helper.c b/target/rx/helper.c index dad5fb4976..80912e8dcb 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -45,8 +45,7 @@ void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte) #define INT_FLAGS (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIR) void rx_cpu_do_interrupt(CPUState *cs) { - RXCPU *cpu = RX_CPU(cs); - CPURXState *env = &cpu->env; + CPURXState *env = cpu_env(cs); int do_irq = cs->interrupt_request & INT_FLAGS; uint32_t save_psw; @@ -122,8 +121,7 @@ void rx_cpu_do_interrupt(CPUState *cs) bool rx_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - RXCPU *cpu = RX_CPU(cs); - CPURXState *env = &cpu->env; + CPURXState *env = cpu_env(cs); int accept = 0; /* hardware interrupt (Normal) */ if ((interrupt_request & CPU_INTERRUPT_HARD) && diff --git a/target/rx/translate.c b/target/rx/translate.c index f6bf68e00e..f6e9e0ec90 100644 --- a/target/rx/translate.c +++ b/target/rx/translate.c @@ -131,8 +131,7 @@ static int bdsp_s(DisasContext *ctx, int d) void rx_cpu_dump_state(CPUState *cs, FILE *f, int flags) { - RXCPU *cpu = RX_CPU(cs); - CPURXState *env = &cpu->env; + CPURXState *env = cpu_env(cs); int i; uint32_t psw;