@samitouri / QOSamiQemu / commits / 79674d07d4

page-vary: Build set_preferred_target_page_bits as common code

Use target_info->page_bits_vary to merge set_preferred_target_page_bits_common into set_preferred_target_page_bits in page-vary-common.c. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260217095106.598486-5-richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Richard Henderson committed Feb 17, 2026 at 19:51 UTC 79674d07d40919dabd37c2fc1f542f791b9c3162
3 files changed +18 -22
include/exec/page-vary.h
-1
@@ -41,7 +41,6 @@ typedef struct {
41 } TargetPageBits;
42
43 #ifdef IN_PAGE_VARY
44 -bool set_preferred_target_page_bits_common(int bits);
44 void finalize_target_page_bits_common(int min);
45 #endif
46
page-vary-common.c
+18 -11
@@ -20,25 +20,32 @@
20 #define IN_PAGE_VARY 1
21
22 #include "qemu/osdep.h"
23 +#include "qemu/target-info-impl.h"
24 #include "exec/page-vary.h"
25
26 /* WARNING: This file must *not* be complied with -flto. */
27
28 TargetPageBits target_page;
29
29 -bool set_preferred_target_page_bits_common(int bits)
30 +bool set_preferred_target_page_bits(int bits)
31 {
31 - /*
32 - * The target page size is the lowest common denominator for all
33 - * the CPUs in the system, so we can only make it smaller, never
34 - * larger. And we can't make it smaller once we've committed to
35 - * a particular size.
36 - */
37 - if (target_page.bits == 0 || target_page.bits > bits) {
38 - if (target_page.decided) {
39 - return false;
32 + const TargetInfo *ti = target_info();
33 +
34 + assert(bits >= TARGET_PAGE_BITS_MIN);
35 + if (ti->page_bits_vary) {
36 +
37 + /*
38 + * The target page size is the lowest common denominator for all
39 + * the CPUs in the system, so we can only make it smaller, never
40 + * larger. And we can't make it smaller once we've committed to
41 + * a particular size.
42 + */
43 + if (target_page.bits == 0 || target_page.bits > bits) {
44 + if (target_page.decided) {
45 + return false;
46 + }
47 + target_page.bits = bits;
48 }
41 - target_page.bits = bits;
49 }
50 return true;
51 }
page-vary-target.c
-10
@@ -39,16 +39,6 @@ int migration_legacy_page_bits(void)
39 }
40 #endif
41
42 -bool set_preferred_target_page_bits(int bits)
43 -{
44 - assert(bits >= TARGET_PAGE_BITS_MIN);
45 -#ifdef TARGET_PAGE_BITS_VARY
46 - return set_preferred_target_page_bits_common(bits);
47 -#else
48 - return true;
49 -#endif
50 -}
51 -
42 void finalize_target_page_bits(void)
43 {
44 #ifndef TARGET_PAGE_BITS_VARY