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 ABA4BCFA754 for ; Sat, 5 Oct 2024 16:37:26 +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:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID: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=XPESY2edLAcEliTLUr2IWqbHmU8dAWw6jNNy2bbD/gk=; b=BdA3Szg1dP5m4GpRf5FkvA5fzo fnHTpGliChE28WtcF23BF+2Prjdc7jFJYBbXxS9CHDR3L6TvO89DTkMpCIxJESX8nMFZngNK05Eh+ ors3KRzY51LLxr5rz64qtiI96VG3YCBZfrbE2pEelDVOLu0PMjby/Hkn5iR9SI+O06kyAz0PTFK0i y1KE9jdXp6iFHRcTm6Q/Ycjz7EOzeABI2kgGgUQjv8n9zTgDs0lZAhHVbKzxm2djvrp3L+bUdZn/u BkvAykZ56He+MStjfvbFvviHhfuGbXkWvEEMW/sLJNKFFrpPWyeF8O+kftNoymRfEVUmycoF3b7Js N406kRaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sx7mP-0000000Faib-3b14; Sat, 05 Oct 2024 16:37:18 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sx7l6-0000000FaYK-3q5H for linux-arm-kernel@lists.infradead.org; Sat, 05 Oct 2024 16:35:58 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 863F5A406D3; Sat, 5 Oct 2024 16:35:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E44CC4CEC2; Sat, 5 Oct 2024 16:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728146155; bh=80nL05CVdGDExIrpaz/GZLy22HLnLEgT36r17S9CRx4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DnXyVKgu3+cYcLSUAd1Qooqz2SF7XlYECIssoKYlWO0bXg0vdJ+CrwwyL84wqCRJO VVhuzighv5ZwhsdTyJlfQaeCIU5GVwtAywuCmDJ0NHY3QbHB0/FlksxH14KuWRxj4G dwrsvGIVpHEpbPvvrvW9/FZM+L+1V7vHmR36EqmXrXfWm5RRDMfmtqIcpWUS9+G/Vj XCX+LEc0teLdVMCiuBpUiVH8AL9Uqp87XKPAq8eVFfvIf8WAEpygl80TpYLGiERqma YnuJG6nDIlb4Zww0VTrT8ZasZkjzGWcf9Bb6I1nOcvAHatENPWZKOGNiwBtYvQeYB4 BCy85pHodRlrg== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sx7l3-000dt3-BM; Sat, 05 Oct 2024 17:35:53 +0100 Date: Sat, 05 Oct 2024 17:35:52 +0100 Message-ID: <87bjzyv76f.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Catalin Marinas , Will Deacon , Oliver Upton , Joey Gouly , Suzuki K Poulose , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v14 4/5] KVM: arm64: Set PSTATE.EXLOCK when entering an exception In-Reply-To: References: <20241005-arm64-gcs-v14-0-59060cd6092b@kernel.org> <20241005-arm64-gcs-v14-4-59060cd6092b@kernel.org> <87h69qvi9y.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: broonie@kernel.org, catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241005_093557_108354_2A0831FB X-CRM114-Status: GOOD ( 22.11 ) 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 Sat, 05 Oct 2024 15:14:21 +0100, Mark Brown wrote: > > On Sat, Oct 05, 2024 at 01:36:09PM +0100, Marc Zyngier wrote: > > Mark Brown wrote: > > > > + // PSTATE.EXLOCK is set to 0 upon any exception to a higher > > > + // EL, or to GCSCR_ELx.EXLOCKEN for an exception to the same > > > + // exception level. See ARM DDI 0487 RWTXBY, D.1.3.2 in K.a. > > > + if (kvm_has_gcs(vcpu->kvm) && > > > + (target_mode & PSR_EL_MASK) == (mode & PSR_EL_MASK)) { > > > + u64 gcscr = __vcpu_read_sys_reg(vcpu, GCSCR_EL1); > > > No, please. This only works by luck when a guest has AArch32 EL0, and > > creates more havoc on a NV guest. In general, this PSR_EL_MASK creates > > more problem than anything else, and doesn't fit the rest of the code. > > You say luck, I say careful architecture definition but sure. I wasn't talking about the architecture, but sure. > > > So this needs to: > > - explicitly only apply to exceptions from AArch64 > > - handle exception from EL2, since this helper already deals with that > > > The latter point of course means introducing GCSCR_EL2 (and everything > > that depends on it, such as the trap handling). > > For clarity, which trap handling specifically? All the traps described in the GCSCR_EL2 documentation -- I see two control bits described in K.a, all of which needs to be propagated and their effects handled. Similarly, GCSPR_EL2 needs to be defined. M. -- Without deviation from the norm, progress is not possible.