summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2019-05-20 09:15:12 +0200
committerPaul Mackerras <paulus@ozlabs.org>2019-05-29 13:44:37 +1000
commitd47aacdb8e0bc03dcaa1a5630a3c633cdcd4cfa7 (patch)
tree61c7e7804d649495d3e5baffe0473f76026ec172 /arch
parent5a3f49364c3ffa1107bd88f8292406e98c5d206c (diff)
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 <paulus@ozlabs.org> Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/book3s_xive_native.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c
index da31dd05fd72..9cedd04e7a44 100644
--- a/arch/powerpc/kvm/book3s_xive_native.c
+++ b/arch/powerpc/kvm/book3s_xive_native.c
@@ -977,6 +977,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
* the device. Therefore there can not be any of the