From patchwork Tue Jul 2 23:46:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 809146 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp443555wru; Tue, 2 Jul 2024 16:48:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYwF+ZEPL0ueTrJts9EQdk2I+IZ3/U/GIbnfGy6op9KAZBXz05Tt6favvCSXxZ9Gr5veT4HMusvAWrqifOLElP X-Google-Smtp-Source: AGHT+IHfaK0MjMJb7/BsvKMheeAZh5cldQ/bJjmolftfcKhv4xswxyqxjuXiK+6nYeFDx5LPAGON X-Received: by 2002:a05:620a:4709:b0:79d:5399:baf5 with SMTP id af79cd13be357-79d7b987e8amr1190178285a.15.1719964091202; Tue, 02 Jul 2024 16:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719964091; cv=none; d=google.com; s=arc-20160816; b=HIQ6ymoRjIKhpX91WXFHlVE0MvNuzau0QeqZl6/sY8ssF4TwOYoVQFZRJ8iOId9XFL 7oylHT3u9YHKRoRZ6LHuDo5ts1YnKSeFB4TGkcQc5JJvK/3B7iZF/1+lKbez22X08+if rNJzWiQzNFWuErAizM0FAIvhK6Ditm2+7+W3DTrXDHqj8WZ4OaHzVrsrsG8uk4u1omA6 3N0hCSpIJyLbdMzF0ytO1cOQzmDdlpwgfLQPYHue2NVtHtYLEp5DbV0kV/RplFnxCLay PJMjWd0PSd2plS/Ng3J44jHW4mCYf/b5A5gNYFglFpPTC6rNDyXn4AUy9mvz1CJatqAJ rsiQ== 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=dbZQwN4l72NfnRdu4dMv7G4q55sco83AM+p/oHKAQe8=; fh=0YTlrtA8XsSn/NGLxPm6Cl+1ZmYgEb6/q0YMfRT+W9g=; b=0ft2wzacRvRP101vSKOBncghq2Le3eZIbWvzOCUhMqAiuvtrtG00oUM7q+ZnuTWNTA T6mVHm8fXANQXMyt4LZVxxLVx6ayYtBBTG9SAyXk9qipUHK6LAbmdTp7UxzHzPfTR+oV 2fIQYeQDFlJ5Jdgo/woqqOl4XHpA4wPwanpi1BPw2jErv5HKQwVJIQX9Pyx4tCYhD5Ft /lSmTuv5Zo6IWmK6q0VVJPO0KoBCcsbxTzbNzOkskDIVH9iWzRGAwBpiJGfw2W7kz1sU IepuxvIsRUJ3P/hU1HE+sDIgHVdA/UTqhi0j0dOy1yFEEBGGOZubq5E3ayiByOluQdvk 2sfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r/2WAJJX"; 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-79d6927adaesi1138433285a.163.2024.07.02.16.48.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 16:48:11 -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="r/2WAJJX"; 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 1sOnDU-0002Bw-ST; Tue, 02 Jul 2024 19:47:21 -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 1sOnDN-00024W-1D for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:14 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOnDG-0007VI-Vs for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:12 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1fafc9e07f8so8496015ad.0 for ; Tue, 02 Jul 2024 16:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719964022; x=1720568822; 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=dbZQwN4l72NfnRdu4dMv7G4q55sco83AM+p/oHKAQe8=; b=r/2WAJJXXosDDjwGFSBIYC00w0Wg2XUsZf01jE8XeS2aHGW7nyCT/3/COwOT7ATcTF uYrCMwPo5pWg9Ja5uVkvPjlcHmboBjoTzR8xHDD2+G26xXbVaVRaKQNLasyu8OBtcyvn YI1ZW/FeC2QywOuhkkaDrYvL4jmquJMu7iIYqPgptkE4AMPrDX5ctOHhzKbodsYTPsmQ PiM6rAr11Qdben/MpbiUv5x5Cys9goBmuYoISJRovsHcrK/ZHhJFj00Ud4gHIpJ55R7l qu61GLaAwc+yqV8Ij4BQIZKewBcoNBlT/HAMn8K+J1kF47UCCIOrSjRn2c+oimQMGi8/ DTgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719964022; x=1720568822; 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=dbZQwN4l72NfnRdu4dMv7G4q55sco83AM+p/oHKAQe8=; b=f3zzVh9N8kYYwKWBIJRlq+a6WyMi6Ydn0Lc7eONsj36Eqyv/9YgGAwdZwMIj7DiXbQ bUyBzABG3ZIA8m0UULhvjYB7K9cQS5YJqBjqMmR8PwMLQI7UIpOdTnzEfOXdiIPEzJj9 uDHcXc9bJwPEFIfqyaAVFt4vbTEYakFQJO9BiLhe2QZYsd0FB8YlQ+ErqNkt4+kyJVQ2 NoajhnP33Z3qo2WvcZMaIXMfaCTRkpgHSqyIOL+YTkIJLYpSr4Hc/8RQjyalE3k0eIG0 SjPep4FfKqK+arEhu5etk/CIzvWm0ieL0ymGmVvZQAbXqLQ3Z/GPxS32Ik7S5ULTHKMP hCdg== X-Gm-Message-State: AOJu0Yy6Gu4D+1+tKTAwYwSLGFq0NF/IHxR22u5dXvEXFI7Olx8Leult h3Scxgt4ZOdm5IkJZU03m3HjSd9Xw8Ne+rMCJr7KECwFDgCFefM/mGLuuJcyZ+hFO45G3Eq8+to q X-Received: by 2002:a17:902:f611:b0:1f7:1a31:fae8 with SMTP id d9443c01a7336-1fadbc85fc7mr117478325ad.26.1719964022021; 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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 16:47:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, balaton@eik.bme.hu Subject: [PATCH 1/4] target/ppc/mem_helper.c: Remove a conditional from dcbz_common() Date: Tue, 2 Jul 2024 16:46:56 -0700 Message-Id: <20240702234659.2106870-2-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::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 From: BALATON Zoltan Instead of passing a bool and select a value within dcbz_common() let the callers pass in the right value to avoid this conditional statement. On PPC dcbz is often used to zero memory and some code uses it a lot. This change improves the run time of a test case that copies memory with a dcbz call in every iteration from 6.23 to 5.83 seconds. Signed-off-by: BALATON Zoltan Message-Id: <20240622204833.5F7C74E6000@zero.eik.bme.hu> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- target/ppc/mem_helper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index f88155ad45..361fd72226 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -271,12 +271,11 @@ void helper_stsw(CPUPPCState *env, target_ulong addr, uint32_t nb, } static void dcbz_common(CPUPPCState *env, target_ulong addr, - uint32_t opcode, bool epid, uintptr_t retaddr) + uint32_t opcode, int mmu_idx, uintptr_t retaddr) { target_ulong mask, dcbz_size = env->dcache_line_size; uint32_t i; void *haddr; - int mmu_idx = epid ? PPC_TLB_EPID_STORE : ppc_env_mmu_index(env, false); #if defined(TARGET_PPC64) /* Check for dcbz vs dcbzl on 970 */ @@ -309,12 +308,12 @@ 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, false, GETPC()); + dcbz_common(env, addr, opcode, ppc_env_mmu_index(env, false), GETPC()); } void helper_dcbzep(CPUPPCState *env, target_ulong addr, uint32_t opcode) { - dcbz_common(env, addr, opcode, true, GETPC()); + dcbz_common(env, addr, opcode, PPC_TLB_EPID_STORE, GETPC()); } void helper_icbi(CPUPPCState *env, target_ulong addr) 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) From patchwork Tue Jul 2 23:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 809147 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp443584wru; Tue, 2 Jul 2024 16:48:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXM+akLmt92yZg3feiTej20ZbtuIf97yzSlmJk1GBKJlxcfHC6uLpuVsV5VjCZ4Pk6hUpE7JyE+83h3eOZNsEHB X-Google-Smtp-Source: AGHT+IHEDN7mlYf0rydlDtt6WjWZ/C1FaJxcx71Q1kzFpvoCA3WM/0Ex52tKrNFWq0QQilesPxRb X-Received: by 2002:a05:6214:ca3:b0:6b5:71c4:b8dd with SMTP id 6a1803df08f44-6b5b7098c91mr122383206d6.14.1719964100474; Tue, 02 Jul 2024 16:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719964100; cv=none; d=google.com; s=arc-20160816; b=0S73mXDyEySdDBvKOBvyjXAT9XsYnLSLUpb39I/tPcU1dhyqbcPPiikWzOEtQyjDAP tfNtPmLvCKjiAKZJqACUsJeH+78kVb5VB/Fov25Y3Fo5raceDUKgzfp6um2rcaBlNyvj zW19J+RVYzEsqLs9PzJlh/paOF+piay/UMLZbxqfPEoXkrDDmsHoPIHDRFrvsi0Beq0n rtFvuWZW2jRj0Ump+ujTW15bz4TuMt1khXeB++UArnkcs5zG1JNXiLPvi7v0E/lINyog bb/HI3+tSp6dca7uiQ3mAGKaltFxprSFSeWwSppE93bdOIxl2d/409na+5PU+P+7JCyx Y5NA== 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=/97R44ZbYpqM6mlWBYqM01l2PIY00KEtifrsfqW+GKQ=; fh=0YTlrtA8XsSn/NGLxPm6Cl+1ZmYgEb6/q0YMfRT+W9g=; b=EhGHNKbl7LK54MfcyhgNM938V7v+HN+1fsU4XHJFcV3ZEVdpdQHfCGLawr2D+inKjl H/K9W8JEYwi92DRFRPbMyOAy1OqUEFuChF5GMelgrVSBe87PmUQnXa7PLE5q9oxGusIM 84A5Z04N7EeQauXYuzYpIvVj4mQI9Xc/YodXtYpQ4/72L3GtT8wJsZ0u1HvqrY0lYGcn 00xGW+TIs5/m5yxp6TGS7Ds8naKpWNzfgEgHJMruLaCh2ytUKtJJSfanuRr4A8ACcAAS HRUR4CZmCU8e1H0btDx544/YdV4+O6RcL27or9pmcpP1s7XwhN6CY/h+ac4Tj0FTcN8/ QNEw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CGTPgF5w; 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 6a1803df08f44-6b59e363513si119199006d6.43.2024.07.02.16.48.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 16:48:20 -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=CGTPgF5w; 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 1sOnDT-00027r-0q; Tue, 02 Jul 2024 19:47: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 1sOnDM-00024A-0t for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:12 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOnDH-0007Ve-R4 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:11 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f480624d10so35859575ad.1 for ; Tue, 02 Jul 2024 16:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719964024; x=1720568824; 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=/97R44ZbYpqM6mlWBYqM01l2PIY00KEtifrsfqW+GKQ=; b=CGTPgF5wS+7fi+FJHFUwrDMqA+qz1O3aqs7f77LZ5Kl3h6YgS1NKZsQ1iObrxKftHU 5QnfflqFc/tNA2A4XmcPzy566ZOFTxt13Vy16cCk2vrnLF/E/KgWXJnFTBBWQYLj9Hdm /6A5Jy/66f3dm7PNpVRSSA0pvN9WLtCvYZ8/agHWjMyQ2Ti2FdTcovuqzQHNin3+Ke+6 lptUno2PhZsvNQAsyM9pTmEKG34sxA32xjEaepwDRau2fhM8GeTehuWwGaMk7XtEJZ24 lndDCGACC54O/4BZjmY8jbM0LwlDNxmEwlpLM3WrkgdT6wY5WljYPxrB8wFhNsRBVpWq IAaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719964024; x=1720568824; 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=/97R44ZbYpqM6mlWBYqM01l2PIY00KEtifrsfqW+GKQ=; b=O8SkQj9Rf7QHmIjbtrQ8J1zZj1tcTp2eNRYP+LmgIhL/WCEeUzKOOC6NNoF2TRS35e YsbrqVz9Cz1M7AqZJZ1Pfm3FfXQOTacsu1jh88ZiQ6EtWAqTISJVGpmeLZZmxGjrh5d2 00CJJ8KDsdbGDNMT2BBO94JAJlxK/ZFKCqy1iMeH5PYev+QJhSOrVWDIupz7g7ZAYmON E4ourzHMp6emlNNCo0g+nft0U8/CNms5Kr6k/HI+8PKE0cidrr+R4Lb5CEY+0VlTX4PG FVuV1n5YOABhts6XaW5MzQDsg6kZH5Pg2RktZxgOhi97NecyF1wJUsOH+17W3roI8Biq 0sbw== X-Gm-Message-State: AOJu0YyynocKw3vgLV6lKpgJw7Z0ZQaXvjzExgAliWFWJAp6WNipLNjn fZUqJZ0LpBRSc++nqBgSy+eIJj24lME7fgtxKRpDj9tdYACNHiC0hln05YzKkUygMiyhHFXjDp/ P X-Received: by 2002:a17:903:191:b0:1f9:aa05:878f with SMTP id d9443c01a7336-1fadbb4c3e7mr98720645ad.0.1719964023964; Tue, 02 Jul 2024 16:47:03 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 16:47:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, balaton@eik.bme.hu Subject: [PATCH 3/4] target/ppc: Split out helper_dbczl for 970 Date: Tue, 2 Jul 2024 16:46:58 -0700 Message-Id: <20240702234659.2106870-4-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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=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 We can determine at translation time whether the insn is or is not dbczl. We must retain a runtime check against the HID5 register, but we can move that to a separate function that never affects other ppc models. Signed-off-by: Richard Henderson Reviewed-by: Nicholas Piggin --- target/ppc/helper.h | 7 +++++-- target/ppc/mem_helper.c | 34 +++++++++++++++++++++------------- target/ppc/translate.c | 24 ++++++++++++++---------- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 76b8f25c77..afc56855ff 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -46,8 +46,11 @@ 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_3(dcbz, TCG_CALL_NO_WG, void, env, tl, i32) -DEF_HELPER_FLAGS_3(dcbzep, TCG_CALL_NO_WG, void, env, tl, 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) +#ifdef TARGET_PPC64 +DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env, tl) +#endif DEF_HELPER_FLAGS_2(icbi, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_FLAGS_2(icbiep, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_5(lscbx, tl, env, tl, i32, i32, i32) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index 5067919ff8..d4957efd6e 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -296,26 +296,34 @@ static void dcbz_common(CPUPPCState *env, target_ulong addr, } } -void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t opcode) +void helper_dcbz(CPUPPCState *env, target_ulong addr) { - 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()); + dcbz_common(env, addr, env->dcache_line_size, + ppc_env_mmu_index(env, false), GETPC()); } -void helper_dcbzep(CPUPPCState *env, target_ulong addr, uint32_t opcode) +void helper_dcbzep(CPUPPCState *env, target_ulong addr) { dcbz_common(env, addr, env->dcache_line_size, PPC_TLB_EPID_STORE, GETPC()); } +#ifdef TARGET_PPC64 +void helper_dcbzl(CPUPPCState *env, target_ulong addr) +{ + int dcbz_size = env->dcache_line_size; + + /* + * The translator checked for POWERPC_EXCP_970. + * All that's left is to check HID5. + */ + if (((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { + dcbz_size = 32; + } + + dcbz_common(env, addr, dcbz_size, ppc_env_mmu_index(env, false), GETPC()); +} +#endif + void helper_icbi(CPUPPCState *env, target_ulong addr) { addr &= ~(env->dcache_line_size - 1); diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 0bc16d7251..2664c94522 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -200,6 +200,7 @@ struct DisasContext { uint32_t flags; uint64_t insns_flags; uint64_t insns_flags2; + powerpc_excp_t excp_model; }; #define DISAS_EXIT DISAS_TARGET_0 /* exit to main loop, pc updated */ @@ -4445,27 +4446,29 @@ static void gen_dcblc(DisasContext *ctx) /* dcbz */ static void gen_dcbz(DisasContext *ctx) { - TCGv tcgv_addr; - TCGv_i32 tcgv_op; + TCGv tcgv_addr = tcg_temp_new(); gen_set_access_type(ctx, ACCESS_CACHE); - tcgv_addr = tcg_temp_new(); - tcgv_op = tcg_constant_i32(ctx->opcode & 0x03FF000); gen_addr_reg_index(ctx, tcgv_addr); - gen_helper_dcbz(tcg_env, tcgv_addr, tcgv_op); + +#ifdef TARGET_PPC64 + if (ctx->excp_model == POWERPC_EXCP_970 && !(ctx->opcode & 0x00200000)) { + gen_helper_dcbzl(tcg_env, tcgv_addr); + return; + } +#endif + + gen_helper_dcbz(tcg_env, tcgv_addr); } /* dcbzep */ static void gen_dcbzep(DisasContext *ctx) { - TCGv tcgv_addr; - TCGv_i32 tcgv_op; + TCGv tcgv_addr = tcg_temp_new(); gen_set_access_type(ctx, ACCESS_CACHE); - tcgv_addr = tcg_temp_new(); - tcgv_op = tcg_constant_i32(ctx->opcode & 0x03FF000); gen_addr_reg_index(ctx, tcgv_addr); - gen_helper_dcbzep(tcg_env, tcgv_addr, tcgv_op); + gen_helper_dcbzep(tcg_env, tcgv_addr); } /* dst / dstt */ @@ -6480,6 +6483,7 @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->hv = (hflags >> HFLAGS_HV) & 1; ctx->insns_flags = env->insns_flags; ctx->insns_flags2 = env->insns_flags2; + ctx->excp_model = env->excp_model; ctx->access_type = -1; ctx->need_access_type = !mmu_is_64bit(env->mmu_model); ctx->le_mode = (hflags >> HFLAGS_LE) & 1; From patchwork Tue Jul 2 23:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 809148 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp443617wru; Tue, 2 Jul 2024 16:48:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWC/J2xklXVoTIgMZnpgyBFp0qW5X/HcK8nDG6j5cy49KzGT4gdHmytesApFD6NvWrLw4VjLpL0hFe63RSOG2lj X-Google-Smtp-Source: AGHT+IE3kB84uZBFvOKXdcALPf9UM3Dt4Jq9tUy2/KRBfaRpfusCODukXvo1dGZdueZsHZzXodJW X-Received: by 2002:a05:6102:374d:b0:48f:46df:3b7d with SMTP id ada2fe7eead31-48faf16cd69mr11590038137.35.1719964105631; Tue, 02 Jul 2024 16:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719964105; cv=none; d=google.com; s=arc-20160816; b=UtwX9+4tElUvq556tVxGkKm1FeAZtwH53AelDsqHJ7THxUEvtGPsfNu2hWVqmDW4Rw XE0OTtQGWn/7dFC4/t2kpLaE8X20lf4VOD6IMsnlzI6xS/Jo9t1C0UGwl0oXoxVU9BIz DmPHIazfqBXafZJy73IiX0nxbldUH78Ot7N37+gqYrQRJIPQww0JBzqWaOQcOmDJbg7q iz6+PAhFwrPi5MYcv/vjQNPGTLPina0ZlCxQD2Aqo+h8vXjcPYgjRHBa1tQMcL99TH3I K1DHcKsNW1Ug2fH6vDxAsa+bMZzIVaIi093uC0MecyYfdw850xej+NARy5oeo49bxmju BwEA== 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=CaC3T2BfYoaBDwnO5rCCvOq9J0+P8XOAD1K7mnYvbhs=; fh=0YTlrtA8XsSn/NGLxPm6Cl+1ZmYgEb6/q0YMfRT+W9g=; b=thXDPYDS4uFIWZXUM66rEU4QoDuPwy9NY+w5VSZU0Sbows1WVqIAKf1nlW5Fq1ImFt b5QC3u5rxeDIJ4nk6Y0sJXg9cmJTCti9pVLee77H72n3KT7mn4ZHWy9cxNMBGyQxg/Bs ZhZc4+mSmV/vNcdkYJzS34HT9w/oF38O39F1HnJYa2JYKyf5IiUq3kipZwfn0XFregAC J0dn3B/LUvSmsBYXic7vFNROovBqCeM0Qs2jmDlz4tBoSYq3fImkxc5ttimoC9LqGa3b 7G2aGEXgdsE+L2nq3suz+Fz9MqcFUUKn8olhjkZIuxlSNY23SYnKfjYkYFcyZP8UMIb8 d1sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kzycDzh4; 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-79d69261498si1127176585a.32.2024.07.02.16.48.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jul 2024 16:48:25 -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=kzycDzh4; 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 1sOnDU-0002BZ-0u; Tue, 02 Jul 2024 19:47:20 -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 1sOnDN-00024i-M3 for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:14 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOnDK-0007Vt-IA for qemu-devel@nongnu.org; Tue, 02 Jul 2024 19:47:13 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-7180308e90bso2780086a12.1 for ; Tue, 02 Jul 2024 16:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719964025; x=1720568825; 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=CaC3T2BfYoaBDwnO5rCCvOq9J0+P8XOAD1K7mnYvbhs=; b=kzycDzh4Eqcw22cRXv0pdQsHB9mrzcLcRKXMVV04WYQn6HVSVchBJfWfbjSD4FeHqN 6gkvPt5o8c/MbrOHnve1bOnLgzNcWNV4knn0RdWmq3hYIWxflm7Gjjej15n9GLn3I3J5 2Hyv2KJHarKXAQuerH2g0wwPPHjSxU0wsvwsl/1yaDAa9e1r96C+xqTCY96HMcmm5b9Z k2+Isc8ML9JTi1rL9c/esPv12g/Zu37ROCHLBQ8uan/6OkLLhykba0SkAG9SByNViowM eLcZVbSF3Nd83lUgCTSk52Qd3TRW8kRWAn72kiMEHh92Fu99YA31ZVlHq4UL+yrHBe9D AQXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719964025; x=1720568825; 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=CaC3T2BfYoaBDwnO5rCCvOq9J0+P8XOAD1K7mnYvbhs=; b=N52G/bkrbG+2YZG5ilABoA9Nvi2CDbe1AilXDPpFcYAtQKtr+Omq+BPXf7gTMKe9xh XgWR2wLO1204+VnDIRgbcOJ0sMnd0q19jKYx6EZdn8e8l6YpSbg4JmV7XVEEjPvJ/BiG IUwi4B7ZLY2uSfpJgajyTGXPj7+gfqWnhrk4gac0LLIISiyQJbdIpabWhORXu7ZV8SKV rBCC29MXm2RMomuD1+HB5B4HABCP2Iu71j5J9FZp7wZGX1ryaQoxiDH+c6JU7WibYcNT qsS7DPRrGPyjm6LQkTr2Zi7wdaA/XY3Ds4aaUQPhCRuiQ0ELRbP9oQdYC6QYKuXkZlA8 QmLg== X-Gm-Message-State: AOJu0YwwaYRN15SaBP3T/brfacYiIfdIItz+qLFVZn0mrE4jUzKGPd1X ipKAa943BzUY5qUWvRQwDBPd/rCYYZn21KgjmNkQvnQIHLFt632oYpg2hZ+VBLtJ0F/PjdrPQLG q X-Received: by 2002:a05:6a21:6d87:b0:1be:c0c9:5fa7 with SMTP id adf61e73a8af0-1bef6103c73mr9133794637.15.1719964025420; Tue, 02 Jul 2024 16:47:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 16:47:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, balaton@eik.bme.hu Subject: [PATCH 4/4] target/ppc: Merge helper_{dcbz,dcbzep} Date: Tue, 2 Jul 2024 16:46:59 -0700 Message-Id: <20240702234659.2106870-5-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::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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 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 Reviewed-by: Nicholas Piggin --- 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 */