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 A800BC54E4A for ; Mon, 26 Feb 2024 10:09:15 +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: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sdFzIKYJ/YImPlJshxx8EobDu7BmWA9OF982b2zITw0=; b=EzCGPCEQsmSSwT ocBJzauNfmobGSKkHPKOFJEEyQU3wxLHi+noCrrsdlvMr+uOcBZNMHAZ2ovaxZD/OFfoSZkM9KIMX u7Y86E1n3a59Y7HGmWk7vpKnbyYtWXc9HJV9z1FjGb3uIIMzsb3D1/p0LhqK3Jt7k8/95aUrkcUQ6 fl3w9EKhJgScZmbM56uEfN3rLGzyjxdBpyijdgu5xFz9vML3OxL0Vc02grKrBOEk+Z2o2/Rg6YEd7 rtAianwNeZdsQGwU82X1+6uhUL9hMn76+H3SSWwSgg4eoh+83fwwNd+HXfDUxuXeaTGUGn9BJcX9r B0CvrRxuufLf3S/lDkoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reXuS-0000000HXrs-3oP7; Mon, 26 Feb 2024 10:08:32 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reXtz-0000000HXie-0tFu for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Feb 2024 10:08:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xikCibclXOgsE4o9B/W7OB+fLV6efdEdQg2j91wRLVQ=; b=NVi3R0lIZJ8kgAXsIybx+5p+Se Z8fbKxzEDSedav0RitcDiP58TOTdSkWmUX5fnFpwLIX3uoagsV8LIke2vpb12dyX8wF48zPBlrolO Yi9EaiQ1R2bS0bSEhNhkidTLsZzPC/Djg655J+uTciU+fHcMAniZxR7HNgvN5gFOnWGd21UOqaVTY 87KOSlaopVUMp90fD/9A0YqQoScAG7hUwHV/Ibq+Q7qRXfvz0H8WSq2Vr/rPp5/gFoti0a0hL7cul uI/ifdJIpzoSAKLUemdzlnj2KMgMg72uv9aVeiWnu2BAcpcN/uS5oJ9HqpzdTGZhKUMZ7HbDIy6oG h3QyPWPQ==; Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reXtq-00000001707-2EwI for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2024 10:08:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7999260FB4; Mon, 26 Feb 2024 10:07:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31F7CC433F1; Mon, 26 Feb 2024 10:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708942056; bh=/JFNRuFhSNGUhTs1Ose+PaTc1pfV2tE0oa2Vq1kSAYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5UHoJwRw7p66gnCLeiadvZecd7/5/7v6eJbv9DNVZuJFOMk+sUYviiKs5t+P6p9f uB68Pin4ZBtc0fPFUUcHeLz0EqjsZfkTQfl5hKJM2xJDV4gjwMbHco5MsDO4ymkuI2 4lJ86wET6qqhUedE/OJ6Hd4yFHvQSBU7yDtiuqWZxNhlVyWYvPjb/XmfQf9syuQRyq 7LHOn8ieDjorZXRCSVLrckweQWJqXHmEErttT6h0Cm2UDuUgZZV74a9zc1faIGzmQ0 E6RCS5zpbHz7AxVjLFA3p2EjSEIxy2cket01KZ/riWBd2fzloO7ySbWIDSEOnxA1gQ bUEZfhwBE3xLw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1reXtV-006nQ5-Up; Mon, 26 Feb 2024 10:07:34 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Will Deacon , Catalin Marinas Subject: [PATCH v2 03/13] KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag Date: Mon, 26 Feb 2024 10:05:51 +0000 Message-Id: <20240226100601.2379693-4-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240226100601.2379693-1-maz@kernel.org> References: <20240226100601.2379693-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, will@kernel.org, catalin.marinas@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-20240226_100755_106652_97EAE994 X-CRM114-Status: GOOD ( 12.97 ) 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 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 a5ec4c7d3966..75eb8e170515 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)) { u64 mode = *vcpu_cpsr(vcpu) & (PSR_MODE_MASK | PSR_MODE32_BIT); switch (mode) { @@ -240,11 +240,6 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) sysreg_restore_guest_state_vhe(guest_ctxt); __debug_switch_to_guest(vcpu); - if (is_hyp_ctxt(vcpu)) - vcpu_set_flag(vcpu, VCPU_HYP_CONTEXT); - else - vcpu_clear_flag(vcpu, VCPU_HYP_CONTEXT); - do { /* Jump in the fire! */ exit_code = __guest_enter(vcpu); -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel