Skip to content

Commit cf86770

Browse files
committed
Merge tag 'pull-request-2025-01-21v2' of https://gitlab.com/thuth/qemu into staging
* Fix bugs related to the new "boot order" feature in the s390-ccw bios * Fix crash that occurs when introspecting older s390-virtio-ccw machines * Fix error in pbkdf code on fast machines (e.g. s390x with crypto adapter) * Convert kvm_xen_guest avocado test to the functional framework # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmeQpIYRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbXYKA/9HddJS8Ljxwwme2XL1uSXreTGGKjE4QO1 # NKaEyJFfu5KAXCgufr/L4mLLxc8Bdf+qEux1v9u49OadMlYf/WzG5BYW42bLBrnK # zhZZGnuLZHU6kzhK3OMQ0kJLYVGneKU8WahHiPaOfIjuEr+6SoMfb5N8ttSOG7ry # Np3HvA5K5m4pOL0kSMJiiCqKSzRPbzWaxxwwB5j+iD4NB5NfLo8kEH1iXqRqkEBQ # zkM0ab0pYYYZil6DqpNQ84QbWY0qJfhj+1GhsVugTE46ePdr7t7v3K1TFq27cGPw # seJiUAdQwjUfblmlyjcuZfXr1p2sNAY2xocg/6dyIqroOVU9SxVwqrZAOvXd9t2r # 7UEoT0EfEkDaEaL3T2me6AEtxpkXwEw/usVHv/79vdAVX4VxHUQz3YxUnG4kByXJ # AEwUzq9Pm7mIV6I3zZ1AZHmBxENshhL0pBGdsL9F/Wv1tkPEf1WnDJ+1d2v2Hpag # Pr5i6RikG0x8LoT1+G2Swr43fhOLGybqIiy7T4d4WiCuR3szfj1FCeJoMTEK6jHg # 29Fps7ypQhfkSCcMCvk8VwImb+lc5bQPrV1PKcpEnLZbf3jU6myO/Ac3j2cnfYd6 # 3HidYK3GTpL7hMegyYh/nmFNp/edsgcky7SnDvcxsedVbwLxX112DaVed1ngPXmu # 6ZLrIhNk7BU= # =4IXO # -----END PGP SIGNATURE----- # gpg: Signature made Wed 22 Jan 2025 02:55:50 EST # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2025-01-21v2' of https://gitlab.com/thuth/qemu: pc-bios: Update the s390 bios images with the recent changes pc-bios/s390-ccw: Abort IPL on invalid loadparm pc-bios/s390-ccw/netmain: Fix error messages with regards to the TFTP server pc-bios/s390-ccw: Fix boot problem with virtio-net devices pc-bios/s390-ccw/virtio: Add a function to reset a virtio device hw/s390x: Fix crash that occurs when inspecting older versioned machines types crypto: fix bogus error benchmarking pbkdf on fast machines MAINTAINERS: Remove myself as Avocado Framework reviewer tests/functional: Convert the kvm_xen_guest avocado test Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 parents 32a97c5 + 9744ceb commit cf86770

File tree

11 files changed

+128
-77
lines changed

11 files changed

+128
-77
lines changed

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ S: Supported
489489
F: include/system/kvm_xen.h
490490
F: target/i386/kvm/xen*
491491
F: hw/i386/kvm/xen*
492-
F: tests/avocado/kvm_xen_guest.py
492+
F: tests/functional/test_x86_64_kvm_xen.py
493493

494494
Guest CPU Cores (other accelerators)
495495
------------------------------------
@@ -4207,7 +4207,6 @@ F: tests/tcg/Makefile.target
42074207
Integration Testing with the Avocado framework
42084208
W: https://trello.com/b/6Qi1pxVn/avocado-qemu
42094209
R: Cleber Rosa <crosa@redhat.com>
4210-
R: Philippe Mathieu-Daudé <philmd@linaro.org>
42114210
S: Odd Fixes
42124211
F: tests/avocado/
42134212

crypto/pbkdf.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void *threaded_qcrypto_pbkdf2_count_iters(void *data)
107107
size_t nsalt = iters_data->nsalt;
108108
size_t nout = iters_data->nout;
109109
Error **errp = iters_data->errp;
110-
110+
size_t scaled = 0;
111111
uint64_t ret = -1;
112112
g_autofree uint8_t *out = g_new(uint8_t, nout);
113113
uint64_t iterations = (1 << 15);
@@ -131,7 +131,17 @@ static void *threaded_qcrypto_pbkdf2_count_iters(void *data)
131131

132132
delta_ms = end_ms - start_ms;
133133

134-
if (delta_ms == 0) { /* sanity check */
134+
/*
135+
* For very small 'iterations' values, CPU (or crypto
136+
* accelerator) might be fast enough that the scheduler
137+
* hasn't incremented getrusage() data, or incremented
138+
* it by a very small amount, resulting in delta_ms == 0.
139+
* Once we've scaled 'iterations' x10, 5 times, we really
140+
* should be seeing delta_ms != 0, so sanity check at
141+
* that point.
142+
*/
143+
if (scaled > 5 &&
144+
delta_ms == 0) { /* sanity check */
135145
error_setg(errp, "Unable to get accurate CPU usage");
136146
goto cleanup;
137147
} else if (delta_ms > 500) {
@@ -141,6 +151,7 @@ static void *threaded_qcrypto_pbkdf2_count_iters(void *data)
141151
} else {
142152
iterations = (iterations * 1000 / delta_ms);
143153
}
154+
scaled++;
144155
}
145156

146157
iterations = iterations * 1000 / delta_ms;

hw/s390x/s390-virtio-ccw.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
782782

783783
s390mc->hpage_1m_allowed = true;
784784
s390mc->max_threads = 1;
785-
mc->init = ccw_init;
786785
mc->reset = s390_machine_reset;
787786
mc->block_default_type = IF_VIRTIO;
788787
mc->no_cdrom = 1;
@@ -852,31 +851,31 @@ static const TypeInfo ccw_machine_info = {
852851
};
853852

854853
#define DEFINE_CCW_MACHINE_IMPL(latest, ...) \
854+
static void MACHINE_VER_SYM(mach_init, ccw, __VA_ARGS__)(MachineState *mach) \
855+
{ \
856+
current_mc = S390_CCW_MACHINE_CLASS(MACHINE_GET_CLASS(mach)); \
857+
MACHINE_VER_SYM(instance_options, ccw, __VA_ARGS__)(mach); \
858+
ccw_init(mach); \
859+
} \
855860
static void MACHINE_VER_SYM(class_init, ccw, __VA_ARGS__)( \
856861
ObjectClass *oc, \
857862
void *data) \
858863
{ \
859864
MachineClass *mc = MACHINE_CLASS(oc); \
860865
MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \
861866
mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \
867+
mc->init = MACHINE_VER_SYM(mach_init, ccw, __VA_ARGS__); \
862868
MACHINE_VER_DEPRECATION(__VA_ARGS__); \
863869
if (latest) { \
864870
mc->alias = "s390-ccw-virtio"; \
865871
mc->is_default = true; \
866872
} \
867873
} \
868-
static void MACHINE_VER_SYM(instance_init, ccw, __VA_ARGS__)(Object *obj) \
869-
{ \
870-
MachineState *machine = MACHINE(obj); \
871-
current_mc = S390_CCW_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
872-
MACHINE_VER_SYM(instance_options, ccw, __VA_ARGS__)(machine); \
873-
} \
874874
static const TypeInfo MACHINE_VER_SYM(info, ccw, __VA_ARGS__) = \
875875
{ \
876876
.name = MACHINE_VER_TYPE_NAME("s390-ccw-virtio", __VA_ARGS__), \
877877
.parent = TYPE_S390_CCW_MACHINE, \
878878
.class_init = MACHINE_VER_SYM(class_init, ccw, __VA_ARGS__), \
879-
.instance_init = MACHINE_VER_SYM(instance_init, ccw, __VA_ARGS__), \
880879
}; \
881880
static void MACHINE_VER_SYM(register, ccw, __VA_ARGS__)(void) \
882881
{ \

pc-bios/s390-ccw.img

16 KB
Binary file not shown.

pc-bios/s390-ccw/bootmap.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr,
336336

337337
debug_print_int("loadparm", loadparm);
338338
if (loadparm >= MAX_BOOT_ENTRIES) {
339-
puts("loadparm value greater than max number of boot entries allowed");
340-
return -EINVAL;
339+
panic("loadparm value greater than max number of boot entries allowed");
341340
}
342341

343342
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -348,8 +347,8 @@ static int run_eckd_boot_script(block_number_t bmt_block_nr,
348347

349348
block_nr = gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl);
350349
if (block_nr == NULL_BLOCK_NR) {
351-
puts("Cannot find Boot Map Table Entry");
352-
return -EIO;
350+
printf("The requested boot entry (%d) is invalid\n", loadparm);
351+
panic("Invalid loadparm");
353352
}
354353

355354
memset(sec, FREE_SPACE_FILLER, sizeof(sec));
@@ -792,8 +791,12 @@ static int ipl_scsi(void)
792791

793792
debug_print_int("loadparm", loadparm);
794793
if (loadparm >= MAX_BOOT_ENTRIES) {
795-
puts("loadparm value greater than max number of boot entries allowed");
796-
return -EINVAL;
794+
panic("loadparm value greater than max number of boot entries allowed");
795+
}
796+
797+
if (!valid_entries[loadparm]) {
798+
printf("The requested boot entry (%d) is invalid\n", loadparm);
799+
panic("Invalid loadparm");
797800
}
798801

799802
return zipl_run(&prog_table->entry[loadparm].scsi);

pc-bios/s390-ccw/netmain.c

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,10 @@ static int tftp_load(filename_ip_t *fnip, void *buffer, int len)
153153
return rc;
154154
}
155155

156-
static int net_init(filename_ip_t *fn_ip)
156+
static int net_init_ip(filename_ip_t *fn_ip)
157157
{
158158
int rc;
159159

160-
memset(fn_ip, 0, sizeof(filename_ip_t));
161-
162-
rc = virtio_net_init(mac);
163-
if (rc < 0) {
164-
puts("Could not initialize network device");
165-
return -101;
166-
}
167-
fn_ip->fd = rc;
168-
169160
printf(" Using MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n",
170161
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
171162

@@ -177,6 +168,14 @@ static int net_init(filename_ip_t *fn_ip)
177168
if (fn_ip->ip_version == 4) {
178169
set_ipv4_address(fn_ip->own_ip);
179170
}
171+
} else if (rc == -2) {
172+
printf("ARP request to TFTP server (%d.%d.%d.%d) failed\n",
173+
(fn_ip->server_ip >> 24) & 0xFF, (fn_ip->server_ip >> 16) & 0xFF,
174+
(fn_ip->server_ip >> 8) & 0xFF, fn_ip->server_ip & 0xFF);
175+
return -102;
176+
} else if (rc == -4 || rc == -3) {
177+
puts("Can't obtain TFTP server IP address");
178+
return -107;
180179
} else {
181180
puts("Could not get IP address");
182181
return -101;
@@ -192,17 +191,6 @@ static int net_init(filename_ip_t *fn_ip)
192191
printf(" Using IPv6 address: %s\n", ip6_str);
193192
}
194193

195-
if (rc == -2) {
196-
printf("ARP request to TFTP server (%d.%d.%d.%d) failed\n",
197-
(fn_ip->server_ip >> 24) & 0xFF, (fn_ip->server_ip >> 16) & 0xFF,
198-
(fn_ip->server_ip >> 8) & 0xFF, fn_ip->server_ip & 0xFF);
199-
return -102;
200-
}
201-
if (rc == -4 || rc == -3) {
202-
puts("Can't obtain TFTP server IP address");
203-
return -107;
204-
}
205-
206194
printf(" Using TFTP server: ");
207195
if (fn_ip->ip_version == 4) {
208196
printf("%d.%d.%d.%d\n",
@@ -221,11 +209,33 @@ static int net_init(filename_ip_t *fn_ip)
221209
return rc;
222210
}
223211

212+
static int net_init(filename_ip_t *fn_ip)
213+
{
214+
int rc;
215+
216+
memset(fn_ip, 0, sizeof(filename_ip_t));
217+
218+
rc = virtio_net_init(mac);
219+
if (rc < 0) {
220+
puts("Could not initialize network device");
221+
return -101;
222+
}
223+
fn_ip->fd = rc;
224+
225+
rc = net_init_ip(fn_ip);
226+
if (rc < 0) {
227+
virtio_net_deinit();
228+
}
229+
230+
return rc;
231+
}
232+
224233
static void net_release(filename_ip_t *fn_ip)
225234
{
226235
if (fn_ip->ip_version == 4) {
227236
dhcp_send_release(fn_ip->fd);
228237
}
238+
virtio_net_deinit();
229239
}
230240

231241
/**

pc-bios/s390-ccw/virtio-net.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,8 @@ int recv(int fd, void *buf, int maxlen, int flags)
140140

141141
return len;
142142
}
143+
144+
void virtio_net_deinit(void)
145+
{
146+
virtio_reset(virtio_get_device());
147+
}

pc-bios/s390-ccw/virtio.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd)
217217
return 0;
218218
}
219219

220+
int virtio_reset(VDev *vdev)
221+
{
222+
return run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false);
223+
}
224+
220225
int virtio_setup_ccw(VDev *vdev)
221226
{
222227
int i, cfg_size = 0;
@@ -235,7 +240,7 @@ int virtio_setup_ccw(VDev *vdev)
235240
vdev->config.blk.blk_size = 0; /* mark "illegal" - setup started... */
236241
vdev->guessed_disk_nature = VIRTIO_GDN_NONE;
237242

238-
run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false);
243+
virtio_reset(vdev);
239244

240245
status = VIRTIO_CONFIG_S_ACKNOWLEDGE;
241246
if (run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false)) {

pc-bios/s390-ccw/virtio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,10 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags);
274274
int vr_poll(VRing *vr);
275275
int vring_wait_reply(void);
276276
int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd);
277+
int virtio_reset(VDev *vdev);
277278
int virtio_setup_ccw(VDev *vdev);
278279

279280
int virtio_net_init(void *mac_addr);
281+
void virtio_net_deinit(void);
280282

281283
#endif /* VIRTIO_H */

tests/functional/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ test_timeouts = {
4444
'riscv64_tuxrun' : 120,
4545
's390x_ccw_virtio' : 420,
4646
'sh4_tuxrun' : 240,
47+
'x86_64_kvm_xen' : 180,
4748
}
4849

4950
tests_generic_system = [
@@ -244,6 +245,7 @@ tests_x86_64_system_thorough = [
244245
'netdev_ethtool',
245246
'virtio_gpu',
246247
'x86_64_hotplug_cpu',
248+
'x86_64_kvm_xen',
247249
'x86_64_tuxrun',
248250
]
249251

0 commit comments

Comments
 (0)