From patchwork Thu Jul 26 14:35:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10280 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 558AA24039 for ; Thu, 26 Jul 2012 14:35:25 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 08DCBA18F40 for ; Thu, 26 Jul 2012 14:35:24 +0000 (UTC) Received: by yenq6 with SMTP id q6so2027858yen.11 for ; Thu, 26 Jul 2012 07:35:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=bH/KsRADjqTiGHhWNY3SkOvwR2zsrPBquIT3KSCRsos=; b=JE6z2RRBOeTuep2UdEiB0BaB8sPCrnRj14uzSX4bJQe/iSBknco+x3uG7dQQf7ITm0 hBI5q8rXrOf4jAsjT3x9HzyTLDoS9g9Joym/qzBFDZ49gPZPJoKkwsWN3bHmKi/j2/4E QFLuGN+TFciTAQo8aDm0hbQY9KBHql9zTDQR2r1Q6JqO9RmE90HqW+4DnAfbLsUizpxg jGwokGkzba9+puDRHnfWTGoVR4bkhiB8GsnIyhKvKUeXhjvpFlVn9zpXMBaDCsBF76bN lrEDV+und3WIobonOMm8BPk0z+vgRTHmCmxLbL8z2J/tUIxTHzbfM9sd36xRDhtfDCap BIBQ== Received: by 10.50.209.73 with SMTP id mk9mr1796593igc.66.1343313324057; Thu, 26 Jul 2012 07:35:24 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.43.93.3 with SMTP id bs3csp142937icc; Thu, 26 Jul 2012 07:35:22 -0700 (PDT) Received: by 10.14.184.130 with SMTP id s2mr4316456eem.43.1343313321251; Thu, 26 Jul 2012 07:35:21 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id d2si3307270eeo.74.2012.07.26.07.35.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 07:35:21 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SuP9q-00073Q-3Z; Thu, 26 Jul 2012 15:35:18 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Avi Kivity , Marcelo Tosatti , Jan Kiszka , Alexander Graf Subject: [PATCH v2 3/7] kvm: Move kvm_allows_irq0_override() to target-i386, fix return type Date: Thu, 26 Jul 2012 15:35:13 +0100 Message-Id: <1343313317-27087-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1343313317-27087-1-git-send-email-peter.maydell@linaro.org> References: <1343313317-27087-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkWSNsb4ex6OcXoT4kMOxHm46DkoD4TAzcxMdioPzUUgu/yaeB1o/uxJ/9Jn+9wjnuOEH7x kvm_allows_irq0_override() is a totally x86 specific concept: move it to the target-specific source file where it belongs. This means we need a new header file for the prototype: kvm_i386.h, in line with the existing kvm_ppc.h. While we are moving it, fix the return type to be 'bool' rather than 'int'. Signed-off-by: Peter Maydell --- hw/pc.c | 1 + kvm-all.c | 5 ----- kvm-stub.c | 5 ----- kvm.h | 2 -- target-i386/Makefile.objs | 1 + target-i386/kvm-stub.c | 18 ++++++++++++++++++ target-i386/kvm.c | 6 ++++++ target-i386/kvm_i386.h | 16 ++++++++++++++++ 8 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 target-i386/kvm-stub.c create mode 100644 target-i386/kvm_i386.h diff --git a/hw/pc.c b/hw/pc.c index 598267a..4953376 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -42,6 +42,7 @@ #include "sysbus.h" #include "sysemu.h" #include "kvm.h" +#include "kvm_i386.h" #include "xen.h" #include "blockdev.h" #include "hw/block-common.h" diff --git a/kvm-all.c b/kvm-all.c index 7c635be..9a34090 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1672,11 +1672,6 @@ int kvm_has_gsi_routing(void) #endif } -int kvm_allows_irq0_override(void) -{ - return !kvm_irqchip_in_kernel() || kvm_has_gsi_routing(); -} - void *kvm_vmalloc(ram_addr_t size) { #ifdef TARGET_S390X diff --git a/kvm-stub.c b/kvm-stub.c index a7a03e1..f2b0c61 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -72,11 +72,6 @@ int kvm_has_many_ioeventfds(void) return 0; } -int kvm_allows_irq0_override(void) -{ - return 1; -} - int kvm_has_pit_state2(void) { return 0; diff --git a/kvm.h b/kvm.h index 744209d..47bf5ba 100644 --- a/kvm.h +++ b/kvm.h @@ -75,8 +75,6 @@ int kvm_has_pit_state2(void); int kvm_has_many_ioeventfds(void); int kvm_has_gsi_routing(void); -int kvm_allows_irq0_override(void); - #ifdef NEED_CPU_H int kvm_init_vcpu(CPUArchState *env); diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs index 683fd59..0715f58 100644 --- a/target-i386/Makefile.objs +++ b/target-i386/Makefile.objs @@ -3,6 +3,7 @@ obj-y += excp_helper.o fpu_helper.o cc_helper.o int_helper.o svm_helper.o obj-y += smm_helper.o misc_helper.o mem_helper.o seg_helper.o obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o obj-$(CONFIG_KVM) += kvm.o hyperv.o +obj-$(CONFIG_NO_KVM) += kvm-stub.o obj-$(CONFIG_LINUX_USER) += ioport-user.o obj-$(CONFIG_BSD_USER) += ioport-user.o diff --git a/target-i386/kvm-stub.c b/target-i386/kvm-stub.c new file mode 100644 index 0000000..11429c4 --- /dev/null +++ b/target-i386/kvm-stub.c @@ -0,0 +1,18 @@ +/* + * QEMU KVM x86 specific function stubs + * + * Copyright Linaro Limited 2012 + * + * Author: Peter Maydell + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ +#include "qemu-common.h" +#include "kvm_i386.h" + +bool kvm_allows_irq0_override(void) +{ + return 1; +} diff --git a/target-i386/kvm.c b/target-i386/kvm.c index e53c2f6..7e5f51e 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -23,6 +23,7 @@ #include "qemu-common.h" #include "sysemu.h" #include "kvm.h" +#include "kvm_i386.h" #include "cpu.h" #include "gdbstub.h" #include "host-utils.h" @@ -65,6 +66,11 @@ static bool has_msr_async_pf_en; static bool has_msr_misc_enable; static int lm_capable_kernel; +bool kvm_allows_irq0_override(void) +{ + return !kvm_irqchip_in_kernel() || kvm_has_gsi_routing(); +} + static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max) { struct kvm_cpuid2 *cpuid; diff --git a/target-i386/kvm_i386.h b/target-i386/kvm_i386.h new file mode 100644 index 0000000..b82bbf4 --- /dev/null +++ b/target-i386/kvm_i386.h @@ -0,0 +1,16 @@ +/* + * QEMU KVM support -- x86 specific functions. + * + * Copyright (c) 2012 Linaro Limited + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_KVM_I386_H +#define QEMU_KVM_I386_H + +bool kvm_allows_irq0_override(void); + +#endif