From patchwork Wed Jun 17 21:01:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610569 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03721618 for ; Wed, 17 Jun 2020 21:04:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE32E21852 for ; Wed, 17 Jun 2020 21:04:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZUm9OP/p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE32E21852 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:37712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfEp-0004UD-VM for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:04:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDO-0002bL-KJ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:22 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:36356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDJ-0008OM-A1 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:22 -0400 Received: by mail-qk1-x742.google.com with SMTP id 205so3517535qkg.3 for ; Wed, 17 Jun 2020 14:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dhx8kBlipihHAeKCJXfkKKAuD+dwgXnNkcughiZZtFw=; b=ZUm9OP/ppA5whu7a9OgxbPtF42XrPrAo3DlE/0Oi8XdHuGRkCj8ljfQu4IZ+PPMZMx 3SxjAS6qfhPkLmupKJY2PDyYcrZ4hiHz7DgeJEN0v96tLPAWs5SOT3tDE73CHfHAdbVX vGa4A+z+Z4UktE/zkKvJpPgN5+pc0dfddvQ2CuakTgZdfACZyl7VHlyZvRGjEkH/ModE sJ1TSSi5lA09LkKMVhqPO3KaIUzW3TqArcjbwD1DB+uGvBKowxJBDTqKoUxWzMj1jyF1 0zrSrdLyE7JfcAHg6f5DtlFb363BiXBJ9dnc2/GaAL2Cy0Ktrg0Pkpa/hUJbuQo/H+Kw I/oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dhx8kBlipihHAeKCJXfkKKAuD+dwgXnNkcughiZZtFw=; b=ixTWwtW6QqgbzBtqDffgnF2yFjTcLeXvF2y+CZKTlwyf2Pf6bey7KB85afhNrWMPFR z4J3eJoKDLkCTydK0e3O7WMtn7huoyjh9NjKCidgtrl/ZncYn7CbsdxNLNC1MYSeT7sH YZXGMedM3b2XCbjNjUUhHNqBQbYS/hQben32mSUb7JZUhqEuAJmenPOW2/WncJFCzxi8 URANrZOSbTw9NDWIrVenz4CLzl1WCVHSkObTP1L8//qoma2790wz1uaDIa78crZK4WBc qLk19LzqyyP37zoTGKRBqbUOq7eUMG5uQiIvd/XsWj6l3ijFn+/FYlF7CI2SwDMjigmF /Fmw== X-Gm-Message-State: AOAM530bzCxr4F5JavuoOvLBt5AEQu2WMPdvAtvfoY+DVxnd8tYaKKuJ bPRWRKm1v9TJ3uuGHIGGnN9NxOv/GsnUxg== X-Google-Smtp-Source: ABdhPJxc/8ec9dUq51782MJ5+QI5GVOXnnEBtuHcz9MJ3sIgaS9ONS86do7WVTT9iYw9gFmjR4KSyA== X-Received: by 2002:a05:620a:164c:: with SMTP id c12mr500828qko.343.1592427796072; Wed, 17 Jun 2020 14:03:16 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:15 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 01/73] cpu: rename cpu->work_mutex to cpu->lock Date: Wed, 17 Jun 2020 17:01:19 -0400 Message-Id: <20200617210231.4393-2-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This lock will soon protect more fields of the struct. Give it a more appropriate name. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 14 +++++++------- cpus.c | 4 ++-- hw/core/cpu.c | 4 ++-- include/hw/core/cpu.h | 6 ++++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 8f5512b3d7..622430bd33 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -105,10 +105,10 @@ struct qemu_work_item { static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) { - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); QSIMPLEQ_INSERT_TAIL(&cpu->work_list, wi, node); wi->done = false; - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); qemu_cpu_kick(cpu); } @@ -300,15 +300,15 @@ void process_queued_cpu_work(CPUState *cpu) { struct qemu_work_item *wi; - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); return; } while (!QSIMPLEQ_EMPTY(&cpu->work_list)) { wi = QSIMPLEQ_FIRST(&cpu->work_list); QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node); - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); if (wi->exclusive) { /* Running work items outside the BQL avoids the following deadlock: * 1) start_exclusive() is called with the BQL taken while another @@ -324,13 +324,13 @@ void process_queued_cpu_work(CPUState *cpu) } else { wi->func(cpu, wi->data); } - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); if (wi->free) { g_free(wi); } else { atomic_mb_set(&wi->done, true); } } - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); qemu_cond_broadcast(&qemu_work_cond); } diff --git a/cpus.c b/cpus.c index 7317ae06b9..3c011ec452 100644 --- a/cpus.c +++ b/cpus.c @@ -101,9 +101,9 @@ static inline bool cpu_work_list_empty(CPUState *cpu) { bool ret; - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); ret = QSIMPLEQ_EMPTY(&cpu->work_list); - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); return ret; } diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 0f23409f1d..1cba5b6e69 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -369,7 +369,7 @@ static void cpu_common_initfn(Object *obj) cpu->nr_cores = 1; cpu->nr_threads = 1; - qemu_mutex_init(&cpu->work_mutex); + qemu_mutex_init(&cpu->lock); QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); @@ -381,7 +381,7 @@ static void cpu_common_finalize(Object *obj) { CPUState *cpu = CPU(obj); - qemu_mutex_destroy(&cpu->work_mutex); + qemu_mutex_destroy(&cpu->lock); } static int64_t cpu_common_get_arch_id(CPUState *cpu) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index b3f4b79318..afc8081ca8 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -331,7 +331,8 @@ struct qemu_work_item; * @opaque: User data. * @mem_io_pc: Host Program Counter at which the memory was accessed. * @kvm_fd: vCPU file descriptor for KVM. - * @work_mutex: Lock to prevent multiple access to @work_list. + * @lock: Lock to prevent multiple access to per-CPU fields. Must be acquired + * after the BQL. * @work_list: List of pending asynchronous work. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). @@ -375,7 +376,8 @@ struct CPUState { uint64_t random_seed; sigjmp_buf jmp_env; - QemuMutex work_mutex; + QemuMutex lock; + /* fields below protected by @lock */ QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; From patchwork Wed Jun 17 21:01:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3C6290 for ; Wed, 17 Jun 2020 21:06:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CADB121883 for ; Wed, 17 Jun 2020 21:06:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TF8X0jiQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CADB121883 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfGa-0007pK-1b for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:06:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDT-0002eg-Sr for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:29 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:39413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDO-0008Pk-Cr for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:27 -0400 Received: by mail-qt1-x842.google.com with SMTP id k22so2751469qtm.6 for ; Wed, 17 Jun 2020 14:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZYteIUkqExuWadWFdiCSlI10s1/zCIoztEZoLySpuAc=; b=TF8X0jiQLJdX49wvJNWN2EsKmh/+c0yHko7XgtzikAtgnaI0Y4mrYSZxsWOEAUdyWG jq6/qkzab3HtMsOqgl31+2qgEeD+TEhQ4MSIVRo7i/JlEs6g1/FIktPLPJqw2LWR55Sx /MKWheQmtNhLbxe43ti56Me9dvxauU56jaPQ8/j+G2XlMGc7llAM1m9SpPWi+ST+fcMd wuWdLJ9qRjgqZ8tehLZ8CeuHHgr02kT4P+MpgbiAr3ZPB0ANwhKasF4s+wd0CifsXBIA wnXSyVrC8+2GP1e506rLR+QaAAPUA2eE1gBwDI+DzAZlwzt3J8JmdfeKGPF2eNOn6aPM LpcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZYteIUkqExuWadWFdiCSlI10s1/zCIoztEZoLySpuAc=; b=Diw5btKJujA5Vv7YvYixVPfTfqVG54b0tRgQabKZStONKapie6rMvWyyotNIie1GT3 SgQC2dJ2gPin7Gw1pCl/wYzOLrbLRkpS6bUPdIIaei+kPPpuVoxLSkRhmo1q673AA2fA kwP6uVA7lV3y6FcWFHxOM0u3QLEFK8gaerUixEl8iU9DSs+knyIctJtnyDIfAQwYBypf TrhGKDL5TIzgIc/mPrHrYvrxdwOeMaoI5w8y1/S7TPJU9UYZYa5suThuh4nIGFRMww3w b7/6sVcz+WTGKeBA+osx7yH9KBSHPkwykuBikg/Hmjx+MMrIjuPGd5yshxtMUpbIlBSv /QBw== X-Gm-Message-State: AOAM533ukJ1ssuCol39qEo3etRsjEZnkRw9/yKmIgBMZdjha51ac6wtR cwhl+cO8QR/XejtOsjYzf61vPOIyaiaebw== X-Google-Smtp-Source: ABdhPJwKNZlTuHv3C0fd2aFWR3+Sk8y+ypqyE0OxIFFkv3MU6MipIpr1UjAtxHspmxpYi5AUcJ5I9w== X-Received: by 2002:ac8:6f5c:: with SMTP id n28mr1097058qtv.269.1592427797718; Wed, 17 Jun 2020 14:03:17 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:17 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 02/73] cpu: introduce cpu_mutex_lock/unlock Date: Wed, 17 Jun 2020 17:01:20 -0400 Message-Id: <20200617210231.4393-3-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" The few direct users of &cpu->lock will be converted soon. The per-thread bitmap introduced here might seem unnecessary, since a bool could just do. However, once we complete the conversion to per-vCPU locks, we will need to cover the use case where all vCPUs are locked by the same thread, which explains why the bitmap is introduced here. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota [RF: Add assert in smp_parse. Make cpu_mutex_lock stub empty] Signed-off-by: Robert Foley --- cpus.c | 45 +++++++++++++++++++++++++++++++++++++++++-- hw/core/machine.c | 1 + include/hw/core/cpu.h | 36 ++++++++++++++++++++++++++++++++++ stubs/Makefile.objs | 1 + stubs/cpu-lock.c | 20 +++++++++++++++++++ 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 stubs/cpu-lock.c diff --git a/cpus.c b/cpus.c index 3c011ec452..ca271411a4 100644 --- a/cpus.c +++ b/cpus.c @@ -92,6 +92,44 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +/* + * Note: we index the bitmap with cpu->cpu_index + 1 so that the logic + * also works during early CPU initialization, when cpu->cpu_index is set to + * UNASSIGNED_CPU_INDEX == -1. + */ +static __thread DECLARE_BITMAP(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); + +bool no_cpu_mutex_locked(void) +{ + return bitmap_empty(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); +} + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ +/* coverity gets confused by the indirect function call */ +#ifdef __COVERITY__ + qemu_mutex_lock_impl(&cpu->lock, file, line); +#else + QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); + + g_assert(!cpu_mutex_locked(cpu)); + set_bit(cpu->cpu_index + 1, cpu_lock_bitmap); + f(&cpu->lock, file, line); +#endif +} + +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) +{ + g_assert(cpu_mutex_locked(cpu)); + qemu_mutex_unlock_impl(&cpu->lock, file, line); + clear_bit(cpu->cpu_index + 1, cpu_lock_bitmap); +} + +bool cpu_mutex_locked(const CPUState *cpu) +{ + return test_bit(cpu->cpu_index + 1, cpu_lock_bitmap); +} + bool cpu_is_stopped(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); @@ -101,9 +139,9 @@ static inline bool cpu_work_list_empty(CPUState *cpu) { bool ret; - qemu_mutex_lock(&cpu->lock); + cpu_mutex_lock(cpu); ret = QSIMPLEQ_EMPTY(&cpu->work_list); - qemu_mutex_unlock(&cpu->lock); + cpu_mutex_unlock(cpu); return ret; } @@ -1865,6 +1903,9 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line) { QemuMutexLockFunc bql_lock = atomic_read(&qemu_bql_mutex_lock_func); + /* enforce locking order */ + g_assert(no_cpu_mutex_locked()); + g_assert(!qemu_mutex_iothread_locked()); bql_lock(&qemu_global_mutex, file, line); iothread_locked = true; diff --git a/hw/core/machine.c b/hw/core/machine.c index 1d80ab0e1d..74edd3c86d 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -769,6 +769,7 @@ static void smp_parse(MachineState *ms, QemuOpts *opts) ms->smp.threads = threads; ms->smp.sockets = sockets; } + assert(ms->smp.max_cpus <= CPU_LOCK_BITMAP_SIZE); if (ms->smp.cpus > 1) { Error *blocker = NULL; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index afc8081ca8..4d4006f1fb 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -457,6 +457,39 @@ extern CPUTailQ cpus; extern __thread CPUState *current_cpu; +/** + * cpu_mutex_lock - lock a CPU's mutex + * @cpu: the CPU whose mutex is to be locked + * + * To avoid deadlock, a CPU's mutex must be acquired after the BQL. + */ +#define cpu_mutex_lock(cpu) \ + cpu_mutex_lock_impl(cpu, __FILE__, __LINE__) +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line); + +/** + * cpu_mutex_unlock - unlock a CPU's mutex + * @cpu: the CPU whose mutex is to be unlocked + */ +#define cpu_mutex_unlock(cpu) \ + cpu_mutex_unlock_impl(cpu, __FILE__, __LINE__) +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line); + +/** + * cpu_mutex_locked - check whether a CPU's mutex is locked + * @cpu: the CPU of interest + * + * Returns true if the calling thread is currently holding the CPU's mutex. + */ +bool cpu_mutex_locked(const CPUState *cpu); + +/** + * no_cpu_mutex_locked - check whether any CPU mutex is held + * + * Returns true if the calling thread is not holding any CPU mutex. + */ +bool no_cpu_mutex_locked(void); + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; @@ -1184,4 +1217,7 @@ extern const VMStateDescription vmstate_cpu_common; #define UNASSIGNED_CPU_INDEX -1 #define UNASSIGNED_CLUSTER_INDEX -1 +/* XXX: is this really the max number of CPUs? */ +#define CPU_LOCK_BITMAP_SIZE 2048 + #endif diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 28e48171d1..becf8f6986 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -1,6 +1,7 @@ stub-obj-y += blk-commit-all.o stub-obj-y += cpu-get-clock.o stub-obj-y += cpu-get-icount.o +stub-obj-y += cpu-lock.o stub-obj-y += dump.o stub-obj-y += error-printf.o stub-obj-y += fdset.o diff --git a/stubs/cpu-lock.c b/stubs/cpu-lock.c new file mode 100644 index 0000000000..1981a00fb3 --- /dev/null +++ b/stubs/cpu-lock.c @@ -0,0 +1,20 @@ +#include "qemu/osdep.h" +#include "hw/core/cpu.h" + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ +} + +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) +{ +} + +bool cpu_mutex_locked(const CPUState *cpu) +{ + return true; +} + +bool no_cpu_mutex_locked(void) +{ + return true; +} From patchwork Wed Jun 17 21:01:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A3AA60D for ; Wed, 17 Jun 2020 21:06:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F26B12186A for ; Wed, 17 Jun 2020 21:06:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Zt4xqudC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F26B12186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfGi-000892-2c for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:06:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDS-0002dT-2G for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:26 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:36374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDO-0008Pv-Co for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:25 -0400 Received: by mail-qt1-x841.google.com with SMTP id w9so2761265qtv.3 for ; Wed, 17 Jun 2020 14:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pQeS3ErQJYe6lUMZTvW4HI5IzahbrklWfBxpVQvJbIg=; b=Zt4xqudCRQ0OUAqxQ8rsAwSTaiB7Ot9EnCA+XPlHCfM1HpEPiuTaGSlQNU0nM6R9Xk zsqX3HrWFtcYLMkGwt1QkSmVLIrKyj3jLzV6YHigqNioDLLu1PIlxhw7KpT7CgIQfxyC gvSWI5KSo3ZoZCU3Y6d9+6H33bnrC51Wp004WhWtTQ+/tHxbajTZsk0NemVmPNI+0NLJ k1cW6nIIXIHSEBbCWywd8U+Ddz9dMdtShANprE9XMWnEjUijiz0ReLu2s3oh0Cmn5vfY MQRHNFPpeVdJQUBsguK3NunKDflIpP0dVdQRwmc++ZxCV65ZXISsPWrIyMLIdXn0SU8L LROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pQeS3ErQJYe6lUMZTvW4HI5IzahbrklWfBxpVQvJbIg=; b=oif95DmAGlL9BX/bVxXa33TW7vjm4CEz1jL8ZfxyAdjJDaYg0LSDL2v2OSnv4CEvNt /4ZPp8YKYufo1dQ/OP7+TDEaRBLDFRmLwpJmnrxa1d4h5Cw06NJh7bkEAmACXORJAmHY KzkACe9PMJrtvEkmWDLc3EMHRco836gv8n4y+aiJxTCECD9JlaOqLGHsW54FesJlQEx+ 6qsO8Bq4MCMCLxEvlmzb2enuEZsFNjDb3j4D4mY7QPwpKae+Ucn4jfcBUUVXfUmj63Aq U99yKJUj5C8TlZiN/L+9+YDVuChNlir/VdiPXcDKnXrptkkeKjXd6Q3ojVAMhCqDGNDX gE6g== X-Gm-Message-State: AOAM532r3pmvVFL5/Y9Gajhbsfhfh4Wp1BHTyOMPoUfz+DCUweeFTHti 3OW7knNN3dK949PPkm9vZkrii/1/CVU74g== X-Google-Smtp-Source: ABdhPJwm4Prd7s/y/OVV2BowxMoBKxWpU3jOeN1DGr3xq9PrniQQLBtETI11mggJBHQtC9Aa+9B4oA== X-Received: by 2002:ac8:538b:: with SMTP id x11mr1116947qtp.84.1592427799432; Wed, 17 Jun 2020 14:03:19 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:18 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 03/73] cpu: make qemu_work_cond per-cpu Date: Wed, 17 Jun 2020 17:01:21 -0400 Message-Id: <20200617210231.4393-4-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This eliminates the need to use the BQL to queue CPU work. While at it, give the per-cpu field a generic name ("cond") since it will soon be used for more than just queueing CPU work. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 72 ++++++++++++++++++++++++++++++++++--------- cpus.c | 2 +- hw/core/cpu.c | 1 + include/hw/core/cpu.h | 6 ++-- 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 622430bd33..57d9fc6ea1 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -27,7 +27,6 @@ static QemuMutex qemu_cpu_list_lock; static QemuCond exclusive_cond; static QemuCond exclusive_resume; -static QemuCond qemu_work_cond; /* >= 1 if a thread is inside start_exclusive/end_exclusive. Written * under qemu_cpu_list_lock, read with atomic operations. @@ -43,7 +42,6 @@ void qemu_init_cpu_list(void) qemu_mutex_init(&qemu_cpu_list_lock); qemu_cond_init(&exclusive_cond); qemu_cond_init(&exclusive_resume); - qemu_cond_init(&qemu_work_cond); } void cpu_list_lock(void) @@ -103,23 +101,37 @@ struct qemu_work_item { bool free, exclusive, done; }; -static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) +/* Called with the CPU's lock held */ +static void queue_work_on_cpu_locked(CPUState *cpu, struct qemu_work_item *wi) { - qemu_mutex_lock(&cpu->lock); QSIMPLEQ_INSERT_TAIL(&cpu->work_list, wi, node); wi->done = false; - qemu_mutex_unlock(&cpu->lock); qemu_cpu_kick(cpu); } -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, - QemuMutex *mutex) +static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) +{ + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, wi); + cpu_mutex_unlock(cpu); +} + +void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { struct qemu_work_item wi; + bool has_bql = qemu_mutex_iothread_locked(); + + g_assert(no_cpu_mutex_locked()); if (qemu_cpu_is_self(cpu)) { - func(cpu, data); + if (has_bql) { + func(cpu, data); + } else { + qemu_mutex_lock_iothread(); + func(cpu, data); + qemu_mutex_unlock_iothread(); + } return; } @@ -129,13 +141,34 @@ void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, wi.free = false; wi.exclusive = false; - queue_work_on_cpu(cpu, &wi); + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, &wi); + + /* + * We are going to sleep on the CPU lock, so release the BQL. + * + * During the transition to per-CPU locks, we release the BQL _after_ + * having kicked the destination CPU (from queue_work_on_cpu_locked above). + * This makes sure that the enqueued work will be seen by the CPU + * after being woken up from the kick, since the CPU sleeps on the BQL. + * Once we complete the transition to per-CPU locks, we will release + * the BQL earlier in this function. + */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&qemu_work_cond, mutex); + qemu_cond_wait(&cpu->cond, &cpu->lock); current_cpu = self_cpu; } + cpu_mutex_unlock(cpu); + + if (has_bql) { + qemu_mutex_lock_iothread(); + } } void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) @@ -299,6 +332,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void process_queued_cpu_work(CPUState *cpu) { struct qemu_work_item *wi; + bool has_bql = qemu_mutex_iothread_locked(); qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { @@ -316,13 +350,23 @@ void process_queued_cpu_work(CPUState *cpu) * BQL, so it goes to sleep; start_exclusive() is sleeping too, so * neither CPU can proceed. */ - qemu_mutex_unlock_iothread(); + if (has_bql) { + qemu_mutex_unlock_iothread(); + } start_exclusive(); wi->func(cpu, wi->data); end_exclusive(); - qemu_mutex_lock_iothread(); + if (has_bql) { + qemu_mutex_lock_iothread(); + } } else { - wi->func(cpu, wi->data); + if (has_bql) { + wi->func(cpu, wi->data); + } else { + qemu_mutex_lock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_unlock_iothread(); + } } qemu_mutex_lock(&cpu->lock); if (wi->free) { @@ -332,5 +376,5 @@ void process_queued_cpu_work(CPUState *cpu) } } qemu_mutex_unlock(&cpu->lock); - qemu_cond_broadcast(&qemu_work_cond); + qemu_cond_broadcast(&cpu->cond); } diff --git a/cpus.c b/cpus.c index ca271411a4..035f41a997 100644 --- a/cpus.c +++ b/cpus.c @@ -1216,7 +1216,7 @@ void qemu_init_cpu_loop(void) void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { - do_run_on_cpu(cpu, func, data, &qemu_global_mutex); + do_run_on_cpu(cpu, func, data); } static void qemu_kvm_destroy_vcpu(CPUState *cpu) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 1cba5b6e69..07251d83df 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -370,6 +370,7 @@ static void cpu_common_initfn(Object *obj) cpu->nr_threads = 1; qemu_mutex_init(&cpu->lock); + qemu_cond_init(&cpu->cond); QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4d4006f1fb..ebff239ad3 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -333,6 +333,7 @@ struct qemu_work_item; * @kvm_fd: vCPU file descriptor for KVM. * @lock: Lock to prevent multiple access to per-CPU fields. Must be acquired * after the BQL. + * @cond: Condition variable for per-CPU events. * @work_list: List of pending asynchronous work. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). @@ -378,6 +379,7 @@ struct CPUState { QemuMutex lock; /* fields below protected by @lock */ + QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; @@ -774,12 +776,10 @@ bool cpu_is_stopped(CPUState *cpu); * @cpu: The vCPU to run on. * @func: The function to be executed. * @data: Data to pass to the function. - * @mutex: Mutex to release while waiting for @func to run. * * Used internally in the implementation of run_on_cpu. */ -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, - QemuMutex *mutex); +void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); /** * run_on_cpu: From patchwork Wed Jun 17 21:01:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610571 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7FF17618 for ; Wed, 17 Jun 2020 21:05:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5605221532 for ; Wed, 17 Jun 2020 21:05:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AA2z7orh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5605221532 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfF2-0004hm-JP for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:05:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDV-0002fG-Sa for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:29 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:42436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDO-0008Q3-Cg for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:29 -0400 Received: by mail-qt1-x842.google.com with SMTP id q14so2741522qtr.9 for ; Wed, 17 Jun 2020 14:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QNZB54KyQChgQjAJ4p/NXb5SKwXOjBRD9J4KOgYTGDc=; b=AA2z7orh/m+mwEWFgQscfE4OJA8CSw68Kuhox/bKvytcSM8YZvkftQB7TO16rvo0eM fhWp068tIALYrvq/uUyZEaB2jQe5FUEKV3dbou1qpxpMhqcG0TEuOfBt36LWBQL+Akr6 yAlBmE+vRbhV8EaxNBElT1idS3uGuiC20f7zX/M/KjDTEcpny+v2Y1C/W4P/pI3V214S XhgB94mTYZ5AwsIY4UUVo4ujR+pCw5c9PZxsahotK4zc65O7Z0wiX1V6Kl8zW06vyMlM QOPWkaoFLG0UhfOhk+DkHHZeLg+wtzKhb87kjDeNzvScYgXpUzj2K8zmtYJ+qjYD7DW4 laOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QNZB54KyQChgQjAJ4p/NXb5SKwXOjBRD9J4KOgYTGDc=; b=HwUcYW7OjlyjdKt5qHQ8xmIN3t43/mc2DZ4l5Al8wYtwDhRubfLcemIqKUZVUUkHXB l05Nps5ZNWWI9imR1uoY3Vzfag8w/Vw0zpXVWveWRW5ML0VnTJqVY/qjUYj3kiYoKq5x 4WZNNX309Lx5t8OjJF8dUkIfaBOfrH2cas4KDybbVAYLE4ngkKeUvaspqnI6/VHX+1Aj JVb10QS83aQiGUnX/uKqXXIwampXSRm74vBUGkgQVLZIyqJAsnpFDgRFG79Le6LAhQlU KVlPLnnFI0VlkzGXnmSv7hkFw1+vNNEN2wuW3oVlS2m29Ogi2NinwhsOWM6ST9qWMIdz t3Hw== X-Gm-Message-State: AOAM5323gq7Vk52nsNVZb9DvEJS4bbIjZwuyv961af4+3IVwjYA1gt0W aEcn2uE7lTlWlxzr3jcZAK6sPyBdq2LBfA== X-Google-Smtp-Source: ABdhPJyXJHPLpEEuCZdP7Yc8QXLwbj/JnTLMaC8xTB/kqlmZU3ZJYneco7TC6KWaL/rh+/WiZngFqg== X-Received: by 2002:ac8:6edb:: with SMTP id f27mr1035447qtv.325.1592427801035; Wed, 17 Jun 2020 14:03:21 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:20 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 04/73] cpu: move run_on_cpu to cpus-common Date: Wed, 17 Jun 2020 17:01:22 -0400 Message-Id: <20200617210231.4393-5-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" We don't pass a pointer to qemu_global_mutex anymore. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 2 +- cpus.c | 5 ----- include/hw/core/cpu.h | 10 ---------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 57d9fc6ea1..b1069193c1 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -117,7 +117,7 @@ static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) cpu_mutex_unlock(cpu); } -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) +void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { struct qemu_work_item wi; bool has_bql = qemu_mutex_iothread_locked(); diff --git a/cpus.c b/cpus.c index 035f41a997..8e54916169 100644 --- a/cpus.c +++ b/cpus.c @@ -1214,11 +1214,6 @@ void qemu_init_cpu_loop(void) qemu_thread_get_self(&io_thread); } -void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) -{ - do_run_on_cpu(cpu, func, data); -} - static void qemu_kvm_destroy_vcpu(CPUState *cpu) { if (kvm_destroy_vcpu(cpu) < 0) { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index ebff239ad3..e3f7ec06ff 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -771,16 +771,6 @@ void qemu_cpu_kick(CPUState *cpu); */ bool cpu_is_stopped(CPUState *cpu); -/** - * do_run_on_cpu: - * @cpu: The vCPU to run on. - * @func: The function to be executed. - * @data: Data to pass to the function. - * - * Used internally in the implementation of run_on_cpu. - */ -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); - /** * run_on_cpu: * @cpu: The vCPU to run on. From patchwork Wed Jun 17 21:01:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CC4B90 for ; Wed, 17 Jun 2020 21:06:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E40B2186A for ; Wed, 17 Jun 2020 21:06:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XMYikFss" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E40B2186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfGl-0008FZ-Ad for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:06:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDc-0002iK-E0 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:36 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:41360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDP-0008QF-Qe for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:34 -0400 Received: by mail-qk1-x742.google.com with SMTP id n11so3487335qkn.8 for ; Wed, 17 Jun 2020 14:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hf6KnrMMAO78JvrEU5J5AEUZKfa7iIkvGpGZcKZJQGs=; b=XMYikFsscz06ROPMZ9LLk/ydPwrUpyhSe/DtawZ3X35OB/tmH6mv3wRhWZ8VU65em+ 4675uYtMi9RFmjkG4w5PHAXD5xfxs2FpNGzAKvDqLXiBFGbcr9B7knrDL2y0xX5/40HR /IMu4cdcct442Zw7n1ccynwRASWFWG5Tl5stH3eCrdHpf6Bd7mulfVUqhx8JOLcXJrBE +BAcAi+dt6FBYYDEv69Df5AUPRQyUGa/BTWep0zgYRhryK0uXE9LyCB//QX269jGtpk0 IdJKSzS2z2h1uRWz3u8H/GVrPWI5OzsL+37T+4RrexjJDnJ5Av+rkFeS9Z4hofImj6Xq JgrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hf6KnrMMAO78JvrEU5J5AEUZKfa7iIkvGpGZcKZJQGs=; b=nDPrUWdda/Eqi5i6PtvwOIc/7EqF2+2AKe4XFgVPCG8P/DUrdkvM0v+m8LXlap7lm4 pD02JFDiS3GvZFlmBuVcVdAccn+gMvqZolIUFTzDjTQLp1/tKTrk5+Z49g7eSvIbEfAv qQ5rvRKoOa8WQ2dRVq74ZDd3sHkg9Hr4LjmvZL9aC1Mc8JssKtFV1zBV2Q+s3xoRx4t2 gVRMj8j8BowD+0uXonZb7r27OT38ASdclt/SBWT8NePWYPgjPY2epofagGvKWPLfEGu9 sfjduspvIFZG/+dmIRQnlv4twx9JYZuhnciEl4SdEDObjGISlQY9snsVfngafGKjaKR7 lztg== X-Gm-Message-State: AOAM530SKy1Qkf7lPqc2Vj/OA12zHZsseEyQN2SQNRBDy7DLNiN8yYNB sI1X383UuwSxXTjKRv3Az/pUnxwXnGbcXg== X-Google-Smtp-Source: ABdhPJwJScHxgvcaDYcTqrc8O45oc6j+JH+aVCCY4gj6ZTvULScEi7dh3OC12yj3fMlgoWH4lwMIPQ== X-Received: by 2002:a37:4ed2:: with SMTP id c201mr602204qkb.138.1592427802647; Wed, 17 Jun 2020 14:03:22 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:21 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 05/73] cpu: introduce process_queued_cpu_work_locked Date: Wed, 17 Jun 2020 17:01:23 -0400 Message-Id: <20200617210231.4393-6-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This completes the conversion to cpu_mutex_lock/unlock in the file. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index b1069193c1..6f51ae127c 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -329,20 +329,19 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, queue_work_on_cpu(cpu, wi); } -void process_queued_cpu_work(CPUState *cpu) +/* Called with the CPU's lock held */ +static void process_queued_cpu_work_locked(CPUState *cpu) { struct qemu_work_item *wi; bool has_bql = qemu_mutex_iothread_locked(); - qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { - qemu_mutex_unlock(&cpu->lock); return; } while (!QSIMPLEQ_EMPTY(&cpu->work_list)) { wi = QSIMPLEQ_FIRST(&cpu->work_list); QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node); - qemu_mutex_unlock(&cpu->lock); + cpu_mutex_unlock(cpu); if (wi->exclusive) { /* Running work items outside the BQL avoids the following deadlock: * 1) start_exclusive() is called with the BQL taken while another @@ -368,13 +367,19 @@ void process_queued_cpu_work(CPUState *cpu) qemu_mutex_unlock_iothread(); } } - qemu_mutex_lock(&cpu->lock); + cpu_mutex_lock(cpu); if (wi->free) { g_free(wi); } else { atomic_mb_set(&wi->done, true); } } - qemu_mutex_unlock(&cpu->lock); qemu_cond_broadcast(&cpu->cond); } + +void process_queued_cpu_work(CPUState *cpu) +{ + cpu_mutex_lock(cpu); + process_queued_cpu_work_locked(cpu); + cpu_mutex_unlock(cpu); +} From patchwork Wed Jun 17 21:01:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FF6460D for ; Wed, 17 Jun 2020 21:08:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 140E92098B for ; Wed, 17 Jun 2020 21:08:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vsKZ3f93" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 140E92098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfIG-0003CG-AN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:08:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDX-0002h4-Lp for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:31 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:34508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDR-0008QT-Qr for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:31 -0400 Received: by mail-qk1-x744.google.com with SMTP id f18so3521294qkh.1 for ; Wed, 17 Jun 2020 14:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Aa0/6c3+jxPlKOE23QHPcFZBwOZeQHpI9u7mvd3Wohw=; b=vsKZ3f93HJuY3GvGrAXQ7l5e+XOcoG9zvWYvYbpqEbZqwQIbAowyjOTD76BNEs1Ghy fJfYzI9qKJmPANTZvxEbaA6smJsk01IbfzQypoZSPif7MyLX7vKhqq4HCFl/UKGbL4/i GnbHHO15EoeRsF+C9ipNcO0KmGb/AaeikzBq9sfWDkObJVcvOXHpvhJ8ZRp0hnXFAP+c QuFnJqhDkByHaHJODzt1349WMnQ2rOrFiWMpnb+zrMyRSrJiCDSp0plSASjArNwYduP8 MGdKvEuJW0jbdJ2cNkXjqU4GYTq77s9OAr1SNk4HAGViYzddSPYTh2A9JZWk89OfpKCz TvHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Aa0/6c3+jxPlKOE23QHPcFZBwOZeQHpI9u7mvd3Wohw=; b=dB2cXa6k3nv32dSbCoEOM6oGAIv5YjOLHjM/8A2XM7ckptJU8FDsMH/9Q52n+MuXbJ LDUtEuZ++7ydcAI3BFsCXMrsyuNJTeoYDjj6ay7vXpzMm31YHlJaHVkjCym3ggGTHok1 YHE4KU/pMsWBM4bFFihrKNKECUqz+P7xnBPnKwX7AXQs884t1W6L5Xe/2KnWlW1+QQIh OaXUD+CZi/vcFXnmeraYk3rlISSEssg8wcc8Ux+Xn10wtpwxXJ1h/RNVzw5Iz7PKKzgR MDnL/ZVuqK5UXLd6bEARA5uSCkDrBWCevAqCCAabzIGlXQB66/mOYR0i3gLVnPAod+MJ +8FQ== X-Gm-Message-State: AOAM533zd1ubvuMrqupu0NOaf0UMHIvoyTRAiBi4KUOBDTw7qE8vy7E6 1WK/ns0qiDXThNyIus/ISN6RIfBQU9R8dg== X-Google-Smtp-Source: ABdhPJzQX9oE+1IPZs/xjNQE7k1PfdpLJwPgeyN8dLcjdn/m8syR0X8FTh+eRri63qjPy2f4GCsYBA== X-Received: by 2002:a37:4acc:: with SMTP id x195mr594325qka.454.1592427804435; Wed, 17 Jun 2020 14:03:24 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:23 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 06/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode Date: Wed, 17 Jun 2020 17:01:24 -0400 Message-Id: <20200617210231.4393-7-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Before we can switch from the BQL to per-CPU locks in the CPU loop, we have to accommodate the fact that TCG rr mode (i.e. !MTTCG) cannot work with separate per-vCPU locks. That would lead to deadlock since we need a single lock/condvar pair on which to wait for events that affect any vCPU, e.g. in qemu_tcg_rr_wait_io_event. At the same time, we are moving towards an interface where the BQL and CPU locks are independent, and the only requirement is that the locking order is respected, i.e. the BQL is acquired first if both locks have to be held at the same time. In this patch we make the BQL a recursive lock under the hood. This allows us to (1) keep the BQL and CPU locks interfaces separate, and (2) use a single lock for all vCPUs in TCG rr mode. Note that the BQL's API (qemu_mutex_lock/unlock_iothread) remains non-recursive. Added cpu_mutex_destroy, and call from cpu_common_finalize, to avoid destroying qemu_global_mutex, when cpu mutex is destroyed. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota [RF: Fixed destroy issue, added cpu_mutex_destroy.] Signed-off-by: Robert Foley --- cpus-common.c | 2 +- cpus.c | 101 ++++++++++++++++++++++++++++++++++++++---- hw/core/cpu.c | 5 ++- include/hw/core/cpu.h | 8 +++- stubs/cpu-lock.c | 7 +++ 5 files changed, 110 insertions(+), 13 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 6f51ae127c..0287018dc4 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -161,7 +161,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&cpu->cond, &cpu->lock); + qemu_cond_wait(&cpu->cond, cpu->lock); current_cpu = self_cpu; } cpu_mutex_unlock(cpu); diff --git a/cpus.c b/cpus.c index 8e54916169..8edc9858d6 100644 --- a/cpus.c +++ b/cpus.c @@ -92,6 +92,12 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +static inline bool qemu_is_tcg_rr(void) +{ + /* in `make check-qtest', "use_icount && !tcg_enabled()" might be true */ + return use_icount || (tcg_enabled() && !qemu_tcg_mttcg_enabled()); +} + /* * Note: we index the bitmap with cpu->cpu_index + 1 so that the logic * also works during early CPU initialization, when cpu->cpu_index is set to @@ -104,25 +110,75 @@ bool no_cpu_mutex_locked(void) return bitmap_empty(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); } -void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +static __thread bool iothread_locked; +/* + * In TCG rr mode, we make the BQL a recursive mutex, so that we can use it for + * all vCPUs while keeping the interface as if the locks were per-CPU. + * + * The fact that the BQL is implemented recursively is invisible to BQL users; + * the mutex API we export (qemu_mutex_lock_iothread() etc.) is non-recursive. + * + * Locking order: the BQL is always acquired before CPU locks. + */ +static __thread int iothread_lock_count; + +static void rr_cpu_mutex_lock(void) { -/* coverity gets confused by the indirect function call */ + if (iothread_lock_count++ == 0) { + /* + * Circumvent qemu_mutex_lock_iothread()'s state keeping by + * acquiring the BQL directly. + */ + qemu_mutex_lock(&qemu_global_mutex); + } +} + +static void rr_cpu_mutex_unlock(void) +{ + g_assert(iothread_lock_count > 0); + if (--iothread_lock_count == 0) { + /* + * Circumvent qemu_mutex_unlock_iothread()'s state keeping by + * releasing the BQL directly. + */ + qemu_mutex_unlock(&qemu_global_mutex); + } +} + +static void do_cpu_mutex_lock(CPUState *cpu, const char *file, int line) +{ + /* coverity gets confused by the indirect function call */ #ifdef __COVERITY__ - qemu_mutex_lock_impl(&cpu->lock, file, line); + qemu_mutex_lock_impl(cpu->lock, file, line); #else QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); + f(cpu->lock, file, line); +#endif +} + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ g_assert(!cpu_mutex_locked(cpu)); set_bit(cpu->cpu_index + 1, cpu_lock_bitmap); - f(&cpu->lock, file, line); -#endif + + if (qemu_is_tcg_rr()) { + rr_cpu_mutex_lock(); + } else { + do_cpu_mutex_lock(cpu, file, line); + } } void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) { g_assert(cpu_mutex_locked(cpu)); - qemu_mutex_unlock_impl(&cpu->lock, file, line); clear_bit(cpu->cpu_index + 1, cpu_lock_bitmap); + + if (qemu_is_tcg_rr()) { + rr_cpu_mutex_unlock(); + return; + } + qemu_mutex_unlock_impl(cpu->lock, file, line); } bool cpu_mutex_locked(const CPUState *cpu) @@ -130,6 +186,20 @@ bool cpu_mutex_locked(const CPUState *cpu) return test_bit(cpu->cpu_index + 1, cpu_lock_bitmap); } +void cpu_mutex_destroy(CPUState *cpu) +{ + /* + * In TCG RR, cpu->lock is the BQL under the hood. In all other modes, + * cpu->lock is a standalone per-CPU lock. + */ + if (qemu_is_tcg_rr()) { + cpu->lock = NULL; + } else { + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + } +} + bool cpu_is_stopped(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); @@ -1883,8 +1953,6 @@ bool qemu_in_vcpu_thread(void) return current_cpu && qemu_cpu_is_self(current_cpu); } -static __thread bool iothread_locked = false; - bool qemu_mutex_iothread_locked(void) { return iothread_locked; @@ -1903,6 +1971,8 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line) g_assert(!qemu_mutex_iothread_locked()); bql_lock(&qemu_global_mutex, file, line); + g_assert(iothread_lock_count == 0); + iothread_lock_count++; iothread_locked = true; } @@ -1910,7 +1980,10 @@ void qemu_mutex_unlock_iothread(void) { g_assert(qemu_mutex_iothread_locked()); iothread_locked = false; - qemu_mutex_unlock(&qemu_global_mutex); + g_assert(iothread_lock_count > 0); + if (--iothread_lock_count == 0) { + qemu_mutex_unlock(&qemu_global_mutex); + } } void qemu_cond_wait_iothread(QemuCond *cond) @@ -2146,6 +2219,16 @@ void qemu_init_vcpu(CPUState *cpu) cpu_address_space_init(cpu, 0, "cpu-memory", cpu->memory); } + /* + * In TCG RR, cpu->lock is the BQL under the hood. In all other modes, + * cpu->lock is a standalone per-CPU lock. + */ + if (qemu_is_tcg_rr()) { + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + cpu->lock = &qemu_global_mutex; + } + if (kvm_enabled()) { qemu_kvm_start_vcpu(cpu); } else if (hax_enabled()) { diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 07251d83df..1d2cafe76c 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -369,7 +369,8 @@ static void cpu_common_initfn(Object *obj) cpu->nr_cores = 1; cpu->nr_threads = 1; - qemu_mutex_init(&cpu->lock); + cpu->lock = g_new(QemuMutex, 1); + qemu_mutex_init(cpu->lock); qemu_cond_init(&cpu->cond); QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); @@ -382,7 +383,7 @@ static void cpu_common_finalize(Object *obj) { CPUState *cpu = CPU(obj); - qemu_mutex_destroy(&cpu->lock); + cpu_mutex_destroy(cpu); } static int64_t cpu_common_get_arch_id(CPUState *cpu) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index e3f7ec06ff..9d25fc25a2 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -377,7 +377,7 @@ struct CPUState { uint64_t random_seed; sigjmp_buf jmp_env; - QemuMutex lock; + QemuMutex *lock; /* fields below protected by @lock */ QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; @@ -485,6 +485,12 @@ void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line); */ bool cpu_mutex_locked(const CPUState *cpu); +/** + * cpu_mutex_destroy - Handle how to destroy this CPU's mutex + * @cpu: the CPU whose mutex to destroy + */ +void cpu_mutex_destroy(CPUState *cpu); + /** * no_cpu_mutex_locked - check whether any CPU mutex is held * diff --git a/stubs/cpu-lock.c b/stubs/cpu-lock.c index 1981a00fb3..97a81f447d 100644 --- a/stubs/cpu-lock.c +++ b/stubs/cpu-lock.c @@ -18,3 +18,10 @@ bool no_cpu_mutex_locked(void) { return true; } + +void cpu_mutex_destroy(CPUState *cpu) +{ + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + cpu->lock = NULL; +} From patchwork Wed Jun 17 21:01:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 839A390 for ; Wed, 17 Jun 2020 21:08:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B1292098B for ; Wed, 17 Jun 2020 21:08:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PeGyUbkM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B1292098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfIH-0003DM-KX for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:08:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDd-0002lr-Vl for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:45562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDT-0008Qe-LQ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:37 -0400 Received: by mail-qt1-x842.google.com with SMTP id y1so2729877qtv.12 for ; Wed, 17 Jun 2020 14:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1vOKTGG7r7jNUJaDxhAJRyKeVBws+iqtlbFnw8ux2yw=; b=PeGyUbkMI3pOovZHdFQmrpdylYHtgbPgM8pdzXFMziKQBbXZESlYWjeDUsk0obRFiW L/GIlCYWa8t8oC89L0YJUU193J4kaI5MUCJ8qWlAqlafFUb/VO33UorfmUoQVr+yC81h KcZ2GuYzSxNusMV94s/DiqFkdKk0I0Ivg7e3YRLWPv85ca4uUDg708A2YTohk1kthvE+ Mb8ueMsV9nkWgyPHta5gzyNpm6/boxqx1F7oT4tqNxo7SupapHvRcB3bZtHJOuJdjDYz aOEeS1pU7Ssn1SSvx8H278xuzlTKYzWAWS9znoK6wRe4zKqjQWb/gtViyXjG/am7ctZh 9iJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1vOKTGG7r7jNUJaDxhAJRyKeVBws+iqtlbFnw8ux2yw=; b=bXGKVMdCFTAdxGfeIVbi5ufUnXGBtiQfxiEq1I7bvNhwrX6a5nCqm9lhTsE+l+/gfe ehB5d+w7odjE5Mp6o0HdMdqcZkNK6Yx4i5rRVQJmbknUfqFkgOyfpqBe/4vFAARKaeMk sdQz3EJIrF1aoXcwRkaiCVz7WmMewf0Q/LCx8potE3zwadnZ9yyMcjDDoYExqux4Xe43 MhHNg1KENtJEw2mE3IVfAuFg2eku8iJmgDNEgvUi86jAmymS9004f2wGkwHSCTTYp77Z 78N1Sa70xvjc6dSLb5JAzcXMD2ID+qOqCYEiuQODPKbM0p6EEErAVcURAc10vLbp8M8a yEUg== X-Gm-Message-State: AOAM533vRQAIwDzOEQ3t0dOh1G4+ez0qWw8t+F8/0KltVaTbPTai28fK otOfOz6sJ2u0iq4NHUAZmnhaXZ5Ujzy18A== X-Google-Smtp-Source: ABdhPJxpQKjxJwdDw0860st385fV8/3BS2Ebhr+sfq6RjYBO9NXKsEs2YOViP5e6JfLJGTuBgqlI0Q== X-Received: by 2002:aed:3f55:: with SMTP id q21mr1146781qtf.190.1592427805826; Wed, 17 Jun 2020 14:03:25 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:25 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 07/73] tcg-runtime: define helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:25 -0400 Message-Id: <20200617210231.4393-8-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/tcg-runtime.c | 7 +++++++ accel/tcg/tcg-runtime.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 446465a09a..32ec18fe40 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -168,3 +168,10 @@ void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(env_cpu(env), GETPC()); } + +void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) +{ + CPUState *cpu = env_cpu(env); + + cpu->halted = val; +} diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 4eda24e63a..eb7af0e6f0 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -28,6 +28,8 @@ DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env) DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) +DEF_HELPER_FLAGS_2(cpu_halted_set, TCG_CALL_NO_RWG, void, env, i32) + #ifdef CONFIG_SOFTMMU DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, From patchwork Wed Jun 17 21:01:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E95E90 for ; Wed, 17 Jun 2020 21:10:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3E342098B for ; Wed, 17 Jun 2020 21:10:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uf2sSmV1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3E342098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfJt-0006Gy-4V for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:10:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDe-0002nG-KF for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:38875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDV-0008Qv-K6 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: by mail-qv1-xf43.google.com with SMTP id ec10so1758972qvb.5 for ; Wed, 17 Jun 2020 14:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nYtL05IMdrK2PLihxK9n2nGdaQygV4Nn/DL2l37l62U=; b=uf2sSmV1u0B0TpF0NljmOMjFOfBWEdoYIHpMMtB5x4sJWIcBCHgIL6cvPlhDmOhjBR upte1RQ8EBrJXbztVgOgi1AocARBTmewIZtuWR7Msmuu1hsKj1d9heUzvsTvVQ5c+W38 LVbKP+t00bXNQgoGlFVsWnfjhKr14GsABcg9SWB8Xdp4+YxGMJEKRd6TralB2KIdfiRr URFQ+UKgtPa6hJqwgy36FjfJkSWvXMhPh1gGnslt7SXaPJeqFo5s6wB0t6CnSEbusW/F rLWdRnXPM+NXOhatbziPAHdLQ2LijA0liaM7Hfb5ZYU1q21CsxFesqpmceaxWqjJm2r5 T3TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nYtL05IMdrK2PLihxK9n2nGdaQygV4Nn/DL2l37l62U=; b=UM1ejAs5qak4atDqXbbhslIJYAmZlwo1RJfBdOxVq0CC3W1AT3vn4PejXkkbgr686d XHDC/XrYpc/U6FF45Y/UTPRvCG+rp+ucl80dWJT0S6ChnJUeWUiKj7PWxBpDZB0D0NCa XMYN0Zh1OQ/Irwv/LMz4aRn2EcKLts9kcmhuaqKwv/Cy/7zCs9/BHXztsttYuNxHhaVL tuIjGqwGWLgSmWDtrjKV03BG0opkM6Lycy8BCkZkQ19d7x1dU1LwE9SoXJ4WKwabOZzo AbP2JqvxgduB3YiJSZJ1rosBRzkXNQdJ1zuLleRQzfxq4z0AWgswPzOYC2J+eA1iCzOP a7Lw== X-Gm-Message-State: AOAM532S7f4sVHE24wn1Fhrg6nrvgI5IIJjHVcKN21vLUql7MfO0yt3W UcM0Ouk93iYgfZ+3A1051PvKCRDkgmlKOQ== X-Google-Smtp-Source: ABdhPJzji1mSwfmzePOg3XmvoEiPxmDGMTDZj6OXuvD0In8yX2m32x5XSC5TN011l2rP5+qOtcBWsQ== X-Received: by 2002:ad4:4851:: with SMTP id t17mr594808qvy.160.1592427807531; Wed, 17 Jun 2020 14:03:27 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:26 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 08/73] ppc: convert to helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:26 -0400 Message-Id: <20200617210231.4393-9-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Acked-by: David Gibson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/ppc/translate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4ce3d664b5..d30c2159fa 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1596,8 +1596,7 @@ GEN_LOGICAL2(nor, tcg_gen_nor_tl, 0x03, PPC_INTEGER); static void gen_pause(DisasContext *ctx) { TCGv_i32 t0 = tcg_const_i32(0); - tcg_gen_st_i32(t0, cpu_env, - -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, t0); tcg_temp_free_i32(t0); /* Stop translation, this gives other CPUs a chance to run */ @@ -3621,8 +3620,7 @@ static void gen_sync(DisasContext *ctx) static void gen_wait(DisasContext *ctx) { TCGv_i32 t0 = tcg_const_i32(1); - tcg_gen_st_i32(t0, cpu_env, - -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, t0); tcg_temp_free_i32(t0); /* Stop translation, as the CPU is supposed to sleep from now */ gen_exception_nip(ctx, EXCP_HLT, ctx->base.pc_next); From patchwork Wed Jun 17 21:01:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4004390 for ; Wed, 17 Jun 2020 21:10:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1761121582 for ; Wed, 17 Jun 2020 21:10:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GakJUK72" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1761121582 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfKK-0007Cx-07 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:10:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDe-0002mJ-7x for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:40741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDX-0008R7-BJ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:37 -0400 Received: by mail-qv1-xf43.google.com with SMTP id e2so1755979qvw.7 for ; Wed, 17 Jun 2020 14:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I06C2sE0s7zrdX3gLkjEgs8DOpvCtPpl7x1fQYW5h5A=; b=GakJUK72IOEF2gr6ZnvdYEt0Ixa+LSj089KcAo663SMsOh9Uak7fxg/4RTtL+mO/MT PTE7gH/2bwCTbggFfOsuC5l+tVIk4K0elPXfLB5UO5tkeVl06+gcSDDgSoFO+Zh3UBgS c/O5TfHPAOpU4BP+sTgs6tI+NOptFFEdJIOFYhcaRHEJ+NLN9ftoqUHNPrOE+I5dgfnW 5ZNP2awYQ7jhNJtlDzXDP+oVQbSZTm9hZ/JVOcVgqVqvgRBLrlftglE26Q70h7udHtCq NzSiiXRuNlFJRRT+5crJkVvLm77Nc87XH5veZyvfRFP3rRbjeizlhaBs6MijS0LTCG5w iaCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I06C2sE0s7zrdX3gLkjEgs8DOpvCtPpl7x1fQYW5h5A=; b=f3iACXxGqMRJELipjCGYzGRc9K7XJa2FbmZua1av2LYTblWtygHVpW9ssPyngGmGtS rpQv2i23R+DhdvFxoiyR4OwtLuukVasZaC0/X4IRnNKnpSOSde+3zKk1wEw7tY+AxJaA meG+g3PV61LoD8CGsn0RtGLkvpIaL6OufM+stlR3MB3fneJza1zNIpofU3xt18CQqdT8 ZwASnKv1yGw72/oA/6qIkZLOmcWRsVgWjtjrWP6EUqzaNqdyKRO9WWUPIodJSyEraTNe a9P3AAn5CIkyfjohQGbm8vBI4Wcn2VmMZe/Lo1a8bJ30rDMD4TsAbYZlVi6bUrbQezqC KlLg== X-Gm-Message-State: AOAM533ujACWKtlq5q3mqcz1ZGJAYh8MW8z4n1cduE8uywbTYknJSRNA k9O3LGwkAHie8uGm6maaB2FBDmXCJXYd0w== X-Google-Smtp-Source: ABdhPJy9Y3jCD5Svbcn8gi54vhh6rh2X1StsZj2/rLhK+sA/K+Go/prVJsjFv0AqRiEzC3ttlgUmBw== X-Received: by 2002:a05:6214:848:: with SMTP id dg8mr552195qvb.152.1592427809217; Wed, 17 Jun 2020 14:03:29 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:28 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 09/73] cris: convert to helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:27 -0400 Message-Id: <20200617210231.4393-10-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" And fix the temp leak along the way. Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/cris/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index aaa46b5bca..6c4f091b7a 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -2823,8 +2823,9 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) cris_cc_mask(dc, 0); if (dc->op2 == 15) { - tcg_gen_st_i32(tcg_const_i32(1), cpu_env, - -offsetof(CRISCPU, env) + offsetof(CPUState, halted)); + TCGv_i32 tmp = tcg_const_i32(1); + gen_helper_cpu_halted_set(cpu_env, tmp); + tcg_temp_free_i32(tmp); tcg_gen_movi_tl(env_pc, dc->pc + 2); t_gen_raise_exception(EXCP_HLT); return 2; From patchwork Wed Jun 17 21:01:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E114D60D for ; Wed, 17 Jun 2020 21:08:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1EA62098B for ; Wed, 17 Jun 2020 21:08:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hQoCPWgl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1EA62098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfI5-0002n9-Rq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:08:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDd-0002lU-Ot for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:37 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:39813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDX-0008RF-Q4 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:37 -0400 Received: by mail-qv1-xf41.google.com with SMTP id r16so1760442qvm.6 for ; Wed, 17 Jun 2020 14:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wrWqzZuurKLoDMN6QCL6bZgCudK/zrEU5r5KFbp+gtw=; b=hQoCPWglOq4TovAqV8Vh7jPChis7GkW1FdcQ/q/4+2mPBL552PrmZoA95o2z/wtxwl 307nBu0ery1QUYdSLMNvgWKVvHh667gKWdReAhHnG3msMMfPO14KgDFAoSJxi0zD+Y4O N7RAT4TEmn178wK9mszQO6HeCV47LXV6ZRsh7cETFIg1BYWdb+39qQBxHW1ruNxIO9oL blKSVaCcT9Hn8rMBSCBQzPQYJq2PcJylOAKUPVTlFtsLx4nB5XoVNlypuRIuHrz4Gkr2 7E5+zdO3NOSaz+P4V+L1IWgkv4pei+jzLw6TozajGuGpe0DlkvAmjBnE5Xbv2QdKO6m6 quhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wrWqzZuurKLoDMN6QCL6bZgCudK/zrEU5r5KFbp+gtw=; b=eOHqJkqIf1fsxZ4p5M+ma6OxWp5HSjDl/p2V1kga2TUB6LDb/hlKA4MdY646SV6UqI SmOnVTeU4BL79QsJTsr19cWXFKLc5oK7/nqsVeI0cK74dwCkKvPJswLGbV4QS4d2LBH8 JB1GdGTbrj2KUAh1BK1sS0lAseExqjpMmbjLB/AQ91zyBNP9NvZuGcsb4xZX2gxVoeGj FswcS9BB8GbGTNlkeePBO1vWgE+NG5V37xB4s1ByDH2Hw+Rhtlyw+68Jla11Z3RfiO+G 4DoNvefelbN8dtysYILEVChxZ/T1f8cXsuyAs1EtaEoZn2qkQRXf6rautE7HtY8X69+N L+5g== X-Gm-Message-State: AOAM532enHAS678a/hiKFvW5cUlVmn71xAo9H38TS5I/pt8Q2acA/4aH 8wJ6ow9+Vk3kVVOhwv2NnvGdD/Gbe/xdgA== X-Google-Smtp-Source: ABdhPJwuO3Dv8hCbqTJxJ+vAtG77B3ov/8/C9+sgyue0s0+Db7c20QuTw3Ev7xPICGX3GBCYs5DgVA== X-Received: by 2002:a0c:806e:: with SMTP id 101mr520295qva.173.1592427810525; Wed, 17 Jun 2020 14:03:30 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:29 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 10/73] hppa: convert to helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:28 -0400 Message-Id: <20200617210231.4393-11-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/hppa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 52d7bea1ea..9c4d5b28b0 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2725,8 +2725,7 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf *a) /* Tell the qemu main loop to halt until this cpu has work. */ tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); gen_excp_1(EXCP_HALTED); ctx->base.is_jmp = DISAS_NORETURN; From patchwork Wed Jun 17 21:01:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63CDE90 for ; Wed, 17 Jun 2020 21:12:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 347AF21841 for ; Wed, 17 Jun 2020 21:12:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GJq01Zl5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 347AF21841 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfMT-0003Iq-DP for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:12:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDe-0002mp-DX for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:39814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDc-0008RR-5t for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: by mail-qv1-xf42.google.com with SMTP id r16so1760478qvm.6 for ; Wed, 17 Jun 2020 14:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4iFy7dIAe5u1Ho2N3UqzjTBmrVGvnP56Md9pXka22/M=; b=GJq01Zl56emhpKBWqwD25by/f/y3PvwaKGnN0S0csqDXR/pc0jXiKAhmSkiFIrB7Va /DICE6EnNdLRrs7vSecpwhhTK/fOiWc96RqAkxcnTvNwZVTmTSjfqemkvlnsgr5IDuYM MUfHB6nlnV/2X+g8bKtSgyN3FNVJkj+jQCGkLRslQGywFb9C1x9O1A34RdUkz6y9x0U5 3onK6H0WYJdS0iZOu99mqQa2aXMQT/KtXXhanb0gY5iTPtPLvTfs1URL0aJlyi/SCh+f O+QBcPiTKiR3lALzRugPM/2VK7rriaNlT+tWNGrsc4QU78uXLdUaMsUZAIyM46E8a1gX 1dIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4iFy7dIAe5u1Ho2N3UqzjTBmrVGvnP56Md9pXka22/M=; b=KUubNBeD2hEy6jnY6t/TWmWrIUIeC7F8gpsW+nMsuV8U7Ha0+jKB1nJ8UlcEJpIaJV y1Pn2EwZ6Kdi2wIMO9mExmJ6QAgEO29Wu2/Idy8WGbs3GL6cQ47fUKd3BOsCyNPezQoX wi7yKeTSE1Y/TjessCn1us8NlYmclb2aAdBZDD1KVRCapv8UVaS2B4BQRagl66DW35nL ANCoDgwVIr8BXTLwXYtbJWqf2dzVY9h6HEqpDYfMc640eqk7UpJgpxoqCPGk2G77dCn2 YWgUaB9XGY6oZ9TBiCcqCdDqsHA1Zrn/LK0Z0Yqv8h26O7Roo3unhh86OaNkmbUe1Vpx 43nQ== X-Gm-Message-State: AOAM530w7lWM+DolTJhBqBaw1XTiHMR4rLrQze5ESczHzY13HSqumOZa 43RRLvc7h8YEdGMg0Gi04Jettkt44DMkrA== X-Google-Smtp-Source: ABdhPJxYpORM5zaU5RZvNX3UNeLoLacc5aJJ+cG8bvG6HXdVmsJeVHOFtSXcF7i4wDArwGu+ykGhQA== X-Received: by 2002:ad4:48c7:: with SMTP id v7mr559228qvx.190.1592427811804; Wed, 17 Jun 2020 14:03:31 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:31 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 11/73] m68k: convert to helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:29 -0400 Message-Id: <20200617210231.4393-12-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Laurent Vivier Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/m68k/translate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 3fc67aa452..35086ff449 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -44,7 +44,6 @@ #undef DEFO32 #undef DEFO64 -static TCGv_i32 cpu_halted; static TCGv_i32 cpu_exception_index; static char cpu_reg_names[2 * 8 * 3 + 5 * 4]; @@ -80,9 +79,6 @@ void m68k_tcg_init(void) #undef DEFO32 #undef DEFO64 - cpu_halted = tcg_global_mem_new_i32(cpu_env, - -offsetof(M68kCPU, env) + - offsetof(CPUState, halted), "HALTED"); cpu_exception_index = tcg_global_mem_new_i32(cpu_env, -offsetof(M68kCPU, env) + offsetof(CPUState, exception_index), @@ -4698,6 +4694,7 @@ DISAS_INSN(halt) DISAS_INSN(stop) { uint16_t ext; + TCGv_i32 tmp; if (IS_USER(s)) { gen_exception(s, s->base.pc_next, EXCP_PRIVILEGE); @@ -4707,7 +4704,9 @@ DISAS_INSN(stop) ext = read_im16(env, s); gen_set_sr_im(s, ext, 0); - tcg_gen_movi_i32(cpu_halted, 1); + tmp = tcg_const_i32(1); + gen_helper_cpu_halted_set(cpu_env, tmp); + tcg_temp_free_i32(tmp); gen_exception(s, s->pc, EXCP_HLT); } From patchwork Wed Jun 17 21:01:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37D911392 for ; Wed, 17 Jun 2020 21:15:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F2D62184D for ; Wed, 17 Jun 2020 21:15:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EZZo5knf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F2D62184D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfOl-0007Gq-7e for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:15:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDf-0002p4-80 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:39 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:37430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDc-0008RV-69 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:38 -0400 Received: by mail-qk1-x741.google.com with SMTP id b27so3508327qka.4 for ; Wed, 17 Jun 2020 14:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8O2wd0xMJ+DcB/CefCYufYGHDOjb2p67mBVobEDCvB4=; b=EZZo5knfSSDy73/TMZC+g9YfOw3kPYfcF3JMZTKAwDBZ4SD9AxG1sdOmVBprdYx4Fz kMe9jM7AwQ+AqTmf8k0cMLGgsw6JpcKCxzqxOmgD2uZvSG4seCOGnTfgrC+H5c6M3kP5 HwmMOxwDIOGSP5+3nUPAFr0iv0h6/rmtFNPN/90kf9kxcdYEh5bjvU7DAdiizz7pIEqf fSk61QFF9tufPWnFzYtoR0lsljChcD1Y1qFT3M/hbn3LXg2Wik9am7hQwhhSHnqKG+h1 GDR42sWfmg9VLb2kwWDyY2c9YInj73nMuH7mbVp32ovpph73zEWQpXrhODuNmYTjydJ6 qe4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8O2wd0xMJ+DcB/CefCYufYGHDOjb2p67mBVobEDCvB4=; b=CMH7en96ymm6jXKiOeLIq4bfHFKNQN5rWJFygK3t0+qy94lfmB94xeR/JVgmbtjtk7 FL6x4pXM5qsj8jbquNoE9ld3hBer5PH5E5JPtoEQtdLW1NHk7UnSbb1HHdLotEvfBP48 m8vve/bb21f+kTk/+sBTtoluPpuShGnAM1sZa0vRgnsdZjt4sm57Q4s2dA2Mo/N5MFew mYH0Wa0XcJLSC6iX0puj3eVbS7Z8CWDszjjIMhgFktPbTQz4yXeknmsq9TZdwanj5l4M EMpcLmkocrPP0iER7Qb8bMkEp+/c2A07mCSh33NstRCJ2uDyreIaEmuCMNDJB4rmSPsZ 1yTg== X-Gm-Message-State: AOAM530kOepO6wNjEbP+JmBwRCdQIzNZy9JpDgP5Ya5DQpBL2HlmOd6x KkrJLyJU18g1rmyb9B0NvxH3qUL8cH5aPg== X-Google-Smtp-Source: ABdhPJwYnCjD+TX4VXbPeoQ5sChwruzNvGYDcLPi/M+/41ITkgfREmTfK/7o3zmFOTAHSNkWObfhCQ== X-Received: by 2002:a05:620a:200a:: with SMTP id c10mr590690qka.218.1592427813151; Wed, 17 Jun 2020 14:03:33 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:32 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 12/73] alpha: convert to helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:30 -0400 Message-Id: <20200617210231.4393-13-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/alpha/translate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 8870284f57..b1cd55e6ca 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1226,8 +1226,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode) /* WTINT */ { TCGv_i32 tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); } tcg_gen_movi_i64(ctx->ir[IR_V0], 0); @@ -1381,8 +1380,7 @@ static DisasJumpType gen_mtpr(DisasContext *ctx, TCGv vb, int regno) /* WAIT */ { TCGv_i32 tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); } return gen_excp(ctx, EXCP_HALTED, 0); From patchwork Wed Jun 17 21:01:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37AC01392 for ; Wed, 17 Jun 2020 21:18:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E32E2166E for ; Wed, 17 Jun 2020 21:18:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bWUG+Nn5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E32E2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfRZ-0002vv-5t for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:18:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDh-0002t4-Cr for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:41 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:43930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDc-0008Rb-6Q for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:41 -0400 Received: by mail-qk1-x743.google.com with SMTP id j68so138258qkb.10 for ; Wed, 17 Jun 2020 14:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XOL0McJNxpiiKDMcuEDzDPwcyrSarpMmiP9igPMccJY=; b=bWUG+Nn58G7tf1GVpLj8HXfMR8FrqALNXTDR30Ey5jrxh4ryzsblivnkfST/l5sm0e WAx/s9rdvzkFkCNuoblOq+NDoYMdotzjYIJaC+uINryWEwPfzxrTrEKUlQaTSwCgjI7a Phudp5IaC3VZPmO1Mzm1h474xpskwCp78qAb2Q22heWlEetVQVEsRaLFRgLptur39CPY CJBF6ckB4l3uRFdkque5De7gdofqS8i42aHWGnYHt98B9/+Z1f3rG5yUFZGv9PeWcTDn DBAhH+D4r+5m1pIstGRmB4TwI1FunumjbhwCuyY6QhbEwJmJSHqwSQYbT86c1pnGyVbD 8ZXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XOL0McJNxpiiKDMcuEDzDPwcyrSarpMmiP9igPMccJY=; b=p77qYu3Hm8vewZxrkwq+L2kaA1GE3Nni6axZWywBvgXNqEQXPuXRyfqMmocAyOqfYS RUqojaAdW+HFsf5h5cYt4leGu2MAdoNd1GfWtTEXuBEZACerYMMm3Y9l9qmCobSavgUK f5ooQ5KSC/PCJhlG+84yAb2gC+WTUOgB4+lpJYB7Q97ujEvZ/IbJiv2f+zJRE7M0mX/2 eVzKs919Dju+roEb5FxjmXUY9vPf79kDmrKuzKTSh8vsyS4O2LoO62KNZeP6Rf4anZXt KTxEdv5fXkKS3bDZzuhU6U63w89EfB66JOdcT39z6P4clx05DS4fYcdPgGsFo4WIMPv+ uoog== X-Gm-Message-State: AOAM5331fFfQY1PTfJ5rKYexoI/AU0r+rURRn2kne8T4xSD8O7ce7pLb IlZln+JI7iaqdbj5m+2041eWYYloYMK/pw== X-Google-Smtp-Source: ABdhPJxUqltz36O4G7d9obYHNBaTLYS+nsyK5AD+rZdnTG4tLcbSM05Al1sm5b1gY3EYHGjpDwNYAQ== X-Received: by 2002:a05:620a:12cd:: with SMTP id e13mr567675qkl.143.1592427814586; Wed, 17 Jun 2020 14:03:34 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:34 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 13/73] microblaze: convert to helper_cpu_halted_set Date: Wed, 17 Jun 2020 17:01:31 -0400 Message-Id: <20200617210231.4393-14-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/microblaze/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index f6ff2591c3..c08a7f1d39 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1237,9 +1237,7 @@ static void dec_br(DisasContext *dc) LOG_DIS("sleep\n"); t_sync_flags(dc); - tcg_gen_st_i32(tmp_1, cpu_env, - -offsetof(MicroBlazeCPU, env) - +offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp_1); tcg_gen_movi_i64(cpu_SR[SR_PC], dc->pc + 4); gen_helper_raise_exception(cpu_env, tmp_hlt); tcg_temp_free_i32(tmp_hlt); From patchwork Wed Jun 17 21:01:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4887D14B7 for ; Wed, 17 Jun 2020 21:05:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F75421532 for ; Wed, 17 Jun 2020 21:05:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QtqWXwkH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F75421532 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfFH-00053E-9N for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:05:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDf-0002q1-Og for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:39 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:41385) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDd-0008Rp-0R for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:39 -0400 Received: by mail-qv1-xf42.google.com with SMTP id er17so1755317qvb.8 for ; Wed, 17 Jun 2020 14:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=38XOeCAg8eirTLUPmY4XSVCYcrFE+9q7Dk1aEtr2HSc=; b=QtqWXwkH/gGVezhhKpEW7oEkU6PGrLgNCGeRarDoft3Nbw73bQO9gWAlCHjQ+tnSjA gGEElf8eJJuOkr8OBu+CYGdCWGpmcXKHZ38H6o5bCRwVcoguXDME9xVmDK83DIodCZo/ LF2uHOF2Dfkqs18U9flgZVn36PuvcEV01wNFSb7E5kdN7QRg6QmH35K1NB2hfqClGP7p 0rdGigepcWmzigRNdNFz8SjNz8+xQsdCV96rf7yfr3BFRVDFx5i/yj27gtIGVzGqE/+n rMWG4T6+OA87VReCwXhhn19Wtkh0szfEOjH3DRH2OirA6etWTxzq7H/U5NLbmUfJ/VBA q/Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=38XOeCAg8eirTLUPmY4XSVCYcrFE+9q7Dk1aEtr2HSc=; b=f9ILX8p+mTeRd+IwEcqfKKjW7Nymmvus3o2B3QRykG8YzP0qJbRIDu8Id7EL8GLqtw GNanjWra8xBygxqOysw0HD8U7iKzVsmzfvtg48Kc/9drmANwgw+H3XoK9LhAo2sudwGk NxA39C3FugkC3zlI+dbkyuKM20a+1VOuKMk2ximSZc7yFD1cP4223B4TezhYsjyTN8q4 EjK7di8UWMoEB//jdvS5gMr1BXFXkXcWiwPYeJsVqSfgru5qqlGsASp1UXYnr02UtHBH IZIUpBPpWahmcY1zdbfvtGlsZ7nhXqPU+0og4onIAWlqnXKnIBBugEc82QaPfTbANUvS btEg== X-Gm-Message-State: AOAM5307tvVwUYbl3GcXtX+UQnZM9zF54KONGlQcWnUP9xDl0PDnkzG+ wB9dKG/EYLQUazBJ4scmgW2p4Od3WlwARA== X-Google-Smtp-Source: ABdhPJwZlIMrHZxJo0qhbmrYDlw/V3NmWSFzOk8LXyu3rGbQDG9YxOSMZq8xcQQT0k58bAYW1IV7dg== X-Received: by 2002:ad4:590d:: with SMTP id ez13mr555335qvb.177.1592427815933; Wed, 17 Jun 2020 14:03:35 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:35 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 14/73] cpu: define cpu_halted helpers Date: Wed, 17 Jun 2020 17:01:32 -0400 Message-Id: <20200617210231.4393-15-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" cpu->halted will soon be protected by cpu->lock. We will use these helpers to ease the transition, since right now cpu->halted has many direct callers. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- include/hw/core/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 9d25fc25a2..92069ebc59 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -498,6 +498,30 @@ void cpu_mutex_destroy(CPUState *cpu); */ bool no_cpu_mutex_locked(void); +static inline uint32_t cpu_halted(CPUState *cpu) +{ + uint32_t ret; + + if (cpu_mutex_locked(cpu)) { + return cpu->halted; + } + cpu_mutex_lock(cpu); + ret = cpu->halted; + cpu_mutex_unlock(cpu); + return ret; +} + +static inline void cpu_halted_set(CPUState *cpu, uint32_t val) +{ + if (cpu_mutex_locked(cpu)) { + cpu->halted = val; + return; + } + cpu_mutex_lock(cpu); + cpu->halted = val; + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; From patchwork Wed Jun 17 21:01:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC9BA1392 for ; Wed, 17 Jun 2020 21:22:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3AAC2168B for ; Wed, 17 Jun 2020 21:22:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ko47ccey" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3AAC2168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfWB-00025d-1a for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:22:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDi-0002vJ-DE for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:42 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:42865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDe-0008S8-GE for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:42 -0400 Received: by mail-qk1-x743.google.com with SMTP id l17so3471079qki.9 for ; Wed, 17 Jun 2020 14:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5p5QVMZ54qL4PKza/xfxsC7DswUaUr8tRQACxDFIq5U=; b=Ko47cceyF6xkP1sqhiKJJfvtLpsMqHO2ctU5ho3y93gZ72PKeO8FjMj7g0orB+jRnQ mRt9t7raBAkBcU4xXIAx8Qp+w01TR0dZMjWke81TLI5UXMCvShzZODMEpdO52ewAD1CQ B1+J8Rczl9oeQzX5hceglsk9VeoFHpf+bbb4UTY8iIQP0Z32hz0LhRKE9mkjUw/uRGCS nsPkzTW70M9JMDGga7cnYULifBvGzZfCK1660ye9wa9FC3kSAo0ljkJVFPZMC/yL+RAX JSiXRhmE5dDRDHt70/M6V/vmTQbLHAF6IVn99uiQ0EYxC+W5GudRX5B6qEdMSwUk/mW9 ffKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5p5QVMZ54qL4PKza/xfxsC7DswUaUr8tRQACxDFIq5U=; b=bBJY0xZdN21P6mTif+DLy4Uz/sJeqBD/984R6dVz5fj8yZSiVyeH08pTPyjT5A+d1S xv2kK61TEHEQxd835pkeIG79REQiflsWpcl23c3RKxNBWauf90ZN6FQIWVhFa1OQhcQ5 pdgj9O9WTpFPKuo64xZJZpGmPG8/Q2gLHa6zF/1nib0iJA4FBaqw4/WWT1jmftuPPJqB pypi2aXS0JUkskgV9hKLhk63+niiKxIIbRxQu+AhkUptde/hEgz/jchcdXEun18QRSsv XWyZ0EWEISmhb7HXMuNluLBTMKzoNWDjkIM4KLgzuxU4LNkor15/Wped3rXaFD6hY80R F3YA== X-Gm-Message-State: AOAM533wpHmAMs6GRK+FL/Z7O27fjvNXec6j+RqsomusmaLeoMfRCp8N IeS5UCOUi3olvqimnjzCHcwqp+DFOrsv4g== X-Google-Smtp-Source: ABdhPJxQOEfP7M+e1MUpRSZ6W3L7GPhxnjeAQEQT1tGJ629bE91LFvkT/MCL7BGrzzDkO9WG8+q4Lw== X-Received: by 2002:a37:5e07:: with SMTP id s7mr622767qkb.20.1592427817350; Wed, 17 Jun 2020 14:03:37 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:36 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 15/73] tcg-runtime: convert to cpu_halted_set Date: Wed, 17 Jun 2020 17:01:33 -0400 Message-Id: <20200617210231.4393-16-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/tcg-runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 32ec18fe40..ca0774d3bf 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -173,5 +173,5 @@ void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) { CPUState *cpu = env_cpu(env); - cpu->halted = val; + cpu_halted_set(cpu, val); } From patchwork Wed Jun 17 21:01:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EEA0912 for ; Wed, 17 Jun 2020 21:20:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7497C2098B for ; Wed, 17 Jun 2020 21:20:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dz4gDTBP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7497C2098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:42192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfTt-00072S-Ka for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:20:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDi-0002uf-3C for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:42 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:39416) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDf-0008Sd-Sw for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:41 -0400 Received: by mail-qt1-x841.google.com with SMTP id k22so2752340qtm.6 for ; Wed, 17 Jun 2020 14:03:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vm7jFPC3E4tKVChYDNiheUybVx+cA91nQK1Z4PmgN4c=; b=dz4gDTBPsD18T3Jayz0+UMxJvvLmkge2RVqGqhqy7tNMCT8cngvkz43bMlSqYwKNWY zaAdaU4Oj4V8J6wmSlQDg5uqY+sBUYWOmbvlu5Q4in73BLiwvGZsDdA+lY98aFQckC6Q 8YO0/A0ssfFJFohg4VdBqI2QR2DNpzxuh5sz09A5aZSS8EXs82w/QMi7MhhEsP5bYp9K fJlODxSPzYmfKakZBh9h4hKaIOUFHUayYnmhBqv/ozlKy+hwePlv3Kp9krckIA88qe8F QBpmI2pEAX8UvUhbISrebCG3s0aZd53QbZKgwIwu1RdpjPvYm9ndQfgxylpu9BCl3VjH jClQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vm7jFPC3E4tKVChYDNiheUybVx+cA91nQK1Z4PmgN4c=; b=TWUU0xoGTpU8Sw/BlRT1mNR3SoXM6hGWhUDHIKLogHP+QHYvM7+KxTyFAi9Tdh3HgT BxMrIqBH0+Dty9tWA26Ad1RIil/YE/fU+IgS+YCFTnLBr2BUZ3r0Sh2jLckIr3JVcy2Y 0OLbJI8rXIoEg8wquomEj1npHBPkAi1xJIMWnO18XzN4t5kCtN2jhiGxPQYpMTaZRAui /l/3R4CKOoVtcEZBPnvXyJngzchopz8IvQJHop43tTA5DZrQEADnUDT6qNlffxcWylqT 8cC0jWYaVFA653qiZpdHlChLUzlIlpVBK9506dX5U1PTBef0XGQ9RUUgkII/2w8ysTQE z9Ig== X-Gm-Message-State: AOAM533iLD7C1I8qgTgtU4XgHNOl9K4kl2Jt2UZrrxr5mW7Z8ceLuAnr C/a4zH5lH8A0RoFhV+Sg7FmWMLpucXD74A== X-Google-Smtp-Source: ABdhPJyR200q311vm/KlL44kfm4YHNTK9/UoI7pDxirR6xG1gwU+vX9FAJqnzFfIwSL+ZGBfmRsKkg== X-Received: by 2002:ac8:1285:: with SMTP id y5mr1096548qti.245.1592427818712; Wed, 17 Jun 2020 14:03:38 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:38 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 16/73] hw/semihosting: convert to cpu_halted_set Date: Wed, 17 Jun 2020 17:01:34 -0400 Message-Id: <20200617210231.4393-17-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Robert Foley Reviewed-by: Alex Bennée --- hw/semihosting/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c index 22e7827824..01cafa4bca 100644 --- a/hw/semihosting/console.c +++ b/hw/semihosting/console.c @@ -130,7 +130,7 @@ static void console_wake_up(gpointer data, gpointer user_data) { CPUState *cs = (CPUState *) data; /* cpu_handle_halt won't know we have work so just unbung here */ - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); } @@ -153,7 +153,7 @@ target_ulong qemu_semihosting_console_inc(CPUArchState *env) g_assert(current_cpu); if (fifo8_is_empty(&c->fifo)) { c->sleeping_cpus = g_slist_prepend(c->sleeping_cpus, current_cpu); - current_cpu->halted = 1; + cpu_halted_set(current_cpu, 1); current_cpu->exception_index = EXCP_HALTED; cpu_loop_exit(current_cpu); /* never returns */ From patchwork Wed Jun 17 21:01:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D5021392 for ; Wed, 17 Jun 2020 21:24:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33A342166E for ; Wed, 17 Jun 2020 21:24:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UaETTkwf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33A342166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfYB-0005cH-7c for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:24:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDj-0002xr-GY for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:43 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:37823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDh-0008T7-Ho for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:43 -0400 Received: by mail-qt1-x843.google.com with SMTP id d27so2765364qtg.4 for ; Wed, 17 Jun 2020 14:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8/IOqlv1sAgxjuNf6Y85K/ZDCKml0j6c2FyJ0KPQgug=; b=UaETTkwfDdnYPXLtIYH5paeb1vy/0aphoujhPrx+mgSsso+GIaJR6UIeoBCE78mT7Z 6FruA6t8aHcrQ98v33eAc8R0suRVo6PUjRdIPuzDyqj7r8NUd4Hzk9pKvYPpdYiEpS6i An6MkTkh+l1GxUZSi2Lkmt0rXkOwlj8VVLgZrnZhpSZptW0lg0akKVwJNr73JM/cl7XE ZYqUoCwTRY6bKuWMYoKv73msc8QQOe9HEpEYN7i4i4QiVtFxsKW0WX9YEwh937gewEWk f0zxdmh/6IlpQeLQsIMUjL81/OUOVjnOFDA9hnWPq0He2VjhTaNkmfiQLyTLiEMeqwnt X54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8/IOqlv1sAgxjuNf6Y85K/ZDCKml0j6c2FyJ0KPQgug=; b=TiRadLFBTncll8IuBlVJ726z6yNI5GpzKZ1Du+jHC6lqh9RKE/UH3Tg7w48ENkhNE6 jF/GGpVzK3Iana8ru+M7/ysaSPtlInvxvo2NKXYfZ43R8DSfGchcSrZsAL2zmzg4p9Hq 7rFvwCWtQpI7MChgwDGPz9AaF+LYKNdDbxfnvylaUxR+iRVYYlXaYKpqMJ6XoiE3xeIK FISSfVSiOhG6MDyfjDSsHBrwcXMP/rqZUnlLBXUHG7J2O5lac8pnp53anfNS53nH0P7C EoXvkk1B8a9Hs4e0oNhNjUjHYpuFiTAsGlX5kwMRYQ4I99nNIGpnvhfVKiGGHgiRkupK A+DA== X-Gm-Message-State: AOAM5327fjU6B2MXHlZlAhabakh/cvH2CeffYekx0s1O20XFdV8++KRk uA0swO3rmn8dJ0mK/ZIg3P/uwN9+8Moz9g== X-Google-Smtp-Source: ABdhPJx5CtnxDhIY41kwToFLmyBYSELYIP1ZEQ6iXrBY4fq47jhx7L1yu6O8g3Uf9MZJNjuAEqbKpw== X-Received: by 2002:ac8:6bc1:: with SMTP id b1mr1111814qtt.65.1592427820196; Wed, 17 Jun 2020 14:03:40 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:39 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 17/73] arm: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:35 -0400 Message-Id: <20200617210231.4393-18-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , robert.foley@linaro.org, cota@braap.org, qemu-arm@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/arm/omap1.c | 4 ++-- hw/arm/pxa2xx_gpio.c | 2 +- hw/arm/pxa2xx_pic.c | 2 +- target/arm/arm-powerctl.c | 6 +++--- target/arm/cpu.c | 2 +- target/arm/op_helper.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 6ba0df6b6d..d0963a7ff7 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -1776,7 +1776,7 @@ static uint64_t omap_clkdsp_read(void *opaque, hwaddr addr, case 0x18: /* DSP_SYSST */ cpu = CPU(s->cpu); return (s->clkm.clocking_scheme << 11) | s->clkm.cold_start | - (cpu->halted << 6); /* Quite useless... */ + (cpu_halted(cpu) << 6); /* Quite useless... */ } OMAP_BAD_REG(addr); @@ -3797,7 +3797,7 @@ void omap_mpu_wakeup(void *opaque, int irq, int req) struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque; CPUState *cpu = CPU(mpu->cpu); - if (cpu->halted) { + if (cpu_halted(cpu)) { cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB); } } diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index d6d0d0b08e..266a1d45b4 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -132,7 +132,7 @@ static void pxa2xx_gpio_set(void *opaque, int line, int level) pxa2xx_gpio_irq_update(s); /* Wake-up GPIOs */ - if (cpu->halted && (mask & ~s->dir[bank] & pxa2xx_gpio_wake[bank])) { + if (cpu_halted(cpu) && (mask & ~s->dir[bank] & pxa2xx_gpio_wake[bank])) { cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB); } } diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 105c5e63f2..3c58546e30 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -59,7 +59,7 @@ static void pxa2xx_pic_update(void *opaque) PXA2xxPICState *s = (PXA2xxPICState *) opaque; CPUState *cpu = CPU(s->cpu); - if (cpu->halted) { + if (cpu_halted(cpu)) { mask[0] = s->int_pending[0] & (s->int_enabled[0] | s->int_idle); mask[1] = s->int_pending[1] & (s->int_enabled[1] | s->int_idle); if (mask[0] || mask[1]) { diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index b75f813b40..f0db413519 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -64,7 +64,7 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state, /* Initialize the cpu we are turning on */ cpu_reset(target_cpu_state); - target_cpu_state->halted = 0; + cpu_halted_set(target_cpu_state, 0); if (info->target_aa64) { if ((info->target_el < 3) && arm_feature(&target_cpu->env, @@ -241,7 +241,7 @@ static void arm_set_cpu_on_and_reset_async_work(CPUState *target_cpu_state, /* Initialize the cpu we are turning on */ cpu_reset(target_cpu_state); - target_cpu_state->halted = 0; + cpu_halted_set(target_cpu_state, 0); /* Finally set the power status */ assert(qemu_mutex_iothread_locked()); @@ -297,7 +297,7 @@ static void arm_set_cpu_off_async_work(CPUState *target_cpu_state, assert(qemu_mutex_iothread_locked()); target_cpu->power_state = PSCI_OFF; - target_cpu_state->halted = 1; + cpu_halted_set(target_cpu_state, 1); target_cpu_state->exception_index = EXCP_HLT; } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5b7a36b5d7..df5c019145 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -175,7 +175,7 @@ static void arm_cpu_reset(DeviceState *dev) env->vfp.xregs[ARM_VFP_MVFR2] = cpu->isar.mvfr2; cpu->power_state = cpu->start_powered_off ? PSCI_OFF : PSCI_ON; - s->halted = cpu->start_powered_off; + cpu_halted_set(s, cpu->start_powered_off); if (arm_feature(env, ARM_FEATURE_IWMMXT)) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q'; diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index eb0de080f1..88c86a4346 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -305,7 +305,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) } cs->exception_index = EXCP_HLT; - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_loop_exit(cs); } From patchwork Wed Jun 17 21:01:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610607 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F40A60D for ; Wed, 17 Jun 2020 21:12:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8C8C21841 for ; Wed, 17 Jun 2020 21:12:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sA0vVj2C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8C8C21841 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfMb-0003lt-Uq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:12:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDl-00031b-Bk for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:45 -0400 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]:44138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDj-0008Ta-9m for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:44 -0400 Received: by mail-qv1-xf44.google.com with SMTP id g7so1744157qvx.11 for ; Wed, 17 Jun 2020 14:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gPDP1ha9C7ALCv7aOZuUhe7Y6Lzn4ZCDvLz9ksRTpOw=; b=sA0vVj2C/T5fgTJcomwXG4DEUyfnGpSLfMJ1kos7SFwPDLVieh/gJnYXpKAZOdD6LN lcTFAVOREhqIR0dRc0ImvaoLt61/M7w1WADmt3NsXKnHqKSOx7KmM3p3gBLjVyFKQpip Iyxi7qGbggq8pet/UFssBvVNnAQwUgOTPJWp37PzoTfCDATA6rdK9mjppXj5p6Xv1MCE C8wJz8M/QHE4bkkd4CKcvnAhby8sYfViIMQX9aU2tM4C9G7zG0k+uoEXNmXSqS82EYhk BwBVbZKT/h2BjVqBwaUCdE78b3gVawD7tGpNxKuleTAH/tZAyr5uYk2bW+YinWog1qUu o6Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gPDP1ha9C7ALCv7aOZuUhe7Y6Lzn4ZCDvLz9ksRTpOw=; b=tn0Rq6XhtPCk9BIbXa0ZBVRxI3gIuaiNVOGLxix6QEwzMnuoemcubWMUTQFmrEu89q PWTc5FUeV+JQmQWxeG96VLTj09daLFNODySoOOtu1zrRhXhiSvz9kc3Vq+bZ8e2nu7hN sn25nV45KclytDluJqIKFfkTb6c2wWPcgFEyRfmtbI8RQPN8a3JZmjqpWwh4PMYSFPM5 3ZWViLYxRcs8T4cFtC5hzS+RrPW7i4/B1KJYSuNtcb0ubp7Pa8vu/IbAeUFszOXrZaGR trieaqLEgS8QkMd/Q77nWwjKhI1GGnSWGfHFD43nGRMzVo2gf9/ydJDAbfmepcSWqREM x8Ww== X-Gm-Message-State: AOAM533HYaJzVPCLALWA8be82izsRr1gqZ9lQEAEIWyZakFv/qWbOgUf vEE5umJMfSI2IC8g7s3aG9cao7Bswunfww== X-Google-Smtp-Source: ABdhPJw0vcHPbUXOYOkMmdlN6lxUSUwdmJ8A4ZjBA7x7QtmYO2UPdG++VMrO0mHz1oHHiFclNq2TaQ== X-Received: by 2002:a0c:9ae2:: with SMTP id k34mr516617qvf.247.1592427821833; Wed, 17 Jun 2020 14:03:41 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:41 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 18/73] ppc: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:36 -0400 Message-Id: <20200617210231.4393-19-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::f44; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf44.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" In ppce500_spin.c, acquire the lock just once to update both cpu->halted and cpu->stopped. In hw/ppc/spapr_hcall.c, acquire the lock just once to update cpu->halted and call cpu_has_work, since later in the series we'll acquire the BQL (if not already held) from cpu_has_work. Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota [RF: hw/ppc/spapr_hcall.c, spapr_rtas.c more conversions] Signed-off-by: Robert Foley --- hw/ppc/e500.c | 4 ++-- hw/ppc/ppc.c | 10 +++++----- hw/ppc/ppce500_spin.c | 6 ++++-- hw/ppc/spapr_cpu_core.c | 4 ++-- hw/ppc/spapr_hcall.c | 14 ++++++++------ hw/ppc/spapr_rtas.c | 8 ++++---- target/ppc/excp_helper.c | 4 ++-- target/ppc/helper_regs.h | 2 +- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 8 ++++---- 10 files changed, 34 insertions(+), 30 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 51bf95b303..89db681edd 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -706,7 +706,7 @@ static void ppce500_cpu_reset_sec(void *opaque) /* Secondary CPU starts in halted state for now. Needs to change when implementing non-kernel boot. */ - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } @@ -720,7 +720,7 @@ static void ppce500_cpu_reset(void *opaque) cpu_reset(cs); /* Set initial guest state. */ - cs->halted = 0; + cpu_halted_set(cs, 0); env->gpr[1] = (16 * MiB) - 8; env->gpr[3] = bi->dt_base; env->gpr[4] = 0; diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 4a11fb1640..0e7386ff88 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -149,7 +149,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level) /* XXX: Note that the only way to restart the CPU is to reset it */ if (level) { LOG_IRQ("%s: stop the CPU\n", __func__); - cs->halted = 1; + cpu_halted_set(cs, 1); } break; case PPC6xx_INPUT_HRESET: @@ -228,10 +228,10 @@ static void ppc970_set_irq(void *opaque, int pin, int level) /* XXX: TODO: relay the signal to CKSTP_OUT pin */ if (level) { LOG_IRQ("%s: stop the CPU\n", __func__); - cs->halted = 1; + cpu_halted_set(cs, 1); } else { LOG_IRQ("%s: restart the CPU\n", __func__); - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); } break; @@ -445,10 +445,10 @@ static void ppc40x_set_irq(void *opaque, int pin, int level) /* Level sensitive - active low */ if (level) { LOG_IRQ("%s: stop the CPU\n", __func__); - cs->halted = 1; + cpu_halted_set(cs, 1); } else { LOG_IRQ("%s: restart the CPU\n", __func__); - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); } break; diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index 66c1065db2..79313944cf 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -107,9 +107,11 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data) map_start = ldq_p(&curspin->addr) & ~(map_size - 1); mmubooke_create_initial_mapping(env, 0, map_start, map_size); - cs->halted = 0; - cs->exception_index = -1; + cpu_mutex_lock(cs); + cpu_halted_set(cs, 0); cs->stopped = false; + cpu_mutex_unlock(cs); + cs->exception_index = -1; qemu_cpu_kick(cs); } diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 26ad566f42..b69c6c292d 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -39,7 +39,7 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu) /* All CPUs start halted. CPU0 is unhalted from the machine level * reset code and the rest are explicitly started up by the guest * using an RTAS call */ - cs->halted = 1; + cpu_halted_set(cs, 1); env->spr[SPR_HIOR] = 0; @@ -88,7 +88,7 @@ void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip, env->gpr[3] = r3; env->gpr[4] = r4; kvmppc_set_reg_ppc_online(cpu, 1); - CPU(cpu)->halted = 0; + cpu_halted_set(CPU(cpu), 0); /* Enable Power-saving mode Exit Cause exceptions */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] | pcc->lpcr_pm); } diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 0f54988f2e..e678ca29a5 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1058,17 +1058,19 @@ static target_ulong h_cede(PowerPCCPU *cpu, SpaprMachineState *spapr, env->msr |= (1ULL << MSR_EE); hreg_compute_hflags(env); + cpu_mutex_lock(cs); if (spapr_cpu->prod) { spapr_cpu->prod = false; + cpu_mutex_unlock(cs); return H_SUCCESS; } if (!cpu_has_work(cs)) { - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cs->exit_request = 1; } - + cpu_mutex_unlock(cs); return H_SUCCESS; } @@ -1085,7 +1087,7 @@ static target_ulong h_confer_self(PowerPCCPU *cpu) spapr_cpu->prod = false; return H_SUCCESS; } - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HALTED; cs->exit_request = 1; @@ -1116,7 +1118,7 @@ static target_ulong h_join(PowerPCCPU *cpu, SpaprMachineState *spapr, } /* Don't have a way to indicate joined, so use halted && MSR[EE]=0 */ - if (!cs->halted || (e->msr & (1ULL << MSR_EE))) { + if (!cpu_halted(cs) || (e->msr & (1ULL << MSR_EE))) { last_unjoined = false; break; } @@ -1199,7 +1201,7 @@ static target_ulong h_prod(PowerPCCPU *cpu, SpaprMachineState *spapr, spapr_cpu = spapr_cpu_state(tcpu); spapr_cpu->prod = true; - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); return H_SUCCESS; @@ -1685,7 +1687,7 @@ target_ulong do_client_architecture_support(PowerPCCPU *cpu, if (cs == CPU(cpu)) { continue; } - if (!cs->halted) { + if (!cpu_halted(cs)) { warn_report("guest has multiple active vCPUs at CAS, which is not allowed"); return H_MULTI_THREADS_ACTIVE; } diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index bcac0d00e7..2306f2985e 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -111,7 +111,7 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_, id = rtas_ld(args, 0); cpu = spapr_find_cpu(id); if (cpu != NULL) { - if (CPU(cpu)->halted) { + if (cpu_halted(CPU(cpu))) { rtas_st(rets, 1, 0); } else { rtas_st(rets, 1, 2); @@ -155,7 +155,7 @@ static void rtas_start_cpu(PowerPCCPU *callcpu, SpaprMachineState *spapr, env = &newcpu->env; pcc = POWERPC_CPU_GET_CLASS(newcpu); - if (!CPU(newcpu)->halted) { + if (!cpu_halted(CPU(newcpu))) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } @@ -213,7 +213,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, SpaprMachineState *spapr, */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm); env->spr[SPR_PSSCR] |= PSSCR_EC; - cs->halted = 1; + cpu_halted_set(cs, 1); kvmppc_set_reg_ppc_online(cpu, 0); qemu_cpu_kick(cs); } @@ -238,7 +238,7 @@ static void rtas_ibm_suspend_me(PowerPCCPU *cpu, SpaprMachineState *spapr, } /* See h_join */ - if (!cs->halted || (e->msr & (1ULL << MSR_EE))) { + if (!cpu_halted(cs) || (e->msr & (1ULL << MSR_EE))) { rtas_st(rets, 0, H_MULTI_THREADS_ACTIVE); return; } diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index a988ba15f4..507f64c9e7 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -305,7 +305,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) qemu_log("Machine check while not allowed. " "Entering checkstop state\n"); } - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_interrupt_exittb(cs); } if (env->msr_mask & MSR_HVB) { @@ -1134,7 +1134,7 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn_t insn) CPUState *cs; cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); /* * The architecture specifies that HDEC interrupts are discarded diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index d78c2af63e..f84438f639 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -168,7 +168,7 @@ static inline int hreg_store_msr(CPUPPCState *env, target_ulong value, #if !defined(CONFIG_USER_ONLY) if (unlikely(msr_pow == 1)) { if (!env->pending_interrupts && (*env->check_pow)(env)) { - cs->halted = 1; + cpu_halted_set(cs, 1); excp = EXCP_HALTED; } } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2692f76130..aae2ef0ad4 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1342,7 +1342,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *cs) { - return cs->halted; + return cpu_halted(cs); } static int kvmppc_handle_halt(PowerPCCPU *cpu) @@ -1351,7 +1351,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu) CPUPPCState *env = &cpu->env; if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index a40888411c..ac59648541 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8540,7 +8540,7 @@ static bool cpu_has_work_POWER7(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - if (cs->halted) { + if (cpu_halted(cs)) { if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { return false; } @@ -8702,7 +8702,7 @@ static bool cpu_has_work_POWER8(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - if (cs->halted) { + if (cpu_halted(cs)) { if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { return false; } @@ -8902,7 +8902,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - if (cs->halted) { + if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { @@ -9118,7 +9118,7 @@ static bool cpu_has_work_POWER10(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - if (cs->halted) { + if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { From patchwork Wed Jun 17 21:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12D1660D for ; Wed, 17 Jun 2020 21:07:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE2EE2098B for ; Wed, 17 Jun 2020 21:07:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FywU01ug" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE2EE2098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfH2-0000UK-3e for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:07:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDm-00033R-2N for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:46 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:37431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDk-0008Tq-CF for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:45 -0400 Received: by mail-qk1-x741.google.com with SMTP id b27so3508836qka.4 for ; Wed, 17 Jun 2020 14:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B03XAH5wL6d9wQMcetAjOEJJOmedJjFZih4s04YDqvs=; b=FywU01ugE/Po4A3CGfnl2o0/Ueb0CbiUSIbfHaG0Q+RawwrkEG/urfCMCbxEPZOV7b sfKbFfEHWjCsbfrff3TW717e/zE/rs3PamGHa9nPyVxq6wbDfFqyhTLE0j2NfkLGB+Bq Gc0+HDhi8d+5XjVNYT+2VygAi7bKxv2iTAXoTkbOz39lyExiVXNxyTlzuIItkH1Nb1l6 AKzagW0eE0lvQcNZtD1yXc8qqNY+jIGw/gXUt734RBohaQ8E6vShWXimLD9Gq6GxxjZu o8ZfgmW+9cSelMiapXMoPyShmdt1vqlOputb9AfbJ1eYEJ/TKwqvz4SA6JgecrqYFKkE EUiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B03XAH5wL6d9wQMcetAjOEJJOmedJjFZih4s04YDqvs=; b=X8vd2nWOfASF3c/TOUULKj/imyey6I7BIfiHL2jK6shQnEpPpTIes3pO/Zj2ocM9b5 m267jNyvy5IGIn3xkQmbxlQ+fu8PyExCmlLBxPBnQbUQnBW2rlmlYJXttOIAdevM3yl+ J3hBQ2X474Tk3jGWYyJNrW4WWyUfN/NfJphPeKCKif22Yury1ON+6yXDQ9+MV/KNsfbN q70jhe5dJay9R5+/rxuWH38bKE8AA8sHB2w61jHjYYegx4sBNzxxkfIokrnzQh47QPcE zJ+D67GNFR5T3GXmL+QqRyBIM30/L4IqEaqvagDgd+/WRI3dNZeciK/WphCfGPzkt7Eu gtTg== X-Gm-Message-State: AOAM532v3H0kYHEyfKJ2eVZTD+pIdJjX7yBAlxhsJcmJUMk2rwxjbhlb L8QbtWY2gbrQCZ0cB/0V/o/0lMaIklWpoA== X-Google-Smtp-Source: ABdhPJy5++27wdNslhJYjZREppFXV6/bN0A0fC6ucDwILRG60IkgCKLYz7nuwYqsGaeRLo9AOoq2GA== X-Received: by 2002:a05:620a:14b8:: with SMTP id x24mr531887qkj.284.1592427823243; Wed, 17 Jun 2020 14:03:43 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:42 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 19/73] sh4: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:37 -0400 Message-Id: <20200617210231.4393-20-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Yoshinori Sato , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Aurelien Jarno Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/sh4/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/sh4/op_helper.c b/target/sh4/op_helper.c index 14c3db0f48..d338bbe871 100644 --- a/target/sh4/op_helper.c +++ b/target/sh4/op_helper.c @@ -90,7 +90,7 @@ void helper_sleep(CPUSH4State *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); env->in_sleep = 1; raise_exception(env, EXCP_HLT, 0); } From patchwork Wed Jun 17 21:01:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63EA790 for ; Wed, 17 Jun 2020 21:08:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23F962098B for ; Wed, 17 Jun 2020 21:08:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R5z5IR5F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23F962098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfIi-0003um-5f for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:08:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDo-00039i-IF for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:48 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:45353) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDm-0008U7-Fu for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:48 -0400 Received: by mail-qk1-x742.google.com with SMTP id q8so3449651qkm.12 for ; Wed, 17 Jun 2020 14:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rba7pljRMVc6wa2lS86kVUPY7O/d9hkT9SFA7+vY6nY=; b=R5z5IR5FLnMnMqf2RggbF8wnsY2icPxT3w46kmMuEmy69k/4Mr4UNe+RuR+WiEPvG3 9c8CJRRyY7m6nltryWkmWziQvRZfYasj4SE4VArK46KiVyJ+gazqevXOxXuZqTuDay8U 9X86q5vyz5COzSuzfdMrSntdJ3rZjYQt7Eq5Lt1dQttkcMCrcVV8Vo1J9H6x1Btp9rjo 6Sr1nzX1mKh5hhoW25c15laX42Nri5JALP/VjoR4EXVD56IZn2Zv6dyI+FR9L/LqrxXz fbXETyMyprillHLMW8zUjP4+c2fyHOBDmvmInXSFqQ+yIOGH5Gtlr4YE5cLe6r/hZBmA uerw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rba7pljRMVc6wa2lS86kVUPY7O/d9hkT9SFA7+vY6nY=; b=DZwubFykX9o+h2C337PtU/9T/36KpWMO3X7ToalaKP0eIIwKU1kmSJYQmIFI/UQbAG oAmXK/JGw0vbuVX8LzKjqvjeWaK7iqR9k2xIeIatvQGWQ90tZaQ19CBRTWwoi2+R2Ngm 15a+CKq9g1faWAQPHQXUUOLFGUQke0x6DH7d5K1hux1/A15ilFS+HCcOvMUFvSqzbCc+ Iovs6/ZiYVsySE0N99oG02Md1SAdq1mJr4gCLQFHZnADqGAm28xpybjhj0FaCaqRn1qw C75GSicr4ufQ2x7TEgpYFRBYqw+qn3CzzQUEsH8oI/vknpMYkY/j+S/x4uas8g4BuCld Icqw== X-Gm-Message-State: AOAM530IJJI1jN5DVLN29GSFkH9B9LDYR1ZPU4w+tThKCScjsbwOqO++ G4PU/NnbHaiT/iz8XjjlJ+gQw8HcUGpmhw== X-Google-Smtp-Source: ABdhPJzZuLORD87VxHFuUa7rIS/eYuoX8SDFPbCz5s962zeXaI0xoYOVy9OxMVd8SVfCrJEKucANOw== X-Received: by 2002:a37:9684:: with SMTP id y126mr589113qkd.348.1592427825231; Wed, 17 Jun 2020 14:03:45 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:44 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 20/73] i386: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:38 -0400 Message-Id: <20200617210231.4393-21-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, "open list:X86 KVM CPUs" , "open list:X86 HAXM CPUs" , Marcelo Tosatti , Roman Bolshakov , cota@braap.org, Colin Xu , Wenchao Wang , Paolo Bonzini , peter.puhov@linaro.org, Sunil Muthuswamy , Richard Henderson , alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Eduardo Habkost Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted new code in i386/hax-all.c to cpu_halted] Signed-off-by: Robert Foley --- target/i386/cpu.c | 2 +- target/i386/cpu.h | 2 +- target/i386/hax-all.c | 6 +++--- target/i386/helper.c | 4 ++-- target/i386/hvf/hvf.c | 4 ++-- target/i386/hvf/x86hvf.c | 4 ++-- target/i386/kvm.c | 10 +++++----- target/i386/misc_helper.c | 2 +- target/i386/whpx-all.c | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b1b311baa2..4d3ab0f3a2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6084,7 +6084,7 @@ static void x86_cpu_reset(DeviceState *dev) /* We hard-wire the BSP to the first CPU. */ apic_designate_bsp(cpu->apic_state, s->cpu_index == 0); - s->halted = !cpu_is_bsp(cpu); + cpu_halted_set(s, !cpu_is_bsp(cpu)); if (kvm_enabled()) { kvm_arch_reset_vcpu(cpu); diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 7d77efd9e4..c618b90568 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1880,7 +1880,7 @@ static inline void cpu_x86_load_seg_cache_sipi(X86CPU *cpu, sipi_vector << 12, env->segs[R_CS].limit, env->segs[R_CS].flags); - cs->halted = 0; + cpu_halted_set(cs, 0); } int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector, diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index c93bb23a44..acfb7a6e10 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -511,7 +511,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - cpu->halted = 0; + cpu_halted_set(cpu, 0); } if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { @@ -529,7 +529,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) hax_vcpu_sync_state(env, 1); } - if (cpu->halted) { + if (cpu_halted(cpu)) { /* If this vcpu is halted, we must not ask HAXM to run it. Instead, we * break out of hax_smp_cpu_exec() as if this vcpu had executed HLT. * That way, this vcpu thread will be trapped in qemu_wait_io_event(), @@ -594,7 +594,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { /* hlt instruction with interrupt disabled is shutdown */ env->eflags |= IF_MASK; - cpu->halted = 1; + cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; ret = 1; } diff --git a/target/i386/helper.c b/target/i386/helper.c index c3a6e4fabe..058de4073d 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -450,7 +450,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags) (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, (env->a20_mask >> 20) & 1, (env->hflags >> HF_SMM_SHIFT) & 1, - cs->halted); + cpu_halted(cs)); } else #endif { @@ -477,7 +477,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags) (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, (env->a20_mask >> 20) & 1, (env->hflags >> HF_SMM_SHIFT) & 1, - cs->halted); + cpu_halted(cs)); } for(i = 0; i < 6; i++) { diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index be016b951a..b3bd2285fa 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -709,7 +709,7 @@ int hvf_vcpu_exec(CPUState *cpu) vmx_update_tpr(cpu); qemu_mutex_unlock_iothread(); - if (!cpu_is_bsp(X86_CPU(cpu)) && cpu->halted) { + if (!cpu_is_bsp(X86_CPU(cpu)) && cpu_halted(cpu)) { qemu_mutex_lock_iothread(); return EXCP_HLT; } @@ -742,7 +742,7 @@ int hvf_vcpu_exec(CPUState *cpu) (env->eflags & IF_MASK)) && !(cpu->interrupt_request & CPU_INTERRUPT_NMI) && !(idtvec_info & VMCS_IDT_VEC_VALID)) { - cpu->halted = 1; + cpu_halted_set(cpu, 1); ret = EXCP_HLT; break; } diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 5cbcb32ab6..c09cf160ef 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -446,7 +446,7 @@ int hvf_process_events(CPUState *cpu_state) if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) { - cpu_state->halted = 0; + cpu_halted_set(cpu_state, 0); } if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) { hvf_cpu_synchronize_state(cpu_state); @@ -458,5 +458,5 @@ int hvf_process_events(CPUState *cpu_state) apic_handle_tpr_access_report(cpu->apic_state, env->eip, env->tpr_access_type); } - return cpu_state->halted; + return cpu_halted(cpu_state); } diff --git a/target/i386/kvm.c b/target/i386/kvm.c index b3c13cb898..eda51904dd 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3594,7 +3594,7 @@ static int kvm_get_mp_state(X86CPU *cpu) } env->mp_state = mp_state.mp_state; if (kvm_irqchip_in_kernel()) { - cs->halted = (mp_state.mp_state == KVM_MP_STATE_HALTED); + cpu_halted_set(cs, mp_state.mp_state == KVM_MP_STATE_HALTED); } return 0; } @@ -4152,7 +4152,7 @@ int kvm_arch_process_async_events(CPUState *cs) kvm_queue_exception(env, EXCP12_MCHK, 0, 0); env->has_error_code = 0; - cs->halted = 0; + cpu_halted_set(cs, 0); if (kvm_irqchip_in_kernel() && env->mp_state == KVM_MP_STATE_HALTED) { env->mp_state = KVM_MP_STATE_RUNNABLE; } @@ -4175,7 +4175,7 @@ int kvm_arch_process_async_events(CPUState *cs) if (((cs->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (cs->interrupt_request & CPU_INTERRUPT_NMI)) { - cs->halted = 0; + cpu_halted_set(cs, 0); } if (cs->interrupt_request & CPU_INTERRUPT_SIPI) { kvm_cpu_synchronize_state(cs); @@ -4188,7 +4188,7 @@ int kvm_arch_process_async_events(CPUState *cs) env->tpr_access_type); } - return cs->halted; + return cpu_halted(cs); } static int kvm_handle_halt(X86CPU *cpu) @@ -4199,7 +4199,7 @@ static int kvm_handle_halt(X86CPU *cpu) if (!((cs->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && !(cs->interrupt_request & CPU_INTERRUPT_NMI)) { - cs->halted = 1; + cpu_halted_set(cs, 1); return EXCP_HLT; } diff --git a/target/i386/misc_helper.c b/target/i386/misc_helper.c index b6b1d41b14..c396b6c7b9 100644 --- a/target/i386/misc_helper.c +++ b/target/i386/misc_helper.c @@ -558,7 +558,7 @@ static void do_hlt(X86CPU *cpu) CPUX86State *env = &cpu->env; env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index c78baac6df..efc2d88810 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -759,7 +759,7 @@ static int whpx_handle_halt(CPUState *cpu) (env->eflags & IF_MASK)) && !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; - cpu->halted = true; + cpu_halted_set(cpu, true); ret = 1; } qemu_mutex_unlock_iothread(); @@ -918,7 +918,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - cpu->halted = false; + cpu_halted_set(cpu, false); } if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { @@ -944,7 +944,7 @@ static int whpx_vcpu_run(CPUState *cpu) int ret; whpx_vcpu_process_async_events(cpu); - if (cpu->halted) { + if (cpu_halted(cpu)) { cpu->exception_index = EXCP_HLT; atomic_set(&cpu->exit_request, false); return 0; From patchwork Wed Jun 17 21:01:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD60490 for ; Wed, 17 Jun 2020 21:10:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94F3E2098B for ; Wed, 17 Jun 2020 21:10:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="abTi7xGx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94F3E2098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfK9-0006oq-Np for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:10:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfDu-0003BP-Jz for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:58 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:35143) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDn-0008UC-NB for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:53 -0400 Received: by mail-qt1-x844.google.com with SMTP id z1so2776543qtn.2 for ; Wed, 17 Jun 2020 14:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KjBP9WZwlnczZ3SxEnPdyurMaB67UgSlf8Umf0tpZgo=; b=abTi7xGxOycXHf+FavHb7RymYID+HTzoPXque5EuWixdD9rNu2Y9loUZ+YbY5TWjSF 13h+mGlyuWYeGfFWN596I05f133hD2UBp76A5xL0XhIzCnqtardpZHtSJ6ijXKBDVHSW UHFWpW/FYkJI0S8/xzUJTTd92nKDj1dHsi12y42osj/AQahKmudEZSySmWnAm63Ny+Ie fBQgg9WTMpqtTEfRO2MdeL+kwd65McTsb+JIdReBEMtijNt3SsZ+glEzsl3hcOpBOwlt o3Wmi9SfhkZkGZTv/N1mUNlb227fQEf+dglSORWEwlS0ijxEcHrjnOUX58ivzRji9w+N a9HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KjBP9WZwlnczZ3SxEnPdyurMaB67UgSlf8Umf0tpZgo=; b=sKZQ46kt6agPvB3LXmJiv5qyTPLXFyFpotA3yUCIVOJ3bGxdpCEuJjvjAzD00fbOO4 E7hNGh+jhxwvKYWC3Jxlnm9awba9Rc/R4113WAbaIcWUE77Bp/TstML3zeVgQc7gwkkd gWwZcmMdKxxxynVtKk46w1FoCRwXtnkxP81gh81tUgpG08MPlYVGZ8GQiBxsSeKvCgRR ceAFsb9Njdkk4Wa5sin103Ruzr1xo9PThc2MCgQ/dBys0wJiKEJ5q0Y397TDBKbEg9Ua 3SpVt+Zj/s/4ghUmn/89wT+J2BU6uUDhZjG8v0F7L7b/XGXkFxUFRzXMwLW2KDMGDawe YU7A== X-Gm-Message-State: AOAM533FwFE7mhNHTsvLIRhv1kRMujH6GqN+1a/ueODjesVGzZge7THn 6JO2TuS/Z7TUsxy3C5uE907mUQPMSvpRbA== X-Google-Smtp-Source: ABdhPJyqwHpT6X+LkF9eljWkoUotyBmYvwY6SSUUqaAv+L5XkRwnN2X4uKqT9/qrwDs355OFATVl3A== X-Received: by 2002:ac8:7303:: with SMTP id x3mr1144098qto.44.1592427826541; Wed, 17 Jun 2020 14:03:46 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:46 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 21/73] lm32: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:39 -0400 Message-Id: <20200617210231.4393-22-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, Michael Walle , cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Michael Walle Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/lm32/op_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c index e39fcd5647..8e0bd57b9d 100644 --- a/target/lm32/op_helper.c +++ b/target/lm32/op_helper.c @@ -32,7 +32,7 @@ void HELPER(hlt)(CPULM32State *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } @@ -45,7 +45,7 @@ void HELPER(ill)(CPULM32State *env) "Connect a debugger or switch to the monitor console " "to find out more.\n"); vm_stop(RUN_STATE_PAUSED); - cs->halted = 1; + cpu_halted_set(cs, 1); raise_exception(env, EXCP_HALTED); #endif } From patchwork Wed Jun 17 21:01:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6085490 for ; Wed, 17 Jun 2020 21:12:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3313521841 for ; Wed, 17 Jun 2020 21:12:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w8fUhqA+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3313521841 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfMI-0002au-Aq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:12:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE0-0003Df-DS for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:00 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:37823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDp-0008UK-0A for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:03:59 -0400 Received: by mail-qt1-x841.google.com with SMTP id d27so2765730qtg.4 for ; Wed, 17 Jun 2020 14:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9s3zaT975n7OFyLauiO739G/mW0fqcwhecj+9+iav3g=; b=w8fUhqA+iRJtmFSwrzoP1e2deJUjj6dpEpCzDxImxM7DOAErFKp9C4t4h7+MJD7ZXg /1nZx1qIC7Xnsev0Hd5GBo4j3Sp9h87u+6NgEnVxvkmRGc6Js30MhaGBJgHCmzHW3Ww9 JDs6miaZR/7uJYi+xPZb2XSODrRIAF1vHF9INTBsiT14DkoAhEmb1LzK/+OW52WjNhub qu8y9sPgHf/ijlQFPZ5GJ3D6I49IQ5V6Drku+Lgwt0+qwzrjrqQmHdwg29SePL+bH9Cq TOweATc9wxeX50YvwnyXF4CjT3ldL32OXqve0W22LSw7Bvrz4kPDEELvQrUCQWmmj9Cs avdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9s3zaT975n7OFyLauiO739G/mW0fqcwhecj+9+iav3g=; b=OJi9y6iLXsdaEXJcFlVXwscO/9yEWTX/O6ckGMpMgWxV4atqUz7Ieq2ZKTKroTdHXD 8wf2g4NOD52sa3+66kBJ/6GKdGb1NZ0VKmV3yjuk1PuBm5I+WRZ2Fb8MHh3g+F3G9D5a 7RDOBXTy+cXwQfZj1f4lxRDYKhHtzKmNlMVS78nnc2mxZ+zZ+/OuxHlzQR/1rLwClMWr 7mtSWxgOHxClbLkvhZjDDQsYvAj8nZ438fh30ltyyr4WEFc5jRtLG0TOflptQOT4jW8T Oh0eZPf1YhA88XhsnNFk99eoS5I52SG85Enqw0OE31jbqHKC9zxUDG05owr0400UDhlt /zrw== X-Gm-Message-State: AOAM532uZ1EGYrStnC1EmoghDVwwz2ay9jGBDoPQKqQ6YjTCAAGk6OrL Z+u5mPiOSKjHTtAGYqEjuJQ3SD2baxiHhA== X-Google-Smtp-Source: ABdhPJxS5EieiKEJ1xUjSQd7F/SrsFWqMGv7Cg/BVsrStelJWI9uxu1Z5zAcdJGSi4eBVkWjd6QZ4A== X-Received: by 2002:ac8:7a90:: with SMTP id x16mr1080458qtr.233.1592427827917; Wed, 17 Jun 2020 14:03:47 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:47 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 22/73] m68k: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:40 -0400 Message-Id: <20200617210231.4393-23-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/m68k/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 202498deb5..4a032a150e 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -222,7 +222,7 @@ static void cf_interrupt_all(CPUM68KState *env, int is_hw) do_m68k_semihosting(env, env->dregs[0]); return; } - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); return; From patchwork Wed Jun 17 21:01:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CF4090 for ; Wed, 17 Jun 2020 21:15:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62D872184D for ; Wed, 17 Jun 2020 21:15:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UIrJ8GPS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62D872184D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfP4-0007me-Gw for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:15:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE5-0003F4-EK for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:05 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:43931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDt-0008UP-PL for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:05 -0400 Received: by mail-qk1-x741.google.com with SMTP id j68so138959qkb.10 for ; Wed, 17 Jun 2020 14:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bHkAJHEjthSszeufZ4EcOnf2q9qJPdqEDnGkc3v/vAE=; b=UIrJ8GPSOnQW0OYDixWOg0Ybkar/cEywpT23s8H0785SiHHmx3gE3BkDOC8S24TbhO W2i7TfbkHj9fWXVoB7yCDfNSX+KfZct2JU4HcvrXnib+Bqnw7hJJnKhiZazpEFyPPXp1 YigjPlOw6PJjDLNazEzKxiSsgwjv4F0NVtS7qpjeFrmJE9KIFY5uarATkJZhw5dhwVw4 dHU3kNmH1iO911UiwLfJ5TOl0kXrfDND1Iv/O5YNK0bwn/RpBDNx/vJOEwcsqZQTKaJr F3GPexT8cH2blQdGoUBDDevmJUxs9RQ8TrOhLGNaRsq3CROVDrsBYYDChGtKn8ze10XB /gNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bHkAJHEjthSszeufZ4EcOnf2q9qJPdqEDnGkc3v/vAE=; b=HyelD1T+q21/thf0c8MnWbvIjghOxZuIlcDZ02FjuzIpuZt3UdPmroiUFEHjfJHrgu tAZHsV5Qufi1fQ3CXe4kyIQvwIRT3W2zLr/LeFMrdJcM1GqNQ1obeJSbUIIyLjLfFjmW 6iViiuhjC9BvQLTyhjeotRnNQtArrv7O8dSvGNf6qqvyyFUzGIheS72E2HRqBMF+ict4 bVRgcxaeQY/nRZNtgIAzFE13yzkHdLgLTF43ZMS1BQfnFKPfB7ya2MWEz6sKSqRNomAq mSLHfeurAJukWOj1jA3URd3njlPIneAYBUV/GbFJIEhbSllyWhsvTMke7lLqISOKlKj7 HF8g== X-Gm-Message-State: AOAM531J3nqMBM7aAA5VQgE5lGh/3dJJY5B23/faJuDhV38jDvH0Gz/P rO2FBjLWhuvGqEAndvtKFqodIpOARfr+UA== X-Google-Smtp-Source: ABdhPJzcf8hlsnvo61iMLLG6l2rwNU0iCc/dkJAmKakGeKLizjN15fvR8yK6GJ70Tj7JeQQethXYvw== X-Received: by 2002:a37:9ad5:: with SMTP id c204mr546510qke.413.1592427829379; Wed, 17 Jun 2020 14:03:49 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:48 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 23/73] mips: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:41 -0400 Message-Id: <20200617210231.4393-24-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , robert.foley@linaro.org, Aleksandar Markovic , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted code in target/mips/kvm.c to cpu_halted.] Signed-off-by: Robert Foley --- hw/mips/cps.c | 2 +- hw/misc/mips_itu.c | 4 ++-- target/mips/cp0_helper.c | 6 +++--- target/mips/kvm.c | 2 +- target/mips/op_helper.c | 2 +- target/mips/translate.c | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index cdfab19826..51176e1be0 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -54,7 +54,7 @@ static void main_cpu_reset(void *opaque) cpu_reset(cs); /* All VPs are halted on reset. Leave powering up to CPC. */ - cs->halted = 1; + cpu_halted_set(cs, 1); } static bool cpu_mips_itu_supported(CPUMIPSState *env) diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index 3540985258..623a600ed1 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -183,7 +183,7 @@ static void wake_blocked_threads(ITCStorageCell *c) { CPUState *cs; CPU_FOREACH(cs) { - if (cs->halted && (c->blocked_threads & (1ULL << cs->cpu_index))) { + if (cpu_halted(cs) && (c->blocked_threads & (1ULL << cs->cpu_index))) { cpu_interrupt(cs, CPU_INTERRUPT_WAKE); } } @@ -193,7 +193,7 @@ static void wake_blocked_threads(ITCStorageCell *c) static void QEMU_NORETURN block_thread_and_exit(ITCStorageCell *c) { c->blocked_threads |= 1ULL << current_cpu->cpu_index; - current_cpu->halted = 1; + cpu_halted_set(current_cpu, 1); current_cpu->exception_index = EXCP_HLT; cpu_loop_exit_restore(current_cpu, current_cpu->mem_io_pc); } diff --git a/target/mips/cp0_helper.c b/target/mips/cp0_helper.c index bbf12e4a97..4d413c24d3 100644 --- a/target/mips/cp0_helper.c +++ b/target/mips/cp0_helper.c @@ -43,7 +43,7 @@ static bool mips_vpe_is_wfi(MIPSCPU *c) * If the VPE is halted but otherwise active, it means it's waiting for * an interrupt.\ */ - return cpu->halted && mips_vpe_active(env); + return cpu_halted(cpu) && mips_vpe_active(env); } static bool mips_vp_is_wfi(MIPSCPU *c) @@ -51,7 +51,7 @@ static bool mips_vp_is_wfi(MIPSCPU *c) CPUState *cpu = CPU(c); CPUMIPSState *env = &c->env; - return cpu->halted && mips_vp_active(env); + return cpu_halted(cpu) && mips_vp_active(env); } static inline void mips_vpe_wake(MIPSCPU *c) @@ -74,7 +74,7 @@ static inline void mips_vpe_sleep(MIPSCPU *cpu) * The VPE was shut off, really go to bed. * Reset any old _WAKE requests. */ - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_reset_interrupt(cs, CPU_INTERRUPT_WAKE); } diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 96cfa10cf2..92608cfe15 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -162,7 +162,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *cs) { - return cs->halted; + return cpu_halted(cs); } int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c index 9552b280e0..152b45826c 100644 --- a/target/mips/op_helper.c +++ b/target/mips/op_helper.c @@ -1124,7 +1124,7 @@ void helper_wait(CPUMIPSState *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_reset_interrupt(cs, CPU_INTERRUPT_WAKE); /* * Last instruction in the block, PC was updated before diff --git a/target/mips/translate.c b/target/mips/translate.c index 9fad58ea2c..0d0792d701 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -31495,7 +31495,7 @@ void cpu_state_reset(CPUMIPSState *env) env->tcs[i].CP0_TCHalt = 1; } env->active_tc.CP0_TCHalt = 1; - cs->halted = 1; + cpu_halted_set(cs, 1); if (cs->cpu_index == 0) { /* VPE0 starts up enabled. */ @@ -31503,7 +31503,7 @@ void cpu_state_reset(CPUMIPSState *env) env->CP0_VPEConf0 |= (1 << CP0VPEC0_MVP) | (1 << CP0VPEC0_VPA); /* TC0 starts up unhalted. */ - cs->halted = 0; + cpu_halted_set(cs, 0); env->active_tc.CP0_TCHalt = 0; env->tcs[0].CP0_TCHalt = 0; /* With thread 0 active. */ From patchwork Wed Jun 17 21:01:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD9EE90 for ; Wed, 17 Jun 2020 21:11:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3A462166E for ; Wed, 17 Jun 2020 21:11:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EaXicV2S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3A462166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:37472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfKm-0007hl-Us for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:11:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE1-0003EU-4C for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:05 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:44349) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDt-0008UW-Pi for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:00 -0400 Received: by mail-qt1-x842.google.com with SMTP id c12so2730052qtq.11 for ; Wed, 17 Jun 2020 14:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YemnOlklw+URp/aLKC6SFqz2X8HrxCoaaT+NwLjZldo=; b=EaXicV2SrI+jZc6jXA3EYsKOVyBml4iIwvFptjrgJSaDZTl1CxdsgLEDDrg+OTstid /p0bJ/ZhZckKfDS983OAVfF+wUVE7MwWOnt9zISrGsGAI0TdgZXjmtuZAkylfJPmuJCN rWV4jZmZvFyKeJ69TKoVLZO7ID9PNOqbFiQyfE7oNgXwzNxvShyC7SRsUU+wWv3dhOxC yRjfgEL1vTFweXxAEIsGR4Sy6ca4YsqjFEIcU7Fb2ifqarqgxi09BpQSMBdIr1A9I8As u+47cOCFkkr0RBF25khfp7+zOR4Xh0ga3ykD7odaen/IwSoFIRliyhzHsQkAhSo9Ul7J 0enA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YemnOlklw+URp/aLKC6SFqz2X8HrxCoaaT+NwLjZldo=; b=Es6jOgL5zJbCXNpPjAhS9+OrpTaUwo9ZL9YyW0sCGjN4fHnTQ1ox4J+neeMg1W0NGA QhRpqksYIUH6GFeU7XlPKrr+BplvSiYVw/uIirxK2Q/exOyqJ6WB+3Qa5NRv1eW8UwHD t3UOmqzrCVLtgnt+HgIL7wuPyKEZH1YCawU1mPa9L3Ru2/hPTZFNQXxVZ5p6ztXlFuYS C0+s98Lfga7Eg+DelaI7ObFkpqG31sjBq2CBdcqUlpCAEvj1HBQSB/Uy3DZyWm08pZ5q 0m1IeVBHBYk142+Vh/ixyI35hRjmwsTXuH3lgjV4Eg/HDtpmNb5JRxL60oQlHcptkK30 dd7Q== X-Gm-Message-State: AOAM533bHK+QKolMnwzfcxiwKEq8GAeKluGEf7pyZRa7UsVEPRFzAMpP 1Nl5fJ4lhgT5SWm7ZsVca9aXRfj0BMs4xA== X-Google-Smtp-Source: ABdhPJxHn8AowkC/EXsVktX4pts+OqQvGVJhH/dy8X8htxveYHYznjUY7wrfF7EOpcNQSeoyRZFQdw== X-Received: by 2002:aed:35fa:: with SMTP id d55mr1054590qte.385.1592427830871; Wed, 17 Jun 2020 14:03:50 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:50 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 24/73] riscv: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:42 -0400 Message-Id: <20200617210231.4393-25-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , "open list:RISC-V TCG CPUs" , robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , cota@braap.org, Palmer Dabbelt , peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Sagar Karandikar Cc: Bastian Koppelmann Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/riscv/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index b0c49efc4a..fe1373a95d 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -176,7 +176,7 @@ void helper_wfi(CPURISCVState *env) riscv_cpu_virt_enabled(env)) { riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); } else { - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } From patchwork Wed Jun 17 21:01:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610625 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4045A90 for ; Wed, 17 Jun 2020 21:18:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 164ED2166E for ; Wed, 17 Jun 2020 21:18:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="E22g1j7g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 164ED2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfRs-0003Qy-8r for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:18:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE7-0003Gi-3A for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:07 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:39455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDu-0008Uh-B4 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:06 -0400 Received: by mail-qk1-x744.google.com with SMTP id w3so3495306qkb.6 for ; Wed, 17 Jun 2020 14:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0Pwj8GypD7Z+8gMlM2oBcpPOEswoZuhb40JEwUc+M6A=; b=E22g1j7gZAOIPfrauv7unDiVj8oaEUe996v6ANRYFpjRygV8JeJp7JnHGJ9sQ3wzhW 1BsMgIeaEStlO58KPdX4myJwvz4+OYjDEkwiXK5sRS4SJsa6YFA8L/VdJezBDtw8RlpZ fvjSmD4anJrNztLldX54PGIahyFY2fl05q/vbwTxJCl4v57DQi1MoSewIvTjlevG8fuy J0ijf9qp/gjHOIKpgTQlMXs1Iem/w3hHTfW9pT9xsvLbAY4B2pPyVDMadOZQ0w6Cp6NG kqPK1AAq/lF6kM/DP70rwv+ytPSS9TwG1DLBvFFXoZ6Y94mlOO4QPedKMvAjgear9e92 QYqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Pwj8GypD7Z+8gMlM2oBcpPOEswoZuhb40JEwUc+M6A=; b=MG/WZZNWDETqDIEDa9qKWb/osO4OtBRB0ZUJCpjf2EzZJ1fppSudIxMPwaF3mwYPrL 80KpcUMkOrRXxWyJVYIXi0kI77/Fd51av1qQGjaq4XLszAPBWeOMgAQasyh86hAUXzEk /kpyqWnsY8wHthHyvmXQ7XVBBYpFJ3jBcqssXVTtI1XpPT2grKKVoNVUWEn/W/B//GJL U2QVUIwN3zD44Q6CqDmFMAoy/Syrk60wvb3QP3sMdsy7w4W6Ggs0SKYJsw24xyH5NgHK D9XVMnAzSicc1ZX3VXq/MAzj4koOzgKBJBp+eSSnpLfadguUxlb07YQg6PYh47FHQppX wu3g== X-Gm-Message-State: AOAM5325I/BimmgTgxxK5zeAdVUHSrwQMiaBsj191Y+bIbvJSW/i1J24 dlvJvTRw1ZrP3zjLM8lGS82lSkrYQeUYIg== X-Google-Smtp-Source: ABdhPJzlKRp2NDu/gUXDi9F0/HaA3mZ3hM17T4JGipI3qmbNMkwikHPTCSbzlin/KWSydx932iAmbw== X-Received: by 2002:a37:6813:: with SMTP id d19mr592483qkc.11.1592427832576; Wed, 17 Jun 2020 14:03:52 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:51 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 25/73] s390x: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:43 -0400 Message-Id: <20200617210231.4393-26-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , robert.foley@linaro.org, David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Christian Borntraeger Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 22 +++++++++++++++------- target/s390x/excp_helper.c | 2 +- target/s390x/kvm.c | 2 +- target/s390x/sigp.c | 8 ++++---- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index aacdb1bbc2..46ec8272c0 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -200,7 +200,7 @@ static void qemu_s390_flic_notify(uint32_t type) } /* we always kick running CPUs for now, this is tricky */ - if (cs->halted) { + if (cpu_halted(cs)) { /* don't check for subclasses, CPUs double check when waking up */ if (type & FLIC_PENDING_SERVICE) { if (!(cpu->env.psw.mask & PSW_MASK_EXT)) { diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 08eb674d22..d7a98bd52b 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -291,7 +291,7 @@ static void s390_cpu_initfn(Object *obj) S390CPU *cpu = S390_CPU(obj); cpu_set_cpustate_pointers(cpu); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; #if !defined(CONFIG_USER_ONLY) object_property_add(obj, "crash-information", "GuestPanicInformation", @@ -318,8 +318,8 @@ static void s390_cpu_finalize(Object *obj) #if !defined(CONFIG_USER_ONLY) static bool disabled_wait(CPUState *cpu) { - return cpu->halted && !(S390_CPU(cpu)->env.psw.mask & - (PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK)); + return cpu_halted(cpu) && !(S390_CPU(cpu)->env.psw.mask & + (PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK)); } static unsigned s390_count_running_cpus(void) @@ -345,10 +345,16 @@ unsigned int s390_cpu_halt(S390CPU *cpu) CPUState *cs = CPU(cpu); trace_cpu_halt(cs->cpu_index); - if (!cs->halted) { - cs->halted = 1; + /* + * cpu_halted and cpu_halted_set acquire the cpu lock if it + * isn't already held, so acquire it first. + */ + cpu_mutex_lock(cs); + if (!cpu_halted(cs)) { + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } + cpu_mutex_unlock(cs); return s390_count_running_cpus(); } @@ -358,10 +364,12 @@ void s390_cpu_unhalt(S390CPU *cpu) CPUState *cs = CPU(cpu); trace_cpu_unhalt(cs->cpu_index); - if (cs->halted) { - cs->halted = 0; + cpu_mutex_lock(cs); + if (cpu_halted(cs)) { + cpu_halted_set(cs, 0); cs->exception_index = -1; } + cpu_mutex_unlock(cs); } unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 3b58d10df3..db6640ba2c 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -537,7 +537,7 @@ try_deliver: if ((env->psw.mask & PSW_MASK_WAIT) || stopped) { /* don't trigger a cpu_loop_exit(), use an interrupt instead */ cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); - } else if (cs->halted) { + } else if (cpu_halted(cs)) { /* unhalt if we had a WAIT PSW somehwere in our injection chain */ s390_cpu_unhalt(cpu); } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index f2f75d2a57..f376c4a2f6 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1094,7 +1094,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *cs) { - return cs->halted; + return cpu_halted(cs); } static int s390_kvm_irq_to_interrupt(struct kvm_s390_irq *irq, diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c index c604f17710..44d22ae3bf 100644 --- a/target/s390x/sigp.c +++ b/target/s390x/sigp.c @@ -115,7 +115,7 @@ static void sigp_stop(CPUState *cs, run_on_cpu_data arg) } /* disabled wait - sleeping in user space */ - if (cs->halted) { + if (cpu_halted(cs)) { s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); } else { /* execute the stop function */ @@ -131,7 +131,7 @@ static void sigp_stop_and_store_status(CPUState *cs, run_on_cpu_data arg) SigpInfo *si = arg.host_ptr; /* disabled wait - sleeping in user space */ - if (s390_cpu_get_state(cpu) == S390_CPU_STATE_OPERATING && cs->halted) { + if (s390_cpu_get_state(cpu) == S390_CPU_STATE_OPERATING && cpu_halted(cs)) { s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); } @@ -313,7 +313,7 @@ static void sigp_cond_emergency(S390CPU *src_cpu, S390CPU *dst_cpu, } /* this looks racy, but these values are only used when STOPPED */ - idle = CPU(dst_cpu)->halted; + idle = cpu_halted(CPU(dst_cpu)); psw_addr = dst_cpu->env.psw.addr; psw_mask = dst_cpu->env.psw.mask; asn = si->param; @@ -347,7 +347,7 @@ static void sigp_sense_running(S390CPU *dst_cpu, SigpInfo *si) } /* If halted (which includes also STOPPED), it is not running */ - if (CPU(dst_cpu)->halted) { + if (cpu_halted(CPU(dst_cpu))) { set_sigp_status(si, SIGP_STAT_NOT_RUNNING); } else { si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; From patchwork Wed Jun 17 21:01:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610609 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DC2D60D for ; Wed, 17 Jun 2020 21:12:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54A042186A for ; Wed, 17 Jun 2020 21:12:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rYl0g55d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54A042186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfMd-0003oL-FJ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:12:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE5-0003FF-Kh for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:05 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:37882) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDy-0008Ut-3e for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:05 -0400 Received: by mail-qk1-x735.google.com with SMTP id b27so3509458qka.4 for ; Wed, 17 Jun 2020 14:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P/Z/EXXqAnjV0sexMMAA4/Iljvg21zFf1h2uuTezcCs=; b=rYl0g55datJBDFOzYMAmY/qRs0L2+E1EYtDPb3ksHvVLJcqUHrpW8wYokoG5DNO+Fi bIjE8ztfakJGXq7daiaJCguXuZUr9mFHSQI13yB6Gq4DLYnenjL/s5GHkfN0EqJ3hcnv qsxtamP9muOpEFwv2WCSvuUd32Gv44hUp43M5UtYygsJn1gIxvmb14fS4M8IDIFMsonY L5dJ+I0fJ6UTJiUbWaXWfxVEedsI+iviFZ6TOPxyM6Tv7B6N2y3kAtEhHrne1R4LMhj2 OYYltDDj9mEFHAbaUuHZ5rbBbPhQTqJ7jKjHJGpwjhopaW23i0wV4zUx766vuUXMFAj7 WJ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P/Z/EXXqAnjV0sexMMAA4/Iljvg21zFf1h2uuTezcCs=; b=mHUGu6OBDjucRaUMOMWhD2JtBulkxG0vtOyI+4YVyaDZIHavZ6yZ5vp5dcTkjALs0u MwNPGnNmjOSkbYfKnkpxWb649jQ1C4nFsO2pRSiUQPFEllPsXDCwLnbRC2HdnS7uWKPT PftSTy6SkTmk1HJmdFANZj2PzjPAhsKCa6LWZeBovi0LbTkppOGfZLKPsoY4yeER7ek3 biNdcJQuzuARxgsgQviaM9FPXWhcOzGOVRPIsggQeP3FP59ETyCx1ABA+wopd7zoPSvn hZmjyD4IZiXXYJN92d99ESIC58wp018zrrW0LWKJbffD/WCllQQCoc3Er1PH7YolrZ68 QzDQ== X-Gm-Message-State: AOAM533ye0HsY2QqPZ8rcKMzc6V++3MoTUPGA5OwYHDKQhtHEp0tBjs1 DGKrKX88vr2gikmAhibWKRb+/+/r13hEyg== X-Google-Smtp-Source: ABdhPJyriGqbN04M4QQNoNrZwND12p2JQjyvNPY62On3fXEpCBEG+5rxR+7OWtR8gmWmV5tpI68M5A== X-Received: by 2002:a05:620a:14b8:: with SMTP id x24mr532712qkj.284.1592427834123; Wed, 17 Jun 2020 14:03:54 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:53 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 26/73] sparc: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:44 -0400 Message-Id: <20200617210231.4393-27-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x735.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Mark Cave-Ayland , Fabien Chouteau , KONRAD Frederic , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Fabien Chouteau Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/sparc/leon3.c | 2 +- hw/sparc/sun4m.c | 8 ++++---- hw/sparc64/sparc64.c | 4 ++-- target/sparc/helper.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index d40b7891f6..aea1b4200f 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -132,7 +132,7 @@ static void main_cpu_reset(void *opaque) cpu_reset(cpu); - cpu->halted = 0; + cpu_halted_set(cpu, 0); env->pc = s->entry; env->npc = s->entry + 4; env->regbase[6] = s->sp; diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index ee52b5cbbc..12f9ac1b61 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -193,7 +193,7 @@ static void cpu_kick_irq(SPARCCPU *cpu) CPUSPARCState *env = &cpu->env; CPUState *cs = CPU(cpu); - cs->halted = 0; + cpu_halted_set(cs, 0); cpu_check_irqs(env); qemu_cpu_kick(cs); } @@ -224,7 +224,7 @@ static void main_cpu_reset(void *opaque) CPUState *cs = CPU(cpu); cpu_reset(cs); - cs->halted = 0; + cpu_halted_set(cs, 0); } static void secondary_cpu_reset(void *opaque) @@ -233,7 +233,7 @@ static void secondary_cpu_reset(void *opaque) CPUState *cs = CPU(cpu); cpu_reset(cs); - cs->halted = 1; + cpu_halted_set(cs, 1); } static void cpu_halt_signal(void *opaque, int irq, int level) @@ -832,7 +832,7 @@ static void cpu_devinit(const char *cpu_type, unsigned int id, } else { qemu_register_reset(secondary_cpu_reset, cpu); cs = CPU(cpu); - cs->halted = 1; + cpu_halted_set(cs, 1); } *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS); env->prom_addr = prom_addr; diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 100b2fab17..fe9c678459 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -101,7 +101,7 @@ static void cpu_kick_irq(SPARCCPU *cpu) CPUState *cs = CPU(cpu); CPUSPARCState *env = &cpu->env; - cs->halted = 0; + cpu_halted_set(cs, 0); cpu_check_irqs(env); qemu_cpu_kick(cs); } @@ -116,7 +116,7 @@ void sparc64_cpu_set_ivec_irq(void *opaque, int irq, int level) if (!(env->ivec_status & 0x20)) { trace_sparc64_cpu_ivec_raise_irq(irq); cs = CPU(cpu); - cs->halted = 0; + cpu_halted_set(cs, 0); env->interrupt_index = TT_IVEC; env->ivec_status |= 0x20; env->ivec_data[0] = (0x1f << 6) | irq; diff --git a/target/sparc/helper.c b/target/sparc/helper.c index 07d87efa4e..90dfb1e92f 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -244,7 +244,7 @@ void helper_power_down(CPUSPARCState *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; env->pc = env->npc; env->npc = env->pc + 4; From patchwork Wed Jun 17 21:01:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 903BE1392 for ; Wed, 17 Jun 2020 21:15:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67AC921883 for ; Wed, 17 Jun 2020 21:15:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HOARYgXf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67AC921883 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfP4-0007lW-Kq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:15:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE6-0003GF-DH for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:06 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:46789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDy-0008V0-5e for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:06 -0400 Received: by mail-qv1-xf41.google.com with SMTP id cv17so1737085qvb.13 for ; Wed, 17 Jun 2020 14:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LDQ6XQ/3vPiAN54mt6Pw+hfW8ObudV4rT2qqPEmK+8U=; b=HOARYgXfUN1w6kPg1m35xgFG7+zdTYVR2nuOJfUhF1lcd1PQVx1xDUlhNG6Hho4Xnm GVQqebUe69kQxHIcnR24Sc30EfbV8pOtG0ihqc59NGKxF59U8KpvsUePe4H+B+45lQcd YiP4zPsVGZ3sDnwGggTRReCkaHSl7oJQ3s0H/Lm1iGqW3LnT4d3va+1FnZKYGSindyty cgWN7fmwWXp4UFJQ9xB/E90NSGfALEqNzJLcbDZ/BhOx1q0nUzAirR3s7UK3awqPZvFe MUDX10Ii/CF1E3ptvGFYXFft7otsDk0iWDElUiP1f5fMBY181D11SP7vj6XQamALVFLi vRNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LDQ6XQ/3vPiAN54mt6Pw+hfW8ObudV4rT2qqPEmK+8U=; b=e82BMz5uG3hQRVJic3ReEwz4qV6K+jEGolCClFT8cm3MTCFR+d1ZC0roBZr8lXThYT D6rRLI6zUtYIkEfMExheivVYkamOcm1/Yw1c5uvL2sy4CgRUiaQHAowlxFIKmfFn3BP0 A7UvemrbExrpmX3bl1V9KA/7o8zWPWJnEHBru0s8Ti6QYJ+1D5LM83NPpK711cPTUIvM 3ZQNpaE/osfZqDO3vVEGzUACAbH+sLDHOu/KtQ/+ltfBjP+v8szZryRXNv4sxUioaXDA cWmTdAlBW/aIbO8K4+W+8h9RPz6Ldr0TDjMmibKCscGTTdLsKf/SgLotMtKJeTeqRu2q gM1Q== X-Gm-Message-State: AOAM531sPCO9dUULror8NWCXxVa3e0ysqRse8W+adKzOFL4V+aK8zkI6 OKHJwBJjgd0h1pdQcCx+jX+KHxgsTzA42A== X-Google-Smtp-Source: ABdhPJxCw0A9I66SY7k9zYJkAvR/W4PwZLJQu2LBYzBCkZsdUh3HOeVhFNqoj/obmC4VuPjji0+Vzg== X-Received: by 2002:ad4:46a9:: with SMTP id br9mr554986qvb.246.1592427835455; Wed, 17 Jun 2020 14:03:55 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:54 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 27/73] xtensa: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:45 -0400 Message-Id: <20200617210231.4393-28-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Max Filippov Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/xtensa/cpu.c | 2 +- target/xtensa/exc_helper.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 82c2ee0679..fda4a73722 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -102,7 +102,7 @@ static void xtensa_cpu_reset(DeviceState *dev) #ifndef CONFIG_USER_ONLY reset_mmu(env); - s->halted = env->runstall; + cpu_halted_set(s, env->runstall); #endif } diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c index 601341d13a..01d1e56feb 100644 --- a/target/xtensa/exc_helper.c +++ b/target/xtensa/exc_helper.c @@ -115,7 +115,7 @@ void HELPER(waiti)(CPUXtensaState *env, uint32_t pc, uint32_t intlevel) return; } - cpu->halted = 1; + cpu_halted_set(cpu, 1); HELPER(exception)(env, EXCP_HLT); } diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 7073381f03..031a14cf86 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -328,7 +328,7 @@ void xtensa_runstall(CPUXtensaState *env, bool runstall) CPUState *cpu = env_cpu(env); env->runstall = runstall; - cpu->halted = runstall; + cpu_halted_set(cpu, runstall); if (runstall) { cpu_interrupt(cpu, CPU_INTERRUPT_HALT); } else { From patchwork Wed Jun 17 21:01:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 571FA1392 for ; Wed, 17 Jun 2020 21:20:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DB3421883 for ; Wed, 17 Jun 2020 21:20:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FLazHiiM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DB3421883 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfUB-0007aM-D2 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:20:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE7-0003Gg-3s for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:07 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:39456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDy-0008V4-6M for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:06 -0400 Received: by mail-qk1-x744.google.com with SMTP id w3so3495522qkb.6 for ; Wed, 17 Jun 2020 14:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r3ihf6Hm5TzP8tkXXmmJd+HhpHTqUNEyVizEpWsgvtc=; b=FLazHiiMttd3/Qd+Dl/Rze/N8LbtIMW3GoaMCj4W1fl1o0Yl35Z2o0BYg52G5ggmAB 7T2Um0hj/foyGWbpjIHDiGGGmhQ6MU+dJE0qTP1MbRPvyr7YkQ3KxOy/ZPeJa6S+BSl7 IOngYd60f5oHr5U7C8XS3o9sk2f3nrx3rpDx1bQ7G59v1tavYzGMINDx0YBufOUlEsAe w4lZb6tuyKCK+xm9owNYFNVcVcRHG+xrhFF3rSwD0xEnvfNE4FXquQoMu/NcXdoPu46j NZVeaUEJJHcW4jAFbUs+NZh/pD6Y7raWKPy+MJuTKwkLHfKGe7AdDHosd8JL15PudG+a 8mvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r3ihf6Hm5TzP8tkXXmmJd+HhpHTqUNEyVizEpWsgvtc=; b=QfukeIaWbc3cYYfr2SGuqHl+gAbZVpNWzc+ZHG/brGcl8z+kCWqTDG5N1Kh2FosjxU VZKbduUn8bk53LbzTb8afodSNjMkpNW56ggVfd7IW9+TSEdlyvMZ8EMBtwmh2VYk/AUg G0I63AKSgJntYQJ3QM9Jl6b6eYiyqKzt+euZc4TowxjDEwBlhWM8saJIsE7apCmBqp39 GhaxDprH/2YvZkrOAEVl5iJ2wT4xO7DjYuHUaa0ukF7o8Mw2STCTF7ao36HRrZOd76XQ gsFpB47Tb8DTyMUABVQXi1UGt21nKFfm/Xd95YNFoOl0pGzwgRDXs1hIDauSpllhuwxo b5uQ== X-Gm-Message-State: AOAM530hAUMQKZbbUQM/U46M1XpwmEDS8JqErwl5OU1TBdp7ScLlt9pG DVTF4iOLS0au+t7p6mkzBmaAk4j6Au2dIA== X-Google-Smtp-Source: ABdhPJyAThCZa/zBmHIFbY4iGsWkaL1FbA02flAYJWC/OYAUSKBAuRDs5KdvXwy+EwJlzMK7/CnNbA== X-Received: by 2002:a37:4ed2:: with SMTP id c201mr604934qkb.138.1592427836755; Wed, 17 Jun 2020 14:03:56 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:56 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 28/73] gdbstub: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:46 -0400 Message-Id: <20200617210231.4393-29-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 6950fd243f..b25796b33d 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2062,10 +2062,10 @@ static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx) g_autofree char *cpu_name = object_get_canonical_path_component(OBJECT(cpu)); g_string_printf(rs, "%s %s [%s]", cpu_model, cpu_name, - cpu->halted ? "halted " : "running"); + cpu_halted(cpu) ? "halted " : "running"); } else { g_string_printf(rs, "CPU#%d [%s]", cpu->cpu_index, - cpu->halted ? "halted " : "running"); + cpu_halted(cpu) ? "halted " : "running"); } trace_gdbstub_op_extra_info(rs->str); memtohex(gdbserver_state.str_buf, (uint8_t *)rs->str, rs->len); From patchwork Wed Jun 17 21:01:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A26571392 for ; Wed, 17 Jun 2020 21:27:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78E072166E for ; Wed, 17 Jun 2020 21:27:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IRM0C7pF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78E072166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfaY-0001XX-Lj for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:27:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE7-0003Gm-4n for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:07 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:45357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfDz-0008VC-QP for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:06 -0400 Received: by mail-qk1-x743.google.com with SMTP id q8so3450292qkm.12 for ; Wed, 17 Jun 2020 14:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O0fBrT3P1tRSLH4phcxb7WjFxDduimB9rIeQgvMHfic=; b=IRM0C7pFoTg1L2sxI+taEDC+ZG+BeUGjMY10i9SdEfHlp8J4ikn0QpCpjT46EbbG7F Li03oMkZyZCDVCAxh4gcJInYBus6QuVgHT4CV7kc8Gt0TjbpI/AAZmd2zo5h6cboMpG2 MG41Mt4E1It1M/E+CwmPObEW3vvXzdtG0YjZz0VtaoQl/30CDN3DfcIDju2vzBOr1XYk 2PI3lsk8tJ1QWxJctVPOR9SBT+3UXu7aQfY1S5OmtS+I0UPe2KJiUuucUr5HX3t4YVUA fthaMmkKyjP5VQoUWnEC+VjpbVulj2QKs+2MUExykcqKdFup8m+kEx5mYsAHS6/E1OgF Q/UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O0fBrT3P1tRSLH4phcxb7WjFxDduimB9rIeQgvMHfic=; b=DszzcW2csKduhfqt+QrMOaoZZkSSn5Q8TBk/+rOxd/NdlvJlYcK0GdY7Z15GF3LgsJ wORLddRiT+/8/aFL2Qnxu2pTEaaCPXVTVRJ3IvbVUbcK2zOPzoBVAMhHsxZvjyeEKarU 420ZhkdG+Ich0Xbv5UBrP3tZG2m02Mu/UyiIg0YqfFkFH4nbLOshG0BpztRCRJ+irCcq 9tIOQxy6aFa2O7msuibg47D2HRkVdCfwrqrqBSyiKIvruQEGUkW+kAc7xkMrQF3O7Qjr eidIxcAUhwM0g+CO2kePsxL/KCHvgbkE9MK5STYjNuam1wGaxziOYCLMI5rN1hOFskzK Zyzw== X-Gm-Message-State: AOAM532YK1A9LVJ4ZSD+XcK4aY7cLbHqNuTZAlPhI44rQzbkKxIGXWtX mdZn3H3WFsL92CPmuwDOhaIHjzwu3pLDJw== X-Google-Smtp-Source: ABdhPJxp01N+0tR1SNc6jCm8XkcTNe3ng9IOq+hSRY/lAQXSe/KRtNsuZN9EZ800nJwotnufr0Tvsw== X-Received: by 2002:a05:620a:2213:: with SMTP id m19mr608072qkh.244.1592427838111; Wed, 17 Jun 2020 14:03:58 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:57 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 29/73] openrisc: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:47 -0400 Message-Id: <20200617210231.4393-30-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, Stafford Horne , cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Stafford Horne Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index d9fe6c5948..2615571ce7 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -134,7 +134,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) if (env->pmr & PMR_DME || env->pmr & PMR_SME) { cpu_restore_state(cs, GETPC(), true); env->pc += 4; - cs->halted = 1; + cpu_halted_set(cs, 1); raise_exception(cpu, EXCP_HALTED); } break; From patchwork Wed Jun 17 21:01:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C318F912 for ; Wed, 17 Jun 2020 21:25:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A8EE2166E for ; Wed, 17 Jun 2020 21:25:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mvQxS9Ba" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A8EE2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfYS-000692-S3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:25:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEA-0003M7-Tm for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:10 -0400 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]:38879) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfE0-0008VI-Lt for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:10 -0400 Received: by mail-qv1-xf44.google.com with SMTP id ec10so1759797qvb.5 for ; Wed, 17 Jun 2020 14:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pBQreEfimlo/TeCu0za1hNbEWK5jCOhKGwDICZx6xko=; b=mvQxS9BaVCNlAsDmYqVgirbmHemc9z5WGJbjnkzJv9ld/zyyZnu2xIuYAEslfWbhRH F0UFFmKK9x7rybo2O0NewTwltqm2r1k+4KdIBj/9sJ2/Vmokmyry8qIJaWNKfScDuH63 qyu3ICvzmMwurx+Eoo+8C1+iFvJMGXX11vb+Uwx1e35m/kA8OPODIky6I7YThgaDKUf1 INQtuUChZzhR4ix/qMdLcXTbRXp+kbLvJGjit+ApcHspQ51etdD1mX2UO1kiLgnirtGZ 2rol7lbp1wGZ/6SbHz9PzLVSaJHsNlA0f8a7PFj0QK0f8530JVKEutKjUMfG/qPtMoPP uP4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pBQreEfimlo/TeCu0za1hNbEWK5jCOhKGwDICZx6xko=; b=OCKk5osMC81pB/ardUXjVUk7urg0QspjIQg8YkYYHYDft6N8ESj4AsjWyNFzez4hVV SSSOr5oe7dtACOhN9PjXZYIlg96wjBYXv0cA9kEY9KaQAWkUK1lWSA9QDi/mhJqigC6E HlDwq11cQsNMUuQYntFkiHqg3JWqdv4PHHRBjo83J326EncwmK1H9MwjUrgsJ11/9YuU 9icILbepu6aIpsSdrowCtORKhv9a6XQ5nCqgOLaeXa+W+5+jJzif2c6Y8/gjCh9pkuZr wDZ0gZJCZl1PKWjsu1Pqxe2TW27Zk//oQkUhjlMiXjRzV0xce0GToDJ4gFUYRfTR7NPv 6wiA== X-Gm-Message-State: AOAM532xGlLBVhoZEDT3+fpHmxB8c0RaQ/TgH+GyUWFBKewU8bvYWFk9 K/pE3PJwImibw+3Ia+ASj7WybTJKKYew7w== X-Google-Smtp-Source: ABdhPJyYrZ1uBKzifJhfGS0O+c6KGeE4xxlb8UUt+Gho5aEbJ3lKBpPux2D/YwwyH87j+UAFFgk2rw== X-Received: by 2002:a0c:d40b:: with SMTP id t11mr623582qvh.0.1592427839478; Wed, 17 Jun 2020 14:03:59 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:03:58 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 30/73] cpu-exec: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:48 -0400 Message-Id: <20200617210231.4393-31-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f44; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf44.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d95c4848a4..e296894ea1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -425,14 +425,21 @@ static inline TranslationBlock *tb_find(CPUState *cpu, return tb; } -static inline bool cpu_handle_halt(CPUState *cpu) +static inline bool cpu_handle_halt_locked(CPUState *cpu) { - if (cpu->halted) { + g_assert(cpu_mutex_locked(cpu)); + + if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); + + /* prevent deadlock; cpu_mutex must be acquired _after_ the BQL */ + cpu_mutex_unlock(cpu); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + apic_poll_irq(x86_cpu->apic_state); cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); qemu_mutex_unlock_iothread(); @@ -442,12 +449,22 @@ static inline bool cpu_handle_halt(CPUState *cpu) return true; } - cpu->halted = 0; + cpu_halted_set(cpu, 0); } return false; } +static inline bool cpu_handle_halt(CPUState *cpu) +{ + bool ret; + + cpu_mutex_lock(cpu); + ret = cpu_handle_halt_locked(cpu); + cpu_mutex_unlock(cpu); + return ret; +} + static inline void cpu_handle_debug_exception(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); @@ -546,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; - cpu->halted = 1; + cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); return true; From patchwork Wed Jun 17 21:01:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 137AA13A0 for ; Wed, 17 Jun 2020 21:23:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF3002166E for ; Wed, 17 Jun 2020 21:23:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r/cNR2lk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF3002166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfWP-0002bd-5v for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE9-0003I3-8j for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:09 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:43608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfE5-0008Vc-2z for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:08 -0400 Received: by mail-qv1-xf43.google.com with SMTP id dp10so1742987qvb.10 for ; Wed, 17 Jun 2020 14:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sbez58I4EiEfgiO/NYT9T3e4CNH+JdYMM0H0+QygWQ0=; b=r/cNR2lkier1zsQCfbqN+DznF2rDQqhEHqzWL8z3/6fRWGjh5S98S3sIqQB1jGRRxn jr66U4ove8He3107YfX8oGCerP7Q7KVb2Jqp5mgQ9cyEZnV3P5ezICRtEDTXVDkkgSzf 69WJvV+RVzFIjuqPxQ7yIVL4LcHulHZixEBPMF+CwLRbWrtI1MsO2df33qT0jHenJEd4 Duxo6v51uLzJgcqhijwqPoMddz/aVJtpaDpy3cFgkREkpZwHBToM9f3DKlv9v8IsfJHa 741NG9taUGI5akF6ktd1OR9CaOJJ43wwGOUJhTZIR1nTy86r6nR6QsoFRTjEJSn/9ne9 S7dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sbez58I4EiEfgiO/NYT9T3e4CNH+JdYMM0H0+QygWQ0=; b=okRmljyn+swDJzvevu85T8SZaJYsbAPH5eRZ1zThDlCRjE4p9p+mmypPGyf/piDCN9 Ix3Iaru2p8iaizswKxOd3PnvKwWAzuZsBzy8PYxpQQBrA4wIZ1oTPPcaqOEWQjvOkyvT EAh349HaXEX5OX850VVLe2ax5wC4eUjm1e74qZUOY2mXk+OTu+36Ic9zGpWR/2xG90fi jo9Cucbcn/5qqYvO+xKOXtLSerUDVJN1+6nKSqQJDzA6EdvmAF5aHqC9kATWz9IfeErf ii7AXb08p4eLbaKbrvTeS/3/bJ8q5TvTZ82LCpmSmouclsxZtuExy6SRzQTbb1WLge8r 6fwg== X-Gm-Message-State: AOAM533ZRLpE+/jf21gwkKvuBXmqVZ6me0EmGWU513PEzHgLZ9QPqfWO 6oxUiL6WeWNDEUiKyC742Z5WWd2gC15/3A== X-Google-Smtp-Source: ABdhPJxf/Fia+TxyAytQCRWEJI2MUmt8v+j8/rMBqU5C1YznoiI6qJaYCQq7Z0rs7mF+vn9f8iYtGA== X-Received: by 2002:a05:6214:1842:: with SMTP id d2mr535702qvy.197.1592427841007; Wed, 17 Jun 2020 14:04:01 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:00 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 31/73] cpu: convert to cpu_halted Date: Wed, 17 Jun 2020 17:01:49 -0400 Message-Id: <20200617210231.4393-32-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This finishes the conversion to cpu_halted. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 2 +- cpus.c | 4 ++-- hw/core/cpu.c | 2 +- hw/core/machine-qmp-cmds.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e296894ea1..099dd83ee0 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -435,7 +435,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); - /* prevent deadlock; cpu_mutex must be acquired _after_ the BQL */ + /* locking order: cpu_mutex must be acquired _after_ the BQL */ cpu_mutex_unlock(cpu); qemu_mutex_lock_iothread(); cpu_mutex_lock(cpu); diff --git a/cpus.c b/cpus.c index 8edc9858d6..e070bffbff 100644 --- a/cpus.c +++ b/cpus.c @@ -223,7 +223,7 @@ static bool cpu_thread_is_idle(CPUState *cpu) if (cpu_is_stopped(cpu)) { return true; } - if (!cpu->halted || cpu_has_work(cpu) || + if (!cpu_halted(cpu) || cpu_has_work(cpu) || kvm_halt_in_kernel()) { return false; } @@ -1865,7 +1865,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) * * cpu->halted should ensure we sleep in wait_io_event */ - g_assert(cpu->halted); + g_assert(cpu_halted(cpu)); break; case EXCP_ATOMIC: qemu_mutex_unlock_iothread(); diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 1d2cafe76c..64a1bf3e92 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -259,7 +259,7 @@ static void cpu_common_reset(DeviceState *dev) } cpu->interrupt_request = 0; - cpu->halted = 0; + cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->icount_extra = 0; atomic_set(&cpu->icount_decr_ptr->u32, 0); diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 2c5da8413d..a35559b5d8 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -62,7 +62,7 @@ CpuInfoList *qmp_query_cpus(Error **errp) info->value = g_malloc0(sizeof(*info->value)); info->value->CPU = cpu->cpu_index; info->value->current = (cpu == first_cpu); - info->value->halted = cpu->halted; + info->value->halted = cpu_halted(cpu); info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); info->value->thread_id = cpu->thread_id; #if defined(TARGET_I386) From patchwork Wed Jun 17 21:01:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7AB7912 for ; Wed, 17 Jun 2020 21:29:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE89421883 for ; Wed, 17 Jun 2020 21:29:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pxbDiHWq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE89421883 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfcu-0005QR-Vc for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfE9-0003Hi-0J for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:09 -0400 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]:36744) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfE5-0008Vj-2Z for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:07 -0400 Received: by mail-qk1-x736.google.com with SMTP id 205so3519792qkg.3 for ; Wed, 17 Jun 2020 14:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MqrgrNTQ/ix1Dv7Vxho5rUxV7/F8VuXS30653W0xsHs=; b=pxbDiHWqDjdbSYz4Nr7qe5Nnf8SNlv3vdF/xKuTyXCanWL0j11BVGokBv3jrVA3Pva Vpy7wd5AbO8HJ/ScuLEmDLK47ube3CtN8MBU7gS4qipZ75UpXCOzb4/GeJbCMfz9QUIJ VAwy5Iiozk9ejkKCiYZLxNnBWpRpvWTT6Mkh8Z1Dt2Sb462J7edP/vx855pnj3iioVbi RLFc6cDA2XM8IqOQyfqpPP98XCKSDRiffJCfX/h33K9e3zbp2/dgjNTcwjSXqykpnDVr MmHZrvSfsXXhQ+zlfq3wMr8m3mGgoAov+WkdeoaoYIL3IVaMAymWPpijGPit3+aYjCVi b63Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MqrgrNTQ/ix1Dv7Vxho5rUxV7/F8VuXS30653W0xsHs=; b=Z4A9TBqTfyz8W46nChgVXBuehH7WpIZ8GlRXWrHAKOJeeWi47EmqmE0LEc5Bvcn2CU WJDXhtczpRc6p+ObKINOuKhqSWzYHd3FFxHiSkO0Mltaz+Ei0QqIB3Wv4IsJoX7w4iDy gVgFMzLM3TwwdJ2tHy6NggANG9xt7MGF/xL0LAFTK1W+J9uzsRecaHKmS0BswsFdNGtc ew7vFccZFmK742BkUMa+DNd7eU7e0MReKd+MDUD4DKs0XUwcM3arBk0PA2Eo/hogxZa2 IhW6R99PJp0gHRNYMH5WiVso26b0WAJGs1GRQEtXpeN2YNulPYlppOk6jf5p/9FM//Tg djtg== X-Gm-Message-State: AOAM532AU8A7TnrAIqSqXLLQAZ1qX4hoIh1yE34EVXnvzEZ7CNiv21df PrdXJ2xNB2gqvxeuR5zdm+gf9pTi5PFZHg== X-Google-Smtp-Source: ABdhPJyQmN7ygmXBAnkvcrrWpT2g1xjvKyQ/lYMBvAtkb/JtQFLFDOb4OPLRpBdCRdpypnR5Y9di9Q== X-Received: by 2002:a37:a84c:: with SMTP id r73mr332364qke.0.1592427842402; Wed, 17 Jun 2020 14:04:02 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:01 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 32/73] cpu: define cpu_interrupt_request helpers Date: Wed, 17 Jun 2020 17:01:50 -0400 Message-Id: <20200617210231.4393-33-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x736.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Add a comment about how atomic_read works here. The comment refers to a "BQL-less CPU loop", which will materialize toward the end of this series. Note that the modifications to cpu_reset_interrupt are there to avoid deadlock during the CPU lock transition; once that is complete, cpu_interrupt_request will be simple again. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/core/cpu.c | 27 +++++++++++++++++++++------ include/hw/core/cpu.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 64a1bf3e92..d3223f6d42 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -99,14 +99,29 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool need_lock = !qemu_mutex_iothread_locked(); + bool has_bql = qemu_mutex_iothread_locked(); + bool has_cpu_lock = cpu_mutex_locked(cpu); - if (need_lock) { - qemu_mutex_lock_iothread(); + if (has_bql) { + if (has_cpu_lock) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + } else { + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + cpu_mutex_unlock(cpu); + } + return; + } + + if (has_cpu_lock) { + cpu_mutex_unlock(cpu); } - cpu->interrupt_request &= ~mask; - if (need_lock) { - qemu_mutex_unlock_iothread(); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + qemu_mutex_unlock_iothread(); + if (!has_cpu_lock) { + cpu_mutex_unlock(cpu); } } diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 92069ebc59..6f2c005171 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -522,6 +522,43 @@ static inline void cpu_halted_set(CPUState *cpu, uint32_t val) cpu_mutex_unlock(cpu); } +/* + * When sending an interrupt, setters OR the appropriate bit and kick the + * destination vCPU. The latter can then read interrupt_request without + * acquiring the CPU lock, because once the kick-induced completes, they'll read + * an up-to-date interrupt_request. + * Setters always acquire the lock, which guarantees that (1) concurrent + * updates from different threads won't result in data races, and (2) the + * BQL-less CPU loop will always see an up-to-date interrupt_request, since the + * loop holds the CPU lock. + */ +static inline uint32_t cpu_interrupt_request(CPUState *cpu) +{ + return atomic_read(&cpu->interrupt_request); +} + +static inline void cpu_interrupt_request_or(CPUState *cpu, uint32_t mask) +{ + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request | mask); + return; + } + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request | mask); + cpu_mutex_unlock(cpu); +} + +static inline void cpu_interrupt_request_set(CPUState *cpu, uint32_t val) +{ + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, val); + return; + } + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, val); + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; From patchwork Wed Jun 17 21:01:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610623 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C7E61392 for ; Wed, 17 Jun 2020 21:18:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1368B2166E for ; Wed, 17 Jun 2020 21:18:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ejmPWiR0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1368B2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfRp-0003KX-8D for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:18:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEA-0003KX-BP for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:10 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:46910) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfE5-0008Vr-4S for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:09 -0400 Received: by mail-qt1-x841.google.com with SMTP id g18so2723364qtu.13 for ; Wed, 17 Jun 2020 14:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9A7y00FSGgamAX20OqsIrmd5Bhg8NgpNlEQx1G0undg=; b=ejmPWiR0v02UVxmZ398zLrIXxCek8QuDnCa6ZDQi298AcyuiOwoXb8UGDGN/LQ+kHN /k4Xcb/L3C+Fiq4BL7Z4/taW4VsO9qgjiGO4DfGYsOq4JBeMRg1WUlvXedRB8tPH1288 KUFkh59Q8Tb1H/MvV/r3tlQSVCvmq5WKMXC/0mUMs8CgFAC5lheR/r+UvtsvofxabO8K 6ORkMlYLMIKU/LNBA10Lh077jbH5Dr++2NR+7Bxvo3tbFimHnH5RZoK9RMU8ILwY2Gf7 epJiVHKCo7+yw+/E+A1K/3G/B72xOG+wwXgjV2WXgoOlQyDxU8GqoB7uZuNn5N2JejuN /ruQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9A7y00FSGgamAX20OqsIrmd5Bhg8NgpNlEQx1G0undg=; b=GuFz01+La0Y/XUTeA6GiUn9zT0w1A3gyY6shEOZfeCAkr4B4jcREEENLj3XXXrOuR4 jFPzUJSCioasTCvYQsx/lyvg928WJiYY/p653lXoqRsCSUWKY6WpMkM8jDBaU0EpfgP+ bLlb339wPuQhBMsQWzTYUV7JvPRd0CxGsX9X5t6HiUjxavV9FUlaV1WloUuSGS6gHXI9 EzSQnyI+sEi7QPchBSfoHjk+uCSJp9GqnOafxj7TwUMqCobNzm6oC9FJYGmdPbEcP7su Xuaa20aq9qkyFCc8re1fgHDIEknvC79dYjrvksawPKqKVtHMYhQEF8meoiH09vvrLPVZ ZEPA== X-Gm-Message-State: AOAM532e4S+CISupnH5k/Zx5w4mgqceJebND2KZeUycmGMzrGL9KPOEa HzNG5Kk4rENyajdEgFee+F0AE772zNQ2Jw== X-Google-Smtp-Source: ABdhPJwyu5JcTS5Tgzntf3Vg8FGyhu2oC9siLtvrpzvlhf+Jih/q83gvaId6kY7S2VmKxUcknkhE0w== X-Received: by 2002:aed:3e5d:: with SMTP id m29mr1085289qtf.125.1592427843830; Wed, 17 Jun 2020 14:04:03 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:03 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 33/73] ppc: use cpu_reset_interrupt Date: Wed, 17 Jun 2020 17:01:51 -0400 Message-Id: <20200617210231.4393-34-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: qemu-ppc@nongnu.org Acked-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 507f64c9e7..bf9e1e27e9 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1060,7 +1060,7 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) { - cs->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } return true; } From patchwork Wed Jun 17 21:01:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A46AF912 for ; Wed, 17 Jun 2020 21:20:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79CE12098B for ; Wed, 17 Jun 2020 21:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XM/7BK+/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79CE12098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfU6-0007Sw-Nd for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:20:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEA-0003L8-Ik for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:10 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:43935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfE6-0008W5-Ep for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:10 -0400 Received: by mail-qk1-x743.google.com with SMTP id j68so139639qkb.10 for ; Wed, 17 Jun 2020 14:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kW0XRsqxaI6VAROraHDcJYsTCy7+fL1IiAmTn+bRRXA=; b=XM/7BK+/iHa4FBsC1UBLrfofa7/j6P5RMeFU/Ek8K59mhBj47wxLUaaCGpCbX4em5m 5fM10wnUeGFErzBgK3m2N4P3Ht0oni0C5QoJt/6WV0s0AzRdxF8dwZyt221bV8PmDSPh 7CpwRw6/TfY8uRmXXGZfWKwKpSPbGutShDsAja4MIamIvhBUv+ekuyUm4KgGCpUFB65q 4b1xQeF3Ixs8gML2Uhe94Q34OPoQ8Qsi1jys6OlHJjcfKI9r80oQY12PZKzmsFd0Qvim ituAiAmJtsGTkUcI4HQenqDFJTHCdLXxdqaf7+RUdTEL3WyfFf4t6PSI9o4rk/0p/9H4 rsrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kW0XRsqxaI6VAROraHDcJYsTCy7+fL1IiAmTn+bRRXA=; b=VLTH/uXxWgFBG8vFj+mglvEkMmAtLoAkH5RnagPGKYH9VLm///qe7yK2O9NvYNtaMJ McTlvfajzr0Wwn9t1zIP2dQ5Lo3M5RWxlA/LM8c7sPZd1QitwYiHsuJFcBsrfMOkuk/2 ku2hktJTeEt1rvsd5Bt6vSV8qVhudQgVcamj/77NEzHvJSWWCUffa0UlF87FmEIig2Zb IugHiGGN02MubmgVQzJFKEkjMsbfJLvsfifazGWwMheJ4mZkwwxKzIsZOYjJFbkbZjqS LKAtsq13ZBOqwhICMup9FhdjyP6Sm0esNXArrkYzTK4uUz32ZoNXBlv/sho7561Mo6PE wlIQ== X-Gm-Message-State: AOAM5301He4jhU2eL3EO/HET25IG4lCA4pZpiyyJw3On5hVpAptjLB8y LFB4+IKmvEudWZ0eF7Pra+HTxnVPLU+WzA== X-Google-Smtp-Source: ABdhPJxhTs+/3LWI+xZKLjMn+wzxlDw7mA8mFD6NxqHpAD82UqFp3nCcm+WmsCaIhKKn1IIntHs4iw== X-Received: by 2002:a37:383:: with SMTP id 125mr522609qkd.487.1592427845272; Wed, 17 Jun 2020 14:04:05 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:04 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 34/73] exec: use cpu_reset_interrupt Date: Wed, 17 Jun 2020 17:01:52 -0400 Message-Id: <20200617210231.4393-35-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index d6712fba7e..58fc928801 100644 --- a/exec.c +++ b/exec.c @@ -752,7 +752,7 @@ static int cpu_common_post_load(void *opaque, int version_id) /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the version_id is increased. */ - cpu->interrupt_request &= ~0x01; + cpu_reset_interrupt(cpu, 1); tlb_flush(cpu); /* loadvm has just updated the content of RAM, bypassing the From patchwork Wed Jun 17 21:01:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7190A912 for ; Wed, 17 Jun 2020 21:23:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 388082168B for ; Wed, 17 Jun 2020 21:23:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NySidOpP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 388082168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfWO-0002YC-E1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:23:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEC-0003Pd-9r for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:12 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:38878) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfE8-00004u-Tv for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:11 -0400 Received: by mail-qv1-xf42.google.com with SMTP id ec10so1759998qvb.5 for ; Wed, 17 Jun 2020 14:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D0B+23tpZukrgbMI7+fpAiYqU7WS51LFOzw8uiXiuuo=; b=NySidOpPj08qTC/OUAD4iCGfmMMUMdI8V27RWpNzsQj/0giNTvkASqGBb9i50IicKE 3u7ZNhhTJRjT8cAg/o4VPHVeT8cBkFu/VowQ3bXxZf5noPAGA3c4pZr2H0Y5VQtgLsNX oOge0ZsglI9P6rUDyI3I8tYa30WQdhU3FXok+pmewaPLYsY1Ku1xRpFyfsNCRIJDP17t Almw3DTLOPZLdd7k4hOxKCFm6BBLDZBrKLnDm+4dQ8WJd3fNwFYrmkoYLxNi+5KTrQ+n wyud3HedV46rnAqgXhfqVWRBxDunpln+eVi5ADy2DsZyUPQhbcKIoKJF0yt9gD7WtDWP Bv1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D0B+23tpZukrgbMI7+fpAiYqU7WS51LFOzw8uiXiuuo=; b=pWKLHsHFIjR0FCWj7b7CwjTVwqrICLDsN5Q28EWAq9tge+Cb29wEisXb6H3M5u0LYM 7kWeOPnhF+ps9pm7KT6/Nvy/6XR6qCzfy2RTvcoxx650gDdFBDqgJRHTpExNGe3Q2U3k AsbUzxiDNsPZ784OKzPDzNM/MpKtsKxfO30D+45ha4fvlr7XSPtFLJqzrXTIlQo6O7s9 ZNYcz3DVvTEKei2JmQppTHeDw8BarQig0VflHrQH8v1W4V7nVUCdSCWfq6Wi4pr1w2E3 y5D54EB3IKIRsba3HlPfIERH3YuVU5JOhEt0Pbz1Wt3X+FvVFVFP/jOVsBr5Y4/B9Sul 6Bmw== X-Gm-Message-State: AOAM533+sk9vg0DNtyMNVBHzOFfx7yOh5H2wrROnGEat150KHr3DYtf/ y1ABgmgaAAT/OeJYzdAX4i29TvrbSko5SQ== X-Google-Smtp-Source: ABdhPJwmTac+YV6mlbff6cEKmbKEtUOTbUH+fkvhUa9tQ4NH0/IRI8OLYSp1kNlKqL6EK9pRjA+GzA== X-Received: by 2002:a05:6214:1432:: with SMTP id o18mr549317qvx.57.1592427847060; Wed, 17 Jun 2020 14:04:07 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:06 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 35/73] i386: use cpu_reset_interrupt Date: Wed, 17 Jun 2020 17:01:53 -0400 Message-Id: <20200617210231.4393-36-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, "open list:X86 KVM CPUs" , Marcelo Tosatti , Eduardo Habkost , Roman Bolshakov , cota@braap.org, "open list:X86 HAXM CPUs" , Wenchao Wang , Paolo Bonzini , peter.puhov@linaro.org, Sunil Muthuswamy , Richard Henderson , alex.bennee@linaro.org, Colin Xu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/hax-all.c | 4 ++-- target/i386/hvf/x86hvf.c | 8 ++++---- target/i386/kvm.c | 14 +++++++------- target/i386/seg_helper.c | 13 ++++++------- target/i386/svm_helper.c | 2 +- target/i386/whpx-all.c | 10 +++++----- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index acfb7a6e10..6a4152730f 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -438,7 +438,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) irq = cpu_get_pic_interrupt(env); if (irq >= 0) { hax_inject_interrupt(env, irq); - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); } } @@ -486,7 +486,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) } if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index c09cf160ef..8e9b60d0a7 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -402,7 +402,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | EXCP02_NMI; wvmcs(cpu_state->hvf_fd, VMCS_ENTRY_INTR_INFO, info); } else { @@ -414,7 +414,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK) && !(info & VMCS_INTR_VALID)) { int line = cpu_get_pic_interrupt(&x86cpu->env); - cpu_state->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD); if (line >= 0) { wvmcs(cpu_state->hvf_fd, VMCS_ENTRY_INTR_INFO, line | VMCS_INTR_VALID | VMCS_INTR_T_HWINTR); @@ -440,7 +440,7 @@ int hvf_process_events(CPUState *cpu_state) } if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && @@ -453,7 +453,7 @@ int hvf_process_events(CPUState *cpu_state) do_cpu_sipi(cpu); } if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR); hvf_cpu_synchronize_state(cpu_state); apic_handle_tpr_access_report(cpu->apic_state, env->eip, env->tpr_access_type); diff --git a/target/i386/kvm.c b/target/i386/kvm.c index eda51904dd..8628fa9111 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3658,7 +3658,7 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) */ events.smi.pending = cs->interrupt_request & CPU_INTERRUPT_SMI; events.smi.latched_init = cs->interrupt_request & CPU_INTERRUPT_INIT; - cs->interrupt_request &= ~(CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); + cpu_reset_interrupt(cs, CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); } else { /* Keep these in cs->interrupt_request. */ events.smi.pending = 0; @@ -4021,7 +4021,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) if (cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { qemu_mutex_lock_iothread(); - cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); qemu_mutex_unlock_iothread(); DPRINTF("injected NMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_NMI); @@ -4032,7 +4032,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) } if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { qemu_mutex_lock_iothread(); - cpu->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); qemu_mutex_unlock_iothread(); DPRINTF("injected SMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_SMI); @@ -4068,7 +4068,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) (env->eflags & IF_MASK)) { int irq; - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { struct kvm_interrupt intr; @@ -4139,7 +4139,7 @@ int kvm_arch_process_async_events(CPUState *cs) /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */ assert(env->mcg_cap); - cs->interrupt_request &= ~CPU_INTERRUPT_MCE; + cpu_reset_interrupt(cs, CPU_INTERRUPT_MCE); kvm_cpu_synchronize_state(cs); @@ -4169,7 +4169,7 @@ int kvm_arch_process_async_events(CPUState *cs) } if (cs->interrupt_request & CPU_INTERRUPT_POLL) { - cs->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } if (((cs->interrupt_request & CPU_INTERRUPT_HARD) && @@ -4182,7 +4182,7 @@ int kvm_arch_process_async_events(CPUState *cs) do_cpu_sipi(cpu); } if (cs->interrupt_request & CPU_INTERRUPT_TPR) { - cs->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cs, CPU_INTERRUPT_TPR); kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(cpu->apic_state, env->eip, env->tpr_access_type); diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c index b96de068ca..818f65f35f 100644 --- a/target/i386/seg_helper.c +++ b/target/i386/seg_helper.c @@ -1332,7 +1332,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) switch (interrupt_request) { #if !defined(CONFIG_USER_ONLY) case CPU_INTERRUPT_POLL: - cs->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); break; #endif @@ -1341,23 +1341,22 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) break; case CPU_INTERRUPT_SMI: cpu_svm_check_intercept_param(env, SVM_EXIT_SMI, 0, 0); - cs->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cs, CPU_INTERRUPT_SMI); do_smm_enter(cpu); break; case CPU_INTERRUPT_NMI: cpu_svm_check_intercept_param(env, SVM_EXIT_NMI, 0, 0); - cs->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cs, CPU_INTERRUPT_NMI); env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); break; case CPU_INTERRUPT_MCE: - cs->interrupt_request &= ~CPU_INTERRUPT_MCE; + cpu_reset_interrupt(cs, CPU_INTERRUPT_MCE); do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); break; case CPU_INTERRUPT_HARD: cpu_svm_check_intercept_param(env, SVM_EXIT_INTR, 0, 0); - cs->interrupt_request &= ~(CPU_INTERRUPT_HARD | - CPU_INTERRUPT_VIRQ); + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); @@ -1372,7 +1371,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); - cs->interrupt_request &= ~CPU_INTERRUPT_VIRQ; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ); break; #endif } diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index 7b8105a1c3..63eb136743 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -700,7 +700,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->hflags &= ~HF_GUEST_MASK; env->intercept = 0; env->intercept_exceptions = 0; - cs->interrupt_request &= ~CPU_INTERRUPT_VIRQ; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ); env->tsc_offset = 0; env->gdt.base = x86_ldq_phys(cs, env->vm_hsave + offsetof(struct vmcb, diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index efc2d88810..d5beb4a5e2 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -790,14 +790,14 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { - cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { - cpu->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -820,7 +820,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { new_int.InterruptionType = WHvX64PendingInterrupt; @@ -911,7 +911,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) } if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } @@ -927,7 +927,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) } if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { - cpu->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); whpx_cpu_synchronize_state(cpu); apic_handle_tpr_access_report(x86_cpu->apic_state, env->eip, env->tpr_access_type); From patchwork Wed Jun 17 21:01:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610611 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5397A90 for ; Wed, 17 Jun 2020 21:14:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D94F921841 for ; Wed, 17 Jun 2020 21:14:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FXuMrH/a" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D94F921841 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfOD-0006w8-UC for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:14:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEB-0003Oi-Um for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:11 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:43959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEA-00005O-0p for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:11 -0400 Received: by mail-qt1-x844.google.com with SMTP id v19so301336qtq.10 for ; Wed, 17 Jun 2020 14:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OzUdSzbvDHrAdBgz7T3QQ9Qj/8hER0zlUjzEzhKy+Cs=; b=FXuMrH/ayFieQeNBk58pBYu631HqHSlzSzfND2T+mxHfKeUhQVTf3u8CJd2e9tPV5L ki1uVigHNioK4v6sTW7g1KGdY7sCT/FuxItCNa/SmM+hnc6L7WpLGbbzUX3/Gfkbqkwh 6Bqw4zuOZpBlFas1ci0kqwt8xTXBaIs1CATSNfaJYdT61mUBiCYj0fxsTa0uQ47z1GoH YMxzb+k7L6kFvZnTKOY6FLhAiyKALfCBUknuAXfUnG2Usg7XheyXZilfOeJXMWqrk3Dp g5MdItvGr3bvtnbcpTQ60Wxj32vDgbd7pbJt59G5hqnZK1neKhA5Dtl3RE1mrW9bxy35 QqVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OzUdSzbvDHrAdBgz7T3QQ9Qj/8hER0zlUjzEzhKy+Cs=; b=uXzeDlphY5uaM3xVw9jpuAweAL8rDPQmd8jPSzHwXk+7iea9HAlaIJbpkpLSCQlQQw toXEVzPUNx7ysJe4fUcorsGqZ3igO05y8a1S+uzIaIZORbE4zrN224hTaJEQ/0PXELv3 +x7PZpkqJ7K4XXKWeLo75gSe7RyuGiqgBrkcBPkRvSY5y7VmLvREj/IlwTjCkTwkjkfE UhC4KkmQcWoGvD8imT5CodC/J6lJm9wA/NiYEPMuDGf7JJGK3ILoGBjDUQr+jpjIlV59 80QbbkyIrrf9KcKooLlHLQkyINK3cRHZ2U9iK0rF+zsgKhgXX06lnPQ4VFM1cBWx3O1G QIxg== X-Gm-Message-State: AOAM5325A1P7nFlcXdYbVVJrTeDMLr/ZtMm4LW1zJUR69kbjimrbhZuW X4CazGkklfF4pL+yEEQmcZZ4PzzDpxMlxw== X-Google-Smtp-Source: ABdhPJyF16sG7NBWpMntU37cYM/KPisBoMQLSRvrWGinFdgmeLhsWdNSr+DC3UzuzyILis+im0HDUg== X-Received: by 2002:ac8:341a:: with SMTP id u26mr1164523qtb.36.1592427848788; Wed, 17 Jun 2020 14:04:08 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:08 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 36/73] s390x: use cpu_reset_interrupt Date: Wed, 17 Jun 2020 17:01:54 -0400 Message-Id: <20200617210231.4393-37-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , robert.foley@linaro.org, David Hildenbrand , Cornelia Huck , qemu-s390x@nongnu.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: qemu-s390x@nongnu.org Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/s390x/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index db6640ba2c..dde7afc2f0 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -530,7 +530,7 @@ try_deliver: /* we might still have pending interrupts, but not deliverable */ if (!env->pending_int && !qemu_s390_flic_has_any(flic)) { - cs->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } /* WAIT PSW during interrupt injection or STOP interrupt */ From patchwork Wed Jun 17 21:01:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610647 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9A62912 for ; Wed, 17 Jun 2020 21:25:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0A7D2166E for ; Wed, 17 Jun 2020 21:25:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GyJ/jnNz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0A7D2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfYQ-00066y-VM for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:25:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfED-0003SI-EW for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:13 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:41175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEB-00005t-8F for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:13 -0400 Received: by mail-qt1-x844.google.com with SMTP id w90so2749980qtd.8 for ; Wed, 17 Jun 2020 14:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UAoGpC+tFU+Lrmci3F+3S0Zh/4YRyJd+sLsoLGG3MBc=; b=GyJ/jnNzWFStVefIGozuSYyimRxYRgtyThR8wWWfcLxMxTgodWUbTNsJm7+K6Gk/jt Swkd65jaLs9BIyGmf19466GvogyyztH+CozDC/Yte5nSHy0Nc48vCEFBTBESqoVBh1Yz VJrfQqCdgSOOiIX/wIuXEmdALEyCro5PgiGD1bfanKbIg7upgrfvHzwxb3cVt/+SXiQq DsRayPIPVCe8tJ6bsHuL4oTi2q60Bvn6YaJvRU/ejBME1KoGFLKpVYxcMX3Jxv2x2D3Z Zommg/zn4c9xSlxqActFrbyX0CF40LU5I6RTnHXCzm6E28z8wfAzlP0lomBbZxgeuq/G yX2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UAoGpC+tFU+Lrmci3F+3S0Zh/4YRyJd+sLsoLGG3MBc=; b=LI4pNEsDl2mFDVd1ZzF6vYEa/g7m1lBF5vShVPac1S60UEoaslVz3oO1ydEjfvNoaV Zb4PhdSYbAjoqJradlrWb8vA+vFrUj2detdwODifSxOa2bcAYndFi0BsAWuvu+idZ+Ek xpN4jT5ICfT1xcpgvAEjDvFs/86GIHiuXjLFj/bO7UHZ502gmmWqZrDuFLwLE2oH7g9R 344AgJ2luTuBTolO/RIVTjyfvqSEXGd2MiTn1Yd5e4D0lE5vmTR7PDFwdZamOB5YP15O Qn5dJM5fD4v2xavUixucsUJDjJDoFj4zVvjMeyWSuF3RSj+sUdiIEzG4M9QN/4mAvlXn ZVIg== X-Gm-Message-State: AOAM5300Pj+7jxhWfjwRPFXMb4zl6jToFcdtkBNpLp2HjRtbQfmjdGzn pUBlV6h267prwyEEDdkveMhSAiTYcsmjjw== X-Google-Smtp-Source: ABdhPJzwqD3fbpvBkGjredjWWtP1MVsaFqx1+8dr68eOHTjcOCHfO4/UbmyDCveBrHzUw3sou+F/gw== X-Received: by 2002:ac8:6edb:: with SMTP id f27mr1039501qtv.325.1592427850072; Wed, 17 Jun 2020 14:04:10 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:09 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 37/73] openrisc: use cpu_reset_interrupt Date: Wed, 17 Jun 2020 17:01:55 -0400 Message-Id: <20200617210231.4393-38-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, Stafford Horne , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 2615571ce7..e54c148d4f 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -167,7 +167,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) env->ttmr = (rb & ~TTMR_IP) | ip; } else { /* Clear IP bit. */ env->ttmr = rb & ~TTMR_IP; - cs->interrupt_request &= ~CPU_INTERRUPT_TIMER; + cpu_reset_interrupt(cs, CPU_INTERRUPT_TIMER); } cpu_openrisc_timer_update(cpu); From patchwork Wed Jun 17 21:01:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19AE01392 for ; Wed, 17 Jun 2020 21:27:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E51C62166E for ; Wed, 17 Jun 2020 21:27:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GozekeXF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E51C62166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfac-0001jL-5G for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:27:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEE-0003Vm-SH for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:14 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:35146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEC-00006U-Qs for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:14 -0400 Received: by mail-qt1-x841.google.com with SMTP id z1so2777492qtn.2 for ; Wed, 17 Jun 2020 14:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w3X/TBVNKMn8EXCp7BpdBrJlJ5hMtFe3cm30uQpq+d0=; b=GozekeXFYlWQXc1tMVUl/JqyJ9gj3I7wtlDcVuLTMgtCkIfkbkJSx66XqbZX6HxjoW xCTsRkmRhQmNSiIw3YYxP5pPqAP5gYylI4rPfzid97zPwDhcrSSDjgV6zBDuB1AACSad VKcvAdjwP2F0UgMR59wTRkSGMBy0FyxyLA4jScOfkz0Wja3f1qpwzzySRiKEij+xlNGE NrFf/C+jji+/nRN0A1eQIjENRQiM9lzVkepDE5DczAy/ZsXzlJsyWI7J77ox2rbkHsve MLmLE+ww80hJYbPM6Dat6tcyxeuBSOivaHKkjcl8hhuXco23AAsBmU/ec7CceBYzrzdu DFCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w3X/TBVNKMn8EXCp7BpdBrJlJ5hMtFe3cm30uQpq+d0=; b=JOHxrSkGMOjQG91UJH2/5od5vVC4dDwocbEpIAx/JYwSf9XfeYrYqfbjhnTJ47pZLn thS57iLHDcW7IBwhUmI7wKh9mAGf5ymGQ3nsAegCnFC5iSLHhaT1Koc9yY+LuNSwoftm C91FfuG3Dw5dmxfpAtdZHQ3BRrlotBqc3wkXMcMfpr0SbA7ZphI699tS2xk113VtXyMD JkvE0ABvTSUAITHA9agOrRjdeimrqAjljMONOuBkavAOVgBIsrFjYXLG80e2q+u4LBJv wEbdZ+BLCk9EXCV1osYVhyoyeS4pINoxqLspAg3sh9RoXUbbXmJLzr/TuTJxUJlXsbwO UpWg== X-Gm-Message-State: AOAM532gqvhQbdmxzKBbFzaSIE+Jz6GwZ0x2Wt57qnLLBFteG7s/e4up zblyBsGw17URi2YPueWzTcP2ciGTvBkSjw== X-Google-Smtp-Source: ABdhPJw7/ieyWQ3tZwJNV12DlE9QivM4axAwt8bvqYtOPk6CdxHncwUi33b7qpMrvkTRJltoS05k+w== X-Received: by 2002:ac8:5354:: with SMTP id d20mr1105252qto.363.1592427851478; Wed, 17 Jun 2020 14:04:11 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:10 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 38/73] arm: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:01:56 -0400 Message-Id: <20200617210231.4393-39-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , robert.foley@linaro.org, cota@braap.org, qemu-arm@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/arm/cpu.c | 6 +++--- target/arm/helper.c | 16 +++++++--------- target/arm/machine.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index df5c019145..2b11e126a8 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -75,7 +75,7 @@ static bool arm_cpu_has_work(CPUState *cs) ARMCPU *cpu = ARM_CPU(cs); return (cpu->power_state != PSCI_OFF) - && cs->interrupt_request & + && cpu_interrupt_request(cs) & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_EXITTB); @@ -586,7 +586,7 @@ void arm_cpu_update_virq(ARMCPU *cpu) bool new_state = (env->cp15.hcr_el2 & HCR_VI) || (env->irq_line_state & CPU_INTERRUPT_VIRQ); - if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VIRQ) != 0)) { + if (new_state != ((cpu_interrupt_request(cs) & CPU_INTERRUPT_VIRQ) != 0)) { if (new_state) { cpu_interrupt(cs, CPU_INTERRUPT_VIRQ); } else { @@ -607,7 +607,7 @@ void arm_cpu_update_vfiq(ARMCPU *cpu) bool new_state = (env->cp15.hcr_el2 & HCR_VF) || (env->irq_line_state & CPU_INTERRUPT_VFIQ); - if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VFIQ) != 0)) { + if (new_state != ((cpu_interrupt_request(cs) & CPU_INTERRUPT_VFIQ) != 0)) { if (new_state) { cpu_interrupt(cs, CPU_INTERRUPT_VFIQ); } else { diff --git a/target/arm/helper.c b/target/arm/helper.c index 972a766730..37ac1cabfe 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2079,26 +2079,27 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) CPUState *cs = env_cpu(env); uint64_t hcr_el2 = arm_hcr_el2_eff(env); uint64_t ret = 0; + uint32_t interrupt_request = cpu_interrupt_request(cs); bool allow_virt = (arm_current_el(env) == 1 && (!arm_is_secure_below_el3(env) || (env->cp15.scr_el3 & SCR_EEL2))); if (allow_virt && (hcr_el2 & HCR_IMO)) { - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (interrupt_request & CPU_INTERRUPT_VIRQ) { ret |= CPSR_I; } } else { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { ret |= CPSR_I; } } if (allow_virt && (hcr_el2 & HCR_FMO)) { - if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { + if (interrupt_request & CPU_INTERRUPT_VFIQ) { ret |= CPSR_F; } } else { - if (cs->interrupt_request & CPU_INTERRUPT_FIQ) { + if (interrupt_request & CPU_INTERRUPT_FIQ) { ret |= CPSR_F; } } @@ -9591,10 +9592,7 @@ void arm_cpu_do_interrupt(CPUState *cs) } #endif - /* Hooks may change global state so BQL should be held, also the - * BQL needs to be held for any modification of - * cs->interrupt_request. - */ + /* Hooks may change global state so BQL should be held */ g_assert(qemu_mutex_iothread_locked()); arm_call_pre_el_change_hook(cpu); @@ -9609,7 +9607,7 @@ void arm_cpu_do_interrupt(CPUState *cs) arm_call_el_change_hook(cpu); if (!kvm_enabled()) { - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_EXITTB); } } #endif /* !CONFIG_USER_ONLY */ diff --git a/target/arm/machine.c b/target/arm/machine.c index c5a2114f51..42f4368de3 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -713,7 +713,7 @@ static int cpu_post_load(void *opaque, int version_id) if (env->irq_line_state == UINT32_MAX) { CPUState *cs = CPU(cpu); - env->irq_line_state = cs->interrupt_request & + env->irq_line_state = cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VFIQ); } From patchwork Wed Jun 17 21:01:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610619 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8635D1392 for ; Wed, 17 Jun 2020 21:17:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D9D52166E for ; Wed, 17 Jun 2020 21:17:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BwPPvfcY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D9D52166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:32854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfRG-0002dE-HU for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:17:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEG-0003Wx-63 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:16 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:37880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEE-00007X-7u for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:15 -0400 Received: by mail-qk1-x731.google.com with SMTP id b27so3510324qka.4 for ; Wed, 17 Jun 2020 14:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4aryhQbcmaB7oNBbR9UD5nwcxfkIN5/StOGhgwEfKig=; b=BwPPvfcY3SN6EkACB8Aw04cAGgk26UutV0tjcSaMPiPDr1sX1TwEwIxzHSNEM7VtFn XbApUFCS09sXSuvnsdChjTl4LOx4Q6GXccgbUrI67MPyIPtsIT6RjUFIDK131NiQZjr0 HDXZLwi4OT0BmOf7kXLzMbLlIP22E7hQ0JVxpuajweYrdKMs+bwX2khBtvFGwvF/vaLs tDvn4n8dHBGMnLAVNw0OGT3MAeToKIHA0vzkbRdJ5UrCFSCD6B8Lrs5IQtYliEcQMKkv zHCJ4vXrmQjhc8K+Y5bsdtEJaCAuDSk55kIgCA04+FLw2nylCbE+KLbQANQGGCp0NuWM F1pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4aryhQbcmaB7oNBbR9UD5nwcxfkIN5/StOGhgwEfKig=; b=N7PFu9oChtqbVvTsVvWvQXm6BQpX3xojLkSLEBWnhVkP7/nkTYZmzbBJWZHKm3XZHU kIl+RS3+CQoP8Hm+dahPmygp53r0qCAIw6nSzVAdG6hxFK9YsdRqgLu0RMs1tJ5MLGQz RhsrsYeFKjkTrDL3EHipsTdC+PHDoSRHRC9wxipEHrwjF2Lg4FV3qUAmen1R5pRocRlT V4d8elYUaJH+zLPDgKIPb5tRPJhchgEqyf7uKJc8+3TIoaKgd2pnAzgI1/SbGMaHi3Wq FeUqrigmsuogUU57gdLCR7yukpVQkHrPQZp2+eCPok7sIV4zZ+5KkxgskZG4je4gnqDX Lw8A== X-Gm-Message-State: AOAM532cEw/LGaBq6oT4uYAjTYupoDkYZRbCjTHE7p5gtoLUjTUm2R/0 aT4iwsqJ1Ix7Hs3qeHRlwp7ClGMKNriycA== X-Google-Smtp-Source: ABdhPJyju7vmLoHpCcD0cYBcsx3wNUKHeGKSLAyqnl8xM8It0WMH5WMieDP5E/ZZyjTy8xDPZQhTCg== X-Received: by 2002:a05:620a:3cc:: with SMTP id r12mr627072qkm.44.1592427852927; Wed, 17 Jun 2020 14:04:12 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:12 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 39/73] i386: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:01:57 -0400 Message-Id: <20200617210231.4393-40-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x731.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/cpu.c | 2 +- target/i386/helper.c | 4 ++-- target/i386/svm_helper.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 4d3ab0f3a2..59ac96bd01 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7093,7 +7093,7 @@ int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request) static bool x86_cpu_has_work(CPUState *cs) { - return x86_cpu_pending_interrupt(cs, cs->interrupt_request) != 0; + return x86_cpu_pending_interrupt(cs, cpu_interrupt_request(cs)) != 0; } static void x86_disas_set_info(CPUState *cs, disassemble_info *info) diff --git a/target/i386/helper.c b/target/i386/helper.c index 058de4073d..623a7299ac 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -1029,12 +1029,12 @@ void do_cpu_init(X86CPU *cpu) CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; CPUX86State *save = g_new(CPUX86State, 1); - int sipi = cs->interrupt_request & CPU_INTERRUPT_SIPI; + int sipi = cpu_interrupt_request(cs) & CPU_INTERRUPT_SIPI; *save = *env; cpu_reset(cs); - cs->interrupt_request = sipi; + cpu_interrupt_request_set(cs, sipi); memcpy(&env->start_init_save, &save->start_init_save, offsetof(CPUX86State, end_init_save) - offsetof(CPUX86State, start_init_save)); diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index 63eb136743..c739bf0d9c 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -316,7 +316,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend) if (int_ctl & V_IRQ_MASK) { CPUState *cs = env_cpu(env); - cs->interrupt_request |= CPU_INTERRUPT_VIRQ; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_VIRQ); } /* maybe we need to inject an event */ @@ -674,7 +674,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->vm_vmcb + offsetof(struct vmcb, control.int_ctl)); int_ctl &= ~(V_TPR_MASK | V_IRQ_MASK); int_ctl |= env->v_tpr & V_TPR_MASK; - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_VIRQ) { int_ctl |= V_IRQ_MASK; } x86_stl_phys(cs, From patchwork Wed Jun 17 21:01:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B638D1392 for ; Wed, 17 Jun 2020 21:20:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C01A212CC for ; Wed, 17 Jun 2020 21:20:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RQ63kTM3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C01A212CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfTU-0006Vc-As for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:20:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEH-0003aT-N3 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:17 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:43937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEF-00009C-J2 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:17 -0400 Received: by mail-qk1-x743.google.com with SMTP id j68so140069qkb.10 for ; Wed, 17 Jun 2020 14:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bMJDR0op9yYxk4Q3uQ7Lh3faQWxq/2pZw+Fv/nrXz+A=; b=RQ63kTM3AKz8TNyE0qqe3WkxI4DWPU9SoW1W8pf9NzcSXpE0kY0LeFIbtftZnxkj4x xZuG7uhNcOEJpQEDpXhvC4mN6Up5589I6u4feY9dRApjrGtw0jzbP/VS3RgTMf+3aBMs KTTbCR481jg527+8nsl8LO+Vk/i0cl2OV8eCwCMyefErmZD3bZ1vHgf1mAxZ2ABZZCPj fT0xXvOy6UqjOHQopPv8256ETNp9vw1p7oH/cVAr7hjf0NIgnlygj/9hIa6OTvoYpio8 yEHxkxu+nZ+YVDtvv47ypap+qoRvdvBgWhM6O73KoW/1Uk32RfTR5O74JLUdSLiGrb3n Zk+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bMJDR0op9yYxk4Q3uQ7Lh3faQWxq/2pZw+Fv/nrXz+A=; b=q2PgbqpYXAvRDQTXAWTocHCJI2PR9vhI3SCgp+QzpYKrGiBzYRy06Wqx+wCO/VX1Oi QwASCsbAK+YcofbJk4svNJCpvv1gaK+LFA27UEDjrVl280tS+6+n10iLoYUI5+MY/igU uxX6SFed/C6EcImdciZJBP54bQq1XuL28330oHjakB7YPOL7oaA1SWFsKIM27THYzPFR dthz5cUJXMxGY7IKt3LCJVuZ4nXmCt/l6vQHiw/JCEcSyjYk/1FV00h2yIJTFFpPLbFe cOXLFfN9+drd6sDSIxNO+rV4vygvDiyHCKUyVy9EK0Ugag1pCLsgrlSH3kiHrGpmW87e QrLg== X-Gm-Message-State: AOAM533bj7LhLy9QAj0d2P2TWCnueGw+/iKJB/JjJrCuJ1MYom1coicA h1J3ZJDz7yfoHmFGG/XvED1/8Y2krRiQ2g== X-Google-Smtp-Source: ABdhPJznqaLvi+9naqRjgbuk4+KNhEW9buBCGiCCF3iJ7TMvCWyNwsADfAY+cpYywUMGIYMeZlcjcA== X-Received: by 2002:a37:5e07:: with SMTP id s7mr625733qkb.20.1592427854372; Wed, 17 Jun 2020 14:04:14 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:13 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 40/73] i386/kvm: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:01:58 -0400 Message-Id: <20200617210231.4393-41-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, "open list:X86 KVM CPUs" , Marcelo Tosatti , Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/kvm.c | 58 ++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 8628fa9111..415a6d8114 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3653,11 +3653,14 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) events.smi.smm = !!(env->hflags & HF_SMM_MASK); events.smi.smm_inside_nmi = !!(env->hflags2 & HF2_SMM_INSIDE_NMI_MASK); if (kvm_irqchip_in_kernel()) { + uint32_t interrupt_request; + /* As soon as these are moved to the kernel, remove them * from cs->interrupt_request. */ - events.smi.pending = cs->interrupt_request & CPU_INTERRUPT_SMI; - events.smi.latched_init = cs->interrupt_request & CPU_INTERRUPT_INIT; + interrupt_request = cpu_interrupt_request(cs); + events.smi.pending = interrupt_request & CPU_INTERRUPT_SMI; + events.smi.latched_init = interrupt_request & CPU_INTERRUPT_INIT; cpu_reset_interrupt(cs, CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); } else { /* Keep these in cs->interrupt_request. */ @@ -4015,14 +4018,14 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) { X86CPU *x86_cpu = X86_CPU(cpu); CPUX86State *env = &x86_cpu->env; + uint32_t interrupt_request; int ret; + interrupt_request = cpu_interrupt_request(cpu); /* Inject NMI */ - if (cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { - qemu_mutex_lock_iothread(); + if (interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); - qemu_mutex_unlock_iothread(); DPRINTF("injected NMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_NMI); if (ret < 0) { @@ -4030,10 +4033,8 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) strerror(-ret)); } } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { - qemu_mutex_lock_iothread(); + if (interrupt_request & CPU_INTERRUPT_SMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); - qemu_mutex_unlock_iothread(); DPRINTF("injected SMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_SMI); if (ret < 0) { @@ -4047,16 +4048,22 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) qemu_mutex_lock_iothread(); } + /* + * We might have cleared some bits in cpu->interrupt_request since reading + * it; read it again. + */ + interrupt_request = cpu_interrupt_request(cpu); + /* Force the VCPU out of its inner loop to process any INIT requests * or (for userspace APIC, but it is cheap to combine the checks here) * pending TPR access reports. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -4064,7 +4071,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) if (!kvm_pic_in_kernel()) { /* Try to inject an interrupt if the guest can accept it */ if (run->ready_for_interrupt_injection && - (cpu->interrupt_request & CPU_INTERRUPT_HARD) && + (interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) { int irq; @@ -4088,7 +4095,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) * interrupt, request an interrupt window exit. This will * cause a return to userspace as soon as the guest is ready to * receive interrupts. */ - if ((cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD)) { run->request_interrupt_window = 1; } else { run->request_interrupt_window = 0; @@ -4134,8 +4141,9 @@ int kvm_arch_process_async_events(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; - if (cs->interrupt_request & CPU_INTERRUPT_MCE) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_MCE) { /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */ assert(env->mcg_cap); @@ -4158,7 +4166,7 @@ int kvm_arch_process_async_events(CPUState *cs) } } - if ((cs->interrupt_request & CPU_INTERRUPT_INIT) && + if ((cpu_interrupt_request(cs) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { kvm_cpu_synchronize_state(cs); do_cpu_init(cpu); @@ -4168,20 +4176,21 @@ int kvm_arch_process_async_events(CPUState *cs) return 0; } - if (cs->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cs->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cs); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cs->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 0); } - if (cs->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { kvm_cpu_synchronize_state(cs); do_cpu_sipi(cpu); } - if (cs->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cs, CPU_INTERRUPT_TPR); kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(cpu->apic_state, env->eip, @@ -4195,10 +4204,13 @@ static int kvm_handle_halt(X86CPU *cpu) { CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; + + interrupt_request = cpu_interrupt_request(cs); - if (!((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cs->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 1); return EXCP_HLT; } From patchwork Wed Jun 17 21:01:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2B6460D for ; Wed, 17 Jun 2020 21:30:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 897362168B for ; Wed, 17 Jun 2020 21:30:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rW65jctj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 897362168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfdK-0005i4-Od for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:30:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEJ-0003fb-3G for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:19 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:40509) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEH-0000As-8o for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:18 -0400 Received: by mail-qk1-x742.google.com with SMTP id c185so3482973qke.7 for ; Wed, 17 Jun 2020 14:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VHZjlUaQqM5GtwqE4D5+D6h1EspkQ+6Rl4guLSEBSAc=; b=rW65jctjvH3r1V0QQCpLFxV92Q8HELkZYRBzjiw48re9Oq4ktX+sKEWxBDM3ToS+ER wGl/jf00OTfgHLkjaKMUpx/AoKKU56sPW8nVgfFS8xc0NHsBx5Z0SqUxpYJkHEqVT6PW wbVuh145a6dEWUWL2+NNgeydVGpTxRn1qBE03mNHOW6y+Jk3IcIWww6e+gJjG3X6WCQz uv7hoPuReXuxzaPsL4epXTzDdHp96L2z9q939unvGXhrUdAebUwJAsXMvaJGS/1D21Yk Cw0FKFVyrCJCa1VXdjTtSb/985jjNnylrH9eCKny0oMnxqVqYFs6AP37CcZNZV4uNSQW kulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VHZjlUaQqM5GtwqE4D5+D6h1EspkQ+6Rl4guLSEBSAc=; b=ooYWCfz2JyLcsMcxQqQjjVjhkxcUo9j5NadwiHv6lrqB597gDenFaIefD9pHKuN4mT Y/Ka5DrkWtInAusXne8sci/f4fgqr5zlYH60hA9vsbu8nxKmcNcGMDqOQ87dGZe7eVwQ IrIpTHnF+J15dCXuPVMJyOfJ8gqqeRy3iAPXxL79FBLZKTFeMWpO5XzeDSWoWoFdFv3x z0KQSk8OsNO5ojuOS8FhJzP57OECDEfiWcw+H7F4TTcf3YCUnld9J6iNT2wWuQNSqdD3 OAf+V6wUFfAC2I79gx9Yr4/GS7PX440Em4s6ktybuFqERaYjTkkUa6Py8J1mbn4IWBau XN4A== X-Gm-Message-State: AOAM530ofFmWDcdX/ZRPMNIP5zx3eiT/Wzmg+DfVhsNtm+0gFIXFB7fH knm7a3lUBMrZFggfaDf/FV0tIA0w3YPRlg== X-Google-Smtp-Source: ABdhPJxyKdvZ4aTBFboYGa3cyD2sHZUkg6lAUtf1Rd1J2TFMKrvzXJSRmL1I18OvrnNIK6b3tMDH6g== X-Received: by 2002:a37:9ad5:: with SMTP id c204mr548600qke.413.1592427855921; Wed, 17 Jun 2020 14:04:15 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:15 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 41/73] i386/hax-all: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:01:59 -0400 Message-Id: <20200617210231.4393-42-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, "open list:X86 HAXM CPUs" , Colin Xu , Paolo Bonzini , peter.puhov@linaro.org, Richard Henderson , alex.bennee@linaro.org, Wenchao Wang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted new code to cpu_interrupt_request] Signed-off-by: Robert Foley --- target/i386/hax-all.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index 6a4152730f..20a75a891f 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -298,7 +298,7 @@ int hax_vm_destroy(struct hax_vm *vm) static void hax_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); @@ -432,7 +432,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) * Unlike KVM, HAX kernel check for the eflags, instead of qemu */ if (ht->ready_for_interrupt_injection && - (cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + (cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD)) { int irq; irq = cpu_get_pic_interrupt(env); @@ -446,7 +446,7 @@ static int hax_vcpu_interrupt(CPUArchState *env) * interrupt, request an interrupt window exit. This will * cause a return to userspace as soon as the guest is ready to * receive interrupts. */ - if ((cpu->interrupt_request & CPU_INTERRUPT_HARD)) { + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD)) { ht->request_interrupt_window = 1; } else { ht->request_interrupt_window = 0; @@ -485,7 +485,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) return 0; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } @@ -508,20 +508,20 @@ static int hax_vcpu_hax_exec(CPUArchState *env) * c) INIT signal; * d) SIPI signal. */ - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (cpu_interrupt_request(cpu) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, 0); } - if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) { DPRINTF("\nhax_vcpu_hax_exec: handling INIT for %d\n", cpu->cpu_index); do_cpu_init(x86_cpu); hax_vcpu_sync_state(env, 1); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_SIPI) { DPRINTF("hax_vcpu_hax_exec: handling SIPI for %d\n", cpu->cpu_index); hax_vcpu_sync_state(env, 0); @@ -590,13 +590,17 @@ static int hax_vcpu_hax_exec(CPUArchState *env) ret = -1; break; case HAX_EXIT_HLT: - if (!(cpu->interrupt_request & CPU_INTERRUPT_HARD) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - /* hlt instruction with interrupt disabled is shutdown */ - env->eflags |= IF_MASK; - cpu_halted_set(cpu, 1); - cpu->exception_index = EXCP_HLT; - ret = 1; + { + uint32_t interrupt_request = cpu_interrupt_request(cpu); + + if (!(interrupt_request & CPU_INTERRUPT_HARD) && + !(interrupt_request & CPU_INTERRUPT_NMI)) { + /* hlt instruction with interrupt disabled is shutdown */ + env->eflags |= IF_MASK; + cpu_halted_set(cpu, 1); + cpu->exception_index = EXCP_HLT; + ret = 1; + } } break; /* these situations will continue to hax module */ From patchwork Wed Jun 17 21:02:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610677 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8725912 for ; Wed, 17 Jun 2020 21:27:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F2252168B for ; Wed, 17 Jun 2020 21:27:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Y0xaPLfr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F2252168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfao-0002B2-O1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:27:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEK-0003je-ON for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:20 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:39820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEI-0000Er-Jf for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:20 -0400 Received: by mail-qv1-xf42.google.com with SMTP id r16so1761705qvm.6 for ; Wed, 17 Jun 2020 14:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EcsY6TGhrUKNyVg3Ugjl3o+5XwjzyMO1Q9LTdSRFfVg=; b=Y0xaPLfr7H0xD9RlJzFNKFZAocI3yNY1KGVZm1Ak4h7JEqbfrNfBfVWEouHU6oHRAi Gn6pPKMFCGxuq3rqqa/Am/DVlBNsJCTXTB8ZPF0OM2Vsw2VvreoBkWVOeuE0g6/DYf6V 285nXjiwa8F7iFimgcYJQnEm58M6vlDm01M2ps4BIuTPhtrBVAsMTH5YaB6lKcYl6ufq lNHfCBbAqSRJBQBHd5qDfXpe4JYrb2SzBWQ0o6fd7JYJp3fjrbSIB20xAoOWGp2lpXPY eVK7f4Iuw0xcGV7HtZtCZYXfWtkIqfLoLIJnGpak6S8iy5rcF9H66vFkhXxpUtoXr1x1 eRKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EcsY6TGhrUKNyVg3Ugjl3o+5XwjzyMO1Q9LTdSRFfVg=; b=j4U7pgPtCryxUikHYj40C70dJ8xWiHOJqZ5sHKfkzM7Hx2YzkPvRqFXfjYi+8FfkF6 Jhafb9DZyj6bH2/QOtQK8cjeqHktjnvjX4AH0vIsJH3/2jix4oaD3IuNZVZxrahxZ0lL RDKfzeKIx2bjdH0qcLIiT5fd3W3mZf1BdG7eErlY3pLVkqGxb0rtEDu1XzQrfxCQc61H 5LAGOSO0AajhmieNN5jA+BVq+W8hgw37j+YxRJdnVk117ZtLyqD8Qh5v47OQ5bHH5CKh 0G/ft4jxQwirfBgwH6ZqeoLVYBG14t+TTQwPQdxO/rZrBirUZuSCZtXudhsU6PG6X5hV vgjg== X-Gm-Message-State: AOAM531D9ZZH+KFvPb4L5fAPps4w92yONVFBDK7WaAgIzbt+S44fFnPt iRG+ycW7hOfJX4Ywfz6A0DIF/B+9ATArhQ== X-Google-Smtp-Source: ABdhPJz0dU2JrKR+YLEpyMswc/BOBYG3ZNtOke13elnzruKWb1F8SHzaox/w6GN5umYkPECShRer8w== X-Received: by 2002:ad4:590d:: with SMTP id ez13mr558482qvb.177.1592427857405; Wed, 17 Jun 2020 14:04:17 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:16 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 42/73] i386/whpx-all: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:00 -0400 Message-Id: <20200617210231.4393-43-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, Sunil Muthuswamy , alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/whpx-all.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index d5beb4a5e2..cb424f04a3 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -752,12 +752,14 @@ static int whpx_handle_portio(CPUState *cpu, static int whpx_handle_halt(CPUState *cpu) { struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); + uint32_t interrupt_request; int ret = 0; qemu_mutex_lock_iothread(); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cpu); + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; cpu_halted_set(cpu, true); ret = 1; @@ -775,6 +777,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); int irq; + uint32_t interrupt_request; uint8_t tpr; WHV_X64_PENDING_INTERRUPTION_REGISTER new_int; UINT32 reg_count = 0; @@ -786,17 +789,19 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); + interrupt_request = cpu_interrupt_request(cpu); + /* Inject NMI */ if (!vcpu->interruption_pending && - cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { + interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { + if (interrupt_request & CPU_INTERRUPT_SMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -805,12 +810,12 @@ static void whpx_vcpu_pre_run(CPUState *cpu) * Force the VCPU out of its inner loop to process any INIT requests or * commit pending TPR access. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -819,7 +824,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); - if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { @@ -849,7 +854,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) /* Update the state of the interrupt delivery notification */ if (!vcpu->window_registered && - cpu->interrupt_request & CPU_INTERRUPT_HARD) { + cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) { reg_values[reg_count].DeliverabilityNotifications.InterruptNotification = 1; vcpu->window_registered = 1; @@ -902,31 +907,33 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + uint32_t interrupt_request; - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { whpx_cpu_synchronize_state(cpu); do_cpu_init(x86_cpu); vcpu->interruptable = true; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cpu); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, false); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { whpx_cpu_synchronize_state(cpu); do_cpu_sipi(x86_cpu); } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); whpx_cpu_synchronize_state(cpu); apic_handle_tpr_access_report(x86_cpu->apic_state, env->eip, @@ -1413,7 +1420,7 @@ static void whpx_memory_init(void) static void whpx_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Wed Jun 17 21:02:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610695 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A5E21392 for ; Wed, 17 Jun 2020 21:34:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7105E2186A for ; Wed, 17 Jun 2020 21:34:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IIdMlYj5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7105E2186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfhB-0002Yx-MG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:34:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEL-0003m7-Qt for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:21 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:40510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEJ-0000Fo-Ux for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:21 -0400 Received: by mail-qk1-x743.google.com with SMTP id c185so3483114qke.7 for ; Wed, 17 Jun 2020 14:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wUXpbIr+0XemeXbqwPqj4NV/3r6BPUZk1p9TVsxJgTg=; b=IIdMlYj5yz2hWu4Xu65YBgLkXmLNVn53G+Psk1HqPR8Xtmbp8BKjaVRLHHypSUisy0 uYX5S8/EIT7N3R/bSAmiOtHIeTD9ziTNjrHil/DKIr3Cf2JoxSKAINsrVS907rcVf7Oe iRJ6Sx3RZBkmYlblx77/Vgw9TT2BzwDKOfEolv90yQpzyQKhtRfmLMav5SgBQ6mNHHTn kY3EiNTOmi7pwTe9P/SQfl6Q0vPG7yLVVoIq+9vNTg8/dlUSholu7XIKu7eLB/X2imrx 7o2dmoi9NQl/AsHqRJYbMRnbdz0ouHLvTwzoCIkLNWEQXHP+uxarEJGTfEwokGqaDWRT 11xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wUXpbIr+0XemeXbqwPqj4NV/3r6BPUZk1p9TVsxJgTg=; b=Pjy7bF4tK7ljaLz5AiMdUY9dGQ37WBvqvw8P9AfKgTaL++miAxtbJR6lsVfuuTeP2P 0ZuiKRxQaW70rBK/hn2+RYPFNiikVL23fXAfK4CCOaRCCo/J6nKBItpzWWS9G4U2Hnmg n76evqWDno55ZI3FsO735ou2sHLkxWPFq0JAuDAxBkl4cag9jMSjugyu5tVmY07j0vvR Vga0MAolwIX0u2cjrZaXoctRQMKIcsD4jy2LuAZtdGBrCaabIYovLuAsur358aax9NXF +PB5kVVr6Qn3mqkckyE/A2WnNVgKeDh+wmOkFoPTM5PMnwsxwGydx7pjkP3VMI7KXPz+ 3mkA== X-Gm-Message-State: AOAM532CpO3QWfAUfBhLH0OrBB+LuVnv9bNGRacD5iOgTgpfCsfxEDmO B1oLnCU3mEjBUTW7DDtqDguKSUbdo9dqFQ== X-Google-Smtp-Source: ABdhPJzCjfVejbCftVoxD5957JzHtAXgmn73ipiE0ckSMEa0PkW99IKvqhB4pdzt9LJu/LaQxFTEWg== X-Received: by 2002:a05:620a:14b8:: with SMTP id x24mr534431qkj.284.1592427858837; Wed, 17 Jun 2020 14:04:18 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:18 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 43/73] i386/hvf: convert to cpu_request_interrupt Date: Wed, 17 Jun 2020 17:02:01 -0400 Message-Id: <20200617210231.4393-44-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , Roman Bolshakov , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/hvf/hvf.c | 8 +++++--- target/i386/hvf/x86hvf.c | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index b3bd2285fa..01ee420185 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -262,7 +262,7 @@ static void update_apic_tpr(CPUState *cpu) static void hvf_handle_interrupt(CPUState * cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); } @@ -737,10 +737,12 @@ int hvf_vcpu_exec(CPUState *cpu) ret = 0; switch (exit_reason) { case EXIT_REASON_HLT: { + uint32_t interrupt_request = cpu_interrupt_request(cpu); + macvm_set_rip(cpu, rip + ins_len); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) - && !(cpu->interrupt_request & CPU_INTERRUPT_NMI) && + && !(interrupt_request & CPU_INTERRUPT_NMI) && !(idtvec_info & VMCS_IDT_VEC_VALID)) { cpu_halted_set(cpu, 1); ret = EXCP_HLT; diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 8e9b60d0a7..565594bc10 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -352,6 +352,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) uint8_t vector; uint64_t intr_type; + uint32_t interrupt_request; bool have_event = true; if (env->interrupt_injected != -1) { vector = env->interrupt_injected; @@ -400,7 +401,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) }; } - if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | EXCP02_NMI; @@ -411,7 +412,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) } if (!(env->hflags & HF_INHIBIT_IRQ_MASK) && - (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK) && !(info & VMCS_INTR_VALID)) { int line = cpu_get_pic_interrupt(&x86cpu->env); cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD); @@ -420,39 +421,42 @@ bool hvf_inject_interrupts(CPUState *cpu_state) VMCS_INTR_VALID | VMCS_INTR_T_HWINTR); } } - if (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) { vmx_set_int_window_exiting(cpu_state); } - return (cpu_state->interrupt_request - & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)); + return cpu_interrupt_request(cpu_state) & (CPU_INTERRUPT_INIT | + CPU_INTERRUPT_TPR); } int hvf_process_events(CPUState *cpu_state) { X86CPU *cpu = X86_CPU(cpu_state); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; env->eflags = rreg(cpu_state->hvf_fd, HV_X86_RFLAGS); - if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_INIT) { hvf_cpu_synchronize_state(cpu_state); do_cpu_init(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + + interrupt_request = cpu_interrupt_request(cpu_state); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu_state, 0); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { hvf_cpu_synchronize_state(cpu_state); do_cpu_sipi(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR); hvf_cpu_synchronize_state(cpu_state); apic_handle_tpr_access_report(cpu->apic_state, env->eip, From patchwork Wed Jun 17 21:02:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610691 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B888C60D for ; Wed, 17 Jun 2020 21:33:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90B0321897 for ; Wed, 17 Jun 2020 21:33:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S8T0vdim" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90B0321897 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfgd-0001Xp-Rt for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:33:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEO-0003sy-JJ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:24 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:45364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEL-0000I2-LR for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:24 -0400 Received: by mail-qk1-x743.google.com with SMTP id q8so3451448qkm.12 for ; Wed, 17 Jun 2020 14:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=otzI+vAMFZo6kJ+xiIJJ7YKSc6bvWOvFds+iAtOJpdU=; b=S8T0vdim/sT9wr1S5Vdr7TX0r1CXRya8L+qIoKGAskCjcFuyN1of8xNkjvDSanleBb p+8m3n3GQ9LKqAn5Rg7ZZUXhe89Jrlqlnu1ir2QSoH+oFHY4TheQigQUMzjuE5kgG1AQ zjrFI2eMvIQ5tFZJ4PQ2rTcOLnr6el8s3iYTdKwlPR3BtFVbM6yXg6iT0Bnh7lQ30eTV 0RZ4bmJvkT/BOD0bBUKmOtD/UCtE4Kmvdc+RkwAMtEN+DIl6Uo2/z8K0SOW9lW3a1+yD hkdEhzyb4eQXjzI25Me8swEawHHYYdsFFYuu9UWqp8D/NO2RWRprqTEkltdOhh/3/RWr 7vgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=otzI+vAMFZo6kJ+xiIJJ7YKSc6bvWOvFds+iAtOJpdU=; b=ZgUt0F0/50ddJYq/GwDRA6tMIHXz7WL8c9lrds+9CXnbaILzMhBc4J7fhCfDc1+8VY SLZG1DRGQQc2lHpdVaws/AsoEPM31YjqID4TwHMdItZ1rkoaVaEhNbdZ0wiX84vEENPR AwL97kLH1pcjqIdGFcOtLgvfdFEXRuJdGNYi64Ztbky+vEZj0bMeiry92UCzqLEUlaIs XxyM5pWkNKBIgrLNWvBzhJpDhlKyf34ov8RSA7Duc4CKE0UKOjBcYUfBt3pJ6aUvsHdY uxga3/v0KUOsWdcPK4OVM+DfQGPxPgJocsIgtqdUfycUP2TuzaxePV5bU1IU/YhpQnhw vS8Q== X-Gm-Message-State: AOAM533Nq79T5ssop9AI2ky82qiXtyg5Gg5exPAmJe8kiVoIDz8vcYMr mphqWAz9oBx7heL4Ue/tsG39CzxibU+p+Q== X-Google-Smtp-Source: ABdhPJz2pEF6XfP5oxWKDDHm+CNN+oDD54jtlq9KimO3MMniYQUkAoqEeC4hSOGIu6237ww6MiQ0TQ== X-Received: by 2002:a37:d246:: with SMTP id f67mr575324qkj.300.1592427860391; Wed, 17 Jun 2020 14:04:20 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:19 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 44/73] ppc: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:02 -0400 Message-Id: <20200617210231.4393-45-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , Roman Bolshakov , cota@braap.org, qemu-ppc@nongnu.org, Paolo Bonzini , peter.puhov@linaro.org, Richard Henderson , alex.bennee@linaro.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota [RF: Minor adjustment for new code in hvf_inject_interrupts] Signed-off-by: Robert Foley --- hw/ppc/ppc.c | 2 +- target/i386/hvf/x86hvf.c | 1 - target/ppc/kvm.c | 2 +- target/ppc/translate_init.inc.c | 14 +++++++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 0e7386ff88..89f92c4a88 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -89,7 +89,7 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, - env->pending_interrupts, CPU(cpu)->interrupt_request); + env->pending_interrupts, cpu_interrupt_request(CPU(cpu))); if (locked) { qemu_mutex_unlock_iothread(); diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 565594bc10..53515d0f0e 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -352,7 +352,6 @@ bool hvf_inject_interrupts(CPUState *cpu_state) uint8_t vector; uint64_t intr_type; - uint32_t interrupt_request; bool have_event = true; if (env->interrupt_injected != -1) { vector = env->interrupt_injected; diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index aae2ef0ad4..084e158c34 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1350,7 +1350,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu) CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (msr_ee)) { cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index ac59648541..d06d9ff204 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8541,7 +8541,7 @@ static bool cpu_has_work_POWER7(CPUState *cs) CPUPPCState *env = &cpu->env; if (cpu_halted(cs)) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && @@ -8565,7 +8565,7 @@ static bool cpu_has_work_POWER7(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } } @@ -8703,7 +8703,7 @@ static bool cpu_has_work_POWER8(CPUState *cs) CPUPPCState *env = &cpu->env; if (cpu_halted(cs)) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && @@ -8735,7 +8735,7 @@ static bool cpu_has_work_POWER8(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } } @@ -8905,7 +8905,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } @@ -8951,7 +8951,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } } @@ -10656,7 +10656,7 @@ static bool ppc_cpu_has_work(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } static void ppc_cpu_reset(DeviceState *dev) From patchwork Wed Jun 17 21:02:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7E9F14B7 for ; Wed, 17 Jun 2020 21:36:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEDED2085B for ; Wed, 17 Jun 2020 21:36:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Z7nPbxN9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEDED2085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfj3-0005bF-18 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEO-0003to-Ts for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:24 -0400 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]:34515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEN-0000J1-2z for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:24 -0400 Received: by mail-qv1-xf44.google.com with SMTP id fc4so1776123qvb.1 for ; Wed, 17 Jun 2020 14:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cJAv+EbsefdW66yr8LjRtj+7g6Sr3jeK6hHxTVUkhJA=; b=Z7nPbxN9nrVvlMAqzjDNaj7kD9CZdQv9dyywyXt+Ph1BM/q33gxGtkIo2dCblV9zOU G+TubiU7MZCinD1HWYpJ0N0L/1R8N0wgimpk/H4fy1yW8XvPn9Ak3dUE0nCK5Hpmwb3V KAem1secs41VxsXUxefQL1BK/uVozQXpFefh1v3rLB1VcpNsrfo6qKACtcVbe5NoCSxD Qrou6/svXhi8H8xvbkKMl5XRi8b3ga6tU8OhHQ+5tPgWlEVYabuzcEFFaGoyVDGZTCd0 zG/Ce1+Gy3nKaR8YeF77hG5ktujcKP4+w+bSzIWUpESXwB3YZ/csxKc3OJj9c1ZqqMjz gagg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cJAv+EbsefdW66yr8LjRtj+7g6Sr3jeK6hHxTVUkhJA=; b=IegCyd8PKhDNZVOl+JjlAuwjhj9BIvH0yUn/4pqxj++J65Nz+Mu7BdGf7rDYQ1sjw4 brWjN2FnoS73Z0BQwMLENOR3KoRnw1igpPzQWQ2sTkky95q8xcZR5NjvQ1ykCuYQVcKo /Zp3xkA7yrmJPUCLSDEPh2nY501Ciw4OzwO2VS4nHdmsPaNCbkRMo3tv4TIetIHPNHab ba/x/PCMQSLiL3ziYAO/NxIRjgk/UuWiN1wy5voavNlA3neMDU/ogjiGOojgVJQsYhBl bnhWyijspdqKGFfUHlX75qBxl/OkkTDvNBW8DNJ+arAijrtf7Co+qi77NdO1h9SusfPv O3YQ== X-Gm-Message-State: AOAM531DdqLoZJiBmhzEUD7LZ7z3vruqBGCjKQUxt3GL67i8ILLPPRRh D2yD3IyN7is7CxEWOCLGquASom3O/pfgMQ== X-Google-Smtp-Source: ABdhPJxYV3yaUAovRK41PP3Qo7LV9GbVJ8hNhPHC6zuDNA5ZR/421XqHVubbGWH9FCe12abmYZraTQ== X-Received: by 2002:a0c:9ae2:: with SMTP id k34mr519566qvf.247.1592427861880; Wed, 17 Jun 2020 14:04:21 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:21 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 45/73] sh4: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:03 -0400 Message-Id: <20200617210231.4393-46-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f44; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf44.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Yoshinori Sato , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Aurelien Jarno Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/sh4/cpu.c | 2 +- target/sh4/helper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 3c68021c56..18f3448183 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -44,7 +44,7 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) static bool superh_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void superh_cpu_reset(DeviceState *dev) diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 408478ce5d..1e32365c75 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -62,7 +62,7 @@ void superh_cpu_do_interrupt(CPUState *cs) { SuperHCPU *cpu = SUPERH_CPU(cs); CPUSH4State *env = &cpu->env; - int do_irq = cs->interrupt_request & CPU_INTERRUPT_HARD; + int do_irq = cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; int do_exp, irq_vector = cs->exception_index; /* prioritize exceptions over interrupts */ From patchwork Wed Jun 17 21:02:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D31A5912 for ; Wed, 17 Jun 2020 21:22:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A96D52168B for ; Wed, 17 Jun 2020 21:22:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wQf05jCF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A96D52168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfW4-0001oq-Te for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEQ-0003xI-5T for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:26 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:44356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEO-0000L1-C0 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:25 -0400 Received: by mail-qt1-x843.google.com with SMTP id c12so2731224qtq.11 for ; Wed, 17 Jun 2020 14:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UmLKvFwmPDwDSuHmbH2s4seTobiEOYrK5RpLD5v7Faw=; b=wQf05jCFx79dmRxlxL1PmGqqSKLC9c6eW/LaqnWK1CEeBjBeKAVylzLKyCNhPWuqr9 WQEb2HOvQXd4R1qzMd4+51sszktA5wNJ+Pwm5ziHlQWacWZPvHUwXOkFWt6soOtXQOqa M41I9N459JII+PpvLLlGfIunnmSgnzSlgEKEeDnx8t/dq7Y75l7/rvGHJJY/bdGilZ4k Znilb63gDiZEsnrLkrkuSltwcNbX13z7KTrc2wLWKMi2lF3bGV3Z2ULhZUPmPOp822Wn paMdRH++xtms45qrLN1p3ulJlrWyC+stAf7ckC9rR3FbhwJqWmQuhCEdzOO1h0UvV4X6 3/Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UmLKvFwmPDwDSuHmbH2s4seTobiEOYrK5RpLD5v7Faw=; b=fVahgagzvFlXyZVlSrfwAgVBV8J1jK8gWzBvqqk5B68McmiN2AXNgNcWAkgxqgKbcU oEfhgzScDxfjMGhnndgzVZ7Z58+q5jTO8c8OCpP0WsGPbKPBQkYNR616D7yZNK+u51sl lJdIiMV+RcO9P1Jk6iXdYH7uX58VIti38JT6+LuJt2WMSBZ08RiO5pK6xLRv38kC2PCc sHZRdInFlSV4bVEggO/TDjxa4zXUanhtdHA1NgUqZwU4FwiMlru33FXGmDM5Ih753l+s LAvIXpuoMgTK2SLwj1E+LOzxJia2GI8zqtnoloVBbEsgTOE8vhEO1qGsIDkkL9HgGwRT eAdg== X-Gm-Message-State: AOAM531zn+v7HWgxcgTj1hgmIuT5YQLCA6okFB35Sk9OwreFHE1R0vO4 wY6vg/4lL7Lo7OqN6faR3OrdsfNO03GTyA== X-Google-Smtp-Source: ABdhPJzEegUqYHlHUUoAPmnDXDpbVwuxkP8Qapk/X915gRyaiqiu3E+d32E+Q5j5Ma3NvfVDF75JKw== X-Received: by 2002:aed:33e2:: with SMTP id v89mr1126320qtd.129.1592427863196; Wed, 17 Jun 2020 14:04:23 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:22 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 46/73] cris: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:04 -0400 Message-Id: <20200617210231.4393-47-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/cris/cpu.c | 2 +- target/cris/helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/cris/cpu.c b/target/cris/cpu.c index cff6b9eabf..6d7e266042 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -37,7 +37,7 @@ static void cris_cpu_set_pc(CPUState *cs, vaddr value) static bool cris_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } static void cris_cpu_reset(DeviceState *dev) diff --git a/target/cris/helper.c b/target/cris/helper.c index b5159b8357..67946d9246 100644 --- a/target/cris/helper.c +++ b/target/cris/helper.c @@ -131,7 +131,7 @@ void crisv10_cpu_do_interrupt(CPUState *cs) D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, - cs->interrupt_request); + cpu_interrupt_request(cs)); if (env->dslot) { /* CRISv10 never takes interrupts while in a delay-slot. */ @@ -193,7 +193,7 @@ void cris_cpu_do_interrupt(CPUState *cs) D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, - cs->interrupt_request); + cpu_interrupt_request(cs)); switch (cs->exception_index) { case EXCP_BREAK: From patchwork Wed Jun 17 21:02:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610707 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4465C913 for ; Wed, 17 Jun 2020 21:38:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C1F22088E for ; Wed, 17 Jun 2020 21:38:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GE0AA6F0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C1F22088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfl1-00012h-As for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:38:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfES-00041j-B1 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:28 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:33709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEQ-0000LR-Hu for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:27 -0400 Received: by mail-qv1-xf42.google.com with SMTP id d12so1775865qvn.0 for ; Wed, 17 Jun 2020 14:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oS4OFCHOXLNPVShms1TjWbnrC15wr+ouKwB5TcDXaeE=; b=GE0AA6F0qghZkTHfPxeGxcc04dzhmoqfZtJMXikX8yoIn+CxuNQ9j94pEpjoZ8fMBx IBSDa8D0i9ekrXE+rJP+qNDmVFN/MLpPNG4EETYPdc6TJpbyqEQg8tXRV3qQeTc+QhtD WAIyLdjtp0HZ+czVWcizdGrk5825Y1Ze/MIeWuSZuHLqYH2A7G0RIW+9Pu+g1svJNNxm y4r3wdr+f/WLp7gqW2z2+xeKXC19oLV3tJTr6/6/V4IukBqzPJ9f/md5wgb1xq1OJoKT kNxX7iwjE8PwLyFYSD2Hh6AqqXTwZnefhQTmg4ymy5RcFhQ3R+UpFnNY1UTKKPCRYbMI 7CVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oS4OFCHOXLNPVShms1TjWbnrC15wr+ouKwB5TcDXaeE=; b=ZSmm7x55lxeLlRJixHDcMK8E4sRvPrjxl1KWCUZpCs0rIDAoU/2zK8WueQzo7348IU jHAC4xl4Bfg6TEtSQ8NcGQKx//cnyFIUbCskLhC0X9Oqgb3+x1Ju7Axa3IcG6NHtlR6j 6JbdGVxT2tICLCJNX+eVPw+efrLQF63C32nZeYgkGxwcCoU5Ec0F24ffxb6ii7OffQbV dW6XTL0I+U3CDwWpllJIcDIdUef4EspmH3c247x5SLHSNlo6kP6Kz30IvMabs3ammkzr mWHlRCk3DMv2dwIpxZXg2U/f1Kqtx2BpCyfBPQ4ss0wbjFceGnL+3apDlYzJr72AtqRF gYsA== X-Gm-Message-State: AOAM531jNa/tqcGbpqUs7CzMxWhozpEuE8rWKjvC/Ed1E0yXDw3MUydC T5Gb2iucIQ1jwfo9d51xp5F/dB5MkfQjLQ== X-Google-Smtp-Source: ABdhPJx1hN6zWpynxS0xeB7YUJdmDiLn5MvRJZQa4q3/0rSqcrGAqD8GNRMWxANy1OOfhVa5sWQW7w== X-Received: by 2002:ad4:4851:: with SMTP id t17mr599131qvy.160.1592427864494; Wed, 17 Jun 2020 14:04:24 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:23 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 47/73] hppa: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:05 -0400 Message-Id: <20200617210231.4393-48-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/hppa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 71b6aca45d..287055f96e 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -61,7 +61,7 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) static bool hppa_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info) From patchwork Wed Jun 17 21:02:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 798581392 for ; Wed, 17 Jun 2020 21:24:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FDDB2168B for ; Wed, 17 Jun 2020 21:24:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oudhz65T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FDDB2168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfXb-0005Ir-He for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:24:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfES-00042s-Sq for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:28 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:43611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfER-0000LW-2B for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:28 -0400 Received: by mail-qv1-xf43.google.com with SMTP id dp10so1743591qvb.10 for ; Wed, 17 Jun 2020 14:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=leGMjXpK2HH4jKgWKo9xRsuJr3HkPgiK0233yCfpGgs=; b=oudhz65TfyHpYuLR9i4rIICUzB0r5nPw7a9UiTrsDIbg+PrX1eHmJ9g2FxhATNfFXq 1l0oiP4J4+NJYjM/niXRgp3M1TDttJ0zA1iy3uoVls2Vr+ZfE2p7+fIlY9Luq6z6EW1h 09mFs1yuIMJ5CUCy/HnQz1NmgoNKXqFVKE9d4K9FSJKbX6Fm1P77ls4jACovft/oz0/2 TfI3ahHzDeTEMqhCfthIWak7OXZpHKzsFXQdp1LqUb6QoQY61ph3hJGxmH43H1x/pgky QVzlTCA41LVzHIVOhk41BkYTp/if87Z5DJSlt3elJSwUGjKZgSi/c0WcupUwNX/BLJjx TOBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=leGMjXpK2HH4jKgWKo9xRsuJr3HkPgiK0233yCfpGgs=; b=K7qiQ32SPaUHofLeqgqpIdt9rD+9/DGWQnpCaWOrVzWMFVd18cZyEyFHxqVuxCJT7X gYngDmtIbGkNS2F4qHFjn/OnExWJ6/B37EyNU14W/G+0o72sMx4ZHyAxOPWEbcacark5 5sJ6SRrsPoSC+XRKXXwSBTIZmXSChzQq7RGQPITm7mBTHc7qx2hOm8OtPxIpm9BpVbSj aAIDVo20cghmb26x+81TbSrhILO45UUdJTHqGxUrNX4HFnx3M8oYuIt3csOukSb/Gf8Q 2ofCtof/yLPoLeD62anr4fnD+EEnQO+iI5EWDtMJPcCs23wcfT7kUFOwrOuhc6pOPesc CPAA== X-Gm-Message-State: AOAM533k76+nd8y3I50KnmwpAA3clpdKPRw/qsNBPC+MekObHUn5U6N2 PbQcGVXgrzK0mqYgrPg9ayvtMQohY0nYQg== X-Google-Smtp-Source: ABdhPJxYdhHldkV+KneTM2kP408KlgsTDwq806haZN2BjdIK0DF7a9PdFGhWpCKamWyYdgDh+a0fxQ== X-Received: by 2002:a05:6214:713:: with SMTP id b19mr536025qvz.199.1592427865845; Wed, 17 Jun 2020 14:04:25 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:25 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 48/73] lm32: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:06 -0400 Message-Id: <20200617210231.4393-49-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, Michael Walle , cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Michael Walle Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/lm32/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index c50ad5fa15..9e7d8ca929 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -96,7 +96,7 @@ static void lm32_cpu_init_cfg_reg(LM32CPU *cpu) static bool lm32_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void lm32_cpu_reset(DeviceState *dev) From patchwork Wed Jun 17 21:02:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610703 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9CC5214B7 for ; Wed, 17 Jun 2020 21:36:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 748672085B for ; Wed, 17 Jun 2020 21:36:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="F6FxaP1V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 748672085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfje-0006rA-Kf for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:36:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEU-00045D-1K for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:30 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:41389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfES-0000Ld-7C for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:29 -0400 Received: by mail-qv1-xf42.google.com with SMTP id er17so1756650qvb.8 for ; Wed, 17 Jun 2020 14:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lvs+qOX6bs/iZi7N2ZR8e7cxDlqBQWqbjCB2CJTYkPk=; b=F6FxaP1VKb0Gp1RxkTSgeFU7z5xnH3WLU9yvrvrXFeftFMOjWOT6axOqQviQ1F6OHs 9ROzfE9VvuQUivb+EWC4tzJ08Iy56H54YmMZQt4s6tMoW5Y59eKORw0xTJg2xgXQnrTg 9LajHXVdIlB6e+cj8UMyC3VIwpAKMDBQDFtmdA8zKGWvWoYjOn89xd17JEfYQ1UB/7Ox pZR8j1Ngp1YcyR2DUCy8q3Q/BUP3ZL8DOkSry8GyUeL/hv5zbljxe8WGNuLy6lGc8gYr kefE0wPQOPrLkepve5JkKtgB6utrxmgFhtC3LgfzkYyhsESYQJjcNVjZ+uetAO7pAKKM 6FyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lvs+qOX6bs/iZi7N2ZR8e7cxDlqBQWqbjCB2CJTYkPk=; b=F4gDC2cPD4JewJcVqvREGZgnQYA8pknrY5QIYt3OSKaLqH93chu+XJXEcvpE5mmSSf i8kfTnhv0crXN6Nr7EOYSpbcyq0DoZ87atDFNUpk6fFQdGJ/BgkvcNfePkcuQjm+V1P0 yJH+vTD6diOC2xB6GLg5VDQPRA8of/jiMXbUm7hpNOpEbX3IVY6VGu0pojwVZxGHUXWB SwQKyRdahN7Or0/IltDg/hAXEq8YWsvt4sB5BtZDp7FXmsR9dXhFeRIsv+10772VW8lW +tFoa9viusYy5aKZUQ0lHUtI2spw1rt6fbrU5O7n0Ohvi+XrfQB9yfw2XsqdptHWKKzz buTQ== X-Gm-Message-State: AOAM530A4vNwvKoxly/AEo6VaZbjRV3fD26wSERrL26QcBgm6NPgux1g adpEA9zT68OgVKcsd8jyzsenFMtV9TEJPw== X-Google-Smtp-Source: ABdhPJwMiMj3L4AYJp4dTQnS/AXWCyx62yxhxQh0MycziR2B/kY3gf3yxkhhQwIV6Pc/ts+b2sFPLg== X-Received: by 2002:ad4:46a9:: with SMTP id br9mr557202qvb.246.1592427867100; Wed, 17 Jun 2020 14:04:27 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:26 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 49/73] m68k: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:07 -0400 Message-Id: <20200617210231.4393-50-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/m68k/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 72c545149e..f2585154f5 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -33,7 +33,7 @@ static void m68k_cpu_set_pc(CPUState *cs, vaddr value) static bool m68k_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void m68k_set_feature(CPUM68KState *env, int feature) From patchwork Wed Jun 17 21:02:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610717 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83EA8913 for ; Wed, 17 Jun 2020 21:41:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5BB2820897 for ; Wed, 17 Jun 2020 21:41:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gNYKdFfH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BB2820897 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfoQ-00073x-L3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:41:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEV-00048Z-Ih for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:31 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:34438) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfET-0000Lq-NS for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:31 -0400 Received: by mail-qt1-x841.google.com with SMTP id u17so2787124qtq.1 for ; Wed, 17 Jun 2020 14:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8Q2sL8ohmf8wunp2u0YbDC2Iqv7PQMpqvb2Mr0aPlxc=; b=gNYKdFfHfp3hprbcJcWx41N94LYYAkf3UbpgGT651vSBkXvSLCyegKbcfSdCvI5B6H 8V1qZPe2JIxzxZOFKRF8vqk9h6aLJtWXYLnDeu8qFKzReZb9l7IUZbkT1c5wcWGZMpSi pYK6TRseneD8eztvJOmVmxEenNRly046sp7Feo/N8jjbR1vo7JWyBwB5VCxuvxAgOtEx RhHRkuG/qgFA7CVapVJ5X3Zx7JUMiOlwGdQ5DUqSekapIdwoh36N6owZWY01KW2PZxC5 S4VJ4EgCaTKNTK9P9dBtQeTxgy5OnrOc4EVwYV/Vjx00SJR9q9S+WuQKYYe507vEDcuo vZwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Q2sL8ohmf8wunp2u0YbDC2Iqv7PQMpqvb2Mr0aPlxc=; b=LGne6plKbc7Nb2Nmwgj1f9tNCoT2EcLbT3hvpnukaZyC7adh3W05WFtjt5twSZfX2S cn2eQaer47U0ijdU0dBLT2Mlup0PJcXcqcSqaZpli9lUwKjXhjqTT4ZQcgGBvUWk9EB3 5nRDimBL1vrW/VB4esb1SKi4ogwpM59ad5GZnAELcUWi2tQviEEGPCtVxpE09x+tlgB+ spj/fVJ1ZryHtvR3K//7qcfzc6hwg6oEfF/BgvzADaHrI5DpOLrYQVdKAD9Uy8zss8FV JoS4ePqhXMl7M/fJ+QaU+VdJ2Z0K/FWl+9o+3IryBpEUOTv9E0M/UwCSbxDV45W+iV1r jHgw== X-Gm-Message-State: AOAM532Zu4taQvIigJPZM5lGrSzBHgX1OiZ3ZoxaZ2y927n/9Sx78LH0 l++KiNG7zJWkmtLQP8MbPVIl/vvJPAkgRw== X-Google-Smtp-Source: ABdhPJwu7k0bFZmh+QSrr8ehQ+YnZJGLLpqcqSifhAjlMGt3JG2R2C8/ysiwY1XQZMoOvmVGclHGaA== X-Received: by 2002:ac8:5354:: with SMTP id d20mr1106683qto.363.1592427868582; Wed, 17 Jun 2020 14:04:28 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:27 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 50/73] mips: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:08 -0400 Message-Id: <20200617210231.4393-51-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , robert.foley@linaro.org, Aleksandar Markovic , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Aurelien Jarno Cc: Aleksandar Markovic Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/mips/cpu.c | 7 ++++--- target/mips/kvm.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index e86cd06548..761d8aaa54 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -56,13 +56,14 @@ static bool mips_cpu_has_work(CPUState *cs) MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; bool has_work = false; + uint32_t interrupt_request = cpu_interrupt_request(cs); /* * Prior to MIPS Release 6 it is implementation dependent if non-enabled * interrupts wake-up the CPU, however most of the implementations only * check for interrupts that can be taken. */ - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { if (cpu_mips_hw_interrupts_enabled(env) || (env->insn_flags & ISA_MIPS32R6)) { @@ -76,7 +77,7 @@ static bool mips_cpu_has_work(CPUState *cs) * The QEMU model will issue an _WAKE request whenever the CPUs * should be woken up. */ - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } @@ -86,7 +87,7 @@ static bool mips_cpu_has_work(CPUState *cs) } /* MIPS Release 6 has the ability to halt the CPU. */ if (env->CP0_Config5 & (1 << CP0C5_VP)) { - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } if (!mips_vp_active(env)) { diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 92608cfe15..682b969579 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -141,7 +141,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) qemu_mutex_lock_iothread(); - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_mips_io_interrupts_pending(cpu)) { intr.cpu = -1; intr.irq = 2; From patchwork Wed Jun 17 21:02:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610725 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7FBD013B1 for ; Wed, 17 Jun 2020 21:43:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57BC02166E for ; Wed, 17 Jun 2020 21:43:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e+GjfbsE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57BC02166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfqN-000232-Jz for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:43:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEW-0004BO-Uf for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:33 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:40079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEV-0000M0-88 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:32 -0400 Received: by mail-qt1-x842.google.com with SMTP id i16so2751709qtr.7 for ; Wed, 17 Jun 2020 14:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1YbnvmhNqAhmF66BGNb4cMj4pII5ByUEQJWinpDd9pc=; b=e+GjfbsEEWzjau9GWD7/LJJe6jl/qjLCZqkpLJHYyjzsJqyO3f0cixECvSSGzqp9Fv G9IinPhQwS/UGqE+pQNKPLAgGDSAEJ+pDK/DHc3spOuTophvZqca4C44wKfjsF1CjywB VOBMRFuzDPOX4aEShCVrzdu/a9VFEZrsnwnwYZFq16sjd1rV7/+Yfz6r4Dl9CGkT/PAK g4xvZ0CiO1EV1pfahapwcAg9A5Y4WwW8fUlGEv8trydWXXjvr+Attir7XyGruwCdg6dR u5C1G8PlTKVwLMc9W8UCdXUXPopc0Ri+EtPAXl+i87HdBDJvxFU4z2OiwbaFsaT/v9f4 kL6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1YbnvmhNqAhmF66BGNb4cMj4pII5ByUEQJWinpDd9pc=; b=S90qeuMzjgy/W3Fp2fwM1DeUQmNguefCJafxp9ItBgr8SPsmBGpzL526L0ZbwxS/BI EutJVrtzU8arG0pdfF/cukaB/DllQEbAHqpeIkLDEVOzf3x4sgUbvmCXyyVRMbr2QrAx lwb4JNUttR1PEsb6cFTR4Kb9Mc330tRAR/Vd6L94/kYQM+J7ylawseyqRy6OI/8JugNK SUmTkGNyiTHfbZET00KQeYLZJlZh821l5u25ica9vVLrrx5BgqA86wROSDKUqzsMH2Fq 2cc/AYyOkqMZ7L8qTZ8D379EMkzHl86LMQQti4YLSw4B9WLFR6hLb90tY5b5Cdqx2f45 g0Gw== X-Gm-Message-State: AOAM530D1LbObdl0nw/2H4Mourj1grhV2g+Cd4bFdQJSIh/+aWCxgmT9 xHVWqW2+1Ci2yxqD6MFKs/YGa+IDJ6UC3g== X-Google-Smtp-Source: ABdhPJxONwflqqnuoqK9oPE4dP+eWbKvJzw3x9QgYxy18hu83bb0zm7Z2MnqemFxud6tWGJ99hgSfA== X-Received: by 2002:ac8:40dc:: with SMTP id f28mr1094990qtm.63.1592427870017; Wed, 17 Jun 2020 14:04:30 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:29 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 51/73] nios: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:09 -0400 Message-Id: <20200617210231.4393-52-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , robert.foley@linaro.org, Chris Wulff , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Chris Wulff Cc: Marek Vasut Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/nios2/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 8f7011fcb9..fe5fd9adfd 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -36,7 +36,7 @@ static void nios2_cpu_set_pc(CPUState *cs, vaddr value) static bool nios2_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } static void nios2_cpu_reset(DeviceState *dev) From patchwork Wed Jun 17 21:02:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610687 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF41C1392 for ; Wed, 17 Jun 2020 21:30:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A626D21852 for ; Wed, 17 Jun 2020 21:30:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tmQ+zuW2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A626D21852 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfdl-0006Cm-SV for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:30:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEY-0004EO-D3 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:34 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:41177) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEW-0000MG-QV for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:34 -0400 Received: by mail-qt1-x842.google.com with SMTP id w90so2750781qtd.8 for ; Wed, 17 Jun 2020 14:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ljUyAp0qqYElrS8vzQ49pxqGCe+fOWSwI5BjIxDRmqQ=; b=tmQ+zuW2eIVChtJ/OEnskHJxF3k9ShXoaMhKG9DVleoTY8AIwCy/Vn0caSyLKfWerP mRH0n0/uYybOYJVOvCwQTIKX8l39KMEr15B7loh/wkwXaiArqt152Tjxh3utng+J8zdt CGMfyvNZFGCSmsS7QsAZi+zxOcIFLqKKhPQhpAqz8yzzvjyaFmLurXfCQmgElH+vhZeb p8tmWYJNU4n8yrMx/zy/d/z3Nz8FQefdOrkRxsG/SWJBZKn/cJ2u80RGdrstMzojix7n gwyl2Q9RVpErRixBXV2eEl+n6nUqBn7CpgaMMbPTXEpVX2zpSAycKgja3R3YPKPF505r clIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ljUyAp0qqYElrS8vzQ49pxqGCe+fOWSwI5BjIxDRmqQ=; b=TbokHBMiS51AC2ZQmvavrtPbljkM3T2kU6ZkXDNCP8S4G8WtTpVWr5VMDGdReVIJGi LZZ29U+fT5l7Pul2SGiW8Ge12zlVxgdTp5+08HsANfmM5DdjKOQptiBHo7cuy68Mwov3 x+vbMXWRwa/Fbwn+gHbgJ6/7jm2iJCPZoVOU7kZ9mEoSG3U/dNkiSMDa+lLvwo/PEt5/ GDk5lk7EewCORtdfI0RoOAmhPEpvCPt/p9oZ5VVg0uX9StgdhUyYy4+7feOGqxU1obni +n6WhD1kDUS6HHQT3ULv98+3xVufG8l4t6D7FyUc8OG6lHGWv3A5WwyR1hGKDR1fFyv9 KXhQ== X-Gm-Message-State: AOAM533Q1u+hRuARgX1JuPyzVFZ+f9qMq4+GU/KYvmPbvDTdB53r/4Qc gLUvaAetTmABtMMIwOX2rtqr4PQTTR5LJA== X-Google-Smtp-Source: ABdhPJxLhoeZFFmzEkj2Ldj9fFwsS3NFgUzySG+UBwp1WNlfgsYAzAe5/A1CqV5Wocohb9eYOR822Q== X-Received: by 2002:ac8:6bc1:: with SMTP id b1mr1116070qtt.65.1592427871693; Wed, 17 Jun 2020 14:04:31 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:31 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 52/73] s390x: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:10 -0400 Message-Id: <20200617210231.4393-53-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , robert.foley@linaro.org, David Hildenbrand , Cornelia Huck , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Christian Borntraeger Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 46ec8272c0..964cb41b4c 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -191,7 +191,7 @@ static void qemu_s390_flic_notify(uint32_t type) CPU_FOREACH(cs) { S390CPU *cpu = S390_CPU(cs); - cs->interrupt_request |= CPU_INTERRUPT_HARD; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_HARD); /* ignore CPUs that are not sleeping */ if (s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING && diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index d7a98bd52b..d157dbb7a9 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -65,7 +65,7 @@ static bool s390_cpu_has_work(CPUState *cs) return false; } - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } From patchwork Wed Jun 17 21:02:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610671 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4ECE61392 for ; Wed, 17 Jun 2020 21:27:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25E632166E for ; Wed, 17 Jun 2020 21:27:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gjGWNyK1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25E632166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfaF-0000h1-Dm for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:26:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEd-0004IZ-Q5 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:41 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:36374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEY-0000MT-78 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:39 -0400 Received: by mail-qk1-x741.google.com with SMTP id 205so3521153qkg.3 for ; Wed, 17 Jun 2020 14:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E/tQbITHc97dgORFyK3tE34tNsNJB0LGdPZMzeOAZ2A=; b=gjGWNyK1fJl5+QdDcTtGkUHu0bKZupTYgIu+ikmiZPdtkwH1bKpmzZMkekHfQOqcyp j6iTEhdp4xVVerBTq6iuPTwCNjRVTkX9kkrFWnklf5AhvoU+PSlfMRuaeNZCJdObue4J rDMKy4yeH1BSyTEBqEVx9/0u6l2UcRkl1xVXG4U/yZ3a1FNwPiV1oshvaEuxn9RKCpR1 o6wBIxf1pmtmQS3jLQBLgp3a2PITVnVJCpXl6NWjnCgiujBnlahisTEGpqOpvcCXAhlB GGd06yOrXzXNLBgbvFarwTz773YM9k7IpsMSSxeggM7MpD+rE+1vUauIuUv3gHPwEuzK FsoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E/tQbITHc97dgORFyK3tE34tNsNJB0LGdPZMzeOAZ2A=; b=tHvKO3iyVC1WPUEI5z2oCQeYbDzVuIuWMN7u7tOTVkibB4lLAoxIqEs704u2rm32bg ZG/cMKb+UHdJKVqGb9rBBHJkTUFkPmnWYqdtKs/ZkJ2BllhoMopnjr61+PKF2SnTGmWL I4zRDeWF/2J6CiP+MNcrATCR+DisqOFuOMmS6ibZvqqRLPcqBuPOX9sbrtdlIgeeK9Dn T2Ix/tQMySktzJOdwSGZ9g//+XTzbu0aGjtiBzsp4+aBSTRu4DYUfk1AiB4UmdSpKo6L VEm+MRCDoH1VKCKDLFIgd8JFu8dFsbdG5EN/rddZ3kjDHp/qyFKCX7/nat3g6iFJKpjr cdHg== X-Gm-Message-State: AOAM532AX38n954tASMmrXsumE5R0e5DqzEjPT3Z3/vgWciVb1Pp5WUt OMderKbsZQQNxv/nem9SOrLB05flI96EMw== X-Google-Smtp-Source: ABdhPJyZimv7dIPy8hBowq7zQvT/g30LHqCOD6SLjPxun950vDmvnc9XckquUOklTVlMA3HyYU7uEw== X-Received: by 2002:a37:4ed2:: with SMTP id c201mr607695qkb.138.1592427873025; Wed, 17 Jun 2020 14:04:33 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:32 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 53/73] alpha: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:11 -0400 Message-Id: <20200617210231.4393-54-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/alpha/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index b3fd6643e8..09677c6c44 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -42,10 +42,10 @@ static bool alpha_cpu_has_work(CPUState *cs) assume that if a CPU really wants to stay asleep, it will mask interrupts at the chipset level, which will prevent these bits from being set in the first place. */ - return cs->interrupt_request & (CPU_INTERRUPT_HARD - | CPU_INTERRUPT_TIMER - | CPU_INTERRUPT_SMP - | CPU_INTERRUPT_MCHK); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD + | CPU_INTERRUPT_TIMER + | CPU_INTERRUPT_SMP + | CPU_INTERRUPT_MCHK); } static void alpha_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Wed Jun 17 21:02:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610711 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 009C1913 for ; Wed, 17 Jun 2020 21:38:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA3C92088E for ; Wed, 17 Jun 2020 21:38:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ecIVUAfI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA3C92088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfld-0001zT-1e for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:38:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEf-0004Iu-JS for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:41 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:42453) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEZ-0000Mg-DK for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:41 -0400 Received: by mail-qt1-x843.google.com with SMTP id q14so2744537qtr.9 for ; Wed, 17 Jun 2020 14:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TvYnAkjAppdRPxTCTiIdH7gnvDHcZXb4SiVpZ+2G8IY=; b=ecIVUAfIhsVG8DNL0q88t8bJ1XhdEQ3El8SmKRGwLxu/MxLAocT2DAhvIbtuh1KwPG 45knDavjQm1HSsPs6XX4eU6+IGVn/JdmsvoLmRtzNxO4zEkqT5IzUs0Qx2gt91EoL4Y1 aA2U9HVif14sh1NCIKoUqSRS1jgvNrRdKFuUcZNhNM7YY9jwfI6nEIRUlFR8JVf4fgdp N1YYOBHIkKAxo0gWZ+lP60bKfhhS4MpqVlE60LmXMm5CZSDySJGzttW+v/tG5D0serqU 3QZVVXvIk+616xsejbi6ep35XMvsBrslfragTlkHCY6quxhW5PxWupnf4qielcy8sLd/ wrgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TvYnAkjAppdRPxTCTiIdH7gnvDHcZXb4SiVpZ+2G8IY=; b=I+QMFii7Mm+1vwpucnUE4tyNEZyFqIrzLOORdQeYcKIIXMbzZE1mJV4vwXXZG8zegK TBSaKzCuKzCkc2X3axABNrbZxKHHDlZW0dZsY86XBO3fQCldVyZJmJDd7sXzEgoyr8Ja 9Ju47IXvERz/4uVgskJ1ITD/0SAP8IuX08HbnKBrqEaHhc8f1KG4bGXp0HYrRFl87mkk A7kE8c723zhqaenprtMdj524eEm/LSly1KF2EVP+YrxfLyuyquzFnIysYuMymtd9nBeZ YtZLyw60ev96lJBmWttXhHRK6viyRKfohWN1myS4B8+CNTQlulClolIt0H8MCau+i5sP GUjg== X-Gm-Message-State: AOAM532A37Scuw5TOUsj4mvCj99noLQyf3DaeRAsNaDgRwwoWOmNK5Jr VVz0CqfX8MFl6OAyfMdf4pgOLvKsCc8aaA== X-Google-Smtp-Source: ABdhPJz0LjXz1SYvP3++9YKVh1YXhO644lvGi4yUfS2yqvXzOCDD2Gmn0wABu71CqL3RZZqFy97zHw== X-Received: by 2002:ac8:6b85:: with SMTP id z5mr1092175qts.191.1592427874319; Wed, 17 Jun 2020 14:04:34 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:33 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 54/73] moxie: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:12 -0400 Message-Id: <20200617210231.4393-55-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, Anthony Green , cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Anthony Green Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/moxie/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index 6e0443ccb7..f823eb234d 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -32,7 +32,7 @@ static void moxie_cpu_set_pc(CPUState *cs, vaddr value) static bool moxie_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void moxie_cpu_reset(DeviceState *dev) From patchwork Wed Jun 17 21:02:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610693 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0305A1392 for ; Wed, 17 Jun 2020 21:33:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEB1021852 for ; Wed, 17 Jun 2020 21:33:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="q2dc5j9L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEB1021852 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfgg-0001Zg-22 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:33:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEh-0004Jt-FS for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:43 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:40746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEb-0000Ml-JM for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:42 -0400 Received: by mail-qv1-xf41.google.com with SMTP id e2so1757636qvw.7 for ; Wed, 17 Jun 2020 14:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cWfP+0MUzrrNImWYZpz2KO/NSgj5qKMFSKUqs77s2xU=; b=q2dc5j9LGIKDmehInfKJjEb6jmYURGpk8RoLvw8cVtWLlWYhcWg2N9AmUjEN5UUJHm 2qfB9d7mVmnA4uh1TEKszpydB3ltf0YnJKZGU8y134vcwpanL/bO7N6UXCMMhFrmrPVL dPVkE6LfZmA/hvCdbl46rYkmTbgcgsyxlhnYgeeA3fjo3za5KMKYmOwsGB7ZxCng9uZk +qyMy3IX9BbjGGXcvizgB418I+XUJU/mb/sQ8+rrc54qvEkqr2UtzW47Ot7cPbLbfOl2 tvFkpxKRdbA1uhB75Pi8ePAKEc1sO7uCi2/58VA2CgplS1Z/tKPz3krJb3My8FE6slBt uI5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cWfP+0MUzrrNImWYZpz2KO/NSgj5qKMFSKUqs77s2xU=; b=Ib3+2JyJtPVnwAuhrmFtlAETOuIzNwakhzjL/j53WgbHpqkyrFnkpOesjEdH0WpaXi eKyALDhndu9MDPFssjkooH7a495VgQ4tSZwGeTvWnpAOQzlHxs449xeKNxLvtChJijTR TNFGR+D+uNsPixRebezOaSbk5oxxp0+gfyveVSksZ6pgeOJCfpf0VwgT1UPfvO/yQzQU 7iR2xOQ3poJ8yZYTqh2Oc1imUuzh1GclSuIPx/flcsssy0fREmJsMb4Gy08AcQlK82iO yCSnDdLAtEIK4xDJd2gYE3ZjZmuQaN9Z0yu0LYKE+F6MukT5dutjplkSnwr8xjMtoIFr RaEg== X-Gm-Message-State: AOAM531Y8R80E7msI7x4ZGkBDIv6H7micpN5kg+dUeG3jGIXL5TTFuw4 4uSbN/1aTwVXYo9V6+H0j2ie/v76JrXM2g== X-Google-Smtp-Source: ABdhPJzCTtcLN6/WDze13qgbwX91FaKVhh3OB6OSCdJxYdg7Xnf1X5gbtbJJ6URSuI6M63OK2GV/eQ== X-Received: by 2002:a0c:806e:: with SMTP id 101mr524860qva.173.1592427875727; Wed, 17 Jun 2020 14:04:35 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:35 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 55/73] sparc: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:13 -0400 Message-Id: <20200617210231.4393-56-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Mark Cave-Ayland , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/sparc64/sparc64.c | 4 ++-- target/sparc/cpu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index fe9c678459..191ebfbb93 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -57,7 +57,7 @@ void cpu_check_irqs(CPUSPARCState *env) /* The bit corresponding to psrpil is (1<< psrpil), the next bit is (2 << psrpil). */ if (pil < (2 << env->psrpil)) { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_reset_irq(env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -88,7 +88,7 @@ void cpu_check_irqs(CPUSPARCState *env) break; } } - } else if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + } else if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_disabled(pil, env->pil_in, env->softint, env->interrupt_index); env->interrupt_index = 0; diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 3f05aba9d6..cef25238a5 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -704,7 +704,7 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; - return (cs->interrupt_request & CPU_INTERRUPT_HARD) && + return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } From patchwork Wed Jun 17 21:02:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610715 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80AD2913 for ; Wed, 17 Jun 2020 21:41:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55E6920897 for ; Wed, 17 Jun 2020 21:41:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bJZ9AnyH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55E6920897 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfoH-0006hu-IF for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEi-0004Ka-6p for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:45 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:36007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEd-0000Mp-Ek for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:43 -0400 Received: by mail-qv1-xf41.google.com with SMTP id x16so1776244qvr.3 for ; Wed, 17 Jun 2020 14:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1b+dD7RxLqaUPVVNgXTFGKKstOqQ+qP/ZFHAKJHyCiE=; b=bJZ9AnyH38/u9FenAZJOw32x7nXAE3c11H3UA9e01D6LcFVkzh4ioqYu144nKCXVdF BxD+8cKCbFSDCU4yOxEWObt9rju8aW6aEX6X0gjikj3LhAjdtXr2iX9GFZKrQrJSZs1k r5oAMM8Q5RamzzyyeALQEzu5uzrcXmrgF/iPgE/jB8lixwmZOBIe8XnHlMnyj3XwSq5i PfaztLFruop8N0rCUpUgINYCWyGgxhXGkSO4zjaEuv3K+PXc276ZN4EFE9Qv7sOikx1V vx/6tOfp9M1+OnZGsjIwGBQRMeICZKZEcQ5o15sw8ncbFmRBuFk1FutnQoe2zAa/HhmF 7AUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1b+dD7RxLqaUPVVNgXTFGKKstOqQ+qP/ZFHAKJHyCiE=; b=KaGzK9nqja7xYdxpSYkDIZ8hfc0oMHXfq+IvRZR6mj+b2stHDdgEmpUlHiOXsTs4Ov 1vZw8Kf6JQL6vxqd4KvYKEzL0mFgAnHYNyJio+WLG5emGRe3Z4p9mVVl1WmeADW7CLTh yk0v1ogUBTyZ4HCBttFSkbRD6nVPsKHoJwIL2GCIpaR12oywd5wnoao1kLw2fqdcVBYx 8OYHF7hdmAvQhmIQIVoWlA3qusrnd50PLM3FnrptTLC+Wk0z/toG6VlaUuX/mWQ2UdBR zdMzAHYfXbY6UCGY9qyzjVIBkev+VrOdD/T9rY0GQQDbe912UcgFr4cNmIOk/xQk1xYM fi+w== X-Gm-Message-State: AOAM530NoBAi/atJ0vej/w2u0KFGGxOnOvSjR36o0sD+b2XRtXZMAHyA aQUDx5NlmetEpAMVq/h/3smUlseiAwfCPg== X-Google-Smtp-Source: ABdhPJxNRVYp3AP7tFXV4bYbpzCc6IIWl4aKAMxqCHDz7BBBmEMED+n9+XyakEaFp6QPMpbpOI1oyg== X-Received: by 2002:a05:6214:6b2:: with SMTP id s18mr523072qvz.135.1592427877097; Wed, 17 Jun 2020 14:04:37 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:36 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 56/73] openrisc: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:14 -0400 Message-Id: <20200617210231.4393-57-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, Stafford Horne , cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Stafford Horne Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/openrisc/cputimer.c | 2 +- target/openrisc/cpu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/openrisc/cputimer.c b/hw/openrisc/cputimer.c index 93268815d8..9475b77d0a 100644 --- a/hw/openrisc/cputimer.c +++ b/hw/openrisc/cputimer.c @@ -102,7 +102,7 @@ static void openrisc_timer_cb(void *opaque) CPUState *cs = CPU(cpu); cpu->env.ttmr |= TTMR_IP; - cs->interrupt_request |= CPU_INTERRUPT_TIMER; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_TIMER); } switch (cpu->env.ttmr & TTMR_M) { diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 5528c0918f..fd2da39124 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -32,8 +32,8 @@ static void openrisc_cpu_set_pc(CPUState *cs, vaddr value) static bool openrisc_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | - CPU_INTERRUPT_TIMER); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_TIMER); } static void openrisc_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Wed Jun 17 21:02:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610723 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7EA9913 for ; Wed, 17 Jun 2020 21:43:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F4462166E for ; Wed, 17 Jun 2020 21:43:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nbqe93r9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F4462166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfqE-0001iH-Rf for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:43:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEk-0004Oo-8w for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:46 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:42453) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEd-0000Mu-F9 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:45 -0400 Received: by mail-qt1-x842.google.com with SMTP id q14so2744727qtr.9 for ; Wed, 17 Jun 2020 14:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NQ/BbjaNmbkm5KQOy7Vv4O17R/NYOg7qZF+hAsl6NgU=; b=nbqe93r9K4U8lYPXg4i1bJG9LdCn/l8r2IMJNiRx8Jo2MrIeaa7KCf6eUKyjziJAUy iM4JsruncRAxUF0U9DVKp0vwdwlty8EHiiMWthQVW85QP9/AtlvCe5n+SKgQlbwCLGHm Ge5UPlXyvV9K6vIDCsPXRZZD//DzigbXygtmg/o2F7gKNkCvty/aInxu3r046SANPoG+ Jj4Cy7BEB9XK+j5E+1jd8vFEEwHc9T27+lNyhOUGkGigbrnQxM3bZiNgbmNnzAiemW4z JC1nePJWOxnXi/AOZHXdZRY0cJs7BcZZzP/d/rDzhP+9HFqkAcfqR0E3g3Bo1kPxinGI kvZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NQ/BbjaNmbkm5KQOy7Vv4O17R/NYOg7qZF+hAsl6NgU=; b=EEzbYXvWn2mpcPl6l5z39TjiXQv+kPfRJ+aOLiWRTyvDBygr8OKW5MaDgry9F4ujjD cOBwUnsXMJGaYqrdHKnWYQaXAk+bbVcAXctWUSBTT36zgO4HiA8VW14m0kQbUVKjeevj 3u83BtxWaOOmEcrkfSoHY+9BW+bPNal+31RxrlbLq3tWMCnOo+XFW24Dy1zW637TblJg snRhGYibwlucull8Y6d7nicSltT0VvZUvFDGZWxRfIDMu1qRD4eM1iGZwq2FRyguxOdy GAid5MYd3K/H6eOsNoIeONCO7yBVegxqfrHa7zGgsYpMaoIXTQR4HfsSqboZKQUMypKH mA4g== X-Gm-Message-State: AOAM533LPy01p2tqibWjDe/mllC6Zkl0LQ2Y6VfuUFk5gBjPNODmDRNt D7uQpydQTM6bEWaBB8jlde2O3w9qn7C1fA== X-Google-Smtp-Source: ABdhPJwx3BgYdlywnyjqWo0ZkR2Ounnd6fxtCLVwk8+Po16TZ3taU3TarQuhJEW97IazglhYl87rGQ== X-Received: by 2002:ac8:7a90:: with SMTP id x16mr1084555qtr.233.1592427878391; Wed, 17 Jun 2020 14:04:38 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:37 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 57/73] unicore32: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:15 -0400 Message-Id: <20200617210231.4393-58-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guan Xuetao , peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Guan Xuetao Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/unicore32/cpu.c | 2 +- target/unicore32/softmmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index b27fb9689f..06bf4b4b63 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -27,7 +27,7 @@ static void uc32_cpu_set_pc(CPUState *cs, vaddr value) static bool uc32_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB); } diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index cbdaa500b7..9660bd2a27 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -117,7 +117,7 @@ void uc32_cpu_do_interrupt(CPUState *cs) /* The PC already points to the proper instruction. */ env->regs[30] = env->regs[31]; env->regs[31] = addr; - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_EXITTB); } static int get_phys_addr_ucv2(CPUUniCore32State *env, uint32_t address, From patchwork Wed Jun 17 21:02:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610681 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FCBE1392 for ; Wed, 17 Jun 2020 21:29:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5A8E2168B for ; Wed, 17 Jun 2020 21:29:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="t24d0x6B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5A8E2168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfcR-0004mR-3c for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:29:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEk-0004QX-SP for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:46 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:42312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEf-0000N2-8V for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:46 -0400 Received: by mail-qv1-xf42.google.com with SMTP id p15so1751102qvr.9 for ; Wed, 17 Jun 2020 14:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3gel5qcjCCdr1MutUEbekB9AJ+USfjviG0mT0qyFu6k=; b=t24d0x6BQM7S8qLKgPPOpQYxItr1MVKjih5JCkiDdhZ7wDMdfAIpFm6Dt7ExJsSdZB VhCe+A6aQDsKrg5Ze6A6fP0OxwuxxhtPvTJYafSmT1dZR+Sr37sgalHf3Soao3apwpXg F6lLWIROdhfdQjE1OWBra31oKhq+Oqt4LQK7X5Wv6o14oe37CuiI9G0k/WgeYmzCsSOs Vmx3/fhEs1be5bcenmdY1/1eSREBk1mORtbukOJ05e9lh1/A2C0/WS9ZCxq5jng/mI0s HMJRz/I7CIl9lhZPA2FWcadarjQ9vkC4KYNDFydydjURY87oNPxVzyF9JfmcycG2WJpy cL0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3gel5qcjCCdr1MutUEbekB9AJ+USfjviG0mT0qyFu6k=; b=gzd4sf/H+yC7k9iZ2OLBMIQoQyoAaF8gCbmLRsJIW7YI2nv1IQU6/ggsYZ+0wGTAsP j4vjsFLb4yXgD6boCcgMDI3Z3H1NrZGgpb00h4EHuugzFZ0N1KFMNi+MZ52GcJlvbZqQ IZ8wH8wzM80ISGoEN1tgha1ZdXT8iNvjg2tr6TuYdPYFqBgsJvVG+kxkQNM6zeQl8ES4 KlTS6OxRQix5/hKUohiVEvP2slMQztlbuljeZJLSOd4BMn2R/hBPCLdjVrYT33X5nyyE 1+QbGsDjTC6abPD6AJnzB6hnsT8375djYiSbDm7FcqR9XkPHAthLcpfwsImrQpyXZxIq UmXg== X-Gm-Message-State: AOAM533hx3POsuHAHCdh+hnIFV677uB2QYRjiQX3ZqAT2E+nRt6iKAlT XRnzH86Z4exuKQXGbrpy1pYKlQqpOnS7hQ== X-Google-Smtp-Source: ABdhPJyg9mnaprijMjYRGZe5I4jl8clpdTB2Ur8jXW9CwriqZ+7eMVzzHW548HPNHo8B6v9E6bXfLg== X-Received: by 2002:a0c:f949:: with SMTP id i9mr556056qvo.75.1592427879628; Wed, 17 Jun 2020 14:04:39 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:39 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 58/73] microblaze: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:16 -0400 Message-Id: <20200617210231.4393-59-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/microblaze/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 51e5c85b10..ce70f7d281 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -84,7 +84,7 @@ static void mb_cpu_set_pc(CPUState *cs, vaddr value) static bool mb_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } #ifndef CONFIG_USER_ONLY From patchwork Wed Jun 17 21:02:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610731 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D61F912 for ; Wed, 17 Jun 2020 21:45:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04345206F1 for ; Wed, 17 Jun 2020 21:45:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HAIEtFIs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04345206F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfs5-0005NX-3w for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:45:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEk-0004OQ-3E for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:46 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:42810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEh-0000ND-7C for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:45 -0400 Received: by mail-qt1-x835.google.com with SMTP id q14so2744834qtr.9 for ; Wed, 17 Jun 2020 14:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=km3WZi1TaIpmNQhmf1v8PVX4fpTySmyjj8uA+abKwoo=; b=HAIEtFIsWsNy2Ng+eP2vfYLwDDRwem0GOYxVU8SnQNr9aqvT9MAhd2dbeP76mo81wJ MxDF7dRV5MIX6iSgoRV+DnsY0DGOvIqG+aUUEfV5+8QcXj7wX3YUOSpxYhSRPjCQZUEJ um0sr8OCx3pP5my3tl18cwklpTjM6DdYXwQGqPwIbkzZQwJcdBvOh3oHB3f61SpQ0W+s 05BQXr/MekCuM50w/BdcSmH3Q8m0shZVjHK5TjCqahO5NwkVo+Kp/hHkwggc2iNX8QEw TnI7Dsf0AdFP5RmiavaikcFt4Y568FGqOp1m3f2dDbuY7BVhcfO4EbhoLOseGKbUpLrc xhBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=km3WZi1TaIpmNQhmf1v8PVX4fpTySmyjj8uA+abKwoo=; b=FT9ajWnLa2MvJAkfKaNJuNTlSroRCzw2lUsQPQJGhAy+f6cWNBqBWwZZUcEzcdNxEB 9DBLLQUFW29Lp6S0cPXgnlmiZO9wGKIy+8Jm49a+VIoGy+jLt0jcVMiY5LjKCED1faX4 Qa3FvzEcHwMHz5e4ckun+Y9sj5fUiC4mT6soVL5Csrltqjv8TgzSQg6V5bdm/wGA92/z bCWt/Ti5BxXzD+87bIWNiS7UrF/olA58O+mlmz1BCh78wGq1aGbBs2nAuAjU9uwT2so6 5kkm88X5NzK6G+sKXKaF4GGm8QgBGR3X7aMO/mUig2kV6nM12SPG7O88MrIcIObbHrkd wMfA== X-Gm-Message-State: AOAM533BbbNu75NpBS8atvsuXR6Yav80fHT3v+s1GjOfZWBWnEoycPLf 0osCE2DyNrnWP1W2oNyTqauuoflTFmWgeA== X-Google-Smtp-Source: ABdhPJxAz8j/ulmeo2NGhiaJz85JJQIk0wNmNvP0BAucR4B1FE0z+wYeAQJnpFoePqe9sx9LQSMe+Q== X-Received: by 2002:ac8:40dc:: with SMTP id f28mr1095809qtm.63.1592427880932; Wed, 17 Jun 2020 14:04:40 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:40 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 59/73] accel/tcg: convert to cpu_interrupt_request Date: Wed, 17 Jun 2020 17:02:17 -0400 Message-Id: <20200617210231.4393-60-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x835.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 15 ++++++++------- accel/tcg/tcg-all.c | 12 +++++++++--- accel/tcg/translate-all.c | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 099dd83ee0..b549a37847 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -431,7 +431,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu) if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) - if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); @@ -544,16 +544,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, */ atomic_mb_set(&cpu_neg(cpu)->icount_decr.u16.high, 0); - if (unlikely(atomic_read(&cpu->interrupt_request))) { + if (unlikely(cpu_interrupt_request(cpu))) { int interrupt_request; + qemu_mutex_lock_iothread(); - interrupt_request = cpu->interrupt_request; + interrupt_request = cpu_interrupt_request(cpu); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { - cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index = EXCP_DEBUG; qemu_mutex_unlock_iothread(); return true; @@ -562,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* Do nothing */ } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); - cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); @@ -599,10 +600,10 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } /* The target hook may have updated the 'cpu->interrupt_request'; * reload the 'interrupt_request' value */ - interrupt_request = cpu->interrupt_request; + interrupt_request = cpu_interrupt_request(cpu); } if (interrupt_request & CPU_INTERRUPT_EXITTB) { - cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB); /* ensure that no TB jump will be modified as the program flow was changed */ *last_tb = NULL; diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 3b4fda5640..5eda24d87b 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -52,10 +52,16 @@ typedef struct TCGState { static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; - g_assert(qemu_mutex_iothread_locked()); - old_mask = cpu->interrupt_request; - cpu->interrupt_request |= mask; + if (!cpu_mutex_locked(cpu)) { + cpu_mutex_lock(cpu); + old_mask = cpu_interrupt_request(cpu); + cpu_interrupt_request_or(cpu, mask); + cpu_mutex_unlock(cpu); + } else { + old_mask = cpu_interrupt_request(cpu); + cpu_interrupt_request_or(cpu, mask); + } /* * If called from iothread context, wake the target cpu in diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index c3d37058a1..23007570f6 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2409,7 +2409,7 @@ void dump_opcount_info(void) void cpu_interrupt(CPUState *cpu, int mask) { g_assert(qemu_mutex_iothread_locked()); - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); atomic_set(&cpu_neg(cpu)->icount_decr.u16.high, -1); } From patchwork Wed Jun 17 21:02:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610729 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 790C913B1 for ; Wed, 17 Jun 2020 21:45:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FF44206D7 for ; Wed, 17 Jun 2020 21:45:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FSHBi39k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FF44206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfru-00052S-I0 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:45:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEl-0004S4-IF for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:47 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:41391) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEh-0000NJ-QR for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:47 -0400 Received: by mail-qv1-xf43.google.com with SMTP id er17so1756991qvb.8 for ; Wed, 17 Jun 2020 14:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E2rKLqGPhEt5KLMSHY+b9yS/ljZbSYYEkJSY3sQ9lfk=; b=FSHBi39kWjJXbvfD+LjWVR+egqIhudII4Eiv+X3PtmHKMB/5fA96rUFM7ElEP3NpI0 +dF6oTriVZpfDZXmu7dHfhcLQ1ZLv6oA7+6PBbAY3P67/PILpMs7cS8ID4g4WF5ar92C aZQPZifbTDs0muaferUZR4YgSGSl+xXUZJLMcl4TmDX/f7AgmZVotbWaYcRnu0SsYHnW 4G4elB34Y893JR3oePpDqkbP8sjZ8dk4GPCRSEsYjSKbJP0zEmstNu91fdCBYXlBFQVw ABCICIyaDo13RX517oCP4EsLUTIs4eCr/U4hR/8XjDVMZzgtVjkYFpTCMlPse2EozqNg am3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E2rKLqGPhEt5KLMSHY+b9yS/ljZbSYYEkJSY3sQ9lfk=; b=D4iyly/0HSuoLneic4llFbIdamYrQzXbi+mBA+E8khNzYr47DDzXA1+U07f8f7rK3O wj+MrXbRP8a5clwdgaFu39StmJOBughZCH7BQAqqzOr1avqjVOp8R4nkD2i7mXr01VQN trYUame4TpNupihmz/yFtPnP2aE+VGEKE3dfhUJ9jZ7eY6pIi6slPCI8I3efPcKf+JRV up1FScExszeD+9Zhxy1LWV8wzoBJkqXWpfHuq6DxW2JmxKwaVqL9rrDc/INph//+0/Dw MW0s2uPovlwvaIYKhlkWaK038mtNobmoFYpMhiBUWv97011dAGCdlMkj0RfWRC9mJQfD I+cw== X-Gm-Message-State: AOAM531b3xyyRheKTqiPEUgT6xhi/o9ZPRV3OhnO4CzJTSUXPYYQt2pA lo0OpgdPLomSYPStS1nmpDZjp76c/sVFfw== X-Google-Smtp-Source: ABdhPJyV9c1DOWH0BDXp+eroMssVKvn5BAvJRmUG+WURzvFGQPPGAMiKKfJ2PT7JgCLp//6cUZCXAQ== X-Received: by 2002:a05:6214:1432:: with SMTP id o18mr551765qvx.57.1592427882239; Wed, 17 Jun 2020 14:04:42 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:41 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 60/73] cpu: convert to interrupt_request Date: Wed, 17 Jun 2020 17:02:18 -0400 Message-Id: <20200617210231.4393-61-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This finishes the conversion to interrupt_request. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/core/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index d3223f6d42..59f02594a3 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -273,7 +273,7 @@ static void cpu_common_reset(DeviceState *dev) log_cpu_state(cpu, cc->reset_dump_flags); } - cpu->interrupt_request = 0; + cpu_interrupt_request_set(cpu, 0); cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->icount_extra = 0; @@ -413,7 +413,7 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len) static void generic_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Wed Jun 17 21:02:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610737 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DD84912 for ; Wed, 17 Jun 2020 21:47:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04B692070A for ; Wed, 17 Jun 2020 21:47:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZIQSD87L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04B692070A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfty-0000kV-6H for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:47:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEn-0004VF-1D for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:50 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:44478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEj-0000Nh-PI for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:48 -0400 Received: by mail-qk1-x741.google.com with SMTP id b4so3459387qkn.11 for ; Wed, 17 Jun 2020 14:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b2xeW1FaDB2PR1E4Ymub3nePuzIlXe65/BuJe3DDIkY=; b=ZIQSD87LAmmPZtdpcbAKBzJo9w6PtLrbHTREwy1cFiP4Qsx+hehp85X/ycyuslgWDN 6rXGwKkZwl96xGeM2jx9HRl25o1ItzEHTgPMrq+JnMmNQWOs0yeQPZrt8P9+z7u80CkK mkwDC7P3yXeHXv1ESDwb9EWZT2y87P7DnKqdZxgXBSWLlt7+rfWZQAwjPdVuZPhHXSlt BbzmtXBQja8eyG2BEDC+087dOrYgvtJBEHe8ulbwlJrF7LP0tuAcZxsLUYzDq1S1mmmI UjYmNXQl6blnmJ+iNcr2vylLs9jqFnyFk34JY/tweuw92dMLTWKZhIxZ9tiUOn5/AGhC TZoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b2xeW1FaDB2PR1E4Ymub3nePuzIlXe65/BuJe3DDIkY=; b=DQnvI6o3r0mYkT4XBvaWAn5Qg2jqhYc94fEBxaXg57+3Wwhp2bD62mJ3XChIkDj1Ok reNzxZO9s4FVlC5oEi5Tp9dBLq8Shk1cre+BRWsCzZGY+/JOIyaGGLIq5RtN1qS5Mh6N 9heEzax1XeI8gntOxCLTw5G8TLm9GqZidXx+94QSoELb1t5RSsEzcjqlb0pfwL7/mFN0 sBrmVAjZb23YX5Xzc/fWASL7MLypDu0fW4reZldDLaTcK/FmbCOa0GXr/W1HlxZvjy+m KrdwJx1A887EuHn8J5Gmuufln1kxAnDM/zOu3WSBBXDmtDWjwvSB+GogjGzIBY1W+7Ky kvwQ== X-Gm-Message-State: AOAM532S8Te4LUFJb/mOhy23S6lMQFBNdnykpLRylAUNRwk8iU1eUm2+ Mm0gf/5BdhXkT6h7J8pj4r89zAq96/yYkw== X-Google-Smtp-Source: ABdhPJwPMylsKqsiMX109wPlTPAq5KFJ/glBKr/TjnDtjv7j4/necsC/sEBUqST7SyIhtKxQn10CEw== X-Received: by 2002:a37:9ad5:: with SMTP id c204mr550641qke.413.1592427883491; Wed, 17 Jun 2020 14:04:43 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:43 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 61/73] cpu: call .cpu_has_work with the CPU lock held Date: Wed, 17 Jun 2020 17:02:19 -0400 Message-Id: <20200617210231.4393-62-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- include/hw/core/cpu.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 6f2c005171..79da78cd10 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -80,7 +80,8 @@ struct TranslationBlock; * instantiatable CPU type. * @parse_features: Callback to parse command line arguments. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. - * @has_work: Callback for checking if there is work to do. + * @has_work: Callback for checking if there is work to do. Called with the + * CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unaligned_access: Callback for unaligned access handling, if * the target defines #TARGET_ALIGNED_ONLY. @@ -804,9 +805,16 @@ const char *parse_cpu_option(const char *cpu_option); static inline bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + bool ret; g_assert(cc->has_work); - return cc->has_work(cpu); + if (cpu_mutex_locked(cpu)) { + return cc->has_work(cpu); + } + cpu_mutex_lock(cpu); + ret = cc->has_work(cpu); + cpu_mutex_unlock(cpu); + return ret; } /** From patchwork Wed Jun 17 21:02:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E5AF175D for ; Wed, 17 Jun 2020 21:36:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9A1D20885 for ; Wed, 17 Jun 2020 21:36:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jsBY4oHC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9A1D20885 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfj3-0005dK-5j for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:36:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEm-0004Tx-Dr for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:48 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:34524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEk-0000Np-53 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:48 -0400 Received: by mail-qk1-x744.google.com with SMTP id f18so3524898qkh.1 for ; Wed, 17 Jun 2020 14:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2fC2p4q7EXMT22jmjpJyi2yYnEcYk9REFP3VTNIoqTk=; b=jsBY4oHCFsO3VZPpm5UPbNXmnE7ZOy0NoqalWszny0h/zWNqlLNEOPiLpOw3HWaljV ymmlyJ9kqHsZdj9V2W0+LPPm9Hno71HpFkxyHgmCOjoYS8t+SY3zKYK8k9bz00r7ZMVF dQt+Gd+YgR4ROEUgHBJHhmAoCPNomgrHm5yDwdO2F+LKBUw+fp4Nmc1Phw+Kuucj3z/o fP61PUBL91eHaQ65dXzI0fp2IGNus7maKC8eAwwSqeZ/j1PT3/XQJj1Wzq6AOlbdc5QP BOdeEtfV5LtFJnEt1JQ7djZYdLKYUkOFuw/2fEBVmmhqWd4wlzqN6B0fM3GLaFkj/eTZ hQhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2fC2p4q7EXMT22jmjpJyi2yYnEcYk9REFP3VTNIoqTk=; b=ThdhzRcf3hsKsyF556Wy9fWAUaHPVXcijuFVmink1MJfStpxz6N2awWSi6ERB6xRSa jSL5sMbX4Y82TC3REv6zTruJDnT6FOtqFpJchAsmgAYdgqP2GGo2uKJRbSiFNhxnS8YH SlEQWoXBN1jrJWRrr60qukp+5LT8EEYgw9Hn7IWjo2dZ3kkF9rR5FroO9i3NAr1PTAP8 6jUeoYBN3imMvTn9Iw+gaUo2q4zjtsu71D/6IXe5KL1PFb7Gus8QFEVq8XGsgz65P1cQ ok9X/w67DPNPKKSp8cHtyecv6/yJh2Edm15B+p33cQuz3P3Cn2Ef3FIlBEl9Z/nwswJA v9hw== X-Gm-Message-State: AOAM532lOpeTbl318b+I1Fl5eDYVmnB22i2fFI0aB6nMR5gwFg+z/5Uw D4goji25fheBYRoc1t0sM5pAK30aQVO8qw== X-Google-Smtp-Source: ABdhPJxchMTSZ7tuU+6x+Tf4VT1yIsiZl+CER43NGdd4pyESY7D2ChqI/yhMgqWGdSFtGSrtj1t1qg== X-Received: by 2002:a05:620a:1524:: with SMTP id n4mr541319qkk.295.1592427884939; Wed, 17 Jun 2020 14:04:44 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:44 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 62/73] cpu: introduce cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:20 -0400 Message-Id: <20200617210231.4393-63-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" It will gain some users soon. Suggested-by: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- include/hw/core/cpu.h | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 79da78cd10..720bc85a84 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -26,6 +26,7 @@ #include "exec/memattrs.h" #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" +#include "qemu/main-loop.h" #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" @@ -82,6 +83,8 @@ struct TranslationBlock; * @reset_dump_flags: #CPUDumpFlags to use for reset logging. * @has_work: Callback for checking if there is work to do. Called with the * CPU lock held. + * @has_work_with_iothread_lock: Callback for checking if there is work to do. + * Called with both the BQL and the CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unaligned_access: Callback for unaligned access handling, if * the target defines #TARGET_ALIGNED_ONLY. @@ -167,6 +170,7 @@ typedef struct CPUClass { int reset_dump_flags; bool (*has_work)(CPUState *cpu); + bool (*has_work_with_iothread_lock)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); void (*do_unaligned_access)(CPUState *cpu, vaddr addr, MMUAccessType access_type, @@ -805,14 +809,41 @@ const char *parse_cpu_option(const char *cpu_option); static inline bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + bool has_cpu_lock = cpu_mutex_locked(cpu); + bool (*func)(CPUState *cpu); bool ret; + /* some targets require us to hold the BQL when checking for work */ + if (cc->has_work_with_iothread_lock) { + if (qemu_mutex_iothread_locked()) { + func = cc->has_work_with_iothread_lock; + goto call_func; + } + + if (has_cpu_lock) { + /* avoid deadlock by acquiring the locks in order */ + cpu_mutex_unlock(cpu); + } + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + + ret = cc->has_work_with_iothread_lock(cpu); + + qemu_mutex_unlock_iothread(); + if (!has_cpu_lock) { + cpu_mutex_unlock(cpu); + } + return ret; + } + g_assert(cc->has_work); - if (cpu_mutex_locked(cpu)) { - return cc->has_work(cpu); + func = cc->has_work; + call_func: + if (has_cpu_lock) { + return func(cpu); } cpu_mutex_lock(cpu); - ret = cc->has_work(cpu); + ret = func(cpu); cpu_mutex_unlock(cpu); return ret; } From patchwork Wed Jun 17 21:02:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610743 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14C05912 for ; Wed, 17 Jun 2020 21:49:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF9072070A for ; Wed, 17 Jun 2020 21:49:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VaZgkRbq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF9072070A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfvz-0004pr-47 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:49:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEo-0004a8-Uf for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:51 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:35411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEl-0000OE-JT for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:50 -0400 Received: by mail-qk1-x743.google.com with SMTP id q2so3530862qkb.2 for ; Wed, 17 Jun 2020 14:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wzz0etTpNkLIVhXKsaNrdHJF+FQFmmiKYteH+ClsJ3Y=; b=VaZgkRbqExWZmfHzCi1ylCk2OTlGq4vZUGFz8454JcjhQz7U8XsVLAJhEjS86oc7YI aIT2qvw6nlnhOTcxuk8SVnV44NBHZzePlYGJAX5TdIbJgkpx1moTYkZcOXQDKXG9XHjC L3JiZMZxBV7VBqGv/oOqwgGOYBR1xEBX6MT/PF6hpHn1Z/XJCS4JkHOGgPebZezzmg9U KBk5TzEZoIvwdR54MhA0oPcnVdXjmR/MyaMitLvtcUbGlU9+4f0cRB5nMhGfQEuBFmdV i2wPNQO0YBZ4IrOqlXXFaiZFjONytjH3ilx2BIXW/O2jGYmlg3dqQaxLXZXtzeDA5kJ9 x+qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Wzz0etTpNkLIVhXKsaNrdHJF+FQFmmiKYteH+ClsJ3Y=; b=WFdl5v8aXNWQSwbqhMSjsopFyq8Fc8oUsYcJ3gVmg7OWdjJxon4VeXFBWDNCYozXs8 2xWriMgpKrlmhr75C3V/yt73NIFw9rjJTqDxgLMluPRjFKx6Ryj3l0rgC9lY3tXdy+js UcMJB/lP4sEp23LUWz2qdJIkSB6TetIvMhhaS5C1TITvMp7mlmAqmbYt5mRvmhe6q84U nYP5i71l6WuxBK66GKNmJVZUcd1OFRdQszoWUZ4gqa14cNMfbKSsMZdfvTeGjBEOTRA3 Dwgy1yQCyP0x4TzQGFlRRr8i+1JuD3hTursbgneL7kjP01QRWIuCn88ij45XzQDx3eOL PFig== X-Gm-Message-State: AOAM533igE9RhEvZExxQxYALLN2IOs7VgvcjTbVOvXaIw4JQKbpLaToW xfG4Et5YeBD+o+dnRRgB9jgf7u5rBctUMg== X-Google-Smtp-Source: ABdhPJxM6QYpcRkr9Oc35nOQvHJgtBtlSj0UtIwI8rlUvBY9sV4CeFovpAHG4xq1HcNUQ6mZvlmC+A== X-Received: by 2002:a37:9684:: with SMTP id y126mr593877qkd.348.1592427886325; Wed, 17 Jun 2020 14:04:46 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:45 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 63/73] ppc: convert to cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:21 -0400 Message-Id: <20200617210231.4393-64-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota [RF: Converted new code related to POWER10] Signed-off-by: Robert Foley --- target/ppc/translate_init.inc.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index d06d9ff204..60ee51c105 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8540,6 +8540,8 @@ static bool cpu_has_work_POWER7(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; @@ -8582,7 +8584,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) pcc->pcr_supported = PCR_COMPAT_2_06 | PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER7; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER7; + cc->has_work_with_iothread_lock = cpu_has_work_POWER7; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -8702,6 +8704,8 @@ static bool cpu_has_work_POWER8(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; @@ -8752,7 +8756,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) pcc->pcr_supported = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER8; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER8; + cc->has_work_with_iothread_lock = cpu_has_work_POWER8; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -8902,6 +8906,8 @@ static bool cpu_has_work_POWER9(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; @@ -8969,7 +8975,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER9; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER9; + cc->has_work_with_iothread_lock = cpu_has_work_POWER9; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -9118,6 +9124,7 @@ static bool cpu_has_work_POWER10(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; @@ -9186,7 +9193,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) PCR_COMPAT_2_06 | PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER10; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER10; + cc->has_work_with_iothread_lock = cpu_has_work_POWER10; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -10656,6 +10663,8 @@ static bool ppc_cpu_has_work(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } @@ -10880,7 +10889,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = ppc_cpu_class_by_name; pcc->parent_parse_features = cc->parse_features; cc->parse_features = ppc_cpu_parse_featurestr; - cc->has_work = ppc_cpu_has_work; + cc->has_work_with_iothread_lock = ppc_cpu_has_work; cc->do_interrupt = ppc_cpu_do_interrupt; cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt; cc->dump_state = ppc_cpu_dump_state; From patchwork Wed Jun 17 21:02:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610689 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 658C81392 for ; Wed, 17 Jun 2020 21:32:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A94521852 for ; Wed, 17 Jun 2020 21:32:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Thm2aHey" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A94521852 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlffw-0000I7-BR for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:32:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEs-0004d9-Ll for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:54 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:46918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEm-0000OY-VU for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:54 -0400 Received: by mail-qt1-x844.google.com with SMTP id g18so2725211qtu.13 for ; Wed, 17 Jun 2020 14:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Gn2vKDOISxQzKy44RYpzzeOAg/5NGEBTOA6wtcYZvN4=; b=Thm2aHeyJvMESgiuasvN/HjzFdRSeqqVQq4LmqV7D6GB6694ajgYvGe/9WpkcXcr7F H6koOjMcYHMlU58jiBD/na7kpp3MbsoTyX0KplAxlwrt2ZmSeI/rh5fM8TdZticOuv0p Z1vjrEEY1KGN1jCiWJwqToxP+qrfb2n72GLHYu9mJqEYeG3CUlJzq4Eky3Kx2UvuHPHN aMlcJ1moeBFKEZ07hjG6Nhi29ltknA7u72gd+Wrac+8dyTBBsAfs1wIVelDyGhrH+pG+ PPsjFOGYYUXi0b4Dv6yGb227Q5Ef2PKsuQMeOhRBSfupxxYGQECJ0uMoPk4M83egmmQx rsew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Gn2vKDOISxQzKy44RYpzzeOAg/5NGEBTOA6wtcYZvN4=; b=eK+bamCd/z262bhZrdAt9o1bJRpRneSS+H1nOJqtmyNSaC6hbb+uaKBxEAAbDv3Lmb IWFDcC1ucWfvAXg2J0zoFksB/58J7NpNkqVF3m08mplZDVZdoNp9t14uZpOWIfBRJUmf PsEH7PcmefK05FG9QBP6+T69O9kHBBaBYk79fMqs2E3gO9oN2wfI10DkNj7XC5UVPa8Q pcj1rm6Ov43tH0VHH4Wst1pJ5jsWjdp5wz241rXZm1AxZy7+FW/Ew+l90n2nNWhPWx0/ D6Wmwbnr083jaVTWuAURHM+Xczvw5sHyHHJYhS+H7phe1xAUCHn1bI264mHR8ry01QHP n9Gw== X-Gm-Message-State: AOAM531hWh/5SWwtiDRLiLha723myIuM73+b4DGDrBbiWIry9QQY4/jb snnozBt+aYlfCBtWt42P/BkNLu/09ol46w== X-Google-Smtp-Source: ABdhPJxAKNubapx5PrPPbM5wErYiPAmdGaZpL0L5IGJIvowKMl1c2emXMR/ej2SGxbckZ5RV2i/pjg== X-Received: by 2002:ac8:51d5:: with SMTP id d21mr1141796qtn.154.1592427887822; Wed, 17 Jun 2020 14:04:47 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:47 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 64/73] mips: convert to cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:22 -0400 Message-Id: <20200617210231.4393-65-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , robert.foley@linaro.org, Aleksandar Markovic , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Aurelien Jarno Cc: Aleksandar Markovic Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/mips/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 761d8aaa54..ec9dde5100 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -58,6 +58,8 @@ static bool mips_cpu_has_work(CPUState *cs) bool has_work = false; uint32_t interrupt_request = cpu_interrupt_request(cs); + g_assert(qemu_mutex_iothread_locked()); + /* * Prior to MIPS Release 6 it is implementation dependent if non-enabled * interrupts wake-up the CPU, however most of the implementations only @@ -193,7 +195,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) device_class_set_parent_reset(dc, mips_cpu_reset, &mcc->parent_reset); cc->class_by_name = mips_cpu_class_by_name; - cc->has_work = mips_cpu_has_work; + cc->has_work_with_iothread_lock = mips_cpu_has_work; cc->do_interrupt = mips_cpu_do_interrupt; cc->cpu_exec_interrupt = mips_cpu_exec_interrupt; cc->dump_state = mips_cpu_dump_state; From patchwork Wed Jun 17 21:02:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3F6090 for ; Wed, 17 Jun 2020 21:51:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49DD8206E2 for ; Wed, 17 Jun 2020 21:51:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EOHgITnT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49DD8206E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfxy-0008Lp-95 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:51:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEt-0004ge-VY for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:56 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:41180) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEo-0000Ou-E7 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:55 -0400 Received: by mail-qt1-x843.google.com with SMTP id w90so2751525qtd.8 for ; Wed, 17 Jun 2020 14:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9h9/kdng7d5/XyPKaeEfDSBMXGQEDWBnIMh8jIPDb5s=; b=EOHgITnTlH58unySKZbtDoTPHEK2dDpC/Gtmrde6cCSG6qN91j/e6Wc8xugGiyMW0Y aWbVM6z1y7CLV6VkMIKEuYpr4xJXFKN+WNdu6UmpyfyoR027BeM1+giuAFsGReSzuHFm 25DEXXNX4cC/PYZn+8JECZlnzGb1fkr7Hebi10zYnGZC5kBUmnAWMTnkE5KXMYL0aqXt 0TqTsv+crkoS3h+WhA4i6zkayEDU7y/ON+3maOBj7OwABKtPBdRX3OlFLizYRyU52cB1 KUnOn5AwjGGXU/D/K/lRgigLztlsb0gCdyqyfGvmtMRuUpGB2dZIrMUnjxD/itry2i/X qciw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9h9/kdng7d5/XyPKaeEfDSBMXGQEDWBnIMh8jIPDb5s=; b=g5fhUQ05rBk00UMICRQ/HhRmRIQnr3wHN4t8oEYlQYIr/AJ+HlmaFdnB/MBQ4sSLz/ RDwb1buTLStZlMGJqlDp7NQoLkR7IcoqZ+YHwcXnmGJStnSvKQzFSkdbESHnChIC3uJp a2A3Xu+h92qOE/S5/Z9il0xF+jRoyXmtjN81pr7XgNT1QxkHF2OrlzD4DM/Uwq468RTE 20O7YeFXtoA2hmTYPV6ppPwIl1dSM4Pz4vuPzeUZaCxYFWnkAw60F3Ik2mflAcgfUGGS zDVqI+odoCuyyiAEBq4bRTFNvE6U28YsA58jKcKPEys7LwnVEnpQGRXLFfbAft66hMpm IccQ== X-Gm-Message-State: AOAM530OlAIrCn+2tRkSIGBatBS5YjgIz+S4sENdawBHngi6XHvG9sp3 EO4UHbLsWdiQvWV2iqV7ptQFBdogozmbjw== X-Google-Smtp-Source: ABdhPJxDbZZsWRpQ7oF8CF81oaCZXwgMXStQtX0RyCVG9VnqlMOGfaaP92E8zJYNCy5eo6zgd8WcDA== X-Received: by 2002:ac8:341a:: with SMTP id u26mr1167704qtb.36.1592427889282; Wed, 17 Jun 2020 14:04:49 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:48 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 65/73] s390x: convert to cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:23 -0400 Message-Id: <20200617210231.4393-66-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , robert.foley@linaro.org, David Hildenbrand , Cornelia Huck , qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/s390x/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index d157dbb7a9..4d0d323cf9 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -59,6 +59,8 @@ static bool s390_cpu_has_work(CPUState *cs) { S390CPU *cpu = S390_CPU(cs); + g_assert(qemu_mutex_iothread_locked()); + /* STOPPED cpus can never wake up */ if (s390_cpu_get_state(cpu) != S390_CPU_STATE_LOAD && s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING) { @@ -489,7 +491,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) #endif scc->reset = s390_cpu_reset; cc->class_by_name = s390_cpu_class_by_name, - cc->has_work = s390_cpu_has_work; + cc->has_work_with_iothread_lock = s390_cpu_has_work; #ifdef CONFIG_TCG cc->do_interrupt = s390_cpu_do_interrupt; #endif From patchwork Wed Jun 17 21:02:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610709 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D280013B1 for ; Wed, 17 Jun 2020 21:38:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA5592088E for ; Wed, 17 Jun 2020 21:38:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hC/Pejzb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA5592088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfl1-00013p-U7 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:38:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEt-0004eO-3b for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:55 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:37446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEq-0000PG-0P for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:54 -0400 Received: by mail-qk1-x742.google.com with SMTP id b27so3512081qka.4 for ; Wed, 17 Jun 2020 14:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YTz6vFHmZFyC4ACE7F4vHqeFTUJV7CWjdiB6P/9KC+w=; b=hC/Pejzb8BghSmFgUSR+yU/UxhcdgiOuTZg5ww8qnQVSJ+j0wrUDItnixZfav82TfF u9kU66OoyEgjPZ2wUSfOqEsbfjJYkaDJ0dNgeGhQneC3JAAgYSs7plS52Yt19W5ddJTy 6C2yFaWdcV9IS/gbbkfo6pmL6uhUpVpWCr7PiaaTIg1XVCOu5X2LN9WHmajL3OOhrHZQ e6eNPGdU1F5ipFHlNs8CflvhyLr97YoWavUT7BOHfwWtmTjjDN7p0uUCq22NqqtzmSsi g1CNKMY7eAld89KE83NMt0dQ9aGc/ytAjuDNkV7kAaekVPgFyRCEGH/4V418+uzQArls hu2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YTz6vFHmZFyC4ACE7F4vHqeFTUJV7CWjdiB6P/9KC+w=; b=spbTNvYcbRumoO9hByYwa6TESeXORS8rPrGEFMnjDk4X9pGzdPC+hZKqSkFNHJA4HQ /5P6gtnwDmdTsiBgflXqBWy2TqTJZUYqi9GHx8aEvaZTdR4FBqc9S3KBPdn1pZhW6vZH gVm6M1TfNDMrV5lXGD8BQ4rHsG99YUI/hK6eBdLQaJnRJWyPKlqfZqMoz5gdiQi6CH45 Ody46F9LM6D0ct+z5NV99DEtVujbI7nLdbJtDFw/Tv8zEbj7yBBQwf/G3jtNnEQKNQlo T0t1K3NIPqK3JeT/W8VH5c3BPmlylnFV+1dUCYH9F3uORJoLh6E3Fqt50/INvxqrgMWM 0Gmg== X-Gm-Message-State: AOAM533W+7x67U+ekzsYpRIZWjXLzm/pqmVsBs5A/dNp8NohdY5ysLfr j0hY4/C2ExFq0llYXeP/dG2PWf6ToEV1rA== X-Google-Smtp-Source: ABdhPJzbaSCLaao3AWjR6m5aPs45KbFrOxOruYbFXhOkTsPlQrFCOCPObgXKviN3NH70Z40F28etrQ== X-Received: by 2002:a37:5e07:: with SMTP id s7mr628501qkb.20.1592427890822; Wed, 17 Jun 2020 14:04:50 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:50 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 66/73] riscv: convert to cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:24 -0400 Message-Id: <20200617210231.4393-67-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , "open list:RISC-V TCG CPUs" , robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , cota@braap.org, Palmer Dabbelt , peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Sagar Karandikar Cc: Bastian Koppelmann Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/riscv/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3a6d202d03..d56ba65b32 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -310,6 +310,9 @@ static bool riscv_cpu_has_work(CPUState *cs) #ifndef CONFIG_USER_ONLY RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; + + g_assert(qemu_mutex_iothread_locked()); + /* * Definition of the WFI instruction requires it to ignore the privilege * mode and delegation registers, but respect individual enables @@ -510,7 +513,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) device_class_set_parent_reset(dc, riscv_cpu_reset, &mcc->parent_reset); cc->class_by_name = riscv_cpu_class_by_name; - cc->has_work = riscv_cpu_has_work; + cc->has_work_with_iothread_lock = riscv_cpu_has_work; cc->do_interrupt = riscv_cpu_do_interrupt; cc->cpu_exec_interrupt = riscv_cpu_exec_interrupt; cc->dump_state = riscv_cpu_dump_state; From patchwork Wed Jun 17 21:02:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610713 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3D1E913 for ; Wed, 17 Jun 2020 21:40:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAFF22089D for ; Wed, 17 Jun 2020 21:40:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OFm64wZN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAFF22089D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfnP-0005fW-U0 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:40:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEv-0004hR-27 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:58 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:40085) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEr-0000PX-Ed for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:56 -0400 Received: by mail-qt1-x844.google.com with SMTP id i16so2752568qtr.7 for ; Wed, 17 Jun 2020 14:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xM5F5VKH4+4sC5/UG8rh4cawXyjUH8jNOSP42/FFGNs=; b=OFm64wZNBrpW0k2TGETE/NApPmVP1ss5RBk7onAJHsQ7hcEsI6yN1SgiNrUrxHWD6J jYFFXroxefK9j4U+Fe0l9sR5wKekFRc1sW23R2+58zenplFK0YRODgS2w9pMy27xk8jL ZGNIfJtGlMGRN4N8U0x3cijwymopup+N2W6/P8Qlx92y4bqIKCYW2PBAvilqLXBP07AG XDSi0RMEblKmIye1sOOu4k1vm5jBSrRWE0B+8TIV1nUgqEEt4tRxIwd0tdrFCUmXpJPr wNkoEtWWW5e2K1Cj9S9JDFQXqNjygPb1PG18bNZjNHJTojEq5DVtfdDwlcC/pVEdNwOa B6ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xM5F5VKH4+4sC5/UG8rh4cawXyjUH8jNOSP42/FFGNs=; b=sMO6d1kdjRw5JmbZ/jiISflmicjHDTt9vqbM+J+O4efsoW4Bo2JNDcsBc0ASvujYw0 sFtidjbe1rPt74iLxX8kDxk1DKABf71yCBa/oBwr3K/rpfFfVcdsetgqTMppgqOH8ol/ yqDuDD3RQvsr7ppqm6frC1TGlKNOsjqF/f8l+/Yu546oYHK6Zs0/fQEdyl75xXOk0HpX G1aMQWwcN2kFRazCpuUnUCG+XqTqfX79bWh4urckPehcdb2sxREhiL7V147B2Nx8QCVF IKriTQKo5U4nYxzdyp7a48t1K7UG5QlEZzUpluUyq/XebY8XF6VuTQN8NYnzUOFfxenm Ju6Q== X-Gm-Message-State: AOAM530yOPZ2ZB7KUFqS41YdfbCO53Wx/8ZRBU6RKoxJvNR1YdzRRinm DNM2sm0HHdjlhkSdov/DFPY2PgvJbZVntw== X-Google-Smtp-Source: ABdhPJxXNfGSfor+PGZaaz82a2xEBg66fJWgIH+uRokPLXiV+g87VSlNwu/Jwb2CAlA9ZVdI/bTCMw== X-Received: by 2002:ac8:7a90:: with SMTP id x16mr1085647qtr.233.1592427892159; Wed, 17 Jun 2020 14:04:52 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:51 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 67/73] sparc: convert to cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:25 -0400 Message-Id: <20200617210231.4393-68-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Mark Cave-Ayland , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Acked-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/sparc/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index cef25238a5..3fa1a535d9 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -704,6 +704,8 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } @@ -863,7 +865,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = sparc_cpu_class_by_name; cc->parse_features = sparc_cpu_parse_features; - cc->has_work = sparc_cpu_has_work; + cc->has_work_with_iothread_lock = sparc_cpu_has_work; cc->do_interrupt = sparc_cpu_do_interrupt; cc->cpu_exec_interrupt = sparc_cpu_exec_interrupt; cc->dump_state = sparc_cpu_dump_state; From patchwork Wed Jun 17 21:02:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C85090 for ; Wed, 17 Jun 2020 21:53:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72B6921556 for ; Wed, 17 Jun 2020 21:53:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="b7NNgrZr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72B6921556 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfzo-0003z3-NG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:53:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEw-0004hb-0b for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:58 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:41381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEs-0000Pj-JN for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:57 -0400 Received: by mail-qk1-x743.google.com with SMTP id n11so3491772qkn.8 for ; Wed, 17 Jun 2020 14:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FcchR0Kiy3cS07PsythDlOBOqbmqT9MEDX8/TYIcoYY=; b=b7NNgrZrFNuqVFOfuDQ849a9QCbO8DRNYzIhM0lVUGYEd5ZmLEzBXc9iDl2xxSdRNX wyvClhDSJmiqfoawmvHf63Ivq9hJxSUryarsthN6PgF0Hj7roHiy7732Pgu2AVqtU/lk vD8P9EvZtlR5KoVsJgd3YqI6z0Q+alrUH6ZazunfyvHsYdPmBtk7k6CQuMCPhFPtgBR5 s5Ygr9YbIarzbNs3cTe6gAMyptKJNna9j30UF3Mm6ORtQqqKGkbRYd95Q4G2jxOxJUTY sElUgc1sLzdzOWctyz+lGbsc9YsLVV7/bCZ/URBv4iSO9rYAJOMRz+nfIuxbA00d6K/b IWaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FcchR0Kiy3cS07PsythDlOBOqbmqT9MEDX8/TYIcoYY=; b=THiEuTHk/drK9Xbdq6dnf4R57thrWQCC3KDn838q8h4JUlUigTn7K7JYU/fKuTYbT8 cXnihemOaeID1NiFmRXGhwrJolEWn5Bx+jGABibUX5yAGsKtyDTRN3nLfXisF8izR5zR 2D8m29Q1HSZEQF7rQL+2dAKzIFafqiBOHoK11B/bijLhOquWqKUA+KcXtseYCRTDio8c gnj7K02VDmJY33PCEfHvFfUL98O0CVilC44sIEP9GFqEbFK0swgptWeGLq96jDIDCxrr Thn16YWnyWK9e/NqyARexWlQagyYs5hGGgbEJBF3TpLhE8zhikqwdESi415G6uf4tpoQ ppsQ== X-Gm-Message-State: AOAM533fmG1MZi7GqIBsjISbnBczfdF3pbC0XxuDdbCtEkUAiqOJ5Uog K6npnLfcbx0jnCixXdpC7cU1IX/aSW+qzw== X-Google-Smtp-Source: ABdhPJyx+9aPp6NjMgmMg2Jpy2x8+7rtzrr2M4IIVCw7aqzUu3jyOAym+42n5ip9HKdguY35gz62Dg== X-Received: by 2002:a37:a84c:: with SMTP id r73mr336144qke.0.1592427893463; Wed, 17 Jun 2020 14:04:53 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:52 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 68/73] xtensa: convert to cpu_has_work_with_iothread_lock Date: Wed, 17 Jun 2020 17:02:26 -0400 Message-Id: <20200617210231.4393-69-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.puhov@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Max Filippov Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/xtensa/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index fda4a73722..0f96483563 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -47,6 +47,8 @@ static bool xtensa_cpu_has_work(CPUState *cs) #ifndef CONFIG_USER_ONLY XtensaCPU *cpu = XTENSA_CPU(cs); + g_assert(qemu_mutex_iothread_locked()); + return !cpu->env.runstall && cpu->env.pending_irq_level; #else return true; @@ -187,7 +189,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) device_class_set_parent_reset(dc, xtensa_cpu_reset, &xcc->parent_reset); cc->class_by_name = xtensa_cpu_class_by_name; - cc->has_work = xtensa_cpu_has_work; + cc->has_work_with_iothread_lock = xtensa_cpu_has_work; cc->do_interrupt = xtensa_cpu_do_interrupt; cc->cpu_exec_interrupt = xtensa_cpu_exec_interrupt; cc->dump_state = xtensa_cpu_dump_state; From patchwork Wed Jun 17 21:02:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610719 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4060A913 for ; Wed, 17 Jun 2020 21:43:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 176702166E for ; Wed, 17 Jun 2020 21:43:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eeIjDad8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 176702166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfpr-0000mo-9P for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:43:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfEz-0004kL-11 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:01 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:44362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEu-0000Pw-Gg for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:04:59 -0400 Received: by mail-qt1-x842.google.com with SMTP id c12so2732467qtq.11 for ; Wed, 17 Jun 2020 14:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E8xOKg6zl9lpl0+sHu1MbBAzWMqSY0gf0lTzZwybF5o=; b=eeIjDad8QZZSwiPDJPlhK/CUYY5xjxWhWsCKEVDRwD3prmDhbP4OuHsTXGFXpyrqcq fgL/59sa1tTdZYAx6uk1lLa5Q+Se/972AnxrO01Cr8/UbSGVL7bn9NSGDkTMTMbicdhQ aH/doqCOF3vW6zSGP+7cYoR2f1igNxpmw1+vimHRxx+divzGubxR3ypvQNKYjIj+oXwa 48NS/Hj43H6dv3L/tKAC9jBK21DOMfFZlfHZ4LAGuFfFQdKm6EdjWN7e2YQTkxIee/fu vOU7ri095drXYoDMfOlLhttYnZPJTQZHypybF08Lqdh60s/NBK+ZJVNp/n6DyPSKPbae PvPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E8xOKg6zl9lpl0+sHu1MbBAzWMqSY0gf0lTzZwybF5o=; b=sK5Gk8ZWfHUjZaOIMN5+6k6nwzG3NAmRgUnZJdh+omn0cPJxYsflrqjKUxytgBWIqc n090WGK/hOT3DTGCzMVyu4yQzfzOyI/Ref6/5wNfuuBdByS/6NAFL5VoaLMSA56hQms/ JfnMUYRjmCl1dkZ+s0OYdfRXViqX6AuVXnkEgEawo1PMSzuL5SDky5+uvCwIwY81MeHk XXCo+JNaK39KXtTKcGOO2oAduPEK5Pj8jwyNFaFRodU2cBVhheT9a0cfmQsnyJFCap/s 9E+syn7r6E390Y09vM3cP8Gedxz9/BZMjjCWHc3OGOTKDh0nGcahLErK5o+Zz9IzU0bF AeOw== X-Gm-Message-State: AOAM533Jfeu8PiAaqTpp248VUgzbsJY8qiZiCFa5s0mVqlej560yD1Gj +IbCxTG3ri1EGhuiK4CKo/t3f8jsWJMQkQ== X-Google-Smtp-Source: ABdhPJxNIzeZBOZW0gNtxYteNvYRgBJc+2t1LbJsDe88yOKZZbS2v0yNUfFBlPV9NqI3svqHVeS7nA== X-Received: by 2002:ac8:4281:: with SMTP id o1mr1113527qtl.322.1592427894841; Wed, 17 Jun 2020 14:04:54 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:54 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 69/73] cpu: rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle Date: Wed, 17 Jun 2020 17:02:27 -0400 Message-Id: <20200617210231.4393-70-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This function is only called from TCG rr mode, so add a prefix to mark this as well as an assertion. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index e070bffbff..2e9c19ae36 100644 --- a/cpus.c +++ b/cpus.c @@ -230,10 +230,12 @@ static bool cpu_thread_is_idle(CPUState *cpu) return true; } -static bool all_cpu_threads_idle(void) +static bool qemu_tcg_rr_all_cpu_threads_idle(void) { CPUState *cpu; + g_assert(qemu_is_tcg_rr()); + CPU_FOREACH(cpu) { if (!cpu_thread_is_idle(cpu)) { return false; @@ -642,7 +644,7 @@ void qemu_start_warp_timer(void) } if (replay_mode != REPLAY_MODE_PLAY) { - if (!all_cpu_threads_idle()) { + if (!qemu_tcg_rr_all_cpu_threads_idle()) { return; } @@ -1320,7 +1322,7 @@ static void qemu_tcg_rr_wait_io_event(void) { CPUState *cpu; - while (all_cpu_threads_idle()) { + while (qemu_tcg_rr_all_cpu_threads_idle()) { stop_tcg_kick_timer(); qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); } @@ -1676,7 +1678,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) atomic_mb_set(&cpu->exit_request, 0); } - if (use_icount && all_cpu_threads_idle()) { + if (use_icount && qemu_tcg_rr_all_cpu_threads_idle()) { /* * When all cpus are sleeping (e.g in WFI), to avoid a deadlock * in the main_loop, wake it up in order to start the warp timer. From patchwork Wed Jun 17 21:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 796A813B1 for ; Wed, 17 Jun 2020 21:57:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE81621841 for ; Wed, 17 Jun 2020 21:57:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Q7iL6Pzi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE81621841 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlg3X-0002mR-RU for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfF1-0004nA-Nw for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:04 -0400 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:42240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEw-0000QR-UP for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:03 -0400 Received: by mail-qk1-x729.google.com with SMTP id l17so3474983qki.9 for ; Wed, 17 Jun 2020 14:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=somM3qjZe4+by7maEgxb8iMXH+nc+Oo/EsRQ641wFQQ=; b=Q7iL6PziRJHNj5UdpvXQaBPkofmTiZO+q+U6VHpTWjdhCZe74NLRKmipvbU8qifmr4 iPE/aT98AutiUsVlBKOwe+JKOBt9oYn2skWIKONTpDm0GGp1txaBtqV/xsDvzpLpeSoE Vlm59gZR9RPWls3L0gEPUI72V3jwMpBVy0YoFdylK5zT6GZpPaqIwTYPiCtZ4muPom3I nxdX//UPyGjZX1myffWKbjRAyId5GpLSGyAEr+/AbRIVH8sTfTp5vEw12XvQ80CsVOs+ PnZWtcTQbh55CCpXQ3PfBsh3VLdCKLV5JXKFOdNQuvaqucHTkNqNlH++UP1fqnrnQZFd IltA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=somM3qjZe4+by7maEgxb8iMXH+nc+Oo/EsRQ641wFQQ=; b=ot3w8xSfvaecBCf+j4ihDUv1EtZy9yOsCYqWME5nXnRL2hP2P3zzKPC2CElPLGPrV6 S6cxUv05nbrpqchKqQf6B4xUrNRdVL3+Lj6cLSTuLS2gkS3WRZk5ulwL/8FTazNJPcIy G5C5TVhrGsGTLpe2kMRKEO8lnP/sfcILbDDbEZgs/yHjOJl/o8r9XLoS2fwMgdtVuzLc 9jWjXgn/lIe0Zidkl8SWitztq8UMmMpnd/OEprQPPgCJUy54f6o2fqOPIQWL0Ms7p6uO xiE5zRww3Vo8cxTf6ugnmCzFv1bN1Xxu13eZ4dTsAJCbDvvPtED1Vgdg0T6SJT3sgjRE XlTg== X-Gm-Message-State: AOAM533i3shK5CdeNNtwwgyM/850SMBjv5kTt7i9xlil/Ua+SINfL/bx 6QpNcm4tYNOD2DUIWlwxmlsZuEkjYfVvKQ== X-Google-Smtp-Source: ABdhPJzD4oCCaLWwRLsH4JQNq4gb3BYvkDCYq+taJsHaFWT2lojwAlHa3kYZOzLvu7WoJiMsdj8sIA== X-Received: by 2002:a05:620a:14b8:: with SMTP id x24mr536947qkj.284.1592427896538; Wed, 17 Jun 2020 14:04:56 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:55 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 70/73] cpu: protect CPU state with cpu->lock instead of the BQL Date: Wed, 17 Jun 2020 17:02:28 -0400 Message-Id: <20200617210231.4393-71-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x729.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Use the per-CPU locks to protect the CPUs' state, instead of using the BQL. These locks are uncontended (they are mostly acquired by the corresponding vCPU thread), so acquiring them is cheaper than acquiring the BQL, which particularly in MTTCG can be contended at high core counts. In this conversion we drop qemu_cpu_cond and qemu_pause_cond, and use cpu->cond instead. In qom/cpu.c we can finally remove the ugliness that results from having to hold both the BQL and the CPU lock; now we just have to grab the CPU lock. Removed g_assert(qemu_mutex_iothread_locked()) from qemu_tcg_rr_all_cpu_threads_idle(). There is an existing case where we call qemu_tcg_rr_all_cpu_threads_idle() without the BQL held. Also changed qemu_cond_wait() to qemu_cond_timed_wait() in qemu_tcg_rr_cpu_thread_fn() to fix issue where we might miss the broadcast wakeup. Also changed to obtain cpu lock in qemu_cpu_kick() prior to broadcast to avoid missing notification. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota [RF: Adjusted assert, added timed_wait, obtain cpu lock] Signed-off-by: Robert Foley --- cpus.c | 307 ++++++++++++++++++++++++++++++++---------- hw/core/cpu.c | 29 +--- include/hw/core/cpu.h | 20 +-- 3 files changed, 248 insertions(+), 108 deletions(-) diff --git a/cpus.c b/cpus.c index 2e9c19ae36..4a1056aab0 100644 --- a/cpus.c +++ b/cpus.c @@ -200,24 +200,30 @@ void cpu_mutex_destroy(CPUState *cpu) } } -bool cpu_is_stopped(CPUState *cpu) +/* Called with the CPU's lock held */ +static bool cpu_is_stopped_locked(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); } -static inline bool cpu_work_list_empty(CPUState *cpu) +bool cpu_is_stopped(CPUState *cpu) { - bool ret; + if (!cpu_mutex_locked(cpu)) { + bool ret; - cpu_mutex_lock(cpu); - ret = QSIMPLEQ_EMPTY(&cpu->work_list); - cpu_mutex_unlock(cpu); - return ret; + cpu_mutex_lock(cpu); + ret = cpu_is_stopped_locked(cpu); + cpu_mutex_unlock(cpu); + return ret; + } + return cpu_is_stopped_locked(cpu); } static bool cpu_thread_is_idle(CPUState *cpu) { - if (cpu->stop || !cpu_work_list_empty(cpu)) { + g_assert(cpu_mutex_locked(cpu)); + + if (cpu->stop || !QSIMPLEQ_EMPTY(&cpu->work_list)) { return false; } if (cpu_is_stopped(cpu)) { @@ -235,9 +241,16 @@ static bool qemu_tcg_rr_all_cpu_threads_idle(void) CPUState *cpu; g_assert(qemu_is_tcg_rr()); + g_assert(no_cpu_mutex_locked()); CPU_FOREACH(cpu) { - if (!cpu_thread_is_idle(cpu)) { + bool is_idle; + + cpu_mutex_lock(cpu); + is_idle = cpu_thread_is_idle(cpu); + cpu_mutex_unlock(cpu); + + if (!is_idle) { return false; } } @@ -731,6 +744,8 @@ void qemu_start_warp_timer(void) static void qemu_account_warp_timer(void) { + g_assert(qemu_mutex_iothread_locked()); + if (!use_icount || !icount_sleep) { return; } @@ -865,8 +880,15 @@ static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque) endtime_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + sleeptime_ns; while (sleeptime_ns > 0 && !cpu->stop) { if (sleeptime_ns > SCALE_MS) { - qemu_cond_timedwait(cpu->halt_cond, &qemu_global_mutex, - sleeptime_ns / SCALE_MS); + if (!cpu_mutex_locked(cpu)) { + cpu_mutex_lock(cpu); + qemu_cond_timedwait(cpu->halt_cond, cpu->lock, + sleeptime_ns / SCALE_MS); + cpu_mutex_unlock(cpu); + } else { + qemu_cond_timedwait(cpu->halt_cond, cpu->lock, + sleeptime_ns / SCALE_MS); + } } else { qemu_mutex_unlock_iothread(); g_usleep(sleeptime_ns / SCALE_US); @@ -1086,6 +1108,7 @@ static void kick_tcg_thread(void *opaque) static void start_tcg_kick_timer(void) { assert(!mttcg_enabled); + g_assert(qemu_mutex_iothread_locked()); if (!tcg_kick_vcpu_timer && CPU_NEXT(first_cpu)) { tcg_kick_vcpu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, kick_tcg_thread, NULL); @@ -1098,6 +1121,7 @@ static void start_tcg_kick_timer(void) static void stop_tcg_kick_timer(void) { assert(!mttcg_enabled); + g_assert(qemu_mutex_iothread_locked()); if (tcg_kick_vcpu_timer && timer_pending(tcg_kick_vcpu_timer)) { timer_del(tcg_kick_vcpu_timer); } @@ -1199,6 +1223,8 @@ int vm_shutdown(void) static bool cpu_can_run(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + if (cpu->stop) { return false; } @@ -1271,16 +1297,9 @@ static void qemu_init_sigbus(void) static QemuThread io_thread; -/* cpu creation */ -static QemuCond qemu_cpu_cond; -/* system init */ -static QemuCond qemu_pause_cond; - void qemu_init_cpu_loop(void) { qemu_init_sigbus(); - qemu_cond_init(&qemu_cpu_cond); - qemu_cond_init(&qemu_pause_cond); qemu_mutex_init(&qemu_global_mutex); qemu_thread_get_self(&io_thread); @@ -1298,39 +1317,60 @@ static void qemu_tcg_destroy_vcpu(CPUState *cpu) { } -static void qemu_cpu_stop(CPUState *cpu, bool exit) +static void qemu_cpu_stop_locked(CPUState *cpu, bool exit) { + g_assert(cpu_mutex_locked(cpu)); g_assert(qemu_cpu_is_self(cpu)); cpu->stop = false; cpu->stopped = true; if (exit) { cpu_exit(cpu); } - qemu_cond_broadcast(&qemu_pause_cond); + qemu_cond_broadcast(&cpu->cond); +} + +static void qemu_cpu_stop(CPUState *cpu, bool exit) +{ + cpu_mutex_lock(cpu); + qemu_cpu_stop_locked(cpu, exit); + cpu_mutex_unlock(cpu); } static void qemu_wait_io_event_common(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + atomic_mb_set(&cpu->thread_kicked, false); if (cpu->stop) { - qemu_cpu_stop(cpu, false); + qemu_cpu_stop_locked(cpu, false); } + /* + * unlock+lock cpu_mutex, so that other vCPUs have a chance to grab the + * lock and queue some work for this vCPU. + */ + cpu_mutex_unlock(cpu); process_queued_cpu_work(cpu); + cpu_mutex_lock(cpu); } static void qemu_tcg_rr_wait_io_event(void) { CPUState *cpu; + g_assert(qemu_mutex_iothread_locked()); + g_assert(no_cpu_mutex_locked()); + while (qemu_tcg_rr_all_cpu_threads_idle()) { stop_tcg_kick_timer(); - qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(first_cpu->halt_cond, first_cpu->lock); } start_tcg_kick_timer(); CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); qemu_wait_io_event_common(cpu); + cpu_mutex_unlock(cpu); } } @@ -1338,12 +1378,15 @@ static void qemu_wait_io_event(CPUState *cpu) { bool slept = false; + g_assert(cpu_mutex_locked(cpu)); + g_assert(!qemu_mutex_iothread_locked()); + while (cpu_thread_is_idle(cpu)) { if (!slept) { slept = true; qemu_plugin_vcpu_idle_cb(cpu); } - qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(cpu->halt_cond, cpu->lock); } if (slept) { qemu_plugin_vcpu_resume_cb(cpu); @@ -1366,6 +1409,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) rcu_register_thread(); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; @@ -1378,15 +1422,21 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) } kvm_init_cpu_signals(cpu); + qemu_mutex_unlock_iothread(); /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = kvm_cpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1394,10 +1444,16 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) qemu_wait_io_event(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); qemu_kvm_destroy_vcpu(cpu); - cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); + cpu->created = false; + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); + rcu_unregister_thread(); return NULL; } @@ -1414,7 +1470,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) rcu_register_thread(); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; @@ -1425,11 +1481,11 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); do { int sig; r = sigwait(&waitset, &sig); @@ -1438,11 +1494,11 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) perror("sigwait"); exit(1); } - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_wait_io_event(cpu); } while (!cpu->unplug); - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); rcu_unregister_thread(); return NULL; #endif @@ -1482,6 +1538,8 @@ static int64_t tcg_get_icount_limit(void) static void handle_icount_deadline(void) { assert(qemu_in_vcpu_thread()); + g_assert(qemu_mutex_iothread_locked()); + if (use_icount) { int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, QEMU_TIMER_ATTR_ALL); @@ -1562,12 +1620,15 @@ static void deal_with_unplugged_cpus(void) CPUState *cpu; CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); if (cpu->unplug && !cpu_can_run(cpu)) { qemu_tcg_destroy_vcpu(cpu); cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); break; } + cpu_mutex_unlock(cpu); } } @@ -1588,25 +1649,45 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) rcu_register_thread(); tcg_register_thread(); + /* + * We call cpu_mutex_lock/unlock just to please the assertions in common + * code, since here cpu->lock is an alias to the BQL. + */ qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); - cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); qemu_guest_random_seed_thread_part2(cpu->random_seed); /* wait for initial kick-off after machine start */ + cpu_mutex_lock(first_cpu); while (first_cpu->stopped) { - qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); + /* + * a timedwait is needed since this gets kicked off + * by a cond_broadcast, and it is possible + * to not be woken up by the broadcast if we are + * not waiting when the broadcast is sent. + */ + qemu_cond_timedwait(first_cpu->halt_cond, + first_cpu->lock, + 100); + cpu_mutex_unlock(first_cpu); /* process any pending work */ CPU_FOREACH(cpu) { current_cpu = cpu; + cpu_mutex_lock(cpu); qemu_wait_io_event_common(cpu); + cpu_mutex_unlock(cpu); } + + cpu_mutex_lock(first_cpu); } + cpu_mutex_unlock(first_cpu); start_tcg_kick_timer(); @@ -1633,7 +1714,12 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) cpu = first_cpu; } - while (cpu && cpu_work_list_empty(cpu) && !cpu->exit_request) { + while (cpu) { + cpu_mutex_lock(cpu); + if (!QSIMPLEQ_EMPTY(&cpu->work_list) || cpu->exit_request) { + cpu_mutex_unlock(cpu); + break; + } atomic_mb_set(&tcg_current_rr_cpu, cpu); current_cpu = cpu; @@ -1644,6 +1730,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) if (cpu_can_run(cpu)) { int r; + cpu_mutex_unlock(cpu); qemu_mutex_unlock_iothread(); prepare_icount_for_run(cpu); @@ -1651,11 +1738,14 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) process_icount_data(cpu); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); + cpu_mutex_unlock(cpu); break; } else if (r == EXCP_ATOMIC) { + cpu_mutex_unlock(cpu); qemu_mutex_unlock_iothread(); cpu_exec_step_atomic(cpu); qemu_mutex_lock_iothread(); @@ -1665,11 +1755,15 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) if (cpu->unplug) { cpu = CPU_NEXT(cpu); } + cpu_mutex_unlock(current_cpu); break; } + cpu_mutex_unlock(cpu); cpu = CPU_NEXT(cpu); - } /* while (cpu && !cpu->exit_request).. */ + } /* for (;;) .. */ + + g_assert(no_cpu_mutex_locked()); /* Does not need atomic_mb_set because a spurious wakeup is okay. */ atomic_set(&tcg_current_rr_cpu, NULL); @@ -1701,6 +1795,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) rcu_register_thread(); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); @@ -1708,12 +1803,18 @@ static void *qemu_hax_cpu_thread_fn(void *arg) current_cpu = cpu; hax_init_vcpu(cpu); - qemu_cond_signal(&qemu_cpu_cond); + qemu_mutex_unlock_iothread(); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = hax_smp_cpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1721,6 +1822,8 @@ static void *qemu_hax_cpu_thread_fn(void *arg) qemu_wait_io_event(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); + + cpu_mutex_unlock(cpu); rcu_unregister_thread(); return NULL; } @@ -1738,6 +1841,7 @@ static void *qemu_hvf_cpu_thread_fn(void *arg) rcu_register_thread(); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); @@ -1745,15 +1849,21 @@ static void *qemu_hvf_cpu_thread_fn(void *arg) current_cpu = cpu; hvf_init_vcpu(cpu); + qemu_mutex_unlock_iothread(); /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = hvf_vcpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1761,10 +1871,16 @@ static void *qemu_hvf_cpu_thread_fn(void *arg) qemu_wait_io_event(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); hvf_vcpu_destroy(cpu); - cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); + cpu->created = false; + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); + rcu_unregister_thread(); return NULL; } @@ -1777,6 +1893,7 @@ static void *qemu_whpx_cpu_thread_fn(void *arg) rcu_register_thread(); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); current_cpu = cpu; @@ -1786,29 +1903,41 @@ static void *qemu_whpx_cpu_thread_fn(void *arg) fprintf(stderr, "whpx_init_vcpu failed: %s\n", strerror(-r)); exit(1); } + qemu_mutex_unlock_iothread(); /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = whpx_vcpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } } while (cpu_thread_is_idle(cpu)) { - qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(cpu->halt_cond, cpu->lock); } qemu_wait_io_event_common(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); whpx_destroy_vcpu(cpu); - cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); + cpu->created = false; + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); + rcu_unregister_thread(); return NULL; } @@ -1836,14 +1965,14 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) rcu_register_thread(); tcg_register_thread(); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; current_cpu = cpu; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); /* process any pending work */ @@ -1852,9 +1981,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) do { if (cpu_can_run(cpu)) { int r; - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); r = tcg_cpu_exec(cpu); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); switch (r) { case EXCP_DEBUG: cpu_handle_guest_debug(cpu); @@ -1870,9 +1999,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) g_assert(cpu_halted(cpu)); break; case EXCP_ATOMIC: - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); cpu_exec_step_atomic(cpu); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); default: /* Ignore everything else? */ break; @@ -1885,8 +2014,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) qemu_tcg_destroy_vcpu(cpu); cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); - qemu_mutex_unlock_iothread(); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); rcu_unregister_thread(); return NULL; } @@ -1920,7 +2049,13 @@ static void qemu_cpu_kick_thread(CPUState *cpu) void qemu_cpu_kick(CPUState *cpu) { - qemu_cond_broadcast(cpu->halt_cond); + if (!cpu_mutex_locked(cpu)) { + cpu_mutex_lock(cpu); + qemu_cond_broadcast(cpu->halt_cond); + cpu_mutex_unlock(cpu); + } else { + qemu_cond_broadcast(cpu->halt_cond); + } if (tcg_enabled()) { if (qemu_tcg_mttcg_enabled()) { cpu_exit(cpu); @@ -1993,54 +2128,69 @@ void qemu_cond_wait_iothread(QemuCond *cond) qemu_cond_wait(cond, &qemu_global_mutex); } -static bool all_vcpus_paused(void) -{ - CPUState *cpu; - - CPU_FOREACH(cpu) { - if (!cpu->stopped) { - return false; - } - } - - return true; -} - void pause_all_vcpus(void) { CPUState *cpu; + g_assert(no_cpu_mutex_locked()); + qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false); CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); if (qemu_cpu_is_self(cpu)) { qemu_cpu_stop(cpu, true); } else { cpu->stop = true; qemu_cpu_kick(cpu); } + cpu_mutex_unlock(cpu); } + drop_locks_and_stop_all_vcpus: /* We need to drop the replay_lock so any vCPU threads woken up * can finish their replay tasks */ replay_mutex_unlock(); + qemu_mutex_unlock_iothread(); - while (!all_vcpus_paused()) { - qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex); - CPU_FOREACH(cpu) { + CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); + if (!cpu->stopped) { + cpu->stop = true; qemu_cpu_kick(cpu); + qemu_cond_wait(&cpu->cond, cpu->lock); } + cpu_mutex_unlock(cpu); } - qemu_mutex_unlock_iothread(); replay_mutex_lock(); qemu_mutex_lock_iothread(); + + /* a CPU might have been hot-plugged while we weren't holding the BQL */ + CPU_FOREACH(cpu) { + bool stopped; + + cpu_mutex_lock(cpu); + stopped = cpu->stopped; + cpu_mutex_unlock(cpu); + + if (!stopped) { + goto drop_locks_and_stop_all_vcpus; + } + } } void cpu_resume(CPUState *cpu) { - cpu->stop = false; - cpu->stopped = false; + if (cpu_mutex_locked(cpu)) { + cpu->stop = false; + cpu->stopped = false; + } else { + cpu_mutex_lock(cpu); + cpu->stop = false; + cpu->stopped = false; + cpu_mutex_unlock(cpu); + } qemu_cpu_kick(cpu); } @@ -2060,8 +2210,11 @@ void resume_all_vcpus(void) void cpu_remove_sync(CPUState *cpu) { + cpu_mutex_lock(cpu); cpu->stop = true; cpu->unplug = true; + cpu_mutex_unlock(cpu); + qemu_cpu_kick(cpu); qemu_mutex_unlock_iothread(); qemu_thread_join(cpu->thread); @@ -2245,9 +2398,15 @@ void qemu_init_vcpu(CPUState *cpu) qemu_dummy_start_vcpu(cpu); } + qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); while (!cpu->created) { - qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); + qemu_cond_wait(&cpu->cond, cpu->lock); } + cpu_mutex_unlock(cpu); + + qemu_mutex_lock_iothread(); } void cpu_stop_current(void) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 59f02594a3..194734f16a 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -95,32 +95,13 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, error_setg(errp, "Obtaining memory mappings is unsupported on this CPU."); } -/* Resetting the IRQ comes from across the code base so we take the - * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool has_bql = qemu_mutex_iothread_locked(); - bool has_cpu_lock = cpu_mutex_locked(cpu); - - if (has_bql) { - if (has_cpu_lock) { - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - } else { - cpu_mutex_lock(cpu); - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - cpu_mutex_unlock(cpu); - } - return; - } - - if (has_cpu_lock) { - cpu_mutex_unlock(cpu); - } - qemu_mutex_lock_iothread(); - cpu_mutex_lock(cpu); - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - qemu_mutex_unlock_iothread(); - if (!has_cpu_lock) { + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + } else { + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); cpu_mutex_unlock(cpu); } } diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 720bc85a84..d5e4c339e1 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -312,10 +312,6 @@ struct qemu_work_item; * valid under cpu_list_lock. * @created: Indicates whether the CPU thread has been successfully created. * @interrupt_request: Indicates a pending interrupt request. - * @halted: Nonzero if the CPU is in suspended state. - * @stop: Indicates a pending stop request. - * @stopped: Indicates the CPU has been artificially stopped. - * @unplug: Indicates a pending CPU unplug request. * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU * @singlestep_enabled: Flags for single-stepping. * @icount_extra: Instructions until next timer event. @@ -340,6 +336,10 @@ struct qemu_work_item; * after the BQL. * @cond: Condition variable for per-CPU events. * @work_list: List of pending asynchronous work. + * @halted: Nonzero if the CPU is in suspended state. + * @stop: Indicates a pending stop request. + * @stopped: Indicates the CPU has been artificially stopped. + * @unplug: Indicates a pending CPU unplug request. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask). @@ -364,12 +364,7 @@ struct CPUState { #endif int thread_id; bool running, has_waiter; - struct QemuCond *halt_cond; bool thread_kicked; - bool created; - bool stop; - bool stopped; - bool unplug; bool crash_occurred; bool exit_request; bool in_exclusive_context; @@ -385,7 +380,13 @@ struct CPUState { QemuMutex *lock; /* fields below protected by @lock */ QemuCond cond; + QemuCond *halt_cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; + uint32_t halted; + bool created; + bool stop; + bool stopped; + bool unplug; CPUAddressSpace *cpu_ases; int num_ases; @@ -431,7 +432,6 @@ struct CPUState { /* TODO Move common fields from CPUArchState here. */ int cpu_index; int cluster_index; - uint32_t halted; uint32_t can_do_io; int32_t exception_index; From patchwork Wed Jun 17 21:02:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA71590 for ; Wed, 17 Jun 2020 21:54:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1EB42168B for ; Wed, 17 Jun 2020 21:54:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bO9MuSq1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1EB42168B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlg1I-0007J3-U0 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:54:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfF1-0004mC-BO for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:03 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:34526) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEx-0000Qd-99 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:01 -0400 Received: by mail-qk1-x743.google.com with SMTP id f18so3525502qkh.1 for ; Wed, 17 Jun 2020 14:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kEALw3cb/snp1kLPThKHADdrwsKNjGM+CsHVn0z1BOY=; b=bO9MuSq1OMXIKKUrkq0Ed1xUAKaGJHYI3TUP8sVHeVVlXy8kYH34c8iZgMJ7FGnlqe LtFgPKywurlzQsVGxJ+n385Gxywl8qMKrJusr9swyNSfM3ix8tHpJMafEU+pLWKQI6iH sVjHNyiQd+vTndm/NIBFjdGdApsInLbwWq+1lIdmXpRff6HaHI5VmnqhejNxGBQNCpI3 GNpwgL8Zt05GSWMz2KJLeu9VCQbJ9U826hXuqgwsQM9KtnHQrZtRU5FCUohfbxYRBzC1 PNdle87wdF5h7jtxISc2tomBatJOEAFx1/oThnriGf/ZERfyrgcuLg8ymi0XmJw604ib irjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kEALw3cb/snp1kLPThKHADdrwsKNjGM+CsHVn0z1BOY=; b=OeTJPSthp0iRxitLyTqHbD5M/iqIBSnoczQpJizvzhgr29lwQHwbcN61hg+XOLkzXU 9jhvshn0mZC/Y7LMO9VyqWR5v31LbDTIkteyjGPGX0/t0c3WB8kYuA/zfXvE7XcrDfJO BiiwCwRd7GgXiW2fYL8sRb51aM8iGkmhHNl2bcd2I7GBAxGoguzzFk5MyWAbC9pxaVF/ d7S8FR1p6gGzkVZ73glcDiW6e68M/w36p7cPzhdsXaN4HtnnJTPWrvGrQPRx0rBOLjfK bo4MSiodYnkyg5a05ysSPgXWE/NzQi5afTHTrVnTstmoY8EnWOElrGANGPr9h/3eD3kF HTIw== X-Gm-Message-State: AOAM531B26OfLKMZWk+WZ7Abg75wgkFjTQQ+IhzUT5iZWoKeXkkJgBjP uBUki7tdWDM8WLvu968Y0sgIGQ/rPhX3xw== X-Google-Smtp-Source: ABdhPJyzFaP57/N9Q4K0gShHJH+xWEY+/KTNguIWfv27cMjyiMhByKkqR1X3YNWLKaDskUXg6ijGRA== X-Received: by 2002:a37:d246:: with SMTP id f67mr578006qkj.300.1592427897910; Wed, 17 Jun 2020 14:04:57 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:57 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 71/73] cpus-common: release BQL earlier in run_on_cpu Date: Wed, 17 Jun 2020 17:02:29 -0400 Message-Id: <20200617210231.4393-72-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 0287018dc4..eecd63029a 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -135,6 +135,11 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) return; } + /* We are going to sleep on the CPU lock, so release the BQL */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + wi.func = func; wi.data = data; wi.done = false; @@ -143,21 +148,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); - - /* - * We are going to sleep on the CPU lock, so release the BQL. - * - * During the transition to per-CPU locks, we release the BQL _after_ - * having kicked the destination CPU (from queue_work_on_cpu_locked above). - * This makes sure that the enqueued work will be seen by the CPU - * after being woken up from the kick, since the CPU sleeps on the BQL. - * Once we complete the transition to per-CPU locks, we will release - * the BQL earlier in this function. - */ - if (has_bql) { - qemu_mutex_unlock_iothread(); - } - while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; From patchwork Wed Jun 17 21:02:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610697 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA6DC1392 for ; Wed, 17 Jun 2020 21:34:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C02C92186A for ; Wed, 17 Jun 2020 21:34:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l9e2iGt6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C02C92186A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfhv-0004Dl-Vb for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:34:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfF2-0004ns-Rv for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:05 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:42314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEz-0000Qm-JY for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:04 -0400 Received: by mail-qv1-xf41.google.com with SMTP id p15so1751615qvr.9 for ; Wed, 17 Jun 2020 14:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mMSK5jG93ccRv0iEW+yiTm1N/o9bSTPpnWnCySDcIBA=; b=l9e2iGt6X9bkA7GiikT3IzyDF6HuI1DQNYrztcTjfl8hAnrUokmdoS8PMcQrkKIeGi i2IydSAEhYYwj/gw+8kng65TMrgpptccie9kfRrkNpJoJJsIAG7Brc5J43IvQcqv+4wc sTvV2gKAKN1ujjKiyRmaPZqFuOdUqTPMQFFBsqh93Ep91TrKKvZWkPDfrUr3oIq5Ae7H ynlk5QG4s4RGMZZpg3fWGGqcMbCY2qRWXVuo0k2m7RHRvapYoFTSMkC1R0z2ve9YiNr+ XQyrCXHy6LBJL6EuDBEeTybBZiaVUPCoMjIXrDvdE+vj4lERk1t1xyT2duLOklQ4oCt5 KAzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mMSK5jG93ccRv0iEW+yiTm1N/o9bSTPpnWnCySDcIBA=; b=YpLrGFpnacXPWzgGq5gZUQTYNW+XEriamxf22/N8xzd5T5x/VdCVg34rER9aZwAEK9 vQuHnhUeKn8enesw9VIt5daMlEY9NHjVJw/QIsWNSQ+CtlDWcsPmSCg+0RiPcDFyy8fN v9y5yGV1DaTRD5WYdcgvl66F/wbhAmScJwJ0d0sWlXn2MkRLZmHIqhGWUBCVQ5fR9iaQ +lBNRM9J797RYmjEskNvch2CiVQS5FGRaAlosUNZGzN1MHJH0uV4hL8+cr9QGqH4TVFl LNtbVIsBKFmpbNVPE+81m2VBZqUIe0ZDEnf+93vTIxF/QrGGTiaoKVhj7kjcoZiXJ0Ck Lgyw== X-Gm-Message-State: AOAM532brwhKB05+o+zcP+hFdKUOASXiyrix5fVMnxW4eIL3vVXLnSrg Kl3tdjmSDt3f92MCG0bFF3J2Hei/Dqk8rA== X-Google-Smtp-Source: ABdhPJxTQJNn6gVu0kYsPjcH5hefyPmvER9VyoPxwhgIlAjoVhLUNN6NskyInwv3AeCf0UwKDrbVhw== X-Received: by 2002:a0c:9ba0:: with SMTP id o32mr553544qve.129.1592427899987; Wed, 17 Jun 2020 14:04:59 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:58 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 72/73] cpu: add async_run_on_cpu_no_bql Date: Wed, 17 Jun 2020 17:02:30 -0400 Message-Id: <20200617210231.4393-73-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Eduardo Habkost , cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Some async jobs do not need the BQL. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 39 ++++++++++++++++++++++++++++++++++----- include/hw/core/cpu.h | 14 ++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index eecd63029a..923371a997 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -99,6 +99,7 @@ struct qemu_work_item { run_on_cpu_func func; run_on_cpu_data data; bool free, exclusive, done; + bool bql; }; /* Called with the CPU's lock held */ @@ -145,6 +146,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi.done = false; wi.free = false; wi.exclusive = false; + wi.bql = true; cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); @@ -169,6 +171,21 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi->func = func; wi->data = data; wi->free = true; + wi->bql = true; + + queue_work_on_cpu(cpu, wi); +} + +void async_run_on_cpu_no_bql(CPUState *cpu, run_on_cpu_func func, + run_on_cpu_data data) +{ + struct qemu_work_item *wi; + + wi = g_malloc0(sizeof(struct qemu_work_item)); + wi->func = func; + wi->data = data; + wi->free = true; + /* wi->bql initialized to false */ queue_work_on_cpu(cpu, wi); } @@ -315,6 +332,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, wi->data = data; wi->free = true; wi->exclusive = true; + /* wi->bql initialized to false */ queue_work_on_cpu(cpu, wi); } @@ -339,6 +357,7 @@ static void process_queued_cpu_work_locked(CPUState *cpu) * BQL, so it goes to sleep; start_exclusive() is sleeping too, so * neither CPU can proceed. */ + g_assert(!wi->bql); if (has_bql) { qemu_mutex_unlock_iothread(); } @@ -349,12 +368,22 @@ static void process_queued_cpu_work_locked(CPUState *cpu) qemu_mutex_lock_iothread(); } } else { - if (has_bql) { - wi->func(cpu, wi->data); + if (wi->bql) { + if (has_bql) { + wi->func(cpu, wi->data); + } else { + qemu_mutex_lock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_unlock_iothread(); + } } else { - qemu_mutex_lock_iothread(); - wi->func(cpu, wi->data); - qemu_mutex_unlock_iothread(); + if (has_bql) { + qemu_mutex_unlock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_lock_iothread(); + } else { + wi->func(cpu, wi->data); + } } } cpu_mutex_lock(cpu); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d5e4c339e1..e37f64b57a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -894,9 +894,23 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); * @data: Data to pass to the function. * * Schedules the function @func for execution on the vCPU @cpu asynchronously. + * See also: async_run_on_cpu_no_bql() */ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); +/** + * async_run_on_cpu_no_bql: + * @cpu: The vCPU to run on. + * @func: The function to be executed. + * @data: Data to pass to the function. + * + * Schedules the function @func for execution on the vCPU @cpu asynchronously. + * This function is run outside the BQL. + * See also: async_run_on_cpu() + */ +void async_run_on_cpu_no_bql(CPUState *cpu, run_on_cpu_func func, + run_on_cpu_data data); + /** * async_safe_run_on_cpu: * @cpu: The vCPU to run on. From patchwork Wed Jun 17 21:02:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11610705 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB97613B1 for ; Wed, 17 Jun 2020 21:37:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C21CA2088E for ; Wed, 17 Jun 2020 21:37:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Gc6M8yD2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C21CA2088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlfkS-00007W-0Z for patchwork-qemu-devel@patchwork.kernel.org; Wed, 17 Jun 2020 17:37:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfF4-0004p6-V4 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:06 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:43949) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfF1-0000R9-8H for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:05 -0400 Received: by mail-qk1-x742.google.com with SMTP id j68so142460qkb.10 for ; Wed, 17 Jun 2020 14:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=47Bm+ilUjsoqQoc0Msg5H7tt6ZAFbVXOlvVANVjxWdA=; b=Gc6M8yD2PJf+m4eJQn/d9k5M5bF7YfbYtb14NoW536wuiAoo+dXW3ZBDn1/7DaX/xD wWSNbu0aiTUfBQXtFSKfy/s0o3LbEYwSMRKh91MReJaPxx4HpdIX1bDoeCrQY64WHaqX AV1PRhuchKh+lf8Gkqwj8TArkBvxOnMF0v3QF9234LlToVzhm6B39EmAzyniQhWg1yDO PzoHtpmJskKHhKADgbh7tcPg4o+wO8S08xySwvTSOPkj6bbxveDDJiqEeXVPhVmioGj+ wlM6JIN+dPBop+VXHI8V/uid2htTKct6d7aMW7iJwI0zzFSXtJ8slA6YOtrOc6CqoaUh iBJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=47Bm+ilUjsoqQoc0Msg5H7tt6ZAFbVXOlvVANVjxWdA=; b=PnmEglxs0panLFS277ix4vG1RsKNEVS9kekmHdySBvwmzkgmmiZ7wfn+PlseiHf6en o7AdCPu0IShisWDF7MMiYVwxN3in3/nm/YFs3b/8JIsbs0P8SD9lw9vN5x6i6o7kZwCl 0Mx9NpqmEYYtuhGObAw8NAXDdjXOlAffjzhkmltBJGqVGOd9AIaCcThf0cMNlbI8goAa fTwtfJ3+PnPn30vIMbTPO1rfCKL0kneM6gYTV1kISyirTL2njJmhFxXoqdMPx/Xiq4Cv t8o10YOt61ZpbDAIKIZV7hrEDbhrPtI6bk9ruRtB9C0zl78hVjN8dN5ghgN0Dlnt/Ppi ZTLA== X-Gm-Message-State: AOAM531+PEDtHEIrMjZczQeNZ557bkAlDC7SFF38cvbjkq8S644dZk7x hElCM256VUlAgKOOfkctZ6RwpNlmMeqZpw== X-Google-Smtp-Source: ABdhPJzXnIjcO/f0aD77Htf4KnucFW8nSv7G9/x9WMjQqmt2CCNHQoUrDa/BcrvOEEPsqONI9zmDJg== X-Received: by 2002:a37:4ed2:: with SMTP id c201mr609785qkb.138.1592427901325; Wed, 17 Jun 2020 14:05:01 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:05:00 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 73/73] cputlb: queue async flush jobs without the BQL Date: Wed, 17 Jun 2020 17:02:31 -0400 Message-Id: <20200617210231.4393-74-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This yields sizable scalability improvements, as the below results show. Host: Two Intel Xeon Silver 4114 20-core CPUs at 2.20 GHz VM: Ubuntu 18.04 ppc64 Speedup vs a single thread for kernel build                                                                                                     7 +-----------------------------------------------------------------------+       |         +          +         +         +         +          +         |       |                                    ###########       baseline ******* |       |                               #####           ####   cpu lock ####### |       |                             ##                    ####                |     6 |-+                         ##                          ##            +-|       |                         ##                              ####          |       |                       ##                                    ###       |       |                     ##        *****                            #      |       |                   ##      ****     ***                          #     |       |                 ##     ***            *                               |     5 |-+             ##    ***                ****                         +-|       |              #  ****                       **                         |       |             # **                             **                       |       |             #*                                 **                     |       |          #*                                          **               |       |         #*                                             *              |       |         #                                               ******        |       |        #                                                      **      |       |       #                                                         *     |     3 |-+     #                                                             +-|       |      #                                                                |       |      #                                                                |       |     #                                                                 |       |     #                                                                 |     2 |-+  #                                                                +-|       |    #                                                                  |       |   #                                                                   |       |   #                                                                   |       |  #                                                                    |       |  #      +          +         +         +         +          +         |     1 +-----------------------------------------------------------------------+       0         5          10        15        20        25         30        35                                      Guest vCPUs   Pictures are also here: https://drive.google.com/file/d/1ASg5XyP9hNfN9VysXC3qe5s9QSJlwFAt/view?usp=sharing Some notes: - baseline corresponds to the commit before this series - cpu-lock is this series Single-threaded performance is affected very lightly. Results below for debian aarch64 bootup+test for the entire series on an Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz host: - Before: Performance counter stats for 'taskset -c 0 ../img/aarch64/die.sh' (10 runs): 7269.033478 task-clock (msec) # 0.998 CPUs utilized ( +- 0.06% ) 30,659,870,302 cycles # 4.218 GHz ( +- 0.06% ) 54,790,540,051 instructions # 1.79 insns per cycle ( +- 0.05% ) 9,796,441,380 branches # 1347.695 M/sec ( +- 0.05% ) 165,132,201 branch-misses # 1.69% of all branches ( +- 0.12% ) 7.287011656 seconds time elapsed ( +- 0.10% ) - After: 7375.924053 task-clock (msec) # 0.998 CPUs utilized ( +- 0.13% ) 31,107,548,846 cycles # 4.217 GHz ( +- 0.12% ) 55,355,668,947 instructions # 1.78 insns per cycle ( +- 0.05% ) 9,929,917,664 branches # 1346.261 M/sec ( +- 0.04% ) 166,547,442 branch-misses # 1.68% of all branches ( +- 0.09% ) 7.389068145 seconds time elapsed ( +- 0.13% ) That is, a 1.37% slowdown. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Tested-by: Alex Bennée Signed-off-by: Emilio G. Cota [Updated the speedup chart results for re-based series.] Signed-off-by: Robert Foley --- accel/tcg/cputlb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 1e815357c7..7f75054643 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -299,7 +299,7 @@ static void flush_all_helper(CPUState *src, run_on_cpu_func fn, CPU_FOREACH(cpu) { if (cpu != src) { - async_run_on_cpu(cpu, fn, d); + async_run_on_cpu_no_bql(cpu, fn, d); } } } @@ -367,8 +367,8 @@ void tlb_flush_by_mmuidx(CPUState *cpu, uint16_t idxmap) tlb_debug("mmu_idx: 0x%" PRIx16 "\n", idxmap); if (cpu->created && !qemu_cpu_is_self(cpu)) { - async_run_on_cpu(cpu, tlb_flush_by_mmuidx_async_work, - RUN_ON_CPU_HOST_INT(idxmap)); + async_run_on_cpu_no_bql(cpu, tlb_flush_by_mmuidx_async_work, + RUN_ON_CPU_HOST_INT(idxmap)); } else { tlb_flush_by_mmuidx_async_work(cpu, RUN_ON_CPU_HOST_INT(idxmap)); } @@ -562,7 +562,7 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, uint16_t idxmap) * we can stuff idxmap into the low TARGET_PAGE_BITS, avoid * allocating memory for this operation. */ - async_run_on_cpu(cpu, tlb_flush_page_by_mmuidx_async_1, + async_run_on_cpu_no_bql(cpu, tlb_flush_page_by_mmuidx_async_1, RUN_ON_CPU_TARGET_PTR(addr | idxmap)); } else { TLBFlushPageByMMUIdxData *d = g_new(TLBFlushPageByMMUIdxData, 1); @@ -570,7 +570,7 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, uint16_t idxmap) /* Otherwise allocate a structure, freed by the worker. */ d->addr = addr; d->idxmap = idxmap; - async_run_on_cpu(cpu, tlb_flush_page_by_mmuidx_async_2, + async_run_on_cpu_no_bql(cpu, tlb_flush_page_by_mmuidx_async_2, RUN_ON_CPU_HOST_PTR(d)); } }