Merge tag 'hw-misc-20240517' of https://github.com/philmd/qemu into staging
Misc HW patches queue
- Fix build when GBM buffer management library is detected (Cédric)
- Fix PFlash block write (Gerd)
- Allow 'parameter=1' for SMP topology on any machine (Daniel)
- Allow guest-debug tests to run with recent GDB (Gustavo)
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmZHcOsACgkQ4+MsLN6t
# wN4CqxAA15Ow9ubxipORpM+XJgJ5isyPjD1s/6bR6lj7joBS6CYQbMaaskXuDQK8
# FpeoWw2DI2Fh/61NcUMAk7XBFF59DLrtngDhfLZJYdwBh0S8RFs1wp6sKyaBA9K6
# wDy39plxt/abKGzj3EcJUGDvhBLPJNnqy5OF9fZtWGrQg+A1i9uLMu/ac6srfX+K
# zau/CxQaHYRYLYFmRcQCOhFVAtp2TQHw14CiiLYMCxF3GvUCN0xmtg8lzj9/y4ke
# Yt0VN6jC3opfmQuDtPJNNkp8beaHbwMARFmXepDVB2cHp8DY5Gm4Ij2WiR0K985G
# fqDknHEXDPI+RislV9+EN3p2c05m7ihPKLiDLYCulD4TIRDz+eUf71Onus9uecj9
# zCDdPYjU1ly9pyt7EVG2Bla9D/F51ZvbrzJQrHbvqhxWuZGOPSzHdpSsHZBIOXk6
# OhxTtUPeWDYW5K+wdNpxYPy5dqIR3jSEbDwLh2Wts2iPKxCGC8ly6CbZJPgA5lQE
# hwYbiSKNcxAMV3V9qBfKLRSGadnnfPwG/zrGOHBni9ejz+m7foA13mJ4H6VFBn7Q
# GGe9f00MCKcWTTlzRty1oIzAKcpupCOanX0MpVNcTYUqVtODhlQpDdH63ZVuiyRU
# kux9xz71I+mwkjQiTHTki1qcAbLNj9+jgwbcc74Zz1BngIauqtc=
# =Octv
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 17 May 2024 04:59:55 PM CEST
# gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
* tag 'hw-misc-20240517' of https://github.com/philmd/qemu:
tests: Gently exit from GDB when tests complete
tests: add testing of parameter=1 for SMP topology
hw/core: allow parameter=1 for SMP topology on any machine
hw/pflash: fix block write start
ui/console: Only declare variable fence_fd when CONFIG_GBM is defined
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 1bda842..c8f1cf5 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -518,10 +518,6 @@
break;
case 0xe8: /* Write to buffer */
trace_pflash_write(pfl->name, "write to buffer");
- /* FIXME should save @offset, @width for case 1+ */
- qemu_log_mask(LOG_UNIMP,
- "%s: Write to buffer emulation is flawed\n",
- __func__);
pfl->status |= 0x80; /* Ready! */
break;
case 0xf0: /* Probe for AMD flash */
@@ -574,7 +570,6 @@
}
pfl->counter = value;
pfl->wcycle++;
- pflash_blk_write_start(pfl, offset);
break;
case 0x60:
if (cmd == 0xd0) {
@@ -605,6 +600,9 @@
switch (pfl->cmd) {
case 0xe8: /* Block write */
/* FIXME check @offset, @width */
+ if (pfl->blk_offset == -1 && pfl->counter) {
+ pflash_blk_write_start(pfl, offset);
+ }
if (!pfl->ro && (pfl->blk_offset != -1)) {
pflash_data_write(pfl, offset, value, width, be);
} else {
diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 2b93fa9..5d8d7ed 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -118,76 +118,46 @@
}
/*
- * If not supported by the machine, a topology parameter must be
- * omitted.
+ * If not supported by the machine, a topology parameter must
+ * not be set to a value greater than 1.
*/
- if (!mc->smp_props.modules_supported && config->has_modules) {
- if (config->modules > 1) {
- error_setg(errp, "modules not supported by this "
- "machine's CPU topology");
- return;
- } else {
- /* Here modules only equals 1 since we've checked zero case. */
- warn_report("Deprecated CPU topology (considered invalid): "
- "Unsupported modules parameter mustn't be "
- "specified as 1");
- }
+ if (!mc->smp_props.modules_supported &&
+ config->has_modules && config->modules > 1) {
+ error_setg(errp,
+ "modules > 1 not supported by this machine's CPU topology");
+ return;
}
modules = modules > 0 ? modules : 1;
- if (!mc->smp_props.clusters_supported && config->has_clusters) {
- if (config->clusters > 1) {
- error_setg(errp, "clusters not supported by this "
- "machine's CPU topology");
- return;
- } else {
- /* Here clusters only equals 1 since we've checked zero case. */
- warn_report("Deprecated CPU topology (considered invalid): "
- "Unsupported clusters parameter mustn't be "
- "specified as 1");
- }
+ if (!mc->smp_props.clusters_supported &&
+ config->has_clusters && config->clusters > 1) {
+ error_setg(errp,
+ "clusters > 1 not supported by this machine's CPU topology");
+ return;
}
clusters = clusters > 0 ? clusters : 1;
- if (!mc->smp_props.dies_supported && config->has_dies) {
- if (config->dies > 1) {
- error_setg(errp, "dies not supported by this "
- "machine's CPU topology");
- return;
- } else {
- /* Here dies only equals 1 since we've checked zero case. */
- warn_report("Deprecated CPU topology (considered invalid): "
- "Unsupported dies parameter mustn't be "
- "specified as 1");
- }
+ if (!mc->smp_props.dies_supported &&
+ config->has_dies && config->dies > 1) {
+ error_setg(errp,
+ "dies > 1 not supported by this machine's CPU topology");
+ return;
}
dies = dies > 0 ? dies : 1;
- if (!mc->smp_props.books_supported && config->has_books) {
- if (config->books > 1) {
- error_setg(errp, "books not supported by this "
- "machine's CPU topology");
- return;
- } else {
- /* Here books only equals 1 since we've checked zero case. */
- warn_report("Deprecated CPU topology (considered invalid): "
- "Unsupported books parameter mustn't be "
- "specified as 1");
- }
+ if (!mc->smp_props.books_supported &&
+ config->has_books && config->books > 1) {
+ error_setg(errp,
+ "books > 1 not supported by this machine's CPU topology");
+ return;
}
books = books > 0 ? books : 1;
- if (!mc->smp_props.drawers_supported && config->has_drawers) {
- if (config->drawers > 1) {
- error_setg(errp, "drawers not supported by this "
- "machine's CPU topology");
- return;
- } else {
- /* Here drawers only equals 1 since we've checked zero case. */
- warn_report("Deprecated CPU topology (considered invalid): "
- "Unsupported drawers parameter mustn't be "
- "specified as 1");
- }
+ if (!mc->smp_props.drawers_supported &&
+ config->has_drawers && config->drawers > 1) {
+ error_setg(errp,
+ "drawers > 1 not supported by this machine's CPU topology");
+ return;
}
drawers = drawers > 0 ? drawers : 1;
diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdbstub.py
index 7f71d34..46fbf98 100644
--- a/tests/guest-debug/test_gdbstub.py
+++ b/tests/guest-debug/test_gdbstub.py
@@ -57,4 +57,4 @@ def main(test, expected_arch=None):
pass
print("All tests complete: {} failures".format(fail_count))
- exit(fail_count)
+ gdb.execute(f"exit {fail_count}")
diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c
index 8994337..9fdba24 100644
--- a/tests/unit/test-smp-parse.c
+++ b/tests/unit/test-smp-parse.c
@@ -330,6 +330,14 @@
.config = SMP_CONFIG_GENERIC(T, 8, T, 2, T, 4, T, 2, T, 16),
.expect_prefer_sockets = CPU_TOPOLOGY_GENERIC(8, 2, 4, 2, 16),
.expect_prefer_cores = CPU_TOPOLOGY_GENERIC(8, 2, 4, 2, 16),
+ }, {
+ /*
+ * Unsupported parameters are always allowed to be set to '1'
+ * config: -smp 8,books=1,drawers=1,sockets=2,modules=1,dies=1,cores=2,threads=2,maxcpus=8
+ * expect: cpus=8,sockets=2,cores=2,threads=2,maxcpus=8 */
+ .config = SMP_CONFIG_WITH_FULL_TOPO(8, 1, 1, 2, 1, 1, 2, 2, 8),
+ .expect_prefer_sockets = CPU_TOPOLOGY_GENERIC(8, 2, 2, 2, 8),
+ .expect_prefer_cores = CPU_TOPOLOGY_GENERIC(8, 2, 2, 2, 8),
},
};
@@ -337,21 +345,21 @@
{
/* config: -smp 2,dies=2 */
.config = SMP_CONFIG_WITH_DIES(T, 2, F, 0, T, 2, F, 0, F, 0, F, 0),
- .expect_error = "dies not supported by this machine's CPU topology",
+ .expect_error = "dies > 1 not supported by this machine's CPU topology",
}, {
/* config: -smp 2,clusters=2 */
.config = SMP_CONFIG_WITH_CLUSTERS(T, 2, F, 0, T, 2, F, 0, F, 0, F, 0),
- .expect_error = "clusters not supported by this machine's CPU topology",
+ .expect_error = "clusters > 1 not supported by this machine's CPU topology",
}, {
/* config: -smp 2,books=2 */
.config = SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 2, F, 0, T, 2, F,
0, F, 0, F, 0, F, 0),
- .expect_error = "books not supported by this machine's CPU topology",
+ .expect_error = "books > 1 not supported by this machine's CPU topology",
}, {
/* config: -smp 2,drawers=2 */
.config = SMP_CONFIG_WITH_BOOKS_DRAWERS(T, 2, T, 2, F, 0, F,
0, F, 0, F, 0, F, 0),
- .expect_error = "drawers not supported by this machine's CPU topology",
+ .expect_error = "drawers > 1 not supported by this machine's CPU topology",
}, {
/* config: -smp 8,sockets=2,cores=4,threads=2,maxcpus=8 */
.config = SMP_CONFIG_GENERIC(T, 8, T, 2, T, 4, T, 2, T, 8),
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 0473f68..9831c10 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -68,9 +68,9 @@
GdkWindow *window;
#ifdef CONFIG_GBM
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
+ int fence_fd;
#endif
int ww, wh, ws;
- int fence_fd;
if (!vc->gfx.gls) {
return;