From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C20FC52D7C for ; Thu, 22 Aug 2024 16:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=p1lgM9ITvw6fuCy4dL1RLtZ983NhZ+UFVIbO1dNmvpQ=; b=Z9mooovw5mbGg7w56PSj6lfVJH j7twD2di0S2Snuor3y4v9aRppG7E/9UE+DcpHhXZWyPnDeOn6YqCEgsBv+Mi6IuTUKclYDGbxPvS+ 0Vg34T6+cfJiTBk0FbcOL/dyAm9b5EwmG1y3Ey70HW7B+qxlvHKI+qCxQUpEnx7I3RP3C0WsNLIjQ p1vzY0ons/DOa4lNG4dPUFxYmgbK+1ucrBm93gHsDZzWwBtgYoGNQrC7+ho1Y0EL07Woqf6GSS+/R T+jPyiSg6nPs4kOJ1TuF2dF2ELcZzxDRwPM8u06nBa8dhR5tWDWc+heH+lsoBm/GlB9rUlFJovNkL ZO75fq5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shAVA-0000000DYbu-0iBY; Thu, 22 Aug 2024 16:17:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shATB-0000000DXo5-3euu; Thu, 22 Aug 2024 16:15:31 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5B8BD61221; Thu, 22 Aug 2024 16:15:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39F58C32782; Thu, 22 Aug 2024 16:15:23 +0000 (UTC) Date: Thu, 22 Aug 2024 17:15:20 +0100 From: Catalin Marinas To: Mark Brown Cc: Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , Kees Cook , "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , Ross Burton , Yury Khrustalev , Wilco Dijkstra , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v11 20/39] arm64/gcs: Context switch GCS state for EL0 Message-ID: References: <20240822-arm64-gcs-v11-0-41b81947ecb5@kernel.org> <20240822-arm64-gcs-v11-20-41b81947ecb5@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240822-arm64-gcs-v11-20-41b81947ecb5@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_091529_985656_50FC2113 X-CRM114-Status: GOOD ( 18.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 22, 2024 at 02:15:23AM +0100, Mark Brown wrote: > There are two registers controlling the GCS state of EL0, GCSPR_EL0 which > is the current GCS pointer and GCSCRE0_EL1 which has enable bits for the > specific GCS functionality enabled for EL0. Manage these on context switch > and process lifetime events, GCS is reset on exec(). Also ensure that > any changes to the GCS memory are visible to other PEs and that changes > from other PEs are visible on this one by issuing a GCSB DSYNC when > moving to or from a thread with GCS. > > Since the current GCS configuration of a thread will be visible to > userspace we store the configuration in the format used with userspace > and provide a helper which configures the system register as needed. > > On systems that support GCS we always allow access to GCSPR_EL0, this > facilitates reporting of GCS faults if userspace implements disabling of > GCS on error - the GCS can still be discovered and examined even if GCS > has been disabled. > > Signed-off-by: Mark Brown We could do with a bit more code comments around GCSB DSYNC but otherwise it looks fine now. Reviewed-by: Catalin Marinas