Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6955599rdb; Tue, 2 Jan 2024 22:21:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgRZxVzLI/RWnpopn8cK+0swJH91mU6SroF1e+FdvugAfESYF5yXHFlBfzAi3RxjZXVpl9 X-Received: by 2002:a05:6a00:1989:b0:6d9:3628:d50e with SMTP id d9-20020a056a00198900b006d93628d50emr679249pfl.32.1704262899054; Tue, 02 Jan 2024 22:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704262899; cv=none; d=google.com; s=arc-20160816; b=kR+/QaWfHTaTEm5yVTJ9TYlC/W2Ij7T0HzN1oVQFo4XEp8P18fOUs5ZKe4QVkuJ68N mlIvXIbeIjzs0FEFXy9PF5nK296hcWgLGBcFJ3MgA1ZkqlBXptA8gVAvM05mynG1OXxo cBXMrOKH3eVxSF01wb9BqAOPYOuiUEEbtEzHnK+FaHTfC56GT80ozuzwdwXgBMGNg/Jl cl4yTILScnNuITmXn+M/rstSGLonXyY6nZbZeWwLa/eUlDH/75WGogZDVfB8hLlupyd1 c+mGz4MVFgLFNGQV+97USSQpN6rDT8AgV7bg/j9dntRZnYBGV8wAvOVbb9pKthDqIarz lw1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=gqFLusm/fZhXe5aDYDqzwb9f9vRCG7C7UGX5BAUfKIw=; fh=O2kz3CwWG2tcX62CXdJdAdZcWIjBV6DYWFvxCKLThNE=; b=RACWrp0x1q67559Vqxe3H1WRmQs+D5uJu46CJO5xjUgTMlMEIwidi3zrXvC8qR5OzI Oe9s22dUSgYPGEFLc670lb34jmh9e0OMlTG/izV+pUuS+XN7eN6p/WcUjleJk0KDRctO UmKOtbym7oOQOVC9nAD5Q4kw7UViOLnzIN5BgawkuucpC4Zq+zKLUDWWiyjr87IRlmnR WmFG1daHfZ2asz36MgRhwe2Hz/svCDnp45dgDVelFYbCg5B3ACPYhUn+gRUT1PHv9d5S 8+xQNpGgb84P14kY/GRBbYB67BPw+sVNQttxdaHxqBBa4HzZIABqNeaJVwMVLRjFEbdr LLlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AlyNNFIr; spf=pass (google.com: domain of linux-kernel+bounces-15212-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n127-20020a632785000000b005cdfdcc946dsi18056154pgn.512.2024.01.02.22.21.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 22:21:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15212-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AlyNNFIr; spf=pass (google.com: domain of linux-kernel+bounces-15212-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B6461281E22 for ; Wed, 3 Jan 2024 06:21:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25F57179A7; Wed, 3 Jan 2024 06:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AlyNNFIr" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51C76179AA for ; Wed, 3 Jan 2024 06:20:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D43B5C433CA for ; Wed, 3 Jan 2024 06:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704262801; bh=Syb/OqAPuzYkJd/5Px0xgqgiiqYsgunBbJPRk+8KkZk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AlyNNFIr6NoDkL9xxWN9VczUDw46k1TflXh7bQMBuHSzD11Z4FU5+iMgKEXg4OpMU zbuAwfJJQJNmF7GT3FIQiIK7yRJ9tj1VN7FfWlfrBU1/hYfbmxwQtW2tjPtwdPmyGE xyIi2BRMTJyviX1Q+FQ0ZZnCAimyNPROaAzJNmYvhElvRFhUjK1DxgC/AW5pz78F3/ TywLH8kjm4igzOoJF8CIhnqXJXexFB1fkqSLwhcTiu7Wpj3VVtTuEQdUphzFiMjey+ aCM0kGCpLbGUZt78lm1Rv39XMCMZwNxGEp9+gKIKEPDm3NpiRuotDZ6AhLo8G2qJB0 QDWmWgeiJmaTg== Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-556996d52e5so1412642a12.1 for ; Tue, 02 Jan 2024 22:20:01 -0800 (PST) X-Gm-Message-State: AOJu0YwboaRO1NssJbJnQQfedlKIlehP0cQub3sP741hTATPYc/Qqp+j IVY83x3IRX+PVQA21Yx6yfKJJKRZShWwEruteT8= X-Received: by 2002:a17:906:c012:b0:a25:49d5:e272 with SMTP id e18-20020a170906c01200b00a2549d5e272mr8392516ejz.12.1704262800314; Tue, 02 Jan 2024 22:20:00 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231231082955.16516-1-guoren@kernel.org> <20231231082955.16516-3-guoren@kernel.org> <20240102-7e62facbd8322db4dee4b0dd@orel> In-Reply-To: <20240102-7e62facbd8322db4dee4b0dd@orel> From: Guo Ren Date: Wed, 3 Jan 2024 14:19:49 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2 2/3] riscv: Add ARCH_HAS_PRETCHW support with Zibop To: Andrew Jones Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, panqinglin2020@iscas.ac.cn, bjorn@rivosinc.com, conor.dooley@microchip.com, leobras@redhat.com, peterz@infradead.org, keescook@chromium.org, wuwei2016@iscas.ac.cn, xiaoguang.xing@sophgo.com, chao.wei@sophgo.com, unicorn_wang@outlook.com, uwu@icenowy.me, jszhang@kernel.org, wefu@redhat.com, atishp@atishpatra.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 2, 2024 at 6:45=E2=80=AFPM Andrew Jones wrote: > > > s/Zibop/Zicbop/ <<<$SUBJECT okay > > On Sun, Dec 31, 2023 at 03:29:52AM -0500, guoren@kernel.org wrote: > > From: Guo Ren > > > > Enable Linux prefetchw primitive with Zibop cpufeature, which preloads > > Also s/Zibop/Zicbop/ here okay, thx. > > > cache line into L1 cache for the next write operation. > > > > Signed-off-by: Guo Ren > > Signed-off-by: Guo Ren > > --- > > arch/riscv/include/asm/processor.h | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/as= m/processor.h > > index f19f861cda54..8d3a2ab37678 100644 > > --- a/arch/riscv/include/asm/processor.h > > +++ b/arch/riscv/include/asm/processor.h > > @@ -13,6 +13,9 @@ > > #include > > > > #include > > +#include > > +#include > > +#include > > > > #ifdef CONFIG_64BIT > > #define DEFAULT_MAP_WINDOW (UL(1) << (MMAP_VA_BITS - 1)) > > @@ -106,6 +109,19 @@ static inline void arch_thread_struct_whitelist(un= signed long *offset, > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->epc) > > #define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) > > > > +#ifdef CONFIG_RISCV_ISA_ZICBOP > > +#define ARCH_HAS_PREFETCHW > > + > > +#define PREFETCHW_ASM(x) \ > > + ALTERNATIVE(__nops(1), CBO_PREFETCH_W(x, 0), 0, \ > > + RISCV_ISA_EXT_ZICBOP, CONFIG_RISCV_ISA_ZICBOP) > > + > > + > > +static inline void prefetchw(const void *x) > > +{ > > + __asm__ __volatile__(PREFETCHW_ASM(%0) : : "r" (x) : "memory"); > > +} > > Shouldn't we create an interface which exposes the offset input of > the instruction, allowing a sequence of calls to be unrolled? But > I guess that could be put off until there's a need for it. I want to put it off until there's a user. Let's keep the whole imm[11:0] zero for the current. > > > +#endif /* CONFIG_RISCV_ISA_ZICBOP */ > > > > /* Do necessary setup to start up a newly executed thread. */ > > extern void start_thread(struct pt_regs *regs, > > -- > > 2.40.1 > > > > Thanks, > drew --=20 Best Regards Guo Ren