[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/33] softmmu/physmem: Remove HOST_PAGE_ALIGN
From: |
Richard Henderson |
Subject: |
[PATCH 14/33] softmmu/physmem: Remove HOST_PAGE_ALIGN |
Date: |
Fri, 18 Aug 2023 10:12:08 -0700 |
Align allocation sizes to the maximum of host and target page sizes.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
softmmu/physmem.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 6881b2d8f8..9eff0acb2f 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1663,7 +1663,8 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize,
Error **errp)
assert(block);
- newsize = HOST_PAGE_ALIGN(newsize);
+ newsize = TARGET_PAGE_ALIGN(newsize);
+ newsize = REAL_HOST_PAGE_ALIGN(newsize);
if (block->used_length == newsize) {
/*
@@ -1898,7 +1899,9 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size,
MemoryRegion *mr,
return NULL;
}
- size = HOST_PAGE_ALIGN(size);
+ size = TARGET_PAGE_ALIGN(size);
+ size = REAL_HOST_PAGE_ALIGN(size);
+
file_size = get_file_size(fd);
if (file_size > offset && file_size < (offset + size)) {
error_setg(errp, "backing store size 0x%" PRIx64
@@ -1976,13 +1979,17 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size,
ram_addr_t max_size,
{
RAMBlock *new_block;
Error *local_err = NULL;
+ int align;
assert((ram_flags & ~(RAM_SHARED | RAM_RESIZEABLE | RAM_PREALLOC |
RAM_NORESERVE)) == 0);
assert(!host ^ (ram_flags & RAM_PREALLOC));
- size = HOST_PAGE_ALIGN(size);
- max_size = HOST_PAGE_ALIGN(max_size);
+ align = qemu_real_host_page_size();
+ align = MAX(align, TARGET_PAGE_SIZE);
+ size = ROUND_UP(size, align);
+ max_size = ROUND_UP(max_size, align);
+
new_block = g_malloc0(sizeof(*new_block));
new_block->mr = mr;
new_block->resized = resized;
--
2.34.1
- [PATCH 05/33] linux-user/hppa: Simplify init_guest_commpage, (continued)
- [PATCH 05/33] linux-user/hppa: Simplify init_guest_commpage, Richard Henderson, 2023/08/18
- [PATCH 06/33] linux-user/nios2: Remove qemu_host_page_size from init_guest_commpage, Richard Henderson, 2023/08/18
- [PATCH 07/33] linux-user/arm: Remove qemu_host_page_size from init_guest_commpage, Richard Henderson, 2023/08/18
- [PATCH 08/33] linux-user: Remove qemu_host_page_{size, mask} from mmap.c, Richard Henderson, 2023/08/18
- [PATCH 09/33] linux-user: Remove REAL_HOST_PAGE_ALIGN from mmap.c, Richard Henderson, 2023/08/18
- [PATCH 10/33] linux-user: Remove HOST_PAGE_ALIGN from mmap.c, Richard Henderson, 2023/08/18
- [PATCH 11/33] migration: Remove qemu_host_page_size, Richard Henderson, 2023/08/18
- [PATCH 12/33] hw/tpm: Remove HOST_PAGE_ALIGN from tpm_ppi_init, Richard Henderson, 2023/08/18
- [PATCH 13/33] softmmu/physmem: Remove qemu_host_page_size, Richard Henderson, 2023/08/18
- [PATCH 14/33] softmmu/physmem: Remove HOST_PAGE_ALIGN,
Richard Henderson <=
- [PATCH 15/33] linux-user: Remove qemu_host_page_size from main, Richard Henderson, 2023/08/18
- [PATCH 17/33] linux-user: Move some mmap checks outside the lock, Richard Henderson, 2023/08/18
- [PATCH 16/33] linux-user: Split out target_mmap__locked, Richard Henderson, 2023/08/18
- [PATCH 18/33] linux-user: Fix sub-host-page mmap, Richard Henderson, 2023/08/18
- [PATCH 20/33] linux-user: Do early mmap placement only for reserved_va, Richard Henderson, 2023/08/18
- [PATCH 21/33] linux-user: Split out mmap_h_eq_g, Richard Henderson, 2023/08/18
- [PATCH 19/33] linux-user: Split out mmap_end, Richard Henderson, 2023/08/18