aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/microvm.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-02-02 10:10:07 +0000
committerPeter Maydell <peter.maydell@linaro.org>2023-02-02 10:10:07 +0000
commitdeabea6e88f7c4c3c12a36ee30051c6209561165 (patch)
treef32d252f632936ba594c74f77100188e2b0309f6 /hw/i386/microvm.c
parent026817fb69414c9d3909d8b1a209f90180d777d6 (diff)
parentf5cb612867d3b10b86d6361ba041767e02c1b127 (diff)
downloadqemu-deabea6e88f7c4c3c12a36ee30051c6209561165.zip
qemu-deabea6e88f7c4c3c12a36ee30051c6209561165.tar.gz
qemu-deabea6e88f7c4c3c12a36ee30051c6209561165.tar.bz2
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
virtio,pc,pci: features, cleanups, fixes lots of fixes, cleanups Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # -----BEGIN PGP SIGNATURE----- # # iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmPYJdcPHG1zdEByZWRo # YXQuY29tAAoJECgfDbjSjVRp08cIAMYq0y++RtepDpLnPjybR0v1G4cPgZS4DXFz # 8uc/2nkAHe1Q2lJNmk9p3YjLLloSO8yC1bmuuhUpmry9BJokYzY1r7rfXc8jd/Za # z2FjC9LuYX+sk26NTGUxPq9mhT0p14HXyoxpnQlCweuVL0DJg1Tip6HI4oOG2LJj # Au6Rl9keMQNqf9qVtsR1djO+8nO4ywbx6D9d2CYSKkQ3pK3uLvNds9vqU16x8wq7 # mNPqV8BIoDgW4zEOL478h6rJcL7pDQo6kAT1wfg7q1JcMMHJfW36VcBeFfskfJFg # Pej3TEP2rg1LsGfh5XVw5Rp6FZ4K2TEyTK9cPZ9F7CzKdUrgBHU= # =S0zd # -----END PGP SIGNATURE----- # gpg: Signature made Mon 30 Jan 2023 20:17:27 GMT # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (56 commits) docs/pcie.txt: Replace ioh3420 with pcie-root-port Revert "vhost-user: Introduce nested event loop in vhost_user_read()" Revert "vhost-user: Monitor slave channel in vhost_user_read()" tests/qtest/bios-tables-test: Make the test less verbose by default hw: Use TYPE_PCI_BUS definition where appropriate vhost-user: Skip unnecessary duplicated VHOST_USER_ADD/REM_MEM_REG requests tests: acpi: update expected blobs pcihp: generate populated non-hotpluggble slot descriptions on non-hotplug path tests: acpi: whitelist DSDT before moving non-hotpluggble slots description from hotplug path tests: acpi: update expected blobs pcihp: acpi: ignore coldplugged bridges when composing hotpluggable slots tests: acpi: whitelist DSDT blobs before removing dynamic _DSM on coldplugged bridges tests: acpi: update expected blobs pcihp: acpi: decouple hotplug and generic slots description tests: acpi: whitelist DSDT before decoupling PCI hotplug code from basic slots description pcihp: isolate rule whether slot should be described in DSDT pci: make sure pci_bus_is_express() won't error out with "discards ‘const’ qualifier" pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml pci: acpi: wire up AcpiDevAmlIf interface to generic bridge x86: pcihp: acpi: prepare slot ignore rule to work with self describing bridges ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i386/microvm.c')
-rw-r--r--hw/i386/microvm.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 170a331..29f30dd 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -378,7 +378,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
MicrovmMachineState *mms = MICROVM_MACHINE(machine);
BusState *bus;
BusChild *kid;
- char *cmdline;
+ char *cmdline, *existing_cmdline;
+ size_t len;
/*
* Find MMIO transports with attached devices, and add them to the kernel
@@ -387,7 +388,8 @@ 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.
*/
- cmdline = g_strdup(machine->kernel_cmdline);
+ existing_cmdline = fw_cfg_read_bytes_ptr(x86ms->fw_cfg, FW_CFG_CMDLINE_DATA);
+ cmdline = g_strdup(existing_cmdline);
bus = sysbus_get_default();
QTAILQ_FOREACH(kid, &bus->children, sibling) {
DeviceState *dev = kid->child;
@@ -411,9 +413,12 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
}
}
- 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);
-
+ 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);
+ }
g_free(cmdline);
}