From patchwork Fri Jul 19 01:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 813368 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp545118wro; Thu, 18 Jul 2024 18:09:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJQg++jpdvdJfckWF+CMmRFL1sEstk8B8r8ejvRA8gy9CliJF9iLm3P9xWHt6K/loH13NWabQFVg8PxpuduFCf X-Google-Smtp-Source: AGHT+IGnSqqrW0p0iDHxld/eG41X3pFGTpf0jjSFhVFB4ZR8CwfNrTY4AQQr0TYqWscLi07aqRRW X-Received: by 2002:a05:622a:c6:b0:43d:f946:faed with SMTP id d75a77b69052e-44f96a56a95mr34549541cf.26.1721351361241; Thu, 18 Jul 2024 18:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721351361; cv=none; d=google.com; s=arc-20160816; b=c7p0xtxuvGXLtVrgC0nC3SLMj1ZcjUmtuvofu4Unv1eWsMI/j7xLC829AaSMJcaejd IA128J2qFScZcvhhOHy5IUGxgQXqzirSDYHA/xhLDp4/w9EcZYM6lzEKzNBl8hTCaj5e p0P+g7bOAiP2qXkTmcu/3x7jFYnWJ2TX0jM44FabMRLzMhnJeTJH9e8FM0aeF08kNtMw EwBBRNRAvTmKfwZ65YvT11YusUxs+UgYsfiza9Gh+jkEpKtWyLKOxRUr+xs28pd0aHN8 YCbQU9lSC/TmzvSWZ0ZkqA2MhCUCPHztgjWqw2SpxhEcV2uhteF9y1xc1O2FjMzh/BFC wmPg== 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=qvZQYGxfhFbqPHPcUgtNXtbdH2OSgyvIGjZjBPS5VAI=; fh=/Slz4xbUrbq3y08cw9sY58k/LHu7k+IMs9GTwVwwc7g=; b=n7m7McmXYf25DXd9LrGFFEO9paU1NLWDXMoiqcQdyJKoLGQUJJPHAZaZvd3Gkyii/M He5jt70puN4x0dYzEBZUI22XkfOyvvo6zlf1/E4YGUuhFUN/TEpygW5jVVxpEmpydBi8 pRT1dzMC+Mi0FPd8e+eC5WCVI+QoiWG5kWcC64/4YNXbWqHMYI7u/JqZ/jiO+eT5R4IQ 35+IcVy1viWYxEfrvFIv5PEpKEtc1sBx3revK/xShGBvJxzo2BXeC/5nNhlkOmhWlOzQ EBBx5QESHVDU8u0q8/YVhFGAQSPlglnKIgK3NHnfAac8R1QBYHIUTj3rjoZeMEydlz3n StcA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qp/x/VGL"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-44f9cf05327si4245811cf.658.2024.07.18.18.09.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jul 2024 18:09:21 -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="Qp/x/VGL"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUc6c-00053Q-GX; Thu, 18 Jul 2024 21:08:19 -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 1sUc69-0003iK-70 for qemu-devel@nongnu.org; Thu, 18 Jul 2024 21:07:50 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUc62-0000q6-HH for qemu-devel@nongnu.org; Thu, 18 Jul 2024 21:07:45 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fc49c1f3e5so13757575ad.1 for ; Thu, 18 Jul 2024 18:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721351260; x=1721956060; 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=qvZQYGxfhFbqPHPcUgtNXtbdH2OSgyvIGjZjBPS5VAI=; b=Qp/x/VGLybP0vyIxTGb+r6mCd8Zl1fLG16iE0QcK4JmBKN5F24wtlZheYeBmIPTRjY v/IbZg2QjfsBMlGy0PYxigUJ6omZ7p6r63vu9fsvRNuCzkVBHHsRScu71i/pVn1OkNli yplbRVXDp7dogSEip9DRDUyyHsLB4MMZQnIUTngy4GT0Rj3OqoyOuegjrycyecIE6P52 4HKKUS7E74uTm+JdQgmGGUbvtcV8G99zjSGGXsCVaUcnsPWl8MSmDmVwBBeyos/aOvwK KIB2Y/tBFSixOxG1Qga/9xtck5ksgZUNkWPUPdhe216BZf7mKRS1pzdkjbBC+N7zcVUy PGsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721351260; x=1721956060; 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=qvZQYGxfhFbqPHPcUgtNXtbdH2OSgyvIGjZjBPS5VAI=; b=fgl2bOEVJti3gRCY6A8BKMeymdMmOMhobLnPOrimCjabWhZHhWTSaEoTyb+mRuhduM +nUfhRyl3fPzPMzw33vsUblEk2MuzawYMoCptvOAGMIkjXG+4MyXk+cda3ZNATGanVCQ xP6nA3oLuSInvI1hHC+pjb6LsRaHkk1PuEihLDqd0LADusiB7OGuLP7Jy2CJ3Zqh//oU 4+GkT0/C9bb3Po4oEfDxqlbGrJ3hgBXW4BglB+GaQuy3Phxjysb0KWjigBe5gNCleQF2 nv8Nm9X5jXySvkOO41JSHsgVChBVhhT6Wn/RGnaMTck2/T+qHR/p8QL/EOavIiDEWAag +wMw== X-Gm-Message-State: AOJu0YxiwN8ETFSPKLUCKqmcigJ1Gv3Y0vTbzPBdtLtg/tkKyO4eI4MZ g92WeV4NIPDwp5Ona8jbclkz4hWEBoYU+zSa0uC0+gOuXzmfYAw26+OH5cGrTX/hoP9v3g2cAEs MiWUxpA== X-Received: by 2002:a17:903:2451:b0:1fb:57e7:5bab with SMTP id d9443c01a7336-1fc4e16191fmr52789145ad.36.1721351259904; Thu, 18 Jul 2024 18:07:39 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fd64d07ad9sm2067415ad.177.2024.07.18.18.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 18:07:39 -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, Nicholas Piggin Subject: [PATCH v3 07/12] target/ppc: Merge helper_{dcbz,dcbzep} Date: Fri, 19 Jul 2024 11:07:02 +1000 Message-ID: <20240719010707.1319675-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240719010707.1319675-1-richard.henderson@linaro.org> References: <20240719010707.1319675-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: 37 X-Spam_score: 3.7 X-Spam_bar: +++ X-Spam_report: (3.7 / 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, RCVD_IN_SBL_CSS=3.335, 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. Reviewed-by: Nicholas Piggin 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 9e472ab7ef..cba943a49d 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 */