From patchwork Tue Apr 17 18:13:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 153269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 20CA3B706E for ; Wed, 18 Apr 2012 04:10:26 +1000 (EST) Received: from localhost ([::1]:38095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKCr9-0005D6-Ib for incoming@patchwork.ozlabs.org; Tue, 17 Apr 2012 14:10:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKCqv-00055Q-OX for qemu-devel@nongnu.org; Tue, 17 Apr 2012 14:10:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKCql-0002IL-AQ for qemu-devel@nongnu.org; Tue, 17 Apr 2012 14:10:09 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:24815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKCql-0002GN-4p for qemu-devel@nongnu.org; Tue, 17 Apr 2012 14:09:59 -0400 X-IronPort-AV: E=Sophos;i="4.75,437,1330923600"; d="scan'208";a="190780619" Received: from ftlpmailmx02.citrite.net ([10.13.107.66]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 17 Apr 2012 14:08:26 -0400 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.66) with Microsoft SMTP Server id 8.3.213.0; Tue, 17 Apr 2012 14:08:16 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59] helo=localhost.localdomain) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1SKCp0-0008NB-D7; Tue, 17 Apr 2012 19:08:10 +0100 From: Stefano Stabellini To: qemu-devel@nongnu.org Date: Tue, 17 Apr 2012 19:13:07 +0100 Message-ID: <1334686387-2350-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: anthony.perard@citrix.com, xen-devel@lists.xensource.com, alevy@redhat.com, Stefano Stabellini Subject: [Qemu-devel] [PATCH BUILD FIX 2/2] xen: add a dummy xc_hvm_inject_msi for Xen < 4.2 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 xc_hvm_inject_msi is only available on Xen >= 4.2: add a dummy compatibility function for Xen < 4.2. Also enable msi support only on Xen >= 4.2. Signed-off-by: Stefano Stabellini Acked-by: Anthony PERARD --- hw/pc.c | 2 +- hw/xen.h | 10 ++++++++++ hw/xen_common.h | 15 +++++++++++++++ xen-all.c | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 1f5aacb..4d34a33 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -916,7 +916,7 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) msi_supported = true; } - if (xen_enabled()) { + if (xen_msi_support()) { msi_supported = true; } diff --git a/hw/xen.h b/hw/xen.h index e5926b7..3ae4cd0 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -57,4 +57,14 @@ void xen_register_framebuffer(struct MemoryRegion *mr); # define HVM_MAX_VCPUS 32 #endif +static inline int xen_msi_support(void) +{ +#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \ + && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420 + return xen_enabled(); +#else + return 0; +#endif +} + #endif /* QEMU_HW_XEN_H */ diff --git a/hw/xen_common.h b/hw/xen_common.h index 0409ac7..7043c14 100644 --- a/hw/xen_common.h +++ b/hw/xen_common.h @@ -133,6 +133,21 @@ static inline int xc_fd(xc_interface *xen_xc) } #endif +/* Xen before 4.2 */ +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 420 +static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom, + uint64_t addr, uint32_t data) +{ + return -ENOSYS; +} +#else +static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom, + uint64_t addr, uint32_t data) +{ + return xc_hvm_inject_msi(xen_xc, dom, addr, data); +} +#endif + void destroy_hvm_domain(void); #endif /* QEMU_HW_XEN_COMMON_H */ diff --git a/xen-all.c b/xen-all.c index a08eec0..bdf9c0f 100644 --- a/xen-all.c +++ b/xen-all.c @@ -129,7 +129,7 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) void xen_hvm_inject_msi(uint64_t addr, uint32_t data) { - xc_hvm_inject_msi(xen_xc, xen_domid, addr, data); + xen_xc_hvm_inject_msi(xen_xc, xen_domid, addr, data); } static void xen_suspend_notifier(Notifier *notifier, void *data)