From patchwork Fri Jul 19 01:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 813372 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp545289wro; Thu, 18 Jul 2024 18:09:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWwQxKvf8dE2KX+XDgh7xFVt9Qzi2ccv3+ykDA8yDSpn81DC4iLDmOF1Y91sRgug0fdcMH3nMwSE6NwcZwtwTsC X-Google-Smtp-Source: AGHT+IEN25Cov5KqnfXlhfI7LINEOa1RtiksrR7rXR1VBKdJjZI3egeU0qfm6vzJi/t7YDYIZLhY X-Received: by 2002:a05:6102:554c:b0:48f:e69d:5953 with SMTP id ada2fe7eead31-49159885c8cmr6962981137.19.1721351396084; Thu, 18 Jul 2024 18:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721351396; cv=none; d=google.com; s=arc-20160816; b=uNxjTBk0gbqiZwvCviv5IM8A4jFK0cfCY+lT7y1CI0hR7VCOwm0rOt4kCNKMpqfDfM ICJME4HnsAb04WxebOoI/1lU5V8c5t+Pyfb+uIE0xa+k3Cx0qDAjT/zfI++HarrxxabV kVXP/oT2busrGo1DSsoAZjLHbj+WpcX7H8hFMFNAxwkaM+vobkmgZYOZfKUR8BquArbG kXdXvgji4G8DlHypmt7V08sCNvs6JsdJ/wqVBLv0SRIU6p0JZ+Rupx3q6Hg5ym32/2QB hW24goqyebM5QbteuVoMrNhNjc38fTc0yn1a3e5jzdcvb3dT3Z3U8mJlJRxlrNmjxtzY 3E7A== 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=qQ06f1POln3X8Sb8fDa8/CDLulrLL54olCBz3brWMPA=; fh=Rc2oOAtVcw1QgMi4H4R5cDBav9mgTQMB7BmgqsQhSJ8=; b=POgZEusf4q8j68aVCJIfZNOQB6Bw7BsXM5/zvPc3ONNbb9WMekwKXRtvptsMqz74Pu EJWps5Qk4ZId6UwmfYfv976IVTbhc4d7RHDf5NbzOb9Mg2gEp1SLflIMe2rT4XkvX8Yp FZEdiGmt5c5Kzc4bCrwnLo6pBeZ8YEf8Trpn3+JKDk5q7Zcz4WEKGegd4LjK6peTR1Vx VqzSmZrv3qjZW+EvJAoQY/Azk5UOlEpaMZ/XNXlznJVy1QwWhQj3hg0kyUVR+EhOQzcF +RbZRlsHlvnXPLJqMssVzAhsY/9JDjzw/CfSLzpz73WztH5LmVPag/oJn/Asjh2BPcJx 7Gbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HIgrXQvi; 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-44f9ccfdd56si4608471cf.71.2024.07.18.18.09.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jul 2024 18:09:56 -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=HIgrXQvi; 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 1sUc6j-0005hV-Qg; Thu, 18 Jul 2024 21:08:25 -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 1sUc5y-0003Hx-Ui for qemu-devel@nongnu.org; Thu, 18 Jul 2024 21:07:41 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUc5u-0000ml-MG for qemu-devel@nongnu.org; Thu, 18 Jul 2024 21:07:37 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fc4fcbb131so13396695ad.3 for ; Thu, 18 Jul 2024 18:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721351253; x=1721956053; 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=qQ06f1POln3X8Sb8fDa8/CDLulrLL54olCBz3brWMPA=; b=HIgrXQvijkfwIOy0gZzA5J5UwBcIKZUzRC+Jyo3xzqNlBZG4WjXb3zP5Mb0Ews37sp 0iBkAH7iQ45kgAHY8gZbIHvCdAZghfZVxpP8I8wBtDhyqYuS9EttXICk4j1Vv2E9aaoe Waw8jD2rR3gFQIqI64edXjGldGJlrSyUsc9cOeRbRsvQ4dg8I4a/Kh8/4kNHDT3rUulJ F8LWIZmTizxMwc6odIaVZEy2Wnwau1haoVXONYkO2ZWErSgZRezY3aNERNszuUsaSRrY ab+neIXBox/Z0eqeKqKcynXOKjEU+5b4CWOhpKQ+9LZvTQhZZ8Rbvi7+dZMsygRSIV6R WDlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721351253; x=1721956053; 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=qQ06f1POln3X8Sb8fDa8/CDLulrLL54olCBz3brWMPA=; b=bAWoLBqwJJ3e3os0n3obj0mmRY8kLHcyWKjYAGO1kZABKskVFwpPH9SnypB7nxwkyW DRJp8mSV7bmQ+bt7WAPFp/Ks1QupeKrMxbCz0J7ZelbYyn2J7w4yhysooajve39OM402 UmTaY1PatgnxS7sxHrtwnBPsuR2KPFPXDGzaaRNCsHfaSoEkxEmA9wSv2kG9KNirg2nd r9509fb1V7qdRzyXI95mzH0VmDh+A8dYdR1sONd81uFJqTi6MVh67REMId6HEj0tM3Qq p3uSstaYAKUdzHYXGAO6xLH/RMd9dgAIJvUH5VSMWeBTmff3pigTbuivk/U3ifmsg4/7 CSAg== X-Gm-Message-State: AOJu0Yz6t4Mx0pQHz0PbprGXmaLhlCd0CbWtsrGs752hPxtBxRa+GUls o2c7te0WWOiN/uWOqt5GWU5dQU7yKzP00XdJXEFSBxR6DgO9YKqD0PqhKk1eYJBykmCMBp58/aW xWCHzvQ== X-Received: by 2002:a17:903:41c7:b0:1fa:8f64:8b0d with SMTP id d9443c01a7336-1fc4e154b4fmr67172795ad.4.1721351252633; Thu, 18 Jul 2024 18:07:32 -0700 (PDT) Received: from stoup.. ([203.56.128.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fd64d07ad9sm2067415ad.177.2024.07.18.18.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 18:07:32 -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 , BALATON Zoltan Subject: [PATCH v3 05/12] target/ppc: Hoist dcbz_size out of dcbz_common Date: Fri, 19 Jul 2024 11:07:00 +1000 Message-ID: <20240719010707.1319675-6-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::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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 The 970 logic does not apply to dcbzep, which is an e500 insn. Reviewed-by: Nicholas Piggin Reviewed-by: BALATON Zoltan Signed-off-by: Richard Henderson --- target/ppc/mem_helper.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index 361fd72226..5067919ff8 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -271,22 +271,12 @@ void helper_stsw(CPUPPCState *env, target_ulong addr, uint32_t nb, } static void dcbz_common(CPUPPCState *env, target_ulong addr, - uint32_t opcode, int mmu_idx, uintptr_t retaddr) + int dcbz_size, int mmu_idx, uintptr_t retaddr) { - target_ulong mask, dcbz_size = env->dcache_line_size; - uint32_t i; + target_ulong mask = ~(target_ulong)(dcbz_size - 1); void *haddr; -#if defined(TARGET_PPC64) - /* Check for dcbz vs dcbzl on 970 */ - if (env->excp_model == POWERPC_EXCP_970 && - !(opcode & 0x00200000) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { - dcbz_size = 32; - } -#endif - /* Align address */ - mask = ~(dcbz_size - 1); addr &= mask; /* Check reservation */ @@ -300,7 +290,7 @@ static void dcbz_common(CPUPPCState *env, target_ulong addr, memset(haddr, 0, dcbz_size); } else { /* Slow path */ - for (i = 0; i < dcbz_size; i += 8) { + for (int i = 0; i < dcbz_size; i += 8) { cpu_stq_mmuidx_ra(env, addr + i, 0, mmu_idx, retaddr); } } @@ -308,12 +298,22 @@ static void dcbz_common(CPUPPCState *env, target_ulong addr, void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t opcode) { - dcbz_common(env, addr, opcode, ppc_env_mmu_index(env, false), GETPC()); + int dcbz_size = env->dcache_line_size; + +#if defined(TARGET_PPC64) + /* Check for dcbz vs dcbzl on 970 */ + if (env->excp_model == POWERPC_EXCP_970 && + !(opcode & 0x00200000) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { + dcbz_size = 32; + } +#endif + + dcbz_common(env, addr, dcbz_size, ppc_env_mmu_index(env, false), GETPC()); } void helper_dcbzep(CPUPPCState *env, target_ulong addr, uint32_t opcode) { - dcbz_common(env, addr, opcode, PPC_TLB_EPID_STORE, GETPC()); + dcbz_common(env, addr, env->dcache_line_size, PPC_TLB_EPID_STORE, GETPC()); } void helper_icbi(CPUPPCState *env, target_ulong addr)