Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2740170rdh; Wed, 27 Sep 2023 11:09:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFU2pNBfUCWVDh63rbrJeP1jhLhTAGfrPjHsItFSa2DztXXgZI5Oc0kA+ZwkW/f2HBwL7Os X-Received: by 2002:a17:903:41c6:b0:1c6:30d1:7214 with SMTP id u6-20020a17090341c600b001c630d17214mr2208859ple.55.1695838149452; Wed, 27 Sep 2023 11:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695838149; cv=none; d=google.com; s=arc-20160816; b=T2AYonF94Eb4kd+SbwLAhWOBoFYoC+w63auAtRYfFrmdf88a7iw0/MsfwGe73YYNdk TOYxE+tXNeY0NrfubjHbu1O1jj+d/KFI4LwWNqI+eDwDxFUDAU6APXnzfBNswyGViQUx NNQOsAws3J1MpFXHZtNHuQmkIGqlhGVWv5SJzoKZYf7aLuXbsA14Yiie7FYpAQu8SdJ3 wdVvBFnpAqdmEhA9hzFdKjk5YWoVYIqUy+YggCBFXO9jC1VGEss7ImTXhI+yIuNEAe0Y UjEqTpsqYQU8aqXrkPGWw5neGtmlt3jmXAOWS81vpJIm4o8Y+NSoghBMs8d3xdeVCDEJ EJAg== 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=bOPrKJWAl/9/IN/C/sVh2aNItIVXrI/b8dgIww0vJHY=; fh=c2laDwcKFA/KRfLU3+KEwmMaBXdhdkaFLFO7AjYGVZk=; b=wdQI1R31uexAW7G9x1Gdncrj1ULS1V5igiRlH7DHR0oGOf2bPxdG+9m+DaBy8/2miZ UKpgkiK5C6OU1CdNE23W8x2+x67ITNQ9CvfiioN4vbXoB2jVRJ27QHTO1LopdSCpLkNE /YMcI0q1TcGNknXCLLZp90qsWsK3NISq52tp8ZTX8avQ5x1mHx9QAIJ3yaxcvutLh4yu LPCUBdTVDZboqseVDIu8BGcM/PMk1ehVxR7/I1g1motXgXeTuA537Y1YB9SYcZzH/JHj ZanqBQhtoSooBdK12EqBL7kPsgW4ks5qLKtd6sV/2vTl+IKXyNiP+zYuI1znhJA1sUqc Ne6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=iwS7v1Tm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y12-20020a170903010c00b001c5f9de7a35si11045934plc.109.2023.09.27.11.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:09:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=iwS7v1Tm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 78A29824E52B; Wed, 27 Sep 2023 04:03:19 -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 S230138AbjI0LDM (ORCPT + 99 others); Wed, 27 Sep 2023 07:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjI0LDL (ORCPT ); Wed, 27 Sep 2023 07:03:11 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2034F3 for ; Wed, 27 Sep 2023 04:03:09 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1dd8cf47849so972945fac.0 for ; Wed, 27 Sep 2023 04:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1695812589; x=1696417389; 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=bOPrKJWAl/9/IN/C/sVh2aNItIVXrI/b8dgIww0vJHY=; b=iwS7v1TmMSzVKKXPj+ct1z8u+hq2fJG6O/fBv6wPe5qZomSUup8dLVXkJQ6HkDJVXh wrN3tf1/Z3u3gIgEiuCmo03/aRRv3R2M03bs55c6kD770LyXJ5mpr+GzHz/qR30IejTV mC3COfQLRicNPdyAbwfsjtIPkWGjDuxeVALnbYcyHjxvWgCaVYo+V2gx7FoX4MPJFRzo 7QO9kIi7ijmeRMStM5e28h3NkGHzw+4WZ69lWTokxXkI5XsFKMueRtD2TjfhIbcUildS tXmP70aP+D2c75sWkAYLu7frZNh/QnDcc1q3r5PAHUeHGXl25b+F0kaA44kIci2iyn5E 1vjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695812589; x=1696417389; 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=bOPrKJWAl/9/IN/C/sVh2aNItIVXrI/b8dgIww0vJHY=; b=D6LfEEcJ96E/slZylJKBqA8ZKBva5HDI0d+NDvDdk1vZJfjT4AqvNvxGmmRaijzroV tKkqz1h4PKPXllYxLSSe2eJ+mqJ4IMky7BlnlppR6S1+vHxsuZO3+Ch4iKXjPYTQVzXj 13oe9kmY0PQTOrZ4RCaLl7awDMPNr7MZh/bQwbI3LinjRVdVfp+Uwly0wKt9HYX3D/3X I0Lo9oOw1QT1Wl94JXcx16kX6zuFIf9tVxV8gjQ/2a7Cqk5fcfNqplxrkPTqeVSwGeuT ItPgyYstguV8ZW0K+vro0m1rkcpQE/lY3RMcxrHHBUfAgqUhVmHAIcTzh6jic3D5K81Q IYWw== X-Gm-Message-State: AOJu0YwhCBdneYXdJLWUWv1GKTMSgKxGO6td6m9K7nGWKfVMIifLdRJQ Ie1/XN7ooXIrXhFHNEDPOhPEnhchBRcZGx4jve/H0xYqa8KiKV3c X-Received: by 2002:a05:6870:b30e:b0:1ad:2e18:7090 with SMTP id a14-20020a056870b30e00b001ad2e187090mr2122393oao.32.1695812589020; Wed, 27 Sep 2023 04:03:09 -0700 (PDT) MIME-Version: 1.0 References: <20230922085701.3164-1-yongxuan.wang@sifive.com> <20230922085701.3164-2-yongxuan.wang@sifive.com> <20230927-62fbd3d63f4c6ffada90b7ee@orel> In-Reply-To: <20230927-62fbd3d63f4c6ffada90b7ee@orel> From: Yong-Xuan Wang Date: Wed, 27 Sep 2023 19:02:58 +0800 Message-ID: Subject: Re: [PATCH v2 1/3] RISC-V: Detect and Enable Svadu Extension Support To: Andrew Jones 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 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 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]); Wed, 27 Sep 2023 04:03:19 -0700 (PDT) Hi drew, On Wed, Sep 27, 2023 at 3:03=E2=80=AFPM Andrew Jones wrote: > > 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_youn= g() > > 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? This bit was called HADE in v0.1 spec. I will update it to ADUE in patch v3. Thank you! Regards, Yong-Xuan > > > #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..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/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), > > __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