From patchwork Thu May 10 21:02:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 158400 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 070FFB6FA8 for ; Fri, 11 May 2012 07:27:36 +1000 (EST) Received: from localhost ([::1]:49034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSaWj-0001ZG-OL for incoming@patchwork.ozlabs.org; Thu, 10 May 2012 17:03:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSaW9-0008Rq-Rh for qemu-devel@nongnu.org; Thu, 10 May 2012 17:03:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSaW6-0006SY-Od for qemu-devel@nongnu.org; Thu, 10 May 2012 17:03:21 -0400 Received: from goliath.siemens.de ([192.35.17.28]:30392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSaW6-0006S5-Fm for qemu-devel@nongnu.org; Thu, 10 May 2012 17:03:18 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id q4AL3EI1014266; Thu, 10 May 2012 23:03:14 +0200 Received: from mchn199C.mchp.siemens.de ([139.22.46.144]) by mail1.siemens.de (8.13.6/8.13.6) with SMTP id q4AL31b9028153; Thu, 10 May 2012 23:03:12 +0200 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Thu, 10 May 2012 18:02:53 -0300 Message-Id: X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.28 Cc: Stefano Stabellini , qemu-devel , kvm@vger.kernel.org, "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v3 4/8] pc: Enable MSI support at APIC level 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 Push msi_supported enabling to the APIC implementations where we can encapsulate the decision more cleanly, hiding the details from the generic code. CC: Stefano Stabellini Signed-off-by: Jan Kiszka Acked-by: Stefano Stabellini --- hw/apic.c | 2 ++ hw/pc.c | 9 --------- hw/xen.h | 10 ---------- hw/xen_apic.c | 5 +++++ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/hw/apic.c b/hw/apic.c index 4eeaf88..a337790 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -862,6 +862,8 @@ static void apic_init(APICCommonState *s) s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s); local_apics[s->idx] = s; + + msi_supported = true; } static void apic_class_init(ObjectClass *klass, void *data) diff --git a/hw/pc.c b/hw/pc.c index 4d34a33..6691b18 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -911,15 +911,6 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) apic_mapped = 1; } - /* KVM does not support MSI yet. */ - if (!kvm_irqchip_in_kernel()) { - msi_supported = true; - } - - if (xen_msi_support()) { - msi_supported = true; - } - return dev; } diff --git a/hw/xen.h b/hw/xen.h index 3ae4cd0..e5926b7 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -57,14 +57,4 @@ 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_apic.c b/hw/xen_apic.c index 1725ff6..a9e101f 100644 --- a/hw/xen_apic.c +++ b/hw/xen_apic.c @@ -40,6 +40,11 @@ static void xen_apic_init(APICCommonState *s) { memory_region_init_io(&s->io_memory, &xen_apic_io_ops, s, "xen-apic-msi", MSI_SPACE_SIZE); + +#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \ + && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420 + msi_supported = true; +#endif } static void xen_apic_set_base(APICCommonState *s, uint64_t val)