[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code |
Date: |
Wed, 8 Dec 2010 17:46:28 +0900 |
From: Michael S. Tsirkin <address@hidden>
Same logic is used to assert interrupts
and send msix messages, so add a static functin for this.
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/pcie_aer.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index 0fb21ab..2ceb00a 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -273,6 +273,17 @@ static uint32_t pcie_aer_status_to_cmd(uint32_t status)
return cmd;
}
+static void pcie_aer_root_notify(PCIDevice *dev)
+{
+ if (msix_enabled(dev)) {
+ msix_notify(dev, pcie_aer_root_get_vector(dev));
+ } else if (msi_enabled(dev)) {
+ msi_notify(dev, pcie_aer_root_get_vector(dev));
+ } else {
+ qemu_set_irq(dev->irq[dev->exp.aer_intx], 1);
+ }
+}
+
/*
* 6.2.6 Error Message Control
* Figure 6-3
@@ -344,13 +355,7 @@ static void pcie_aer_msg_root_port(PCIDevice *dev, const
PCIEAERMsg *msg)
return;
}
- if (msix_enabled(dev)) {
- msix_notify(dev, pcie_aer_root_get_vector(dev));
- } else if (msi_enabled(dev)) {
- msi_notify(dev, pcie_aer_root_get_vector(dev));
- } else {
- qemu_set_irq(dev->irq[dev->exp.aer_intx], 1);
- }
+ pcie_aer_root_notify(dev);
}
/*
@@ -760,13 +765,7 @@ void pcie_aer_root_write_config(PCIDevice *dev,
return;
}
- if (msix_enabled(dev)) {
- msix_notify(dev, pcie_aer_root_get_vector(dev));
- } else if (msi_enabled(dev)) {
- msi_notify(dev, pcie_aer_root_get_vector(dev));
- } else {
- abort();
- }
+ pcie_aer_root_notify(dev);
}
static const VMStateDescription vmstate_pcie_aer_err = {
--
1.7.1.1
- [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes, Isaku Yamahata, 2010/12/08
- [Qemu-devel] [PATTCH v2 4/6] pci/aer: fix interrupt on config write, Isaku Yamahata, 2010/12/08
- [Qemu-devel] [PATTCH v2 2/6] Makefile: make msix/msi depend on CONFIG_PCI, Isaku Yamahata, 2010/12/08
- [Qemu-devel] [PATTCH v2 5/6] pci/aer: remove dead code, Isaku Yamahata, 2010/12/08
- [Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code,
Isaku Yamahata <=
- [Qemu-devel] [PATTCH v2 3/6] pci/aer: fix error injection, Isaku Yamahata, 2010/12/08
- [Qemu-devel] [PATTCH v2 1/6] pci: untangle pci/msi dependency, Isaku Yamahata, 2010/12/08
- [Qemu-devel] Re: [PATTCH v2 0/6] pcie aer fixes, Michael S. Tsirkin, 2010/12/09