diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-08-10 10:05:29 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-08-10 10:05:29 +0100 |
commit | 8a6be122e4eec029501a0d61f104fca3a5ae6f30 (patch) | |
tree | a47e36f4fe6dad3c0361032ff552ebb0ce9eb1b6 | |
parent | 54affb3a3623b1d36c95e34faa722a5831323a74 (diff) | |
parent | 24dd1e17696fbd11b3df50718dddcbdfe2c45f24 (diff) | |
download | qemu-8a6be122e4eec029501a0d61f104fca3a5ae6f30.zip qemu-8a6be122e4eec029501a0d61f104fca3a5ae6f30.tar.gz qemu-8a6be122e4eec029501a0d61f104fca3a5ae6f30.tar.bz2 |
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc, vhost: fixes for rc3
Fix up bugs and warnings in tests. Revert an experimental commit that I
put in by mistake: harmless but useless.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Wed 09 Aug 2017 02:23:17 BST
# gpg: using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg: aka "Michael S. Tsirkin <mst@redhat.com>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67
# Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469
* remotes/mst/tags/for_upstream:
libqtest: always set up signal handler for SIGABRT
libvhost-user: quit when no more data received
net: fix -netdev socket,fd= for UDP sockets
Revert "cpu: add APIs to allocate/free CPU environment"
acpi-test: update expected DSDT files
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | contrib/libvhost-user/libvhost-user.c | 4 | ||||
-rw-r--r-- | include/qom/cpu.h | 31 | ||||
-rw-r--r-- | net/socket.c | 37 | ||||
-rw-r--r-- | qom/cpu.c | 34 | ||||
-rw-r--r-- | tests/acpi-test-data/q35/DSDT | bin | 7782 -> 7782 bytes | |||
-rw-r--r-- | tests/acpi-test-data/q35/DSDT.bridge | bin | 7799 -> 7799 bytes | |||
-rw-r--r-- | tests/acpi-test-data/q35/DSDT.cphp | bin | 8245 -> 8245 bytes | |||
-rw-r--r-- | tests/acpi-test-data/q35/DSDT.ipmibt | bin | 7857 -> 7857 bytes | |||
-rw-r--r-- | tests/acpi-test-data/q35/DSDT.memhp | bin | 9147 -> 9147 bytes | |||
-rw-r--r-- | tests/libqtest.c | 2 |
10 files changed, 22 insertions, 86 deletions
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index 9efb9da..35fa0c5 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -161,7 +161,7 @@ vu_message_read(VuDev *dev, int conn_fd, VhostUserMsg *vmsg) rc = recvmsg(conn_fd, &msg, 0); } while (rc < 0 && (errno == EINTR || errno == EAGAIN)); - if (rc <= 0) { + if (rc < 0) { vu_panic(dev, "Error while recvmsg: %s", strerror(errno)); return false; } @@ -806,6 +806,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg) return vu_get_queue_num_exec(dev, vmsg); case VHOST_USER_SET_VRING_ENABLE: return vu_set_vring_enable_exec(dev, vmsg); + case VHOST_USER_NONE: + break; default: vmsg_close_fds(vmsg); vu_panic(dev, "Unhandled request: %d", vmsg->request); diff --git a/include/qom/cpu.h b/include/qom/cpu.h index e9d30c5..25eefea 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -162,10 +162,6 @@ typedef struct CPUClass { void (*dump_statistics)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, int flags); int64_t (*get_arch_id)(CPUState *cpu); - void * (*alloc_env)(CPUState *cpu); - void (*get_env)(CPUState *cpu, void *env); - void (*set_env)(CPUState *cpu, void *env); - void (*free_env)(CPUState *cpu, void *env); bool (*get_paging_enabled)(const CPUState *cpu); void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, Error **errp); @@ -444,33 +440,6 @@ extern bool mttcg_enabled; #define qemu_tcg_mttcg_enabled() (mttcg_enabled) /** - * cpu_alloc_env: allocate CPU environment structure - * @cpu: allocate environment structure for this CPU - */ -void *cpu_alloc_env(CPUState *cpu); - -/** - * cpu_get_env: retrieve CPU environment structure - * @cpu: CPU to use - * @env: environment structure to use - */ -void cpu_get_env(CPUState *cpu, void *env); - -/** - * cpu_set_env: switch to given CPU environment - * @cpu: CPU to use - * @env: environment structure to use - */ -void cpu_set_env(CPUState *cpu, void *env); - -/** - * cpu_free_env: free CPU environment structure - * @cpu: free environment structure for this CPU - * @env: structure to free - */ -void cpu_free_env(CPUState *cpu, void *env); - -/** * cpu_paging_enabled: * @cpu: The CPU whose state is to be inspected. * diff --git a/net/socket.c b/net/socket.c index f85ef7d..18af2ab 100644 --- a/net/socket.c +++ b/net/socket.c @@ -320,11 +320,11 @@ static NetClientInfo net_dgram_socket_info = { static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, const char *model, const char *name, - int fd, int is_connected) + int fd, int is_connected, + const char *mcast) { struct sockaddr_in saddr; int newfd; - socklen_t saddr_len = sizeof(saddr); NetClientState *nc; NetSocketState *s; @@ -333,8 +333,13 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, * by ONLY ONE process: we must "clone" this dgram socket --jjo */ - if (is_connected) { - if (getsockname(fd, (struct sockaddr *) &saddr, &saddr_len) == 0) { + if (is_connected && mcast != NULL) { + if (parse_host_port(&saddr, mcast) < 0) { + fprintf(stderr, + "qemu: error: init_dgram: fd=%d failed parse_host_port()\n", + fd); + goto err; + } /* must be bound */ if (saddr.sin_addr.s_addr == 0) { fprintf(stderr, "qemu: error: init_dgram: fd=%d unbound, " @@ -351,12 +356,6 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer, dup2(newfd, fd); close(newfd); - } else { - fprintf(stderr, - "qemu: error: init_dgram: fd=%d failed getsockname(): %s\n", - fd, strerror(errno)); - goto err; - } } nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name); @@ -432,7 +431,7 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer, static NetSocketState *net_socket_fd_init(NetClientState *peer, const char *model, const char *name, - int fd, int is_connected) + int fd, int is_connected, const char *mc) { int so_type = -1, optlen=sizeof(so_type); @@ -445,7 +444,7 @@ static NetSocketState *net_socket_fd_init(NetClientState *peer, } switch(so_type) { case SOCK_DGRAM: - return net_socket_fd_init_dgram(peer, model, name, fd, is_connected); + return net_socket_fd_init_dgram(peer, model, name, fd, is_connected, mc); case SOCK_STREAM: return net_socket_fd_init_stream(peer, model, name, fd, is_connected); default: @@ -567,7 +566,7 @@ static int net_socket_connect_init(NetClientState *peer, break; } } - s = net_socket_fd_init(peer, model, name, fd, connected); + s = net_socket_fd_init(peer, model, name, fd, connected, NULL); if (!s) return -1; snprintf(s->nc.info_str, sizeof(s->nc.info_str), @@ -602,7 +601,7 @@ static int net_socket_mcast_init(NetClientState *peer, if (fd < 0) return -1; - s = net_socket_fd_init(peer, model, name, fd, 0); + s = net_socket_fd_init(peer, model, name, fd, 0, NULL); if (!s) return -1; @@ -652,7 +651,7 @@ static int net_socket_udp_init(NetClientState *peer, } qemu_set_nonblock(fd); - s = net_socket_fd_init(peer, model, name, fd, 0); + s = net_socket_fd_init(peer, model, name, fd, 0, NULL); if (!s) { return -1; } @@ -675,9 +674,9 @@ int net_init_socket(const Netdev *netdev, const char *name, assert(netdev->type == NET_CLIENT_DRIVER_SOCKET); sock = &netdev->u.socket; - if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mcast + - sock->has_udp != 1) { - error_report("exactly one of fd=, listen=, connect=, mcast= or udp=" + if (sock->has_listen + sock->has_connect + sock->has_mcast + + sock->has_udp > 1) { + error_report("exactly one of listen=, connect=, mcast= or udp=" " is required"); return -1; } @@ -696,7 +695,7 @@ int net_init_socket(const Netdev *netdev, const char *name, return -1; } qemu_set_nonblock(fd); - if (!net_socket_fd_init(peer, "socket", name, fd, 1)) { + if (!net_socket_fd_init(peer, "socket", name, fd, 1, sock->mcast)) { return -1; } return 0; @@ -89,40 +89,6 @@ out: return cpu; } -void *cpu_alloc_env(CPUState *cpu) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - return cc->alloc_env ? cc->alloc_env(cpu) : NULL; -} - -void cpu_get_env(CPUState *cpu, void *env) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->get_env) { - cc->get_env(cpu, env); - } -} - -void cpu_set_env(CPUState *cpu, void *env) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->set_env) { - cc->set_env(cpu, env); - } -} - -void cpu_free_env(CPUState *cpu, void *env) -{ - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->free_env) { - cc->free_env(cpu, env); - } -} - bool cpu_paging_enabled(const CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT Binary files differindex a6138c8..a080e2a 100644 --- a/tests/acpi-test-data/q35/DSDT +++ b/tests/acpi-test-data/q35/DSDT diff --git a/tests/acpi-test-data/q35/DSDT.bridge b/tests/acpi-test-data/q35/DSDT.bridge Binary files differindex 6b90f60..31a7673 100644 --- a/tests/acpi-test-data/q35/DSDT.bridge +++ b/tests/acpi-test-data/q35/DSDT.bridge diff --git a/tests/acpi-test-data/q35/DSDT.cphp b/tests/acpi-test-data/q35/DSDT.cphp Binary files differindex 976755e..3e23cb6 100644 --- a/tests/acpi-test-data/q35/DSDT.cphp +++ b/tests/acpi-test-data/q35/DSDT.cphp diff --git a/tests/acpi-test-data/q35/DSDT.ipmibt b/tests/acpi-test-data/q35/DSDT.ipmibt Binary files differindex b3fa435..9c5e03f 100644 --- a/tests/acpi-test-data/q35/DSDT.ipmibt +++ b/tests/acpi-test-data/q35/DSDT.ipmibt diff --git a/tests/acpi-test-data/q35/DSDT.memhp b/tests/acpi-test-data/q35/DSDT.memhp Binary files differindex 7341c40..1b7c484 100644 --- a/tests/acpi-test-data/q35/DSDT.memhp +++ b/tests/acpi-test-data/q35/DSDT.memhp diff --git a/tests/libqtest.c b/tests/libqtest.c index 4a5492a..b9a1f18 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -140,8 +140,8 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *data) /* Only install SIGABRT handler once */ if (!abrt_hooks.is_setup) { g_hook_list_init(&abrt_hooks, sizeof(GHook)); - setup_sigabrt_handler(); } + setup_sigabrt_handler(); hook = g_hook_alloc(&abrt_hooks); hook->func = fn; |