qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: hutao@cn.fujitsu.com, qemu-devel@nongnu.org,
	tangchen@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
	pbonzini@redhat.com, guz.fnst@cn.fujitsu.com,
	imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 02/10] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus.
Date: Tue, 3 Mar 2015 10:18:12 +0800	[thread overview]
Message-ID: <54F519E4.6090502@cn.fujitsu.com> (raw)
In-Reply-To: <20150301173139.GG8233@redhat.com>


On 03/02/2015 01:31 AM, Michael S. Tsirkin wrote:
> On Thu, Feb 26, 2015 at 09:16:44AM +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>
> Same comments as everywhere: include implementation with
> users.
> In this case, I can't tell whether error_setg is
> appropriate since I don't know whether the error
> ever comes from user.

Do you have any suggestions about this error_setg?

Thanks,
Zhu

>
>> ---
>>   hw/acpi/memory_hotplug.c | 26 +++++++++++++++++++-------
>>   1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
>> index c6580da..6d91a0d 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_get_slot_status_descriptor: "
>>                      "device [%s] returned invalid memory slot[%d]",
>> -                    dev_path, slot);
>> +                   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-03  2:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  1:16 [Qemu-devel] [PATCH v3 00/10] QEMU memory hot unplug support Zhu Guihua
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 01/10] acpi, mem-hotplug: Use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb() Zhu Guihua
2015-03-01 17:32   ` Michael S. Tsirkin
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 02/10] acpi, mem-hotplug: Add acpi_memory_slot_status() to get MemStatus Zhu Guihua
2015-03-01 17:31   ` Michael S. Tsirkin
2015-03-03  2:18     ` Zhu Guihua [this message]
2015-03-03 13:43       ` Michael S. Tsirkin
2015-03-04  3:03         ` Zhu Guihua
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 03/10] acpi, mem-hotplug: Add acpi_send_gpe_event() to rise sci for memory hotplug Zhu Guihua
2015-03-01 17:29   ` Michael S. Tsirkin
2015-03-02  9:27     ` Igor Mammedov
2015-03-02  9:58       ` Michael S. Tsirkin
2015-03-04 12:16       ` Michael S. Tsirkin
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 04/10] acpi, mem-hotplug: Add unplug request cb for memory device Zhu Guihua
2015-03-01 17:25   ` Michael S. Tsirkin
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 05/10] ich9, piix4, pc-dimm: Add memory hot unplug request support Zhu Guihua
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 06/10] acpi, mem-hotplug: Add unplug cb for memory device Zhu Guihua
2015-03-01 17:21   ` Michael S. Tsirkin
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 07/10] ich9, piix4, pc-dimm: Add memory hot unplug support Zhu Guihua
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 08/10] qdev: make qdev_get_hotplug_handler() non-static Zhu Guihua
2015-03-01 17:10   ` Michael S. Tsirkin
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 09/10] ssdt-mem: add MEMORY_SLOT_EJECT_METHOD Zhu Guihua
2015-03-01 17:11   ` Michael S. Tsirkin
2015-02-26  1:16 ` [Qemu-devel] [PATCH v3 10/10] acpi: Add hardware implementation for memory hot unplug Zhu Guihua
2015-03-01 17:16   ` Michael S. Tsirkin
2015-03-01 17:35 ` [Qemu-devel] [PATCH v3 00/10] QEMU memory hot unplug support Michael S. Tsirkin

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=54F519E4.6090502@cn.fujitsu.com \
    --to=zhugh.fnst@cn.fujitsu.com \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.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 \
    /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).