Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp349295rdg; Thu, 12 Oct 2023 07:27:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZvxGa1pkSpattKqYgrAz1OojKRzbElir3BPvHWyC1uIZj1IzpP+MHyo5pneW/IpB1bhC5 X-Received: by 2002:a17:90b:3e87:b0:274:755b:63b8 with SMTP id rj7-20020a17090b3e8700b00274755b63b8mr24312287pjb.43.1697120872545; Thu, 12 Oct 2023 07:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697120872; cv=none; d=google.com; s=arc-20160816; b=RT0FG9OyhkW6zji7Kqe0NZ/G1NxMPEVyUdoaGhh71jInwfiaXXLhXMMND0eVbX3j6r 3yygmkzfDMaLDnmhkb4n4HT/eDGZRTUxxaru8btoUEgEigPpIWqUO+HB2+M6GDkzvTNS 0ArzqFzqvDiQmhJk37aH0722Sl/jrya+gQ9IZeve54Je7tr2y1gJ1f1ci67uOksEMP8h LV+oJD3KAGS+O2yAUIRumMvg883awUsqB+UfL4Zipkcysu/VByouIpyNzPNUvU6Xz4Vg G1GDmiyUVkCn/IQYkoJ30Kcwh237BCgLjor8egAaeUtBo6FLs7PXlBPtdM+lt4eHkYoZ XM7g== 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=rOcVEF+DLR8YBdD3FC/TfIc3l3zPkMPgrWwxtN86E6o=; fh=Nv7NcH2g3txwzj7qewEBNML2WRFRP76CtM09rjNxR/M=; b=ceM3oU2rp2acEMXDK7FyitUAHaTn3oKfK6yn+rf/t/SqRZAS5Q38i0NwIl7tUBcUTG u5Xf6UPj9O0c0ZFnlx74PB76szDB+isTRWe1ehbQVYH0gFOWX3GI93TSYDApTzi1Od+a 5d+9x1efjdMSulcSfOwiIU2S4XC6dr/l8j4VPupMd4ZCpqAF/7Qn8EKYkCTKZZV3FwS7 aEhRiJ1X/aKG4Jn6AmubaFI6DlULeChjGo8YmGb8tB1dcSWqSFYrqD7fhEtSO3HjtbUK Kf7XuVKJxoMo6hAMtEFGiKORbA6vyA9TmB1AwKnnV1KFOZ0HQmqjsj2oN72CUgqFRTi6 j84g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KxEzD4Hb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id g25-20020a632019000000b0059b8e2b0ec3si2338346pgg.661.2023.10.12.07.27.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 07:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KxEzD4Hb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 613A68260091; Thu, 12 Oct 2023 07:27:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378679AbjJLO10 (ORCPT + 99 others); Thu, 12 Oct 2023 10:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344035AbjJLO1Y (ORCPT ); Thu, 12 Oct 2023 10:27:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB697BE for ; Thu, 12 Oct 2023 07:27:22 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A04DC433C9; Thu, 12 Oct 2023 14:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697120842; bh=qzR32gMwqLa17IpLtlTXacrXoBXks+o3rMWn8BtgPT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KxEzD4Hb45irhwRrR6hmVCp9cRJNfnq1J8JUzLAk6c0ZrW5q+mVClsOlJX3lIlK9Y d/ZwrOqNaJn8hH7/jCQ1lzfXy42fMEYNWxcU1f1BEF9lSEqEICRP87lWmjP1CXS4Ys LisBPismY1a2v66e+o79sXzTudUIMUUHdp0Z4SZ2kPZlngpuER0y9SWZC4UDLhtwIA w/ikdXlLY3iKZEhZO1RKv7eIxs1XKQ666mlm8jJEcqPuPRGNvJ9vtq1nw3Ii1bbRVm S89Hh34WiBgf1M5OZ6NSJT3JNotxrWOfhmSJrL3MgLQyhP+dT5JjIrn9tmdb8BkfT0 0M5i2RnPY0zPQ== 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 v3 2/2] riscv: errata: thead: use pa based instructions for CMO Date: Thu, 12 Oct 2023 22:14:56 +0800 Message-Id: <20231012141456.4078-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20231012141456.4078-1-jszhang@kernel.org> References: <20231012141456.4078-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 07:27:50 -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 --- 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