Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1210586rdb; Wed, 20 Sep 2023 02:55:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFe4tRzuLTBoCAjDA/rbsTGHS20oqv0/SSmQ9/HA+sG5f/Qn7DnkQ03BEt/MpYT2H/JSQ8J X-Received: by 2002:a05:6a00:c92:b0:690:2ecd:a59c with SMTP id a18-20020a056a000c9200b006902ecda59cmr2424531pfv.23.1695203716489; Wed, 20 Sep 2023 02:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695203716; cv=none; d=google.com; s=arc-20160816; b=JnmCZDI/mJidIw7eC2WVmwp4uXZCOVokDUb110nqeZsDoHdP2dXxVXan7ovVVt3sIz pItmsXrANjQbYc9wjmDrKX3lv0HTYWUsIg+I9sVdNaDlBJvCPW3CNak0HU+atzgNeBBp S3Bd+dm3sODRJJENtYyBJIq4TnfRY/Gv3WbsU7yY2nu7uSvajrm8jBom+MbFgt5JUxAb FulxOKHmbV7etkhCRAt1VIBycRfX41ju243r74X6ltovqbK7TS91PTAECwAwz5HlSMq/ esO2t7DVD0y1vr1CQoZIV1WRB51+SdTyHPzeagfTsNhv+KzCWsxk+tXZg6s8IewFvGhb bnNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CcEmXd6qxRcs3BYgRhvSX8w5LurG2MJXEE/HzYLhdCo=; fh=bX7G7Ad/ifPPXjK0bUeNTUFsSX0/9YIOQCBRe2VsQXI=; b=w08Igs1wHoJxgljocg3RnjThioAX0Ty3noIF8ceTFmt9b0uZyw5vwd4KbE0RI1ah3X zpoc+z33mGTf/kyzNOUviNdKwUKtHyUJ7wo2zOW53fkATgY00j6qKfqDQv8/cDkl78ct m29RiomuCaa6Owe260mP/KicImGaoF+mXMza6GH7lDLJJTz7iduLbP1SJaj5PMgMNjYJ lAGm8+pT7yFbE3g3Z+YDxfR7ueqO6ZiJ/hR9M8VZwue9aqcqs63gYBXSSsL0mBFa0yBq A+9ifUkVUDXWWgwCPUzrHooQBRnQASuX+wrKKMsUSJ0Xw9dYAA0uLiwDJPjREimLU8ej llpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="BjBG/80l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id e12-20020a63db0c000000b0056949c3eda8si11096613pgg.119.2023.09.20.02.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 02:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="BjBG/80l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 14805826FA8A; Tue, 19 Sep 2023 20:50:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232192AbjITDuB (ORCPT + 99 others); Tue, 19 Sep 2023 23:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231948AbjITDt7 (ORCPT ); Tue, 19 Sep 2023 23:49:59 -0400 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A182AC for ; Tue, 19 Sep 2023 20:49:53 -0700 (PDT) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1d544a4a315so4104172fac.3 for ; Tue, 19 Sep 2023 20:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1695181792; x=1695786592; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CcEmXd6qxRcs3BYgRhvSX8w5LurG2MJXEE/HzYLhdCo=; b=BjBG/80lU+Oquv5sCPrpjFBtiAB+1eHTSVzKy2UpAzP3H1PuyAjs6j1VLs08nxgbri j208euLUjI8U7jJ29IEsJCn0nl7ztwCKKZDliS/pbsY2jFx1khCA+z/FME22IovLEph3 EHVEVX5fSEnj4ZEB+HO68jNvCaqb0klCJGwDufmIFcWOvSM+N8//12qSeO2eDRUKdmOi m/3ZXVCdHoyt3xHwC0t4DieQxn1a5WlHRHZ6uuf9IFznS7Sm/n/V4SPF5UQ6hvYRpV0u Cr7qySrQaAWx+FwHGR8gD8UXqSJ31h3R/ubOjbGrENOsKbeENaZm8VPgV0wQmnVHCtxd AtXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695181792; x=1695786592; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CcEmXd6qxRcs3BYgRhvSX8w5LurG2MJXEE/HzYLhdCo=; b=dmcomUnpmyBsu4leAEN06d//7qnmHTQiBSvPuxPi/jowHdjngyPH5gzUIBZoWvGueo abXLM1Uz37Oxh0Ul3sT9W0Z0KrVBGX4I8XMpf1kzoyEdzkOHxHmTZhBoOifi69UjHa/l yt1wCXyQe3CgUBMA/TTemPEN2WovhEPLqHX1ASWw1RV01vxCVbMiz2yuChdtrji26Phe tmGD9RNG06ZI0n/kdXRhu0fth4g2wELkOsTY4HVaIMVVD/cQehAg5HfYKkzcGzV1pI1d g7jVkjAmKj++v7w6DMVLZ5LV34QYKa07SXQ2YIKQS+qPOklkmUsVP5xBXXo0Zx9cXa5A efVA== X-Gm-Message-State: AOJu0YyZ0u7pnx/c0/qez5P8GjosLbG9HfBG3mYQmhoMZrNkTkVseOM+ CyOd6oIz+8wADNL2hEw0/MpOq6Yntp1TJAOGY4FPqQ== X-Received: by 2002:a05:6870:6122:b0:1d6:ef37:9416 with SMTP id s34-20020a056870612200b001d6ef379416mr1495389oae.22.1695181792271; Tue, 19 Sep 2023 20:49:52 -0700 (PDT) MIME-Version: 1.0 References: <20230915082701.3643-1-yongxuan.wang@sifive.com> <20230915082701.3643-2-yongxuan.wang@sifive.com> <20230915-triangle-fool-e7032469d3e1@wendy> In-Reply-To: <20230915-triangle-fool-e7032469d3e1@wendy> From: Yong-Xuan Wang Date: Wed, 20 Sep 2023 11:49:41 +0800 Message-ID: Subject: Re: [PATCH 1/2] RISC-V: Detect and Enable Svadu Extension Support To: Conor Dooley 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 , Andrew Jones , wchen , Heiko Stuebner , Jisheng Zhang , Andrew Morton , Alexandre Ghiti , Kemeng Shi , David Hildenbrand , Sergey Matyukevich , "Matthew Wilcox (Oracle)" , Charlie Jenkins , Qinglin Pan , Rick Edgecombe , Evan Green , Sunil V L , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 20:50:03 -0700 (PDT) Hi Conor, On Fri, Sep 15, 2023 at 4:45=E2=80=AFPM Conor Dooley wrote: > > On Fri, Sep 15, 2023 at 08:26:57AM +0000, Yong-Xuan Wang wrote: > > We detect Svadu extension support from DTB and add arch_has_hw_pte_youn= g() > > to enable optimization in MGLRU and __wp_page_copy_user() if Svadu > > extension is available. > > > > Signed-off-by: Jinyu Tang > > You're either missing a From: or a Co-developed-by: tag here. > > > 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) > > #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/hw= cap.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..f3d077dff8ac 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_likely(RISCV_ISA_EXT_SVADU); > > No hardware currently has this, why is it likely? > > > +} > > + > > /* > > * THP functions > > */ > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeat= ure.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[] =3D= { > > __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), > > This needs to be documented in riscv/extensions.yaml. > Thank you! I will update these in v2 patch. Regards, Yong-Xuan > Thanks, > Conor. > > > __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 > >