[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_m
From: |
David Hildenbrand |
Subject: |
Re: [qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memory_plug |
Date: |
Fri, 8 Jun 2018 10:07:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 08.06.2018 10:05, Greg Kurz wrote:
> On Thu, 7 Jun 2018 18:52:13 +0200
> David Hildenbrand <address@hidden> wrote:
>
>> Let's clean the hotplug handler up by moving everything into
>> spapr_memory_plug().
>>
>> Signed-off-by: David Hildenbrand <address@hidden>
>> ---
>> hw/ppc/spapr.c | 23 ++++++++++-------------
>> 1 file changed, 10 insertions(+), 13 deletions(-)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index d038f3243e..a12be24ca9 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -3136,14 +3136,22 @@ static void spapr_add_lmbs(DeviceState *dev,
>> uint64_t addr_start, uint64_t size,
>> }
>>
>> static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
>> - uint32_t node, Error **errp)
>> + Error **errp)
>> {
>> Error *local_err = NULL;
>> sPAPRMachineState *ms = SPAPR_MACHINE(hotplug_dev);
>> + sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
>> PCDIMMDevice *dimm = PC_DIMM(dev);
>> PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
>> MemoryRegion *mr;
>> uint64_t align, size, addr;
>> + uint32_t node;
>> +
>> + if (!smc->dr_lmb_enabled) {
>> + error_setg(&local_err, "Memory hotplug not supported for this
>> machine");
>> + goto out;
>> + }
>
> Wouldn't it be more appropriate to move this check to spapr_memory_pre_plug()
> ?
Think you're right (and as spapr_memory_pre_plug() already exists, it's
easy), other opinions? Thanks.
>
>> + node = object_property_get_uint(OBJECT(dev), PC_DIMM_NODE_PROP, NULL);
>>
>> mr = ddc->get_memory_region(dimm, &local_err);
>> if (local_err) {
>> @@ -3568,19 +3576,8 @@ out:
>> static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
>> DeviceState *dev, Error **errp)
>> {
>> - MachineState *ms = MACHINE(hotplug_dev);
>> - sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
>> -
>> if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
>> - int node;
>> -
>> - if (!smc->dr_lmb_enabled) {
>> - error_setg(errp, "Memory hotplug not supported for this
>> machine");
>> - return;
>> - }
>> - node = object_property_get_uint(OBJECT(dev), PC_DIMM_NODE_PROP,
>> NULL);
>> -
>> - spapr_memory_plug(hotplug_dev, dev, node, errp);
>> + spapr_memory_plug(hotplug_dev, dev, errp);
>> } else if (object_dynamic_cast(OBJECT(dev), TYPE_SPAPR_CPU_CORE)) {
>> spapr_core_plug(hotplug_dev, dev, errp);
>> }
>
--
Thanks,
David / dhildenb
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, (continued)
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Greg Kurz, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Cornelia Huck, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, Greg Kurz, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Gibson, 2018/06/08
- Re: [qemu-s390x] [PATCH v1 2/8] spapr: no need to verify the node, David Hildenbrand, 2018/06/08
[qemu-s390x] [PATCH v1 3/8] spapr: move all DIMM checks into spapr_memory_plug, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 5/8] spapr: introduce machine unplug handler, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 4/8] spapr: local error handling in hotplug handler functions, David Hildenbrand, 2018/06/07
[qemu-s390x] [PATCH v1 6/8] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/06/07