mirror of
https://github.com/qemu/qemu.git
synced 2024-11-29 14:53:35 +08:00
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>
This commit is contained in:
parent
aabcf5266f
commit
a5d1fd20cc
19
hw/pci.c
19
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 */
|
||||
|
||||
|
3
hw/pci.h
3
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user