From: Cédric Le Goater Date: Mon, 20 May 2019 07:15:12 +0000 (+0200) Subject: KVM: PPC: Book3S HV: XIVE: Clear file mapping when device is released X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d47aacdb8e0bc03dcaa1a5630a3c633cdcd4cfa7;p=linux.git KVM: PPC: Book3S HV: XIVE: Clear file mapping when device is released 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édric Le Goater Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c index da31dd05fd72f..9cedd04e7a449 100644 --- a/arch/powerpc/kvm/book3s_xive_native.c +++ b/arch/powerpc/kvm/book3s_xive_native.c @@ -976,6 +976,14 @@ static void kvmppc_xive_native_release(struct kvm_device *dev) pr_devel("Releasing xive native device\n"); + /* + * 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 = NULL; + mutex_unlock(&xive->mapping_lock); + /* * Since this is the device release function, we know that * userspace does not have any open fd or mmap referring to