[Qemu-devel] [PATCH v2 08/20] pc-dimm: implement memory device class function set_addr()

David Hildenbrand posted 20 patches 7 years, 5 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v2 08/20] pc-dimm: implement memory device class function set_addr()
Posted by David Hildenbrand 7 years, 5 months ago
Keep it simple for now and simply set the static property, that will
fail once realized.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 hw/mem/pc-dimm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index a208b17c64..d4e8a415bf 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -236,6 +236,12 @@ static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
     return dimm->addr;
 }
 
+static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
+                                Error **errp)
+{
+    object_property_set_uint(OBJECT(md), addr, PC_DIMM_ADDR_PROP, errp);
+}
+
 static uint64_t pc_dimm_md_get_plugged_size(const MemoryDeviceState *md,
                                             Error **errp)
 {
@@ -307,6 +313,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
     ddc->get_vmstate_memory_region = pc_dimm_get_memory_region;
 
     mdc->get_addr = pc_dimm_md_get_addr;
+    mdc->set_addr = pc_dimm_md_set_addr;
     mdc->get_plugged_size = pc_dimm_md_get_plugged_size;
     mdc->get_memory_region = pc_dimm_md_get_memory_region;
     mdc->fill_device_info = pc_dimm_md_fill_device_info;
-- 
2.17.1


Re: [Qemu-devel] [PATCH v2 08/20] pc-dimm: implement memory device class function set_addr()
Posted by Igor Mammedov 7 years, 4 months ago
On Wed, 29 Aug 2018 17:36:12 +0200
David Hildenbrand <david@redhat.com> wrote:

> Keep it simple for now and simply set the static property, that will
> fail once realized.
I'd merge this with previous patch and mention that set_addr will replace
'addr' property setting in the next patch where preliminary steps during
memory hotplug are factored out into _preplug handler

> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  hw/mem/pc-dimm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index a208b17c64..d4e8a415bf 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -236,6 +236,12 @@ static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
>      return dimm->addr;
>  }
>  
> +static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
> +                                Error **errp)
> +{
> +    object_property_set_uint(OBJECT(md), addr, PC_DIMM_ADDR_PROP, errp);
> +}
> +
>  static uint64_t pc_dimm_md_get_plugged_size(const MemoryDeviceState *md,
>                                              Error **errp)
>  {
> @@ -307,6 +313,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
>      ddc->get_vmstate_memory_region = pc_dimm_get_memory_region;
>  
>      mdc->get_addr = pc_dimm_md_get_addr;
> +    mdc->set_addr = pc_dimm_md_set_addr;
>      mdc->get_plugged_size = pc_dimm_md_get_plugged_size;
>      mdc->get_memory_region = pc_dimm_md_get_memory_region;
>      mdc->fill_device_info = pc_dimm_md_fill_device_info;


Re: [Qemu-devel] [PATCH v2 08/20] pc-dimm: implement memory device class function set_addr()
Posted by David Hildenbrand 7 years, 4 months ago
Am 13.09.18 um 14:14 schrieb Igor Mammedov:
> On Wed, 29 Aug 2018 17:36:12 +0200
> David Hildenbrand <david@redhat.com> wrote:
> 
>> Keep it simple for now and simply set the static property, that will
>> fail once realized.
> I'd merge this with previous patch and mention that set_addr will replace
> 'addr' property setting in the next patch where preliminary steps during
> memory hotplug are factored out into _preplug handler

Sounds good to me, thanks!

> 
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  hw/mem/pc-dimm.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
>> index a208b17c64..d4e8a415bf 100644
>> --- a/hw/mem/pc-dimm.c
>> +++ b/hw/mem/pc-dimm.c
>> @@ -236,6 +236,12 @@ static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
>>      return dimm->addr;
>>  }
>>  
>> +static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
>> +                                Error **errp)
>> +{
>> +    object_property_set_uint(OBJECT(md), addr, PC_DIMM_ADDR_PROP, errp);
>> +}
>> +
>>  static uint64_t pc_dimm_md_get_plugged_size(const MemoryDeviceState *md,
>>                                              Error **errp)
>>  {
>> @@ -307,6 +313,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
>>      ddc->get_vmstate_memory_region = pc_dimm_get_memory_region;
>>  
>>      mdc->get_addr = pc_dimm_md_get_addr;
>> +    mdc->set_addr = pc_dimm_md_set_addr;
>>      mdc->get_plugged_size = pc_dimm_md_get_plugged_size;
>>      mdc->get_memory_region = pc_dimm_md_get_memory_region;
>>      mdc->fill_device_info = pc_dimm_md_fill_device_info;
> 


-- 

Thanks,

David / dhildenb