From patchwork Fri Jan 26 22:03:50 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: 766388 Delivered-To: patch@linaro.org Received: by 2002:adf:a314:0:b0:337:62d3:c6d5 with SMTP id c20csp452854wrb; Fri, 26 Jan 2024 14:06:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEws9yxNtP+J5Qq1CvaiHZHsgaw0LJ5jq0HyL0Q3AjgD65oqMmIH88iG2p/+d8talrf5vND X-Received: by 2002:a05:6214:21c9:b0:68c:37b1:5c6f with SMTP id d9-20020a05621421c900b0068c37b15c6fmr791963qvh.59.1706306774172; Fri, 26 Jan 2024 14:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706306774; cv=none; d=google.com; s=arc-20160816; b=aFqClhV01rMKc1xVjHpRG1FQihEb/38r7B2bD21bSWGTwpBEwYA7aF10pIwBWvgQBJ +7LouHxCKRog+Eh5EEvNDfQH1e4dBt474XE/hYAJmuca87J6i0hYrusxYA3k5v652a2N gBd/Bc45DUwnlpg3M0sZdCteWnZuG/veM4qGwRKLn6XDPxZGzSk0yvnBOBi5rZRMnLR/ 6DlPs/xQOLXbcuJ/PnAGuvXjwkLY6YvHCQCYmvO6Lq9mVIFan8w8E1hclERmGfEb5F7s 3lHKDwqeMkuF2+qh2J6vyBaakBWSR7iAe1akyzsmVNJDr+g5cKiuMvAheBiIM/860NkG eiJA== 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=cPu55INOwoo+R5I4TkxjPDT1q0XH169I9oVKNyLzarM=; fh=vjIQCdGIiQvlMQV4M7vu+NKSTn5p9Q4HADr8u1W/+iI=; b=XXHvqH2MPsZuWh/IIKpYtm6KvgEKI20fJNY5WFMduerq/7hvuiaXeuYO9QQPHZ9HcE RcneIRydqRLGrRz3I10WNp1lyd09dT05hjmbIJsqafpWQZfrSmYmrCqLwBROVJhGftfu dzxnFvQ7z7ybFs9Ao9Kvs1gtiFpN2H+XzGFfh2p3D44a4JlYSyK7ykZj0MpXfVJKvxZw WEFvhbBFHtO8C0XhzlPJHsOx8VeO45zm6bmDeLhcukL4h+4qDs+ibYBPl35ev9PClMN7 ixCTpnvgFGvQ51CerpoAuEi1AYrWa6J2uU6YIN+yMsUk/IuZQyxW8Wk+WpkZHmegGa2Y MKcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oaEmwjqq; 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 o7-20020a0562140e4700b00685adbfcf24si2095915qvc.616.2024.01.26.14.06.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2024 14:06:14 -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=oaEmwjqq; 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 1rTUKJ-00088i-WD; Fri, 26 Jan 2024 17:05:32 -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 1rTUJt-0007j7-5o for qemu-devel@nongnu.org; Fri, 26 Jan 2024 17:05:07 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTUJo-0003hB-5j for qemu-devel@nongnu.org; Fri, 26 Jan 2024 17:05:03 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40e80046264so18407905e9.0 for ; Fri, 26 Jan 2024 14:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706306698; x=1706911498; 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=cPu55INOwoo+R5I4TkxjPDT1q0XH169I9oVKNyLzarM=; b=oaEmwjqqryulukgyuMsVx7oBIBceLgoF9Dy4vyFT3YN3HjnKJH+3ORTu4kB8UAPGEb 70IF4CkptYf8o0qKG8XOXwqmt02YUQP6taFycl9yJ5yeEJ6t3BBcsE+QJwpDLIn/xnNN Uc0CtccIlWy7RquzXip6RgyiTZSVF7zqEKhyEYGF92/cZnoNNtA3TP7zmunYeTE7fFWG vW38+Y/frt7KC/HnsOVr8VJ6lsMno071c4khHvw5AW9XnCAQ/NSBK0s7nLkW8h7+t6Ve j0AzCLg0dAcPjJGhCMya9l/kviMlGCIVW2sEqogJf+Pd3zoyD7nGLhGPoZ772qn5V5o8 1aSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706306698; x=1706911498; 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=cPu55INOwoo+R5I4TkxjPDT1q0XH169I9oVKNyLzarM=; b=vAWy9pucDHVb5/gTjcaQStgFIxqhmHNujmbQCFDUO2fVQUtpMzEJEzau57VRxv0JUe PZWbNIHX+sSVahUa5L7ZhvWXJmNj/Sep9FRdIsJjzd6hq26Rxbuj8GJiK61mQznnl9Q6 lA4MubtQYbcUX7Ex4GVLyEh1rda/XJh8JaDCCPDEOe1hQt1rXJRR5E033ab6wMjJBhUJ 1KcxIFeFjc2XwX/YAvRDL1LZrT5dusjdi5Isa/UJAEsCy8+7r4kIXWfAF+JfHnSIJeRj zP7Zd1nzMYLRaXAj5IyOeVHgKzWDHrHJ4Vi1Isc6RD0Yu0DLFyb3LL6Ro5Fi3Qj8eCPc Z2xA== X-Gm-Message-State: AOJu0YzQiE/4ZHu/L7wMZi8NW+u2s6hETWdbKIVbDD97UaCh21EdvJWN 90Z3m0+LoIOXwUaTcCpY89ZJahDadRUOE06FQNQTggNp2iS5hoy27LNUCwT1Vili3Qw2jRmY5qY u X-Received: by 2002:a05:600c:1f91:b0:40c:610d:c2bf with SMTP id je17-20020a05600c1f9100b0040c610dc2bfmr319162wmb.16.1706306698503; Fri, 26 Jan 2024 14:04:58 -0800 (PST) Received: from m1x-phil.lan ([176.176.142.39]) by smtp.gmail.com with ESMTPSA id fi5-20020a056402550500b005583e670df7sm1016030edb.73.2024.01.26.14.04.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 26 Jan 2024 14:04:58 -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?= Subject: [PATCH v2 08/23] target/hppa: Prefer fast cpu_env() over slower CPU QOM cast macro Date: Fri, 26 Jan 2024 23:03:50 +0100 Message-ID: <20240126220407.95022-9-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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 --- target/hppa/cpu.c | 8 ++------ target/hppa/int_helper.c | 8 ++------ target/hppa/mem_helper.c | 3 +-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 14e17fa9aa..3200de0998 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -106,11 +106,8 @@ void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { - HPPACPU *cpu = HPPA_CPU(cs); - CPUHPPAState *env = &cpu->env; - cs->exception_index = EXCP_UNALIGN; - hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); + hppa_set_ior_and_isr(cpu_env(cs), addr, MMU_IDX_MMU_DISABLED(mmu_idx)); cpu_loop_exit_restore(cs, retaddr); } @@ -145,8 +142,7 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp) static void hppa_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); - HPPACPU *cpu = HPPA_CPU(obj); - CPUHPPAState *env = &cpu->env; + CPUHPPAState *env = cpu_env(CPU(obj)); cs->exception_index = -1; cpu_hppa_loaded_fr0(env); diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index efe638b36e..d072ad2af7 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -99,8 +99,7 @@ void HELPER(write_eiem)(CPUHPPAState *env, target_ulong val) void hppa_cpu_do_interrupt(CPUState *cs) { - HPPACPU *cpu = HPPA_CPU(cs); - CPUHPPAState *env = &cpu->env; + CPUHPPAState *env = cpu_env(cs); int i = cs->exception_index; uint64_t old_psw; @@ -268,9 +267,6 @@ void hppa_cpu_do_interrupt(CPUState *cs) bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - HPPACPU *cpu = HPPA_CPU(cs); - CPUHPPAState *env = &cpu->env; - if (interrupt_request & CPU_INTERRUPT_NMI) { /* Raise TOC (NMI) interrupt */ cpu_reset_interrupt(cs, CPU_INTERRUPT_NMI); @@ -280,7 +276,7 @@ bool hppa_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } /* If interrupts are requested and enabled, raise them. */ - if ((env->psw & PSW_I) && (interrupt_request & CPU_INTERRUPT_HARD)) { + if ((cpu_env(cs)->psw & PSW_I) && (interrupt_request & CPU_INTERRUPT_HARD)) { cs->exception_index = EXCP_EXT_INTERRUPT; hppa_cpu_do_interrupt(cs); return true; diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index bb85962d50..7e73b80788 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -357,8 +357,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, MMUAccessType type, int mmu_idx, bool probe, uintptr_t retaddr) { - HPPACPU *cpu = HPPA_CPU(cs); - CPUHPPAState *env = &cpu->env; + CPUHPPAState *env = cpu_env(cs); HPPATLBEntry *ent; int prot, excp, a_prot; hwaddr phys;