From patchwork Mon Feb 15 12:11:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 582866 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4409E140324 for ; Mon, 15 Feb 2016 23:12:30 +1100 (AEDT) Received: from localhost ([::1]:59700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVI0y-0002TS-7Q for incoming@patchwork.ozlabs.org; Mon, 15 Feb 2016 07:12:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVI0i-0002AA-1L for qemu-devel@nongnu.org; Mon, 15 Feb 2016 07:12:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVI0d-00061s-La for qemu-devel@nongnu.org; Mon, 15 Feb 2016 07:12:11 -0500 Received: from smtp.citrix.com ([66.165.176.89]:48403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVI0d-00061o-GT for qemu-devel@nongnu.org; Mon, 15 Feb 2016 07:12:07 -0500 X-IronPort-AV: E=Sophos;i="5.22,450,1449532800"; d="scan'208";a="331709574" From: Stefano Stabellini To: Date: Mon, 15 Feb 2016 12:11:15 +0000 Message-ID: <1455538275-5673-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 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() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 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)