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 611BB1D89E9; Thu, 5 Dec 2024 11:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733396745; cv=none; b=M9LS2iOXcoBbOb3crmtlKFoltmxTiwcexpNI6nxjuV+Nc1jw3/715FIUwNvGaYJmqQBaNdWO2J/ympV+EcvY4JnGvS3oHSW+Sm9bzKb0LTDFrCmioLKQV0BTTf8OdMoEH8OtcjUxrVstG37WVU0dqEYMLRLX0GUZFIKMiyFSkFo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733396745; c=relaxed/simple; bh=7qEFDnVWDKnQE5vhrgDGQVUO3Mkq7JDzj0t4dg/cGaE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=T/u0nqTXmWk9L3hJXGmepASB9l6rw43z8flht6+XlBP3S8dfiCVPSyZx6fLTMG3JYfnvd0Kkq/virVJKeR8E238gENHzcrIfX4OnYCrpaux2kEw3EgiOzmZQH7YLuVdDGJNit5vQ6zkAeUO6ZzFkyEfmagg0DtFlLZAZArZP9Lo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VN7aySVe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VN7aySVe" 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) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org 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: 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 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.