From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paul Brook <paul@codesourcery.com>, Avi Kivity <avi@redhat.com>,
qemu-devel@nongnu.org, Carsten Otte <cotte@de.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
kraxel@redhat.com, markmc@redhat.com
Subject: [Qemu-devel] [PATCHv2 4/4] qemu/pci: reset device registers on bus reset
Date: Wed, 16 Sep 2009 13:41:09 +0300 [thread overview]
Message-ID: <20090916104109.GE4446@redhat.com> (raw)
In-Reply-To: <cover.1253097390.git.mst@redhat.com>
Reset BARs and a couple of other registers on bus reset, as per PCI
spec.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 600df2f..b489d41 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -90,7 +90,20 @@ static inline int pci_bar(int reg)
static void pci_device_reset(PCIDevice *dev)
{
+ int r;
+
memset(dev->irq_state, 0, sizeof dev->irq_state);
+ dev->config[PCI_COMMAND] &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
+ PCI_COMMAND_MASTER);
+ dev->config[PCI_CACHE_LINE_SIZE] = 0x0;
+ dev->config[PCI_INTERRUPT_LINE] = 0x0;
+ for (r = 0; r < PCI_NUM_REGIONS; ++r) {
+ if (!dev->io_regions[r].size) {
+ continue;
+ }
+ pci_set_long(dev->config + pci_bar(r), dev->io_regions[r].type);
+ }
+ pci_update_mappings(dev);
}
static void pci_bus_reset(void *opaque)
--
1.6.2.5
prev parent reply other threads:[~2009-09-16 10:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1253097390.git.mst@redhat.com>
2009-09-16 10:40 ` [Qemu-devel] [PATCHv2 1/4] qemu/qdev: type safety in reset handler Michael S. Tsirkin
2009-09-16 10:40 ` [Qemu-devel] [PATCHv2 2/4] qemu/virtio: fix reset with device removal Michael S. Tsirkin
2009-09-16 10:40 ` [Qemu-devel] [PATCHv2 3/4] qemu/pci: refactor code/symbolic constants Michael S. Tsirkin
2009-09-16 10:41 ` Michael S. Tsirkin [this message]
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=20090916104109.GE4446@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cotte@de.ibm.com \
--cc=kraxel@redhat.com \
--cc=markmc@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.