aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/microvm.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2023-02-08 15:55:36 -0500
committerMichael S. Tsirkin <mst@redhat.com>2023-03-02 03:10:46 -0500
commitb34f2fd17e4276ac0a75f8d72485a0236a740954 (patch)
tree5d689a72817ffc868a186100a523bf3167344860 /hw/i386/microvm.c
parent60d09b8dc7dd4256d664ad680795cb1327805b2b (diff)
downloadqemu-b34f2fd17e4276ac0a75f8d72485a0236a740954.zip
qemu-b34f2fd17e4276ac0a75f8d72485a0236a740954.tar.gz
qemu-b34f2fd17e4276ac0a75f8d72485a0236a740954.tar.bz2
Revert "x86: don't let decompressed kernel image clobber setup_data"
This reverts commit eac7a7791bb6d719233deed750034042318ffd56. Fixes: eac7a7791b ("x86: don't let decompressed kernel image clobber setup_data") Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Dov Murik <dovmurik@linux.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'hw/i386/microvm.c')
-rw-r--r--hw/i386/microvm.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 68c2201..6680530 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -376,8 +376,7 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
MicrovmMachineState *mms = MICROVM_MACHINE(machine);
BusState *bus;
BusChild *kid;
- char *cmdline, *existing_cmdline;
- size_t len;
+ char *cmdline;
/*
* Find MMIO transports with attached devices, and add them to the kernel
@@ -386,8 +385,7 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
* Yes, this is a hack, but one that heavily improves the UX without
* introducing any significant issues.
*/
- existing_cmdline = fw_cfg_read_bytes_ptr(x86ms->fw_cfg, FW_CFG_CMDLINE_DATA);
- cmdline = g_strdup(existing_cmdline);
+ cmdline = g_strdup(machine->kernel_cmdline);
bus = sysbus_get_default();
QTAILQ_FOREACH(kid, &bus->children, sibling) {
DeviceState *dev = kid->child;
@@ -411,12 +409,9 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
}
}
- len = strlen(cmdline);
- if (len > VIRTIO_CMDLINE_TOTAL_MAX_LEN + strlen(existing_cmdline)) {
- fprintf(stderr, "qemu: virtio mmio cmdline too large, skipping\n");
- } else {
- memcpy(existing_cmdline, cmdline, len + 1);
- }
+ fw_cfg_modify_i32(x86ms->fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(cmdline) + 1);
+ fw_cfg_modify_string(x86ms->fw_cfg, FW_CFG_CMDLINE_DATA, cmdline);
+
g_free(cmdline);
}