exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
cover exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
Simple patch while trying to figure out Fuloong-2E 16KB page size. Better safe than sorry =)
Philippe Mathieu-Daudé (2):
MAINTAINERS: Cover exec-vary.c (variable page size)
exec: Ensure variable page size is only used with
TARGET_PAGE_BITS_VARY
include/qemu-common.h | 4 +++- exec-vary.c | 4 +++- MAINTAINERS | 1 + 3 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 MAINTAINERS: Cover exec-vary.c (variable page size)
Add exec-vary.c to the 'Overall TCG CPUs' section.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -117,6 +117,7 @@ R: Paolo Bonzini <[email protected]> S: Maintained F: softmmu/cpus.c F: cpus-common.c +F: exec-vary.c F: accel/tcg/ F: accel/stubs/tcg-stub.c F: scripts/decodetree.py
Signature · 1 line
2.26.2
PATCH 2/2 exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
In reply to Philippe Mathieu-DaudéIf TARGET_PAGE_BITS_VARY is not supported, machines should not intent to modify the target page size.
As set_preferred_target_page_bits() is supposed to return 'false' on failure (documented in "qemu-common.h"), return false to indicate failure if this ever happens.
--- include/qemu-common.h | 4 +++- exec-vary.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
include/qemu-common.h +3 -1
@@ -70,7 +70,9 @@ void cpu_exec_step_atomic(CPUState *cpu);* size may be smaller than any given CPU's preference). * Returns true on success, false on failure (which can only happen * if this is called after the system has already finalized its -* choice of page size and the requested page size is smaller than that). +* choice of page size and the requested page size is smaller than +* that). Only target supporting variable page size should set a +* preferred target page size. */ bool set_preferred_target_page_bits (int bits);
exec-vary.c +3 -1
@@ -86,8 +86,10 @@ bool set_preferred_target_page_bits(int bits) } init_target_page.bits = bits; } -#endif return true; +#else +return false; +#endif }void finalize_target_page_bits (void )
Signature · 1 line
2.26.2
Quoted 32 lines · Philippe Mathieu-Daudé
If
TARGET_PAGE_BITS_VARYis not supported, machines should not intent to modify the target page size.
Asset_preferred_target_page_bits()is supposed to return 'false' on failure (documented in "qemu-common.h"), return false to indicate failure if this ever happens.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/qemu-common.h | 4 +++- exec-vary.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)include/qemu-common.h +3
-1@@ -70,7 +70,9 @@ void cpu_exec_step_atomic(CPUState *cpu);* size may be smaller than any given CPU's preference). * Returns true on success, false on failure (which can only happen * if this is called after the system has already finalized its -* choice of page size and the requested page size is smaller than that). +* choice of page size and the requested page size is smaller than +* that). Only target supporting variable page size should set a +* preferred target page size. */ bool set_preferred_target_page_bits (int bits);exec-vary.c +0
-0
exec-vary.c bool set_preferred_target_page_bits(int bits) · line 92
Quoted 8 lines
exec-vary.c +3
-1@@ -86,8 +86,10 @@ bool set_preferred_target_page_bits(int bits) } init_target_page.bits = bits; } -#endif return true; +#else +return false; +#endif
I guess the only generic caller is the one in softmmu/vl.c, which is protected by machine_class->minimum_page_bits != 0. So this affects exactly one machine outside arm -- fuloong2e.
Certainly we should not allow an impossible setting. I wonder if it is worth doing return bits == TARGET_PAGE_BITS?
Either way,
r~
ping?
Quoted 13 lines · Philippe Mathieu-Daudé
Simple patch while trying to figure out Fuloong-2E 16KB page size. Better safe than sorry =)
Philippe Mathieu-Daudé (2):
MAINTAINERS: Coverexec-vary.c(variable page size)
exec: Ensure variable page size is only used with
TARGET_PAGE_BITS_VARYinclude/qemu-common.h | 4 +++- exec-vary.c | 4 +++- MAINTAINERS | 1 + 3 files changed, 7 insertions(+), 2 deletions(-)