All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
To: kbusch@kernel.org, kwolf@redhat.com, mreitz@redhat.com
Cc: pbonzini@redhat.com,
	Andrzej Jakowski <andrzej.jakowski@linux.intel.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: [PATCH v5 1/3] memory: export memory_region_to_absolute_addr() function
Date: Thu, 23 Jul 2020 09:03:23 -0700	[thread overview]
Message-ID: <20200723160325.41734-2-andrzej.jakowski@linux.intel.com> (raw)
In-Reply-To: <20200723160325.41734-1-andrzej.jakowski@linux.intel.com>

This change exports memory_region_to_absolute_addr() function so it can
be used by drivers requiring to calculate absolute address for memory
subregions when memory hierarchy is used.

Signed-off-by: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
---
 include/exec/memory.h | 9 +++++++++
 softmmu/memory.c      | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 307e527835..6e5bba602e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2017,6 +2017,15 @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,
                                          MemOp op,
                                          MemTxAttrs attrs);
 
+/**
+ * memory_region_to_absolute_addr: walk through memory hierarchy to retrieve
+ * absolute address for given MemoryRegion.
+ *
+ * @mr: #MemoryRegion to scan through
+ * @offset: starting offset within mr
+ */
+hwaddr memory_region_to_absolute_addr(MemoryRegion *mr, hwaddr offset);
+
 /**
  * address_space_init: initializes an address space
  *
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 9200b20130..deff3739ff 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -399,7 +399,7 @@ static inline uint64_t memory_region_shift_write_access(uint64_t *value,
     return tmp;
 }
 
-static hwaddr memory_region_to_absolute_addr(MemoryRegion *mr, hwaddr offset)
+hwaddr memory_region_to_absolute_addr(MemoryRegion *mr, hwaddr offset)
 {
     MemoryRegion *root;
     hwaddr abs_addr = offset;
-- 
2.21.1



  reply	other threads:[~2020-07-23 16:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 16:03 [PATCH v5] nvme: allow cmb and pmr emulation on same device Andrzej Jakowski
2020-07-23 16:03 ` Andrzej Jakowski [this message]
2020-07-23 16:03 ` [PATCH v5 2/3] nvme: indicate CMB support through controller capabilities register Andrzej Jakowski
2020-07-23 16:03 ` [PATCH v5 3/3] nvme: allow cmb and pmr to be enabled on same device Andrzej Jakowski
2020-07-27  9:06   ` Klaus Jensen
2020-07-27 18:59     ` Andrzej Jakowski
2020-07-29 20:17       ` Klaus Jensen

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=20200723160325.41734-2-andrzej.jakowski@linux.intel.com \
    --to=andrzej.jakowski@linux.intel.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.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.