[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 2/4] sclp-s390: Add device to manage s390 mem
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH v4 2/4] sclp-s390: Add device to manage s390 memory hotplug |
Date: |
Wed, 21 May 2014 09:48:46 +0200 |
On Tue, 20 May 2014 12:26:26 -0400
Matthew Rosato <address@hidden> wrote:
> Add sclpMemoryHotplugDev to contain associated data structures, etc.
>
> Signed-off-by: Matthew Rosato <address@hidden>
> ---
> hw/s390x/sclp.c | 38 ++++++++++++++++++++++++++++++++++++++
> include/hw/s390x/sclp.h | 20 ++++++++++++++++++++
> 2 files changed, 58 insertions(+)
>
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index d8ddf35..3f32eba 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -183,3 +183,41 @@ void s390_sclp_init(void)
> OBJECT(dev), NULL);
> qdev_init_nofail(dev);
> }
> +
> +sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void)
> +{
> + ObjectProperty *op;
> + DeviceState *dev;
> + dev = qdev_create(NULL, TYPE_SCLP_MEMORY_HOTPLUG_DEV);
> + object_property_add_child(qdev_get_machine(),
> + TYPE_SCLP_MEMORY_HOTPLUG_DEV,
> + OBJECT(dev), NULL);
> + qdev_init_nofail(dev);
> + op = object_property_find(qdev_get_machine(),
> + TYPE_SCLP_MEMORY_HOTPLUG_DEV,
> + NULL);
> + return op->opaque;
one is not supposed to touch internals of ObjectProperty
pls use object_resolve_path*() instead of object_property_find()
in this patch.
> +}
> +
> +sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void)
> +{
> + ObjectProperty *op = object_property_find(qdev_get_machine(),
> + TYPE_SCLP_MEMORY_HOTPLUG_DEV,
> + NULL);
> + if (!op) {
> + return NULL;
> + }
> + return op->opaque;
> +}
> +
> +static TypeInfo sclp_memory_hotplug_dev_info = {
> + .name = TYPE_SCLP_MEMORY_HOTPLUG_DEV,
> + .parent = TYPE_SYS_BUS_DEVICE,
> + .instance_size = sizeof(sclpMemoryHotplugDev),
> +};
> +
> +static void register_types(void)
> +{
> + type_register_static(&sclp_memory_hotplug_dev_info);
> +}
> +type_init(register_types);
> diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
> index 7ef1622..03bc9c3 100644
> --- a/include/hw/s390x/sclp.h
> +++ b/include/hw/s390x/sclp.h
> @@ -37,6 +37,7 @@
> #define SCLP_STARTING_SUBINCREMENT_ID 0x10001
> #define SCLP_INCREMENT_UNIT 0x10000
> #define MAX_AVAIL_SLOTS 32
> +#define MAX_STORAGE_INCREMENTS 1020
>
> /* CPU hotplug SCLP codes */
> #define SCLP_HAS_CPU_INFO 0x0C00000000000000ULL
> @@ -156,6 +157,23 @@ typedef struct SCCB {
> char data[SCCB_DATA_LEN];
> } QEMU_PACKED SCCB;
>
> +typedef struct sclpMemoryHotplugDev sclpMemoryHotplugDev;
> +
> +#define TYPE_SCLP_MEMORY_HOTPLUG_DEV "sclp-memory-hotplug-dev"
> +#define SCLP_MEMORY_HOTPLUG_DEV(obj) \
> + OBJECT_CHECK(sclpMemoryHotplugDev, (obj), TYPE_SCLP_MEMORY_HOTPLUG_DEV)
> +
> +struct sclpMemoryHotplugDev {
> + DeviceState parent;
> + ram_addr_t standby_mem_size;
> + ram_addr_t padded_ram_size;
> + ram_addr_t pad_size;
> + ram_addr_t standby_subregion_size;
> + ram_addr_t rzm;
> + int increment_size;
> + char *standby_state_map;
> +};
> +
> static inline int sccb_data_len(SCCB *sccb)
> {
> return be16_to_cpu(sccb->h.length) - sizeof(sccb->h);
> @@ -163,6 +181,8 @@ static inline int sccb_data_len(SCCB *sccb)
>
>
> void s390_sclp_init(void);
> +sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void);
> +sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void);
> void sclp_service_interrupt(uint32_t sccb);
> void raise_irq_cpu_hotplug(void);
>