From patchwork Wed Jan 30 00:46:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A159922 for ; Wed, 30 Jan 2019 00:55:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D5AF2C972 for ; Wed, 30 Jan 2019 00:55:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61BCA2C9C5; Wed, 30 Jan 2019 00:55:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD1952C972 for ; Wed, 30 Jan 2019 00:55:54 +0000 (UTC) Received: from localhost ([127.0.0.1]:57874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeAU-0005v9-2c for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:55:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe35-0007sm-FD for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe34-0000d1-Du for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51245) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe34-0000cm-7u for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CBD9521D1F; Tue, 29 Jan 2019 19:48:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:13 -0500 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=4o94DGkzqYYU7HKDH1GvvfDwoknjXbc/2dQRF8MFLxY=; b=e/fE9qpcJl4G rG7TkDqlyBtlMI88KrouWpPru6JlKvVKB8xx0pMV8Mp7F1EdbBFT9aSFVczgaiSZ 5lwO5C2KiHkhrQIbCeWK5N7UZGEQbdpmc3Fmkgsc/N1U8dD47XNS14XcpEf2IZzZ bMHwMjWFQ/G5iJqckF7KueSS2oJgXvE= 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=4o94DGkzqYYU7HKDH1GvvfDwoknjXbc/2dQRF8MFL xY=; b=BUaIAGkLB5nb5sqroe617IFMh/K4PSLf+S3OmHZrHGyN2PgK6XXM/dDE7 LTEP1SkM6i/HzxLXDY0lC/NcefmynsOC/g6YkRHCf++kqDZ0pYmjxMBIkDXgLbKk L9BymyVW8yRNtaAwgcO5FYft7TTtxyq7AuOV/8ZX/iWxgK+LL7k4VoPq8bA+VyN6 6k2vMgh+MhNCKiPkeSVE5xPUsDv4ycbzIHNRPFRFw1zX6IpNo99zP+AOsn/Cue97 muI563YUfOH0/ZthZ5CIUIfZVDhwiwY7/W/bVwIYZixjq6QL4gtR4qYl5PU1YoVE g8VNAKebROY5uCZzszENrF7m7Y2Hw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E4524E4664; Tue, 29 Jan 2019 19:48:12 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:46:59 -0500 Message-Id: <20190130004811.27372-2-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 01/73] cpu: convert queued work to a QSIMPLEQ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of open-coding it. While at it, make sure that all accesses to the list are performed while holding the list's lock. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 4c2feb9c17..fc39f5d529 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -321,8 +321,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). @@ -363,7 +363,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 3ca58c64e8..a1bbf4139f 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 b09b702712..edde8268b9 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)) { @@ -1513,7 +1523,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 f5579b1cd5..06d6b6044d 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -372,6 +372,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 Wed Jan 30 00:47:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B65F922 for ; Wed, 30 Jan 2019 00:53:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E85F2D278 for ; Wed, 30 Jan 2019 00:53:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D672D285; Wed, 30 Jan 2019 00:53:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8AC172D278 for ; Wed, 30 Jan 2019 00:53:06 +0000 (UTC) Received: from localhost ([127.0.0.1]:57820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe7l-0003SL-R6 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:53:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe35-0007so-Lb for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe34-0000dP-Iu for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42885) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe34-0000cn-7x for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CBE3B21F05; Tue, 29 Jan 2019 19:48:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:13 -0500 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=ICE/rgl4oo1aBksMxcqMPrEMzubRrHm3PbFVORA3e2w=; b=yNty3ugJod4d dEhqkJNO7lDASvMytOV7B3EZn4Kzw1sPXtdLgHvkZH2C0LKtUSk0IMFHiauFVb9H R37P0ZTIQ9rI/avrS56wGrRvdGJ8Pk64RbIVLatK1mGk4knXmNOA7V4mTZaALwdH K96Y89wDyKVutMHcoRYJ4z/D9TGYdgw= 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=ICE/rgl4oo1aBksMxcqMPrEMzubRrHm3PbFVORA3e 2w=; b=MtmbmBLskuBQmJ58GJlmtLFGxXWPxQ1D3qY51z1oc21LEZ2/PhiC3WQtA XOyEoBbiMDkq6SaQJQnDsTP1GCdk5UDJMLjT9cbmQ4t+5MKihyOt67TqCDaj264p 88O4un3pNNXfmU8RGOZnFFU4shh7AzVJZFyO1HpCE9YBaAbP2BFUKnMyH22x/oU7 j2J/kD4MguUaCnfiITVn8b72zo/BzgiJY2J59A9OraBqfKquVxRqvWcqHkHggB4K 4A/5GZcj+41IcJdeC8fssVs11KwZltk88twtKcG7g+lu00N93Zm8LBlqSCahXQSJ ZG9iG7Ey6xabJYK2/iuaGfXQhUshQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 41F62E4667; Tue, 29 Jan 2019 19:48:13 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:00 -0500 Message-Id: <20190130004811.27372-3-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 02/73] cpu: rename cpu->work_mutex to cpu->lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This lock will soon protect more fields of the struct. Give it a more appropriate name. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 fc39f5d529..6224b83ada 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -321,7 +321,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). @@ -362,7 +362,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 a1bbf4139f..d0e619f149 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 edde8268b9..9a3a1d8a6a 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 06d6b6044d..a2964e53c6 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -371,7 +371,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 Wed Jan 30 00:47:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A856B159A for ; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C8B72D18F for ; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F2D12D19C; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F17392D1A5 for ; Wed, 30 Jan 2019 00:50:03 +0000 (UTC) Received: from localhost ([127.0.0.1]:57760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4p-00014Q-6d for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:50:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe35-0007sp-NY for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe34-0000dA-FZ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50467) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe34-0000cq-8r for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 063A32206C; Tue, 29 Jan 2019 19:48:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:14 -0500 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=o893rZIY7m1Hf/4poo3+z9DUik93TjyaofXmLKJt0VI=; b=xSpWy 8PZ3+RTUx3vGkRP3oKuDAK3k0s6PeDjNmwaBkiS1oSHYt2Y/nM6vNPjS2PT/dTCE P+c7aIVgX9gE2JMiw17E0YSGBQLFioLHp2acboa5Cai6ctkQJrQCvy0pNw0M5w6F DVxKJ+ozXsUJsVuvpyjA0FXGZM9xVc8rugjV6E= 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=o893rZIY7m1Hf/4poo3+z9DUik93T jyaofXmLKJt0VI=; b=ZImpEZXc/hhEq/koFCVyCCrRE2v+LOEpW4yTCq6Z6C4qm dfMB502OZ+D99Y9GeVIxVjEysxaoupdIy3Kmmkra21xt6VRXIOSYzxg2iPzS3Jdh Fa7pJQIvSTORlm80RGRXyxE/YCyfrgR9w8k5pllu9nf/FvFH+0eYe/oGB5+b7Dfo vWXTUY8V+x7+UH0LC9nCFHJ23rvtkivqbtNe/QQXh287ThEYcD2dk459WQSQjKYa xLcJeO8BaQC9emHQMVDNqBO0UmfAh0pMlXIeq1wqn97ZqR35GqV0GzPYl2SCQ7Ku 9tbAETrc0jgcLvmB3w4br0QxQXzmjYJG/TwK7r7lw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 83901E4559; Tue, 29 Jan 2019 19:48:13 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:01 -0500 Message-Id: <20190130004811.27372-4-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 03/73] cpu: introduce cpu_mutex_lock/unlock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The few direct users of &cpu->lock will be converted soon. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 33 +++++++++++++++++++++++++++++++ cpus.c | 48 +++++++++++++++++++++++++++++++++++++++++++-- stubs/cpu-lock.c | 28 ++++++++++++++++++++++++++ stubs/Makefile.objs | 1 + 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 stubs/cpu-lock.c diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 6224b83ada..403c48695b 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -454,6 +454,39 @@ extern CPUTailQ cpus; extern __thread CPUState *current_cpu; +/** + * cpu_mutex_lock - lock a CPU's mutex + * @cpu: the CPU whose mutex is to be locked + * + * To avoid deadlock, a CPU's mutex must be acquired after the BQL. + */ +#define cpu_mutex_lock(cpu) \ + cpu_mutex_lock_impl(cpu, __FILE__, __LINE__) +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line); + +/** + * cpu_mutex_unlock - unlock a CPU's mutex + * @cpu: the CPU whose mutex is to be unlocked + */ +#define cpu_mutex_unlock(cpu) \ + cpu_mutex_unlock_impl(cpu, __FILE__, __LINE__) +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line); + +/** + * cpu_mutex_locked - check whether a CPU's mutex is locked + * @cpu: the CPU of interest + * + * Returns true if the calling thread is currently holding the CPU's mutex. + */ +bool cpu_mutex_locked(const CPUState *cpu); + +/** + * no_cpu_mutex_locked - check whether any CPU mutex is held + * + * Returns true if the calling thread is not holding any CPU mutex. + */ +bool no_cpu_mutex_locked(void); + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; diff --git a/cpus.c b/cpus.c index 9a3a1d8a6a..187aed2533 100644 --- a/cpus.c +++ b/cpus.c @@ -83,6 +83,47 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +/* XXX: is this really the max number of CPUs? */ +#define CPU_LOCK_BITMAP_SIZE 2048 + +/* + * Note: we index the bitmap with cpu->cpu_index + 1 so that the logic + * also works during early CPU initialization, when cpu->cpu_index is set to + * UNASSIGNED_CPU_INDEX == -1. + */ +static __thread DECLARE_BITMAP(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); + +bool no_cpu_mutex_locked(void) +{ + return bitmap_empty(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); +} + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ +/* coverity gets confused by the indirect function call */ +#ifdef __COVERITY__ + qemu_mutex_lock_impl(&cpu->lock, file, line); +#else + QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); + + g_assert(!cpu_mutex_locked(cpu)); + set_bit(cpu->cpu_index + 1, cpu_lock_bitmap); + f(&cpu->lock, file, line); +#endif +} + +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) +{ + g_assert(cpu_mutex_locked(cpu)); + qemu_mutex_unlock_impl(&cpu->lock, file, line); + clear_bit(cpu->cpu_index + 1, cpu_lock_bitmap); +} + +bool cpu_mutex_locked(const CPUState *cpu) +{ + return test_bit(cpu->cpu_index + 1, cpu_lock_bitmap); +} + bool cpu_is_stopped(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); @@ -92,9 +133,9 @@ static inline bool cpu_work_list_empty(CPUState *cpu) { bool ret; - qemu_mutex_lock(&cpu->lock); + cpu_mutex_lock(cpu); ret = QSIMPLEQ_EMPTY(&cpu->work_list); - qemu_mutex_unlock(&cpu->lock); + cpu_mutex_unlock(cpu); return ret; } @@ -1855,6 +1896,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..3f07d3a28b --- /dev/null +++ b/stubs/cpu-lock.c @@ -0,0 +1,28 @@ +#include "qemu/osdep.h" +#include "qom/cpu.h" + +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); + f(&cpu->lock, file, line); +#endif +} + +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) +{ + qemu_mutex_unlock_impl(&cpu->lock, file, line); +} + +bool cpu_mutex_locked(const CPUState *cpu) +{ + return true; +} + +bool no_cpu_mutex_locked(void) +{ + return true; +} diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 5dd0aeeec6..49f83cf7ff 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 Wed Jan 30 00:47:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0287D1874 for ; Wed, 30 Jan 2019 00:50:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA2822D1A9 for ; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCF552D1B9; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3971B2D17B for ; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) Received: from localhost ([127.0.0.1]:57763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4p-00014l-G8 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:50:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe35-0007sq-SO for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe34-0000dI-Gb for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:53559) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe34-0000cu-CJ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2BB472207E; Tue, 29 Jan 2019 19:48:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:14 -0500 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=HALsbFuGkgcKHGOiM+YuCYA4Z92sZhpJoAw87XRcIrU=; b=tlTJ1quJkIdE zSbdBPhLLMDWkjLpyMHjsIiPamQppRzGiGUiMCTWldZwdW0m6KtUVkqXzkwVEmq1 CEVHIGqguDxPI3LWo7mlJyn+3YXEq8SfMvch/6zn2XGxOGdB/rEU+NUAHYjimjZ2 rUobirJYseur2h9c8tyDpi1ZPLgPQL0= 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=HALsbFuGkgcKHGOiM+YuCYA4Z92sZhpJoAw87XRcI rU=; b=VLCTnZz9o4P7MjPMRvRa3hRstUjixOeEVHzm+ThfPfgXrEtttj29XQDzC XBpXLGFu79xBPIP5hUt/qAoT0aKuudMd7eUBbxnY3srtMaFwSXHlrquxoKDd+eZx q4eDC5xO8mz/OdtyTi9Y9PcFRXXGq/MYFTpXlp0cNBmuPFRTJKRcxuYafnLVKMNe SzhQByA648wsZnMciBfvHA6qMthhCWcGxZXM1OCNj96o0EvWkuInYMDUVolAP4mu VfqzQT8TTZcvEoiN+sqbZzBWx7yj2l2BF0+F7yiNtYU2WI0RE+/AAwK06YFEatLt Tn29T1vfAStQUQgOtc0GJuPWXrs0A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C4952E4669; Tue, 29 Jan 2019 19:48:13 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:02 -0500 Message-Id: <20190130004811.27372-5-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 04/73] cpu: make qemu_work_cond per-cpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This eliminates the need to use the BQL to queue CPU work. While at it, give the per-cpu field a generic name ("cond") since it will soon be used for more than just queueing CPU work. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 6 ++-- cpus-common.c | 72 ++++++++++++++++++++++++++++++++++++++--------- cpus.c | 2 +- qom/cpu.c | 1 + 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 403c48695b..46e3c164aa 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -322,6 +322,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). @@ -364,6 +365,7 @@ struct CPUState { QemuMutex lock; /* fields below protected by @lock */ + QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; @@ -771,12 +773,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 d0e619f149..daf1531868 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -26,7 +26,6 @@ static QemuMutex qemu_cpu_list_lock; static QemuCond exclusive_cond; static QemuCond exclusive_resume; -static QemuCond qemu_work_cond; /* >= 1 if a thread is inside start_exclusive/end_exclusive. Written * under qemu_cpu_list_lock, read with atomic operations. @@ -42,7 +41,6 @@ void qemu_init_cpu_list(void) qemu_mutex_init(&qemu_cpu_list_lock); qemu_cond_init(&exclusive_cond); qemu_cond_init(&exclusive_resume); - qemu_cond_init(&qemu_work_cond); } void cpu_list_lock(void) @@ -113,23 +111,37 @@ struct qemu_work_item { bool free, exclusive, done; }; -static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) +/* Called with the CPU's lock held */ +static void queue_work_on_cpu_locked(CPUState *cpu, struct qemu_work_item *wi) { - qemu_mutex_lock(&cpu->lock); QSIMPLEQ_INSERT_TAIL(&cpu->work_list, wi, node); wi->done = false; - qemu_mutex_unlock(&cpu->lock); qemu_cpu_kick(cpu); } -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, - QemuMutex *mutex) +static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) +{ + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, wi); + cpu_mutex_unlock(cpu); +} + +void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { struct qemu_work_item wi; + bool has_bql = qemu_mutex_iothread_locked(); + + g_assert(no_cpu_mutex_locked()); if (qemu_cpu_is_self(cpu)) { - func(cpu, data); + if (has_bql) { + func(cpu, data); + } else { + qemu_mutex_lock_iothread(); + func(cpu, data); + qemu_mutex_unlock_iothread(); + } return; } @@ -139,13 +151,34 @@ void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, wi.free = false; wi.exclusive = false; - queue_work_on_cpu(cpu, &wi); + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, &wi); + + /* + * We are going to sleep on the CPU lock, so release the BQL. + * + * During the transition to per-CPU locks, we release the BQL _after_ + * having kicked the destination CPU (from queue_work_on_cpu_locked above). + * This makes sure that the enqueued work will be seen by the CPU + * after being woken up from the kick, since the CPU sleeps on the BQL. + * Once we complete the transition to per-CPU locks, we will release + * the BQL earlier in this function. + */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&qemu_work_cond, mutex); + qemu_cond_wait(&cpu->cond, &cpu->lock); current_cpu = self_cpu; } + cpu_mutex_unlock(cpu); + + if (has_bql) { + qemu_mutex_lock_iothread(); + } } void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) @@ -307,6 +340,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void process_queued_cpu_work(CPUState *cpu) { struct qemu_work_item *wi; + bool has_bql = qemu_mutex_iothread_locked(); qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { @@ -324,13 +358,23 @@ void process_queued_cpu_work(CPUState *cpu) * BQL, so it goes to sleep; start_exclusive() is sleeping too, so * neither CPU can proceed. */ - qemu_mutex_unlock_iothread(); + if (has_bql) { + qemu_mutex_unlock_iothread(); + } start_exclusive(); wi->func(cpu, wi->data); end_exclusive(); - qemu_mutex_lock_iothread(); + if (has_bql) { + qemu_mutex_lock_iothread(); + } } else { - wi->func(cpu, wi->data); + if (has_bql) { + wi->func(cpu, wi->data); + } else { + qemu_mutex_lock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_unlock_iothread(); + } } qemu_mutex_lock(&cpu->lock); if (wi->free) { @@ -340,5 +384,5 @@ void process_queued_cpu_work(CPUState *cpu) } } qemu_mutex_unlock(&cpu->lock); - qemu_cond_broadcast(&qemu_work_cond); + qemu_cond_broadcast(&cpu->cond); } diff --git a/cpus.c b/cpus.c index 187aed2533..42ea8cfbb5 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 a2964e53c6..be8393e589 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -372,6 +372,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 Wed Jan 30 00:47:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AB5B1874 for ; Wed, 30 Jan 2019 00:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDA1E2D17B for ; Wed, 30 Jan 2019 00:50:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB0DE2D19C; Wed, 30 Jan 2019 00:50:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 648162D17B for ; Wed, 30 Jan 2019 00:50:03 +0000 (UTC) Received: from localhost ([127.0.0.1]:57755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4o-00011P-4P for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:50:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe35-0007sn-L9 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe34-0000dh-R2 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41675) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe34-0000dH-M3 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 750F222094; Tue, 29 Jan 2019 19:48:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:14 -0500 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=YWq9JdxoNFHQuGrGqh2ExtGAPy94cWJykLjlOiLEp4U=; b=UnJlw NoUooqTCHu9u9/60gTEL229D4Ei/VWlylTnWP6WhDX1qEPeUIe657QEpf2CaoaRp a+rdQcoy8OE6mOtC1GkY860MU1H6SID7NaRjuhQe/tJd4XxAQq0Z9FzoJ7q6jEC8 EiYTFW+7Ly/ufhs4uwcXm47Gwn+4U2qbHkRezE= 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=YWq9JdxoNFHQuGrGqh2ExtGAPy94c WJykLjlOiLEp4U=; b=WA86Vs/3iAhlE7jR1qqJ87Shf2diX67W4M75RmF9aVLAL uOxVVBDlo6Bm+MpZFRwmr6i3vbDd9HT5SukWWd/QbZg4Y8RNSaewBBsutcs2SCrV Vdftw4/E3ShnsTizZfY3GB8yw/Ok3ffn+7fT1MuQsoo3yykJ9ksNWia9yKs18YtR aOuep4Go8PY+FWK+/0uFdTNmmVGa2yoWFH+f94DfyOQG94E5uOFz+PUOzAbhbJCL yuqCCCnzyV7moWMqpHFm7S05NALWrntnCx4LM5Ym1IqxL3An3Qs0cgc7rzyqZzjp E8wIdtKHqVhcYT/HROjHGM0WPtK9kWrY3z3RG0KBg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 12F86E4664; Tue, 29 Jan 2019 19:48:14 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:03 -0500 Message-Id: <20190130004811.27372-6-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 05/73] cpu: move run_on_cpu to cpus-common X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We don't pass a pointer to qemu_global_mutex anymore. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 46e3c164aa..fe389037c5 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -768,16 +768,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 daf1531868..85a61eb970 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -127,7 +127,7 @@ static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) cpu_mutex_unlock(cpu); } -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) +void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { struct qemu_work_item wi; bool has_bql = qemu_mutex_iothread_locked(); diff --git a/cpus.c b/cpus.c index 42ea8cfbb5..755e4addab 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 Wed Jan 30 00:47:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97F9291E for ; Wed, 30 Jan 2019 00:53:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DCC72D278 for ; Wed, 30 Jan 2019 00:53:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CCED2D285; Wed, 30 Jan 2019 00:53:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E5F122D278 for ; Wed, 30 Jan 2019 00:53:00 +0000 (UTC) Received: from localhost ([127.0.0.1]:57816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe7g-0003Mb-7v for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:53:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe36-0007sr-1I for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe35-0000dr-42 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52641) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe34-0000da-VY for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AC055220AB; Tue, 29 Jan 2019 19:48:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:14 -0500 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=RCtl4PDV3GHK6v+cBYUfeXzymy4IjwgK/VkY5crAIfU=; b=pggT/0m1zlgK QlwYrFpooIqyCFyyWBKr7lpe9aPmU4c+pjPL2Zfydgoa3YK5zoT0Z/7xxMyb2mfE qJoH1g/4Pb6GMaR3Kja/+eb/VVjk2EpdvhkOS3Sn5tSpsUMnwHMGdrgPA7fAEHMr OKB+BLM/YCGYofs3stRuS6g67Z1XjDs= 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=RCtl4PDV3GHK6v+cBYUfeXzymy4IjwgK/VkY5crAI fU=; b=t/SE962KgLQxJpAI/lxo/YAPTf0KfEfPc1Upmn6icoZEbezqtd63dRqec 2ieK1U3qUOGPNIGDwiLEfkAWDyWwyXHS0E6aI7spH/IH+ALvCR/HhfePSRGOyHq8 629QPtMmLLsMjzrDjXRhTBhK42rlqHT/NRCwcbR6+VIgvx5Eenj/9r1kFpOeBnzB Rg+WuCI36sI9xOMj3OxvrbiGKVCJLChPqma63QKB5aBZ5ILleTIaSGqxzHqSEtwQ MXIM8yzan0zQBqaafhLRqJU5yA+cTMutLaJcAY/9QTAH6g1BMaXH4aVr/J6f3yx/ r0qoajgmEbNHy+aehYFAiBbS3Jszw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 45C6AE4559; Tue, 29 Jan 2019 19:48:14 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:04 -0500 Message-Id: <20190130004811.27372-7-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 06/73] cpu: introduce process_queued_cpu_work_locked X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This completes the conversion to cpu_mutex_lock/unlock in the file. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- cpus-common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 85a61eb970..99662bfa87 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -337,20 +337,19 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, queue_work_on_cpu(cpu, wi); } -void process_queued_cpu_work(CPUState *cpu) +/* Called with the CPU's lock held */ +static void process_queued_cpu_work_locked(CPUState *cpu) { struct qemu_work_item *wi; bool has_bql = qemu_mutex_iothread_locked(); - qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { - qemu_mutex_unlock(&cpu->lock); return; } while (!QSIMPLEQ_EMPTY(&cpu->work_list)) { wi = QSIMPLEQ_FIRST(&cpu->work_list); QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node); - qemu_mutex_unlock(&cpu->lock); + cpu_mutex_unlock(cpu); if (wi->exclusive) { /* Running work items outside the BQL avoids the following deadlock: * 1) start_exclusive() is called with the BQL taken while another @@ -376,13 +375,19 @@ void process_queued_cpu_work(CPUState *cpu) qemu_mutex_unlock_iothread(); } } - qemu_mutex_lock(&cpu->lock); + cpu_mutex_lock(cpu); if (wi->free) { g_free(wi); } else { atomic_mb_set(&wi->done, true); } } - qemu_mutex_unlock(&cpu->lock); qemu_cond_broadcast(&cpu->cond); } + +void process_queued_cpu_work(CPUState *cpu) +{ + cpu_mutex_lock(cpu); + process_queued_cpu_work_locked(cpu); + cpu_mutex_unlock(cpu); +} From patchwork Wed Jan 30 00:47:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68F37922 for ; Wed, 30 Jan 2019 01:01:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C39A2D4DC for ; Wed, 30 Jan 2019 01:01:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50A212D512; Wed, 30 Jan 2019 01:01:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B1E62D4DC for ; Wed, 30 Jan 2019 01:01:29 +0000 (UTC) Received: from localhost ([127.0.0.1]:57957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeFs-0002K6-Sb for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:01:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe36-0007t7-UY for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe35-0000e2-8Y for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60423) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe35-0000dl-4U for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CD491220B8; Tue, 29 Jan 2019 19:48:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:14 -0500 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=cghKRdB49OLWPLifjGXPpS6ohRQmhrzFWn0RDoW8gvc=; b=rBx/j 6I/m2vvD9T6sr/4q9CzcRfSw6DK/nwJNPVeQC0kyVpcxZPUfNq3A1x9YlIVuaQ2N S1QkGVTJ2XegbETq2mTAwEANGqrF2Bc6uqvuz3dm7904oUJbbck+wOFpebLq7Iie RU22Fu4oXY/dS5mBhvdGru1skNOdH4GwoxWhbE= 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=cghKRdB49OLWPLifjGXPpS6ohRQmh rzFWn0RDoW8gvc=; b=hyWcwpHqM2748tIzAmgvBlGe3/UcJPBy2Uzp18rdpMaeu SenLmkW86TJn3Hl0J5yzraJqXGjDrBFg2zRdjc9fJLfkkcrotLYOlcQkyDWi1WGZ +QJYsvw6nZvdj4rAw/ar1EckwMycOKB5qoqDAWvrFIBEY87yOryDMz/vNs+h4gxf 1/nFHceIGoIDcCLiRNFVLUnsrhmDlmPAcwq8LsgW86T2p/rJMwggqwXsLLhDfxfY Pj8Wels3N5n/2iN1Z8fLovZ1WIE/mW1pv7Fm5Zs6OnSEe9Amt822XDEFc7axLKRT E0/aEoh7ZBoGwa03lcX7BTe9Bq1dCBMb/B8Fb7/uQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 7D467E4667; Tue, 29 Jan 2019 19:48:14 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:05 -0500 Message-Id: <20190130004811.27372-8-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Before we can switch from the BQL to per-CPU locks in the CPU loop, we have to accommodate the fact that TCG rr mode (i.e. !MTTCG) cannot work with separate per-vCPU locks. That would lead to deadlock since we need a single lock/condvar pair on which to wait for events that affect any vCPU, e.g. in qemu_tcg_rr_wait_io_event. At the same time, we are moving towards an interface where the BQL and CPU locks are independent, and the only requirement is that the locking order is respected, i.e. the BQL is acquired first if both locks have to be held at the same time. In this patch we make the BQL a recursive lock under the hood. This allows us to (1) keep the BQL and CPU locks interfaces separate, and (2) use a single lock for all vCPUs in TCG rr mode. Note that the BQL's API (qemu_mutex_lock/unlock_iothread) remains non-recursive. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- include/qom/cpu.h | 2 +- cpus-common.c | 2 +- cpus.c | 90 +++++++++++++++++++++++++++++++++++++++++------ qom/cpu.c | 3 +- stubs/cpu-lock.c | 6 ++-- 5 files changed, 86 insertions(+), 17 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index fe389037c5..8b85a036cf 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -363,7 +363,7 @@ struct CPUState { int64_t icount_extra; sigjmp_buf jmp_env; - QemuMutex lock; + QemuMutex *lock; /* fields below protected by @lock */ QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; diff --git a/cpus-common.c b/cpus-common.c index 99662bfa87..62e282bff1 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -171,7 +171,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&cpu->cond, &cpu->lock); + qemu_cond_wait(&cpu->cond, cpu->lock); current_cpu = self_cpu; } cpu_mutex_unlock(cpu); diff --git a/cpus.c b/cpus.c index 755e4addab..c4fa3cc876 100644 --- a/cpus.c +++ b/cpus.c @@ -83,6 +83,12 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +static inline bool qemu_is_tcg_rr(void) +{ + /* in `make check-qtest', "use_icount && !tcg_enabled()" might be true */ + return use_icount || (tcg_enabled() && !qemu_tcg_mttcg_enabled()); +} + /* XXX: is this really the max number of CPUs? */ #define CPU_LOCK_BITMAP_SIZE 2048 @@ -98,25 +104,76 @@ bool no_cpu_mutex_locked(void) return bitmap_empty(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); } -void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +static QemuMutex qemu_global_mutex; +static __thread bool iothread_locked; +/* + * In TCG rr mode, we make the BQL a recursive mutex, so that we can use it for + * all vCPUs while keeping the interface as if the locks were per-CPU. + * + * The fact that the BQL is implemented recursively is invisible to BQL users; + * the mutex API we export (qemu_mutex_lock_iothread() etc.) is non-recursive. + * + * Locking order: the BQL is always acquired before CPU locks. + */ +static __thread int iothread_lock_count; + +static void rr_cpu_mutex_lock(void) +{ + if (iothread_lock_count++ == 0) { + /* + * Circumvent qemu_mutex_lock_iothread()'s state keeping by + * acquiring the BQL directly. + */ + qemu_mutex_lock(&qemu_global_mutex); + } +} + +static void rr_cpu_mutex_unlock(void) +{ + g_assert(iothread_lock_count > 0); + if (--iothread_lock_count == 0) { + /* + * Circumvent qemu_mutex_unlock_iothread()'s state keeping by + * releasing the BQL directly. + */ + qemu_mutex_unlock(&qemu_global_mutex); + } +} + +static void do_cpu_mutex_lock(CPUState *cpu, const char *file, int line) { -/* coverity gets confused by the indirect function call */ + /* coverity gets confused by the indirect function call */ #ifdef __COVERITY__ - qemu_mutex_lock_impl(&cpu->lock, file, line); + qemu_mutex_lock_impl(cpu->lock, file, line); #else QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); + f(cpu->lock, file, line); +#endif +} + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ g_assert(!cpu_mutex_locked(cpu)); set_bit(cpu->cpu_index + 1, cpu_lock_bitmap); - f(&cpu->lock, file, line); -#endif + + if (qemu_is_tcg_rr()) { + rr_cpu_mutex_lock(); + } else { + do_cpu_mutex_lock(cpu, file, line); + } } void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) { g_assert(cpu_mutex_locked(cpu)); - qemu_mutex_unlock_impl(&cpu->lock, file, line); clear_bit(cpu->cpu_index + 1, cpu_lock_bitmap); + + if (qemu_is_tcg_rr()) { + rr_cpu_mutex_unlock(); + return; + } + qemu_mutex_unlock_impl(cpu->lock, file, line); } bool cpu_mutex_locked(const CPUState *cpu) @@ -1215,8 +1272,6 @@ static void qemu_init_sigbus(void) } #endif /* !CONFIG_LINUX */ -static QemuMutex qemu_global_mutex; - static QemuThread io_thread; /* cpu creation */ @@ -1876,8 +1931,6 @@ bool qemu_in_vcpu_thread(void) return current_cpu && qemu_cpu_is_self(current_cpu); } -static __thread bool iothread_locked = false; - bool qemu_mutex_iothread_locked(void) { return iothread_locked; @@ -1896,6 +1949,8 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line) g_assert(!qemu_mutex_iothread_locked()); bql_lock(&qemu_global_mutex, file, line); + g_assert(iothread_lock_count == 0); + iothread_lock_count++; iothread_locked = true; } @@ -1903,7 +1958,10 @@ void qemu_mutex_unlock_iothread(void) { g_assert(qemu_mutex_iothread_locked()); iothread_locked = false; - qemu_mutex_unlock(&qemu_global_mutex); + g_assert(iothread_lock_count > 0); + if (--iothread_lock_count == 0) { + qemu_mutex_unlock(&qemu_global_mutex); + } } static bool all_vcpus_paused(void) @@ -2127,6 +2185,16 @@ void qemu_init_vcpu(CPUState *cpu) cpu_address_space_init(cpu, 0, "cpu-memory", cpu->memory); } + /* + * In TCG RR, cpu->lock is the BQL under the hood. In all other modes, + * cpu->lock is a standalone per-CPU lock. + */ + if (qemu_is_tcg_rr()) { + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + cpu->lock = &qemu_global_mutex; + } + if (kvm_enabled()) { qemu_kvm_start_vcpu(cpu); } else if (hax_enabled()) { diff --git a/qom/cpu.c b/qom/cpu.c index be8393e589..2c05aa1bca 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -371,7 +371,8 @@ static void cpu_common_initfn(Object *obj) cpu->nr_cores = 1; cpu->nr_threads = 1; - qemu_mutex_init(&cpu->lock); + cpu->lock = g_new(QemuMutex, 1); + qemu_mutex_init(cpu->lock); qemu_cond_init(&cpu->cond); QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); diff --git a/stubs/cpu-lock.c b/stubs/cpu-lock.c index 3f07d3a28b..7406a66d97 100644 --- a/stubs/cpu-lock.c +++ b/stubs/cpu-lock.c @@ -5,16 +5,16 @@ 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); + qemu_mutex_lock_impl(cpu->lock, file, line); #else QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); - f(&cpu->lock, file, line); + f(cpu->lock, file, line); #endif } void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) { - qemu_mutex_unlock_impl(&cpu->lock, file, line); + qemu_mutex_unlock_impl(cpu->lock, file, line); } bool cpu_mutex_locked(const CPUState *cpu) From patchwork Wed Jan 30 00:47:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C017F159A for ; Wed, 30 Jan 2019 00:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B17EF2D17B for ; Wed, 30 Jan 2019 00:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A61E42D19C; Wed, 30 Jan 2019 00:50:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 52D0E2D17B for ; Wed, 30 Jan 2019 00:50:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:57774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4s-000181-IC for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:50:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe36-0007t6-U4 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe35-0000eX-LB for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33061) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe35-0000e6-GX for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:15 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1DC4321FED; Tue, 29 Jan 2019 19:48:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:15 -0500 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=oRkODhzwwYFaQfEOdmmHeNoUMgxydjK6hxWjudFdnjM=; b=16mig OOZABpo9jTsM2mdXNZF9bRXIyS/o8gTdMUVn86YHxx+BnwZWxmoxE8x6wd0OUTMb MAMSD8wV1R7PD6G9W3Yd4Iw+7acZPzfKeBmhDsd/ZfayKRzf+jOl+3LhDfb9k2L1 KI8agScjkFgJyZVoSG55IROX2+wHRKsVAzeRMU= 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=oRkODhzwwYFaQfEOdmmHeNoUMgxyd jK6hxWjudFdnjM=; b=yzLHNW5i5qpe9tGvTsokpzU5a9+Zj1RBkcf7QjNP/Vr6/ skAv+z8dSIW5YoanBnVzBC32/PUmZCCaNfHANC4lGlACe8GwTBiMliVitdIP9t4C m6xxmogwuLbHwxikz/YF0c53YHdATS5SY+QA2fhqjL/dGKMJEWkj+lefCTw4ZtnV G1twVlvigFUqXLJIMPCTggx6HlpJl0NEgnjOzJK+Hq/7EJkMsc4JSsXRIV/uqpSQ H7gewW3y/+i/LBcpchjSMw1pfv2Qu2HdUgnn4t3aqMpdebr+nKs90TZIgd3KXPt/ Kw9yXRotYtuS+7sd2EezDGw57jDNzdztVhsEho0UQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B5C57E4664; Tue, 29 Jan 2019 19:48:14 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:06 -0500 Message-Id: <20190130004811.27372-9-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 08/73] tcg-runtime: define helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- accel/tcg/tcg-runtime.h | 2 ++ accel/tcg/tcg-runtime.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index dfe325625c..46386bb564 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -28,6 +28,8 @@ DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env) DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) +DEF_HELPER_FLAGS_2(cpu_halted_set, TCG_CALL_NO_RWG, void, env, i32) + #ifdef CONFIG_SOFTMMU DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index d0d4484406..4aa038465f 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -167,3 +167,10 @@ void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(ENV_GET_CPU(env), GETPC()); } + +void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) +{ + CPUState *cpu = ENV_GET_CPU(env); + + cpu->halted = val; +} From patchwork Wed Jan 30 00:47:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBA7091E for ; Wed, 30 Jan 2019 00:55:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD33F2C969 for ; Wed, 30 Jan 2019 00:55:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D184F2C972; Wed, 30 Jan 2019 00:55:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F03F2C969 for ; Wed, 30 Jan 2019 00:55:47 +0000 (UTC) Received: from localhost ([127.0.0.1]:57870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeAM-0005pN-Ad for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:55:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3V-0008BF-SH for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3U-0000tK-SA for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:41 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33311) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3S-0000fQ-Ja; Tue, 29 Jan 2019 19:48:39 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 00C3A2208A; Tue, 29 Jan 2019 19:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:16 -0500 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=EX2WnqT0GCzlSOhpAzFxoqJ8LkS9FRb1WgotVrWaDKU=; b=cTzxebg8/rTx 675T+n+DjJNZwJ8ttrucRWl5xxZeolSqxReYap6f5P3GqXcD685vFj6B7FFWl4NW 10Xpk31Vix3992aTDaulcv1r3Umh6Wa+jDqfL9xLMGvtiuOhEgdY0Kh7pinp0GZu EGW/LlAKs7L24hxFCSwwHtz+AZ2U03A= 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=EX2WnqT0GCzlSOhpAzFxoqJ8LkS9FRb1WgotVrWaD KU=; b=sp5FOMmYZ0YE3SU8FjVGgt/Bm0nYPXZGg4eszPNY51RNuPuESWMwXEMHa d6Xkq3S9/Hk/0x/y/rMAdg6pXkumJ4x3HDK3WohPirMaWHbdkkOyCJbECTHBqsET GN69UWtXABIhl4hSMfRz3s467hjnoMDQSoQAE0USqrs1mzCvkMYiiny1qYjjlDPV QlXwXk8ccgEyNwEwqyhrowLEM3rLxH0X3JBtY1yMsJzBZ5xLlWwhD/fRk2N7ruPb CxgQiO9q90eBV+YHvmUu8Q9HXpRLS27kEpp0DOq/1dd8dsJ4G5Px/hoypjUp3ZSg gaZY5fMLRwq1fKRhImEA17nQF850g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E40B0E4559; Tue, 29 Jan 2019 19:48:14 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:07 -0500 Message-Id: <20190130004811.27372-10-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 09/73] ppc: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: David Gibson Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Acked-by: David Gibson Signed-off-by: Emilio G. Cota --- target/ppc/translate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e169c43643..75aac45b54 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1575,8 +1575,7 @@ GEN_LOGICAL2(nor, tcg_gen_nor_tl, 0x03, PPC_INTEGER); static void gen_pause(DisasContext *ctx) { TCGv_i32 t0 = tcg_const_i32(0); - tcg_gen_st_i32(t0, cpu_env, - -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, t0); tcg_temp_free_i32(t0); /* Stop translation, this gives other CPUs a chance to run */ @@ -3550,8 +3549,7 @@ static void gen_sync(DisasContext *ctx) static void gen_wait(DisasContext *ctx) { TCGv_i32 t0 = tcg_const_i32(1); - tcg_gen_st_i32(t0, cpu_env, - -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, t0); tcg_temp_free_i32(t0); /* Stop translation, as the CPU is supposed to sleep from now */ gen_exception_nip(ctx, EXCP_HLT, ctx->base.pc_next); From patchwork Wed Jan 30 00:47:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83DF591E for ; Wed, 30 Jan 2019 00:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7727E2D278 for ; Wed, 30 Jan 2019 00:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B8662D285; Wed, 30 Jan 2019 00:53:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1CACE2D278 for ; Wed, 30 Jan 2019 00:53:06 +0000 (UTC) Received: from localhost ([127.0.0.1]:57818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe7l-0003Rr-DV for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:53:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe37-0007tD-0V for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe36-0000fM-2m for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:49069) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe35-0000el-Ux for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9BCBD21F93; Tue, 29 Jan 2019 19:48:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:15 -0500 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=7CVGcZlTQ4YD3hfWCX3qrg4pR1DhNqUBwV6ADqBCWys=; b=l9Ujgz3u2qKS +8RruVeSwEk134JeHmKr/aPwzggxLV2Q7mTjgT1tvaXHzE+p1Bc1owsfNyg9FNO+ a6ra3G0b9K1ezCAfCbp+Dpz/IAMtWvC1qscO8NrdxrLla/I4dEMu3GRtwQ5EI7q7 s+lHkmPgacYYAsv/AFQ+5Ua7QMC2eCA= 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=7CVGcZlTQ4YD3hfWCX3qrg4pR1DhNqUBwV6ADqBCW ys=; b=NUK1n212d7jGOsBah0Jk6bz+TdI+rkxG/UgxT/xijqZ2TuCf0R26DoK8H FlkKdXdIyQ0zZs6PONHTg28Kxkucf82tkaFL8j+WCiUeZu3mlKOEIzBcjo1Fgvbm XoW8/j2rDVsZ7YmdXnjjvtxarjuEfuhQ5Mrn+sAaxuti/Wm3OefnFAlu6Qinl0Oa X7ui6MrKH3CVRgpSTwiB5Ah8G8D5PF7SFJs+YycP0gcta0LZ/VkuzzbAotfWGeei V2vC0+x/T0tO+4dD1CB5Bgx2EX/Md2xVxJfwIOUsUeLuNOVu11GL42fgNzxKFI2M 5P1PJ6e29kgJHwi69blOHSG2fbMGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 272E5E4667; Tue, 29 Jan 2019 19:48:15 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:08 -0500 Message-Id: <20190130004811.27372-11-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 10/73] cris: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP And fix the temp leak along the way. Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- target/cris/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index 11b2c11174..f059745ec0 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -2829,8 +2829,9 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) cris_cc_mask(dc, 0); if (dc->op2 == 15) { - tcg_gen_st_i32(tcg_const_i32(1), cpu_env, - -offsetof(CRISCPU, env) + offsetof(CPUState, halted)); + TCGv_i32 tmp = tcg_const_i32(1); + gen_helper_cpu_halted_set(cpu_env, tmp); + tcg_temp_free_i32(tmp); tcg_gen_movi_tl(env_pc, dc->pc + 2); t_gen_raise_exception(EXCP_HLT); return 2; From patchwork Wed Jan 30 00:47:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EEEA391E for ; Wed, 30 Jan 2019 00:58:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E06532C971 for ; Wed, 30 Jan 2019 00:58:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4EAB2C977; Wed, 30 Jan 2019 00:58:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 866E02C971 for ; Wed, 30 Jan 2019 00:58:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:57901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeD5-0008FJ-P2 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:58:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe37-0007tC-02 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe36-0000fh-8s for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57231) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe36-0000f5-3j for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B99002207D; Tue, 29 Jan 2019 19:48:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:15 -0500 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=4UCa3gNnWmKbHt6WSB28opNWJSJ3lW2feXaolQrbTHk=; b=p02utQ9MEIyi mTE3Ua9RSDl2I7+kjQ3aO9eI/pc38cal2qu+gsgGZju5My3tHprPSEgcWQPXPhMf Rmlqvlj2jy84Jn/ewXn1wIJhm5rSEiOwIDA/RF+xBosy8i7l6hLJnNTgVrqTOT+Y +7WRwCA7BCHKuTS5uSZIgK0K9XQIi/c= 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=4UCa3gNnWmKbHt6WSB28opNWJSJ3lW2feXaolQrbT Hk=; b=PfpXz5PS7AJafepyqUM39sT5Xh1UvBNLxIswch5TbuIh4GvIzjAq8Us7R qpMQfw5mo4PEcI5jxQ059TTTYH0I/OxuQGH5xSp9yIRcyI3K/WfjcboezJ3ODY5D RSa1OlTvywQ4H4C+2ByGZAGg9+vrKTSJJ2peAJ4Xn1Fq8b1XrCpe2Bl1F0/UqgCl HrYoIo5x6ytYoTCv8u+jxM8PjRxWGDJNZsxvmADCi3mOkE+/yZqe4jJP9cy6bCxs tm6tr8BMvAqQFfUwCaXQBKI/jlzI9Czia1/4oQNf9+s+Ao5EODTgs78y14fms7wS RirC0w/r1i5lk8OX5qJC4nApPw/PQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 5C2CDE4664; Tue, 29 Jan 2019 19:48:15 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:09 -0500 Message-Id: <20190130004811.27372-12-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 11/73] hppa: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- target/hppa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ce05d5619d..df9179e70f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2845,8 +2845,7 @@ static DisasJumpType trans_pause(DisasContext *ctx, uint32_t insn, /* Tell the qemu main loop to halt until this cpu has work. */ tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); gen_excp_1(EXCP_HALTED); From patchwork Wed Jan 30 00:47:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0616B91E for ; Wed, 30 Jan 2019 00:55:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECC822C977 for ; Wed, 30 Jan 2019 00:55:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E137E2C9C5; Wed, 30 Jan 2019 00:55:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7C6232D010 for ; Wed, 30 Jan 2019 00:55:54 +0000 (UTC) Received: from localhost ([127.0.0.1]:57872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeAT-0005uh-OJ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:55:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe37-0007tX-R8 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe36-0000gG-Tc for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:17 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57195) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe36-0000fR-FA for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:16 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0B1F72206C; Tue, 29 Jan 2019 19:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:16 -0500 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=5bH9rMknbp9qbVSPbIlqmgSt6gTYo6xwmFaWp0w3cvQ=; b=w7c2xETadzuB wVAoynoJ+dAxL0xBYxKrpuNuGYzYoUDfoFL0NeJPSSIEDFhEOxEn+fPKXGqpF5Iv j5Pu4P329qOtCpa8v885bt/FbEb2dE0yi5KeSRHlcGLhNvfnmorc6djjeLEoYFLq wKLxvZVt9nWeV+y/opjJbJ+QyBeOSJ8= 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=5bH9rMknbp9qbVSPbIlqmgSt6gTYo6xwmFaWp0w3c vQ=; b=TOjw3yANWWjzPBL/RIH5/K49aJ7PDctBkG6xoqAblYH06y+CXTf1X7WBj vIi7oG+fwAS66dEWWmRCFkziS84qZ5WiDYVJKI+TsuhXZILNVhdt4WBbvPe3Ujdx ec0n0F5taVLULSZSEDEm5sE3/cJHPTXu6BaFOFSn8gqIHz0tB6lgAwnayUiZDdKP 1T5U5XPzLIDpMmgeDs1BjOq98qpoKot2qvw7i3HEfm8wx+mFJoDv4BVAwBUr9OnE 7ib1IP9SCe15iOtx/Spy7LHF+yCAnNTBQYyeW81alj87+dchQ++Jv8nUHSa2DZ2X UZToUqlRL6CNYMwBOAl7nUtcb2VwQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9133AE466A; Tue, 29 Jan 2019 19:48:15 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:10 -0500 Message-Id: <20190130004811.27372-13-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 12/73] m68k: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Laurent Vivier Signed-off-by: Emilio G. Cota --- target/m68k/translate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 752e46ef63..5bd4220e06 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -43,7 +43,6 @@ #undef DEFO32 #undef DEFO64 -static TCGv_i32 cpu_halted; static TCGv_i32 cpu_exception_index; static char cpu_reg_names[2 * 8 * 3 + 5 * 4]; @@ -79,9 +78,6 @@ void m68k_tcg_init(void) #undef DEFO32 #undef DEFO64 - cpu_halted = tcg_global_mem_new_i32(cpu_env, - -offsetof(M68kCPU, env) + - offsetof(CPUState, halted), "HALTED"); cpu_exception_index = tcg_global_mem_new_i32(cpu_env, -offsetof(M68kCPU, env) + offsetof(CPUState, exception_index), @@ -4637,6 +4633,7 @@ DISAS_INSN(halt) DISAS_INSN(stop) { uint16_t ext; + TCGv_i32 tmp; if (IS_USER(s)) { gen_exception(s, s->base.pc_next, EXCP_PRIVILEGE); @@ -4646,7 +4643,9 @@ DISAS_INSN(stop) ext = read_im16(env, s); gen_set_sr_im(s, ext, 0); - tcg_gen_movi_i32(cpu_halted, 1); + tmp = tcg_const_i32(1); + gen_helper_cpu_halted_set(cpu_env, tmp); + tcg_temp_free_i32(tmp); gen_exception(s, s->pc, EXCP_HLT); } From patchwork Wed Jan 30 00:47:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B26991E for ; Wed, 30 Jan 2019 00:58:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AC0C2C971 for ; Wed, 30 Jan 2019 00:58:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F03A02C977; Wed, 30 Jan 2019 00:58:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AFE32C971 for ; Wed, 30 Jan 2019 00:58:35 +0000 (UTC) Received: from localhost ([127.0.0.1]:57899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeD4-0008Eb-E2 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:58:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3O-00084l-8F for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3J-0000n7-N4 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:31 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:46775) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3H-0000fe-8X for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:28 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 34F112206E; Tue, 29 Jan 2019 19:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:16 -0500 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=1NFmahtNZclTunO51qGZqMg0/tlUYW7wWV01j40L+ZQ=; b=ToVEl1WCCOV6 TCqDu0186BiAv/2kQZWKzIN5inWqu2MwSMBzRqphf7IADHBmr2053pwlO4mCu2ww i2JUJAwi6WOtLFfeqQXyB4dDjd3h6WrQIpLxwXsLfb2r+sxC4oTASXhLrnhod+sd NCvdep1kNqRTCjMRnXc2yOVN4G6sRZc= 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=1NFmahtNZclTunO51qGZqMg0/tlUYW7wWV01j40L+ ZQ=; b=SkvtH7h2fI58GvXMGk0qQ2LBgcJctcOT2SYlhj/xU9rwKXqoMfT3nE/rJ xvdH8aISeewuoMO4r8cqLBJ2xFRj9NsrjNPPi32TH54cwOS1pLIiYAYNUjMnHlJj rbdFoct/1XSPspZrNUbtkEQ0jiZJrqrczamCayg97m/tu7VM9p6R0KJs7MQ4VSkl Je6vPS8RWCu7fKZQ+rLZyuRWimpJGkok/dAlMAsUtCrjY74abq+nEwPLWWuoMtdZ xU1KnqugoQf+VXG8QnS4ITIIxhIm1mjDiUdmmNHMimABL1MaGdtsSCaRzvL4Jwiw +PMt95v/7+Igip1iU0ulHFuF5ijGA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C79F9E4667; Tue, 29 Jan 2019 19:48:15 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:11 -0500 Message-Id: <20190130004811.27372-14-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 13/73] alpha: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- target/alpha/translate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 9d8f9b3eea..a75413e9b5 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1226,8 +1226,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode) /* WTINT */ { TCGv_i32 tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); } tcg_gen_movi_i64(ctx->ir[IR_V0], 0); @@ -1382,8 +1381,7 @@ static DisasJumpType gen_mtpr(DisasContext *ctx, TCGv vb, int regno) /* WAIT */ { TCGv_i32 tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); } return gen_excp(ctx, EXCP_HALTED, 0); From patchwork Wed Jan 30 00:47:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7459213B5 for ; Wed, 30 Jan 2019 01:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6727E2D4DC for ; Wed, 30 Jan 2019 01:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B5982D4F0; Wed, 30 Jan 2019 01:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E8452D4DC for ; Wed, 30 Jan 2019 01:04:51 +0000 (UTC) Received: from localhost ([127.0.0.1]:57987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeJ9-0004dJ-9R for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:04:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3Q-00086z-KM for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3N-0000pK-AV for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:34 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:59753) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3I-0000fo-L4 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:31 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5C6072207E; Tue, 29 Jan 2019 19:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:16 -0500 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=n7RpxagQbjdzVAzUL7uQM59ovzPu0IQaDOVmw/9gKuY=; b=NoJlM5kgCr8Z JWRjU7JwFSUVCMrIi602MSu43ZfV5XNPLbvHE9C7FZ4nUEnjLRh8JU7ejbZIfWov TNem9OMCYCTxOXa5sn93VDUo3+4bFkW+GSf2nypu5QuIjBun3Te49pMLyVco+FKv jalszIliZO+kFJs9PAlkVUHRr4hi4mQ= 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=n7RpxagQbjdzVAzUL7uQM59ovzPu0IQaDOVmw/9gK uY=; b=sZiXIPqnBx6rFJJUkmJytyjFSajCCpp0oQsMN7lIhqgVR4/MUYR8tVEFl N6WHKKS2NF5d2jyLbJ0DWzdLrLiwQbgwT8rY7YjOEzHA2EMi3uRwHk8h1Qv676sb gOD6Y2/5FpREMmRR1vq2bg5+4nXlBrCu3U/ovN8iWrMTWM9nl3BRBhlZxF09Hqg/ mXgnii2yJGZBy0W3Ppm22hMLG2kzZiFSTvMjZwnrE/2ywbI6Z8zdAxvQU5c3LPoP N47n0+T3FWwJzzkR08EgjSKnlirA7OiD9gYNykKBY2oK4ynfiqtDZe+cBQVJLAbk spMP+8FkAifLW1TU002XuTmyAMTSw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B3AAE4664; Tue, 29 Jan 2019 19:48:16 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:12 -0500 Message-Id: <20190130004811.27372-15-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 14/73] microblaze: convert to helper_cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- target/microblaze/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 78ca265b04..008b84d456 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1233,9 +1233,7 @@ static void dec_br(DisasContext *dc) LOG_DIS("sleep\n"); t_sync_flags(dc); - tcg_gen_st_i32(tmp_1, cpu_env, - -offsetof(MicroBlazeCPU, env) - +offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp_1); tcg_gen_movi_i64(cpu_SR[SR_PC], dc->pc + 4); gen_helper_raise_exception(cpu_env, tmp_hlt); tcg_temp_free_i32(tmp_hlt); From patchwork Wed Jan 30 00:47:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83EBD14E1 for ; Wed, 30 Jan 2019 01:01:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78AC72D4DC for ; Wed, 30 Jan 2019 01:01:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D2392D506; Wed, 30 Jan 2019 01:01:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 150162D509 for ; Wed, 30 Jan 2019 01:01:29 +0000 (UTC) Received: from localhost ([127.0.0.1]:57959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeFs-0002KH-Cv for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:01:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3Q-00086Q-2o for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3M-0000oR-BK for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:34 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:58129) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3H-0000g8-82 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:28 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B6522220AA; Tue, 29 Jan 2019 19:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:16 -0500 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=Fw5R01aPGBupY6rnf5xphoeRgBQQgFcZWa9+VxA5v7g=; b=2OVLuxNOlCaE wNq10iCcffCjR56Uaffw3jsQb43fMOQI/Eh5Q7cG0OlLDac3qs9qBBjU7Q9jq6MT GpS/THQ0ZA5l3SApC6BUwyAHNNEKBVVQMuqR70lnoEz3eOtSxIAfv0K7bnYImQ3R vvnkiHXY/AsNpOcNo4ezhsHTNDcHHZI= 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=Fw5R01aPGBupY6rnf5xphoeRgBQQgFcZWa9+VxA5v 7g=; b=kSQZl73SsSakbMJy+1A2280kjrGVgW2xoKOCkmV4ouBQ+Cwebw1OAcWIj ifI4jdfmUy4+SGI3LAQJizdA8Kx0worZ4gd211crI2D7SKdnS8jUeGF1aA0PJveK CEwX18CTlqiMeAG5fUzg1UMu7gHqvI1KclkyxC+2UtvheA9jnh3a/qcSBOMn//v/ aip5qO7tct8+//Bo9Yl25sdhjuK0dAIIyDocDZCCo6EzL266CLU+zGobEreGXBTQ B9RH7nNwhuuQ4lMM6QZLQCASTlacRuGyZOB20hCohoHWkh9HFhQjjKJESx3EXbUK NPUp7HakrmkILiPzvOsmt5ZozdlIg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 436ECE4559; Tue, 29 Jan 2019 19:48:16 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:13 -0500 Message-Id: <20190130004811.27372-16-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 15/73] cpu: define cpu_halted helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP cpu->halted will soon be protected by cpu->lock. We will use these helpers to ease the transition, since right now cpu->halted has many direct callers. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 8b85a036cf..5047047666 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -489,6 +489,30 @@ bool cpu_mutex_locked(const CPUState *cpu); */ bool no_cpu_mutex_locked(void); +static inline uint32_t cpu_halted(CPUState *cpu) +{ + uint32_t ret; + + if (cpu_mutex_locked(cpu)) { + return cpu->halted; + } + cpu_mutex_lock(cpu); + ret = cpu->halted; + cpu_mutex_unlock(cpu); + return ret; +} + +static inline void cpu_halted_set(CPUState *cpu, uint32_t val) +{ + if (cpu_mutex_locked(cpu)) { + cpu->halted = val; + return; + } + cpu_mutex_lock(cpu); + cpu->halted = val; + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; From patchwork Wed Jan 30 00:47:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C938A922 for ; Wed, 30 Jan 2019 00:54:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBBCB285D4 for ; Wed, 30 Jan 2019 00:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD36128E77; Wed, 30 Jan 2019 00:54:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D490285D4 for ; Wed, 30 Jan 2019 00:54:15 +0000 (UTC) Received: from localhost ([127.0.0.1]:57822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe8s-0004WA-HY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:54:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3Q-00086R-3E for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3M-0000oU-BF for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:34 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57737) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3H-0000gX-8u for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:28 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E0FEA22089; Tue, 29 Jan 2019 19:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:16 -0500 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=PNEU9dRhFpodF9bWB/VD6888ICLnibwbN47QpugcwVA=; b=hmzb85TUt7UD 8bS53+MieHrtAuK/Pi2O6hT773LsTBKkKeZlZRWQLMCcVr346V9kW9m56SxH9r9D 5UB/PfufncVABVcXLrKD64vEOND4JXvPID/H9o5TMoGT+E33mHiF1K6rmzpJXeDe OuHviRk3bOGydcCSBXCNgDwlgcX2YyA= 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=PNEU9dRhFpodF9bWB/VD6888ICLnibwbN47Qpugcw VA=; b=J7DRXQd+9pvqktwX3DzzyfNrh8kbN24m/4tMS2gaKxF6/PAIJCPSbj+5G HZHIuTrhV49sNQIdkxeDVMn0RIC2DshasbhvPIrL8wq2LgyQNgc6kSVKuFLcsCJf POUWivyl/peEWCBHT8Cdijqa9TB0wmzOS/yKswIOZFEQWK6Bb44qgSpwEtZLYo9O Ej/etjr6N/y+bNlG1vp+VWfEYt1jHgAcwt3/r/oPWZLYoqkFwXAvgxt+WBb+VPgB uvyMWovhyZuu0Qd6brslBiCusC8Wo8xXc+eEhlpfFeasgya8ZufU0ELtLu+UaEBt d33QzAdzgE+KiF/dRWRJwYH4YrmWg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 7AE9FE4596; Tue, 29 Jan 2019 19:48:16 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:14 -0500 Message-Id: <20190130004811.27372-17-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 16/73] tcg-runtime: convert to cpu_halted_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- accel/tcg/tcg-runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 4aa038465f..70e3c9de71 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -172,5 +172,5 @@ void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) { CPUState *cpu = ENV_GET_CPU(env); - cpu->halted = val; + cpu_halted_set(cpu, val); } From patchwork Wed Jan 30 00:47:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 967CE922 for ; Wed, 30 Jan 2019 01:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 883F82C842 for ; Wed, 30 Jan 2019 01:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BB312C876; Wed, 30 Jan 2019 01:17:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E79DD2C842 for ; Wed, 30 Jan 2019 01:17:17 +0000 (UTC) Received: from localhost ([127.0.0.1]:58184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeVB-0006WR-3o for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:17:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3g-0008KQ-W3 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3e-00014h-Am for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:51 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:53481) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3b-0000gi-Tt; Tue, 29 Jan 2019 19:48:48 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3A0AD220D7; Tue, 29 Jan 2019 19:48:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:17 -0500 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=vTJvbxpBU4eOFfsiY9y7x8qOJQHNwQmc9QTOLwCiUI0=; b=y9RKQGoKDEAs 85pavS1yb/v7+dD8yykRW/Bh26epojEmI2jexMfAkbpY3aWxU6fqjPrfvsWup7iX RPszzafbA+i3bXDw/gu36GLsrfKvTZkUGPExrTheaq55tOj6oGeDMLdw9UHXYRUW x8Wzri9rWEswipjaZ8KsgucZGmnyzfI= 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=vTJvbxpBU4eOFfsiY9y7x8qOJQHNwQmc9QTOLwCiU I0=; b=FUMIy6gaoI3Cmie9Ftblr8laYpoVyMl3j/gS0iLhYLAV4Z7yc6em6oxSr IJ+YhLmYkftMY+LxEhBFGgP7nQt5wAs4ICnYqdP9ZBKdQtfA43ktN4AAss45KKkW csNsz0SRl337k+dai4DjN3g1ne9XpW6uhOAlnvyHTJgkiuTMoS71u+bsD/bky0LT +sJvupK0RrI8N7ejYwAVuzEtm0DJaX7br3deRSxMKHiQ5/rW4d64zx708Nv6jx0c mBpSxuW5T59dulKc1vOKgREUuLm7bauo8VDh+i795kSbWISHvAMssZMpVxfCKAPy ww31/LBMJD4lOXi22FOZSeCCJIYIQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B1ED8E4667; Tue, 29 Jan 2019 19:48:16 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:15 -0500 Message-Id: <20190130004811.27372-18-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 17/73] arm: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 2b856930fb..003bf6c184 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, @@ -238,7 +238,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 d6da3f4fed..8cf2f5466b 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->isar.mvfr2; cpu->power_state = cpu->start_powered_off ? PSCI_OFF : PSCI_ON; - s->halted = cpu->start_powered_off; + cpu_halted_set(s, cpu->start_powered_off); if (arm_feature(env, ARM_FEATURE_IWMMXT)) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q'; diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c998eadfaa..f9ccdc9abf 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -479,7 +479,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) } cs->exception_index = EXCP_HLT; - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_loop_exit(cs); } From patchwork Wed Jan 30 00:47:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFEB6922 for ; Wed, 30 Jan 2019 01:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2C642D4D7 for ; Wed, 30 Jan 2019 01:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6F762D4EE; Wed, 30 Jan 2019 01:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1A6F2D4D7 for ; Wed, 30 Jan 2019 01:04:51 +0000 (UTC) Received: from localhost ([127.0.0.1]:57985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeJ9-0004ct-3P for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:04:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3X-0008Cf-Es for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3W-0000uG-1I for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:43 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3V-0000h8-Sj; Tue, 29 Jan 2019 19:48:41 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 756F2220F9; Tue, 29 Jan 2019 19:48:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:17 -0500 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=9hpKveWJQxWUrzcZa/RdJgi3lFThTuYZwErlYiAFIQI=; b=oIphg YVAeWuFw57iD02wXwyTW+GG7o9DQHy7cvHUUwJdQOwLxz7bd6PeR6imOlGOGPrMC sNhfEtro6lpRdyEbPngsyIcZcsLGdZlxUWdnA34YcoBv60cbuPiPTLpGea/JDlKi 9FIq5p642ScZDzUoiNfj0MwY0/pWUvc5cox6iw= 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=9hpKveWJQxWUrzcZa/RdJgi3lFThT uYZwErlYiAFIQI=; b=PhvjLlQaDQTLpjK79dr2nD0ZYBeNmIUXbAaoIEYsjI8kl 1rk8WpZBOwD5RGD5LbdCmzSQNon0mefDeSakXbhh+Iol0LtVhw1A93xWL2iHHLS1 9Mjjf6mGVaX80KTQyJSO518yVPXG+NbIIbhok4jctwar5TBqNkK6Kgs8ebBOYg1C 646hu4HO4uUHcl+TpmdiMYBL5wJvR8fTFPE3vMmeHxjRS5AWAOUjE9Es+Lji0f+i 4nnCPsP1blJBiNN+kcSzEL7rCWzDkqP3t9RPYvYBDEB6fT48juP9CwQJT95eqSjz xW1KS/ca40/aRcc8PM36yIeN3rg+cNh8G57feu6gg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeeg X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id F2C24E4559; Tue, 29 Jan 2019 19:48:16 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:16 -0500 Message-Id: <20190130004811.27372-19-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 18/73] ppc: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In ppce500_spin.c, acquire the lock just once to update both cpu->halted and cpu->stopped. In hw/ppc/spapr_hcall.c, acquire the lock just once to update cpu->halted and call cpu_has_work, since later in the series we'll acquire the BQL (if not already held) from cpu_has_work. Cc: David Gibson Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson 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 0581e9e3d4..d685c36767 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 0405306d1e..797fd5c1a8 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -36,7 +36,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. @@ -90,7 +90,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 17bcaa3822..a889eef4f7 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 ebbb48c42f..0efdb71532 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1374,7 +1374,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) @@ -1383,7 +1383,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 59e0b86762..a757e02f52 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8454,7 +8454,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; } @@ -8608,7 +8608,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; } @@ -8800,7 +8800,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 Wed Jan 30 00:47:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80DE7922 for ; Wed, 30 Jan 2019 01:11:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7075A2CDE8 for ; Wed, 30 Jan 2019 01:11:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 642BC2D71A; Wed, 30 Jan 2019 01:11:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E0912D747 for ; Wed, 30 Jan 2019 01:11:15 +0000 (UTC) Received: from localhost ([127.0.0.1]:58099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goePK-0001NZ-9x for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:11:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3b-0008Gh-7L for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3a-00010V-AF for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:47 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55295) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3a-0000n9-48 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A276B21F93; Tue, 29 Jan 2019 19:48:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:17 -0500 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=v+Ie6wjjbdONS5kbNT+NedOaLePHO4mnHUamIazXbp4=; b=lieWZykLpOxQ zdiHH5LBEEaH5ziS9ZJf353ScwnJV7Sm21DXoSSzfhXJK0YpqA2r2xw6M6MazSCN D1N4xwxvsz7K4/GKUJdeMpGRUhdwXmS3nZxyPTv6M8dOsDHR7cIBewPYaBIx+oE5 JR2EPJEt8kfRHxYK5xJvvxoFqy3GSTA= 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=v+Ie6wjjbdONS5kbNT+NedOaLePHO4mnHUamIazXb p4=; b=axUMHOwHC9m9ShfYxDI/YISa+v7kQdfXfXNwCPgVTpsDepW1gb3LRUMTD 2xW3TgLCT0ClnCVDvqz0Dt9KNnKwhjvdzqP5XfQ/YjOVnXmXkEx2P1hg7u6KMa34 pOSdP4J4mHCVLnty5RWOoqz+1/TC8zskL+2vgTzEAgU/jIXzgRVvcVnhWdyJTjjC E+t8vrIZsaZq7YS/WFbWuloHXDrrHFV8ZRmhlJL3qnV8LOwFo5Pn1FATHKeCbMGv VM/nvqn1L0Wxls/H2Btjnt23u8Sej+qhFP0FOVdyIBL6ZVDqI0H6onT6LFbwQGys xyl58kxci1eagoPyCUDI62HOk15oQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3A069E4596; Tue, 29 Jan 2019 19:48:17 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:17 -0500 Message-Id: <20190130004811.27372-20-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 19/73] sh4: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAB5F6C2 for ; Wed, 30 Jan 2019 01:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC4BC2D4E2 for ; Wed, 30 Jan 2019 01:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F99F2D4E4; Wed, 30 Jan 2019 01:01:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CC5762D4E2 for ; Wed, 30 Jan 2019 01:01:19 +0000 (UTC) Received: from localhost ([127.0.0.1]:57955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeFi-0002DY-HY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:01:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3b-0008H1-IZ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3a-00010D-6u for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:47 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:53889) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3a-0000nA-0l for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E929A21D1F; Tue, 29 Jan 2019 19:48:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:17 -0500 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=KsN5jCji4hQ6WtTC+1zKqtuxAR438zTAt3ofaYlADvw=; b=GY6k1xQQi5iv QPFCRIDFx5e2jDGN77dY8fhuZG2lhKCY44bvIebi3p4ywiOr9br3i3tRDZ5uyMdu Hu5krs/ECdYDDax1MtreEYZBzLVx7MBpKZL/2IDbsgKEL2gCuH9Is8dGQ7+0zWvu pVk91HkxxyDqJrnX2a5nALdH+M5/WYs= 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=KsN5jCji4hQ6WtTC+1zKqtuxAR438zTAt3ofaYlAD vw=; b=ATHOkvp/azrLrFrbeQXDsTakUwrU/szEsaGqDYtEr1LW9B3NtYohV+WS3 +aUUpH5z8x0qr05jzQgjz9UdxtBCszFREMahfZ4RPESJ+U7UpUbY8u5wZPeEYUWE d7WKkIeeLwgTCIvfGG8xmmFbf34UUhFFW/vZxWsf+P1pqv2fk/ljlKU11+/EkouG +ERvnzPGtMjpIEqzFK4NyBFqGyvc6C/yojJauUERwZrT3yGnlzBIrwd2K6yoYG+4 MKDjzEgni/M9YHLJza9iIA1GoRHphHz3pzP8AE5sfGiqMEuCWYWWnXZLsVGcCq/l F8n5Bryxgj0LF1QmsrJuAoIwM69Vg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 759A5E4667; Tue, 29 Jan 2019 19:48:17 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:18 -0500 Message-Id: <20190130004811.27372-21-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 20/73] i386: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Eduardo Habkost Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 59656a70e6..6c65b2ee5d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1618,7 +1618,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 2f5412592d..a37b984b61 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4723,7 +4723,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 b978a9b821..22951017cf 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -471,7 +471,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; @@ -548,7 +548,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 e193022c03..c1ff220985 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -499,7 +499,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); } @@ -659,7 +659,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; @@ -677,7 +677,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; } @@ -711,7 +711,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 9af4542fb8..9006f04d92 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2836,7 +2836,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; } @@ -3320,7 +3320,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; } @@ -3343,7 +3343,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); @@ -3356,7 +3356,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) @@ -3367,7 +3367,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 Wed Jan 30 00:47:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7707F922 for ; Wed, 30 Jan 2019 01:11:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B6502CDE8 for ; Wed, 30 Jan 2019 01:11:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FAC22D764; Wed, 30 Jan 2019 01:11:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFCA92D4F8 for ; Wed, 30 Jan 2019 01:11:17 +0000 (UTC) Received: from localhost ([127.0.0.1]:58101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goePN-0001Qz-3s for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:11:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3b-0008Gc-6V for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3a-00010K-74 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:47 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39885) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3a-0000ob-2W for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1A2AF2206C; Tue, 29 Jan 2019 19:48:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:18 -0500 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=PawPv0a3dyNnbcWoiEN+79WSi9tXq3p+eK7KnmdkQO4=; b=CgaNQcLaTqpJ 5Gs8On7ighZRFOuHIjRjVnX/or+Q55Ekufb50xwtHRHPtfrF4O5/+f9zQJQE1Pe5 mwWzZ77pT5/Vuru0ObFuLl1jyXwKQ89gwzoerfdH62AtJrTqTf5PN9i2WuF45Frv MG+DNw3jSLN9goy80UD6V1LqNrD/h1Q= 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=PawPv0a3dyNnbcWoiEN+79WSi9tXq3p+eK7KnmdkQ O4=; b=kY9xE2Mkt+gMrh58BkcOUg6gmRU9LwQw7M1HRQJ+pkGumk6qvB63v7pXM f52DL+YK/n43rGGLGgg3055nrY+tDhl2+zERzpjWPpdgd2hJttqniYdzEU/u7e3O O1GXscMQPMKetdILHGyI/lEO0zhRP4RfwOM/HU/77imL6UJ+KvnnY5kfmD6uw41q 5D1c1Rh172DuXY7VMLZ+lMh9XwBen9iovqfBiTwB0N2IVudn4PizvgtvImgwHnCH L+7K934lk4xyMNN4e/VZ0wMf4zIryQiB0ayicOQkKcM1FVlUwcYrHyV1di4Gd6SM kap8UplTNLGBUcJH/yJWqgrHYpvzw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id AC3EFE4559; Tue, 29 Jan 2019 19:48:17 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:19 -0500 Message-Id: <20190130004811.27372-22-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 21/73] lm32: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Michael Walle , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Michael Walle Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C82B791E for ; Wed, 30 Jan 2019 01:15:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBFD22C842 for ; Wed, 30 Jan 2019 01:15:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B05942C876; Wed, 30 Jan 2019 01:15:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 311102C842 for ; Wed, 30 Jan 2019 01:15:17 +0000 (UTC) Received: from localhost ([127.0.0.1]:58044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeMO-0007Hn-4M for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:08:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3Z-0008Ex-Ip for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3Y-0000yo-VC for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:45 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34185) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3Y-0000oa-Rd for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:44 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 697F4220AB; Tue, 29 Jan 2019 19:48:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:18 -0500 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=w3cQVwyHy5Lp8ohm2WCs/pbdJ3RqM53258B+acZq+sE=; b=Cp2luCxwZaCK se5yVLNW1GgD6uare4dOccrpx2L9/e1ib2uvZkfKgdaKTvw6a8mPdRfQ9utg3dAa drYGGIM+V4VwUhFUeseH3eMeK25qpC5iEK5mKzu/lhOR7HZof5/WotRuad/65TsU D+zhEHSy9JHBy0/xV773PH6huo7bVfY= 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=w3cQVwyHy5Lp8ohm2WCs/pbdJ3RqM53258B+acZq+ sE=; b=iz1sDSS8I6svyciDQR6+rYCZasIdUWiW8xoR3XHSsjgMe6VLMXbaFGagZ OhbbndDXk107Hxp2cfL3ID2zdjgQsJ0jAs5YcCO79s8IGAS3UibQYfatIXN7ihAN XnesZaELmjpPUdzVOfc9o0KsBVNjXQq2JIWFZ4F9EfcjzyjeiyzLmcn/XwZJgQQZ WxbKF+ys0DNnbKIlQesQa/JURJk2GSNUBnTbBFqLeDvuzR2J12hXTsjuh63UnAqW LsO7Y+t5rOg+I+rHcSozCwkDo2Ov8KvjMurwDaWyjo9kQVNpOjgW5pabdCS9WrkC jj+nlf7+Z2MwvR4KoIAWRzccg3w3w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id EA94AE4596; Tue, 29 Jan 2019 19:48:17 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:20 -0500 Message-Id: <20190130004811.27372-23-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 22/73] m68k: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAA89922 for ; Wed, 30 Jan 2019 01:14:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9ACB2C842 for ; Wed, 30 Jan 2019 01:14:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAF9A2C86F; Wed, 30 Jan 2019 01:14:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 378DD2C842 for ; Wed, 30 Jan 2019 01:14:29 +0000 (UTC) Received: from localhost ([127.0.0.1]:58130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeSS-00040M-EP for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:14:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3b-0008H0-IE for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3a-00010h-At for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:47 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:46499) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3a-0000oc-3w for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EA791220B8; Tue, 29 Jan 2019 19:48:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:18 -0500 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=anel5ixvlWysa+hrhIb24Q99hJiUPUhtrWK+Skbskyw=; b=ehZBNXiMAplN 6vEnn3XNUPVkMr7AxRTTYuFSW/5AHcINbg50iQi3TJn13M3QWEK7/Ct82LeD1+4A KcI7ZaFZ4RkoOOw9flGip9BA/ZLdKMeEosOsVOpVmhYizGN5PDbOwuedHsjlZl1N /zVopH+5d4o60Y+qV5srQfA6OioXo7w= 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=anel5ixvlWysa+hrhIb24Q99hJiUPUhtrWK+Skbsk yw=; b=n3uCPgHRhtUFUx0nPcHgHmrPRLvSi2uEnKHWx6EBIG2Xm5Kq38oOE/MK+ 9vNdvbV4SupeZUkZK/Vne2qm8e9pVDkktfyYvqEYHL+ImA0IzKNB/5epHmUQ6jy1 aeXeiGCNCXLBge7zimfjVqHVGsmhvJTB6FBrxXLQ94fgMZLNs8sRlZmOQm3lkG+P Zl52/yiCAQgiNAoDxltwq0GxILSBb8c7g2j3u/DtJRk5+6ztWjhaDX7g+rO6pVcC 0d1MSB2sACzIkra4IQb6qv/xAUNILqyWQeDV7jeZwEL9N371xu4uFj1tSnX2tvu9 wSGkzu2utGVs7lZgOYwblzFbmNKgA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3719FE4559; Tue, 29 Jan 2019 19:48:18 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:21 -0500 Message-Id: <20190130004811.27372-24-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 23/73] mips: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 fc97f59af4..57f3c9e5fc 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 1257d8fce6..1fab14d332 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -181,7 +181,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); } } @@ -191,7 +191,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 aebad24ed6..0b8104c27f 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); } @@ -2669,7 +2669,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 e9b5d1d860..3e20ce9f1d 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -30044,7 +30044,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. */ @@ -30052,7 +30052,7 @@ void cpu_state_reset(CPUMIPSState *env) env->CP0_VPEConf0 |= (1 << CP0VPEC0_MVP) | (1 << CP0VPEC0_VPA); /* TC0 starts up unhalted. */ - cs->halted = 0; + cpu_halted_set(cs, 0); env->active_tc.CP0_TCHalt = 0; env->tcs[0].CP0_TCHalt = 0; /* With thread 0 active. */ From patchwork Wed Jan 30 00:47:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57A6C91E for ; Wed, 30 Jan 2019 00:58:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3282C971 for ; Wed, 30 Jan 2019 00:58:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C8C32C977; Wed, 30 Jan 2019 00:58:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C9CF2C971 for ; Wed, 30 Jan 2019 00:58:28 +0000 (UTC) Received: from localhost ([127.0.0.1]:57897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeCx-000895-Pg for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:58:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3Z-0008Eg-Ch for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3Y-0000yN-Bf for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:45 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:56819) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3Y-0000oe-87 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:44 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EA87322094; Tue, 29 Jan 2019 19:48:18 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:18 -0500 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=FnrHFDPYEZOeoHDjTCgBAWKVQcZsN406I/7RVcdXXmo=; b=jIQ7h bfWV8fhzkn201H3dJyCOzktqok8UzrWTKjIbOyO3Znc3nlARa1/gi4IieD6C17UF udtgh6Chv9G23BiaiDSvJJuT5705A/LQX2QyDxNX5oRyjKMSYZ8uKrt0UFKyxCVd D5jTt8sRTNHUjBhAwH0GC9d4WXVh4UAgDbPqPs= 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=FnrHFDPYEZOeoHDjTCgBAWKVQcZsN 406I/7RVcdXXmo=; b=Hw3hU0d+V5ffuYxWT5qvltogKeJJucxlQ+PHzs3oqg6tA pQLq5SvCiwkFxc7/tpiOnwsS/yu0hCj2qXCQjocdpttoYqSsWkudfhUyyWT5HBXm b/K0zNr22weYf4caed3cSkM8JNsbp6PgaGw0Ne+FdtkWu7qr8yVhxDiBLxON97oG O9ZTrHw+2R6qt4qMVSGqEqiqJ5b7M0F3nuO4Ji3SuQRV1+dmAA3wef8rMykO4y8X VPieu2GyYh/FUr32RB/6tdaVcEZT2S2zesIB8iNJia1DCk/Y3hogVLS4NuUpku4Z LrMt3CSsBdbe4PxSObZbzoKzQmgLP6DhkctXtp+Pg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeeg X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 713FDE4664; Tue, 29 Jan 2019 19:48:18 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:22 -0500 Message-Id: <20190130004811.27372-25-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 24/73] riscv: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , Richard Henderson , Paolo Bonzini , Alistair Francis Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: Alistair Francis Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alistair Francis --- 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 81bd1a77ea..261d6fbfe9 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -125,7 +125,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 Wed Jan 30 00:47:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADE23922 for ; Wed, 30 Jan 2019 01:14:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F7A42C842 for ; Wed, 30 Jan 2019 01:14:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93BE82C86F; Wed, 30 Jan 2019 01:14:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CBC982C842 for ; Wed, 30 Jan 2019 01:14:54 +0000 (UTC) Received: from localhost ([127.0.0.1]:58024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeKC-0005WM-97 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:05:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3l-0008P9-Dt for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3j-00018B-0g for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:56 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39351) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3i-0000pP-SR; Tue, 29 Jan 2019 19:48:54 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 37C882207D; Tue, 29 Jan 2019 19:48:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:19 -0500 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=dRko9o7UIuv09Hif64QtDzaTNbrbLpVj30v6PONbyhA=; b=LZondVWcqVRk g+ps0jQQ7nddp95HNTZLD1+Is3F5+UcpJ/sARScGtjzwxAnUfwZBjdf6/7QI4qyE WQnoyEExyQYx4WdGvNCM8INVEgsQUr076AI43G3GoL6cMCQDUtJ8ldBvrN1z7OJ5 /R71bb0NlDd5WM/Jy9ecMYwjlPMEuvk= 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=dRko9o7UIuv09Hif64QtDzaTNbrbLpVj30v6PONby hA=; b=MfdLjfGuFt6/EEuMy+kdsxt0xYELImjQR8xDG8tA3ENLyLRqqTS+1bFnA A4pz19cTfoLP8oetcHC69lN1wGbOl5Yc3aofCvt0ueKpM6AdwGYl+zxphdujGMif 4Z4sG1tCD/icR5NUNbjGzqffP7G5fGjMC2uDlTX+fQygg/cRUXoZC3JD6PIFKkYL fYp60NOY2Y3aW1Dh250iQHGrhhpZwthvjbdDHSk0vn8me4Icv8HRdLIuqAdQzwH6 RqDqQUznxjY5ELI0vGpTwrgVWCmrkhY72TFM606F083JNSE/wbdkAele+9P/1PWz RElWc08S2DaJ/IuvuqRDMMh6V5OOw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id A97E0E4596; Tue, 29 Jan 2019 19:48:18 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:23 -0500 Message-Id: <20190130004811.27372-26-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 25/73] s390x: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Cornelia Huck Cc: Christian Borntraeger Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Reviewed-by: Cornelia Huck --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 22 +++++++++++++++------- target/s390x/excp_helper.c | 2 +- target/s390x/kvm.c | 2 +- target/s390x/sigp.c | 8 ++++---- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 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..4d70ba785c 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,16 @@ unsigned int s390_cpu_halt(S390CPU *cpu) CPUState *cs = CPU(cpu); trace_cpu_halt(cs->cpu_index); - if (!cs->halted) { - cs->halted = 1; + /* + * cpu_halted and cpu_halted_set acquire the cpu lock if it + * isn't already held, so acquire it first. + */ + cpu_mutex_lock(cs); + if (!cpu_halted(cs)) { + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } + cpu_mutex_unlock(cs); return s390_count_running_cpus(); } @@ -353,10 +359,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 Wed Jan 30 00:47:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD7E113B5 for ; Wed, 30 Jan 2019 01:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB2A02C842 for ; Wed, 30 Jan 2019 01:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAFDC2C86F; Wed, 30 Jan 2019 01:15:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04BDB2C842 for ; Wed, 30 Jan 2019 01:15:01 +0000 (UTC) Received: from localhost ([127.0.0.1]:58031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeMM-0005yn-Jh for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:08:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3a-0008GO-Tp for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3Z-0000zk-SB for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:46 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:59567) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3Z-0000pM-Nm for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:45 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 447A4220F7; Tue, 29 Jan 2019 19:48:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:19 -0500 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=T1jvfbjZQbcYAiRnhSGINWUuTxHdTdCdEdsW64M5tr4=; b=ffpofg9ljSbU 4WSwkh1i+t6ZUItLSpyybBbd1FpZhKZmpDUT8BREgQvfkrqO5q/ThFnPtaSMzfDS 1WdybqJzHnEO+iG7VnmwTxKxeUwnJGhBS3U0Ui26HpH1Z6LEqkCZxbiudKMznlJy f0GCQrSS+jnKiJeziLL4rZ8HYCEtNUY= 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=T1jvfbjZQbcYAiRnhSGINWUuTxHdTdCdEdsW64M5t r4=; b=qH+tIJ1C3P1crCHXB7k3yptK0aqunXqhimfn+Vth4dBWSe6Lob6yYOgg4 S/gFuslMQ/O+6vlb+0+r8N4H0oU4XreaOlCA3/4mlZiVjHbssSMq4yBrh12APHU6 BEZq//3dAemv+khGlwD//ASf1yRgCGHVy25um0xuqI5x3A9dSbm6kgQLwj1kX8fy J9XsOBt0wyiHdDlFASprO+rdTBQbOrcWdjtdHaHnvtlQe0PhwoZgm7drcVLlwOnI 1CZ7MfVu8DeuLxTZfdwnHK7LV8wI/QMhpwBsviqpDzSx/mekaQnKqnvPjvk53dQH SSmlvNH7k5ojei/GDtFYcgXjJt4JA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E3C87E4667; Tue, 29 Jan 2019 19:48:18 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:24 -0500 Message-Id: <20190130004811.27372-27-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 26/73] sparc: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Richard Henderson , Artyom Tarasenko , Fabien Chouteau Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Fabien Chouteau Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota --- 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 709ee37e08..ddcc8d8c4f 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -167,7 +167,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); } @@ -198,7 +198,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) @@ -207,7 +207,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 Wed Jan 30 00:47:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57DCC922 for ; Wed, 30 Jan 2019 00:57:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3BA2C969 for ; Wed, 30 Jan 2019 00:57:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FA6B2C972; Wed, 30 Jan 2019 00:57:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CDCD52C969 for ; Wed, 30 Jan 2019 00:57:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:57895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeC8-0007Oj-3m for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 19:57:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3i-0008MI-UH for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3h-00016r-M9 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:54 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51871) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3g-0000tJ-VH for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:53 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9A9D721B84; Tue, 29 Jan 2019 19:48:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:19 -0500 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=bYo/eCxspK50LViz0ZwJZHij9KCsdbGTQTbSCy/29BM=; b=yGkiI8J6p9UB pQmresUjN0LMDOv6J+3vad2j0mfORhTZ3oAausLjSOd+zxEhkz6HWS6uf3eMuZgM x1ZYi/TdSAsml7br3IKDDHzosInCn9obDRKhrQQkX5tz/ue1+EkXMW3Ijxd2OD9k 0j981p+ij0UauBQvX/A6k1dSrC8jmxk= 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=bYo/eCxspK50LViz0ZwJZHij9KCsdbGTQTbSCy/29 BM=; b=wIk7jK0wHWL8wpcJNvjOMqPhFie7i6hK1TfOzGpCsRdp7HB/mDWt4VCsh /JT1fhKPhxiNaEbp4Q7XdJl3Q8zNWESMfct94x6mvC1T1L2DAEQyGvZgG1Whi3VU TVixHukUTEdgkkATJAVea8ZPCXQQ/WnhSv5X3r+QJqh7eDkwVJkteBVbKGkeCFWn ahYY9PyMtiGUkcB/5W3dUa5dZ0XNIVwuy7o0Z0VM8a1TSiWBTbXt8pv7B+57BnUq 6xtd3U8kVLYtSSe+WvWPFK0HXM2gb4vFzgeXfZUvzQHqNGSdyyZFQXdvXseqaI0A NccmXB8xGtHRblEfWP+oRehfrAraw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 25423E4669; Tue, 29 Jan 2019 19:48:19 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:25 -0500 Message-Id: <20190130004811.27372-28-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 27/73] xtensa: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Max Filippov Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- target/xtensa/cpu.c | 2 +- target/xtensa/exc_helper.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 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/exc_helper.c b/target/xtensa/exc_helper.c index 371a32ba5a..65031e6b65 100644 --- a/target/xtensa/exc_helper.c +++ b/target/xtensa/exc_helper.c @@ -116,7 +116,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); } diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 323c47a7fb..2ebbfc29bf 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -248,7 +248,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 { From patchwork Wed Jan 30 00:47:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DA3913B5 for ; Wed, 30 Jan 2019 01:14:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F6E2295EE for ; Wed, 30 Jan 2019 01:14:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 636A429789; Wed, 30 Jan 2019 01:14:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0DDC5295EE for ; Wed, 30 Jan 2019 01:14:10 +0000 (UTC) Received: from localhost ([127.0.0.1]:58127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeS9-0003iq-7o for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:14:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3i-0008MH-UA for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3h-00016h-KW for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:54 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:56785) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3g-0000tH-U3 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:53 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D2EF322112; Tue, 29 Jan 2019 19:48:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:19 -0500 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=Wt+44SC+3DVYaXBv0kwACpEPYHc5fOlQLkruvF5Ro5A=; b=w/trN01yhnNG bzandsqJCx8kFvDSLtvXqsLx+MQnkerZ87iXjlHm+CkaEwEMOEzcEYbp9D7xNJAs lM+5LpAyittO8/x0J4EqBG7cwT2NQQV7dnSucPFLnFL5URxHgD/x9N5ydSvtGVag eCiGsM8LN9H9y03nTHI+ipgwPHiEQQk= 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=Wt+44SC+3DVYaXBv0kwACpEPYHc5fOlQLkruvF5Ro 5A=; b=ZfiFTKB/gTeCEC4H0kahrr3VP+ydg0S4UccboAZKmcg7fZILRvMkbzhud 5FkSRRTjPZ6g5ECploIaKbZGNYPjYkqTTbgUROEpCs/K2zPK9Eai0rRDW/02r4ns EZBsPWh54El7sIQhuFMIChHLWH29NeCKSFm1kfDMiyVusxUTarEOY38+Voc7bGRt huC03RegtT7BWI+PBbxZgl3jRoK36itYXwc5b4G/JXRdUe5VvEM8YhtmIcOL4i62 qSpjhJi1+Xz6vB2n58/8KI1qxKBPaP/9QdtuLcjzOEX4T/ZYGzeKmG4WGpBxoqyD YxTruua+fZSEYwDInw8IbMefOrxXw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 636DCE4559; Tue, 29 Jan 2019 19:48:19 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:26 -0500 Message-Id: <20190130004811.27372-29-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 28/73] gdbstub: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 3129b5c284..91790112a2 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1659,13 +1659,13 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) object_get_canonical_path_component(OBJECT(cpu)); len = snprintf((char *)mem_buf, sizeof(buf) / 2, "%s %s [%s]", cpu_model, cpu_name, - cpu->halted ? "halted " : "running"); + cpu_halted(cpu) ? "halted " : "running"); g_free(cpu_name); } else { /* 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); From patchwork Wed Jan 30 00:47:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5DAF91E for ; Wed, 30 Jan 2019 01:16:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8CB82C842 for ; Wed, 30 Jan 2019 01:16:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBE082C876; Wed, 30 Jan 2019 01:16:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C03E2C842 for ; Wed, 30 Jan 2019 01:16:55 +0000 (UTC) Received: from localhost ([127.0.0.1]:58182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeUo-0006EA-Kw for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:16:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3l-0008PC-FH for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3i-00017L-F6 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:56 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45787) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3h-0000uL-1O for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:53 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1516C21FED; Tue, 29 Jan 2019 19:48:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:20 -0500 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=X/x2JcpscALtnqZc4ILquw0WwywjjtaY6hJXpBC9xuw=; b=PodTNs+miBUi wHXMdHeOccnsmNZI4TrPX6EFWbh6wNySLlbsT41u5IseOz82LssOchV29kwcYDBX hT/d6Tucma9CBr0gXhJHfclK4tvgd2zmnH5QE4tuxbrcmDr0alBZP2AkUA0LNDjU kfmeDjJsUtzbP4ngphSLFklJ3YbR7Co= 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=X/x2JcpscALtnqZc4ILquw0WwywjjtaY6hJXpBC9x uw=; b=dAuuhQ4qrTekDQvWV4CM0boxmnjGiLoiOUx/YZNt1hGoWbnDoE3JE2tWT D4891mlvgAg6KcOEooJo7fepdDTieTsLtrhMkQ+z013NEKRtu9GG4Wa/qLelOLUI ZNbdZOvhHYK7Py5xtClU133IGTW1I99WW0FxqIMghjQZ6eptTf7kgpn5pz89XjHA CZ/s7a+4nUpszvSzI92/SIXgywXeDkew+dJ3bVEusGZcQETxVvWUq1rHlEml6hXi JVytkvBLEq+aZ9Pjolwhx+nUKhAZlDbkLCCnxCTqN6QrnyZIH+tzQEWUcRpMP/1y yDT47b5SKGz5n+5rU0QnWcXHHGaUA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9C430E4664; Tue, 29 Jan 2019 19:48:19 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:27 -0500 Message-Id: <20190130004811.27372-30-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 29/73] openrisc: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Stafford Horne Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED0406C2 for ; Wed, 30 Jan 2019 01:00:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D631C2D278 for ; Wed, 30 Jan 2019 01:00:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8C0B2CE4C; Wed, 30 Jan 2019 01:00:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 67DA72D285 for ; Wed, 30 Jan 2019 01:00:21 +0000 (UTC) Received: from localhost ([127.0.0.1]:57949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeEm-0001Ro-NH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:00:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3l-0008P8-DX for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3i-00017X-K7 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:56 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37315) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3h-0000uI-0Q for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:53 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4D1CD2211C; Tue, 29 Jan 2019 19:48:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:20 -0500 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=nteXfkQgFhCCC1LXSehxF9hlSNxS0UbtbpK+jvLaaQU=; b=qgQgd /aKtdZVYf9yDAAuhkAtw8b47MdVJze98me2DXxR65k5aON66J22HApb2hvizukpe e/8vca/QVxRyCk556SXKkNc5lmn00BXQTehtE/flvy+Wn7uLBYFhRZptgO2homY0 Tb8uvwxhFbMkyKIU/U37Sqxd4sn5+0+2g4miTI= 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=nteXfkQgFhCCC1LXSehxF9hlSNxS0 UbtbpK+jvLaaQU=; b=JW9aQfnh2jymHqltFcJN8MB3MPQemdTmEsWieFlIgfPMw IKVd93WBpBbKO3xdWYuUgKPnlFbIbQlqYD5GXnExF7qqMLlgIq+cYdTKdU7hu39e chER0s8wQSSW+AkbT/WXyfwfriK9j2zzZzzElhS6GGcU6bou8tLESyTcxesE8Siy eZRzFzP7IWnlL4YaAUPzRFN89OLcLCrG5VCgdm3rcNr5Zt4lqXMb4NgrGiKpddjA zQ421f8QUOnmNuMoVCzqrG3S6KakdSt1Oxbm9mx34mXttOJy6y8HunrKRjZIqhPu Iv3nwWHLKU727xY+RKrBnfZaUyRtYluEN6t2dlPVw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeeg X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D68B3E4667; Tue, 29 Jan 2019 19:48:19 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:28 -0500 Message-Id: <20190130004811.27372-31-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 30/73] cpu-exec: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- accel/tcg/cpu-exec.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 6c4a33262f..e3d72897e8 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -425,14 +425,21 @@ static inline TranslationBlock *tb_find(CPUState *cpu, return tb; } -static inline bool cpu_handle_halt(CPUState *cpu) +static inline bool cpu_handle_halt_locked(CPUState *cpu) { - if (cpu->halted) { + g_assert(cpu_mutex_locked(cpu)); + + if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); + + /* prevent deadlock; cpu_mutex must be acquired _after_ the BQL */ + cpu_mutex_unlock(cpu); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + apic_poll_irq(x86_cpu->apic_state); cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); qemu_mutex_unlock_iothread(); @@ -442,12 +449,22 @@ static inline bool cpu_handle_halt(CPUState *cpu) return true; } - cpu->halted = 0; + cpu_halted_set(cpu, 0); } return false; } +static inline bool cpu_handle_halt(CPUState *cpu) +{ + bool ret; + + cpu_mutex_lock(cpu); + ret = cpu_handle_halt_locked(cpu); + cpu_mutex_unlock(cpu); + return ret; +} + static inline void cpu_handle_debug_exception(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); @@ -546,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; - cpu->halted = 1; + cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); return true; From patchwork Wed Jan 30 00:47:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF183922 for ; Wed, 30 Jan 2019 01:15:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C032E2C842 for ; Wed, 30 Jan 2019 01:15:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2CD92C86F; Wed, 30 Jan 2019 01:15:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 577F42C842 for ; Wed, 30 Jan 2019 01:15:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:58149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeT4-0004Yd-LY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:15:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3w-00005W-MP for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3s-0001G8-PO for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:06 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55645) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3s-0000yS-I8 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:04 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5E25022121; Tue, 29 Jan 2019 19:48:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:20 -0500 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=0/a9OGctNOF4CEU6FzYoTH6+KLJUMb4KjKR6c+e1Yuk=; b=CMSk8 NrdmF7AifaY8Glwpp1wHpVBYXDSof9t6Tzmk6VNRww3EqVFJ5O38OYnc0GUXNJR7 DsLJ8rcqNfeOl1AehbdzAE9JLwV06uwrx8jpwB32LHenvBcwix8o65laah9OVg2R cL8sHQxposDmc1otI/1CvWmNu9KAKwPBhZbtJM= 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=0/a9OGctNOF4CEU6FzYoTH6+KLJUM b4KjKR6c+e1Yuk=; b=xEA4Js4Ji078yH7VSomOPJkdHLuvJAz2QfWc8spYbUPEN dSBEF8dI3IGEs7HyqlM5M86YNh6rVd1QXBxlqeS72PpOw5MPZQmDmJx4PLwKoiCl 8cgDJml0SiLBOfAfcwOozXj/vKWCP2Hfb0XUZ3hRZB5gDrbwafM4pGe2qMWrMpPN N0Fadws0TYVbPXN8+VkzT6NaWV6nxjKL4qWi8jWwJMYmmOUC/j7Z22JqtbCnDDnA 74nEp85e5aI2wXLEZ7xv4tja0TSqo93vBQpj2r5SdwVSLokIlXIsyb21bNUswV8A HhoJwOeoeQfzMMDtsiLzAFt3UzT5DWhCKoTCHxbkw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeeg X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 191A8E4559; Tue, 29 Jan 2019 19:48:20 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:29 -0500 Message-Id: <20190130004811.27372-32-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 31/73] cpu: convert to cpu_halted X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This finishes the conversion to cpu_halted. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- cpus.c | 8 ++++---- qom/cpu.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cpus.c b/cpus.c index c4fa3cc876..aee129c0b3 100644 --- a/cpus.c +++ b/cpus.c @@ -204,7 +204,7 @@ static bool cpu_thread_is_idle(CPUState *cpu) if (cpu_is_stopped(cpu)) { return true; } - if (!cpu->halted || cpu_has_work(cpu) || + if (!cpu_halted(cpu) || cpu_has_work(cpu) || kvm_halt_in_kernel()) { return false; } @@ -1686,7 +1686,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) 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); @@ -1845,7 +1845,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) * * cpu->halted should ensure we sleep in wait_io_event */ - g_assert(cpu->halted); + g_assert(cpu_halted(cpu)); break; case EXCP_ATOMIC: qemu_mutex_unlock_iothread(); @@ -2342,7 +2342,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 2c05aa1bca..c5106d5af8 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -261,7 +261,7 @@ static void cpu_common_reset(CPUState *cpu) } cpu->interrupt_request = 0; - cpu->halted = 0; + cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->mem_io_vaddr = 0; cpu->icount_extra = 0; From patchwork Wed Jan 30 00:47:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1826013B5 for ; Wed, 30 Jan 2019 01:15:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B3C52C842 for ; Wed, 30 Jan 2019 01:15:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F382F2C86F; Wed, 30 Jan 2019 01:15:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 739B82C842 for ; Wed, 30 Jan 2019 01:15:16 +0000 (UTC) Received: from localhost ([127.0.0.1]:58050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeNO-0008E4-G6 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:09:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3o-0008QS-Pw for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3k-000192-QF for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:58 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60639) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3i-0000yQ-VV for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:55 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8C7CF22131; Tue, 29 Jan 2019 19:48:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:20 -0500 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=m3kLTZqe+FpEt4latAPLDgeEyYLXJMip1h/ZJ5ZUxIY=; b=SIKbQpldoRKg kphVZNMOqad4nWGoVt7KX/rc2pFNkfsWOxIYmXjyfjofivHLthos/jc5WVUdpGhB WfBCcvfcCTsBre7nwN5zGEqJsE24H4wlknCY0IY1Jq5prhV0OJFTajzaD44SqI3V kE7cBa9n4Xm1KoFB7FqqL5RlVL5cFAQ= 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=m3kLTZqe+FpEt4latAPLDgeEyYLXJMip1h/ZJ5ZUx IY=; b=LJHgw73YNdBtbnByXpHZc5rr8vY+W4xbg9y1IuEdmKGT6eldNdiNQXWm1 jUyIV0z6Z/Wa5tKFG8d67CYEuXjVQ92QlZwJlv6x7GDhvJ24Q6yCKMeUh1RCa48O /R1C5XorTjRwHrriPoK1KG1NxIbIqKG8Osoa5CW+XxIxVrlybiPCtsB4LpnTIqFj DriN3cB94EksmuKojvPmEia50Q0UyRzCoPa+wMLlioL4Q5hupSQC89NTfh7Dct10 xxM3e3D6ea7k9XbK1AXZaL2nkxMHU3Hv9D1zkSALF2ixiDI/ji7mOshbVfXLwG22 CTiSE3z/r/Oabs8RWs1ZXYfsuzPVw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 46CF9E4664; Tue, 29 Jan 2019 19:48:20 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:30 -0500 Message-Id: <20190130004811.27372-33-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 32/73] cpu: define cpu_interrupt_request helpers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a comment about how atomic_read works here. The comment refers to a "BQL-less CPU loop", which will materialize toward the end of this series. Note that the modifications to cpu_reset_interrupt are there to avoid deadlock during the CPU lock transition; once that is complete, cpu_interrupt_request will be simple again. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- include/qom/cpu.h | 37 +++++++++++++++++++++++++++++++++++++ qom/cpu.c | 27 +++++++++++++++++++++------ 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 5047047666..4a87c1fef7 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -513,6 +513,43 @@ static inline void cpu_halted_set(CPUState *cpu, uint32_t val) cpu_mutex_unlock(cpu); } +/* + * When sending an interrupt, setters OR the appropriate bit and kick the + * destination vCPU. The latter can then read interrupt_request without + * acquiring the CPU lock, because once the kick-induced completes, they'll read + * an up-to-date interrupt_request. + * Setters always acquire the lock, which guarantees that (1) concurrent + * updates from different threads won't result in data races, and (2) the + * BQL-less CPU loop will always see an up-to-date interrupt_request, since the + * loop holds the CPU lock. + */ +static inline uint32_t cpu_interrupt_request(CPUState *cpu) +{ + return atomic_read(&cpu->interrupt_request); +} + +static inline void cpu_interrupt_request_or(CPUState *cpu, uint32_t mask) +{ + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request | mask); + return; + } + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request | mask); + cpu_mutex_unlock(cpu); +} + +static inline void cpu_interrupt_request_set(CPUState *cpu, uint32_t val) +{ + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, val); + return; + } + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, val); + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; diff --git a/qom/cpu.c b/qom/cpu.c index c5106d5af8..00add81a7f 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -98,14 +98,29 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool need_lock = !qemu_mutex_iothread_locked(); + bool has_bql = qemu_mutex_iothread_locked(); + bool has_cpu_lock = cpu_mutex_locked(cpu); - if (need_lock) { - qemu_mutex_lock_iothread(); + if (has_bql) { + if (has_cpu_lock) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + } else { + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + cpu_mutex_unlock(cpu); + } + return; + } + + if (has_cpu_lock) { + cpu_mutex_unlock(cpu); } - cpu->interrupt_request &= ~mask; - if (need_lock) { - qemu_mutex_unlock_iothread(); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + qemu_mutex_unlock_iothread(); + if (!has_cpu_lock) { + cpu_mutex_unlock(cpu); } } From patchwork Wed Jan 30 00:47:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4348E91E for ; Wed, 30 Jan 2019 01:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 343752C97E for ; Wed, 30 Jan 2019 01:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2872A2C989; Wed, 30 Jan 2019 01:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB3EA2C97E for ; Wed, 30 Jan 2019 01:27:13 +0000 (UTC) Received: from localhost ([127.0.0.1]:58340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeem-0006hi-VL for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:27:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe43-0000JL-8A for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe42-0001X4-73 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44633) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0000yp-0s; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E6CE92213F; Tue, 29 Jan 2019 19:48:20 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:20 -0500 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=wzrQuUCEDrT7r5rVK7Zodb4U8mjtYm9B5bFqWBfcZW8=; b=BJdzOuu4Zdb2 QFPXTV9S2hHmlsqLASJnEIFEwGeNqSYPMotSCgYQ5qauDoTExMWw+lmzcSPpuWBj 1wV2UnE1HpAFJcYf7oXmoSdv7r5L5Eym0cTP6zRHD3BT43P/MUJiQDKxJ5ppKMsC DZ8jqKaYRG2DNdRB7tQnWofrHUdBTpU= 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=wzrQuUCEDrT7r5rVK7Zodb4U8mjtYm9B5bFqWBfcZ W8=; b=GqJbOy4jK7YmecJaAoIll6d/zXdj21Kkq2A7S4uWX6w0LIOrxXfmYz8bo eJZLyyg96dEtIdrvGbcGDmfAw+LETzCVCeIyH7q3kb5MzBULiQE+IY1xEpyn21QM WGmJQr1Gx5lpTOS8mzGqSMutDsQ/ozVVnBETp52/H4xhGQrFDNDV7obh5l+UcFNp Vu86B+X8NVhfc8NZx2po+Uhgnf1Hyoy4mX+Ny9lTXizKwuOkTwla30+FYgY8MNYT 70IuYvFbBvUNXqBRxK0VVbL5nTKWj/2orGePDUKOaa39RzEMNitHLMVKrNW6qxkD HtTLZVhQM9kwO1QKqkrs3Cr/BxlkA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 803EEE4559; Tue, 29 Jan 2019 19:48:20 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:31 -0500 Message-Id: <20190130004811.27372-34-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 33/73] ppc: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Cc: David Gibson Cc: qemu-ppc@nongnu.org Acked-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77819922 for ; Wed, 30 Jan 2019 01:03:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69C062D40D for ; Wed, 30 Jan 2019 01:03:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B7AB2D4DC; Wed, 30 Jan 2019 01:03:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F0FC12D40D for ; Wed, 30 Jan 2019 01:03:40 +0000 (UTC) Received: from localhost ([127.0.0.1]:57980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeI0-0003mr-54 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:03:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3s-0008Uu-Ju for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3q-0001E0-CL for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:04 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:56773) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3m-0000yr-Le for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:58 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 19F9F22148; Tue, 29 Jan 2019 19:48:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:21 -0500 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=/QPicua7qhzdWU83JHj4+m1ykNzGr9JDcVLlxRVWwgQ=; b=aUFRvZaggtHr eC5eXeTi3qR3w1DuQQLrWjcV/vnahSeu/Y0lmSkt3whheHxz5NdmPdBxH7OvW9Jm 4xsM8AoGGwUl84W7gCTy+Yt5ksELvrTFI8IultmCpm3T+4tTE6S0ekuVXtr0yLAH r3hwVPp7U6gVTZZINEm6wtNiCMczSXE= 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=/QPicua7qhzdWU83JHj4+m1ykNzGr9JDcVLlxRVWw gQ=; b=QlyDusNGS7w9OEYXFvWN7cxQVzXdslXAPQ+MbbwK+ppKsWxqGw9PeARsS aQv63cbIGjzU+22q0Pq6qfWrrIKcr1jerfwfmBzPxNqgu8dfDrcZZJsYhic+DU67 9NYKuctjVDAyoRAIlclxguzgR0gO1iH1li31eJeidsslfQdTsskHHeXTwn/fLEr8 jdAlJR1iv/TY4JOJvMM42U0P8NQFFuT/dyiADClVEYuJUpbp6Mv1xThNKuz57Y1S tHpGnKqSDSu7NCA+GeHmcpcwYzHbHm50YVjYUI2/4t2/rWfsP0ab8MnRlrPNEfdu nXaXoRzFButEtaCWIVO78FNJcOM5w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B5F57E4664; Tue, 29 Jan 2019 19:48:20 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:32 -0500 Message-Id: <20190130004811.27372-35-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 34/73] exec: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée 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 da3e635f91..21826f0816 100644 --- a/exec.c +++ b/exec.c @@ -777,7 +777,7 @@ static int cpu_common_post_load(void *opaque, int version_id) /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the version_id is increased. */ - cpu->interrupt_request &= ~0x01; + cpu_reset_interrupt(cpu, 1); tlb_flush(cpu); /* loadvm has just updated the content of RAM, bypassing the From patchwork Wed Jan 30 00:47:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EC131390 for ; Wed, 30 Jan 2019 01:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FA7B2CC45 for ; Wed, 30 Jan 2019 01:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03FB72D131; Wed, 30 Jan 2019 01:35:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 393DB2CC45 for ; Wed, 30 Jan 2019 01:35:50 +0000 (UTC) Received: from localhost ([127.0.0.1]:58267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeaZ-0002xn-Sp for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:22:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3w-00005Y-MQ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3s-0001F5-1g for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:06 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36475) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3o-0000zp-02 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:00 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 83C6422136; Tue, 29 Jan 2019 19:48:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:21 -0500 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=8QSiRJ1v+C3w+EWr0h8sxmQXvZjIDYcSbFK4Dx7UjAQ=; b=epcVQghN0s1u IwRG0UmfQWlFTjLhHOEF7rsVLOPvSEIiVphMekjobXA9S/qYkCDN7OTivBvhnl2U 4ARFwSajHh7gckDUhnWNYuKhQRpVma4JdPTsQG7mxKM/HTVesDerS2RIwSJ8pnIs 5fqDNtWhUVfgs5Oe+YAG03SLTPhezzc= 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=8QSiRJ1v+C3w+EWr0h8sxmQXvZjIDYcSbFK4Dx7Uj AQ=; b=aFfQgAh+qS0ncllcpsCh/Hx2n0j/vNBDxM8TcsU09H+/9L8dq7MhMTtsq Re6hm74rYLyREa600zHjS58hXKVP6y4kz4LgEgKqOP/iC+b3ZD1MQ9I6GNGVfhDV Ns+dL5viYoxPFl7ick6HiAVcAyuVbPUWNAznZ2CLDTm1K4m9L3/zMzWP9t/3CRJr QERWQZpG27OiaU/e5QRR3CFiZ6TcoxfftYgHcumiBTfDNCEXCM0U43J6vk1OdA1S P8YDfOmFCaTA2NLX5S7st1vxXDRBaWmU8LXg55x2MorQkMB3IogXIoARrxnuTTlT u1b874lQ5OCJ/SC03ihOIloq6YFsg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 00B73E4667; Tue, 29 Jan 2019 19:48:20 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:33 -0500 Message-Id: <20190130004811.27372-36-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 35/73] i386: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- 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 22951017cf..518c6ff103 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -424,7 +424,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); } } @@ -474,7 +474,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 9006f04d92..ca2629f0fe 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2893,7 +2893,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; @@ -3189,7 +3189,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); @@ -3200,7 +3200,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); @@ -3236,7 +3236,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; @@ -3307,7 +3307,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); @@ -3337,7 +3337,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) && @@ -3350,7 +3350,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 63e265cb38..b580403ef4 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 Wed Jan 30 00:47:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B0441390 for ; Wed, 30 Jan 2019 01:29:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CBD82D0A0 for ; Wed, 30 Jan 2019 01:29:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EDCA2D0AF; Wed, 30 Jan 2019 01:29:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1935A2D0A0 for ; Wed, 30 Jan 2019 01:29:20 +0000 (UTC) Received: from localhost ([127.0.0.1]:58360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goegp-0000CS-9n for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:29:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Lq-HP for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe43-0001Yu-47 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50491) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0000zm-Qd; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A52A721DE0; Tue, 29 Jan 2019 19:48:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:21 -0500 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=00TXrxbEMdsDtoameotazAsDpUKi/M1hcTJLW+jkGWA=; b=1930qCuRdaSd zglPnFo3HQaGfj8ik2eH+L2HDlNckzkniJm/NR6OyYs9OzSfdpcaQiLOa+zfoR7x Glno3HolT4hNScolPYrb1SFpPdxNbLdWrKEOi4kv3Y3mJ26HWHkO2FJLMZIV2zgl GYB3EmzxXhxC+WsNYuqYNo7cuA6AiaQ= 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=00TXrxbEMdsDtoameotazAsDpUKi/M1hcTJLW+jkG WA=; b=SYYMLAIArUMmdRzUe3wTYA4ua0SeCQB9yc9ZfUTPlagBrfIHqDWjO7ssa 2b3BCcBkUkpzOeLMwh00cgJcTDBbsq+vJGi1mfMm5L8cVTtQpdA+thD4nRVBV/Wt Wz5f/UXXzXlfcCJvPGl0CT6Cc1h9t6Lv6SY223UyEgNeYN3ZXi3FmOFK0O5XPtgI aSDrX5gAvsl0DiHbURcmxAlY++FN2lvzWrjttaZ6rNq1kdlJE+T/RDbRrBcIV0Ty /CyJDGYOZFjyni3/NNF13bxuv/zElFa/tLerRZj2HGcZCrvjmLcwZr4N0m7zG8cj bRh4AZnaDXSWNedC5qKS3LwraI3Jw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepke X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4124EE4559; Tue, 29 Jan 2019 19:48:21 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:34 -0500 Message-Id: <20190130004811.27372-37-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 36/73] 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: Paolo Bonzini , qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , David Hildenbrand Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Cc: Cornelia Huck Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2475B91E for ; Wed, 30 Jan 2019 01:15:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F372C842 for ; Wed, 30 Jan 2019 01:15:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B47F2C876; Wed, 30 Jan 2019 01:15:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A34C82C842 for ; Wed, 30 Jan 2019 01:15:55 +0000 (UTC) Received: from localhost ([127.0.0.1]:58176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeTq-0005OI-Rl for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:15:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3y-00007y-PX for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3w-0001Im-MX for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33837) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3s-000109-TX for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:06 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6952522152; Tue, 29 Jan 2019 19:48:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:22 -0500 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=FsZbGy+ZieyIRRKXrMhZe4aAK9gXs8CzW4/CPm2W5vc=; b=nsVNYHFKl94M jyPmZvphurbjbMsTWgCFVEsnrZastZspsJdRLyNMVBZQvQeyegWbqlRbrSQFH3hn m17I61hXbYZ1PCngqbbX0hNppAEYv/S7G7yjPY8CYRi0XfTYLmb9mEZTqIA0dfNE GaFUHz2WkLNU8J6ktOECyrMLhP2UV8w= 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=FsZbGy+ZieyIRRKXrMhZe4aAK9gXs8CzW4/CPm2W5 vc=; b=fPK5uPZfLvMCNlH9dNXoq5PB2CLQSAYlrkE0erAQ3vRw/WMLqrq8UUIpi b2T5HMjftBJmnQVAUvnmKJLWl9PsPhN9uhj6l+/xvdmv+ZHKBB0K34I1bSME0XQT MpZMzBw6UphybADVzZM43LXDTnsFvrWMx6csc9vhKdVsLh2bu5AHH5TZRqQv1Ymg EYPmL28JNP7PpdkapfyS2xDhdLfd8LLCMpmKNIV72kriSrN8vIXDAY01QcXA1so+ Hc0nTIRcEO9ZdkK5WPmsEVjQcQ7NGj+rOz93AtzqXUkgrSZid6SJZrfp1tilF5+Z pDk8Ca7of6ySyIYj+NIl44zPp6R8A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id BE4CBE4664; Tue, 29 Jan 2019 19:48:21 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:35 -0500 Message-Id: <20190130004811.27372-38-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 37/73] openrisc: use cpu_reset_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini Cc: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81EB2922 for ; Wed, 30 Jan 2019 01:40:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 721812D47F for ; Wed, 30 Jan 2019 01:40:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65D722D48E; Wed, 30 Jan 2019 01:40:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D4FCE2D47F for ; Wed, 30 Jan 2019 01:40:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:58544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goerH-0001SY-53 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:40:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4F-0000Y0-FU for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4E-0001ju-5B for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:27 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57535) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4B-000107-3W; Tue, 29 Jan 2019 19:49:23 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E121622155; Tue, 29 Jan 2019 19:48:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:22 -0500 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=yk831HbKd5vwJg9BfpZlW22rFvgBxVFAiKaaqEReLsY=; b=XfKEg k4M1NCcrAgg9EFDFr4ngBnP++2iuxeZd+g/ONMWpGDV/Xus7lkTCcvfhH2Q203ih 1yzHgfur4+xy6jw8zcJmImxLOydsmCqIo+JTDbTTsOSwolUqnPV7Jq0iy235VVec 2wskrITmtlTDbkAMXtkSRyryUnmi+8//nIuUrA= 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=yk831HbKd5vwJg9BfpZlW22rFvgBx VFAiKaaqEReLsY=; b=sZ0fHJz2cI8aOkaZcwN1gJ/eWe8zfkdY8D3E6EIvaqjAp HOtzlVp/WghQO3eSNhcS7jIRgmtiAiC5z62pPDsnZ12pW08oOExwFQVJ9tTm7M5p i6v10rBvXqFNx6Kt52xVlJOBTY8o7oF/bABnXOoT+S/mi8YhgcTVfOiwyHdGSUh+ EAQ+GtUthAgnjzhPz4YdL4E6AqhT7us1WUbReWXou01OL+vm6F1rP2KislFSbQA7 agn4Gf+DZn4Eoig10dldANUO4jpaByZElZPgoIt0dShdpsE2z3uytPohNXPtINqS XKuusv4rzY7oFfxAxj7UgapdT3mLwuLxbLjir65hg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4B666E4559; Tue, 29 Jan 2019 19:48:22 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:36 -0500 Message-Id: <20190130004811.27372-39-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 38/73] arm: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-arm@nongnu.org, Richard Henderson , Peter Maydell Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/arm/cpu.c | 6 +++--- target/arm/helper.c | 16 +++++++--------- target/arm/machine.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 8cf2f5466b..ef652ebdc2 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); @@ -451,7 +451,7 @@ void arm_cpu_update_virq(ARMCPU *cpu) bool new_state = (env->cp15.hcr_el2 & HCR_VI) || (env->irq_line_state & CPU_INTERRUPT_VIRQ); - if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VIRQ) != 0)) { + if (new_state != ((cpu_interrupt_request(cs) & CPU_INTERRUPT_VIRQ) != 0)) { if (new_state) { cpu_interrupt(cs, CPU_INTERRUPT_VIRQ); } else { @@ -472,7 +472,7 @@ void arm_cpu_update_vfiq(ARMCPU *cpu) bool new_state = (env->cp15.hcr_el2 & HCR_VF) || (env->irq_line_state & CPU_INTERRUPT_VFIQ); - if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VFIQ) != 0)) { + if (new_state != ((cpu_interrupt_request(cs) & CPU_INTERRUPT_VFIQ) != 0)) { if (new_state) { cpu_interrupt(cs, CPU_INTERRUPT_VFIQ); } else { diff --git a/target/arm/helper.c b/target/arm/helper.c index 66faebea8e..cb42d19fe8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1782,23 +1782,24 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) CPUState *cs = ENV_GET_CPU(env); uint64_t hcr_el2 = arm_hcr_el2_eff(env); uint64_t ret = 0; + uint32_t interrupt_request = cpu_interrupt_request(cs); if (hcr_el2 & HCR_IMO) { - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (interrupt_request & CPU_INTERRUPT_VIRQ) { ret |= CPSR_I; } } else { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { ret |= CPSR_I; } } if (hcr_el2 & HCR_FMO) { - if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { + if (interrupt_request & CPU_INTERRUPT_VFIQ) { ret |= CPSR_F; } } else { - if (cs->interrupt_request & CPU_INTERRUPT_FIQ) { + if (interrupt_request & CPU_INTERRUPT_FIQ) { ret |= CPSR_F; } } @@ -9435,10 +9436,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); @@ -9453,7 +9451,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); } } diff --git a/target/arm/machine.c b/target/arm/machine.c index b292549614..4f2099ecde 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -693,7 +693,7 @@ static int cpu_post_load(void *opaque, int version_id) if (env->irq_line_state == UINT32_MAX) { CPUState *cs = CPU(cpu); - env->irq_line_state = cs->interrupt_request & + env->irq_line_state = cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VFIQ); } From patchwork Wed Jan 30 00:47:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 585FF922 for ; Wed, 30 Jan 2019 01:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 478F12CDDF for ; Wed, 30 Jan 2019 01:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36B532CE38; Wed, 30 Jan 2019 01:13:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB72A2CDDF for ; Wed, 30 Jan 2019 01:13:09 +0000 (UTC) Received: from localhost ([127.0.0.1]:58105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeR9-0001mF-VA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:13:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3y-00007p-KT for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3u-0001HR-RX for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:08 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40621) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3s-00010H-Qt for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:04 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9CCB022153; Tue, 29 Jan 2019 19:48:23 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:23 -0500 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=bGEeZ1XvmuPEE0rUqIT0YC7V8KY51BIMKyg+H57sem4=; b=SHmXw YNqqCGIzUJZmQS1S84xwX41nXNJGM1rMEuBHqXa55+ZYDX2MZIc4WE3xG1d/Y0Sv NGBlZOeR3h/RI8DpBE1XHnsrr2rINEM6Y3z8NyU6UqYBZ2Bokz/b4GGJP4GQICOW MtlvQcftXTyLwqjOfFETMaxEDVZwgyFfq7zqPI= 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=bGEeZ1XvmuPEE0rUqIT0YC7V8KY51 BIMKyg+H57sem4=; b=l45eebTyFvbeQF/CPFPhGipiZ/qsVaq//AccOUSnCE53l SjU2x2ndMf1OjZ4AROnwI4YwWM6e+0oqz+cxl7QoXsUBnZPflbEESTho5VaUHkNx f5HeP+DgpPt6MMJpSXqpnXu1ECY6zeh7wpgWsK9DLlGwPqzUGibfjuJY4Lqm2cuF Da+xZbcCKXdIHHA2JtCXCdZndva4wz/b/kPBp90ZMfaUXpBdG3d3I6R9PUj/uT7q TQVAUEmL76IS+BGlSJ8UjztS9cy9KirVT3WS1pFQzJQL3v1gsXVLAxNU0Uu/MqT6 Y4FcVJoNLWmutA1Do7DpC6lkxa4ttWrFLNo29mZ+g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id AA1C5E4664; Tue, 29 Jan 2019 19:48:22 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:37 -0500 Message-Id: <20190130004811.27372-40-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 39/73] i386: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/i386/cpu.c | 2 +- target/i386/helper.c | 4 ++-- target/i386/svm_helper.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a37b984b61..35dea8c152 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5678,7 +5678,7 @@ int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request) static bool x86_cpu_has_work(CPUState *cs) { - return x86_cpu_pending_interrupt(cs, cs->interrupt_request) != 0; + return x86_cpu_pending_interrupt(cs, cpu_interrupt_request(cs)) != 0; } static void x86_disas_set_info(CPUState *cs, disassemble_info *info) diff --git a/target/i386/helper.c b/target/i386/helper.c index a75278f954..9197fb4edc 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -1035,12 +1035,12 @@ void do_cpu_init(X86CPU *cpu) CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; CPUX86State *save = g_new(CPUX86State, 1); - int sipi = cs->interrupt_request & CPU_INTERRUPT_SIPI; + int sipi = cpu_interrupt_request(cs) & CPU_INTERRUPT_SIPI; *save = *env; cpu_reset(cs); - cs->interrupt_request = sipi; + cpu_interrupt_request_set(cs, sipi); memcpy(&env->start_init_save, &save->start_init_save, offsetof(CPUX86State, end_init_save) - offsetof(CPUX86State, start_init_save)); diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index a6d33e55d8..ebf3643ba7 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -316,7 +316,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend) if (int_ctl & V_IRQ_MASK) { CPUState *cs = CPU(x86_env_get_cpu(env)); - cs->interrupt_request |= CPU_INTERRUPT_VIRQ; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_VIRQ); } /* maybe we need to inject an event */ @@ -674,7 +674,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->vm_vmcb + offsetof(struct vmcb, control.int_ctl)); int_ctl &= ~(V_TPR_MASK | V_IRQ_MASK); int_ctl |= env->v_tpr & V_TPR_MASK; - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_VIRQ) { int_ctl |= V_IRQ_MASK; } x86_stl_phys(cs, From patchwork Wed Jan 30 00:47:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5AC13922 for ; Wed, 30 Jan 2019 01:36:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3562CC45 for ; Wed, 30 Jan 2019 01:36:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F2732D131; Wed, 30 Jan 2019 01:36:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 83C8A2CC45 for ; Wed, 30 Jan 2019 01:36:37 +0000 (UTC) Received: from localhost ([127.0.0.1]:58212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeXr-0000Y3-4K for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:20:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3w-00005X-MW for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3s-0001GO-Tl for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:06 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:47561) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3s-00010I-Lr for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:04 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 541182212C; Tue, 29 Jan 2019 19:48:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:24 -0500 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=Tr/1UGmocX9rJxwXIUlhc73I7UHQgFSK5+BvfBugJ9k=; b=kNrrf lEFpW5XyvVNWrjt4C+2mN7Cw9kAoeSEZY80rTEmO0XNHtWOrEl/pPz8OKLrQ1ceE 81wwd8PDjwkQDfF1kY/B8/iKhqsinX0lmDaJb+H2JSw0FdnWceLyeGMknPpxgU9A 73nNS1OSiREjbKXGQRzP5MT4+C5aljmVaQcu88= 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=Tr/1UGmocX9rJxwXIUlhc73I7UHQg FSK5+BvfBugJ9k=; b=sGlfj3pQU7SSzvbROe6LU6G++wwHV2T7pHYZ89zAbVvCo v+0Joi2ZCqy3Nkt5756P7fczF5DDr319PlS3GRiuczkby4u5R/3iD4negACnoTV0 nWO64C4BI7GpCLXjRU5lb70tw9W7t+Ky/+aBanN5Ek4seftreqhcderDtTXranPv E0qkClgVL8MPo3EnIdHFBXRLQOLkFuAX13CAXPF53ugyz8gURYOfgRwZGKf1pget iorzsPbcYrPn7GNg6k1supi2JwD+eLVX7Jt0MtNtcCu7iSQVXzGINuwg45p/LFQP xM7h6oYHzg38Je3E10/K4KMEM59Js9NuYgh7XQ0Tw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 714E2E4559; Tue, 29 Jan 2019 19:48:23 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:38 -0500 Message-Id: <20190130004811.27372-41-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 40/73] i386/kvm: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/i386/kvm.c | 54 +++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index ca2629f0fe..3f3c670897 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2888,11 +2888,14 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) events.smi.smm = !!(env->hflags & HF_SMM_MASK); events.smi.smm_inside_nmi = !!(env->hflags2 & HF2_SMM_INSIDE_NMI_MASK); if (kvm_irqchip_in_kernel()) { + uint32_t interrupt_request; + /* As soon as these are moved to the kernel, remove them * from cs->interrupt_request. */ - events.smi.pending = cs->interrupt_request & CPU_INTERRUPT_SMI; - events.smi.latched_init = cs->interrupt_request & CPU_INTERRUPT_INIT; + interrupt_request = cpu_interrupt_request(cs); + events.smi.pending = interrupt_request & CPU_INTERRUPT_SMI; + events.smi.latched_init = interrupt_request & CPU_INTERRUPT_INIT; cpu_reset_interrupt(cs, CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI); } else { /* Keep these in cs->interrupt_request. */ @@ -3183,14 +3186,14 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) { X86CPU *x86_cpu = X86_CPU(cpu); CPUX86State *env = &x86_cpu->env; + uint32_t interrupt_request; int ret; + interrupt_request = cpu_interrupt_request(cpu); /* Inject NMI */ - if (cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { - qemu_mutex_lock_iothread(); + if (interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); - qemu_mutex_unlock_iothread(); DPRINTF("injected NMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_NMI); if (ret < 0) { @@ -3198,10 +3201,8 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) strerror(-ret)); } } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { - qemu_mutex_lock_iothread(); + if (interrupt_request & CPU_INTERRUPT_SMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); - qemu_mutex_unlock_iothread(); DPRINTF("injected SMI\n"); ret = kvm_vcpu_ioctl(cpu, KVM_SMI); if (ret < 0) { @@ -3215,16 +3216,18 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) qemu_mutex_lock_iothread(); } + interrupt_request = cpu_interrupt_request(cpu); + /* Force the VCPU out of its inner loop to process any INIT requests * or (for userspace APIC, but it is cheap to combine the checks here) * pending TPR access reports. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -3232,7 +3235,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) if (!kvm_pic_in_kernel()) { /* Try to inject an interrupt if the guest can accept it */ if (run->ready_for_interrupt_injection && - (cpu->interrupt_request & CPU_INTERRUPT_HARD) && + (interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) { int irq; @@ -3256,7 +3259,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; @@ -3302,8 +3305,9 @@ int kvm_arch_process_async_events(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; - if (cs->interrupt_request & CPU_INTERRUPT_MCE) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_MCE) { /* We must not raise CPU_INTERRUPT_MCE if it's not supported. */ assert(env->mcg_cap); @@ -3326,7 +3330,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); @@ -3336,20 +3340,21 @@ int kvm_arch_process_async_events(CPUState *cs) return 0; } - if (cs->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cs->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cs); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cs->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 0); } - if (cs->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { kvm_cpu_synchronize_state(cs); do_cpu_sipi(cpu); } - if (cs->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cs, CPU_INTERRUPT_TPR); kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(cpu->apic_state, env->eip, @@ -3363,10 +3368,13 @@ static int kvm_handle_halt(X86CPU *cpu) { CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; + + interrupt_request = cpu_interrupt_request(cs); - if (!((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cs->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 1); return EXCP_HLT; } From patchwork Wed Jan 30 00:47:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BF1C1399 for ; Wed, 30 Jan 2019 01:19:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DFCB2C94A for ; Wed, 30 Jan 2019 01:19:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D44C2CF38; Wed, 30 Jan 2019 01:19:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE7972C94A for ; Wed, 30 Jan 2019 01:19:45 +0000 (UTC) Received: from localhost ([127.0.0.1]:58206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeXY-0000HC-VE for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:19:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3y-00007x-PU for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3w-0001In-Mb for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:35613) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3s-00010S-T4 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:06 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 7B16422167; Tue, 29 Jan 2019 19:48:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:24 -0500 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=4c/z1jan/mW3f9BqFLSAXVqHnIFG9F4t7aDBLtx/S3Y=; b=h610U UIXeWAXMYjT4ubznw+V6cM0/7EdoXNcBCeln5fwmRDjFkRPT8IexHYp9jblMt6Tg j3GD4XGZSsAh/gTJL3CkB++soD8zKhV+0HGzH499gwRVy3j42P0DV94n4M/mF8Kb 3zehJx7sWQ2ltaA6/Ji5I2dUEvNTfj70vtU6zo= 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=4c/z1jan/mW3f9BqFLSAXVqHnIFG9 F4t7aDBLtx/S3Y=; b=MONQPobi3KMAU+AJOn+tN3MG+MgviBNlxlfr4eILPTBUn xpIGHxKl/TgNk6tacj2Q5CLm2dHFTxY4HL+UuiV7QrlTJW2w+R/OIS8KpbqItFBw j9nDhbMUz40kVfYiCW/6t4TiYFwd3DPHa48OM6O9OfaQ3zTgX9c7DiGviUDAvR03 v22WP1w/78aAuFfIM6No1Agq/mli8yyMW+OxgRPSsVQ2k44K7xhNaGoL5sMhYqF/ 2Z026fIrCR2xE6UO297W+YKlvStQggehvHzohawKhUi+Q2HFcLXN9bZ2kSBQPaw3 WG6sGi78T3Ec2DTvLgpP+PZBh7lyOz6OfKivbK+zA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CE7BAE4664; Tue, 29 Jan 2019 19:48:23 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:39 -0500 Message-Id: <20190130004811.27372-42-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 41/73] i386/hax-all: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- target/i386/hax-all.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index 518c6ff103..18da1808c6 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -284,7 +284,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); @@ -418,7 +418,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); @@ -432,7 +432,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; @@ -473,19 +473,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); @@ -544,13 +544,17 @@ static int hax_vcpu_hax_exec(CPUArchState *env) ret = -1; break; case HAX_EXIT_HLT: - if (!(cpu->interrupt_request & CPU_INTERRUPT_HARD) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - /* hlt instruction with interrupt disabled is shutdown */ - env->eflags |= IF_MASK; - cpu_halted_set(cpu, 1); - cpu->exception_index = EXCP_HLT; - ret = 1; + { + uint32_t interrupt_request = cpu_interrupt_request(cpu); + + if (!(interrupt_request & CPU_INTERRUPT_HARD) && + !(interrupt_request & CPU_INTERRUPT_NMI)) { + /* hlt instruction with interrupt disabled is shutdown */ + env->eflags |= IF_MASK; + cpu_halted_set(cpu, 1); + cpu->exception_index = EXCP_HLT; + ret = 1; + } } break; /* these situations will continue to hax module */ From patchwork Wed Jan 30 00:47:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33845922 for ; Wed, 30 Jan 2019 01:12:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 267CE2CDE8 for ; Wed, 30 Jan 2019 01:12:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A7BC2DB45; Wed, 30 Jan 2019 01:12:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71ACE2CDE8 for ; Wed, 30 Jan 2019 01:12:17 +0000 (UTC) Received: from localhost ([127.0.0.1]:58107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeQK-0002CJ-GY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:12:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3s-0008Uk-IJ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3o-0001Bu-VC for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:02 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:56185) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3m-00010T-Ke for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:48:58 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id ABEF822158; Tue, 29 Jan 2019 19:48:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:24 -0500 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=jXu3Nsj40QF3GBjc8BQhsE/41thq3gfSa5FS96CGXwg=; b=ZNWbw kcDo/MlkURCWnmHixjPLgyKVmHxJv2KcI6ABQ29GaW+2YlvEegkTDashRN1U2kC4 zIwmGV+utEftZjx3C1TLjQpnSmAx3UhoSNTgwKrzJ5Br1SoUbz3tLfAHKwsc0YiG uSJbs2Gz3h3IgzOB6zUpTy1a23vZM3wQPI92pI= 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=jXu3Nsj40QF3GBjc8BQhsE/41thq3 gfSa5FS96CGXwg=; b=Kb88xffSplo1I9AChiKJoOqU4P/KsovH1hzsjzUHSNw/K 1k8kYN/SRGhHT0dKSNRmKV3ASmFefDaapgB67Tb5Ss4pp7iUdmIVI9hW4d+5+nq1 cnRv5BG7PQv8AT/so96EGLccie7ZNIpT+WmGgLmRXQFcuw3SwvpZ6UscIV9u8mSc UZQFQzCTqAU+P/cLv5pLRWgYdTErLcj50EHlUnEXp8mDIel+rxd4y8wQOB7dbKEp g3R5r0DWwmU4Ix/mq9N+nGkxwg6DFQ2rMkovH8Q2sH/aclsRfuibYw7Xa1Lnre2K xkqqf7AC8uwt9YtYbGiBKKcMDDw1GeovFB4RmPBeg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 434CAE4667; Tue, 29 Jan 2019 19:48:24 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:40 -0500 Message-Id: <20190130004811.27372-43-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 42/73] i386/whpx-all: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- target/i386/whpx-all.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 9673bdc219..0d8cfa3a19 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -690,12 +690,14 @@ static int whpx_handle_portio(CPUState *cpu, static int whpx_handle_halt(CPUState *cpu) { struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); + uint32_t interrupt_request; int ret = 0; qemu_mutex_lock_iothread(); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cpu); + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; cpu_halted_set(cpu, true); ret = 1; @@ -713,6 +715,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); int irq; + uint32_t interrupt_request; uint8_t tpr; WHV_X64_PENDING_INTERRUPTION_REGISTER new_int; UINT32 reg_count = 0; @@ -724,17 +727,19 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); + interrupt_request = cpu_interrupt_request(cpu); + /* Inject NMI */ if (!vcpu->interruption_pending && - cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { + interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { + if (interrupt_request & CPU_INTERRUPT_SMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -743,12 +748,12 @@ static void whpx_vcpu_pre_run(CPUState *cpu) * Force the VCPU out of its inner loop to process any INIT requests or * commit pending TPR access. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -757,7 +762,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); - if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { @@ -787,7 +792,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) /* Update the state of the interrupt delivery notification */ if (!vcpu->window_registered && - cpu->interrupt_request & CPU_INTERRUPT_HARD) { + cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) { reg_values[reg_count].DeliverabilityNotifications.InterruptNotification = 1; vcpu->window_registered = 1; @@ -840,8 +845,9 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + uint32_t interrupt_request; - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { do_cpu_init(x86_cpu); @@ -849,25 +855,26 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) vcpu->interruptable = true; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cpu); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, false); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); } do_cpu_sipi(x86_cpu); } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); if (!cpu->vcpu_dirty) { whpx_get_registers(cpu); @@ -1350,7 +1357,7 @@ static void whpx_memory_init(void) static void whpx_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Wed Jan 30 00:47:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5629D1390 for ; Wed, 30 Jan 2019 01:38:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48D802CD5B for ; Wed, 30 Jan 2019 01:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34FAC2D131; Wed, 30 Jan 2019 01:38:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6C702CD5B for ; Wed, 30 Jan 2019 01:38:28 +0000 (UTC) Received: from localhost ([127.0.0.1]:58274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeb7-0003QM-2v for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:23:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe42-0000Go-EW for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe41-0001Vg-7K for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50457) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe40-00010a-Vu for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EA06322169; Tue, 29 Jan 2019 19:48:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:24 -0500 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=skkH4GDCVPYIVLN3XL1i9CEexSlZGPNHM8OrGHVu9w8=; b=zzJVp xczHqCkCffBeIE9TmbrCch8MMq21LAm2/+u46MKEB9HkTxVVCb9PV3yfnB0tsjGz FWawXW6Jt5TKOCgni88erhzw/us/LYwNeIGLf/96dFNJHhotcfiGUWIWjL01+Lga hHn2Xh/z/RMePF3EMpObihqSMYQ38qhoVwjwB4= 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=skkH4GDCVPYIVLN3XL1i9CEexSlZG PNHM8OrGHVu9w8=; b=Q5edFSSEcHquIYOSl22zbMYSpLQqD3Nn1N1TTCzvtyGBS Xh48AqdORK5cxE3ehl4YoCatHAQCIAnsdqCdD5+NPfXnvtJZ9WcV0IAxTjlhvoIJ MPXgIXdyEsi/BE4Ej5S2G3dldBtAETNYHUC36BfMLjTMKNpVwlepoSr/DNm6wB8g A4qZSu0SMicg9qgO07HzDjEZnPSAz737Fah0gwhahqsigjlp/eKxxVL+LC1SJsf9 fGOzX+Qqx/JKwjf0X+DL947qtMsB0Pwn33Kd5jv3mo/mJUX1PTx2F/FIf+oFe3Dl Pk+Oz4+Omd0RwBP6M/U/8uFzCLe9bmLNTXrkmSuSg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 84164E4559; Tue, 29 Jan 2019 19:48:24 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:41 -0500 Message-Id: <20190130004811.27372-44-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 43/73] i386/hvf: convert to cpu_request_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- target/i386/hvf/hvf.c | 8 +++++--- target/i386/hvf/x86hvf.c | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index c1ff220985..619a4dd565 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -249,7 +249,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); } @@ -706,10 +706,12 @@ int hvf_vcpu_exec(CPUState *cpu) ret = 0; switch (exit_reason) { case EXIT_REASON_HLT: { + uint32_t interrupt_request = cpu_interrupt_request(cpu); + macvm_set_rip(cpu, rip + ins_len); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) - && !(cpu->interrupt_request & CPU_INTERRUPT_NMI) && + && !(interrupt_request & CPU_INTERRUPT_NMI) && !(idtvec_info & VMCS_IDT_VEC_VALID)) { cpu_halted_set(cpu, 1); ret = EXCP_HLT; diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index e8b13ed534..91feafeedc 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -358,6 +358,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) uint8_t vector; uint64_t intr_type; + uint32_t interrupt_request; bool have_event = true; if (env->interrupt_injected != -1) { vector = env->interrupt_injected; @@ -400,7 +401,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) }; } - if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | NMI_VEC; @@ -411,7 +412,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) } if (!(env->hflags & HF_INHIBIT_IRQ_MASK) && - (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK) && !(info & VMCS_INTR_VALID)) { int line = cpu_get_pic_interrupt(&x86cpu->env); cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD); @@ -420,39 +421,42 @@ bool hvf_inject_interrupts(CPUState *cpu_state) VMCS_INTR_VALID | VMCS_INTR_T_HWINTR); } } - if (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) { vmx_set_int_window_exiting(cpu_state); } - return (cpu_state->interrupt_request - & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)); + return cpu_interrupt_request(cpu_state) & (CPU_INTERRUPT_INIT | + CPU_INTERRUPT_TPR); } int hvf_process_events(CPUState *cpu_state) { X86CPU *cpu = X86_CPU(cpu_state); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; EFLAGS(env) = rreg(cpu_state->hvf_fd, HV_X86_RFLAGS); - if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_INIT) { hvf_cpu_synchronize_state(cpu_state); do_cpu_init(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + + interrupt_request = cpu_interrupt_request(cpu_state); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) || - (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu_state, 0); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { hvf_cpu_synchronize_state(cpu_state); do_cpu_sipi(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR); hvf_cpu_synchronize_state(cpu_state); apic_handle_tpr_access_report(cpu->apic_state, env->eip, From patchwork Wed Jan 30 00:47:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11A9D922 for ; Wed, 30 Jan 2019 01:41:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 046772D626 for ; Wed, 30 Jan 2019 01:41:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC96F2D63C; Wed, 30 Jan 2019 01:41:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 537112D626 for ; Wed, 30 Jan 2019 01:41:48 +0000 (UTC) Received: from localhost ([127.0.0.1]:58581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goest-0003AC-KJ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:41:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4B-0000Sm-LQ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4A-0001fo-51 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4A-00010Z-1A; Tue, 29 Jan 2019 19:49:22 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 333EA22178; Tue, 29 Jan 2019 19:48:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:25 -0500 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=3vcVQIU2J63xsKCDzZKtH0Pp8x5lSrq5Pi9t+1Cpd+w=; b=rjDEK wfOrET/WppPqbuFUBq96PgFnF3vhxOuNdHpStEQo//JDYcDqI1SNPjtBSS3kf7Wv 9EM3HvpBO1xQGL9sHs+T3fNwydM2T9shf1K1WKvXKV4D8Xq3phCvHrYnxS9vNDoa 22+V1/b5xlGMVmzMRwU+2vY8hGnC2U5tWXzhN0= 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=3vcVQIU2J63xsKCDzZKtH0Pp8x5lS rq5Pi9t+1Cpd+w=; b=mEfzSONP9QmPbULWJMISNL68C1d7eCZcTVNCSbeQqlncW xhuZqfy5ESD4rv3KI/neJdLORXw1a2QkXPt7tTyKvLJBN5CXTHpUAPry3Wq07xw5 BtY0DPeq8X12ap1Lohcxx7aqoajDA974gIn87cIYCmZb7I8iXQUqRT0IFM+KbMfN LPByaAUyOBkKsT2T0HCejE+Cb5N0qnzqvoZ9hcgw4gdKQW+LRcj3mcIQvjppbNSR 4YUsdwTq+cgeKiY/GhbBjPmjr1N3gVhIccXkisPziKwbJbgFCjXwSR5IuoEB/6cE WfbJe2k0kS58TSEfagqQmnVcLoBmL+Im3GLQg11/w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C5B44E4664; Tue, 29 Jan 2019 19:48:24 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:42 -0500 Message-Id: <20190130004811.27372-45-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 44/73] ppc: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: David Gibson Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota --- hw/ppc/ppc.c | 2 +- target/ppc/excp_helper.c | 2 +- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index d1a5a0b877..bc1cefa13f 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -91,7 +91,7 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, - env->pending_interrupts, CPU(cpu)->interrupt_request); + env->pending_interrupts, cpu_interrupt_request(CPU(cpu))); if (locked) { qemu_mutex_unlock_iothread(); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 737c9c72be..75a434f46b 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -753,7 +753,7 @@ static void ppc_hw_interrupt(CPUPPCState *env) qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n", __func__, env, env->pending_interrupts, - cs->interrupt_request, (int)msr_me, (int)msr_ee); + cpu_interrupt_request(cs), (int)msr_me, (int)msr_ee); #endif /* External reset */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 0efdb71532..50919da6af 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1340,7 +1340,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) * interrupt, reset, etc) in PPC-specific env->irq_input_state. */ if (!cap_interrupt_level && run->ready_for_interrupt_injection && - (cs->interrupt_request & CPU_INTERRUPT_HARD) && + (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (env->irq_input_state & (1<env; - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (msr_ee)) { cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index a757e02f52..e1059d9ed6 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8455,7 +8455,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)) && @@ -8479,7 +8479,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); } } @@ -8609,7 +8609,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)) && @@ -8641,7 +8641,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); } } @@ -8801,7 +8801,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 */ @@ -8834,7 +8834,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); } } @@ -10247,7 +10247,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 Wed Jan 30 00:47:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77B9A13B5 for ; Wed, 30 Jan 2019 01:13:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E98295EE for ; Wed, 30 Jan 2019 01:13:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 566D229789; Wed, 30 Jan 2019 01:13:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE4E8295EE for ; Wed, 30 Jan 2019 01:13:56 +0000 (UTC) Received: from localhost ([127.0.0.1]:58036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeLF-0006Mp-TW for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:07:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3s-0008V9-Ry for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3s-0001F0-1i for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:04 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44955) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3n-00012M-Fe for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:00 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 92C0E2212D; Tue, 29 Jan 2019 19:48:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:25 -0500 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=acs5HR86C3lryMu9nkqKCDZs5wYv1tFuZptgEFxCqFk=; b=Bu9frVYRw59o NcLRK78VdlJAy/pDXTNMRTaRyrc/AkXp+8CqxA//GY+2okADLYzhDK5UeURDnZhD O6bTsrcIsSQigxifG8R8YFyVsOHwJfVX4RCKZiRCgXuuWSR5m/d60AIcWWzx6zn/ S7v0j4kgjWeYIkZQnD6j5CpLcqz58FY= 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=acs5HR86C3lryMu9nkqKCDZs5wYv1tFuZptgEFxCq Fk=; b=PAjhvX05+6GwHkTfv8UYWk0O92XjcGvSZtCRQXDj93jGGaGgPwBCA3Y0q QBbU0jt6b3jmcgMlYwBqg+HXxd1vbOfzn7Lsya1x/wehPqD+xBnbc1zTuktxKbXK /KTT323+tp5n4n11/L3fbrModqUlVaOMrN1e0fGWTZ9uK50kX77whLXS7bCQvKac NVTgcOCTYAKomrd3jZ0TRmUC0HpxQjvyZsnHjOwfezSaYfuPmyDETL56cKFJzeBB fETfMhBDykbvP/zCgLs6FSqJDm/aVs9ERQNMrlDS3Xh650vVZ2bOqcqN4E73aNzC upMKsUOlm38UiZp59A2BymiMCliqg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 1A215E4559; Tue, 29 Jan 2019 19:48:25 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:43 -0500 Message-Id: <20190130004811.27372-46-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 45/73] sh4: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2528591E for ; Wed, 30 Jan 2019 01:15:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1872E2C842 for ; Wed, 30 Jan 2019 01:15:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09DA32C876; Wed, 30 Jan 2019 01:15:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 939582C842 for ; Wed, 30 Jan 2019 01:15:47 +0000 (UTC) Received: from localhost ([127.0.0.1]:58082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeOI-0000Wm-Ql for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:10:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe3y-00007t-Lg for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3v-0001Ht-DE for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:08 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52747) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3s-00012N-R5 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:04 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D26312217A; Tue, 29 Jan 2019 19:48:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:25 -0500 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=s2MjC5IYIeKxv7QrXIPPudpKKAed9ZYkVgoFf4G5UGQ=; b=ZF6ArorFcHA0 hfXw7/06JUcXnJt8qYmZdN6uukAZni+VVgFy2Hi4RC+m/iy04TzQJbL3Dss1Zvcn OlBPnC3zfBQyC5BEbDnOgeUoArJtJ2/rqIE0p/k2ar3NritHGwYER0+igGXQ+5oN 289yq+sSKMCbQ/7ShWqQxTBjc3buc+U= 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=s2MjC5IYIeKxv7QrXIPPudpKKAed9ZYkVgoFf4G5U GQ=; b=UDAk4bNW+gwqMQ9ExaeMYVsrWG32Tos61rY638CELLsqNnRKlMev+t2Dk yye0rnQhjD4qryt0Nq1a7el8fy8Gwd0Yb+1wFUSubiefh1xeqWtVdaFgfrsBnCEL moohVbOW22CrQjqqMm59/rm6Ll/zme7mlMhgPf+7+O1v9yeXNVKu2ENjxSqNIj+y GeFZ+4L2LTToh8MTbILukTieSIzd28bcKWGPyjGuUqDnQBqgdD+dKyF/gDxi+nkx faSPvP444cX8s2Edgp6i/FNT7207RkGXUVY3VbcpJsom+IXN3qfXu0h4qC4KUzhr FALaOSARFkHpUyhNYRQXqST/i4BLg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 5A6BFE4664; Tue, 29 Jan 2019 19:48:25 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:44 -0500 Message-Id: <20190130004811.27372-47-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 46/73] cris: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 b2dbb2075c..5c453d5221 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 Wed Jan 30 00:47:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2986991E for ; Wed, 30 Jan 2019 01:18:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D8C92C84B for ; Wed, 30 Jan 2019 01:18:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11D382C890; Wed, 30 Jan 2019 01:18:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B53F82C84B for ; Wed, 30 Jan 2019 01:18:44 +0000 (UTC) Received: from localhost ([127.0.0.1]:58188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeWZ-0006aI-Tn for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:18:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe40-0000Bs-PE for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3w-0001J8-Tm for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:11 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:43707) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3u-00016m-Qn for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:08 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E66652217B; Tue, 29 Jan 2019 19:48:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:25 -0500 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=4eouLRK3vC1a10DsglmOfO+roAJN7ypicmfsGXZDSp0=; b=bzqfTIxkXZHP kR+KHsh49R5Tvnvx9JjEOO8bRZfdn7gfJHHpQ0Qouw0XssqyyJuKf7FupS4S5N9X 2al29GEICQZKSv67MfrnhaZotZNr0k5IrHAZsqe7vMsuGzT4exVm3oJPhl9udRsT tzsD3XYNx5QZaskGer5gpni+8hemDyU= 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=4eouLRK3vC1a10DsglmOfO+roAJN7ypicmfsGXZDS p0=; b=b3DjmNa2vF/GBW5RNvlsiNZnoLfy6qcYtqWphUJ6/v4PcoScLNGSIFneN MZqzwBYAU+nMSXruBdeI7fNXzmSSNTgM8OeYZ98pLkmyrx2P/eQUt2dQKCan9MS2 A0ebdfI1w3JR4Z+9FgA6JbQ4y56wKkRN7uBXWePf2ZEX6cNsYBMh1p8lcXQmY5zp 6tF2D3hgp7nAo2EXIkkwSO79nIZcSFdYaH2OQvHyQvb6/V7JcsqxsP6SzOwxHyyY IIsJoONrTCNOQyIRbhHZYmsjN9keMfmUVCQ922ShrGmKFb7DYlq4B4BHX9EfsZ0X gmhAJK2DO5k+kDFIoz8t1SAnISJBg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8FC7EE4667; Tue, 29 Jan 2019 19:48:25 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:45 -0500 Message-Id: <20190130004811.27372-48-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 47/73] hppa: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57D6A1390 for ; Wed, 30 Jan 2019 01:29:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 493C12AC0F for ; Wed, 30 Jan 2019 01:29:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CDA92D0AC; Wed, 30 Jan 2019 01:29:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CC9632AC0F for ; Wed, 30 Jan 2019 01:29:31 +0000 (UTC) Received: from localhost ([127.0.0.1]:58255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeZE-0001ne-5g for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:21:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe40-0000Bt-Pe for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe3y-0001LX-Pd for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:12 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:59887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3y-00016l-K1 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 30E6B22133; Tue, 29 Jan 2019 19:48:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:26 -0500 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=xzsWhmL8cShyeGU8UBmA3b/0IzBMJavgEQ8Xw2psEdo=; b=ZaZE+XYUd5W8 Rx/GtC36IfgvG9KAtZHgnbTKXCzsD1dG38oRQOSai3ijSyQxuKscm8KJ3qN/tLY4 2AHHhFz9ey3tpm74A5VrX9MNDuDHwvfeJNHrmZXQ98xNBsJAUy3LDbjeE+QhanI6 BarynyeJojuOM717ECdZzghvyvYG3bU= 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=xzsWhmL8cShyeGU8UBmA3b/0IzBMJavgEQ8Xw2psE do=; b=dasv+XPUElK5a7M0XL8IF7rlh3lTxYCiatXHRwROH5N6zTUtUJ+S7fC4I H9NJDqnwz72rzwPOJO3coCrLTzeIk3sJTulz5sOPm0oSZ9t1SIRBuSUG0e168V0k hS+mIG1vdE6A+4rOQtENemPoCnTgKa2QtJjPuhiaNwhNnRBsucQSCpLG4hRX0HOD P+JbES0dpO5UWE8IABC7ZMAPqthi94Pd0pdF66Ijilsxgbi6lYCe2xCvfXJsw00Z z/S2JLdNPB1gm1qg+lcvjtLR6/80+tLZ8XDOvrvednqBK5an6gn79DD7+sN/5lg7 IvmkYKVAylFLFWLTKnCelwMflAwLg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C7FCCE4559; Tue, 29 Jan 2019 19:48:25 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:46 -0500 Message-Id: <20190130004811.27372-49-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 48/73] lm32: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Michael Walle , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Michael Walle Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E36C1390 for ; Wed, 30 Jan 2019 01:20:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F7562C94A for ; Wed, 30 Jan 2019 01:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 738AB2D1F7; Wed, 30 Jan 2019 01:20:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC0A02C94A for ; Wed, 30 Jan 2019 01:20:37 +0000 (UTC) Received: from localhost ([127.0.0.1]:58246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeYP-00016d-7R for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:20:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe42-0000Gq-F1 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe41-0001Vz-Bm for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54579) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe41-00016v-61 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 674A622182; Tue, 29 Jan 2019 19:48:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:26 -0500 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=yeZSU+KbVkJbrjbwW81TBIqRy5fS2E0CF7nSVVHNFJA=; b=Ue/AS 2aTN1RjrJqQiEzwHmsyZL5+FZaUYcsyjzGuShleMh6TCQKE1e+mctVbZmpAkOqCP +S7s7dK4UKY8qydNlN+SHRG2+/x53L0/lA8DJfDPyBR/f0bbgq42pvRHtSymWPgi bpao5zramUjWj+4mJK1SRzzKJxvvRDs5Ea+xXc= 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=yeZSU+KbVkJbrjbwW81TBIqRy5fS2 E0CF7nSVVHNFJA=; b=errA1Tcwm3ri23VOf4RRz/MVKhM1u+EaNRjfiNrrUsD9V REjp91nKOspPv4z8xGAlTndOZvvaLAEIaG4VywnBq1lhsK04IZgqjZUrTXDnDNbG SpjeQU9wx/tx4bQNFJHcn25Mao2s51XblCZ9YZkEEStzsLX170h+MAE1KR1xJmRG AnnQN7izxOqPiiOv7f8ohNoQELYC6d2aVMrnt6B8+dmWybsWL4HTLDnP0eDYfKXx n19CgMm4r6A7QCnAp1dSFfIAqxsWMlo8NwmPwFb+030omIRWK5KTAP8q07mfQiw2 plG2GaZ/GHbozJxyJGqB8w4sJ5rsoctraVUgb40ew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 102DEE4664; Tue, 29 Jan 2019 19:48:26 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:47 -0500 Message-Id: <20190130004811.27372-50-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 49/73] m68k: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Laurent Vivier Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B25FA922 for ; Wed, 30 Jan 2019 01:37:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A41DC2CD5B for ; Wed, 30 Jan 2019 01:37:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 982142D131; Wed, 30 Jan 2019 01:37:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 32CCE2CD5B for ; Wed, 30 Jan 2019 01:37:22 +0000 (UTC) Received: from localhost ([127.0.0.1]:58319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goecu-0004yf-I3 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:25:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe41-0000CU-0I for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe40-0001U2-1c for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:12 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36615) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3y-00016w-Rt for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BE97A2216B; Tue, 29 Jan 2019 19:48:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:26 -0500 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=KkVB19/XOoA3XZvP3dgoznBiMceDqOUbY4qS2wrE5NA=; b=U//FX /V+9HQN1th1iRnnWply3S62x0xaUw+ouQUVF8NKMBPevK5uJ3YRe7ZJDRJYbpm/k t4PnMSlEescs4TXADYEhQndcPz8/Qrgtvpd38FO4hAKKMfv0vOCcz+mRy+YZw2ZB aHl/Fn5Om7S5uU7SzvBG+55hwhtRSqKwpII02w= 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=KkVB19/XOoA3XZvP3dgoznBiMceDq OUbY4qS2wrE5NA=; b=jLIve0ixs9F4CepnmTAeVc/KcHA3Kr/pDhLx2/dvcGJ2g 5PymgunL0fGnG7/IcVZOuvGCXEz9wFEFj0zVtM7g/xey9u6EbEHJeR2iiyl0nWs3 hv7grZcKk5mLUUg9EEnOikekk8L3b08zCfAsmwO7s51L6X43Xe4q+/RSTgjrDinl puVQuU3nSjuaXnyuFiHu+Hx7r2YkfCPpXxy5q8OV5uX5++S5yPSaVfRCCM3XYGYR lFmdPgJ2b3xUImgf86AIn5+m0/Hmk3D/jGzkmY1MWlQodlX/ID7TYa9IJAj6pf1T EFj5YJaTIVsVgS/NGdKJJQSF8YonVhm7hVBa8ZouQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 4DB28E4559; Tue, 29 Jan 2019 19:48:26 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:48 -0500 Message-Id: <20190130004811.27372-51-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 50/73] mips: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aleksandar Markovic , Aurelien Jarno , James Hogan Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Aurelien Jarno Cc: Aleksandar Markovic Cc: James Hogan Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- target/mips/cpu.c | 7 ++++--- target/mips/kvm.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index e217fb3e36..fdae8cf440 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -56,11 +56,12 @@ static bool mips_cpu_has_work(CPUState *cs) MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; bool has_work = false; + uint32_t interrupt_request = cpu_interrupt_request(cs); /* Prior to MIPS Release 6 it is implementation dependent if non-enabled interrupts wake-up the CPU, however most of the implementations only check for interrupts that can be taken. */ - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { if (cpu_mips_hw_interrupts_enabled(env) || (env->insn_flags & ISA_MIPS32R6)) { @@ -72,7 +73,7 @@ static bool mips_cpu_has_work(CPUState *cs) if (env->CP0_Config3 & (1 << CP0C3_MT)) { /* The QEMU model will issue an _WAKE request whenever the CPUs should be woken up. */ - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } @@ -82,7 +83,7 @@ static bool mips_cpu_has_work(CPUState *cs) } /* MIPS Release 6 has the ability to halt the CPU. */ if (env->CP0_Config5 & (1 << CP0C5_VP)) { - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } if (!mips_vp_active(env)) { diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 0b177a7577..568c3d8f4a 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -135,7 +135,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) qemu_mutex_lock_iothread(); - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_mips_io_interrupts_pending(cpu)) { intr.cpu = -1; intr.irq = 2; From patchwork Wed Jan 30 00:47:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0DB491E for ; Wed, 30 Jan 2019 01:26:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEFEE2C97C for ; Wed, 30 Jan 2019 01:26:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE0802C980; Wed, 30 Jan 2019 01:26:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71BC92C97C for ; Wed, 30 Jan 2019 01:26:39 +0000 (UTC) Received: from localhost ([127.0.0.1]:58336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeeE-0006Dr-Ij for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:26:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe43-0000LT-LY for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe40-0001V0-Qy for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44207) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe40-00017R-1L for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:12 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0E0312219D; Tue, 29 Jan 2019 19:48:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:27 -0500 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=Eud35TkF6+q062AivX0u3SGzsarF/Chbd2ARRKTZsbs=; b=uzyvwNiMNqEp Lshr1vAmb4BP2Ds8l5CWI05NKpCe2KXUoaDhzvv++YcSifDzsdZ7kY5bbBlxn7dN BiQYFJnOOraiUbFXazjI/jkp4Cw6O4W56GGqqfYR6OXRmYbaAH4aPBXg4K+1ri0f OBK2hGjObOQJJDZxMDflHiGnRyHKBYA= 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=Eud35TkF6+q062AivX0u3SGzsarF/Chbd2ARRKTZs bs=; b=oL/IF1OE0qGsuNdZMpisejuF1ATDrafE93nwiz8EETtGTstCVzJU8mBGt u1MeA1IPL/FD/XzefkRR5krvGLP9Y9Q1zIBeFgDsTi1fpQqDwoh5XXnl/aNq7MmL joFOjcRpfd/EeG1MWpigCZSqt0kdy7Y8Hh4hOvnyy+34IP5vcVeYb3zMdd3McT+k AKm8ntuLe3J9XeDzeoDfbdQs2Z6I1HSsAAv22S08mvxF3wRC5IUG/YU1l9rD3jBw IQ1aezkhH92PgTvMFHKXt5Enm1W1v/9+7wtfLNTlShVY3Tj1c2KX84imDN6fGiI/ aF5d2xdGuvROFBzzuj+l3DHnNp25A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8929EE4596; Tue, 29 Jan 2019 19:48:26 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:49 -0500 Message-Id: <20190130004811.27372-52-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 51/73] nios: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Paolo Bonzini , Chris Wulff , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Chris Wulff Cc: Marek Vasut Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA1911390 for ; Wed, 30 Jan 2019 01:33:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 964AC2D10A for ; Wed, 30 Jan 2019 01:33:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88A5F2D12C; Wed, 30 Jan 2019 01:33:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDDD62D10A for ; Wed, 30 Jan 2019 01:32:59 +0000 (UTC) Received: from localhost ([127.0.0.1]:58426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goekN-0003OA-54 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:32:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4B-0000T1-Su for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4A-0001gb-V6 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:42779) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4A-00017Q-Pk; Tue, 29 Jan 2019 19:49:22 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 55804221A3; Tue, 29 Jan 2019 19:48:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:27 -0500 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=eh2h4LZkMsIIZehUz50lLq3QMfEvqUO9dGGik+4Hu/s=; b=ltk91h1LcwyY zPdxu9pgW6KQvdtp2Yw/w2J/oQuubuCYyb97VAXQS3nHaFXRfoRalfWYdt4p5RPJ cXMVbX3dLl6e7J9eVoSfVJONXdKpSYyz2+rFdRtxz+NHwLmUmpWc+++ZWuWKuvku LTudZhU2odyV7Xu6DBnGuL4VR+7hwZw= 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=eh2h4LZkMsIIZehUz50lLq3QMfEvqUO9dGGik+4Hu /s=; b=D3kSFhY+a+W1wLMsMszcI5JZ7EJzlVJZlwGVwtFUhjsGcJcGaXk8wWe7A JUi2Av1sP8eSsCMSu1utQnaWR1VEquX3tvPHWsMrb8qe9vABa1ejCslBNOBJF/By 8b6YL57iowS1b0R3abcGD0AE6Pk8k54EzN0EEzzLoQOP7fxkwJf8d8SlRWAcLbyQ pB5ObaQhfcCoZA2aEWU7IlIAi1MHciD9F6tou8xObUnDZib7PYtmp1rNHjLtxisR /k5GbD/YHr0ccs8vmureIOsc1nBFnzxvNa55jrGWqZx3haSk6cV8c49ojXgtLAtw TcQQ9k90LF8g6qljShBzeNO2prvuA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D475EE4559; Tue, 29 Jan 2019 19:48:26 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:50 -0500 Message-Id: <20190130004811.27372-53-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 52/73] s390x: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Cornelia Huck Cc: Christian Borntraeger Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota --- 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 4d70ba785c..d1594c90d9 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -65,7 +65,7 @@ static bool s390_cpu_has_work(CPUState *cs) return false; } - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } From patchwork Wed Jan 30 00:47:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B699091E for ; Wed, 30 Jan 2019 01:29:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A70312AC0F for ; Wed, 30 Jan 2019 01:29:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B4962AE05; Wed, 30 Jan 2019 01:29:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 427362AC0F for ; Wed, 30 Jan 2019 01:29:06 +0000 (UTC) Received: from localhost ([127.0.0.1]:58280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goebv-00047I-A5 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:24:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe40-0000CK-Tt for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe40-0001U5-1g for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:12 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60547) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3y-00017b-Rn for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8AF11221BF; Tue, 29 Jan 2019 19:48:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:27 -0500 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=143ov9ij4yHKF2aehV2tiQIRFhoilkER+LmxRPKE4Ro=; b=XmIsPjiuFBlp NrHzNQSPDgnXft98JkBwYt5Uc+YCoKspLnLvjTMCreimoq0TwIgajrVcNp2RfV20 8WlEbou1t/uKYGMDl7DEHpjP5OgYIBEEMtXk6UKJW12dIxRCiy5vkL8Tq9r3jPlG 0YqJAW9GL9/zQyuCLGo3rhBcYfMuj8c= 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=143ov9ij4yHKF2aehV2tiQIRFhoilkER+LmxRPKE4 Ro=; b=qTudHSQZADSVO3XHv1RdaSaZ991dpiP+l9S1lj7yRg+U+eLBO5br/gtBC ObtHH60A8sPhpnJHI5u1mhK1W1pAs6TJ5HoJryPNYsBi/gMzspBsdHk8j+dDhRE5 FZYw/JSCSvAR1bMY/q4rJ9npVIwRKKT49ipArOHky/2qKqgQfE19WGlXB9utyJQ6 6OoztyJoIt7ib72ekUX3MPXS2sIDkx4uvaatOlSlTluCv4L8D+8/SdI69gpkTFfn a4dAHE7D/WQXwe+j7V86GzjTMsKOLhNsgzi0TIbGll8iRm1nffdp8Kzut8lby0dv I5C++14Iohd+zUWOhP2a0IKLNfWTQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 189A3E4667; Tue, 29 Jan 2019 19:48:27 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:51 -0500 Message-Id: <20190130004811.27372-54-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 53/73] alpha: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 1fd95d6c0f..cebd459251 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -42,10 +42,10 @@ static bool alpha_cpu_has_work(CPUState *cs) assume that if a CPU really wants to stay asleep, it will mask interrupts at the chipset level, which will prevent these bits from being set in the first place. */ - return cs->interrupt_request & (CPU_INTERRUPT_HARD - | CPU_INTERRUPT_TIMER - | CPU_INTERRUPT_SMP - | CPU_INTERRUPT_MCHK); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD + | CPU_INTERRUPT_TIMER + | CPU_INTERRUPT_SMP + | CPU_INTERRUPT_MCHK); } static void alpha_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Wed Jan 30 00:47:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 282B61390 for ; Wed, 30 Jan 2019 01:30:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 196CF2D105 for ; Wed, 30 Jan 2019 01:30:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7A52D10A; Wed, 30 Jan 2019 01:30:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0AD32D105 for ; Wed, 30 Jan 2019 01:30:39 +0000 (UTC) Received: from localhost ([127.0.0.1]:58402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goei6-0001Tl-UH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:30:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe42-0000Fx-4d for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe41-0001VZ-5X for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:58253) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe40-00017c-Vj for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BCF49221C9; Tue, 29 Jan 2019 19:48:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:27 -0500 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=Xb76L6U0SxCitlHD+wHYEHsbP6KoJ0e4P0MCFqRy3IA=; b=p0kCBYLS075f rZkqp/rVL2leRZWCkY/dKPdKxtxh+yzIoQkaPDacGBsp5e6kR5vLV0gBx4aGs/Z3 W93rSFaVKgNWeS2Mq7A0VzvVj22OrEgQ+gz3Me+f+3Vy3jJ5dXZftDQTs8pv738S 4qXe2O4I050Ydtrk+fDqw0PQOzeSPyY= 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=Xb76L6U0SxCitlHD+wHYEHsbP6KoJ0e4P0MCFqRy3 IA=; b=gNUU00epNdMqWINv9mndeTVzMjcVdj+zYpXcuzrO6yR/5Lv1893erI6LN 2AEsrpjSms/xxlNHf6al0OqGIQrvPCPUvZTUFlo8wrz8JkoRK7p3Q5bq8xFirzdh 41lE9qfBWosNc20ppnJ7yYm60icYfeui8goOP8pI7M7dhDQB79MbRBAENvu7zABA uyqUiI4DfBUC0CJ/N2f/22qkA45veJ6aC8eIvkNt2RqJ+gn0w2yK8PUoE/xELcuu NHI+YPGdVtvh7DQEzM8k4wueTJYqIexQJ4rab2XU1u3r4wegpNCHtzz571YmR9K1 r526L5jYRpDNK4fH7a+X/zi9mqAmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D661E4596; Tue, 29 Jan 2019 19:48:27 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:52 -0500 Message-Id: <20190130004811.27372-55-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 54/73] moxie: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Anthony Green , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Anthony Green Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 621F31390 for ; Wed, 30 Jan 2019 01:28:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 518932AC0F for ; Wed, 30 Jan 2019 01:28:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44B742AE05; Wed, 30 Jan 2019 01:28:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D53932AC0F for ; Wed, 30 Jan 2019 01:28:55 +0000 (UTC) Received: from localhost ([127.0.0.1]:58263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeaC-0002fP-Hp for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:22:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe40-0000CR-W3 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe40-0001Tr-0L for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:12 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55631) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe3y-000188-O7 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:10 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 15C6F2219C; Tue, 29 Jan 2019 19:48:28 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:28 -0500 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=AT6d0vNyGlfx6+cGiDrYllJqn4sS8Z8dVh+2s6ELO1w=; b=Qt0w7WLPOiGQ 0v6JfAZF8efnIqkuGcGL3W4SidOp0MLPZolHN2O5qTwokWmtZ8xvxn1NDk9MP8ju UrcelVWwLOllXxScinhIL99MDDaTnTIyelvoAEE6tZw0flNZC7x3HHj/eD5+wQbn mHngfxyD5mgJCenJu9qycm/C/5H8Pyw= 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=AT6d0vNyGlfx6+cGiDrYllJqn4sS8Z8dVh+2s6ELO 1w=; b=n/nOHkBsVZfL2yTaqummVxtHpGe3TRRboSrLxHTEp9TW+RTeckPRhdlAn dhhMxqF19auCLzh6N72qloVFNF6D3304R4Y5sO2vUA5xIFxpxttEcqb6UNDqnLJC wEihIMNiVzXEl2z1KN1QDL5yT/qNDoyCHVZJryiLdosZMTimYeumJDfXLfhMrzvE xxAar2w8T8oaBXJvnTH78J32B1c1oE2nkKFsNWu3Vo5PRiABxaJgp1O3iS3LGmzO DhEHDZ1m/DnfQkPVB7t21Re6y1ViO6Z8y8zeHGn41knVzRLx6nG3knoklASXnI9E 9UhAVN/1cA9sRezyBjLZapW+5m/iA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepvdek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 96052E4559; Tue, 29 Jan 2019 19:48:27 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:53 -0500 Message-Id: <20190130004811.27372-56-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 55/73] sparc: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Richard Henderson , Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota --- hw/sparc64/sparc64.c | 4 ++-- target/sparc/cpu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 372bbd4f5b..58faeb111a 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -56,7 +56,7 @@ void cpu_check_irqs(CPUSPARCState *env) /* The bit corresponding to psrpil is (1<< psrpil), the next bit is (2 << psrpil). */ if (pil < (2 << env->psrpil)) { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_reset_irq(env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -87,7 +87,7 @@ void cpu_check_irqs(CPUSPARCState *env) break; } } - } else if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + } else if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_disabled(pil, env->pil_in, env->softint, env->interrupt_index); env->interrupt_index = 0; diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 4a4445bdf5..933fd8e954 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -708,7 +708,7 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; - return (cs->interrupt_request & CPU_INTERRUPT_HARD) && + return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } From patchwork Wed Jan 30 00:47:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2A9B91E for ; Wed, 30 Jan 2019 01:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52C62C97E for ; Wed, 30 Jan 2019 01:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C98712C989; Wed, 30 Jan 2019 01:27:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6FCE72C97E for ; Wed, 30 Jan 2019 01:27:57 +0000 (UTC) Received: from localhost ([127.0.0.1]:58348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goefU-0007NN-KU for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:27:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe41-0000Ex-RV for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe40-0001VI-UY for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:33085) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe40-000189-N5 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:12 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3CA43221D1; Tue, 29 Jan 2019 19:48:28 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:28 -0500 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=1/4jTKIqKu/237nv0ApRGSMo5Cwj66O156kM1aHsO+U=; b=urXkLb7EnRcL SduSnfQ13DVcoCyhUMv98xMZmd03Wc5Hpa9UjTj8ssouXpNdbqInVh58mSBade6b vvEq2PHANrwbjAIUe9arAoIPjKIqUV5cFxbjlsd6Vfl4c04OyvhtHPbyjmUE3eWU 4m0uWSol/HQ9HCIVZcfPgJbSYaD63TA= 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=1/4jTKIqKu/237nv0ApRGSMo5Cwj66O156kM1aHsO +U=; b=NeAq9rXfHnuP46FW6jy765EUpbXhAOZbpj9Dd+56FD6Ob8olfoaIkWJJL 5b8BBD7/V0XfEK6+g0hhZTt+SYbnHM0fMiISAxQncUlIkk3kdjxGqiljOSl1QQSX sXPZ4KlWYWvodrNyVAOxT2txEUMdIo6iG5Crup/HUKMiVGd+hORev7TNzc4d9Mb1 WRdg4+MjWLefPb0GLFXZED6CB+0t4Ch0NAcagmhKnqOFdFLd7ZgIAOrXMUkMVh5e upaSm4yTZP8Q6kO1u0VTsYvn4/G08qzm+apQNfmWn+tafi2/XFaBWGa85daMONav 3SfKr3oT6UvxqP8Y65+SmsOi3yl3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepfeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CE7DFE4667; Tue, 29 Jan 2019 19:48:27 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:54 -0500 Message-Id: <20190130004811.27372-57-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 56/73] openrisc: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stafford Horne , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Stafford Horne Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B768A1390 for ; Wed, 30 Jan 2019 01:29:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8F972AC0F for ; Wed, 30 Jan 2019 01:29:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D2092D0AC; Wed, 30 Jan 2019 01:29:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E1F832AC0F for ; Wed, 30 Jan 2019 01:29:55 +0000 (UTC) Received: from localhost ([127.0.0.1]:58364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goehP-0000k6-6t for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:29:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Ls-Hd for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe42-0001YO-Uf for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52643) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-000196-MW for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 712CF221DF; Tue, 29 Jan 2019 19:48:28 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:28 -0500 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=gReHik7andLLg2Nsbv/TVDbuPJ4VyHsEhnH4PjZAzic=; b=0cqggYfKsOzl je4r2P0qHI2X0u4zPVQAfHMYHLy08b1LxnkCjCd8Cymxz99pAQRIh1hJFGc/sAmg prjDhNcZKVC9Gd+QkmOU1EzTooDBZ+qT8qAJ2vWUB6lIus0rFCh9GQXxjZd4BLcB PDk9lgkT5mB1SsGQ+kOnCYrup0Mtd9c= 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=gReHik7andLLg2Nsbv/TVDbuPJ4VyHsEhnH4PjZAz ic=; b=exX19MzxpRv8jmi6UueCCt/dp8aSJyTNUgDHBSC6rk2G+h902/w+4Xamw N26/BarzFnrOWCHtktr3b1gaGwYxWkbiSYmSZ7tr/s14Bp/CwyJarQJgzn3kd1mh sFbsHezqILR9qVtBDlNv9ZEjARDabwROWA4Q3O+n00RyVEaShvp5ZLNl5MoEpKT3 TAGaXBMXdkZ0WedT+8Ha3fBHvKsAG1QIyIXvz4a0g/QW2DHApNCNVQHXwkPoPNRO ORL4na+ghZHpOxIZ4XUcQdrHLF1aP64eKJM1li3RtYJ+E4y2j5kdT22Yj5JDxjbC j6QUKknSBIYSnwMF4RrpqYGVydshQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepfeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 13389E4596; Tue, 29 Jan 2019 19:48:28 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:55 -0500 Message-Id: <20190130004811.27372-58-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 57/73] unicore32: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Guan Xuetao , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: Guan Xuetao Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 Wed Jan 30 00:47:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1851E13B4 for ; Wed, 30 Jan 2019 01:31:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A8852D105 for ; Wed, 30 Jan 2019 01:31:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F313F2D10A; Wed, 30 Jan 2019 01:31:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 972BF2D105 for ; Wed, 30 Jan 2019 01:31:33 +0000 (UTC) Received: from localhost ([127.0.0.1]:58410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeiy-0002FX-Sk for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:31:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe49-0000QP-M8 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe48-0001en-VE for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:21 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:57169) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe48-000197-Qh for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:20 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B86F4221CD; Tue, 29 Jan 2019 19:48:28 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:28 -0500 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=q0VuvyniGGl3gOPO4NlBJXzYK8At5TpuHHkR9uKH3XU=; b=AX0MqZZnI75M b9obsXAVV9VJszw//nKukYarfklECIAI2wjpNszOH5GhGhADuaM9MIiRBRp1fx8T 082JJnNhU9S3RFJOJK/KDkXr6jiM0x7/o862L9saEAJtDOS4frXDPZjz5mFg/kxg Cj4m+IBOUYehsdJw/ApqA/1jeG/3GRs= 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=q0VuvyniGGl3gOPO4NlBJXzYK8At5TpuHHkR9uKH3 XU=; b=m/F7GL+YZ8lRXj0M3cNWYV7IUomGkLJSrmRiIBUN2qyQh1eAqoJuQDNKi PlZWN7uRQow/15cFyEVZs0I5P/vu3YMX5pH3qs3FokbbuuvfMbqHiVU8wleSiZ3V d/0GeQoozzpSuxTgqRzM4nQuOgCNDBXi7zQzh6ZwQSGwNFk/NvQSAJSu8Wpoc+IJ hQiWpd73UXYAiMYhJVW6mvrzhI5H8ZiRzPBiUB/HceQbqrFG1zts9MaytoDvFhH0 DNEuV9s3QVaEXAL8K0gUdkX/pMNLlvhfdGIpBpKa1TdCSiYHU3zMobFXBNrKGxc1 NaftltRG/QYs84xemQG4Zp8VucDww== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepfeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 50E30E4667; Tue, 29 Jan 2019 19:48:28 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:56 -0500 Message-Id: <20190130004811.27372-59-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 58/73] microblaze: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- 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 5596cd5485..0cdd7fe917 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -84,7 +84,7 @@ static void mb_cpu_set_pc(CPUState *cs, vaddr value) static bool mb_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } #ifndef CONFIG_USER_ONLY From patchwork Wed Jan 30 00:47:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBAE791E for ; Wed, 30 Jan 2019 01:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD5E72C97C for ; Wed, 30 Jan 2019 01:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D16A02C980; Wed, 30 Jan 2019 01:26:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4427B2C97C for ; Wed, 30 Jan 2019 01:26:11 +0000 (UTC) Received: from localhost ([127.0.0.1]:58289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goedm-0004c1-FD for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:26:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Lt-V8 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe42-0001YI-UC for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45365) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0001Bs-Na for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 00B97221ED; Tue, 29 Jan 2019 19:48:29 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:28 -0500 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=pRiS4Z+s9VUGwJJ4seEtoNfQIYcTABiiWMxWOPcmkaM=; b=ZOkmXYrD6si/ 3mYdMomh+ii4q/i/PJC0Z5T2/r+55h450IlYvH3lYjxicfLDMle1y7abKkURaeNR TWvP8VqCsWMNGsRwdV8ufu/mBq6BflRJBJMMrmQ6m8OnqkmFjPBvIEJU3Jj+9/MA lFIeYtkC+EUi7YQqIdxftGub/zMHt6c= 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=pRiS4Z+s9VUGwJJ4seEtoNfQIYcTABiiWMxWOPcmk aM=; b=NCWKpiEi2vdv4HPxX1S6pxpJliTKbFhQu58usJn4qCQDf93nixkrceAJE XjXVsU0vCs6HmbsTP1TP6lJDrjs+GFK9rXsxXber6W4Wg8DYYmsZpuuFI8yR6/tC xoA8RDN6qiHWiWHZjx/U2J6GvWHq6v/1gW08vDDabs+YjSYeySNgXsnhwpzBgCM2 fMudzOKFawhCf4btrZbcCosk59TiLSaaZQJfxUScOIx/TVUW08LytGaV2ktXoX4u ENqofmI6WeBZ/ikF+XANicV6WfEVsNTNxbdnIf/3ZRXeWKS4MRNrlRaNdOy9SoTw jiv3choDaUJ6X7cDS3S0JKOWSrohQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfgggtgfesthekredtredtjeenucfhrhhomhepfdfgmhhilhhiohcuifdrucevohhtrgdf uceotghothgrsegsrhgrrghprdhorhhgqeenucfkphepuddvkedrheelrddvtddrvdduie enucfrrghrrghmpehmrghilhhfrhhomheptghothgrsegsrhgrrghprdhorhhgnecuvehl uhhsthgvrhfuihiivgepfeek X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9170CE4596; Tue, 29 Jan 2019 19:48:28 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:57 -0500 Message-Id: <20190130004811.27372-60-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 59/73] accel/tcg: convert to cpu_interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota --- accel/tcg/cpu-exec.c | 15 ++++++++------- accel/tcg/tcg-all.c | 12 +++++++++--- accel/tcg/translate-all.c | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e3d72897e8..e4ae04f72c 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -431,7 +431,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu) if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) - if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); @@ -544,16 +544,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, */ atomic_mb_set(&cpu->icount_decr.u16.high, 0); - if (unlikely(atomic_read(&cpu->interrupt_request))) { + if (unlikely(cpu_interrupt_request(cpu))) { int interrupt_request; + qemu_mutex_lock_iothread(); - interrupt_request = cpu->interrupt_request; + interrupt_request = cpu_interrupt_request(cpu); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { - cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index = EXCP_DEBUG; qemu_mutex_unlock_iothread(); return true; @@ -562,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* Do nothing */ } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); - cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); @@ -599,10 +600,10 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } /* The target hook may have updated the 'cpu->interrupt_request'; * reload the 'interrupt_request' value */ - interrupt_request = cpu->interrupt_request; + interrupt_request = cpu_interrupt_request(cpu); } if (interrupt_request & CPU_INTERRUPT_EXITTB) { - cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB); /* ensure that no TB jump will be modified as the program flow was changed */ *last_tb = NULL; diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 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 7364e8a071..ec708208b6 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2343,7 +2343,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 Wed Jan 30 00:47:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 294FC922 for ; Wed, 30 Jan 2019 01:17:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C90E2C842 for ; Wed, 30 Jan 2019 01:17:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10DE72C876; Wed, 30 Jan 2019 01:17:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B88E22C842 for ; Wed, 30 Jan 2019 01:17:57 +0000 (UTC) Received: from localhost ([127.0.0.1]:58190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeVo-00072L-TU for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:17:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe42-0000GB-8k for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe41-0001Vq-9K for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41809) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe41-0001Br-2W for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:13 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 44A6E221E5; Tue, 29 Jan 2019 19:48:29 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:29 -0500 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=+9LXsQ02ykRi39c8qd8DeEDKBraMCZTn03AAaZ+Rgfo=; b=PmR7g oVXjNYTsr+ONKsf3zAeZFxooGslzY6HPBphO97YsRcnAT3dssm1gR3rRGHVIPzKI qDHN0r6B5/mCvl2c68IN6Iton3XBZgC1XPJpVX49jSZvlRNjAT6QUjzbqBa3c2/v XRe6OHX9d6R1MyaTX+qfface1iTr/kY0iuT+QE= 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=+9LXsQ02ykRi39c8qd8DeEDKBraMC ZTn03AAaZ+Rgfo=; b=iSULOFRP2JfSTu/qhqSe13z0zN1bowPL6s++xVH/0JLk6 D57Fr/ZUYHuT+GZHA7oG5sr/JL0pTDn4xQ9SiBLc64PBjF4svUXL41k+CPrqqOEC s708Ea6TWScJdwlTLPucz4bZzd4l1T9/UBWtbRcLt+7UT/Jtjs8MqMCBirkyckqb Guw2oiIXGnrQV5MRpHj9M8Jj/W0GysRRXUWUjTdOTlqYfT/Ssz/9xwENxaGC8OCp hDktbZURKFdIryWojn87nTfc4TqgUARfWuH+a5tst7mH6r4iGB+V6mG7zUCLVnPH wCeDR97+eyKCW2SOw2pujwSl4fu3MRA+zCBsJii0A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D1F37E446A; Tue, 29 Jan 2019 19:48:28 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:58 -0500 Message-Id: <20190130004811.27372-61-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 60/73] cpu: convert to interrupt_request X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This finishes the conversion to interrupt_request. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- qom/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qom/cpu.c b/qom/cpu.c index 00add81a7f..f2695be9b2 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -275,7 +275,7 @@ static void cpu_common_reset(CPUState *cpu) log_cpu_state(cpu, cc->reset_dump_flags); } - cpu->interrupt_request = 0; + cpu_interrupt_request_set(cpu, 0); cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->mem_io_vaddr = 0; @@ -412,7 +412,7 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len) static void generic_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Wed Jan 30 00:47:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F8571390 for ; Wed, 30 Jan 2019 01:34:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F4582CC45 for ; Wed, 30 Jan 2019 01:34:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 809B42D131; Wed, 30 Jan 2019 01:34:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2250B2CC45 for ; Wed, 30 Jan 2019 01:34:47 +0000 (UTC) Received: from localhost ([127.0.0.1]:58444 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goem6-0004vh-DK for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:34:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Lm-0P for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe43-0001Ys-3Q for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0001E5-Qc for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6FE7A221DB; Tue, 29 Jan 2019 19:48:29 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:29 -0500 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=HU4DBq1euOkxKqvmpnJ7nOAGXl/VDj/0ofGJKtJp3XQ=; b=cscdr 0VU00K2iUHryd3CSM2Im6tmaxpsgrgG7HndzS5Z3ZgufP/QJeotA8D89TuzB0imB Lfil2aSrG0LwrBFBOZ8ZFZHNr+eqT/l3HyUNbydJxbo2sP9xMLFmT7q8zA1VsGYx +k5yQIiZJqBa2F1OPzj0eKNfJ3XrOGWDezxfu0= 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=HU4DBq1euOkxKqvmpnJ7nOAGXl/VD j/0ofGJKtJp3XQ=; b=fRikTpOZulkAnOGhzQeVUgNm2kKlHzkTNlHPf2o/VZv8U BXwB24caWEnK5dkWz6AkbRY9YW9qMPpk4QMf0ykvv6LAQlFmmHwMWnhq9hqoc69q l23ec8Zpc7BWeyG5osjEizQ30sMnOS8bSnC6GqCpr0ORmN8KaShJTCYH2O87sgXy lrjD4IXCcLt3qd6Xmr5E6zY9FZJl60rUzfU5AVNzh4/AqkGHZe4NZ04a5c6Aa0K/ JjoqbnuNM/GhhWQyPGa0ugdNbVWoGNdbQ4CxSEgI05T/7dOuADlXPkbxIcHOB2Z0 x7CHC9HnLowT5rrrAM6kU8pv1sWkKM3S/yjFI/9MQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 17CCCE4559; Tue, 29 Jan 2019 19:48:29 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:47:59 -0500 Message-Id: <20190130004811.27372-62-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 61/73] cpu: call .cpu_has_work with the CPU lock held X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- include/qom/cpu.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 4a87c1fef7..96a5d0cb94 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -85,7 +85,8 @@ struct TranslationBlock; * @parse_features: Callback to parse command line arguments. * @reset: Callback to reset the #CPUState to its initial state. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. - * @has_work: Callback for checking if there is work to do. + * @has_work: Callback for checking if there is work to do. Called with the + * CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) @@ -795,9 +796,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 Wed Jan 30 00:48:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C099922 for ; Wed, 30 Jan 2019 01:36:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E9762D12A for ; Wed, 30 Jan 2019 01:36:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 831902D14D; Wed, 30 Jan 2019 01:36:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 218E12D131 for ; Wed, 30 Jan 2019 01:36:12 +0000 (UTC) Received: from localhost ([127.0.0.1]:58492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goenT-0006EB-DI for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:36:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Lo-6V for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe42-0001Xo-N5 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51159) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0001E4-Hr for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B4090221F3; Tue, 29 Jan 2019 19:48:29 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:29 -0500 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=a/XGJL7JheeLP3KMz+B+/JrTbwgvQq/kM9TyzL7zolE=; b=v10FY EQzzqGpaRaXtf+mSoilKaPgGy/hL96B0p6FafM0ZRM+8l1CZj4f2AQNFCAV0vBUp juaMxfNPOT4vG4tTTULp6cNdOM+ls1ybdHpu7Ek6d/VSVhsLZnVyVvkSxOQow2l1 A1txNfpPUQbnKrsFAEEJEcOoy3k7tN5hKobEfA= 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=a/XGJL7JheeLP3KMz+B+/JrTbwgvQ q/kM9TyzL7zolE=; b=ENKsprdjPEiQAowiUYPoPhrtgd0ICgUASKSkTRV37wAMT 7VwERCRuOvEnLK/JPe4sXW32ovZ9ND4lov56gjweRbYR3Ha0UB+IlwtpZ/QRfRW3 ApEI62RWZysnibz0zD9HAUAuE6fHTLqfxkbHyX8kIsysQSXUZ9PBRYghjFAl3I/D 3E5eCyP/Zr6LfYQDkTzJZgijfUXHs7S+DDudTqjkMBqyRhaibxlle4f9sGfxjh5t BmM996KpmGyDii+StxexJupS8hZy7EtwoyJY40a3CS9826+XRFDTc1Cfk/NZEFIM g+atwyXsVScwHoXztx/M3y2TnnqfbY8DPYtk2xCLg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 480EFE4664; Tue, 29 Jan 2019 19:48:29 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:00 -0500 Message-Id: <20190130004811.27372-63-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 62/73] cpu: introduce cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It will gain some users soon. Suggested-by: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- include/qom/cpu.h | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 96a5d0cb94..27a80bc113 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -27,6 +27,7 @@ #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" #include "qemu/fprintf-fn.h" +#include "qemu/main-loop.h" #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" @@ -87,6 +88,8 @@ struct TranslationBlock; * @reset_dump_flags: #CPUDumpFlags to use for reset logging. * @has_work: Callback for checking if there is work to do. Called with the * CPU lock held. + * @has_work_with_iothread_lock: Callback for checking if there is work to do. + * Called with both the BQL and the CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) @@ -158,6 +161,7 @@ typedef struct CPUClass { void (*reset)(CPUState *cpu); int reset_dump_flags; bool (*has_work)(CPUState *cpu); + bool (*has_work_with_iothread_lock)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); CPUUnassignedAccess do_unassigned_access; void (*do_unaligned_access)(CPUState *cpu, vaddr addr, @@ -796,14 +800,40 @@ const char *parse_cpu_model(const char *cpu_model); static inline bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + bool has_cpu_lock = cpu_mutex_locked(cpu); + bool (*func)(CPUState *cpu); bool ret; + if (cc->has_work_with_iothread_lock) { + if (qemu_mutex_iothread_locked()) { + func = cc->has_work_with_iothread_lock; + goto call_func; + } + + if (has_cpu_lock) { + /* avoid deadlock by acquiring the locks in order */ + cpu_mutex_unlock(cpu); + } + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + + ret = cc->has_work_with_iothread_lock(cpu); + + qemu_mutex_unlock_iothread(); + if (!has_cpu_lock) { + cpu_mutex_unlock(cpu); + } + return ret; + } + g_assert(cc->has_work); - if (cpu_mutex_locked(cpu)) { - return cc->has_work(cpu); + func = cc->has_work; + call_func: + if (has_cpu_lock) { + return func(cpu); } cpu_mutex_lock(cpu); - ret = cc->has_work(cpu); + ret = func(cpu); cpu_mutex_unlock(cpu); return ret; } From patchwork Wed Jan 30 00:48:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7843C1390 for ; Wed, 30 Jan 2019 01:45:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6830C2C461 for ; Wed, 30 Jan 2019 01:45:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C47E2D697; Wed, 30 Jan 2019 01:45:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C97F82C461 for ; Wed, 30 Jan 2019 01:45:02 +0000 (UTC) Received: from localhost ([127.0.0.1]:58637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goew2-0005Cq-5r for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:45:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4M-0000dT-UY for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4F-0001lc-FN for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:31 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41955) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4E-0001F9-5i; Tue, 29 Jan 2019 19:49:26 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id ED44A2214E; Tue, 29 Jan 2019 19:48:29 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:29 -0500 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=6zYkevLdzPprZ4+XXfLXRrzOcz6B7gSkqfdmxUrcRkA=; b=FPWSr XBpOAWbeDoE0D2li3El5xjRFFM11SE+5HPkV0n5WAMKXK7nf4gQnVWw70GP4FQ6B L4nm6jqgverXHq+H4PO3lJeOXpjuTP7nvNvJFFloSAPK8+BhIeIujWPgyd537xQo 9JtBSaVBtgL4aY1dC6rozAk7TId9Qc4RSWV1sw= 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=6zYkevLdzPprZ4+XXfLXRrzOcz6B7 gSkqfdmxUrcRkA=; b=MJ55T+IuDhqBWe9JK3ZoRCNxLIn+xQRzyYhCGoorawDxc sg/g69oeDF7u9BRPuKl3kJDniAVkawpo9cBjCbc+cREj00nKMOJ+CqVh3OE2NmgR hZs4a6lBDQ075hZ4hJ0LJDhr15gqv9xLewIYV2Q5qDaqEVUGVX4cYREFYxGwyF7i y8LJG1+YsWZb7Z263zl+7qTGob1DmCio8w0Cl6UEeQWPsln3/gGqBkghf+T0PwoZ 500LihMU9P1Iftqe/ZuaDhEaRxxUMHjv9prAev0H27bAOU+Aqh6IvJAf0FCRYO7h o7iz2Ew0w3La4f+5Tf6sbJpPhbfpunKV0wRdYTIOw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 8AEFFE446A; Tue, 29 Jan 2019 19:48:29 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:01 -0500 Message-Id: <20190130004811.27372-64-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 63/73] ppc: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, Paolo Bonzini , Richard Henderson , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: David Gibson Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota --- target/ppc/translate_init.inc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index e1059d9ed6..78bb766f3f 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8454,6 +8454,8 @@ static bool cpu_has_work_POWER7(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; @@ -8497,7 +8499,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) pcc->pcr_supported = PCR_COMPAT_2_06 | PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER7; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER7; + cc->has_work_with_iothread_lock = cpu_has_work_POWER7; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -8608,6 +8610,8 @@ static bool cpu_has_work_POWER8(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; @@ -8659,7 +8663,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) pcc->pcr_supported = PCR_COMPAT_2_07 | PCR_COMPAT_2_06 | PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER8; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER8; + cc->has_work_with_iothread_lock = cpu_has_work_POWER8; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -8800,6 +8804,8 @@ static bool cpu_has_work_POWER9(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; @@ -8853,7 +8859,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER9; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER9; + cc->has_work_with_iothread_lock = cpu_has_work_POWER9; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -10247,6 +10253,8 @@ static bool ppc_cpu_has_work(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } @@ -10446,7 +10454,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = ppc_cpu_class_by_name; pcc->parent_parse_features = cc->parse_features; cc->parse_features = ppc_cpu_parse_featurestr; - cc->has_work = ppc_cpu_has_work; + cc->has_work_with_iothread_lock = ppc_cpu_has_work; cc->do_interrupt = ppc_cpu_do_interrupt; cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt; cc->dump_state = ppc_cpu_dump_state; From patchwork Wed Jan 30 00:48:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C81F1390 for ; Wed, 30 Jan 2019 01:33:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D5F12D12C for ; Wed, 30 Jan 2019 01:33:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FC0B2D138; Wed, 30 Jan 2019 01:33:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B18F2D12C for ; Wed, 30 Jan 2019 01:33:26 +0000 (UTC) Received: from localhost ([127.0.0.1]:58434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goekn-0003nW-D8 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:33:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Ln-2c for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe42-0001Xz-QZ for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:15 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34723) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0001F4-Ju for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 36D2A2217D; Tue, 29 Jan 2019 19:48:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:30 -0500 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=K3gyK/hmMsLmgqN+70QNnCR95KGpXm1kRX9QMmVcKJc=; b=FiesV 6ZXGAAYX3zvVhLOrNfu7JcCiQzDrq/5EeY221KYTvEtnPHQ/1SCka45tYRsVbZKA 0POLPZ83EaX90PdxzuRP1FEDnutCleQICACKkHGp8pEqgCbgppxnoHjaGkoib388 dJ7SN+eE7ZLYh4bAXtHNMLxzaE31iWKbqxM8GY= 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=K3gyK/hmMsLmgqN+70QNnCR95KGpX m1kRX9QMmVcKJc=; b=NH1I7/bg0QIdoSrSI/L1Lk9fiSBALmCRMiBhSXQmzoztY 0x7gzuFv7sTARZyAfX+LmLWIAFAIT6Jh3oDZRMFj445oGrEtl9HgdhtGprXpNYsf 4AS+Jhjej70ckd19MgiPuWHx0iy+WeVenc7m5E5Ndl1fa9flthVzaSDjseTQ9DC8 3E1AYZa73pFyAJdZaY44wPf3iN84Bjefpfo6nDtxZ9yMzOBTnibLB6Tx4Cdqw/Sd Wk+1vXa8dsfnRBnz/3Y5zq9xtZn7qYsTzEij13qZvnLyfw70yw15lAb3IDbrkTTW yqmUiuUTjfn9QwOX0dsdiC7yYf9bbRCBrztsMvH8w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id C62A6E4559; Tue, 29 Jan 2019 19:48:29 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:02 -0500 Message-Id: <20190130004811.27372-65-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 64/73] mips: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Aurelien Jarno Cc: Aleksandar Markovic Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- target/mips/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index fdae8cf440..de1eb771fa 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -58,6 +58,8 @@ static bool mips_cpu_has_work(CPUState *cs) bool has_work = false; uint32_t interrupt_request = cpu_interrupt_request(cs); + g_assert(qemu_mutex_iothread_locked()); + /* Prior to MIPS Release 6 it is implementation dependent if non-enabled interrupts wake-up the CPU, however most of the implementations only check for interrupts that can be taken. */ @@ -190,7 +192,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->reset = mips_cpu_reset; cc->class_by_name = mips_cpu_class_by_name; - cc->has_work = mips_cpu_has_work; + cc->has_work_with_iothread_lock = mips_cpu_has_work; cc->do_interrupt = mips_cpu_do_interrupt; cc->cpu_exec_interrupt = mips_cpu_exec_interrupt; cc->dump_state = mips_cpu_dump_state; From patchwork Wed Jan 30 00:48:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AEAB922 for ; Wed, 30 Jan 2019 01:41:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CF612D615 for ; Wed, 30 Jan 2019 01:41:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 014A72D626; Wed, 30 Jan 2019 01:41:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A48522D615 for ; Wed, 30 Jan 2019 01:41:24 +0000 (UTC) Received: from localhost ([127.0.0.1]:58573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goesV-0002qY-Tg for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:41:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4E-0000WP-6U for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4D-0001iw-A1 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:26 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37567) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4D-0001FA-4T; Tue, 29 Jan 2019 19:49:25 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 51F33221FC; Tue, 29 Jan 2019 19:48:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:30 -0500 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=1Oc50TkPtujcTzrYb2PctjtVWgSbMDc+ie1GTmlWyRw=; b=nXIDH W6ye0ihU5sSMKWY8uCVAH/SbwSMM9pHOC/RQTU+NlU91Vf71eOWKeNjFO5GjATTm aotKe36xsEdEWsA8i/S1fsla6/9l9PrQuBK31j9If+tSOhVc65J4IjHdtzlQVdz8 0Qub+JgvIc9Z5CBTeKwlbit9wxKuTtchADVFwk= 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=1Oc50TkPtujcTzrYb2PctjtVWgSbM Dc+ie1GTmlWyRw=; b=bENW2xgHx3VE+DjCgm1FS90ZrC3dWTnqplo07Vw67ehFJ 1euc5hDNi6BdXJoVkJYwN9XTPb1k2+mYKTgrkzzDMdvHbiZ3WjLNl7xckpJURyqo ee1ho8QOP9KQh9EjR6qqqlxR02cF2gy5BcDGuzaISmRG/3rc2+6DicqyQa3gJ7jb FT+gPmWTMAgWEqGMwN4bfnEVhc8OLEY/UtUzLymyzT12Yai3Lyla8dl79tZw6iZ6 9AKdG8uAf9p72wvkI+zhZMc2ZRZwMOoUQIj6pltdD23wjiSqw17bIAJoI+4vitGD NZybP1HFMoiRsVvEtRZRChwOdP8phiYj0W9ElKYUw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id F1557E4664; Tue, 29 Jan 2019 19:48:29 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:03 -0500 Message-Id: <20190130004811.27372-66-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 65/73] s390x: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , David Hildenbrand Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Cornelia Huck Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Cornelia Huck --- target/s390x/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index d1594c90d9..5c38abaa49 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -59,6 +59,8 @@ static bool s390_cpu_has_work(CPUState *cs) { S390CPU *cpu = S390_CPU(cs); + g_assert(qemu_mutex_iothread_locked()); + /* STOPPED cpus can never wake up */ if (s390_cpu_get_state(cpu) != S390_CPU_STATE_LOAD && s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING) { @@ -473,7 +475,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) scc->initial_cpu_reset = s390_cpu_initial_reset; cc->reset = s390_cpu_full_reset; cc->class_by_name = s390_cpu_class_by_name, - cc->has_work = s390_cpu_has_work; + cc->has_work_with_iothread_lock = s390_cpu_has_work; #ifdef CONFIG_TCG cc->do_interrupt = s390_cpu_do_interrupt; #endif From patchwork Wed Jan 30 00:48:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8411B1390 for ; Wed, 30 Jan 2019 01:32:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A9C2D105 for ; Wed, 30 Jan 2019 01:32:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C1172D10A; Wed, 30 Jan 2019 01:32:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D500C2D105 for ; Wed, 30 Jan 2019 01:32:02 +0000 (UTC) Received: from localhost ([127.0.0.1]:58418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goejR-0002ci-TW for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:32:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe44-0000Lr-Hh for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe43-0001Yo-3a for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:16 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41033) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe42-0001FB-Pd for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 96754221EE; Tue, 29 Jan 2019 19:48:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:30 -0500 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=VKEeg5Id4MHy6qhthroijmzAVf92/liRGLdcqt8b4IM=; b=KbLby xqb4YLSfrye3rhSZmW/2rZjoCbiUY5IcUvmAH5QfOWswHF9cJzdi61OK/m3Xv9K5 o5guA4rrmaook25ETK2PsVEyxFye5ddeDC55vjJ6vyoRNgmhPNMZGjp94QzcnQ35 iXKntfzKf9AX9Hj5tJ0/9Mbq4cSAngU9dPd2Fw= 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=VKEeg5Id4MHy6qhthroijmzAVf92/ liRGLdcqt8b4IM=; b=O59PBk5iccy0VlH+JiSDGbqqIu9EF70XKmAqUXL6VJWzb ss1KkQ4CQVC5/IBsulF373/EUbbGUsQ+nqSM2KZAePkkf+CoNuMWOBRqGVOlB/US PAPAb0lydvtb6N6wzokPmEHvIVd9CAmqmimxq/gTZmX4eeacKQsaRDHbqzO0KDcK f/ti869CtgPunQ1xSKpMNTEDw5+1fXonXTM+hKC72F3YerlDckKGmQ9pP6gvOapz mlpGrlKBS3wNKI4uTBXLZn1wiFh3lxu2BRPSqXTofLj4xJ7jNFXDuyvbAn6vi9kQ Vc/VpWhYcIfjoyHiL74F4QZlW+1i0KHIDbadqvKuQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 29855E446A; Tue, 29 Jan 2019 19:48:30 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:04 -0500 Message-Id: <20190130004811.27372-67-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 66/73] riscv: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Palmer Dabbelt , Richard Henderson , Sagar Karandikar , Bastian Koppelmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Palmer Dabbelt Cc: Sagar Karandikar Cc: Bastian Koppelmann Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 28d7e5302f..7b36c09fe0 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -257,6 +257,9 @@ static bool riscv_cpu_has_work(CPUState *cs) #ifndef CONFIG_USER_ONLY RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; + + g_assert(qemu_mutex_iothread_locked()); + /* * Definition of the WFI instruction requires it to ignore the privilege * mode and delegation registers, but respect individual enables @@ -343,7 +346,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) cc->reset = riscv_cpu_reset; cc->class_by_name = riscv_cpu_class_by_name; - cc->has_work = riscv_cpu_has_work; + cc->has_work_with_iothread_lock = riscv_cpu_has_work; cc->do_interrupt = riscv_cpu_do_interrupt; cc->cpu_exec_interrupt = riscv_cpu_exec_interrupt; cc->dump_state = riscv_cpu_dump_state; From patchwork Wed Jan 30 00:48:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 368371390 for ; Wed, 30 Jan 2019 01:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 286282CC45 for ; Wed, 30 Jan 2019 01:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C1792D131; Wed, 30 Jan 2019 01:35:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B49732CC45 for ; Wed, 30 Jan 2019 01:35:41 +0000 (UTC) Received: from localhost ([127.0.0.1]:58484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goemy-0005nh-Qo for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:35:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4B-0000Sz-Ro for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4A-0001gQ-Sy for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39851) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4A-0001G1-O9 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:22 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A42F1221F0; Tue, 29 Jan 2019 19:48:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:30 -0500 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=j+wvCmAOu3KL+xNyWyNekw8AsvFO21bb/k9I3teLA8Q=; b=Daq4c 6I8mQHXapnzmBaVlEiRyKeqdXoJui4B79S/7eVTYkVPnMDVazX6xX+LuGyT0wEwl +xTV18j2gAblZ+C283yY1FW54Fz/WF1s3cNucnRJDyAItxdfVOnoxY2cQiTxmWs5 8iSiFwcrRDgHeR0kBG94COiFCmd5dhUXPevbNM= 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=j+wvCmAOu3KL+xNyWyNekw8AsvFO2 1bb/k9I3teLA8Q=; b=I1J+zUpjwHKg2TLYSW13cH3+yuvh5+yYkcoc7uFYzTHOS Wy8y0WKezWaA/L5u0e2tBVb6IeVIArLasBxrjK8g7Kkq4+rEPBAIXMsMAPvmmdfe EyHnEWy7l7faGsnLoXivKQp+3yCHq8DT2r74wN7xWv5msfc9CvoqlnPN9Hz5Eth1 lFTu3DTcZECO8z3nUl9RWuIlBawztTanqwFst9wtPn3R9Y9j9NYshoNYFXclDS5G K/zgyr+IK+ZIGKxDC4zXhUUKZGvOcWmL5CfFMgEchl43ZPl/g6+QljxoQQsu9mZR pH+h3d9m6nxxtyAfW0jhTC7aNiI8pJfTmq7HvxpEg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 65FBCE4664; Tue, 29 Jan 2019 19:48:30 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:05 -0500 Message-Id: <20190130004811.27372-68-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 67/73] sparc: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Mark Cave-Ayland , Richard Henderson , Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Mark Cave-Ayland Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Acked-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota --- target/sparc/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 933fd8e954..b15f6ef180 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -708,6 +708,8 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } @@ -869,7 +871,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = sparc_cpu_class_by_name; cc->parse_features = sparc_cpu_parse_features; - cc->has_work = sparc_cpu_has_work; + cc->has_work_with_iothread_lock = sparc_cpu_has_work; cc->do_interrupt = sparc_cpu_do_interrupt; cc->cpu_exec_interrupt = sparc_cpu_exec_interrupt; cc->dump_state = sparc_cpu_dump_state; From patchwork Wed Jan 30 00:48:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 579381390 for ; Wed, 30 Jan 2019 01:37:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 478E92CC45 for ; Wed, 30 Jan 2019 01:37:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39AAF2D131; Wed, 30 Jan 2019 01:37:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD4062CC45 for ; Wed, 30 Jan 2019 01:37:04 +0000 (UTC) Received: from localhost ([127.0.0.1]:58496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeoJ-00075d-UE for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:37:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4C-0000TR-77 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4B-0001gn-7n for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:24 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48473) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4A-0001G2-VO for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 17894221D2; Tue, 29 Jan 2019 19:48:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:31 -0500 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=Oy2gHedvCAFDd06nczpInwMkHiFRl+HC6CD/K6XF9o0=; b=sp0AK 9NrB14A5RTCXWYo4y07UpxdUIc07I6iLirPZPWwtCaZADOk/S2YTTYZzrysz+62p VSQZDMVhnKfBb5r3mudy9ZnQ7McdSnQGNbuFbnB+rOaTOFbkdvTZ/V5oaBc5v9Fm PGJHckyqldhP35Ix4FILAJixubOSa75xnKtfLY= 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=Oy2gHedvCAFDd06nczpInwMkHiFRl +HC6CD/K6XF9o0=; b=Iq6JqBTrKsDdonM/fFULxDt0vaRZ2AUBnIFVBr/auR4UA Jb75AZY9j8EemxuWX/CW4jw8OrLmHrTfEGFpHwrLbyj7EJ64Hq1SLIKeo3mEOALk jsFR3IRYUTgQzXgf6vFyDQtbpiVG/xd/MgDZqrqhU7t0lHyMMPYepaQDoAjfiYmK Lu3pIcd5IheNsKgbpp1LYFcsLZSlVN41NN1Zf2OEqpQ+uRRk7kiCz5+lF90CeBr4 giOI1iuy5PWlUdyYPtMei+k6fJumiN+gqdZG6esbZlndRGV37K/l1bdFUI/Iw6OK 4mNAT0M4T4dujo26tNl4xPa+e8VwVF1ZxQ7LLV/Og== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 9662DE4667; Tue, 29 Jan 2019 19:48:30 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:06 -0500 Message-Id: <20190130004811.27372-69-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 68/73] xtensa: convert to cpu_has_work_with_iothread_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , Max Filippov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Soon we will call cpu_has_work without the BQL. Cc: Max Filippov Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota --- target/xtensa/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index d4ca35e6cc..5f3b4a70b0 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -47,6 +47,8 @@ static bool xtensa_cpu_has_work(CPUState *cs) #ifndef CONFIG_USER_ONLY XtensaCPU *cpu = XTENSA_CPU(cs); + g_assert(qemu_mutex_iothread_locked()); + return !cpu->env.runstall && cpu->env.pending_irq_level; #else return true; @@ -173,7 +175,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) cc->reset = xtensa_cpu_reset; cc->class_by_name = xtensa_cpu_class_by_name; - cc->has_work = xtensa_cpu_has_work; + cc->has_work_with_iothread_lock = xtensa_cpu_has_work; cc->do_interrupt = xtensa_cpu_do_interrupt; cc->cpu_exec_interrupt = xtensa_cpu_exec_interrupt; cc->dump_state = xtensa_cpu_dump_state; From patchwork Wed Jan 30 00:48:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A503C1390 for ; Wed, 30 Jan 2019 01:38:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 941702CD5B for ; Wed, 30 Jan 2019 01:38:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84F1E2D131; Wed, 30 Jan 2019 01:38:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07A022CD5B for ; Wed, 30 Jan 2019 01:38:27 +0000 (UTC) Received: from localhost ([127.0.0.1]:58510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goepe-0008NL-5T for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:38:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe4C-0000US-QR for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe4B-0001hU-Sy for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:24 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:38415) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe4B-0001GG-ND for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 314B9221FD; Tue, 29 Jan 2019 19:48:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:31 -0500 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=YVKbzMXZbxQNg5RU7QnENfVd8oX45srWiOEXLkGAJFc=; b=IxTaU rGvZclbwJ0+0Io9jRyj3dz+47S6AIoarfPZEkjxPN2EIB7QvV+JZRD/XUQlBMPrQ oYxV/InqdXK04AQwSQNYu8t1yw5gX6xN4ZdmLt1kmPLVUKOAXBiYtTVMQIKNVPQU EY72Qi2m3BCb58HUUfdnJdsn9zdrWvD+ACRt50= 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=YVKbzMXZbxQNg5RU7QnENfVd8oX45 srWiOEXLkGAJFc=; b=v0KPUTS4na5PSCj3dL0SZUXinKHYb94ln14jVruMKKjwI g2MKQ2Ck8BVF+h6PfAQ36y9oADWW4NUSbOOUhfjTsIIh3C+E972JhPML5eRFF9ta vD0TnG4P8LhPREg7CpmzjIZJnkTV9BZA4CehI78BZgLaDf+aGNENMG49ktqhFAer RLcsaxfjeblhh1r+Jnx/BnJOhdAyol9Oz70+RrXUsO/9LSsbcdRGsvwk/YdYcqyp CeasY74kV9DS8GAlY/97vUKYX+AT1RaHKYcn88q9bZ/mZ1zsz6iahtph7YP5WjAm sODfFeamYvsJs9GOXG1RUW2KPFbS18DnQlO6RBlpg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id D421AE446A; Tue, 29 Jan 2019 19:48:30 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:07 -0500 Message-Id: <20190130004811.27372-70-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 69/73] cpu: rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This function is only called from TCG rr mode, so add a prefix to mark this as well as an assertion. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- cpus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index aee129c0b3..0d255c2655 100644 --- a/cpus.c +++ b/cpus.c @@ -211,10 +211,12 @@ static bool cpu_thread_is_idle(CPUState *cpu) return true; } -static bool all_cpu_threads_idle(void) +static bool qemu_tcg_rr_all_cpu_threads_idle(void) { CPUState *cpu; + g_assert(qemu_is_tcg_rr()); + CPU_FOREACH(cpu) { if (!cpu_thread_is_idle(cpu)) { return false; @@ -692,7 +694,7 @@ void qemu_start_warp_timer(void) } if (replay_mode != REPLAY_MODE_PLAY) { - if (!all_cpu_threads_idle()) { + if (!qemu_tcg_rr_all_cpu_threads_idle()) { return; } @@ -1325,7 +1327,7 @@ static void qemu_tcg_rr_wait_io_event(void) { CPUState *cpu; - while (all_cpu_threads_idle()) { + while (qemu_tcg_rr_all_cpu_threads_idle()) { stop_tcg_kick_timer(); qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); } @@ -1659,7 +1661,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) atomic_mb_set(&cpu->exit_request, 0); } - if (use_icount && all_cpu_threads_idle()) { + if (use_icount && qemu_tcg_rr_all_cpu_threads_idle()) { /* * When all cpus are sleeping (e.g in WFI), to avoid a deadlock * in the main_loop, wake it up in order to start the warp timer. From patchwork Wed Jan 30 00:48:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30CF3922 for ; Wed, 30 Jan 2019 01:39:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CC392D30C for ; Wed, 30 Jan 2019 01:39:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CFD72D315; Wed, 30 Jan 2019 01:39:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B30142D30C for ; Wed, 30 Jan 2019 01:39:04 +0000 (UTC) Received: from localhost ([127.0.0.1]:58522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeqG-0000UD-1E for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:39:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe49-0000Pv-DI for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe46-0001cm-Sa for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:21 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51399) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe46-0001GH-MS for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9E80422200; Tue, 29 Jan 2019 19:48:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:31 -0500 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=QX6qHCWS4YKsSZlv/2OaEU933uANTU9kIxAI7S/kSso=; b=qNMht rq8ShXV4zneOm+cI6hs2wPUpT6JyFBChcW81j2nyVPJI+Wd8h/ULlNOQJ33Ft0EV ybBNSG90cK013xnJUdPpz4wCS0PVX/sOn6pd5Fg9DMgiHJzDkx8VO6kXnhxbQ2CS GWYvIV92iJux7XkQLg3h+KCL80oUjyMxqm0+NY= 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=QX6qHCWS4YKsSZlv/2OaEU933uANT U9kIxAI7S/kSso=; b=AhL34o3NMSUvHWbgSZk4pXfpWew+eH5nvaHeKPJl9c9jE X04mjIG02WFqKG4J4lYRqYA4ktFh5jLrtT8SrbwKqpVa/GRigrYPE9SdnwjYTbjW vR+BpMukc7Is2dJId7nkby713/GFJJXW4vtIi2hXnu57ojLpWutLToIdWfHlaGWU +Qfwd9j52DkvF9KZ6Z+GqMPtJXW+1+eDgSqGUta2ECh2L4Twwrmm+HQDhzZD5TMM Y9Xmqt9uOSf9o6bAU12wMIGDViQpA3HBYUqwjZGzEISPebEpav73s3RE+o8A39al Tqt21AXWIuLNqpvhbSKedwY2H3rn3/eASm+Q7RxLg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 15E11E4664; Tue, 29 Jan 2019 19:48:31 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:08 -0500 Message-Id: <20190130004811.27372-71-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 70/73] cpu: protect CPU state with cpu->lock instead of the BQL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use the per-CPU locks to protect the CPUs' state, instead of using the BQL. These locks are uncontended (they are mostly acquired by the corresponding vCPU thread), so acquiring them is cheaper than acquiring the BQL, which particularly in MTTCG can be contended at high core counts. In this conversion we drop qemu_cpu_cond and qemu_pause_cond, and use cpu->cond instead. In qom/cpu.c we can finally remove the ugliness that results from having to hold both the BQL and the CPU lock; now we just have to grab the CPU lock. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- include/qom/cpu.h | 20 ++-- cpus.c | 280 ++++++++++++++++++++++++++++++++++------------ qom/cpu.c | 29 +---- 3 files changed, 225 insertions(+), 104 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 27a80bc113..30ed2fae0b 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -297,10 +297,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. @@ -329,6 +325,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). @@ -352,12 +352,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; @@ -371,7 +366,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; @@ -419,7 +420,6 @@ struct CPUState { /* TODO Move common fields from CPUArchState here. */ int cpu_index; int cluster_index; - uint32_t halted; uint32_t can_do_io; int32_t exception_index; diff --git a/cpus.c b/cpus.c index 0d255c2655..4f17fe25bf 100644 --- a/cpus.c +++ b/cpus.c @@ -181,24 +181,30 @@ 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)) { @@ -216,9 +222,17 @@ static bool qemu_tcg_rr_all_cpu_threads_idle(void) CPUState *cpu; g_assert(qemu_is_tcg_rr()); + g_assert(qemu_mutex_iothread_locked()); + g_assert(no_cpu_mutex_locked()); CPU_FOREACH(cpu) { - if (!cpu_thread_is_idle(cpu)) { + bool is_idle; + + cpu_mutex_lock(cpu); + is_idle = cpu_thread_is_idle(cpu); + cpu_mutex_unlock(cpu); + + if (!is_idle) { return false; } } @@ -780,6 +794,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; } @@ -1090,6 +1106,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); @@ -1102,6 +1119,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); } @@ -1204,6 +1222,8 @@ int vm_shutdown(void) static bool cpu_can_run(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + if (cpu->stop) { return false; } @@ -1276,16 +1296,9 @@ static void qemu_init_sigbus(void) static QemuThread io_thread; -/* cpu creation */ -static QemuCond qemu_cpu_cond; -/* system init */ -static QemuCond qemu_pause_cond; - void qemu_init_cpu_loop(void) { qemu_init_sigbus(); - qemu_cond_init(&qemu_cpu_cond); - qemu_cond_init(&qemu_pause_cond); qemu_mutex_init(&qemu_global_mutex); qemu_thread_get_self(&io_thread); @@ -1303,46 +1316,70 @@ static void qemu_tcg_destroy_vcpu(CPUState *cpu) { } -static void qemu_cpu_stop(CPUState *cpu, bool exit) +static void qemu_cpu_stop_locked(CPUState *cpu, bool exit) { + g_assert(cpu_mutex_locked(cpu)); g_assert(qemu_cpu_is_self(cpu)); cpu->stop = false; cpu->stopped = true; if (exit) { cpu_exit(cpu); } - qemu_cond_broadcast(&qemu_pause_cond); + qemu_cond_broadcast(&cpu->cond); +} + +static void qemu_cpu_stop(CPUState *cpu, bool exit) +{ + cpu_mutex_lock(cpu); + qemu_cpu_stop_locked(cpu, exit); + cpu_mutex_unlock(cpu); } static void qemu_wait_io_event_common(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + atomic_mb_set(&cpu->thread_kicked, false); if (cpu->stop) { - qemu_cpu_stop(cpu, false); + qemu_cpu_stop_locked(cpu, false); } + /* + * unlock+lock cpu_mutex, so that other vCPUs have a chance to grab the + * lock and queue some work for this vCPU. + */ + cpu_mutex_unlock(cpu); process_queued_cpu_work(cpu); + cpu_mutex_lock(cpu); } static void qemu_tcg_rr_wait_io_event(void) { CPUState *cpu; + g_assert(qemu_mutex_iothread_locked()); + g_assert(no_cpu_mutex_locked()); + while (qemu_tcg_rr_all_cpu_threads_idle()) { stop_tcg_kick_timer(); - qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(first_cpu->halt_cond, first_cpu->lock); } start_tcg_kick_timer(); CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); qemu_wait_io_event_common(cpu); + cpu_mutex_unlock(cpu); } } 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 @@ -1362,6 +1399,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; @@ -1374,14 +1412,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); } @@ -1389,10 +1433,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; } @@ -1409,7 +1459,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; @@ -1420,10 +1470,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); @@ -1432,10 +1482,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 @@ -1466,6 +1517,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); @@ -1546,12 +1599,15 @@ static void deal_with_unplugged_cpus(void) CPUState *cpu; CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); if (cpu->unplug && !cpu_can_run(cpu)) { qemu_tcg_destroy_vcpu(cpu); cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); break; } + cpu_mutex_unlock(cpu); } } @@ -1572,24 +1628,36 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) rcu_register_thread(); tcg_register_thread(); + /* + * We call cpu_mutex_lock/unlock just to please the assertions in common + * code, since here cpu->lock is an alias to the BQL. + */ qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); - cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); /* 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); start_tcg_kick_timer(); @@ -1616,7 +1684,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; @@ -1627,6 +1700,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); @@ -1634,11 +1708,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(); @@ -1648,11 +1725,15 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) if (cpu->unplug) { cpu = CPU_NEXT(cpu); } + cpu_mutex_unlock(current_cpu); break; } + cpu_mutex_unlock(cpu); cpu = CPU_NEXT(cpu); - } /* while (cpu && !cpu->exit_request).. */ + } /* for (;;) .. */ + + g_assert(no_cpu_mutex_locked()); /* Does not need atomic_mb_set because a spurious wakeup is okay. */ atomic_set(&tcg_current_rr_cpu, NULL); @@ -1684,6 +1765,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) rcu_register_thread(); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); @@ -1692,11 +1774,17 @@ static void *qemu_hax_cpu_thread_fn(void *arg) current_cpu = cpu; hax_init_vcpu(cpu); - qemu_cond_signal(&qemu_cpu_cond); + qemu_mutex_unlock_iothread(); + qemu_cond_signal(&cpu->cond); 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); } @@ -1704,6 +1792,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; } @@ -1721,6 +1811,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(); @@ -1728,14 +1819,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); } @@ -1743,10 +1840,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; } @@ -1759,6 +1862,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; @@ -1768,28 +1872,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; } @@ -1817,14 +1933,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; @@ -1832,9 +1948,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); @@ -1850,9 +1966,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) g_assert(cpu_halted(cpu)); break; case EXCP_ATOMIC: - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); cpu_exec_step_atomic(cpu); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); default: /* Ignore everything else? */ break; @@ -1865,8 +1981,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; } @@ -1966,54 +2082,69 @@ void qemu_mutex_unlock_iothread(void) } } -static bool all_vcpus_paused(void) -{ - CPUState *cpu; - - CPU_FOREACH(cpu) { - if (!cpu->stopped) { - return false; - } - } - - return true; -} - void pause_all_vcpus(void) { CPUState *cpu; + g_assert(no_cpu_mutex_locked()); + qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false); CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); if (qemu_cpu_is_self(cpu)) { qemu_cpu_stop(cpu, true); } else { cpu->stop = true; qemu_cpu_kick(cpu); } + cpu_mutex_unlock(cpu); } + drop_locks_and_stop_all_vcpus: /* We need to drop the replay_lock so any vCPU threads woken up * can finish their replay tasks */ replay_mutex_unlock(); + qemu_mutex_unlock_iothread(); - while (!all_vcpus_paused()) { - qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex); - CPU_FOREACH(cpu) { + CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); + if (!cpu->stopped) { + cpu->stop = true; qemu_cpu_kick(cpu); + qemu_cond_wait(&cpu->cond, cpu->lock); } + cpu_mutex_unlock(cpu); } - qemu_mutex_unlock_iothread(); replay_mutex_lock(); qemu_mutex_lock_iothread(); + + /* a CPU might have been hot-plugged while we weren't holding the BQL */ + CPU_FOREACH(cpu) { + bool stopped; + + cpu_mutex_lock(cpu); + stopped = cpu->stopped; + cpu_mutex_unlock(cpu); + + if (!stopped) { + goto drop_locks_and_stop_all_vcpus; + } + } } void cpu_resume(CPUState *cpu) { - cpu->stop = false; - cpu->stopped = false; + if (cpu_mutex_locked(cpu)) { + cpu->stop = false; + cpu->stopped = false; + } else { + cpu_mutex_lock(cpu); + cpu->stop = false; + cpu->stopped = false; + cpu_mutex_unlock(cpu); + } qemu_cpu_kick(cpu); } @@ -2029,8 +2160,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); @@ -2211,9 +2345,15 @@ void qemu_init_vcpu(CPUState *cpu) qemu_dummy_start_vcpu(cpu); } + qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); while (!cpu->created) { - qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); + qemu_cond_wait(&cpu->cond, cpu->lock); } + cpu_mutex_unlock(cpu); + + qemu_mutex_lock_iothread(); } void cpu_stop_current(void) diff --git a/qom/cpu.c b/qom/cpu.c index f2695be9b2..65b070a570 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -94,32 +94,13 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, error_setg(errp, "Obtaining memory mappings is unsupported on this CPU."); } -/* Resetting the IRQ comes from across the code base so we take the - * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool has_bql = qemu_mutex_iothread_locked(); - bool has_cpu_lock = cpu_mutex_locked(cpu); - - if (has_bql) { - if (has_cpu_lock) { - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - } else { - cpu_mutex_lock(cpu); - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - cpu_mutex_unlock(cpu); - } - return; - } - - if (has_cpu_lock) { - cpu_mutex_unlock(cpu); - } - qemu_mutex_lock_iothread(); - cpu_mutex_lock(cpu); - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - qemu_mutex_unlock_iothread(); - if (!has_cpu_lock) { + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + } else { + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); cpu_mutex_unlock(cpu); } } From patchwork Wed Jan 30 00:48:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BB04922 for ; Wed, 30 Jan 2019 01:37:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BD372CD5B for ; Wed, 30 Jan 2019 01:37:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F93D2D131; Wed, 30 Jan 2019 01:37:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3F052CD5B for ; Wed, 30 Jan 2019 01:37:31 +0000 (UTC) Received: from localhost ([127.0.0.1]:58500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeol-0007Ui-A5 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:37:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe47-0000NH-2w for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe46-0001c4-6s for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41377) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe46-0001HV-1w for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:18 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AFA4D22203; Tue, 29 Jan 2019 19:48:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:31 -0500 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=yX5BV8uoDdB3SqyNiosF/J7VeH5BcN2lT+cKn4Idt60=; b=xRzUB GkMNDiMictdI9hnbDeotu8LWNNlciYPsBvM1CDF1rpX5abd2d7ntOKJl+srGad7b Ecgxz6BSCyjW83T/z3IvuaeOls9Y/Iqr9z75LbwPq/zgYXohXnAx01E045T9NspW h9ZUxiCfBNwJNnZUA0Ekz9XU0efRM/SR0uMEzw= 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=yX5BV8uoDdB3SqyNiosF/J7VeH5Bc N2lT+cKn4Idt60=; b=LunISpXENmLBnfHhd/7LhdlTlmmeemMWsQ1tcb9pP5QNd Y37hp2/yczuBxqUZyA42nsrh9wotdgDgIUqL0zaKqMLcWk2jvJLoJ9ZdL6DmWCOR 60F3W9Zpy8v8il3I0dmudiFFRo9nRXw56moxtqCrk+tiCDsO+gNQXWnT/YvmN+D5 8tIGaM/PNHUHn9SYB39kHLQBXIuQjG8jqXgTg5aU1qpiSnAWPeQsJOBWSOkUNDOQ lybEyBFMREjhckuwMYuo1+hLN24ySM0TP8WUOTGlhXHjh9JxEIzkHVv7BWCXOTV6 cadEp7AT1/XUpQOHRV6YgY/50aAluLM/SMyG8pb1w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 595A1E446A; Tue, 29 Jan 2019 19:48:31 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:09 -0500 Message-Id: <20190130004811.27372-72-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 71/73] cpus-common: release BQL earlier in run_on_cpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 62e282bff1..1241024b2c 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -145,6 +145,11 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) return; } + /* We are going to sleep on the CPU lock, so release the BQL */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + wi.func = func; wi.data = data; wi.done = false; @@ -153,21 +158,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); - - /* - * We are going to sleep on the CPU lock, so release the BQL. - * - * During the transition to per-CPU locks, we release the BQL _after_ - * having kicked the destination CPU (from queue_work_on_cpu_locked above). - * This makes sure that the enqueued work will be seen by the CPU - * after being woken up from the kick, since the CPU sleeps on the BQL. - * Once we complete the transition to per-CPU locks, we will release - * the BQL earlier in this function. - */ - if (has_bql) { - qemu_mutex_unlock_iothread(); - } - while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; From patchwork Wed Jan 30 00:48:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5A8313B4 for ; Wed, 30 Jan 2019 01:34:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7D0C2C35E for ; Wed, 30 Jan 2019 01:34:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBA3D22B26; Wed, 30 Jan 2019 01:34:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 454BD22B26 for ; Wed, 30 Jan 2019 01:34:18 +0000 (UTC) Received: from localhost ([127.0.0.1]:58440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goeld-0004XB-Fh for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:34:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe49-0000QY-PV for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe48-0001eZ-R4 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:21 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55213) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe48-0001HW-MV for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:20 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 133F42211F; Tue, 29 Jan 2019 19:48:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:32 -0500 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=zATs2ANPjN3p6xLoLz8Cgyl8hjsMkcF5SoAMeXeCMHA=; b=g2Ak5 9DoZ18fW3srtjKbSDKVxT9hUH7X0bjd2DIUOYHRbgE8+nSKNQmcW5ISQi3w7r9WR Wh1Poywp+4lofFxIYdqItJ1E3Gv+iEZh0Vc+z3qPegk4ezLA+8zgliva4UQvrA16 E0LzEjjFvkSvXIo6+Kg+bIHdPX4XMK36FBIc7s= 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=zATs2ANPjN3p6xLoLz8Cgyl8hjsMk cF5SoAMeXeCMHA=; b=farW4QcPmSn39+p3l983eto4Ux70Y9pn0LmHoSGsMqLuO yzNaIVBEkDkkou7deasQbSwPT9uDnTR0HXRJhS//IIDCJmjvUxNnMSrA+Ooj2ftm 4zbBzthFWG2hLbBnwjOxNg/sS0vFP9+9toHo+fIXOVDnJr6ivGj8hhcLjMkWrtxa 3tMx1rcfLxrEwhsMSBt/YBsDuRGfohb/a1gnkFvR3kp3gAJqhGzAUhvGwsQnh0dn 0zSnKOi85SYaU/ByA6NhUtigpu/4CV9j//8b+XOnx4m4vCY8M6vIQYBBI92/BLEN sYdYUDJmeQPpZl+VGgjbicodFLmbNinyy0Rul/poQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojg hfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcuoegt ohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeinecurf grrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhushht vghrufhiiigvpeduje X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id A9A69E4667; Tue, 29 Jan 2019 19:48:31 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:10 -0500 Message-Id: <20190130004811.27372-73-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 72/73] cpu: add async_run_on_cpu_no_bql X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some async jobs do not need the BQL. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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 30ed2fae0b..bb0729f969 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -884,9 +884,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 1241024b2c..5832a8bf37 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -109,6 +109,7 @@ struct qemu_work_item { run_on_cpu_func func; run_on_cpu_data data; bool free, exclusive, done; + bool bql; }; /* Called with the CPU's lock held */ @@ -155,6 +156,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi.done = false; wi.free = false; wi.exclusive = false; + wi.bql = true; cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); @@ -179,6 +181,21 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi->func = func; wi->data = data; wi->free = true; + wi->bql = true; + + queue_work_on_cpu(cpu, wi); +} + +void async_run_on_cpu_no_bql(CPUState *cpu, run_on_cpu_func func, + run_on_cpu_data data) +{ + struct qemu_work_item *wi; + + wi = g_malloc0(sizeof(struct qemu_work_item)); + wi->func = func; + wi->data = data; + wi->free = true; + /* wi->bql initialized to false */ queue_work_on_cpu(cpu, wi); } @@ -323,6 +340,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, wi->data = data; wi->free = true; wi->exclusive = true; + /* wi->bql initialized to false */ queue_work_on_cpu(cpu, wi); } @@ -347,6 +365,7 @@ static void process_queued_cpu_work_locked(CPUState *cpu) * BQL, so it goes to sleep; start_exclusive() is sleeping too, so * neither CPU can proceed. */ + g_assert(!wi->bql); if (has_bql) { qemu_mutex_unlock_iothread(); } @@ -357,12 +376,22 @@ static void process_queued_cpu_work_locked(CPUState *cpu) qemu_mutex_lock_iothread(); } } else { - if (has_bql) { - wi->func(cpu, wi->data); + if (wi->bql) { + if (has_bql) { + wi->func(cpu, wi->data); + } else { + qemu_mutex_lock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_unlock_iothread(); + } } else { - qemu_mutex_lock_iothread(); - wi->func(cpu, wi->data); - qemu_mutex_unlock_iothread(); + if (has_bql) { + qemu_mutex_unlock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_lock_iothread(); + } else { + wi->func(cpu, wi->data); + } } } cpu_mutex_lock(cpu); From patchwork Wed Jan 30 00:48:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10787535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CD7C1390 for ; Wed, 30 Jan 2019 01:40:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A3D72D5E5 for ; Wed, 30 Jan 2019 01:40:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D6162D619; Wed, 30 Jan 2019 01:40:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADB432D5E5 for ; Wed, 30 Jan 2019 01:40:28 +0000 (UTC) Received: from localhost ([127.0.0.1]:58524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goerb-0000aB-S6 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Jan 2019 20:40:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goe49-0000Qq-V9 for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goe48-0001ei-Up for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:21 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55237) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goe48-0001Hq-QK for qemu-devel@nongnu.org; Tue, 29 Jan 2019 19:49:20 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6D48522089; Tue, 29 Jan 2019 19:48:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 29 Jan 2019 19:48:32 -0500 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=X6K0Rt6gDdodrkG8IJ1vxkEL3ujtiw2f/+wvDGg5KMs=; b=uZeQz lcDJAAQ3fdHM6eIAiA4fS3juJDSUOARlBrWHUzhmHZGj0ON5fyHtvTPFCxobHYh5 TTzzrxFLWtWoKMOvmkNimUPf+AcIW/vKBS1GD/vE2+LZLAs9glaN9HnWv/sXI1EY 8We52jm5cW6sbhHp/kPgiQhcIwijpGV4z5xLms= 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=X6K0Rt6gDdodrkG8IJ1vxkEL3ujti w2f/+wvDGg5KMs=; b=xFREtlrCbZOQDF4ACmWjxzOF3XyXM2HwBE3vsDDeG8tU9 heM6tlo4RL2Ja9uFiFhjeR8hDuPXmX+gVbAQnjUATh8FLEYphwOGCSrTeyjFtE5A eRNY2u5JfSnpgtkeVlvwr8cf4+EFIJAopCp+I/K+KihaXbeXwZnpZUqw5naKb+Bj d2vbG4LeJlCBIS1EG5LXvzlsp6Oy/OrJ+MJh3itUUqWwSsjnQRPfwDQ3LufNNPfF r5+DjFRMbA9rUMYvAbqYtP8fFJwa+dbyrbPHdCUsGoU73ie+WnGEVsTY3EMD0iPo pNyS4pZIV52mle+/JxuQHjAXkDaTRaaIH6aBr9ogA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjeefgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegoufhushhpvggtthffohhmrg hinhculdegledmnecujfgurhephffvufffkffojghfsedttdertdertddtnecuhfhrohhm pedfgfhmihhlihhoucfirdcuvehothgrfdcuoegtohhtrgessghrrggrphdrohhrgheqne cuffhomhgrihhnpehimhhguhhrrdgtohhmnecukfhppeduvdekrdehledrvddtrddvudei necurfgrrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id DECCAE446A; Tue, 29 Jan 2019 19:48:31 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 29 Jan 2019 19:48:11 -0500 Message-Id: <20190130004811.27372-74-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190130004811.27372-1-cota@braap.org> References: <20190130004811.27372-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.25 Subject: [Qemu-devel] [PATCH v6 73/73] cputlb: queue async flush jobs without the BQL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This yields sizable scalability improvements, as the below results show. Host: Two Intel E5-2683 v3 14-core CPUs at 2.00 GHz (Haswell) Workload: Ubuntu 18.04 ppc64 compiling the linux kernel with "make -j N", where N is the number of cores in the guest. Speedup vs a single thread (higher is better): 14 +---------------------------------------------------------------+ | + + + + + + $$$$$$ + | | $$$$$ | | $$$$$$ | 12 |-+ $A$$ +-| | $$ | | $$$ | 10 |-+ $$ ##D#####################D +-| | $$$ #####**B**************** | | $$####***** ***** | | A$#***** B | 8 |-+ $$B** +-| | $$** | | $** | 6 |-+ $$* +-| | A** | | $B | | $ | 4 |-+ $* +-| | $ | | $ | 2 |-+ $ +-| | $ +cputlb-no-bql $$A$$ | | A +per-cpu-lock ##D## | | + + + + + + baseline **B** | 0 +---------------------------------------------------------------+ 1 4 8 12 16 20 24 28 Guest vCPUs png: https://imgur.com/zZRvS7q Some notes: - baseline corresponds to the commit before this series - per-cpu-lock is the commit that converts the CPU loop to per-cpu locks. - cputlb-no-bql is this commit. - I'm using taskset to assign cores to threads, favouring locality whenever possible but not using SMT. When N=1, I'm using a single host core, which leads to superlinear speedups (since with more cores the I/O thread can execute while vCPU threads sleep). In the future I might use N+1 host cores for N guest cores to avoid this, or perhaps pin guest threads to cores one-by-one. Single-threaded performance is affected very lightly. Results below for debian aarch64 bootup+test for the entire series on an Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz host: - Before: Performance counter stats for 'taskset -c 0 ../img/aarch64/die.sh' (10 runs): 7269.033478 task-clock (msec) # 0.998 CPUs utilized ( +- 0.06% ) 30,659,870,302 cycles # 4.218 GHz ( +- 0.06% ) 54,790,540,051 instructions # 1.79 insns per cycle ( +- 0.05% ) 9,796,441,380 branches # 1347.695 M/sec ( +- 0.05% ) 165,132,201 branch-misses # 1.69% of all branches ( +- 0.12% ) 7.287011656 seconds time elapsed ( +- 0.10% ) - After: 7375.924053 task-clock (msec) # 0.998 CPUs utilized ( +- 0.13% ) 31,107,548,846 cycles # 4.217 GHz ( +- 0.12% ) 55,355,668,947 instructions # 1.78 insns per cycle ( +- 0.05% ) 9,929,917,664 branches # 1346.261 M/sec ( +- 0.04% ) 166,547,442 branch-misses # 1.68% of all branches ( +- 0.09% ) 7.389068145 seconds time elapsed ( +- 0.13% ) That is, a 1.37% slowdown. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Bennée Tested-by: Alex Bennée Reviewed-by: Richard Henderson --- accel/tcg/cputlb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index dad9b7796c..8491d36bcf 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -260,7 +260,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); } } } @@ -336,8 +336,8 @@ void tlb_flush_by_mmuidx(CPUState *cpu, uint16_t idxmap) tlb_debug("mmu_idx: 0x%" PRIx16 "\n", idxmap); if (cpu->created && !qemu_cpu_is_self(cpu)) { - async_run_on_cpu(cpu, tlb_flush_by_mmuidx_async_work, - RUN_ON_CPU_HOST_INT(idxmap)); + async_run_on_cpu_no_bql(cpu, tlb_flush_by_mmuidx_async_work, + RUN_ON_CPU_HOST_INT(idxmap)); } else { tlb_flush_by_mmuidx_async_work(cpu, RUN_ON_CPU_HOST_INT(idxmap)); } @@ -481,8 +481,8 @@ 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_flush_page_by_mmuidx_async_work, - RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); + async_run_on_cpu_no_bql(cpu, tlb_flush_page_by_mmuidx_async_work, + RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); } else { tlb_flush_page_by_mmuidx_async_work( cpu, RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx));