From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Isaku Yamahata <yamahata@valinux.co.jp>,
Alexander Graf <agraf@suse.de>, Gerd Hoffmann <kraxel@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH v4 5/8] msi: Invoke msi/msix_reset from PCI core
Date: Tue, 15 May 2012 20:09:56 -0300 [thread overview]
Message-ID: <4FB2E244.2090006@siemens.com> (raw)
In-Reply-To: <a47c3e4162d2724decd35c67843ef8903b6cccca.1336747349.git.jan.kiszka@siemens.com>
There is no point in pushing this burden to the devices, they tend to
forget to call them (like intel-hda, ahci, xhci did). Instead, reset
functions are now called from pci_device_reset. They do nothing if
MSI/MSI-X is not in use.
CC: Alexander Graf <agraf@suse.de>
CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v4:
- removed redundant msi_reset from bridges and msix_reset from ivshmem
hw/ide/ich.c | 1 -
hw/intel-hda.c | 3 ---
hw/ioh3420.c | 2 +-
hw/ivshmem.c | 1 -
hw/pci.c | 5 +++++
hw/pci_bridge.c | 10 ++--------
hw/pci_bridge_dev.c | 4 +---
hw/virtio-pci.c | 1 -
hw/xio3130_downstream.c | 2 +-
hw/xio3130_upstream.c | 2 +-
10 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index e7026bb..d3bc822 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -88,7 +88,6 @@ static void pci_ich9_reset(DeviceState *dev)
{
struct AHCIPCIState *d = DO_UPCAST(struct AHCIPCIState, card.qdev, dev);
- msi_reset(&d->card);
ahci_reset(&d->ahci);
}
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index e38861e..bb11af2 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1107,9 +1107,6 @@ static void intel_hda_reset(DeviceState *dev)
DeviceState *qdev;
HDACodecDevice *cdev;
- if (d->msi) {
- msi_reset(&d->pci);
- }
intel_hda_regs_reset(d);
d->wall_base_ns = qemu_get_clock_ns(vm_clock);
diff --git a/hw/ioh3420.c b/hw/ioh3420.c
index 1632d31..d1499da 100644
--- a/hw/ioh3420.c
+++ b/hw/ioh3420.c
@@ -81,7 +81,7 @@ static void ioh3420_write_config(PCIDevice *d,
static void ioh3420_reset(DeviceState *qdev)
{
PCIDevice *d = PCI_DEVICE(qdev);
- msi_reset(d);
+
ioh3420_aer_vector_update(d);
pcie_cap_root_reset(d);
pcie_cap_deverr_reset(d);
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index d48e5f9..05559b6 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -530,7 +530,6 @@ static void ivshmem_reset(DeviceState *d)
IVShmemState *s = DO_UPCAST(IVShmemState, dev.qdev, d);
s->intrstatus = 0;
- msix_reset(&s->dev);
ivshmem_use_msix(s);
return;
}
diff --git a/hw/pci.c b/hw/pci.c
index b706e69..2148245 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -31,6 +31,8 @@
#include "loader.h"
#include "range.h"
#include "qmp-commands.h"
+#include "msi.h"
+#include "msix.h"
//#define DEBUG_PCI
#ifdef DEBUG_PCI
@@ -188,6 +190,9 @@ void pci_device_reset(PCIDevice *dev)
}
}
pci_update_mappings(dev);
+
+ msi_reset(dev);
+ msix_reset(dev);
}
/*
diff --git a/hw/pci_bridge.c b/hw/pci_bridge.c
index 866f0b6..e0832b4 100644
--- a/hw/pci_bridge.c
+++ b/hw/pci_bridge.c
@@ -254,8 +254,9 @@ void pci_bridge_disable_base_limit(PCIDevice *dev)
}
/* reset bridge specific configuration registers */
-void pci_bridge_reset_reg(PCIDevice *dev)
+void pci_bridge_reset(DeviceState *qdev)
{
+ PCIDevice *dev = PCI_DEVICE(qdev);
uint8_t *conf = dev->config;
conf[PCI_PRIMARY_BUS] = 0;
@@ -291,13 +292,6 @@ void pci_bridge_reset_reg(PCIDevice *dev)
pci_set_word(conf + PCI_BRIDGE_CONTROL, 0);
}
-/* default reset function for PCI-to-PCI bridge */
-void pci_bridge_reset(DeviceState *qdev)
-{
- PCIDevice *dev = PCI_DEVICE(qdev);
- pci_bridge_reset_reg(dev);
-}
-
/* default qdev initialization function for PCI-to-PCI bridge */
int pci_bridge_initfn(PCIDevice *dev)
{
diff --git a/hw/pci_bridge_dev.c b/hw/pci_bridge_dev.c
index eccaa58..b6d5fb7 100644
--- a/hw/pci_bridge_dev.c
+++ b/hw/pci_bridge_dev.c
@@ -119,10 +119,8 @@ static void pci_bridge_dev_write_config(PCIDevice *d,
static void qdev_pci_bridge_dev_reset(DeviceState *qdev)
{
PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
+
pci_bridge_reset(qdev);
- if (msi_present(dev)) {
- msi_reset(dev);
- }
shpc_reset(dev);
}
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 4a4413d..3395a02 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -277,7 +277,6 @@ void virtio_pci_reset(DeviceState *d)
VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
virtio_pci_stop_ioeventfd(proxy);
virtio_reset(proxy->vdev);
- msix_reset(&proxy->pci_dev);
proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
}
diff --git a/hw/xio3130_downstream.c b/hw/xio3130_downstream.c
index 319624f..3716e45 100644
--- a/hw/xio3130_downstream.c
+++ b/hw/xio3130_downstream.c
@@ -48,7 +48,7 @@ static void xio3130_downstream_write_config(PCIDevice *d, uint32_t address,
static void xio3130_downstream_reset(DeviceState *qdev)
{
PCIDevice *d = PCI_DEVICE(qdev);
- msi_reset(d);
+
pcie_cap_deverr_reset(d);
pcie_cap_slot_reset(d);
pcie_cap_ari_reset(d);
diff --git a/hw/xio3130_upstream.c b/hw/xio3130_upstream.c
index 34a99bb..962d48e 100644
--- a/hw/xio3130_upstream.c
+++ b/hw/xio3130_upstream.c
@@ -47,7 +47,7 @@ static void xio3130_upstream_write_config(PCIDevice *d, uint32_t address,
static void xio3130_upstream_reset(DeviceState *qdev)
{
PCIDevice *d = PCI_DEVICE(qdev);
- msi_reset(d);
+
pci_bridge_reset(qdev);
pcie_cap_deverr_reset(d);
}
--
1.7.3.4
next prev parent reply other threads:[~2012-05-15 23:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 14:42 [Qemu-devel] [PATCH v3 0/8] msi: Refactorings and reset fixes Jan Kiszka
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 1/8] ahci: Fix reset of MSI function Jan Kiszka
2012-05-22 10:17 ` Alexander Graf
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 2/8] intel-hda: " Jan Kiszka
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 3/8] ahci: Clean up reset functions Jan Kiszka
2012-05-22 10:20 ` Alexander Graf
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 4/8] msi: Guard msi_reset with msi_present Jan Kiszka
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 5/8] msi: Invoke msi/msix_reset from PCI core Jan Kiszka
2012-05-15 23:09 ` Jan Kiszka [this message]
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 6/8] msi: Guard msi/msix_write_config with msi_present Jan Kiszka
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 7/8] msi: Invoke msi/msix_write_config from PCI core Jan Kiszka
2012-05-11 14:42 ` [Qemu-devel] [PATCH v3 8/8] msi: Use msi/msix_present more consistently Jan Kiszka
2012-06-04 14:48 ` Michael S. Tsirkin
2012-06-04 14:53 ` [Qemu-devel] [PATCH v4 " Jan Kiszka
2012-06-04 18:57 ` Michael S. Tsirkin
2012-05-22 10:16 ` [Qemu-devel] [PATCH v3 0/8] msi: Refactorings and reset fixes Alexander Graf
2012-06-04 14:17 ` Jan Kiszka
2012-06-04 14:27 ` 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=4FB2E244.2090006@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=agraf@suse.de \
--cc=kraxel@redhat.com \
--cc=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).