From patchwork Wed Oct 9 19:00:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13829196 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 AF1B8CEE343 for ; Wed, 9 Oct 2024 20:10:56 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H4PwoNtax4QUESZK439rL19PTqCY+iRtdLi232dITis=; b=Ih42G/+gUExzMEu49vQ6RtclKP r2VIMDHJO+F/IqujTYulpgGNiXHIbM4b6jTauOFAi5asGFD5NYcxUd21MT+W6vtK/5BTZqtPft6W3 1uhMKgDIJHHYGL6dqer4feQB0iGuGdjgLrzK7NS0iKbTH+jg6jJZ1HT9wfl+J7KiPV2pT7UInrfmt rLCJK3hons9K/05LY5q+e1R+7uiVZxcQWqpOcf/WRe1E4FBziItx62NUUEn91v9QDIPORfiYnYcIK udxmNEqWcgKw0rOf1WyS0F1tWbB06lkN4W1yOq2T3MsyGJ6lTmdfFzpWhDqPMpwL2ORPlkkJyWRQ6 OvmAL0XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syd15-0000000AaP9-2z1n; Wed, 09 Oct 2024 20:10:39 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sybva-0000000ARJb-3Huz for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 19:01:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F1AF05C5D2E; Wed, 9 Oct 2024 19:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04571C4CECE; Wed, 9 Oct 2024 19:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728500449; bh=EBML1UPI/XbYRfxzj0vXzXyo3UGhbMQqqUkLLxHimA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mISyacbg0DxO9q7oP4Ht4u1Fm+cTGec9LkLZjUgfLggVYc/2crgrvx89Ssq7UgYIM Fa/cYs+2/7hUIl/jUn3f9NftKtfoHbSOgEo/s+4jcmr1lo2Je4TprZdKuwHqloO654 kVEY2RpyzgoQMy6g1VcZRg6Xl0WKxhzfo1gKkUBY1rW+lphcv4EF/Ry/ah/vRYvNDc jmE8loNZplwW0KMvu9XhZlWzkkjttHDTADcATDd1peOjJXhBeK1sqXmjZy0QzDJSUC Op2N5bM6ndns9DYllNBWghEG+dIFAU8tS8H0ntS/7Ct7d6TWrYVSlRRM2eMn9X1XaM qBCWalw1fqUIg== 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 1sybvT-001wcY-78; Wed, 09 Oct 2024 20:00:47 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Alexandru Elisei , Mark Brown Subject: [PATCH v4 31/36] KVM: arm64: Add save/retore support for POR_EL2 Date: Wed, 9 Oct 2024 20:00:14 +0100 Message-Id: <20241009190019.3222687-32-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241009190019.3222687-1-maz@kernel.org> References: <20241009190019.3222687-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, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, alexandru.elisei@arm.com, broonie@kernel.org 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-20241009_120055_061844_87DEDAB4 X-CRM114-Status: GOOD ( 10.23 ) 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 POR_EL2 needs saving when the guest is VHE, and restoring in any case. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kvm/hyp/vhe/sysreg-sr.c b/arch/arm64/kvm/hyp/vhe/sysreg-sr.c index 005175c10b4a9..86078bd37f8bb 100644 --- a/arch/arm64/kvm/hyp/vhe/sysreg-sr.c +++ b/arch/arm64/kvm/hyp/vhe/sysreg-sr.c @@ -58,6 +58,9 @@ static void __sysreg_save_vel2_state(struct kvm_vcpu *vcpu) __vcpu_sys_reg(vcpu, PIRE0_EL2) = read_sysreg_el1(SYS_PIRE0); __vcpu_sys_reg(vcpu, PIR_EL2) = read_sysreg_el1(SYS_PIR); } + + if (ctxt_has_s1poe(&vcpu->arch.ctxt)) + __vcpu_sys_reg(vcpu, POR_EL2) = read_sysreg_el1(SYS_POR); } /* @@ -124,6 +127,9 @@ static void __sysreg_restore_vel2_state(struct kvm_vcpu *vcpu) write_sysreg_el1(__vcpu_sys_reg(vcpu, PIR_EL2), SYS_PIR); write_sysreg_el1(__vcpu_sys_reg(vcpu, PIRE0_EL2), SYS_PIRE0); } + + if (ctxt_has_s1poe(&vcpu->arch.ctxt)) + write_sysreg_el1(__vcpu_sys_reg(vcpu, POR_EL2), SYS_POR); } write_sysreg_el1(__vcpu_sys_reg(vcpu, ESR_EL2), SYS_ESR);