From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRPYh-0003cS-2C for qemu-devel@nongnu.org; Mon, 17 Aug 2015 14:55:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRPYd-0002PH-QJ for qemu-devel@nongnu.org; Mon, 17 Aug 2015 14:54:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRPYd-0002PB-JJ for qemu-devel@nongnu.org; Mon, 17 Aug 2015 14:54:55 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 792418EFF9 for ; Mon, 17 Aug 2015 18:45:04 +0000 (UTC) From: Eduardo Habkost Date: Mon, 17 Aug 2015 11:42:31 -0700 Message-Id: <1439836952-15739-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1439836952-15739-1-git-send-email-ehabkost@redhat.com> References: <1439836952-15739-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH v2 3/4] pc: Move legacy_acpi_table_size global to PCMachineClass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org This way we can set legacy_acpi_table_size on the machine_options() functions, instead of requirng code in pc_compat_*() functions. Signed-off-by: Eduardo Habkost --- hw/i386/pc_piix.c | 40 +++++++++++++++++++--------------------- include/hw/i386/pc.h | 1 + 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 3b80ade..ea544fa 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -60,8 +60,6 @@ static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; -static int legacy_acpi_table_size; - /* PC hardware initialisation */ static void pc_init1(MachineState *machine) { @@ -149,7 +147,7 @@ static void pc_init1(MachineState *machine) guest_info = pc_guest_info_init(pcms); guest_info->has_acpi_build = pcmc->has_acpi_build; - guest_info->legacy_acpi_table_size = legacy_acpi_table_size; + guest_info->legacy_acpi_table_size = pcmc->legacy_acpi_table_size; guest_info->isapc_ram_fw = !pcmc->pci_enabled; guest_info->has_reserved_memory = pcmc->has_reserved_memory; @@ -314,23 +312,6 @@ static void pc_compat_2_1(MachineState *machine) static void pc_compat_2_0(MachineState *machine) { pc_compat_2_1(machine); - /* This value depends on the actual DSDT and SSDT compiled into - * the source QEMU; unfortunately it depends on the binary and - * not on the machine type, so we cannot make pc-i440fx-1.7 work on - * both QEMU 1.7 and QEMU 2.0. - * - * Large variations cause migration to fail for more than one - * consecutive value of the "-smp" maxcpus option. - * - * For small variations of the kind caused by different iasl versions, - * the 4k rounding usually leaves slack. However, there could be still - * one or two values that break. For QEMU 1.7 and QEMU 2.0 the - * slack is only ~10 bytes before one "-smp maxcpus" value breaks! - * - * 6652 is valid for QEMU 2.0, the right value for pc-i440fx-1.7 on - * QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418. - */ - legacy_acpi_table_size = 6652; pc_set_legacy_acpi_data_size(); } @@ -338,7 +319,6 @@ static void pc_compat_1_7(MachineState *machine) { pc_compat_2_0(machine); option_rom_has_mr = true; - legacy_acpi_table_size = 6414; x86_cpu_compat_kvm_no_autoenable(FEAT_1_ECX, CPUID_EXT_X2APIC); } @@ -479,6 +459,23 @@ static void pc_i440fx_2_0_machine_options(MachineClass *m) SET_MACHINE_COMPAT(m, PC_COMPAT_2_0); pcmc->smbios_legacy_mode = true; pcmc->has_reserved_memory = false; + /* This value depends on the actual DSDT and SSDT compiled into + * the source QEMU; unfortunately it depends on the binary and + * not on the machine type, so we cannot make pc-i440fx-1.7 work on + * both QEMU 1.7 and QEMU 2.0. + * + * Large variations cause migration to fail for more than one + * consecutive value of the "-smp" maxcpus option. + * + * For small variations of the kind caused by different iasl versions, + * the 4k rounding usually leaves slack. However, there could be still + * one or two values that break. For QEMU 1.7 and QEMU 2.0 the + * slack is only ~10 bytes before one "-smp maxcpus" value breaks! + * + * 6652 is valid for QEMU 2.0, the right value for pc-i440fx-1.7 on + * QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418. + */ + pcmc->legacy_acpi_table_size = 6652; } DEFINE_I440FX_MACHINE(v2_0, "pc-i440fx-2.0", pc_compat_2_0, @@ -493,6 +490,7 @@ static void pc_i440fx_1_7_machine_options(MachineClass *m) SET_MACHINE_COMPAT(m, PC_COMPAT_1_7); pcmc->smbios_defaults = false; pcmc->gigabyte_align = false; + pcmc->legacy_acpi_table_size = 6414; } DEFINE_I440FX_MACHINE(v1_7, "pc-i440fx-1.7", pc_compat_1_7, diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index b09c652..b812968 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -75,6 +75,7 @@ struct PCMachineClass { bool gigabyte_align; bool has_reserved_memory; bool kvmclock_enabled; + int legacy_acpi_table_size; }; #define TYPE_PC_MACHINE "generic-pc-machine" -- 2.1.0