aboutsummaryrefslogtreecommitdiff
path: root/hw/pcie_aer.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-12-08 17:46:23 +0900
committerMichael S. Tsirkin <mst@redhat.com>2010-12-09 12:48:18 +0200
commit4a9dd6658268a942a8ea230f950a951229355cbb (patch)
tree1273e979fefd46bbe01299a570221121d784bb12 /hw/pcie_aer.c
parentb1aeb92666d2fde413c34578b3b42bbfe5f2a506 (diff)
pci: untangle pci/msi dependency
msi depends on pci but pci should not depend on msi. The only dependency we have is a recent addition of pci_msi_ functions, IMO they add little enough to open-code in the small number of users. Follow-up patches add more cleanups. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Diffstat (limited to 'hw/pcie_aer.c')
-rw-r--r--hw/pcie_aer.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index 47d64003fc..dac27c39fe 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -339,9 +339,13 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
if (root_cmd & msg->severity) {
/* 6.2.4.1.2 Interrupt Generation */
- if (pci_msi_enabled(dev)) {
+ if (msix_enabled(dev)) {
if (msi_trigger) {
- pci_msi_notify(dev, pcie_aer_root_get_vector(dev));
+ msix_notify(dev, pcie_aer_root_get_vector(dev));
+ }
+ } else if (msi_enabled(dev)) {
+ if (msi_trigger) {
+ msi_notify(dev, pcie_aer_root_get_vector(dev));
}
} else {
qemu_set_irq(dev->irq[dev->exp.aer_intx], 1);
@@ -761,16 +765,20 @@ void pcie_aer_root_write_config(PCIDevice *dev,
/* 6.2.4.1.2 Interrupt Generation */
/* 0 -> 1 */
- uint32_t root_cmd_set = (root_cmd_prev ^ root_cmd) & root_cmd;
+ uint32_t root_cmd_set = ~root_cmd_prev & root_cmd;
uint32_t root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
+ bool trigger = pcie_aer_root_does_trigger(root_cmd_set, root_status);
- if (pci_msi_enabled(dev)) {
- if (pcie_aer_root_does_trigger(root_cmd_set, root_status)) {
- pci_msi_notify(dev, pcie_aer_root_get_vector(dev));
+ if (msix_enabled(dev)) {
+ if (trigger) {
+ msix_notify(dev, pcie_aer_root_get_vector(dev));
+ }
+ } else if (msi_enabled(dev)) {
+ if (trigger) {
+ msi_notify(dev, pcie_aer_root_get_vector(dev));
}
} else {
- int int_level = pcie_aer_root_does_trigger(root_cmd, root_status);
- qemu_set_irq(dev->irq[dev->exp.aer_intx], int_level);
+ qemu_set_irq(dev->irq[dev->exp.aer_intx], trigger);
}
}
}