From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C08F61DDDD for ; Fri, 21 Jul 2023 13:41:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3790DC433CA; Fri, 21 Jul 2023 13:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689946914; bh=BSJk9O4xFcMfPmu+z8NskWVtRs269ehnwbVyZUZJHlc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XcpYfYE9WdS7ZL4RQJ0vYcUbsYSrUx4XrYWBWiyVcDr5QRFSVPrNnEsFGNzlnmuf2 sKHN14tMvwjpDPfV6jqdISqzAkNdI848oqm2DipVyJg9GNjWtOF2w1cyGuPA4LQps4 PJIPJMcmcpNzjStd77IHKCwKq3M6CP2zMs+VW1O7qeO2LWE3i1GsfDCEZni21aFj3E 4uk9wjuG/tNhHToFvShBoXQh8rCm9i3h/v7qvGoPqMQy6wLTC6HTWBz8OocsrKJ+kl wxyaAD7RXlWxWZ6L3jKW60baM6T6GN7ckfXH8yG9PSQWHd041I435opV2yPyYYvbWL v84ldUcJ8IYJg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.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 1qMqOF-00FZVi-OG; Fri, 21 Jul 2023 14:41:51 +0100 Date: Fri, 21 Jul 2023 14:41:51 +0100 Message-ID: <86o7k5tm8w.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, oliver.upton@linux.dev, catalin.marinas@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org Subject: Re: [PATCH v2 0/7] Fix setting SVE and SME traps in (h)VHE In-Reply-To: <20230721095144.306817-1-tabba@google.com> References: <20230721095144.306817-1-tabba@google.com> 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/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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: tabba@google.com, kvmarm@lists.linux.dev, oliver.upton@linux.dev, catalin.marinas@arm.com, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Hey Fuad, On Fri, 21 Jul 2023 10:51:37 +0100, Fuad Tabba wrote: > > Hi, > > Changes from V1: > - Expanded the cover letter to clarify the reasoning behind being > consistent in writing to the architectural trap register based on > the KVM mode (Marc) > - Factored out the code for checking E2H into a macro (Oliver) > - Factored out the code that selects which register to write to > into a function (Oliver) > > The (re)setting and disabling of SVE/SME trap handling (mostly) > done for the hVHE work [*] misses a couple of cases. > > This patch series ensures that these traps are disabled on setup > and reset. Moreover, it makes the code consistent in using > CPACR_EL1 or CPTR_EL2, depending on the mode. > > CPACR_EL1 aliases to CPTR_EL2 when HCR_EL2.E2H == 1, but by being > consistent we don't need to issue a synchronisation when > alternating between one or the other accessor. Moreover, when > running hVHE under NV, we don't trap unnecessarily on accessing > CPTR_EL2, while CPACR_EL1 can be used directly without any trap. > > Based on Linux 6.5-rc2. > > Cheers, > /fuad > > [*] https://lore.kernel.org/all/20230609162200.2024064-1-maz@kernel.org/ > > Fuad Tabba (7): > KVM: arm64: Factor out code for checking E2H into a macro > KVM: arm64: Use the appropriate feature trap register for SVE at EL2 > setup > KVM: arm64: Disable SME traps for (h)VHE at setup > KVM: arm64: Helper to write to appropriate feature trap register based > on mode > KVM: arm64: Use the appropriate feature trap register when activating > traps > KVM: arm64: Fix resetting SVE trap values on reset for hVHE > KVM: arm64: Fix resetting SME trap values on reset for (h)VHE > > arch/arm64/include/asm/el2_setup.h | 44 ++++++++++++++++++---------- > arch/arm64/include/asm/kvm_emulate.h | 21 ++++++++++--- > arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- > 3 files changed, 47 insertions(+), 20 deletions(-) Thanks again for fixing this, and going the extra mile on the cleanup front. FWIW, Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.