Re: [Qemu-devel] [PATCH v5 14/24] hw: i386: Make the hotpluggable memory size property more generic

2018-11-15 Thread Igor Mammedov
On Mon,  5 Nov 2018 02:40:37 +0100
Samuel Ortiz  wrote:

> This property is currently defined under i386/pc while it only describes
> a region size that's eventually fetched from the AML ACPI code.
> 
> We can make it more generic and shareable across machine types by moving
> it to memory-device.h instead.
> 
> Signed-off-by: Samuel Ortiz 
not sure it belong to this series, but regardless where it end-ups

Reviewed-by: Igor Mammedov 

> ---
>  include/hw/i386/pc.h   | 1 -
>  include/hw/mem/memory-device.h | 2 ++
>  hw/i386/acpi-build.c   | 2 +-
>  hw/i386/pc.c   | 3 ++-
>  4 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index bbbdb33ea3..44cb6bf3f3 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -62,7 +62,6 @@ struct PCMachineState {
>  };
>  
>  #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
> -#define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"
>  #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
>  #define PC_MACHINE_VMPORT   "vmport"
>  #define PC_MACHINE_SMM  "smm"
> diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
> index e904e194d5..d9a4fc7c3e 100644
> --- a/include/hw/mem/memory-device.h
> +++ b/include/hw/mem/memory-device.h
> @@ -97,6 +97,8 @@ typedef struct MemoryDeviceClass {
>   MemoryDeviceInfo *info);
>  } MemoryDeviceClass;
>  
> +#define MEMORY_DEVICE_REGION_SIZE "memory-device-region-size"
> +
>  MemoryDeviceInfoList *qmp_memory_device_list(void);
>  uint64_t get_plugged_memory_size(void);
>  void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index d8bba16776..1ef1a38441 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1628,7 +1628,7 @@ build_srat(GArray *table_data, BIOSLinker *linker,
>  MachineClass *mc = MACHINE_GET_CLASS(machine);
>  const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(machine);
>  ram_addr_t hotplugabble_address_space_size =
> -object_property_get_int(OBJECT(machine), 
> PC_MACHINE_DEVMEM_REGION_SIZE,
> +object_property_get_int(OBJECT(machine), MEMORY_DEVICE_REGION_SIZE,
>  NULL);
>  
>  srat_start = table_data->len;
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 090f969933..c9ffc8cff6 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -67,6 +67,7 @@
>  #include "hw/boards.h"
>  #include "acpi-build.h"
>  #include "hw/mem/pc-dimm.h"
> +#include "hw/mem/memory-device.h"
>  #include "qapi/error.h"
>  #include "qapi/qapi-visit-common.h"
>  #include "qapi/visitor.h"
> @@ -2443,7 +2444,7 @@ static void pc_machine_class_init(ObjectClass *oc, void 
> *data)
>  nc->nmi_monitor_handler = x86_nmi;
>  mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE;
>  
> -object_class_property_add(oc, PC_MACHINE_DEVMEM_REGION_SIZE, "int",
> +object_class_property_add(oc, MEMORY_DEVICE_REGION_SIZE, "int",
>  pc_machine_get_device_memory_region_size, NULL,
>  NULL, NULL, _abort);
>  




[Qemu-devel] [PATCH v5 14/24] hw: i386: Make the hotpluggable memory size property more generic

2018-11-04 Thread Samuel Ortiz
This property is currently defined under i386/pc while it only describes
a region size that's eventually fetched from the AML ACPI code.

We can make it more generic and shareable across machine types by moving
it to memory-device.h instead.

Signed-off-by: Samuel Ortiz 
---
 include/hw/i386/pc.h   | 1 -
 include/hw/mem/memory-device.h | 2 ++
 hw/i386/acpi-build.c   | 2 +-
 hw/i386/pc.c   | 3 ++-
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index bbbdb33ea3..44cb6bf3f3 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -62,7 +62,6 @@ struct PCMachineState {
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
-#define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
 #define PC_MACHINE_VMPORT   "vmport"
 #define PC_MACHINE_SMM  "smm"
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index e904e194d5..d9a4fc7c3e 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -97,6 +97,8 @@ typedef struct MemoryDeviceClass {
  MemoryDeviceInfo *info);
 } MemoryDeviceClass;
 
+#define MEMORY_DEVICE_REGION_SIZE "memory-device-region-size"
+
 MemoryDeviceInfoList *qmp_memory_device_list(void);
 uint64_t get_plugged_memory_size(void);
 void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index d8bba16776..1ef1a38441 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1628,7 +1628,7 @@ build_srat(GArray *table_data, BIOSLinker *linker,
 MachineClass *mc = MACHINE_GET_CLASS(machine);
 const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(machine);
 ram_addr_t hotplugabble_address_space_size =
-object_property_get_int(OBJECT(machine), PC_MACHINE_DEVMEM_REGION_SIZE,
+object_property_get_int(OBJECT(machine), MEMORY_DEVICE_REGION_SIZE,
 NULL);
 
 srat_start = table_data->len;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 090f969933..c9ffc8cff6 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -67,6 +67,7 @@
 #include "hw/boards.h"
 #include "acpi-build.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/mem/memory-device.h"
 #include "qapi/error.h"
 #include "qapi/qapi-visit-common.h"
 #include "qapi/visitor.h"
@@ -2443,7 +2444,7 @@ static void pc_machine_class_init(ObjectClass *oc, void 
*data)
 nc->nmi_monitor_handler = x86_nmi;
 mc->default_cpu_type = TARGET_DEFAULT_CPU_TYPE;
 
-object_class_property_add(oc, PC_MACHINE_DEVMEM_REGION_SIZE, "int",
+object_class_property_add(oc, MEMORY_DEVICE_REGION_SIZE, "int",
 pc_machine_get_device_memory_region_size, NULL,
 NULL, NULL, _abort);
 
-- 
2.19.1