From patchwork Sun Jun 29 16:58:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 365405 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 010301400A0 for ; Mon, 30 Jun 2014 02:58:48 +1000 (EST) Received: from localhost ([::1]:58350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1IRB-0007FW-8G for incoming@patchwork.ozlabs.org; Sun, 29 Jun 2014 12:58:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1IQS-0005x6-H8 for qemu-devel@nongnu.org; Sun, 29 Jun 2014 12:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1IQN-0002kt-LV for qemu-devel@nongnu.org; Sun, 29 Jun 2014 12:58:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1IQN-0002kk-D8 for qemu-devel@nongnu.org; Sun, 29 Jun 2014 12:57:55 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5TGvnTN004678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 29 Jun 2014 12:57:50 -0400 Received: from redhat.com (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s5TGvkvo018587; Sun, 29 Jun 2014 12:57:47 -0400 Date: Sun, 29 Jun 2014 19:58:14 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1404060115-27410-5-git-send-email-mst@redhat.com> References: <1404060115-27410-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1404060115-27410-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Liu Ping Fan , Eduardo Habkost , Anthony Liguori Subject: [Qemu-devel] [PULL 04/37] pc: Move q35 compat props to PC_COMPAT_* 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 From: Eduardo Habkost For each compat property on PC_Q35_COMPAT_*, there are only two possibilities: * If the device is never instantiated when using a machine other than pc-q35, then the compat property can be safely added to PC_COMPAT_*; * If the device can be instantiated when using a machine other than pc-q35, that means the other machines also need the compat property to be set. That means we don't need separate PC_Q35_COMPAT_* macros at all, today. The hpet.hpet-intcap case is interesting: piix and q35 do have something that emulates different defaults, but the machine-specific default is applied _after_ compat_props are applied, by simply checking if the property is zero (which is the real default on the hpet code). The hpet.hpet-intcap=0x4 compat property can (should?) be applied to piix too, because 0x4 was the default on both piix and q35 before the hpet-intcap property was introduced. Now, if one day we change the default HPET intcap on one of the PC machine-types again, we may want to introduce PC_{Q35,I440FX}_COMPAT macros. But while we don't need that, we can keep the code simple. Signed-off-by: Eduardo Habkost Cc: Liu Ping Fan Cc: Peter Maydell Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 55 +++++++++++++++++----------------------------------- hw/i386/pc_q35.c | 10 +++++----- 2 files changed, 23 insertions(+), 42 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 486e98f..81718b8 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -294,43 +294,6 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); -#define PC_Q35_COMPAT_2_0 \ - PC_COMPAT_2_0, \ - {\ - .driver = "ICH9-LPC",\ - .property = "memory-hotplug-support",\ - .value = "off",\ - },{\ - .driver = "xio3130-downstream",\ - .property = COMPAT_PROP_PCP,\ - .value = "off",\ - },{\ - .driver = "ioh3420",\ - .property = COMPAT_PROP_PCP,\ - .value = "off",\ - } - -#define PC_Q35_COMPAT_1_7 \ - PC_COMPAT_1_7, \ - PC_Q35_COMPAT_2_0, \ - {\ - .driver = "hpet",\ - .property = HPET_INTCAP,\ - .value = stringify(4),\ - } - -#define PC_Q35_COMPAT_1_6 \ - PC_COMPAT_1_6, \ - PC_Q35_COMPAT_1_7 - -#define PC_Q35_COMPAT_1_5 \ - PC_COMPAT_1_5, \ - PC_Q35_COMPAT_1_6 - -#define PC_Q35_COMPAT_1_4 \ - PC_COMPAT_1_4, \ - PC_Q35_COMPAT_1_5 - #define PC_COMPAT_2_0 \ {\ .driver = "virtio-scsi-pci",\ @@ -370,6 +333,19 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = "virtio-net-pci",\ .property = "guest_announce",\ .value = "off",\ + },\ + {\ + .driver = "ICH9-LPC",\ + .property = "memory-hotplug-support",\ + .value = "off",\ + },{\ + .driver = "xio3130-downstream",\ + .property = COMPAT_PROP_PCP,\ + .value = "off",\ + },{\ + .driver = "ioh3420",\ + .property = COMPAT_PROP_PCP,\ + .value = "off",\ } #define PC_COMPAT_1_7 \ @@ -383,6 +359,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = "PIIX4_PM",\ .property = "acpi-pci-hotplug-with-bridge-support",\ .value = "off",\ + },\ + {\ + .driver = "hpet",\ + .property = HPET_INTCAP,\ + .value = stringify(4),\ } #define PC_COMPAT_1_6 \ diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 155db99..36b6ab0 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -361,7 +361,7 @@ static QEMUMachine pc_q35_machine_v2_0 = { .name = "pc-q35-2.0", .init = pc_q35_init_2_0, .compat_props = (GlobalProperty[]) { - PC_Q35_COMPAT_2_0, + PC_COMPAT_2_0, { /* end of list */ } }, }; @@ -373,7 +373,7 @@ static QEMUMachine pc_q35_machine_v1_7 = { .name = "pc-q35-1.7", .init = pc_q35_init_1_7, .compat_props = (GlobalProperty[]) { - PC_Q35_COMPAT_1_7, + PC_COMPAT_1_7, { /* end of list */ } }, }; @@ -385,7 +385,7 @@ static QEMUMachine pc_q35_machine_v1_6 = { .name = "pc-q35-1.6", .init = pc_q35_init_1_6, .compat_props = (GlobalProperty[]) { - PC_Q35_COMPAT_1_6, + PC_COMPAT_1_6, { /* end of list */ } }, }; @@ -395,7 +395,7 @@ static QEMUMachine pc_q35_machine_v1_5 = { .name = "pc-q35-1.5", .init = pc_q35_init_1_5, .compat_props = (GlobalProperty[]) { - PC_Q35_COMPAT_1_5, + PC_COMPAT_1_5, { /* end of list */ } }, }; @@ -409,7 +409,7 @@ static QEMUMachine pc_q35_machine_v1_4 = { .name = "pc-q35-1.4", .init = pc_q35_init_1_4, .compat_props = (GlobalProperty[]) { - PC_Q35_COMPAT_1_4, + PC_COMPAT_1_4, { /* end of list */ } }, };