Message ID | 20250328200459.483089-9-richard.henderson@linaro.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | single-binary: Restrict scope of TARGET_PAGE_BITS_MIN | expand |
On 3/28/25 13:04, Richard Henderson wrote: > Rename to migration_legacy_page_bits, to make it clear that > we cannot change the value without causing a migration break. > Move to page-vary.h and page-vary-target.c. > Define via TARGET_PAGE_BITS if not TARGET_PAGE_BITS_VARY. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > include/exec/page-vary.h | 9 +++++++++ > include/exec/target_page.h | 1 - > migration/savevm.c | 6 +++--- > page-target.c | 5 ----- > page-vary-target.c | 9 +++++++++ > 5 files changed, 21 insertions(+), 9 deletions(-) > > diff --git a/include/exec/page-vary.h b/include/exec/page-vary.h > index 54ddde308a..101c25911c 100644 > --- a/include/exec/page-vary.h > +++ b/include/exec/page-vary.h > @@ -49,4 +49,13 @@ bool set_preferred_target_page_bits(int bits); > */ > void finalize_target_page_bits(void); > > +/** > + * migration_legacy_page_bits > + * > + * For migration compatibility with qemu v2.9, prior to the introduction > + * of the configuration/target-page-bits section, return the value of > + * TARGET_PAGE_BITS that the target had then. > + */ > +int migration_legacy_page_bits(void); > + > #endif /* EXEC_PAGE_VARY_H */ > diff --git a/include/exec/target_page.h b/include/exec/target_page.h > index 8e89e5cbe6..e4bd7f7767 100644 > --- a/include/exec/target_page.h > +++ b/include/exec/target_page.h > @@ -63,7 +63,6 @@ static inline int qemu_target_page_bits(void) > return TARGET_PAGE_BITS; > } > > -int qemu_target_page_bits_min(void); > size_t qemu_target_pages_to_MiB(size_t pages); > > #endif > diff --git a/migration/savevm.c b/migration/savevm.c > index c33200a33f..0c12e373b4 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -50,6 +50,7 @@ > #include "system/cpus.h" > #include "system/memory.h" > #include "exec/target_page.h" > +#include "exec/page-vary.h" > #include "trace.h" > #include "qemu/iov.h" > #include "qemu/job.h" > @@ -339,7 +340,7 @@ static int configuration_pre_load(void *opaque) > * predates the variable-target-page-bits support and is using the > * minimum possible value for this CPU. > */ > - state->target_page_bits = qemu_target_page_bits_min(); > + state->target_page_bits = migration_legacy_page_bits(); > return 0; > } > > @@ -462,8 +463,7 @@ static const VMStateInfo vmstate_info_capability = { > */ > static bool vmstate_target_page_bits_needed(void *opaque) > { > - return qemu_target_page_bits() > - > qemu_target_page_bits_min(); > + return qemu_target_page_bits() > migration_legacy_page_bits(); > } > > static const VMStateDescription vmstate_target_page_bits = { > diff --git a/page-target.c b/page-target.c > index 321e43d06f..8fcd5443b5 100644 > --- a/page-target.c > +++ b/page-target.c > @@ -9,11 +9,6 @@ > #include "qemu/osdep.h" > #include "exec/target_page.h" > > -int qemu_target_page_bits_min(void) > -{ > - return TARGET_PAGE_BITS_MIN; > -} > - > /* Convert target pages to MiB (2**20). */ > size_t qemu_target_pages_to_MiB(size_t pages) > { > diff --git a/page-vary-target.c b/page-vary-target.c > index 84ddeb7c26..6251d948cf 100644 > --- a/page-vary-target.c > +++ b/page-vary-target.c > @@ -23,6 +23,15 @@ > #include "exec/page-vary.h" > #include "exec/target_page.h" > > +int migration_legacy_page_bits(void) > +{ > +#ifdef TARGET_PAGE_BITS_VARY > + return TARGET_PAGE_BITS_MIN; > +#else > + return TARGET_PAGE_BITS; > +#endif > +} > + > bool set_preferred_target_page_bits(int bits) > { > #ifdef TARGET_PAGE_BITS_VARY Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff --git a/include/exec/page-vary.h b/include/exec/page-vary.h index 54ddde308a..101c25911c 100644 --- a/include/exec/page-vary.h +++ b/include/exec/page-vary.h @@ -49,4 +49,13 @@ bool set_preferred_target_page_bits(int bits); */ void finalize_target_page_bits(void); +/** + * migration_legacy_page_bits + * + * For migration compatibility with qemu v2.9, prior to the introduction + * of the configuration/target-page-bits section, return the value of + * TARGET_PAGE_BITS that the target had then. + */ +int migration_legacy_page_bits(void); + #endif /* EXEC_PAGE_VARY_H */ diff --git a/include/exec/target_page.h b/include/exec/target_page.h index 8e89e5cbe6..e4bd7f7767 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -63,7 +63,6 @@ static inline int qemu_target_page_bits(void) return TARGET_PAGE_BITS; } -int qemu_target_page_bits_min(void); size_t qemu_target_pages_to_MiB(size_t pages); #endif diff --git a/migration/savevm.c b/migration/savevm.c index c33200a33f..0c12e373b4 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -50,6 +50,7 @@ #include "system/cpus.h" #include "system/memory.h" #include "exec/target_page.h" +#include "exec/page-vary.h" #include "trace.h" #include "qemu/iov.h" #include "qemu/job.h" @@ -339,7 +340,7 @@ static int configuration_pre_load(void *opaque) * predates the variable-target-page-bits support and is using the * minimum possible value for this CPU. */ - state->target_page_bits = qemu_target_page_bits_min(); + state->target_page_bits = migration_legacy_page_bits(); return 0; } @@ -462,8 +463,7 @@ static const VMStateInfo vmstate_info_capability = { */ static bool vmstate_target_page_bits_needed(void *opaque) { - return qemu_target_page_bits() - > qemu_target_page_bits_min(); + return qemu_target_page_bits() > migration_legacy_page_bits(); } static const VMStateDescription vmstate_target_page_bits = { diff --git a/page-target.c b/page-target.c index 321e43d06f..8fcd5443b5 100644 --- a/page-target.c +++ b/page-target.c @@ -9,11 +9,6 @@ #include "qemu/osdep.h" #include "exec/target_page.h" -int qemu_target_page_bits_min(void) -{ - return TARGET_PAGE_BITS_MIN; -} - /* Convert target pages to MiB (2**20). */ size_t qemu_target_pages_to_MiB(size_t pages) { diff --git a/page-vary-target.c b/page-vary-target.c index 84ddeb7c26..6251d948cf 100644 --- a/page-vary-target.c +++ b/page-vary-target.c @@ -23,6 +23,15 @@ #include "exec/page-vary.h" #include "exec/target_page.h" +int migration_legacy_page_bits(void) +{ +#ifdef TARGET_PAGE_BITS_VARY + return TARGET_PAGE_BITS_MIN; +#else + return TARGET_PAGE_BITS; +#endif +} + bool set_preferred_target_page_bits(int bits) { #ifdef TARGET_PAGE_BITS_VARY
Rename to migration_legacy_page_bits, to make it clear that we cannot change the value without causing a migration break. Move to page-vary.h and page-vary-target.c. Define via TARGET_PAGE_BITS if not TARGET_PAGE_BITS_VARY. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- include/exec/page-vary.h | 9 +++++++++ include/exec/target_page.h | 1 - migration/savevm.c | 6 +++--- page-target.c | 5 ----- page-vary-target.c | 9 +++++++++ 5 files changed, 21 insertions(+), 9 deletions(-)