Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1387650pxb; Thu, 7 Oct 2021 06:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5O6aYnehJws85Q0Aw0UaI/4Bo6LCevJrKOfM0utlqe6mqlN3ufiteTV3ACCMIU5wdh7VG X-Received: by 2002:a17:90b:4b85:: with SMTP id lr5mr5028592pjb.66.1633614758346; Thu, 07 Oct 2021 06:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633614758; cv=none; d=google.com; s=arc-20160816; b=Lfrc11Nm3ryRL3Vu9G/p1S7jlk0NQePIF0jgOpkhGE0DUEHcJEuARPz8vF+nlDakVl TBW8bDic+qzyTj1DFmFvf0VJuwLJHNIG+MYYGTIx1xyTx3Ep2U9uMO+VplNYU/Znbzaa EpZbfVW/HWpZPY4R/dCocHjYE8VcNvb+Qvvmdau88QZuPeFZyiJzcTeWvjLRL2UAGRF1 W7tAwjIUG5tL5bhD0XF+I/5Z0BVAuw7m5AzWtrJrhKZfsg175u9TMlBcyjhwFOzcdyi7 qpSWeDzEMUQszndZumPKI19z0L2Ft8uBJ76+XPEz+++lx0Ya0ynHqdB7OqQqG6TcWNPj Mc+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YV63mS4RpYRoGQSZMwqbE1CRZKLm8qRI0uKOruLtURg=; b=yXDkYticG4XNx8sIIB3rHjW4O5ziy33GNPjxnP9ZTcC3zLF9lAgmDOwXOs8NDxeC3K z9BXZRZTCVVl4oXxxPuJ0lebcYTTw3aIjZg3uZsI/5bgRr1ORZfkMxhvYvNMYkMf3pHU vQem1UIL67J3omRgH+KecXSmvHF7PkMA1p0blWhx76wbxaCOfY3lWaHBD3DO7pyw6Vp2 njYQdnRs6x6yTRd+3sbOa5VQfQTFk2a4aqnacE/hYHvdi9hLqd9J2riMj+Be7iN/VS+6 ugKYQL6nLVjehpefnhDWEiLeeWmu8tZ2XgKvDlfARvDMdzc4lSQBwFWUO8cHKBjFYaMp vTEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i81V86cX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 35si12693582pgq.480.2021.10.07.06.52.24; Thu, 07 Oct 2021 06:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i81V86cX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233003AbhJGNv1 (ORCPT + 99 others); Thu, 7 Oct 2021 09:51:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54271 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241800AbhJGNvX (ORCPT ); Thu, 7 Oct 2021 09:51:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633614568; 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=YV63mS4RpYRoGQSZMwqbE1CRZKLm8qRI0uKOruLtURg=; b=i81V86cXVmYstB2kUR6CDyvShggvjV+7y5CE6LT9OIcmWvuTDK99twXtdTY6o7oYef704f MXD7s+eTSe3DahlsMXm7UoqsZd7BlODiWOzYPlba5Rm1r4gJO2/8PsXTYjSbOmGevmZu0j /Gv5mvJ8LRa2UGqM5SnJgimlvqfmH+A= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-UTc2yRX6PE-VT2Zbv9iJBw-1; Thu, 07 Oct 2021 09:49:27 -0400 X-MC-Unique: UTc2yRX6PE-VT2Zbv9iJBw-1 Received: by mail-qt1-f199.google.com with SMTP id r13-20020ac86d2d000000b002a755d36425so5218036qtu.14 for ; Thu, 07 Oct 2021 06:49:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YV63mS4RpYRoGQSZMwqbE1CRZKLm8qRI0uKOruLtURg=; b=hjTiib6t2bQNjcEX6Tldht9iyFhj6Udlef8l+3Mhhg0ymlctfJSFAE4rSyvAJDmQiL CLZ8eLaiM+eFVdGBlBByRfFlkSDjAcBqr4ytyL/JSn7jdLpNObwNM+pxxIfr7Bx38PJB QgVYxbSD8wHgCQJsGltNFCjomGwlcJimqhnO5Gyasvx690eSH1SmVOtCxVfFHCCoW6Dt VSbLPbOYHQ4NbxmS/rCXmB9Goom8yZoTA1gU6UM5sQ8E9lUxk//IM1N+3s7M12fUWPJC 8w2ac4fuFHsxg8ZrOFJwTMgmIg1QGe1JDGF79XCCpR+LPo1QfiXIVO7zM82fapg6Z77T 4YqQ== X-Gm-Message-State: AOAM532NdX9vqMXZKfBO2ha6njulzFZXq3MUjpdCY8DADkeDywNsOxX3 pnc+E21Sw3DEJrlu1SiExBcnIIfJZklhhSPnfhDMoPL/zr4Uuf+FAp6uP9bGdto+2HVoo6Rfvvo uVamZhCUbV5QKOZJTmLTxdGUr X-Received: by 2002:a05:6214:a4d:: with SMTP id ee13mr4121147qvb.6.1633614567252; Thu, 07 Oct 2021 06:49:27 -0700 (PDT) X-Received: by 2002:a05:6214:a4d:: with SMTP id ee13mr4121130qvb.6.1633614567050; Thu, 07 Oct 2021 06:49:27 -0700 (PDT) Received: from gator (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id n123sm633770qke.36.2021.10.07.06.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 06:49:26 -0700 (PDT) Date: Thu, 7 Oct 2021 15:49:22 +0200 From: Andrew Jones To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, qperret@google.com, dbrazdil@google.com, Steven Price , Fuad Tabba , Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH v2 06/16] KVM: arm64: Force a full unmap on vpcu reinit Message-ID: <20211007134922.sg3b3egpwc2izbi2@gator> References: <20211004174849.2831548-1-maz@kernel.org> <20211004174849.2831548-7-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211004174849.2831548-7-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 > #include > +#include > > #include > #include > @@ -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