Merge tag 'migration-20231201-pull-request' of https://github.com/xzpeter/qemu into staging
Migration patches for rc3:
- One more memleak regression fix from Het
# -----BEGIN PGP SIGNATURE-----
#
# iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCZWoLbRIccGV0ZXJ4QHJl
# ZGhhdC5jb20ACgkQO1/MzfOr1wahYwD+OsD7CaZYjkl9KSooRfblEenD6SdfhAdC
# oZc07f2UxocA/0s1keDBZUUcZOiGYPDFV5his4Jw4F+RRD1YIpVWZg4J
# =T0/r
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 01 Dec 2023 11:35:57 EST
# gpg: using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706
# gpg: issuer "peterx@redhat.com"
# gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [full]
# gpg: aka "Peter Xu <peterx@redhat.com>" [full]
# Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D D1A9 3B5F CCCD F3AB D706
* tag 'migration-20231201-pull-request' of https://github.com/xzpeter/qemu:
migration: Plug memory leak with migration URIs
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c
index 992a55e..ddfa094 100644
--- a/hw/ppc/amigaone.c
+++ b/hw/ppc/amigaone.c
@@ -36,10 +36,19 @@
* -device VGA,romfile=VGABIOS-lgpl-latest.bin
* from http://www.nongnu.org/vgabios/ instead.
*/
-#define PROM_FILENAME "u-boot-amigaone.bin"
#define PROM_ADDR 0xfff00000
#define PROM_SIZE (512 * KiB)
+/* AmigaOS calls this routine from ROM, use this if no firmware loaded */
+static const char dummy_fw[] = {
+ 0x38, 0x00, 0x00, 0x08, /* li r0,8 */
+ 0x7c, 0x09, 0x03, 0xa6, /* mtctr r0 */
+ 0x54, 0x63, 0xf8, 0x7e, /* srwi r3,r3,1 */
+ 0x42, 0x00, 0xff, 0xfc, /* bdnz 0x8 */
+ 0x7c, 0x63, 0x18, 0xf8, /* not r3,r3 */
+ 0x4e, 0x80, 0x00, 0x20, /* blr */
+};
+
static void amigaone_cpu_reset(void *opaque)
{
PowerPCCPU *cpu = opaque;
@@ -60,8 +69,6 @@
PowerPCCPU *cpu;
CPUPPCState *env;
MemoryRegion *rom, *pci_mem, *mr;
- const char *fwname = machine->firmware ?: PROM_FILENAME;
- char *filename;
ssize_t sz;
PCIBus *pci_bus;
Object *via;
@@ -94,20 +101,24 @@
}
/* allocate and load firmware */
- filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, fwname);
- if (filename) {
- rom = g_new(MemoryRegion, 1);
- memory_region_init_rom(rom, NULL, "rom", PROM_SIZE, &error_fatal);
- memory_region_add_subregion(get_system_memory(), PROM_ADDR, rom);
+ rom = g_new(MemoryRegion, 1);
+ memory_region_init_rom(rom, NULL, "rom", PROM_SIZE, &error_fatal);
+ memory_region_add_subregion(get_system_memory(), PROM_ADDR, rom);
+ if (!machine->firmware) {
+ rom_add_blob_fixed("dummy-fw", dummy_fw, sizeof(dummy_fw),
+ PROM_ADDR + PROM_SIZE - 0x80);
+ } else {
+ g_autofree char *filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
+ machine->firmware);
+ if (!filename) {
+ error_report("Could not find firmware '%s'", machine->firmware);
+ exit(1);
+ }
sz = load_image_targphys(filename, PROM_ADDR, PROM_SIZE);
if (sz <= 0 || sz > PROM_SIZE) {
error_report("Could not load firmware '%s'", filename);
exit(1);
}
- g_free(filename);
- } else if (!qtest_enabled()) {
- error_report("Could not find firmware '%s'", fwname);
- exit(1);
}
/* Articia S */
diff --git a/migration/migration.c b/migration/migration.c
index 34340f3..3ce04b2 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -462,7 +462,6 @@
{
g_autoptr(MigrationChannel) val = g_new0(MigrationChannel, 1);
g_autoptr(MigrationAddress) addr = g_new0(MigrationAddress, 1);
- SocketAddress *saddr = NULL;
InetSocketAddress *isock = &addr->u.rdma;
strList **tail = &addr->u.exec.args;
@@ -487,12 +486,14 @@
strstart(uri, "vsock:", NULL) ||
strstart(uri, "fd:", NULL)) {
addr->transport = MIGRATION_ADDRESS_TYPE_SOCKET;
- saddr = socket_parse(uri, errp);
+ SocketAddress *saddr = socket_parse(uri, errp);
if (!saddr) {
return false;
}
addr->u.socket.type = saddr->type;
addr->u.socket.u = saddr->u;
+ /* Don't free the objects inside; their ownership moved to "addr" */
+ g_free(saddr);
} else if (strstart(uri, "file:", NULL)) {
addr->transport = MIGRATION_ADDRESS_TYPE_FILE;
addr->u.file.filename = g_strdup(uri + strlen("file:"));
diff --git a/migration/multifd.c b/migration/multifd.c
index ec58c58..4094606 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -883,8 +883,7 @@
trace_multifd_new_send_channel_async(p->id);
if (!qio_task_propagate_error(task, &local_err)) {
- p->c = ioc;
- qio_channel_set_delay(p->c, false);
+ qio_channel_set_delay(ioc, false);
p->running = true;
if (multifd_channel_connect(p, ioc, &local_err)) {
return;
diff --git a/pc-bios/README b/pc-bios/README
index c555dd3..4189bb2 100644
--- a/pc-bios/README
+++ b/pc-bios/README
@@ -14,7 +14,7 @@
- SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware
implementation for certain IBM POWER hardware. The sources are at
https://github.com/aik/SLOF, and the image currently in qemu is
- built from git tag qemu-slof-20220719.
+ built from git tag qemu-slof-20230918.
- VOF (Virtual Open Firmware) is a minimalistic firmware to work with
-machine pseries,x-vof=on. When enabled, the firmware acts as a slim shim and
diff --git a/pc-bios/slof.bin b/pc-bios/slof.bin
index ef9b81d..27fed09 100644
--- a/pc-bios/slof.bin
+++ b/pc-bios/slof.bin
Binary files differ
diff --git a/roms/SLOF b/roms/SLOF
index 6b6c16b..3a259df 160000
--- a/roms/SLOF
+++ b/roms/SLOF
@@ -1 +1 @@
-Subproject commit 6b6c16b4b40763507cf1f518096f3c3883c5cf2d
+Subproject commit 3a259df2449fc4a4e43ab5f33f0b2c66484b4bc3