* s390x header clean-ups from Philippe

* Rework and improvements of the EINTR handling by Nikita
 * Deprecate the -no-hpet command line option
 * Disable the qtests in the 32-bit Windows CI job again
 * Some other misc fixes here and there
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmO8It8RHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbUwbA//dXgfHy95C1r2nTMDekk09+KkmNB1f6M8
 3HK4ROmmrMT/aP9FwfqMBT7JHM/m4bwOGw0Sula8vfjg9NYGPWuSYjdObWKnrIq/
 YORoTxqak9c98Co06EQbAfWn3Pj0ifQkX+FIyzcNGhu4856FWdBsMuyq52VLi36q
 Z8ruSOmclzluoIB3mVYY/s5J7ED2A3K0h39frKLE9FGsKObX10KWj+MZyDHi9oGZ
 ucTHai12OXgNghjlrwI0BqJziih4NxfIWs0JovSo3cN0at7m57G5JChjR38zTMNT
 2Q46tDKoIXesY1GUmVuIgJ5F1Uoshc8Pz5qBSQ5mUbZUQMpivhFrEB666wsYmPd1
 M/YwnZ+PFhWjem7p28fKmnmkeATvE0S+vMDifTVZ880nmAbyUm1vFKfqV6r2mBrT
 p4iXfh/9easFfJWHueU4fBwyMndDGRaCRJnP8KQ5I9yb0WZbt+/0k/y8CQD8Oxr7
 dNFFFoY3KnIO9DCRO5Wr+3OqUgtSAQyhBDf5V2wSMCFrwPHKsvWKSbdiWR3Qe4ck
 41InWgawB3xx57+vXraDUA10+nBZ1VrM92ObqfLPTFqjLCom6Fm85cG4YFRLIvRt
 rdlOC+ScpeVpec7MwcHrScGL0HmUgPnShDAo07pRy4oKK+c89sXzdAFf2nYJTAWS
 WCuChrn7VFM=
 =D+Yw
 -----END PGP SIGNATURE-----

Merge tag 'pull-request-2023-01-09' of https://gitlab.com/thuth/qemu into staging

* s390x header clean-ups from Philippe
* Rework and improvements of the EINTR handling by Nikita
* Deprecate the -no-hpet command line option
* Disable the qtests in the 32-bit Windows CI job again
* Some other misc fixes here and there

# gpg: Signature made Mon 09 Jan 2023 14:21:19 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-2023-01-09' of https://gitlab.com/thuth/qemu:
  .gitlab-ci.d/windows: Do not run the qtests in the msys2-32bit job
  error handling: Use RETRY_ON_EINTR() macro where applicable
  Refactoring: refactor TFR() macro to RETRY_ON_EINTR()
  docs/interop: Change the vnc-ledstate-Pseudo-encoding doc into .rst
  i386: Deprecate the -no-hpet QEMU command line option
  tests/qtest/bios-tables-test: Replace -no-hpet with hpet=off machine parameter
  tests/readconfig: spice doesn't support unix socket on windows yet
  target/s390x: Restrict sysemu/reset.h to system emulation
  target/s390x/tcg/excp_helper: Restrict system headers to sysemu
  target/s390x/tcg/misc_helper: Remove unused "memory.h" include
  hw/s390x/pv: Restrict Protected Virtualization to sysemu
  exec/memory: Expose memory_region_access_valid()
  MAINTAINERS: Add MIPS-related docs and configs to the MIPS architecture section
  tests/vm: Update get_default_jobs() to work on non-x86_64 non-KVM hosts
  qemu-iotests/stream-under-throttle: do not shutdown QEMU

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2023-01-09 15:54:31 +00:00
commit aa96ab7c9d
39 changed files with 122 additions and 123 deletions

View File

@ -116,4 +116,5 @@ msys2-32bit:
- ..\msys64\usr\bin\bash -lc '../configure --target-list=ppc64-softmmu - ..\msys64\usr\bin\bash -lc '../configure --target-list=ppc64-softmmu
--disable-opengl' --disable-opengl'
- ..\msys64\usr\bin\bash -lc 'make' - ..\msys64\usr\bin\bash -lc 'make'
- ..\msys64\usr\bin\bash -lc 'make check || { cat meson-logs/testlog.txt; exit 1; } ;' - ..\msys64\usr\bin\bash -lc 'make check MTESTARGS=\"--no-suite qtest\" ||
{ cat meson-logs/testlog.txt; exit 1; }'

View File

@ -113,6 +113,8 @@ M: Philippe Mathieu-Daudé <philmd@linaro.org>
R: Jiaxun Yang <jiaxun.yang@flygoat.com> R: Jiaxun Yang <jiaxun.yang@flygoat.com>
S: Odd Fixes S: Odd Fixes
K: ^Subject:.*(?i)mips K: ^Subject:.*(?i)mips
F: docs/system/target-mips.rst
F: configs/targets/mips*
Guest CPU cores (TCG) Guest CPU cores (TCG)
--------------------- ---------------------

View File

@ -1229,9 +1229,7 @@ static int hdev_get_max_segments(int fd, struct stat *st)
ret = -errno; ret = -errno;
goto out; goto out;
} }
do { ret = RETRY_ON_EINTR(read(sysfd, buf, sizeof(buf) - 1));
ret = read(sysfd, buf, sizeof(buf) - 1);
} while (ret == -1 && errno == EINTR);
if (ret < 0) { if (ret < 0) {
ret = -errno; ret = -errno;
goto out; goto out;
@ -1379,9 +1377,9 @@ static int handle_aiocb_ioctl(void *opaque)
RawPosixAIOData *aiocb = opaque; RawPosixAIOData *aiocb = opaque;
int ret; int ret;
do { ret = RETRY_ON_EINTR(
ret = ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf); ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf)
} while (ret == -1 && errno == EINTR); );
if (ret == -1) { if (ret == -1) {
return -errno; return -errno;
} }
@ -1463,18 +1461,17 @@ static ssize_t handle_aiocb_rw_vector(RawPosixAIOData *aiocb)
{ {
ssize_t len; ssize_t len;
do { len = RETRY_ON_EINTR(
if (aiocb->aio_type & QEMU_AIO_WRITE) (aiocb->aio_type & QEMU_AIO_WRITE) ?
len = qemu_pwritev(aiocb->aio_fildes, qemu_pwritev(aiocb->aio_fildes,
aiocb->io.iov, aiocb->io.iov,
aiocb->io.niov, aiocb->io.niov,
aiocb->aio_offset); aiocb->aio_offset) :
else qemu_preadv(aiocb->aio_fildes,
len = qemu_preadv(aiocb->aio_fildes,
aiocb->io.iov, aiocb->io.iov,
aiocb->io.niov, aiocb->io.niov,
aiocb->aio_offset); aiocb->aio_offset)
} while (len == -1 && errno == EINTR); );
if (len == -1) { if (len == -1) {
return -errno; return -errno;
@ -1899,9 +1896,7 @@ static int allocate_first_block(int fd, size_t max_size)
buf = qemu_memalign(max_align, write_size); buf = qemu_memalign(max_align, write_size);
memset(buf, 0, write_size); memset(buf, 0, write_size);
do { n = RETRY_ON_EINTR(pwrite(fd, buf, write_size, 0));
n = pwrite(fd, buf, write_size, 0);
} while (n == -1 && errno == EINTR);
ret = (n == -1) ? -errno : 0; ret = (n == -1) ? -errno : 0;

View File

@ -198,7 +198,7 @@ int qmp_chardev_open_file_source(char *src, int flags, Error **errp)
{ {
int fd = -1; int fd = -1;
TFR(fd = qemu_open_old(src, flags, 0666)); fd = RETRY_ON_EINTR(qemu_open_old(src, flags, 0666));
if (fd == -1) { if (fd == -1) {
error_setg_file_open(errp, errno, src); error_setg_file_open(errp, errno, src);
} }

View File

@ -131,8 +131,8 @@ static void qemu_chr_open_pipe(Chardev *chr,
filename_in = g_strdup_printf("%s.in", filename); filename_in = g_strdup_printf("%s.in", filename);
filename_out = g_strdup_printf("%s.out", filename); filename_out = g_strdup_printf("%s.out", filename);
TFR(fd_in = qemu_open_old(filename_in, O_RDWR | O_BINARY)); fd_in = RETRY_ON_EINTR(qemu_open_old(filename_in, O_RDWR | O_BINARY));
TFR(fd_out = qemu_open_old(filename_out, O_RDWR | O_BINARY)); fd_out = RETRY_ON_EINTR(qemu_open_old(filename_out, O_RDWR | O_BINARY));
g_free(filename_in); g_free(filename_in);
g_free(filename_out); g_free(filename_out);
if (fd_in < 0 || fd_out < 0) { if (fd_in < 0 || fd_out < 0) {
@ -142,7 +142,9 @@ static void qemu_chr_open_pipe(Chardev *chr,
if (fd_out >= 0) { if (fd_out >= 0) {
close(fd_out); close(fd_out);
} }
TFR(fd_in = fd_out = qemu_open_old(filename, O_RDWR | O_BINARY)); fd_in = fd_out = RETRY_ON_EINTR(
qemu_open_old(filename, O_RDWR | O_BINARY)
);
if (fd_in < 0) { if (fd_in < 0) {
error_setg_file_open(errp, errno, filename); error_setg_file_open(errp, errno, filename);
return; return;

View File

@ -93,9 +93,7 @@ static void pty_chr_update_read_handler(Chardev *chr)
pfd.fd = fioc->fd; pfd.fd = fioc->fd;
pfd.events = G_IO_OUT; pfd.events = G_IO_OUT;
pfd.revents = 0; pfd.revents = 0;
do { rc = RETRY_ON_EINTR(g_poll(&pfd, 1, 0));
rc = g_poll(&pfd, 1, 0);
} while (rc == -1 && errno == EINTR);
assert(rc >= 0); assert(rc >= 0);
if (pfd.revents & G_IO_HUP) { if (pfd.revents & G_IO_HUP) {

View File

@ -93,6 +93,12 @@ form is preferred.
Using ``-drive if=none`` to configure the OTP device of the sifive_u Using ``-drive if=none`` to configure the OTP device of the sifive_u
RISC-V machine is deprecated. Use ``-drive if=pflash`` instead. RISC-V machine is deprecated. Use ``-drive if=pflash`` instead.
``-no-hpet`` (since 8.0)
''''''''''''''''''''''''
The HPET setting has been turned into a machine property.
Use ``-machine hpet=off`` instead.
QEMU Machine Protocol (QMP) commands QEMU Machine Protocol (QMP) commands
------------------------------------ ------------------------------------

View File

@ -23,3 +23,4 @@ are useful for making QEMU interoperate with other software.
vhost-user-gpu vhost-user-gpu
vhost-vdpa vhost-vdpa
virtio-balloon-stats virtio-balloon-stats
vnc-ledstate-pseudo-encoding

View File

@ -470,9 +470,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
if (fd == -1) { if (fd == -1) {
return -1; return -1;
} }
do { tsize = RETRY_ON_EINTR(read(fd, (void *)buf, bufsz));
tsize = read(fd, (void *)buf, bufsz);
} while (tsize == -1 && errno == EINTR);
close_preserve_errno(fd); close_preserve_errno(fd);
} else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) { (fs_ctx->export_flags & V9FS_SM_NONE)) {
@ -908,9 +906,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
} }
/* Write the oldpath (target) to the file. */ /* Write the oldpath (target) to the file. */
oldpath_size = strlen(oldpath); oldpath_size = strlen(oldpath);
do { write_size = RETRY_ON_EINTR(write(fd, (void *)oldpath, oldpath_size));
write_size = write(fd, (void *)oldpath, oldpath_size);
} while (write_size == -1 && errno == EINTR);
close_preserve_errno(fd); close_preserve_errno(fd);
if (write_size != oldpath_size) { if (write_size != oldpath_size) {

View File

@ -13,7 +13,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "exec/memop.h" #include "exec/memop.h"
#include "exec/memory-internal.h" #include "exec/memory.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "sysemu/hw_accel.h" #include "sysemu/hw_accel.h"
#include "hw/pci/pci_device.h" #include "hw/pci/pci_device.h"

View File

@ -38,10 +38,6 @@ void flatview_unref(FlatView *view);
extern const MemoryRegionOps unassigned_mem_ops; extern const MemoryRegionOps unassigned_mem_ops;
bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
unsigned size, bool is_write,
MemTxAttrs attrs);
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section); void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section);
AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv); AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
void address_space_dispatch_compact(AddressSpaceDispatch *d); void address_space_dispatch_compact(AddressSpaceDispatch *d);

View File

@ -2442,6 +2442,10 @@ void memory_global_dirty_log_stop(unsigned int flags);
void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled); void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled);
bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
unsigned size, bool is_write,
MemTxAttrs attrs);
/** /**
* memory_region_dispatch_read: perform a read directly to the specified * memory_region_dispatch_read: perform a read directly to the specified
* MemoryRegion. * MemoryRegion.

View File

@ -251,7 +251,13 @@ void QEMU_ERROR("code path is reachable")
#define ESHUTDOWN 4099 #define ESHUTDOWN 4099
#endif #endif
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) #define RETRY_ON_EINTR(expr) \
(__extension__ \
({ typeof(expr) __result; \
do { \
__result = (expr); \
} while (__result == -1 && errno == EINTR); \
__result; }))
/* time_t may be either 32 or 64 bits depending on the host OS, and /* time_t may be either 32 or 64 bits depending on the host OS, and
* can be either signed or unsigned, so we can't just hardcode a * can be either signed or unsigned, so we can't just hardcode a

View File

@ -240,9 +240,7 @@ static ssize_t net_l2tpv3_receive_dgram_iov(NetClientState *nc,
message.msg_control = NULL; message.msg_control = NULL;
message.msg_controllen = 0; message.msg_controllen = 0;
message.msg_flags = 0; message.msg_flags = 0;
do { ret = RETRY_ON_EINTR(sendmsg(s->fd, &message, 0));
ret = sendmsg(s->fd, &message, 0);
} while ((ret == -1) && (errno == EINTR));
if (ret > 0) { if (ret > 0) {
ret -= s->offset; ret -= s->offset;
} else if (ret == 0) { } else if (ret == 0) {
@ -285,9 +283,7 @@ static ssize_t net_l2tpv3_receive_dgram(NetClientState *nc,
message.msg_control = NULL; message.msg_control = NULL;
message.msg_controllen = 0; message.msg_controllen = 0;
message.msg_flags = 0; message.msg_flags = 0;
do { ret = RETRY_ON_EINTR(sendmsg(s->fd, &message, 0));
ret = sendmsg(s->fd, &message, 0);
} while ((ret == -1) && (errno == EINTR));
if (ret > 0) { if (ret > 0) {
ret -= s->offset; ret -= s->offset;
} else if (ret == 0) { } else if (ret == 0) {
@ -434,12 +430,9 @@ static void net_l2tpv3_send(void *opaque)
msgvec = s->msgvec + s->queue_head; msgvec = s->msgvec + s->queue_head;
if (target_count > 0) { if (target_count > 0) {
do { count = RETRY_ON_EINTR(
count = recvmmsg( recvmmsg(s->fd, msgvec, target_count, MSG_DONTWAIT, NULL)
s->fd, );
msgvec,
target_count, MSG_DONTWAIT, NULL);
} while ((count == -1) && (errno == EINTR));
if (count < 0) { if (count < 0) {
/* Recv error - we still need to flush packets here, /* Recv error - we still need to flush packets here,
* (re)set queue head to current position * (re)set queue head to current position

View File

@ -117,15 +117,13 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,
NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc); NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
ssize_t ret; ssize_t ret;
do { ret = RETRY_ON_EINTR(
if (s->dgram_dst.sin_family != AF_UNIX) { s->dgram_dst.sin_family != AF_UNIX ?
ret = sendto(s->fd, buf, size, 0, sendto(s->fd, buf, size, 0,
(struct sockaddr *)&s->dgram_dst, (struct sockaddr *)&s->dgram_dst,
sizeof(s->dgram_dst)); sizeof(s->dgram_dst)) :
} else { send(s->fd, buf, size, 0)
ret = send(s->fd, buf, size, 0); );
}
} while (ret == -1 && errno == EINTR);
if (ret == -1 && errno == EAGAIN) { if (ret == -1 && errno == EAGAIN) {
net_socket_write_poll(s, true); net_socket_write_poll(s, true);

View File

@ -56,7 +56,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
} else { } else {
snprintf(dname, sizeof dname, "/dev/tap%d", i); snprintf(dname, sizeof dname, "/dev/tap%d", i);
} }
TFR(fd = open(dname, O_RDWR)); fd = RETRY_ON_EINTR(open(dname, O_RDWR));
if (fd >= 0) { if (fd >= 0) {
break; break;
} }
@ -111,7 +111,7 @@ static int tap_open_clone(char *ifname, int ifname_size, Error **errp)
int fd, s, ret; int fd, s, ret;
struct ifreq ifr; struct ifreq ifr;
TFR(fd = open(PATH_NET_TAP, O_RDWR)); fd = RETRY_ON_EINTR(open(PATH_NET_TAP, O_RDWR));
if (fd < 0) { if (fd < 0) {
error_setg_errno(errp, errno, "could not open %s", PATH_NET_TAP); error_setg_errno(errp, errno, "could not open %s", PATH_NET_TAP);
return -1; return -1;
@ -159,7 +159,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
if (ifname[0] != '\0') { if (ifname[0] != '\0') {
char dname[100]; char dname[100];
snprintf(dname, sizeof dname, "/dev/%s", ifname); snprintf(dname, sizeof dname, "/dev/%s", ifname);
TFR(fd = open(dname, O_RDWR)); fd = RETRY_ON_EINTR(open(dname, O_RDWR));
if (fd < 0 && errno != ENOENT) { if (fd < 0 && errno != ENOENT) {
error_setg_errno(errp, errno, "could not open %s", dname); error_setg_errno(errp, errno, "could not open %s", dname);
return -1; return -1;

View File

@ -45,7 +45,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
int len = sizeof(struct virtio_net_hdr); int len = sizeof(struct virtio_net_hdr);
unsigned int features; unsigned int features;
TFR(fd = open(PATH_NET_TUN, O_RDWR)); fd = RETRY_ON_EINTR(open(PATH_NET_TUN, O_RDWR));
if (fd < 0) { if (fd < 0) {
error_setg_errno(errp, errno, "could not open %s", PATH_NET_TUN); error_setg_errno(errp, errno, "could not open %s", PATH_NET_TUN);
return -1; return -1;

View File

@ -84,13 +84,13 @@ static int tap_alloc(char *dev, size_t dev_size, Error **errp)
if( ip_fd ) if( ip_fd )
close(ip_fd); close(ip_fd);
TFR(ip_fd = open("/dev/udp", O_RDWR, 0)); ip_fd = RETRY_ON_EINTR(open("/dev/udp", O_RDWR, 0));
if (ip_fd < 0) { if (ip_fd < 0) {
error_setg(errp, "Can't open /dev/ip (actually /dev/udp)"); error_setg(errp, "Can't open /dev/ip (actually /dev/udp)");
return -1; return -1;
} }
TFR(tap_fd = open("/dev/tap", O_RDWR, 0)); tap_fd = RETRY_ON_EINTR(open("/dev/tap", O_RDWR, 0));
if (tap_fd < 0) { if (tap_fd < 0) {
error_setg(errp, "Can't open /dev/tap"); error_setg(errp, "Can't open /dev/tap");
return -1; return -1;
@ -104,7 +104,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error **errp)
if ((ppa = ioctl (tap_fd, I_STR, &strioc_ppa)) < 0) if ((ppa = ioctl (tap_fd, I_STR, &strioc_ppa)) < 0)
error_report("Can't assign new interface"); error_report("Can't assign new interface");
TFR(if_fd = open("/dev/tap", O_RDWR, 0)); if_fd = RETRY_ON_EINTR(open("/dev/tap", O_RDWR, 0));
if (if_fd < 0) { if (if_fd < 0) {
error_setg(errp, "Can't open /dev/tap (2)"); error_setg(errp, "Can't open /dev/tap (2)");
return -1; return -1;
@ -137,7 +137,7 @@ static int tap_alloc(char *dev, size_t dev_size, Error **errp)
if (ioctl (ip_fd, I_PUSH, "arp") < 0) if (ioctl (ip_fd, I_PUSH, "arp") < 0)
error_report("Can't push ARP module (3)"); error_report("Can't push ARP module (3)");
/* Open arp_fd */ /* Open arp_fd */
TFR(arp_fd = open ("/dev/tap", O_RDWR, 0)); arp_fd = RETRY_ON_EINTR(open("/dev/tap", O_RDWR, 0));
if (arp_fd < 0) if (arp_fd < 0)
error_report("Can't open %s", "/dev/tap"); error_report("Can't open %s", "/dev/tap");

View File

@ -102,9 +102,7 @@ static ssize_t tap_write_packet(TAPState *s, const struct iovec *iov, int iovcnt
{ {
ssize_t len; ssize_t len;
do { len = RETRY_ON_EINTR(writev(s->fd, iov, iovcnt));
len = writev(s->fd, iov, iovcnt);
} while (len == -1 && errno == EINTR);
if (len == -1 && errno == EAGAIN) { if (len == -1 && errno == EAGAIN) {
tap_write_poll(s, true); tap_write_poll(s, true);
@ -577,9 +575,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
close(sv[1]); close(sv[1]);
do { fd = RETRY_ON_EINTR(recv_fd(sv[0]));
fd = recv_fd(sv[0]);
} while (fd == -1 && errno == EINTR);
saved_errno = errno; saved_errno = errno;
close(sv[0]); close(sv[0]);
@ -650,7 +646,7 @@ static int net_tap_init(const NetdevTapOptions *tap, int *vnet_hdr,
vnet_hdr_required = 0; vnet_hdr_required = 0;
} }
TFR(fd = tap_open(ifname, ifname_sz, vnet_hdr, vnet_hdr_required, fd = RETRY_ON_EINTR(tap_open(ifname, ifname_sz, vnet_hdr, vnet_hdr_required,
mq_required, errp)); mq_required, errp));
if (fd < 0) { if (fd < 0) {
return -1; return -1;

View File

@ -272,7 +272,7 @@ void os_setup_post(void)
error_report("not able to chdir to /: %s", strerror(errno)); error_report("not able to chdir to /: %s", strerror(errno));
exit(1); exit(1);
} }
TFR(fd = qemu_open_old("/dev/null", O_RDWR)); fd = RETRY_ON_EINTR(qemu_open_old("/dev/null", O_RDWR));
if (fd == -1) { if (fd == -1) {
exit(1); exit(1);
} }

View File

@ -2545,7 +2545,7 @@ DEF("no-hpet", 0, QEMU_OPTION_no_hpet,
"-no-hpet disable HPET\n", QEMU_ARCH_I386) "-no-hpet disable HPET\n", QEMU_ARCH_I386)
SRST SRST
``-no-hpet`` ``-no-hpet``
Disable HPET support. Disable HPET support. Deprecated, use '-machine hpet=off' instead.
ERST ERST
DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable, DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,

View File

@ -63,9 +63,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp)
*status = 0; *status = 0;
do { rpid = RETRY_ON_EINTR(waitpid(pid, status, 0));
rpid = waitpid(pid, status, 0);
} while (rpid == -1 && errno == EINTR);
if (rpid == -1) { if (rpid == -1) {
error_setg_errno(errp, errno, "failed to wait for child (pid: %d)", error_setg_errno(errp, errno, "failed to wait for child (pid: %d)",

View File

@ -317,9 +317,7 @@ static void host_read(CPUState *cs, gdb_syscall_complete_cb complete,
complete(cs, -1, EFAULT); complete(cs, -1, EFAULT);
return; return;
} }
do { ret = RETRY_ON_EINTR(read(gf->hostfd, ptr, len));
ret = read(gf->hostfd, ptr, len);
} while (ret == -1 && errno == EINTR);
if (ret == -1) { if (ret == -1) {
complete(cs, -1, errno); complete(cs, -1, errno);
unlock_user(ptr, buf, 0); unlock_user(ptr, buf, 0);

View File

@ -3259,6 +3259,7 @@ void qemu_init(int argc, char **argv)
qdict_put_str(machine_opts_dict, "acpi", "off"); qdict_put_str(machine_opts_dict, "acpi", "off");
break; break;
case QEMU_OPTION_no_hpet: case QEMU_OPTION_no_hpet:
warn_report("-no-hpet is deprecated, use '-machine hpet=off' instead");
qdict_put_str(machine_opts_dict, "hpet", "off"); qdict_put_str(machine_opts_dict, "hpet", "off");
break; break;
case QEMU_OPTION_no_reboot: case QEMU_OPTION_no_reboot:

View File

@ -26,7 +26,6 @@
#include "s390x-internal.h" #include "s390x-internal.h"
#include "kvm/kvm_s390x.h" #include "kvm/kvm_s390x.h"
#include "sysemu/kvm.h" #include "sysemu/kvm.h"
#include "sysemu/reset.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "trace.h" #include "trace.h"
#include "qapi/qapi-types-machine.h" #include "qapi/qapi-types-machine.h"
@ -35,6 +34,9 @@
#include "fpu/softfloat-helpers.h" #include "fpu/softfloat-helpers.h"
#include "disas/capstone.h" #include "disas/capstone.h"
#include "sysemu/tcg.h" #include "sysemu/tcg.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/reset.h"
#endif
#define CR0_RESET 0xE0UL #define CR0_RESET 0xE0UL
#define CR14_RESET 0xC2000000UL; #define CR14_RESET 0xC2000000UL;

View File

@ -14,7 +14,9 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "cpu_features.h" #include "cpu_features.h"
#ifndef CONFIG_USER_ONLY
#include "hw/s390x/pv.h" #include "hw/s390x/pv.h"
#endif
#define DEF_FEAT(_FEAT, _NAME, _TYPE, _BIT, _DESC) \ #define DEF_FEAT(_FEAT, _NAME, _TYPE, _BIT, _DESC) \
[S390_FEAT_##_FEAT] = { \ [S390_FEAT_##_FEAT] = { \
@ -107,6 +109,7 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
feat = find_next_bit(features, S390_FEAT_MAX, feat + 1); feat = find_next_bit(features, S390_FEAT_MAX, feat + 1);
} }
#ifndef CONFIG_USER_ONLY
if (!s390_is_pv()) { if (!s390_is_pv()) {
return; return;
} }
@ -147,6 +150,7 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
default: default:
return; return;
} }
#endif
} }
void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type, void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,

View File

@ -23,8 +23,8 @@
#include "qemu/qemu-print.h" #include "qemu/qemu-print.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#endif
#include "hw/s390x/pv.h" #include "hw/s390x/pv.h"
#endif
#define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \ #define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
{ \ { \
@ -236,6 +236,7 @@ bool s390_has_feat(S390Feat feat)
return 0; return 0;
} }
#ifndef CONFIG_USER_ONLY
if (s390_is_pv()) { if (s390_is_pv()) {
switch (feat) { switch (feat) {
case S390_FEAT_DIAG_318: case S390_FEAT_DIAG_318:
@ -259,6 +260,7 @@ bool s390_has_feat(S390Feat feat)
break; break;
} }
} }
#endif
return test_bit(feat, cpu->model->features); return test_bit(feat, cpu->model->features);
} }

View File

@ -21,15 +21,15 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/log.h" #include "qemu/log.h"
#include "cpu.h" #include "cpu.h"
#include "s390x-internal.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "qemu/timer.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/cpu_ldst.h" #include "exec/cpu_ldst.h"
#include "hw/s390x/ioinst.h" #include "s390x-internal.h"
#include "exec/address-spaces.h"
#include "tcg_s390x.h" #include "tcg_s390x.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
#include "qemu/timer.h"
#include "exec/address-spaces.h"
#include "hw/s390x/ioinst.h"
#include "hw/s390x/s390_flic.h" #include "hw/s390x/s390_flic.h"
#include "hw/boards.h" #include "hw/boards.h"
#endif #endif

View File

@ -23,7 +23,6 @@
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "cpu.h" #include "cpu.h"
#include "s390x-internal.h" #include "s390x-internal.h"
#include "exec/memory.h"
#include "qemu/host-utils.h" #include "qemu/host-utils.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "qemu/timer.h" #include "qemu/timer.h"

View File

@ -88,6 +88,8 @@ class TestStreamWithThrottle(iotests.QMPTestCase):
'x-iops-total=10000,x-bps-total=104857600') 'x-iops-total=10000,x-bps-total=104857600')
self.vm.add_blockdev(self.vm.qmp_to_opts(blockdev)) self.vm.add_blockdev(self.vm.qmp_to_opts(blockdev))
self.vm.add_device('virtio-blk,iothread=iothr0,drive=throttled-node') self.vm.add_device('virtio-blk,iothread=iothr0,drive=throttled-node')
if iotests.qemu_default_machine == 's390-ccw-virtio':
self.vm.add_args('-no-shutdown')
self.vm.launch() self.vm.launch()
def tearDown(self) -> None: def tearDown(self) -> None:

View File

@ -78,6 +78,7 @@
typedef struct { typedef struct {
bool tcg_only; bool tcg_only;
const char *machine; const char *machine;
const char *machine_param;
const char *variant; const char *variant;
const char *uefi_fl1; const char *uefi_fl1;
const char *uefi_fl2; const char *uefi_fl2;
@ -776,26 +777,29 @@ static char *test_acpi_create_args(test_data *data, const char *params,
* when arm/virt boad starts to support it. * when arm/virt boad starts to support it.
*/ */
if (data->cd) { if (data->cd) {
args = g_strdup_printf("-machine %s %s -accel tcg " args = g_strdup_printf("-machine %s%s %s -accel tcg "
"-nodefaults -nographic " "-nodefaults -nographic "
"-drive if=pflash,format=raw,file=%s,readonly=on " "-drive if=pflash,format=raw,file=%s,readonly=on "
"-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s", "-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s",
data->machine, data->tcg_only ? "" : "-accel kvm", data->machine, data->machine_param ?: "",
data->tcg_only ? "" : "-accel kvm",
data->uefi_fl1, data->uefi_fl2, data->cd, params ? params : ""); data->uefi_fl1, data->uefi_fl2, data->cd, params ? params : "");
} else { } else {
args = g_strdup_printf("-machine %s %s -accel tcg " args = g_strdup_printf("-machine %s%s %s -accel tcg "
"-nodefaults -nographic " "-nodefaults -nographic "
"-drive if=pflash,format=raw,file=%s,readonly=on " "-drive if=pflash,format=raw,file=%s,readonly=on "
"-drive if=pflash,format=raw,file=%s,snapshot=on %s", "-drive if=pflash,format=raw,file=%s,snapshot=on %s",
data->machine, data->tcg_only ? "" : "-accel kvm", data->machine, data->machine_param ?: "",
data->tcg_only ? "" : "-accel kvm",
data->uefi_fl1, data->uefi_fl2, params ? params : ""); data->uefi_fl1, data->uefi_fl2, params ? params : "");
} }
} else { } else {
args = g_strdup_printf("-machine %s %s -accel tcg " args = g_strdup_printf("-machine %s%s %s -accel tcg "
"-net none %s " "-net none %s "
"-drive id=hd0,if=none,file=%s,format=raw " "-drive id=hd0,if=none,file=%s,format=raw "
"-device %s,drive=hd0 ", "-device %s,drive=hd0 ",
data->machine, data->tcg_only ? "" : "-accel kvm", data->machine, data->machine_param ?: "",
data->tcg_only ? "" : "-accel kvm",
params ? params : "", disk, params ? params : "", disk,
data->blkdev ?: "ide-hd"); data->blkdev ?: "ide-hd");
} }
@ -1141,8 +1145,9 @@ static void test_acpi_piix4_tcg_nohpet(void)
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.machine = MACHINE_PC; data.machine = MACHINE_PC;
data.machine_param = ",hpet=off";
data.variant = ".nohpet"; data.variant = ".nohpet";
test_acpi_one("-no-hpet", &data); test_acpi_one(NULL, &data);
free_test_data(&data); free_test_data(&data);
} }
@ -1210,8 +1215,9 @@ static void test_acpi_q35_tcg_nohpet(void)
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.machine = MACHINE_Q35; data.machine = MACHINE_Q35;
data.machine_param = ",hpet=off";
data.variant = ".nohpet"; data.variant = ".nohpet";
test_acpi_one("-no-hpet", &data); test_acpi_one(NULL, &data);
free_test_data(&data); free_test_data(&data);
} }

View File

@ -203,7 +203,7 @@ void qtest_wait_qemu(QTestState *s)
#ifndef _WIN32 #ifndef _WIN32
pid_t pid; pid_t pid;
TFR(pid = waitpid(s->qemu_pid, &s->wstatus, 0)); pid = RETRY_ON_EINTR(waitpid(s->qemu_pid, &s->wstatus, 0));
assert(pid == s->qemu_pid); assert(pid == s->qemu_pid);
#else #else
DWORD ret; DWORD ret;
@ -689,9 +689,7 @@ int qtest_socket_server(const char *socket_path)
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path);
do { ret = RETRY_ON_EINTR(bind(sock, (struct sockaddr *)&addr, sizeof(addr)));
ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr));
} while (ret == -1 && errno == EINTR);
g_assert_cmpint(ret, !=, -1); g_assert_cmpint(ret, !=, -1);
ret = listen(sock, 1); ret = listen(sock, 1);
g_assert_cmpint(ret, !=, -1); g_assert_cmpint(ret, !=, -1);

View File

@ -109,8 +109,10 @@ static void test_spice(void)
QTestState *qts; QTestState *qts;
const char *cfgdata = const char *cfgdata =
"[spice]\n" "[spice]\n"
"disable-ticketing = \"on\"\n" #ifndef WIN32
"unix = \"on\"\n"; "unix = \"on\"\n"
#endif
"disable-ticketing = \"on\"\n";
qts = qtest_init_with_config(cfgdata); qts = qtest_init_with_config(cfgdata);
/* Test valid command */ /* Test valid command */

View File

@ -331,9 +331,7 @@ vubr_backend_recv_cb(int sock, void *ctx)
.msg_iovlen = num, .msg_iovlen = num,
.msg_flags = MSG_DONTWAIT, .msg_flags = MSG_DONTWAIT,
}; };
do { ret = RETRY_ON_EINTR(recvmsg(vubr->backend_udp_sock, &msg, 0));
ret = recvmsg(vubr->backend_udp_sock, &msg, 0);
} while (ret == -1 && (errno == EINTR));
if (i == 0) { if (i == 0) {
iov_restore_front(elem->in_sg, sg, hdrlen); iov_restore_front(elem->in_sg, sg, hdrlen);

View File

@ -569,7 +569,6 @@ def parse_args(vmcls):
# more cores. but only up to a reasonable limit. User # more cores. but only up to a reasonable limit. User
# can always override these limits with --jobs. # can always override these limits with --jobs.
return min(multiprocessing.cpu_count() // 2, 8) return min(multiprocessing.cpu_count() // 2, 8)
else:
return 1 return 1
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(

View File

@ -64,9 +64,7 @@ static void sigfd_handler(void *opaque)
ssize_t len; ssize_t len;
while (1) { while (1) {
do { len = RETRY_ON_EINTR(read(fd, &info, sizeof(info)));
len = read(fd, &info, sizeof(info));
} while (len == -1 && errno == EINTR);
if (len == -1 && errno == EAGAIN) { if (len == -1 && errno == EAGAIN) {
break; break;

View File

@ -244,9 +244,7 @@ static int qemu_lock_fcntl(int fd, int64_t start, int64_t len, int fl_type)
.l_type = fl_type, .l_type = fl_type,
}; };
qemu_probe_lock_ops(); qemu_probe_lock_ops();
do { ret = RETRY_ON_EINTR(fcntl(fd, fcntl_op_setlk, &fl));
ret = fcntl(fd, fcntl_op_setlk, &fl);
} while (ret == -1 && errno == EINTR);
return ret == -1 ? -errno : 0; return ret == -1 ? -errno : 0;
} }

View File

@ -240,9 +240,9 @@ static int qemu_vfio_pci_read_config(QEMUVFIOState *s, void *buf,
s->config_region_info.offset, s->config_region_info.offset,
s->config_region_info.size); s->config_region_info.size);
assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size)); assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size));
do { ret = RETRY_ON_EINTR(
ret = pread(s->device, buf, size, s->config_region_info.offset + ofs); pread(s->device, buf, size, s->config_region_info.offset + ofs)
} while (ret == -1 && errno == EINTR); );
return ret == size ? 0 : -errno; return ret == size ? 0 : -errno;
} }
@ -254,9 +254,9 @@ static int qemu_vfio_pci_write_config(QEMUVFIOState *s, void *buf, int size, int
s->config_region_info.offset, s->config_region_info.offset,
s->config_region_info.size); s->config_region_info.size);
assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size)); assert(QEMU_IS_ALIGNED(s->config_region_info.offset + ofs, size));
do { ret = RETRY_ON_EINTR(
ret = pwrite(s->device, buf, size, s->config_region_info.offset + ofs); pwrite(s->device, buf, size, s->config_region_info.offset + ofs)
} while (ret == -1 && errno == EINTR); );
return ret == size ? 0 : -errno; return ret == size ? 0 : -errno;
} }