From: "Michael S. Tsirkin" <mst@redhat.com>
To: yamahata@valinux.co.jp, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 6/6] pci/aer: factor out common code
Date: Fri, 3 Dec 2010 00:54:47 +0200 [thread overview]
Message-ID: <7ab56779a4dcd09712ff1045ca8dcd312faae435.1291330353.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1291330353.git.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 1c513a7..ca4f517 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
@@ -352,13 +363,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);
}
/*
@@ -768,13 +773,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 {
- assert(0);
- }
+ pcie_aer_root_notify(dev);
}
static const VMStateDescription vmstate_pcie_aer_err = {
--
1.7.3.2.91.g446ac
next prev parent reply other threads:[~2010-12-02 22:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-02 22:54 [Qemu-devel] [PATCH 0/6] pcie aer fixes Michael S. Tsirkin
2010-12-02 22:54 ` [Qemu-devel] [PATCH 1/6] pci: untangle pci/msi dependency Michael S. Tsirkin
2010-12-04 13:35 ` [Qemu-devel] " Paolo Bonzini
2010-12-09 9:53 ` Michael S. Tsirkin
2010-12-07 7:21 ` Isaku Yamahata
2010-12-02 22:54 ` [Qemu-devel] [PATCH 3/6] pci/aer: remove dead code Michael S. Tsirkin
2010-12-07 7:29 ` [Qemu-devel] " Isaku Yamahata
2010-12-02 22:54 ` [Qemu-devel] [PATCH 4/6] pci/aer: fix error injection Michael S. Tsirkin
2010-12-02 22:54 ` [Qemu-devel] [PATCH 5/6] pci/aer: fix interrupt on config write Michael S. Tsirkin
2010-12-07 7:23 ` [Qemu-devel] " Isaku Yamahata
2010-12-02 22:54 ` Michael S. Tsirkin [this message]
2010-12-07 7:24 ` [Qemu-devel] Re: [PATCH 6/6] pci/aer: factor out common code Isaku Yamahata
2010-12-02 22:54 ` [Qemu-devel] [PATCH 2/6] Makefile: make msix/msi depend on CONFIG_PCI Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ab56779a4dcd09712ff1045ca8dcd312faae435.1291330353.git.mst@redhat.com \
--to=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).