qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: xen-devel@lists.xen.org, mst@redhat.com,
	stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [PATCH] xen: xen_is_pirq_msi only when xen_enabled()
Date: Mon, 15 Feb 2016 12:11:15 +0000	[thread overview]
Message-ID: <1455538275-5673-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)

Only return true from xen_is_pirq_msi when Xen is enabled: the function
should never identify an MSI as Xen pirq when not running on Xen.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: mst@redhat.com
CC: berrange@redhat.com
CC: xen-devel@lists.xen.org
---
 hw/pci/msix.c |    2 +-
 xen-hvm.c     |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 537fdba..fc03b35 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -83,7 +83,7 @@ static bool msix_vector_masked(PCIDevice *dev, unsigned int vector, bool fmask)
     uint8_t *data = &dev->msix_table[offset + PCI_MSIX_ENTRY_DATA];
     /* MSIs on Xen can be remapped into pirqs. In those cases, masking
      * and unmasking go through the PV evtchn path. */
-    if (xen_enabled() && xen_is_pirq_msi(pci_get_long(data))) {
+    if (xen_is_pirq_msi(pci_get_long(data))) {
         return false;
     }
     return fmask || dev->msix_table[offset + PCI_MSIX_ENTRY_VECTOR_CTRL] &
diff --git a/xen-hvm.c b/xen-hvm.c
index 039680a..991f6b7 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -151,7 +151,8 @@ int xen_is_pirq_msi(uint32_t msi_data)
     /* If vector is 0, the msi is remapped into a pirq, passed as
      * dest_id.
      */
-    return ((msi_data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT) == 0;
+    return xen_enabled() &&
+        ((msi_data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT) == 0;
 }
 
 void xen_hvm_inject_msi(uint64_t addr, uint32_t data)
-- 
1.7.10.4

             reply	other threads:[~2016-02-15 12:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 12:11 Stefano Stabellini [this message]
2016-02-15 14:15 ` [Qemu-devel] [PATCH] xen: xen_is_pirq_msi only when xen_enabled() Markus Armbruster
2016-02-15 16:32   ` Stefano Stabellini

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=1455538275-5673-1-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xen.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).