Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2639244rdh; Wed, 27 Sep 2023 08:24:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyuRt+GwGQmzHUUBImIqSmHSHAPX1/cU4+pzhHCNfd9YlJ3gEWpqfWzJ9ZiG1pjJD7fZey X-Received: by 2002:a17:902:b282:b0:1c3:8679:6ed4 with SMTP id u2-20020a170902b28200b001c386796ed4mr2065977plr.8.1695828272410; Wed, 27 Sep 2023 08:24:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695828272; cv=none; d=google.com; s=arc-20160816; b=Byu1ratQx4TOzdNeajat/AIKIiDyJB+FdDuonYwzQDiCTopiSjTx6b40BFXxkMg+eJ dK7hnrakmntNPyCi4HvOXoTz1mJws4byNyXYTSEz0rY62hBg4VrBXhkrh5/xPin1Tn9D 7VAgqZXmvR3j/KhA096nO2t251TNYozMzEoHsfkoL7FZlvmzvRrWMpR2WQMGJo63/wVP KSJpXZr5ilK12BBZZnFW33iNZ8MxcJsQZf0H7LmsOYvJ9rDdvF4VKcQ0J99C/FV2LMPi YqF0H05lvmMpXuePAJoG3yU+VYNt+PZKsmQMzn0g/1rxZkp1dusnL3pvs5eDWJL11w7c um4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=abujtVG6p0xZNC8A7dBvKw/44lCK9FG1V8Q7D6GoWec=; fh=NksvyU08xcQUAYefK9y0a0dLXPx6GA16EdTGpe303Ic=; b=bF1oNUGB9V9n66NX+KSGYDALCgo45821ggAt0eFcZ7gbMYMRz+CccvC4t8tPJfei/N O8f/A3dNqyoGTgHQ9OyxadN+wMX9YfD+9BuSGCmy0qHtta/RRXOcG4cJSlxYcfafTFoH XKEXK7Lav48xWTRu5gX35hOhrQilIA0rRHXzbgKhC6R/8ebLH0NOTFvsceD1LXzvDMRK YHTj/A6GdjwnfhEc8zIXPPCS8bdz9Gs1TBijkTyf6RhdMnHg64kWMEBdDxV1PrUU+z39 M56N5Xf3DN4HvtyRZbWTME9MdyGkNo2ATYtHMSus1l//v0avr/erxAe9mEW71eUbZx/j 20VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=KuMYXGyV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y14-20020a17090322ce00b001c71eed110esi3990025plg.254.2023.09.27.08.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 08:24:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=KuMYXGyV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 957ED836E5E4; Wed, 27 Sep 2023 00:04:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbjI0HDu (ORCPT + 99 others); Wed, 27 Sep 2023 03:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjI0HDr (ORCPT ); Wed, 27 Sep 2023 03:03:47 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C56EA3 for ; Wed, 27 Sep 2023 00:03:42 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-530bc7c5bc3so12644902a12.1 for ; Wed, 27 Sep 2023 00:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1695798220; x=1696403020; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=abujtVG6p0xZNC8A7dBvKw/44lCK9FG1V8Q7D6GoWec=; b=KuMYXGyVj9ZBOAaf8zoUF5LV2X/prGH5Z8zhGEnU2RN1UMTR4Q/k0hMc5g08sn7SDC bxESysqE8yNKQjt8iyRSm2185FE4kknLPTvZyLh4yD/HTVkVcqDz0Yu0kydyLYsdOIiX UsfFkDaq/R0xQ/yDgpCfnZyDGwvIC7EVyAJtbm2arUHS+FCeVa+1xFzbglD3b+kHANpE t0LTqQKTZg3GNacdCZ9c/rDv64duxLUpqEi8fgoUASIMHLIo3onpcYuV9BOD0cQRzoGH 7abZu/Ya6z/eski6xme1Vpmdq58uc+4ANnT3WYUp4fzD5TXHTgjzQicqJLwGcLxTVM8V +g9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695798220; x=1696403020; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=abujtVG6p0xZNC8A7dBvKw/44lCK9FG1V8Q7D6GoWec=; b=A3esPur0qTiu3CAZzQmOO82wW1JO+yhiU8wiy3pZZyrm5ViDOoj4YqStcEmuYlxGDl V0ldFEsCtrwiOmbkFpPrlb8/mEeCfx5KME4tbmQ/b+RCs6nuOCGopekPYYoS9fRGD1Oh TBw/n/yg2xuEPpEkNl8/8+zFGyqLkh/1H6sXJhmlS89giTDgJgYhs0Vl7ppAiJbCByz3 pKHK3ho8SV4uRdYdm+HUorV4iV1FOCa3DZZxJYSI+EoETrmdK+Tair2fwKdvLk+mW2NI mNKuYovCAQW9Qlg2NIyxhhlkIoFMX3yKEU5T41CeQQ5FVGj5uNmEeySptZzyvVySUHW4 Y0wQ== X-Gm-Message-State: AOJu0Yw2CMVXHA8rYEW+cwG5QwfVXTb0Jk4nKewO8qvWxWTvFa2aBK8W zQDz1IDW8jKQnpR9n8gG+I58sw== X-Received: by 2002:a05:6402:1b1b:b0:530:f74d:f4ab with SMTP id by27-20020a0564021b1b00b00530f74df4abmr1093293edb.11.1695798220413; Wed, 27 Sep 2023 00:03:40 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id a25-20020aa7d759000000b0051dd19d6d6esm7749118eds.73.2023.09.27.00.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 00:03:39 -0700 (PDT) Date: Wed, 27 Sep 2023 09:03:38 +0200 From: Andrew Jones To: Yong-Xuan Wang Cc: linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, greentime.hu@sifive.com, vincent.chen@sifive.com, tjytimi@163.com, alex@ghiti.fr, Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Guo Ren , Conor Dooley , Daniel Henrique Barboza , wchen , Heiko Stuebner , Jisheng Zhang , Andrew Morton , Alexandre Ghiti , Kemeng Shi , "Matthew Wilcox (Oracle)" , Charlie Jenkins , Sergey Matyukevich , David Hildenbrand , Qinglin Pan , Rick Edgecombe , Sunil V L , Evan Green , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] RISC-V: Detect and Enable Svadu Extension Support Message-ID: <20230927-62fbd3d63f4c6ffada90b7ee@orel> References: <20230922085701.3164-1-yongxuan.wang@sifive.com> <20230922085701.3164-2-yongxuan.wang@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922085701.3164-2-yongxuan.wang@sifive.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 00:04:12 -0700 (PDT) On Fri, Sep 22, 2023 at 08:56:47AM +0000, Yong-Xuan Wang wrote: > We detect Svadu extension support from DTB and add arch_has_hw_pte_young() > to enable optimization in MGLRU and __wp_page_copy_user() if Svadu > extension is available. > > Co-developed-by: Jinyu Tang > Signed-off-by: Jinyu Tang > Signed-off-by: Yong-Xuan Wang > --- > arch/riscv/include/asm/csr.h | 1 + > arch/riscv/include/asm/hwcap.h | 1 + > arch/riscv/include/asm/pgtable.h | 6 ++++++ > arch/riscv/kernel/cpufeature.c | 1 + > 4 files changed, 9 insertions(+) > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h > index 777cb8299551..10648b372a2a 100644 > --- a/arch/riscv/include/asm/csr.h > +++ b/arch/riscv/include/asm/csr.h > @@ -194,6 +194,7 @@ > /* xENVCFG flags */ > #define ENVCFG_STCE (_AC(1, ULL) << 63) > #define ENVCFG_PBMTE (_AC(1, ULL) << 62) > +#define ENVCFG_HADE (_AC(1, ULL) << 61) This bit is named 'ADUE' in the spec. Why are we calling it HADE? > #define ENVCFG_CBZE (_AC(1, UL) << 7) > #define ENVCFG_CBCFE (_AC(1, UL) << 6) > #define ENVCFG_CBIE_SHIFT 4 > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h > index b7b58258f6c7..1013661d6516 100644 > --- a/arch/riscv/include/asm/hwcap.h > +++ b/arch/riscv/include/asm/hwcap.h > @@ -58,6 +58,7 @@ > #define RISCV_ISA_EXT_ZICSR 40 > #define RISCV_ISA_EXT_ZIFENCEI 41 > #define RISCV_ISA_EXT_ZIHPM 42 > +#define RISCV_ISA_EXT_SVADU 43 > > #define RISCV_ISA_EXT_MAX 64 > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index b2ba3f79cfe9..028b700cd27b 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -629,6 +629,12 @@ static inline pgprot_t pgprot_writecombine(pgprot_t _prot) > return __pgprot(prot); > } > > +#define arch_has_hw_pte_young arch_has_hw_pte_young > +static inline bool arch_has_hw_pte_young(void) > +{ > + return riscv_has_extension_unlikely(RISCV_ISA_EXT_SVADU); > +} > + > /* > * THP functions > */ > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 1cfbba65d11a..ead378c04991 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -178,6 +178,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { > __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), > __RISCV_ISA_EXT_DATA(sscofpmf, RISCV_ISA_EXT_SSCOFPMF), > __RISCV_ISA_EXT_DATA(sstc, RISCV_ISA_EXT_SSTC), > + __RISCV_ISA_EXT_DATA(svadu, RISCV_ISA_EXT_SVADU), > __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), > __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), > __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), > -- > 2.17.1 > Thanks, drew