From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: "David Hildenbrand" <david@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Xiao Guangrong" <xiaoguangrong.eric@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Michal Privoznik" <mprivozn@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Gavin Shan" <gshan@redhat.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Maciej S . Szmigiero" <mail@maciej.szmigiero.name>,
kvm@vger.kernel.org
Subject: [PATCH v2 03/16] softmmu/physmem: Fixup qemu_ram_block_from_host() documentation
Date: Fri, 25 Aug 2023 15:21:36 +0200 [thread overview]
Message-ID: <20230825132149.366064-4-david@redhat.com> (raw)
In-Reply-To: <20230825132149.366064-1-david@redhat.com>
Let's fixup the documentation (e.g., removing traces of the ram_addr
parameter that no longer exists) and move it to the header file while at
it.
Suggested-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/exec/cpu-common.h | 15 +++++++++++++++
softmmu/physmem.c | 17 -----------------
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 87dc9a752c..cc491a4bf4 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -76,6 +76,21 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
ram_addr_t qemu_ram_addr_from_host(void *ptr);
ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr);
RAMBlock *qemu_ram_block_by_name(const char *name);
+
+/*
+ * Translates a host ptr back to a RAMBlock and an offset in that RAMBlock.
+ *
+ * @ptr: The host pointer to translate.
+ * @round_offset: Whether to round the result offset down to a target page
+ * @offset: Will be set to the offset within the returned RAMBlock.
+ *
+ * Returns: RAMBlock (or NULL if not found)
+ *
+ * By the time this function returns, the returned pointer is not protected
+ * by RCU anymore. If the caller is not within an RCU critical section and
+ * does not hold the iothread lock, it must have other means of protecting the
+ * pointer, such as a reference to the memory region that owns the RAMBlock.
+ */
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
ram_addr_t *offset);
ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host);
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 3df73542e1..57469b3c97 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2181,23 +2181,6 @@ ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host)
return res;
}
-/*
- * Translates a host ptr back to a RAMBlock, a ram_addr and an offset
- * in that RAMBlock.
- *
- * ptr: Host pointer to look up
- * round_offset: If true round the result offset down to a page boundary
- * *ram_addr: set to result ram_addr
- * *offset: set to result offset within the RAMBlock
- *
- * Returns: RAMBlock (or NULL if not found)
- *
- * By the time this function returns, the returned pointer is not protected
- * by RCU anymore. If the caller is not within an RCU critical section and
- * does not hold the iothread lock, it must have other means of protecting the
- * pointer, such as a reference to the region that includes the incoming
- * ram_addr_t.
- */
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
ram_addr_t *offset)
{
--
2.41.0
next prev parent reply other threads:[~2023-08-25 13:24 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 13:21 [PATCH v2 00/16] virtio-mem: Expose device memory through multiple memslots David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 01/16] vhost: Rework memslot filtering and fix "used_memslot" tracking David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 02/16] vhost: Remove vhost_backend_can_merge() callback David Hildenbrand
2023-08-25 13:21 ` David Hildenbrand [this message]
2023-08-25 13:21 ` [PATCH v2 04/16] kvm: Return number of free memslots David Hildenbrand
2023-08-28 22:26 ` Philippe Mathieu-Daudé
2023-09-06 14:14 ` David Hildenbrand
2023-09-06 14:37 ` David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 05/16] vhost: " David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 06/16] memory-device: Support memory devices with multiple memslots David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 07/16] stubs: Rename qmp_memory_device.c to memory_device.c David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 08/16] memory-device: Track required and actually used memslots in DeviceMemoryState David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 09/16] memory-device, vhost: Support memory devices that dynamically consume memslots David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 10/16] kvm: Add stub for kvm_get_max_memslots() David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 11/16] vhost: Add vhost_get_max_memslots() David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 12/16] memory-device, vhost: Support automatic decision on the number of memslots David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 13/16] memory: Clarify mapping requirements for RamDiscardManager David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 14/16] virtio-mem: Expose device memory via multiple memslots if enabled David Hildenbrand
2023-08-25 13:21 ` [PATCH v2 15/16] memory, vhost: Allow for marking memory device memory regions unmergeable David Hildenbrand
2023-08-28 22:43 ` [PATCH v2 15/16] memory,vhost: " Philippe Mathieu-Daudé
2023-08-25 13:21 ` [PATCH v2 16/16] virtio-mem: Mark memslot alias " David Hildenbrand
2023-08-28 22:44 ` Philippe Mathieu-Daudé
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=20230825132149.366064-4-david@redhat.com \
--to=david@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=gshan@redhat.com \
--cc=imammedo@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=marcel.apfelbaum@gmail.com \
--cc=mprivozn@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=wangyanan55@huawei.com \
--cc=xiaoguangrong.eric@gmail.com \
/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).