From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, afaerber@suse.de, peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH memory v3 4/9] memory: Coreify subregion add functionality
Date: Sun, 1 Jun 2014 21:16:16 -0700 [thread overview]
Message-ID: <eeaad5dd19d33a39095901ebc54d430150c3846b.1401681566.git.peter.crosthwaite@xilinx.com> (raw)
In-Reply-To: <cover.1401681566.git.peter.crosthwaite@xilinx.com>
Split off the core looping code that actually adds subregions into
it's own fn. This prepares support for Memory Region qomification
where setting the MR address or parent via QOM will back onto this more
minimal function.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
memory.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/memory.c b/memory.c
index 1352881..dd0a576 100644
--- a/memory.c
+++ b/memory.c
@@ -1410,18 +1410,15 @@ void memory_region_del_eventfd(MemoryRegion *mr,
memory_region_transaction_commit();
}
-static void memory_region_add_subregion_common(MemoryRegion *mr,
- hwaddr offset,
- MemoryRegion *subregion)
+static void do_memory_region_add_subregion_common(MemoryRegion *subregion)
{
+ hwaddr offset = subregion->addr;
+ MemoryRegion *mr = subregion->parent;
MemoryRegion *other;
memory_region_transaction_begin();
- assert(!subregion->parent);
memory_region_ref(subregion);
- subregion->parent = mr;
- subregion->addr = offset;
QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {
if (subregion->may_overlap || other->may_overlap) {
continue;
@@ -1455,6 +1452,15 @@ done:
memory_region_transaction_commit();
}
+static void memory_region_add_subregion_common(MemoryRegion *mr,
+ hwaddr offset,
+ MemoryRegion *subregion)
+{
+ assert(!subregion->parent);
+ subregion->parent = mr;
+ subregion->addr = offset;
+ do_memory_region_add_subregion_common(subregion);
+}
void memory_region_add_subregion(MemoryRegion *mr,
hwaddr offset,
--
2.0.0
next prev parent reply other threads:[~2014-06-02 4:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 4:13 [Qemu-devel] [PATCH memory v3 0/9] Memory Region QOMification Peter Crosthwaite
2014-06-02 4:14 ` [Qemu-devel] [PATCH memory v3 1/9] memory: Simplify mr_add_subregion() if-else Peter Crosthwaite
2014-06-02 4:15 ` [Qemu-devel] [PATCH memory v3 2/9] qom: object: Ignore refs/unrefs of NULL Peter Crosthwaite
2014-06-02 4:15 ` [Qemu-devel] [PATCH memory v3 3/9] qom: Publish object_resolve_link Peter Crosthwaite
2014-06-02 4:16 ` Peter Crosthwaite [this message]
2014-06-02 4:16 ` [Qemu-devel] [PATCH memory v3 5/9] memory: MemoryRegion: factor out memory region re-adder Peter Crosthwaite
2014-06-02 4:17 ` [Qemu-devel] [PATCH memory v3 6/9] memory: MemoryRegion: QOMify Peter Crosthwaite
2014-06-02 12:18 ` Peter Maydell
2014-06-02 22:39 ` Peter Crosthwaite
2014-06-02 4:17 ` [Qemu-devel] [PATCH memory v3 7/9] memory: MemoryRegion: Add container and addr props Peter Crosthwaite
2014-06-02 4:18 ` [Qemu-devel] [PATCH memory v3 8/9] memory: MemoryRegion: Add may-overlap and priority props Peter Crosthwaite
2014-06-02 4:19 ` [Qemu-devel] [PATCH memory v3 9/9] memory: MemoryRegion: Add size property Peter Crosthwaite
2014-06-02 14:26 ` [Qemu-devel] [PATCH memory v3 0/9] Memory Region QOMification Peter Maydell
2014-06-02 22:37 ` Peter Crosthwaite
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=eeaad5dd19d33a39095901ebc54d430150c3846b.1401681566.git.peter.crosthwaite@xilinx.com \
--to=peter.crosthwaite@xilinx.com \
--cc=afaerber@suse.de \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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).