Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7305348rdb; Wed, 3 Jan 2024 11:05:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3JARp/yPY/JwJ5Wpemp+cUq3uYCDbjUuzg/TzswEoeyHQx3rYBOuzLbQxJ8K5FI8l6N0X X-Received: by 2002:a05:6808:1b29:b0:3bc:2a84:7e6a with SMTP id bx41-20020a0568081b2900b003bc2a847e6amr811405oib.45.1704308727646; Wed, 03 Jan 2024 11:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704308727; cv=none; d=google.com; s=arc-20160816; b=mYYD55ibqZ5oe8obW4AidhIAH95LKihk90yS0RLEXM+MbpEjV5FVNenIe+XkPwC7/a XGsglXOvlwyX9nh9I3qG7aXKWu6NsvBkBLlxLvhUIJELzGnt/bUe4L8Y1h8eqcQQnsTX TfqAIjF5SFlios5cN1m4IjY0U6ynYQ9LUcY03/ZJVOUDebdJJO9AONQJ99HGS+x/WvO1 1TGp8JYa6PCpUSfQo54A3yv5yfUwgEAjMlBO9PYqSfGXNQMCnVSRYkfwyWmMHlif8z9V 4dXSkGaq2+bHM11gqEwEelOvrHLftIOqYGKea8YKhP7BEG3IwESwg/bys6toabvEeBUr eHWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=1Sk8miiHF/d2ya2q7kYXl8D7bd/oZPlQyy/ElPudR44=; fh=HtnyuuqYFSjmM59zzC6PvuDBEftCF4loANagPUB7Dtc=; b=j87ay3aTgpv2Sw23dD/CXBwnXRct2PuFqQ2xAthETkc3D+TDGwD88iPVRGyuAa8Cz9 oULtdeu3BmxyuKRymyFbsVIY/MfV3X9dstnhUqdVuD8qrMcMD9zNK7ZM1xil0hxRCyxb Rs/I5cp9hvr8z3vXwqFqVihS9hJhnWErUXeS2o6WXSjCHq7P1b3pDVxipj68I5fdwN5P ae98sIVjt9/Ihn+TReskpr0et6YgcBbvrQjxhLeKx3ihUGcRfOEifYlITmLsNWfQV7wO 4PVuq57Iirj1ScPJmDYGNU7vw6ip6p0dpwOnhfJc4WtGkRnloqr8Hp/VTVkpcXnGUGSn c2Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y+A0L8y7; spf=pass (google.com: domain of linux-kernel+bounces-15900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e10-20020a0cf74a000000b0067f837a8277si28856785qvo.327.2024.01.03.11.05.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 11:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y+A0L8y7; spf=pass (google.com: domain of linux-kernel+bounces-15900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 41F8B1C2422A for ; Wed, 3 Jan 2024 19:04:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF0041CFA0; Wed, 3 Jan 2024 19:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y+A0L8y7" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 3D26E1CF89 for ; Wed, 3 Jan 2024 19:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704308677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Sk8miiHF/d2ya2q7kYXl8D7bd/oZPlQyy/ElPudR44=; b=Y+A0L8y7OyE3Oz9ubJGFQ/BxYPgf0iU0EenjVGcCRS7RO0MiLB/tCX92su9wTaR3KWujzP 1YZ2rvEES8K/vl6G0P/1KdKgqawCF/hjq/VDXHyDcdDxle83Ekat+VLacyADcJG28LfugK EOon8lAR3RLh8sq7Uze77E9YLCue9X0= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-T2iJvoI_OU6CB0DU2kKsfg-1; Wed, 03 Jan 2024 14:04:35 -0500 X-MC-Unique: T2iJvoI_OU6CB0DU2kKsfg-1 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-5ce63e72bc3so1144894a12.0 for ; Wed, 03 Jan 2024 11:04:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704308674; x=1704913474; h=content-transfer-encoding:content-disposition: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=1Sk8miiHF/d2ya2q7kYXl8D7bd/oZPlQyy/ElPudR44=; b=BZ5fX/f4mpk3oVfyhln1IVluwIVxb7SSreOy4p2wrnXceqdQ0e2C5KudVO1IsG7Ueo 60iYC7jjuHAxU6E+ORWK4WK3vvunZRbbdTgItqfGapRR3PguT4mGdD6QE04geYxgyRl7 voNSg31CHsb2rOWHkg+n4IhHmSMlZVYCTU7BFLHQJ27SAaF+9sZRr4/z0HwBGFf9kW9O F0mjZEsWyv4Hb6x3UUCJDho/ox2QAom57T/X+MmzD2BdC6+M1BYku6R1fWlkJLlFPPBd UpBRWIpWe8qSNcs4ZZMmol8iyVAjPn9xHIAw7IfBbx3p6qgFNzwmcsnpiIYcJp6+N6Hw bwYQ== X-Gm-Message-State: AOJu0YzJWcnnqVQl9K4gWiRadnKa9HNrFPcbqTdjAPKn32XYpZGvMqfd sb+L558q884BHLGTz4Vn5bYRUNjmfAL+uouE4aISx+2T2yi50GQ8hZ7wVTqchzKfJTDJFVe64fB xNL368RZgEANM/p+vamz9fVk/LqeUMo1Q X-Received: by 2002:a17:903:1251:b0:1d3:b308:ad9c with SMTP id u17-20020a170903125100b001d3b308ad9cmr9386188plh.80.1704308673984; Wed, 03 Jan 2024 11:04:33 -0800 (PST) X-Received: by 2002:a17:903:1251:b0:1d3:b308:ad9c with SMTP id u17-20020a170903125100b001d3b308ad9cmr9386167plh.80.1704308673715; Wed, 03 Jan 2024 11:04:33 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ec:911:6911:ca60:846:eb46]) by smtp.gmail.com with ESMTPSA id w15-20020a170902e88f00b001d4c955cc00sm3410994plg.271.2024.01.03.11.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 11:04:32 -0800 (PST) From: Leonardo Bras To: Guo Ren Cc: Leonardo Bras , paul.walmsley@sifive.com, palmer@dabbelt.com, panqinglin2020@iscas.ac.cn, bjorn@rivosinc.com, conor.dooley@microchip.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, ajones@ventanamicro.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Guo Ren Subject: Re: [PATCH V2 2/3] riscv: Add ARCH_HAS_PRETCHW support with Zibop Date: Wed, 3 Jan 2024 16:04:20 -0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20231231082955.16516-1-guoren@kernel.org> <20231231082955.16516-3-guoren@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon, Jan 01, 2024 at 10:29:21AM +0800, Guo Ren wrote: > On Sun, Dec 31, 2023 at 4:30 PM wrote: > > > > From: Guo Ren > > > > Enable Linux prefetchw primitive with Zibop cpufeature, which preloads > > 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/asm/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(unsigned 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) > The PREFETCHW_ASM(x) definition should be out of "ifdef > CONFIG_RISCV_ISA_ZICBOP... #endif", because xchg_small may use this > macro without CONFIG_RISCV_ISA_ZICBOP. > Agree :) > > + > > + > > +static inline void prefetchw(const void *x) > > +{ > > + __asm__ __volatile__(PREFETCHW_ASM(%0) : : "r" (x) : "memory"); > > +} > > +#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 > > > > > -- > Best Regards > Guo Ren >