From patchwork Tue Mar 12 12:43:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 779715 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2001627wrt; Tue, 12 Mar 2024 05:52:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVnVEhNToFHnAHiak7BeVQt2VF+LD5P4P6ruKS/fBNZBfrBsEYrA4xFNonwPsVKZIzh6icib7aubUTXlin9lZNJ X-Google-Smtp-Source: AGHT+IGLk4E1a5MvybUZGWWHTPWLOYfTtwvgSS6Ax+ucs9UxNWM1JFOqAds6cKmrangCU6++XBnJ X-Received: by 2002:a05:620a:12e6:b0:788:4020:a400 with SMTP id f6-20020a05620a12e600b007884020a400mr1472853qkl.36.1710247973418; Tue, 12 Mar 2024 05:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710247973; cv=none; d=google.com; s=arc-20160816; b=trlefl0PhVCs7/xnHg2wm7eH9p55kIqx2cdevOAPwbioOBNOdpj5CwJNoWc+GQDv4h WLsPxMOGEW/eU5IRL5YvpMLT0sILQrC+rNmizEhLKLxhFHBEITb21fXEL87hvYBqfg7s nbsTlWKgFHill785Rkm/zbISXML5TcZubo6aTRxcVuLGk6RWzN6mIyFbd30Sj2fjexNO yIZuiTUhERbZFMIVzpiRU4ezL0EwqRvhdHM3wF0tTDA9XUnKp1Q5zx96SUcfmartYDa7 BW4h80vm4vX7stA51zD2i6PP71mqvDValeQJHXwvEfaJVC97wqHnqmuXeu5HT6/jmDkQ qO9w== 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=xXkoorxlTSEReqUP0thEsel8IhSLhhmlljcP3i1qTlY=; fh=MVtmONGgcwaswePOsQaFbzD/JigNLxHXgB5l4X9593E=; b=t5qFmtdunGer4vEh6qJig/hchKbFXLahzvkApfRoQCzvkKBYSgPB+85PuFaa+azgwe dv2yoNtZ45Wk44wUP4JcAJ8NMXQhrw6araQbeU0tJjAay9c9D0Gq/x5wBhmjokfrLOyV qt3ImW4oxgGqi9pBN/Z1fU0P2skgbdpdjBp3Jlf+8a6okVf3sI7k0dJiAoCi7SFsfSN0 EC75ak4KdJ0JHQ42SUdHrK4GDNVmpr8pdt9Uwmx7wVMbM+Uji++liXDIcynODAkMTS0R PdULO8gnjK/M3jbMwAjL1N5RaAHyh49E/WyMzEEPTgB/c/eNKRUmwCgKl4NftpLsXQxi febA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hoYr82GQ; 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 j19-20020a05620a147300b0078875de472asi2589663qkl.482.2024.03.12.05.52.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 05:52:53 -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=hoYr82GQ; 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 1rk1Xw-0000Rs-7x; Tue, 12 Mar 2024 08:47:56 -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 1rk1VK-0004eQ-9s for qemu-devel@nongnu.org; Tue, 12 Mar 2024 08:45:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk1VI-0000bZ-3Y for qemu-devel@nongnu.org; Tue, 12 Mar 2024 08:45:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710247509; 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=xXkoorxlTSEReqUP0thEsel8IhSLhhmlljcP3i1qTlY=; b=hoYr82GQA2xwQYTmtkr/NhNSBeaVAZo0YOYJJ5J3X8CMFPH7zBDp5BfqyKWY2qi3vYJ6j+ TrWcEc6VAYX2GOQYo0fdUKQXRld64XenMRzHKaJ3TvTI3U9BTn37nBjL0fp6xHj6FCw8o0 MtU7pMyTqjocA7j4pyJiQtyurheL9DM= 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-599-fuQxiqVOPj-Uykq2VpXB-A-1; Tue, 12 Mar 2024 08:45:06 -0400 X-MC-Unique: fuQxiqVOPj-Uykq2VpXB-A-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 A77A5386A0A7; Tue, 12 Mar 2024 12:45:05 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF0FA492BC4; Tue, 12 Mar 2024 12:45:04 +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 45/55] target/microblaze: Prefer fast cpu_env() over slower CPU QOM cast macro Date: Tue, 12 Mar 2024 13:43:29 +0100 Message-ID: <20240312124339.761630-46-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.129.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, 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. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20240129164514.73104-18-philmd@linaro.org> Signed-off-by: Thomas Huth --- target/microblaze/gdbstub.c | 3 +-- target/microblaze/helper.c | 3 +-- target/microblaze/translate.c | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index eb168d1007..09d74e164d 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -110,9 +110,8 @@ int mb_cpu_gdb_read_stack_protect(CPUState *cs, GByteArray *mem_buf, int n) int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { - MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUClass *cc = CPU_GET_CLASS(cs); - CPUMBState *env = &cpu->env; + CPUMBState *env = cpu_env(cs); uint32_t tmp; if (n > cc->gdb_num_core_regs) { diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index 460eee0cf5..d25c9eb4d3 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -252,8 +252,7 @@ hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, bool mb_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); - CPUMBState *env = &cpu->env; + CPUMBState *env = cpu_env(cs); if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->msr & MSR_IE) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index a465c2d245..4e52ef32db 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1630,7 +1630,6 @@ static void mb_tr_insn_start(DisasContextBase *dcb, CPUState *cs) static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) { DisasContext *dc = container_of(dcb, DisasContext, base); - CPUMBState *env = cpu_env(cs); uint32_t ir; /* TODO: This should raise an exception, not terminate qemu. */ @@ -1641,7 +1640,7 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) dc->tb_flags_to_set = 0; - ir = cpu_ldl_code(env, dc->base.pc_next); + ir = cpu_ldl_code(cpu_env(cs), dc->base.pc_next); if (!decode(dc, ir)) { trap_illegal(dc, true); } @@ -1800,8 +1799,7 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, void mb_cpu_dump_state(CPUState *cs, FILE *f, int flags) { - MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); - CPUMBState *env = &cpu->env; + CPUMBState *env = cpu_env(cs); uint32_t iflags; int i;