From patchwork Mon Sep 14 11:50:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 47294 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8EBop0l011900 for ; Mon, 14 Sep 2009 11:50:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755393AbZINLuX (ORCPT ); Mon, 14 Sep 2009 07:50:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755391AbZINLuW (ORCPT ); Mon, 14 Sep 2009 07:50:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3176 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755305AbZINLuV (ORCPT ); Mon, 14 Sep 2009 07:50:21 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8EBoOP2007853 for ; Mon, 14 Sep 2009 07:50:24 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8EBoNeQ001347; Mon, 14 Sep 2009 07:50:24 -0400 Received: from localhost.localdomain (cleopatra.tlv.redhat.com [10.35.255.11]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id EC50525004E; Mon, 14 Sep 2009 14:50:22 +0300 (IDT) From: Avi Kivity To: Marcelo Tosatti Cc: kvm@vger.kernel.org Subject: [PATCH 2/2] test-device: add support for irq injection Date: Mon, 14 Sep 2009 14:50:22 +0300 Message-Id: <1252929022-13927-3-git-send-email-avi@redhat.com> In-Reply-To: <1252929022-13927-1-git-send-email-avi@redhat.com> References: <1252929022-13927-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This allows apic.flat to pass. Signed-off-by: Avi Kivity --- hw/pc.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 360dbfb..ea31b0f 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1131,12 +1131,20 @@ static uint32_t test_device_memsize_read(void *opaque, uint32_t addr) return (intptr_t)opaque; } -static void create_test_device(ram_addr_t ram_size) +static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data) +{ + qemu_irq *isa_irq = opaque; + + qemu_set_irq(isa_irq[addr - 0x2000], !!data); +} + +static void create_test_device(ram_addr_t ram_size, qemu_irq *isa_irq) { register_ioport_write(0xf1, 1, 1, test_device_serial_write, NULL); register_ioport_write(0xf4, 1, 4, test_device_exit, NULL); register_ioport_read(0xd1, 1, 4, test_device_memsize_read, (void *)(intptr_t)ram_size); + register_ioport_write(0x2000, 24, 1, test_device_irq_line, isa_irq); } /* PC hardware initialisation */ @@ -1169,10 +1177,6 @@ static void pc_init1(ram_addr_t ram_size, void *fw_cfg; extern int testdevice; - if (testdevice) { - create_test_device(ram_size); - } - if (ram_size >= 0xe0000000 ) { above_4g_mem_size = ram_size - 0xe0000000; below_4g_mem_size = 0xe0000000; @@ -1499,6 +1503,10 @@ static void pc_init1(ram_addr_t ram_size, assigned_dev_load_option_roms(pci_option_rom_offset); } #endif /* USE_KVM_DEVICE_ASSIGNMENT */ + + if (testdevice) { + create_test_device(ram_size, isa_irq); + } } static void pc_init_pci(ram_addr_t ram_size,