[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [PATCH v3 1/3] pc-dimm: factor out MemoryDevice interfa
From: |
David Gibson |
Subject: |
Re: [qemu-s390x] [PATCH v3 1/3] pc-dimm: factor out MemoryDevice interface |
Date: |
Sun, 22 Apr 2018 14:26:15 +1000 |
User-agent: |
Mutt/1.9.2 (2017-12-15) |
On Fri, Apr 20, 2018 at 02:34:54PM +0200, David Hildenbrand wrote:
> On the qmp level, we already have the concept of memory devices:
> "query-memory-devices"
> Right now, we only support NVDIMM and PCDIMM.
>
> We want to map other devices later into the address space of the guest.
> Such device could e.g. be virtio devices. These devices will have a
> guest memory range assigned but won't be exposed via e.g. ACPI. We want
> to make them look like memory device, but not glued to pc-dimm.
>
> Especially, it will not always be possible to have TYPE_PC_DIMM as a parent
> class (e.g. virtio devices). Let's use an interface instead. As a first
> part, convert handling of
> - qmp_pc_dimm_device_list
> - get_plugged_memory_size
> to our new model. plug/unplug stuff etc. will follow later.
>
> A memory device will have to provide the following functions:
> - get_addr(): Necessary, as the property "addr" can e.g. not be used for
> virtio devices (already defined).
> - get_plugged_size(): The amount this device offers to the guest as of
> now.
> - get_region_size(): Because this can later on be bigger than the
> plugged size.
> - fill_device_info(): Fill MemoryDeviceInfo, e.g. for qmp.
>
> Signed-off-by: David Hildenbrand <address@hidden>
Reviewed-by: David Gibson <address@hidden>
with the exception of some tiny nits..
[snip]
> +static gint memory_device_addr_sort(gconstpointer a, gconstpointer b)
> +{
> + MemoryDeviceState *md_a = MEMORY_DEVICE(a);
> + MemoryDeviceState *md_b = MEMORY_DEVICE(b);
These probably should be const MemoryDeviceState *.
> + MemoryDeviceClass *mdc_a = MEMORY_DEVICE_GET_CLASS(a);
> + MemoryDeviceClass *mdc_b = MEMORY_DEVICE_GET_CLASS(b);
> + const uint64_t addr_a = mdc_a->get_addr(md_a);
> + const uint64_t addr_b = mdc_b->get_addr(md_b);
> +
> + if (addr_a > addr_b) {
> + return 1;
> + } else if (addr_a < addr_b) {
> + return -1;
> + }
> + return 0;
> +}
> +
> +static int memory_device_built_list(Object *obj, void *opaque)
s/built/build/ will read a bit more clearly I think.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
[qemu-s390x] [PATCH v3 1/3] pc-dimm: factor out MemoryDevice interface, David Hildenbrand, 2018/04/20
- Re: [qemu-s390x] [PATCH v3 1/3] pc-dimm: factor out MemoryDevice interface,
David Gibson <=
Re: [qemu-s390x] [Qemu-devel] [PATCH v3 1/3] pc-dimm: factor out MemoryDevice interface, Pankaj Gupta, 2018/04/22
[qemu-s390x] [PATCH v3 3/3] pc-dimm: factor out address space logic into MemoryDevice code, David Hildenbrand, 2018/04/20