* [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes
@ 2010-12-08 8:46 Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 1/6] pci: untangle pci/msi dependency Isaku Yamahata
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
I respined the patch series by mst for bisectability.
Changes v1 -> v2:
- reorder patches for bisectability
- s/assert/trigger/ to avoid name conflict
- abort() instead of assert(0)
Original patch description:
Here are a bunch of fixes and cleanups to aer interrupt injection.
Compile tested only, issues were found by reading the
code and spec.
Michael S. Tsirkin (6):
pci: untangle pci/msi dependency
Makefile: make msix/msi depend on CONFIG_PCI
pci/aer: fix error injection
pci/aer: fix interrupt on config write
pci/aer: remove dead code
pci/aer: factor out common code
Makefile.objs | 3 +-
hw/pci.c | 19 ----------
hw/pci.h | 3 --
hw/pcie.c | 8 +++--
hw/pcie_aer.c | 111 ++++++++++++++++++++++++++------------------------------
5 files changed, 59 insertions(+), 85 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATTCH v2 1/6] pci: untangle pci/msi dependency
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
@ 2010-12-08 8:46 ` Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 2/6] Makefile: make msix/msi depend on CONFIG_PCI Isaku Yamahata
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
From: Michael S. Tsirkin <mst@redhat.com>
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>
---
Changes v1 -> v2:
- s/assert/trigger/g
variable name, assert, would conflict with assert.h
- msi_trigger
---
hw/pci.c | 19 -------------------
hw/pci.h | 3 ---
hw/pcie.c | 8 +++++---
hw/pcie_aer.c | 24 ++++++++++++++++--------
4 files changed, 21 insertions(+), 33 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index ca878e8..254647b 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -25,8 +25,6 @@
#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"
@@ -1099,23 +1097,6 @@ 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 099c251..aa3afe9 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -261,9 +261,6 @@ 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)
{
diff --git a/hw/pcie.c b/hw/pcie.c
index f461c1c..d1f0086 100644
--- a/hw/pcie.c
+++ b/hw/pcie.c
@@ -167,10 +167,12 @@ static void hotplug_event_notify(PCIDevice *dev)
* The Port may optionally send an MSI when there are hot-plug events that
* occur while interrupt generation is disabled, and interrupt generation is
* subsequently enabled. */
- if (!pci_msi_enabled(dev)) {
+ if (msix_enabled(dev)) {
+ msix_notify(dev, pcie_cap_flags_get_vector(dev));
+ } else if (msi_enabled(dev)) {
+ msi_notify(dev, pcie_cap_flags_get_vector(dev));
+ } else {
qemu_set_irq(dev->irq[dev->exp.hpev_intx], dev->exp.hpev_notified);
- } else if (dev->exp.hpev_notified) {
- pci_msi_notify(dev, pcie_cap_flags_get_vector(dev));
}
}
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index 235ac53..80cc438 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);
}
}
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATTCH v2 2/6] Makefile: make msix/msi depend on CONFIG_PCI
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 1/6] pci: untangle pci/msi dependency Isaku Yamahata
@ 2010-12-08 8:46 ` Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 3/6] pci/aer: fix error injection Isaku Yamahata
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
From: Michael S. Tsirkin <mst@redhat.com>
Possible now that pci is not depending on these.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Makefile.objs | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index 04625eb..d1e63ce 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -168,7 +168,8 @@ hw-obj-$(CONFIG_VIRTIO) += virtio.o virtio-console.o
hw-obj-y += fw_cfg.o
# FIXME: Core PCI code and its direct dependencies are required by the
# QMP query-pci command.
-hw-obj-y += pci.o pci_bridge.o msix.o msi.o
+hw-obj-y += pci.o pci_bridge.o
+hw-obj-$(CONFIG_PCI) += msix.o msi.o
hw-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o
hw-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o
hw-obj-y += watchdog.o
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATTCH v2 3/6] pci/aer: fix error injection
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 1/6] pci: untangle pci/msi dependency Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 2/6] Makefile: make msix/msi depend on CONFIG_PCI Isaku Yamahata
@ 2010-12-08 8:46 ` Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 4/6] pci/aer: fix interrupt on config write Isaku Yamahata
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
From: Michael S. Tsirkin <mst@redhat.com>
Fix the injection logic upon aer message to follow 6.2.4.1.2 more
closely: specifically only send an msi interrupt when the logical or of
the enabled bits changed, not when a bit which was previously clear
becomes set.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Changes v1 -> v2:
- reorder
---
hw/pcie_aer.c | 51 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index 80cc438..bc98da0 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -257,6 +257,22 @@ static unsigned int pcie_aer_root_get_vector(PCIDevice *dev)
return (root_status & PCI_ERR_ROOT_IRQ) >> PCI_ERR_ROOT_IRQ_SHIFT;
}
+/* Given a status register, get corresponding bits in the command register */
+static uint32_t pcie_aer_status_to_cmd(uint32_t status)
+{
+ uint32_t cmd = 0;
+ if (status & PCI_ERR_ROOT_COR_RCV) {
+ cmd |= PCI_ERR_ROOT_CMD_COR_EN;
+ }
+ if (status & PCI_ERR_ROOT_NONFATAL_RCV) {
+ cmd |= PCI_ERR_ROOT_CMD_NONFATAL_EN;
+ }
+ if (status & PCI_ERR_ROOT_FATAL_RCV) {
+ cmd |= PCI_ERR_ROOT_CMD_FATAL_EN;
+ }
+ return cmd;
+}
+
/*
* return value:
* true: error message is sent up
@@ -272,14 +288,14 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
uint16_t cmd;
uint8_t *aer_cap;
uint32_t root_cmd;
- uint32_t root_status;
+ uint32_t root_status, prev_status;
bool msi_trigger;
msg_sent = false;
cmd = pci_get_word(dev->config + PCI_COMMAND);
aer_cap = dev->config + dev->exp.aer_cap;
root_cmd = pci_get_long(aer_cap + PCI_ERR_ROOT_COMMAND);
- root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
+ prev_status = root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
msi_trigger = false;
if (cmd & PCI_COMMAND_SERR) {
@@ -337,20 +353,23 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
}
pci_set_long(aer_cap + PCI_ERR_ROOT_STATUS, root_status);
- if (root_cmd & msg->severity) {
- /* 6.2.4.1.2 Interrupt Generation */
- if (msix_enabled(dev)) {
- if (msi_trigger) {
- 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);
- }
- msg_sent = true;
+ /* 6.2.4.1.2 Interrupt Generation */
+ /* All the above did was set some bits in the status register.
+ * Specifically these that match message severity.
+ * The below code relies on this fact. */
+ if (!(root_cmd & msg->severity) ||
+ (pcie_aer_status_to_cmd(prev_status) & root_cmd)) {
+ /* Condition is not being set or was already true so nothing to do. */
+ return msg_sent;
+ }
+
+ msg_sent = true;
+ 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);
}
return msg_sent;
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATTCH v2 4/6] pci/aer: fix interrupt on config write
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
` (2 preceding siblings ...)
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 3/6] pci/aer: fix error injection Isaku Yamahata
@ 2010-12-08 8:46 ` Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 5/6] pci/aer: remove dead code Isaku Yamahata
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
From: Michael S. Tsirkin <mst@redhat.com>
config write handling for aer seems broken:
For example, it won't clear a level interrupt
when command register is set to 0.
Make it match the spec: level should equal
the logical or of enabled bits, msi only
be sent when the logical or changes.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
- reorder
- abort() instead of assert(0)
---
hw/pcie_aer.c | 46 +++++++++++++++++-----------------------------
1 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index bc98da0..389e9d5 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -762,43 +762,31 @@ void pcie_aer_root_reset(PCIDevice *dev)
*/
}
-static bool pcie_aer_root_does_trigger(uint32_t cmd, uint32_t status)
-{
- return
- ((cmd & PCI_ERR_ROOT_CMD_COR_EN) && (status & PCI_ERR_ROOT_COR_RCV)) ||
- ((cmd & PCI_ERR_ROOT_CMD_NONFATAL_EN) &&
- (status & PCI_ERR_ROOT_NONFATAL_RCV)) ||
- ((cmd & PCI_ERR_ROOT_CMD_FATAL_EN) &&
- (status & PCI_ERR_ROOT_FATAL_RCV));
-}
-
void pcie_aer_root_write_config(PCIDevice *dev,
uint32_t addr, uint32_t val, int len,
uint32_t root_cmd_prev)
{
uint8_t *aer_cap = dev->config + dev->exp.aer_cap;
-
- /* root command register */
+ uint32_t root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
+ uint32_t enabled_cmd = pcie_aer_status_to_cmd(root_status);
uint32_t root_cmd = pci_get_long(aer_cap + PCI_ERR_ROOT_COMMAND);
- if (root_cmd & PCI_ERR_ROOT_CMD_EN_MASK) {
- /* 6.2.4.1.2 Interrupt Generation */
+ /* 6.2.4.1.2 Interrupt Generation */
+ if (!msix_enabled(dev) && !msi_enabled(dev)) {
+ qemu_set_irq(dev->irq[dev->exp.aer_intx], !!(root_cmd & enabled_cmd));
+ return;
+ }
- /* 0 -> 1 */
- 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 ((root_cmd_prev & enabled_cmd) || !(root_cmd & enabled_cmd)) {
+ /* Send MSI on transition from false to true. */
+ return;
+ }
- 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 {
- qemu_set_irq(dev->irq[dev->exp.aer_intx], trigger);
- }
+ 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();
}
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATTCH v2 5/6] pci/aer: remove dead code
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
` (3 preceding siblings ...)
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 4/6] pci/aer: fix interrupt on config write Isaku Yamahata
@ 2010-12-08 8:46 ` Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code Isaku Yamahata
2010-12-09 11:23 ` [Qemu-devel] Re: [PATTCH v2 0/6] pcie aer fixes Michael S. Tsirkin
6 siblings, 0 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
From: Michael S. Tsirkin <mst@redhat.com>
Remove some unused variables and return values.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
changes v1 -> v2:
- reorder
---
hw/pcie_aer.c | 25 ++-----------------------
1 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index 389e9d5..0fb21ab 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -274,29 +274,21 @@ static uint32_t pcie_aer_status_to_cmd(uint32_t status)
}
/*
- * return value:
- * true: error message is sent up
- * false: error message is masked
- *
* 6.2.6 Error Message Control
* Figure 6-3
* root port part
*/
-static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
+static void pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
{
- bool msg_sent;
uint16_t cmd;
uint8_t *aer_cap;
uint32_t root_cmd;
uint32_t root_status, prev_status;
- bool msi_trigger;
- msg_sent = false;
cmd = pci_get_word(dev->config + PCI_COMMAND);
aer_cap = dev->config + dev->exp.aer_cap;
root_cmd = pci_get_long(aer_cap + PCI_ERR_ROOT_COMMAND);
prev_status = root_status = pci_get_long(aer_cap + PCI_ERR_ROOT_STATUS);
- msi_trigger = false;
if (cmd & PCI_COMMAND_SERR) {
/* System Error.
@@ -315,25 +307,14 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
if (root_status & PCI_ERR_ROOT_COR_RCV) {
root_status |= PCI_ERR_ROOT_MULTI_COR_RCV;
} else {
- if (root_cmd & PCI_ERR_ROOT_CMD_COR_EN) {
- msi_trigger = true;
- }
pci_set_word(aer_cap + PCI_ERR_ROOT_COR_SRC, msg->source_id);
}
root_status |= PCI_ERR_ROOT_COR_RCV;
break;
case PCI_ERR_ROOT_CMD_NONFATAL_EN:
- if (!(root_status & PCI_ERR_ROOT_NONFATAL_RCV) &&
- root_cmd & PCI_ERR_ROOT_CMD_NONFATAL_EN) {
- msi_trigger = true;
- }
root_status |= PCI_ERR_ROOT_NONFATAL_RCV;
break;
case PCI_ERR_ROOT_CMD_FATAL_EN:
- if (!(root_status & PCI_ERR_ROOT_FATAL_RCV) &&
- root_cmd & PCI_ERR_ROOT_CMD_FATAL_EN) {
- msi_trigger = true;
- }
if (!(root_status & PCI_ERR_ROOT_UNCOR_RCV)) {
root_status |= PCI_ERR_ROOT_FIRST_FATAL;
}
@@ -360,10 +341,9 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
if (!(root_cmd & msg->severity) ||
(pcie_aer_status_to_cmd(prev_status) & root_cmd)) {
/* Condition is not being set or was already true so nothing to do. */
- return msg_sent;
+ return;
}
- msg_sent = true;
if (msix_enabled(dev)) {
msix_notify(dev, pcie_aer_root_get_vector(dev));
} else if (msi_enabled(dev)) {
@@ -371,7 +351,6 @@ static bool pcie_aer_msg_root_port(PCIDevice *dev, const PCIEAERMsg *msg)
} else {
qemu_set_irq(dev->irq[dev->exp.aer_intx], 1);
}
- return msg_sent;
}
/*
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
` (4 preceding siblings ...)
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 5/6] pci/aer: remove dead code Isaku Yamahata
@ 2010-12-08 8:46 ` Isaku Yamahata
2010-12-09 11:23 ` [Qemu-devel] Re: [PATTCH v2 0/6] pcie aer fixes Michael S. Tsirkin
6 siblings, 0 replies; 8+ messages in thread
From: Isaku Yamahata @ 2010-12-08 8:46 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
From: Michael S. Tsirkin <mst@redhat.com>
Same logic is used to assert interrupts
and send msix messages, so add a static functin for this.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: [PATTCH v2 0/6] pcie aer fixes
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
` (5 preceding siblings ...)
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code Isaku Yamahata
@ 2010-12-09 11:23 ` Michael S. Tsirkin
6 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2010-12-09 11:23 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel
On Wed, Dec 08, 2010 at 05:46:22PM +0900, Isaku Yamahata wrote:
> I respined the patch series by mst for bisectability.
Applied, thanks.
> Changes v1 -> v2:
> - reorder patches for bisectability
> - s/assert/trigger/ to avoid name conflict
> - abort() instead of assert(0)
>
> Original patch description:
> Here are a bunch of fixes and cleanups to aer interrupt injection.
> Compile tested only, issues were found by reading the
> code and spec.
>
> Michael S. Tsirkin (6):
> pci: untangle pci/msi dependency
> Makefile: make msix/msi depend on CONFIG_PCI
> pci/aer: fix error injection
> pci/aer: fix interrupt on config write
> pci/aer: remove dead code
> pci/aer: factor out common code
>
> Makefile.objs | 3 +-
> hw/pci.c | 19 ----------
> hw/pci.h | 3 --
> hw/pcie.c | 8 +++--
> hw/pcie_aer.c | 111 ++++++++++++++++++++++++++------------------------------
> 5 files changed, 59 insertions(+), 85 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-12-09 11:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08 8:46 [Qemu-devel] [PATTCH v2 0/6] pcie aer fixes Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 1/6] pci: untangle pci/msi dependency Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 2/6] Makefile: make msix/msi depend on CONFIG_PCI Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 3/6] pci/aer: fix error injection Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 4/6] pci/aer: fix interrupt on config write Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 5/6] pci/aer: remove dead code Isaku Yamahata
2010-12-08 8:46 ` [Qemu-devel] [PATTCH v2 6/6] pci/aer: factor out common code Isaku Yamahata
2010-12-09 11:23 ` [Qemu-devel] Re: [PATTCH v2 0/6] pcie aer fixes Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).