[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GIT PULL 03/18] softmmu/physmem: Fixup qemu_ram_block_from_host() docum
From: |
David Hildenbrand |
Subject: |
[GIT PULL 03/18] softmmu/physmem: Fixup qemu_ram_block_from_host() documentation |
Date: |
Thu, 12 Oct 2023 16:36:40 +0200 |
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.
Message-ID: <20230926185738.277351-4-david@redhat.com>
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>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/exec/cpu-common.h | 15 +++++++++++++++
system/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 605b160a7e..30c376a4de 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -83,6 +83,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/system/physmem.c b/system/physmem.c
index edc3ed8ab9..fc2b0fee01 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -2221,23 +2221,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
- [GIT PULL 00/18] Host Memory Backends and Memory devices queue 2023-10-12, David Hildenbrand, 2023/10/12
- [GIT PULL 07/18] stubs: Rename qmp_memory_device.c to memory_device.c, David Hildenbrand, 2023/10/12
- [GIT PULL 03/18] softmmu/physmem: Fixup qemu_ram_block_from_host() documentation,
David Hildenbrand <=
- [GIT PULL 05/18] vhost: Return number of free memslots, David Hildenbrand, 2023/10/12
- [GIT PULL 06/18] memory-device: Support memory devices with multiple memslots, David Hildenbrand, 2023/10/12
- [GIT PULL 08/18] memory-device: Track required and actually used memslots in DeviceMemoryState, David Hildenbrand, 2023/10/12
- [GIT PULL 09/18] memory-device, vhost: Support memory devices that dynamically consume memslots, David Hildenbrand, 2023/10/12
- [GIT PULL 11/18] vhost: Add vhost_get_max_memslots(), David Hildenbrand, 2023/10/12
- [GIT PULL 02/18] vhost: Remove vhost_backend_can_merge() callback, David Hildenbrand, 2023/10/12
- [GIT PULL 01/18] vhost: Rework memslot filtering and fix "used_memslot" tracking, David Hildenbrand, 2023/10/12
- [GIT PULL 15/18] virtio-mem: Update state to match bitmap as soon as it's been migrated, David Hildenbrand, 2023/10/12
- [GIT PULL 14/18] virtio-mem: Pass non-const VirtIOMEM via virtio_mem_range_cb, David Hildenbrand, 2023/10/12
- [GIT PULL 04/18] kvm: Return number of free memslots, David Hildenbrand, 2023/10/12