From patchwork Tue Jul 2 23:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 809144 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp443441wru; Tue, 2 Jul 2024 16:47:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXz3ZcUF+WGZmB9GnQmgs7iANpfc8qO36SEdlp8x51kRZIk+DgQe+wVhWgp4p5NrkvjUUL0C00VZFlqsPoer6mL X-Google-Smtp-Source: AGHT+IHy0Ds/gZ9DqRdX/T/Q42YjU30HlKzoA2Ac/I1+U5aSJLdm0YY6TxB4Y8wSEL7+vzcgM7AN X-Received: by 2002:a05:620a:2911:b0:795:5842:2457 with SMTP id af79cd13be357-79d7b99e0acmr1576447085a.15.1719964060527; Tue, 02 Jul 2024 16:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719964060; cv=none; d=google.com; s=arc-20160816; b=x8s25l7tYk4klA4LYr7s9sjjJ6xznzI0mNHxEVkHK6k0aRgpKATqzc53bQE9qyq7p2 dbzWNGorsglEGhqfOS+tRmSuOigvMprWLytC7RwZbaLxc/TAKI/MmdpGb7hfZ1sug9gl mxzRJPKCmHoZeSWmMx1q6mlXOl7BX81nSAxYl0E0LhZPebKjWyXnYyLF3eEwOONdd5rz Yf8OycwLTqWOBtsk1HfJIeCWZnIf1959IlNGgyHswBMvem2IPxvogOsHrv2kpwGJgccn DJ1rYWuNZctYR25jzmwYyAt3BZ6GCEcV7nmgnKWcljNIPm87hSeCYyf+HFrmpArnh5C8 pXPA== 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=iBbLHGYBkBp9/gobRLQEvALvdonH56rxBBHwTgA3fhU=; fh=0YTlrtA8XsSn/NGLxPm6Cl+1ZmYgEb6/q0YMfRT+W9g=; b=tYp7horC3n31rm5CtE4cO5QBdkzX++ui/Z5B77Rr463pCEgzI3/Ll9HGWv5tjh1A6n v8CkpapdBggn/zjZHAKrWeD+jSIIinnapkQw0vV66AEc4TN7P3cKO7b/abAb9cqHuq1D bQagrEmG6uXcmOtZXyMs1Bt+DfIt07AkeLKXqUFKhn+p8ubfVj1ddV5yATZFuSispfGK WKmWOqc93qcmdlRLNgeEtQDuHb4+GvSK7d08ka1oYSrj9ZCIaLg2GM4OWbtBbbnwyp+f ClLAPt71sXTJ5wruruaItQyAtaz/i+A3hfgkb8lhVYSyfvqiGm/Cj0PIpeAP6XOReTJ4 1i0A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="La7hAA/Z"; 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-79d692f13aasi1229709385a.251.2024.07.02.16.47.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 16:47:40 -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="La7hAA/Z"; 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 1sOnDM-00024O-IH; Tue, 02 Jul 2024 19:47:12 -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 1sOnDI-00023c-KH for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:08 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOnDF-0007VM-Os for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:08 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1fa0f143b85so34254225ad.3 for ; Tue, 02 Jul 2024 16:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719964023; x=1720568823; 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=iBbLHGYBkBp9/gobRLQEvALvdonH56rxBBHwTgA3fhU=; b=La7hAA/Za7VfNFrD0It8cK4uq9sq0ZCbXEEVkN0yrIkMXpuuTRpNCKH1aV14akLz/l em1ajFMAmy4VTLUtknfq6zpcNI5XsqK55MNgppq1AzMQQrN4gqLswRhebEiG5D/zfeSQ RB3Z39p9oQ+9Vs3ZNMwstQub1LMKuEwpNCWjywwWBsi/OEBtewq0PnkrcjJNZO1HCAah P6MqYh+5q391+81URqqRHZoQghgJPjUhRB61yvW2BXp/mnY/z9hyYpSXz8WlDXoxsvGq 8q1mLZIV7BMUad6H8lA/+gG0jCQXAYoC0lJAsAxsfwE3J3HawBEJyTVFbgKJl+shvcsU qsSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719964023; x=1720568823; 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=iBbLHGYBkBp9/gobRLQEvALvdonH56rxBBHwTgA3fhU=; b=pEwwDzJrB048oD3o1tq/1/JjEmP/H2+pihjD3h+7ikAHNN4RGg2XKE8Nc05nVrfqTu M3knysflvM1ia8Xe+NrARX5DkDPJFaL180rSnt/ymUv3/ki4CHbtwOxGbiX+fRp0biBB SkE41BA8SwhxA9DB6da7Jaotnm7NiBD+/KOYWPSPk4LvUqrBND8K3u80BkESAaIDkJJe 1wYaQBF4ujnfQ4fFfOdf9RuvBcmTiYVBneRZrHgdNgcbR+zkkIE5s1a/JmxORCQG2E5s 0RNdH/tvljfhlG77hnfMuNiSsmaZEqSC78rQgCdzIJbvV1aRu8VNOtKd4HGsvJHkjA5O +aTA== X-Gm-Message-State: AOJu0YzGLGT5pF+zI01c6eFH5t+ciZUnzC4uRx8pvZhKE5mva4DAHs0i kL7IoR5QUFaRzEeND59B+S7mp8fOXrXgo8jNc+GgcSkeSRr3rKLkK8TbKWW0uw8ndhHOIy+U4Cb d X-Received: by 2002:a17:903:41c8:b0:1fa:acf0:72a6 with SMTP id d9443c01a7336-1fadbca1b56mr69196555ad.28.1719964022899; Tue, 02 Jul 2024 16:47:02 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1535e62sm90147045ad.154.2024.07.02.16.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 16:47:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, balaton@eik.bme.hu Subject: [PATCH 2/4] target/ppc: Hoist dcbz_size out of dcbz_common Date: Tue, 2 Jul 2024 16:46:57 -0700 Message-Id: <20240702234659.2106870-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240702234659.2106870-1-richard.henderson@linaro.org> References: <20240702234659.2106870-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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 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 The 970 logic does not apply to dcbzep, which is an e500 insn. Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- 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)