page-vary: Build finalize_target_page_bits as common code
Use target_info->page_bits_init to merge finalize_target_page_bits_common into finalize_target_page_bits in page-vary-common.c. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-ID: <20260217095106.598486-6-richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Richard Henderson committed
Feb 17, 2026 at 19:51 UTC
eb52c6d7698824e877a19293706c77ce7b523120
3 files changed
+11
-20
include/exec/page-vary.h
-4
@@ -40,10 +40,6 @@ typedef struct {
40
uint64_t mask;
41
} TargetPageBits;
42
43
-#ifdef IN_PAGE_VARY
44
-void finalize_target_page_bits_common(int min);
45
-#endif
46
-
43
/**
44
* set_preferred_target_page_bits:
45
* @bits: number of bits needed to represent an address within the page
page-vary-common.c
+11
-4
@@ -50,11 +50,18 @@ bool set_preferred_target_page_bits(int bits)
50
return true;
51
}
52
53
-void finalize_target_page_bits_common(int min)
53
+void finalize_target_page_bits(void)
54
{
55
- if (target_page.bits == 0) {
56
- target_page.bits = min;
55
+ int bits = target_page.bits;
56
+
57
+ if (bits == 0) {
58
+ const TargetInfo *ti = target_info();
59
+
60
+ bits = ti->page_bits_init;
61
+ assert(bits != 0);
62
+ target_page.bits = bits;
63
}
58
- target_page.mask = -1ull << target_page.bits;
64
+
65
+ target_page.mask = -1ull << bits;
66
target_page.decided = true;
67
}
page-vary-target.c
-12
@@ -38,15 +38,3 @@ int migration_legacy_page_bits(void)
38
#endif
39
}
40
#endif
41
-
42
-void finalize_target_page_bits(void)
43
-{
44
-#ifndef TARGET_PAGE_BITS_VARY
45
- finalize_target_page_bits_common(TARGET_PAGE_BITS);
46
-#elif defined(CONFIG_USER_ONLY)
47
- assert(target_page.bits != 0);
48
- finalize_target_page_bits_common(target_page.bits);
49
-#else
50
- finalize_target_page_bits_common(TARGET_PAGE_BITS_LEGACY);
51
-#endif
52
-}