[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 02/14] pci: introduce helper function to handle m
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v5 02/14] pci: introduce helper function to handle msi-x and msi. |
Date: |
Tue, 19 Oct 2010 18:06:29 +0900 |
this patch implements helper functions to handle msi-x and msi
uniformly.
They will be used later.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.c | 19 +++++++++++++++++++
hw/pci.h | 3 +++
2 files changed, 22 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 */
diff --git a/hw/pci.h b/hw/pci.h
index 752e652..3072a5f 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -239,6 +239,9 @@ void do_pci_info_print(Monitor *mon, const QObject *data);
void do_pci_info(Monitor *mon, QObject **ret_data);
void pci_bridge_update_mappings(PCIBus *b);
+bool pci_msi_enabled(PCIDevice *dev);
+void pci_msi_notify(PCIDevice *dev, unsigned int vector);
+
static inline void
pci_set_byte(uint8_t *config, uint8_t val)
{
--
1.7.1.1
- [Qemu-devel] [PATCH v5 00/14] pcie port switch emulators, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 04/14] pci/bridge: fix pci_bridge_reset(), Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 13/14] pcie/hotplug: introduce pushing attention button command, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 03/14] pci: use pci_word_test_and_clear_mask() in pci_device_reset(), Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 02/14] pci: introduce helper function to handle msi-x and msi.,
Isaku Yamahata <=
- [Qemu-devel] [PATCH v5 14/14] pcie/aer: glue aer error injection into qemu monitor, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 01/14] pci: introduce helper functions to test-and-{clear, set} mask in configuration space, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 06/14] pcie: add pcie constants to pcie_regs.h, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 12/14] x3130: pcie downstream port, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 07/14] pcie: helper functions for pcie capability and extended capability, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 08/14] pcie/aer: helper functions for pcie aer capability, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 11/14] x3130: pcie upstream port, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 09/14] pcie port: define struct PCIEPort/PCIESlot and helper functions, Isaku Yamahata, 2010/10/19
- [Qemu-devel] [PATCH v5 05/14] msi: implements msi, Isaku Yamahata, 2010/10/19