Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2821140rdb; Mon, 12 Feb 2024 19:25:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6HfZSpaMdJjQC64JHDHsXrB0FZeem7do78iiHVHCd0I77XnGECVTtl+bx5MrNFACGiYRYegxY0I4PML+VUOF1uVurJ463+OKY9C4syw== X-Google-Smtp-Source: AGHT+IFn82hvSTffku/JOPAKrxpxGbIAA/Na8z7KSKNsugvhaAYgeCajOX7bjOCA0wjArNZ7aefv X-Received: by 2002:a05:6402:1f49:b0:561:3b53:d0af with SMTP id 9-20020a0564021f4900b005613b53d0afmr1141292edz.12.1707794735422; Mon, 12 Feb 2024 19:25:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707794735; cv=pass; d=google.com; s=arc-20160816; b=tD8OtjNHa+ovKV846AlkYMSonqY6aDrOjVD+z1lmUAP1+td6VqQTJLeNqdkhyZgojK YQfv+bWmo0r3luODcWBXdC/MkBsclLqRPGd0uTX0HseUtm2XKeKKYHpvG+Ilbaj+NMmI D08A9LCdHvHD1Em7iMbnyBdf7BoACUZkglqBxNOxSR76w2xnnYcACID2OZZ9N0eoq8nC h+cv8tUOqzIPsUndxtEb+JBUQPoxYVq8Mh+nFbGLVq3sslkJSUfm/+DRnrWlHz5GYHBn M+EJYCQ3waoYcS49QUugtW6oKrL9UVvgwqGV6xiibg+kRlEjlpsfC4yKKdzLu/KdQnFc BttA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=if1pmLTRVcuqiS5WFrEFaB+wVVF4073IHWC80dtkSxU=; fh=+9ln2RUA+wP91L6Vqw5VHGhZpRu4IQ3TIVWNrjFRZdQ=; b=daONNmhTJF/gTb6jChSCjfI69I0sCkdrbAQlf5cp8G2JfqOUrFjjlbnjM/khgO8qUS 7twk3C+RUIZQRJGw5Si563hx7VB8DPTmcZIMM7kS72RMvA8TeiOSk+q18DTNdgNdWeAi f0iwfe65RraPi6JLZj4/q0FDtikeC6ZAg33ZhRFZKz7nslnzJrU9sinossF8iqHuJAKc a4mPcaXNruvdcI0DCENByQK3nhtdJnM9ggvlvNdVhPqrdXHrkyXlJ6OULoNAI1S2VoGf UKzYD07nWmgR/dMNC83R26mqb/2+A1l/Rs4vyixLjuKDzpu2k11WmY3LfqzxerHJsY5n ahtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=MYxAUPHN; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-62907-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62907-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com X-Forwarded-Encrypted: i=2; AJvYcCWdhqSh61sHKRiTXIDbdf5vaH0AZ8GyE7965C/hnZ976TD4HIb1TCg4fZRCQsuTlwcg8BAw6zwEG/rgYmQpkpqmm2BAcUx91V4Nm8KbxA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cq10-20020a056402220a00b005609dd0d95esi3198025edb.565.2024.02.12.19.25.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 19:25:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62907-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=MYxAUPHN; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-62907-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62907-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2BAEB1F2407C for ; Tue, 13 Feb 2024 03:25:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E43739479; Tue, 13 Feb 2024 03:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="MYxAUPHN" Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 855108C17 for ; Tue, 13 Feb 2024 03:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707794725; cv=none; b=T7UjRz9EKpesOeeolZyzGgy7PJJBxzhBioK3nG3bKLDXSyzL+fsbjNDE3nfPj+f/1PAMd1kd/KfgAddC7szNVBaDdXJOWVT+BPoxTXq4Z7B+pTclwZSYsel9BSCbWcWVnE6dmoG3ldUU0qWPbZq2zsNVQ73heEd2UXKIL3/lN+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707794725; c=relaxed/simple; bh=6CxxssLo05mXziTeSFtD+zska6iXGLCRihBC/F1iGPc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bkocvOfpJGPiv5deGfWQjC22G3B+AqZT9Dr1ElB/s5eKCDL3F9qjncLRVqx2n1h2m5ronA4+jBK8uKp43Nxb8ckimLOvyMpDpaS3YYQvUc4Njf5L5nlduc7Q1zHrMa5Eg5HUaaNY9VvlOonvYbMaNPFE3BzXs4olS/UhN81bSPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=MYxAUPHN; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-42c6b6ec76eso24177911cf.1 for ; Mon, 12 Feb 2024 19:25:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1707794722; x=1708399522; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=if1pmLTRVcuqiS5WFrEFaB+wVVF4073IHWC80dtkSxU=; b=MYxAUPHNCSFWCPevfH7tNoy8KKGnf4O6Ql5J5/rhT9rkcIJjKtG5KFTOB5uOhWNf3y lG0HUmCSNoHZ6cfgTEZPFUZ+YDoxhJtt1WmHc7fowFBXWs0y9qeKCoFBAkXPrI6kQuCH BuKdrxrwXWYdwJlcxKxz8HxyUoTzrTq9Cj2sA8CVTvpbne2KNRtkCvQ6uaEJ4Ofrzfmk qO5y8jSFcc9d/sqXnY9gP9Yh0F4kEbmxBaJHRXHpLattywY2+O48AAJk1G/H1FGIiGka qfnd0XGVN3Q/40D//i7ggES2pQoDH5rBsH/7rENScoF15f3kIv+OAuzAcJwZ3zz/NFe4 0FgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707794722; x=1708399522; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=if1pmLTRVcuqiS5WFrEFaB+wVVF4073IHWC80dtkSxU=; b=TIEmfUdXaVJH9ukPzoBawyFmC4EQRJ2M0M/6OU+nMk0kvLGoLkOAtKrw48XOGMgyqJ SQY0E14IsoPeKWUUWjiyIB1eUCNBSg1p7YpD5Hz562wjurfluJbEklSz1dpTwKp/vtrI tQLG9C2fRWmJYziWMGwxtzJP9xOuzs6snDVHLr1t+FTfVhqWXXPWWxmddbtPwGmqTZPP zEw5NdqU7Z/0Qlb+U6ZtD8Yr7l4fDxUttSOjoI269WLuE0BhSfhcio6zIWYnXhd7z7df 3K5gdg+Dq4UhUQBop2qkqf22qij7Gb94T03be2fUk3D2LLA+2TQ756fBTzC+6ppqIbw9 kokw== X-Forwarded-Encrypted: i=1; AJvYcCViIQXVVBlf8iYJr/ipMlYsdP+296CPzmxqK3zBu7SSqcZT5mhYdWW34162JoXBPzCMGCSwlZJcrzWjd66RY3/eB1UtKk2/QeLspAnj X-Gm-Message-State: AOJu0YzTPlhn2g2w/Lp+If3EF0I5LF/NhnNvJ2SvQ2KR3L46eVIzbIiS ZePI7ebsl3Cs9Jr0Lkhst+/3cp0wCEBr+pMxJddi+Ky/x35NELRCJ4FFyZEL+DI= X-Received: by 2002:ac8:5f53:0:b0:42c:3c54:6f20 with SMTP id y19-20020ac85f53000000b0042c3c546f20mr13275386qta.10.1707794722333; Mon, 12 Feb 2024 19:25:22 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXBGqZV4wDvnXDxxc2cMc1N1ZZswMYG/Wbwxt7v1ZN/KLBlfkAF7pU/O5lCiyWAeGtDH1OAtyC2ZhnHUPSq62pEkGZGzXRVK8oa8SzX/sv7Bj4xKlTEXbsia2AYBrvzdPtgWXFDmygyqzZPDcQ6IgeG+8Yhyv0ICa9nxQbbDmiJ5aV83xX+sKR/ysHCcA== Received: from [100.64.0.1] ([170.85.8.192]) by smtp.gmail.com with ESMTPSA id p20-20020a05622a00d400b0042c72e4074esm753096qtw.56.2024.02.12.19.25.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Feb 2024 19:25:21 -0800 (PST) Message-ID: Date: Mon, 12 Feb 2024 21:25:20 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -fixes 2/2] riscv: Save/restore envcfg CSR during CPU suspend Content-Language: en-US To: Stefan O'Rear , Andrew Jones , Palmer Dabbelt Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, stable@kernel.org References: <20240212022642.1968739-1-samuel.holland@sifive.com> <20240212022642.1968739-2-samuel.holland@sifive.com> From: Samuel Holland In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Stefan, On 2024-02-12 7:21 AM, Stefan O'Rear wrote: > On Sun, Feb 11, 2024, at 9:26 PM, Samuel Holland wrote: >> The value of the [ms]envcfg CSR is lost when entering a nonretentive >> idle state, so the CSR must be rewritten when resuming the CPU. >> >> Because the [ms]envcfg CSR is part of the base RISC-V privileged ISA >> specification, it cannot be detected from the ISA string. However, most >> existing hardware is too old to implement this CSR. As a result, it must >> be probed at runtime. >> >> Extend the logic for the Zicsr ISA extension to probe for the presence >> of specific CSRs. Since the CSR number is encoded as an immediate value >> within the csrr instruction, a switch case is necessary for any CSR that >> must be probed this way. Use the exception table to handle the illegal >> instruction exception raised when the CSR is not implemented. > > We support non-conforming extensions, so we can't assume that if an > implementation does not provide the Ss1p12 extension which defines senvcfg, > the corresponding CSR number will not be used for other purposes. Yes, you're right, I'll do this for v2. Though this does prevent us from supporting hardware which implements senvcfg but not all of the rest of Ss1p12 (e.g. Ss1p11 + Zicboz). Regards, Samuel