diff mbox

[RFC,v3,27/35] pc: Move gigabyte_align to PCMachineClass

Message ID 1404519002-10224-28-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost July 5, 2014, 12:09 a.m. UTC
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc.c         |  1 +
 hw/i386/pc_piix.c    | 11 +++--------
 hw/i386/pc_q35.c     |  9 ++-------
 include/hw/i386/pc.h |  5 +++++
 4 files changed, 11 insertions(+), 15 deletions(-)
diff mbox

Patch

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 7f44b3b..3fe5764 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1666,6 +1666,7 @@  static void pc_machine_class_init(ObjectClass *oc, void *data)
     pcmc->kvmclock_enabled = true;
     pcmc->smbios_defaults = true;
     pcmc->has_acpi_build = true;
+    pcmc->gigabyte_align = true;
     mc->get_hotplug_handler = pc_get_hotpug_handler;
     mc->default_boot_order = "cad";
     mc->hot_add_cpu = pc_hot_add_cpu;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ca662b4..1d58798 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -59,11 +59,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 };
 
-/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
- * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
- * pages in the host.
- */
-static bool gigabyte_align = true;
 static bool has_reserved_memory = true;
 
 /* PC hardware initialisation */
@@ -105,7 +100,7 @@  static void pc_init1(MachineState *machine)
      * breaking migration.
      */
     if (machine->ram_size >= 0xe0000000) {
-        lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
+        lowmem = pcmc->gigabyte_align ? 0xc0000000 : 0xe0000000;
     } else {
         lowmem = 0xe0000000;
     }
@@ -299,7 +294,6 @@  static void pc_compat_2_0(MachineState *machine)
 static void pc_compat_1_7(MachineState *machine)
 {
     pc_compat_2_0(machine);
-    gigabyte_align = false;
     option_rom_has_mr = true;
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
@@ -393,7 +387,6 @@  static void pc_init_pci_no_kvmclock(MachineState *machine)
 
 static void pc_init_isa(MachineState *machine)
 {
-    gigabyte_align = false;
     has_reserved_memory = false;
     option_rom_has_mr = true;
     rom_file_has_mr = false;
@@ -488,6 +481,7 @@  static void pc_i440fx_machine_v1_7_class_init(ObjectClass *oc, void *data)
     mc->name = "pc-i440fx-1.7";
     machine_class_add_compat_props(mc, compat_props);
     pcmc->smbios_defaults = false;
+    pcmc->gigabyte_align = false;
 }
 
 static const TypeInfo pc_i440fx_machine_v1_7_type_info = {
@@ -970,6 +964,7 @@  static void isapc_machine_class_init(ObjectClass *oc, void *data)
     pcmc->smbios_defaults = false;
     pcmc->has_acpi_build = false;
     pcmc->has_pci_info = false;
+    pcmc->gigabyte_align = false;
 }
 
 static const TypeInfo isapc_machine_type_info = {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index d8b304f..9b67a67 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -49,11 +49,6 @@ 
 /* ICH9 AHCI has 6 ports */
 #define MAX_SATA_PORTS     6
 
-/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
- * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
- * pages in the host.
- */
-static bool gigabyte_align = true;
 static bool has_reserved_memory = true;
 
 /* PC hardware initialisation */
@@ -95,7 +90,7 @@  static void pc_q35_init(MachineState *machine)
      * breaking migration.
      */
     if (machine->ram_size >= 0xb0000000) {
-        lowmem = gigabyte_align ? 0x80000000 : 0xb0000000;
+        lowmem = pcmc->gigabyte_align ? 0x80000000 : 0xb0000000;
     } else {
         lowmem = 0xb0000000;
     }
@@ -278,7 +273,6 @@  static void pc_compat_2_0(MachineState *machine)
 static void pc_compat_1_7(MachineState *machine)
 {
     pc_compat_2_0(machine);
-    gigabyte_align = false;
     option_rom_has_mr = true;
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 }
@@ -400,6 +394,7 @@  static void pc_q35_machine_v1_7_class_init(ObjectClass *oc, void *data)
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-1.7";
     pcmc->smbios_defaults = false;
+    pcmc->gigabyte_align = false;
 }
 
 static TypeInfo pc_q35_machine_v1_7_type_info = {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 2b90dcb..c31c1bc 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -59,6 +59,11 @@  struct PCMachineClass {
     bool smbios_defaults;
     bool has_acpi_build;
     bool has_pci_info;
+    /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
+     * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
+     * pages in the host.
+     */
+    bool gigabyte_align;
 };
 
 typedef struct PCMachineState PCMachineState;