Skip to content

Commit

Permalink
Merge branch 'qemu:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lzw29107 authored Aug 13, 2024
2 parents 341f47c + 9eb5153 commit 9cfa5c7
Show file tree
Hide file tree
Showing 283 changed files with 9,225 additions and 4,092 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.d/buildtest-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
when: always
before_script:
- JOBS=$(expr $(nproc) + 1)
- cat /packages.txt
script:
- export CCACHE_BASEDIR="$(pwd)"
- export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
Expand Down
2 changes: 2 additions & 0 deletions .gitlab-ci.d/crossbuild-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
key: "$CI_JOB_NAME"
when: always
timeout: 80m
before_script:
- cat /packages.txt
script:
- export CCACHE_BASEDIR="$(pwd)"
- export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
Expand Down
17 changes: 10 additions & 7 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ F: disas/hexagon.c
F: configs/targets/hexagon-linux-user/default.mak
F: docker/dockerfiles/debian-hexagon-cross.docker
F: gdb-xml/hexagon*.xml
T: git https://github.com/quic/qemu.git hex-next

Hexagon idef-parser
M: Alessandro Di Federico <ale@rev.ng>
Expand Down Expand Up @@ -1250,9 +1251,9 @@ F: configs/devices/loongarch64-softmmu/default.mak
F: hw/loongarch/
F: include/hw/loongarch/virt.h
F: include/hw/intc/loongarch_*.h
F: include/hw/intc/loongson_ipi.h
F: include/hw/intc/loongson_ipi_common.h
F: hw/intc/loongarch_*.c
F: hw/intc/loongson_ipi.c
F: hw/intc/loongson_ipi_common.c
F: include/hw/pci-host/ls7a.h
F: hw/rtc/ls7a_rtc.c
F: gdb-xml/loongarch*.xml
Expand Down Expand Up @@ -1386,11 +1387,13 @@ Loongson-3 virtual platforms
M: Huacai Chen <chenhuacai@kernel.org>
R: Jiaxun Yang <jiaxun.yang@flygoat.com>
S: Maintained
F: hw/intc/loongson_ipi_common.c
F: hw/intc/loongson_ipi.c
F: hw/intc/loongson_liointc.c
F: hw/mips/loongson3_bootp.c
F: hw/mips/loongson3_bootp.h
F: hw/mips/loongson3_virt.c
F: include/hw/intc/loongson_ipi_common.h
F: include/hw/intc/loongson_ipi.h
F: include/hw/intc/loongson_liointc.h
F: tests/avocado/machine_mips_loongson3v.py
Expand Down Expand Up @@ -2011,7 +2014,6 @@ F: hw/pci-bridge/*
F: qapi/pci.json
F: docs/pci*
F: docs/specs/*pci*
F: docs/system/sriov.rst

PCIE DOE
M: Huai-Cheng Kuo <hchkuo@avery-design.com.tw>
Expand Down Expand Up @@ -2463,7 +2465,7 @@ S: Maintained
F: hw/net/rocker/
F: qapi/rocker.json
F: tests/rocker/
F: docs/specs/rocker.txt
F: docs/specs/rocker.rst

e1000x
M: Dmitry Fleytman <dmitry.fleytman@gmail.com>
Expand Down Expand Up @@ -3751,7 +3753,7 @@ R: Pierrick Bouvier <pierrick.bouvier@linaro.org>
S: Maintained
F: docs/devel/tcg-plugins.rst
F: plugins/
F: tests/plugin/
F: tests/tcg/plugins/
F: tests/avocado/tcg_plugins.py
F: contrib/plugins/

Expand Down Expand Up @@ -3869,7 +3871,7 @@ F: nbd/
F: include/block/nbd*
F: qemu-nbd.*
F: blockdev-nbd.c
F: docs/interop/nbd.txt
F: docs/interop/nbd.rst
F: docs/tools/qemu-nbd.rst
F: tests/qemu-iotests/tests/*nbd*
T: git https://repo.or.cz/qemu/ericb.git nbd
Expand Down Expand Up @@ -3962,7 +3964,8 @@ L: qemu-block@nongnu.org
S: Supported
F: block/parallels.c
F: block/parallels-ext.c
F: docs/interop/parallels.txt
F: docs/interop/parallels.rst
F: docs/interop/prl-xml.rst
T: git https://src.openvz.org/scm/~den/qemu.git parallels

qed
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.0.50
9.0.91
13 changes: 13 additions & 0 deletions accel/kvm/kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
QLIST_REMOVE(cpu, node);
kvm_fd = cpu->kvm_fd;
g_free(cpu);
break;
}
}

Expand Down Expand Up @@ -398,6 +399,18 @@ int kvm_create_vcpu(CPUState *cpu)
return 0;
}

int kvm_create_and_park_vcpu(CPUState *cpu)
{
int ret = 0;

ret = kvm_create_vcpu(cpu);
if (!ret) {
kvm_park_vcpu(cpu);
}

return ret;
}

static int do_kvm_destroy_vcpu(CPUState *cpu)
{
KVMState *s = kvm_state;
Expand Down
6 changes: 4 additions & 2 deletions block/blkio.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,10 @@ static int blkio_open(BlockDriverState *bs, QDict *options, int flags,
}

bs->supported_write_flags = BDRV_REQ_FUA | BDRV_REQ_REGISTERED_BUF;
bs->supported_zero_flags = BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP |
BDRV_REQ_NO_FALLBACK;
bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK;
#ifdef CONFIG_BLKIO_WRITE_ZEROS_FUA
bs->supported_zero_flags |= BDRV_REQ_FUA;
#endif

qemu_mutex_init(&s->blkio_lock);
qemu_co_mutex_init(&s->bounce_lock);
Expand Down
4 changes: 3 additions & 1 deletion block/block-copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,9 @@ static coroutine_fn int block_copy_task_entry(AioTask *task)
if (s->discard_source && ret == 0) {
int64_t nbytes =
MIN(t->req.offset + t->req.bytes, s->len) - t->req.offset;
bdrv_co_pdiscard(s->source, t->req.offset, nbytes);
WITH_GRAPH_RDLOCK_GUARD() {
bdrv_co_pdiscard(s->source, t->req.offset, nbytes);
}
}

return ret;
Expand Down
3 changes: 2 additions & 1 deletion block/monitor/block-hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
goto exit;
}

nbd_server_start(addr, NULL, NULL, 0, &local_err);
nbd_server_start(addr, NULL, NULL, NBD_DEFAULT_MAX_CONNECTIONS,
&local_err);
qapi_free_SocketAddress(addr);
if (local_err != NULL) {
goto exit;
Expand Down
27 changes: 13 additions & 14 deletions block/vvfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,8 +1369,9 @@ static int open_file(BDRVVVFATState* s,mapping_t* mapping)
return -1;
vvfat_close_current_file(s);
s->current_fd = fd;
s->current_mapping = mapping;
}

s->current_mapping = mapping;
return 0;
}

Expand Down Expand Up @@ -1408,7 +1409,9 @@ static inline int read_cluster(BDRVVVFATState *s,int cluster_num)

assert(s->current_fd);

offset=s->cluster_size*(cluster_num-s->current_mapping->begin)+s->current_mapping->info.file.offset;
offset = s->cluster_size *
((cluster_num - s->current_mapping->begin)
+ s->current_mapping->info.file.offset);
if(lseek(s->current_fd, offset, SEEK_SET)!=offset)
return -3;
s->cluster=s->cluster_buffer;
Expand Down Expand Up @@ -1878,7 +1881,6 @@ get_cluster_count_for_direntry(BDRVVVFATState* s, direntry_t* direntry, const ch

uint32_t cluster_num = begin_of_direntry(direntry);
uint32_t offset = 0;
int first_mapping_index = -1;
mapping_t* mapping = NULL;
const char* basename2 = NULL;

Expand Down Expand Up @@ -1929,8 +1931,9 @@ get_cluster_count_for_direntry(BDRVVVFATState* s, direntry_t* direntry, const ch
(mapping->mode & MODE_DIRECTORY) == 0) {

/* was modified in qcow */
if (offset != mapping->info.file.offset + s->cluster_size
* (cluster_num - mapping->begin)) {
if (offset != s->cluster_size
* ((cluster_num - mapping->begin)
+ mapping->info.file.offset)) {
/* offset of this cluster in file chain has changed */
abort();
copy_it = 1;
Expand All @@ -1939,14 +1942,9 @@ get_cluster_count_for_direntry(BDRVVVFATState* s, direntry_t* direntry, const ch

if (strcmp(basename, basename2))
copy_it = 1;
first_mapping_index = array_index(&(s->mapping), mapping);
}

if (mapping->first_mapping_index != first_mapping_index
&& mapping->info.file.offset > 0) {
abort();
copy_it = 1;
}
assert(mapping->first_mapping_index == -1
|| mapping->info.file.offset > 0);

/* need to write out? */
if (!was_modified && is_file(direntry)) {
Expand Down Expand Up @@ -2404,7 +2402,7 @@ static int commit_mappings(BDRVVVFATState* s,
(mapping->end - mapping->begin);
} else
next_mapping->info.file.offset = mapping->info.file.offset +
mapping->end - mapping->begin;
(mapping->end - mapping->begin);

mapping = next_mapping;
}
Expand Down Expand Up @@ -2525,8 +2523,9 @@ commit_one_file(BDRVVVFATState* s, int dir_index, uint32_t offset)
return -1;
}

for (i = s->cluster_size; i < offset; i += s->cluster_size)
for (i = 0; i < offset; i += s->cluster_size) {
c = modified_fat_get(s, c);
}

fd = qemu_open_old(mapping->path, O_RDWR | O_CREAT | O_BINARY, 0666);
if (fd < 0) {
Expand Down
47 changes: 45 additions & 2 deletions blockdev-nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
#include "io/channel-socket.h"
#include "io/net-listener.h"

typedef struct NBDConn {
QIOChannelSocket *cioc;
QLIST_ENTRY(NBDConn) next;
} NBDConn;

typedef struct NBDServerData {
QIONetListener *listener;
QCryptoTLSCreds *tlscreds;
char *tlsauthz;
uint32_t max_connections;
uint32_t connections;
QLIST_HEAD(, NBDConn) conns;
} NBDServerData;

static NBDServerData *nbd_server;
Expand All @@ -51,6 +57,14 @@ int nbd_server_max_connections(void)

static void nbd_blockdev_client_closed(NBDClient *client, bool ignored)
{
NBDConn *conn = nbd_client_owner(client);

assert(qemu_in_main_thread() && nbd_server);

object_unref(OBJECT(conn->cioc));
QLIST_REMOVE(conn, next);
g_free(conn);

nbd_client_put(client);
assert(nbd_server->connections > 0);
nbd_server->connections--;
Expand All @@ -60,12 +74,20 @@ static void nbd_blockdev_client_closed(NBDClient *client, bool ignored)
static void nbd_accept(QIONetListener *listener, QIOChannelSocket *cioc,
gpointer opaque)
{
NBDConn *conn = g_new0(NBDConn, 1);

assert(qemu_in_main_thread() && nbd_server);
nbd_server->connections++;
object_ref(OBJECT(cioc));
conn->cioc = cioc;
QLIST_INSERT_HEAD(&nbd_server->conns, conn, next);
nbd_update_server_watch(nbd_server);

qio_channel_set_name(QIO_CHANNEL(cioc), "nbd-server");
nbd_client_new(cioc, nbd_server->tlscreds, nbd_server->tlsauthz,
nbd_blockdev_client_closed);
/* TODO - expose handshake timeout as QMP option */
nbd_client_new(cioc, NBD_DEFAULT_HANDSHAKE_MAX_SECS,
nbd_server->tlscreds, nbd_server->tlsauthz,
nbd_blockdev_client_closed, conn);
}

static void nbd_update_server_watch(NBDServerData *s)
Expand All @@ -79,12 +101,25 @@ static void nbd_update_server_watch(NBDServerData *s)

static void nbd_server_free(NBDServerData *server)
{
NBDConn *conn, *tmp;

if (!server) {
return;
}

/*
* Forcefully close the listener socket, and any clients that have
* not yet disconnected on their own.
*/
qio_net_listener_disconnect(server->listener);
object_unref(OBJECT(server->listener));
QLIST_FOREACH_SAFE(conn, &server->conns, next, tmp) {
qio_channel_shutdown(QIO_CHANNEL(conn->cioc), QIO_CHANNEL_SHUTDOWN_BOTH,
NULL);
}

AIO_WAIT_WHILE_UNLOCKED(NULL, server->connections > 0);

if (server->tlscreds) {
object_unref(OBJECT(server->tlscreds));
}
Expand Down Expand Up @@ -168,6 +203,10 @@ void nbd_server_start(SocketAddress *addr, const char *tls_creds,

void nbd_server_start_options(NbdServerOptions *arg, Error **errp)
{
if (!arg->has_max_connections) {
arg->max_connections = NBD_DEFAULT_MAX_CONNECTIONS;
}

nbd_server_start(arg->addr, arg->tls_creds, arg->tls_authz,
arg->max_connections, errp);
}
Expand All @@ -180,6 +219,10 @@ void qmp_nbd_server_start(SocketAddressLegacy *addr,
{
SocketAddress *addr_flat = socket_address_flatten(addr);

if (!has_max_connections) {
max_connections = NBD_DEFAULT_MAX_CONNECTIONS;
}

nbd_server_start(addr_flat, tls_creds, tls_authz, max_connections, errp);
qapi_free_SocketAddress(addr_flat);
}
Expand Down
25 changes: 20 additions & 5 deletions contrib/plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,41 @@ endif

SONAMES := $(addsuffix $(SO_SUFFIX),$(addprefix lib,$(NAMES)))

# The main QEMU uses Glib extensively so it's perfectly fine to use it
# The main QEMU uses Glib extensively so it is perfectly fine to use it
# in plugins (which many example do).
PLUGIN_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
PLUGIN_CFLAGS += -fPIC -Wall
PLUGIN_CFLAGS += -I$(TOP_SRC_PATH)/include/qemu

# Helper that honours V=1 so we get some output when compiling
quiet-@ = $(if $(V),,@$(if $1,printf " %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))
quiet-command = $(call quiet-@,$2,$3)$1

# for including , in command strings
COMMA := ,

all: $(SONAMES)

%.o: %.c
$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
$(call quiet-command, \
$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<, \
BUILD, plugin $@)

ifeq ($(CONFIG_WIN32),y)
lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
$(CC) -shared -o $@ $^ $(LDLIBS)
$(call quiet-command, \
$(CC) -shared -o $@ $^ $(LDLIBS), \
LINK, plugin $@)
else ifeq ($(CONFIG_DARWIN),y)
lib%$(SO_SUFFIX): %.o
$(CC) -bundle -Wl,-undefined,dynamic_lookup -o $@ $^ $(LDLIBS)
$(call quiet-command, \
$(CC) -bundle -Wl$(COMMA)-undefined$(COMMA)dynamic_lookup -o $@ $^ $(LDLIBS), \
LINK, plugin $@)
else
lib%$(SO_SUFFIX): %.o
$(CC) -shared -o $@ $^ $(LDLIBS)
$(call quiet-command, \
$(CC) -shared -o $@ $^ $(LDLIBS), \
LINK, plugin $@)
endif


Expand Down
2 changes: 1 addition & 1 deletion contrib/plugins/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ static void append_stats_line(GString *line,
" %-12" PRIu64 " %-11" PRIu64 " %10.4lf%%",
l2_access,
l2_misses,
l2_access ? l2_miss_rate : 0.0);
l2_miss_rate);
}

g_string_append(line, "\n");
Expand Down
Loading

0 comments on commit 9cfa5c7

Please sign in to comment.