Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4732938rdb; Fri, 15 Sep 2023 10:32:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYxmif1WkvIIL2c4xi6oEhA+cmyfV/Am9fY7CMI7eizjZzRXFXbKZaDEWlwS326F5lH1EQ X-Received: by 2002:a05:6a21:191:b0:151:35ad:f331 with SMTP id le17-20020a056a21019100b0015135adf331mr3259124pzb.14.1694799119501; Fri, 15 Sep 2023 10:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694799119; cv=none; d=google.com; s=arc-20160816; b=gBK2cZyMDLmAueudRzX/q4PtRuSVFmLhjVuWCyOsF/kJpVHxC6e8ciMgOg8wv46SGq ec6V6UVWE7DjKvEypLzUWDu91o83onidc28wZslz1XWwFoc93rpPRpbp4ACuQgpI0NR0 RmM+7+PbSTKwp0M/+sXutPhInibr24EWnA7xTs3Qem1ozw3DeWzgSIS5F2MFc8jX8yUa M2mk6+xvs1nrjSk/ZcDsuLihdCxKNPuuQ1IccEs5au/TCo0K9+2th6QYo5BWjkCP2Syx Gdb1LsvLKUuUKUMY/O9CQ8uJCtOlh5Uwh5g2hYzFJd4wahhGxh1MvbFtcOhEAuvH5Zrw tzug== 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=wCwARpWplADVhU3zVYdbJUfTEXuZZBU0YL8z7M5PVtg=; fh=oi+x+m1a2avUjn6Te1O0eQmFfs4PO0rx4m8lyCbwhsY=; b=SnhFWPAQi/gnLcolT0TMq/N9+7B4sHywtlntzXVlold0QA4zQi7npqYStSqhCDfM15 K8FVSEnJMA+V5hzBAK7jvSdDy7c0qS6Q3LiXjsXE7oefGFt/CkaMwuKWoLt4r2gOMohS 6utyalRokpCc9M29hSQ8iHkBFQeyI/Cvl7P7VONaNGsp1DwY2kDOZaguwuouy3CBLE5z njSbwbg1/9HBRGPi5hcpOmo1T2+tqNWr13f7n9O+U9/iZldZvD8iVbIvedB9ShShJnuX apD3Pn5ZLi+LictOy2Cc+0HdY3RUF/68PmQDj0d3x03YdqvhChovPle9pAdyTb9uRoY0 PWFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=i2AoHaAc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id i3-20020a63e903000000b00565eb0cf702si3649737pgh.310.2023.09.15.10.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 10:31:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=i2AoHaAc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3E2E2804F357; Fri, 15 Sep 2023 01:46:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233106AbjIOIp6 (ORCPT + 99 others); Fri, 15 Sep 2023 04:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233092AbjIOIpz (ORCPT ); Fri, 15 Sep 2023 04:45:55 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4852D2711 for ; Fri, 15 Sep 2023 01:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1694767549; x=1726303549; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=H7GanXGftaQ5SpvJrDxJhpXAN84SneN8kwBnokLJ00c=; b=i2AoHaAcEzeMEexK6tSTlnqdNgH2h5RFH5wOH3CrV/8R14fZ04d9/pnj TAPbtZPn/wNN4BgN2+E3wHayAv5FBLmJccvjiIpy57PdPGVtDNphnQEZb g3nlDgQOnblVf+uG3BCcD/7oHkJpEDA9bf65Bw3qpakqNpdFn+TkQgGBH x3maF21da0D3pHglL7/26NpuaKwEW7SwZD7Njb/qsoIUBle1KZUTo8D8A W8AW15cdN7SZakY+QKx46Eg+8udzQ1PfN6PHQ0fVWh9RrbrDR24QCPgeY r9TrPn0offPxs2rdSkdQ5iqN4TD+lzOhZNxwJQLS4Dzf6sDtHHu6HVQIb A==; X-CSE-ConnectionGUID: RV8QYsOtQfaqLyG7dFyPmg== X-CSE-MsgGUID: AnUMj2eBQSSJO8MC9D3Jpw== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="asc'?scan'208";a="5007679" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 15 Sep 2023 01:45:48 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 15 Sep 2023 01:45:38 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 15 Sep 2023 01:45:33 -0700 Date: Fri, 15 Sep 2023 09:45:16 +0100 From: Conor Dooley To: Yong-Xuan Wang CC: , , , , , , 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 , Subject: Re: [PATCH 1/2] RISC-V: Detect and Enable Svadu Extension Support Message-ID: <20230915-triangle-fool-e7032469d3e1@wendy> References: <20230915082701.3643-1-yongxuan.wang@sifive.com> <20230915082701.3643-2-yongxuan.wang@sifive.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EjQ9rfLhfbgZuC1z" Content-Disposition: inline In-Reply-To: <20230915082701.3643-2-yongxuan.wang@sifive.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 15 Sep 2023 01:46:08 -0700 (PDT) --EjQ9rfLhfbgZuC1z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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_young() > to enable optimization in MGLRU and __wp_page_copy_user() if Svadu > extension is available. >=20 > 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(+) >=20 > 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/hwca= p.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 > =20 > #define RISCV_ISA_EXT_MAX 64 > =20 > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pg= table.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); > } > =20 > +#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/cpufeatur= e.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. 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), > --=20 > 2.17.1 >=20 --EjQ9rfLhfbgZuC1z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZQQZnAAKCRB4tDGHoIJi 0ve4AP9Q0ygRFHy474fh3DdhHwB/cWcWUvu2epcVNm3sD+D+vAD/ThRidAt4fJqZ 9lKQi1tz8nxCOaUKyukoH+PMnCRZrgw= =tV2Q -----END PGP SIGNATURE----- --EjQ9rfLhfbgZuC1z--