qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	david@gibson.dropbear.id.au, nfont@linux.vnet.ibm.com,
	mwb@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [RFC PATCH v0 1/2] pc-dimm: Make pc_dimm_built_list() global
Date: Tue, 20 Feb 2018 15:35:10 +0100	[thread overview]
Message-ID: <20180220153510.27451354@redhat.com> (raw)
In-Reply-To: <1519022574-6817-2-git-send-email-bharata@linux.vnet.ibm.com>

On Mon, 19 Feb 2018 12:12:53 +0530
Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:

> Making pc_dimm_built_list() global allows other parts of QEMU code
> to build and walk through the DIMM list in address-sorted order.
> 
> This is needed in the next patch for sPAPR code to create
> ibm,dynamic-memory-v2 device tree property that will have entries
> for populated DIMMs as well as available hotpluggable areas.
> 
> CHECK: List of DIMMs is already available via qmp_pc_dimm_device_list(),
maybe make it sorted first and use it?

(i.e. use pc_dimm_built_list in qmp_pc_dimm_device_list) and hide
recursive callback ugliness from external users.

MemoryDeviceInfoList *qmp_pc_dimm_device_list(void) {
    object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &list);
    ...
}

> but that doesn't provide a sorted list.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> ---
>  hw/mem/pc-dimm.c         | 2 +-
>  include/hw/mem/pc-dimm.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 6e74b61..9bd61ca 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -261,7 +261,7 @@ static gint pc_dimm_addr_sort(gconstpointer a, gconstpointer b)
>      return 0;
>  }
>  
> -static int pc_dimm_built_list(Object *obj, void *opaque)
> +int pc_dimm_built_list(Object *obj, void *opaque)
>  {
>      GSList **list = opaque;
>  
> diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
> index d83b957..d880f5e 100644
> --- a/include/hw/mem/pc-dimm.h
> +++ b/include/hw/mem/pc-dimm.h
> @@ -100,4 +100,5 @@ void pc_dimm_memory_plug(DeviceState *dev, MemoryHotplugState *hpms,
>                           MemoryRegion *mr, uint64_t align, Error **errp);
>  void pc_dimm_memory_unplug(DeviceState *dev, MemoryHotplugState *hpms,
>                             MemoryRegion *mr);
> +int pc_dimm_built_list(Object *obj, void *opaque);
>  #endif

  reply	other threads:[~2018-02-20 14:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19  6:42 [Qemu-devel] [RFC PATCH v0 0/2] Support for ibm,dynamic-memory-v2 Bharata B Rao
2018-02-19  6:42 ` [Qemu-devel] [RFC PATCH v0 1/2] pc-dimm: Make pc_dimm_built_list() global Bharata B Rao
2018-02-20 14:35   ` Igor Mammedov [this message]
2018-02-22  5:52     ` Bharata B Rao
2018-02-19  6:42 ` [Qemu-devel] [RFC PATCH v0 2/2] spapr: Support ibm, dynamic-memory-v2 property Bharata B Rao

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=20180220153510.27451354@redhat.com \
    --to=imammedo@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mwb@linux.vnet.ibm.com \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).