qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Richard Henderson <rth@twiddle.net>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL 05/55] pc: Move enforce_aligned_dimm to PCMachineClass
Date: Tue, 22 Dec 2015 18:52:51 +0200	[thread overview]
Message-ID: <1450803119-4223-6-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1450803119-4223-1-git-send-email-mst@redhat.com>

From: Eduardo Habkost <ehabkost@redhat.com>

enforce_aligned_dimm never changes after the machine is
initialized, so it can be simply set in PCMachineClass like all
the other compat fields.

Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/i386/pc.h |  6 +++---
 hw/i386/pc.c         | 12 +++++++-----
 hw/i386/pc_piix.c    |  4 +---
 hw/i386/pc_q35.c     |  4 +---
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 3edae2b..d1dc63c 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -36,8 +36,6 @@
 /**
  * PCMachineState:
  * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
- * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
- *                        backend's alignment value if provided
  */
 struct PCMachineState {
     /*< private >*/
@@ -52,7 +50,6 @@ struct PCMachineState {
     uint64_t max_ram_below_4g;
     OnOffAuto vmport;
     OnOffAuto smm;
-    bool enforce_aligned_dimm;
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
 };
 
@@ -66,6 +63,8 @@ struct PCMachineState {
 /**
  * PCMachineClass:
  * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler
+ * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
+ *                        backend's alignment value if provided
  */
 struct PCMachineClass {
     /*< private >*/
@@ -94,6 +93,7 @@ struct PCMachineClass {
      * and other BIOS datastructures.
      */
     unsigned acpi_data_size;
+    bool enforce_aligned_dimm;
 };
 
 #define TYPE_PC_MACHINE "generic-pc-machine"
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e8dfc70..5d8f747 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1295,6 +1295,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
     MemoryRegion *ram_below_4g, *ram_above_4g;
     FWCfgState *fw_cfg;
     MachineState *machine = MACHINE(pcms);
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
 
     assert(machine->ram_size == pcms->below_4g_mem_size +
                                 pcms->above_4g_mem_size);
@@ -1356,7 +1357,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
         pcms->hotplug_memory.base =
             ROUND_UP(0x100000000ULL + pcms->above_4g_mem_size, 1ULL << 30);
 
-        if (pcms->enforce_aligned_dimm) {
+        if (pcmc->enforce_aligned_dimm) {
             /* size hotplug region assuming 1G page max alignment per slot */
             hotplug_mem_size += (1ULL << 30) * machine->ram_slots;
         }
@@ -1609,12 +1610,13 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
     HotplugHandlerClass *hhc;
     Error *local_err = NULL;
     PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
     PCDIMMDevice *dimm = PC_DIMM(dev);
     PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
     MemoryRegion *mr = ddc->get_memory_region(dimm);
     uint64_t align = TARGET_PAGE_SIZE;
 
-    if (memory_region_get_alignment(mr) && pcms->enforce_aligned_dimm) {
+    if (memory_region_get_alignment(mr) && pcmc->enforce_aligned_dimm) {
         align = memory_region_get_alignment(mr);
     }
 
@@ -1865,9 +1867,9 @@ static void pc_machine_set_smm(Object *obj, Visitor *v, void *opaque,
 
 static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
 {
-    PCMachineState *pcms = PC_MACHINE(obj);
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(obj);
 
-    return pcms->enforce_aligned_dimm;
+    return pcmc->enforce_aligned_dimm;
 }
 
 static void pc_machine_initfn(Object *obj)
@@ -1905,7 +1907,6 @@ static void pc_machine_initfn(Object *obj)
                                     "Enable vmport (pc & q35)",
                                     &error_abort);
 
-    pcms->enforce_aligned_dimm = true;
     object_property_add_bool(obj, PC_MACHINE_ENFORCE_ALIGNED_DIMM,
                              pc_machine_get_aligned_dimm,
                              NULL, &error_abort);
@@ -1953,6 +1954,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     pcmc->gigabyte_align = true;
     pcmc->has_reserved_memory = true;
     pcmc->kvmclock_enabled = true;
+    pcmc->enforce_aligned_dimm = true;
     /* BIOS ACPI tables: 128K. Other BIOS datastructures: less than 4K reported
      * to be used at the moment, 32K should be enough for a while.  */
     pcmc->acpi_data_size = 0x20000 + 0x8000;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 82b8a5e..f058b3c 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -308,11 +308,8 @@ static void pc_compat_2_2(MachineState *machine)
 
 static void pc_compat_2_1(MachineState *machine)
 {
-    PCMachineState *pcms = PC_MACHINE(machine);
-
     pc_compat_2_2(machine);
     x86_cpu_change_kvm_default("svm", NULL);
-    pcms->enforce_aligned_dimm = false;
 }
 
 static void pc_compat_2_0(MachineState *machine)
@@ -484,6 +481,7 @@ static void pc_i440fx_2_1_machine_options(MachineClass *m)
     m->default_display = NULL;
     SET_MACHINE_COMPAT(m, PC_COMPAT_2_1);
     pcmc->smbios_uuid_encoded = false;
+    pcmc->enforce_aligned_dimm = false;
 }
 
 DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index cc85d3a..2f644f9 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -292,10 +292,7 @@ static void pc_compat_2_2(MachineState *machine)
 
 static void pc_compat_2_1(MachineState *machine)
 {
-    PCMachineState *pcms = PC_MACHINE(machine);
-
     pc_compat_2_2(machine);
-    pcms->enforce_aligned_dimm = false;
     x86_cpu_change_kvm_default("svm", NULL);
 }
 
@@ -409,6 +406,7 @@ static void pc_q35_2_1_machine_options(MachineClass *m)
     m->default_display = NULL;
     SET_MACHINE_COMPAT(m, PC_COMPAT_2_1);
     pcmc->smbios_uuid_encoded = false;
+    pcmc->enforce_aligned_dimm = false;
 }
 
 DEFINE_Q35_MACHINE(v2_1, "pc-q35-2.1", pc_compat_2_1,
-- 
MST

  parent reply	other threads:[~2015-12-22 16:52 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 16:52 [Qemu-devel] [PULL 00/55] acpi, pc features Michael S. Tsirkin
2015-12-22 16:52 ` [Qemu-devel] [PULL 01/55] mmap-alloc: tweak a comment on ppc64 Michael S. Tsirkin
2015-12-22 16:52 ` [Qemu-devel] [PULL 02/55] pc: Move compat boolean globals to PCMachineClass Michael S. Tsirkin
2015-12-22 16:52 ` [Qemu-devel] [PULL 03/55] pc: Move legacy_acpi_table_size global " Michael S. Tsirkin
2015-12-22 16:52 ` [Qemu-devel] [PULL 04/55] pc: Move acpi_data_size " Michael S. Tsirkin
2015-12-22 16:52 ` Michael S. Tsirkin [this message]
2015-12-22 16:52 ` [Qemu-devel] [PULL 06/55] pc: Remove enforce-aligned-dimm QOM property Michael S. Tsirkin
2015-12-22 16:52 ` [Qemu-devel] [PULL 07/55] pc: Move option_rom_has_mr/rom_file_has_mr globals to MachineClass Michael S. Tsirkin
2015-12-22 16:52 ` [Qemu-devel] [PULL 08/55] hw/acpi: merge pxb adjacent memory/IO ranges Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 09/55] hw/pxb: introduce pxb-pcie expander for PCIe machines Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 10/55] hw/i386: extend pxb query for all PC machines Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 11/55] q35: Remove MCHPCIState.guest_info field Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 12/55] pc: Group and document related PCMachineState/PCMachineclass fields Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 13/55] Add a base IPMI interface Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 14/55] ipmi: Add a local BMC simulation Michael S. Tsirkin
2016-01-08  9:02   ` Paolo Bonzini
2016-01-08  9:05   ` Paolo Bonzini
2016-01-12 11:06     ` Michael S. Tsirkin
2016-01-12 12:02       ` Paolo Bonzini
2015-12-22 16:53 ` [Qemu-devel] [PULL 15/55] ipmi: Add an external connection simulation interface Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 16/55] ipmi: Add an ISA KCS low-level interface Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 17/55] ipmi: Add a BT " Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 18/55] ipmi: Add tests Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 19/55] ipmi: Add documentation Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 20/55] ipmi: Add migration capability to the IPMI devices Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 21/55] ipmi: Add a firmware configuration repository Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 22/55] ipmi: Add firmware registration to the ISA interface Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 23/55] ipmi: Add a force off function Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 24/55] q35: skip q35-acpi-dsdt.aml load if not needed Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 25/55] pc: Remove redundant code from pc-*-2.3 machine classes Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 26/55] pc: Add pc-*-2.6 " Michael S. Tsirkin
2015-12-22 16:53 ` [Qemu-devel] [PULL 27/55] pc: Change indentation of PC_COMPAT_* to 4 spaces Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 28/55] hw/compat.h: Change indentation of HW_COMPAT_* " Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 29/55] docs/pci_expander_bridge: fix typo Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 30/55] nvdimm: implement NVDIMM device abstract Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 31/55] acpi: support specified oem table id for build_header Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 32/55] nvdimm acpi: build ACPI NFIT table Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 33/55] nvdimm acpi: build ACPI nvdimm devices Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 34/55] nvdimm: add maintain info Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 35/55] acpi: add aml_derefof Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 36/55] acpi: add aml_sizeof Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 37/55] acpi: add aml_lgreater_equal() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 38/55] acpi: add aml_mutex(), aml_acquire(), aml_release() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 39/55] acpi: add aml_create_qword_field() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 40/55] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 41/55] acpi: extend aml_add() to accept target argument Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 42/55] acpi: add aml_decrement() and aml_subtract() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 43/55] acpi: add aml_call0() helper Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 44/55] acpi: add aml_to_integer() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 45/55] acpi: extend aml_shiftright() to accept target argument Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 46/55] acpi: add aml_alias() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 47/55] acpi: add aml_sleep() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 48/55] acpi: add aml_lor() Michael S. Tsirkin
2015-12-22 16:54 ` [Qemu-devel] [PULL 49/55] acpi: add aml_lgreater() Michael S. Tsirkin
2015-12-22 16:55 ` [Qemu-devel] [PULL 50/55] acpi: extend aml_field() to support LockRule Michael S. Tsirkin
2015-12-22 16:55 ` [Qemu-devel] [PULL 51/55] acpi: add aml_to_hexstring() Michael S. Tsirkin
2015-12-22 16:55 ` [Qemu-devel] [PULL 52/55] acpi: add aml_to_buffer() Michael S. Tsirkin
2015-12-22 16:55 ` [Qemu-devel] [PULL 53/55] acpi add aml_dma() Michael S. Tsirkin
2015-12-22 16:55 ` [Qemu-devel] [PULL 54/55] acpi: extend aml_or() to accept target argument Michael S. Tsirkin
2015-12-22 16:55 ` [Qemu-devel] [PULL 55/55] acpi: extend aml_and() " Michael S. Tsirkin
2015-12-23 12:55 ` [Qemu-devel] [PULL 00/55] acpi, pc features Peter Maydell
2016-01-08 14:53 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450803119-4223-6-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).