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 1E150EB64D9 for ; Tue, 27 Jun 2023 17:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rjrNdFw0FLedl88QHW1J0OZxb5vdE4BipvNkG3j58Ig=; b=wkhSmqqrl9SGbp TUmz6dVk0zhMKylZ6GoCLae4lDBKx3wBVwi2Z+118COAs3LgTKPQBUYuf47Z2ExJPiqmooYebRO6+ v0h18ssqDw0A5jQNILSKn9zBhZv2pWSq2XIWa+wijGRKUIe+fH4uNmnW5yq7Qo8Fppf86gjN1z73+ RN0689J4iIHdT1Uxftg/pkXArytFVjjk9na3rZ+e9XyI2J/A5bUdjB+pYvUaNwxZvdFgCNfX7ADZK VfzdW0A8kBHR9dQMGohntQnbL1CzdpzNJMjk2F7MnjhptH2viyNBm6N7YLKgkUVuIJY2WAHrkp4p2 sh1W6ln5W8nno8Oyx4Ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qECHV-00Dhqt-1c; Tue, 27 Jun 2023 17:15:09 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qECHT-00DhqS-19 for linux-arm-kernel@lists.infradead.org; Tue, 27 Jun 2023 17:15:08 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E3DC611D1; Tue, 27 Jun 2023 17:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6C4DC433C0; Tue, 27 Jun 2023 17:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687886105; bh=t9t1/a06KinouPCACcUuUpceqv6hMh2a6Tw4XIcjN4c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WsQ45bPsRfyitg7EavXXk3MVtRFks+vihvVXxuENZTdS+E8wbhnMxkwCFii6JmAA3 IhCahkSjnnSQcMCU8sZSmNFccI5E67IqphG+pkebqKJNbDU+CBJ2Lte8sIK9KMLUvA tXJ6BLFwGsxZBj2F6q7twe8DnjPvo9LO4YG374IQBHpyEKwx9Oq31iT5L7m0vDodhA CS+wCu6sT/5eA9m53Gg9phGk+yvrO6pfL+sGdJcmr6qpEUVrhaj4vXQX6aYcTn2OW9 6tWG1yLTtvlv2rgjWOQXlII0l2g8Pk9t7n2pr783ZtbPnUmXYHeCa+8wKqSpAuvs8+ /VWyWTKx7wK5Q== 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 1qECHP-008sHp-7W; Tue, 27 Jun 2023 18:15:03 +0100 Date: Tue, 27 Jun 2023 18:14:58 +0100 Message-ID: <86cz1gygh9.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu , stable@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: timers: Use CNTHCTL_EL2 when setting non-CNTKCTL_EL1 bits In-Reply-To: References: <20230627140557.544885-1-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/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, stable@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-20230627_101507_477377_5748DD04 X-CRM114-Status: GOOD ( 28.33 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 27 Jun 2023 17:36:16 +0100, Oliver Upton wrote: > > On Tue, Jun 27, 2023 at 03:05:57PM +0100, Marc Zyngier wrote: > > It recently appeared that, whien running VHE, there is a notable > > difference between using CNTKCTL_EL1 and CNTHCTL_EL2, despite what > > the architecture documents: > > > > - When accessed from EL2, bits [19:18] and [16:10] same bits have > > the same assignment as CNTHCTL_EL2 > > - When accessed from EL1, bits [19:18] and [16:10] are RES0 > > > > It is all OK, until you factor in NV, where the EL2 guest runs at EL1. > > In this configuration, CNTKCTL_EL11 doesn't trap, nor ends up in > > the VNCR page. This means that any write from the guest affecting > > CNTHCTL_EL2 using CNTKCTL_EL1 ends up losing some state. Not good. > > > > The fix it obvious: don't use CNTKCTL_EL1 if you want to change bits > > that are not part of the EL1 definition of CNTKCTL_EL1, and use > > CNTHCTL_EL2 instead. This doesn't change anything for a bare-metal OS, > > and fixes it when running under NV. The NV hypervisor will itself > > have to work harder to merge the two accessors. > > > > Note that there is a pending update to the architecture to address > > this issue by making the affected bits UNKNOWN when CNTKCTL_EL1 is > > user from EL2 with VHE enabled. > > > > Fixes: c605ee245097 ("KVM: arm64: timers: Allow physical offset without CNTPOFF_EL2") > > Signed-off-by: Marc Zyngier > > Cc: stable@vger.kernel.org # v6.4 > > Looks good. I'll probably open a fixes branch around -rc1 and pick this > patch up then. Awesome, thanks. (/me goes back to encoding FGT handling by hand... :-/) M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel