* e1000e qtest improvements

* Allow TLS PSK tests on win32
 * Increase the timeout of the clang-user CI job
 * Some s390x fixes for QEMU 7.2
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmNn0vMRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbXCoQ/1HXhfnPv/sIjdfJqC0M5/DjpOz2VM/fTb
 g/GGf3EiAlbnK09rjvZA939PAar+MQzBC5YJkn77jX6KFAyeQrQR3xCHIsjgeR+S
 c9v5Ix+OD4WAZHMwQ4XFtK5gxIqYHXY9kkBXqJspPC4BbQRRF4wfLXS5z7Mny7pH
 goz2F2FBCaT+hMK7Z8ibh2trdGEAevCoG6rRRUCkgrURy7mGy4fMiSyXHMOR8OD2
 quxUj+1aq57jdqPGix45pqzRNot6SRkqRuJXruSHJ3nV1ZV1192LiHPA1tUZIPpt
 pKNt2HJwcWJY0letAA9zB/xwwX8GppGrnJq65RKprSZXWLFHevM/jXx44KxPCWAz
 X7ASSpyX2ZW6H6MNyWpt+Bs66x0x6j6XYL0nPU4rmVeGteimnKyzYTcWlOcVA3Zp
 LDov8wIBlxTaQPK9RfrgvdiAR9RnH9OHUiSZVIhl9lJycQr2URLRM6pVXGDhXL/O
 YMe6gxoui8es4blXuMeEJfo1PWrZGsvY+sb0Ixz2+AFO/CT8HQYWVkK6lH2j9ymK
 NjDKmfFmNfzv/JA25CqDhY3/eUjLn3Nej2up9tzJBtddHjaqvaN1EzBpLipX42M1
 +QnfzP6WTimMgP+QznT0Y1OE1irJyAi/jNW7lUWcrtMHqSQSgexuLjljVBgyVZls
 2AyGTz/g+Q==
 =w9Q7
 -----END PGP SIGNATURE-----

Merge tag 'pull-request-2022-11-06' of https://gitlab.com/thuth/qemu into staging

* e1000e qtest improvements
* Allow TLS PSK tests on win32
* Increase the timeout of the clang-user CI job
* Some s390x fixes for QEMU 7.2

# -----BEGIN PGP SIGNATURE-----
#
# iQJEBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmNn0vMRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbXCoQ/1HXhfnPv/sIjdfJqC0M5/DjpOz2VM/fTb
# g/GGf3EiAlbnK09rjvZA939PAar+MQzBC5YJkn77jX6KFAyeQrQR3xCHIsjgeR+S
# c9v5Ix+OD4WAZHMwQ4XFtK5gxIqYHXY9kkBXqJspPC4BbQRRF4wfLXS5z7Mny7pH
# goz2F2FBCaT+hMK7Z8ibh2trdGEAevCoG6rRRUCkgrURy7mGy4fMiSyXHMOR8OD2
# quxUj+1aq57jdqPGix45pqzRNot6SRkqRuJXruSHJ3nV1ZV1192LiHPA1tUZIPpt
# pKNt2HJwcWJY0letAA9zB/xwwX8GppGrnJq65RKprSZXWLFHevM/jXx44KxPCWAz
# X7ASSpyX2ZW6H6MNyWpt+Bs66x0x6j6XYL0nPU4rmVeGteimnKyzYTcWlOcVA3Zp
# LDov8wIBlxTaQPK9RfrgvdiAR9RnH9OHUiSZVIhl9lJycQr2URLRM6pVXGDhXL/O
# YMe6gxoui8es4blXuMeEJfo1PWrZGsvY+sb0Ixz2+AFO/CT8HQYWVkK6lH2j9ymK
# NjDKmfFmNfzv/JA25CqDhY3/eUjLn3Nej2up9tzJBtddHjaqvaN1EzBpLipX42M1
# +QnfzP6WTimMgP+QznT0Y1OE1irJyAi/jNW7lUWcrtMHqSQSgexuLjljVBgyVZls
# 2AyGTz/g+Q==
# =w9Q7
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 06 Nov 2022 10:29:55 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-2022-11-06' of https://gitlab.com/thuth/qemu:
  s390x/cpu topology: add max_threads machine class attribute
  s390x: Register TYPE_S390_CCW_MACHINE properties as class properties
  s390x/pci: RPCIT second pass when mappings exhausted
  s390x/css: revert SCSW ctrl/flag bits on error
  gitlab-ci: increase clang-user timeout
  tests/qtest: migration-test: Enable TLS PSK tests for win32
  tests/qtest: Fix two format strings
  tests/qtest/libqos/e1000e: Use IVAR shift definitions
  tests/qtest/libqos/e1000e: Use E1000_STATUS_ASDV_1000
  tests/qtest/e1000e-test: Use e1000_regs.h
  tests/qtest/libqos/e1000e: Set E1000_CTRL_SLU
  tests/qtest/libqos/e1000e: Refer common PCI ID definitions

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2022-11-07 05:44:44 -05:00
commit cd706454c6
8 changed files with 178 additions and 147 deletions

View file

@ -33,34 +33,11 @@
#include "qemu/bitops.h"
#include "libqos/libqos-malloc.h"
#include "libqos/e1000e.h"
#include "hw/net/e1000_regs.h"
static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *alloc)
{
struct {
uint64_t buffer_addr;
union {
uint32_t data;
struct {
uint16_t length;
uint8_t cso;
uint8_t cmd;
} flags;
} lower;
union {
uint32_t data;
struct {
uint8_t status;
uint8_t css;
uint16_t special;
} fields;
} upper;
} descr;
static const uint32_t dtyp_data = BIT(20);
static const uint32_t dtyp_ext = BIT(29);
static const uint32_t dcmd_rs = BIT(27);
static const uint32_t dcmd_eop = BIT(24);
static const uint32_t dsta_dd = BIT(0);
struct e1000_tx_desc descr;
static const int data_len = 64;
char buffer[64];
int ret;
@ -73,10 +50,10 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
/* Prepare TX descriptor */
memset(&descr, 0, sizeof(descr));
descr.buffer_addr = cpu_to_le64(data);
descr.lower.data = cpu_to_le32(dcmd_rs |
dcmd_eop |
dtyp_ext |
dtyp_data |
descr.lower.data = cpu_to_le32(E1000_TXD_CMD_RS |
E1000_TXD_CMD_EOP |
E1000_TXD_CMD_DEXT |
E1000_TXD_DTYP_D |
data_len);
/* Put descriptor to the ring */
@ -86,7 +63,8 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
e1000e_wait_isr(d, E1000E_TX0_MSG_ID);
/* Check DD bit */
g_assert_cmphex(le32_to_cpu(descr.upper.data) & dsta_dd, ==, dsta_dd);
g_assert_cmphex(le32_to_cpu(descr.upper.data) & E1000_TXD_STAT_DD, ==,
E1000_TXD_STAT_DD);
/* Check data sent to the backend */
ret = recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
@ -101,31 +79,7 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
static void e1000e_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator *alloc)
{
union {
struct {
uint64_t buffer_addr;
uint64_t reserved;
} read;
struct {
struct {
uint32_t mrq;
union {
uint32_t rss;
struct {
uint16_t ip_id;
uint16_t csum;
} csum_ip;
} hi_dword;
} lower;
struct {
uint32_t status_error;
uint16_t length;
uint16_t vlan;
} upper;
} wb;
} descr;
static const uint32_t esta_dd = BIT(0);
union e1000_rx_desc_extended descr;
char test[] = "TEST";
int len = htonl(sizeof(test));
@ -162,7 +116,7 @@ static void e1000e_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator
/* Check DD bit */
g_assert_cmphex(le32_to_cpu(descr.wb.upper.status_error) &
esta_dd, ==, esta_dd);
E1000_RXD_STAT_DD, ==, E1000_RXD_STAT_DD);
/* Check data sent to the backend */
memread(data, buffer, sizeof(buffer));

View file

@ -18,6 +18,7 @@
#include "qemu/osdep.h"
#include "hw/net/e1000_regs.h"
#include "hw/pci/pci_ids.h"
#include "../libqtest.h"
#include "pci-pc.h"
#include "qemu/sockets.h"
@ -29,9 +30,9 @@
#include "e1000e.h"
#define E1000E_IVAR_TEST_CFG \
(E1000E_RX0_MSG_ID | E1000_IVAR_INT_ALLOC_VALID | \
((E1000E_TX0_MSG_ID | E1000_IVAR_INT_ALLOC_VALID) << 8) | \
((E1000E_OTHER_MSG_ID | E1000_IVAR_INT_ALLOC_VALID) << 16) | \
(((E1000E_RX0_MSG_ID | E1000_IVAR_INT_ALLOC_VALID) << E1000_IVAR_RXQ0_SHIFT) | \
((E1000E_TX0_MSG_ID | E1000_IVAR_INT_ALLOC_VALID) << E1000_IVAR_TXQ0_SHIFT) | \
((E1000E_OTHER_MSG_ID | E1000_IVAR_INT_ALLOC_VALID) << E1000_IVAR_OTHER_SHIFT) | \
E1000_IVAR_TX_INT_EVERY_WB)
#define E1000E_RING_LEN (0x1000)
@ -121,7 +122,7 @@ static void e1000e_pci_start_hw(QOSGraphObject *obj)
/* Reset the device */
val = e1000e_macreg_read(&d->e1000e, E1000_CTRL);
e1000e_macreg_write(&d->e1000e, E1000_CTRL, val | E1000_CTRL_RST);
e1000e_macreg_write(&d->e1000e, E1000_CTRL, val | E1000_CTRL_RST | E1000_CTRL_SLU);
/* Enable and configure MSI-X */
qpci_msix_enable(&d->pci_dev);
@ -129,8 +130,8 @@ static void e1000e_pci_start_hw(QOSGraphObject *obj)
/* Check the device status - link and speed */
val = e1000e_macreg_read(&d->e1000e, E1000_STATUS);
g_assert_cmphex(val & (E1000_STATUS_LU | E1000_STATUS_LAN_INIT_DONE),
==, E1000_STATUS_LU | E1000_STATUS_LAN_INIT_DONE);
g_assert_cmphex(val & (E1000_STATUS_LU | E1000_STATUS_ASDV_1000),
==, E1000_STATUS_LU | E1000_STATUS_ASDV_1000);
/* Initialize TX/RX logic */
e1000e_macreg_write(&d->e1000e, E1000_RCTL, 0);
@ -217,8 +218,8 @@ static void *e1000e_pci_create(void *pci_bus, QGuestAllocator *alloc,
static void e1000e_register_nodes(void)
{
QPCIAddress addr = {
.vendor_id = 0x8086,
.device_id = 0x10D3,
.vendor_id = PCI_VENDOR_ID_INTEL,
.device_id = E1000_DEV_ID_82574L,
};
/* FIXME: every test using this node needs to setup a -netdev socket,id=hs0

View file

@ -1402,7 +1402,6 @@ static void test_precopy_unix_dirty_ring(void)
}
#ifdef CONFIG_GNUTLS
#ifndef _WIN32
static void test_precopy_unix_tls_psk(void)
{
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
@ -1415,7 +1414,6 @@ static void test_precopy_unix_tls_psk(void)
test_precopy_common(&args);
}
#endif /* _WIN32 */
#ifdef CONFIG_TASN1
static void test_precopy_unix_tls_x509_default_host(void)
@ -1524,7 +1522,6 @@ static void test_precopy_tcp_plain(void)
}
#ifdef CONFIG_GNUTLS
#ifndef _WIN32
static void test_precopy_tcp_tls_psk_match(void)
{
MigrateCommon args = {
@ -1535,7 +1532,6 @@ static void test_precopy_tcp_tls_psk_match(void)
test_precopy_common(&args);
}
#endif /* _WIN32 */
static void test_precopy_tcp_tls_psk_mismatch(void)
{
@ -1933,7 +1929,6 @@ static void test_multifd_tcp_zstd(void)
#endif
#ifdef CONFIG_GNUTLS
#ifndef _WIN32
static void *
test_migrate_multifd_tcp_tls_psk_start_match(QTestState *from,
QTestState *to)
@ -1941,7 +1936,6 @@ test_migrate_multifd_tcp_tls_psk_start_match(QTestState *from,
test_migrate_precopy_tcp_multifd_start_common(from, to, "none");
return test_migrate_tls_psk_start_match(from, to);
}
#endif /* _WIN32 */
static void *
test_migrate_multifd_tcp_tls_psk_start_mismatch(QTestState *from,
@ -1993,7 +1987,6 @@ test_migrate_multifd_tls_x509_start_reject_anon_client(QTestState *from,
}
#endif /* CONFIG_TASN1 */
#ifndef _WIN32
static void test_multifd_tcp_tls_psk_match(void)
{
MigrateCommon args = {
@ -2003,7 +1996,6 @@ static void test_multifd_tcp_tls_psk_match(void)
};
test_precopy_common(&args);
}
#endif /* _WIN32 */
static void test_multifd_tcp_tls_psk_mismatch(void)
{
@ -2188,7 +2180,7 @@ static void calc_dirty_rate(QTestState *who, uint64_t calc_time)
qobject_unref(qmp_command(who,
"{ 'execute': 'calc-dirty-rate',"
"'arguments': { "
"'calc-time': %ld,"
"'calc-time': %" PRIu64 ","
"'mode': 'dirty-ring' }}",
calc_time));
}
@ -2203,7 +2195,7 @@ static void dirtylimit_set_all(QTestState *who, uint64_t dirtyrate)
qobject_unref(qmp_command(who,
"{ 'execute': 'set-vcpu-dirty-limit',"
"'arguments': { "
"'dirty-rate': %ld } }",
"'dirty-rate': %" PRIu64 " } }",
dirtyrate));
}
@ -2505,10 +2497,8 @@ int main(int argc, char **argv)
qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plain);
qtest_add_func("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle);
#ifdef CONFIG_GNUTLS
#ifndef _WIN32
qtest_add_func("/migration/precopy/unix/tls/psk",
test_precopy_unix_tls_psk);
#endif
if (has_uffd) {
/*
@ -2534,10 +2524,8 @@ int main(int argc, char **argv)
qtest_add_func("/migration/precopy/tcp/plain", test_precopy_tcp_plain);
#ifdef CONFIG_GNUTLS
#ifndef _WIN32
qtest_add_func("/migration/precopy/tcp/tls/psk/match",
test_precopy_tcp_tls_psk_match);
#endif
qtest_add_func("/migration/precopy/tcp/tls/psk/mismatch",
test_precopy_tcp_tls_psk_mismatch);
#ifdef CONFIG_TASN1
@ -2581,10 +2569,8 @@ int main(int argc, char **argv)
test_multifd_tcp_zstd);
#endif
#ifdef CONFIG_GNUTLS
#ifndef _WIN32
qtest_add_func("/migration/multifd/tcp/tls/psk/match",
test_multifd_tcp_tls_psk_match);
#endif
qtest_add_func("/migration/multifd/tcp/tls/psk/mismatch",
test_multifd_tcp_tls_psk_mismatch);
#ifdef CONFIG_TASN1