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 A4108C4345F for ; Tue, 16 Apr 2024 20:07:00 +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=nW7NhSRl+SGsY1JKo1VpFy1ZOjHaU5LBUiKOHP8Jw4w=; b=EPBZgcjg07cR69 mkd2TOyv/2Xa/VGXmPvYi0+J9gu9Tc3zwXDcM6J4xegBZYSUMwCByeYWlV5mC0tsB2MOXF4eSGarX DgSac9SyTkgJm7YieYl3rC11+pAmB8TUsgTtYdN0CscnA0oHqtCOHcIX3gRqr6baJcs6ZfVN5K8y5 GcQoQcXRF3TTXr3Rmqbett16gUGBcId9KWKTcevOeweK6CJ9VWPBBGNe99cGFf0vXDDbGNfMojCsC 9zElC7xJ10Y+qyESrc9ESgMV5eobqF6eZkr7+fugDytAjZ2MPmWskhRDmmux1rJC/ceKSG4PuTujI WyWuyf1h56L3PFV+0LAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwp4n-0000000DdKN-1sBt; Tue, 16 Apr 2024 20:06:45 +0000 Received: from out-172.mta1.migadu.com ([2001:41d0:203:375::ac]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwp4g-0000000DdI0-0dXK for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2024 20:06:44 +0000 Date: Tue, 16 Apr 2024 20:06:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713297991; 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=VSWPho2kknmGfgIdFVf+iWGjKotisbb0h2HUCV7V9K8=; b=B3VgsmvrFpWAjoUVeUtpn8K+mXtgPiZF6T3anGdR8d0uD1r54eKA2ZgBtMPwF4zSyI4kkj 96MEqmfFQ1hRkQZXv0r+fON7NNgzfnWpmqaXyer9CFSpkdk1wWAZ7SFqVxbr5tqiq92FQc YU8OGIo5wgGNrzVM4G+T0AB76Loc23A= 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, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Joey Gouly , Will Deacon , Catalin Marinas Subject: Re: [PATCH v3 04/15] KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag Message-ID: References: <20240321155356.3236459-1-maz@kernel.org> <20240321155356.3236459-5-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240321155356.3236459-5-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_130638_921548_A2E1523C X-CRM114-Status: GOOD ( 16.91 ) 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 Thu, Mar 21, 2024 at 03:53:45PM +0000, Marc Zyngier wrote: > It has become obvious that HCR_EL2.NV serves the exact same use > as VCPU_HYP_CONTEXT, only in an architectural way. So just drop > the flag for good. > > Reviewed-by: Joey Gouly > Signed-off-by: Marc Zyngier > --- > arch/arm64/include/asm/kvm_host.h | 2 -- > arch/arm64/kvm/hyp/vhe/switch.c | 7 +------ > 2 files changed, 1 insertion(+), 8 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 839c76529bb2..3f1c3c91e5c2 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -816,8 +816,6 @@ struct kvm_vcpu_arch { > #define DEBUG_STATE_SAVE_SPE __vcpu_single_flag(iflags, BIT(5)) > /* Save TRBE context if active */ > #define DEBUG_STATE_SAVE_TRBE __vcpu_single_flag(iflags, BIT(6)) > -/* vcpu running in HYP context */ > -#define VCPU_HYP_CONTEXT __vcpu_single_flag(iflags, BIT(7)) > > /* SVE enabled for host EL0 */ > #define HOST_SVE_ENABLED __vcpu_single_flag(sflags, BIT(0)) > diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c > index 1581df6aec87..58415783fd53 100644 > --- a/arch/arm64/kvm/hyp/vhe/switch.c > +++ b/arch/arm64/kvm/hyp/vhe/switch.c > @@ -197,7 +197,7 @@ static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code) > * If we were in HYP context on entry, adjust the PSTATE view > * so that the usual helpers work correctly. > */ > - if (unlikely(vcpu_get_flag(vcpu, VCPU_HYP_CONTEXT))) { > + if (unlikely(read_sysreg(hcr_el2) & HCR_NV)) { Can this be additionally predicated on vcpu_has_nv() so we condition on the NV cpucap and avoid the sysreg read on non-nesting hardware? -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel