Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1361089lqt; Wed, 20 Mar 2024 01:08:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWUmZbYUqcLV/evEuoQpOV9j5JUAXjlaGruBzMA3Gla2zsS/U8u5g6Aya9Eg+aMdfiF748SJxfpTwmlUJ+a/dAyfhje4synFcA7SLimuA== X-Google-Smtp-Source: AGHT+IHjor1X2sDm0H2BhDCw2rQYqLR9vr6mnkg85liX4B+AHQ/2wO6elOiDWA4IT6xbijTfnfvr X-Received: by 2002:a05:6358:430a:b0:17e:6a5b:4d3a with SMTP id r10-20020a056358430a00b0017e6a5b4d3amr1324598rwc.8.1710922083380; Wed, 20 Mar 2024 01:08:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710922083; cv=pass; d=google.com; s=arc-20160816; b=0xv7yT37/FcS4FMEYPZLikJWTTTh2rGAreVIYZ3m0VpIO35noFV2418CHeHBPjKivg 8pYu+PPQXawWyplyv8zDcwpFOsFKIQ3Ocz2E/K0AYR+7o9++/Rlcqxzrp08UgpdcQF16 ccMC601dfovHOweRZK7EGUf6h4WJEoL2dFH+P/ChTbzWg2xZRFbe83fdjv663zG+G//9 0ursNwcRL+/7aNrJr5OvtcUDEa8BRJBFbg/O2fOomgq2DrlFf7WYJPOdRvI95aWLzriZ 465YHGKSJ6eIfhNq2iA0dVNYzHjmr5HKTQKCgu/qgtkTCRLH9KmsRpj46Mg/3UAFznab 6ZFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qo2WFvFI+ooaSXfDj307OMcV56cuiGsV5SDZpCU1v40=; fh=JL/0fyzVWMrNfKjXDitWaeIkziClIwkZcvEfh8HTePw=; b=YcN2OhWvSdpbrQPLoYEkzXDFDrDShNptAJAADQZ9BItFvC6O6FMc52D24Asock7J84 cn5MN7DisZJxlTzDJk+MHpRX5zZZ+7ieQyAiwv6XcTeCjc5SRawhSe93XcuQ89dMeaMp V9eQXb7zgU1C7gyJ+Y5Rbje7ztTiiW/5hgBPLYqqOwpuTccaBAawLyvcXja4oZNTm/jB 7RTnbCR7Hq/r1Bzb1jku5QmtYuTkcg03ukd5JFncM8BUg3Ld+7ZBRydDLlg2t24DVVaI Iv8CRRPUKSkCXTvopd6ewV5UmS6fLpTPXeZwjSoPmwhciLNRLJA5QHt+4MuD75PRLVj4 7P0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=hHH5DxSY; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-108592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s1-20020a63dc01000000b005d8c5595ddbsi11915862pgg.271.2024.03.20.01.08.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 01:08:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=hHH5DxSY; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-108592-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 70E1328194D for ; Wed, 20 Mar 2024 08:07:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8B112C69C; Wed, 20 Mar 2024 08:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="hHH5DxSY" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 9540936AE4; Wed, 20 Mar 2024 08:07:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710922055; cv=none; b=AwpomJLlI3y44aR68fmUeyAjXw9/NbfSeOMP5loJmvHg5SfN42PkoZjMdCfCXZ8ZklmAMfBxVFv8JvcDOtPloTF4yO2uV55FCFp2vb0WQWfVJBRCfPgeEp2cyNrYl9my2hMrYsrKkEtOW9Cm1PqGrUJbgJEInamP8hB4RlU7G5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710922055; c=relaxed/simple; bh=8s8XKGkGT4rwQeAawGzZEkGeS8AnzqsL4K//1R+zt5Q=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ah4pTubxMI3wIf5XoYR0a4LBB1wosag+zNUMJdvn5H3/IjtetmPIuKxQ2xyNwViNYSGNR+mXb1pibdpJ3bgDYDUzWbmUl8pIwL9TR88quXUEYHNthIdPJjlNrTyHJ5RMF0l1eyGrdnPJR2M3UbbDeoIL6NX67bvXzHOpA7m9Td8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=hHH5DxSY; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1710922054; x=1742458054; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=8s8XKGkGT4rwQeAawGzZEkGeS8AnzqsL4K//1R+zt5Q=; b=hHH5DxSY/R/+5ju6Tu8yndEmtunuKsBNmB260zQ3AYGzWDXV/7XBbvHP Sy1oIN3vxCAEhRW/Nj1GWRpi/beHVw0bW3SHbvOzFtyUHxv3X/OjFvdff 0ra9jz4Zq9TIjNFUjz/Wh1SKTv44ZjToDiLBFKAksqGu7par804adSnnZ FwcFP32gvuiGVgb0H7xHaRZ9vNcBABNHUZj9v+KuV417vuSTT8x2SQZvj mUKn7QBMF+zP+2haC5OaXnGifBPBYqDx8SKIy7twNO+mwGb1uByJWVIt/ yz8fqyYXwU+Wd8p1LE2PlP6O5BctCQjYvpDjCB27AHQHTz0/ia9x5qBbF Q==; X-CSE-ConnectionGUID: +2PKfpLTQGq2m0SEBNMVqQ== X-CSE-MsgGUID: eSxs2JbuTmyaJCQMbacMkA== X-IronPort-AV: E=Sophos;i="6.07,139,1708412400"; d="asc'?scan'208";a="248659095" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Mar 2024 01:07:30 -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.35; Wed, 20 Mar 2024 01:07:10 -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.35 via Frontend Transport; Wed, 20 Mar 2024 01:07:07 -0700 Date: Wed, 20 Mar 2024 08:06:20 +0000 From: Conor Dooley To: Samuel Holland CC: Deepak Gupta , Palmer Dabbelt , , , Catalin Marinas , , Conor Dooley , , Evgenii Stepanov , Krzysztof Kozlowski , Rob Herring , Andrew Jones , Guo Ren , Heiko Stuebner , Paul Walmsley Subject: Re: [RISC-V] [tech-j-ext] [RFC PATCH 5/9] riscv: Split per-CPU and per-thread envcfg bits Message-ID: <20240320-fanfare-flick-3b38dde081d8@wendy> References: <20240319215915.832127-1-samuel.holland@sifive.com> <20240319215915.832127-6-samuel.holland@sifive.com> <40ab1ce5-8700-4a63-b182-1e864f6c9225@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZQuW/bL/DNtzlQCx" Content-Disposition: inline In-Reply-To: <40ab1ce5-8700-4a63-b182-1e864f6c9225@sifive.com> --ZQuW/bL/DNtzlQCx Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 19, 2024 at 09:20:59PM -0500, Samuel Holland wrote: > On 2024-03-19 6:55 PM, Deepak Gupta wrote: > > On Tue, Mar 19, 2024 at 2:59=E2=80=AFPM Samuel Holland via lists.riscv.= org > > wrote: > >> > >> Some envcfg bits need to be controlled on a per-thread basis, such as > >> the pointer masking mode. However, the envcfg CSR value cannot simply = be > >> stored in struct thread_struct, because some hardware may implement a > >> different subset of envcfg CSR bits is across CPUs. As a result, we ne= ed > >> to combine the per-CPU and per-thread bits whenever we switch threads. > >> > >=20 > > Why not do something like this > >=20 > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h > > index b3400517b0a9..01ba87954da2 100644 > > --- a/arch/riscv/include/asm/csr.h > > +++ b/arch/riscv/include/asm/csr.h > > @@ -202,6 +202,8 @@ > > #define ENVCFG_CBIE_FLUSH _AC(0x1, UL) > > #define ENVCFG_CBIE_INV _AC(0x3, UL) > > #define ENVCFG_FIOM _AC(0x1, UL) > > +/* by default all threads should be able to zero cache */ > > +#define ENVCFG_BASE ENVCFG_CBZE >=20 > Linux does not assume Sstrict, so without Zicboz being present in DT/ACPI= , we > have no idea what the CBZE bit does--there's no guarantee it has the stan= dard > meaning--so it's not safe to set the bit unconditionally. If that policy > changes, we could definitely simplify the code. The wording for that "extension", if two lines in the profiles doc makes something an extension is: "No non-conforming extensions are present. Attempts to execute unimplemented opcodes or access unimplemented CSRs in the standard or reserved encoding spaces raises an illegal instruction exception that results in a contained trap to the supervisor-mode trap handler." I know we have had new extensions come along and mark previously fair game interrupts for vendors as out of bounds. I wonder if there's a risk of that happening with CSRs or opcodes too (or maybe it has happened and I cannot recall). Going back to the interrupts - is the Andes PMU non-conforming because it uses an interrupt that was declared as vendor usable but is now part of the standard space because of AIA? If it is, then the meaning of Sstrict could vary wildly based on the set of extensions (and their versions for specs). That sounds like a lot of fun. --ZQuW/bL/DNtzlQCx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZfqY/AAKCRB4tDGHoIJi 0m4/AP0UYPz9RdNLmW6g7L1tf8w83wsWZfBkuwZqh3A3w0Jq9wEA7t8mWVQ1YVm2 D9FdG5Y2+4p6MzgZJDv6xF67VncJZAU= =unOr -----END PGP SIGNATURE----- --ZQuW/bL/DNtzlQCx--