[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211007134922.sg3b3egpwc2izbi2@gator>
Date: Thu, 7 Oct 2021 15:49:22 +0200
From: Andrew Jones <drjones@...hat.com>
To: Marc Zyngier <maz@...nel.org>
Cc: linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org, will@...nel.org,
qperret@...gle.com, dbrazdil@...gle.com,
Steven Price <steven.price@....com>,
Fuad Tabba <tabba@...gle.com>,
Srivatsa Vaddagiri <vatsa@...eaurora.org>,
Shanker R Donthineni <sdonthineni@...dia.com>,
James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
kernel-team@...roid.com
Subject: Re: [PATCH v2 06/16] KVM: arm64: Force a full unmap on vpcu reinit
On Mon, Oct 04, 2021 at 06:48:39PM +0100, Marc Zyngier wrote:
> As we now keep information in the S2PT, we must be careful not
> to keep it across a VM reboot, which could otherwise lead to
> interesting problems.
>
> Make sure that the S2 is completely discarded on reset of
> a vcpu, and remove the flag that enforces the MMIO check.
>
> Signed-off-by: Marc Zyngier <maz@...nel.org>
> ---
> arch/arm64/kvm/psci.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm64/kvm/psci.c b/arch/arm64/kvm/psci.c
> index 74c47d420253..6c9cb041f764 100644
> --- a/arch/arm64/kvm/psci.c
> +++ b/arch/arm64/kvm/psci.c
> @@ -12,6 +12,7 @@
>
> #include <asm/cputype.h>
> #include <asm/kvm_emulate.h>
> +#include <asm/kvm_mmu.h>
>
> #include <kvm/arm_psci.h>
> #include <kvm/arm_hypercalls.h>
> @@ -180,6 +181,13 @@ static void kvm_prepare_system_event(struct kvm_vcpu *vcpu, u32 type)
> tmp->arch.power_off = true;
> kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_SLEEP);
>
> + /*
> + * If the MMIO guard was enabled, we pay the price of a full
> + * unmap to get back to a sane state (and clear the flag).
> + */
> + if (test_and_clear_bit(KVM_ARCH_FLAG_MMIO_GUARD, &vcpu->kvm->arch.flags))
> + stage2_unmap_vm(vcpu->kvm);
> +
> memset(&vcpu->run->system_event, 0, sizeof(vcpu->run->system_event));
> vcpu->run->system_event.type = type;
> vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
> --
> 2.30.2
>
Reviewed-by: Andrew Jones <drjones@...hat.com>
Powered by blists - more mailing lists