All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: Alexander Bulekov <alxndr@bu.edu>
Subject: [PULL 09/31] memory: Add FlatView foreach function
Date: Mon, 26 Oct 2020 11:06:10 +0100	[thread overview]
Message-ID: <20201026100632.212530-10-thuth@redhat.com> (raw)
In-Reply-To: <20201026100632.212530-1-thuth@redhat.com>

From: Alexander Bulekov <alxndr@bu.edu>

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201023150746.107063-2-alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/exec/memory.h |  5 +++++
 softmmu/memory.c      | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 622207bde1..042918dd16 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -719,6 +719,11 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as)
     return qatomic_rcu_read(&as->current_map);
 }
 
+typedef int (*flatview_cb)(Int128 start,
+                           Int128 len,
+                           const MemoryRegion*, void*);
+
+void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque);
 
 /**
  * struct MemoryRegionSection: describes a fragment of a #MemoryRegion
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 403ff3abc9..a5d1641820 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -656,6 +656,19 @@ static void render_memory_region(FlatView *view,
     }
 }
 
+void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque)
+{
+    FlatRange *fr;
+
+    assert(fv);
+    assert(cb);
+
+    FOR_EACH_FLAT_RANGE(fr, fv) {
+        if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque))
+            break;
+    }
+}
+
 static MemoryRegion *memory_region_get_flatview_root(MemoryRegion *mr)
 {
     while (mr->enabled) {
-- 
2.18.2



  parent reply	other threads:[~2020-10-26 10:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 10:06 [PULL 00/31] qtests and gitlab-CI/acceptance patches Thomas Huth
2020-10-26 10:06 ` [PULL 01/31] tests/migration: fix memleak in wait_command/wait_command_fd Thomas Huth
2020-10-26 10:06 ` [PULL 02/31] tests/qtest/libqtest: Fix detection of architecture for binaries without path Thomas Huth
2020-10-26 10:06 ` [PULL 03/31] accel: Remove _WIN32 ifdef from qtest-cpus.c Thomas Huth
2020-10-26 10:06 ` [PULL 04/31] accel: move qtest CpusAccel functions to a common location Thomas Huth
2020-10-26 10:06 ` [PULL 05/31] accel: Add xen CpusAccel using dummy-cpus Thomas Huth
2020-10-26 10:06 ` [PULL 06/31] tests/qtest: Make npcm7xx_timer-test conditional on CONFIG_NPCM7XX Thomas Huth
2020-10-26 10:06 ` [PULL 07/31] libqtest: fix the order of buffered events Thomas Huth
2020-10-26 10:06 ` [PULL 08/31] libqtest: fix memory leak in the qtest_qmp_event_ref Thomas Huth
2020-10-26 10:06 ` Thomas Huth [this message]
2020-10-26 10:06 ` [PULL 10/31] fuzz: Add generic virtual-device fuzzer Thomas Huth
2020-10-26 10:06 ` [PULL 11/31] fuzz: Add PCI features to the generic fuzzer Thomas Huth
2020-10-26 10:06 ` [PULL 12/31] fuzz: Add DMA support to the generic-fuzzer Thomas Huth
2020-10-26 10:06 ` [PULL 13/31] fuzz: Declare DMA Read callback function Thomas Huth
2020-10-26 10:06 ` [PULL 14/31] fuzz: Add fuzzer callbacks to DMA-read functions Thomas Huth
2020-10-26 10:06 ` [PULL 15/31] fuzz: Add support for custom crossover functions Thomas Huth
2020-10-26 10:06 ` [PULL 16/31] fuzz: add a DISABLE_PCI op to generic-fuzzer Thomas Huth
2020-10-26 10:06 ` [PULL 17/31] fuzz: add a crossover function " Thomas Huth
2020-10-26 10:06 ` [PULL 18/31] scripts/oss-fuzz: Add script to reorder a generic-fuzzer trace Thomas Huth
2020-10-26 10:06 ` [PULL 19/31] scripts/oss-fuzz: Add crash trace minimization script Thomas Huth
2020-10-26 10:06 ` [PULL 20/31] fuzz: Add instructions for using generic-fuzz Thomas Huth
2020-10-26 10:06 ` [PULL 21/31] fuzz: add an "opaque" to the FuzzTarget struct Thomas Huth
2020-10-26 10:06 ` [PULL 22/31] fuzz: add generic-fuzz configs for oss-fuzz Thomas Huth
2020-10-26 10:06 ` [PULL 23/31] fuzz: register predefined generic-fuzz configs Thomas Huth
2020-10-26 10:06 ` [PULL 24/31] scripts/oss-fuzz: use hardlinks instead of copying Thomas Huth
2020-10-26 10:06 ` [PULL 25/31] scripts/oss-fuzz: ignore the generic-fuzz target Thomas Huth
2020-10-26 10:06 ` [PULL 26/31] tests/acceptance/ppc_prep_40p: Fix the URL to the NetBSD-4.0 archive Thomas Huth
2020-10-26 10:06 ` [PULL 27/31] test/acceptance: Remove the CONTINUOUS_INTEGRATION tags Thomas Huth
2020-10-26 10:06 ` [PULL 28/31] tests/acceptance: Enable AVOCADO_ALLOW_UNTRUSTED_CODE in the gitlab-CI Thomas Huth
2020-10-26 10:06 ` [PULL 29/31] test/docker/dockerfiles: Add missing packages for acceptance tests Thomas Huth
2020-10-26 10:06 ` [PULL 30/31] tests/acceptance: Remove unused import Thomas Huth
2020-10-26 10:06 ` [PULL 31/31] tests/acceptance: Use .ppm extention for Portable PixMap files Thomas Huth
2020-10-26 14:49 ` [PULL 00/31] qtests and gitlab-CI/acceptance patches Peter Maydell

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=20201026100632.212530-10-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=alxndr@bu.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.