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 67505EB64DC for ; Tue, 27 Jun 2023 16:37:02 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3WOisUxJKqBNRXnXpZ0mvKqiXEMqXYEt17d0ttN1SJQ=; b=uD7UOlgPtEO/8R 3DLyQWBkMu/xgtbPM/A0a5yW8sl0S5dXTDwbT+K409A1VRGus/oMLGkZ1damDzvsKVAVR98LNFk7A c+pMbBPUHXRwnpw6UkO3JgidQB5vUws1zzcabXNQqum1AWiuTDIJjUOd3CJvs2vdGvUGPGNS3ZpbA hpXWbHKQT3zJrrV8eVo8mI94kO6SKwg+he/WiAuqHznloemA4Q0ZmalkHKzLfv+XUkdKAsDTvc1uR 3e+pBFdWV5Vayj9HkDnHwNYlreTqYzkljAJD2WSpDmL3f3NcPrLRlMb8E29pZRm1jPdzSPdytPMcN d14xPrmiUete3Ufpciww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qEBg5-00DeXb-2c; Tue, 27 Jun 2023 16:36:29 +0000 Received: from out-49.mta0.migadu.com ([91.218.175.49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qEBg3-00DeWj-03 for linux-arm-kernel@lists.infradead.org; Tue, 27 Jun 2023 16:36:28 +0000 Date: Tue, 27 Jun 2023 16:36:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1687883781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TdPWXSyjblV3/5xOatcCVLPo7q0/XX1p8z7/HRrMyY4=; b=EXIZVy5J6MxGX9EQ+OKpXpnnjbw5vcyBncQrLh1i58J5rK3yZEUFuI1CpFoLhqMING/XeP KXHTTGtwb2mpSmLdpYfZnQfT8KEgSBAzQk7Yr6uodNnP/9VUfXRhrmcb6YtTumqyh/1+1j WQz0gZ20fj54qKqWLkxZptQhaLjcGAQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier 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 Message-ID: References: <20230627140557.544885-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230627140557.544885-1-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230627_093627_214812_E5C9558D X-CRM114-Status: GOOD ( 18.07 ) 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, 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. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel