qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RESEND PATCH v4 08/10] pc-dimm: Add pc_dimm_unrealize(


From: Igor Mammedov
Subject: Re: [Qemu-devel] [RESEND PATCH v4 08/10] pc-dimm: Add pc_dimm_unrealize() for memory hot unplug support.
Date: Wed, 5 Nov 2014 11:19:06 +0100

On Wed, 5 Nov 2014 13:49:53 +0800
Tang Chen <address@hidden> wrote:

> From: Hu Tao <address@hidden>
> 
> Implement unrealize function for pc-dimm device. It remove subregion from
> hotplug region, and delete ram address range from guest ram list.
This still doesn't address comments made in V3

looks like there isn't any need for unrealize so far
> 
> Signed-off-by: Hu Tao <address@hidden>
> Signed-off-by: Tang Chen <address@hidden>
> ---
>  hw/mem/pc-dimm.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index ee802bb..b105871 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -270,12 +270,22 @@ static MemoryRegion 
> *pc_dimm_get_memory_region(PCDIMMDevice *dimm)
>      return host_memory_backend_get_memory(dimm->hostmem, &error_abort);
>  }
>  
> +static void pc_dimm_unrealize(DeviceState *dev, Error **errp)
> +{
> +    PCDIMMDevice *dimm = PC_DIMM(dev);
> +    MemoryRegion *mr = pc_dimm_get_memory_region(dimm);
> +
> +    memory_region_del_subregion(mr->container, mr);
you wouldn't need to access fields if it's done in unplug handler
and you shouldn't access MemoryRegion fields directly in the first place

> +    vmstate_unregister_ram(mr, dev);


all above should be done unplug handler by pc-machine

> +}
> +
>  static void pc_dimm_class_init(ObjectClass *oc, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(oc);
>      PCDIMMDeviceClass *ddc = PC_DIMM_CLASS(oc);
>  
>      dc->realize = pc_dimm_realize;
> +    dc->unrealize = pc_dimm_unrealize;
>      dc->props = pc_dimm_properties;
>  
>      ddc->get_memory_region = pc_dimm_get_memory_region;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]