qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH v4 8/8] msi: Use msi/msix_present more consistently
Date: Mon, 04 Jun 2012 16:53:48 +0200	[thread overview]
Message-ID: <4FCCCBFC.5080303@siemens.com> (raw)
In-Reply-To: <20120604144837.GA30538@redhat.com>

On 2012-06-04 16:48, Michael S. Tsirkin wrote:
> On Fri, May 11, 2012 at 11:42:41AM -0300, Jan Kiszka wrote:
>> Replace some open-coded msi/msix_present checks.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This last one doesn't apply but I don't expect this blocks
> anything. Applied 1-7 for now.

Hmm, might have rebased here but forgot to send:

---8<----

Replace some open-coded msi/msix_present checks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/msi.c  |    2 +-
 hw/msix.c |   13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/msi.c b/hw/msi.c
index 556c7c4..5233204 100644
--- a/hw/msi.c
+++ b/hw/msi.c
@@ -175,7 +175,7 @@ void msi_uninit(struct PCIDevice *dev)
     uint16_t flags;
     uint8_t cap_size;
 
-    if (!(dev->cap_present & QEMU_PCI_CAP_MSI)) {
+    if (!msi_present(dev)) {
         return;
     }
     flags = pci_get_word(dev->config + msi_flags_off(dev));
diff --git a/hw/msix.c b/hw/msix.c
index 339e652..ded3c55 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -319,8 +319,9 @@ static void msix_free_irq_entries(PCIDevice *dev)
 /* Clean up resources for the device. */
 int msix_uninit(PCIDevice *dev, MemoryRegion *bar)
 {
-    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
+    if (!msix_present(dev)) {
         return 0;
+    }
     pci_del_capability(dev, PCI_CAP_ID_MSIX, MSIX_CAP_LENGTH);
     dev->msix_cap = 0;
     msix_free_irq_entries(dev);
@@ -339,7 +340,7 @@ void msix_save(PCIDevice *dev, QEMUFile *f)
 {
     unsigned n = dev->msix_entries_nr;
 
-    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) {
+    if (!msix_present(dev)) {
         return;
     }
 
@@ -353,7 +354,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
     unsigned n = dev->msix_entries_nr;
     unsigned int vector;
 
-    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) {
+    if (!msix_present(dev)) {
         return;
     }
 
@@ -407,8 +408,9 @@ void msix_notify(PCIDevice *dev, unsigned vector)
 
 void msix_reset(PCIDevice *dev)
 {
-    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
+    if (!msix_present(dev)) {
         return;
+    }
     msix_free_irq_entries(dev);
     dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
 	    ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
@@ -447,8 +449,9 @@ void msix_vector_unuse(PCIDevice *dev, unsigned vector)
 
 void msix_unuse_all_vectors(PCIDevice *dev)
 {
-    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX))
+    if (!msix_present(dev)) {
         return;
+    }
     msix_free_irq_entries(dev);
 }
 
-- 
1.7.3.4

  reply	other threads:[~2012-06-04 14:54 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   ` [Qemu-devel] [PATCH v4 " Jan Kiszka
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     ` Jan Kiszka [this message]
2012-06-04 18:57       ` [Qemu-devel] [PATCH v4 " 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=4FCCCBFC.5080303@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=mst@redhat.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 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).