From patchwork Thu Oct 10 07:56:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pingfan liu X-Patchwork-Id: 282148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 86C162C00CC for ; Thu, 10 Oct 2013 18:58:06 +1100 (EST) Received: from localhost ([::1]:45482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUB8G-0007Mb-Lg for incoming@patchwork.ozlabs.org; Thu, 10 Oct 2013 03:58:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUB7a-000724-NM for qemu-devel@nongnu.org; Thu, 10 Oct 2013 03:57:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUB7S-0005zt-7v for qemu-devel@nongnu.org; Thu, 10 Oct 2013 03:57:22 -0400 Received: from mail-oa0-x233.google.com ([2607:f8b0:4003:c02::233]:35417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUB7S-0005zp-1V for qemu-devel@nongnu.org; Thu, 10 Oct 2013 03:57:14 -0400 Received: by mail-oa0-f51.google.com with SMTP id h16so1149875oag.38 for ; Thu, 10 Oct 2013 00:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gUOENlmTtsMHQcKeLH0t+BWZAESEXhxhY0PmJl6XU5o=; b=vWkiZ7lXlZ9M13liQol+X4JeioaOwY+U+bSogpSStUc1SWlOpcAUDWYS15DvKVM4ne X2b0ZMstbHJjiBJ2oqclp4YLR33nb0mOCOzqfsk3r9PhWCG5iNcNYRNn9A7aR8LqkpyV AmCtLBAICCbqO8Nddz9JKaUdrEknHfmVS5S0FQhq/vtVHalACb0I2+Eh2pkVS4VCy79G hHdSRJdWo8BoxfojlUT21W118+pIO0xupIx6EQQW+Si3/5o9NOCcGSLVYT878UudLNQZ AHn+ZHF2yU/06Cx5lrNKxBiiN11KHj5M6AFHupXvN3CG5qwuw0u1Xa5qv5cxWFcMjNWS RU8Q== X-Received: by 10.60.161.10 with SMTP id xo10mr23099oeb.71.1381391833410; Thu, 10 Oct 2013 00:57:13 -0700 (PDT) Received: from localhost ([202.108.130.138]) by mx.google.com with ESMTPSA id j9sm85738095oef.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 10 Oct 2013 00:57:12 -0700 (PDT) From: Liu Ping Fan To: qemu-devel@nongnu.org Date: Thu, 10 Oct 2013 15:56:19 +0800 Message-Id: <1381391779-27718-6-git-send-email-pingfank@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1381391779-27718-1-git-send-email-pingfank@linux.vnet.ibm.com> References: <1381391779-27718-1-git-send-email-pingfank@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::233 Cc: Paolo Bonzini , Anthony Liguori , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v6 5/5] PC: differentiate hpet's interrupt capability on piix and q35 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 For pc-piix-*, hpet's intcap is always hard coded as IRQ2. For q35, if it is pc-q35-1.7 and earlier, we use IRQ2 for compat reason, otherwise IRQ2, IRQ8, and IRQ16~23 are allowed. Signed-off-by: Liu Ping Fan --- hw/i386/pc.c | 21 ++++++++++++++++----- hw/i386/pc_piix.c | 3 ++- hw/i386/pc_q35.c | 2 +- include/hw/i386/pc.h | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f2b7b6c..062019d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1219,7 +1219,8 @@ static const MemoryRegionOps ioportF0_io_ops = { void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, ISADevice **floppy, - bool no_vmport) + bool no_vmport, + bool hpet_irqs) { int i; DriveInfo *fd[MAX_FD]; @@ -1249,10 +1250,20 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, /* In order to set property, here not using sysbus_try_create_simple */ hpet = qdev_try_create(NULL, "hpet"); if (hpet) { - /* tmp fix. For compat, hard code to IRQ2 until we have correct - * compat property and differentiate pc-iix with pc-q35 - */ - qdev_prop_set_uint32(hpet, "intcap", 0x4); + /* For pc-piix-*, hpet's intcap is always IRQ2. */ + if (!hpet_irqs) { + qdev_prop_set_uint32(hpet, "intcap", 0x4); + } else { + /* For pc-q35-1.7 and earlier, use IRQ2 for compat. */ + uint8_t compat = object_property_get_int(OBJECT(hpet), + "compat", NULL); + if (compat) { + qdev_prop_set_uint32(hpet, "intcap", 0x4); + } else { + /* using IRQ16~23, IRQ8 and IRQ2 */ + qdev_prop_set_uint32(hpet, "intcap", 0xff0104); + } + } qdev_init_nofail(hpet); sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 90f1ea4..a45ce11 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -180,7 +180,8 @@ static void pc_init1(QEMUMachineInitArgs *args, pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); /* init basic PC hardware */ - pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled()); + pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(), + false); pc_nic_init(isa_bus, pci_bus); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index ca84e1c..9e41f4a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -181,7 +181,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) pc_register_ferr_irq(gsi[13]); /* init basic PC hardware */ - pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false); + pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, true); /* connect pm stuff to lpc */ ich9_lpc_pm_init(lpc); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 80aa7bd..a49d9cd 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -134,7 +134,8 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, ISADevice **floppy, - bool no_vmport); + bool no_vmport, + bool hpet_irqs); void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, const char *boot_device,