public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: muli@il.ibm.com
To: avi@redhat.com
Cc: kvm@vger.kernel.org, anthony@codemonkey.ws,
	weidong.han@intel.com, benami@il.ibm.com, muli@il.ibm.com,
	amit.shah@redhat.com, allen.m.kay@intel.com
Subject: [PATCH 1/6] device assignment: add ioctl wrappers
Date: Tue, 28 Oct 2008 12:06:45 +0200	[thread overview]
Message-ID: <1225188410-2222-2-git-send-email-muli@il.ibm.com> (raw)
In-Reply-To: <1225188410-2222-1-git-send-email-muli@il.ibm.com>

From: Amit Shah <amit.shah@redhat.com>

[muli: return -errno instead of ioctl retval]

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
---
 libkvm/libkvm.c |   25 +++++++++++++++++++++++++
 libkvm/libkvm.h |   27 +++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 444b97f..e7dba8a 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -1112,3 +1112,28 @@ int kvm_unregister_coalesced_mmio(kvm_context_t kvm, uint64_t addr, uint32_t siz
 	return -ENOSYS;
 }
 
+#ifdef KVM_CAP_DEVICE_ASSIGNMENT
+int kvm_assign_pci_device(kvm_context_t kvm,
+			  struct kvm_assigned_pci_dev *assigned_dev)
+{
+	int ret;
+
+	ret = ioctl(kvm->vm_fd, KVM_ASSIGN_PCI_DEVICE, assigned_dev);
+	if (ret < 0)
+		return -errno;
+
+	return ret;
+}
+
+int kvm_assign_irq(kvm_context_t kvm,
+		   struct kvm_assigned_irq *assigned_irq)
+{
+	int ret;
+
+	ret = ioctl(kvm->vm_fd, KVM_ASSIGN_IRQ, assigned_irq);
+	if (ret < 0)
+		return -errno;
+
+	return ret;
+}
+#endif
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 423ce31..53d67f2 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -686,4 +686,31 @@ int kvm_s390_interrupt(kvm_context_t kvm, int slot,
 int kvm_s390_set_initial_psw(kvm_context_t kvm, int slot, psw_t psw);
 int kvm_s390_store_status(kvm_context_t kvm, int slot, unsigned long addr);
 #endif
+
+#ifdef KVM_CAP_DEVICE_ASSIGNMENT
+/*!
+ * \brief Notifies host kernel about a PCI device to be assigned to a guest
+ *
+ * Used for PCI device assignment, this function notifies the host
+ * kernel about the assigning of the physical PCI device to a guest.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param assigned_dev Parameters, like bus, devfn number, etc
+ */
+int kvm_assign_pci_device(kvm_context_t kvm,
+			  struct kvm_assigned_pci_dev *assigned_dev);
+
+/*!
+ * \brief Notifies host kernel about changes to IRQ for an assigned device
+ *
+ * Used for PCI device assignment, this function notifies the host
+ * kernel about the changes in IRQ number for an assigned physical
+ * PCI device.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param assigned_irq Parameters, like dev id, host irq, guest irq, etc
+ */
+int kvm_assign_irq(kvm_context_t kvm,
+		   struct kvm_assigned_irq *assigned_irq);
+#endif
 #endif
-- 
1.5.6.5


  reply	other threads:[~2008-10-28 10:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 10:06 [v8] Userspace patches for PCI device assignment muli
2008-10-28 10:06 ` muli [this message]
2008-10-28 10:06   ` [PATCH 2/6] device assignment: introduce pci_map_irq to get irq nr from pin number muli
2008-10-28 10:06     ` [PATCH 3/6] device assignment: introduce functions to correlate pin number and irq muli
2008-10-28 10:06       ` [PATCH 4/6] device assignment: build vtd.c for Intel IOMMU support muli
2008-10-28 10:06         ` [PATCH 5/6] device assignment: support for assigning PCI devices to guests muli
2008-10-28 10:06           ` [PATCH 6/6] device assignment: support for hot-plugging PCI devices muli
2008-10-28 14:10           ` [PATCH 5/6] device assignment: support for assigning PCI devices to guests Han, Weidong
2008-10-28 15:32             ` Muli Ben-Yehuda
     [not found]           ` <715D42877B251141A38726ABF5CABF2C018683D874@pdsmsx503.ccr.corp.intel.com>
2008-10-28 15:31             ` Han, Weidong
2008-10-28 15:36           ` Han, Weidong
2008-10-28 15:47             ` Muli Ben-Yehuda
2008-10-28 15:45           ` Anthony Liguori
2008-10-28 15:53             ` Muli Ben-Yehuda
2008-10-29  7:56               ` Zhang, Xiantao
2008-10-29 10:27                 ` Muli Ben-Yehuda
2008-10-29  8:22               ` Han, Weidong
2008-10-29 10:25               ` Muli Ben-Yehuda
2008-10-29 10:39                 ` Muli Ben-Yehuda
2008-10-28 16:55           ` Mark McLoughlin
2008-10-29 10:31             ` Muli Ben-Yehuda
2008-10-29 11:07               ` Mark McLoughlin
2008-10-29 11:15               ` Mark McLoughlin
2008-10-29 11:47                 ` Muli Ben-Yehuda
2008-10-29  7:38         ` [PATCH 4/6] device assignment: build vtd.c for Intel IOMMU support Zhang, Xiantao
  -- strict thread matches above, loose matches on Subject: below --
2008-10-29 10:22 [v9] Userspace patches for PCI device assignment muli
2008-10-29 10:22 ` [PATCH 1/6] device assignment: add ioctl wrappers muli
2008-10-29 12:19 [v10] Userspace patches for PCI device assignment muli
2008-10-29 12:19 ` [PATCH 1/6] device assignment: add ioctl wrappers muli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1225188410-2222-2-git-send-email-muli@il.ibm.com \
    --to=muli@il.ibm.com \
    --cc=allen.m.kay@intel.com \
    --cc=amit.shah@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=benami@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=weidong.han@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox