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: 8314011 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 678B89F6E4 for ; Mon, 15 Feb 2016 12:12:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF6C0201FA for ; Mon, 15 Feb 2016 12:12:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC17F2010F for ; Mon, 15 Feb 2016 12:12:19 +0000 (UTC) Received: from localhost ([::1]:59698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVI0o-0002Ag-Un for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Feb 2016 07:12:18 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)