From: Fabiano Rosas <farosas@suse.de>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
peterx@redhat.com
Cc: qemu-devel@nongnu.org, vsementsov@yandex-team.ru,
Peter Maydell <peter.maydell@linaro.org>,
"open list:ARM TCG CPUs" <qemu-arm@nongnu.org>
Subject: Re: [PATCH 27/30] arm/machine: move to new migration APIs
Date: Thu, 03 Sep 2026 14:15:41 -0300 [thread overview]
Message-ID: <87jyp28ddu.fsf@suse.de> (raw)
In-Reply-To: <20260825213811.3725682-28-vsementsov@yandex-team.ru>
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> target/arm/machine.c | 107 ++++++++++++++++++++++---------------------
> 1 file changed, 56 insertions(+), 51 deletions(-)
>
> diff --git a/target/arm/machine.c b/target/arm/machine.c
> index 89127e5d83c..159a1f0e930 100644
> --- a/target/arm/machine.c
> +++ b/target/arm/machine.c
> @@ -51,8 +51,8 @@ static bool vfp_fpcr_fpsr_needed(void *opaque)
> (vfp_get_fpsr(env) & ~FPSCR_FPSR_MASK);
> }
>
> -static int get_fpscr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field)
> +static bool load_fpscr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> @@ -62,78 +62,81 @@ static int get_fpscr(QEMUFile *f, void *opaque, size_t size,
> /* 0 means we might have the data in the fpcr_fpsr subsection */
> vfp_set_fpscr(env, val);
> }
> - return 0;
> + return true;
> }
>
> -static int put_fpscr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field, JSONWriter *vmdesc)
> +static bool save_fpscr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field,
> + JSONWriter *vmdesc, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> uint32_t fpscr = vfp_fpcr_fpsr_needed(opaque) ? 0 : vfp_get_fpscr(env);
>
> qemu_put_be32(f, fpscr);
> - return 0;
> + return true;
> }
>
> static const VMStateInfo vmstate_fpscr = {
> .name = "fpscr",
> - .get = get_fpscr,
> - .put = put_fpscr,
> + .load = load_fpscr,
> + .save = save_fpscr,
> };
>
> -static int get_fpcr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field)
> +static bool load_fpcr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> uint64_t val = qemu_get_be64(f);
>
> vfp_set_fpcr(env, val);
> - return 0;
> + return true;
> }
>
> -static int put_fpcr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field, JSONWriter *vmdesc)
> +static bool save_fpcr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field,
> + JSONWriter *vmdesc, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
>
> qemu_put_be64(f, vfp_get_fpcr(env));
> - return 0;
> + return true;
> }
>
> static const VMStateInfo vmstate_fpcr = {
> .name = "fpcr",
> - .get = get_fpcr,
> - .put = put_fpcr,
> + .load = load_fpcr,
> + .save = save_fpcr,
> };
>
> -static int get_fpsr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field)
> +static bool load_fpsr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> uint64_t val = qemu_get_be64(f);
>
> vfp_set_fpsr(env, val);
> - return 0;
> + return true;
> }
>
> -static int put_fpsr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field, JSONWriter *vmdesc)
> +static bool save_fpsr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field,
> + JSONWriter *vmdesc, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
>
> qemu_put_be64(f, vfp_get_fpsr(env));
> - return 0;
> + return true;
> }
>
> static const VMStateInfo vmstate_fpsr = {
> .name = "fpsr",
> - .get = get_fpsr,
> - .put = put_fpsr,
> + .load = load_fpsr,
> + .save = save_fpsr,
> };
>
> static const VMStateDescription vmstate_vfp_fpcr_fpsr = {
> @@ -755,8 +758,8 @@ static const VMStateDescription vmstate_m_security = {
> }
> };
>
> -static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field)
> +static bool load_cpsr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> @@ -797,22 +800,22 @@ static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
> }
> /* Ignore the low bits, they are handled by vmstate_m. */
> xpsr_write(env, val, ~XPSR_EXCP);
> - return 0;
> + return true;
> }
>
> env->aarch64 = ((val & PSTATE_nRW) == 0);
>
> if (is_a64(env)) {
> pstate_write(env, val);
> - return 0;
> + return true;
> }
>
> cpsr_write(env, val, 0xffffffff, CPSRWriteRaw);
> - return 0;
> + return true;
> }
>
> -static int put_cpsr(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field, JSONWriter *vmdesc)
> +static bool save_cpsr(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, JSONWriter *vmdesc, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> @@ -828,17 +831,17 @@ static int put_cpsr(QEMUFile *f, void *opaque, size_t size,
> }
>
> qemu_put_be32(f, val);
> - return 0;
> + return true;
> }
>
> static const VMStateInfo vmstate_cpsr = {
> .name = "cpsr",
> - .get = get_cpsr,
> - .put = put_cpsr,
> + .load = load_cpsr,
> + .save = save_cpsr,
> };
>
> -static int get_pstate64(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field)
> +static bool load_pstate64(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> @@ -850,11 +853,12 @@ static int get_pstate64(QEMUFile *f, void *opaque, size_t size,
> } else {
> cpsr_write_from_spsr_elx(env, val);
> }
> - return 0;
> + return true;
> }
>
> -static int put_pstate64(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field, JSONWriter *vmdesc)
> +static bool save_pstate64(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field,
> + JSONWriter *vmdesc, Error **errp)
> {
> ARMCPU *cpu = opaque;
> CPUARMState *env = &cpu->env;
> @@ -866,7 +870,7 @@ static int put_pstate64(QEMUFile *f, void *opaque, size_t size,
> val = cpsr_read_for_spsr_elx(env);
> }
> qemu_put_be64(f, val);
> - return 0;
> + return true;
> }
>
> static bool pstate64_needed(void *opaque)
> @@ -901,8 +905,8 @@ static const VMStateDescription vmstate_pstate64 = {
> .size = sizeof(uint64_t),
> .info = &(const VMStateInfo) {
> .name = "pstate64",
> - .get = get_pstate64,
> - .put = put_pstate64,
> + .load = load_pstate64,
> + .save = save_pstate64,
> },
> .flags = VMS_SINGLE,
> .offset = 0,
> @@ -911,17 +915,17 @@ static const VMStateDescription vmstate_pstate64 = {
> },
> };
>
> -static int get_power(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field)
> +static bool load_power(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, Error **errp)
> {
> ARMCPU *cpu = opaque;
> bool powered_off = qemu_get_byte(f);
> arm_set_cpu_power_state(cpu, powered_off ? PSCI_OFF : PSCI_ON);
> - return 0;
> + return true;
> }
>
> -static int put_power(QEMUFile *f, void *opaque, size_t size,
> - const VMStateField *field, JSONWriter *vmdesc)
> +static bool save_power(QEMUFile *f, void *opaque, size_t size,
> + const VMStateField *field, JSONWriter *vmdesc, Error **errp)
> {
> ARMCPU *cpu = opaque;
>
> @@ -931,16 +935,17 @@ static int put_power(QEMUFile *f, void *opaque, size_t size,
> cpu->power_state == PSCI_OFF) {
> bool powered_off = (cpu->power_state == PSCI_OFF) ? true : false;
> qemu_put_byte(f, powered_off);
> - return 0;
> + return true;
> } else {
> - return 1;
> + error_setg(errp, "Migration should not happen during power transition");
> + return false;
> }
> }
>
> static const VMStateInfo vmstate_powered_off = {
> .name = "powered_off",
> - .get = get_power,
> - .put = put_power,
> + .load = load_power,
> + .save = save_power,
> };
>
> static bool syndrome64_needed(void *opaque)
../target/arm/machine.c: In function ‘save_power’:
../target/arm/machine.c:940:9: error: implicit declaration of function ‘error_setg’ [-Wimplicit-function-declaration]
940 | error_setg(errp, "Migration should not happen during power transition");
| ^~~~~~~~~~
../target/arm/machine.c:940:9: error: nested extern declaration of ‘error_setg’ [-Werror=nested-externs]
next prev parent reply other threads:[~2026-09-03 17:17 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 21:37 [PATCH 00/30] move to new migration APIs Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 01/30] tests/unit/test-vmstate: " Vladimir Sementsov-Ogievskiy
2026-08-29 5:55 ` Akihiko Odaki
2026-09-03 17:12 ` Fabiano Rosas
2026-08-25 21:37 ` [PATCH 02/30] ui/vdagent: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 03/30] hw/virtio: extra state: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 04/30] hw/virtio: config save/load: " Vladimir Sementsov-Ogievskiy
2026-09-03 17:41 ` Fabiano Rosas
2026-09-04 21:01 ` Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 05/30] hw/virtio: make virtio_save() and virtio_load() static Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 06/30] hw/virtio: remaining: move to new migration APIs Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 07/30] hw/s390x/virtio-ccw.c: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 08/30] hw/scsi/spapr_vscsi: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 09/30] hw/scsi/scsi-bus.c: use " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 10/30] hw/vfio/pci: move to " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 11/30] hw/pci/pci: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 12/30] hw/pci/msix.c: use " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 13/30] hw/pci/shpc.c: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 14/30] hw/display/virtio-gpu: move to " Vladimir Sementsov-Ogievskiy
2026-08-29 6:54 ` Akihiko Odaki
2026-08-29 19:30 ` Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 15/30] hw/net/virtio-net.c: use " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 16/30] hw/nvram/eeprom93xx.c: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 17/30] hw/nvram/fw_cfg.c: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 18/30] hw/usb/redirect.c: move to " Vladimir Sementsov-Ogievskiy
2026-08-25 21:37 ` [PATCH 19/30] alpha/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 20/30] avr/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 21/30] or1k/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 22/30] microblaze/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 23/30] hppa/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 24/30] sparc/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 25/30] ppc/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 26/30] mips/machine: " Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 27/30] arm/machine: " Vladimir Sementsov-Ogievskiy
2026-09-03 17:15 ` Fabiano Rosas [this message]
2026-08-25 21:38 ` [PATCH 28/30] migration/vmstate-types: convert vmstate_info_g_byte_array to new APIs Vladimir Sementsov-Ogievskiy
2026-09-03 17:41 ` Fabiano Rosas
2026-08-25 21:38 ` [PATCH 29/30] migration: VMStateInfo: remove old .get / .set handlers Vladimir Sementsov-Ogievskiy
2026-08-25 21:38 ` [PATCH 30/30] migration: finally drop vmstate_save/load_state() functions Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jyp28ddu.fsf@suse.de \
--to=farosas@suse.de \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.