Skip to content

Commit

Permalink
Merge tag 'pull-request-2024-01-11' of https://gitlab.com/thuth/qemu
Browse files Browse the repository at this point in the history
…into staging

* Fix non-deterministic failures of the 'netdev-socket' qtest
* Fix device presence checking in the virtio-ccw qtest
* Support codespell checking in checkpatch.pl
* Fix emulation of LAE s390x instruction
* Work around htags bug when environment is large
* Some other small clean-ups here and there

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmWgHlgRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbXAnBAAjQve/Jmfp9p8eQmswG7cl/a2TuJ59b9X
# SFRja2PprV/Wp4kxxEJX4er9F2+rlMusNL62LBp/QjZi9u4lCvCmuB7sMa0wEkjr
# BPPBrkxkAT+/8vhGpYg2GrxZv/UOLkycp3sjEp4v5yXWQw+OEBnkZZ+AuHddpnEr
# NKMKss71uQmccvuzD5FMDfbJQcSBD/yGPyFfDrv1RKreYRlbkEDVlcVoZpfoMwQY
# Pl167iDdmjVtsT+4wf8vHo5W/AYKDOjlV6AoujCnJVZnGx6BtDLiF/iNJ/VU1Ty5
# cRxySPT64HG+cGrbRqz9IjDvs++WW5EQn1jPY8NO2XFz3sney6Cs/pLKjqJY9S7P
# kfOXOBZG3zOI1kgd/CSR5b4szg4XvtTZaupczKiGOpYC9klf0oQNXGU5jXi3Csop
# Q332oUgiPeNdOx/4tXobFX6RwVCqLRYZbHx9RRYSxWlqJJPAB74/n+RZsmOtsxuJ
# RaiPKDmbVlslkUm78gIa5e6DMwDk2wmlkqa64W7VZxyqfQTRDPiPvfMGePkj6tmZ
# h9vUsELwwORlHpZyL08n0fzs3aeIYwzPwhfr+5iQZIawIp4Zqo8i8Lic/WfIlok9
# rmPIA0mjs1VtrUsroItw4NcY04xcVa7hkhz4EbkZROrfGamdkLuvbk2OKuOeoL0U
# lpgtQL6jA7E=
# =F/j2
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 11 Jan 2024 16:59:04 GMT
# 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-2024-01-11' of https://gitlab.com/thuth/qemu:
  .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large
  tests/tcg/s390x: Test LOAD ADDRESS EXTENDED
  target/s390x: Fix LAE setting a wrong access register
  scripts/checkpatch: Support codespell checking
  hw/s390x/ccw: Replace dirname() with g_path_get_dirname()
  hw/s390x/ccw: Replace basename() with g_path_get_basename()
  target/s390x/kvm/pv: Provide some more useful information if decryption fails
  gitlab: fix s390x tag for avocado-system-centos
  tests/qtest/virtio-ccw: Fix device presence checking
  qtest: ensure netdev-socket tests have non-overlapping names
  net: handle QIOTask completion to report useful error message
  net: add explicit info about connecting/listening state
  Revert "tests/qtest/netdev-socket: Raise connection timeout to 120 seconds"
  Revert "osdep: add getloadavg"
  Revert "netdev: set timeout depending on loadavg"
  qtest: use correct boolean type for failover property
  q800: move dp8393x_prom memory region to Q800MachineState

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jan 12, 2024
2 parents 393d5c5 + 52a2168 commit b1b1585
Show file tree
Hide file tree
Showing 19 changed files with 223 additions and 110 deletions.
7 changes: 5 additions & 2 deletions .gitlab-ci.d/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ avocado-system-centos:
variables:
IMAGE: centos8
MAKE_CHECK_ARGS: check-avocado
AVOCADO_TAGS: arch:ppc64 arch:or1k arch:390x arch:x86_64 arch:rx
AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx
arch:sh4 arch:nios2

build-system-opensuse:
Expand Down Expand Up @@ -647,7 +647,10 @@ pages:
- mkdir -p public
# HTML-ised source tree
- make gtags
- htags -anT --tree-view=filetree -m qemu_init
# We unset variables to work around a bug in some htags versions
# which causes it to fail when the environment is large
- CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= htags
-anT --tree-view=filetree -m qemu_init
-t "Welcome to the QEMU sourcecode"
- mv HTML public/src
# Project documentation
Expand Down
7 changes: 3 additions & 4 deletions hw/m68k/q800.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ static void q800_machine_init(MachineState *machine)
int bios_size;
ram_addr_t initrd_base;
int32_t initrd_size;
MemoryRegion *dp8393x_prom = g_new(MemoryRegion, 1);
uint8_t *prom;
int i, checksum;
MacFbMode *macfb_mode;
Expand Down Expand Up @@ -406,13 +405,13 @@ static void q800_machine_init(MachineState *machine)
sysbus_connect_irq(sysbus, 0,
qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_SONIC));

memory_region_init_rom(dp8393x_prom, NULL, "dp8393x-q800.prom",
memory_region_init_rom(&m->dp8393x_prom, NULL, "dp8393x-q800.prom",
SONIC_PROM_SIZE, &error_fatal);
memory_region_add_subregion(get_system_memory(), SONIC_PROM_BASE,
dp8393x_prom);
&m->dp8393x_prom);

/* Add MAC address with valid checksum to PROM */
prom = memory_region_get_ram_ptr(dp8393x_prom);
prom = memory_region_get_ram_ptr(&m->dp8393x_prom);
checksum = 0;
for (i = 0; i < 6; i++) {
prom[i] = revbit8(nd_table[0].macaddr.a[i]);
Expand Down
5 changes: 2 additions & 3 deletions hw/s390x/ipl.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ static void s390_ipl_prepare_qipl(S390CPU *cpu)
cpu_physical_memory_unmap(addr, len, 1, len);
}

int s390_ipl_prepare_pv_header(void)
int s390_ipl_prepare_pv_header(Error **errp)
{
IplParameterBlock *ipib = s390_ipl_get_iplb_pv();
IPLBlockPV *ipib_pv = &ipib->pv;
Expand All @@ -711,8 +711,7 @@ int s390_ipl_prepare_pv_header(void)

cpu_physical_memory_read(ipib_pv->pv_header_addr, hdr,
ipib_pv->pv_header_len);
rc = s390_pv_set_sec_parms((uintptr_t)hdr,
ipib_pv->pv_header_len);
rc = s390_pv_set_sec_parms((uintptr_t)hdr, ipib_pv->pv_header_len, errp);
g_free(hdr);
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion hw/s390x/ipl.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef union IplParameterBlock IplParameterBlock;

int s390_ipl_set_loadparm(uint8_t *loadparm);
void s390_ipl_update_diag308(IplParameterBlock *iplb);
int s390_ipl_prepare_pv_header(void);
int s390_ipl_prepare_pv_header(Error **errp);
int s390_ipl_pv_unpack(void);
void s390_ipl_prepare_cpu(S390CPU *cpu);
IplParameterBlock *s390_ipl_get_iplb(void);
Expand Down
7 changes: 5 additions & 2 deletions hw/s390x/s390-ccw.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
Error **errp)
{
unsigned int cssid, ssid, devid;
char dev_path[PATH_MAX] = {0}, *tmp;
char dev_path[PATH_MAX] = {0};
g_autofree char *tmp_dir = NULL;
g_autofree char *tmp = NULL;

if (!sysfsdev) {
error_setg(errp, "No host device provided");
Expand All @@ -92,7 +94,8 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,

cdev->mdevid = g_path_get_basename(dev_path);

tmp = basename(dirname(dev_path));
tmp_dir = g_path_get_dirname(dev_path);
tmp = g_path_get_basename(tmp_dir);
if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {
error_setg_errno(errp, errno, "Failed to read %s", tmp);
return;
Expand Down
5 changes: 4 additions & 1 deletion hw/s390x/s390-virtio-ccw.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static int s390_machine_protect(S390CcwMachineState *ms)
}

/* Set SE header and unpack */
rc = s390_ipl_prepare_pv_header();
rc = s390_ipl_prepare_pv_header(&local_err);
if (rc) {
goto out_err;
}
Expand All @@ -410,6 +410,9 @@ static int s390_machine_protect(S390CcwMachineState *ms)
return rc;

out_err:
if (local_err) {
error_report_err(local_err);
}
s390_machine_unprotect(ms);
return rc;
}
Expand Down
1 change: 1 addition & 0 deletions include/hw/m68k/q800.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct Q800MachineState {
MOS6522Q800VIA1State via1;
MOS6522Q800VIA2State via2;
dp8393xState dp8393x;
MemoryRegion dp8393x_prom;
ESCCState escc;
OrIRQState escc_orgate;
SysBusESPState esp;
Expand Down
10 changes: 0 additions & 10 deletions include/qemu/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,16 +781,6 @@ static inline int platform_does_not_support_system(const char *command)
}
#endif /* !HAVE_SYSTEM_FUNCTION */

/**
* If the load average was unobtainable, -1 is returned
*/
#ifndef HAVE_GETLOADAVG_FUNCTION
static inline int getloadavg(double loadavg[], int nelem)
{
return -1;
}
#endif /* !HAVE_GETLOADAVG_FUNCTION */

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2343,7 +2343,6 @@ config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice)
config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', dependencies: util))
config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul'))
config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
config_host_data.set('HAVE_GETLOADAVG_FUNCTION', cc.has_function('getloadavg', prefix: '#include <stdlib.h>'))
if rbd.found()
config_host_data.set('HAVE_RBD_NAMESPACE_EXISTS',
cc.has_function('rbd_namespace_exists',
Expand Down
18 changes: 13 additions & 5 deletions net/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ static gboolean net_stream_send(QIOChannel *ioc,
s->ioc_write_tag = 0;
}
if (s->listener) {
qemu_set_info_str(&s->nc, "listening");
qio_net_listener_set_client_func(s->listener, net_stream_listen,
s, NULL);
}
Expand All @@ -173,7 +174,6 @@ static gboolean net_stream_send(QIOChannel *ioc,

net_socket_rs_init(&s->rs, net_stream_rs_finalize, false);
s->nc.link_down = true;
qemu_set_info_str(&s->nc, "%s", "");

qapi_event_send_netdev_stream_disconnected(s->nc.name);
net_stream_arm_reconnect(s);
Expand Down Expand Up @@ -272,9 +272,11 @@ static void net_stream_server_listening(QIOTask *task, gpointer opaque)
QIOChannelSocket *listen_sioc = QIO_CHANNEL_SOCKET(s->listen_ioc);
SocketAddress *addr;
int ret;
Error *err = NULL;

if (listen_sioc->fd < 0) {
qemu_set_info_str(&s->nc, "connection error");
if (qio_task_propagate_error(task, &err)) {
qemu_set_info_str(&s->nc, "error: %s", error_get_pretty(err));
error_free(err);
return;
}

Expand All @@ -292,6 +294,7 @@ static void net_stream_server_listening(QIOTask *task, gpointer opaque)
s->nc.link_down = true;
s->listener = qio_net_listener_new();

qemu_set_info_str(&s->nc, "listening");
net_socket_rs_init(&s->rs, net_stream_rs_finalize, false);
qio_net_listener_set_client_func(s->listener, net_stream_listen, s, NULL);
qio_net_listener_add(s->listener, listen_sioc);
Expand All @@ -309,6 +312,7 @@ static int net_stream_server_init(NetClientState *peer,

nc = qemu_new_net_client(&net_stream_info, peer, model, name);
s = DO_UPCAST(NetStreamState, nc, nc);
qemu_set_info_str(&s->nc, "initializing");

s->listen_ioc = QIO_CHANNEL(listen_sioc);
qio_channel_socket_listen_async(listen_sioc, addr, 0,
Expand All @@ -325,9 +329,11 @@ static void net_stream_client_connected(QIOTask *task, gpointer opaque)
SocketAddress *addr;
gchar *uri;
int ret;
Error *err = NULL;

if (sioc->fd < 0) {
qemu_set_info_str(&s->nc, "connection error");
if (qio_task_propagate_error(task, &err)) {
qemu_set_info_str(&s->nc, "error: %s", error_get_pretty(err));
error_free(err);
goto error;
}

Expand Down Expand Up @@ -382,6 +388,7 @@ static gboolean net_stream_reconnect(gpointer data)
static void net_stream_arm_reconnect(NetStreamState *s)
{
if (s->reconnect && s->timer_tag == 0) {
qemu_set_info_str(&s->nc, "connecting");
s->timer_tag = g_timeout_add_seconds(s->reconnect,
net_stream_reconnect, s);
}
Expand All @@ -400,6 +407,7 @@ static int net_stream_client_init(NetClientState *peer,

nc = qemu_new_net_client(&net_stream_info, peer, model, name);
s = DO_UPCAST(NetStreamState, nc, nc);
qemu_set_info_str(&s->nc, "connecting");

s->ioc = QIO_CHANNEL(sioc);
s->nc.link_down = true;
Expand Down
125 changes: 105 additions & 20 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
my $root;
my %debug;
my $help = 0;
my $codespell = 0;
my $codespellfile = "/usr/share/codespell/dictionary.txt";
my $user_codespellfile = "";

sub help {
my ($exitcode) = @_;
Expand Down Expand Up @@ -66,6 +69,9 @@ sub help {
is all off)
--test-only=WORD report only warnings/errors containing WORD
literally
--codespell Use the codespell dictionary for spelling/typos
(default: $codespellfile)
--codespellfile Use this codespell dictionary
--color[=WHEN] Use colors 'always', 'never', or only when output
is a terminal ('auto'). Default is 'auto'.
-h, --help, --version display this help and exit
Expand All @@ -85,28 +91,50 @@ sub help {
}

GetOptions(
'q|quiet+' => \$quiet,
'tree!' => \$tree,
'signoff!' => \$chk_signoff,
'patch!' => \$chk_patch,
'branch!' => \$chk_branch,
'emacs!' => \$emacs,
'terse!' => \$terse,
'f|file!' => \$file,
'strict!' => \$no_warnings,
'root=s' => \$root,
'summary!' => \$summary,
'mailback!' => \$mailback,
'summary-file!' => \$summary_file,

'debug=s' => \%debug,
'test-only=s' => \$tst_only,
'color=s' => \$color,
'no-color' => sub { $color = 'never'; },
'h|help' => \$help,
'version' => \$help
'q|quiet+' => \$quiet,
'tree!' => \$tree,
'signoff!' => \$chk_signoff,
'patch!' => \$chk_patch,
'branch!' => \$chk_branch,
'emacs!' => \$emacs,
'terse!' => \$terse,
'f|file!' => \$file,
'strict!' => \$no_warnings,
'root=s' => \$root,
'summary!' => \$summary,
'mailback!' => \$mailback,
'summary-file!' => \$summary_file,
'debug=s' => \%debug,
'test-only=s' => \$tst_only,
'codespell!' => \$codespell,
'codespellfile=s' => \$user_codespellfile,
'color=s' => \$color,
'no-color' => sub { $color = 'never'; },
'h|help' => \$help,
'version' => \$help
) or help(1);

if ($user_codespellfile) {
# Use the user provided codespell file unconditionally
$codespellfile = $user_codespellfile;
} elsif (!(-f $codespellfile)) {
# If /usr/share/codespell/dictionary.txt is not present, try to find it
# under codespell's install directory: <codespell_root>/data/dictionary.txt
if (($codespell || $help) && which("python3") ne "") {
my $python_codespell_dict = << "EOF";
import os.path as op
import codespell_lib
codespell_dir = op.dirname(codespell_lib.__file__)
codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt')
print(codespell_file, end='')
EOF

my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;
$codespellfile = $codespell_dict if (-f $codespell_dict);
}
}

help(0) if ($help);

my $exit = 0;
Expand Down Expand Up @@ -337,6 +365,36 @@ sub help {
qr{guintptr},
);

# Load common spelling mistakes and build regular expression list.
my $misspellings;
my %spelling_fix;

if ($codespell) {
if (open(my $spelling, '<', $codespellfile)) {
while (<$spelling>) {
my $line = $_;

$line =~ s/\s*\n?$//g;
$line =~ s/^\s*//g;

next if ($line =~ m/^\s*#/);
next if ($line =~ m/^\s*$/);
next if ($line =~ m/, disabled/i);

$line =~ s/,.*$//;

my ($suspect, $fix) = split(/->/, $line);

$spelling_fix{$suspect} = $fix;
}
close($spelling);
} else {
warn "No codespell typos will be found - file '$codespellfile': $!\n";
}
}

$misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;

# This can be modified by sub possible. Since it can be empty, be careful
# about regexes that always match, because they can cause infinite loops.
our @modifierList = (
Expand Down Expand Up @@ -477,6 +535,18 @@ sub top_of_kernel_tree {
return 1;
}

sub which {
my ($bin) = @_;

foreach my $path (split(/:/, $ENV{PATH})) {
if (-e "$path/$bin") {
return "$path/$bin";
}
}

return "";
}

sub expand_tabs {
my ($str) = @_;

Expand Down Expand Up @@ -1585,6 +1655,21 @@ sub process {
WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
}

# Check for various typo / spelling mistakes
if (defined($misspellings) &&
($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) {
my $typo = $1;
my $blank = copy_spacing($rawline);
my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo);
my $hereptr = "$hereline$ptr\n";
my $typo_fix = $spelling_fix{lc($typo)};
$typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
$typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
WARN("'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $hereptr);
}
}

# ignore non-hunk lines and lines being removed
next if (!$hunk_line || $line =~ /^-/);

Expand Down

0 comments on commit b1b1585

Please sign in to comment.