Skip to content

Commit aa90f11

Browse files
committed
Merge tag 'migration-20250314-pull-request' of https://gitlab.com/farosas/qemu into staging
Migration pull request Fixes for cpr-transfer (live update functionality). # -----BEGIN PGP SIGNATURE----- # # iQJEBAABCAAuFiEEqhtIsKIjJqWkw2TPx5jcdBvsMZ0FAmfUQEYQHGZhcm9zYXNA # c3VzZS5kZQAKCRDHmNx0G+wxne24D/9iwMQyOuD+F3MYvX9tSmqD7KAxTsUOT1yk # +jD6/b05FwuAqTQVFLOyIg3bowYuScdgDY6LOHf8T/+NtO9xe305RDE+q8ZXVA16 # ldOPHc1Fvm7c79ShohAJIebec7h6UaWQ390kpbAyIXFRW8gZjvYe64hDAsRQLNQy # ykkD+5G5dBWU4pOJh5w9Q+C3yIM3IMwyPcP3zJsmrDyAs20B/BrnC0kIaq90rAyS # qYWIk1ttPrOckeOLK4bPM/bGNvIJWxzdBLgFqhRfTotfdSCj0YCDNhqN5JHKjQvY # 6bPzqr1BVOql4TpuwykYpUFWONQLeFasTfJxckls8s0qifkUWYRpQXT7+gWYrdHt # 3NId+0XG1Vq8gAXbEoQXCozsq0LAW9REryTQBCTZIJ1n8hwWuXLLUB1k9e2f1mXq # SyKrko2CADvWAQKz1Nl7MQc73vuHI/rK8W+JHlhT1KHfMPeXM06K+bBU2w4kQLhn # t8wfv5l1z4nH4Jmn4f5kmhbAzEfSny1FQXxGWwfamgw85FCYdmsJ0JTX0nosLIYf # 5ntOeJp2KnILtbSyd3c44jE1u/eSlw5Yb05SWjiUwFpDKo/1LBi61deJtbxoG6rE # pJauuOEM/X9GpAU1drlT9G0scwLRKGZBJ1FbOU43bMUbEF2fQiPi4pGeW428Ol4y # ggk8QixbGg== # =w3AQ # -----END PGP SIGNATURE----- # gpg: Signature made Fri 14 Mar 2025 10:42:14 EDT # gpg: using RSA key AA1B48B0A22326A5A4C364CFC798DC741BEC319D # gpg: issuer "[email protected]" # gpg: Good signature from "Fabiano Rosas <[email protected]>" [unknown] # gpg: aka "Fabiano Almeida Rosas <[email protected]>" [unknown] # gpg: WARNING: The key's User ID is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: AA1B 48B0 A223 26A5 A4C3 64CF C798 DC74 1BEC 319D * tag 'migration-20250314-pull-request' of https://gitlab.com/farosas/qemu: hw/qxl: fix cpr hw/loader: fix roms during cpr pflash: fix cpr migration: cpr_is_incoming Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents 5719376 + 8ffe062 commit aa90f11

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

hw/block/block.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "system/blockdev.h"
1313
#include "system/block-backend.h"
1414
#include "hw/block/block.h"
15+
#include "migration/cpr.h"
1516
#include "qapi/error.h"
1617
#include "qapi/qapi-types-block.h"
1718

@@ -66,6 +67,10 @@ bool blk_check_size_and_read_all(BlockBackend *blk, DeviceState *dev,
6667
int ret;
6768
g_autofree char *dev_id = NULL;
6869

70+
if (cpr_is_incoming()) {
71+
return true;
72+
}
73+
6974
blk_len = blk_getlength(blk);
7075
if (blk_len < 0) {
7176
error_setg_errno(errp, -blk_len,

hw/core/loader.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "trace.h"
5252
#include "hw/hw.h"
5353
#include "disas/disas.h"
54+
#include "migration/cpr.h"
5455
#include "migration/vmstate.h"
5556
#include "monitor/monitor.h"
5657
#include "system/reset.h"
@@ -1029,7 +1030,9 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name, bool ro)
10291030
vmstate_register_ram_global(rom->mr);
10301031

10311032
data = memory_region_get_ram_ptr(rom->mr);
1032-
memcpy(data, rom->data, rom->datasize);
1033+
if (!cpr_is_incoming()) {
1034+
memcpy(data, rom->data, rom->datasize);
1035+
}
10331036

10341037
return data;
10351038
}

hw/display/qxl.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "qemu/module.h"
3131
#include "hw/qdev-properties.h"
3232
#include "system/runstate.h"
33+
#include "migration/cpr.h"
3334
#include "migration/vmstate.h"
3435
#include "trace.h"
3536

@@ -333,6 +334,10 @@ static void init_qxl_rom(PCIQXLDevice *d)
333334
uint32_t fb;
334335
int i, n;
335336

337+
if (cpr_is_incoming()) {
338+
goto skip_init;
339+
}
340+
336341
memset(rom, 0, d->rom_size);
337342

338343
rom->magic = cpu_to_le32(QXL_ROM_MAGIC);
@@ -390,6 +395,7 @@ static void init_qxl_rom(PCIQXLDevice *d)
390395
sizeof(rom->client_monitors_config));
391396
}
392397

398+
skip_init:
393399
d->shadow_rom = *rom;
394400
d->rom = rom;
395401
d->modes = modes;
@@ -403,6 +409,9 @@ static void init_qxl_ram(PCIQXLDevice *d)
403409

404410
buf = d->vga.vram_ptr;
405411
d->ram = (QXLRam *)(buf + le32_to_cpu(d->shadow_rom.ram_header_offset));
412+
if (cpr_is_incoming()) {
413+
return;
414+
}
406415
d->ram->magic = cpu_to_le32(QXL_RAM_MAGIC);
407416
d->ram->int_pending = cpu_to_le32(0);
408417
d->ram->int_mask = cpu_to_le32(0);
@@ -539,6 +548,10 @@ static void interface_set_compression_level(QXLInstance *sin, int level)
539548

540549
trace_qxl_interface_set_compression_level(qxl->id, level);
541550
qxl->shadow_rom.compression_level = cpu_to_le32(level);
551+
if (cpr_is_incoming()) {
552+
assert(qxl->rom->compression_level == cpu_to_le32(level));
553+
return;
554+
}
542555
qxl->rom->compression_level = cpu_to_le32(level);
543556
qxl_rom_set_dirty(qxl);
544557
}
@@ -997,7 +1010,8 @@ static void interface_set_client_capabilities(QXLInstance *sin,
9971010
}
9981011

9991012
if (runstate_check(RUN_STATE_INMIGRATE) ||
1000-
runstate_check(RUN_STATE_POSTMIGRATE)) {
1013+
runstate_check(RUN_STATE_POSTMIGRATE) ||
1014+
cpr_is_incoming()) {
10011015
return;
10021016
}
10031017

@@ -1200,6 +1214,10 @@ static void qxl_reset_state(PCIQXLDevice *d)
12001214
{
12011215
QXLRom *rom = d->rom;
12021216

1217+
if (cpr_is_incoming()) {
1218+
return;
1219+
}
1220+
12031221
qxl_check_state(d);
12041222
d->shadow_rom.update_id = cpu_to_le32(0);
12051223
*rom = d->shadow_rom;
@@ -1370,8 +1388,11 @@ static int qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta,
13701388
memslot.virt_start = virt_start + (guest_start - pci_start);
13711389
memslot.virt_end = virt_start + (guest_end - pci_start);
13721390
memslot.addr_delta = memslot.virt_start - delta;
1373-
memslot.generation = d->rom->slot_generation = 0;
1374-
qxl_rom_set_dirty(d);
1391+
if (!cpr_is_incoming()) {
1392+
d->rom->slot_generation = 0;
1393+
qxl_rom_set_dirty(d);
1394+
}
1395+
memslot.generation = d->rom->slot_generation;
13751396

13761397
qemu_spice_add_memslot(&d->ssd, &memslot, async);
13771398
d->guest_slots[slot_id].mr = mr;

include/migration/cpr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ int cpr_find_fd(const char *name, int id);
2121

2222
MigMode cpr_get_incoming_mode(void);
2323
void cpr_set_incoming_mode(MigMode mode);
24+
bool cpr_is_incoming(void);
2425

2526
int cpr_state_save(MigrationChannel *channel, Error **errp);
2627
int cpr_state_load(MigrationChannel *channel, Error **errp);

migration/cpr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ void cpr_set_incoming_mode(MigMode mode)
128128
incoming_mode = mode;
129129
}
130130

131+
bool cpr_is_incoming(void)
132+
{
133+
return incoming_mode != MIG_MODE_NONE;
134+
}
135+
131136
int cpr_state_save(MigrationChannel *channel, Error **errp)
132137
{
133138
int ret;

0 commit comments

Comments
 (0)