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@xxxxxxxxxx> Signed-off-by: Cédric Le Goater <clg@xxxxxxxx> --- 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/book3s_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_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); + /* * Clearing mmu_ready temporarily while holding kvm->lock * is a way of ensuring that no vcpus can enter the guest -- 2.20.1