qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Cc: mst@redhat.com, hutao@cn.fujitsu.com, qemu-devel@nongnu.org,
	tangchen@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
	guz.fnst@cn.fujitsu.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 08/12] acpi, mem-hotplug: Add unplug cb for memory device.
Date: Tue, 10 Feb 2015 15:09:48 +0100	[thread overview]
Message-ID: <20150210150948.738315ea@nial.brq.redhat.com> (raw)
In-Reply-To: <d082d8ec3ea2384502bc38612be1f7f2db74a39a.1423016633.git.zhugh.fnst@cn.fujitsu.com>

On Wed, 4 Feb 2015 10:51:22 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:

> From: Tang Chen <tangchen@cn.fujitsu.com>
> 
> Reset all memory status, and unparent the memory device.
> 
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
>  hw/acpi/memory_hotplug.c         | 34 ++++++++++++++++++++++++++++++++++
>  hw/core/qdev.c                   |  2 +-
>  include/hw/acpi/memory_hotplug.h |  2 ++
>  include/hw/qdev-core.h           |  1 +
>  4 files changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index 3d3c1ec..3ae9629 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -1,6 +1,7 @@
>  #include "hw/acpi/memory_hotplug.h"
>  #include "hw/acpi/pc-hotplug.h"
>  #include "hw/mem/pc-dimm.h"
> +#include "hw/i386/pc.h"
>  #include "hw/boards.h"
>  #include "trace.h"
>  #include "qapi-event.h"
> @@ -221,6 +222,39 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
>      acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
>  }
>  
> +void acpi_memory_unplug_cb(ACPIREGS *ar, qemu_irq irq,
> +                           MemHotplugState *mem_st,
> +                           DeviceState *dev, Error **errp)
> +{
[...]
> +
> +    hotplug_dev = qdev_get_hotplug_handler(dev);
> +    pcms = PC_MACHINE(hotplug_dev);
> +    dimm = PC_DIMM(dev);
> +    ddc = PC_DIMM_GET_CLASS(dimm);
> +    mr = ddc->get_memory_region(dimm);
> +
> +    memory_region_del_subregion(&pcms->hotplug_memory, mr);
> +    vmstate_unregister_ram(mr, dev);
perhaps I wasn't clear previous time,
acpi device has no business in un-mapping and un-registering.

Pls, leave lines that deal with internal to acpi device state
/i.e. mdev/ and move memory_region_del_subregion/vmstate_unregister_ram
to pc_dimm_unplug().

> +}
> +
>  static const VMStateDescription vmstate_memhp_sts = {
>      .name = "memory hotplug device state",
>      .version_id = 1,




> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 2eacac0..2f3d1df 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -273,7 +273,7 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
>      dev->alias_required_for_version = required_for_version;
>  }
>  
> -static HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
> +HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
>  {
>      HotplugHandler *hotplug_ctrl = NULL;
>  
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 15a226f..03d6239 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -266,6 +266,7 @@ int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT;
>  void qdev_init_nofail(DeviceState *dev);
>  void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
>                                   int required_for_version);
> +HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev);
>  void qdev_unplug(DeviceState *dev, Error **errp);
>  void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
>                                    DeviceState *dev, Error **errp);
move qdev_get_hotplug_handler changes into a separate patch,
though it won't be used in this patch it will be used by the last patch anyway.

  reply	other threads:[~2015-02-10 14:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  2:51 [Qemu-devel] [PATCH v2 00/12] QEmu memory hot unplug support Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 01/12] acpi, mem-hotplug: Use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb() Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 02/12] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus Zhu Guihua
2015-02-10 14:18   ` Igor Mammedov
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 03/12] acpi, mem-hotplug: Add acpi_memory_hotplug_sci() to rise sci for memory hotplug Zhu Guihua
2015-02-10 13:01   ` Igor Mammedov
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 04/12] acpi, mem-hotplug: Add unplug request cb for memory device Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 05/12] acpi, piix4: Add memory hot unplug request support for piix4 Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 06/12] acpi, ich9: Add memory hot unplug request support for ich9 Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 07/12] pc-dimm: Add memory hot unplug request support for pc-dimm Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 08/12] acpi, mem-hotplug: Add unplug cb for memory device Zhu Guihua
2015-02-10 14:09   ` Igor Mammedov [this message]
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 09/12] acpi, piix4: Add memory hot unplug support for piix4 Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 10/12] acpi, ich9: Add memory hot unplug support for ich9 Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 11/12] pc-dimm: Add memory hot unplug support for pc-dimm Zhu Guihua
2015-02-04  2:51 ` [Qemu-devel] [PATCH v2 12/12] acpi: Add hardware implementation for memory hot unplug Zhu Guihua
2015-02-10 13:38   ` Igor Mammedov
2015-02-04 10:28 ` [Qemu-devel] [PATCH v2 00/12] QEmu memory hot unplug support Michael S. Tsirkin
2015-02-04 10:36   ` Zhu Guihua
2015-02-10 13:59 ` Igor Mammedov

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=20150210150948.738315ea@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tangchen@cn.fujitsu.com \
    --cc=zhugh.fnst@cn.fujitsu.com \
    /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).