Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp791956lqo; Fri, 10 May 2024 15:33:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXaSpMWC/zQYHwtekPrDm++cMJiJZmPH7O+HWRur6K93vfx+GyNPZUp6YPWaXTRhSCdKHUIBhiGbJXYh03LLwBv+D8wciTV91GtZ9f7ew== X-Google-Smtp-Source: AGHT+IHPg4Dqjjocs0xWMJtjn7XyNg4URA8n32TR7JesQBVVF09qMiNxpbn1YzPnrQVUsNuQU0b6 X-Received: by 2002:a50:bb05:0:b0:572:5f28:1f25 with SMTP id 4fb4d7f45d1cf-5734d5c1692mr2853867a12.7.1715380433147; Fri, 10 May 2024 15:33:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715380433; cv=pass; d=google.com; s=arc-20160816; b=yXZA0s8OC0ILSBQu8ShIsCygtY4xDiI6eMguVU/b87G+1r/LMJijFUwYwoCyfWs/mO 6X3i9gseq5ndLRiKVFoApaNh9cL9t5+1qz+3oCX2dxuEq5dsWFrr0BuL8F9/mR2b+ABF C7ns9XiQHhLBDqJSRjVUF0ycq31LOsNIWJp15u5BP8bGgkmeXMaygyUfuMR/4Crn8sZ/ 3fL4A+J25BgoXOtmb04AK/QvRkOBDSE0sMoyI2frINv8LseOUTWvMh1VFko1qEPFJXa4 X5w3B20O8uJQy1FED/ambGX2JYJZKFiYloiGik6sYWc6l0gKbOFmSXJT6XNEgW/Tlvfr hGYw== 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=Rx86BKf20oqqJvvyTkwVjgHBFBglkui4kaaauK5EOTw=; fh=PLVTPrXTlTUZU4FHSixDhUkWDmk2dOMZwBCoJp0k3kE=; b=ESqpCSjiMYb/Dn8WBuX2bjVfaqGoOfyOjmpdUIE7OkVlk0ilKJRJhFSvJvgDtVcplx LWiyxnGeKdswVvED4DpPqVQNQE3OwWhslHpir8Vfwt4qtKqpw+Rj0z8CVcAmdzAi68Vq Mkag0lgXXnzt4MGU5MFznuu/5VX4Vw6KTnKGcARv8c66g34tzczZAYWzr6mZnJxGMXpI nJGQ0Mx8FThP9EJ6ccfF3f10yZZi8zD6970coKGCXeRBaec02q0ZAZzOPg3ypIRpynMU 5FPbKCy3eV7RXhll1EX4Lmv7IF+Q4xvGfyS3I5+VYQb5YxPXaLVVvVAw1Hk4QbxTSvr2 JooA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=o8hi3s3l; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-176275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176275-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c36e334si2337690a12.549.2024.05.10.15.33.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 15:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176275-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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=o8hi3s3l; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-176275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176275-linux.lists.archive=gmail.com@vger.kernel.org" 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 A99681F22C4A for ; Fri, 10 May 2024 22:33:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0082B171E53; Fri, 10 May 2024 22:33:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="o8hi3s3l" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 AE3E71474D0 for ; Fri, 10 May 2024 22:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715380423; cv=none; b=rprgFeKbr2W0iiapF1i2UOMJNPWdV7y0PuiPAvljB6pyK96ht3CM58iiHTUAv//IG4VV1TEXik4DvgB1KRszQNcmcdDzszPwyh8hnA5VWPvGIqQvW7U0SE5kNJYRNx64D7ynKNscjdr69xFJoYDiFZe3OvYd/9B7yuGnElYP048= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715380423; c=relaxed/simple; bh=cFsqolC03whbOXne5XKlbHEqaO9KmgRG1wEiBKh9mPQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CPaEy+trgEtIqC3XjlEXlWKIXxbMwF1MwM4brjl7OcsWY5LjHJTzhzP9OpFK+wUWz4TjSw66hG7aGRBchT+7YCKgWeqgeroxHdKTIOkpKU95LazZ6HrrTWeyB3deWjcO/75l5Jd0l4Kqc9tvjEVKCjBUUf/THXc/p2UtTL8Z/BQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=o8hi3s3l; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1edfc57ac0cso21008915ad.3 for ; Fri, 10 May 2024 15:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715380421; x=1715985221; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Rx86BKf20oqqJvvyTkwVjgHBFBglkui4kaaauK5EOTw=; b=o8hi3s3lmX2YqQnd9C/rkwE38e0hHuJfKp8+ForFPhNh+16MvZrxNZyMWKWUzl9QrB qlM2my0i+vefxi2fxXAVQoi4gWsYKvYDmT5fAB+SGucJSMbN1UluiHj9pUcBpXgy33+X qu9dvsIF8CyhUcZAYtkEAiydou6AoPPlrY5W4+RnREg1kl0L9O2V43w+yFFYlU4ECd02 WS4SdsP5pB3hlxXuMMdwyycHVavdp9uXnIMc66BPCJ3ksWiSHr4xm4WqYCAcT2HvCYWG 5WCWKybQQtsyp5j3rQ3xRwEIQbZahlYP1htzOFpK/TTIifibLzJseyY+oZi+asW3gRb4 dyvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715380421; x=1715985221; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Rx86BKf20oqqJvvyTkwVjgHBFBglkui4kaaauK5EOTw=; b=oviEfLwc4cMGEgsYMGrpft0u/6Dd8MCeoKm2sSd4plpw9ty57QkoUztNYUPeh6IDKp VEO3y8hSHDs6NeG/EexVTCJSlnme+r+rdbTjY1hWBVNSbKOBzD6+rCtgrfTxnh7+qkVe DBQfpivHGz9lCxAN2aeVQiCN5y4RwBiBqgOf9279z04qTbMqtSJusfzQoqzHy4rIJnAG D9D3Jicc2ZCwXXZfc5YdcmhA3NzCGFQ4Yt8vtBwpR+ZYYoxiBWVzBMUhf0Kb8beheqhN 13v7xuNTMQNa38NCqg0KPjOBYdulskCiaAaBPgYlGpYpGY2c7gP5C6zR8koUeixeDkw3 z+Dg== X-Forwarded-Encrypted: i=1; AJvYcCUSgNx6x/XXTr9G6z0QO2Awn8FTlyOOO31CtshIZXhBQr3LppJkVnh8xfBJoAzAu9FxNDxcKZzbfZ/qLkM4vezOYZ7OxBoFcmXxhIps X-Gm-Message-State: AOJu0YzWEiVim5ZG9B9uMsXYYRUSlr8/uAv+Uap+6mD9kWV/Jt1+7IU4 hbSmEKC+nkA21pKqpSByjLoke+QAp6NUXlQD95MCpjlq/clae+PBL0g7cCk9nPQ= X-Received: by 2002:a17:902:d483:b0:1eb:57cb:4c69 with SMTP id d9443c01a7336-1ef43f4d1ebmr53974765ad.45.1715380420958; Fri, 10 May 2024 15:33:40 -0700 (PDT) Received: from ghost ([2601:647:5700:6860:629e:3f2:f321:6c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c16093fsm37221825ad.281.2024.05.10.15.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 15:33:40 -0700 (PDT) Date: Fri, 10 May 2024 15:33:36 -0700 From: Charlie Jenkins To: Deepak Gupta Cc: paul.walmsley@sifive.com, rick.p.edgecombe@intel.com, broonie@kernel.org, Szabolcs.Nagy@arm.com, kito.cheng@sifive.com, keescook@chromium.org, ajones@ventanamicro.com, conor.dooley@microchip.com, cleger@rivosinc.com, atishp@atishpatra.org, alex@ghiti.fr, bjorn@rivosinc.com, alexghiti@rivosinc.com, samuel.holland@sifive.com, conor@kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, corbet@lwn.net, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, oleg@redhat.com, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, Liam.Howlett@oracle.com, vbabka@suse.cz, lstoakes@gmail.com, shuah@kernel.org, brauner@kernel.org, andy.chiu@sifive.com, jerry.shih@sifive.com, hankuan.chen@sifive.com, greentime.hu@sifive.com, evan@rivosinc.com, xiao.w.wang@intel.com, apatel@ventanamicro.com, mchitale@ventanamicro.com, dbarboza@ventanamicro.com, sameo@rivosinc.com, shikemeng@huaweicloud.com, willy@infradead.org, vincent.chen@sifive.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, gerg@kernel.org, heiko@sntech.de, bhe@redhat.com, jeeheng.sia@starfivetech.com, cyy@cyyself.name, maskray@google.com, ancientmodern4@gmail.com, mathis.salmen@matsal.de, cuiyunhui@bytedance.com, bgray@linux.ibm.com, mpe@ellerman.id.au, baruch@tkos.co.il, alx@kernel.org, david@redhat.com, catalin.marinas@arm.com, revest@chromium.org, josh@joshtriplett.org, shr@devkernel.io, deller@gmx.de, omosnace@redhat.com, ojeda@kernel.org, jhubbard@nvidia.com Subject: Re: [PATCH v3 02/29] riscv: define default value for envcfg for task Message-ID: References: <20240403234054.2020347-1-debug@rivosinc.com> <20240403234054.2020347-3-debug@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403234054.2020347-3-debug@rivosinc.com> On Wed, Apr 03, 2024 at 04:34:50PM -0700, Deepak Gupta wrote: > Defines a base default value for envcfg per task. By default all tasks > should have cache zeroing capability. Any future base capabilities that > apply to all tasks can be turned on same way. > > Signed-off-by: Deepak Gupta > --- > arch/riscv/include/asm/csr.h | 2 ++ > arch/riscv/kernel/process.c | 6 ++++++ > 2 files changed, 8 insertions(+) > > diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h > index 2468c55933cd..bbd2207adb39 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 > > /* Smstateen bits */ > #define SMSTATEEN0_AIA_IMSIC_SHIFT 58 > diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c > index 92922dbd5b5c..d3109557f951 100644 > --- a/arch/riscv/kernel/process.c > +++ b/arch/riscv/kernel/process.c > @@ -152,6 +152,12 @@ void start_thread(struct pt_regs *regs, unsigned long pc, > else > regs->status |= SR_UXL_64; > #endif > + /* > + * read current envcfg settings, AND it with base settings applicable > + * for all the tasks. Base settings should've been set up during CPU > + * bring up. > + */ > + current->thread_info.envcfg = csr_read(CSR_ENVCFG) & ENVCFG_BASE; This needs to be gated on xlinuxenvcfg. - Charlie > } > > void flush_thread(void) > -- > 2.43.2 >