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 E5B49E77170 for ; Thu, 5 Dec 2024 11:07: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: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=/kQuycqurqXX8SdZ+5sBUs/k0wd14WdsquBUEuCo02A=; b=KpAXc1eZLyJpUiZzUoDcrqlD/C vpApxoa2mmRRJ9BD1Qz2WVzSq4LDcpvMGM1+GTs0LyuT5Laz+Fn4KF/E+kVbmZgQN8u1pmW67FiDC PgdsNooSpPybAiObydn24/OePgIbtpqiFUHxdk0E79RD8jaLVonfHDQF4bpYyAww4ZdukfUdW7jL0 /5rKoh9KbkJ+ZJZ2vPGWuYLq9jlRBCozOS/fLGHBzSUoMdgAB40YmbKR43kMr/t6F0iI7tE9jZI4d gTHpQ4QXgyvkShQaG1R9FgV4gnCFfMXd3SLdaSpDWZgXPMhldATGIQPD79fcptFWsP+YCJLICPvHm YXtjmd8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJ9h3-0000000Fejz-0n0P; Thu, 05 Dec 2024 11:06:49 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJ9g2-0000000Feat-1uSb for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2024 11:05:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5ED41A43198; Thu, 5 Dec 2024 11:03:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4D94C4CED1; Thu, 5 Dec 2024 11:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733396745; bh=7qEFDnVWDKnQE5vhrgDGQVUO3Mkq7JDzj0t4dg/cGaE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VN7aySVe51BTx5iMa0nq5uCIPsayqS/SrYd6YjB7RgqplH1O+omxfN1vrrEaWH/kj WQiiiMKp+R+KNJ7DUQvd6jDevzLi+M0aQK9GQWYZo3FAgTneTzaEQeQEqYBUCEywxf qNJmvC+drEjx7+tGwqlVaRXF8uXGk7YMRqEvE7+x39ac0Q/i+itUccvX3s7fok266I yNfkoWhARLCZgAiuZ/elXGTuNlVPg3XlP4XrxKY7ie/Grk6WZvgDYwV5iAyLroViQX jOBpsBG8xzOkNmqxxeOreSShPePD+juL7SoJEqoDx3Ahd4zClOpcQlIp1ck5IbGGvi 1fUj0CizpyM/A== 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 1tJ9e1-000lyP-UO; Thu, 05 Dec 2024 11:05:42 +0000 Date: Thu, 05 Dec 2024 11:03:41 +0000 Message-ID: <86ikrytmr6.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, Joey Gouly , Suzuki K Poulose , Zenghui Yu , Bjorn Andersson , Christoffer Dall Subject: Re: [PATCH 06/11] KVM: arm64: nv: Acceletate EL0 counter accesses from hypervisor context In-Reply-To: References: <20241202172134.384923-1-maz@kernel.org> <20241202172134.384923-7-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 (aarch64-unknown-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: oliver.upton@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, andersson@kernel.org, christoffer.dall@arm.com 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-20241205_030546_555603_737D1839 X-CRM114-Status: GOOD ( 13.16 ) 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, 05 Dec 2024 00:37:34 +0000, Oliver Upton wrote: > > typo: accelerate Huh, thanks! > > On Mon, Dec 02, 2024 at 05:21:29PM +0000, Marc Zyngier wrote: [...] > > + case SYS_CNTVCT_EL0: > > + case SYS_CNTVCTSS_EL0: > > + /* If !ELIsInHost(EL2), the guest's CNTVOFF_EL2 applies */ > > !ELIsInHost(EL0) No, and that's the whole point. CNTVOFF_EL2 applies at all times when HCR_EL2==0 and that we're at EL2. From the pseudocode for CNTVCT_EL0: [...] elsif PSTATE.EL == EL2 then if !ELIsInHost(EL2) then X[t, 64] = PhysicalCountInt() - CNTVOFF_EL2; else X[t, 64] = PhysicalCountInt(); [...] Which is why we only check E2H, and not E2H+TGE. It is CNTPOFF_EL2 that applies when !ELIsInHost(EL0), and this is why it cannot be reliably emulated as we don't (and cannot) track changes to HCR_EL2.TGE. Yes, this is nonsense. M. -- Without deviation from the norm, progress is not possible.