Skip to content

Commit

Permalink
KVM: PPC: Book3S HV: XIVE: Clear file mapping when device is released
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cédric Le Goater authored and Paul Mackerras committed May 29, 2019
1 parent 5a3f493 commit d47aacd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/powerpc/kvm/book3s_xive_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d47aacd

Please sign in to comment.