summaryrefslogtreecommitdiffstats
path: root/accel
diff options
context:
space:
mode:
authorRichard Henderson2022-09-17 14:25:12 +0200
committerRichard Henderson2022-10-26 03:11:28 +0200
commit50d4c8c1d433ae843a6b86a65467c507095f65f1 (patch)
tree6c5fe4a6b10dc82d545a62523d5620c4b72b7adc /accel
parentinclude/qemu/thread: Use qatomic_* functions (diff)
downloadqemu-50d4c8c1d433ae843a6b86a65467c507095f65f1.tar.gz
qemu-50d4c8c1d433ae843a6b86a65467c507095f65f1.tar.xz
qemu-50d4c8c1d433ae843a6b86a65467c507095f65f1.zip
accel/tcg: Make page_alloc_target_data allocation constant
Use a constant target data allocation size for all pages. This will be necessary to reduce overhead of page tracking. Since TARGET_PAGE_DATA_SIZE is now required, we can use this to omit data tracking for targets that don't require it. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/translate-all.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 4ed75a13e1..64a2601f9f 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -2271,6 +2271,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
void page_reset_target_data(target_ulong start, target_ulong end)
{
+#ifdef TARGET_PAGE_DATA_SIZE
target_ulong addr, len;
/*
@@ -2293,15 +2294,17 @@ void page_reset_target_data(target_ulong start, target_ulong end)
g_free(p->target_data);
p->target_data = NULL;
}
+#endif
}
+#ifdef TARGET_PAGE_DATA_SIZE
void *page_get_target_data(target_ulong address)
{
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
return p ? p->target_data : NULL;
}
-void *page_alloc_target_data(target_ulong address, size_t size)
+void *page_alloc_target_data(target_ulong address)
{
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
void *ret = NULL;
@@ -2309,11 +2312,12 @@ void *page_alloc_target_data(target_ulong address, size_t size)
if (p->flags & PAGE_VALID) {
ret = p->target_data;
if (!ret) {
- p->target_data = ret = g_malloc0(size);
+ p->target_data = ret = g_malloc0(TARGET_PAGE_DATA_SIZE);
}
}
return ret;
}
+#endif /* TARGET_PAGE_DATA_SIZE */
int page_check_range(target_ulong start, target_ulong len, int flags)
{