From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>,
Markus Armbruster <armbru@redhat.com>,
qemu-ppc@nongnu.org, Pankaj Gupta <pagupta@redhat.com>,
Alexander Graf <agraf@suse.de>,
David Hildenbrand <david@redhat.com>
Subject: [Qemu-devel] [PATCH v1 5/8] pc-dimm: implement new memory device functions
Date: Thu, 3 May 2018 17:49:33 +0200 [thread overview]
Message-ID: <20180503154936.18946-6-david@redhat.com> (raw)
In-Reply-To: <20180503154936.18946-1-david@redhat.com>
Implement the new functions, we don't have to care about alignment for
these DIMMs right now, so leave that function unimplemented.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
hw/mem/pc-dimm.c | 22 ++++++++++++++++++++++
include/hw/mem/memory-device.h | 4 ++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 12da89d562..7ab9e77747 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -244,6 +244,26 @@ 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)
+{
+ PCDIMMDevice *dimm = PC_DIMM(md);
+
+ dimm->addr = addr;
+}
+
+static MemoryRegion *pc_dimm_md_get_memory_region(MemoryDeviceState *md)
+{
+ PCDIMMDevice *dimm = PC_DIMM(md);
+
+ const PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(md);
+ MemoryRegion *mr;
+
+ mr = ddc->get_memory_region(dimm, &error_abort);
+ g_assert(mr);
+
+ return mr;
+}
+
static uint64_t pc_dimm_md_get_region_size(const MemoryDeviceState *md)
{
/* dropping const here is fine as we don't touch the memory region */
@@ -304,6 +324,8 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
ddc->get_vmstate_memory_region = pc_dimm_get_vmstate_memory_region;
mdc->get_addr = pc_dimm_md_get_addr;
+ mdc->set_addr = pc_dimm_md_set_addr;
+ mdc->get_memory_region = pc_dimm_md_get_memory_region;
/* for a dimm plugged_size == region_size */
mdc->get_plugged_size = pc_dimm_md_get_region_size;
mdc->get_region_size = pc_dimm_md_get_region_size;
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index e43ce1c8d3..e10f2e854a 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -34,8 +34,8 @@ typedef struct MemoryDeviceClass {
/* required functions that have to be implemented */
uint64_t (*get_addr)(const MemoryDeviceState *md);
- uint64_t (*set_addr)(MemoryDeviceState *md);
- MemoryRegion * (*get_memory_region)(MemoryDeviceState *md);
+ void (*set_addr)(MemoryDeviceState *md, uint64_t addr);
+ MemoryRegion *(*get_memory_region)(MemoryDeviceState *md);
uint64_t (*get_plugged_size)(const MemoryDeviceState *md);
uint64_t (*get_region_size)(const MemoryDeviceState *md);
void (*fill_device_info)(const MemoryDeviceState *md,
--
2.14.3
next prev parent reply other threads:[~2018-05-03 15:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 15:49 [Qemu-devel] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler David Hildenbrand
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 1/8] memory-device: always compile support for memory devices for SOFTMMU David Hildenbrand
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 2/8] qdev: introduce ResourceHandler as a first-stage hotplug handler David Hildenbrand
2018-05-04 14:22 ` David Hildenbrand
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 3/8] machine: provide default resource handler David Hildenbrand
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 4/8] memory-device: new functions to handle resource assignment David Hildenbrand
2018-05-03 15:49 ` David Hildenbrand [this message]
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 6/8] machine: introduce enforce_memory_device_align() and add it for pc David Hildenbrand
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 7/8] memory-device: factor out pre-assign into default resource handler David Hildenbrand
2018-05-03 15:49 ` [Qemu-devel] [PATCH v1 8/8] memory-device: factor out (un)assign " David Hildenbrand
2018-05-04 8:49 ` [Qemu-devel] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler Igor Mammedov
2018-05-04 9:19 ` David Hildenbrand
2018-05-04 10:00 ` Igor Mammedov
2018-05-04 11:49 ` David Hildenbrand
2018-05-09 14:13 ` David Hildenbrand
2018-05-10 13:02 ` Igor Mammedov
2018-05-10 13:20 ` David Hildenbrand
2018-05-10 13:32 ` Igor Mammedov
2018-05-11 7:41 ` David Hildenbrand
2018-05-10 13:04 ` [Qemu-devel] [PATCH] qdev: let machine hotplug handler to override bus hotplug handler Igor Mammedov
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=20180503154936.18946-6-david@redhat.com \
--to=david@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pagupta@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
/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).