From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Mon, 20 May 2019 07:15:12 +0000 Subject: [PATCH 1/3] KVM: PPC: Book3S HV: XIVE: clear file mapping when device is released Message-Id: <20190520071514.9308-2-clg@kaod.org> List-Id: References: <20190520071514.9308-1-clg@kaod.org> In-Reply-To: <20190520071514.9308-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: kvm-ppc@vger.kernel.org Cc: Paul Mackerras , David Gibson , kvm@vger.kernel.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paul Mackerras Improve the release of the XIVE KVM device by clearing the file address_space which is used to unmap the interrupt ESB pages when a device is passed-through. Suggested-by: Paul Mackerras Signed-off-by: C=C3=A9dric Le Goater --- arch/powerpc/kvm/book3s_xive_native.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3= s_xive_native.c index 6a8e698c4b6e..796d86549cfe 100644 --- a/arch/powerpc/kvm/book3s_xive_native.c +++ b/arch/powerpc/kvm/book3s_xive_native.c @@ -979,6 +979,14 @@ static void kvmppc_xive_native_release(struct kvm_devi= ce *dev) =20 pr_devel("Releasing xive native device\n"); =20 + /* + * Clear the KVM device file address_space which is used to + * unmap the ESB pages when a device is passed-through. + */ + mutex_lock(&xive->mapping_lock); + xive->mapping =3D NULL; + mutex_unlock(&xive->mapping_lock); + /* * Clearing mmu_ready temporarily while holding kvm->lock * is a way of ensuring that no vcpus can enter the guest --=20 2.20.1