summaryrefslogtreecommitdiff
path: root/libkvm
diff options
context:
space:
mode:
authorWeidong Han <weidong.han@intel.com>2009-05-21 17:08:38 -0700
committerEduardo Habkost <ehabkost@redhat.com>2009-05-28 18:55:18 -0300
commit4b71bd9e25cbf932ff02b04b9db31458481b3209 (patch)
tree077c7227a381fa7806a2bff0b641b56b63e823cb /libkvm
parente80d654b2c16b64595b2598f2d3e168683bc0fa5 (diff)
kvm: libkvm: add deassign ioctl
Add this to support hot remove assigned device. Acked-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Weidong Han <weidong.han@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com> (cherry picked from commit 0512290fa039bfb8254df33bd5e1a8407add4211) Signed-off-by: Chris Wright <chrisw@redhat.com> Bugzilla: 498084 Message-Id: <1242950924-30161-8-git-send-email-chrisw@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Upstream-status: applied Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Don Dutile <ddutile@redhat.com>
Diffstat (limited to 'libkvm')
-rw-r--r--libkvm/libkvm.c14
-rw-r--r--libkvm/libkvm.h13
2 files changed, 27 insertions, 0 deletions
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 92332077..5ffb01f8 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -1154,6 +1154,20 @@ int kvm_assign_irq(kvm_context_t kvm,
}
#endif
+#ifdef KVM_CAP_DEVICE_DEASSIGNMENT
+int kvm_deassign_pci_device(kvm_context_t kvm,
+ struct kvm_assigned_pci_dev *assigned_dev)
+{
+ int ret;
+
+ ret = ioctl(kvm->vm_fd, KVM_DEASSIGN_PCI_DEVICE, assigned_dev);
+ if (ret < 0)
+ return -errno;
+
+ return ret;
+}
+#endif
+
int kvm_destroy_memory_region_works(kvm_context_t kvm)
{
int ret = 0;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 40275d74..87dded7b 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -721,6 +721,19 @@ int kvm_assign_irq(kvm_context_t kvm,
int kvm_destroy_memory_region_works(kvm_context_t kvm);
#endif
+#ifdef KVM_CAP_DEVICE_DEASSIGNMENT
+/*!
+ * \brief Notifies host kernel about a PCI device to be deassigned from a guest
+ *
+ * Used for hot remove PCI device, this function notifies the host
+ * kernel about the deassigning of the physical PCI device from a guest.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param assigned_dev Parameters, like bus, devfn number, etc
+ */
+int kvm_deassign_pci_device(kvm_context_t kvm,
+ struct kvm_assigned_pci_dev *assigned_dev);
+#endif
/*!
* \brief Checks whether the generic irq routing capability is present