Skip to content

Commit 7960e8c

Browse files
committed
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) <[email protected]>" [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 <[email protected]>
2 parents c302660 + ae81527 commit 7960e8c

File tree

11 files changed

+60
-31
lines changed

11 files changed

+60
-31
lines changed

docs/system/arm/imx8mp-evk.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Direct Linux Kernel Boot
3535

3636
Probably the easiest way to get started with a whole Linux system on the machine
3737
is to generate an image with Buildroot. Version 2024.11.1 is tested at the time
38-
of writing and involves three steps. First run the following commands in the
38+
of writing and involves two steps. First run the following commands in the
3939
toplevel directory of the Buildroot source tree:
4040

4141
.. code-block:: bash
@@ -50,21 +50,13 @@ it and resize the SD card image to a power of two:
5050
5151
$ qemu-img resize sdcard.img 256M
5252
53-
Finally, the device tree needs to be patched with the following commands which
54-
will remove the ``cpu-idle-states`` properties from CPU nodes:
55-
56-
.. code-block:: bash
57-
58-
$ dtc imx8mp-evk.dtb | sed '/cpu-idle-states/d' > imx8mp-evk-patched.dts
59-
$ dtc imx8mp-evk-patched.dts -o imx8mp-evk-patched.dtb
60-
6153
Now that everything is prepared the machine can be started as follows:
6254

6355
.. code-block:: bash
6456
6557
$ qemu-system-aarch64 -M imx8mp-evk -smp 4 -m 3G \
6658
-display none -serial null -serial stdio \
6759
-kernel Image \
68-
-dtb imx8mp-evk-patched.dtb \
60+
-dtb imx8mp-evk.dtb \
6961
-append "root=/dev/mmcblk2p2" \
7062
-drive file=sdcard.img,if=sd,bus=2,format=raw,id=mmcblk2

docs/system/arm/virt.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ Supported guest CPU types:
7070
- ``cortex-a76`` (64-bit)
7171
- ``cortex-a710`` (64-bit)
7272
- ``a64fx`` (64-bit)
73-
- ``host`` (with KVM only)
73+
- ``host`` (with KVM and HVF only)
7474
- ``neoverse-n1`` (64-bit)
7575
- ``neoverse-v1`` (64-bit)
7676
- ``neoverse-n2`` (64-bit)
77-
- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
77+
- ``max`` (same as ``host`` for KVM and HVF; best possible emulation with TCG)
7878

7979
Note that the default is ``cortex-a15``, so for an AArch64 guest you must
8080
specify a CPU type.

hw/arm/imx8mp-evk.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,34 @@
1515
#include "system/qtest.h"
1616
#include "qemu/error-report.h"
1717
#include "qapi/error.h"
18+
#include <libfdt.h>
19+
20+
static void imx8mp_evk_modify_dtb(const struct arm_boot_info *info, void *fdt)
21+
{
22+
int i, offset;
23+
24+
/* Temporarily disable following nodes until they are implemented */
25+
const char *nodes_to_remove[] = {
26+
"nxp,imx8mp-fspi",
27+
};
28+
29+
for (i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) {
30+
const char *dev_str = nodes_to_remove[i];
31+
32+
offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
33+
while (offset >= 0) {
34+
fdt_nop_node(fdt, offset);
35+
offset = fdt_node_offset_by_compatible(fdt, offset, dev_str);
36+
}
37+
}
38+
39+
/* Remove cpu-idle-states property from CPU nodes */
40+
offset = fdt_node_offset_by_compatible(fdt, -1, "arm,cortex-a53");
41+
while (offset >= 0) {
42+
fdt_nop_property(fdt, offset, "cpu-idle-states");
43+
offset = fdt_node_offset_by_compatible(fdt, offset, "arm,cortex-a53");
44+
}
45+
}
1846

1947
static void imx8mp_evk_init(MachineState *machine)
2048
{
@@ -32,6 +60,7 @@ static void imx8mp_evk_init(MachineState *machine)
3260
.board_id = -1,
3361
.ram_size = machine->ram_size,
3462
.psci_conduit = QEMU_PSCI_CONDUIT_SMC,
63+
.modify_dtb = imx8mp_evk_modify_dtb,
3564
};
3665

3766
s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));

hw/core/machine.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,12 +1731,6 @@ void qdev_machine_creation_done(void)
17311731
phase_advance(PHASE_MACHINE_READY);
17321732
qdev_assert_realized_properly();
17331733

1734-
/*
1735-
* If the user used -machine dumpdtb=file.dtb to request that we
1736-
* dump the DTB to a file, do it now, and exit.
1737-
*/
1738-
handle_machine_dumpdtb(current_machine);
1739-
17401734
/* TODO: once all bus devices are qdevified, this should be done
17411735
* when bus is created by qdev.c */
17421736
/*
@@ -1750,6 +1744,12 @@ void qdev_machine_creation_done(void)
17501744

17511745
notifier_list_notify(&machine_init_done_notifiers, NULL);
17521746

1747+
/*
1748+
* If the user used -machine dumpdtb=file.dtb to request that we
1749+
* dump the DTB to a file, do it now, and exit.
1750+
*/
1751+
handle_machine_dumpdtb(current_machine);
1752+
17531753
if (rom_check_and_register_reset() != 0) {
17541754
exit(1);
17551755
}

hw/nvme/ctrl.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7755,7 +7755,11 @@ static int nvme_start_ctrl(NvmeCtrl *n)
77557755
for (int i = 1; i <= NVME_MAX_NAMESPACES; i++) {
77567756
NvmeNamespace *ns = nvme_subsys_ns(n->subsys, i);
77577757

7758-
if (ns && nvme_csi_supported(n, ns->csi) && !ns->params.detached) {
7758+
if (!ns || (!ns->params.shared && ns->ctrl != n)) {
7759+
continue;
7760+
}
7761+
7762+
if (nvme_csi_supported(n, ns->csi) && !ns->params.detached) {
77597763
if (!ns->attached || ns->params.shared) {
77607764
nvme_attach_ns(n, ns);
77617765
}
@@ -8988,6 +8992,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
89888992
if (n->namespace.blkconf.blk) {
89898993
ns = &n->namespace;
89908994
ns->params.nsid = 1;
8995+
ns->ctrl = n;
89918996

89928997
if (nvme_ns_setup(ns, errp)) {
89938998
return;

hw/nvme/ns.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,10 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
763763

764764
ns->id_ns.endgid = cpu_to_le16(0x1);
765765
ns->id_ns_ind.endgrpid = cpu_to_le16(0x1);
766+
767+
if (!ns->params.shared) {
768+
ns->ctrl = n;
769+
}
766770
}
767771

768772
static const Property nvme_ns_props[] = {

hw/nvme/nvme.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ typedef struct NvmeNamespace {
268268
NvmeSubsystem *subsys;
269269
NvmeEnduranceGroup *endgrp;
270270

271+
/* NULL for shared namespaces; set to specific controller if private */
272+
NvmeCtrl *ctrl;
273+
271274
struct {
272275
uint32_t err_rec;
273276
} features;

hw/nvme/subsys.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
5656
{
5757
NvmeSubsystem *subsys = n->subsys;
5858
NvmeSecCtrlEntry *sctrl = nvme_sctrl(n);
59-
int cntlid, nsid, num_rsvd, num_vfs = n->params.sriov_max_vfs;
59+
int cntlid, num_rsvd, num_vfs = n->params.sriov_max_vfs;
6060

6161
if (pci_is_vf(&n->parent_obj)) {
6262
cntlid = le16_to_cpu(sctrl->scid);
@@ -92,13 +92,6 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
9292

9393
subsys->ctrls[cntlid] = n;
9494

95-
for (nsid = 1; nsid < ARRAY_SIZE(subsys->namespaces); nsid++) {
96-
NvmeNamespace *ns = subsys->namespaces[nsid];
97-
if (ns && ns->params.shared && !ns->params.detached) {
98-
nvme_attach_ns(n, ns);
99-
}
100-
}
101-
10295
return cntlid;
10396
}
10497

hw/smbios/smbios.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,9 @@ static int save_opt_one(void *opaque,
12851285
g_byte_array_append(data, (guint8 *)buf, ret);
12861286
}
12871287

1288+
buf[0] = '\0';
1289+
g_byte_array_append(data, (guint8 *)buf, 1);
1290+
12881291
qemu_close(fd);
12891292

12901293
*opt->dest = g_renew(char *, *opt->dest, (*opt->ndest) + 1);

hw/ufs/ufs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,8 +1753,8 @@ static void ufs_init_hc(UfsHc *u)
17531753
u->geometry_desc.length = sizeof(GeometryDescriptor);
17541754
u->geometry_desc.descriptor_idn = UFS_QUERY_DESC_IDN_GEOMETRY;
17551755
u->geometry_desc.max_number_lu = (UFS_MAX_LUS == 32) ? 0x1 : 0x0;
1756-
u->geometry_desc.segment_size = cpu_to_be32(0x2000); /* 4KB */
1757-
u->geometry_desc.allocation_unit_size = 0x1; /* 4KB */
1756+
u->geometry_desc.segment_size = cpu_to_be32(0x2000); /* 4MB: 8192 * 512B */
1757+
u->geometry_desc.allocation_unit_size = 0x1; /* 4MB: 1 segment */
17581758
u->geometry_desc.min_addr_block_size = 0x8; /* 4KB */
17591759
u->geometry_desc.max_in_buffer_size = 0x8;
17601760
u->geometry_desc.max_out_buffer_size = 0x8;

0 commit comments

Comments
 (0)