Skip to content

Commit

Permalink
Merge tag 'v9.1.2' into utm-edition
Browse files Browse the repository at this point in the history
v9.1.2 release
  • Loading branch information
osy committed Nov 24, 2024
2 parents d1aea4c + 508081a commit a815a0a
Show file tree
Hide file tree
Showing 130 changed files with 954 additions and 797 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.d/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ variables:
when: manual

# Jobs can run if any jobs they depend on were successful
- if: '$QEMU_JOB_SKIPPED && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
when: on_success
variables:
QEMU_CI_CONTAINER_TAG: $CI_COMMIT_REF_SLUG
Expand Down
2 changes: 2 additions & 0 deletions .gitlab-ci.d/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ build-tcg-disabled:
124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
208 209 216 218 227 234 246 247 248 250 254 255 257 258
260 261 262 263 264 270 272 273 277 279 image-fleecing
- cd ../..
- make distclean

build-user:
extends: .native_build_job_template
Expand Down
5 changes: 2 additions & 3 deletions .gitlab-ci.d/check-dco.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
reponame = os.path.basename(cwd)
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)

print(f"adding upstream git repo @ {repourl}")
subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
subprocess.check_call(["git", "fetch", "check-dco", "master"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
subprocess.check_call(["git", "fetch", "check-dco", "master"])

ancestor = subprocess.check_output(["git", "merge-base",
"check-dco/master", "HEAD"],
Expand Down
5 changes: 2 additions & 3 deletions .gitlab-ci.d/check-patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
reponame = os.path.basename(cwd)
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)

print(f"adding upstream git repo @ {repourl}")
# GitLab CI environment does not give us any direct info about the
# base for the user's branch. We thus need to figure out a common
# ancestor between the user's branch and current git master.
subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
subprocess.check_call(["git", "fetch", "check-patch", "master"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
subprocess.check_call(["git", "fetch", "check-patch", "master"])

ancestor = subprocess.check_output(["git", "merge-base",
"check-patch/master", "HEAD"],
Expand Down
6 changes: 0 additions & 6 deletions .gitlab-ci.d/container-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ arm64-debian-cross-container:
variables:
NAME: debian-arm64-cross

armel-debian-cross-container:
extends: .container_job_template
stage: containers
variables:
NAME: debian-armel-cross

armhf-debian-cross-container:
extends: .container_job_template
stage: containers
Expand Down
7 changes: 0 additions & 7 deletions .gitlab-ci.d/crossbuilds.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
include:
- local: '/.gitlab-ci.d/crossbuild-template.yml'

cross-armel-user:
extends: .cross_user_build_job
needs:
job: armel-debian-cross-container
variables:
IMAGE: debian-armel-cross

cross-armhf-user:
extends: .cross_user_build_job
needs:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.1.0
9.1.2
89 changes: 73 additions & 16 deletions accel/kvm/kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
#define KVM_GUESTDBG_BLOCKIRQ 0
#endif

/* Default num of memslots to be allocated when VM starts */
#define KVM_MEMSLOTS_NR_ALLOC_DEFAULT 16

struct KVMParkedVcpu {
unsigned long vcpu_id;
int kvm_fd;
Expand Down Expand Up @@ -165,6 +168,57 @@ void kvm_resample_fd_notify(int gsi)
}
}

/**
* kvm_slots_grow(): Grow the slots[] array in the KVMMemoryListener
*
* @kml: The KVMMemoryListener* to grow the slots[] array
* @nr_slots_new: The new size of slots[] array
*
* Returns: True if the array grows larger, false otherwise.
*/
static bool kvm_slots_grow(KVMMemoryListener *kml, unsigned int nr_slots_new)
{
unsigned int i, cur = kml->nr_slots_allocated;
KVMSlot *slots;

if (nr_slots_new > kvm_state->nr_slots) {
nr_slots_new = kvm_state->nr_slots;
}

if (cur >= nr_slots_new) {
/* Big enough, no need to grow, or we reached max */
return false;
}

if (cur == 0) {
slots = g_new0(KVMSlot, nr_slots_new);
} else {
assert(kml->slots);
slots = g_renew(KVMSlot, kml->slots, nr_slots_new);
/*
* g_renew() doesn't initialize extended buffers, however kvm
* memslots require fields to be zero-initialized. E.g. pointers,
* memory_size field, etc.
*/
memset(&slots[cur], 0x0, sizeof(slots[0]) * (nr_slots_new - cur));
}

for (i = cur; i < nr_slots_new; i++) {
slots[i].slot = i;
}

kml->slots = slots;
kml->nr_slots_allocated = nr_slots_new;
trace_kvm_slots_grow(cur, nr_slots_new);

return true;
}

static bool kvm_slots_double(KVMMemoryListener *kml)
{
return kvm_slots_grow(kml, kml->nr_slots_allocated * 2);
}

unsigned int kvm_get_max_memslots(void)
{
KVMState *s = KVM_STATE(current_accel());
Expand Down Expand Up @@ -193,15 +247,26 @@ unsigned int kvm_get_free_memslots(void)
/* Called with KVMMemoryListener.slots_lock held */
static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml)
{
KVMState *s = kvm_state;
unsigned int n;
int i;

for (i = 0; i < s->nr_slots; i++) {
for (i = 0; i < kml->nr_slots_allocated; i++) {
if (kml->slots[i].memory_size == 0) {
return &kml->slots[i];
}
}

/*
* If no free slots, try to grow first by doubling. Cache the old size
* here to avoid another round of search: if the grow succeeded, it
* means slots[] now must have the existing "n" slots occupied,
* followed by one or more free slots starting from slots[n].
*/
n = kml->nr_slots_allocated;
if (kvm_slots_double(kml)) {
return &kml->slots[n];
}

return NULL;
}

Expand All @@ -222,10 +287,9 @@ static KVMSlot *kvm_lookup_matching_slot(KVMMemoryListener *kml,
hwaddr start_addr,
hwaddr size)
{
KVMState *s = kvm_state;
int i;

for (i = 0; i < s->nr_slots; i++) {
for (i = 0; i < kml->nr_slots_allocated; i++) {
KVMSlot *mem = &kml->slots[i];

if (start_addr == mem->start_addr && size == mem->memory_size) {
Expand Down Expand Up @@ -267,7 +331,7 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram,
int i, ret = 0;

kvm_slots_lock();
for (i = 0; i < s->nr_slots; i++) {
for (i = 0; i < kml->nr_slots_allocated; i++) {
KVMSlot *mem = &kml->slots[i];

if (ram >= mem->ram && ram < mem->ram + mem->memory_size) {
Expand Down Expand Up @@ -1071,7 +1135,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml,

kvm_slots_lock();

for (i = 0; i < s->nr_slots; i++) {
for (i = 0; i < kml->nr_slots_allocated; i++) {
mem = &kml->slots[i];
/* Discard slots that are empty or do not overlap the section */
if (!mem->memory_size ||
Expand Down Expand Up @@ -1719,12 +1783,8 @@ static void kvm_log_sync_global(MemoryListener *l, bool last_stage)
/* Flush all kernel dirty addresses into KVMSlot dirty bitmap */
kvm_dirty_ring_flush();

/*
* TODO: make this faster when nr_slots is big while there are
* only a few used slots (small VMs).
*/
kvm_slots_lock();
for (i = 0; i < s->nr_slots; i++) {
for (i = 0; i < kml->nr_slots_allocated; i++) {
mem = &kml->slots[i];
if (mem->memory_size && mem->flags & KVM_MEM_LOG_DIRTY_PAGES) {
kvm_slot_sync_dirty_pages(mem);
Expand Down Expand Up @@ -1839,12 +1899,9 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
{
int i;

kml->slots = g_new0(KVMSlot, s->nr_slots);
kml->as_id = as_id;

for (i = 0; i < s->nr_slots; i++) {
kml->slots[i].slot = i;
}
kvm_slots_grow(kml, KVM_MEMSLOTS_NR_ALLOC_DEFAULT);

QSIMPLEQ_INIT(&kml->transaction_add);
QSIMPLEQ_INIT(&kml->transaction_del);
Expand Down Expand Up @@ -2603,7 +2660,7 @@ static int kvm_init(MachineState *ms)
}

kvm_readonly_mem_allowed =
(kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
(kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);

kvm_resamplefds_allowed =
(kvm_check_extension(s, KVM_CAP_IRQFD_RESAMPLE) > 0);
Expand Down
1 change: 1 addition & 0 deletions accel/kvm/trace-events
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ kvm_io_window_exit(void) ""
kvm_run_exit_system_event(int cpu_index, uint32_t event_type) "cpu_index %d, system_even_type %"PRIu32
kvm_convert_memory(uint64_t start, uint64_t size, const char *msg) "start 0x%" PRIx64 " size 0x%" PRIx64 " %s"
kvm_memory_fault(uint64_t start, uint64_t size, uint64_t flags) "start 0x%" PRIx64 " size 0x%" PRIx64 " flags 0x%" PRIx64
kvm_slots_grow(unsigned int old, unsigned int new) "%u -> %u"
4 changes: 4 additions & 0 deletions accel/tcg/plugin-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,8 @@ void plugin_gen_tb_end(CPUState *cpu, size_t num_insns)

/* inject the instrumentation at the appropriate places */
plugin_gen_inject(ptb);

/* reset plugin translation state (plugin_tb is reused between blocks) */
tcg_ctx->plugin_db = NULL;
tcg_ctx->plugin_insn = NULL;
}
2 changes: 1 addition & 1 deletion accel/tcg/user-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ static int probe_access_internal(CPUArchState *env, vaddr addr,
if (guest_addr_valid_untagged(addr)) {
int page_flags = page_get_flags(addr);
if (page_flags & acc_flag) {
if ((acc_flag == PAGE_READ || acc_flag == PAGE_WRITE)
if (access_type != MMU_INST_FETCH
&& cpu_plugin_mem_cbs_enabled(env_cpu(env))) {
return TLB_MMIO;
}
Expand Down
3 changes: 2 additions & 1 deletion block/copy-before-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ typedef struct BDRVCopyBeforeWriteState {

/*
* @frozen_read_reqs: current read requests for fleecing user in bs->file
* node. These areas must not be rewritten by guest.
* node. These areas must not be rewritten by guest. There can be multiple
* overlapping read requests.
*/
BlockReqList frozen_read_reqs;

Expand Down
4 changes: 2 additions & 2 deletions block/raw-format.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ raw_apply_options(BlockDriverState *bs, BDRVRawState *s, uint64_t offset,
if (offset > real_size) {
error_setg(errp, "Offset (%" PRIu64 ") cannot be greater than "
"size of the containing file (%" PRId64 ")",
s->offset, real_size);
offset, real_size);
return -EINVAL;
}

if (has_size && (real_size - offset) < size) {
error_setg(errp, "The sum of offset (%" PRIu64 ") and size "
"(%" PRIu64 ") has to be smaller or equal to the "
" actual size of the containing file (%" PRId64 ")",
s->offset, s->size, real_size);
offset, size, real_size);
return -EINVAL;
}

Expand Down
2 changes: 0 additions & 2 deletions block/reqlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
void reqlist_init_req(BlockReqList *reqs, BlockReq *req, int64_t offset,
int64_t bytes)
{
assert(!reqlist_find_conflict(reqs, offset, bytes));

*req = (BlockReq) {
.offset = offset,
.bytes = bytes,
Expand Down
2 changes: 1 addition & 1 deletion contrib/plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ lib%$(SO_SUFFIX): %.o
endif


clean:
clean distclean:
rm -f *.o *$(SO_SUFFIX) *.d
rm -Rf .libs

Expand Down
7 changes: 5 additions & 2 deletions crypto/cipher-nettle.c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -734,16 +734,19 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
#ifdef CONFIG_CRYPTO_SM4
case QCRYPTO_CIPHER_ALG_SM4:
{
QCryptoNettleSm4 *ctx = g_new0(QCryptoNettleSm4, 1);
QCryptoNettleSm4 *ctx;
const QCryptoCipherDriver *drv;

switch (mode) {
case QCRYPTO_CIPHER_MODE_ECB:
ctx->base.driver = &qcrypto_nettle_sm4_driver_ecb;
drv = &qcrypto_nettle_sm4_driver_ecb;
break;
default:
goto bad_cipher_mode;
}

ctx = g_new0(QCryptoNettleSm4, 1);
ctx->base.driver = drv;
sm4_set_encrypt_key(&ctx->key[0], key);
sm4_set_decrypt_key(&ctx->key[1], key);

Expand Down
2 changes: 1 addition & 1 deletion crypto/pbkdf-gcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
case QCRYPTO_HASH_ALG_SHA384:
case QCRYPTO_HASH_ALG_SHA512:
case QCRYPTO_HASH_ALG_RIPEMD160:
return true;
return qcrypto_hash_supports(hash);
default:
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/pbkdf-gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
case QCRYPTO_HASH_ALG_SHA384:
case QCRYPTO_HASH_ALG_SHA512:
case QCRYPTO_HASH_ALG_RIPEMD160:
return true;
return qcrypto_hash_supports(hash);
default:
return false;
}
Expand Down
Loading

0 comments on commit a815a0a

Please sign in to comment.