From patchwork Tue Jan 10 19:10:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 135287 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0D95EB6FCB for ; Wed, 11 Jan 2012 06:12:48 +1100 (EST) Received: from localhost ([::1]:56878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkh7d-00026p-FD for incoming@patchwork.ozlabs.org; Tue, 10 Jan 2012 14:12:37 -0500 Received: from eggs.gnu.org ([140.186.70.92]:60183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkh7H-0001lW-ON for qemu-devel@nongnu.org; Tue, 10 Jan 2012 14:12:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rkh7B-0006Hr-6F for qemu-devel@nongnu.org; Tue, 10 Jan 2012 14:12:15 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:44779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkh7A-0006Hf-Vd for qemu-devel@nongnu.org; Tue, 10 Jan 2012 14:12:09 -0500 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Jan 2012 12:12:07 -0700 Received: from d03relay01.boulder.ibm.com (9.17.195.226) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Jan 2012 12:11:21 -0700 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0AJBJok105262 for ; Tue, 10 Jan 2012 12:11:19 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0AJBIoM012094 for ; Tue, 10 Jan 2012 12:11:18 -0700 Received: from titi.austin.rr.com ([9.57.66.237]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0AJAuFp011135; Tue, 10 Jan 2012 12:11:17 -0700 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Tue, 10 Jan 2012 13:10:53 -0600 Message-Id: <1326222656-26588-12-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1326222656-26588-1-git-send-email-aliguori@us.ibm.com> References: <1326222656-26588-1-git-send-email-aliguori@us.ibm.com> x-cbid: 12011019-6148-0000-0000-00000287CE05 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.153 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 12/15] qtest: add support for target-i386 -M pc 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 This involves forcing the CPU into the halted state if qtest is enabled and replacing the local APIC with the qtest interrupt controller. It should be pretty straight forward to do the same for other machine types on other architectures. Signed-off-by: Anthony Liguori --- hw/pc.c | 7 ++++++- hw/pc_piix.c | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 85304cf..fac5098 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -43,6 +43,7 @@ #include "ui/qemu-spice.h" #include "memory.h" #include "exec-memory.h" +#include "qtest.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS @@ -926,7 +927,11 @@ static void pc_cpu_reset(void *opaque) CPUState *env = opaque; cpu_reset(env); - env->halted = !cpu_is_bsp(env); + if (qtest_enabled()) { + env->halted = 1; + } else { + env->halted = !cpu_is_bsp(env); + } } static CPUState *pc_new_cpu(const char *cpu_model) diff --git a/hw/pc_piix.c b/hw/pc_piix.c index b70431f..2aba89c 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -46,6 +46,7 @@ #ifdef CONFIG_XEN # include #endif +#include "qtest.h" #define MAX_IDE_BUS 2 @@ -154,11 +155,13 @@ static void pc_init1(MemoryRegion *system_memory, } isa_bus_irqs(isa_bus, gsi); - if (!xen_enabled()) { + if (xen_enabled()) { + i8259 = xen_interrupt_controller_init(); + } else if (qtest_enabled()) { + i8259 = qtest_interrupt_controller_init(); + } else { cpu_irq = pc_allocate_cpu_irq(); i8259 = i8259_init(isa_bus, cpu_irq[0]); - } else { - i8259 = xen_interrupt_controller_init(); } for (i = 0; i < ISA_NUM_IRQS; i++) {