From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Mark Cave-Ayland" <mark.caveayland@nutanix.com>
Subject: [PATCH v3 10/13] physmem: Move TCG IOTLB methods around
Date: Thu, 24 Apr 2025 22:24:09 +0200 [thread overview]
Message-ID: <20250424202412.91612-11-philmd@linaro.org> (raw)
In-Reply-To: <20250424202412.91612-1-philmd@linaro.org>
The next commit will restrict TCG specific code in physmem.c
using some #ifdef'ry. In order to keep it simple, move
iotlb_to_section() and memory_region_section_get_iotlb()
around close together.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
system/physmem.c | 50 ++++++++++++++++++++++++------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/system/physmem.c b/system/physmem.c
index 637f2d85324..ccbeae241c4 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -746,6 +746,31 @@ translate_fail:
return &d->map.sections[PHYS_SECTION_UNASSIGNED];
}
+MemoryRegionSection *iotlb_to_section(CPUState *cpu,
+ hwaddr index, MemTxAttrs attrs)
+{
+ int asidx = cpu_asidx_from_attrs(cpu, attrs);
+ CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
+ AddressSpaceDispatch *d = cpuas->memory_dispatch;
+ int section_index = index & ~TARGET_PAGE_MASK;
+ MemoryRegionSection *ret;
+
+ assert(section_index < d->map.sections_nb);
+ ret = d->map.sections + section_index;
+ assert(ret->mr);
+ assert(ret->mr->ops);
+
+ return ret;
+}
+
+/* Called from RCU critical section */
+hwaddr memory_region_section_get_iotlb(CPUState *cpu,
+ MemoryRegionSection *section)
+{
+ AddressSpaceDispatch *d = flatview_to_dispatch(section->fv);
+ return section - d->map.sections;
+}
+
void cpu_address_space_init(CPUState *cpu, int asidx,
const char *prefix, MemoryRegion *mr)
{
@@ -1002,14 +1027,6 @@ bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap,
return false;
}
-/* Called from RCU critical section */
-hwaddr memory_region_section_get_iotlb(CPUState *cpu,
- MemoryRegionSection *section)
-{
- AddressSpaceDispatch *d = flatview_to_dispatch(section->fv);
- return section - d->map.sections;
-}
-
static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,
uint16_t section);
static subpage_t *subpage_init(FlatView *fv, hwaddr base);
@@ -2669,23 +2686,6 @@ static uint16_t dummy_section(PhysPageMap *map, FlatView *fv, MemoryRegion *mr)
return phys_section_add(map, §ion);
}
-MemoryRegionSection *iotlb_to_section(CPUState *cpu,
- hwaddr index, MemTxAttrs attrs)
-{
- int asidx = cpu_asidx_from_attrs(cpu, attrs);
- CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
- AddressSpaceDispatch *d = cpuas->memory_dispatch;
- int section_index = index & ~TARGET_PAGE_MASK;
- MemoryRegionSection *ret;
-
- assert(section_index < d->map.sections_nb);
- ret = d->map.sections + section_index;
- assert(ret->mr);
- assert(ret->mr->ops);
-
- return ret;
-}
-
static void io_mem_init(void)
{
memory_region_init_io(&io_mem_unassigned, NULL, &unassigned_mem_ops, NULL,
--
2.47.1
next prev parent reply other threads:[~2025-04-24 20:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 20:23 [PATCH v3 00/13] include: Remove "exec/exec-all.h" Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 01/13] accel/tcg: Use vaddr for walk_memory_regions callback Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 02/13] accel/tcg: Use vaddr in user/page-protection.h Philippe Mathieu-Daudé
2025-04-28 18:32 ` Anton Johansson via
2025-04-24 20:24 ` [PATCH v3 03/13] accel/tcg: Correct list of included headers in tcg-stub.c Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 04/13] include/exec: Include missing headers in exec-all.h Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 05/13] include/exec: Move tb_invalidate_phys_range to translation-block.h Philippe Mathieu-Daudé
2025-04-28 18:33 ` Anton Johansson via
2025-04-24 20:24 ` [PATCH v3 06/13] accel/tcg: Compile tb-maint.c twice Philippe Mathieu-Daudé
2025-04-28 18:38 ` Anton Johansson via
2025-04-24 20:24 ` [PATCH v3 07/13] target/riscv: Include missing 'accel/tcg/getpc.h' in csr.c Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 08/13] target/hexagon: Include missing 'accel/tcg/getpc.h' Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 09/13] accel/tcg: Include 'accel/tcg/getpc.h' in 'exec/helper-proto' Philippe Mathieu-Daudé
2025-04-28 18:27 ` Anton Johansson via
2025-04-28 20:13 ` Richard Henderson
2025-04-24 20:24 ` Philippe Mathieu-Daudé [this message]
2025-04-24 20:24 ` [PATCH v3 11/13] physmem: Restrict TCG IOTLB code to TCG accel Philippe Mathieu-Daudé
2025-04-28 18:51 ` Anton Johansson via
2025-04-28 20:13 ` Richard Henderson
2025-04-28 20:52 ` Anton Johansson via
2025-04-24 20:24 ` [PATCH v3 12/13] accel/tcg: Extract probe API out of 'exec/exec-all.h' Philippe Mathieu-Daudé
2025-04-24 20:24 ` [PATCH v3 13/13] include: Remove 'exec/exec-all.h' Philippe Mathieu-Daudé
2025-04-28 20:12 ` [PATCH v3 00/13] include: Remove "exec/exec-all.h" Richard Henderson
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=20250424202412.91612-11-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=mark.caveayland@nutanix.com \
--cc=pbonzini@redhat.com \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).