From patchwork Thu Oct 25 14:45:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A48314BB for ; Thu, 25 Oct 2018 15:52:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 586AE2BE88 for ; Thu, 25 Oct 2018 15:52:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48DC82BE8D; Thu, 25 Oct 2018 15:52:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B6EA92BE88 for ; Thu, 25 Oct 2018 15:52:38 +0000 (UTC) Received: from localhost ([::1]:55304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhw5-0007ja-RS for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:52:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-0003ub-Vw for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguW-0007gA-Gj for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:58 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguV-0007TS-EV for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:55 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0E6A421C5C; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id; s=mesmtp; bh=Kl9/e94b4iz8+la PSJpRLm9JH295gK36UvzagV32Dew=; b=KPNe+utVmnR6O4dn3jc+xw4Os1d18yw Ai49ceFjog2CypPaxYUV5W7k4m4kwoh3LDKZksJltmN1V1TYY93mg0JQRye//XdE 1CGnPAbMl3wk0ElVcSCSN+aUA+ndvyGAPA86VbwwtFWCMtRMDtOymwLI4KdZaYDw PYNiW3HJiFyg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=Kl9/e94b4iz8+laPSJpRLm9JH295gK36UvzagV32Dew=; b=EfPlgU8P CdBJv6gMAHz5zdd89UcfhAb/If7hl4o0K8056FxQ2q7FVCMy0i1IUH5EPJRTHTZX QOOhykOmIGaJ7SmXNlfJk3viJ7oTyUW1H//3vz0v5pXbkneJCnC5HQMmApL7u10I aK2sjgBvh3gYrIf9NzXBQGTDrBFXwtNfbX8fqcS9GWXimYSo4EelpHd82VNNSLYz Q/fosEvWYROr05MYaopMlkbZJddZg7eIJQVKlE6Ea+ivI/Ijo0hruxQLfPHNQ/30 jemYakrR5lltrS8SDkUJhKMpacOZwzxySTfE00BUbc8oqj4VgQcmMts7U8XxKqZy Igldg8+CDh0gHg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4F17BE421C; Thu, 25 Oct 2018 10:46:45 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:34 -0400 Message-Id: <20181025144644.15464-1-cota@braap.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 01/71] cpu: convert queued work to a QSIMPLEQ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of open-coding it. While at it, make sure that all accesses to the list are performed while holding the list's lock. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- include/qom/cpu.h | 6 +++--- cpus-common.c | 25 ++++++++----------------- cpus.c | 14 ++++++++++++-- qom/cpu.c | 1 + 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index dc130cd307..53488b202f 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -315,8 +315,8 @@ struct qemu_work_item; * @mem_io_pc: Host Program Counter at which the memory was accessed. * @mem_io_vaddr: Target virtual address at which the memory was accessed. * @kvm_fd: vCPU file descriptor for KVM. - * @work_mutex: Lock to prevent multiple access to queued_work_*. - * @queued_work_first: First asynchronous work pending. + * @work_mutex: Lock to prevent multiple access to @work_list. + * @work_list: List of pending asynchronous work. * @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). @@ -357,7 +357,7 @@ struct CPUState { sigjmp_buf jmp_env; QemuMutex work_mutex; - struct qemu_work_item *queued_work_first, *queued_work_last; + QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; int num_ases; diff --git a/cpus-common.c b/cpus-common.c index 98dd8c6ff1..a2a6cd93a1 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -107,7 +107,7 @@ void cpu_list_remove(CPUState *cpu) } struct qemu_work_item { - struct qemu_work_item *next; + QSIMPLEQ_ENTRY(qemu_work_item) node; run_on_cpu_func func; run_on_cpu_data data; bool free, exclusive, done; @@ -116,13 +116,7 @@ struct qemu_work_item { static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) { qemu_mutex_lock(&cpu->work_mutex); - if (cpu->queued_work_first == NULL) { - cpu->queued_work_first = wi; - } else { - cpu->queued_work_last->next = wi; - } - cpu->queued_work_last = wi; - wi->next = NULL; + QSIMPLEQ_INSERT_TAIL(&cpu->work_list, wi, node); wi->done = false; qemu_mutex_unlock(&cpu->work_mutex); @@ -314,17 +308,14 @@ void process_queued_cpu_work(CPUState *cpu) { struct qemu_work_item *wi; - if (cpu->queued_work_first == NULL) { + qemu_mutex_lock(&cpu->work_mutex); + if (QSIMPLEQ_EMPTY(&cpu->work_list)) { + qemu_mutex_unlock(&cpu->work_mutex); return; } - - qemu_mutex_lock(&cpu->work_mutex); - while (cpu->queued_work_first != NULL) { - wi = cpu->queued_work_first; - cpu->queued_work_first = wi->next; - if (!cpu->queued_work_first) { - cpu->queued_work_last = NULL; - } + 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); if (wi->exclusive) { /* Running work items outside the BQL avoids the following deadlock: diff --git a/cpus.c b/cpus.c index cce64874e6..6d86522031 100644 --- a/cpus.c +++ b/cpus.c @@ -88,9 +88,19 @@ bool cpu_is_stopped(CPUState *cpu) return cpu->stopped || !runstate_is_running(); } +static inline bool cpu_work_list_empty(CPUState *cpu) +{ + bool ret; + + qemu_mutex_lock(&cpu->work_mutex); + ret = QSIMPLEQ_EMPTY(&cpu->work_list); + qemu_mutex_unlock(&cpu->work_mutex); + return ret; +} + static bool cpu_thread_is_idle(CPUState *cpu) { - if (cpu->stop || cpu->queued_work_first) { + if (cpu->stop || !cpu_work_list_empty(cpu)) { return false; } if (cpu_is_stopped(cpu)) { @@ -1509,7 +1519,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) cpu = first_cpu; } - while (cpu && !cpu->queued_work_first && !cpu->exit_request) { + while (cpu && cpu_work_list_empty(cpu) && !cpu->exit_request) { atomic_mb_set(&tcg_current_rr_cpu, cpu); current_cpu = cpu; diff --git a/qom/cpu.c b/qom/cpu.c index 20ad54d43f..c47169896e 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -373,6 +373,7 @@ static void cpu_common_initfn(Object *obj) cpu->nr_threads = 1; qemu_mutex_init(&cpu->work_mutex); + QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); From patchwork Thu Oct 25 14:45:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F38E109C for ; Thu, 25 Oct 2018 16:05:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ECCC2BD69 for ; Thu, 25 Oct 2018 16:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82E732BEFE; Thu, 25 Oct 2018 16:05:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 032062BD69 for ; Thu, 25 Oct 2018 16:05:26 +0000 (UTC) Received: from localhost ([::1]:55402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFi8T-0002Pv-92 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 12:05:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5W-0003jm-4d for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguV-0007ep-N3 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:58 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:48009) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguT-0007TQ-Vt for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:55 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0E6FB21E50; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=XoU8oMRa1G98rHs2o2p3OzrHokiVOD9bmYwLipmSF3g=; b=vP+O0 6/eNZJqfJjJvaMLC2TNb1p0K87yUuSeiJyvGGB6SagoEQCmBFHvkPNeqpiaDpCJa m438OS6oBnWJS4XgBGbONLjVIzfbFs7AE1M7U36pZganjHSJfKEOPrBZO5BTqGg7 qqmdVO1MmsVFXNjt/jWob28fO3EIg8nSdX+K+Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=XoU8oMRa1G98rHs2o2p3OzrHokiVO D9bmYwLipmSF3g=; b=so5UJeVt/32nNDyejtgJ/WtUZ72//kmu+2utaFPDd5cm8 sHKzQ/OJH6KA9//YS/wa7ShTWsMXV2n/S9o3TVpnSEJOn2RGjdQDvsQT/OkU/8wh Ff67oqhDbm6q/P3OL9Kt82/SGS1YKGyWB/zVVeGB9rJkoid5GP9itr5/bQySlNJS XmcsVO0tg+zdUa2fuIP5sOiJ58XDgEsz9Uwa0exFlPGHTahdQMUmUGMLTc/ogM8J a+kPJ11+LUUZPtzqpMbzeTddoLO7HP4JzGVVf6IoIIN0N8ltRqMnqL5mpCXobYH+ RWuggv51Ty/Rw8t1OUQbz0yNPUU572enWnWXmJJFA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8F7B6E47C6; Thu, 25 Oct 2018 10:46:45 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:35 -0400 Message-Id: <20181025144644.15464-2-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 02/71] cpu: rename cpu->work_mutex to cpu->lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This lock will soon protect more fields of the struct. Give it a more appropriate name. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- include/qom/cpu.h | 5 +++-- cpus-common.c | 14 +++++++------- cpus.c | 4 ++-- qom/cpu.c | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 53488b202f..b813ca28fa 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -315,7 +315,7 @@ struct qemu_work_item; * @mem_io_pc: Host Program Counter at which the memory was accessed. * @mem_io_vaddr: Target virtual address 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. * @work_list: List of pending asynchronous work. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). @@ -356,7 +356,8 @@ struct CPUState { int64_t icount_extra; sigjmp_buf jmp_env; - QemuMutex work_mutex; + QemuMutex lock; + /* fields below protected by @lock */ QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; diff --git a/cpus-common.c b/cpus-common.c index a2a6cd93a1..2913294cb7 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -115,10 +115,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); } @@ -308,15 +308,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 @@ -332,13 +332,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 6d86522031..b2a9698dc0 100644 --- a/cpus.c +++ b/cpus.c @@ -92,9 +92,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/qom/cpu.c b/qom/cpu.c index c47169896e..d0758c907d 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -372,7 +372,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); From patchwork Thu Oct 25 14:45:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 604B313A9 for ; Thu, 25 Oct 2018 15:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EBBD2BE44 for ; Thu, 25 Oct 2018 15:56:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F7042BE82; Thu, 25 Oct 2018 15:56:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5FA672BE44 for ; Thu, 25 Oct 2018 15:56:43 +0000 (UTC) Received: from localhost ([::1]:55333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFi02-0003Rc-Cc for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:56:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5W-0004Pv-8E for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguV-0007ej-N5 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:58 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:47977) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguT-0007TR-Vq for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:55 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3F6F321F28; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=R2+tLWvI6BkaKbFMlJ3xjt332ED+1QbM78GpzsaQCfY=; b=RHr9i hl7Zz/ujTCnive4w7bHNaR4AqTvjM82oTa6UNctrHWLcfBk5owjaLP3edjO/fZjK u8wKN28hG0k7ZT9b5Wnrx9xGuvMvQ0hxq/SL1hsZbcVWrk3DBs1GQpwkcf9xn9YF SB/07mBGFP3Qlrcy9Yu0Up+naeZz5Ey7mq+2hA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=R2+tLWvI6BkaKbFMlJ3xjt332ED+1 QbM78GpzsaQCfY=; b=tfxbOCvxEZUvTYOh8NaGRuWAsYH4gYzXOfAnznA/ihfev UO93eMc8NwRi6rcCWYkQQ/8vZcxjZY19HrF6aiYZWVh9I6vNLZVUZChuY+ZplUV0 ws7IAVBAUns7yj7fEiuUjKZoXhoVp4ykK1Ke0fVhFusHZ7AN/1xXlXD38On/bwRV WyUWVXitjP5oe9gMEawTSOsffKtzSZ6JWSlcurl0k3cDxOlRF45k/NyTt6sTi+Ef rogXkfLOmKiMlN8y6C5o+qtezr1XlqeWXx1xxPGXxQLO+bvFtNGkhnAMVdBpMpLK gVrHdUNAdvK4iFArKwsU8vCeioiESbclu7Mf6iJvg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C3573E49F7; Thu, 25 Oct 2018 10:46:45 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:36 -0400 Message-Id: <20181025144644.15464-3-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 03/71] cpu: introduce cpu_mutex_lock/unlock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The few direct users of &cpu->lock will be converted soon. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/qom/cpu.h | 33 +++++++++++++++++++++++++++++++ cpus.c | 48 +++++++++++++++++++++++++++++++++++++++++++-- stubs/cpu-lock.c | 20 +++++++++++++++++++ stubs/Makefile.objs | 1 + 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 stubs/cpu-lock.c diff --git a/include/qom/cpu.h b/include/qom/cpu.h index b813ca28fa..7fdb5a2be0 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -452,6 +452,39 @@ extern struct 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; diff --git a/cpus.c b/cpus.c index b2a9698dc0..38cc9e1278 100644 --- a/cpus.c +++ b/cpus.c @@ -83,6 +83,47 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +/* XXX: is this really the max number of CPUs? */ +#define CPU_LOCK_BITMAP_SIZE 2048 + +/* + * 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(); @@ -92,9 +133,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; } @@ -1843,6 +1884,9 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line) { QemuMutexLockFunc bql_lock = atomic_read(&qemu_bql_mutex_lock_func); + /* prevent deadlock with CPU mutex */ + 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/stubs/cpu-lock.c b/stubs/cpu-lock.c new file mode 100644 index 0000000000..7c09af3768 --- /dev/null +++ b/stubs/cpu-lock.c @@ -0,0 +1,20 @@ +#include "qemu/osdep.h" +#include "qom/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; +} diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 53d3f32cb2..fbcdc0256d 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -8,6 +8,7 @@ stub-obj-y += blockdev-close-all-bdrv-states.o stub-obj-y += clock-warp.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 From patchwork Thu Oct 25 14:45:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1B5913A9 for ; Thu, 25 Oct 2018 15:49:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF89F2BE32 for ; Thu, 25 Oct 2018 15:49:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2A302BE37; Thu, 25 Oct 2018 15:49:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3CDF2BE32 for ; Thu, 25 Oct 2018 15:49:35 +0000 (UTC) Received: from localhost ([::1]:55286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFht9-0004AV-9K for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:49:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-0004FR-RJ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguW-0007gB-Gt for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:58 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37685) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguV-0007TY-ES for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:55 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9220021F3E; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=9yvf4xgPTSJzmBPhpHPcnwPLcsd4UcrrSzkSPv94AaM=; b=WLGyQ muQe+OubHfnoaqC2slxtz0Hp3aPaYmX2B7dnQpaGRpYVdo+V3uLosPPwZyXw8yTn JZ4nb4XENGiO0rZ5/66afEvI+mLq7DMENcb1c8dv1JBaeiluXrtFUs+nM9L8DqDK kfM+AQY63ZgzZSH5QEVIgutG44u5Qc/xvsKMQc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=9yvf4xgPTSJzmBPhpHPcnwPLcsd4U crrSzkSPv94AaM=; b=IDigVZ0syyGDO/E9QvWPP2+CCxAt91wnyeSc6uuQHDUHv K+yr0UJJa6l5PI14v20AIudiqbGQqUnwwW5WiglMP/mh8pTkaQ1cga9vcxYdsFMI HrAhuwW+vyLOrRl+MHC+snpbiTwZP0JTELGnmG6AFxTG8i17WmOGCvsWWlyxsQgM eJuT6uLvNmXcuffLT48Rh3uZsR67uBREhTc3NNqxAog0Wrpp5n7vTG3RAZtYwtUz DtAilgsuzZE0myqQgsmnam8gzzEHNPQ6XnF+iEGWft7Wwrzd1uq0salwxxcijtdh TYo6jur43nLd3oy+4deYOMihuW3a8ZIGIfyQUlEOg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0E487E4A41; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:37 -0400 Message-Id: <20181025144644.15464-4-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 04/71] cpu: make qemu_work_cond per-cpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- include/qom/cpu.h | 6 ++-- cpus-common.c | 72 ++++++++++++++++++++++++++++++++++++++--------- cpus.c | 2 +- qom/cpu.c | 1 + 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 7fdb5a2be0..2fad537a4f 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -316,6 +316,7 @@ struct qemu_work_item; * @mem_io_vaddr: Target virtual address at which the memory was accessed. * @kvm_fd: vCPU file descriptor for KVM. * @lock: Lock to prevent multiple access to per-CPU fields. + * @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). @@ -358,6 +359,7 @@ struct CPUState { QemuMutex lock; /* fields below protected by @lock */ + QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; @@ -769,12 +771,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: diff --git a/cpus-common.c b/cpus-common.c index 2913294cb7..71469c85ce 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -26,7 +26,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. @@ -42,7 +41,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) @@ -113,23 +111,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; } @@ -139,13 +151,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) @@ -307,6 +340,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)) { @@ -324,13 +358,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) { @@ -340,5 +384,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 38cc9e1278..d0b7f8e02d 100644 --- a/cpus.c +++ b/cpus.c @@ -1236,7 +1236,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/qom/cpu.c b/qom/cpu.c index d0758c907d..bb031a3a6a 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -373,6 +373,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); From patchwork Thu Oct 25 14:45:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6997214BB for ; Thu, 25 Oct 2018 15:46:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 557542BDC1 for ; Thu, 25 Oct 2018 15:46:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47A2D2BDDD; Thu, 25 Oct 2018 15:46:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD08E2BDC1 for ; Thu, 25 Oct 2018 15:46:35 +0000 (UTC) Received: from localhost ([::1]:55274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhqE-0001bW-W1 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:46:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5W-0003lE-3M for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguV-0007fR-Pi for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:58 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:50339) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguT-0007U3-WE for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:46:55 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B826B21D06; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=cuaXy4PIOaNeRXOGjaYFTlab+o91Tlnlucoul6y5WVg=; b=0ujh9 yHL8RHBk55mCKvmPcy+G6lOWMNSDb4Ady9s7738oCrO5apY0G0IU6/fwSoPRbmzY HsIGnk3lzXiyw2ixwEzZ7MJUgg7ccLJJl6lD0zVVvhbYUkD47OHpbR5I3ob5dJsL VntSN+yrmCh8OB/x0CE+xXCZTv+HqWl28A8Z1M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=cuaXy4PIOaNeRXOGjaYFTlab+o91T lnlucoul6y5WVg=; b=O9AvM0fD/4RAlmT7ncovG6onAGi1OTfsYh9MCxwp2ddlR gz21leXZvTrSfj8xF4zpF/4co5LLJauS5RxQchFD4Ip3l8o0YrcL8+uJtn0J3ru7 RlGidWmEYDx5yAjk6tB9yltHbSsrTiWms5mfga/tumx/1RsfMigoVe+RD9lcqDIE wuUOQLg+3mMxDnm5+24Y+IavTJrDd0GhoxC5kI0SXn1S01rI65oFiaJpfvIpTQT5 IY1kl7eeX48RYj/8zvXyC7PpeI8axJCFWLA8sZBnn5loFKYzr0VU+OyaNKMK2ox0 yjp6vFhExCbCb1prO1YSZb/q/14F0xQQYmkOONwYg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 571BAE421C; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:38 -0400 Message-Id: <20181025144644.15464-5-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 05/71] cpu: move run_on_cpu to cpus-common X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We don't pass a pointer to qemu_global_mutex anymore. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 10 ---------- cpus-common.c | 2 +- cpus.c | 5 ----- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 2fad537a4f..11cbf21f00 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -766,16 +766,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. diff --git a/cpus-common.c b/cpus-common.c index 71469c85ce..3fccee5585 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -127,7 +127,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 d0b7f8e02d..913db6a8a4 100644 --- a/cpus.c +++ b/cpus.c @@ -1234,11 +1234,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) { From patchwork Thu Oct 25 14:45:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35C35109C for ; Thu, 25 Oct 2018 15:43:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23ECD27F10 for ; Thu, 25 Oct 2018 15:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 154D028459; Thu, 25 Oct 2018 15:43:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 90A5427F10 for ; Thu, 25 Oct 2018 15:43:36 +0000 (UTC) Received: from localhost ([::1]:55256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhnL-0007e7-KW for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:43:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-00045Y-Hi for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgun-0007mh-0i for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:17 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57963) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgum-0007ev-NY for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 11D0521F49; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=clOSrpxQN9iFL2sAjNrAER5acelY1UQamItAzx5PJQU=; b=klQmx nS957eWd0aCBLteUm5PWpe3tEMKlNlW36mr5y8JSkphZFFWDxDusH00B9rOANzF7 5DT+g5lo1IfjygE3RqUJXzf6Vw90hoovoQl3hM3pZmiQE5K/04/xPWi+UeEtX+Vi BMSnAz+2/m8ifrC6goCbDEovKuoVarxCfjz/kU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=clOSrpxQN9iFL2sAjNrAER5acelY1 UQamItAzx5PJQU=; b=VNnAY8jZ4rxozv1GCIW6bjr+2Fn8lI5gYswdiK5Rvhres E7JcY8A6TiKi+HQ06D6SwuZ/xI9UwkPkUB5bT7SkNi8H/cfizNMpznI40ujEGVb1 27jb94FCPTF2GWceZ1p9maE24CYhigvLxkecRg2x+sSjxiBQEi4EBhsipahieYXT NVngS/OZUORCsz0G3f1np/5E/YlohZDpUTjsZu/jl6aMtRDF+Zmj0j0ZjecVfXhF d1VyYT8REYDfEJUfRdcPU2e/vQejmv2K249tSh+8MYuQKdxUZYucESriZJKsn027 UIWOx3AEVMDSawxWB9le3XW99VGU/4oHClkyOq8yA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 96E25E49F7; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:39 -0400 Message-Id: <20181025144644.15464-6-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 06/71] cpu: introduce process_queued_cpu_work_locked X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This completes the conversion to cpu_mutex_lock/unlock in the file. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- cpus-common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 3fccee5585..c2ad554d54 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -337,20 +337,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 @@ -376,13 +375,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 Thu Oct 25 14:45:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6C3F14BB for ; Thu, 25 Oct 2018 15:51:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B77232BF40 for ; Thu, 25 Oct 2018 15:51:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B593F2BEFF; Thu, 25 Oct 2018 15:51:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 45FC82BF9D for ; Thu, 25 Oct 2018 15:51:39 +0000 (UTC) Received: from localhost ([::1]:55300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhv8-0006wv-BD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:51:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-0002yq-8J for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgur-0007q5-Ho for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:18 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:51093) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgun-0007eu-3y for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 474AF21F34; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=YLZe+gFCuTVOuz+1E1nyb15WGSBN2LFKWfYK6jhZJw8=; b=HitOi 8hHdzwtSKTEwkFoMR1cBgB5rW/iwJFRXjxuaInA4tvAOAUbFm5uJiZqgpBgUcVXo niiBIHa1Ufg+7ddT1x0lbGEjDll0GxFlXn71CpHL9pKuKy3bKU/gDSX74kelKlqP BYeYDMTMI2K6gw0uPR8RtGaQi7rAXIomin1ddQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=YLZe+gFCuTVOuz+1E1nyb15WGSBN2 LFKWfYK6jhZJw8=; b=XQvVEVZz0ACf5C4PZ+drfsxUQvJ5hkJZlTIRd08oy2Qm2 oMV3OFxPctp/nLtKMbRkvHgKpAuG36FC109AdN8oNNkdks6V/eQetm7K/WwLhLD3 5dQeMg4K1S9SGIwDamhDs5GhscTKb//UNcP/5/4BasbhnfLrELTUJiORMx5hBqp+ aIMlJoj/B9cCq5IzSrVxcJiQ75658vtjAW2DgwlnQSoa+rpQPkDd5cz5FfRm21+z GFC9MjSH0cL0xt8xPLsn79ghVeIxA4gYCEp9CLm8XsNIfUem+ozMDXK6UxnIn+45 exPrydPV3eVTV02cZ7jgX5bnyEG1nZ537Z2vWpnTA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CC656E421C; Thu, 25 Oct 2018 10:46:46 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:40 -0400 Message-Id: <20181025144644.15464-7-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 07/71] tcg-runtime: define helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- accel/tcg/tcg-runtime.h | 2 ++ accel/tcg/tcg-runtime.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 1bd39d136d..d767f8515b 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, diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index d0d4484406..4aa038465f 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -167,3 +167,10 @@ void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(ENV_GET_CPU(env), GETPC()); } + +void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) +{ + CPUState *cpu = ENV_GET_CPU(env); + + cpu->halted = val; +} From patchwork Thu Oct 25 14:45:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F265C13A9 for ; Thu, 25 Oct 2018 15:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DECE82BDAC for ; Thu, 25 Oct 2018 15:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2B2E2BDD8; Thu, 25 Oct 2018 15:42:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B49F2BDAC for ; Thu, 25 Oct 2018 15:42:37 +0000 (UTC) Received: from localhost ([::1]:55252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhmO-0005fv-Hw for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:42:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5S-00034O-PG for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgur-0007qG-Hy for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:22 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36251) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgun-0007gI-63; Thu, 25 Oct 2018 10:47:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 33D3C21F6A; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=oV35kcJmG1x2GUk2Ps5s4eeNyJPj4jV9lgMsY0MJjYE=; b=vg4Ya 2X4UmmtNBn9KcUULo74IA3PCn2O1P88iGCUrv0yywbac9NWlV//f5Ms1P7rOfySo HP9u5zlPyufg8h7Dii+UCCR2BXeJnEfO2WAzSSqobdiibuKt3Lh4NkfIaMccQzJ5 JjaeCxltGeOHSP0Y4wRab3NBu9NsT4pwMwD/30= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=oV35kcJmG1x2GUk2Ps5s4eeNyJPj4 jV9lgMsY0MJjYE=; b=gv3OEm2cJ84TxC/3LlgJHjDUAZC+UnUzm+7kN6A6ibv64 ncaP4FXjgQKGmFy6llY64jt7WEYDLJ3l7dUxYVoEoyhPPkUgLItPLef9Xe2E7hXG g9Rdvjzq71wiOHzIdrV3Bg0tocTahZKPOfa2v4wlNxJeuBT2gHIAcr/B1RMsRA1U aJEO5hwN6ruo0MM9PnyG+PPKEBA/4rYuyUNWVlOHVtoHj3BDvZbULpE/c4lpcN5o BTA5Vo1eNfbIQyI/SHcavjg/OA2cp47gnddPw2ualh6mgYkcsD4Gu6HEuaHkfoW6 ecQrJF9iLrakN9E4i04XB/ePGVaKbZ/LHgkSMhukg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 130E3E455F; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:41 -0400 Message-Id: <20181025144644.15464-8-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 08/71] ppc: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 4e59dd5f42..2d31b5f7a1 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1609,8 +1609,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 */ @@ -3543,8 +3542,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 Thu Oct 25 14:45:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF3211751 for ; Thu, 25 Oct 2018 15:40:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD0802BDB0 for ; Thu, 25 Oct 2018 15:40:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB0412BDCB; Thu, 25 Oct 2018 15:40:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5168D2BDB7 for ; Thu, 25 Oct 2018 15:40:08 +0000 (UTC) Received: from localhost ([::1]:55237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhjz-0003nZ-Fc for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:40:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5S-0004Uf-Co for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguv-0007vm-Qc for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:27 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57657) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguv-0007fQ-F0 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C69B621F46; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=Q1mq1C/yQovvpVtkW30jxjDezXuZqI677x0kEaQ6X/Y=; b=i18yQ AdasahqAw8QLW0CZmat9UlqaNDl7ztiB5/JL4yAzgGicVv+XRcnEt6oJ5L1VYz7u Kh/mOsoy/lyOvWv17wDz0j5JjK8ll7UeK9qEqJdRR6OmeCBuu6xWXFtipVeIvuAP 97QZovkAil9R81nV7m9YbjPeBY8AFYx9FpPbFQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Q1mq1C/yQovvpVtkW30jxjDezXuZq I677x0kEaQ6X/Y=; b=EeQa547cks/7yCgxp89QImOEDkOfJJtf4uTyseUo19m2u eak7Wmfv7Y+4zijr/YCIObl1Ip0zQffUsFgIjnCZoWvh3XWhF3k9ey3sgbNu60Y7 pDEvRerGK4OUKRGBd7Z6JQXXrSq1wfA3FdQvegISqJ3iFr5AzE7Kkzjsv8KxSAwZ cqwos/Gx26lcrtjxkWc8D5pNyPWf6rYLhSwHAqaGlZVKNUOpUf4qk/9ofYQequqO ceOY3zXRFIZexqBcI21C4ExbKRxFNd5eDsEg0Y6fulvwtTEQ0NIaYL8jkdqVlxGZ 1XgTaOwBgYB/iGU8TPbJp/grVPoYhO3uw71Bv5vTQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 52843E49F7; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:42 -0400 Message-Id: <20181025144644.15464-9-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 09/71] cris: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP And fix the temp leak along the way. Cc: "Edgar E. Iglesias" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 4ae1c04daf..0ccb65fbed 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -2833,8 +2833,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 Thu Oct 25 14:45:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9981413A9 for ; Thu, 25 Oct 2018 15:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8601B2BE45 for ; Thu, 25 Oct 2018 15:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 842442BED2; Thu, 25 Oct 2018 15:50:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1971A2BE98 for ; Thu, 25 Oct 2018 15:50:34 +0000 (UTC) Received: from localhost ([::1]:55295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhu5-0005yC-9A for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:50:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5U-0004Uf-Re for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgus-0007ta-S2 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:20 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:55409) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgus-0007gJ-JN for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:18 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1429B21F5F; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=OYQU1QaWaFDV018F+WvSGrIwGf+VvYTQrb8ZiK//u50=; b=ojnwX LkBXwJR0q+jw7ECmYl3SUmUS4bb6+2anks9wv9IbjXrGxjrixbhbtY61kKRgHr6B P5gc0lFltmIXR+Aki0rGskrBMMZd+llyzXAy0A+d8K5o/q/P2zLayI2XsTzxWCKP cYvgOnY5vl6FiCvg2d+IdjseM7BVu4Lu9kLlvg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=OYQU1QaWaFDV018F+WvSGrIwGf+Vv YTQrb8ZiK//u50=; b=Hq2JeW7waS/cZMsfHPunpGvxEILW3hcpcjRbn19nvFSes C1NEeS2gdcIOF2BPcRoV3xr0aSAbSHD9C0eYIAqC9AGLJfY5jRST+syXGK2ypxDW G54XuKmqg0Rr3LEM06FMuE02e8Y4+iCBc2N8HTpuD5PN3qKXKu+jeYioDw0/6fSt mOId0D6lpdozdjgVtLT5RBXjVvUwE7XK0Ji1smqL9ADQRPP/HLEIDVxxLWUz1Hvc DVOAnV5IjrjoTCKGD4FkH6QCTUzPqNBWXC3IwOc4QrV1LTKHgNL/mkQna3uXCwEa k9Lfwx18fFS7Q2EzkuW01hU/0+36YO+6bFm24Ojwg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 95D76E421C; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:43 -0400 Message-Id: <20181025144644.15464-10-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 10/71] hppa: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 ce05d5619d..df9179e70f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2845,8 +2845,7 @@ static DisasJumpType trans_pause(DisasContext *ctx, uint32_t insn, /* 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); From patchwork Thu Oct 25 14:45:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D68213A9 for ; Thu, 25 Oct 2018 16:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 291022BEFE for ; Thu, 25 Oct 2018 16:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18C432BF00; Thu, 25 Oct 2018 16:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ACF0A2BEFE for ; Thu, 25 Oct 2018 16:04:51 +0000 (UTC) Received: from localhost ([::1]:55394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFi7t-0001ws-Tt for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 12:04:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-0004D4-4e for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgup-0007nh-3F for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:20 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:55669) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgun-0007fO-1N for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 732E321F8A; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=wpnODM1zGY6qEcd6ByZ2aAk5prLoztbRBH0uG2BEr7k=; b=lfKYo FzGsv9+i3C/W0ox86RbksSyJRUysPE+otHouVxZnv21MOK13DACqmqxN6VvOvywc NfY9X0t0Z2MphvHh15Ey3ovEP4AAw1ZbEabTRT7RBZqUw9Kp8wDbEJfpijudAxGj U5XHZQhcGhlqaDS8Le4tuDAe8Sz4tRgi9Za9Mw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=wpnODM1zGY6qEcd6ByZ2aAk5prLoz tbRBH0uG2BEr7k=; b=kbcPF4h5QoM7XSGKF0pDDrMJNMjc9mA36Mw6H9W2B4p1F /TjZCk5Gacya/kvWpCAvhmMehzqvL5ER+UzVihRkhXWpKkxR4pBZNEaAEwwpPNvS qxJ5GyI/+kL8FBVFrZfOIeAXji9dNt0mUR8IlTxCTrXL43RxaB5A++ETQROo3PRV b1Qw5Va8tPFypL9BNWDN/4xXXBEz1XTi8UlWHzEKD5juzlmGronU1xeUJqHyVPbq xLHvV/+j3a2UPh6+r7R0JT0JMpFksTfkJ8fP19QYxsZNWRMSCRqSefb8YFtTjelb fUIee0MuhFH0/LamFchIEnPZ0OcTm2fPE+Rv7g4cg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D481BE4A27; Thu, 25 Oct 2018 10:46:47 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:44 -0400 Message-Id: <20181025144644.15464-11-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 11/71] m68k: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Laurent Vivier Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Laurent Vivier --- 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 ae3651b867..d55e707cf6 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -43,7 +43,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]; @@ -79,9 +78,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), @@ -4637,6 +4633,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); @@ -4646,7 +4643,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 Thu Oct 25 14:45:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4286913A9 for ; Thu, 25 Oct 2018 15:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E2AE2BE7C for ; Thu, 25 Oct 2018 15:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D4AD2BEA3; Thu, 25 Oct 2018 15:54:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB9D92BE7C for ; Thu, 25 Oct 2018 15:54:41 +0000 (UTC) Received: from localhost ([::1]:55315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhy4-0001FD-Pl for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:54:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-0004Uf-Nx for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgum-0007mL-MZ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:17 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52773) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgui-0007ew-UK for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:10 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6BB44205B8; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=EKZBR2Af0pnpck7MgmKaa0oTUuQRysGz75Hc8DPA0f0=; b=snltq 00LmhxTovzTVMJE5HwzOhVB6tlrOg0giIiyxJio+DxXjaT6KSaS7otN5lxBZsX8N N6TzzJFT5WOljfbS34UrGVrQ4Wiz/tGS+RdFtapDJ4FtZ4PKi534DqT9WbvdM3v4 49WHtxmzlMFqneMZNIJQJiTP7LU+Lt8ZtOyzd8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=EKZBR2Af0pnpck7MgmKaa0oTUuQRy sGz75Hc8DPA0f0=; b=sT8kvPVZc2VR4Em4bFt/2u9knN0kf/YnB+xnEHqXqh0LO zv6KOJ/M7uOi8Ia/iHk8dOKYfVyKpeL4EphZBq0rG2UOTPAQherqwqnFOTIguoCg tPrtlWLASTnW2ggjPaN8mA2sMPs2D8goI1WxyV1a48ookKsdngHtx361KJIwaxIC 4BMJUSjpFtTAC3eY/I+5zzqkImCMuvWnfAExzzRt4GLoUKd5klV6tSx0VuqA8EmO Z/fB35Kzr4PU50DjQ1tPfezmsXgBaoUhc0eVN+kOKCwd417M1B6PnGL3rkGL1y32 2azRJNmy5TRFYwiXCohakU+cyy6x8Zw0Auopnj8Gg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 18149E4A41; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:45 -0400 Message-Id: <20181025144644.15464-12-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 12/71] alpha: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 e5d62850c5..25cd95931d 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); @@ -1382,8 +1381,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 Thu Oct 25 14:45:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F15B109C for ; Thu, 25 Oct 2018 15:44:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BEAC2BDDB for ; Thu, 25 Oct 2018 15:44:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2EBC2BDE0; Thu, 25 Oct 2018 15:44:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A49592BDDB for ; Thu, 25 Oct 2018 15:44:52 +0000 (UTC) Received: from localhost ([::1]:55261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhoZ-0000CA-BK for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:44:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5S-0004D4-Kj for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFguv-0007v8-Eb for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:24 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:47509) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFguu-0007ex-Co for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:20 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C77E821FDE; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=qys92J57oJ7+d37XQ3rMWM+fnsLLNpWRs1BjgZp27tQ=; b=UNGAf DjqtoAn9VALwRChTmyv9mMzRQVv5ijsi1gECss/Nh4D8+EE+AzPNKgmdAHjlM1om hl49MbpsUgTWfG3byO4gpRR/9MvvCpJ5H775l6QtSYSknJY0RCyP6yoAE+xLBJcJ S91MKIg2QV8qZS8unPRXNAcLCN1qLY54+Pv9zU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=qys92J57oJ7+d37XQ3rMWM+fnsLLN pWRs1BjgZp27tQ=; b=aMshSkgDjxFDbEsjpXRSUaZ2Mtgm4I4oXfC6Ud/lgSSe5 zR6NJ306PH0B1vJL3J2PIPGtEMCJ3Ko9O7TvgMELeTApL6UfK35hJnHNVsiPmqYb m5PLl+fII+rnl5a7o0X5fBWpjy25PZkRc4cyl/yZHoVOQe+3sPujj0NWdGmG8Yzh Yps8aPBivERvmpOydb65+6Ji60+MksxbsmPlySidVwc6grrJJwsQhaM+lB+vpC5I /U7VmT1wXaQDb8gI92sGpR1vnxoS7b7UCc+hJoMkzbXRTK1toA0abwV4u5IcB13x X/ecfI+opkrANUo7Nic5/FNEJtHEMsrYzy9a66PEw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 57422E4A44; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:46 -0400 Message-Id: <20181025144644.15464-13-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 13/71] microblaze: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: "Edgar E. Iglesias" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 78ca265b04..008b84d456 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1233,9 +1233,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 Thu Oct 25 14:45:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FDA714BB for ; Thu, 25 Oct 2018 15:48:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E4132BD81 for ; Thu, 25 Oct 2018 15:48:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 008612BDC7; Thu, 25 Oct 2018 15:48:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A47702BD81 for ; Thu, 25 Oct 2018 15:48:41 +0000 (UTC) Received: from localhost ([::1]:55284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhsG-0003LE-UL for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:48:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5V-0002yu-5y for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgus-0007si-C8 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:20 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:58077) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgur-0007gL-PH for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:18 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0E45321FE8; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=yFvrCTNwIBOlNSFQ32Flcq+Rf4vT/MuluMSgD1C61YU=; b=ELFHn HlxdLbhvMJ9xyRlcDeZrA369SPO+AnAO88k2BUcYaHpUahW384zVGFUJZTubL/Nk CSAdxQC95vcxtYPbiHfpVfpm1Lx5CUyaajBdQ9gz3Nn99zSKTqcQuj0mIw6+qNC8 L0xwX7YoKy8zXB9Oi2SoSXqDf+YqpK5+embOhI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=yFvrCTNwIBOlNSFQ32Flcq+Rf4vT/ MuluMSgD1C61YU=; b=zAuFORNkdqnw5pajy5lfi/B3YNu+XaZlTeUuqty02D6MY X57zv2A57l+DOB2kYVWsmG+CPiVQRyCRSBfnn2nUTZ2hAaIdQLVnJY0GVxKTfyLi ydN7xq2v2ARdDuT01GpV2nEWLJZTXEYOB2J8TvG9+VUXlO7H8lKOO1TUopSECd7r EX+IQpIaFGc2+tNsY3Urm8CP0Cnc9eBVCNPD/fsGtX+DVM1OUOzWI/iDeGTlacmz 2NQlfjJSig8oqRMvT5ZOCep0snBIAgHnvD1apMkq9NROucnhKVp2xsbkqa+vQPxw uJ9V8wG8/hJ5Whyqns0t7JxaKA5g57xmeTCMvCssg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9427BE4A47; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:47 -0400 Message-Id: <20181025144644.15464-14-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 14/71] cpu: define cpu_halted helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- include/qom/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 11cbf21f00..aeed63a705 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -487,6 +487,30 @@ bool cpu_mutex_locked(const 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 Thu Oct 25 14:45:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9FA4613A9 for ; Thu, 25 Oct 2018 15:34:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F5622BD69 for ; Thu, 25 Oct 2018 15:34:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83CD52BD91; Thu, 25 Oct 2018 15:34:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 19E512BD69 for ; Thu, 25 Oct 2018 15:34:10 +0000 (UTC) Received: from localhost ([::1]:55206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFheD-0005Zs-CD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:34:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5S-0002yq-Ko for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgux-0007xL-Af for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:24 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:49037) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgux-0007gK-4C for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:23 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4627122006; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=cDo17t34N1EkaYNi2crOuYdw+W86Cfjuf0qK0ORdXb0=; b=cM1J4 z8IQi/MfsJw/FImJ/kmG/bBnJP5hXZ4FZHPtL0L89es4cvfSmP8iGgGYxcGsAyYf mIcMSlN07WExHEDMfuWt1D95QHV5lnAV4VpjvREtQI2lq2Yd9N3UWVmQC5GsnXhu 9NpcgGOjmDA3vH/NU4sf5XhNBQe/GW8+1iEE6s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=cDo17t34N1EkaYNi2crOuYdw+W86C fjuf0qK0ORdXb0=; b=O3a0YBqGT2QnlZSaFimJGYilkd/KjPE5vlu0cAZx54h20 psk17JP+xKtv0X8t0BDhOgNcOtX0I6lx0WMC/xwnnZL9SpTu45QetzjYN3tFCpZk Ll9oQjpPlb6kgFjXaFrR8W6qH9etdcfjIlkI2vbj6NdljzjWTMw216Rp0+y+4H4E e3zCwU0Xyz8SX7aJUZ7ZtNwAqhmz5Tz6bQladxgcRiaHZUKChp5G4TlUz2gufGmp /dsEBpy/BFhP2yilg0bPl6Reo/cdr1PhLNoywsC/gszZdH4fHaoea8M+ppdbsVP2 aH/8eoPHJiSnvhXZobnfDClr7rCaopJc4qVQ0TsNA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C7FC5E4A48; Thu, 25 Oct 2018 10:46:48 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:48 -0400 Message-Id: <20181025144644.15464-15-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 15/71] tcg-runtime: convert to cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 4aa038465f..70e3c9de71 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -172,5 +172,5 @@ void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) { CPUState *cpu = ENV_GET_CPU(env); - cpu->halted = val; + cpu_halted_set(cpu, val); } From patchwork Thu Oct 25 14:45:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE09C13A4 for ; Thu, 25 Oct 2018 15:24:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D8C92BD11 for ; Thu, 25 Oct 2018 15:24:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 919232BD20; Thu, 25 Oct 2018 15:24:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 481152BD11 for ; Thu, 25 Oct 2018 15:24:16 +0000 (UTC) Received: from localhost ([::1]:55153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhUd-0005JP-I7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:24:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5K-0004FR-Nd for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvG-0008Et-Pa for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:48 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:53107) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvB-0007mb-Hw; Thu, 25 Oct 2018 10:47:38 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 620AC220A4; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=3j9F53GR3YtLPEfc6I3qE4RlsSU6R+YltslfjdjAowM=; b=zD/ur pk/RMlANZiR5t3kCVBo3mo05ua9/OjXxOXecsoqFlhg+Pwdk8sLOfYfMco1R7Liv hennJ+CopAU/B8GBHjIbmCp+aanK/dZj4juoj4eR6JmE0bNiJR0TgcfMeVPnWSOj tb9hnT+mC0hCCkbKT7YD06Cuyxl/ta84DCroYc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=3j9F53GR3YtLPEfc6I3qE4RlsSU6R +YltslfjdjAowM=; b=iTW5T6cFMLX7oQUo9Dh5QYu4fRAwm0ZL+ck6W1KenzxQK MVQO794ciLyIj3xt4my1GnQtlF5Jy+FTxDNOUZuoimKw+7skj2/16zVrUU2fe9CV nr3lphBVN2EiHpA9juo4kj+//zX8hr6JxW+FLejEza6uX9AYg4ieyn5SdHZxD0hy TrW8d8eBBZNnSqv5iviM71yDQWgW3pFPBL+bL1PDO+mH8+a/2JLMyzpscNFoj/lW GkYoYcGz4NhMmx5V2+gy2+A0y2x5NAc9T5e24E30ffnGTC108YXV6WVsAjcItfIk JHgJnj+e0vWFhkwiUxy5l+4hi+RgQq0KwzoPC8e0g== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 087E6E44D4; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:49 -0400 Message-Id: <20181025144644.15464-16-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 16/71] arm: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- hw/arm/omap1.c | 4 ++-- hw/arm/pxa2xx_gpio.c | 2 +- hw/arm/pxa2xx_pic.c | 2 +- target/arm/arm-powerctl.c | 4 ++-- target/arm/cpu.c | 2 +- target/arm/op_helper.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 539d29ef9c..55a7672976 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -1769,7 +1769,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); @@ -3790,7 +3790,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 e15070188e..5c3fea42e9 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -128,7 +128,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 61275fa040..46ab4c3fc2 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -58,7 +58,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 ce55eeb682..e4477444fc 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, @@ -228,7 +228,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 b5e61cc177..9c5cda8eb7 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -149,7 +149,7 @@ static void arm_cpu_reset(CPUState *s) env->vfp.xregs[ARM_VFP_MVFR2] = cpu->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 fb15a13e6c..8e393823f8 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -465,7 +465,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 Thu Oct 25 14:45:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F7D213A9 for ; Thu, 25 Oct 2018 15:47:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DD792BDD6 for ; Thu, 25 Oct 2018 15:47:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 822762BDDD; Thu, 25 Oct 2018 15:47:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 454682BDD6 for ; Thu, 25 Oct 2018 15:47:00 +0000 (UTC) Received: from localhost ([::1]:55275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhqd-0001sE-H3 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:46:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5O-00034O-3B for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvD-0008Aj-22 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37367) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvB-0007mc-MI; Thu, 25 Oct 2018 10:47:38 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B5C0420CE1; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=UPgyFhU0ld2aOH0gfsuxY1SsvFtG9HAn2Q6MqTjF/88=; b=Pj51D JszcUqvzfwyj5yiRbrp4kjchXlTc9jYgEs/LnFRtNVFzrO36Tr4gxAQqkbmvdp6D /0KXotadmdY/01QdN5gmqP1yDE+I+M1SdqWTPmgcYV0gxGaTa7hX3KOdGKEbgLxe hOq90OczXZ3qZbq5UJxrQgYS1d/vXZh/WZ/3Ps= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=UPgyFhU0ld2aOH0gfsuxY1SsvFtG9 HAn2Q6MqTjF/88=; b=pex03MgWv0KlfbmSLyHud1yovHEBeVX2XkTG/A8LAI53s TkU1IgENLQ3SuVG4dilF/EdhZZmR3lT4v3iLr4530gS+S8sUcGK+0K5e7bgZUwPX xZkYWQqDGgsEpVssf9v0+NCA4786Gm2+MVyhiPAmqEilg9EC40rEa2QLCBUDzuEs YDk4WWY/jifv34GfOmOPqLeiWXApUfGIr7/k45UoB40gffKT91GIrEfpARvwfzmm Y3xRmWFUCgNhizngRRZUeYzb1zXEeTTWKF4Bda+aga1m3fJoOsgHrXnTmuHkWxhD wF+1zRgKAFpEplhS4vzvmBgAJJRilhIlMy2/DwD5Q== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 40294E47C6; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:50 -0400 Message-Id: <20181025144644.15464-17-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 17/71] ppc: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/ppc/helper_regs.h | 2 +- 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 | 4 +++- hw/ppc/spapr_rtas.c | 6 +++--- target/ppc/excp_helper.c | 4 ++-- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 6 +++--- 10 files changed, 27 insertions(+), 23 deletions(-) diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index 5efd18049e..9298052ac5 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -161,7 +161,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/hw/ppc/e500.c b/hw/ppc/e500.c index e6747fce28..6843c545b7 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -657,7 +657,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; } @@ -671,7 +671,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 ec4be25f49..d1a5a0b877 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -151,7 +151,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: @@ -230,10 +230,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; @@ -361,10 +361,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 c45fc858de..4b3532730f 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 2398ce62c0..4c9c60b53b 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -37,7 +37,7 @@ static void spapr_cpu_reset(void *opaque) /* 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); /* Set compatibility mode to match the boot CPU, which was either set * by the machine reset code or by CAS. This should never fail. @@ -91,7 +91,7 @@ void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip, target_ulong r env->nip = nip; env->gpr[3] = r3; 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 ae913d070f..9891fc7740 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1088,11 +1088,13 @@ static target_ulong h_cede(PowerPCCPU *cpu, sPAPRMachineState *spapr, env->msr |= (1ULL << MSR_EE); hreg_compute_hflags(env); + cpu_mutex_lock(cs); 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; } diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index d6a0952154..925f67123c 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -109,7 +109,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); @@ -153,7 +153,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; } @@ -207,7 +207,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, sPAPRMachineState *spapr, * This could deliver an interrupt on a dying CPU and crash the * guest */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm); - cs->halted = 1; + cpu_halted_set(cs, 1); kvmppc_set_reg_ppc_online(cpu, 0); qemu_cpu_kick(cs); } diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 0ec7ae1ad4..5e1778584a 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -206,7 +206,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) { @@ -954,7 +954,7 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn_t insn) CPUState *cs; cs = CPU(ppc_env_get_cpu(env)); - cs->halted = 1; + cpu_halted_set(cs, 1); env->in_pm_state = true; /* The architecture specifies that HDEC interrupts are diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 30aeafa7de..dc6b8d5e9e 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1368,7 +1368,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) @@ -1377,7 +1377,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 263e63cb03..0e423bea69 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8445,7 +8445,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; } @@ -8599,7 +8599,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; } @@ -8791,7 +8791,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)) { if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { return false; } From patchwork Thu Oct 25 14:45:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2817214DE for ; Thu, 25 Oct 2018 15:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 173262BCFC for ; Thu, 25 Oct 2018 15:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 090902BD23; Thu, 25 Oct 2018 15:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8A2A62BCFC for ; Thu, 25 Oct 2018 15:27:13 +0000 (UTC) Received: from localhost ([::1]:55163 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhXU-0006TR-Ne for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:27:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5Q-0004Uf-IL for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv2-00082w-Lf for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:29 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57721) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv1-0007mk-RQ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:27 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3452D2147B; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=rbaMMGAH7U2xbxBW0USgyr/an/7UcZIt4WpZwVHjtac=; b=iiLFW TN468jS5vWcLYYtQ7Mavdf1egmaxlPw2iFPDDjr+JJ7hJwzK9REp5KdZDDmHdi96 4+cqL5ljBeffkyg7VPxFB6adH1Ub3ND0PXtj9KmcQliYlK5ua7EDJFB52KRecStP nPAoet5ei3MjFplQdf/C9/9p6i4034mBXYrDyM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=rbaMMGAH7U2xbxBW0USgyr/an/7Uc ZIt4WpZwVHjtac=; b=j/cp7bpGPiCgO3az5xSG3EK0ATsk/bwgJLaruYo4JOWhx 2NKCmnMN/hz3OI6rEUekj8Iyy70OGHiMveScv+4VPsWNlqiT2blFaFD4qJN20wdU Pd7SdaR4+hBNBQEwh6nzhwZ/20hhbOR+wEPmqLYqcrlSd2E2YmK0OGfoDeZpdMXY YYdgxGrQk2r3Wb060LmfFoH8mhDMR51j6YOMKXfpDP3W8WwGYKVr9nic5ns6BrxC tedtia4tW4z/4ty4HXPamN6rST5WFPg2UmP+v9ROV53fniWQCM6UrrXTJT4acmXg bXZBFf6ij+f5lCDs65qylV/n9Poy/wQMUYj0OPZwA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 81D84E49F7; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:51 -0400 Message-Id: <20181025144644.15464-18-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 18/71] sh4: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 4f825bae5a..57cc363ccc 100644 --- a/target/sh4/op_helper.c +++ b/target/sh4/op_helper.c @@ -105,7 +105,7 @@ void helper_sleep(CPUSH4State *env) { CPUState *cs = CPU(sh_env_get_cpu(env)); - cs->halted = 1; + cpu_halted_set(cs, 1); env->in_sleep = 1; raise_exception(env, EXCP_HLT, 0); } From patchwork Thu Oct 25 14:45:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C8A213A9 for ; Thu, 25 Oct 2018 15:41:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44A0F2BF04 for ; Thu, 25 Oct 2018 15:41:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32B5D2BEE8; Thu, 25 Oct 2018 15:41:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E36F2BE74 for ; Thu, 25 Oct 2018 15:41:48 +0000 (UTC) Received: from localhost ([::1]:55248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhlb-000533-FB for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:41:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5Q-00033X-Il for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv1-00082P-PP for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:29 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:53655) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv1-0007mi-Jr for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:27 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 48EFD21F2A; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=Q0cjcSxd17eDo5qKCMUxbY/JKI5b5MbDGDhBE4TozMk=; b=tY2y2 QokaBWdmivYh1zO9W2nlQTA+boxUwWwxsoZgKXI2nI/coHtjztzhWF3YLMTf0Gf3 C8gxeqt5NIxBw+NJh5JjROWLc43zdsW4YJhEK5+ksMHmYOLsKEOjPTC/LGI+Sawk s2B8ZqlvOXywyCtatg6l38BUmPoRaXS5d4f3Rw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Q0cjcSxd17eDo5qKCMUxbY/JKI5b5 MbDGDhBE4TozMk=; b=b+69x2WnITna7cV/TrVGDMlmG0WRc61oORawypGXYSE6+ RO3BbKurlMhv/CesX8PD7ZNDRvzmzMc2YC+26s5r6V2RCQMYC3ChdIYW39E97mKW 8nuNkZV76KgfYPC0F/qyNKFrkzfkNrQUWaBcq7fE2p/CggeG00zwGcMzV80srwrn hPeaNK37eS+vhifI9qDFeYOTpZMwFv1wMgj2agTEsTIl7TS09uafatdPVMSISToj z1Eon3kvmgeAaBYJnRpOj6I83OtQgAcI+kMcwxcmedxhhaPJTdnK9JdCPiIc9n75 DjvxnJmby4Lb8jr9RoialBP+lTpdIF3/9CUkbnY/Q== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C1778E4A44; Thu, 25 Oct 2018 10:46:49 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:52 -0400 Message-Id: <20181025144644.15464-19-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 19/71] i386: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Eduardo Habkost Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/i386/cpu.h | 2 +- target/i386/cpu.c | 2 +- target/i386/hax-all.c | 4 ++-- target/i386/helper.c | 4 ++-- target/i386/hvf/hvf.c | 8 ++++---- 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, 21 insertions(+), 21 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 730c06f80a..461459520a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1600,7 +1600,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/cpu.c b/target/i386/cpu.c index c88876dfe3..b91d80af0a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4524,7 +4524,7 @@ static void x86_cpu_reset(CPUState *s) /* 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/hax-all.c b/target/i386/hax-all.c index d2e512856b..f095c527e3 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -480,7 +480,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) return 0; } - cpu->halted = 0; + cpu_halted_set(cpu, 0); if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; @@ -557,7 +557,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 e695f8ba7a..a75278f954 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -454,7 +454,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, (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 { @@ -481,7 +481,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, (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 9f52bc413a..fb3b2a26a1 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -500,7 +500,7 @@ void hvf_reset_vcpu(CPUState *cpu) { } hv_vm_sync_tsc(0); - cpu->halted = 0; + cpu_halted_set(cpu, 0); hv_vcpu_invalidate_tlb(cpu->hvf_fd); hv_vcpu_flush(cpu->hvf_fd); } @@ -665,7 +665,7 @@ int hvf_vcpu_exec(CPUState *cpu) int ret = 0; uint64_t rip = 0; - cpu->halted = 0; + cpu_halted_set(cpu, 0); if (hvf_process_events(cpu)) { return EXCP_HLT; @@ -683,7 +683,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; } @@ -717,7 +717,7 @@ int hvf_vcpu_exec(CPUState *cpu) (EFLAGS(env) & 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; } ret = EXCP_INTERRUPT; diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index df8e946fbc..163bbed23f 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) && (EFLAGS(env) & 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); } diff --git a/target/i386/kvm.c b/target/i386/kvm.c index dc4047b02f..d593818cd5 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2650,7 +2650,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; } @@ -3136,7 +3136,7 @@ int kvm_arch_process_async_events(CPUState *cs) env->exception_injected = EXCP12_MCHK; 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; } @@ -3159,7 +3159,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); @@ -3172,7 +3172,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) @@ -3183,7 +3183,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 78f2020ef2..fcd6d833e8 100644 --- a/target/i386/misc_helper.c +++ b/target/i386/misc_helper.c @@ -554,7 +554,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 57e53e1f1f..b9c79ccd99 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -697,7 +697,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(); @@ -857,7 +857,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) { @@ -887,7 +887,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 Thu Oct 25 14:45:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF84513A9 for ; Thu, 25 Oct 2018 15:53:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDCAE2BE9A for ; Thu, 25 Oct 2018 15:53:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1CDA2BEA3; Thu, 25 Oct 2018 15:53:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F0C02BE9A for ; Thu, 25 Oct 2018 15:53:07 +0000 (UTC) Received: from localhost ([::1]:55305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhwY-0008DF-Ja for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:53:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5P-0004FR-DN for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv4-00083w-GY for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:34 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:35949) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv2-0007n0-Nc for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:29 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8AB8021F54; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=TElvHVVaBAyTWuOKpff8akjMw8I8ss/BYo+Gb1S48gM=; b=pCx80 QwLfPwVi9h3uT92FAwgNBiRzbshfkSsLQmiKCUmRD3cPuyvyF22V5S9JmWLuX/cw JP5IYh1orZ93ycdqymHzqC9nf4ze0Wvi8Rfdda1qg656riLY4t+fdAXOeWZbRYFN Yxpxd4u2myFWeqcTN+8yk7DVx/fJanRXJH3BwQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=TElvHVVaBAyTWuOKpff8akjMw8I8s s/BYo+Gb1S48gM=; b=LC2J4HR/l8aoGO6/HE2rKu6+ATF82o/snDFYRfrjSnAZh cR4RZVYts5Opb2WHYcWsMiqRrn6rNB5wMJByXUXPE6nv0e7fVSDfadkydewKtGvM Xam98e2tBJDhOX/qH0nkqxq9h/fNwkFvgbYYTfppHUuRsClsyw/rWIncEnWF1v9Z 0OdYrHxFWyZweExVp+t62BWxFj0VIETLwjBR/FaxOTn2uRBjEms52hO4o5LBQ+Id aGsZE51Q3pRJ0M3YQPZqvMxiFhgOgsj1catwJFe1ALUFTk/uDt/yLlTWgcYWWOET wdwDFPE0ShxQsNw2aYlUPG+O8wpoG2hVfejhrAxxA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 075F1E421C; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:53 -0400 Message-Id: <20181025144644.15464-20-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 20/71] lm32: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Michael Walle , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Michael Walle Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 234d55e056..392634441b 100644 --- a/target/lm32/op_helper.c +++ b/target/lm32/op_helper.c @@ -31,7 +31,7 @@ void HELPER(hlt)(CPULM32State *env) { CPUState *cs = CPU(lm32_env_get_cpu(env)); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } @@ -44,7 +44,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 Thu Oct 25 14:45:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5541913A9 for ; Thu, 25 Oct 2018 15:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43FF82BD1A for ; Thu, 25 Oct 2018 15:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37C5A2BD5E; Thu, 25 Oct 2018 15:35:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7A612BD1A for ; Thu, 25 Oct 2018 15:35:15 +0000 (UTC) Received: from localhost ([::1]:55218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhfG-0006O8-Un for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:35:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5Q-00034O-TU for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv1-00082Z-Qq for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:28 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:33519) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv1-0007mz-MM for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:27 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D8AC221144; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=sJKGL0MiX3+8AkimgLRNsCsnLhgiQbn4zvAe1atYEUA=; b=SbZy1 hpiHlhi+i/5tokz3h3m+nEyCQ7q8y+inEqSOaYGXkC/yUEXwje3tob04drF/efaJ IBTwhr6N0tYlIAtC9l2MPMh7Gu/ueY3u7sAjHldMZ3I4khnh/3LQVw6zMbnSgHNp VVIxibXl+brmhoimLc6P0xlEQqgrj3krqWzyx0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=sJKGL0MiX3+8AkimgLRNsCsnLhgiQ bn4zvAe1atYEUA=; b=XaEqeGyTwlrNKsbokVyyGXJWr0JiQeAaZncOgLl/IxL0m NjsBvZYavoS3we+5XbFBL0DVqKN4p7W41FokgO+Tr47ei6E+Inx60S5mkyixNVVS mi5vy2OmGU9ubFX6ZxR5CJbgc7hccsoaocBGW13oij3tdoX3DKy7RdXt4kw9kqPd UNis86WiBrcH4T/MrTXpmcIE1A/fFDVOm4r32CKN8LCwZQNjAYjC3S2gJk/4B+78 rBNZwumE77rJiajm3bvmgNRquaEGlIt4wjUJb11G7oixax++TIJmFWZZoa9EMsqV ts1XoQwoWmHaWtifAsD4FQ5CWEOy6VzbAG7K6GOJA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 454A3E44D4; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:54 -0400 Message-Id: <20181025144644.15464-21-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 21/71] m68k: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Laurent Vivier Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Laurent Vivier Reviewed-by: Alex Bennée --- 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 8d09ed91c4..61ba1a6dec 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -237,7 +237,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 Thu Oct 25 14:45:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CBA014BB for ; Thu, 25 Oct 2018 15:50:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4992B2BE37 for ; Thu, 25 Oct 2018 15:50:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39AC02BE39; Thu, 25 Oct 2018 15:50:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4AD272BE38 for ; Thu, 25 Oct 2018 15:50:02 +0000 (UTC) Received: from localhost ([::1]:55287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhtZ-0004rl-5x for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:50:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5P-0003ub-3S for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv7-00087k-ES for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:35 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45029) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007qC-Ju for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F405B21607; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=jWqE1vs5KP0lNF/+4MMT/LQ2WZFpx8ZxiZ7qFLkXSVs=; b=YPpZ8 k5V/e9iycCZ6kx9byK28XaqJCfQEU6FhKTqNu3xUf4M1FyCQXlz4rcU3qy2PveMd KcLrrag2I78QKxk53DpIYEWKZ3t7FQo4f6QZYbge7iupLFs4HEe9PICdK6kOdQXA 3XW09W5BdK6ZgKWExAOzmyanZ89LGD0YqetYcE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=jWqE1vs5KP0lNF/+4MMT/LQ2WZFpx 8ZxiZ7qFLkXSVs=; b=sLW2nSH88WsLg6mCpOY0xUmMTcDHx0kG1mf2HTq9993sf 2YRinwn3WzRYDONEK/SDL80JtPofUfGP5QNW4g0J8GeDnA95tq2BavcpsHJeu4rt DrPugSoECCEOLEgiwrxLybDywi6hwiqwWJ+wx5n3Kc8cSqY/lGN3UehVwgSkcvUp xInJBM4LN94/4RPW7fC+7tLVElZ5EwcwEDzptIai43ofNDiA1dv4NGjQoPzKFt6c 8nBmntMKfoZURP3xOBYlo0FOK5bMg2tug64UvmZKR8nwyBwNjwSgZlVEPSCJIDsm PzvIvP6g3VORCKQXSR7lFmT04zzf6CgqelIvLO3pw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 89138E49F7; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:55 -0400 Message-Id: <20181025144644.15464-22-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 22/71] mips: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- hw/mips/cps.c | 2 +- hw/misc/mips_itu.c | 4 ++-- target/mips/kvm.c | 2 +- target/mips/op_helper.c | 8 ++++---- target/mips/translate.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 4285d1964e..a8b27eee78 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -49,7 +49,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 43bbec46cf..7c383939a7 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -162,7 +162,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); } } @@ -172,7 +172,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/kvm.c b/target/mips/kvm.c index 8e72850962..0b177a7577 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -156,7 +156,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 c148b310cd..8904dfa2b4 100644 --- a/target/mips/op_helper.c +++ b/target/mips/op_helper.c @@ -649,7 +649,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) @@ -657,7 +657,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) @@ -674,7 +674,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); } @@ -2519,7 +2519,7 @@ void helper_wait(CPUMIPSState *env) { CPUState *cs = CPU(mips_env_get_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 - no need to recover PC and icount */ diff --git a/target/mips/translate.c b/target/mips/translate.c index ab16cdb911..544e4dc19c 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -25753,7 +25753,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. */ @@ -25761,7 +25761,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 Thu Oct 25 14:45:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F7F514DE for ; Thu, 25 Oct 2018 15:39:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F50B2BD7F for ; Thu, 25 Oct 2018 15:39:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 328BD2BD7D; Thu, 25 Oct 2018 15:39:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4BFB2BD7D for ; Thu, 25 Oct 2018 15:39:27 +0000 (UTC) Received: from localhost ([::1]:55234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhjK-0003Iq-KG for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:39:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5Q-0003Zd-9l for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv3-00083Q-De for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:30 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45927) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv2-0007qD-N8 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:29 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E00A8211A9; Thu, 25 Oct 2018 10:46:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=Caf3nCIG72F1i5Gj1UDPbVI7hvC+w3vIO9qs713D+go=; b=Y49sX NwZPgh8eQGgYs+7RNOYTvL7Ro6QPy4kmyw5lFBMY3ZlzrZ70MQawTZF3khpGSrGl L1Q6LKgSHb+KzVt8wr1e/4QVhHBmXplQqc2dhd7tcE4rRQTG0zV47kCW2E/O9zN6 Wv9RNQ+6Gp5JJUW9S/WSPWMYN7e/yFlYLPYQDA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Caf3nCIG72F1i5Gj1UDPbVI7hvC+w 3vIO9qs713D+go=; b=cfSbBzPHMWATd3j5gbF5L7/o+mGVTzvuSKNMgmQAOgY/+ k04ObZx/7MyK/DEX7r8h0R7/zLT/yudVzqh1RCc0p07CpS9QHsqs2c4VwuqlaplC B2KyJaTrYZTXgqGnRdtInYXDQT5m7ELcQKlO4c9WsEjf2QTJeKbvybYegyjnkMlL 88sn0r8qcVgrYbhQch9c2WVs9k+uN60iAVy6EoZNeuz0Gt6ATKYLn4ZzU4UHIrs7 i1prnLoZzA/P+1ICPbP80JL4BWXic1iVenuRLFBjGE5D4OkgWcE9mxiQtOwRMZY5 Nt7yn3F+KDSgHBDsmejy5578Jwk5ejtgjdn60GeyA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CB52DE421C; Thu, 25 Oct 2018 10:46:50 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:56 -0400 Message-Id: <20181025144644.15464-23-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 23/71] riscv: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , Richard Henderson , Michael Clark , Alistair Francis , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Michael Clark Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: Alistair Francis Reviewed-by: Palmer Dabbelt Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 aec7558e1b..b5c32241dd 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -736,7 +736,7 @@ void helper_wfi(CPURISCVState *env) { CPUState *cs = CPU(riscv_env_get_cpu(env)); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } From patchwork Thu Oct 25 14:45:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E37C13A9 for ; Thu, 25 Oct 2018 15:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A6402BDF9 for ; Thu, 25 Oct 2018 15:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 187F32BDFB; Thu, 25 Oct 2018 15:31:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 715382BDF9 for ; Thu, 25 Oct 2018 15:31:36 +0000 (UTC) Received: from localhost ([::1]:55184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhbi-0002VC-9H for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:31:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-00045Y-3B for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvF-0008CZ-07 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41211) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-0007q8-I5; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9C79D21F4C; Thu, 25 Oct 2018 10:46:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=eBsernVOp/uBRuwqc4jJcY5L+6lj0NdgKMAzV0I9zC8=; b=jbTjq 12CvC7EucOEQsE9AsAy4mLXtC1cwPeDLUKypM0cgRAgBDfR8QTXs/9Un88dzm0hw BpPQkjeUgM5IRftzEe7uUw9xivUGPYpSsPBf8hYy1zsC5KQvCO81FhpEihO1LlAW hF2J1t+J0ER/dMUwry7KmrgsbtdKbKj1ifx2pE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=eBsernVOp/uBRuwqc4jJcY5L+6lj0 NdgKMAzV0I9zC8=; b=QBWhjKBRYvCHO30hoLkh9OEO3t68myTl2ELFSeJwCA4HB UoOXI/Ge9LDYZqb2F4O0zgiIs13lM1tW5O7c58zDz8DoeXVZ7ZqnVQ9BRvie6so5 zDv2DvlmZ9FxFRaaeTeI50HPy5ly+g8tbjg+2qCnjhfH83VPDCqWOjzhkqc4XOSk mfRxPpn7PxjAamcjixKNggll/z13ow18ubEZII6BBH7NQAL47UeaBASH8lhdHq+g 4ofHxRkBLnF7FN1XnPfwcPb0Eu5Joy9fwEvuRkClS+uj8XRWOztabOBSY5/z2+Wt RSbJYner0DQUw3WIA3chPc2mTHzNnPlyMXvitzvUg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 2190BE44D4; Thu, 25 Oct 2018 10:46:51 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:57 -0400 Message-Id: <20181025144644.15464-24-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 24/71] s390x: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , Alexander Graf , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Cornelia Huck Cc: Christian Borntraeger Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 18 +++++++++++------- target/s390x/excp_helper.c | 2 +- target/s390x/kvm.c | 2 +- target/s390x/sigp.c | 8 ++++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 5f8168f0f0..bfb5cf1d07 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -198,7 +198,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 18ba7f85a5..956d4e1d18 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -288,7 +288,7 @@ static void s390_cpu_initfn(Object *obj) CPUS390XState *env = &cpu->env; cs->env_ptr = env; - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; object_property_add(obj, "crash-information", "GuestPanicInformation", s390_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL); @@ -313,8 +313,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) @@ -340,10 +340,12 @@ unsigned int s390_cpu_halt(S390CPU *cpu) CPUState *cs = CPU(cpu); trace_cpu_halt(cs->cpu_index); - if (!cs->halted) { - cs->halted = 1; + 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(); } @@ -353,10 +355,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 2a33222f7e..d22c5b3ce5 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -461,7 +461,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 2ebf26adfe..ffb52888c0 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1005,7 +1005,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 c1f9245797..d410da797a 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))) { si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; } else { set_sigp_status(si, SIGP_STAT_NOT_RUNNING); From patchwork Thu Oct 25 14:45:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A72813A9 for ; Thu, 25 Oct 2018 15:38:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 893922B8F7 for ; Thu, 25 Oct 2018 15:38:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D4EA2B8FC; Thu, 25 Oct 2018 15:38:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E4A8D2B8F7 for ; Thu, 25 Oct 2018 15:38:33 +0000 (UTC) Received: from localhost ([::1]:55225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhiT-0007cE-1A for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:38:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5P-0004Pv-0n for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv8-00088F-7V for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:36 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44321) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007sj-My for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5693F2205C; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=GdJChO6QFX/U3WjsyDMjg5O4nR4qKvkMl6SP4zFAKcI=; b=bAE0I aru912JUBWn1BfX0eSbMop5hAVHFGbmTXvViXffnV+7IWR7uGjKhgRGYn+A5cmGQ GDpI9fVx9tP6bz+opVwTsqX4VwgKO/QgRNMOWKmz/MuQ9KaxcAkiGnU1+qUAqpGt yKlNEY7sIkozkW3C6Uv4LKt4+CvqxK4Yq7ffJg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=GdJChO6QFX/U3WjsyDMjg5O4nR4qK vkMl6SP4zFAKcI=; b=mqFOFHbgHWo7GAkG5dozIC3WQOXjSekgOZXFgLhutJRic 6ou1+t9R8O62Gx/eWpaAICD8zuIUWFgGtcRPOqJ0d5rBca8KNfCAgmo21X6XY58Q g4Yja959RxVDVvObUlC6d/ccHsRVKJErDLYTItzxcD6mXwCyEI4NX0aCYEEPEX+a w5kNQ/RJNhKN0INpwibachb0WJdJjjKdAglGzgdXypsnLj30doDP9hLZ2eKSr8oc fOfONUI+vebxscmhPY4DdYzbHYXpgwkRiXI1oDm4xKw+QTsmG0DZlQ0sXpHlrooO 1ya7FuZSsTn8GTlZLKTrlbgtS121XiaYG6UahzE+g== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 5A34FE4A44; Thu, 25 Oct 2018 10:46:51 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:58 -0400 Message-Id: <20181025144644.15464-25-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 25/71] sparc: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Richard Henderson , Artyom Tarasenko , Fabien Chouteau Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Fabien Chouteau Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 fa98ab8177..0746001f91 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -61,7 +61,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 3c29b68e67..5bd6512b2b 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -168,7 +168,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); } @@ -199,7 +199,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) @@ -208,7 +208,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) @@ -825,7 +825,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 408388945e..372bbd4f5b 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -100,7 +100,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); } @@ -115,7 +115,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 46232788c8..dd00cf7cac 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -245,7 +245,7 @@ void helper_power_down(CPUSPARCState *env) { CPUState *cs = CPU(sparc_env_get_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 Thu Oct 25 14:45:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E40F914DE for ; Thu, 25 Oct 2018 15:36:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2C692BD42 for ; Thu, 25 Oct 2018 15:36:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6D362BD6B; Thu, 25 Oct 2018 15:36:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 28EC52BD42 for ; Thu, 25 Oct 2018 15:36:14 +0000 (UTC) Received: from localhost ([::1]:55209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhgD-0005r9-Ay for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:36:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5P-00045Y-A0 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv6-00087O-PC for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:34 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41823) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007qA-Gy for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0978821F79; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=BjJ9SxwI+cVAMQavi0yFCMgICNrntbIwkLBcT+HHadc=; b=vusL6 5NXEMA2IQ2zv1JiPVl+JMvvye1vKWxWDOv8ZM9p4jBJxI8r9NwZ7z39MXlECxFC6 7EU3giGdn1Qv0ApEA8zjLMZtP0z3C6licyMcMPcBRGqr5ZHv1gZUmYqnJlI5eKLC Qgkh3Gw56YBs0v+PyG8UJZS/ZIyeBXbbQP7CfQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=BjJ9SxwI+cVAMQavi0yFCMgICNrnt bIwkLBcT+HHadc=; b=d5TT9kofQWgrp7qCHqYhWaRd5QCakF+CQCHrrmaFrXoIp Od6FB1Kuwhum58sqDyBh09mnMgyXcfdCLBj1LKgGXyt999cXTrnsQzApAPELL1+P NLHM9rHIpph3K6iLpqPEchJGNPvHofug6Fj1RVg82/gi60/WeBqvvakKFvkTCZn4 U3CjKhpswyPkk4A3jywGO+Gzwr2Ey5JCWN2ej6NmgWcRt+fo6j9995uRf6jcYo6M +wmGTTPQJLaQmCFmZ3qJJJqYoHHleL0uUrzKblnrXBVjBdan13dpvOR8pXXd+1o5 3aVl2CZWC4Zf2RJWFKvOOWN/GBDzSwMkP4GBbv6GA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 90196E4897; Thu, 25 Oct 2018 10:46:51 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:45:59 -0400 Message-Id: <20181025144644.15464-26-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 26/71] xtensa: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Max Filippov Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 2 +- target/xtensa/op_helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index a54dbe4260..d4ca35e6cc 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -86,7 +86,7 @@ static void xtensa_cpu_reset(CPUState *s) #ifndef CONFIG_USER_ONLY reset_mmu(env); - s->halted = env->runstall; + cpu_halted_set(s, env->runstall); #endif } diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 501082f55b..dd6819fbad 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -807,7 +807,7 @@ void xtensa_runstall(CPUXtensaState *env, bool runstall) CPUState *cpu = CPU(xtensa_env_get_cpu(env)); env->runstall = runstall; - cpu->halted = runstall; + cpu_halted_set(cpu, runstall); if (runstall) { cpu_interrupt(cpu, CPU_INTERRUPT_HALT); } else { diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c index e4b42ab3e5..510040b593 100644 --- a/target/xtensa/op_helper.c +++ b/target/xtensa/op_helper.c @@ -414,7 +414,7 @@ void HELPER(waiti)(CPUXtensaState *env, uint32_t pc, uint32_t intlevel) } cpu = CPU(xtensa_env_get_cpu(env)); - cpu->halted = 1; + cpu_halted_set(cpu, 1); HELPER(exception)(env, EXCP_HLT); } From patchwork Thu Oct 25 14:46:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7761413A9 for ; Thu, 25 Oct 2018 15:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 623712BD1A for ; Thu, 25 Oct 2018 15:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F8DC2BD6B; Thu, 25 Oct 2018 15:36:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB2F42BD1A for ; Thu, 25 Oct 2018 15:36:56 +0000 (UTC) Received: from localhost ([::1]:55224 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhgu-0007Yo-2D for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:36:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5P-0004D4-3Y for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv8-000889-6G for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:35 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:59817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007sm-MC for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4500321FF5; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=SCU42ynok0Bx6CV8QLX4WHQuvwoXWSvKN81qJOX0rW8=; b=zUW4+ xiruMNDyvCKOeQP/hL/lFCaOmte8ZnhzvUIZylIKSbvSaOgdYFSUhlr5954VN23X EJv3Y54Drif6QMzMpRHLhApTufcD8myUq5QttgZtqesUNb4NdHD12CcmEBGxhaWm s6urVdgdjM1knuOJ17J9CTkDSdFpROyTjomTKo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=SCU42ynok0Bx6CV8QLX4WHQuvwoXW SvKN81qJOX0rW8=; b=NLVInwK8/xHoJKM3jS+zonUab/icPkrccIKxATa1qRh/7 P3AIDLJD9ycjFhU9qps4b9N2rgsL8N1GJZ8rA4i3P5max7kFwAKckaLQlaoo8Ls6 bvZ1I0elN7jURlpiE7E1mHHFQBUmupVGk30oppP4YMRg2O+NtYWEd0iJgnoNuD+u OGfZgckv9uflUSNUupWVJpBN1A20glwZefR2EWT8Xa26q8ipxKJPJz0WMgQfem2R P5TndVFOcpwEnSByNOJbUIBm6I3wR3vJ6gF9IwKbyUzViVlrCkL8QcNkrAb1jDBd A1cBRa2+JI/fP9Y50PyfX1a5IAecPtVbmrdeVJVKw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C2BD9E44D4; Thu, 25 Oct 2018 10:46:51 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:00 -0400 Message-Id: <20181025144644.15464-27-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 27/71] gdbstub: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbstub.c b/gdbstub.c index c8478de8f5..a5ff50d9e7 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1305,7 +1305,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) /* memtohex() doubles the required space */ len = snprintf((char *)mem_buf, sizeof(buf) / 2, "CPU#%d [%s]", cpu->cpu_index, - cpu->halted ? "halted " : "running"); + cpu_halted(cpu) ? "halted " : "running"); trace_gdbstub_op_extra_info((char *)mem_buf); memtohex(buf, mem_buf, len); put_packet(s, buf); From patchwork Thu Oct 25 14:46:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CD3D14DE for ; Thu, 25 Oct 2018 15:33:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFBFE28744 for ; Thu, 25 Oct 2018 15:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3CE528802; Thu, 25 Oct 2018 15:33:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D414A287C0 for ; Thu, 25 Oct 2018 15:33:35 +0000 (UTC) Received: from localhost ([::1]:55204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhde-00059C-H0 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:33:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5P-0003jm-J2 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv6-00086y-Ie for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:34 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:58389) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007tg-BM for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5696A220FD; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=f4AJke4hU8zkArr13H8uAIke2kfBpG7a7caLX8Nlk3w=; b=dxVeh Wtrm5U1k7wmuz/b1q2uzrR76lc7N1yjA/qyW6P9/ACqEEr16fvx9sPlh6XO2UH1w 4zHbYDJof0zHns67Fj3khu2rs1EjD+jE1wAkxoLgwxGCtWH8PaMR4OAZacc+TA7k ScPrytwNmdMRG8K6+WIQEloKvI4eANNHYmNzYw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=f4AJke4hU8zkArr13H8uAIke2kfBp G7a7caLX8Nlk3w=; b=Yd3M7uF1ahR7dje5gW6nY3ku7THu8496LoUpzOOMJI+E2 li9sLuGSGsFz5MxvxqUFz7blx/NGLCflyu+/UzYfDmH2zrKOVOI2XiG6DU7vwGp4 m/K5jJTdlRyU+a5J+eZFyjxS4ByccBYPcRrNRQUinrAzhIsTvPjq/FV4xEwkcwiw 9U24j6ya08LlHYVSpD2x5owh5OmASaldcEh1gPBKYdL96nUaj48Ehf+MDM3TxZ9p V58qiiJuXuLKBQ0mrJOAhOau1HTN355BK7LZfJRpf/xwRsqX82znFRoO/cvl5n02 zz4z4B5hlIL3agWQK8wVDiAZVqGjrD6JC3fBxsoUQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 13121E421C; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:01 -0400 Message-Id: <20181025144644.15464-28-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 28/71] openrisc: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Stafford Horne Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 b66a45c1e0..ab4d8fb520 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -137,7 +137,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 Thu Oct 25 14:46:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0280A14DE for ; Thu, 25 Oct 2018 15:30:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEB4A2BDB5 for ; Thu, 25 Oct 2018 15:30:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC7622BDB8; Thu, 25 Oct 2018 15:30:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D0BD2BD8B for ; Thu, 25 Oct 2018 15:30:22 +0000 (UTC) Received: from localhost ([::1]:55187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhaX-0002kb-Ld for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:30:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5O-0002yq-Ue for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv9-00088l-3I for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:36 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45015) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007tf-RS for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C2F682212D; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=pKGI5WSbQVpfuaT2ZuF6qCDuoJq+N6ADzw47FzwF3rg=; b=jMqNy JPeFr0sl+rAX6aD4ZGRVt7xhFgEwoWiEEjfLq6yPpJDVm6bmmbHIZibWT/05XyKo CQ/KImPkHy3/mPvfDuzJ+9Z7iCT/WdjtWjlmIMoJ0kTh4iriwfhObLMYv9ts33HW IULq6ZEUPtzPnEbPrhsoU8uXyZ384jrMpB1X+U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=pKGI5WSbQVpfuaT2ZuF6qCDuoJq+N 6ADzw47FzwF3rg=; b=MquXBbJF8JVaj33Qe+bIUZgBZqG2MZhfbhtOlG437GUNc m+3FqOvcaX8NjcbcmZ4beg1XQxnl+qJxJm32YYpjwKiMghlKhyf+8zvJmZc5ZMWa LNJVSgPROEzzAzOKaA2Uxt1mwq6sye+tNsvFHc/ATjmjrqClio8P2yXAcOBSxnSV +SczrMnVJLvNWCLxH3d1b1C8IUOBfaeWc/C68YzHz1GE4mctq4O0xX8fQg4zqLVF jiAbOHuvCQ2RS0hj6YSylygIFkNsPVrJ3suBm+qjiOeRC8gekLxRpccf6YJdYhgq NvQfJlVTKWyt0uKjyA8+3gP5eAQi4sP5EANnmgDZQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4FDF5E4A27; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:02 -0400 Message-Id: <20181025144644.15464-29-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 29/71] cpu-exec: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- accel/tcg/cpu-exec.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 870027d435..f37c9b1e94 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -422,14 +422,20 @@ 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); + + 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(); @@ -439,12 +445,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); @@ -543,7 +559,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 Thu Oct 25 14:46:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D2AB13A9 for ; Thu, 25 Oct 2018 15:56:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEC6A2BC9A for ; Thu, 25 Oct 2018 15:56:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD9732BE89; Thu, 25 Oct 2018 15:56:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B81F2BC9A for ; Thu, 25 Oct 2018 15:56:09 +0000 (UTC) Received: from localhost ([::1]:55314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhzU-0001ER-At for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:56:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5Q-0003lE-6L for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv6-00087C-Lv for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:34 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:50663) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007vB-EW for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:32 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E60EC22137; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=KZhCeTvLVRps+bUvPQFM1RQ9Dv8/N4cypucPU1F0u/Q=; b=bPg3s RLbnlBqqCoV3VqPAOHbp4X20MSUfavHqDa3AgNMUZ4udhHo5/AFJGDH5mGVZ6ZTJ J+P7lX4si/3tMLgv5/pQQ81ApQABuEejUNl9P1pYI5Rx41tlD6s6GaOjfLYHg2AF oB5RAJTVYdEN/ClKWQtkrIWUGG2c0uVFkwBZ+Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=KZhCeTvLVRps+bUvPQFM1RQ9Dv8/N 4cypucPU1F0u/Q=; b=gK6wuCCezlOsJYjHDQx6WD/1+IGoen4yfiAqD3YcaS5k0 wkMWvLG+KB0mjuRzDorfu70lkConEZQoF4vtDd1PobIA5PZNg1TzN2WZT3KypQjF lP2hl1643bQlDxH6Gt+5IUyF/yan4/A0PKWeQIWmf8qfSI7wzls0SlfrcvHxisDN qHqSyCedkYgSXF/glU9GrQo2K/AxthVZYD7fQL9eQReJHqUzYNjd/KUZmI1+YmA7 O117cXC+r6v5zKQ0KIs/ix62QHRIFZmLxXEynCxBAXCSwrPtFcuD9tGR8czaJ44U t8CReKYc5rq5Wv8VF5kNJ7XxuvwRHpNbW9lUf+yCg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 92F41E421C; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:03 -0400 Message-Id: <20181025144644.15464-30-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 30/71] cpu: define cpu_interrupt_request helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- include/qom/cpu.h | 37 +++++++++++++++++++++++++++++++++++++ qom/cpu.c | 27 +++++++++++++++++++++------ 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index aeed63a705..a86690c7a5 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -511,6 +511,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; diff --git a/qom/cpu.c b/qom/cpu.c index bb031a3a6a..ecdf8e7aac 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -98,14 +98,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); } } From patchwork Thu Oct 25 14:46:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8D9014BB for ; Thu, 25 Oct 2018 15:15:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95F1E2BCC7 for ; Thu, 25 Oct 2018 15:15:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89F4A2BCD5; Thu, 25 Oct 2018 15:15:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 252F72BCC7 for ; Thu, 25 Oct 2018 15:15:53 +0000 (UTC) Received: from localhost ([::1]:55112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhMW-0005bX-AP for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:15:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5M-0003lE-HF for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvG-0008F3-Rz for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46869) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvG-0007vD-GY; Thu, 25 Oct 2018 10:47:42 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 050DC22145; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mesmtp; bh=thygt9wEWS7GpGNLcaC1T+Si9cLajuaXwPz2GZHercM=; b=z3qHf3+voBeD 8viRPPS3xME+/2UnrfLtImj+X0yRrzu9UJFgp+ndBxrFq++YaJKc4QpyeK/aLDhk yqykRbszcad0zlQdiK60sXli6K3HBdeIIjX4JSxJfJ8V1ygLaC1W/7QwWLYJY4bu UuHs5vzQoHYnJFRCh43/qWp9Fe2HgQw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=thygt9wEWS7GpGNLcaC1T+Si9cLajuaXwPz2GZHer cM=; b=iR34eVw2KPEULoZP/ihmgmp+fTlnsyDSI5Q50OFPJHs42prvaZoceuTqG osKA5/1pg97rJSPyApkVhQbmgUbocTrDig4J9Fc8EvOfv7WES2zDzZBzFyzrYWR4 /Ef2K9AoTMFuhkA/U4U6ICm+oShIDskZFKMVE4U71jOtgxv5mHLW7XPFkFBhLmd6 tcDfYpCGtdLqWAIWjkKUlFL/uy5V799Efkvlz3Q6iLNTc2J/zE6/stm0mlBmrFVH P8ESNtKIaxeIpFbKjKL4bGluKlhZITPuXdchQ5lMQk/+M87ksA36x1fBj0W3UliB PcB1kcdjc7oL4TNKpT4ndRJY1yZnw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C7441E455F; Thu, 25 Oct 2018 10:46:52 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:04 -0400 Message-Id: <20181025144644.15464-31-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 31/71] ppc: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Acked-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 5e1778584a..737c9c72be 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -880,7 +880,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 Thu Oct 25 14:46:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C371F109C for ; Thu, 25 Oct 2018 16:01:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B24372BEFC for ; Thu, 25 Oct 2018 16:01:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3A602BEFE; Thu, 25 Oct 2018 16:01:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39CAB2BEFC for ; Thu, 25 Oct 2018 16:01:34 +0000 (UTC) Received: from localhost ([::1]:55375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFi4j-0007rZ-B8 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 12:01:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5O-0002yu-Vz for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgv9-00088m-3I for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:36 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41901) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgv6-0007vi-Q9 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 764B02216A; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=RvnHo44h2PUBF9P7ZFTv1E8cqKfIBeBl+enClyvsucI=; b=ct05f H3n/+PEO7LmWOTNTYKZXQK5L9IyRb0E9sOU/bTsMkLn8qXnlvuDJZPe96jPoz49D RiPNZqwEtY8EhJ68bcYE/xC+ChTPBdArV/BoyXturUG8tzh+R5J3+KEqMUHl8ALB dq3iauWBAUpkYEiu+0x9BhXVOiedIf29PyHxzM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=RvnHo44h2PUBF9P7ZFTv1E8cqKfIB eBl+enClyvsucI=; b=lWso6hPJ74DWBzJAxKFatnMD+qISTVwd1PLWCUu4S7Kio T9njT390Av3x4vaLDXuu/3KAW2Nv2t7t6yGJO2KHNFZCjAqebC4vDFTyyhMMtGUO BA1ll4E3PO5cBKBKBmvWFB0+th16I27YDaF4ti2eJ1XTq2Tz5RFuRbxLwuA3YFk4 i0jbTqlOEich4SHrE3quf5zS9AMYtfFRp7OnvKzDQWey1VsJ/Kr5B/zRMIUs1gNv ttJjXghaX0E8zl29oEUELUKIla/gtkdJl3XsC03sWLdWaO6c6e2M3ItaWI0vO/ot elQybMZ2I6Zebgtfz1sdMjxexGVy+6aUfNHcPlPOQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 055C0E421C; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:05 -0400 Message-Id: <20181025144644.15464-32-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 32/71] exec: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 4fd831ef06..cd171adb93 100644 --- a/exec.c +++ b/exec.c @@ -776,7 +776,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 Thu Oct 25 14:46:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EC2213A4 for ; Thu, 25 Oct 2018 15:24:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C8282BD11 for ; Thu, 25 Oct 2018 15:24:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F72B2BD1A; Thu, 25 Oct 2018 15:24:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 89AD92BD11 for ; Thu, 25 Oct 2018 15:24:07 +0000 (UTC) Received: from localhost ([::1]:55151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhUU-0005B8-Ra for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:24:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-00033X-Um for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008BT-Cp for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:40507) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-0007xN-3j for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B8F4121FC6; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=/uMY2tdZHjsHMc6ia7KhFvOZ6x7l0YfqvfZ74nUcZOw=; b=FpuQm SCuxSZy9KOnwdhVdlpVTzPIhp6hzu1A9BGDqcjem5TSiCrhOeDumQGh3Pru2q8Gm vcoBfCCd5z/qYw7pG+PZ8/wa+z9BK9BJ+WtkhA6UxFrkd0A1cdipe4qeOrMmsXEt sphPFin77Pwt9fSfQ3V0j14+QIgyJiKTgf05Rc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=/uMY2tdZHjsHMc6ia7KhFvOZ6x7l0 YfqvfZ74nUcZOw=; b=V+tZimoWtCOHGMPh3HHhUQurAxkrLCCNCWizn7MuvnakV evjhT6Nq917YN8FAeQNrI/+kNDOsHTD47QEKdhsZ2hZ1TSJnt8xnbOApzvrzLmFc Zc9S10+yEn++sR/X2vRrsilVyX8hrq/dH0R98xn3LZu4zCJbTSJjg0gudsgHpPMP T3Yuim0PaIOwnZhZjt4gwLtd27YqXlSZn/Umdc/uigXjGXI7OBjCl5BCHeNWf4w/ gGFQmuJMS40bm43Qxr8FB/8Yzu9I/h9f/aZ9A37X/npf/OqldPh3U65tdsl68mPZ QQSN3W5PlKZ1LDg0AVdJDYny52eV8VhB3/JV1qUVw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3F16CE4A27; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:06 -0400 Message-Id: <20181025144644.15464-33-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 33/71] i386: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 f095c527e3..8b53a9708f 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -433,7 +433,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); } } @@ -483,7 +483,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) cpu_halted_set(cpu, 0); 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 163bbed23f..e8b13ed534 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 | NMI_VEC; 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) && (EFLAGS(env) & 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 d593818cd5..effaf87f01 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2709,7 +2709,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; @@ -3005,7 +3005,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); @@ -3016,7 +3016,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); @@ -3052,7 +3052,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; @@ -3123,7 +3123,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); @@ -3153,7 +3153,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) && @@ -3166,7 +3166,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 33714bc6e1..ac5497de79 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 9fd22a883b..a6d33e55d8 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 b9c79ccd99..9673bdc219 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -728,14 +728,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); } } @@ -758,7 +758,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; @@ -850,7 +850,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); } @@ -868,7 +868,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); if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); } From patchwork Thu Oct 25 14:46:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DB6314BB for ; Thu, 25 Oct 2018 15:23:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03FF2BD20 for ; Thu, 25 Oct 2018 15:23:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E42E32BD53; Thu, 25 Oct 2018 15:23:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6FFDA2BD5E for ; Thu, 25 Oct 2018 15:23:00 +0000 (UTC) Received: from localhost ([::1]:55146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhTP-0004D4-DD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:22:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5M-0003jm-FV for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvG-0008FB-TI for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57417) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvG-0007vj-JQ; Thu, 25 Oct 2018 10:47:42 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B634421F73; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=bAFXo0PUzlKlFbkIVcQJwQ54XN5aVUezLjLrEoweLnE=; b=xt0xW HVfS511una3eb0nuuuGR+hb1K+UUgnQ92MyQEmCLX9PHn30SrqdFF2ZgYeEW9ZQX z/h4rWkQztYtpjc+pxzeRLxR4/gVNewG0GVcEl/gwzN5+6RHB+boXM9YqvPx4cZu Gt+Ek9ObcgqFgv2IjYX2xDWeshbCIY3Zf3OTS0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=bAFXo0PUzlKlFbkIVcQJwQ54XN5aV UezLjLrEoweLnE=; b=kdtW9r7jiuyP91m1TSGezLamjJL5zqevOIpDQuYePUZYF R2I5sXnpoL+AEeL8DZLZVCZfUd0jpcsSNQfpAYy0pKU4COz3/zao3E7nJDotjCkr cXESaB2GC2EcwGUzjF2H1boh4zMZ6YZpO68xVRfgKSBfK1a+TrhqAdBNZh+rXtNJ bO6gs2Jjm+f0HtqnQy4BRcIF4X5UgfDjozXyQm5Kj8wwDqdftlwZs772w3bwrma7 i+bNDe0UCF6nm/tW8aR2QmRFTuLroFFdjbgQxvOpCNpy/sakjbGqN597TzQdX+4i gvUaS1kdH5pn99TpeNNQL2qv9jtedFqDo+vmBunLQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 80942E4A44; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:07 -0400 Message-Id: <20181025144644.15464-34-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 34/71] s390x: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , Alexander Graf , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Cc: Cornelia Huck Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 d22c5b3ce5..7ca50b3df6 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -454,7 +454,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 Thu Oct 25 14:46:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 422E013A9 for ; Thu, 25 Oct 2018 15:32:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3092F2BD60 for ; Thu, 25 Oct 2018 15:32:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23FB32BD71; Thu, 25 Oct 2018 15:32:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 03C782BD60 for ; Thu, 25 Oct 2018 15:32:52 +0000 (UTC) Received: from localhost ([::1]:55201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhcx-0004cK-Qp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:32:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5O-0003jm-8R for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008BF-3B for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46155) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvD-0007xP-2j for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:39 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2628B22155; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mesmtp; bh=cTCoP8n75h7KKNdyvq0ZAwRiA7+Lx/slTwSffoSedTY=; b=mIsZKegrUrv2 MymnGh62ctZpN15F527XmROVHV4CAsMPahnicT/EiF4QUFnr4QYxYWhi9Xk3LoBN ZkEUMe3grvyQ6+9CWZfY1RUwSIAxkfOV2BNdbkPlzu42dvEr4l6OV2qmU6ViqZbj PgzKxVNEIsNywxz2xLKaxabFzhKzc3o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=cTCoP8n75h7KKNdyvq0ZAwRiA7+Lx/slTwSffoSed TY=; b=EPf9Bq2f1jbtIyYgySzLfaQe24TwIGzjcrEZxCjFQE1krET7IcthB+7Bn 6xWEKs0tyz8TNiTiwg0Sxk4kRXT8J+ui+P2s93pZ/gJgVtENLN/FrJSHvu7C4foM ETPMhjOwdmASFGnt8Cmh4XsKzsUepKBO8sqtEEyUN5jEZG07LKq7YxDLEbBMRsyu m7xaFSLT7MbsPrBKfoNdLCpt5PKbMpmWYQsSxt1i2Bby8v2M7N7xSfmCzOdwK5X3 TISTcZkOsLiKmL5McY4DEPUmeihko16Eiu7MS2hJeG1/k4JxpnM9KYZVAtnEKBpF z4mYjcuYc9INn/x46MXp2IICqFTEg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B7677E421C; Thu, 25 Oct 2018 10:46:53 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:08 -0400 Message-Id: <20181025144644.15464-35-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 35/71] openrisc: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Cc: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 ab4d8fb520..c645cc896d 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -170,7 +170,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 Thu Oct 25 14:46:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B6FD15A7 for ; Thu, 25 Oct 2018 15:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49CE12BC51 for ; Thu, 25 Oct 2018 15:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 387492BC71; Thu, 25 Oct 2018 15:06:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B5BF22BC51 for ; Thu, 25 Oct 2018 15:06:28 +0000 (UTC) Received: from localhost ([::1]:55064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhDP-0004a2-Dq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:06:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5I-0002yq-St for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008R6-UD for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:52 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52989) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvN-00082R-Mh; Thu, 25 Oct 2018 10:47:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8870F21F2B; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=VbIEip8n9oE+z5PTq8aYajVjwOcR/rBLjOQFjrUxMo0=; b=rRwfa ar3pbSTuskoLIePGUnZiDcLexPDdbbRwUvbmhvQR6h7kqmhiYxlyX9XsWa4UyiQT g186bBJdLvYigoFPt9sfDW7J6M2+kVIzrevZdpDEYPCxiezEzyfpMxVJ0K9htqQZ q3jvbAZNjKl9R4kNp1SIMy+GiCKWtqg2YdWoUU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=VbIEip8n9oE+z5PTq8aYajVjwOcR/ rBLjOQFjrUxMo0=; b=TZz+DYp76UgpX7BOlaZdW8BlgJjQcnpRv6Jg1mHFb4+DS ULDWpMOasX3HhAjlaBduehv/LcZuy54nzAKGxrAJjDVWeY11l5IOSH5qWGyOnEMv 5ArX4RGye/NBiV6QkerB26w/DjOtP7rxKObrvNfx2xESYAkxbovEyVStfHdgxDei DtPJ45STBiog8mCVVmiPTMd1Pja6SZs28eHpCT3V7lhpeNfbwz3/DmtDidzONwVN XUeKgB9J8ptjlIDGI0VlZWQcpixp3S2nTcwv73c+vLotvGgU9sq4bz25frMNCfQA BzYC9CgR+pW+RnTjaz9ltr8D8u1iVd2hS5ziEtxOg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0DF50E4A44; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:09 -0400 Message-Id: <20181025144644.15464-36-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 36/71] arm: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-arm@nongnu.org, Richard Henderson , Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- target/arm/cpu.c | 2 +- target/arm/helper.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9c5cda8eb7..7330c2dae1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -49,7 +49,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); diff --git a/target/arm/helper.c b/target/arm/helper.c index c83f7c1109..454954a56c 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1294,11 +1294,12 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) { CPUState *cs = ENV_GET_CPU(env); uint64_t ret = 0; + uint32_t interrupt_request = cpu_interrupt_request(cs); - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { ret |= CPSR_I; } - if (cs->interrupt_request & CPU_INTERRUPT_FIQ) { + if (interrupt_request & CPU_INTERRUPT_FIQ) { ret |= CPSR_F; } /* External aborts are not possible in QEMU so A bit is always clear */ @@ -8579,10 +8580,7 @@ void arm_cpu_do_interrupt(CPUState *cs) return; } - /* 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); @@ -8597,7 +8595,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); } } From patchwork Thu Oct 25 14:46:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DEDE109C for ; Thu, 25 Oct 2018 15:43:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29CD22BDDB for ; Thu, 25 Oct 2018 15:43:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A4692BDE2; Thu, 25 Oct 2018 15:43:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AAFC42BDDB for ; Thu, 25 Oct 2018 15:43:51 +0000 (UTC) Received: from localhost ([::1]:55257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhna-0007rl-Vu for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:43:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5O-0003Zd-SD for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008Bv-IN for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60993) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-00082T-4W for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BB6E021F39; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=LkSJ+Pc3IQgYpmUwb1GtyHHMU0UvHwoGMk5kGmn/Cw8=; b=bnYJw Ck1QjshnbllO8vOjDX/wdQPSRRDsgKuLqlgZ3mX8kiv31GbKEAckqEJeCNYeVRl7 jr0mcgpXGccyIoPHFQ+ch0VVB7gkzyOyanlLktEkghC44b8x46jzFV8iRdufSkcT V/rI4peVlFtGh7dEbm/pIs0kbTkcF+lOEfIgvg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=LkSJ+Pc3IQgYpmUwb1GtyHHMU0UvH woGMk5kGmn/Cw8=; b=beya7Y61JGpG/e0Gx0uChGsh3W4ZBl4s32ytVwNfwQu/9 qu10irul1uQbTF/N+0SVuIke+ytXtiGE62HtLd2T8cQs0WY2TzltefLGSNGJUWir Mp+wzwwhBEuquVl0hc+YMNumBVsI3P8cURHbY2aIq1zeyRiGp6SNjcwSsmdE+iHo ANteu+f0/sh9B7nq4Spa+WQL8czxO/Y7Xgbf/ty8RTDJiuRPG4+ZpyaiC6uTERGj 7FaidyRYypgbaNsIoYzZbJ2wgRrvL5DvcCUIizyH8dj4fmqiDiCpR5ZUgXhuvh6J 35Z3hE56a9YsUUodgzmQWzVHt0SpiRDVpuoO5rtyg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 57F43E421C; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:10 -0400 Message-Id: <20181025144644.15464-37-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 37/71] i386: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 b91d80af0a..9eaf3274b2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5473,7 +5473,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 a75278f954..9197fb4edc 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -1035,12 +1035,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 a6d33e55d8..ebf3643ba7 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 = CPU(x86_env_get_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 Thu Oct 25 14:46:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCB3F1751 for ; Thu, 25 Oct 2018 15:40:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C82342BE2F for ; Thu, 25 Oct 2018 15:40:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4F212BE52; Thu, 25 Oct 2018 15:40:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 198A22BE4D for ; Thu, 25 Oct 2018 15:40:43 +0000 (UTC) Received: from localhost ([::1]:55233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhkY-00038D-Bp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:40:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-0003lE-Pl for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008BZ-DT for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41141) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-00082e-2w for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0D12D218C9; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=UGaukA0X7GFLovxOakYhYqkopkP9PEJPFpWeyYcWDco=; b=HjScf C1SD+SIx0la6v7YOKBsCpgbywLEKGDp/smWXWqS9ABixmiTdtVTj7n85WjCBHRaF gTwHGPTSD2GqaCkg9FDNSZwNSXgrCshIPkvVqg2ssgj0rrCftZZeA/frzUYoGILC IOlJ7mX//2O0MBTo7p8EuZap0BECW5TjWBdG3Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=UGaukA0X7GFLovxOakYhYqkopkP9P EJPFpWeyYcWDco=; b=tPklmAUnQc2f+PP3Iwc+XeqJ7reGvM/sziBaY80ArXoYO X8M+jA0KLgfpT4nvhen1/0VxZgnIijEVlr1oGTB3Fh4QTqJPp3PDcnwc8fcOZG7K 7FNhGrHZlSQt76qAp8aze7jOl0b0ZGPWFJwEssZSWpArjuRhrA60PWBMZengD92e 3Otp4aYW8FYe0wt5HU2rOJtBdEBSJ1eziEv8jQUSfq/kTTS+Cf6TPfrstLhNBrh5 LxIYouF4Fie+p/8+BO/vNGCsRIBpx9V4XeCdoDz+YgUtYX5H8LsfHuQfFfogC9pm D6gD/eLI1YLLnf0VeJktDmFUqRuE3eDOxibgxw7vQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8E7E1E44D4; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:11 -0400 Message-Id: <20181025144644.15464-38-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 38/71] i386/kvm: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/i386/kvm.c | 54 +++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index effaf87f01..f4b96d6963 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2704,11 +2704,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. */ @@ -2999,14 +3002,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) { @@ -3014,10 +3017,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) { @@ -3031,16 +3032,18 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) qemu_mutex_lock_iothread(); } + 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; } } @@ -3048,7 +3051,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; @@ -3072,7 +3075,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; @@ -3118,8 +3121,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); @@ -3142,7 +3146,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); @@ -3152,20 +3156,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, @@ -3179,10 +3184,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 Thu Oct 25 14:46:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA33013A4 for ; Thu, 25 Oct 2018 15:58:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3502B9A4 for ; Thu, 25 Oct 2018 15:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F3F52B9A8; Thu, 25 Oct 2018 15:58:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D408B2B9A4 for ; Thu, 25 Oct 2018 15:58:39 +0000 (UTC) Received: from localhost ([::1]:55349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFi1u-000565-Vr for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:58:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-0004D4-Ah for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008Bf-EG for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52279) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-00082d-3T for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1FCA922163; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=SVkaCWk56ReBiucBMaKYpDNx5EIQlyeNrBKgNX/4KRc=; b=PdE7F 7rVbzW22XM4TQBdJnR4C9wBbteFyr+pZJlA5o318JNKVe2fQxOH60i/VctRW4TdZ QINFkQ7Vy68kOMrVaystzcnDu5fswn7aJPuO2MHEH8FdpmaVJMEv2g5pRIJqd69l ljTW8gnepbm/b+YHTcKZzA+EtUS74LlWNT7AfI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=SVkaCWk56ReBiucBMaKYpDNx5EIQl yeNrBKgNX/4KRc=; b=I21cvfGHxQVEOslLixLZiX1UoWVD6sJNpO6DBgDC7ZZvH 44NQUVrMbkCasQgBOSoREMBMQpeXSMdthFIhRpwtuHt1vnyB/BmIvMfg/T4bRf+U FgA4MyRnuzzTNxqaeUDFdRepv8cXNFV/prWZZYMpEhmCX3IodWsZ6dVLK325ahqi 2iGNS+6vmPHdhJXTNv87tsE9Vsv9aNRmgbE7Wbuz2O4yo3a7GuU9TwXkS+2lxTHZ vLrQrtFh3Pg5BVQ78mgNZZkPz+SA95YxU7256ztOliiv2sYvj7/Tzphd/LoZKy5y 47LXmqPbXIIB0KVtyT3MAJZjM07hrkpd9EXkuJ5xw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C7E44E421C; Thu, 25 Oct 2018 10:46:54 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:12 -0400 Message-Id: <20181025144644.15464-39-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 39/71] i386/hax-all: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/i386/hax-all.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index 8b53a9708f..70cea8b1a1 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -293,7 +293,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); @@ -427,7 +427,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); @@ -441,7 +441,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; @@ -482,19 +482,19 @@ static int hax_vcpu_hax_exec(CPUArchState *env) cpu_halted_set(cpu, 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); } - 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); @@ -553,13 +553,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 Thu Oct 25 14:46:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F8D714BB for ; Thu, 25 Oct 2018 15:26:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DC692BD00 for ; Thu, 25 Oct 2018 15:26:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F072BD25; Thu, 25 Oct 2018 15:26:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0BE12BD00 for ; Thu, 25 Oct 2018 15:26:17 +0000 (UTC) Received: from localhost ([::1]:55167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhWb-0006qd-3v for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:26:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5M-0003Zd-Kk for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008CS-VY for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:43393) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-000830-Hp for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 884122073F; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=eSIPjHNrOz/wheVMU2B399XBknscTgNgCYpzt4fx/Dg=; b=L/uxs m5zWXx6JrsTAJZZ/RCUBU+nXXk1j+K9FinT/g86r+nN2AkAVII0xMFNE/Xmsm+zw irF6eTPOaptn2+dYOyaHHD/ebPjE03p4Unj9IhiqnO6TNq4VUfoUl8b28kKZT4LN VZc+LV3Te5j9kvjiAvbVF2kj7oeJxH+dl1ON+w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=eSIPjHNrOz/wheVMU2B399XBknscT gNgCYpzt4fx/Dg=; b=Q+gcDafFujRNvEwrOK6GV/mZuU2Zub9Ti9Rn53fCT0RhE k/louW8V+Ps6Js4Q+oop0mwZdYs9TGi0xC8o3ygaDC8tEaxyfSbP07VTaLnqNkB3 n02jU8SrVRNLI/BWCfA/QTEBX7WrTW45SpbLeu5yPPSEGf+G9kyL7fCb2VZrVlNH j6rqf9x4Xpk6MQx3vffvcxPztEEkdWPZIaoav8NjYohYS+X0bdZIVmLy4E9a5EuM G2Etdwa5OzeDkE/Hgs4UavnDL59ToIAUS/2si5OXr0qqiav0+fnR0R0WhtVAnC0n Kw4ppZxFJkWG4mYTLOCmFRXPGfyt6ehAVrVurZCGQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B66EE4A45; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:13 -0400 Message-Id: <20181025144644.15464-40-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 40/71] i386/whpx-all: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 9673bdc219..0d8cfa3a19 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -690,12 +690,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; @@ -713,6 +715,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; @@ -724,17 +727,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); } } @@ -743,12 +748,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; } } @@ -757,7 +762,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) { @@ -787,7 +792,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; @@ -840,8 +845,9 @@ 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)) { do_cpu_init(x86_cpu); @@ -849,25 +855,26 @@ static void whpx_vcpu_process_async_events(CPUState *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) { if (!cpu->vcpu_dirty) { whpx_get_registers(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); if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); @@ -1350,7 +1357,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 Thu Oct 25 14:46:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C924F14BB for ; Thu, 25 Oct 2018 15:29:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B852F2BD42 for ; Thu, 25 Oct 2018 15:29:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA0482BD4B; Thu, 25 Oct 2018 15:29:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 248092BD42 for ; Thu, 25 Oct 2018 15:29:36 +0000 (UTC) Received: from localhost ([::1]:55181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhZn-0002BM-Fn for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:29:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-0003ub-5s for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvE-0008CM-UK for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:54609) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvE-000831-HF for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:40 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A165A2217B; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=F1C1y1D+bXlrjAliTOwx0Yc2JvI1Jzd1YkIseZzhoIc=; b=ZZh39 Gxed/7eQkcqoFq7zy3MsrHB2CK75l0Gpr+Y/mkM4t12YV0dDbiBZkc5ipfE32M7I asBVVdTNi3fYbS37shTmnexutj5ZVvVFc3efvxUMgp/klaI9msssf7BHUfM30eOl lJYdcvm/8Ahtwpg/7B6/AVN0pUhxOHrgwP5kK8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=F1C1y1D+bXlrjAliTOwx0Yc2JvI1J zd1YkIseZzhoIc=; b=MxbubTK+Ez73S573UGvA3WjDUCJa4XwGQKYsP0Cv1jVif O0T28yT7UFV858WXKc7lw+pTHMYG4eU4c/2BZWAauNXttxoz1EO0WC415mymuucy u8Yf6CH6Mj++sWZJcYPqIbYXCyTtVIpZlaANG5JmgpdYSMj2EgeAzSA5bcXf+lHH VX21mw6hAee0AUtjn/r5o7dLyeZmwrta9PSs6DufiWSzbUIeoJrjWH74hI8nejPY rZc+26mYx+yDi4WE8Kc5iLIBPoXoHWpqK3BQ4s6X4+NRSXecYzmISikKSfKGwBN9 yjMl5fqIj4g4vqFOcL+pb3bTVcl8Bw1Sxf3+k2eYQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4D926E421C; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:14 -0400 Message-Id: <20181025144644.15464-41-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 41/71] i386/hvf: convert to cpu_request_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 fb3b2a26a1..da789117c8 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -250,7 +250,7 @@ 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); } @@ -712,10 +712,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) && (EFLAGS(env) & 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 e8b13ed534..91feafeedc 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -358,6 +358,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 | NMI_VEC; @@ -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) && (EFLAGS(env) & 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; EFLAGS(env) = 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) && (EFLAGS(env) & 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 Thu Oct 25 14:46:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F14214BB for ; Thu, 25 Oct 2018 15:11:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39B762BCFA for ; Thu, 25 Oct 2018 15:11:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35A512BD3D; Thu, 25 Oct 2018 15:11:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71FED2BD1D for ; Thu, 25 Oct 2018 15:11:15 +0000 (UTC) Received: from localhost ([::1]:55086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhI2-0000iM-Ij for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:11:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-00033X-CO for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvO-0008OK-Th for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:58765) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-00083U-Oo; Thu, 25 Oct 2018 10:47:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EEA68215F2; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=V8eTiHBHT3E6vTv1+8ikQOfgThXRB7I8ksTW4dgye3g=; b=CXY8M vL2PJN0VE/3wXTUHHJL6/QWBom4S3rPBIwlvthUhwQ1Oz7oUITkG52GSAYP0nqiB ilmdlhRgfSxABJWtH04GN5UZg4mHDmG/aV9QbP+ps3Mvc9F2kydKUvRYA4mhTgro 1hUwpXHkZa01X1JMg8q3qWRe7glx9swcCg7ZVA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=V8eTiHBHT3E6vTv1+8ikQOfgThXRB 7I8ksTW4dgye3g=; b=xuHvQhIp7vXSW2kUDUK6T2kncdnc9BH1KNZ9beGIEs8HQ kxU3amMZ14JQYU2nyCRa5JiOOos/vdZov+3b1DKo56wytxj4vzLFJWEPwJCwXS+Z o7HJDZX58EeXauSLSQ9/zHeCLf3GFC9W+6iv+VIw8Gka1WiB8KGfJyPRgbU8t7AE 7B78E774QrChxCAglJA8UqU1VJWAiin55zIdCDf3X5G0AUnXn0V3MvxnCIepyYF+ r/rmAKH4KDt7WtlMe8oEcoMWzGbTzMZSlx1kHgBhJvMZADjc2KI5trKUPcwVHPtt zRMfFvSyHSgOOzeFKXMP88iUSAB3kwUJXj/uff41A== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 844EBE455F; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:15 -0400 Message-Id: <20181025144644.15464-42-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 42/71] ppc: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- hw/ppc/ppc.c | 2 +- target/ppc/excp_helper.c | 2 +- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index d1a5a0b877..bc1cefa13f 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -91,7 +91,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/ppc/excp_helper.c b/target/ppc/excp_helper.c index 737c9c72be..75a434f46b 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -753,7 +753,7 @@ static void ppc_hw_interrupt(CPUPPCState *env) qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n", __func__, env, env->pending_interrupts, - cs->interrupt_request, (int)msr_me, (int)msr_ee); + cpu_interrupt_request(cs), (int)msr_me, (int)msr_ee); #endif /* External reset */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index dc6b8d5e9e..438e30b6cb 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1334,7 +1334,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) * interrupt, reset, etc) in PPC-specific env->irq_input_state. */ if (!cap_interrupt_level && run->ready_for_interrupt_injection && - (cs->interrupt_request & CPU_INTERRUPT_HARD) && + (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (env->irq_input_state & (1<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 0e423bea69..6827db14b6 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8446,7 +8446,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)) && @@ -8470,7 +8470,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); } } @@ -8600,7 +8600,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)) && @@ -8632,7 +8632,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); } } @@ -8792,7 +8792,7 @@ static bool cpu_has_work_POWER9(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; } /* External Exception */ @@ -8825,7 +8825,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); } } @@ -10236,7 +10236,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); } /* CPUClass::reset() */ From patchwork Thu Oct 25 14:46:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA56814BB for ; Thu, 25 Oct 2018 15:19:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAB312BCF6 for ; Thu, 25 Oct 2018 15:19:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BED172BCF9; Thu, 25 Oct 2018 15:19:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5808A2BCF6 for ; Thu, 25 Oct 2018 15:19:22 +0000 (UTC) Received: from localhost ([::1]:55126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhPt-0000oh-J5 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:19:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5M-00033X-Ib for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvG-0008En-Mv for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:33787) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvG-00083V-Bs for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 408AA2212E; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=Gad76qe9zYYxX+qeTsSYzj1/mDJ9G8rbgS5HE2LQ9M4=; b=RZNHJ Bxgo4mIwJkuFYKIb86olq67x/AG4aRFXjrhy2v7vXkZz3hcw0dQbWcKEr4tGe+RS PjnSabH6V3ZOMfYzymsQl0aU3bEtyv3MCkpZbKUt8i7cy7vA/aqd7zLKci9FEcmj Y8+pcUq1M1xM/QhFpEVugPD+FxwABLuvqBe6jg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Gad76qe9zYYxX+qeTsSYzj1/mDJ9G 8rbgS5HE2LQ9M4=; b=xZiwSZ40XPXYu2ePu3OJxPO7YyfzRFy2zcVhezGQzVGey M6Zja81HA6mEj4KhnmGMen8NarIV9c2YVyfZt6OX+q97mKLNxEfqC6UK34TFbzD/ lFBdPlagKO6OSWo3Cm6JZQHK1BPJ0OMZAwo4i+AHKYjK0wm+LjFEDs41e3YcBlGO TqhUGX8Qi0Be+ifPapdvQckRLJixda/RIH1qiRkdhjyOyckpR+sTEa9HBMCyKxVi D1tu4WYYrhCIDgoSdGe3YOxjx5RAck9lZuBJsxO9WfqcQIwX5fJj/hDjBNdbIVrx wWcLxDANsSAeMBaNsJ4p70vQT5/GCrRLCqTGMMlrg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id BD3E0E421C; Thu, 25 Oct 2018 10:46:55 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:16 -0400 Message-Id: <20181025144644.15464-43-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 43/71] sh4: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 b9f393b7c7..58ea212f53 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -45,7 +45,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; } /* CPUClass::reset() */ diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 2ff0cf4060..8463da5bc8 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -83,7 +83,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 Thu Oct 25 14:46:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A4BD14DE for ; Thu, 25 Oct 2018 15:30:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ABFD2BDA6 for ; Thu, 25 Oct 2018 15:30:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5968A2BDD1; Thu, 25 Oct 2018 15:30:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9D6B2BDAB for ; Thu, 25 Oct 2018 15:30:49 +0000 (UTC) Received: from localhost ([::1]:55191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhaz-0003BM-2l for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:30:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-0002yu-7g for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvF-0008DV-Dp for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:51317) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvF-000841-4y for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:41 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 71AA7217CF; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=zWP/21BaY7MIREr+KYoX7SbJbxGzKDSUKOw/9yMN8Ik=; b=KJlqS 0iO/XmkuidVRKBwnsMI/KR4kdnZ8zDqLzqgwY2vsWYKAzZcvHxB8yG3dCOziN+ur gJLX97ThnQ7E6MQ0R8o5LxGRPObiOsH5Pqm3Oo96hJ/SjQPcvOrE9rxGD7Og+S+C hMqD5j9jDNFHXiNEva0O7kJqXoiCruZPi8Zd1U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=zWP/21BaY7MIREr+KYoX7SbJbxGzK DSUKOw/9yMN8Ik=; b=oDRU9ls9HO1ZQoQ7+eI2uTtPtdWT5occiXhuGusgZbTQi HbgVjhM+Xi5VsF/81w4X5ltU9ceaV/LC/QK8bhR3qMpild6nRFXaCNvoWby+Y8kF gcJvYClL/vgUqiyov0lCUhv/L/FzSxUc5HysGcCX7z5gllkSqMgYYLagK2OHQZDP Y//17Dng8AKedM8LP3SiCBtVaJYG1nUFSu+X4ls3ee9Pf2yDvHdNyFySf/Q6SJhF LO2BiUfAf6/iqU9/gYkQ58AquE+2VvaNGriMuIFiVFQMhISUZO0AdxA5iNcDkOge lzIZSdziqXWXQ6AbO1fzfdh8+kFsbJoQyOAQi+Lcw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0847EE44D4; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:17 -0400 Message-Id: <20181025144644.15464-44-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 44/71] cris: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/cris/cpu.c | 2 +- target/cris/helper.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/cris/cpu.c b/target/cris/cpu.c index a23aba2688..3cdba581e6 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); } /* CPUClass::reset() */ diff --git a/target/cris/helper.c b/target/cris/helper.c index d2ec349191..e3fa19363f 100644 --- a/target/cris/helper.c +++ b/target/cris/helper.c @@ -116,7 +116,7 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, if (r > 0) { qemu_log_mask(CPU_LOG_MMU, "%s returns %d irqreq=%x addr=%" VADDR_PRIx " phy=%x vec=%x" - " pc=%x\n", __func__, r, cs->interrupt_request, address, + " pc=%x\n", __func__, r, cpu_interrupt_request(cs), address, res.phy, res.bf_vec, env->pc); } return r; @@ -130,7 +130,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. */ @@ -192,7 +192,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 Thu Oct 25 14:46:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 274DC13A4 for ; Thu, 25 Oct 2018 15:19:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F832BCF6 for ; Thu, 25 Oct 2018 15:19:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B80C2BCF9; Thu, 25 Oct 2018 15:19:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 962D32BCF6 for ; Thu, 25 Oct 2018 15:19:17 +0000 (UTC) Received: from localhost ([::1]:55125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhPo-0000iW-O9 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:19:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5N-0004Pv-5M for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvG-0008ER-D9 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:59559) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvG-000840-3C for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:42 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 96D0621C5C; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=bqBHJQ4l6vnW/AIp0ZVvdL6OZsoSoj/iVYInamjYQ4c=; b=Fbf5Y u5k7f5jvGcWq8Usa2vUElDn9GSLh22x69GJjaOlCJhk6ahKPryRP3YlFSfRDX+zA r9F6bIhAV7+bq2W+n2HNI8uIR05eSdS3YG0YF+LOZP2EZsM7vue8eq14eS+wIdAu zL0FAdOsk2ywv/P30ds4+/npXQcZelwLKsRFlk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=bqBHJQ4l6vnW/AIp0ZVvdL6OZsoSo j/iVYInamjYQ4c=; b=gtVdWjSqPj6yHx0bgGS1UIqs2VTta8M3l5An2gdxNWMA0 bn+iBl5XgZh7P7Xx6oygbrtS+KkCgW+ZkkqSOfX7RnjZ9Bj23x2YVWnjjLy10t4b iIvnAIji+57cb7pxsgkMSz5wNLDE0AwxTE3+Zoi/6mUGAAAU3jslK6xF4VyWDn+1 6s84LXbBRVwjO+3Q2HkmgXhTn8rrq3vgmy5N9fxH5KnIG6IwC5gcfbY4HUsLlhgj fshEXCn378pxexc8xpSup5e8BmbtXUvgB/ZSewDZZVs3jsaViV66O52y0ei9aQvz foFikzrOAg/IYI/FpROxM4ELtELk1JTZROktWbjbw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 436E5E4897; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:18 -0400 Message-Id: <20181025144644.15464-45-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 45/71] hppa: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 00bf444620..1ab4e62850 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -60,7 +60,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 Thu Oct 25 14:46:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7416614BB for ; Thu, 25 Oct 2018 15:17:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 622992BCA1 for ; Thu, 25 Oct 2018 15:17:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5683C2BCBC; Thu, 25 Oct 2018 15:17:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1D8C2BCA1 for ; Thu, 25 Oct 2018 15:17:12 +0000 (UTC) Received: from localhost ([::1]:55117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhNn-0006ci-LW for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:17:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5K-0003Zd-C1 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvN-0008MW-7n for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:48143) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvN-00087I-35 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BFDD422189; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=4DFlzYP0JBm/b3F2E7no+m+y3oWpmSEvwizy3tbZ98k=; b=Pqf/z Woe51wQELazlJNl8RPr+Lq9HTbN5a23dRyUSUCQf1z1z7wyv7q0H3n/oYp1m13F4 YeKEalYu4VmxGnldxnFSi5xLwKOosQ9Bh1OD9DJ2MrhMVd2uupd3ZZuinRn35NdP 7k3a4fEIFnAUlPs+r4s7k0yBBEEpWltA0po9M4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=4DFlzYP0JBm/b3F2E7no+m+y3oWpm SEvwizy3tbZ98k=; b=dMq5Ub4DQx7P82kvpZYqW6J/MYoCCX3RpEi+LDg9dXZ96 RDpKCFQstOmOWkI7e+pYNPBmh9S4mPtcGvPWuR1MKyIIfz4xRD+H6lvj+2cwaO78 J0n7AhdKbIFHdepus2/b4pAQmvw+Bp6ej+PjwwXTJVE+ZolPyUYWO22h81UfZXGf w+7lY4QgfgEH0iWiVfrpQbFtraZUSxnvOpUhIMiL6BponAzvEAoQHQiwqtw69GSX pplVAgLIYhod5PuuonFZ+DUR4V/wvdoIQbC2Ze1E1XpV/ud8QYnRwrSKgiGK+ncH AJgnuex4RXuWPp6BP0CTN4b02tqDnX8XrmUsXOrvQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A783E421C; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:19 -0400 Message-Id: <20181025144644.15464-46-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 46/71] lm32: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Michael Walle , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Michael Walle Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 b7499cb627..1508bb6199 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -101,7 +101,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; } /* CPUClass::reset() */ From patchwork Thu Oct 25 14:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655999 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D198614BB for ; Thu, 25 Oct 2018 15:18:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C06592BCC7 for ; Thu, 25 Oct 2018 15:18:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3DEF2BCD5; Thu, 25 Oct 2018 15:18:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 40C602BCC7 for ; Thu, 25 Oct 2018 15:18:06 +0000 (UTC) Received: from localhost ([::1]:55116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhOf-00063N-CH for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:18:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5K-0003lE-9I for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvN-0008NK-Qn for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:35669) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvN-000875-LY for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2BB2B21E50; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=wFlS9V+3h/aJV4auOl4qaurKXoxDsQk0nNi2+YN3vmI=; b=hJb64 gSHPI8esbCisJM0ikPbBSVNXlR9eFZaSKRT1w4Th8/R5jKyWher0aWMxDQPBweg0 dhQNFhOoMWrfTGcZDT8/Wy0BixFamDyVJO+4hvWNzzi79M4l97gIkpDOHw+8b2Jn xGnBUTLpKwVjlSDnzUvHxQxc0w9QyzpE3Ux6xY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=wFlS9V+3h/aJV4auOl4qaurKXoxDs Qk0nNi2+YN3vmI=; b=BxAFCwxmpVbaXBRQq9d2z/2w1efWX+bDjNo1EHLZg7qwI oF5SJiuZ7K2pgb04eHr3li8eT3RsQ/OuaWFiLMoQjhKJILdU49O2FlPzyvcDTO1r XDYxVTFWDq/i+eSV3RRuGCIMTQHG6rRIyFz0eUzx1nB1NaBAdPukY7h8rnNUJepj Ql6MjJns6Qnsp+FBfavupOZKOU/Lb4bN/LqLxqghJlkO4nlezPm3uantZ/KLRMIm WV3m6qA08x4wXCq+nlHVD3C89YQKTHdW8RLQtAX0wz7UsbiPovT4FKF/AISyue+F 6YPL2v5DZXsDfrAO85zLlRE5oJvjuz30jwf8IBgkg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CD0BFE455F; Thu, 25 Oct 2018 10:46:56 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:20 -0400 Message-Id: <20181025144644.15464-47-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 47/71] m68k: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Laurent Vivier Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Laurent Vivier --- 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 582e3a73b3..99a7eb4340 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -34,7 +34,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 Thu Oct 25 14:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1202714BB for ; Thu, 25 Oct 2018 15:27:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 017BA201B0 for ; Thu, 25 Oct 2018 15:27:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9B722BD00; Thu, 25 Oct 2018 15:27:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 830A1201B0 for ; Thu, 25 Oct 2018 15:27:44 +0000 (UTC) Received: from localhost ([::1]:55172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhXz-00084H-R8 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:27:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-0004D4-Mc for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvI-0008GH-AS for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:45 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36013) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvI-000874-0m for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:44 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 69D8621F51; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=b0tdlhsTY0sc8QpbLibSWUu5L54R2BIRN7FydvSHEYI=; b=Tyy8O mm6iMkZM57nnGPdFFxI/fzc3tz2V+J2ApwM4Uj3j1KkFEjt/NwlfRk1vW8bQIq8Z /oi5WDHdVaIf/JhjT+rggZb1h1gYneCwKt4UsNZiwQTGmKM2ViyDvjSJOSiPbmBH O8CJ3LFOErAsVTHjcy5Ab+POrrjOt4YMBiUWH8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=b0tdlhsTY0sc8QpbLibSWUu5L54R2 BIRN7FydvSHEYI=; b=pPBA1stXmKLAsSQjI6+4TcIEBIj3zLfmp0WiGMFzd6T8O jaYjiLVRrzwejO8YQkRf9fI3ImNDd0AibdVIrCJ5/zlbUZqM5Df8B3y6WDQ0dQVj oM2wq+2OEo0QxUmBZVB1Mo+hexRUSVd8XKASbkLtKu3xz/V/qYGzFEs1z2Tg/GYA 84TAVbu3RV5UHJSp9LS4KILFpxWyJrGw0bW1oHLx1srmhu+gk/Y8DbOmSl8tF6eR IdhgyVbx6sjbWKMprshTeHiMSbT4iIZvM/EJT4r2VjOrxo30DIapsC/CqJq2RUOG hhqzgZ12u/JfWyFTrEscIy64ppBp0cErTODaQPCtQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 18313E4897; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:21 -0400 Message-Id: <20181025144644.15464-48-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 48/71] mips: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 497706b669..992d64e796 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -56,11 +56,12 @@ 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)) { @@ -72,7 +73,7 @@ static bool mips_cpu_has_work(CPUState *cs) if (env->CP0_Config3 & (1 << CP0C3_MT)) { /* 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; } @@ -82,7 +83,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 0b177a7577..568c3d8f4a 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -135,7 +135,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 Thu Oct 25 14:46:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656033 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1F8414BB for ; Thu, 25 Oct 2018 15:28:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C87282BA34 for ; Thu, 25 Oct 2018 15:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B826B2BA3F; Thu, 25 Oct 2018 15:28:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 38F2D2BA34 for ; Thu, 25 Oct 2018 15:28:24 +0000 (UTC) Received: from localhost ([::1]:55175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhYc-0000wT-UB for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:28:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-0003Zd-C3 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvI-0008Gc-FO for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:45 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:42045) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvI-00087J-60 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:44 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 011E522199; Thu, 25 Oct 2018 10:46:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=QLmBkfrJdrPPLT6SX7A70hEMHpfEZpEvP0aXPz2JdBM=; b=gIc0z D2+23cubru1li62J6knUho9AcHGZocHWYDgS+3FqCUT1wss6hxwLpFPss+UeX2hn 7vZ6o+CTxOSkYIcTVUl2xgf2rKVEeVTFRG0HHtWbCHPPRwpV+G3yAUsfpqPbNJgk hEzO6135YftZmvR7uzfjlmXNVpNwdrYKEmJd9k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=QLmBkfrJdrPPLT6SX7A70hEMHpfEZ pEvP0aXPz2JdBM=; b=dnaoSli0HXHSg7l/6i8JTtllQTcQvHSuP0fwfrb+oHTZ2 LBcMVY1VKDkBAaW2FDs2Dqm5Z1h2y3hVLh9ogziW2+mtwe4BwOzpcJl+IVeN/hQC lm5JXRSf9ITGllJ+zht+5+vj+TzKx118IsAcSH/FC0r0Mec2ZRCd/2+6EFwVPLWH dGHOkQfBJCsh16yoi5O7b4KDh/3fr+rK80DBpIrmQyUzAiGC3M0BOlawD0N+DHH4 yILkuvzRVk3Bs71Yl/lbWw3CS5XVkD3aHFeYh2rI6Vw6nK5ut1jjFs2UcyQ49XbZ bNMdauoh6RJKivLrM2AjHhYlFXHnB0/CZ+b8w0E1A== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 47715E455F; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:22 -0400 Message-Id: <20181025144644.15464-49-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 49/71] nios: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Paolo Bonzini , Chris Wulff , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Chris Wulff Cc: Marek Vasut Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Alex Bennée --- 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 fbfaa2ce26..49a75414d3 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); } /* CPUClass::reset() */ From patchwork Thu Oct 25 14:46:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C22D113B5 for ; Thu, 25 Oct 2018 15:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B23B828492 for ; Thu, 25 Oct 2018 15:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A38542BB95; Thu, 25 Oct 2018 15:04:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 339A42BBDF for ; Thu, 25 Oct 2018 15:04:55 +0000 (UTC) Received: from localhost ([::1]:55055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhBu-0003R1-4H for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:04:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5G-0002yu-3r for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvS-0008WR-Hv for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:55 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:39487) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvS-00087X-Dr; Thu, 25 Oct 2018 10:47:54 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 00DAE22162; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=sGmHsoBwkYW0EtYy64Uv8ZoxbzSJfE9gF5me1ynqMsk=; b=WIU/4 HluttoaY9GkOK5WaDDybkVHFDhvntkMeQTkdkKLBXhOFTX7fW1/77XvhFl2jakci XEIcZeKMflHMkpr14KKHZ4yKTgDD/wVFPjuCn7i2DisbMjTGDs2nmyVQ2u+fPjnV YCpNmFYzR8wSZv7BpdmnjsDKjANWrRfbMqMLIg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=sGmHsoBwkYW0EtYy64Uv8ZoxbzSJf E9gF5me1ynqMsk=; b=ygMev8ml2hrkyU6On/rRyaLqBJhwK1i8WvLH2MohQLq8a 0oPfYE7p/m5GojBQTwWSBzQ9a7trUSDhoJ/H3ufOaUfqVgQc65oY1mYGpRW+BRDl +Y0MANh5xoNoLZuiHcHzjTkRK/AzkQkzBbEx2W3UNhdySBu2Jw98wYNpx43zO1z8 9Ja29M6T9/SrKI5UtBEK/ZGOMsIiIUwR7nVsLzgygxQIaPyHWIuh1lxIMtGEx83y 1VJuYIDlrs8cFYFqad4aSaKvmcL3exwCXsQ+dHhUmJQ2nE5iLCXnKyo2Wzru0u43 OSfU1YLXBqr5348F3lXhitpzKfwft7kfTkfJD9bsQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 824DEE4897; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:23 -0400 Message-Id: <20181025144644.15464-50-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 50/71] s390x: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , Alexander Graf , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Cornelia Huck Cc: Christian Borntraeger Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck --- 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 bfb5cf1d07..d944824e67 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -189,7 +189,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 956d4e1d18..1f91df57bc 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 Thu Oct 25 14:46:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC0B714BB for ; Thu, 25 Oct 2018 15:20:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB3DA2BD35 for ; Thu, 25 Oct 2018 15:20:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B956D2BD26; Thu, 25 Oct 2018 15:20:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 544F02BD3D for ; Thu, 25 Oct 2018 15:20:41 +0000 (UTC) Received: from localhost ([::1]:55124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhRA-00008o-9U for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:20:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5K-00045Y-TL for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvL-0008JB-AK for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:48 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:47709) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvL-00087W-2S for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3B8662213E; Thu, 25 Oct 2018 10:46:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=n2D57pAck+IB9Cu02kPyqlphcMhkxmN6nDYdCUhxVq4=; b=EN1J6 MUouPv+3vRz98di7F+xPgUqDZBB8sDtPuJOPgnimcLifZ5qgQrujc3S+YJ/OY1iE zVV4uv24WGz6Nh1X2qBTz5//RvNLzLBMxNGnso36QXwWuGNqbdnP+3tUdNbjKq3x Ctilq1Dwb7Voq3eXpgcJ3J9mVSRz3kWSN1FLDY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=n2D57pAck+IB9Cu02kPyqlphcMhkx mN6nDYdCUhxVq4=; b=i9u2Do6VoGz6gdvnKrzL4DdRP/4PS2nqo+jL8o00qHr72 Shp2rEFZGM1U/4IBWCxYGfHfyiU85DfuE7Kra172UlZVV6NV9Jj0lFnY/tiFxfSI dBR/BwTLFTuJHDBDkgQgWbJqqUthgJsRb21PyGFNiwyCMYhOogplusw3LnliYtpI U8bw2uGeFnkqLIPhrvKcLCAAgKuHndt06vTbYFXHiMTIn35qQCl5Qm/gWd03S3Y1 8LolZmTe/jUc/zmleBj50TEeOyJqjNIuk14Ta1Hf2zSzb0dE+0QMdIjXjPnI1qIo DVc0Dy6x6dPHfpq/S1yRCur+N5tKL29Eb0Tayjv+w== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id BC2F5E44D4; Thu, 25 Oct 2018 10:46:57 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:24 -0400 Message-Id: <20181025144644.15464-51-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 51/71] alpha: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 a953897fcc..4e8965fb6c 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 Thu Oct 25 14:46:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656021 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BBBF14DE for ; Thu, 25 Oct 2018 15:25:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B5EC2BD00 for ; Thu, 25 Oct 2018 15:25:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F3602BD25; Thu, 25 Oct 2018 15:25:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2139F2BD00 for ; Thu, 25 Oct 2018 15:25:23 +0000 (UTC) Received: from localhost ([::1]:55150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhVi-0004yc-B4 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:25:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-0003lE-Bk for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvJ-0008HL-Dd for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:54155) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvJ-00087q-6J for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:45 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 76C5F21F26; Thu, 25 Oct 2018 10:46:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=41gePqlYDmsQ/Z00sTzXcCFjk3YTfXN+eNYgAHpJAe8=; b=utI2h z/JbrGVsEf/dVwIVNRe7U1J1mQNuXlxM49Aji7i8GgOf016c8tGuTP0RCLIWEzxq Nn6kD4agz9PdLXIxaCgftvj8wJGwgxcRnRxB2+rpGOBeHuQrI4zw5tFLzXBwTApY G8C/+SbxMJkXMeopLGG57noub4+R6SoWPo1pEY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=41gePqlYDmsQ/Z00sTzXcCFjk3YTf XN+eNYgAHpJAe8=; b=N96pNb7grVtvUAOh56TxwNYt2iBtegEuudwQPp1d+8fbv kj9yHZO2PcEy0xnNFA+4ugz8HcQ+OZibQxgLJZTMD5dImEWfDvSiQSRyIwKEINE4 7HwJ1NqIuE4dvZ1JXX0DIeVY7e3CRyWr5vpBqjDRoI+UxmHSED4ZSopq7Dw0JME4 kK1Ezbc5xb/tflIinuBPppF21yJmB+l81XMnYMHGEgSx33bmZsAwWv86Afc50PMo lwMi3EIbDENRNZ3/StD7PoBbipcWg56IkawUk8vA0DMirWlk2x6JmzvWNeBCjvf3 eBbK8YbNuqQFuU0vlYxZSbJUWDk4C+R3bLdlcsQVw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 067F1E4A44; Thu, 25 Oct 2018 10:46:58 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:25 -0400 Message-Id: <20181025144644.15464-52-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 52/71] moxie: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Anthony Green , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Anthony Green Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 8d67eb6727..bad92cfc61 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -33,7 +33,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(CPUState *s) From patchwork Thu Oct 25 14:46:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46E7817DE for ; Thu, 25 Oct 2018 15:09:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 305862BAF6 for ; Thu, 25 Oct 2018 15:09:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20B232BAF9; Thu, 25 Oct 2018 15:09:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C5AC2BAF6 for ; Thu, 25 Oct 2018 15:09:56 +0000 (UTC) Received: from localhost ([::1]:55076 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhGl-00084p-UD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:09:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0004D4-DX for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvO-0008O8-Ji for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44397) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-00087r-Cn for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 928B0200E3; Thu, 25 Oct 2018 10:46:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=xXkb+qmGGs6auPKhoK+MXz2NHHvvEQGK2p4lXu7OVD0=; b=K6Q9a ToNzL7Ph0OJnentW1K/r4eksKyupW6k7rIbfZSMi0DVG+m4zATV72/3VU/1Y2q/V 4Ge3vF+4ai2iZKzGcY+9FxipK0EtpFn3cS3/o4sxrdZ9SqdLzrl1+Mn6gKXSOhEy 0TjR89RW35qQrtSY6vDzG5XE7Wms1FbTrmyjmA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=xXkb+qmGGs6auPKhoK+MXz2NHHvvE QGK2p4lXu7OVD0=; b=aVMwzqLvGo+oSSUI6i//G0i4y/RuwhfnuMXl2HdplZBJ0 7b5aEnHrrmrTRvXtBwO3ZVT2u5kt5aNjSgFVmCjU+k1NJsQLXQa/dG8i7ofuNFcP ow2/nUzG2oRcHGiggFrku6hOhizrgsowLFaDpuwSdutGKdUPvS0Wf2dn5LHcvgJa Z7Ple8PMlMB4fMy89MBRzu4dZRVvUydDMMhnWXsBJqBwPRy/6vz3cHupN5IppC0t A4YpgWVwOEmNxpacl7lk1RGKchSSBifW657B4KgFVYvCuoXkomCBM57LKTQYVsh7 493LF4Bm3G0L2NBzIM2iaYZ38ulYMeOX9OwOzT/yw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4CD0DE44D4; Thu, 25 Oct 2018 10:46:58 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:26 -0400 Message-Id: <20181025144644.15464-53-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 53/71] sparc: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Richard Henderson , Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Alex Bennée --- 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 372bbd4f5b..58faeb111a 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -56,7 +56,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); @@ -87,7 +87,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 0f090ece54..88427283c1 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -709,7 +709,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 Thu Oct 25 14:46:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2613D13A4 for ; Thu, 25 Oct 2018 15:16:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15C282BCC9 for ; Thu, 25 Oct 2018 15:16:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A0EC2BCD9; Thu, 25 Oct 2018 15:16:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 898EB2BCC9 for ; Thu, 25 Oct 2018 15:16:01 +0000 (UTC) Received: from localhost ([::1]:55113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhMe-0005jY-Ip for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:16:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-00033X-60 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvJ-0008Hm-UP for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37555) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvJ-00088J-Md for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:45 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BE16E21D06; Thu, 25 Oct 2018 10:46:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:46:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=h93uHXHWkOpcmdONRP9J9O1UmWgg7VoSDDxy424u58A=; b=Oxf8N DD/2k3+ijKA3eKeRhDGoqoWtvR/Ehd7S1Fs5Th2pH80mdKpMakJeSZf25EtHGnfs E2QzmARMcXYTLT+PUyuqJlaApeqxGFRRB8i1AhLRgPBMVKfo/SutTWZwYni3TTsM eW3DPzDJiPaRa1pPUsGcZ6xKqwaNxiZHHK5QhU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=h93uHXHWkOpcmdONRP9J9O1UmWgg7 VoSDDxy424u58A=; b=t5dvTIpigQm8waCxhFWfAI0iGHQNN5vrbXI1InYDTlLZB +RXWVcD/jGkrJc2RHuem5fKrdJFX3BAQu5WRoiCawUCNqWZZknVAZiepwbX6KJiR Jep8S3mR+GNDbBJhvwjSOm7O2UPyhTRJIVKDNAQn2Y243eQLsIqY2pzqRxhNS3gy ihJ54cZ2YwSMeJwD0iBhma8DXkNzbQ7U6yHJnkNvFO2Q+KgfAwZUY6eyct2x6OzG 4K75V5A1o8qe6GoD/RzFu3+6hQvB+Q27tKiq/bRT8Kq3ULk1/VmJ08UJ0nDwrPr9 Lj/UYPRibwooJZKZ1WHe/lRCPsvOMpuxwr7vwRNYQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 38448E421C; Thu, 25 Oct 2018 10:46:59 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:27 -0400 Message-Id: <20181025144644.15464-54-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 54/71] openrisc: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Stafford Horne Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 850f88761c..739404e4f5 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 fb7cb5c507..cdbc9353b7 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 Thu Oct 25 14:46:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DEF014BB for ; Thu, 25 Oct 2018 15:12:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B5072BD83 for ; Thu, 25 Oct 2018 15:12:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 885D02BCDF; Thu, 25 Oct 2018 15:12:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 79A772BCF2 for ; Thu, 25 Oct 2018 15:11:59 +0000 (UTC) Received: from localhost ([::1]:55091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhIk-0001Hd-5G for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:11:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0004FR-F2 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvM-0008LK-HC for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44129) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvM-00088K-Cu for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A647621F3E; Thu, 25 Oct 2018 10:47:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=1JTArjkNJurWCZND8n80eEKrpRe7eXb4CORnGi/ccck=; b=K+hGy upbyCZGHwJWGtquYj7nkL4xA0G2hbR9sQ4PodozUyT+9zjkKgPp13pCfd1Zguwzr RU2bC0CQpB1M+w8Sfm02Sy5NtibXM2VDnD170AzK0lJi30mQiqXYCwoIENR6jZYe SyxTHt0VkwFT9GyYn7Sj1O9W1Gs+wiWdYk7L2U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=1JTArjkNJurWCZND8n80eEKrpRe7e Xb4CORnGi/ccck=; b=v0IYt2PNUzkH66HEfUb/J473FbGxBMRsi5pgcRgHKvMiH nX0aI3/pCobFGP4DeaEKWxgwVwJ8oPL2A/A05CQ5f2z1SKZWtPdZTt6rrLKRcMj5 WBopxQwYDCz5AhaUXLy+vEqt741Y21kfdHn6VgUO8op0QjzOtq98DtwpftIgQq+W 0qLxQbDTGEXjIG2DdRDHY+YD8VJ0wB8W6RcoSB/8u2c7mpCZVQ3VeLfQP8eMjGwr IovtnxU9z5uKrn5HAyeDi5TOqO2unNqZAyLYdp12Ww2jLqfZaXYi7ZjQwoeoxa9w 5TTq/upfixfOUOjV71SsFIHbfvUegTQRJTLOnBrFg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 199D9E421C; Thu, 25 Oct 2018 10:47:00 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:28 -0400 Message-Id: <20181025144644.15464-55-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 55/71] unicore32: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Guan Xuetao , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Guan Xuetao Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 2b49d1ca40..65c5334551 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -29,7 +29,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 00c7e0d028..f58e2361e0 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -119,7 +119,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 Thu Oct 25 14:46:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10656007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D552013A4 for ; Thu, 25 Oct 2018 15:21:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C49F12BDEB for ; Thu, 25 Oct 2018 15:21:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C21FD2BDF6; Thu, 25 Oct 2018 15:21:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A2962BDEB for ; Thu, 25 Oct 2018 15:21:55 +0000 (UTC) Received: from localhost ([::1]:55142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhSM-0002ZC-Js for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:21:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-0002yq-3j for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvK-0008IK-CG for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44633) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvK-00088O-4s for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BD79921F4B; Thu, 25 Oct 2018 10:47:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=tc+/t6Gu2hBPbf9g2xPNtw6QudimUi7UE5wemIdrC0E=; b=2fJ70 VpPvGW2goMREN9fFlvC8itub+oEa1477xzwZORYWrJlvokkB1LQW88MZLi9lvfv6 RKAIqguIMSf0zFNsjY273v6i6Yjv8rmLCoIGNNS4p5l/gNcwtX5YGsUWX8MShXha QjtkX+i9uYJnpk2MByYS09kHzwO3142z8Q4okQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=tc+/t6Gu2hBPbf9g2xPNtw6QudimU i7UE5wemIdrC0E=; b=mOH+QJqP4J77ZbwqyOrE1QZzl8mSQiv4wPod9w9JaOqB5 eLh944uonO4EpHf4cioyvH3BtiNvZ12Mi/A9yK7uSyhL29mQaDNVXsJb4lsWIlW6 BnmN+2a+1oQkYZAeK94IQUY+OFUigGpUAvePBg6+kw69HVZ2qruHawKjqMHTQxrw ozDGxHXJPMrC96IsYVzKlYRlIt5SxEZfM49OKc1hTgzHKxnZv88WFn9Fje7c16Pz ugTtQHeRtDd4+eK/Rr1BTxreLxLRJzvPWYv0LqyTAIcRpbnaJabUX3fWuBD+IbA5 T2RJ9Oz+TQOEJZWi8RY8PJtLJC3BpbeE/rQSKFWAw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4AB68E4A44; Thu, 25 Oct 2018 10:47:03 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:29 -0400 Message-Id: <20181025144644.15464-56-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 56/71] microblaze: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 9b546a2c18..206fdd8651 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 Thu Oct 25 14:46:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42F7A13A9 for ; Thu, 25 Oct 2018 15:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31D572BCC4 for ; Thu, 25 Oct 2018 15:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 263792BCD9; Thu, 25 Oct 2018 15:15:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8177C2BCE7 for ; Thu, 25 Oct 2018 15:15:00 +0000 (UTC) Received: from localhost ([::1]:55104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhLe-0004me-RW for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:14:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-00034O-Iu for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvM-0008L2-9h for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45551) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvM-00088N-0x for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0B07F221B0; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=/UlXoeIgMvGe/HnAjPJnCj0rUfs4/axjldrgvhVBPjk=; b=WORQn DHo5t0F6s3xlITt2WKxIMlmvKBnDfwGaLzOMHad0+8cpd4VywUP7Gz9R1h7HoRV2 ILYv6HayJ1CWfs0xw3lYPuZKmXp1wdihkS+8m+CAZ7chsjsh+PLCJEviHzNg52pH SEQm8NPhbBqYCEPe5mHvGmcjndYv3gPEbIjE+g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=/UlXoeIgMvGe/HnAjPJnCj0rUfs4/ axjldrgvhVBPjk=; b=OFSLVLKQbBAMij++1/eNuj07ihV6Znl4MQhnFXHLGE40W l86uzE0T1TKdEplQ8j5COSZFcIemdiO5gBBwV39QeurU+EWhpZ4grhO45dkp0T6+ Vtc9CFy2c6GP+Zfw8EWRgi1F+aXXeHX9Sa/76RoCuE0lsj1XihWiARcgVPOf1Ptx 3dFIynHcOpSWJTsa7Lp3324vsNin2KL/x6ulIOyHcjvcfkukS4V3PrjhUEbZRgfg HA3R/4j0Xa/rpkUK7cnyUsuN5wurFyldvzQOLvO/KyxoKvtb+esE6JredrC7rEJq ON/aQhsDAH/9dH1n6yfTe+JfCfk+l2tGDGuBj92zg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 97B1AE4A46; Thu, 25 Oct 2018 10:47:03 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:30 -0400 Message-Id: <20181025144644.15464-57-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 57/71] accel/tcg: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- 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 f37c9b1e94..d590f1f6c0 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -428,7 +428,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); @@ -540,16 +540,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, */ atomic_mb_set(&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; @@ -558,7 +559,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(); @@ -595,10 +596,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 3d25bdcc17..4e2fe70350 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -39,10 +39,16 @@ unsigned long tcg_tb_size; 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 356dcd0948..038d82fdb5 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2340,7 +2340,7 @@ void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf) 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->icount_decr.u16.high, -1); } From patchwork Thu Oct 25 14:46:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6470514BB for ; Thu, 25 Oct 2018 15:13:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F5F727EED for ; Thu, 25 Oct 2018 15:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DD9A2839C; Thu, 25 Oct 2018 15:13:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0ED42BC71 for ; Thu, 25 Oct 2018 15:13:09 +0000 (UTC) Received: from localhost ([::1]:55090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhJs-00011n-Uc for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:13:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-00034O-1e for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvK-0008IS-F5 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:47 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:34391) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvK-00088v-6n for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 34DB8221BD; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=Jpb+qUurjYT57NIevzIWApuErIaeR5J+BnZ+5TznZIk=; b=smB2Z +QQglIA9FwxoWZzMAEHrz4YsmN73RDKlijZHwnsncs/cdle9x9nGCdlco8XBV3FL TiMUj8b3wZ5wKIjYmKw3pV4wnNMlVvejqQMik2EliGHKO2O1PkCw6SNk8SijfHGg YIVbE+K71esrIEuVECoblFNMFYhVN8QbjBibOw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Jpb+qUurjYT57NIevzIWApuErIaeR 5J+BnZ+5TznZIk=; b=iWXW4ZwU/GRKHWpW6loKuSZHUDYm0kKCbm8E3Qk0Nx71/ nekzoTtHWtxTDrkP6f7WcVdlDuIvmr09QC8aUgN1Uy6H73e2eCcmcv6oRuWOTCPC MCl0Kom3ehRQS3vpA28/k3fDgzFiuKrVYHdHm+2D7x+fSJW+GTrIO1oLU8L6cuVG St7oMeZpyCRpRqlUGkzm0GNEGZMggYism2mHohMNaU9yYc52oFyeeo+QcOY+r3Fu 3zM6q9TeHMrFvhM/DHJrYb+ZwX5BfFHVXJ/JBGuF6KMwfNreMOGRGRip2yTlE6+U /WsgyYIw14Oavjc4+gxIgU3bLflPAF+xJzzFrq10g== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D4569E4A4A; Thu, 25 Oct 2018 10:47:03 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:31 -0400 Message-Id: <20181025144644.15464-58-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 58/71] cpu: call .cpu_has_work with the CPU lock held X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/qom/cpu.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index a86690c7a5..9826cdfa4c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -84,7 +84,8 @@ struct TranslationBlock; * @parse_features: Callback to parse command line arguments. * @reset: Callback to reset the #CPUState to its initial state. * @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_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) @@ -793,9 +794,16 @@ const char *parse_cpu_model(const char *cpu_model); 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 Thu Oct 25 14:46:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC0D817DE for ; Thu, 25 Oct 2018 15:10:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 988732BAF6 for ; Thu, 25 Oct 2018 15:10:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 882D92BAF9; Thu, 25 Oct 2018 15:10:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 226172BAF6 for ; Thu, 25 Oct 2018 15:10:01 +0000 (UTC) Received: from localhost ([::1]:55077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhGq-00089u-BJ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:10:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5L-0003jm-0V for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvK-0008IY-FX for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:47 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60619) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvK-00088u-4F for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 49E652217A; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=mdjsqwIZgmgOLNu1H0AeVPTb3QxbX0r/pxBGkK1JkiU=; b=Yyrzb d+Q6ZMN/7nYKDxBSkp/xlXXJKS0q98mgYO02uB3g+l1zDoU5OAJ/git1gsPRypjH IKTSpdXHCNWYAoyhZ9W8ToPL7iDNxtnHbJQpwVmIJAsZmOgl/Z1H08oKZDWLT37g KOcF0WzabKAfnqMiVYXYAx+U3isVLDqWL4HDIc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=mdjsqwIZgmgOLNu1H0AeVPTb3QxbX 0r/pxBGkK1JkiU=; b=Y4tWOI8HLla6zMJxb6IEASdjR3fdta7lqfiyniC/oRD/x 5y32EZL6XpM2NaAcJRqO3dCgKNanjrmSWcRP4hk5G38vjRoCMWUn0bNuIRPEDzWr oR1AVhDHwuN8gIniMe7c9WSANhUTsj/I+q3KDwT9UROktafj73BhnZgGxQQ0V2e4 0Y9e+KAk8G+DxQPaO6kR7YXsXwcMY4thTnrwGmNsPSP74gA0m/mGT7fgOROkHhiM ezIzQ85x7DNg19rhW/WRbuAwqfbPC4RX+MSA5UHza6krRmB57H8tiYWUHLfAIyDD 8v5FW6sRNpBFS/Cl14CU5N/vA2iIeHasGd49gJL+g== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 1217DE4A44; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:32 -0400 Message-Id: <20181025144644.15464-59-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 59/71] cpu: introduce cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It will gain some users soon. Suggested-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/qom/cpu.h | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 9826cdfa4c..b5c3b2c734 100644 --- a/include/qom/cpu.h +++ b/include/qom/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" @@ -86,6 +87,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_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) @@ -157,6 +160,7 @@ typedef struct CPUClass { void (*reset)(CPUState *cpu); int reset_dump_flags; bool (*has_work)(CPUState *cpu); + bool (*has_work_with_iothread_lock)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); CPUUnassignedAccess do_unassigned_access; void (*do_unaligned_access)(CPUState *cpu, vaddr addr, @@ -794,14 +798,40 @@ const char *parse_cpu_model(const char *cpu_model); 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; + 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 Thu Oct 25 14:46:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 507D015A7 for ; Thu, 25 Oct 2018 15:03:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5CC28417 for ; Thu, 25 Oct 2018 15:03:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2167C2847D; Thu, 25 Oct 2018 15:03:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AFB0F2BA5C for ; Thu, 25 Oct 2018 15:03:16 +0000 (UTC) Received: from localhost ([::1]:55047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhAK-00028i-1J for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:03:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5G-00034O-0V for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvW-00007z-Ar for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:48:01 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:53201) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvW-00088w-6T; Thu, 25 Oct 2018 10:47:58 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C1178221C8; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=giPxLXDO0226dGvPHG4kgVR6ehKtZjyEX1R7FUjRVUQ=; b=qDuyK ImLUwTCJNagfhbDFHLOiF96V8pDuXBhgspKEFLHRVpuMa3rqJ1OfZQEfDv/twkz/ 678Wzfy7utHpxTx4eej2TIyZw14nM0G8sAP7faOuLtAslq4wMXLxNbbgsPbMtgVD +xZblQ5BDUnMvzS9/J31nBw5wgEo4zDwphUuik= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=giPxLXDO0226dGvPHG4kgVR6ehKtZ jyEX1R7FUjRVUQ=; b=cEptG6TMCMRJBAPj+7ZxYxTUq883RiV89bWgSgKjN11df v6lhK0dLVnfYx5zoNK2z9Ezh6NwFPl70NZCu6oLyw++c5CazUiTCVE4rG8ZeM1+x eYgdqIkRt/WKu2KmeBD8pPXGQOvb7Zoww6jBTZXLxnds7R2/WcrTQvXhQydZ0whY OLU7mrLakkctXEz4JKAvQUL7D9mmb/IWGc2RQXvlWsxr/5QOOHrhlS0NgiTZKPtW DZNaqwFQBLKxO/zRgxdAUxTWVD2FBJbH5Psfsb+83hMwSGl0odXVcO4ePavGGoWs oPD/vVpqQWR31FFZrv9WdhCorPaAhG0lTZnRm0tow== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4F38FE49F7; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:33 -0400 Message-Id: <20181025144644.15464-60-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 60/71] ppc: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/ppc/translate_init.inc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 6827db14b6..263977aa32 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8445,6 +8445,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; @@ -8488,7 +8490,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 | @@ -8599,6 +8601,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; @@ -8650,7 +8654,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 | @@ -8791,6 +8795,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)) { if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; @@ -8844,7 +8850,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 | @@ -10236,6 +10242,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); } @@ -10435,7 +10443,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 Thu Oct 25 14:46:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C66A15A7 for ; Thu, 25 Oct 2018 15:06:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AB0A2BC51 for ; Thu, 25 Oct 2018 15:06:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EB862BC71; Thu, 25 Oct 2018 15:06:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 017AE2BC51 for ; Thu, 25 Oct 2018 15:06:35 +0000 (UTC) Received: from localhost ([::1]:55065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhDT-0004ds-BO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:06:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0003jm-In for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvM-0008LB-CA for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56337) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvM-00088t-4K for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E515A221C9; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=BwO6NGJRAMbILXC2qcVy7evSD37HOGX4sj0cagTRvMs=; b=GCbtZ bY1qmXI8xA7M2nyCBNugZNxyQcUN/MY3jyRwb8pebou9kJT1z9pq7KnlTfjKnWb3 I1WDQaLHCogi2y3ImSb3tY/m0qqMr2MOa+JYjIWfPZr9KJuyalazQH/JmAkDzDaC 8Y/A0wyS9rRU2u/s60bSEi74PHP/zMD0bAh6zY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=BwO6NGJRAMbILXC2qcVy7evSD37HO GX4sj0cagTRvMs=; b=dUwIJnEK/GZDPuazh0+XHDzXTGbcO0wpst44RsWVCJMq8 RPDfiL5Eg5DGYmAogzvrWk9OHx2EAe41RaNW3eNLvbwQLN3bsaA8gLUuLycMW1ad cErZzA/u6Ws9lZZJ1mQL1o64P8gysPiW0WOzuu5uHqvOzWDOHTT/xOXpwRqhvPYs LRnfkDqSfUEzPjq7FyUg4ya6b/iSMaMBuVpS3m2w4TXClrQqhWSjpbwq9TamUB8n f6emKH9oVNpqisRrMSPnsRsGYS9vwOosBZ1K9fV67QkuphiBK6mt187acT3glZe9 ziI4K083BLTa2G/hWFQ88+B4WELifKm+PukYFIaGA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8D59DE4897; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:34 -0400 Message-Id: <20181025144644.15464-61-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 61/71] mips: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Aurelien Jarno Cc: Aleksandar Markovic Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 992d64e796..dcda1bce31 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 check for interrupts that can be taken. */ @@ -181,7 +183,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->reset = mips_cpu_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 Thu Oct 25 14:46:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95F2C15A7 for ; Thu, 25 Oct 2018 15:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85D7A2BAA2 for ; Thu, 25 Oct 2018 15:08:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79EB72BAA6; Thu, 25 Oct 2018 15:08:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 05EE02BAA2 for ; Thu, 25 Oct 2018 15:08:29 +0000 (UTC) Received: from localhost ([::1]:55073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhFM-0006tm-4N for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:08:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5G-0004D4-23 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvY-00009F-GD for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:48:01 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36565) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvY-0008As-Bp; Thu, 25 Oct 2018 10:48:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3DAB6221CD; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=SE3SB90yxmPUqjURm5p3/TUqms5XD6sQYhSaFmnae9c=; b=IA1yj 8owzHQePUmKliuIN/2JFPYHiKSOVrXSzL8d0No1wjEiRfvKldfnf4B6GFMkO0WjS XiU80yQ74rTNhbIcSZyRHFauxPGXxiwFNDgUv882PEO9ETaXTYBPt5VGb0c39gNC 5MgTXOnLXER++Xyrm78nGj4G/qJhx/g64KmJ8I= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=SE3SB90yxmPUqjURm5p3/TUqms5XD 6sQYhSaFmnae9c=; b=qfzi/VQuKrU4zRldRR3k3v1hvh9qRp02vR86uPYHJr4/7 w+2f3WFrELyERrnYplgaTEizC8oNB5/EGFrBCb2AB6bNbMFozFsFaTRbzZ09g8f9 up5ZhfhKhy6Lsl9eq2kJBdiPFQln6+LJ8YryUUiisIKO/92qRt131T7kYQM0XY8o 2kk+ZwK3os5u1OEb/3EhbKqRL0+4ZQ5ySfcTeNKHSm68Pm/KFPkMaoMKYglOfh5y SIsQO8+kh3C1G7x111qUxWJvE/Nc63MCmGzX0FzD1hQfr7+witTMgoQktcES76Wm 0ypB1OywDQAPnFDL8LtYyBt484iP+X89dBVPz05kg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C9050E4A47; Thu, 25 Oct 2018 10:47:04 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:35 -0400 Message-Id: <20181025144644.15464-62-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 62/71] s390x: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , Alexander Graf , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Cornelia Huck Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 1f91df57bc..2a2d1227b3 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) { @@ -469,7 +471,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) scc->initial_cpu_reset = s390_cpu_initial_reset; cc->reset = s390_cpu_full_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 Thu Oct 25 14:46:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A1F014BB for ; Thu, 25 Oct 2018 15:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09DBA2BCAB for ; Thu, 25 Oct 2018 15:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F19E02BCAF; Thu, 25 Oct 2018 15:13:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74ED52BCAB for ; Thu, 25 Oct 2018 15:13:02 +0000 (UTC) Received: from localhost ([::1]:55094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhJl-0003F6-FH for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:13:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0002yu-IH for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvO-0008O2-IK for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41953) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-0008At-CJ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8BDBC221C1; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=OpLaguIfTbXhxWap0rPW5HrjCEGYZEIaX0tlJOnsBhs=; b=HlSlu Ud58w27xzEYOBIiz6wGA8Mo486QT1lePOlVOoC0rOQbqDgllUd/Sznp4lE+YdN1D WntpVkYRA2PFeNxUmeU87Eh1Y2pwd8fFRHkZ6kn0NbHl0Av4rFeIH8HiuQOBqCGN zifc5dQd/4Pem+MQedjy3w8aSMuWW8DGEcIB5k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=OpLaguIfTbXhxWap0rPW5HrjCEGYZ EIaX0tlJOnsBhs=; b=ouWHFCKQt1DjlzKv6cXqu6EQXnbGdBfU+JVaK3kp+ZJon iGx28l+EUayfLGUOMvKClMVypTyZS4By+4BOHUoEBs1tGFNlUl2z7Y8nORhYXlU1 wX49UkXu9swZaCQcoOcp2NIVh1jD7H70aZffC7dzL0jB00uXKoiIG32B507PxEMv BPcObnIiF5dQDMomOjACK4T8dZy703ktXRx2Ep5YBA2Vl6618sux22fdYHa7qi8d 1+LmX7S6tJlCiRxztopyFBEFVmjk0fn/feR93jZlwXQTwaI8AD4ZpY9ZoRZCMmmj huk9K47uzFTJyFR5w4ktITSIBQeGKpdqlvHFF3qqg== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 21C62E4897; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:36 -0400 Message-Id: <20181025144644.15464-63-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 63/71] riscv: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , Richard Henderson , Michael Clark , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Michael Clark Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Reviewed-by: Palmer Dabbelt Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 d630e8fd6c..758fbaba29 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -249,6 +249,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 @@ -335,7 +338,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->reset = riscv_cpu_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 Thu Oct 25 14:46:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD7FF15A7 for ; Thu, 25 Oct 2018 15:07:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A93CB2BC59 for ; Thu, 25 Oct 2018 15:07:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BDED2BC94; Thu, 25 Oct 2018 15:07:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F7E92BC59 for ; Thu, 25 Oct 2018 15:07:59 +0000 (UTC) Received: from localhost ([::1]:55068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhEs-0006RG-7u for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:07:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-00045Y-HD for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvO-0008Nl-Bg for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:50781) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-0008Au-1Q for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D1107221D0; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=ehurhgwaKRewiyemYsXJK6VPsV1rEVpjvuSG67JYSyI=; b=RNrrj 7Vq3DPV/j+UKuNyFFBLeSh9CrRmgouOdkJ3kOgR2ftAwwHPaUCJcTdmYS5MsWboD Cf9kxB6zWMNeU8/+IUOcT+wYmE5doidW68jXp9j1/xFvxiUsl4KjOHt7k11oeUuQ Pv18cUo0eljRUi0/l87q3nHtVJWQ0+llV2BDzw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=ehurhgwaKRewiyemYsXJK6VPsV1rE VpjvuSG67JYSyI=; b=wyk/tOIyBgVICxPLW7Lqvw+qpOVvY14Cx+u/9O5zQQfAk xMOF/oErwkf6QvFZnQhZKfOtVYdiIe8Tm78K+q4V+EB2fge6IGqNmiLoqVy32Huf OeC1poYN+lzVLIWqMLosRzPtGk2Ytm7rUj3uIRZW8WpVM0Ofl4dDibDdbGXr6pZ7 C0XSo11f9C6XrSulK0ka3GNGy21HAYCOhl3QCszO+Mn5Ir5VdeFuOxEyKzhSLlGv FeSLs+VuO6tUd5S7w1hGX68+TCGfsE4o/bOuA0JRlQ/6FqmJOL1Iif/PpKoglKay 9bERAlniZjjRsSZl1vVRhyWA1khFgWs1jDPnbWGzQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 6232EE421C; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:37 -0400 Message-Id: <20181025144644.15464-64-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 64/71] sparc: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Richard Henderson , Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 88427283c1..54bffc1a6c 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -709,6 +709,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); } @@ -870,7 +872,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 Thu Oct 25 14:46:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8774F13A9 for ; Thu, 25 Oct 2018 15:14:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76D142BC8F for ; Thu, 25 Oct 2018 15:14:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AF4F2BCAF; Thu, 25 Oct 2018 15:14:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 697302BC8F for ; Thu, 25 Oct 2018 15:14:16 +0000 (UTC) Received: from localhost ([::1]:55093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhKx-0002vG-JD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:14:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0002yq-UP for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvO-0008Nw-Hc for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:55509) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-0008Av-C5 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:50 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1FCDF221C6; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=zK6m8lOHkhpdIy5sMDe4zUbKX4jCxpd4A3+VZtMGSTg=; b=aBGFt YnYpQzWohIaUPK/drTh0cK6LEUSrTcavs3F9VafDfNDtRIbcZdbLig821RYFAVfv l2xWDmYXxdjoXtsVdGYmNHeFo52mJ4eJT1usZn3IXKmQt17bp2OKRpRWQw+KETas dgArQKEnTHvX1M1GMfJoxxiCMaElBcz/zIcAHM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=zK6m8lOHkhpdIy5sMDe4zUbKX4jCx pd4A3+VZtMGSTg=; b=clfNRtYC/oid5YqAf0hNpeChaGX56WeaWEddOXyQoBeZo GCUx1KbK6K+zeWtvovxwPLXLgnWlB3gSm1wQwdZDhXlh9oFrPJAAeWbXVUHku6Dd fvvm6RiubLTEHkRrwd6Bcby+W7BJg3ttYyOY0z0jfmaPpe7b1uk9HPXRdKjmvDiZ FYJu1sp4NoCiMjVYdZxjp6uU1hmBh80Oqjj82ts4/4onRKzFSYIc5T2PvyHFjn66 tKe5bzn+C/78yIbQ7XLt7r/WiHOE4u4t1TCv4QLh7c1aOxyjHpX73jp2isc6FOHP sw0ZSWxr0Do7CjC0/mNYmTiyM8PH7vulL7o3mU20w== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id A2F32E4A44; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:38 -0400 Message-Id: <20181025144644.15464-65-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 65/71] xtensa: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Max Filippov Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 d4ca35e6cc..5f3b4a70b0 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; @@ -173,7 +175,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) cc->reset = xtensa_cpu_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 Thu Oct 25 14:46:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E42015A7 for ; Thu, 25 Oct 2018 15:01:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF0382BA38 for ; Thu, 25 Oct 2018 15:01:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1FFF2BA57; Thu, 25 Oct 2018 15:01:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 668232BA38 for ; Thu, 25 Oct 2018 15:01:05 +0000 (UTC) Received: from localhost ([::1]:55035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh8C-0007cn-Lk for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:01:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5G-0003jm-4c for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008Oe-69 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:54 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:40815) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvP-0008BL-0t for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 60749221BC; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=7xD5hPGnXbfwzQpVwzL5KPNi5OzYLGVppEbCE9xCflk=; b=Fbeal 2TsuGzx53gOag9ejd255qS0EPReAokGdj33ADOIOw+o1tgdeMa/gdZI7XMkhyxeA +Mm0KfJ3F04idUW4xJXLUfna4L9GJOyInuJm/BGgYm+FVDjfszCEk54brDXjxpB0 9b4VAzGoMLxs8M32vTyondbG9q3Tbt1QvimfVY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=7xD5hPGnXbfwzQpVwzL5KPNi5OzYL GVppEbCE9xCflk=; b=HpAg0U3A6bz0rTXiWZOPgp1EqGBlmXkasUqyTicmHjwUx JpHaTCdC19soc1lz+Hb+HzeEK6asiP03C54DcoPVmSpVkVBae8TIvtraE/wZizXn kjqzyQ1IrzlG73qFNu0MD6KE76/AmwdO4u1kWj2IGCMSvxUqWyCyJwdOU0zI7D+s J86zB/YzdzSoIvWt/9hltGbzaTDwPM481VBP6h8FvmVLUUyR3k9X0BWjrUbZb9S0 7OSlVd5uxgC1kTaNE4Tigh0kW7xJ1bQMi7hggTPts/NYxkCNMzjoIksHU3EkHZul GpaJycgtTv0Ct2DlrsszjtC1eogks/HwzJo3TGYww== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E35C2E421C; Thu, 25 Oct 2018 10:47:05 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:39 -0400 Message-Id: <20181025144644.15464-66-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 66/71] cpu: protect most CPU state with cpu->lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of taking the BQL every time we exit the exec loop, have a per-CPU lock to serialize accesses the the CPU's state. Differently from the BQL, this lock is uncontended so acquiring it is cheap. Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 20 ++-- cpus.c | 300 ++++++++++++++++++++++++++++++++-------------- qom/cpu.c | 36 ++---- 3 files changed, 226 insertions(+), 130 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index b5c3b2c734..ed68e089c5 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -291,10 +291,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. @@ -323,6 +319,10 @@ struct qemu_work_item; * @lock: Lock to prevent multiple access to per-CPU fields. * @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). @@ -346,12 +346,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; uint32_t cflags_next_tb; @@ -365,7 +360,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; @@ -412,7 +413,6 @@ struct CPUState { /* TODO Move common fields from CPUArchState here. */ int cpu_index; - uint32_t halted; uint32_t can_do_io; int32_t exception_index; diff --git a/cpus.c b/cpus.c index 913db6a8a4..28e39f045a 100644 --- a/cpus.c +++ b/cpus.c @@ -124,30 +124,36 @@ bool cpu_mutex_locked(const CPUState *cpu) return test_bit(cpu->cpu_index + 1, cpu_lock_bitmap); } -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)) { return true; } - if (!cpu->halted || cpu_has_work(cpu) || + if (!cpu_halted(cpu) || cpu_has_work(cpu) || kvm_halt_in_kernel()) { return false; } @@ -157,13 +163,23 @@ static bool cpu_thread_is_idle(CPUState *cpu) static bool all_cpu_threads_idle(void) { CPUState *cpu; + bool ret = true; + + g_assert(no_cpu_mutex_locked()); + CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); + } CPU_FOREACH(cpu) { if (!cpu_thread_is_idle(cpu)) { - return false; + ret = false; + break; } } - return true; + CPU_FOREACH(cpu) { + cpu_mutex_unlock(cpu); + } + return ret; } /***********************************************************/ @@ -721,6 +737,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; } @@ -1031,6 +1049,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); @@ -1043,6 +1062,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); } @@ -1145,6 +1165,8 @@ int vm_shutdown(void) static bool cpu_can_run(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + if (cpu->stop) { return false; } @@ -1219,16 +1241,9 @@ static QemuMutex qemu_global_mutex; 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); @@ -1246,42 +1261,72 @@ 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(CPUState *cpu) { + g_assert(qemu_mutex_iothread_locked()); + g_assert(no_cpu_mutex_locked()); + while (all_cpu_threads_idle()) { stop_tcg_kick_timer(); - qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); + qemu_cond_wait(&cpu->halt_cond, &cpu->lock); + cpu_mutex_unlock(cpu); + + qemu_mutex_lock_iothread(); } start_tcg_kick_timer(); + cpu_mutex_lock(cpu); qemu_wait_io_event_common(cpu); + cpu_mutex_unlock(cpu); } static void qemu_wait_io_event(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + g_assert(!qemu_mutex_iothread_locked()); + while (cpu_thread_is_idle(cpu)) { - qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(&cpu->halt_cond, &cpu->lock); } #ifdef _WIN32 @@ -1301,6 +1346,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; @@ -1313,14 +1359,20 @@ 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); 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); } @@ -1328,10 +1380,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; } @@ -1348,7 +1406,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; @@ -1359,10 +1417,10 @@ 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); do { - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); do { int sig; r = sigwait(&waitset, &sig); @@ -1371,10 +1429,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); + cpu_mutex_unlock(cpu); rcu_unregister_thread(); return NULL; #endif @@ -1405,6 +1464,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); @@ -1485,12 +1546,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); } } @@ -1511,25 +1575,33 @@ static void *qemu_tcg_rr_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; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); /* 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); + qemu_cond_wait(&first_cpu->halt_cond, &first_cpu->lock); + 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); + qemu_mutex_lock_iothread(); start_tcg_kick_timer(); cpu = first_cpu; @@ -1555,7 +1627,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; @@ -1566,6 +1643,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); @@ -1573,11 +1651,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(); @@ -1587,11 +1668,13 @@ 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 (;;) .. */ /* Does not need atomic_mb_set because a spurious wakeup is okay. */ atomic_set(&tcg_current_rr_cpu, NULL); @@ -1615,19 +1698,26 @@ 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(); cpu->created = true; - cpu->halted = 0; + cpu_halted_set(cpu, 0); current_cpu = cpu; hax_init_vcpu(cpu); - qemu_cond_signal(&qemu_cpu_cond); + qemu_mutex_unlock_iothread(); + qemu_cond_signal(&cpu->cond); 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); } @@ -1635,6 +1725,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; } @@ -1652,6 +1744,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(); @@ -1659,14 +1752,20 @@ 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); 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); } @@ -1674,10 +1773,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; } @@ -1690,6 +1795,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; @@ -1699,28 +1805,40 @@ 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); 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; } @@ -1748,14 +1866,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); /* process any pending work */ cpu->exit_request = 1; @@ -1763,9 +1881,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); @@ -1778,12 +1896,12 @@ 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(); + cpu_mutex_unlock(cpu); cpu_exec_step_atomic(cpu); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); default: /* Ignore everything else? */ break; @@ -1796,8 +1914,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; } @@ -1831,7 +1949,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu) void qemu_cpu_kick(CPUState *cpu) { - qemu_cond_broadcast(cpu->halt_cond); + qemu_cond_broadcast(&cpu->halt_cond); if (tcg_enabled()) { cpu_exit(cpu); /* NOP unless doing single-thread RR */ @@ -1894,19 +2012,6 @@ void qemu_mutex_unlock_iothread(void) qemu_mutex_unlock(&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; @@ -1925,23 +2030,38 @@ void pause_all_vcpus(void) * 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) { - qemu_cpu_kick(cpu); + CPU_FOREACH(cpu) { + CPUState *cs; + + /* XXX: is this necessary, or just paranoid? */ + CPU_FOREACH(cs) { + qemu_cpu_kick(cs); + } + + cpu_mutex_lock(cpu); + if (!cpu->stopped) { + qemu_cond_wait(&cpu->cond, &cpu->lock); } + cpu_mutex_unlock(cpu); } - qemu_mutex_unlock_iothread(); replay_mutex_lock(); qemu_mutex_lock_iothread(); } 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); } @@ -1957,8 +2077,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); @@ -1971,7 +2094,6 @@ void cpu_remove_sync(CPUState *cpu) static void qemu_tcg_init_vcpu(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; - static QemuCond *single_tcg_halt_cond; static QemuThread *single_tcg_cpu_thread; static int tcg_region_inited; @@ -1989,8 +2111,6 @@ static void qemu_tcg_init_vcpu(CPUState *cpu) if (qemu_tcg_mttcg_enabled() || !single_tcg_cpu_thread) { cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); if (qemu_tcg_mttcg_enabled()) { /* create a thread per vCPU with TCG (MTTCG) */ @@ -2008,7 +2128,6 @@ static void qemu_tcg_init_vcpu(CPUState *cpu) qemu_tcg_rr_cpu_thread_fn, cpu, QEMU_THREAD_JOINABLE); - single_tcg_halt_cond = cpu->halt_cond; single_tcg_cpu_thread = cpu->thread; } #ifdef _WIN32 @@ -2017,7 +2136,6 @@ static void qemu_tcg_init_vcpu(CPUState *cpu) } else { /* For non-MTTCG cases we share the thread */ cpu->thread = single_tcg_cpu_thread; - cpu->halt_cond = single_tcg_halt_cond; cpu->thread_id = first_cpu->thread_id; cpu->can_do_io = 1; cpu->created = true; @@ -2029,8 +2147,6 @@ static void qemu_hax_start_vcpu(CPUState *cpu) char thread_name[VCPU_THREAD_NAME_SIZE]; cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/HAX", cpu->cpu_index); @@ -2046,8 +2162,6 @@ static void qemu_kvm_start_vcpu(CPUState *cpu) char thread_name[VCPU_THREAD_NAME_SIZE]; cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/KVM", cpu->cpu_index); qemu_thread_create(cpu->thread, thread_name, qemu_kvm_cpu_thread_fn, @@ -2063,8 +2177,6 @@ static void qemu_hvf_start_vcpu(CPUState *cpu) assert(hvf_enabled()); cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/HVF", cpu->cpu_index); @@ -2077,8 +2189,6 @@ static void qemu_whpx_start_vcpu(CPUState *cpu) char thread_name[VCPU_THREAD_NAME_SIZE]; cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/WHPX", cpu->cpu_index); qemu_thread_create(cpu->thread, thread_name, qemu_whpx_cpu_thread_fn, @@ -2093,8 +2203,6 @@ static void qemu_dummy_start_vcpu(CPUState *cpu) char thread_name[VCPU_THREAD_NAME_SIZE]; cpu->thread = g_malloc0(sizeof(QemuThread)); - cpu->halt_cond = g_malloc0(sizeof(QemuCond)); - qemu_cond_init(cpu->halt_cond); snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY", cpu->cpu_index); qemu_thread_create(cpu->thread, thread_name, qemu_dummy_cpu_thread_fn, cpu, @@ -2129,9 +2237,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) @@ -2261,7 +2375,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) diff --git a/qom/cpu.c b/qom/cpu.c index ecdf8e7aac..d1e6ecae03 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -94,32 +94,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); } } @@ -276,8 +257,8 @@ static void cpu_common_reset(CPUState *cpu) log_cpu_state(cpu, cc->reset_dump_flags); } - cpu->interrupt_request = 0; - cpu->halted = 0; + cpu_interrupt_request_set(cpu, 0); + cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->mem_io_vaddr = 0; cpu->icount_extra = 0; @@ -389,6 +370,7 @@ static void cpu_common_initfn(Object *obj) qemu_mutex_init(&cpu->lock); qemu_cond_init(&cpu->cond); + qemu_cond_init(&cpu->halt_cond); QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); @@ -412,7 +394,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 Thu Oct 25 14:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD44613A4 for ; Thu, 25 Oct 2018 14:59:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA0682BA33 for ; Thu, 25 Oct 2018 14:59:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DBE12BA4D; Thu, 25 Oct 2018 14:59:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49FB52BA33 for ; Thu, 25 Oct 2018 14:59:58 +0000 (UTC) Received: from localhost ([::1]:55015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh77-0005FX-IT for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 10:59:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0003Zd-BK for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008OT-44 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:52 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:48479) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvO-0008BN-Uw for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 88140221DD; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=6ONHjaNfm3oSQRF6S1lHI7ZyJsqnMz7XfwyZKvSlGhY=; b=UM+gR +Le74xykPIpZH+47PVUa7pv7000DH918naeonpxtPqix6nDGhMxm+nOLBhrYSX/W lN2rYFX0MS7nvb7++cYBcrLmKcmB7xD8AsiordpN9fWKmb/TcwPrhusjSCxCAo0h q7EXh0C1qjQxDd8WYFARu8sfOFLtGQMzWV4QHY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=6ONHjaNfm3oSQRF6S1lHI7ZyJsqnM z7XfwyZKvSlGhY=; b=dOw50BgQud7MGaQHLR7v9YHiat7UTFiPPpM0MvjE6rCRh 4nUhpMVd02P6weaKER6YB7ErQU5eJekrjpKr+nNpz4AcTP5sj5DBq3uHhUhCpBev WkWuub7svQs9oxEob0cW4vbJYIVa6Mq2N+84DXG/BmW4kOvG4xxePSKnhThzgbJ1 iTYnx3qlGsfJXUZnLqEraOoFNpVk8/ZUXilUCT/zZPRATvN9WlxbnQcDbk9/Illf XaXwTzSJLRPEdzr/hIUZBlmsoiaVy/OSMjaad/++FDMDUWBjNihJRCJUgw1Y90PW J0lWNBboJpeQ/tYrIJNmNfzF9KqtH46Nxqz4RZLXw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 39CC1E44D4; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:40 -0400 Message-Id: <20181025144644.15464-67-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 67/71] cpus-common: release BQL earlier in run_on_cpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index c2ad554d54..80d7e300eb 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -145,6 +145,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; @@ -153,21 +158,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 Thu Oct 25 14:46:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 153B813B5 for ; Thu, 25 Oct 2018 15:03:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3DF82BA60 for ; Thu, 25 Oct 2018 15:03:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E535C2BA8C; Thu, 25 Oct 2018 15:03:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58F062BA60 for ; Thu, 25 Oct 2018 15:03:17 +0000 (UTC) Received: from localhost ([::1]:55041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhAK-00083G-KI for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:03:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0003ub-AJ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008Pn-KP for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:52 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57789) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvP-0008Bt-AG for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C97FA221E2; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=PFmou4IxVyaAZsp/mAKDP2dcxcauquq0LkdpbM8yqi0=; b=GulST NlTUK566QCL7B48qev7dEaPwvg2b3h9luMZccT9N5Vp2YQcXBUG3ZEvUyDZK6jKj Nj0O+XlwxfQkDQPDI9sQOw+SqBg4gLv0a1FrnNuRFP5aUxyu3Wflud4d04jfO5OY FQ+WUeRlsJYRslCrMu3thwOgbky37rF4II+qvE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=PFmou4IxVyaAZsp/mAKDP2dcxcauq uq0LkdpbM8yqi0=; b=OgwCpmbQOTjhVQ7vQNRthYJTnsR2zkbY9sDY82hHv/hAG h6P3yLqmDJke2XVuEqOsbfrWH+l7dG+z9kd5WESHp2NQYLuMqR9lD0VabVyi2Xon JxBCikZXvB9gGJRrBxOMoJ4NPaJiSigh64eCJSKGIBvFvIEM1GQMkj2/M3Iq5Bph 3uzVFPALCuqVEF92q5yV6Bh6QEUpFwkt/aho9MxMeN+RDeGBMISoeBTtOM2TaMz3 pdovSNLEOT9VHgisQp7FIPUIT0rhHorgVkdoufOpvQJDD/FwYnA5uEtFfnAH/FQt kmEQ1k6eDO2ODD5FE41se0V0hAfUmwZTjQ7jtfrgQ== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 79309E421C; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:41 -0400 Message-Id: <20181025144644.15464-68-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 68/71] cpu: add async_run_on_cpu_no_bql X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some async jobs do not need the BQL. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/qom/cpu.h | 14 ++++++++++++++ cpus-common.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index ed68e089c5..0e90d9d093 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -882,9 +882,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. diff --git a/cpus-common.c b/cpus-common.c index 80d7e300eb..232cb12c46 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -109,6 +109,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 */ @@ -155,6 +156,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); @@ -179,6 +181,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); } @@ -323,6 +340,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); } @@ -347,6 +365,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(); } @@ -357,12 +376,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); From patchwork Thu Oct 25 14:46:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A41315A7 for ; Thu, 25 Oct 2018 15:01:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35E9A2BA38 for ; Thu, 25 Oct 2018 15:01:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26FDA2BA56; Thu, 25 Oct 2018 15:01:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A1C02BA38 for ; Thu, 25 Oct 2018 15:01:37 +0000 (UTC) Received: from localhost ([::1]:55042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh8i-00084k-MU for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:01:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5G-0003ub-7J for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008PU-GC for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:53 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:33841) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvP-0008Bs-8n for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3E6F921F44; Thu, 25 Oct 2018 10:47:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=tpJWUuKmNELcAMAsK8tBpqXfekG9kZZgeareoHLXWRo=; b=lX6dr TC/r4ZYxEu89cM99N7UfGHVwfDgBABwYWD3/YuPzJYPsRV5faOSfwOscaa2um0/C S78alBgbFt4DcNWTt3p7CD62GlZ4EuRWLhVoyZS4cxFDkrVjFJpqKFklYn7vJcZ+ JN1S6TXYe+4B2yTIgklTynKA3B7X75ztlKp30o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=tpJWUuKmNELcAMAsK8tBpqXfekG9k ZZgeareoHLXWRo=; b=tEIAn5aoaTREaTWilIBaRRkZnXy/ZcOcJtJ6nE10ecBvd MJ8KZ4jGxJhozc2qxxNJe9JvY3DnmlE2Enoc1wSyplhyiqJLi1XnFRmoR1y/dr9c jKllrx0N3+rE/9RrBkM/J6vCRs1IPRzCXD6zOVcoLnKELr8usPcx17vD/UcSxADw +L439ki16LpFu5IVExXOyGP1iCn+2ueweNVqawHrzKenBAfvzNctnaGHJfG6FpV2 BVhaSr/8fsoztVN3ZAlXQVvwi3ws/eGLRUzxD6uneXpI3pW1BCWpI8/uDjmMAl3D G/lm7/+UH32QvIzCIXhTu9akPxx+NVQd6OSKlsIEA== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B4E2CE44D4; Thu, 25 Oct 2018 10:47:06 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:42 -0400 Message-Id: <20181025144644.15464-69-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 69/71] cputlb: queue async flush jobs without the BQL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This yields sizable scalability improvements, as the below results show. Host: Two Intel E5-2683 v3 14-core CPUs at 2.00 GHz (Haswell) Workload: Ubuntu 18.04 ppc64 compiling the linux kernel with "make -j N", where N is the number of cores in the guest. Speedup vs a single thread (higher is better): 14 +---------------------------------------------------------------+ | + + + + + + $$$$$$ + | | $$$$$ | | $$$$$$ | 12 |-+ $A$$ +-| | $$ | | $$$ | 10 |-+ $$ ##D#####################D +-| | $$$ #####**B**************** | | $$####***** ***** | | A$#***** B | 8 |-+ $$B** +-| | $$** | | $** | 6 |-+ $$* +-| | A** | | $B | | $ | 4 |-+ $* +-| | $ | | $ | 2 |-+ $ +-| | $ +cputlb-no-bql $$A$$ | | A +per-cpu-lock ##D## | | + + + + + + baseline **B** | 0 +---------------------------------------------------------------+ 1 4 8 12 16 20 24 28 Guest vCPUs png: https://imgur.com/zZRvS7q Some notes: - baseline corresponds to the commit before this series - per-cpu-lock is the commit that converts the CPU loop to per-cpu locks. - cputlb-no-bql is this commit. - I'm using taskset to assign cores to threads, favouring locality whenever possible but not using SMT. When N=1, I'm using a single host core, which leads to superlinear speedups (since with more cores the I/O thread can execute while vCPU threads sleep). In the future I might use N+1 host cores for N guest cores to avoid this, or perhaps pin guest threads to cores one-by-one. - Scalability is not good at 64 cores, where the BQL for handling interrupts dominates. I got this from another machine (a 64-core one), that unfortunately is much slower than this 28-core one, so I don't have the numbers for 1-16 cores. The plot is normalized at 16-core baseline performance, and therefore very ugly :-) https://imgur.com/XyKGkAw See below for an example of the *huge* amount of waiting on the BQL: (qemu) info sync-profile Type Object Call site Wait Time (s) Count Average (us) ---------------------------------------------------------------------------------------------------------- BQL mutex 0x55ba286c9800 accel/tcg/cpu-exec.c:545 2868.85676 14872596 192.90 BQL mutex 0x55ba286c9800 hw/ppc/ppc.c:70 539.58924 3666820 147.15 BQL mutex 0x55ba286c9800 target/ppc/helper_regs.h:105 323.49283 2544959 127.11 mutex [ 2] util/qemu-timer.c:426 181.38420 3666839 49.47 condvar [ 61] cpus.c:1327 136.50872 15379 8876.31 BQL mutex 0x55ba286c9800 accel/tcg/cpu-exec.c:516 86.14785 946301 91.04 condvar 0x55ba286eb6a0 cpus-common.c:196 78.41010 126 622302.35 BQL mutex 0x55ba286c9800 util/main-loop.c:236 28.14795 272940 103.13 mutex [ 64] include/qom/cpu.h:514 17.87662 75139413 0.24 BQL mutex 0x55ba286c9800 target/ppc/translate_init.inc.c:8665 7.04738 36528 192.93 ---------------------------------------------------------------------------------------------------------- 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. Signed-off-by: Emilio G. Cota --- accel/tcg/cputlb.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 353d76d6a5..e3582f2f1d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -212,7 +212,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); } } } @@ -280,8 +280,8 @@ void tlb_flush(CPUState *cpu) if (cpu->created && !qemu_cpu_is_self(cpu)) { if (atomic_mb_read(&cpu->pending_tlb_flush) != ALL_MMUIDX_BITS) { atomic_mb_set(&cpu->pending_tlb_flush, ALL_MMUIDX_BITS); - async_run_on_cpu(cpu, tlb_flush_global_async_work, - RUN_ON_CPU_NULL); + async_run_on_cpu_no_bql(cpu, tlb_flush_global_async_work, + RUN_ON_CPU_NULL); } } else { tlb_flush_nocheck(cpu); @@ -341,8 +341,8 @@ void tlb_flush_by_mmuidx(CPUState *cpu, uint16_t idxmap) tlb_debug("reduced mmu_idx: 0x%" PRIx16 "\n", pending_flushes); atomic_or(&cpu->pending_tlb_flush, pending_flushes); - async_run_on_cpu(cpu, tlb_flush_by_mmuidx_async_work, - RUN_ON_CPU_HOST_INT(pending_flushes)); + async_run_on_cpu_no_bql(cpu, tlb_flush_by_mmuidx_async_work, + RUN_ON_CPU_HOST_INT(pending_flushes)); } } else { tlb_flush_by_mmuidx_async_work(cpu, @@ -442,8 +442,8 @@ void tlb_flush_page(CPUState *cpu, target_ulong addr) tlb_debug("page :" TARGET_FMT_lx "\n", addr); if (!qemu_cpu_is_self(cpu)) { - async_run_on_cpu(cpu, tlb_flush_page_async_work, - RUN_ON_CPU_TARGET_PTR(addr)); + async_run_on_cpu_no_bql(cpu, tlb_flush_page_async_work, + RUN_ON_CPU_TARGET_PTR(addr)); } else { tlb_flush_page_async_work(cpu, RUN_ON_CPU_TARGET_PTR(addr)); } @@ -514,8 +514,9 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, uint16_t idxmap) addr_and_mmu_idx |= idxmap; if (!qemu_cpu_is_self(cpu)) { - async_run_on_cpu(cpu, tlb_check_page_and_flush_by_mmuidx_async_work, - RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); + async_run_on_cpu_no_bql(cpu, + tlb_check_page_and_flush_by_mmuidx_async_work, + RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); } else { tlb_check_page_and_flush_by_mmuidx_async_work( cpu, RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); From patchwork Thu Oct 25 14:46:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10655945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B76271751 for ; Thu, 25 Oct 2018 15:04:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A740928492 for ; Thu, 25 Oct 2018 15:04:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B6652BBDF; Thu, 25 Oct 2018 15:04:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D41E2BB95 for ; Thu, 25 Oct 2018 15:04:32 +0000 (UTC) Received: from localhost ([::1]:55051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFhBX-0003A3-FO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Oct 2018 11:04:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh5J-0003lE-Aj for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFgvP-0008QP-PB for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:52 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44599) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFgvP-0008By-FQ for qemu-devel@nongnu.org; Thu, 25 Oct 2018 10:47:51 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 51341221A3; Thu, 25 Oct 2018 10:47:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 10:47:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=ggwSpfLpW5mnB1jlMsKGEFLNv2YYxEsXChsQCXXgmqw=; b=tQ64H y+JED9UUzXJm3eLoe8G6wjxmyKtfICY0MxC91vyG2LqPbB2SdzxivooxTXS1xaNf khagV0dUZobMw/a9AgA1MHh0QSzHt0nDfIvKUboP76oqNOyid5NXNTLK2Iqh1LfO CeJSiXFaBxu7r9hXt7gC8jzn+9Aveai4Vi+8+8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=ggwSpfLpW5mnB1jlMsKGEFLNv2YYx EsXChsQCXXgmqw=; b=ywHDvP1QiAlAtvA+8YI2Kgt5MCRsNwi3kXe8CcOg4M1Cn ve2syaiwkXP7qhoe+0xVg+zw1oxherHJz/67mlrtSuDlAMAlbNDO+HoYqdiJ+3JI avLBlsTAUFudoLLTXQ+VGlZvbNZoH7MA3y5s/GmybvI9ZWKGO61Mfg4YeTShgEWG /pZwYhNVwlqodcsmz6o1KLYaPgPTLVjaxdvwXXc5wN7+VUeJecljgsuFa3h+6Tmh c5oeFeG+bQ3VphkazaFmQahdfnMyw6r1rhfSfGPrmPA4q1sGq7HgnsVW+OWd+uEJ B0Jp4d85pVVuNkW9Wk0zRzPio54qeMgUUVIXF4/Zw== X-ME-Sender: X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 05F2BE421C; Thu, 25 Oct 2018 10:47:07 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:46:43 -0400 Message-Id: <20181025144644.15464-70-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025144644.15464-1-cota@braap.org> References: <20181025144644.15464-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC v4 70/71] cpus-common: move exclusive_idle higher in the file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will simplify the following commit's diff. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- cpus-common.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 232cb12c46..ad8a8ef535 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -73,6 +73,15 @@ static void finish_safe_work(CPUState *cpu) cpu_exec_end(cpu); } +/* Wait for pending exclusive operations to complete. The CPU list lock + must be held. */ +static inline void exclusive_idle(void) +{ + while (pending_cpus) { + qemu_cond_wait(&exclusive_resume, &qemu_cpu_list_lock); + } +} + void cpu_list_add(CPUState *cpu) { qemu_mutex_lock(&qemu_cpu_list_lock); @@ -200,15 +209,6 @@ void async_run_on_cpu_no_bql(CPUState *cpu, run_on_cpu_func func, queue_work_on_cpu(cpu, wi); } -/* Wait for pending exclusive operations to complete. The CPU list lock - must be held. */ -static inline void exclusive_idle(void) -{ - while (pending_cpus) { - qemu_cond_wait(&exclusive_resume, &qemu_cpu_list_lock); - } -} - /* Start an exclusive operation. Must only be called from outside cpu_exec. */ void start_exclusive(void)