Browse Source

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>
master
Richard Henderson 1 month ago
committed by Philippe Mathieu-Daudé
parent
commit
eb52c6d769
  1. 4
      include/exec/page-vary.h
  2. 15
      page-vary-common.c
  3. 12
      page-vary-target.c

4
include/exec/page-vary.h

@ -40,10 +40,6 @@ typedef struct {
uint64_t mask;
} TargetPageBits;
#ifdef IN_PAGE_VARY
void finalize_target_page_bits_common(int min);
#endif
/**
* set_preferred_target_page_bits:
* @bits: number of bits needed to represent an address within the page

15
page-vary-common.c

@ -50,11 +50,18 @@ bool set_preferred_target_page_bits(int bits)
return true;
}
void finalize_target_page_bits_common(int min)
void finalize_target_page_bits(void)
{
if (target_page.bits == 0) {
target_page.bits = min;
int bits = target_page.bits;
if (bits == 0) {
const TargetInfo *ti = target_info();
bits = ti->page_bits_init;
assert(bits != 0);
target_page.bits = bits;
}
target_page.mask = -1ull << target_page.bits;
target_page.mask = -1ull << bits;
target_page.decided = true;
}

12
page-vary-target.c

@ -38,15 +38,3 @@ int migration_legacy_page_bits(void)
#endif
}
#endif
void finalize_target_page_bits(void)
{
#ifndef TARGET_PAGE_BITS_VARY
finalize_target_page_bits_common(TARGET_PAGE_BITS);
#elif defined(CONFIG_USER_ONLY)
assert(target_page.bits != 0);
finalize_target_page_bits_common(target_page.bits);
#else
finalize_target_page_bits_common(TARGET_PAGE_BITS_LEGACY);
#endif
}

Loading…
Cancel
Save