From patchwork Fri Oct 19 01:05:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="tX+s+qrf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CJj//Yx5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnwX64dFz9s2P for ; Fri, 19 Oct 2018 12:13:15 +1100 (AEDT) Received: from localhost ([::1]:45912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJLk-0001Yq-7g for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:13:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFO-0004U7-TZ for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFL-0002k5-CK for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53739) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFJ-0002aD-D5 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:35 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 532F522942; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:27 -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=vIDeid6MN2OcZzaIRTEpbWmcYEC0ydzRMKuBVGcQ0cQ=; b=tX+s+ qrf27rhiiYOFSiL1isT1b8bT9xoxMeFDSR3D1gR6FrV7QkQtPXfHH70jDS0ddX+z GhKq3XOms7/Dx5aEdDQqujacHyZapp0uXL28/745VgP2lMqQVT7qGwWv1NGGnEDI oYjF7DCd3sXC3h3fnno3VDwjkeUWPXzIEJwxlA= 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=vIDeid6MN2OcZzaIRTEpbWmcYEC0y dzRMKuBVGcQ0cQ=; b=CJj//Yx5IlbJzuSmvBFW/k0s4LuYog8Fdu/PTSHvmmZxo 4JJnnxg82BgZv/j20D52tdXiEETVygAMKA+28liG/x5QOmYxQ8XLCyLRvS549ayv d20/39uRJTzWW+RoQ10v5iyQaC6640ObIOwXAqhx1N8PqB7Xf4vwI+s7Q4ot2UY4 PAVG8dh3v+IhGAOCklasZmWaQCDnCsGw4UTPF92BjyfCxMdNCFZATqc8H2uXa391 rgeaqxdvhtTLknqZkggMbKuG7KTKgqnqmgJAtRHWPXovDNihr7Ck6taTTBW3UGZz eSA6CdFKoGnxDSyniPfG00r5f5DbKQJm3HaWuc4Ig== 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 B590C102E4; Thu, 18 Oct 2018 21:06:26 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:30 -0400 Message-Id: <20181019010625.25294-2-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 01/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of open-coding it. While at it, make sure that all accesses to the list are performed while holding the list's lock. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="uFV20vTN"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="JlaKw/GD"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bns71lcCz9sDb for ; Fri, 19 Oct 2018 12:10:19 +1100 (AEDT) Received: from localhost ([::1]:45896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJIu-0007dh-KB for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:10:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFO-0004U4-Rv for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFL-0002jX-7H for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:49423) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFI-0002aE-J0 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5593322944; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:27 -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=u+KxGO8B1NacyUTSoFex0vulARRuRELPkHpvpny1E4Q=; b=uFV20 vTNraGj878mJCoMV5OeSMD5d53R6agadbW/W5k9CQpapAxssxdt1elGb+XxOuVl6 EIeGIWPDfIEvHefp4SE0WyRi9eAplSs/lU7uZOK2wbMnTSxIAD47Ps1ghgVX7jfz OsWPArjoFce9+3CRZIUlshXPzFYsMFOjhJyDJA= 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=u+KxGO8B1NacyUTSoFex0vulARRuR ELPkHpvpny1E4Q=; b=JlaKw/GDrLKAC6gFssf9SMiFD2lSY4NwuD3fu+Wpf/kKs VsY41a9biJtKeFXld6Bub5RGcIQqh4a9ISxzjNskwZUCelcERSPtITX74AjFZnkl YLi6BVol2Asr+QKulcdV6bxoBNA3OzIUOYR/CaAPnjRtDn3TpEs8zAI4+LBtdMcL GjoLjpHVHNFj4uLHrFAu5vn1X0fYvGMZN6BlXeL8Zp531oAA01vC/64Y3hyzYbAY nYpkDDitqEk1vuYW7JZLSB6XzwYnjG/gLoNICWENyQzlEw5l20wtxJgkyPbh+MGP RJJD/H6dacOGNANgD/hLgM/9swGIyNV5LaoRaukPQ== 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 E88D1102EA; Thu, 18 Oct 2018 21:06:26 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:31 -0400 Message-Id: <20181019010625.25294-3-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 02/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This lock will soon protect more fields of the struct. Give it a more appropriate name. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="pJKbB36C"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Mo4kQQrw"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnnt5xHGz9sDK for ; Fri, 19 Oct 2018 12:07:30 +1100 (AEDT) Received: from localhost ([::1]:45887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJGC-0004Vu-A1 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:07:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFO-0004U5-Sx for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFL-0002js-Bq for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53827) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFJ-0002aF-D4 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:35 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8575F22945; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:27 -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=XEFh9Ps/vBjrh81S7kXZpZNnFA/s6QTvY8TC0BAytNY=; b=pJKbB 36CwouMuHAt9nsX8cnJ7LhuYt8sqNk40Uzt4KiaTCWXsYE/FEdHyyQ9+b8yThCXp x7POD/MYHd7PAp0RuYzRBYELep2hzBLsOhuqIEzv/aRs9aZWoZieaZDwZRdSGJa3 cv4CFaNXZBaFEqp4HnsVFSjPKytWPKyDQZVY0M= 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=XEFh9Ps/vBjrh81S7kXZpZNnFA/s6 QTvY8TC0BAytNY=; b=Mo4kQQrw9v+XLTM0OmLoXNggIcxEDbKpicMhPR3NAyIat rTUN+1Q3ndAJeez7axX/HJgpmonPASmZ3zWqEKWCX55+/rkIZP0h7cnTVLQxS9hJ N+iV2y1H3Z6yKt/VvKEcQWHAUNASPNvFQ3d9wqnYSP0lAfMr8kKUSqpG1iNCrM7L J/z3LQs02W0i7DUsiaAVzNHFgMDVMtnRQt3Au2LlroC4nP8PVAhSKkaF4GYAjAIg d9e+XwzLYdvMFgoHPeJC5CU0d138Guov7PhW4PesE/JUTHFzvpjAGUObSE+EFVzM +JGquPhk5Bd+3ri+SqA7bNtFijfpXkMgGIc78q5hw== 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 22848102EB; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:32 -0400 Message-Id: <20181019010625.25294-4-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 03/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The few direct users of &cpu->lock will be converted soon. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 26 ++++++++++++++++++++++++ cpus.c | 48 +++++++++++++++++++++++++++++++++++++++++++-- stubs/cpu-lock.c | 15 ++++++++++++++ stubs/Makefile.objs | 1 + 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 stubs/cpu-lock.c diff --git a/include/qom/cpu.h b/include/qom/cpu.h index b813ca28fa..1292e7aa33 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -452,6 +452,32 @@ 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); + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; diff --git a/cpus.c b/cpus.c index b2a9698dc0..a190651653 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); + +static 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..bc54f00b78 --- /dev/null +++ b/stubs/cpu-lock.c @@ -0,0 +1,15 @@ +#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; +} 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 Fri Oct 19 01:05: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: 986418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="zqe2SY73"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="IZL7qSWU"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnwX64fRz9s8F for ; Fri, 19 Oct 2018 12:13:15 +1100 (AEDT) Received: from localhost ([::1]:45914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJLl-0001aw-Ef for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:13:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFR-0004UK-4z for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFN-0002my-1P for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:40 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:52709) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFM-0002aO-6T for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B7B2B22946; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:27 -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=tOcJDNyJYGtjbbdvedjW3dJ7N1iVhHolqM9+QWB3e1Q=; b=zqe2S Y73EVlh5WxNu1m6M5xHvcrXixjG1yi8a0vAF3hmH+ai4kxJmONWxTcWBcHneC2AI OYVfve1Ot/RzjzP1iXfulMZcXn0+PcI51FoQnHBmCg+BJURw9/Kib+2SXQg9XyVu LgMpnyCFW7YnrwMTxiKtkSFBHja+sAZkCieJtM= 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=tOcJDNyJYGtjbbdvedjW3dJ7N1iVh HolqM9+QWB3e1Q=; b=IZL7qSWUZw8GwY6nRfMrCShLfRbNPiNFwBfuRP21dNtDX yy5yad8uD9cqR85maB+Ar5qq5VcapnXVDS8/Na9kpreCbe6uaxlIP7hlXoxaGfto Pf4ZabujROrSCzYwO/AZmTiZ5WKV0IEE4HrgUHT87xWIZ3xe3Ht1CMGKN+q/x9M8 K2phida8fI0xtZGfljMbnTCCjfuen5K3y/067APMqE8HAxKuOHKdrukg/hcceG6q NOSHeroAVmVeQqvVwLzTVuNK0HhF6176+76I6ioPerfxYJ6r2ZPcQrfAFt4SMpAf uExySxSz0fiqSnBvUCSSLGmylaZ/nPRUNBF8ycMYg== 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 5200C102EE; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:33 -0400 Message-Id: <20181019010625.25294-5-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 04/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 6 +++--- cpus-common.c | 48 ++++++++++++++++++++++++++++++++++------------- cpus.c | 2 +- qom/cpu.c | 1 + 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 1292e7aa33..82937881ef 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; @@ -762,12 +764,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..2881707c35 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,39 +111,52 @@ 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; + g_assert(qemu_mutex_iothread_locked()); + if (qemu_cpu_is_self(cpu)) { func(cpu, data); return; } + qemu_mutex_unlock_iothread(); + wi.func = func; wi.data = data; wi.done = false; wi.free = false; wi.exclusive = false; - queue_work_on_cpu(cpu, &wi); + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, &wi); 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); + + qemu_mutex_lock_iothread(); } void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) @@ -307,6 +318,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 +336,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 +362,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 a190651653..e844335386 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 Fri Oct 19 01:05: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: 986406 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="ZIOMOGNq"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CsPmqDht"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnnt5SPxz9sD9 for ; Fri, 19 Oct 2018 12:07:30 +1100 (AEDT) Received: from localhost ([::1]:45885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJGC-0004VW-4x for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:07:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFO-0004U6-TC for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFL-0002kp-S3 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56815) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFL-0002aQ-Dp for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:35 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C5BF622948; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:27 -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=yXZMv9WGQ+NVShLWfVcjpPXPvTHxUviNzjbYpfTT9wQ=; b=ZIOMO GNqSqrnpB6uG8EADEOt2Vr1Ntqh1RFUKvuCbW/ZpMT7DHZf3iCbNK2j59B82mMmn BkLUPsxpaxW/mQPcF5S8daGg981MU5594FwNQsWBS4CxCeGDTihWV5VSgE8Ak7oj oOPUuEDR6rGpgzsXpyALiVUVMlMhbFk7Y878R8= 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=yXZMv9WGQ+NVShLWfVcjpPXPvTHxU viNzjbYpfTT9wQ=; b=CsPmqDhtXLQqNwp/EuIcRliBRVeHT5vdM0ANYalN19QQf k9i+vm2J6eU03KkGKLqK9uj9x7/wf5/uVOaQ/9zTxACTQnuHt/GcTTgPwQI4D04k 3umoxmcKJanGhNaDEnMWOr6TGskJib3+lm0/SUZTuPdTQr7Ozbf3dzN5DBPipByR rGPCwfk0jNa0KgQwIku/s/x1mr116HrJ/eoopsuEzzXUyGI6w9z+WWx1p+VuQMLt MLnFJnnvEX6Htg1XtjH2q8KKJfj2j3RVcyYNs6P94seASR97Q17z8lXhweHlIqxS RYByNKbI8BIi70eZMp7/NFQ6eZEZQ/XQYdQM3Wh5g== 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 8A087102E2; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:34 -0400 Message-Id: <20181019010625.25294-6-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 05/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We don't pass a pointer to qemu_global_mutex anymore. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 82937881ef..90fd685899 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -759,16 +759,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 2881707c35..20096ec3c6 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; diff --git a/cpus.c b/cpus.c index e844335386..a101e8863c 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 Fri Oct 19 01:05: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: 986428 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="U8JChAVg"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="YQheAnC1"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp5G5GkQz9s2P for ; Fri, 19 Oct 2018 12:20:50 +1100 (AEDT) Received: from localhost ([::1]:45952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJT6-0008DI-AP for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:20:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFY-0004bE-GS for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFX-00030v-5u for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:48 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:33649) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFW-0002jk-Ko for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:46 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A9BBB22953; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:28 -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=XuN+GTcYXg5H6mgRpVCKhp4tivIdd9npLGaX2N3HHvM=; b=U8JCh AVggyry13D73iaXZRcET5z6oAsLHARQVDxg2u7m/nF9LMv9IHdpPwlGqcl6HXZ9d Ttx6BYPZMGWgt/vGAD1VSqx5y5g+WX1eDUvGtO7MlMJLHCAElbAZz+zQEvngCjRq dCcMbkSz35ACUxroRd4V3i4/qHlsjw6RjcluGg= 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=XuN+GTcYXg5H6mgRpVCKhp4tivIdd 9npLGaX2N3HHvM=; b=YQheAnC1ku6m7GMou4riIk+8NYpdEnTDH5eK/jQEkWOyw 4vFI7NXg1ULHCepIPw33m+NZ5clwOoZ07FVK3g98/q+9xW0LE7jBjc2U39HpAjBO 5tkaRzm27XIwiU5Vgn665GnR5dB7jlJRc4hsUsoeEu+JDmfnP8klscx4AxXRg38l EUBKhkHm9ir6ISVXSKLmG50HAAp5ntCuS5BFBr423x0c/bafpeh7AvjsquQp4ZXx uEJeaX2KbJGarLoSCdSbYYmLe/kUVqIsNuAFpt882LUSLZq5msfHXicSnUYBk/bR 15RBMfgbp89HDdaWH+XvnQzhVRViIFAPjQd/x6/tw== 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 E8A3A102E2; Thu, 18 Oct 2018 21:06:27 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:36 -0400 Message-Id: <20181019010625.25294-8-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 07/56] target/m68k: rename cpu_halted to cpu_halt 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 , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" To avoid a name clash with the soon-to-be-defined cpu_halted() helper. Cc: Laurent Vivier Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/m68k/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index ae3651b867..86491048f8 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -43,7 +43,7 @@ #undef DEFO32 #undef DEFO64 -static TCGv_i32 cpu_halted; +static TCGv_i32 cpu_halt; static TCGv_i32 cpu_exception_index; static char cpu_reg_names[2 * 8 * 3 + 5 * 4]; @@ -79,7 +79,7 @@ void m68k_tcg_init(void) #undef DEFO32 #undef DEFO64 - cpu_halted = tcg_global_mem_new_i32(cpu_env, + cpu_halt = tcg_global_mem_new_i32(cpu_env, -offsetof(M68kCPU, env) + offsetof(CPUState, halted), "HALTED"); cpu_exception_index = tcg_global_mem_new_i32(cpu_env, @@ -4646,7 +4646,7 @@ DISAS_INSN(stop) ext = read_im16(env, s); gen_set_sr_im(s, ext, 0); - tcg_gen_movi_i32(cpu_halted, 1); + tcg_gen_movi_i32(cpu_halt, 1); gen_exception(s, s->pc, EXCP_HLT); } From patchwork Fri Oct 19 01:05: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: 986411 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="LwbGDxwW"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="akK1fvKf"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnsB6ntpz9sC2 for ; Fri, 19 Oct 2018 12:10:22 +1100 (AEDT) Received: from localhost ([::1]:45898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJIy-0007h7-Ej for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:10:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFP-0004UA-LX for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFN-0002nT-59 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:39 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53183) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFM-0002jW-GS for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 746E82294C; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:28 -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=pelipkBDIhTpMHj9zPi9DLZW1+z0dxZR4pcli0npdpo=; b=LwbGD xwW0Z+rTuj6SbvNDRuSIQF9ayUOhWlaaEA/9SYsYccrJJMqyV9w6Dabb3sMi2pWs 3qjqv5p7EvFJvQBImYCdrPIA0sGwxnK61UCiUYyoNNq3VNpxR+M7UOKUeIk0tG0T qN065fFnWpDrY0DWzdaV25sx13stKMJUUQwlD0= 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=pelipkBDIhTpMHj9zPi9DLZW1+z0d xZR4pcli0npdpo=; b=akK1fvKfAAY4jg2p55kgUC3j6lnyfJ3b9S5qX/iJZkWsy 6ubQjAqUrndFHTnisYbcnbWBKA2V8HcMkgyCl6FjI+T6UUHJwtY+jfF/7F79jP6d z8rJPbg+ZicqNJm+UqWHEptmK8d00tYYFvRhvkpFGVea0n23alizABqcqKMWrZwH yVBzLlj7novEfiOmisN3s98RSs6lIE8WCH7cQiyBn/cV/2V6GZ8Lg6bIP35MSume pdHSi1T4MH7BBRrhyRwVFSfbEq4rKnFNkM4nZvS3ABFcmeGg1n7FX0MkmaxsXN8B TVt9ocE6e/mvCp83+W4MlV8bz2R2hHWCP3ESDw4Rg== 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 22A35102ED; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:37 -0400 Message-Id: <20181019010625.25294-9-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 08/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/qom/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 30d1c260dc..3bf6767cb0 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -480,6 +480,30 @@ void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line); */ bool cpu_mutex_locked(const CPUState *cpu); +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 Fri Oct 19 01:05: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: 986420 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="0y//dBm0"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ny9pMGlN"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnws4djhz9s2P for ; Fri, 19 Oct 2018 12:13:33 +1100 (AEDT) Received: from localhost ([::1]:45918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJM3-0002S5-2r for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:13:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFV-0004XZ-B2 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFT-0002x2-Gz for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:45 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:54627) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFM-0002jl-6F; Thu, 18 Oct 2018 21:06:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A332922950; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:28 -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=iI/ykmDlaXgjgkFK63LkLLsYDTwc0tBSlU2DkZ/TrM4=; b=0y//d Bm0marMkc4qAAC6dfou7l2ZQvMLzeI5zihhIwqxECgqW8cJGLpl9mYu70vhXWq6M I6oQ4fqRhmUjl3STlePFgjbQOsuJyTnXS7k79JU/dr5//211u+3Dv/u3wAlwIWYh +dskwiHorsKkdoyIL6wKoYpTfBakRQRbXsRmeQ= 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=iI/ykmDlaXgjgkFK63LkLLsYDTwc0 tBSlU2DkZ/TrM4=; b=ny9pMGlNfwhzJWgLCj+3CUc+/FDnxpRGo76D3gUakKZc9 CEhJVXgnWFhHONmacQfcfEncoSN2oPAc7m3l3XQlFx8ttBmSkj0Y+5q4xa2WsXyk FFsSnGUTOn50yx2Yi2QFX+DoAdmExAGvJfWzvRPtqLgdLxtLiGUsI9uBXl3dhi+x Lqiq9Bfvtn80uBE6QKLn28WdyFOke1WFgGvBDYrG5fDNt8xizhIedbAuuqurs4Td 7eCAq/5NzIAl4B0bFvD1lmINmy3Cc3cNrOV2KuTICGLxFx7oocch578uCp+N9EtF itnsOFxJnrfUalAhutY2ioU1jG2/KblBdqmcuvnoQ== 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 4BEDC102E4; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:38 -0400 Message-Id: <20181019010625.25294-10-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 09/56] 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: Paolo Bonzini , qemu-arm@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="a7RuIyBa"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="zVGYmgcL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnzv5Vgrz9sC2 for ; Fri, 19 Oct 2018 12:16:11 +1100 (AEDT) Received: from localhost ([::1]:45931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJOb-0004Uh-66 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:16:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFQ-0004UH-VF for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFM-0002lU-DJ for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:40 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50737) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFL-0002jo-S1; Thu, 18 Oct 2018 21:06:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 479B92293C; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:29 -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=rxDt4J96wPkmFhz1bMQ8vh0sw4DEVq+/9YD8J2KpaIY=; b=a7RuI yBaV99KyoAOsoLNvw+wnmjkGS1NVo4SkfS0LSS76iMcGNZXSpHS4Az0gKoLCIdkw GlBhuhkKbJ5dGswioS5WpbBGMzEeUYnPk27F/2/09G/djyjc9NzSEDBMbXXe623X iiiiGl9yeyzw12vRD/1HyLwGuNOWvf/ir84RnQ= 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=rxDt4J96wPkmFhz1bMQ8vh0sw4DEV q+/9YD8J2KpaIY=; b=zVGYmgcLs53aenJQqQ1m1+7u6nSwDDGT/jQix7U0rp/ML cAePwe8/jHwLLwLc7llMRoQd4g0PRjGVoDPR3fjO8ZtZqTie4Mqwg4y+rorjagSY GtPOj9nvlsxcsRmQJko1IUjdapakg54nhmDtiC0dyiVUPeqjk4Zo8YZhXFkvtjQI 59zGkEUnWxqJSK1mO5iXh+lBOps/Gnj0+XnKTpJRsUc0OMt5ANnnbVpT2Q86TD1L c3+F7g32i5fwdg+twWFOkgp87kTsGraaupf978hly0iogKx+DyQ8AqfKChBXUXOT r97QVbekg4II79zDYaeNxpT21i/45h7GstGXV1ufQ== 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 7B123102EE; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:39 -0400 Message-Id: <20181019010625.25294-11-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 10/56] 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: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In ppce500_spin.c, acquire the lock just once to update both cpu->halted and cpu->stopped. Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota --- 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 Fri Oct 19 01:05: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: 986404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="qH8cT2Ru"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="bQOjf/wA"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnnr3dKVz9sC2 for ; Fri, 19 Oct 2018 12:07:27 +1100 (AEDT) Received: from localhost ([::1]:45884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJG6-0004Uo-Im for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:07:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFO-0004U8-VX for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFN-0002n8-26 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:38249) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFM-0002jn-CY for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 18C722293F; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:29 -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=Z1jRPz30x5CT8DC7w7UXEXw6owAaty+Ih9AlSI/FS5Y=; b=qH8cT 2Ru1Bv+6sgY2zLhq+Zt1wyzYxR4H0keiTI3m3Q/JVvsUqi9PDD6rM/2K0fWBF1ql Vc8ejgNs9uS+Y2yJutdumE128Yz4ib611sl/mR9XLzsxLSRlM0oSjqQwb269YqLa ALEzTiEtUAlJibrxWl8yoljjvZXMkpUR/Rc1Xo= 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=Z1jRPz30x5CT8DC7w7UXEXw6owAat y+Ih9AlSI/FS5Y=; b=bQOjf/wAcHwPtzzXfBOpWDGK18qzNa8s8NmHRavMeloQl 2lwWBXDGAE5FsOWvVZO7QbDfLmkdYyWaQuDIqK6/CPDBsKDaFSyLTs+4NV0AEw9u vZyCjWpZTasZBZOnp7DIsiOu5HcWao+e1ZPRxkUMXuoGywcG+d8EQ6gdh3AJnvZV P7vIORpmY9CrGqXZIQwBxCxf5bjP8u/QbDPA2/hQ23HG/uZ2WH35egi6sQDalfQt XGb6ZmRBw1yStMCaElzRzVc4hK8TLwr3ulNDATJFk0/O3bLNSQxTqmRQQbjwkTLD uIKGS4JIN0TzX4MAFx1NiEfgfFvQDwig85H7UPHXg== 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 B0DEC102E4; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:40 -0400 Message-Id: <20181019010625.25294-12-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 11/56] 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 , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Aurelien Jarno Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="cZh4V5cL"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="mQ7qxmHi"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp4N1mZMz9sC2 for ; Fri, 19 Oct 2018 12:20:04 +1100 (AEDT) Received: from localhost ([::1]:45950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJSL-0007eY-QZ for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:20:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFc-0004eW-3N for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFX-00031m-JK for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:51 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:57345) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFX-0002kj-5R for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5BEA022955; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:29 -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=SV4gvrTs0LZPMCtVmqhozQEiEogs+Bx3TOMykcg/EbU=; b=cZh4V 5cLjyXIIuyXeku0RBa5jazHc4IxDBb0yf1tNNPoJZ8AWUuFjdp+XGx2BrxFcWgCC G1jtXN9DLjsa2aK/kjUvwV2d2uSRj1SLNPfCUeshGmq9Vw4lbnpdtxRigJ1bPVkL ev0ZmCTSHkBdDJM7eqTswBkaj1SIuhURYR5tLQ= 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=SV4gvrTs0LZPMCtVmqhozQEiEogs+ Bx3TOMykcg/EbU=; b=mQ7qxmHiMLcsW/kiJTKeEG+N6WwGTMhgMEXp4G1GHTp4X 46n3rFymmRiw3+7XVtRaEeZfzoHaAio14gmutA94h4bfTsVxYn4rda25CL4YqfL8 oGOIigBYAYZe6d9mFGPBbT4OLzZ6Tg9IeCsJ6J1atAby8KSfqxRtaEVPHJJk6F1o WrIzYJVS5lYQ8x2uEtWps5sHwS/9PADybHPQX8YzlLPCtrG08Invoq5n0hkcT/3v td1rKp3ZQe63ZJj0v0v8zjuWCmpEFjOjTkBPwFKvMOhKuEMYifSUVUDDQOnAcmHV gUEjO+TeWE8mizBWqLmal0HZkJNS6u+X6En1NlujA== 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 E057B102DE; Thu, 18 Oct 2018 21:06:28 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:41 -0400 Message-Id: <20181019010625.25294-13-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 12/56] 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 , Eduardo Habkost Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Eduardo Habkost Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="2yDPWvb3"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="BYQ+acPV"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnsB65tNz9s8F for ; Fri, 19 Oct 2018 12:10:22 +1100 (AEDT) Received: from localhost ([::1]:45897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJIy-0007gz-Bz for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:10:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFQ-0004UG-L8 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFN-0002nr-Fd for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:40 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44191) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFM-0002ki-RA for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:37 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 79FCB2295B; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:29 -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=/cI7AiTDfXj25Lzuwvq6ya6sa51H5RedLNYBIBG/3/A=; b=2yDPW vb3TWIODi9OdxnVTBiAz7wu8G9GXzm6DvHDZ4vm88Z8iFRaaFHJqFWg6vkwyesfK 9KhwS3ppx7McoVYfDX0QbDTGxCmSb1QwQoC43iWMaYjgPRYeAarPpZMJoiFtI7HR qWvQif3l2C/xNcUzq4BnRnAzFuBCpGvFn8r/8M= 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=/cI7AiTDfXj25Lzuwvq6ya6sa51H5 RedLNYBIBG/3/A=; b=BYQ+acPVlGX1fD4key8j52rf6LcyKxCA0Up1FhvUIZ3ev Vs8cyXj2WZaYQb2m7YP7p/lm0b2U2/yQNb164F4F8C9kMnWp7931AtjCHgWxQ35t 8f9ZOhl4jNMjr1CXEshC09x4B+zklHi8dNrz5yPUWsKsf+CaUdWiQXKe3uN42Ni+ fNil5Edx6fgonUx/2VxFLjmn+AqJ5TEAs/z+a+Ewgr0AZL3uGsJfJzKUhtm0Q4pL 8BV+ESgTur3LHrjPEhOsHK3eWjkELvu5bORGnhJSmuksYxQmQKO+K12qoA4dcVMq V5EDIumjWEN3fqDvt755FoFEpxcRIz+KiKcuGMDsw== 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 1BE4D102E2; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:42 -0400 Message-Id: <20181019010625.25294-14-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 13/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Michael Walle Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="eFR1yT6R"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="iNX0C+9W"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp3t6qjLz9s2P for ; Fri, 19 Oct 2018 12:19:37 +1100 (AEDT) Received: from localhost ([::1]:45948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJRu-0007Cy-0Q for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:19:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFa-0004cw-1K for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFY-00032x-71 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:49 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59009) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFX-0002m0-Nw for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A699522937; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:29 -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=AkL37gXd1lotijlNkngkILBtAzFwjZ1DMYN4c+Dj52I=; b=eFR1y T6R7i6wb3vjEin/JGY2ayJHDTGOdxsBK5AfPMkq5rN3TvGf3KlG0R7EUkuu858Wz 86rblQFokAE8tuRj2T6m8qnsJy+aGXBuKrsl8y5pUd20x2Lr82umL/QXadEOAadR TUTHTwXNTQgKVJOd+bq5NdffXQyELiJUfWpl3Q= 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=AkL37gXd1lotijlNkngkILBtAzFwj Z1DMYN4c+Dj52I=; b=iNX0C+9W4mLffdbX+oFSWxqziKAMTLYtmPO2/xFBrWLGh xG20UK+p8UZ5qG7TZN/n3tzxGHL0uwJlOwG4uBGhLLqkPyOrpWrITrK8FrwOgbw5 7HWtdX4hMEhwnVaQz6AKhHj6C6n3fKWE9F7f9dcEY2/Hg2RZvIn+UC1G36WGkAly uqXBRqd43/4+/XtgR3TObiH4r9i+mopvbzwi5dL5KvKqw6dv3EHivOOT7JTtSErX 1SM7QmpPDhy/FqT/ufm8eDoglpXWVyzWADqvZz8sfO88qJY1PlZrnRSys0qjReDq jsE+KS4lsdEbmuA5l/cOky5wDJ8QGYUkKyeDW6nwg== 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 4A405102E4; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:43 -0400 Message-Id: <20181019010625.25294-15-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 14/56] 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 , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Laurent Vivier Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986424 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="mwkyoiYX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="lmpKrr9A"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp0Q09wfz9s2P for ; Fri, 19 Oct 2018 12:16:38 +1100 (AEDT) Received: from localhost ([::1]:45937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJP1-0004pn-DO for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:16:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFb-0004dv-11 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFX-00032I-TO for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:50 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:33729) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFX-0002m2-C8 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E0D5D2293E; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:29 -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=1nxg38W/W9mRDVwCj+7/8jIg9kVx7SUqF24eBwsvmyw=; b=mwkyo iYXqpoRMtYPSW0v+hjQi91xBn05vM2Zn5gDG28/v/f8cKMr7RV4vjxJGxADbulyL oUQU9r2BVjMf2sO/I3qL3sFUY5+x1A/SbnvI/DchPM9MzWqSel17UmyaLj1BEL3s /LKdk7n8BuOOBLleOGPze6+lmQkSXuwMWfQca4= 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=1nxg38W/W9mRDVwCj+7/8jIg9kVx7 SUqF24eBwsvmyw=; b=lmpKrr9AGyHzcUe0OVjBKLVZzTl4SKuvbPLes8c/leIyZ J1LwU4WYOi5RkZdFn7pdZRATQCB/MsN5rVV0/nKIpxWS1fSevmE2aYsLfLZWOPOE HNC5E1wVdK8ZRRb5aZKwjbLYYwzVbLmzTTB1QvWDODb1dhxBSj7ZprVCglGIcyFG 2zPxJ1/qfXy7TDmws2vwodnrZuNIVsknAMjvRohAW3FbFySHhhc2W9MtzjInEJxR 901ezLlxGNQITfeH7AWLx2Zx374InxPAt8ZNEmkFku1Fbnf6FWtGprXcChdyvDOF XRM06z1ro9nE78nl6ywx6fNM2hLPhVsv7pN3RUk/A== 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 77CA5102DE; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:44 -0400 Message-Id: <20181019010625.25294-16-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 15/56] 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 , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986419 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="mGFQ7F1g"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="k2s3qrSm"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnwc3Nywz9s2P for ; Fri, 19 Oct 2018 12:13:20 +1100 (AEDT) Received: from localhost ([::1]:45916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJLp-0001pN-R3 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:13:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFa-0004cy-2j for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFY-00032h-2O for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:49 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:57389) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFX-0002mG-Gq for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1311322940; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:30 -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=HfsAW+Oo5OsmHZmJkUxtg2MpbzwqG8P01lX2rgF4avo=; b=mGFQ7 F1g5zzYslzlZ3nuPoArtxT2RJVpmRhxf3twUWBdtMDh/KJYtMjj1H2IhviMp9hD2 wNJi/0URPfwyXwPmitxNao75DetxmZtlMtfXiRSFv8YmJC30n/jwTIDbtdsVWBRg fduB0zMJYpjpaeMHkzXc9jP/NMHCle7q8U20HA= 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=HfsAW+Oo5OsmHZmJkUxtg2MpbzwqG 8P01lX2rgF4avo=; b=k2s3qrSmD1N+wObz0rO8WfZCziWTZQHq+BF7K/rZq+jbu Cck2fmmGXR2H0s4yauiu3FR7U7epkW6sfA3Zvvx3UPTaBJ2+WXZAJxt/6r5ndLwl aSJceUU7carIXk7M0KWFYIFsFRc8m4ysX5qktEnEVhCjqwdcZKg3YQpMKAFXcMuc lGjjqzp1KbJ44QM5rKk+f3HPOexfjEGQG6s4d4MM8Og5c/C3nOy9ASn6LaDMH6aH Rd6AV8dj5B+9SbDAWoMf3b1ahXVPU9xANQ9fnHKqO8WdV+fYkEBapEBjSIDvt5DR +SXfOtXunz4wPHWG4kYo7JPJpPZxk7Rv4ODwRs/oA== 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 A7F17102E2; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:45 -0400 Message-Id: <20181019010625.25294-17-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 16/56] 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 , Michael Clark , Paolo Bonzini , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Michael Clark Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: Alistair Francis Signed-off-by: Emilio G. Cota Reviewed-by: Palmer Dabbelt --- 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 Fri Oct 19 01:05:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="FYdSxumk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="AFUeskfk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpH23Qy7z9sBj for ; Fri, 19 Oct 2018 12:29:18 +1100 (AEDT) Received: from localhost ([::1]:46000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJbH-0007X6-Vc for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:29:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFk-0004os-Kn for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFi-0003IK-A1 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:34415) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFh-0002mH-RN; Thu, 18 Oct 2018 21:06:57 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3F27422952; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:30 -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=EgeHfc18CYSSh+R8kISWgQnnaYB9LB5RPHy+XqtMqUA=; b=FYdSx umkMDqEKs6TTBLWvdubt/RVn1iZj6vW+oyMU6zL+y2//KDXecUns2yOwjjvvcbf2 qPC97J4iDcfTcYsFX8oJ/5nh0ck9VtZElK5oAyGQg1lP8RXpiv1B3ljs/igbQH8H E8guGnPOUXweymfts8oL1uyaoWtLAnmXuSEp4Y= 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=EgeHfc18CYSSh+R8kISWgQnnaYB9L B5RPHy+XqtMqUA=; b=AFUeskfk058pMj8EoNcsFZBkrcaWMqbf6dYUJWTPuS/Po Pnd6Pnvjf16Au/BnEtsX/imsCMz3nwVi4z3b0COi7Oj2gRO4YknZkotXyoUTls0M Da0Rj9q5A6xzFYkJSXsTRHXgeNhS0IXDvhK8l+40g1Di7fCwwDsmASaxKur4cXS/ UgVQ1xxr0zLIZLZcVpwYlNLfWR4/o4+Ihh8pWr94MxNANNY0FCtBwuHjbjmBb4FD gmicuQXjZg6+eTBFz+F9bk6raHR2WYNAR84ZFB8p0SKaoHTItTd1k0I5ksj0xlhm PNz5woQny+7zgrSG7eJIzK5vNSIfGeu/d61ss97dA== 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 D7A15102E4; Thu, 18 Oct 2018 21:06:29 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:46 -0400 Message-Id: <20181019010625.25294-18-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 17/56] 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 , Alexander Graf , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Cornelia Huck Cc: Christian Borntraeger Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="Okm3x8gA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZiWO7ugY"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp8050Ngz9sBj for ; Fri, 19 Oct 2018 12:23:12 +1100 (AEDT) Received: from localhost ([::1]:45969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJVO-0001iu-5K for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:23:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFb-0004e1-Mh for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFY-000343-NA for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:51 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:35831) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFY-0002mc-5b for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 656E72295D; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:30 -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=fdxwpbMMda89ny0UOJA5BAOcQHKN1ccIoB4V72EeYqI=; b=Okm3x 8gAuj2L4Mx9HK9C+d68PIQ75ap+EbJXAGfRIgpML8O6jR8iFfMaRPJOH4Y3rcvC+ VbTxpv5whVf4iNdWlwpM5+CxxpLLMjoLtL1aUja8OiB2QHiE4s7zFLcX8spcZgrU bE5nBJ8CTWuX3iQrOTCeBWjnWnRntpS5WrpCx8= 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=fdxwpbMMda89ny0UOJA5BAOcQHKN1 ccIoB4V72EeYqI=; b=ZiWO7ugYx0G13DHRd9bNDGGwuhZHxnvVD02I7i/e4niTH vjokAu13qyhj6InX7pOQ1DdO5qb6s+6oXhk8jKPqmHfh5FUXzssnI7HDlXVS+pH4 D911QS4wZKjRxWfXSVG3YMxOLvdDbskVV1iYlWMY8tHcDsrLQxjfeAQquj0ffOXb lmNt67aNq7Mh7n9rggNMdjsarIYC2uGkeUivRk6+YYhiS5dD4AZaUEEIw8FlCH6K K1v1i9pUs5lKpulFOVQftc1VdyAKp1G4mYtNKbMqRVTuZKawBRoc6buidOhhFhyj YfPz1gZG8ZnEklBbTCf6W0fy4sVGL/by9e3QUe0Dg== 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 157EA102DE; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:47 -0400 Message-Id: <20181019010625.25294-19-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 18/56] 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 , Artyom Tarasenko , Fabien Chouteau Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Fabien Chouteau Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="EpSRz0My"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="y1GZxlSB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp0027Zqz9s2P for ; Fri, 19 Oct 2018 12:16:16 +1100 (AEDT) Received: from localhost ([::1]:45935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJOf-0004bh-Qe for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:16:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFb-0004e0-87 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFZ-00034l-1b for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:50 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:39073) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFY-0002md-DN for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9D8112295E; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:30 -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=uV39lUVVtIPPa7ax4E/lGU6K8a72H3S5qag0ahsvTyw=; b=EpSRz 0MyQUWccD9bNaB/4s0z17kJMUE1Fj1pKdGNDEPz/oZxTi4Ndyv2qQtPqaQWgPJZ0 otu98Svx5r3JIymrl49zzRLZmdGDoGGfF1KHmY4XHjmCX6pT1mv1rvop+BEUu+58 s/GNcAf1RFSv5y2bl5zJfIXuRG+py3e9o8sF4U= 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=uV39lUVVtIPPa7ax4E/lGU6K8a72H 3S5qag0ahsvTyw=; b=y1GZxlSBj8kTjpy2DYRULUBUkgu4kZky+W4+APcAt6AGk uu6ga7ITXwzYxkX2Cjm/GozmUuiRLbj0JMsTnJSeYmU0LD7fn/chx8C5Pjx80GRI P0RBnPo+s/jPua2IumxWqUCwavaNk6sObvi5V/Lzawk6FsOs+0Wh2/K3YSzVkFVW w0kJ1LvPYEzfiTOai/G4C92RDurvnSJdyXLqfVWb7u+loPoTM/q2x8KNEdAa1Ex0 q11idloBkGxvgAfIQyn01z4V/TIU7/jCuGIRekjeHazX5hrnc+eR7Zl9y1J+pytb jpGArEtoosV8TG4RKySwxi7EF/oZu/soFhfmnhmDQ== 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 43BEF102E2; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:48 -0400 Message-Id: <20181019010625.25294-20-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 19/56] 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 , Max Filippov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Max Filippov Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="QaSPGeva"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Ik49RaTG"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnzy0Xsnz9s2P for ; Fri, 19 Oct 2018 12:16:14 +1100 (AEDT) Received: from localhost ([::1]:45934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJOd-0004Zz-Ec for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:16:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFZ-0004cj-Qa for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFX-00031X-Hs for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:49 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53185) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFW-0002lR-W5 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CD47422960; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:30 -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=ssBvmXhvTACfz50MAUzI8wAvFrmNcXtAKD4tPe05/mE=; b=QaSPG evaT9IQuTVTJ+hVLDm/yv2CI0TfTySbdWgRdsKXlQuq+RWX08ivg+WJxGmXpT0+G 4qE68FFyJficzdHa+CQxW+9Cf0g7DfU22UEETx/6colak35n1jaZ8M+ahv9p8iCI rWMMVLLANqO/udrQdTl8GGnRK1sqrbNKLiUIdc= 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=ssBvmXhvTACfz50MAUzI8wAvFrmNc XtAKD4tPe05/mE=; b=Ik49RaTGuz8P3qZof6CqBL47oHuoIdn+AXLzDM5fUcO8w HlpUQmJh2c7d3TsdPk/gLJk6uuugoaD772HiTvJ1Jhh8QfCO/q4ZU776EkUTBAag up9/ja8m+7pk1+UMQnq3KR6IOrecjVtAQs4Y1IdAglZh8jgLa+F0oDpJVvD+MsoK NSh57SKBQma7Hxatc1FUEmkgNsjUk9xksRyDvIZVqSeUbo7CesDyE9xLtv2yyU9t F8MGibfryGMhK3i2nEq7znUQnZOCW9DMqxS4ea2GekGVRetYDm+dEjzoFCiwtUMl GIEcOo7zlp6Ujp8YivbCMoDm4EEUDJglwhxfkKqCg== 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 74C2E102DE; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:49 -0400 Message-Id: <20181019010625.25294-21-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 20/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986412 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="tQh5yJEA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="FJRn3woh"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bnsG1KdLz9s8F for ; Fri, 19 Oct 2018 12:10:26 +1100 (AEDT) Received: from localhost ([::1]:45899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJJ1-0007ho-LO for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:10:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFa-0004dR-DB for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFY-00033f-G3 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:50 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:40711) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFY-0002mg-1Z for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E86EE22962; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:30 -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=YEOzbasEa9v9Km8rzfkmKQqL3mJqKZ/TnAxspllMEhs=; b=tQh5y JEABZhGnp4OiH1F/5vgXtQ3H8Q0FuWqTu9muqZvQuAJJHJEiFkq0NfJrOYP/pyMD VURVAPaWHIecS3GtPx+wzDWn1f9MXjedHHSgatIOCNJlAuLmxtD/+0Eq0vibX+eO YRNdG8juHFUGGxWmg/GsFCFLKJpjj6lL57CnHQ= 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=YEOzbasEa9v9Km8rzfkmKQqL3mJqK Z/TnAxspllMEhs=; b=FJRn3woheZzFXufNWpCVQrG1IaTl37kCOazwgWbiQX6MH sbUruCeoOz26JT1zEkOIpo//OqMFMqRG6LGzHo8Mrb/+kFFgckfvS6JkI4ALthU0 5aklHEpxCSm0eJ2c6H2qtc25juGhDerAtFye8PZHQ7/jk0t8ShCXQ33T1Q4Nj9KI sKRQr8uqAgMa3tzRHlr1PfSBVDXRqbgDbk2TIzxApZ8j/1tN/ecjZuquTR59Of/p xvWockMGN7uaRno7K+avpo5+h2mCNn1xbJAQGLgcqBlxn4grfelX27Gftsw4kr4f 2gWmamWeoVqUQvNJJVU92fWGmA/hKPVeLBXWMorJA== 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 A2B58102E9; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:50 -0400 Message-Id: <20181019010625.25294-22-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 21/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Stafford Horne Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="rak/V+1a"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="CepUud2i"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpC71y2Yz9sBj for ; Fri, 19 Oct 2018 12:25:55 +1100 (AEDT) Received: from localhost ([::1]:45984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJY0-0004Py-OW for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:25:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFc-0004fM-PF for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFa-00036a-0r for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:52 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:45171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFZ-0002mh-7t for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 38BE422966; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:31 -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=B2j18SHkAKl5aCZpHHIc/tb9Wqztjl+R/LhGDg5Zcgo=; b=rak/V +1a69/rnopmeMbyfnaDU/IjXatYH7iTjAR+RIeEcupK1Jh4Dt8JwFUPBEPXJMt7u c6p2P44RzLDEqzltmxguhENLzVk4kTMdx50SkunTQMM4Ok10cp+uyFMb9/OZZR+6 mhF0yRdaMBYNSH1TwOAVnQXsMmrIzDnzai6vXE= 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=B2j18SHkAKl5aCZpHHIc/tb9Wqztj l+R/LhGDg5Zcgo=; b=CepUud2iKDOXCh2P2hdCrTPhWBmt8f3/xC4DgJuyzundA o5ebfPCe7RQ2i2WdXyY0S0TCdvVUkbfzDPu/es+dMMBXDYhLFuOqW9j1Kncxy9x7 pF2XtPPUQ5dUqG4MF8TzDWrN5iF37hzUBl09NGkdaJAKZFlN3NPmYiDzq7A+q3Si +XYlRinkFuhWZteEG1MaxIBIJ1Qn724nJYyfoylBqs8KiDhDhrUMTceEFwCGe11w 5oj6saLkNQiD+XQPZFlPaBl6BpuQB/BoC/AqISfl2P6yXQ5HvK4aoEdm6Us8x0Oh 1sG1bK64GXW6wx/wwZsLtFmWHYYFz5vvwUDE9w+xA== 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 D0688102E2; Thu, 18 Oct 2018 21:06:30 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:51 -0400 Message-Id: <20181019010625.25294-23-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 22/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- 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 Fri Oct 19 01:05:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="eRUrV+Sx"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="PD0y0CA7"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp7f21Qzz9s2P for ; Fri, 19 Oct 2018 12:22:54 +1100 (AEDT) Received: from localhost ([::1]:45966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJV5-0001V0-Qb for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:22:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFc-0004eg-76 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFZ-000369-U0 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:51 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50609) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFZ-0002nF-29 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5334B22969; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:31 -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=Guw/J2UTlk6Afu6U2HIBRljn1dEDjlX+VWpk5oNx6Jo=; b=eRUrV +SxbVi33ysIt9aQGXUWP9E8i5Fnrq8a7eCDr9Tp7WyjmpdUHqQnwwU30+1Gws2DS Bl7s5yMaTF66cadwF56gY6bH1LpQY1mQ5mlHVnnMIsNYbJaj2f3Id94GIzsySXmu jNOgZiS/QINRWEuZYnAJo3T5rnNQ8FDRW2Ll8Q= 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=Guw/J2UTlk6Afu6U2HIBRljn1dEDj lX+VWpk5oNx6Jo=; b=PD0y0CA7aAD+lyktPvJjMXE5zxlfyYoPypNP1HXYjmOdu wj6evLmMo3pGoMPudxXTfwrPdWYoRvGjPnI/ZtIpE0Z4SLsOjK3ugvZmGeQNPDNp lK5Hnq1nW0IA9C2cVytcbWP+VSC3+WlLxPGnqe5lZndk+tSQrO4IRpSXTffZcePZ /k6g4Y5lntkweo175tsgjDWCtowwtfv75K71lE/OMUPdCs/T6AInoZVONYC+NAbX j6ZwwjFvTmCcOuDkRDoPaKTJFHJcsD94XpTn143X6MBQT/DN+Om/EBS/zdtfG6MV uCeoudUpGPYuEj1qFirjWfMlhlusE539Fvp+hRxTw== 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 09F27102DE; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:52 -0400 Message-Id: <20181019010625.25294-24-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 23/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/qom/cpu.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 3bf6767cb0..cd66b8828a 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -504,6 +504,41 @@ static inline void cpu_halted_set(CPUState *cpu, uint32_t val) cpu_mutex_unlock(cpu); } +static inline uint32_t cpu_interrupt_request(CPUState *cpu) +{ + uint32_t ret; + + if (cpu_mutex_locked(cpu)) { + return cpu->interrupt_request; + } + cpu_mutex_lock(cpu); + ret = cpu->interrupt_request; + cpu_mutex_unlock(cpu); + return ret; +} + +static inline void cpu_interrupt_request_or(CPUState *cpu, uint32_t mask) +{ + if (cpu_mutex_locked(cpu)) { + cpu->interrupt_request |= mask; + return; + } + cpu_mutex_lock(cpu); + 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)) { + cpu->interrupt_request = val; + return; + } + cpu_mutex_lock(cpu); + cpu->interrupt_request = val; + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; From patchwork Fri Oct 19 01:05: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: 986435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="b0JE0gIw"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="xgAFS+0w"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpDS2Mn0z9sCQ for ; Fri, 19 Oct 2018 12:27:04 +1100 (AEDT) Received: from localhost ([::1]:45989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJZ7-0005J9-Rg for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:27:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFk-0004p5-QC for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFi-0003JQ-WE for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50117) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFi-0002nH-Gd; Thu, 18 Oct 2018 21:06:58 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 954342296A; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:31 -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=MrmPBkptGpq1DPydNI5a26UTwezAWzgSIl35bpf/C7U=; b=b0JE0gIw1azA 7SgFPVluBoj0Qn6j2JOWEEp0h4fsCnpZYSS83FsF5NBAnlSeLgtL1k7G2ZfVj7SG R6y0fkrDXKw3B+PLXSVKb+Szr7RB4AHm8aaI//cHMYG+HTVrbqjXkMg+4svuoqd7 M7i4Eo7MYdUhH7uQ4Gmz1Ah+sqVdsKQ= 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=MrmPBkptGpq1DPydNI5a26UTwezAWzgSIl35bpf/C 7U=; b=xgAFS+0wjYkgzL93l/9QIsilbae3nAqGHQtDeSLJ6GOv8Ssxp4St3UB+C /eW29UYUgeJW8RiAM/lOSR5MMfYqAaRcwaGsPvLfBdbPrrgCyIvE2tjxnYEV5X9Z KGfhGY9NpTp0IW2EHY4aa+naLQM856gyx3DCSW8SCT4Su+uBSVCoZne5MD+soI3t iwmZ5IHua/ZH7db6nL3/jKumI8qyt1PIr42C8OlVVxOuQQysuw1bygAWNc+lekwv cYMVyCUOCeHDHCvNku/NJmKzCM8g8qV29x4+UYuZUf4NWauXCKnKfkrshfnglP24 F15OmcUA9RbbC9wyu9z84IXuh1Gdg== 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 381A1102E9; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:53 -0400 Message-Id: <20181019010625.25294-25-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 24/56] 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: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Acked-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="ybK7POMg"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="UkmEhtCB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp3t6qmNz9sC2 for ; Fri, 19 Oct 2018 12:19:37 +1100 (AEDT) Received: from localhost ([::1]:45947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJRu-0007Cs-L9 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:19:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFc-0004eY-44 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFZ-00035a-NQ for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:51 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:49825) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFY-0002nk-V2 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:49 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B221C2294F; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:31 -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=JvwE5Dx5huodGmx+90ng1+B3ubbNnAGaUCFjtM6PjIE=; b=ybK7P OMgcnjUG8XBb101iZpyOu1bEsYJbqVK1URMs+u/Uy0mLnFEE9cRNs8Dhz+22hQ2b RV9O1781tP7h3mvTs9yVhPH8S27VMHwR8+iJxm3HXjkIIx4Rr8Kug3LTvpaa+Yz8 iSvoPlh/qnMjbx6Ix1eqrvKEv6LQJBeif4XdIs= 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=JvwE5Dx5huodGmx+90ng1+B3ubbNn AGaUCFjtM6PjIE=; b=UkmEhtCBbWXwiv4/9HjqUOpUDF94st9bc2li9voIZjaLa +gf/8qfdooxkpmIw73FG5RxwfR6jGDIIVkblziYxyNhN1fbSK4ZdIldYyZN50ikO o3fPxoji8u/5X2fKnN1oyxM6DU9e6jR1/qfEcCIu8/qQYcb+tmLOYAOSzaaSDCJy jP8a1iI+DWBsbEkkwrTpbeWvJ2uL4mKPEmGDC7zJN4WexM34X2MMuIszb7UeqmQH 8NCmGqoLZPJ3bTng5DUfNrYBM7kam5DCNndf3TrT7qBmipgama5+LcRzQzmf7UWQ JjmNAeCtM5zEFyPRfygXw3dLlI51g1xRBIonijd/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 66041102DE; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:54 -0400 Message-Id: <20181019010625.25294-26-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 25/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 4fd831ef06..6006902975 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, ~0x01); tlb_flush(cpu); /* loadvm has just updated the content of RAM, bypassing the From patchwork Fri Oct 19 01:05:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="LEFNoAXF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="luEcw9nW"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpCX50gvz9sBj for ; Fri, 19 Oct 2018 12:26:16 +1100 (AEDT) Received: from localhost ([::1]:45987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJYM-0004hm-88 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:26:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFd-0004gn-QI for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFZ-00035E-8r for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:53 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:46593) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFY-0002nj-Js for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:48 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0EE4A21CE2; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:32 -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=5I/oTJwyDrQua1hiCoJPm0KDv8ojb+WbzvphqUlKQZg=; b=LEFNo AXFEVcUrD0EP1HJNQWnGC46V9DkM/1FXhWZfQDObvu4X7orex+9/+1hvEO1lIchl PhfbAdFhvvxD0G6Bub+zwZhc1ee545UZbAvv3RUkAczbHIEH1MU8n/mQESkFnikP zXvd/MUhDHkbNgbO8cBIQb6sXL+5FAwKWHnr1M= 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=5I/oTJwyDrQua1hiCoJPm0KDv8ojb +WbzvphqUlKQZg=; b=luEcw9nWr19qVb128orHod1Du7FtG+AKITDfHkJEwHTqg V55iyYu4go2P+bBGSRYKi8GI+2gGIifZveNgY/nVIu8IGIZ1qafMz3tKuKWENTO4 RlM1cbzku+fJhWwppE6wLT1JZGsztaLY75/vvkIX8GbjjPMFcRduAYl6cj/Cg9Kn LOh8FSWHmWba4SlN6uIsB9pj4PPykFGgdeATj9nYwCBwhBgr5HdRTN7mfRrKyHgA 7FiJmHf4NP4Jb6xJtILrNeJtrDww+VO1yUP4YRJdtOoJ42Na/xVMav1SEwGSEZO3 xhuam95i5aqz/WaxFOzVsXS17wD6s7EymHc1npwTQ== 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 9580D102E2; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:55 -0400 Message-Id: <20181019010625.25294-27-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 26/56] 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 , Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="DhMaBgi6"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="pw5Q/p95"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpmz1KBrz9s8J for ; Fri, 19 Oct 2018 12:51:47 +1100 (AEDT) Received: from localhost ([::1]:46173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJx2-0002rY-R7 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:51:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJG4-00058U-2V for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFx-0003ZL-32 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:17 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:43497) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFr-00030m-NW; Thu, 18 Oct 2018 21:07:09 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 32E812295F; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:32 -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=noqImjofZwILLmmT9r03YUUUxGSxxi/4yr/pmOICvfg=; b=DhMaB gi6W7e8fyL7kcwLscBNZFId/r/AjDaa/UWg671+Rn7sbhUrggVtdfhfVZJLunrE2 WmzJ0xjeY/Gy9DVrZY1nKOhslxih00aYgmllYvRUUBmU1ASPUnnsCRjAwD478Fcr /6Fg2Ra4322wi/gUygk9TmiFAHPjNnAIC7Qf2U= 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=noqImjofZwILLmmT9r03YUUUxGSxx i/4yr/pmOICvfg=; b=pw5Q/p95Wt3/fEssMUeMismKI4xgdB+oM18OcDGFMVQHX FOG4RpbEP8T910P84MTLKzMxfIXN9GRuaO0FrsL0O+jniSt4RgHXVJADzHm/8rsS VYgLLXCmuls9H/b13FRqbuboNk1O8iS2/G+ElMkcYw9ETUz2PQrckVa/0/rIdOuK /pobCPEulxAEZiEI+hiwzQe6cUUTF3iIlQc2/J83ouPxWeawUog9FKTFzAtTVXd5 uNM1kED6kaCk33QC+sbWanhjWcL5yWAKVAsJxD893ZHDWoHAs2OpFMm7akpZD+th GMUlpEZYDrsFY8adhutjXGVT1mEsV77uyeUtZ8WZQ== 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 C5659102E4; Thu, 18 Oct 2018 21:06:31 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:56 -0400 Message-Id: <20181019010625.25294-28-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 27/56] 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 , Alexander Graf , qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Cornelia Huck Cc: Richard Henderson 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: Richard Henderson --- 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 Fri Oct 19 01:05: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: 986437 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="qoSdOC3R"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="YHjdvXKi"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpGY4d8Xz9sBj for ; Fri, 19 Oct 2018 12:28:53 +1100 (AEDT) Received: from localhost ([::1]:45997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJas-00072n-Ue for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:28:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFj-0004mm-1P for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFh-0003Hq-Tc for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:58 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44747) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFh-00030n-GA for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:57 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 736212284B; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:32 -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=6eWOdxbuHUlP8zIAOUpQLbLy2TpAfqIzutBrdT7uIYI=; b=qoSdOC3ROeTX BmZp5hwce63M/tXraSFhf1/JJyWOm3ZHAE80Vk81o9vwxlyRhqCXE3n1LnUlaI2r m1+Nx86D0RJ4WawoaRH3q2mdx267i/7ONfj/mk08hAOI3gZRaCA6SAlEUqpwg8Zl QIa9qvcxr5uH9wTxM8xTVxbRb52z61k= 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=6eWOdxbuHUlP8zIAOUpQLbLy2TpAfqIzutBrdT7uI YI=; b=YHjdvXKidskm0EslDzHuwkCz27hTxpQ2zrd739PqjypmQRLq4M1bKQRaP rbEr0qw2QH5w1Fd7/+ffgghCoWA/OLHcsARnvRrSvt+B63b5tWimUZ1ltQ6td/c7 DTjsS/ELnAPpU/4e4icCgiSXYKoT8PSXBtQv/l8BEfLg0eV6uuydpQuuKH26WuY0 3JyVo8S11F/T60v112RuGSaVmRP090aOLHuMZJOCbNQnSrWke+UMt4ZmUK6JwgoU wCBDOY6646Ih3cQ6KzW6vQqFpYHRX2UK8M4O3uwa7MgGfV3f17OGJ0+OQrFDD9gW 8IyTfvzeMYxpBZSN12GVlXZmjqZgA== 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 026A1102DE; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:57 -0400 Message-Id: <20181019010625.25294-29-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 28/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:05:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986444 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="T6IlZJq1"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="XMnMfsLL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpN20jCbz9s1c for ; Fri, 19 Oct 2018 12:33:38 +1100 (AEDT) Received: from localhost ([::1]:46023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJfT-0002g6-MP for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:33:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJGJ-0005MW-1E for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJG8-0003kn-A4 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:27 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:57149) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFs-00031T-9d; Thu, 18 Oct 2018 21:07:09 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BAB2F2292C; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:32 -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=PTWHollnOpCy3S7RQrHt3R2+4fi5XVnfoaRDFl3+oYE=; b=T6IlZ Jq17Ktrl2NLc5dgPcjbEfWYB7mqZnDyrZcQbMAlmZRxmD085tjTySxTTfyFDQ/lU VjWYQLKzz08w9Ejqbv5OBQucsRtU8shhpBXuD4ZIhWQXFsBR0KGFgVOJgaruPID0 Vx/YSsnpqovdDXbcJCBTRUi5cAcqN9J452bPII= 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=PTWHollnOpCy3S7RQrHt3R2+4fi5X VnfoaRDFl3+oYE=; b=XMnMfsLLa/1WWIz0DX4gX2l02k0i48tymyePhPMMboBhX ECTgmXSAEBIQYNIwkVyr+s+4MAKDQAdCHXbEkjNaW0i760KStVSDdfIBoYpDgLnK mcsL34iKCy1WT8gxwFfZc0jI3Y+iCW7BinFozBEJA812veTo1zMMAYUI4Km3dBuN UHyqlnFCeYCWFiUARB+M39HxTu/yUWxUHXaXHHrSeKir+onz9bWo9vmN7XXhs7Es 1EuQUTpekEd+S4jZ79qxNrbb2Pjq9O/+9fNj6Xl964WSFzPxNbUO2cRa96njYkDp 2BRg3nIwP/xahM57hKx+AnSmMUuoVmnuX9IV9Lv+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 326C9102E2; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:58 -0400 Message-Id: <20181019010625.25294-30-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 29/56] 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, Peter Maydell Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- target/arm/cpu.c | 2 +- target/arm/helper.c | 13 ++++++------- 2 files changed, 7 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..85e0b9645e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1295,12 +1295,14 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) CPUState *cs = ENV_GET_CPU(env); uint64_t ret = 0; - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + cpu_mutex_lock(cs); + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { ret |= CPSR_I; } - if (cs->interrupt_request & CPU_INTERRUPT_FIQ) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_FIQ) { ret |= CPSR_F; } + cpu_mutex_unlock(cs); /* External aborts are not possible in QEMU so A bit is always clear */ return ret; } @@ -8579,10 +8581,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 +8596,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 Fri Oct 19 01:05:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="ZtTGTfXg"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="TVGHh/ah"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpd92Pnyz9s8J for ; Fri, 19 Oct 2018 12:45:01 +1100 (AEDT) Received: from localhost ([::1]:46106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJqU-0004vf-TY for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:44:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFo-0004t6-Ey for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFi-0003IT-DS for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:40003) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFh-00031S-Uw for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:58 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EA114219FE; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:32 -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=TvE8+a3yMeqIQYUnTk4niCDsEtz6Zqth4bc3BO6cVak=; b=ZtTGT fXgmc9dCaMF8+bs9Im7Zt4T9LL7g8ypsFXn1DX24eTSQlriq7lPt4tnDylLZb4k5 AKB8SsIzCFvh8bcYy2kcX9GeG1zwPBd4Zoae7F6SYC9eYBFyi1qUoeWz0lCFrpsL xvJWJBbIfsQi8W59ES0cwc8JY0JoLaDIWrDeAM= 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=TvE8+a3yMeqIQYUnTk4niCDsEtz6Z qth4bc3BO6cVak=; b=TVGHh/ah2n/dxKASm4b3LGwkdZWrEl8sFnlDve3i3wots alaKnO+Fny7cOR9xCAkdIFjeFferTjipl4JTi6GT7wLYEv6FgGw3PPEE/mwsMfDr Wqwre8r6fe4I2CdQUq7oWqvS3lfbU1/iEVLI1ivz9iHjb7oUBk8GMcT08I5Jtnwk OYkXellvx1JUqEPPIxDThecRjxbRUbdPFOMyju+Oo9E4d7uFb9dui5Q2zI0gNKYR H2VP6JB91cCu68b5CHYO0mnWU817RPuAfGL7BST0I3XQaWcy8sNcFJdKwJnVb6qr TluW9qrJfN5T/j966Ba+CbEMOf6O7oQTcYWolhEcw== 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 7F4AE102DE; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:05:59 -0400 Message-Id: <20181019010625.25294-31-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 30/56] 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 , Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Richard Henderson Cc: Eduardo Habkost Signed-off-by: Emilio G. Cota --- target/i386/cpu.c | 2 +- target/i386/hax-all.c | 16 +++++------ target/i386/helper.c | 4 +-- target/i386/hvf/hvf.c | 6 ++-- target/i386/hvf/x86hvf.c | 32 ++++++++++++++-------- target/i386/kvm.c | 59 ++++++++++++++++++++++++---------------- target/i386/svm_helper.c | 4 +-- target/i386/whpx-all.c | 44 ++++++++++++++++++------------ 8 files changed, 98 insertions(+), 69 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/hax-all.c b/target/i386/hax-all.c index 8b53a9708f..11751d78ad 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,8 +553,8 @@ 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)) { + if (!(cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && + !(cpu_interrupt_request(cpu) & CPU_INTERRUPT_NMI)) { /* hlt instruction with interrupt disabled is shutdown */ env->eflags |= IF_MASK; cpu_halted_set(cpu, 1); 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/hvf/hvf.c b/target/i386/hvf/hvf.c index fb3b2a26a1..513a7ef417 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); } @@ -713,9 +713,9 @@ int hvf_vcpu_exec(CPUState *cpu) switch (exit_reason) { case EXIT_REASON_HLT: { macvm_set_rip(cpu, rip + ins_len); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) - && !(cpu->interrupt_request & CPU_INTERRUPT_NMI) && + && !(cpu_interrupt_request(cpu) & 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..aae1324533 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; + bool ret; bool have_event = true; if (env->interrupt_injected != -1) { vector = env->interrupt_injected; @@ -400,7 +401,8 @@ bool hvf_inject_interrupts(CPUState *cpu_state) }; } - if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { + cpu_mutex_lock(cpu_state); + 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 +413,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,43 +422,49 @@ 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)); + ret = cpu_interrupt_request(cpu_state) + & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR); + cpu_mutex_unlock(cpu_state); + return ret; } int hvf_process_events(CPUState *cpu_state) { X86CPU *cpu = X86_CPU(cpu_state); CPUX86State *env = &cpu->env; + int ret; EFLAGS(env) = rreg(cpu_state->hvf_fd, HV_X86_RFLAGS); - if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) { + cpu_mutex_lock(cpu_state); + 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) && + if (((cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) || - (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) { + (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu_state, 0); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) { + if (cpu_interrupt_request(cpu_state) & 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, env->tpr_access_type); } - return cpu_halted(cpu); + ret = cpu_halted(cpu); + cpu_mutex_unlock(cpu_state); + return ret; } diff --git a/target/i386/kvm.c b/target/i386/kvm.c index effaf87f01..2e98a0ac63 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2707,9 +2707,12 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) /* 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; + cpu_mutex_lock(cs); + events.smi.pending = cpu_interrupt_request(cs) & CPU_INTERRUPT_SMI; + events.smi.latched_init = cpu_interrupt_request(cs) & + CPU_INTERRUPT_INIT; cpu_reset_interrupt(cs, CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); + cpu_mutex_unlock(cs); } else { /* Keep these in cs->interrupt_request. */ events.smi.pending = 0; @@ -3001,12 +3004,12 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) CPUX86State *env = &x86_cpu->env; int ret; + cpu_mutex_lock(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 (cpu_interrupt_request(cpu) & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (cpu_interrupt_request(cpu) & 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 (cpu_interrupt_request(cpu) & 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) { @@ -3028,19 +3029,21 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) } if (!kvm_pic_in_kernel()) { + cpu_mutex_unlock(cpu); qemu_mutex_lock_iothread(); + cpu_mutex_lock(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 (cpu_interrupt_request(cpu) & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu) & 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) && + (cpu_interrupt_request(cpu) & 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; @@ -3083,6 +3086,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) qemu_mutex_unlock_iothread(); } + cpu_mutex_unlock(cpu); } MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run) @@ -3118,8 +3122,9 @@ int kvm_arch_process_async_events(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; + int ret; - 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 +3147,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,27 +3157,30 @@ int kvm_arch_process_async_events(CPUState *cs) return 0; } - if (cs->interrupt_request & CPU_INTERRUPT_POLL) { + cpu_mutex_lock(cs); + 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) && + if (((cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cs->interrupt_request & CPU_INTERRUPT_NMI)) { + (cpu_interrupt_request(cs) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 0); } - if (cs->interrupt_request & CPU_INTERRUPT_SIPI) { + if (cpu_interrupt_request(cs) & 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, env->tpr_access_type); } + ret = cpu_halted(cs); + cpu_mutex_unlock(cs); - return cpu_halted(cs); + return ret; } static int kvm_handle_halt(X86CPU *cpu) @@ -3180,12 +3188,15 @@ static int kvm_handle_halt(X86CPU *cpu) CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; - if (!((cs->interrupt_request & CPU_INTERRUPT_HARD) && + cpu_mutex_lock(cs); + if (!((cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cs->interrupt_request & CPU_INTERRUPT_NMI)) { + !(cpu_interrupt_request(cs) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 1); + cpu_mutex_unlock(cs); return EXCP_HLT; } + cpu_mutex_unlock(cs); return 0; } 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, diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 9673bdc219..5456f26d8c 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -693,14 +693,16 @@ static int whpx_handle_halt(CPUState *cpu) int ret = 0; qemu_mutex_lock_iothread(); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + cpu_mutex_lock(cpu); + if (!((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + !(cpu_interrupt_request(cpu) & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; cpu_halted_set(cpu, true); ret = 1; } qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); return ret; } @@ -724,17 +726,20 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + /* Inject NMI */ if (!vcpu->interruption_pending && - cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { + cpu_interrupt_request(cpu) & (CPU_INTERRUPT_NMI | + CPU_INTERRUPT_SMI)) { + if (cpu_interrupt_request(cpu) & 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 (cpu_interrupt_request(cpu) & 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 (cpu_interrupt_request(cpu) & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu) & 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 (cpu_interrupt_request(cpu) & 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; @@ -796,6 +801,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) } qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); if (reg_count) { hr = whp_dispatch.WHvSetVirtualProcessorRegisters( @@ -841,7 +847,9 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + cpu_mutex_lock(cpu); + + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { do_cpu_init(x86_cpu); @@ -849,25 +857,25 @@ 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) && + if (((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (cpu_interrupt_request(cpu) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, false); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (cpu_interrupt_request(cpu) & 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); @@ -876,6 +884,8 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) env->tpr_access_type); } + cpu_mutex_unlock(cpu); + return; } @@ -1350,7 +1360,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 Fri Oct 19 01:06:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="RFLIZ3pE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="x+jNgnkz"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpJL5bJnz9sBj for ; Fri, 19 Oct 2018 12:30:26 +1100 (AEDT) Received: from localhost ([::1]:46005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJcO-0000DB-Bq for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:30:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJG4-00058V-2c for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFx-0003Zt-UT for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:17 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:38891) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFt-00031d-1p; Thu, 18 Oct 2018 21:07:10 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 227462296D; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:33 -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=5VkPxQ1ZHeuAjUme9lONc16hT1D8+wYxG8rus7A5vOk=; b=RFLIZ 3pEMy8cWtb/Y5Ir+9ml8FKglcufNglHvgZxIxwpdYaAhfMeQt3p3x+NiSwaF/aau B8HJICv0XWJ6rgVtxRz0Md50zh6f4XxsZUl3ZFagFH+kPGTeeALUQaXK390jkG51 NkmqYJAxiw40FKvlZ/+ahxwjllwI5+2cOtvwpA= 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=5VkPxQ1ZHeuAjUme9lONc16hT1D8+ wYxG8rus7A5vOk=; b=x+jNgnkzeZkH7q52K3jsXI4kk5xSW67DqEUW31tIp4Zf5 ruwf3GiGUIchiXVYt/JnSLkMB3Gn5NBgiaemGE/3yHuvuMN7AmG+TK0BCNog9S6f rywQbXlO8ET1aCDl0YJcGmKOLBXCaE1eKJmERTodKakKOFqtb2zNNQT/snLgb0vm RFFxy7TdpPR9eWCwN5UcMJ21Zw3pJoVIhG/LCe2TZuYWe5pixci5jKZxaNtWWNTx HWdNoGK247rW62kpUUgxQHuiogsD+EHB0oKje4KkkLS9jmHIZgTN6AVxeh7V7gWT VeDpJwuH1Ir7JxHUY5CZufIJO7VIVmWhkLXTVoktA== 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 B239F102E4; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:00 -0400 Message-Id: <20181019010625.25294-32-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 31/56] 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: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Emilio G. Cota --- hw/ppc/ppc.c | 2 +- target/ppc/excp_helper.c | 2 +- target/ppc/kvm.c | 6 ++++-- target/ppc/translate_init.inc.c | 14 +++++++------- 4 files changed, 13 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..1e1a69f49e 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)) { + cpu_mutex_lock(cs); + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (msr_ee)) { cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } + cpu_mutex_unlock(cs); return 0; } 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 Fri Oct 19 01:06:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="LqUsvN3s"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="SrciSZer"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp8t2HpBz9sBj for ; Fri, 19 Oct 2018 12:23:58 +1100 (AEDT) Received: from localhost ([::1]:45973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJW7-0002wR-VV for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:23:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFk-0004oT-Bp for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFi-0003JH-Sx for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFi-00031f-C8 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:58 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3A47E22970; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:33 -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=mDx3X7aEoK1qxOiwQ5diRna+vRx2nXQ/YR8a6r+3dCM=; b=LqUsv N3sNvF0Z7zVP8uuCsONxLchZB9Jpzv3Dy16fgmEzAS802NV8qyzYzeRJDvDwQ0Fa U8y33jOjKFkrTAMompNHPrvNJt4rWBre/rBdyxTWp1hLrBUm0ffRn7p04sL3mD0g XnmBzNff0K82BEoyvY28m1up6cKXbXUWCsJwdc= 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=mDx3X7aEoK1qxOiwQ5diRna+vRx2n XQ/YR8a6r+3dCM=; b=SrciSZergdHXnCv87nYIo96qMw2XMQWJV2RhRXXHYL4c6 2SHj7cqE8kGV/bfxMyklZ3Zwq9CjW+hZUQNiyJw2mxU2+T4lKUpA46PZN62gumQP dPoIz8pZlrf5EBt9qEsPIaLSaRKkXgZg8osGxiJhFAm4Xp7PJT8X4oUAYidyj8yV e0lnDKzE+r+eu2rYb+QjPRnVc8bPtBouRsvOtmVzTWtN8jvomJ512NfuZVWLV6rL RcViSVU8y2jQHcNZ8VlTe1brEtfO7R6irMe8pB7nyjJyMwyTZa/JxBEngP0ri3CU 8rXQ9WtwH0PEnRgZx1+UUvBQZZDhmedLT+JnRG/ig== 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 E4C57102E2; Thu, 18 Oct 2018 21:06:32 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:01 -0400 Message-Id: <20181019010625.25294-33-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 32/56] 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 , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Aurelien Jarno Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="AwRJCc2q"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Ikrpgksk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpT520jQz9sBj for ; Fri, 19 Oct 2018 12:38:01 +1100 (AEDT) Received: from localhost ([::1]:46050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJji-0006lV-BG for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:37:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFl-0004pQ-1H for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003KK-A9 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:48005) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFi-00032C-Rc for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 75AA922975; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:33 -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=oQj9wa70Ll28eo0vdVBtQJF2RZ6OSOude8mT0dA6flc=; b=AwRJC c2qzdmCdAEvi9lIgeVW7HAFE3nTn3guCqGfuO4CQRInokR1MoJu+F+wwDQ/AnEyQ DNf3wk71bZ8HuO/66jW232LIR+EQfpGS+MADbPgwgCnmxIBPJH/iCNJnfvw+buVn baF+QhUmNu3XZ1sruS3fAXbg5k2QVsqqMTKjA4= 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=oQj9wa70Ll28eo0vdVBtQJF2RZ6OS Oude8mT0dA6flc=; b=IkrpgkskF3gzGctKRuzS6/WEW3EhWkho0UKvndERZRi0T DUKM/Yg2MPz2MsCf4yfuzE93Ca22U89clRaFg6LqfrmtIqI3H+4/DEhqu36e+Vs1 muKzTWpD4UHLq/e1gt4RP2BHzotZ2Tvs9/6rWGB5ZrhlI2pj+ZqkwM3aAr50jIc5 tMkrPLq/HKCLOxxkNlUu9kHjsrVMw2t8Y2fQ8eAOKdyPtHFuy8MhMmwKwVJQm/4t ZyEkXkQDwq3GC7hzlR7DP1WaHeqsPoK74mvKa/N6muFeXUGeUMc4BV4ZnCSywi87 SdoAuayoWNjt3zNIbreu8JRCMa3qF8nEeZcrsd35Q== 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 2006D102E9; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:02 -0400 Message-Id: <20181019010625.25294-34-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 33/56] 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 , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: "Edgar E. Iglesias" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="bKMPwqpX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="pRMveKb4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpXC3xsnz9s3l for ; Fri, 19 Oct 2018 12:40:43 +1100 (AEDT) Received: from localhost ([::1]:46084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJmL-0001G6-1f for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:40:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFl-0004pT-23 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003KS-D8 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:35349) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFi-00032F-VL for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8E9C622976; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:33 -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=C9CXoVqv5muWDEKFSYOnbxtYrv8iA3puDbYMr8ZQQYI=; b=bKMPw qpX4l60EXSdzqtqDzYQCoLAtG4nDqJ9tpPvh/rvt6j/gdrSpyfE7yHCSAiIHTpYf QMq9sNEsANB9hd/Xln2DpEpEXxWJWlwPr39n2Z0iKXLOBrYWNhN4QSh/x5er9Gul STmVufkYbMatgrzcpHFAqNPOHjHklArI8h6sbo= 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=C9CXoVqv5muWDEKFSYOnbxtYrv8iA 3puDbYMr8ZQQYI=; b=pRMveKb4e7aAL24p4giRePI4VEWC9JHYVPa1SnbJk9EJJ vaAr4sxFmn97GBdGxmC/TlyTkFn+YTvBohaFSwEe/hUhouCPSOakpdkBcomlKBMh QFXsnPThSEaBVSC2Fg2WwQQePDSHMJqUmZGjBE3sDTvvlWA3NttUdGhz61BeHvP7 Nh9YBmU6O8XJxrqbd+O2u91TRAdLWMBD7+SrJI+I3Fcz9Iat/kMkUYSVmd/+udMd tGBLTTCHAEjOTIu/ZZLBMkjsWgwcekfiiRiY0oAxs6+omnwn2gMskgMJxxGiMigS Kbfil6AgeujCLNRGPmbKAi/Odhv++drHHPqNj07YA== 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 463F6102E4; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:03 -0400 Message-Id: <20181019010625.25294-35-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 34/56] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986449 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="xvZkG57R"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="XTFJTWpR"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpTS2rCnz9s3l for ; Fri, 19 Oct 2018 12:38:20 +1100 (AEDT) Received: from localhost ([::1]:46053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJk1-0007DW-UD for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:38:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFn-0004sK-Fw for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003LO-Tb for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:35727) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00032Y-DV for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AC89E22977; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:33 -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=nTWeSdVP6nYsinQkB8ZHsNVqkZ2Q7xSVIzCs3MNv1jU=; b=xvZkG 57RLrRrqQRph/teM8hvkxdLs+L8fpyfXWk6oYRC/4wpBp7awqGCX4x+L+YfqZgyJ jfA+9P+Eu+pXF+UvIARuxNO6GE9Ap8roOohiEeWxonejjhf6KWKqO54zlbI5/jhP FJWrF1mGX4KWLJLJiVQls4SU+cmfM9KO+rKfKU= 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=nTWeSdVP6nYsinQkB8ZHsNVqkZ2Q7 xSVIzCs3MNv1jU=; b=XTFJTWpRSxJW/vbHVutlvs19WHpqxrBh+iqT++V0fg/zH 1AT1XcOw8CIl1A5EKWrpeKZ1eXYpgR8r6B/nXCys3plyTKLi/d+gLf/FWT4fJgKX Q16kttSwaWZFJsuYAJwSmIDrlul4QQLD4yFvHOME8KNYy/Lv2ZeoeEYZJMfkqGkZ KeCYQ42kMAbwrP0v/ej81z3pogUzKVga1EuTj3Ml9/pAsRmSXS+6OnvVK//gPFiT oE+8XvXEHmqq9m96p3TlVH7r1DkvNYUwBUctSSk0UtO25mxHRXziU5tQ+exoD3F6 haE+vcUPPuivC6a483BxpSSgaC32AXv51fWEi3QnQ== 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 75F6D102ED; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:04 -0400 Message-Id: <20181019010625.25294-36-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 35/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Michael Walle Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986439 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="VKT6Hvm0"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="nWzdK+MO"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpHv15Gmz9sCQ for ; Fri, 19 Oct 2018 12:30:01 +1100 (AEDT) Received: from localhost ([::1]:46002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJbz-0008Hy-B7 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:29:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFl-0004py-Dt for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003Kj-K5 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:01 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:60747) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00032Z-3w for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id ED7D82297A; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:33 -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=3b91PfgkgobwP9jqpDjrryMniJE0dpqvW3BFnLcnceM=; b=VKT6H vm0GJ6jR1+kBXsIULYdQ3ecpMhs9K3Pb2RdA0e6/YzFexXL9AiEjTyA9bxE0fAmD MWOj4+IllXwUca+lDdh+NtY6gsUb89gT0yhPAo4uwdIdPwczMmHMBl3WkWHP2+ZI PPwhF3nFSo0rvYR1/q2CAeDDhUqLPNa4PEZqec= 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=3b91PfgkgobwP9jqpDjrryMniJE0d pqvW3BFnLcnceM=; b=nWzdK+MOj328rJlIP+AzVW5sK+fn8PqDy3FNVh6pBlna8 wv4P8c/6facqvK1XH42jo06HT6fb+FX6PcHUYn6RMYOZZgaOoKyuwd95HKbyDKrF eKFuhqR2BWmMsHZxRFkr2AIVnhRAu/NhvYBcd6ji2jXbYON7o1g9TNdZMw6N+crh +EdXbMybCpuvf0uRXbUfT2iFqmy1a+vhe4SdQeN8CC/k/GGOH2TTQfmEwdNJWfBr ntlV1YCX4/phxQonT0YR51XQPSuoN+C1e4JzGWOz1+A3rYC4jVVreAlOlPJCeX7B L71ADMFjiquzPMiGb80byLLC3A3CbM0uIcAppe4ig== 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 A46C3102E9; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:05 -0400 Message-Id: <20181019010625.25294-37-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 36/56] 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 , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Laurent Vivier Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986455 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="d9xtENQO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Uo/5Qc5M"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpZs58M2z9s8J for ; Fri, 19 Oct 2018 12:43:01 +1100 (AEDT) Received: from localhost ([::1]:46097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJoZ-00032I-9i for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:42:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFn-0004sL-HD for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003LM-Sq for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:54903) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00032s-Af for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2D9E822961; Thu, 18 Oct 2018 21:06:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:34 -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=z/98dJN658TZtRUZoVO9L4l6s3gziA5HccAYfDpcNCo=; b=d9xtE NQOgM7rSvun6G5JNrBSGhXblEHp5nSndzyT/vLjrpSRvwkwbY9ju6UP92WqHFSCV PC+Om8NdUNyoEASC1AR9CcuPpXyBk7DM3eb4RcsQw5iXVBWTsIr/tfsIFXvxAS3c wxbgQU5KBUrzhLICCj+QF86ofM8xDjhm4Tum0g= 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=z/98dJN658TZtRUZoVO9L4l6s3gzi A5HccAYfDpcNCo=; b=Uo/5Qc5M0pHcz2f4EAUcUuPfvZS+lokuml3998SMGekhk QSt7NsVUMYtMJj7INeAAakD7lGmh1OzywXjhi3J8KUem0m/p7YVuHSF3WtWqTvP+ QZ8DzgRJKGONkLQZpDh4/A9J/RAI+CoKaM2AoCVMBFyd2Rc8qxEfLGJLLOPrP9qy /+GSNMZ3QHupSeMC7w8UwXH08ZgveqAUQnIQvrf46NTw4ZfsdwJO5I1+IQG4GRfh JZtQw0Vman0tWXJ3pQn9P8M203J7XK6fkbmEdtJ6rg2ZK1igNlr77v00ERaF0rkB R7XrzCJAO928zFatFlHW7WPgU7exjnXlsE4V3uAiw== 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 D50C1102E2; Thu, 18 Oct 2018 21:06:33 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:06 -0400 Message-Id: <20181019010625.25294-38-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 37/56] 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 , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Signed-off-by: Emilio G. Cota --- target/mips/cpu.c | 6 +++--- target/mips/kvm.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 497706b669..e30aec6851 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -60,7 +60,7 @@ static bool mips_cpu_has_work(CPUState *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 ((cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { if (cpu_mips_hw_interrupts_enabled(env) || (env->insn_flags & ISA_MIPS32R6)) { @@ -72,7 +72,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 (cpu_interrupt_request(cs) & CPU_INTERRUPT_WAKE) { has_work = true; } @@ -82,7 +82,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 (cpu_interrupt_request(cs) & 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 Fri Oct 19 01:06:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="O0BF6oIC"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="t+03Vch4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpL803TPz9sBj for ; Fri, 19 Oct 2018 12:31:59 +1100 (AEDT) Received: from localhost ([::1]:46016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJdt-0001QS-Hh for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:31:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFk-0004pL-UA for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003K2-68 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56257) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFi-00032p-NV for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:58 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BCB8522980; Thu, 18 Oct 2018 21:06:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:34 -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=RE/bcowOCrz6SQo1A1ageIt5Y7s831JHm7bSni7YKGY=; b=O0BF6 oICZbOu2pkaQUrSAtw1oGrCna/jzeA9KCVMz8Q2nRXK5UQYP04MedzVZ6LLosk32 bMtbS2YPk5MaaWWzOK2wbo9eADGwd83gFuRWTWvv/fuirn/xJjvfcA8WoGXYbpME nHWKeXJffJ3sU3nAf7xEcRG3CNoWlCftP02/T0= 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=RE/bcowOCrz6SQo1A1ageIt5Y7s83 1JHm7bSni7YKGY=; b=t+03Vch4WJHG48oehOK2OdATLd+sQIlP+0KJSTxpZSzAT b0hV73YCSyNMMClrSez3udoPt5RYSE6JnYjKu4ztTJIJWMSSdc9WX5RwfEx93usE ekx2iZS58NRRYrmblEXh0FD8qxyNqGT0Q1Z0u8QXJc0Pb98N8KwdyLMp23ATnus+ Z2tuQ5hnHCNHcYb0fB5ma6rRlT0l0jfpymkbJeOwyMRZpqUsObpOwrWNsa3IVItV frCDadAO4ApcCUdo09AENA8irWuH7DpVC3a0J6vl/iO1PI/34Nn0j+H96+MQ2byQ qRB2ac4QR06O1EfQFOuORQ3ETa/wCuMIvsr6+tsDw== 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 54CBC102E2; Thu, 18 Oct 2018 21:06:34 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:07 -0400 Message-Id: <20181019010625.25294-39-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 38/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Chris Wulff Cc: Marek Vasut Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="vAE0jDkb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Kct+VYfg"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpkm4fllz9s8J for ; Fri, 19 Oct 2018 12:49:52 +1100 (AEDT) Received: from localhost ([::1]:46140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJvC-0001G2-8K for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:49:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJG4-00058e-6i for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFz-0003ae-1O for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:18 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44749) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFt-00033Y-Oz; Thu, 18 Oct 2018 21:07:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E4B4D22984; Thu, 18 Oct 2018 21:06:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:34 -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=nlz8788/AXSxcevPqguh/D59NHSgHk3+Yqzwvp9xPhU=; b=vAE0j DkbtyfAVNsvwzagzTkk7im7Rhlo+IbrGcPbPWKu2hgv1gl58KlLTZyf57uAcvUxc 7NQrXw2MVG+GEwVcgz4h9GO3jK+78P223rTza0ebWlNH0OzuqjGqoI9l/3QxtPbJ oTS3BkKnqmjSFXOifi9FPvGlVPpsNwaZYAjlPc= 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=nlz8788/AXSxcevPqguh/D59NHSgH k3+Yqzwvp9xPhU=; b=Kct+VYfgccBY/nDNzSnxoMAE7Eul5tsd1KAV86NQk3j7h yu9FlwtIjbBkYG5ajBzRreqSO2hV2b0KjFbibJChmIHp611JmYDXsmwW/GpODC75 tTY5GYC4u8kgxt0zPtjmNu1ZOZbBef3Y8HxpmYp+O9FX5rl5NpeYpiapbtvzYhaq baQTeQcgPfzu+R7X/tgl5g4neFfdTq0VzFWuNZQSqJgSY8lVtq/sVrViGruWfwR5 w5IPM+zG6lT8nDHBAUmG87/pplBU06jjuuEqtBBW6eVLHS2/H8t9XjBI6YmGQi3A 74BaoV0XhZJ35Zv7U//pROJSX6jiHBWhM0pi253TA== 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 8F3E5102E9; Thu, 18 Oct 2018 21:06:34 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:08 -0400 Message-Id: <20181019010625.25294-40-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 39/56] 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 , Alexander Graf , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Cornelia Huck Cc: Christian Borntraeger Cc: Alexander Graf Cc: Richard Henderson Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986451 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="DD7o9VXX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ymNSswv0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpWv3fTNz9s3l for ; Fri, 19 Oct 2018 12:40:27 +1100 (AEDT) Received: from localhost ([::1]:46080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJm5-000140-4g for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:40:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFo-0004sw-7v for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFk-0003MD-9G for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44501) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00033Z-Mu for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2B0022297F; Thu, 18 Oct 2018 21:06:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:35 -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=GMCrnjeyzGtITEHb5B7aUEeXbl5vOHjJrndThk57gFQ=; b=DD7o9 VXX4qhxMxyXM1oS30CEUhytMIN2b0PhCTLeGDxxlI7VA38GDbBxQI/jDKz3AQkQs vbiH9RvU+YbMeKSuDEpHcB0PEHC5hDyV+DRqa91JF4U2XtvOgwWNjYOqG5GOJabL TvL2IrIx7z5VMHuyrUNuGw/lnioDi0IyfJuZ4E= 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=GMCrnjeyzGtITEHb5B7aUEeXbl5vO HjJrndThk57gFQ=; b=ymNSswv04kF2/l23X8rHellWbV0FEDO+4N8vRoel4IhqW UE6BtL6phHrJtvjQKWTqRJoNvvp6TF2zQ2MlbZxk1lT9IXPj1lB6NVoeK2o9+SDZ X1ay98nia0IUoLldv2Gl69z+HxRmVCgG9RDIaVxoRtx2Tcr7eYnQg/x6qtdePfYI sygMBkvrSLbA7Tz70wfX6xZz6Vho84OGbR4FJF9jSuXRYtc67Vdo/x13MY4LmIrP B6D4992ng91wKWgy8LdAngf72jo/+XaGkuj9qscA/LjarfBi5BMwjdiKptPYUDwP yH8OuXtCd9QuwPrusMM/UPV3bvAuCfF8mpes96vFw== 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 C89E7102E4; Thu, 18 Oct 2018 21:06:34 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:09 -0400 Message-Id: <20181019010625.25294-41-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 40/56] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="e/fH7bqY"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="RGEhAG0B"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpPl4PNLz9sBj for ; Fri, 19 Oct 2018 12:35:06 +1100 (AEDT) Received: from localhost ([::1]:46028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJgs-0004Nt-Qo for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:35:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFl-0004qM-Sz for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFj-0003LA-Pm for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:01 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:45691) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00033x-7M for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0F78122948; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:36 -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=Ib+Irqp6Mr4LDifRAoK4PJChUgwH7OcZ7SYSVGaGuQk=; b=e/fH7 bqY3vbglXTx6uN/qLdFOq8ZjOcGB7vAFrIoSRlF+9LZqhGT3HIkv8zGzWGvy1GdZ oUDSH/U5ajP6GJxkFZxr55toNjUzlTfV750HvtWTRCORgwOv+86nVuanZCLL6QsM ZPlgxhAgiiTBZmO7l5PcbXIXixMaav60gS3ag4= 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=Ib+Irqp6Mr4LDifRAoK4PJChUgwH7 OcZ7SYSVGaGuQk=; b=RGEhAG0BsijHjJy7x6EvT/1UY79u2EnYJRVnj6nDdsWmD evCINx8XJgSW5JMXOnLl1ECe9yRvwz0t2HgW5FWj0dZUvFCZLKHqoXMQHYrfQa4a Ip53Wc6qfHMNXmMrdj339L52NvIRx0payFp3uLxog/D20jINL3yEgO5ZvpE/b/ZH K/y3pxqRynMJqp48MjT+6EoKH34Ff1fB+R13NIcQsKCs4CJJffiwKU78S2Gtiz0E Qs0IR2tAM05tLoNH0Yj9WX1Ng6U4fNWkjQkfvtr5kwJs5H4dWHKfCOZzNABefOxo e5rOxKKfzk5qQUDytkhdiOk66UppcOnl4m+uFmnSg== 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 7DDFF102E4; Thu, 18 Oct 2018 21:06:35 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:10 -0400 Message-Id: <20181019010625.25294-42-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 41/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Anthony Green Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986443 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="YMYKlAS0"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="GgzNyYnJ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpMS0sjCz9s1c for ; Fri, 19 Oct 2018 12:33:08 +1100 (AEDT) Received: from localhost ([::1]:46020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJez-0002Ei-LT for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:33:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFo-0004tR-R7 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFk-0003Li-3z for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:04 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50325) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00033y-Gy for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4A15822988; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:36 -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=O8p5q93tcYiEYcoYvOek7Xzc6SkRzJy1xhJBQCo8Vhk=; b=YMYKl AS0Nt8sMQ7VudmADGEvUOUTHHtxQxRkVmdwUBD/Ux0tQWgkEkeQgxq1Ei3ooSnOw 8UgA4Q9cLTF7dsTxQ0XXimG6JjD7mOow4EbyPPZfrEG+nJpEON8+BzQiKQ38gsO/ NQYxyqA/yBKqkW5yqYROQSK+ky1DGvQLB45cbk= 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=O8p5q93tcYiEYcoYvOek7Xzc6SkRz Jy1xhJBQCo8Vhk=; b=GgzNyYnJ9uT276bmCs/Hf4y74N66hLC9BaVsauw6vOvIp QwVf77n6sl7wIdl1C2VhFntI8cBUX/rhze/aM/nG7xvmcTfPBuHq+4D/4y1yn5pD IAo5a7qsHcJ6NQDNo5jx2oODS9HDBFa1Uk3NGtfPUh2ZyGx0b5TRZWbELNh4BA4Q fm1K5VZHjJLpkNF35sTV6SArn4hR0tFrqWt1mYfqbEXWxt461SHPZG7hX9cmAjFW vDn7xaAgGJ2ni88DbFi+r8ZrrG5iYy3k292uy9vGaAsU5iqE7JaAUg1RTqCH8PPM 25luo6ReW9y1w91Wem9mbcHmNC3CNEwIxAfc1jIPg== 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 E77E0102E9; Thu, 18 Oct 2018 21:06:35 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:11 -0400 Message-Id: <20181019010625.25294-43-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 42/56] 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 , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- hw/sparc64/sparc64.c | 19 +++++++++++++------ target/sparc/cpu.c | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 372bbd4f5b..640c4b6a30 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -56,11 +56,13 @@ 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) { + cpu_mutex_lock(cs); + 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); } + cpu_mutex_unlock(cs); return; } @@ -87,11 +89,16 @@ void cpu_check_irqs(CPUSPARCState *env) break; } } - } else if (cs->interrupt_request & CPU_INTERRUPT_HARD) { - trace_sparc64_cpu_check_irqs_disabled(pil, env->pil_in, env->softint, - env->interrupt_index); - env->interrupt_index = 0; - cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); + } else { + cpu_mutex_lock(cs); + 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; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); + } + cpu_mutex_unlock(cs); } } 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 Fri Oct 19 01:06: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: 986446 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="D/MMMUiH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZrZjJ/la"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpQ54fDzz9sBj for ; Fri, 19 Oct 2018 12:35:25 +1100 (AEDT) Received: from localhost ([::1]:46030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJhD-0004fQ-6z for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:35:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFn-0004rl-5k for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFk-0003N3-NL for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:02 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:47341) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00034m-Va for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8B5D322989; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:36 -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=VqCUWqgwwu90FfGSvGiwtcK3qQVYDq1lev2Uj3WBHu4=; b=D/MMM UiHBIkO1Y8MVcXu3Vdt84Jmf6OjuygtKBEft+3JYZtLx+zifai5V6X+Oa5/JGO/w QGyBNufHDxTqgCOOeRn1nhPephTCMFiycvWNWIOFvlp+H+8xw4PDg39nuMALrSko AYZfHdzr6kh4zgZhX75G2YHAWQLz5Av929dqEc= 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=VqCUWqgwwu90FfGSvGiwtcK3qQVYD q1lev2Uj3WBHu4=; b=ZrZjJ/laoBG3AqZMGJuki+CP4OPTDkcfTuMieTV8MEpTJ xXFUzXDi+6ScLErBhqpTLeeY9bzRR7auCieZ+iwFHqEkMBMa7Nl+OlNRy9aHIspr sBz2kB2cyYiseCecPEwgSDQFBWaa88u8LCEXeNPJecr7MCqAL+JdUZXzD1weCyCo DMpgb7qDeumQvN3IVIrpNbcZAWquVwytK4zuAwXTO9gCMkK9Hf6SvLJEG5wNX07M udCVN94Ow0LwzAaOMQwUrghcyTglhaX8SPT1d40cj/JuWCnavsNsOPf1Zyiy6s1z NAsDa21cPOBXuBiURoxgw3F4K0RLokzJfdghSvEvw== 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 2CEF4102E4; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:12 -0400 Message-Id: <20181019010625.25294-44-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 43/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Stafford Horne Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="tvQNd4T8"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="tdg9aMGt"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpdX4yMyz9s8J for ; Fri, 19 Oct 2018 12:45:19 +1100 (AEDT) Received: from localhost ([::1]:46110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJql-0005AG-7B for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:45:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFo-0004su-7u for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFk-0003Mh-HE for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50421) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00034p-SC for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AC7522293D; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:36 -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=/7HAzdz9V4gHw39uts8g3aczM4dLh44/OZeuh3DTdbo=; b=tvQNd 4T8EE7QDnezHaYc/9xET9KvRYw1xVDtm0+kKEDEskIsv0S3KVgMlhiAptDcC82Is 0PdplV0xz87FZZzpwgEVxnn+P8CWnqRx3krPCYXQ4/gKe9NMWOwjivDkAn6IyH4p ZE1Oj5MUfgKRhCNp4RK+us2eMyneBKkKdzWKig= 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=/7HAzdz9V4gHw39uts8g3aczM4dLh 44/OZeuh3DTdbo=; b=tdg9aMGt62Hbi2vyeqljpyMgjotAbqyA480ErjL/ESIam KWanwmUNfMpf+uLGgVzCGkHGMvn4OFLW272n3GuFGxRxz1t/tXawIPdHkOZ1ec7D 2RKTuMMyNLGpZ16GFfRHmVAJnJEQcikJz8PfFD2EnPhIVYn4axWArWHZ49+qgeYX VopN1LrWTk46tggQQJssemzQNTmQUfu3gRpXycUMBzDlOffnKqVqhfkicNoc737m bf6EA/+3sYmN3Sfv2lJVEqeB3oVgBK1SacbAGVYYUb0Bt4ix/39wGCAxUDbe9wIo qJFjz7D7cj+v3VOFjaRVbKar7dl+E1DDg0X75O1mA== 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 5CF65102E9; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:13 -0400 Message-Id: <20181019010625.25294-45-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 44/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Guan Xuetao Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="iEDUx6LR"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="S7jXaV1A"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpLd2P4Dz9sBj for ; Fri, 19 Oct 2018 12:32:25 +1100 (AEDT) Received: from localhost ([::1]:46018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJeI-0001hK-R0 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:32:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFm-0004qp-D3 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFk-0003M8-9Y for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:02 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53791) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFj-00034w-Jg for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:06:59 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E9E6F22950; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:36 -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=KIUuXIRpzldGlb4ICvgSb1Z+8snKlhkHrupOU5n5eaw=; b=iEDUx 6LRlWdo77hD45NdA7cE8AXmghHBE4RgJ1e2jw8NIpng3Zn3kTAxVFJZ5W23chgwo 799WReQ8KX3r1XYk1i9D0cU+Mn0gC8zHjEqCxI4J0vzcKquAnfaDkfIwsYK+0qR9 FeX0mDTsPAbQ5e4+mbo2rJfzk3QoKJRxnXQLn8= 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=KIUuXIRpzldGlb4ICvgSb1Z+8snKl hkHrupOU5n5eaw=; b=S7jXaV1AiPUwIm+naMcXu89ceAZcaggcXzu87jGwo7Pmw 8Xen6JGwKvlPNShYsbpe5jEKvg2z2ZjRA32+Ak5rULnWJVuyrQGppgD3+S7Eu8N/ HcB7vJ91EVCwtKqJNEakcAcphvFAuUvXeROtL4nAj5Z+mOdLZK/nYINkxHf19g6Y +NtoJFNjhWnu3OIuMfS01dfKmiLe6CNWFc6uci4WxFEu/74DPz04KHlW6x9l6G8v j6PiWODGCGbHZ6wq2Owtz821i9vwIhI3j0ewg+73/BaPMyUbSHmv97UMIrx0/JLv jthYZr5AwTE04asG2+9WEl9iqpeSjZxSKku/4G10g== 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 8AB65102EA; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:14 -0400 Message-Id: <20181019010625.25294-46-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 45/56] 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 , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: "Edgar E. Iglesias" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- 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 Fri Oct 19 01:06: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: 986432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="LH95mpv8"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="hJ2gpYhj"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bp9M4J0yz9sBq for ; Fri, 19 Oct 2018 12:24:23 +1100 (AEDT) Received: from localhost ([::1]:45975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJWX-0003GA-4w for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:24:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFn-0004rk-4C for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFl-0003NX-0Q for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:02 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:33497) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFk-00034x-1F for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 173FE2297D; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:37 -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=/0LZSCovnqmA2M4oGO78B+VuXmNnzEBHQhm1ii+qf0Y=; b=LH95m pv8TaYNq9RkLiRUm0Rv4ixWmPaYHGIuA+Ezaypa+4MOF+75YT39omD+s2+IcdDPX bAZM29fmJbccmjUfUjEXUeQiAMZ2mr2GBiAUXIavxQyYkeS0zGGllBLrjNjovZD5 HSTFRf8xKPcRF630fp8r8OAsog8netMYROwVok= 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=/0LZSCovnqmA2M4oGO78B+VuXmNnz EBHQhm1ii+qf0Y=; b=hJ2gpYhjqK/TVdPGeptX8tJADLKTtsv0/1j8sorQ7+Bp/ sNfmxlRcfA8wlKpqKlW+WRR7DsnMEFt7rM7of8++4rFHCnLcm/qgrQMcsNx3N1NQ zl2oakC3c0OPPOVg7X6Lwg82JY59orTeNPiOtF7xshMqLOpHcNexsZg2zT9+Wh85 MBnA2+jemSS1QhgzWAWWQE9DDwbJ9SV0Tonrd3qdgcD7iW+C4Mcjrci6g2KQPQXG MXeb5oYInQcOioK+BKi2SYFf+YN5Gepp+uE/veSkRtCG1Z+S0sS2qV2qKQNGusys yTNugajtOqpadGlCuEXYf1zgh4GkTdX9WwiW8gzhA== 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 B93F2102E4; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:15 -0400 Message-Id: <20181019010625.25294-47-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 46/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- accel/tcg/cpu-exec.c | 14 +++++++------- accel/tcg/tcg-all.c | 12 +++++++++--- accel/tcg/translate-all.c | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index f37c9b1e94..25027a1fc6 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,16 @@ 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 +558,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 +595,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 Fri Oct 19 01:06:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="UBbkw6pF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="sW9SfKxt"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpZZ096Sz9s8J for ; Fri, 19 Oct 2018 12:42:45 +1100 (AEDT) Received: from localhost ([::1]:46094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJoJ-0002pr-F8 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:42:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFo-0004t2-BY for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFl-0003Nr-4Q for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:35991) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFk-00035X-CS for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 43C092298B; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:37 -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=FGRgPrm/gA+rsX2AH8wamMUlcAVdc/8it5hbR1Udj/w=; b=UBbkw 6pFfIR5RbJMjySpU0rP1XFEWbddi7IUdHRyz5t2E3CFSJ2Ia8DkWZLZTNhrb7t2f T6ev3Mx9GIEs08HKhsCBhD45lw+kOhH0WaGipcnvX/19euE1PQRVFKLuD/4EywRJ Xqy4/E7o5B7U7TN5XSnd6zt7hdRM+xGcWI2zLM= 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=FGRgPrm/gA+rsX2AH8wamMUlcAVdc /8it5hbR1Udj/w=; b=sW9SfKxt3YSuql0icNj29PuPCRlgv+NkPhGnl1FcVSmlK nbme7FoHgwPt87pXe8T3/SMQODcywlcXri48ip6o/itgOks5oNTLmR9cRZCraJ+1 0IThRYN3iDdgtYHQVcRHCzRu6UYMooOyD0PCZ9+5sQEYQY1AWP7Iibo1n1D/KfxQ zdPsQ+5IyjfvzFD25M/aCLsnJhnU53pe8DWUOpoFhyHGpm3yrog53/pJlQyKPxBD 3SM6WdTaCv+hcWmziRIf6r9LvjwVpZS5xoJwN5/hBPvyDJ/UrWmtrVbCpP9RYcnb wx4tEwGXe2bNAK+vWpJZ0sgcCov4VD9mjJfNHS52g== 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 E825D102E2; Thu, 18 Oct 2018 21:06:36 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:16 -0400 Message-Id: <20181019010625.25294-48-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 47/56] 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index cd66b8828a..ca7d92c360 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -784,9 +784,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 Fri Oct 19 01:06:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="yCVjM7WL"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="dAfAKcZG"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpgy10Jtz9s8J for ; Fri, 19 Oct 2018 12:47:26 +1100 (AEDT) Received: from localhost ([::1]:46125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJsp-0007Aw-Md for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:47:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJG4-00058Y-3W for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFz-0003ad-1P for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:17 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44829) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFu-00035Y-9k; Thu, 18 Oct 2018 21:07:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8C05222946; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:37 -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=0n3Kj8wGOyAiuCv+YmopcIS5coZyIBJ8kAK9IYHaAlE=; b=yCVjM 7WLV83iyPQnccn+oDvSwWUN1NWscLr/Avf1m2/U4ie1rfNwBJ2TqcBdyd/Bck6MF bgz+bKmZ3QnIoZpguHR1XuQOra5mrj0E6/QjeqpdZ3hpnShZZQnXYpbq2cKqUavy uh9gFnRcKyAXfAfcAyhKUv2HQMtEOU+pfW/PDY= 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=0n3Kj8wGOyAiuCv+YmopcIS5coZyI BJ8kAK9IYHaAlE=; b=dAfAKcZG+CCnHe6jvSkkk+eP47CmB9UQGt+S6rifnbwBB nfi+IfNh+ajRh1+F31ELrM32OXSdGGa/XTVHe9iUMtwf4Fgkz7+eoaFc7KqR2hrE KCzzFJxHRumbaTGEiJMHpJdXE9v/kScdw1itVMcM0Pn8ZH6V5MLcMo54oglCoyRk tGMedhEoomBxmyTYNWONzZIevx/pzy0xBv0G88Nc2O37qGD/n45PJ8bb7o94Jteg dLUvF++wPNq48BaM1E9ktZ+F23sqIYcPGmkYoYNvLvwDPGgE1D/Vn95E/ansMTIj V/A6rVLlPDwGchR6QJzKZgK1EE/uPC/diphL4pKAw== 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 20EC5102E9; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:17 -0400 Message-Id: <20181019010625.25294-49-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 48/56] ppc: acquire the BQL in cpu_has_work 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-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Emilio G. Cota --- target/ppc/translate_init.inc.c | 77 +++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 6827db14b6..a206715873 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -18,6 +18,7 @@ * License along with this library; if not, see . */ +#include "qemu/main-loop.h" #include "disas/bfd.h" #include "exec/gdbstub.h" #include "kvm_ppc.h" @@ -8440,11 +8441,13 @@ static bool ppc_pvr_match_power7(PowerPCCPUClass *pcc, uint32_t pvr) return false; } -static bool cpu_has_work_POWER7(CPUState *cs) +static bool cpu_has_work_POWER7_locked(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; @@ -8474,6 +8477,21 @@ static bool cpu_has_work_POWER7(CPUState *cs) } } +static bool cpu_has_work_POWER7(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = cpu_has_work_POWER7_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return cpu_has_work_POWER7_locked(cs); +} + POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -8594,11 +8612,13 @@ static bool ppc_pvr_match_power8(PowerPCCPUClass *pcc, uint32_t pvr) return false; } -static bool cpu_has_work_POWER8(CPUState *cs) +static bool cpu_has_work_POWER8_locked(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; @@ -8636,6 +8656,21 @@ static bool cpu_has_work_POWER8(CPUState *cs) } } +static bool cpu_has_work_POWER8(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = cpu_has_work_POWER8_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return cpu_has_work_POWER8_locked(cs); +} + POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -8786,11 +8821,13 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr) return false; } -static bool cpu_has_work_POWER9(CPUState *cs) +static bool cpu_has_work_POWER9_locked(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; @@ -8829,6 +8866,21 @@ static bool cpu_has_work_POWER9(CPUState *cs) } } +static bool cpu_has_work_POWER9(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = cpu_has_work_POWER9_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return cpu_has_work_POWER9_locked(cs); +} + POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -10231,14 +10283,31 @@ static void ppc_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.nip = value; } -static bool ppc_cpu_has_work(CPUState *cs) +static bool ppc_cpu_has_work_locked(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); } +static bool ppc_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = ppc_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return ppc_cpu_has_work_locked(cs); +} + /* CPUClass::reset() */ static void ppc_cpu_reset(CPUState *s) { From patchwork Fri Oct 19 01:06:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="r2e+IJpf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="KuWJbcGT"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpQx2T9lz9sBq for ; Fri, 19 Oct 2018 12:36:09 +1100 (AEDT) Received: from localhost ([::1]:46040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJhu-0005GI-SA for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:36:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFw-000508-VN for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFl-0003ON-Ap for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:09 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:38915) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFk-00035s-IE for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:01 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9152E2298C; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:37 -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=cgFC/XFnNzX6peGQwRTxkjCGBQlGlMlHeArxc0Ia9yI=; b=r2e+I JpfDp+SaMlBwBVAIjHhkww+pkasjb3JK0+PFd3/3sP4tTHECjAPmsBErTa1RevMT AUt00ZEBeCsfa0iLje5X92//GIVL8u/QHbeTNYz/dCAVxCq3bG9rvGyT4mxtC6dr RJAfD6x3+oCHjzA6vtgOuapE5qTeTySI1jvUBM= 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=cgFC/XFnNzX6peGQwRTxkjCGBQlGl MlHeArxc0Ia9yI=; b=KuWJbcGTSlH+erkNry4uEkM5xVP0sSqQm4WxTeZrI5jUS aBXOaBiqiGqqmOJYKpyjtiCiiq+vFyEuleQOFoSohFRljSQieLKhOZ94EhvfxjO/ Vrsjnc/Alr6nnH7N+i0/Qp3u49S4BvnpONBj/yy6VgKIr8d+kaSXdPrGSL+xAKrn wbHlVVzETFdE0+sDseuTGSrMZs9L/nKM1aPLZy4cvSDU2iQEUWo4/5oIW8xELGNs rH313Wsv8du2tcshZ8fJuyq62du7hEPiUl9nQ8Y6WKeVRu1qfXpDOYC4Hoo8Gkdf v+fYZ36Ag+os4xrGfIWCdf/OZUORns9N+G/kExQCA== 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 542C6102E4; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:18 -0400 Message-Id: <20181019010625.25294-50-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 49/56] mips: acquire the BQL in cpu_has_work 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 , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Soon we will call cpu_has_work without the BQL. Cc: Aurelien Jarno Cc: Aleksandar Markovic Signed-off-by: Emilio G. Cota --- target/mips/cpu.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index e30aec6851..ea30c3c474 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qapi/error.h" #include "cpu.h" #include "internal.h" @@ -51,12 +52,14 @@ static void mips_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) env->hflags |= tb->flags & MIPS_HFLAG_BMASK; } -static bool mips_cpu_has_work(CPUState *cs) +static bool mips_cpu_has_work_locked(CPUState *cs) { MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; bool has_work = false; + 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. */ @@ -92,6 +95,21 @@ static bool mips_cpu_has_work(CPUState *cs) return has_work; } +static bool mips_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = mips_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return mips_cpu_has_work_locked(cs); +} + /* CPUClass::reset() */ static void mips_cpu_reset(CPUState *s) { From patchwork Fri Oct 19 01:06:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="zntex5H6"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="QFgV7jx+"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpWl1LmNz9s3l for ; Fri, 19 Oct 2018 12:40:17 +1100 (AEDT) Received: from localhost ([::1]:46078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJlt-0000vB-Vh for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:40:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJG4-00058W-3V for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFz-0003am-1g for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:17 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:42489) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFu-00035r-5o; Thu, 18 Oct 2018 21:07:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EC8C622999; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:37 -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=WWoQNqgXgGeDKYZYOINDvrA1SPGrGpZQ/hp1KXXxUfI=; b=zntex 5H67Y0M3gvIr0iURWzpro/uGqCu6ZSe6mL4tMzc1lzmzcE2IDt8w2WwSA5uG1bPg eh1I+P1m6tZ8OjilGOtzqejFFRkKi+erXV8Uar1ur8Nik6xs8EwvdbPH33TiPaEN oRTmazhD+5BVYJ+Gz1SbkHUIRJNoTKWEddOy1o= 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=WWoQNqgXgGeDKYZYOINDvrA1SPGrG pZQ/hp1KXXxUfI=; b=QFgV7jx+o1Yls12HRM42Z+y+2OaBI/XuB/XoCg9vhEYBq h3ELHcOmkeCVno0xRUcJg2WMXeHu4cGu9V/BjuV3HtapGifnk8CwGQo7VFL69JZe IAktJouPOncA8Q53qxxJdRda4BoAItg3iD5Dlpw9PFA/oXDxksK/rxd7qwLBzeBO FTDukzVxFy4ePvZIXqXUh0jtJbIyOwKwO5MzJnojtBVcd/hIHbGLdh2fsActfepr amy0OkRGZXcxx2vOpNdoIceXtqSkm7BVu7roCHq8yRMFV/Vl3nDh92s9nKw51CQ1 GSHOaVA+L3mR8KrogGo40TYrKmlBMT9IU5bYbdSjw== 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 8BA4D102E2; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:19 -0400 Message-Id: <20181019010625.25294-51-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 50/56] s390: acquire the BQL in cpu_has_work 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 , Alexander Graf , qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Soon we will call cpu_has_work without the BQL. Cc: Cornelia Huck Cc: Richard Henderson Cc: Alexander Graf Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Signed-off-by: Emilio G. Cota --- target/s390x/cpu.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 1f91df57bc..64c10ad115 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qapi/error.h" #include "cpu.h" #include "internal.h" @@ -55,10 +56,12 @@ static void s390_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.psw.addr = value; } -static bool s390_cpu_has_work(CPUState *cs) +static bool s390_cpu_has_work_locked(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) { @@ -72,6 +75,21 @@ static bool s390_cpu_has_work(CPUState *cs) return s390_cpu_has_int(cpu); } +static bool s390_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = s390_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return s390_cpu_has_work_locked(cs); +} + #if !defined(CONFIG_USER_ONLY) /* S390CPUClass::load_normal() */ static void s390_cpu_load_normal(CPUState *s) From patchwork Fri Oct 19 01:06: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: 986461 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="zyqhhHJe"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="OupMJIql"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bph86THbz9sBq for ; Fri, 19 Oct 2018 12:47:36 +1100 (AEDT) Received: from localhost ([::1]:46128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJt0-0007JU-FV for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:47:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFw-000507-V6 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFl-0003OT-DB for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:09 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:40869) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFk-00036H-KJ for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:01 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1A8682299E; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:38 -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=4bGzpLYb/4dNvp50r7x0JAjhTMTHnpYkTR6dvybtdE8=; b=zyqhh HJe8ZoL0ADzv2FoCJp/Gj4tzT5mM4C7R9n7gO6UOJ4NOTdiIJ9Umlj40egeQzbDt dfrK+TpNllZYT1jwSoLc9EJcJ269GDxzwiYmsqQg2dXm5kqU+EbNTKl5wj6QIVoh RLRADhfrvUw5x+ijO2p8YxFrV+2lccjdKOFDZI= 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=4bGzpLYb/4dNvp50r7x0JAjhTMTHn pYkTR6dvybtdE8=; b=OupMJIqlxqw9NmjyYtr8lOUGZiVTN1fTsTeVx7oBhKG2R 3KjGvQ3xlqR0iXuh6+DK8I4rZnLOu9bUtqPxJP3R//oWQWJXDuZXFpNNH9/YSkuQ jj4ZflZAt14ljzAIaTcGIJizrCuj1F0oPmczgvozQs7fPc/EtxXlC7SsYYCGsrvA 6KTqVrzFH4thsM0148nQlpFuGy7HTRzq8dy8Xnm/eT+4HDRosyy7GNGQ41eEt08S HJoczG93e8aRE6ke6/DZkxFdh75p7oc43zQ/AqZ7CRwV7UNvA80eBmN2mR1l6h5F VAUkfabg6xfmi6VV52bAzMfdmS5KRTYGu4VM/ORqQ== 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 BCF8B102DD; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:20 -0400 Message-Id: <20181019010625.25294-52-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 51/56] riscv: acquire the BQL in cpu_has_work 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 Clark , Palmer Dabbelt , Sagar Karandikar , Bastian Koppelmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Soon we will call cpu_has_work without the BQL. Cc: Michael Clark Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Emilio G. Cota Reviewed-by: Palmer Dabbelt --- target/riscv/cpu.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index d630e8fd6c..b10995c807 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" @@ -244,11 +245,14 @@ static void riscv_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) env->pc = tb->pc; } -static bool riscv_cpu_has_work(CPUState *cs) +static bool riscv_cpu_has_work_locked(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 @@ -259,6 +263,21 @@ static bool riscv_cpu_has_work(CPUState *cs) #endif } +static bool riscv_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = riscv_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return riscv_cpu_has_work_locked(cs); +} + void restore_state_to_opc(CPURISCVState *env, TranslationBlock *tb, target_ulong *data) { From patchwork Fri Oct 19 01:06: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: 986436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="Y7Z7hWfb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="bvVA4iB7"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpDx0XKgz9sBj for ; Fri, 19 Oct 2018 12:27:29 +1100 (AEDT) Received: from localhost ([::1]:45993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJZW-0005gN-Kt for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:27:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJFx-00050C-01 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJFl-0003Ny-4O for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:09 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:39031) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFk-00036E-FH for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:00 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 565182297C; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:38 -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=6ctBkViDGdy5H7c482YWa/meusLR3zkhGhewvDDJGsU=; b=Y7Z7h WfbzwM3vXLqNccxDzXJrnuS5QPXKOJlsUmMZazIZbIbPG++U8vaQaGIuCUV0RDVL V2XOAAbQz9cNDICboaJkx9o497Pa78MzzGZDY/4IMQAb0J33nvnKlCfmsfWtw76L +6TUL+dI0DJMhxFSFEp2y9J+wD8MXGBwOKO+zI= 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=6ctBkViDGdy5H7c482YWa/meusLR3 zkhGhewvDDJGsU=; b=bvVA4iB7EiuK/DTikph1s05F5EWbzPeMZAgy7ib3QM2Ep /+czgBxCrjQa9IdyYJKkhydc46Rn1o8bm9k/Qm19KisHgOdHhTzcK6aVzOGU9jbL VfWlkXNIgz/YXDFHkZ8I9YPu1YJWastU/ISMOKW0UJJearth4CQN34F5E3yvC7ul jPMSNA21MYi0LUvFKgpV5YVbDQ8Th3vzhe9PYL01DlqpX3yAlvWIZE6qx635Q0rY vaYjO1LcgNADxqAPOPfIoZPYGRrcHvY5ccITwzl7RBbGQOaDECqyaL9qcR6EAvkO ZsiV+HhKgACrvIhkxyyyuyf8rcI8/xdIjXmzdNjZg== 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 E2BFF102E4; Thu, 18 Oct 2018 21:06:37 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:21 -0400 Message-Id: <20181019010625.25294-53-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 52/56] sparc: acquire the BQL in cpu_has_work 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 , Artyom Tarasenko Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Soon we will call cpu_has_work without the BQL. Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Signed-off-by: Emilio G. Cota --- target/sparc/cpu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 88427283c1..854c1733c8 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qapi/error.h" #include "cpu.h" #include "qemu/error-report.h" @@ -704,15 +705,30 @@ static void sparc_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) cpu->env.npc = tb->cs_base; } -static bool sparc_cpu_has_work(CPUState *cs) +static bool sparc_cpu_has_work_locked(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); } +static bool sparc_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + qemu_mutex_lock_iothread(); + ret = sparc_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return sparc_cpu_has_work_locked(cs); +} + static char *sparc_cpu_type_name(const char *cpu_model) { char *name = g_strdup_printf(SPARC_CPU_TYPE_NAME("%s"), cpu_model); From patchwork Fri Oct 19 01:06:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="meyCs9YU"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="adLYGPBN"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpsF729Fz9s8J for ; Fri, 19 Oct 2018 12:55:28 +1100 (AEDT) Received: from localhost ([::1]:46206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDK0Z-0005cG-GD for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:55: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 1gDJGO-0005U6-Aj for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJGK-00042J-Sq for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:40 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:33717) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJGI-0003Hk-5E for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:35 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 64BD822982; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:38 -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=1VA5Z7/mwyaiI9SksGJXKlgeDueRRBYKEMy4uxZdkME=; b=meyCs 9YUrYLy93C3RbRcQRLSl+xH/9nTSWKeeJFU0vVMsBFqfwbzn5t8GUgvMAgwFBvFE 4WoSzDF0O5Z0pKP3JdnMPaYX+b5F61/QAhi60oIbu0/gALC2wIruM+LBwHrX45S1 B+xGdt0Y2sQ2HRhooZxdfpJ3SoJu7aOPiqSuSs= 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=1VA5Z7/mwyaiI9SksGJXKlgeDueRR BYKEMy4uxZdkME=; b=adLYGPBNSlhBPBBlD8cc2E3twpbOINwckq54/vNm2aPoq zwVbfDEbQih5qbuHFHtAHdd/nnw+/pUuK8otwhxKRiRqSGmYgswvG3LbRw22zsZ1 +t7pmm4kADXUGAZjlC1iMLhJ1kvfJM11OlfZrBPNCgc0Gu7vjJExTwH6MmmRptE4 7MmbhAYwoll8sEnFB6pBZG3GTO+Z74IdSJSabIXbDihIgEvA+wZdcGa7jzEmkuuP pZPP3e9yRaMv5I/cLeK4GusoprZd0kMX+mnc6zuLuHUZ5GhVlR55fovrSdBICPsx P27XZNk/J9snSWm4DNPcsDOoFq/CpLIQ3c6JpW73Q== 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 1D09C102E2; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:22 -0400 Message-Id: <20181019010625.25294-54-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 53/56] xtensa: acquire the BQL in cpu_has_work 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 , Max Filippov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Soon we will call cpu_has_work without the BQL. Cc: Max Filippov Signed-off-by: Emilio G. Cota --- target/xtensa/cpu.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index d4ca35e6cc..5cb881f89b 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" @@ -42,17 +43,34 @@ static void xtensa_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.pc = value; } -static bool xtensa_cpu_has_work(CPUState *cs) +static bool xtensa_cpu_has_work_locked(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; #endif } +static bool xtensa_cpu_has_work(CPUState *cs) +{ + if (!qemu_mutex_iothread_locked()) { + bool ret; + + cpu_mutex_unlock(cs); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cs); + ret = xtensa_cpu_has_work_locked(cs); + qemu_mutex_unlock_iothread(); + return ret; + } + return xtensa_cpu_has_work_locked(cs); +} + /* CPUClass::reset() */ static void xtensa_cpu_reset(CPUState *s) { From patchwork Fri Oct 19 01:06:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986457 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="F3L9pSQx"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="eRmwJaTx"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpdG58glz9sBq for ; Fri, 19 Oct 2018 12:45:06 +1100 (AEDT) Received: from localhost ([::1]:46108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJqa-0004zA-Ag for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:45:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJGJ-0005MV-1D for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJG7-0003jE-5Z for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:27 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:55581) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJG4-0003Hl-Oy for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D31EC2298D; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:38 -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=wbWLHnB+eNqK5uZsq4wg44MiXiaFsPLBVmSZnZyqnKk=; b=F3L9p SQx8ApDIAIEBDo4i9Oup7VJmFRXKcQyBb67b/Pw53ObGZ+FShXZktULAFOjrE6Mr Jey32c8JmvVSJX2WTquqU/9HUlzv20qVkJ4QEBycdJhdiV+RMLaK+Sfa713IHJMS mFk9NT4KhkQoMVUymkEV69NZlgVHfR0aaXDVDk= 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=wbWLHnB+eNqK5uZsq4wg44MiXiaFs PLBVmSZnZyqnKk=; b=eRmwJaTx3gajNa3t02XSQv5Bjz52HFZInYyt6F7U0P2S3 QksduO9EGnje3XlbE12x+mLYhzZUKi/NXdtK4Jkqtx7CiRHAoKEYhCXdwY1GNEhg 0Hb0hAgjFP33kJ+xvqVO7h+PdDlkBMV2wlR2irJcHdLd99VXWNdYK1+R4DX6+si/ +CaRpbC8euThTcWdXZWWK8pwI1gx7FW4Is0C+/bNscTREDbhgrUWfWIPT3v9+Wwg qpyJdetUQSmPcq1wuZnw0T/LDUbRGx/f3EG3+yvLVrv8a2uxX9T0VYlcZ9UmnqD3 hzR28mgjy0WE237JsyKdUYV8KQ03GXxfGPv4NwP5g== 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 4A97E102DD; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:23 -0400 Message-Id: <20181019010625.25294-55-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 54/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 20 ++-- cpus.c | 290 ++++++++++++++++++++++++++++++++-------------- qom/cpu.c | 23 ++-- 3 files changed, 221 insertions(+), 112 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index ca7d92c360..b351fe6164 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -286,10 +286,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. @@ -318,6 +314,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). @@ -341,12 +341,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; @@ -360,7 +355,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; @@ -407,7 +408,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 a101e8863c..c92776507e 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; } @@ -1221,14 +1243,11 @@ 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 +1265,66 @@ 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); } - process_queued_cpu_work(cpu); + process_queued_cpu_work_locked(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 +1344,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 +1357,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 +1378,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 +1404,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 +1415,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 +1427,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 +1462,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 +1544,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); + cpu_mutex_unlock(cpu); break; } + cpu_mutex_unlock(cpu); } } @@ -1511,25 +1573,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 +1625,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 +1641,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 +1649,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 +1666,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 +1696,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 +1723,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 +1742,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 +1750,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 +1771,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 +1793,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 +1803,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 +1864,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 +1879,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 +1894,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 +1912,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 +1947,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 +2010,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 +2028,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 +2075,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 +2092,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 +2109,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 +2126,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 +2134,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 +2145,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 +2160,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 +2175,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 +2187,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 +2201,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 +2235,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 +2373,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 bb031a3a6a..2aa760eed0 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -94,18 +94,14 @@ 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 need_lock = !qemu_mutex_iothread_locked(); - - if (need_lock) { - qemu_mutex_lock_iothread(); - } - cpu->interrupt_request &= ~mask; - if (need_lock) { - qemu_mutex_unlock_iothread(); + if (cpu_mutex_locked(cpu)) { + cpu->interrupt_request &= ~mask; + } else { + cpu_mutex_lock(cpu); + cpu->interrupt_request &= ~mask; + cpu_mutex_unlock(cpu); } } @@ -261,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; @@ -374,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); @@ -397,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 Fri Oct 19 01:06:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="2kL85ViH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="VRl0jHrD"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bpZK3XXbz9s3l for ; Fri, 19 Oct 2018 12:42:33 +1100 (AEDT) Received: from localhost ([::1]:46092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJo7-0002i0-4u for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:42:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJGA-0005EF-OS for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJG4-0003ea-1J for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:23 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:57283) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJFy-0003IE-VY for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:15 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E7D56229A2; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:38 -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=bjDEox4ckEBpanQjRZ0OtgtJMDzEvBRJSzpiIY6OWmM=; b=2kL85 ViHpgoz6A3fdXNYN03nPMGyeJ4gAelh4no7jdPWenu6l+UETOd7FmDKd8TKc/sL5 pjJ6Z+1O0661xgSUUkzSQbjs8sKv4IaaP27rzDGmWZkM9Ku5yUGnMYPR87aKIZ37 KFHlcLkbB5eNiF2abG/Jujf7+uokV9/kMzSd/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=bjDEox4ckEBpanQjRZ0OtgtJMDzEv BRJSzpiIY6OWmM=; b=VRl0jHrDalL3rVOEAhiDXufOZsZja2ELXeHS/U447vOYO bDOyK9+DNwyTX0v45HhFwmu+mArwEB1sjN4C5huPk+Vsd5T9J9M5MonEyNqG8KAg kDDNnJBMArAidBDOjtmz8svdL+g9i61AaNOoBxoIWubE/R9I+VskBat1R3X/GGQg qdNjS73wB6W42/WnzPokLIo6pkUTSnkT7pEi3lw+N1ITrB+8BiunYFDgvXgJlE4P /dUZXiY/8o+kKbm8/CJkt+ACU/f2nihpuclP4vIK0++aex069V7ZNRj/03pzWYxp ZyCinJ0yfLPlkHzVaIUtvzAHWteiFFUL6HYJ0KlXA== 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 7FEC7102E2; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:24 -0400 Message-Id: <20181019010625.25294-56-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 55/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Some async jobs do not need the BQL. Cc: Peter Crosthwaite Cc: Richard Henderson Signed-off-by: Emilio G. Cota --- 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 b351fe6164..3028447002 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -842,9 +842,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 d559f94ef1..9f33cc94d5 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 */ @@ -145,6 +146,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi.done = false; wi.free = false; wi.exclusive = false; + wi.bql = true; cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); @@ -167,6 +169,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); } @@ -311,6 +328,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); } @@ -335,6 +353,7 @@ 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(); } @@ -345,12 +364,22 @@ 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 Fri Oct 19 01:06:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 986464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=braap.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b="iu5P4xuX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="C74gkH6m"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bppc6JNcz9s8J for ; Fri, 19 Oct 2018 12:53:12 +1100 (AEDT) Received: from localhost ([::1]:46197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJyQ-00042b-He for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 21:53:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDJGD-0005Hn-SV for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDJG5-0003gc-0M for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:25 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56675) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gDJG4-0003IF-7E for qemu-devel@nongnu.org; Thu, 18 Oct 2018 21:07:20 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2972422997; Thu, 18 Oct 2018 21:06:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 18 Oct 2018 21:06:39 -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=Rc0vtpOZ+mYZ7ojbLgiPS1boek259MdYKvs3E4ljKWQ=; b=iu5P4 xuXs1zQA9OQK6s7BxYcVRR8fojR+zPLOU5J7/y2Thg1P7B53FdjHon4XPYXlVx9A GXIFILxJDMSoOBU7t66NOvkGy88nA+AfeMYw6WVCvBqlB791OCQr76RuhdZDxFxz NZXM2bkvdP6EDQqBh55gbAOzM23a+I8/F3Ki8c= 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=Rc0vtpOZ+mYZ7ojbLgiPS1boek259 MdYKvs3E4ljKWQ=; b=C74gkH6mTJw0ROLGkKcIuWMLdlwqs3o5DjElS2UeoIFSd fNS6oocKPvDFhq5BgTrenYlD8zfGsFBOOgAk2aPk/VL7qhcy34pqFnwm3z0ekxOu CqJufeBg/4P4gVaiMoIM7IaU1XtwS9CZT3teY3BBc2uEDeCwSZqNGElLYq0tXWTD YCjAj98WX4KdxoDbhdvRrFya1HAEAtZ17Uid3XEa2cQHAqL0byipCOrxOioYL6xY O1pIOIosJSLcdirH7UdU4inVjnroqhMEceEmsM2kVV1RBS7Lq7x2VLukD9MvNbp2 ceDKLYtPLiBAoWcmd0+YDXxXsDa2ty2Yz3CRg94NA== 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 B5B08102E9; Thu, 18 Oct 2018 21:06:38 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 21:06:25 -0400 Message-Id: <20181019010625.25294-57-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181019010625.25294-1-cota@braap.org> References: <20181019010625.25294-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.29 Subject: [Qemu-devel] [RFC v3 56/56] 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 , Peter Crosthwaite Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Cc: Peter Crosthwaite Cc: Richard Henderson 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));