From patchwork Wed Jul 10 03:28:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 811765 Delivered-To: patch@linaro.org Received: by 2002:adf:ee12:0:b0:367:895a:4699 with SMTP id y18csp571637wrn; Tue, 9 Jul 2024 20:30:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWX7ZORyWkuGME/vMn1Lh4FuFD5JbdWQcQPo2jeqlMa7I/2CEKomuRkawpxM13hnfbm8HxQnPASCdlaiWKoKXEN X-Google-Smtp-Source: AGHT+IEUsBsRE+QF6NQc1QEGxs3LTzT2Ofwl3JKslTXTlx+pBW2zNKYw4bhR8wcN2lMkgWPHl1/E X-Received: by 2002:a05:620a:5e4f:b0:79f:222:4513 with SMTP id af79cd13be357-79f19c07ea0mr486719785a.64.1720582251060; Tue, 09 Jul 2024 20:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720582251; cv=none; d=google.com; s=arc-20160816; b=dh/5lKHmurJ4iHge1He/WPZqV9idiDlRyThwEhlPYfvyVMIpFYtpMocDPX6I0OEG6m WK/SDwdeYPS2eMSUHz1Mc0fav5c7FWMUV240zYZUoCt/n3d0jdDBSS8u9FQRJ+nPgHAP XJ5roLntOn1bPT2AviSP/00iMV8bVEWNuIbZttCEWf3zewbVuLsTlsLXDk16vb/bQSX6 /gEWDQzQ1DpzEQFizPOAj0qF2JJvwUVaZmHBondVVSa4fPqmDfiPKMD1JCb5c27bdT3f nVzkONRNdxmOzlbHNltPj6Ok52CcoL6zXiQ+r7c8q5yVaJNt5qnpPeHP4RWWY9tzNP5n LpAA== 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=8t94LsejldqmNfhg1NCwYzoxnTmvwOZ4iKKvyvaKHa0=; fh=ghNV7mL7MT64gEZ5PHgzOSgxQoCZ3IZKAHIIlbKGaqE=; b=NoqWTmAnWOIXIT76NAZwt3wac6bLTsawtgKjauob4HhjRNdAk9ULXwFvqQzDIy3zyg iGuL7ZYPVnHpQvlbCTc1D5OItpFZXJWcemKtRYaVfWKs4jJ7cp5HbjJ4IIFRyvToiDJj cu88BVqXRj//oKXksag/w0homiOgOto2AlvCdW3Kj3I/RqvlGod5j6VcRZ+YNkHyZEsU 5Ha+ZVSW5viDkP8aXa/1YnV7GZZpv08k3oX7S5/7cgRjR+BQhlwpS2stkYhOeq/Ilusx ttilEPg3dvdoNwoYEOV9UP5obSr4Nrl80A5iU11kkWqlYtmRcoXnhj0J3ZvcMf7zTYJI i23A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ie7K0hB1; 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 af79cd13be357-79f1900f36bsi373680485a.83.2024.07.09.20.30.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jul 2024 20:30:51 -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=@linaro.org header.s=google header.b=ie7K0hB1; 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 1sRO0X-0000nf-LJ; Tue, 09 Jul 2024 23:28:41 -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 1sRO0V-0000cp-9g for qemu-devel@nongnu.org; Tue, 09 Jul 2024 23:28:39 -0400 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRO0J-0003nB-Qk for qemu-devel@nongnu.org; Tue, 09 Jul 2024 23:28:39 -0400 Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3d6301e7279so3819774b6e.3 for ; Tue, 09 Jul 2024 20:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720582105; x=1721186905; 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=8t94LsejldqmNfhg1NCwYzoxnTmvwOZ4iKKvyvaKHa0=; b=ie7K0hB1o9cGw3Pr5fX7Y4XBK8FCFBu/1DR82GfZ2RBt4EMb32zIh/vjPanOuyhyjX XlRPlaLkgAbhL+1NTGBGYgOiux+dJUkbQdfFPbNM/8+gAsJgMlc0TP5diGq9/WOVJVKv ogf86Y0BtQluNNc8ZFTqF07JweVUQP0oclZ2Ete0W/Lg6K/bnOmwljQKFxfZ76YGnnsH nowe/pIbiVEnJrqdRPqQk4m/+GIBsxE0ukzoJv10lg1F7zPgcjOKG77UnTQQ/ajAv1BG qszSG6I94hKwKsueeJ5eBuxoF7p4WVimrG130M8I2Uwd1pWDfS0NHCVgoVmxbZ+iQxnq xIAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720582105; x=1721186905; 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=8t94LsejldqmNfhg1NCwYzoxnTmvwOZ4iKKvyvaKHa0=; b=iB6AgsscLJTHFMNVY2ODea0q/6XJHtlMaH7GOT+H5tFxBDHc4raWLm0xY23HmjJ+Qv JbBYSKs6XOaVhgHo9oLWDUH6kibdVsqi6XINCjk0DtMWWcESZ1bUoi7LfOLiSX3NzyyI FZBrL+ByOrdNKcwHhJhH2P7IuKZuByFBebW/Yz4qATefqOSutsmyh6jKAktkZxgmYsYx U+ndR8Qw00pa7kk33YD84LtuhQwGKM2hGhY6dAh8Zo8e3vg7jndWMZtfdr9T86+7o4G3 obA7/VaElLQfd84F1SxwRnHNtvcaDaBEVHntGfNtcdmVQbQ8JgulhZ+z3qmug7nVIbod 6p5g== X-Gm-Message-State: AOJu0YyyAAPJml63CgFveaAcSWX+yzPlfj3mRUNtCdb7/PXr8hVE4L0t 3VUGFapGWauabm+9avQE18+bq2UVmqR6Up2uFS6QSaFzzCIJZzlixON71VBQcJ6h3QwCM75agC5 HygE= X-Received: by 2002:a05:6808:1312:b0:3d9:243a:7ae8 with SMTP id 5614622812f47-3d93c08c8cfmr4333386b6e.39.1720582104075; Tue, 09 Jul 2024 20:28:24 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438f5679sm2687280b3a.90.2024.07.09.20.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 20:28:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, balaton@eik.bme.hu, max.chou@sifive.com Subject: [PATCH v2 08/13] target/ppc: Merge helper_{dcbz,dcbzep} Date: Tue, 9 Jul 2024 20:28:09 -0700 Message-ID: <20240710032814.104643-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240710032814.104643-1-richard.henderson@linaro.org> References: <20240710032814.104643-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22d; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22d.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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, SUSPICIOUS_RECIPS=2.51 autolearn=no 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 Merge the two and pass the mmu_idx directly from translation. Swap the argument order in dcbz_common to avoid extra swaps. Signed-off-by: Richard Henderson --- target/ppc/helper.h | 3 +-- target/ppc/mem_helper.c | 14 ++++---------- target/ppc/translate.c | 4 ++-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index afc56855ff..4fa089cbf9 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -46,8 +46,7 @@ DEF_HELPER_FLAGS_3(stmw, TCG_CALL_NO_WG, void, env, tl, i32) DEF_HELPER_4(lsw, void, env, tl, i32, i32) DEF_HELPER_5(lswx, void, env, tl, i32, i32, i32) DEF_HELPER_FLAGS_4(stsw, TCG_CALL_NO_WG, void, env, tl, i32, i32) -DEF_HELPER_FLAGS_2(dcbz, TCG_CALL_NO_WG, void, env, tl) -DEF_HELPER_FLAGS_2(dcbzep, TCG_CALL_NO_WG, void, env, tl) +DEF_HELPER_FLAGS_3(dcbz, TCG_CALL_NO_WG, void, env, tl, int) #ifdef TARGET_PPC64 DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env, tl) #endif diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index d4957efd6e..24bae3b80c 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -271,7 +271,7 @@ void helper_stsw(CPUPPCState *env, target_ulong addr, uint32_t nb, } static void dcbz_common(CPUPPCState *env, target_ulong addr, - int dcbz_size, int mmu_idx, uintptr_t retaddr) + int mmu_idx, int dcbz_size, uintptr_t retaddr) { target_ulong mask = ~(target_ulong)(dcbz_size - 1); void *haddr; @@ -296,15 +296,9 @@ static void dcbz_common(CPUPPCState *env, target_ulong addr, } } -void helper_dcbz(CPUPPCState *env, target_ulong addr) +void helper_dcbz(CPUPPCState *env, target_ulong addr, int mmu_idx) { - dcbz_common(env, addr, env->dcache_line_size, - ppc_env_mmu_index(env, false), GETPC()); -} - -void helper_dcbzep(CPUPPCState *env, target_ulong addr) -{ - dcbz_common(env, addr, env->dcache_line_size, PPC_TLB_EPID_STORE, GETPC()); + dcbz_common(env, addr, mmu_idx, env->dcache_line_size, GETPC()); } #ifdef TARGET_PPC64 @@ -320,7 +314,7 @@ void helper_dcbzl(CPUPPCState *env, target_ulong addr) dcbz_size = 32; } - dcbz_common(env, addr, dcbz_size, ppc_env_mmu_index(env, false), GETPC()); + dcbz_common(env, addr, ppc_env_mmu_index(env, false), dcbz_size, GETPC()); } #endif diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 2664c94522..285734065b 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -4458,7 +4458,7 @@ static void gen_dcbz(DisasContext *ctx) } #endif - gen_helper_dcbz(tcg_env, tcgv_addr); + gen_helper_dcbz(tcg_env, tcgv_addr, tcg_constant_i32(ctx->mem_idx)); } /* dcbzep */ @@ -4468,7 +4468,7 @@ static void gen_dcbzep(DisasContext *ctx) gen_set_access_type(ctx, ACCESS_CACHE); gen_addr_reg_index(ctx, tcgv_addr); - gen_helper_dcbzep(tcg_env, tcgv_addr); + gen_helper_dcbz(tcg_env, tcgv_addr, tcg_constant_i32(PPC_TLB_EPID_STORE)); } /* dst / dstt */