qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, tangchen@cn.fujitsu.com,
	pbonzini@redhat.com, izumi.taku@jp.fujitsu.com,
	guz.fnst@cn.fujitsu.com, imammedo@redhat.com
Subject: Re: [Qemu-devel] [RESEND PATCH v4 1/6] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus
Date: Mon, 16 Mar 2015 14:58:21 +0100	[thread overview]
Message-ID: <20150316145713-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <849482771656da4717f071a85bd83e72e48f5ab0.1426494342.git.zhugh.fnst@cn.fujitsu.com>

On Mon, Mar 16, 2015 at 04:58:13PM +0800, Zhu Guihua wrote:
> From: Tang Chen <tangchen@cn.fujitsu.com>
> 
> Add a new API named acpi_memory_slot_status() to obtain a single memory
> slot status. Doing this is because this procedure will be used by other
> functions in the next coming patches.
> 
> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>

It's generally only OK to add API in a separate
patch from its use if the API is well documented.
There's 0 documentation here, so please just squash this
with the user so one can review without jumping
back and forth.


> ---
>  hw/acpi/memory_hotplug.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index c6580da..0efc357 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -163,29 +163,41 @@ void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
>      memory_region_add_subregion(as, ACPI_MEMORY_HOTPLUG_BASE, &state->io);
>  }
>  
> -void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> -                         DeviceState *dev, Error **errp)
> +static MemStatus *
> +acpi_memory_slot_status(MemHotplugState *mem_st,
> +                        DeviceState *dev, Error **errp)
>  {
> -    MemStatus *mdev;
>      Error *local_err = NULL;
>      int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP,
>                                         &local_err);
>  
>      if (local_err) {
>          error_propagate(errp, local_err);
> -        return;
> +        return NULL;
>      }
>  
>      if (slot >= mem_st->dev_count) {
>          char *dev_path = object_get_canonical_path(OBJECT(dev));
> -        error_setg(errp, "acpi_memory_plug_cb: "
> +        error_setg(errp, "acpi_memory_slot_status: "
>                     "device [%s] returned invalid memory slot[%d]",
>                      dev_path, slot);
>          g_free(dev_path);
> +        return NULL;
> +    }
> +
> +    return &mem_st->devs[slot];
> +}
> +
> +void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> +                         DeviceState *dev, Error **errp)
> +{
> +    MemStatus *mdev;
> +
> +    mdev = acpi_memory_slot_status(mem_st, dev, errp);
> +    if (!mdev) {
>          return;
>      }
>  
> -    mdev = &mem_st->devs[slot];
>      mdev->dimm = dev;
>      mdev->is_enabled = true;
>      mdev->is_inserting = true;
> -- 
> 1.9.3

  reply	other threads:[~2015-03-16 13:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16  8:58 [Qemu-devel] [RESEND PATCH v4 0/6] QEMU memory hot unplug support Zhu Guihua
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 1/6] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus Zhu Guihua
2015-03-16 13:58   ` Michael S. Tsirkin [this message]
2015-03-19  1:52     ` Zhu Guihua
2015-03-19  5:59       ` Michael S. Tsirkin
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 2/6] acpi, mem-hotplug: Add unplug request cb for memory device Zhu Guihua
2015-03-16 13:53   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 3/6] pc-dimm: Add memory hot unplug request support for pc-dimm Zhu Guihua
2015-03-16 13:56   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 4/6] acpi, mem-hotplug: Add unplug cb for memory device Zhu Guihua
2015-03-16 14:10   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 5/6] pc-dimm: Add memory hot unplug support for pc-dimm Zhu Guihua
2015-03-16 14:20   ` Igor Mammedov
2015-03-16  8:58 ` [Qemu-devel] [RESEND PATCH v4 6/6] acpi: Add hardware implementation for memory hot unplug Zhu Guihua
2015-03-16 14:59   ` Igor Mammedov
2015-03-23 10:59     ` Zhu Guihua
2015-03-23 12:47       ` Igor Mammedov
2015-03-24  9:34         ` Zhu Guihua
2015-03-24 10:26           ` Igor Mammedov
2015-03-25  6:13             ` Zhu Guihua
2015-03-25 10:40               ` Igor Mammedov
2015-03-24  9:38     ` Zhu Guihua
2015-03-24 10:31       ` Igor Mammedov
2015-03-24 10:48         ` Zhu Guihua
2015-03-25 10:35           ` 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=20150316145713-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=izumi.taku@jp.fujitsu.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).