qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: mst@redhat.com, yamahata@valinux.co.jp
Cc: alex.williamson@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/3] msi: Cleanup uninit
Date: Mon, 01 Nov 2010 23:37:45 -0600	[thread overview]
Message-ID: <20101102053738.10424.81682.stgit@s20.home> (raw)
In-Reply-To: <20101102053544.10424.42769.stgit@s20.home>

This makes msi_uninit more similar to msix_uninit, doing nothing if not
enable, clearing msi_cap and capability flag.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 hw/msi.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/msi.c b/hw/msi.c
index 0ad4e38..110859b 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -170,9 +170,15 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
 
 void msi_uninit(struct PCIDevice *dev)
 {
-    uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));
-    uint8_t cap_size = msi_cap_sizeof(flags);
+    uint8_t cap_size;
+
+    if (!(dev->cap_present & QEMU_PCI_CAP_MSI))
+        return;
+
+    cap_size = msi_cap_sizeof(pci_get_word(dev->config + msi_flags_off(dev)));
     pci_del_capability(dev, PCI_CAP_ID_MSIX, cap_size);
+    dev->msi_cap = 0;
+    dev->cap_present &= ~QEMU_PCI_CAP_MSI;
     MSI_DEV_PRINTF(dev, "uninit\n");
 }
 

  parent reply	other threads:[~2010-11-02  5:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02  5:37 [Qemu-devel] [PATCH 0/3] msi: Small fixes and enhancements Alex Williamson
2010-11-02  5:37 ` [Qemu-devel] [PATCH 1/3] msi: Allow pre-existing MSI capabilities Alex Williamson
2010-11-02 12:02   ` [Qemu-devel] " Michael S. Tsirkin
2010-11-02  5:37 ` Alex Williamson [this message]
2010-11-02  5:37 ` [Qemu-devel] [PATCH 3/3] msi: Store the capability size in PCIDevice Alex Williamson
2010-11-02  9:25   ` [Qemu-devel] " Michael S. Tsirkin
2010-11-02 14:00     ` Alex Williamson
2010-11-02 14:07       ` Michael S. Tsirkin
2010-11-02 14:23         ` Alex Williamson
2010-11-02 15:39           ` Michael S. Tsirkin
2010-11-02 16:08             ` Alex Williamson
2010-11-02 19:26               ` 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=20101102053738.10424.81682.stgit@s20.home \
    --to=alex.williamson@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).