From patchwork Fri Feb 2 05:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 769167 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp754828wrc; Thu, 1 Feb 2024 21:56:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKUft26lQBpqtkwOcgpIO/MPotNI4yNBTBEphDaf1p7QMnbCYhteaEIJDY0HCvAq84GPgB X-Received: by 2002:a25:d0c2:0:b0:dc2:4e05:4f87 with SMTP id h185-20020a25d0c2000000b00dc24e054f87mr4818588ybg.56.1706853412181; Thu, 01 Feb 2024 21:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706853412; cv=none; d=google.com; s=arc-20160816; b=Ol0JCY2l+6a8IGBOJZYWYGyJBd4M2+Hb4Ah0OQVWMim+6DlKTlQI8vTLGaudkTYCEl RHKDV80PaPhYKpOv7Met1bmmpiT/BEjbiIb9rKPMF3f+M2vib0YAbFn1tbXrS9fMLi0O oYdMQY8N8aOADuWseARuIMjgI9YvnsAdUoIpYG6sCA0R/omJ6ePTKZQRaIotQ8Cavwpo f8DM6aWxHquYdwnjAO2tGpRT/EfHuC22FXgTKEtSiUiQIsxHLIXB4uDmPvsnl3u5D5k2 vIgsbzaeltrcwfHK2kgUpu7ZJEfhf6qJLW6py8DneyCHn9AQFNr0YwpL/na265o6vJCR x0QA== 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=UsEJ2g0LpvdUYy2sbV8u3yNlPUAlmvtjJu3b7/RUdbU=; fh=/WksxlkySAmFdrDyqNPn+MQ53zWcu6I898codA9FHqM=; b=sfqyV6ClxL1Y4E4xdoAZuU3ahcnGw/sXVe92s6WK04rob/jvKE3yaNOw84oH15vBRl hb1Gcin9+MQD6EoEBo0+4FUiQzU1mxN0vKzky2m8kXsj5tyAI67KrCloxjk+cn2y6Z9f DPt4H5UcV1jS5NDhqugH8keKvdOVnuJZMVBkAqBT0EPGIFNUcWU9Dk0zSj+dSwgoj5Im sMH334agtsBbGGw0ObJL2Sow0bG8tOVmJpoM+0itMynMHsGRalPQ0FMzaJL1/9/v6Ai0 EOLo+UsnoRSwB/+hTMc/Gc9pMklv4MJ9e1F1q8+aWt0iNVqlR0TThXwsAqDNEYMmxC57 ZUXw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sa/jom/S"; 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 X-Forwarded-Encrypted: i=0; AJvYcCWY0LRXym06uUWe1jDOWFbSN0RGVBpflA1IA5PxCGfneXRg/+TJBrzJetaEhUFWCKnp7BxorL1RiELn8aSWcWp4 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y14-20020ac85f4e000000b0042bb00c9584si1232413qta.506.2024.02.01.21.56.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2024 21:56:52 -0800 (PST) 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="sa/jom/S"; 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 1rVmT6-0002zw-FZ; Fri, 02 Feb 2024 00:52:04 -0500 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 1rVmT3-0002ks-Um for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:52:01 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmT2-00028J-4q for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:52:01 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6ddc1fad6ddso1462886b3a.0 for ; Thu, 01 Feb 2024 21:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853119; x=1707457919; 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=UsEJ2g0LpvdUYy2sbV8u3yNlPUAlmvtjJu3b7/RUdbU=; b=sa/jom/Sl1nEyGR/1Rqq05zFugo2ObJAduqWhzQ5401X8H5UM7Zmslfy1T1HMw9HE3 MD+655gITkh3ZePcTUY8aMAx9WvUv3xXt7OfDDh0vk/vH5/PTNgBbDqn/+I1hSu8vN5r e832zS9tvNyPRs93YuAj0WrA/VWAim2dZo9eQaAUkEJK2/QzMQQpPdazuFxph5n+7r+O 5dY1Rb8ujo6FDd6TqL6n79EyZMPmZwnSfgygnfjzOKXGtM5O81xgOZn6aQL5kUJY2wC4 IUIOMfcKLpiqVJlXx6FeBA+fEmgs53P4qPBksjZTlqIukwzd5gs0bhf9AK7ufptTQlsO p+Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853119; x=1707457919; 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=UsEJ2g0LpvdUYy2sbV8u3yNlPUAlmvtjJu3b7/RUdbU=; b=b1CqAcZlCQMsEhMRYRBwg1U8o7+JKmI/UxLYH90t6poe5oGL6k6yl4trBXit2ZzO82 9XzguV3zASa/SyiL/DYZwBZ7jkthgFXsKkEQBzNBONt4S/ZH2TjRjENyzrQVKIDCL1ed 5QckRaVS3/b1jta68b0IAyPs1rHzjs2zCHMquTSwCZ2MIXW11GTW9XAmDJg3gyLNH31K W0jAECHBOvHr1upfOrETAKz2uIyZc3ksDQhHggeXi+UkivfmdGYIULukahH1g5gjhWXw yZWtdC/3Br4+43Jo2e5KsT0qypUlrQDMg5jq9PW3ZtHFSdO8kvj0dgUCvsGq8bmroAA+ y3eQ== X-Gm-Message-State: AOJu0Yw1Jqk8YkUSYprtZw6yidLa770W47XMx2YRIhGeRuJyw4Xy9FwB LLAzJYFJ3koKihrh8dSLBqfYcUIa0QCU+2VDCVM4eHh7PuoZCVkWM2P3VoF9eYLxgQfC2g+b5P3 HTHw= X-Received: by 2002:a05:6a00:3cc9:b0:6dd:b12f:12ef with SMTP id ln9-20020a056a003cc900b006ddb12f12efmr5751673pfb.1.1706853118840; Thu, 01 Feb 2024 21:51:58 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:51:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 36/57] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for ASI_M_BCOPY Date: Fri, 2 Feb 2024 15:50:15 +1000 Message-Id: <20240202055036.684176-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202055036.684176-1-richard.henderson@linaro.org> References: <20240202055036.684176-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Align the operation to the 32-byte cacheline. Use 2 pair of i128 instead of 8 pair of i32. Signed-off-by: Richard Henderson Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Message-Id: <20231103173841.33651-2-richard.henderson@linaro.org> --- target/sparc/translate.c | 43 +++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 97184fa403..1082aabc14 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -1727,28 +1727,35 @@ static void gen_st_asi(DisasContext *dc, DisasASI *da, TCGv src, TCGv addr) case GET_ASI_BCOPY: assert(TARGET_LONG_BITS == 32); - /* Copy 32 bytes from the address in SRC to ADDR. */ - /* ??? The original qemu code suggests 4-byte alignment, dropping - the low bits, but the only place I can see this used is in the - Linux kernel with 32 byte alignment, which would make more sense - as a cacheline-style operation. */ + /* + * Copy 32 bytes from the address in SRC to ADDR. + * + * From Ross RT625 hyperSPARC manual, section 4.6: + * "Block Copy and Block Fill will work only on cache line boundaries." + * + * It does not specify if an unaliged address is truncated or trapped. + * Previous qemu behaviour was to truncate to 4 byte alignment, which + * is obviously wrong. The only place I can see this used is in the + * Linux kernel which begins with page alignment, advancing by 32, + * so is always aligned. Assume truncation as the simpler option. + * + * Since the loads and stores are paired, allow the copy to happen + * in the host endianness. The copy need not be atomic. + */ { + MemOp mop = MO_128 | MO_ATOM_IFALIGN_PAIR; TCGv saddr = tcg_temp_new(); TCGv daddr = tcg_temp_new(); - TCGv four = tcg_constant_tl(4); - TCGv_i32 tmp = tcg_temp_new_i32(); - int i; + TCGv_i128 tmp = tcg_temp_new_i128(); - tcg_gen_andi_tl(saddr, src, -4); - tcg_gen_andi_tl(daddr, addr, -4); - for (i = 0; i < 32; i += 4) { - /* Since the loads and stores are paired, allow the - copy to happen in the host endianness. */ - tcg_gen_qemu_ld_i32(tmp, saddr, da->mem_idx, MO_UL); - tcg_gen_qemu_st_i32(tmp, daddr, da->mem_idx, MO_UL); - tcg_gen_add_tl(saddr, saddr, four); - tcg_gen_add_tl(daddr, daddr, four); - } + tcg_gen_andi_tl(saddr, src, -32); + tcg_gen_andi_tl(daddr, addr, -32); + tcg_gen_qemu_ld_i128(tmp, saddr, da->mem_idx, mop); + tcg_gen_qemu_st_i128(tmp, daddr, da->mem_idx, mop); + tcg_gen_addi_tl(saddr, saddr, 16); + tcg_gen_addi_tl(daddr, daddr, 16); + tcg_gen_qemu_ld_i128(tmp, saddr, da->mem_idx, mop); + tcg_gen_qemu_st_i128(tmp, daddr, da->mem_idx, mop); } break;