aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2025-04-09 04:32:46 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2025-04-09 04:32:46 -0400
commit7960e8c8ad53a293fedf8d1d3f5765cb832ffb40 (patch)
treeda88282a467b25c84c637bd74dd653b1d2ad2bce
parentc302660920acf48425a1317d56122ea8af60fbc4 (diff)
parentae81527b431e235b7f81a400b9a6a27b798c40b3 (diff)
downloadqemu-7960e8c8ad53a293fedf8d1d3f5765cb832ffb40.zip
qemu-7960e8c8ad53a293fedf8d1d3f5765cb832ffb40.tar.gz
qemu-7960e8c8ad53a293fedf8d1d3f5765cb832ffb40.tar.bz2
Merge tag 'hw-misc-20250408' of https://github.com/philmd/qemu into staging
Misc HW patches - Fix overrun when parsing SMBIOS OEM string (Daan) - Correctly call handle_machine_dumpdtb() callback (Joel) - List HVF as supported for virt machine (Zhang) - Correct UFS segment/alloc size comments (Keoseong) - Do not expose unimplemented devices in i.MX8mp DTB (Guenter & Bernhard) - Attach NVMe private namespaces to proper controller (Klaus) - Fix typo in SDPX license checker script (Zhao) # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmf1cOAACgkQ4+MsLN6t # wN5ZERAAttyD+ZJwIOeTmrVyIhYNAKVKBWzUnqce+k+1NUG0kT/+FXN7rmP4lFhM # 2VasfWG8UVBpOcd2FfjimDadYEZ48WtE6z4txf7Fk3rDYOtC7U8l2dvGRhrvdnv+ # NaClU7+PZwpaS2KE/rGTRXm+QC4gc9GnMz6PPwTcBybVWh6342L7EUcbv0AYhTmn # S1w/jQIwX6OKYkjHdR3WRacx3skKf9PCDoaZkQxxHPCPDzkpf8pJhojScvwg+CBz # PoT9OqKm9vS9UXLxTUFsdW7SWKc7xAJwFWZS/QXtUV5X+D/w1eQ3qEBEwShPecxl # XehwNfaO5YqI6oiSGm+XZlz4Hk7bmoRMv4cl9JZ+ifiU/RronlYiMjRL79lqWXCL # Yp0q553YwdAIFlwzOE3Zblf/4H3iZ0dbc1wSRJLGE+pFvslUb0uch8WqkLQ+FX0q # kUBTJx8bvy0pmV0w/n6aY8gCygBZoK8hK5NZJ7Iq38y8UQ4vjLAlycd6XocA7aQk # PdyFjXvY4ofVldmLMaJdX4pQTgi1/GVSNa7G/cTrF5tcxwIcmVbvpqtZwB3+YxGu # pwQnD1eR5u9ZLsXNoRM2RRCBRB/h7k6HavSJ3JFtNjbQU07C3oFoQ9VePcKLl1Xl # wmHRBq3twgx/ZZAnYZyPQL2mmTcmo125kT3ZFVgl77UzzA/piD0= # =0xrJ # -----END PGP SIGNATURE----- # gpg: Signature made Tue 08 Apr 2025 14:54:24 EDT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * tag 'hw-misc-20250408' of https://github.com/philmd/qemu: scripts/checkpatch: Fix typo in SPDX-License-Identifier keyword hw/nvme: fix attachment of private namespaces hw/arm/imx8mp-evk: Temporarily remove unimplemented imx8mp-fspi node from devicetree hw/arm/imx8mp-evk: Remove unimplemented cpu-idle-states properties from devicetree hw/ufs: Fix incorrect comment for segment_size and allocation_unit_size docs/arm: Add apple HVF host for supported guest CPU type hw/core/machine: Fix -machine dumpdtb=file.dtb smbios: Fix buffer overrun when using path= option Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--docs/system/arm/imx8mp-evk.rst12
-rw-r--r--docs/system/arm/virt.rst4
-rw-r--r--hw/arm/imx8mp-evk.c29
-rw-r--r--hw/core/machine.c12
-rw-r--r--hw/nvme/ctrl.c7
-rw-r--r--hw/nvme/ns.c4
-rw-r--r--hw/nvme/nvme.h3
-rw-r--r--hw/nvme/subsys.c9
-rw-r--r--hw/smbios/smbios.c3
-rw-r--r--hw/ufs/ufs.c4
-rwxr-xr-xscripts/checkpatch.pl4
11 files changed, 60 insertions, 31 deletions
diff --git a/docs/system/arm/imx8mp-evk.rst b/docs/system/arm/imx8mp-evk.rst
index 00527b0..b2f7d29 100644
--- a/docs/system/arm/imx8mp-evk.rst
+++ b/docs/system/arm/imx8mp-evk.rst
@@ -35,7 +35,7 @@ Direct Linux Kernel Boot
Probably the easiest way to get started with a whole Linux system on the machine
is to generate an image with Buildroot. Version 2024.11.1 is tested at the time
-of writing and involves three steps. First run the following commands in the
+of writing and involves two steps. First run the following commands in the
toplevel directory of the Buildroot source tree:
.. code-block:: bash
@@ -50,14 +50,6 @@ it and resize the SD card image to a power of two:
$ qemu-img resize sdcard.img 256M
-Finally, the device tree needs to be patched with the following commands which
-will remove the ``cpu-idle-states`` properties from CPU nodes:
-
-.. code-block:: bash
-
- $ dtc imx8mp-evk.dtb | sed '/cpu-idle-states/d' > imx8mp-evk-patched.dts
- $ dtc imx8mp-evk-patched.dts -o imx8mp-evk-patched.dtb
-
Now that everything is prepared the machine can be started as follows:
.. code-block:: bash
@@ -65,6 +57,6 @@ Now that everything is prepared the machine can be started as follows:
$ qemu-system-aarch64 -M imx8mp-evk -smp 4 -m 3G \
-display none -serial null -serial stdio \
-kernel Image \
- -dtb imx8mp-evk-patched.dtb \
+ -dtb imx8mp-evk.dtb \
-append "root=/dev/mmcblk2p2" \
-drive file=sdcard.img,if=sd,bus=2,format=raw,id=mmcblk2
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
index adf446c..6a719b9 100644
--- a/docs/system/arm/virt.rst
+++ b/docs/system/arm/virt.rst
@@ -70,11 +70,11 @@ Supported guest CPU types:
- ``cortex-a76`` (64-bit)
- ``cortex-a710`` (64-bit)
- ``a64fx`` (64-bit)
-- ``host`` (with KVM only)
+- ``host`` (with KVM and HVF only)
- ``neoverse-n1`` (64-bit)
- ``neoverse-v1`` (64-bit)
- ``neoverse-n2`` (64-bit)
-- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
+- ``max`` (same as ``host`` for KVM and HVF; best possible emulation with TCG)
Note that the default is ``cortex-a15``, so for an AArch64 guest you must
specify a CPU type.
diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
index f17d5db..b5aec06e 100644
--- a/hw/arm/imx8mp-evk.c
+++ b/hw/arm/imx8mp-evk.c
@@ -15,6 +15,34 @@
#include "system/qtest.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
+#include <libfdt.h>
+
+static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)
+{
+ int i, offset;
+
+ /* Temporarily disable following nodes until they are implemented */
+ const char *nodes_to_remove[] = {
+ "nxp,imx8mp-fspi",
+ };
+
+ for (i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) {
+ const char *dev_str = nodes_to_remove[i];
+
+ offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
+ while (offset >= 0) {
+ fdt_nop_node(fdt, offset);
+ offset = fdt_node_offset_by_compatible(fdt, offset, dev_str);
+ }
+ }
+
+ /* Remove cpu-idle-states property from CPU nodes */
+ offset = fdt_node_offset_by_compatible(fdt, -1, "arm,cortex-a53");
+ while (offset >= 0) {
+ fdt_nop_property(fdt, offset, "cpu-idle-states");
+ offset = fdt_node_offset_by_compatible(fdt, offset, "arm,cortex-a53");
+ }
+}
static void imx8mp_evk_init(MachineState *machine)
{
@@ -32,6 +60,7 @@ static void imx8mp_evk_init(MachineState *machine)
.board_id = -1,
.ram_size = machine->ram_size,
.psci_conduit = QEMU_PSCI_CONDUIT_SMC,
+ .modify_dtb = imx8mp_evk_modify_dtb,
};
s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));
diff --git a/hw/core/machine.c b/hw/core/machine.c
index f52a4f2..63c6ef9 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1731,12 +1731,6 @@ void qdev_machine_creation_done(void)
phase_advance(PHASE_MACHINE_READY);
qdev_assert_realized_properly();
- /*
- * If the user used -machine dumpdtb=file.dtb to request that we
- * dump the DTB to a file, do it now, and exit.
- */
- handle_machine_dumpdtb(current_machine);
-
/* TODO: once all bus devices are qdevified, this should be done
* when bus is created by qdev.c */
/*
@@ -1750,6 +1744,12 @@ void qdev_machine_creation_done(void)
notifier_list_notify(&machine_init_done_notifiers, NULL);
+ /*
+ * If the user used -machine dumpdtb=file.dtb to request that we
+ * dump the DTB to a file, do it now, and exit.
+ */
+ handle_machine_dumpdtb(current_machine);
+
if (rom_check_and_register_reset() != 0) {
exit(1);
}
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 518d02d..d6b77d4 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -7755,7 +7755,11 @@ static int nvme_start_ctrl(NvmeCtrl *n)
for (int i = 1; i <= NVME_MAX_NAMESPACES; i++) {
NvmeNamespace *ns = nvme_subsys_ns(n->subsys, i);
- if (ns && nvme_csi_supported(n, ns->csi) && !ns->params.detached) {
+ if (!ns || (!ns->params.shared && ns->ctrl != n)) {
+ continue;
+ }
+
+ if (nvme_csi_supported(n, ns->csi) && !ns->params.detached) {
if (!ns->attached || ns->params.shared) {
nvme_attach_ns(n, ns);
}
@@ -8988,6 +8992,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
if (n->namespace.blkconf.blk) {
ns = &n->namespace;
ns->params.nsid = 1;
+ ns->ctrl = n;
if (nvme_ns_setup(ns, errp)) {
return;
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 98c1e75..4ab8ba7 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -763,6 +763,10 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
ns->id_ns.endgid = cpu_to_le16(0x1);
ns->id_ns_ind.endgrpid = cpu_to_le16(0x1);
+
+ if (!ns->params.shared) {
+ ns->ctrl = n;
+ }
}
static const Property nvme_ns_props[] = {
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 6f782ba..b5c9378 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -268,6 +268,9 @@ typedef struct NvmeNamespace {
NvmeSubsystem *subsys;
NvmeEnduranceGroup *endgrp;
+ /* NULL for shared namespaces; set to specific controller if private */
+ NvmeCtrl *ctrl;
+
struct {
uint32_t err_rec;
} features;
diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c
index 2ae56f1..b617ac3 100644
--- a/hw/nvme/subsys.c
+++ b/hw/nvme/subsys.c
@@ -56,7 +56,7 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
{
NvmeSubsystem *subsys = n->subsys;
NvmeSecCtrlEntry *sctrl = nvme_sctrl(n);
- int cntlid, nsid, num_rsvd, num_vfs = n->params.sriov_max_vfs;
+ int cntlid, num_rsvd, num_vfs = n->params.sriov_max_vfs;
if (pci_is_vf(&n->parent_obj)) {
cntlid = le16_to_cpu(sctrl->scid);
@@ -92,13 +92,6 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
subsys->ctrls[cntlid] = n;
- for (nsid = 1; nsid < ARRAY_SIZE(subsys->namespaces); nsid++) {
- NvmeNamespace *ns = subsys->namespaces[nsid];
- if (ns && ns->params.shared && !ns->params.detached) {
- nvme_attach_ns(n, ns);
- }
- }
-
return cntlid;
}
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 02a09eb..ad4cd67 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1285,6 +1285,9 @@ static int save_opt_one(void *opaque,
g_byte_array_append(data, (guint8 *)buf, ret);
}
+ buf[0] = '\0';
+ g_byte_array_append(data, (guint8 *)buf, 1);
+
qemu_close(fd);
*opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1);
diff --git a/hw/ufs/ufs.c b/hw/ufs/ufs.c
index ee13eda..542f13b 100644
--- a/hw/ufs/ufs.c
+++ b/hw/ufs/ufs.c
@@ -1753,8 +1753,8 @@ static void ufs_init_hc(UfsHc *u)
u->geometry_desc.length = sizeof(GeometryDescriptor);
u->geometry_desc.descriptor_idn = UFS_QUERY_DESC_IDN_GEOMETRY;
u->geometry_desc.max_number_lu = (UFS_MAX_LUS == 32) ? 0x1 : 0x0;
- u->geometry_desc.segment_size = cpu_to_be32(0x2000); /* 4KB */
- u->geometry_desc.allocation_unit_size = 0x1; /* 4KB */
+ u->geometry_desc.segment_size = cpu_to_be32(0x2000); /* 4MB: 8192 * 512B */
+ u->geometry_desc.allocation_unit_size = 0x1; /* 4MB: 1 segment */
u->geometry_desc.min_addr_block_size = 0x8; /* 4KB */
u->geometry_desc.max_in_buffer_size = 0x8;
u->geometry_desc.max_out_buffer_size = 0x8;
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 6ae9d7f..365892d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1688,11 +1688,11 @@ sub process {
/\.(c|h|py|pl|sh|json|inc|Makefile)$/) {
# source code files MUST have SPDX license declared
ERROR("New file '$expect_spdx_file' requires " .
- "'SPDX-License-Identifer'");
+ "'SPDX-License-Identifier'");
} else {
# Other files MAY have SPDX license if appropriate
WARN("Does new file '$expect_spdx_file' need " .
- "'SPDX-License-Identifer'?");
+ "'SPDX-License-Identifier'?");
}
}
$expect_spdx = 1;