Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp363345rdg; Thu, 12 Oct 2023 07:50:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9WV7XV92RG/ay4ZGdSlvYKrlWWcW0HZJThJYttmcdhC8pA7ExeUT7sNraupcSXgj9IyWn X-Received: by 2002:a17:902:ce81:b0:1c7:69a1:7524 with SMTP id f1-20020a170902ce8100b001c769a17524mr29658235plg.37.1697122254088; Thu, 12 Oct 2023 07:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697122254; cv=none; d=google.com; s=arc-20160816; b=HeK4QJv8ztVOLlqI+Wnr1YqzexDCYb4LGMkR8Ci0xKHSbTibEhSk6RC/XQPSQKRnEp g6PKl5tAlkOyzhQlg3k+LAcho9sDfisZollswfHOqsa2Mzlqoq82Qhgp51FMCFsyPBhj Zj+XLmsnIF2NdNOjTM6uQ5Vr83miAoUsae9A04TFO5prPAk/Dy5zsG/vqKF6Rmscraik MiN1H1Wt7m9nHllqfn0CWhKP1Mjd8ALxVKypruDoYbOPFYKlv5trMI+zx2/Ejdb0kvcc 5gnqjDe96ejyjgQM9VEEC2xwReaXyUbtS2yk/XXnkHCDwqvJnIw67yEPoX9pgaFo6ny9 BVKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6Rt5h//L3I617hN+A3xVYyxPPNIyOoKlhtdCJXUF07k=; fh=Nv7NcH2g3txwzj7qewEBNML2WRFRP76CtM09rjNxR/M=; b=0zt+cukkwPLmwu61YumhAyHPTcvkYztLK3wd2jmR/nhYaNlwrXhZz39jKKWhtoHoVU oF1dy7xY1zg49trnkArwVo+VnnQZzweU4Av+8TZZs4pWYryqnnWcPMr5jXsR2wRfuJ8A OyaC3dOoS/4qhanleQg89YPS73RNGow6s4AjtVy1XhP1cD3fUYZ64AnkO1WhQWIQ9WVY DUGUxiMtwvACzXLUPFmT0kU17z1p3BTQPxMjjwJcvJbhNm5IqJN2MhPutClGIQdgcNLo itDCjkJG0avtq+356Uza0k/xS3PDT3Md+NuQxbAoQ56FAY4Sn73Jo8gFnhRhfv1+mnTS z/Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UvtwTxwH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p11-20020a1709026b8b00b001bbb6f4cd6dsi2235239plk.334.2023.10.12.07.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 07:50:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UvtwTxwH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id ED2B880740C0; Thu, 12 Oct 2023 07:50:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379149AbjJLOuG (ORCPT + 99 others); Thu, 12 Oct 2023 10:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379089AbjJLOuC (ORCPT ); Thu, 12 Oct 2023 10:50:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 175ACB8 for ; Thu, 12 Oct 2023 07:50:01 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1533C433C8; Thu, 12 Oct 2023 14:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697122200; bh=z1ZRpKN4zGKXq55T5I704tUYnbOmVfb3YTkG0G86C4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvtwTxwHfDM2Xg+q/s9dvFpSAWc0Wgzy/sITutGQnDGMP0vF1cNiQgLiilNaam2bD xxiqNQgnivwSW3pVxziO6J1mUqKQazgCMwj+mcW/nT9IfgNPORGd1LTrvZ0m5kOS41 vK4veMnWeZzu1ppbl7hP8/nopAQokhP/c51TgyyPIenQrc2V/3Jr6dJAFehs4QsSYS N4V6FW5VfBOCaWfUCbFwux76xuSDd8OZScojUOxMJEc40W9ktyscHL0FxnJG4LmmXV 3QkZaG9+vd9HF+gkUXxfMgSdiwTG9aYdvfJ9BP61nDaeFBwNEQgfSuUflH0tB6dg+9 4HTuBPXTyVl7Q== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Guo Ren , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2] riscv: errata: thead: use pa based instructions for CMO Date: Thu, 12 Oct 2023 22:37:46 +0800 Message-Id: <20231012143746.454-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20231012143746.454-1-jszhang@kernel.org> References: <20231012143746.454-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 07:50:25 -0700 (PDT) T-HEAD CPUs such as C906/C910/C920 support phy address based CMO, use them so that we don't need to convert to virt address. Signed-off-by: Jisheng Zhang Reviewed-by: Guo Ren --- arch/riscv/errata/thead/errata.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c index 3fefeb1b456e..632557f36b19 100644 --- a/arch/riscv/errata/thead/errata.c +++ b/arch/riscv/errata/thead/errata.c @@ -58,9 +58,9 @@ static bool errata_probe_pbmt(unsigned int stage, * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 | * 0000000 11001 00000 000 00000 0001011 */ -#define THEAD_inval_A0 ".long 0x0265000b" -#define THEAD_clean_A0 ".long 0x0255000b" -#define THEAD_flush_A0 ".long 0x0275000b" +#define THEAD_inval_A0 ".long 0x02a5000b" +#define THEAD_clean_A0 ".long 0x0295000b" +#define THEAD_flush_A0 ".long 0x02b5000b" #define THEAD_SYNC_S ".long 0x0190000b" #define THEAD_CMO_OP(_op, _start, _size, _cachesize) \ @@ -79,23 +79,17 @@ asm volatile("mv a0, %1\n\t" \ static void thead_errata_cache_inv(phys_addr_t paddr, size_t size) { - void *vaddr = phys_to_virt(paddr); - - THEAD_CMO_OP(inval, vaddr, size, riscv_cbom_block_size); + THEAD_CMO_OP(inval, paddr, size, riscv_cbom_block_size); } static void thead_errata_cache_wback(phys_addr_t paddr, size_t size) { - void *vaddr = phys_to_virt(paddr); - - THEAD_CMO_OP(clean, vaddr, size, riscv_cbom_block_size); + THEAD_CMO_OP(clean, paddr, size, riscv_cbom_block_size); } static void thead_errata_cache_wback_inv(phys_addr_t paddr, size_t size) { - void *vaddr = phys_to_virt(paddr); - - THEAD_CMO_OP(flush, vaddr, size, riscv_cbom_block_size); + THEAD_CMO_OP(flush, paddr, size, riscv_cbom_block_size); } static const struct riscv_nonstd_cache_ops thead_errata_cmo_ops = { -- 2.40.1