summaryrefslogtreecommitdiffstats
path: root/hw/pci.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-10-19 18:06:29 +0900
committerMichael S. Tsirkin <mst@redhat.com>2010-10-19 13:57:24 +0200
commita5d1fd20ccfd1fbe840729378e4adbc3eb0f8306 (patch)
tree0ea6ce039fc13d1044040728ccc2932b79afe066 /hw/pci.c
parentaabcf5266f94e637afd4c38d46d1fc1d1381d99e (diff)
downloadhqemu-a5d1fd20ccfd1fbe840729378e4adbc3eb0f8306.zip
hqemu-a5d1fd20ccfd1fbe840729378e4adbc3eb0f8306.tar.gz
pci: introduce helper function to handle msi-x and msi.
this patch implements helper functions to handle msi-x and msi uniformly. They will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/pci.c b/hw/pci.c
index e3462a9..300079f 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -25,6 +25,8 @@
#include "pci.h"
#include "pci_bridge.h"
#include "pci_internals.h"
+#include "msix.h"
+#include "msi.h"
#include "monitor.h"
#include "net.h"
#include "sysemu.h"
@@ -1034,6 +1036,23 @@ static void pci_set_irq(void *opaque, int irq_num, int level)
pci_change_irq_level(pci_dev, irq_num, change);
}
+bool pci_msi_enabled(PCIDevice *dev)
+{
+ return msix_enabled(dev) || msi_enabled(dev);
+}
+
+void pci_msi_notify(PCIDevice *dev, unsigned int vector)
+{
+ if (msix_enabled(dev)) {
+ msix_notify(dev, vector);
+ } else if (msi_enabled(dev)) {
+ msi_notify(dev, vector);
+ } else {
+ /* MSI/MSI-X must be enabled */
+ abort();
+ }
+}
+
/***********************************************************/
/* monitor info on PCI */
OpenPOWER on IntegriCloud