From patchwork Thu May 21 16:38:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563427 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3551913 for ; Thu, 21 May 2020 16:44:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AC8520826 for ; Thu, 21 May 2020 16:44:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JVQoXxuE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AC8520826 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboIa-0003Hh-JU for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:44:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboHt-0001bI-Ea for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:17 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:33114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboHs-0006Sv-Cx for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:17 -0400 Received: by mail-qv1-xf41.google.com with SMTP id er16so3384169qvb.0 for ; Thu, 21 May 2020 09:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gyX/K3LZb5/HWyZyTqUsQNfRcZPtWqUo2ougwCy84HA=; b=JVQoXxuEkUhrInGqG7dGcf9ha9WeUZ+vQrLz4RZGpRZsQG4UTuiMWud6rxRiVvIfu/ 8ss8QVhh5EUkN0NLcLg0CmK3LhPLJmsDmoBKE3XjVx1m9QnIEC3yFAT5uJmBTIQ6rMgR UdrcjlYGW26pJBhUrA7Rkmfq9ddPUFl5r+H808WZa1HSctuNgJhl9TqVReXBha89EblV txvSx50s+lCRmMT1sqsUK5MN+MPSbrVv4ipjQ1cYTRgwpqQci92nvv+S4RKvadcXmOWk 985qknzYF3XLq9k5HjjJoPwtINYTPGDm7p6e8kjwd+R5lxtuYpu66nFHfTOc3/yXjUOy DCeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gyX/K3LZb5/HWyZyTqUsQNfRcZPtWqUo2ougwCy84HA=; b=RdWCBe03j1mcOQ2vdD6P/T5slnz42hPXMq0AyC4kR8NyIcsrPRQjQ2aZpPlW5tOtHK GlHV/EauoO9NihuH8dn1TL03G+YVuIvYkufX6q2MH92GtUAE4PpETgHOAibXfv2YG1z4 xOYUujHV3t3tRuHhNQDWed9ekAUjzlmUk2O27BWr2z67oeqllJE04iTUnXlrWSAIGozr fmIoucTn3RbOhgppkCF/fCto9u5uBoR10cJJVtilSVfaT3IvDgp3xeZWXqANL9FRH+ny x+Xx/P3Y/hAWcnVu3uyIcSlS4+eYWtsVX5+AuoBhlG32Xhbb5CImMtb9rqxeWmVZrXkv LBcg== X-Gm-Message-State: AOAM530Ss88WPYRi1J7PCd3DOCKRk9isYR+Pb1O9HFX4UBaoQHy+VFzb 7TceZXSwbE+xrGdUdVnQWtZ10HDgZsOpdA== X-Google-Smtp-Source: ABdhPJy28RL6fv7Gilpp9hLiRI9fX7tQ6P36lhglUgYWwsczPtWoYDO4q7THnbMR5Jb2lubQIqDHZQ== X-Received: by 2002:a0c:f286:: with SMTP id k6mr3207941qvl.72.1590079394965; Thu, 21 May 2020 09:43:14 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:14 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 01/74] cpu: convert queued work to a QSIMPLEQ Date: Thu, 21 May 2020 12:38:58 -0400 Message-Id: <20200521164011.638-2-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" 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 Signed-off-by: Robert Foley --- cpus-common.c | 25 ++++++++----------------- cpus.c | 14 ++++++++++++-- hw/core/cpu.c | 1 + include/hw/core/cpu.h | 6 +++--- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 55d5df8923..210fc7fc39 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -97,7 +97,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; @@ -106,13 +106,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); @@ -306,17 +300,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 5670c96bcf..af44027549 100644 --- a/cpus.c +++ b/cpus.c @@ -97,9 +97,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)) { @@ -1498,7 +1508,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/hw/core/cpu.c b/hw/core/cpu.c index 5284d384fb..77703d62b7 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -368,6 +368,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); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 07f7698155..d78ff1d165 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -331,8 +331,8 @@ struct qemu_work_item; * @opaque: User data. * @mem_io_pc: Host Program Counter at which the memory was accessed. * @kvm_fd: vCPU file descriptor for KVM. - * @work_mutex: Lock to prevent multiple access to 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). @@ -376,7 +376,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; From patchwork Thu May 21 16:38:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563429 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 726C1913 for ; Thu, 21 May 2020 16:44:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 494EC2072C for ; Thu, 21 May 2020 16:44:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kZidtQ0X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 494EC2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboId-0003Ky-Dj for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:44:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboHu-0001bi-JE for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:18 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:45672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboHt-0006T4-IM for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:18 -0400 Received: by mail-qk1-x742.google.com with SMTP id i5so7786049qkl.12 for ; Thu, 21 May 2020 09:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bON7YUxlhwgscX2SUVnZ4d6zlp9keY1L8USoWVcvoFg=; b=kZidtQ0XENdeengyKKW4whn3w3BbFo8YAwMqvx5iCkzwRhHySJ6WNbeEEBV9SLiM4p 3dY/l1Ix/L/OzICp0SH2GNfc0SNqx9sQqfAIEskmmRYjLuhpIw9LaoRzKzT+ND8r/n2k Guf3KKhTPDlCkaJOq/7rjUWwnCocoDCYuJ8NKvXwzftHxSmJ3V83qqtQ59xC8B+Haf7s 3DRP1EyOLMI9cm7883IuuRcxAqtVgxZWQU4YEJ7u7EO//cS3LKnxFMOr+9QX60/wSC5m h9TUbFzLloi9gzijPehgfrd385Ztj298vJn/RuNZhgRV9l9J2G9Jc5a8hrk1WAygY6Wf DNKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bON7YUxlhwgscX2SUVnZ4d6zlp9keY1L8USoWVcvoFg=; b=Bh2mZbArXLa2ypSOe3RXVkDSf6wgfBLpG7eNxyH7gKYy9bspvYob96cKxBO5pk4g7N dzdPCN4U1sj8e9lSpQ1LyUmLUqbBL5aem4sMzdbr1Fp2yTgastzUpmGCwtJz6T/pPxWN LsIeKyg5T2mH5YCMyIIRVfx11Za+kNPMss3aOvN7bVtZzuZugYwscaraUUH9fPk9pus0 feffF9gbjSNlTNaDv9zXBolYt3IpT+RpUlVgvXYuliZ53B8wrDxnxnnCwincd/wDyoKQ 5FYrQHW/nEpq5wyGWaQ7yzQ7SlFDIJaJnciqUU15r5yvVDwBC7B8T2AjaF+iCRIHMBvD BD6A== X-Gm-Message-State: AOAM533p8wdi2n+CH1joqmqr9GY0jK8t1KZbt/Njyq97sFmeqJCxZ0rJ s7QMF7sbz3d+8FCBmz/VrBaQ7FTgbSuKMA== X-Google-Smtp-Source: ABdhPJyWocePND1w9eVhDHgqmbLFLBR00tujlFaGNijLepzgdvSHnUAK8NBlHiP2m3pkSiJpo4t2aA== X-Received: by 2002:a37:f517:: with SMTP id l23mr10957493qkk.475.1590079396278; Thu, 21 May 2020 09:43:16 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:15 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 02/74] cpu: rename cpu->work_mutex to cpu->lock Date: Thu, 21 May 2020 12:38:59 -0400 Message-Id: <20200521164011.638-3-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This lock will soon protect more fields of the struct. Give it a more appropriate name. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 14 +++++++------- cpus.c | 4 ++-- hw/core/cpu.c | 4 ++-- include/hw/core/cpu.h | 6 ++++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 210fc7fc39..34025923e3 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -105,10 +105,10 @@ struct qemu_work_item { static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) { - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); QSIMPLEQ_INSERT_TAIL(&cpu->work_list, wi, node); wi->done = false; - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); qemu_cpu_kick(cpu); } @@ -300,15 +300,15 @@ void process_queued_cpu_work(CPUState *cpu) { struct qemu_work_item *wi; - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); return; } while (!QSIMPLEQ_EMPTY(&cpu->work_list)) { wi = QSIMPLEQ_FIRST(&cpu->work_list); QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node); - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); if (wi->exclusive) { /* Running work items outside the BQL avoids the following deadlock: * 1) start_exclusive() is called with the BQL taken while another @@ -324,13 +324,13 @@ void process_queued_cpu_work(CPUState *cpu) } else { wi->func(cpu, wi->data); } - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); if (wi->free) { g_free(wi); } else { atomic_mb_set(&wi->done, true); } } - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); qemu_cond_broadcast(&qemu_work_cond); } diff --git a/cpus.c b/cpus.c index af44027549..77a2d7b7cf 100644 --- a/cpus.c +++ b/cpus.c @@ -101,9 +101,9 @@ static inline bool cpu_work_list_empty(CPUState *cpu) { bool ret; - qemu_mutex_lock(&cpu->work_mutex); + qemu_mutex_lock(&cpu->lock); ret = QSIMPLEQ_EMPTY(&cpu->work_list); - qemu_mutex_unlock(&cpu->work_mutex); + qemu_mutex_unlock(&cpu->lock); return ret; } diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 77703d62b7..4d58399cfc 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -367,7 +367,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); @@ -379,7 +379,7 @@ static void cpu_common_finalize(Object *obj) { CPUState *cpu = CPU(obj); - qemu_mutex_destroy(&cpu->work_mutex); + qemu_mutex_destroy(&cpu->lock); } static int64_t cpu_common_get_arch_id(CPUState *cpu) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d78ff1d165..873bf23a39 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -331,7 +331,8 @@ struct qemu_work_item; * @opaque: User data. * @mem_io_pc: Host Program Counter at which the memory was accessed. * @kvm_fd: vCPU file descriptor for KVM. - * @work_mutex: Lock to prevent multiple access to @work_list. + * @lock: Lock to prevent multiple access to per-CPU fields. Must be acquired + * after the BQL. * @work_list: List of pending asynchronous work. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). @@ -375,7 +376,8 @@ struct CPUState { uint64_t random_seed; sigjmp_buf jmp_env; - QemuMutex work_mutex; + QemuMutex lock; + /* fields below protected by @lock */ QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; From patchwork Thu May 21 16:39:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29E1F739 for ; Thu, 21 May 2020 16:45:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2C652072C for ; Thu, 21 May 2020 16:45:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="q3/we0bW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2C652072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboKI-0007Kr-S3 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:45:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboHx-0001cv-Gb for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:21 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:41268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboHv-0006TF-6E for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:21 -0400 Received: by mail-qt1-x844.google.com with SMTP id m44so5980524qtm.8 for ; Thu, 21 May 2020 09:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XkuJ6MkZisGtrqNcI/WmjmrJib8LTmp/yxFiG3GQPeA=; b=q3/we0bWpMx2wZYtvNo7PDfKbGGLd1MU7T2yd8K3VQCepk6ILUxIUVlKeYd2TKHYva DbwPOgaKDfpYeqFy87uJ8NBd4ZgWHpIdY/rxr86qceO5fF/VDPKhTwiNOkQja8pToIJR LKRaH+xnVRWTbkKVo0auD2RtPpg6ieznb3DND5XPHt3B5VVyG7orv749L3IbxCqMeN70 LyddUZe5/Kdlwx6zjb06cj0xynwcGt2M4rIzRbk21X6zTM5bd1AvROjJU/9TC0C1HAhm YK75CqBOoyNlZ7/T9SK6StIPnjh+st4UVAoQVseT7REkwtVe2V7s/whfWdHqIJP0CgDI u2XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XkuJ6MkZisGtrqNcI/WmjmrJib8LTmp/yxFiG3GQPeA=; b=TFAgyS112mauIQPte9gKJCT+FtYnmALU290UWrg2EzXtdRlJVI+J4cHhSQQKPLNiUq mWeVKijaOWK1t98HcNvQnU5Yqu7rwkka5modmxARGSb85XVtKKO5oEt16YDqkFEf/keG oX80YcXYQFH/Zc2vuBSpghI0M0Jy6pCKhFzzVFHqUgfRgSkroEsOCmNmhWZPbhy0Oh0x xSBIJff1Q/h4syiWcb9vW9ZKztsrSLRVaZkveS6bVUQT1RVvcObhqm5vvQN+hoEmV4QS wpWcwDOxdwiLDbdJhBMIGcDRMtnenH/DCe/Opr07lzj5YbkWd1R02jP1FpE5WFoVuk1F LN4w== X-Gm-Message-State: AOAM5314x4TDST4nTLTkYQ4bFK4l9bdXSWWRB79TWTHYc+RYI0c1Y/uq 4U+BmmVSYkhaTzLnsD9FqZCFYgG+f28HBA== X-Google-Smtp-Source: ABdhPJzVzUwKTxuOR8q6Lhlfvb+TG02ayREFkvuJz6uDhW3g1IOY0w5Zc+M3uyDgyOvXFljDSG1zYg== X-Received: by 2002:ac8:4f4e:: with SMTP id i14mr11835684qtw.167.1590079397651; Thu, 21 May 2020 09:43:17 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:17 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 03/74] cpu: introduce cpu_mutex_lock/unlock Date: Thu, 21 May 2020 12:39:00 -0400 Message-Id: <20200521164011.638-4-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" The few direct users of &cpu->lock will be converted soon. The per-thread bitmap introduced here might seem unnecessary, since a bool could just do. However, once we complete the conversion to per-vCPU locks, we will need to cover the use case where all vCPUs are locked by the same thread, which explains why the bitmap is introduced here. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota [RF: Add assert in smp_parse. Make cpu_mutex_lock stub empty] Signed-off-by: Robert Foley --- cpus.c | 45 +++++++++++++++++++++++++++++++++++++++++-- hw/core/machine.c | 1 + include/hw/core/cpu.h | 36 ++++++++++++++++++++++++++++++++++ stubs/Makefile.objs | 1 + stubs/cpu-lock.c | 20 +++++++++++++++++++ 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 stubs/cpu-lock.c diff --git a/cpus.c b/cpus.c index 77a2d7b7cf..c2da430221 100644 --- a/cpus.c +++ b/cpus.c @@ -92,6 +92,44 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +/* + * Note: we index the bitmap with cpu->cpu_index + 1 so that the logic + * also works during early CPU initialization, when cpu->cpu_index is set to + * UNASSIGNED_CPU_INDEX == -1. + */ +static __thread DECLARE_BITMAP(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); + +bool no_cpu_mutex_locked(void) +{ + return bitmap_empty(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); +} + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ +/* coverity gets confused by the indirect function call */ +#ifdef __COVERITY__ + qemu_mutex_lock_impl(&cpu->lock, file, line); +#else + QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); + + g_assert(!cpu_mutex_locked(cpu)); + set_bit(cpu->cpu_index + 1, cpu_lock_bitmap); + f(&cpu->lock, file, line); +#endif +} + +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) +{ + g_assert(cpu_mutex_locked(cpu)); + qemu_mutex_unlock_impl(&cpu->lock, file, line); + clear_bit(cpu->cpu_index + 1, cpu_lock_bitmap); +} + +bool cpu_mutex_locked(const CPUState *cpu) +{ + return test_bit(cpu->cpu_index + 1, cpu_lock_bitmap); +} + bool cpu_is_stopped(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); @@ -101,9 +139,9 @@ static inline bool cpu_work_list_empty(CPUState *cpu) { bool ret; - qemu_mutex_lock(&cpu->lock); + cpu_mutex_lock(cpu); ret = QSIMPLEQ_EMPTY(&cpu->work_list); - qemu_mutex_unlock(&cpu->lock); + cpu_mutex_unlock(cpu); return ret; } @@ -1845,6 +1883,9 @@ void qemu_mutex_lock_iothread_impl(const char *file, int line) { QemuMutexLockFunc bql_lock = atomic_read(&qemu_bql_mutex_lock_func); + /* enforce locking order */ + g_assert(no_cpu_mutex_locked()); + g_assert(!qemu_mutex_iothread_locked()); bql_lock(&qemu_global_mutex, file, line); iothread_locked = true; diff --git a/hw/core/machine.c b/hw/core/machine.c index bb3a7b18b1..03a9081f55 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -763,6 +763,7 @@ static void smp_parse(MachineState *ms, QemuOpts *opts) ms->smp.threads = threads; ms->smp.sockets = sockets; } + assert(ms->smp.max_cpus <= CPU_LOCK_BITMAP_SIZE); if (ms->smp.cpus > 1) { Error *blocker = NULL; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 873bf23a39..2912d9a7c1 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -457,6 +457,39 @@ extern CPUTailQ cpus; extern __thread CPUState *current_cpu; +/** + * cpu_mutex_lock - lock a CPU's mutex + * @cpu: the CPU whose mutex is to be locked + * + * To avoid deadlock, a CPU's mutex must be acquired after the BQL. + */ +#define cpu_mutex_lock(cpu) \ + cpu_mutex_lock_impl(cpu, __FILE__, __LINE__) +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line); + +/** + * cpu_mutex_unlock - unlock a CPU's mutex + * @cpu: the CPU whose mutex is to be unlocked + */ +#define cpu_mutex_unlock(cpu) \ + cpu_mutex_unlock_impl(cpu, __FILE__, __LINE__) +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line); + +/** + * cpu_mutex_locked - check whether a CPU's mutex is locked + * @cpu: the CPU of interest + * + * Returns true if the calling thread is currently holding the CPU's mutex. + */ +bool cpu_mutex_locked(const CPUState *cpu); + +/** + * no_cpu_mutex_locked - check whether any CPU mutex is held + * + * Returns true if the calling thread is not holding any CPU mutex. + */ +bool no_cpu_mutex_locked(void); + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; @@ -1179,4 +1212,7 @@ extern const VMStateDescription vmstate_cpu_common; #define UNASSIGNED_CPU_INDEX -1 #define UNASSIGNED_CLUSTER_INDEX -1 +/* XXX: is this really the max number of CPUs? */ +#define CPU_LOCK_BITMAP_SIZE 2048 + #endif diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 45be5dc0ed..d2dd6c94cc 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -5,6 +5,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 diff --git a/stubs/cpu-lock.c b/stubs/cpu-lock.c new file mode 100644 index 0000000000..1981a00fb3 --- /dev/null +++ b/stubs/cpu-lock.c @@ -0,0 +1,20 @@ +#include "qemu/osdep.h" +#include "hw/core/cpu.h" + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ +} + +void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) +{ +} + +bool cpu_mutex_locked(const CPUState *cpu) +{ + return true; +} + +bool no_cpu_mutex_locked(void) +{ + return true; +} From patchwork Thu May 21 16:39:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C945C739 for ; Thu, 21 May 2020 16:46:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A020F2072C for ; Thu, 21 May 2020 16:46:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kPI6r7a1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A020F2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboKr-0008MX-N7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:46:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboHy-0001f3-FU for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:22 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:42228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboHx-0006TM-8T for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:22 -0400 Received: by mail-qk1-x741.google.com with SMTP id s1so7834227qkf.9 for ; Thu, 21 May 2020 09:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=niJOK+gFFfbZ7oCXJZeMjKiL+kdF4g0cKXPQfbfeKkw=; b=kPI6r7a1lED6MVSPk87IsVqLAyD+RsId94FvTDU/9QyaYz8Y3xeWXMwZ9d25hxxXVm +huCpNnk0o+4g9JQkz7BL2OZHUtA/cCYh2M/rFPE3XTA1VjML9PWwMKsdhRV8o5/ksly GSZTIdTMumJUsG3qWvHeVTvNXGSMrSBr+HM5AJvKyrk7uYWULo9jzntROdWk6+4mXnJa 68R2LkkGvspHQdB6nLFpP6/Vw3X9+H//aRQ7wYsFDRxFdu9+2JverfL1eCDG4Yt8Gjcb qmHLMCAw+o7Fu7sa3QUY+BrG9u5VAWBkpxGSh1u4ULivdaSMuZAYMa0AP3VPwPaAZdc7 SRkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=niJOK+gFFfbZ7oCXJZeMjKiL+kdF4g0cKXPQfbfeKkw=; b=M4CN5eJUpykNwmekLPEEtRZqZeoNZxJI6nEaaEQUC2W8HDGIHA6p0iiOzWqi8qQqDe bxjbW68M2QdVv1ADlovuu/W7CZVdmO0BtAs74HpJ5vlo7gj2vX52fKxDQ5IYtD5SgmLA Q9k8MhBJKGcKmAFw2b1jtw2T3wTdYWlSTU2A453eOmILLvxmKAW1RJjoZfq429hsFtMC wZdKVX2nyMjhqT6QDrGXhbarEu4HvQiPyX9id3ydwF3hVg43vHshU2lvwg9YX683Nr7p 0HCtnYZtBDzVOT0K+PQtBlKrsTwDFtfFNYwyO62U3oXYMiUzbVYi2XAwpLEGsMk5PTQC dAxg== X-Gm-Message-State: AOAM532rUxEuylgWzTpUTTaVkJ81iVkjmgkBuGFNr5bL64itumqn+i0N BP8GEqmKWve+/bJEyOpBhN2B1oxBBkAMtA== X-Google-Smtp-Source: ABdhPJy6xBxfJvX8ZP7Ow8cUE7HyZu0IhkRVAJnO5ATWnJtQYePi0+prJb6fQy3LZE6Cn9JHRcMGsQ== X-Received: by 2002:a37:b144:: with SMTP id a65mr10554942qkf.462.1590079399077; Thu, 21 May 2020 09:43:19 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:18 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 04/74] cpu: make qemu_work_cond per-cpu Date: Thu, 21 May 2020 12:39:01 -0400 Message-Id: <20200521164011.638-5-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This eliminates the need to use the BQL to queue CPU work. While at it, give the per-cpu field a generic name ("cond") since it will soon be used for more than just queueing CPU work. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 72 ++++++++++++++++++++++++++++++++++--------- cpus.c | 2 +- hw/core/cpu.c | 1 + include/hw/core/cpu.h | 6 ++-- 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 34025923e3..4db4e0026f 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -27,7 +27,6 @@ static QemuMutex qemu_cpu_list_lock; static QemuCond exclusive_cond; static QemuCond exclusive_resume; -static QemuCond qemu_work_cond; /* >= 1 if a thread is inside start_exclusive/end_exclusive. Written * under qemu_cpu_list_lock, read with atomic operations. @@ -43,7 +42,6 @@ void qemu_init_cpu_list(void) qemu_mutex_init(&qemu_cpu_list_lock); qemu_cond_init(&exclusive_cond); qemu_cond_init(&exclusive_resume); - qemu_cond_init(&qemu_work_cond); } void cpu_list_lock(void) @@ -103,23 +101,37 @@ struct qemu_work_item { bool free, exclusive, done; }; -static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) +/* Called with the CPU's lock held */ +static void queue_work_on_cpu_locked(CPUState *cpu, struct qemu_work_item *wi) { - qemu_mutex_lock(&cpu->lock); QSIMPLEQ_INSERT_TAIL(&cpu->work_list, wi, node); wi->done = false; - qemu_mutex_unlock(&cpu->lock); qemu_cpu_kick(cpu); } -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, - QemuMutex *mutex) +static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) +{ + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, wi); + cpu_mutex_unlock(cpu); +} + +void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { struct qemu_work_item wi; + bool has_bql = qemu_mutex_iothread_locked(); + + g_assert(no_cpu_mutex_locked()); if (qemu_cpu_is_self(cpu)) { - func(cpu, data); + if (has_bql) { + func(cpu, data); + } else { + qemu_mutex_lock_iothread(); + func(cpu, data); + qemu_mutex_unlock_iothread(); + } return; } @@ -129,13 +141,34 @@ void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, wi.free = false; wi.exclusive = false; - queue_work_on_cpu(cpu, &wi); + cpu_mutex_lock(cpu); + queue_work_on_cpu_locked(cpu, &wi); + + /* + * We are going to sleep on the CPU lock, so release the BQL. + * + * During the transition to per-CPU locks, we release the BQL _after_ + * having kicked the destination CPU (from queue_work_on_cpu_locked above). + * This makes sure that the enqueued work will be seen by the CPU + * after being woken up from the kick, since the CPU sleeps on the BQL. + * Once we complete the transition to per-CPU locks, we will release + * the BQL earlier in this function. + */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&qemu_work_cond, mutex); + qemu_cond_wait(&cpu->cond, &cpu->lock); current_cpu = self_cpu; } + cpu_mutex_unlock(cpu); + + if (has_bql) { + qemu_mutex_lock_iothread(); + } } void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) @@ -299,6 +332,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void process_queued_cpu_work(CPUState *cpu) { struct qemu_work_item *wi; + bool has_bql = qemu_mutex_iothread_locked(); qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { @@ -316,13 +350,23 @@ void process_queued_cpu_work(CPUState *cpu) * BQL, so it goes to sleep; start_exclusive() is sleeping too, so * neither CPU can proceed. */ - qemu_mutex_unlock_iothread(); + if (has_bql) { + qemu_mutex_unlock_iothread(); + } start_exclusive(); wi->func(cpu, wi->data); end_exclusive(); - qemu_mutex_lock_iothread(); + if (has_bql) { + qemu_mutex_lock_iothread(); + } } else { - wi->func(cpu, wi->data); + if (has_bql) { + wi->func(cpu, wi->data); + } else { + qemu_mutex_lock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_unlock_iothread(); + } } qemu_mutex_lock(&cpu->lock); if (wi->free) { @@ -332,5 +376,5 @@ void process_queued_cpu_work(CPUState *cpu) } } qemu_mutex_unlock(&cpu->lock); - qemu_cond_broadcast(&qemu_work_cond); + qemu_cond_broadcast(&cpu->cond); } diff --git a/cpus.c b/cpus.c index c2da430221..e57e8fe669 100644 --- a/cpus.c +++ b/cpus.c @@ -1196,7 +1196,7 @@ void qemu_init_cpu_loop(void) void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { - do_run_on_cpu(cpu, func, data, &qemu_global_mutex); + do_run_on_cpu(cpu, func, data); } static void qemu_kvm_destroy_vcpu(CPUState *cpu) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 4d58399cfc..9b9d4296f9 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -368,6 +368,7 @@ static void cpu_common_initfn(Object *obj) cpu->nr_threads = 1; qemu_mutex_init(&cpu->lock); + qemu_cond_init(&cpu->cond); QSIMPLEQ_INIT(&cpu->work_list); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 2912d9a7c1..d8b81db262 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -333,6 +333,7 @@ struct qemu_work_item; * @kvm_fd: vCPU file descriptor for KVM. * @lock: Lock to prevent multiple access to per-CPU fields. Must be acquired * after the BQL. + * @cond: Condition variable for per-CPU events. * @work_list: List of pending asynchronous work. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). @@ -378,6 +379,7 @@ struct CPUState { QemuMutex lock; /* fields below protected by @lock */ + QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; CPUAddressSpace *cpu_ases; @@ -769,12 +771,10 @@ bool cpu_is_stopped(CPUState *cpu); * @cpu: The vCPU to run on. * @func: The function to be executed. * @data: Data to pass to the function. - * @mutex: Mutex to release while waiting for @func to run. * * Used internally in the implementation of run_on_cpu. */ -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data, - QemuMutex *mutex); +void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); /** * run_on_cpu: From patchwork Thu May 21 16:39:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A51B91391 for ; Thu, 21 May 2020 16:45:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C7322072C for ; Thu, 21 May 2020 16:45:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X0ujbNXS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C7322072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboKJ-0007LR-Jy for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:45:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboHz-0001iq-TT for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:23 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:38174) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboHx-0006TU-Ks for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:23 -0400 Received: by mail-qk1-x741.google.com with SMTP id f189so7856412qkd.5 for ; Thu, 21 May 2020 09:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q6fMxoKgDixMx1XBFW+F7YxZyPOAUqVrYpURuluogyg=; b=X0ujbNXSPVo7DCGMqSjhfqLy6GAse5zA/TKx3Ulkrfa5IGvWh8i8xK8we8rT+D5U2u g+S8MH5sRjctxd9LEthtBwssjJQtwNChyQ/zJBRsygHy9EVtXPI8K7ms4LulAEK7lAQQ 3ehBR/1meWP9AEKRFRuloBsb8ydQ2XcXD4bSGzBgfUZ7CQVRfZ+IjZ1NMVs7QR4bMh5s Bo1a/51mpUpK06ihM4Ps/M1m2YiExoAprUEp+/Tm3E7MGzMqWWrbqZby6W6YiWuY7MU+ SPw2OLByuZ0i6m/etP5OhK1yom6/VZoe/lt0H0OhQOsAPY6Knfkilf9bAo/490rQBdFD 3FMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q6fMxoKgDixMx1XBFW+F7YxZyPOAUqVrYpURuluogyg=; b=ldSufmvJpDac1DiK5FqTXfnn+u5mQ/hDEfldaV9g2nqj57mfsn1SF55mSnk6//FEP5 PSYX1zjhA/DOyzR4Leu2hYdqjaOgjytu9jieFLYlGRWbUnF2i7FxMOVXzG5z6ni43Mvv 3zBFQfJ3hHMbF54APkxX5ui/Z+yehrgD3X56LGjgyVgudFAvOcSyFSF6rlsUPuhN7PmX rMl4WAc344CMKAgkDXdl8W91vwOKXQLl9n/URrjUTF25QxA87IXpr/WuG/kIH7R+sL0z WPgn56EF6+rR5qirbxLzotVjn87pnjhRYSwNxBFDXvns/GMfgqC+NOnLsXVzhwJCtdhP nKuw== X-Gm-Message-State: AOAM5329rhb8/gRePlSYajC0Z8TnMnxF9tU0kSQQtDKkEd1Mw/vrRbuC 5XIsbppSW19JCrbD1Me3siy46Cp+JbMjvg== X-Google-Smtp-Source: ABdhPJxqEnZItjmtYo9hGuXVZKoGg7+feg3C2Ih9NNad1IHjt1O0hmpsPs+CY8NZXARJ6a3UaX5t9w== X-Received: by 2002:a37:4897:: with SMTP id v145mr10689935qka.26.1590079400310; Thu, 21 May 2020 09:43:20 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:19 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 05/74] cpu: move run_on_cpu to cpus-common Date: Thu, 21 May 2020 12:39:02 -0400 Message-Id: <20200521164011.638-6-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" We don't pass a pointer to qemu_global_mutex anymore. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 2 +- cpus.c | 5 ----- include/hw/core/cpu.h | 10 ---------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 4db4e0026f..907ba5f0fc 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -117,7 +117,7 @@ static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi) cpu_mutex_unlock(cpu); } -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) +void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) { struct qemu_work_item wi; bool has_bql = qemu_mutex_iothread_locked(); diff --git a/cpus.c b/cpus.c index e57e8fe669..935fff6e4e 100644 --- a/cpus.c +++ b/cpus.c @@ -1194,11 +1194,6 @@ void qemu_init_cpu_loop(void) qemu_thread_get_self(&io_thread); } -void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) -{ - do_run_on_cpu(cpu, func, data); -} - static void qemu_kvm_destroy_vcpu(CPUState *cpu) { if (kvm_destroy_vcpu(cpu) < 0) { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d8b81db262..fe79777502 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -766,16 +766,6 @@ void qemu_cpu_kick(CPUState *cpu); */ bool cpu_is_stopped(CPUState *cpu); -/** - * do_run_on_cpu: - * @cpu: The vCPU to run on. - * @func: The function to be executed. - * @data: Data to pass to the function. - * - * Used internally in the implementation of run_on_cpu. - */ -void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); - /** * run_on_cpu: * @cpu: The vCPU to run on. From patchwork Thu May 21 16:39:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAB9F913 for ; Thu, 21 May 2020 16:44:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 910502072C for ; Thu, 21 May 2020 16:44:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SFnHTXzS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 910502072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboIl-0003Za-O7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:44:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI0-0001kD-EY for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:24 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:43413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboHz-0006Un-Gb for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:24 -0400 Received: by mail-qk1-x742.google.com with SMTP id i14so7812530qka.10 for ; Thu, 21 May 2020 09:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HfcAo2caqwFqp8BpPOPBnSoEMj4Sv7hELhtAr2WNKok=; b=SFnHTXzSh2ag6jIBf0pEydEZ6td6e1OCXQWpaRBK5Z25C14+eNLrsTjzuMwcWjaeZV XFm7hX2k6nPMHxLdiD1aRFtsHYOKDkAG4ReAiP9Xg20iMlHHFxdg4PbmSlDCrMN70d8k jk2GidJ3/O1yjPuRNt0tCazvwcUohnPS6DeG+PwbPYHpEjjnnW8/c2bZ0Uq7ZgEZtMBJ cfIowcnah10R7q/0J2eJY83Fv9DtxyvewE4gAfR2/AUgNLM80HjJN+Jd1x8bWTt8k+4k 9t1tQpxhNFyEWype+wcQ10lv2vO205UjVu0mrqlHccR407AgUANYXUnnaEoO0bD6a3Wn oAfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HfcAo2caqwFqp8BpPOPBnSoEMj4Sv7hELhtAr2WNKok=; b=SwSiaf2mEYfsM0N222XHUGLigR5cDCX3n5L8rbt+7QV7UjU3fgAFLhl8sCcTDJSLFY VOnpb2xyawU+1UTDihKsquRMqYUvcAn6rvt3yvSPz+T70Ef557SgmnHqMZmoWFDB2nES /4+0cAB/LudDCdUKbnpghPXL2qL1lCOxrROImT0MEON8ED7Jj3j0DqcG9HQhFMT1FZae vFZE43oBOAUI5/VH7BAHQs4lkd44TghZ9tZKfuspqTjALaLvfecexip6Z0+H5pd9bTHd K/V6Bmvpw0mZuChwR+g+1PTBC6UjpGhoy/wB3ZUV0gLC7c9NY7fTF1ULbgy59NaPu15G HUAQ== X-Gm-Message-State: AOAM530YC8VT48RluHUN8KSpCgBY2Rhfn6bmBoWqzAb1RI9BOG0xvDfU OSjR6q67xI9+zye3Iaal0yQPLeKAnlk+zA== X-Google-Smtp-Source: ABdhPJwoRIEF3ujvJ+O4jPhLxFI1fmn7mr+Nv75o3Pg9HhhjTeeFjB7Jgb5HaOb9Evlu3n/eHgTD6g== X-Received: by 2002:a37:9d09:: with SMTP id g9mr10904604qke.154.1590079401889; Thu, 21 May 2020 09:43:21 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:21 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 06/74] cpu: introduce process_queued_cpu_work_locked Date: Thu, 21 May 2020 12:39:03 -0400 Message-Id: <20200521164011.638-7-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This completes the conversion to cpu_mutex_lock/unlock in the file. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 907ba5f0fc..e2f609c8e2 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -329,20 +329,19 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, queue_work_on_cpu(cpu, wi); } -void process_queued_cpu_work(CPUState *cpu) +/* Called with the CPU's lock held */ +static void process_queued_cpu_work_locked(CPUState *cpu) { struct qemu_work_item *wi; bool has_bql = qemu_mutex_iothread_locked(); - qemu_mutex_lock(&cpu->lock); if (QSIMPLEQ_EMPTY(&cpu->work_list)) { - qemu_mutex_unlock(&cpu->lock); return; } while (!QSIMPLEQ_EMPTY(&cpu->work_list)) { wi = QSIMPLEQ_FIRST(&cpu->work_list); QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node); - qemu_mutex_unlock(&cpu->lock); + cpu_mutex_unlock(cpu); if (wi->exclusive) { /* Running work items outside the BQL avoids the following deadlock: * 1) start_exclusive() is called with the BQL taken while another @@ -368,13 +367,19 @@ void process_queued_cpu_work(CPUState *cpu) qemu_mutex_unlock_iothread(); } } - qemu_mutex_lock(&cpu->lock); + cpu_mutex_lock(cpu); if (wi->free) { g_free(wi); } else { atomic_mb_set(&wi->done, true); } } - qemu_mutex_unlock(&cpu->lock); qemu_cond_broadcast(&cpu->cond); } + +void process_queued_cpu_work(CPUState *cpu) +{ + cpu_mutex_lock(cpu); + process_queued_cpu_work_locked(cpu); + cpu_mutex_unlock(cpu); +} From patchwork Thu May 21 16:39:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563437 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39990739 for ; Thu, 21 May 2020 16:45:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 101B42072C for ; Thu, 21 May 2020 16:45:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jYOcTp/y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 101B42072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboKR-0007c9-NV for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:45:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI3-0001p5-Af for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:27 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:38340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI2-0006V5-2H for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:26 -0400 Received: by mail-qt1-x844.google.com with SMTP id i68so6005551qtb.5 for ; Thu, 21 May 2020 09:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gOAJ9vmaNi5fhkFh/LZcc0lHcqZy9RW0PLEEr1p6jHs=; b=jYOcTp/ysJNDBzbDlyACVOmNRDGTCVjvL82LZgV0iG4BZR+6Uh+yzSJBhnNR88Q65a 3u009ARfPOiYF+VbBnFPXEoR2p3HwamfqM4p7ao8G8E0FxZ7QR8Nm/4GrXUfHM15fUX7 XBFbtWu+jaX9WR9ol1atYmM5M+Uj8llNs4h4h6nsKn+fY68dEz/SAas1yUwU6QvVAz3N GVg91Rmn7+sHYH5wUllg+gRYmF/2/LN+c+1rp/fyo3nE4uKeKQj6cE5U8VdMr4spCtD9 QKdkEGjTfKKIoJ3GlAZgCL5329Zz0/J9tIe50Ew+0hWzmTlaBbcpv9hCy73ogJ7UstNA eMvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gOAJ9vmaNi5fhkFh/LZcc0lHcqZy9RW0PLEEr1p6jHs=; b=LHqlmVABwXrwkCGKlidmEDowhd9TDqc/2WGmK0ODYP+oCoRMoSfLB0ZIBtcDADg696 dKAM1Lv0CrHd2ptAvfqf/SqfxMTVCAczDrh78elqgcdt10CIFbGMt3RLPJ4zt6XfcFQn CT0Tfhh34/FXtL3pq+W10KSVnWCvmSkJYe7hoTBY0cVoV9FOtJwiScunUGQ2M6HBtIiB 91uB+ImvfRvhBJe1ie8ZyvGLKbzC1A1qzrpwgdGyGt+34R8I5Q6jgZnlqJWRL8ypUtWl 2PyIq69LPS7LGZddOc4+/F8VcLZx0Q8dNIWfvfTtD4oKdkI+lpjdh5IqeakO4KYLsWwj HteA== X-Gm-Message-State: AOAM533Z9Ou7u9t14B3MpkhV0VTOWDxWaF9ExUp41HGF8yN6VhAX1APn AKvs+4Mcg/oD3mfFOtxZ5GyxTN2bG5PzOA== X-Google-Smtp-Source: ABdhPJz0W4zovLCjhFN+KHaSOwfK6qeHA5PySSBtOBrOY5BgAyQAjZHGsgC/ypXXieUTSwaBRo7N/g== X-Received: by 2002:ac8:393a:: with SMTP id s55mr11521271qtb.48.1590079403681; Thu, 21 May 2020 09:43:23 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:23 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 07/74] cpu: make per-CPU locks an alias of the BQL in TCG rr mode Date: Thu, 21 May 2020 12:39:04 -0400 Message-Id: <20200521164011.638-8-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Before we can switch from the BQL to per-CPU locks in the CPU loop, we have to accommodate the fact that TCG rr mode (i.e. !MTTCG) cannot work with separate per-vCPU locks. That would lead to deadlock since we need a single lock/condvar pair on which to wait for events that affect any vCPU, e.g. in qemu_tcg_rr_wait_io_event. At the same time, we are moving towards an interface where the BQL and CPU locks are independent, and the only requirement is that the locking order is respected, i.e. the BQL is acquired first if both locks have to be held at the same time. In this patch we make the BQL a recursive lock under the hood. This allows us to (1) keep the BQL and CPU locks interfaces separate, and (2) use a single lock for all vCPUs in TCG rr mode. Note that the BQL's API (qemu_mutex_lock/unlock_iothread) remains non-recursive. Added cpu_mutex_destroy, and call from cpu_common_finalize, to avoid destroying qemu_global_mutex, when cpu mutex is destroyed. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota [RF: Fixed destroy issue, added cpu_mutex_destroy.] Signed-off-by: Robert Foley --- cpus-common.c | 2 +- cpus.c | 101 ++++++++++++++++++++++++++++++++++++++---- hw/core/cpu.c | 5 ++- include/hw/core/cpu.h | 8 +++- stubs/cpu-lock.c | 7 +++ 5 files changed, 110 insertions(+), 13 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index e2f609c8e2..d418eb5aef 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -161,7 +161,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; - qemu_cond_wait(&cpu->cond, &cpu->lock); + qemu_cond_wait(&cpu->cond, cpu->lock); current_cpu = self_cpu; } cpu_mutex_unlock(cpu); diff --git a/cpus.c b/cpus.c index 935fff6e4e..9cc5f4767e 100644 --- a/cpus.c +++ b/cpus.c @@ -92,6 +92,12 @@ static unsigned int throttle_percentage; #define CPU_THROTTLE_PCT_MAX 99 #define CPU_THROTTLE_TIMESLICE_NS 10000000 +static inline bool qemu_is_tcg_rr(void) +{ + /* in `make check-qtest', "use_icount && !tcg_enabled()" might be true */ + return use_icount || (tcg_enabled() && !qemu_tcg_mttcg_enabled()); +} + /* * Note: we index the bitmap with cpu->cpu_index + 1 so that the logic * also works during early CPU initialization, when cpu->cpu_index is set to @@ -104,25 +110,75 @@ bool no_cpu_mutex_locked(void) return bitmap_empty(cpu_lock_bitmap, CPU_LOCK_BITMAP_SIZE); } -void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +static __thread bool iothread_locked; +/* + * In TCG rr mode, we make the BQL a recursive mutex, so that we can use it for + * all vCPUs while keeping the interface as if the locks were per-CPU. + * + * The fact that the BQL is implemented recursively is invisible to BQL users; + * the mutex API we export (qemu_mutex_lock_iothread() etc.) is non-recursive. + * + * Locking order: the BQL is always acquired before CPU locks. + */ +static __thread int iothread_lock_count; + +static void rr_cpu_mutex_lock(void) { -/* coverity gets confused by the indirect function call */ + if (iothread_lock_count++ == 0) { + /* + * Circumvent qemu_mutex_lock_iothread()'s state keeping by + * acquiring the BQL directly. + */ + qemu_mutex_lock(&qemu_global_mutex); + } +} + +static void rr_cpu_mutex_unlock(void) +{ + g_assert(iothread_lock_count > 0); + if (--iothread_lock_count == 0) { + /* + * Circumvent qemu_mutex_unlock_iothread()'s state keeping by + * releasing the BQL directly. + */ + qemu_mutex_unlock(&qemu_global_mutex); + } +} + +static void do_cpu_mutex_lock(CPUState *cpu, const char *file, int line) +{ + /* coverity gets confused by the indirect function call */ #ifdef __COVERITY__ - qemu_mutex_lock_impl(&cpu->lock, file, line); + qemu_mutex_lock_impl(cpu->lock, file, line); #else QemuMutexLockFunc f = atomic_read(&qemu_mutex_lock_func); + f(cpu->lock, file, line); +#endif +} + +void cpu_mutex_lock_impl(CPUState *cpu, const char *file, int line) +{ g_assert(!cpu_mutex_locked(cpu)); set_bit(cpu->cpu_index + 1, cpu_lock_bitmap); - f(&cpu->lock, file, line); -#endif + + if (qemu_is_tcg_rr()) { + rr_cpu_mutex_lock(); + } else { + do_cpu_mutex_lock(cpu, file, line); + } } void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line) { g_assert(cpu_mutex_locked(cpu)); - qemu_mutex_unlock_impl(&cpu->lock, file, line); clear_bit(cpu->cpu_index + 1, cpu_lock_bitmap); + + if (qemu_is_tcg_rr()) { + rr_cpu_mutex_unlock(); + return; + } + qemu_mutex_unlock_impl(cpu->lock, file, line); } bool cpu_mutex_locked(const CPUState *cpu) @@ -130,6 +186,20 @@ bool cpu_mutex_locked(const CPUState *cpu) return test_bit(cpu->cpu_index + 1, cpu_lock_bitmap); } +void cpu_mutex_destroy(CPUState *cpu) +{ + /* + * In TCG RR, cpu->lock is the BQL under the hood. In all other modes, + * cpu->lock is a standalone per-CPU lock. + */ + if (qemu_is_tcg_rr()) { + cpu->lock = NULL; + } else { + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + } +} + bool cpu_is_stopped(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); @@ -1863,8 +1933,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; @@ -1883,6 +1951,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; } @@ -1890,7 +1960,10 @@ void qemu_mutex_unlock_iothread(void) { g_assert(qemu_mutex_iothread_locked()); iothread_locked = false; - qemu_mutex_unlock(&qemu_global_mutex); + g_assert(iothread_lock_count > 0); + if (--iothread_lock_count == 0) { + qemu_mutex_unlock(&qemu_global_mutex); + } } void qemu_cond_wait_iothread(QemuCond *cond) @@ -2126,6 +2199,16 @@ void qemu_init_vcpu(CPUState *cpu) cpu_address_space_init(cpu, 0, "cpu-memory", cpu->memory); } + /* + * In TCG RR, cpu->lock is the BQL under the hood. In all other modes, + * cpu->lock is a standalone per-CPU lock. + */ + if (qemu_is_tcg_rr()) { + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + cpu->lock = &qemu_global_mutex; + } + if (kvm_enabled()) { qemu_kvm_start_vcpu(cpu); } else if (hax_enabled()) { diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 9b9d4296f9..620feed3e9 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -367,7 +367,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); @@ -380,7 +381,7 @@ static void cpu_common_finalize(Object *obj) { CPUState *cpu = CPU(obj); - qemu_mutex_destroy(&cpu->lock); + cpu_mutex_destroy(cpu); } static int64_t cpu_common_get_arch_id(CPUState *cpu) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index fe79777502..2959ed1b49 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -377,7 +377,7 @@ struct CPUState { uint64_t random_seed; sigjmp_buf jmp_env; - QemuMutex lock; + QemuMutex *lock; /* fields below protected by @lock */ QemuCond cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; @@ -485,6 +485,12 @@ void cpu_mutex_unlock_impl(CPUState *cpu, const char *file, int line); */ bool cpu_mutex_locked(const CPUState *cpu); +/** + * cpu_mutex_destroy - Handle how to destroy this CPU's mutex + * @cpu: the CPU whose mutex to destroy + */ +void cpu_mutex_destroy(CPUState *cpu); + /** * no_cpu_mutex_locked - check whether any CPU mutex is held * diff --git a/stubs/cpu-lock.c b/stubs/cpu-lock.c index 1981a00fb3..97a81f447d 100644 --- a/stubs/cpu-lock.c +++ b/stubs/cpu-lock.c @@ -18,3 +18,10 @@ bool no_cpu_mutex_locked(void) { return true; } + +void cpu_mutex_destroy(CPUState *cpu) +{ + qemu_mutex_destroy(cpu->lock); + g_free(cpu->lock); + cpu->lock = NULL; +} From patchwork Thu May 21 16:39:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD9141391 for ; Thu, 21 May 2020 16:48:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9459A2072C for ; Thu, 21 May 2020 16:48:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JKWYumNg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9459A2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:42822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboMS-0003Ps-Nf for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:48:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI4-0001r2-2O for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:28 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:33116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI3-0006VA-6w for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:27 -0400 Received: by mail-qv1-xf41.google.com with SMTP id er16so3384491qvb.0 for ; Thu, 21 May 2020 09:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wu18ytPvx1d0kVanWp/H7LPvrM4VUoBEe+P8kb9ryLo=; b=JKWYumNgzhW4YWWh51l2xT87Y/KrKNY/g0igIh8o1RXUyE+545PwZLb/F/v2KvFITA OfcQqBSgqfS/Z9C61MytBrdvjuIv2iBwtLC1ugLtlRvz1i/UfK+EONslmQ7t8NmlVuB5 MTmGextuwll52y4oK5AT+UyUhBfBplzYbp8FbAxdVi00ZkUrA18nXRJeburhR/lGwkbj XVh2MNHDOT92mTPyj22/ioJMYYOs55PpxCm0O6gmsURMxXFU3kUssB8m/zIz+5uYmOuf 0OmS/yv9bYoTv8jbqTJtX9jbk4y6x/PXHVh4CCWzi3TLHS3wE46/rehwhl/iIltuHsia YobA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wu18ytPvx1d0kVanWp/H7LPvrM4VUoBEe+P8kb9ryLo=; b=ZFwTpY17lAoYp9lYEUxPk8oe65FfNG2l9vlZqIHs7AUxMjELKZzgIWdZ3Csw91j6Ri +8COceEB5H0uAcofDphrX7I/B3ulh9UYhZ0vvcd9e9Gt/bcw4Lih/ZTH3zTVeCPjwgg7 lSLHhvg0HrA5eZGps6sBlEQqGyDvK8OrQGt3r2XrB41e3TjtcEb7TVMKMyzxtVFAk5g2 MlZJt7sIKWLFHsG8hcgMi6c2a3GEVEOFrhVsoQhvGFAzizIY2mprQTned+DstydsvgNf 9gRcZhslExgOpHtcKelmpmatCZJKhjRssJRh+BpA+BBh0+MdD1MLwvKT+dzjquLyxEqq GpVQ== X-Gm-Message-State: AOAM5332NqsnDPy+KVFK1U7LYinAc/e216/HHNXaLzkUHzpFkCi9hI3g 6nuzLhxK9U1DzgAWl0Mer6ZqAwhdrvxr+g== X-Google-Smtp-Source: ABdhPJwdeuOLdL7WAB+JCWaeudr7GavF6Hf6qe4Wp7mf8WlN54DmMAvJeqKn0J+r84zTRBZ3m/7KLg== X-Received: by 2002:a05:6214:6a7:: with SMTP id s7mr11097903qvz.142.1590079406050; Thu, 21 May 2020 09:43:26 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:25 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 08/74] tcg-runtime: define helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:05 -0400 Message-Id: <20200521164011.638-9-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/tcg-runtime.c | 7 +++++++ accel/tcg/tcg-runtime.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 446465a09a..32ec18fe40 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -168,3 +168,10 @@ void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(env_cpu(env), GETPC()); } + +void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) +{ + CPUState *cpu = env_cpu(env); + + cpu->halted = val; +} diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 4fa61b49b4..433b6bc88e 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -28,6 +28,8 @@ DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env) DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) +DEF_HELPER_FLAGS_2(cpu_halted_set, TCG_CALL_NO_RWG, void, env, i32) + #ifdef CONFIG_SOFTMMU DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, From patchwork Thu May 21 16:39:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F31A8159A for ; Thu, 21 May 2020 16:50:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C7DDB2072C for ; Thu, 21 May 2020 16:50:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oNiKM60+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7DDB2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboOO-0007ZD-Rt for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:50:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI6-0001wQ-5g for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:30 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:39750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI4-0006VN-Bm for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:29 -0400 Received: by mail-qt1-x843.google.com with SMTP id l1so5985322qtp.6 for ; Thu, 21 May 2020 09:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UogW0SUaOY/ZfHuTV6t0YjkQtLB6wEDTJTvQMb1HiHQ=; b=oNiKM60+Anmbj1FdJ6ZU33dx7FSduqFtCvLR+oRYGW9s98jF0IX8Iclc9xgRh5sxGA 5QhhCDUB4nUkesjcq4e+zo1ITQvK30NfWUIWki1S8yWLvYtRgv1APWPey+4l/Wm9JiA6 1q7IXD7l/jjvtFUxY9Js22kXQBleP6KPtmHqDHVML4y5I1Eh+67VzVZqGFJnr96I6XGP lS8mLNjfqPkn593bpChb//oOOYTs5BNvaKopoRb2yLMRmagSQv+hOk0dstMtET7FT11H 1/43LwyDavULUs1X0whA52ZOZ/o/faA1v0G+nKgNXuDfvC0JxGIUDQdzBrqIBXlCvzJ1 m6lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UogW0SUaOY/ZfHuTV6t0YjkQtLB6wEDTJTvQMb1HiHQ=; b=ZchdqxtlIV7NPY/QzcPu+j3moI7GwwVF2ZIrd7X2osh4VH3hzezwKqVd+9wm7mfSEV Guc4xHDR2Oai88siKs8RVEr+7Nr3Fd+iYbfIrZDWcJb3MerMiHloVB9xQgC+K3msHnDe 8V/J+h7pB5qwp5fDNatvdHihQPm8g6s2lnHrQ7GlURf4k6LMnVrBmJTCD5i0nKcge9Wi w8LLRQF9ku6+tDXk2x7zuQnfsMiAfXK6eok4mR6V7FcLdOJqXwTKS4mqOhjJhkE8C8I6 e6Fz1FSvDQi+bXFNACMuK/U295YTlBAxbZC/JjIhOXvzImtpRZn0H9tGseLgp/K5nAvb 5SQQ== X-Gm-Message-State: AOAM533g/PhscqkhoMWFKkgwv9pe7lhunmOc0s9/EHPTFJe0r/CN7wje oXyIcsnEJGpUbhVuHU+46ANQAFaNL2eARQ== X-Google-Smtp-Source: ABdhPJxCVs9XAvKBB/qdJQqz8KPPCJJWfr7v/5tUbGXKM54HyqUxbYDwh7NpcGY1zgk6T9EKLZh5iA== X-Received: by 2002:ac8:7941:: with SMTP id r1mr11640643qtt.290.1590079407270; Thu, 21 May 2020 09:43:27 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:26 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 09/74] ppc: convert to helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:06 -0400 Message-Id: <20200521164011.638-10-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Acked-by: David Gibson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/ppc/translate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 338529879f..c801bf915d 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -1595,8 +1595,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 */ @@ -3620,8 +3619,7 @@ static void gen_sync(DisasContext *ctx) static void gen_wait(DisasContext *ctx) { TCGv_i32 t0 = tcg_const_i32(1); - tcg_gen_st_i32(t0, cpu_env, - -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, t0); tcg_temp_free_i32(t0); /* Stop translation, as the CPU is supposed to sleep from now */ gen_exception_nip(ctx, EXCP_HLT, ctx->base.pc_next); From patchwork Thu May 21 16:39:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBCA9739 for ; Thu, 21 May 2020 16:48:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B369F2072C for ; Thu, 21 May 2020 16:48:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DWDpQm8P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B369F2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboMi-0003ho-OC for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:48:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI6-0001yk-TY for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:30 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:41112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI5-0006Vh-TV for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:30 -0400 Received: by mail-qk1-x741.google.com with SMTP id n11so2376895qkn.8 for ; Thu, 21 May 2020 09:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pu4aLcXEpuJ4ytDOMXC0XbbDo51phtIicVpeJSCDXFU=; b=DWDpQm8PSA5NEf/7AnwZEAKyU/pEgvd9hw5c4hyVd14yhfhx3oc5Eap2P06jV0j7RY 43uxoKGirTg1Sy94QGDtwfFHUQKQm2M25FA6PQQIKtvlGIdzbgRGqyL22+6DB2ocjnn2 GJZHE+HD+LExIHNXy//q0IxedEy6YznJ+Fb1PRH0srrobWnDiCu/y0kAGjH6vyHBiGg0 IkRO/u4OFIDs9/hbiMD52C5Or72nU68I+7/e7M43XAv7lFm+2PKMjC7LK/wS4DgZlW92 QQqBhO4KGTBFT/cnPbTKsIHQkfN8UWp69z3sSDBI+Lb51HlF7ImZsl+Lzwcu8N6z51sH JxWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pu4aLcXEpuJ4ytDOMXC0XbbDo51phtIicVpeJSCDXFU=; b=gy/TLo4ygHWn3DLh1zIwAmTHMDaMTGTY9dozrUarWHvraDo85XhA9RQV6NHJP3iJDU ISBSYscQf4mfdx6zu5wdA8iBzFbVdZiXM3xJ9638SA4RxAWAu45gOAvNaBWRrKIkf4uG bt8+zRbQQgf0HOuE30lWv5jK0WV6to7VQHtl39YF7wX/kHeOAmVX6gNoR4HmkI7CYGxH woXUQyNNAFhd3b7RDXiAcU48erwclVJyUHSrLPfpHvfBamGSFvN5z8sDSfZVuiOtw9/3 KlJLkLE8c6Z489dGZbsxjeuNHkhrcfnL3n9AnqbwzWi19zde6Rvo5M+QuvxebuIQucTe itLw== X-Gm-Message-State: AOAM5306W6NUF1zvCj8tBGm42CALOuHsMIPj/DGFDNSzAg41mq00+OcU LKwLTk/rHo/TvnSYdhAfNmOFakBxTBN0lg== X-Google-Smtp-Source: ABdhPJzkMOq4Q6Y41+ex4wxb/83nn9jFstUZvqN1GeSZHAZWTm5OqSUiJ0uoKZlD+n1IPCtFFTuV7Q== X-Received: by 2002:a05:620a:634:: with SMTP id 20mr10167516qkv.15.1590079408631; Thu, 21 May 2020 09:43:28 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:27 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 10/74] cris: convert to helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:07 -0400 Message-Id: <20200521164011.638-11-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, "Edgar E. Iglesias" , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" And fix the temp leak along the way. Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley Reviewed-by: Edgar E. Iglesias --- target/cris/translate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index aaa46b5bca..6c4f091b7a 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -2823,8 +2823,9 @@ static int dec_rfe_etc(CPUCRISState *env, DisasContext *dc) cris_cc_mask(dc, 0); if (dc->op2 == 15) { - tcg_gen_st_i32(tcg_const_i32(1), cpu_env, - -offsetof(CRISCPU, env) + offsetof(CPUState, halted)); + TCGv_i32 tmp = tcg_const_i32(1); + gen_helper_cpu_halted_set(cpu_env, tmp); + tcg_temp_free_i32(tmp); tcg_gen_movi_tl(env_pc, dc->pc + 2); t_gen_raise_exception(EXCP_HLT); return 2; From patchwork Thu May 21 16:39:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2B0C1391 for ; Thu, 21 May 2020 16:48:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA1E02072C for ; Thu, 21 May 2020 16:48:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YmuuoF5L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA1E02072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboMt-0004Ee-QO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:48:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI8-000228-23 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:32 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:38339) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI7-0006W2-4a for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:31 -0400 Received: by mail-qt1-x841.google.com with SMTP id i68so6005767qtb.5 for ; Thu, 21 May 2020 09:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wrWqzZuurKLoDMN6QCL6bZgCudK/zrEU5r5KFbp+gtw=; b=YmuuoF5LDaLC9LPJFJ/OIGT/lFZhaggYW7guEd37vYOaxxRGX3CYGksjL+A29Pkhwf o++J4eNpgjnAUhOl/PaQW7sP2c4QlcHkcKOKf9A9CNQXmGssLOkqFR/dvVmq7KXJ9wup QjIkdJG8kC9o+aQOoMx1bZO3imXwxJk4lH5njtI8JcI32/ZiFccR03ksZeGTFBj5Xb3B W8TFGmLqGGjHpHZZvWJFTFD7+kN6u9EeakOrxTxTqPCiXP1IQP0uXGtW9L1s1K9yjZly TUcEiwNcTTkoK0Rl5gqWb5AnZS4D/HZbVDHT02fwfJt4Ep7F0seGmq1DTKfD/nue39FZ 6ooA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wrWqzZuurKLoDMN6QCL6bZgCudK/zrEU5r5KFbp+gtw=; b=tq6VNt8SG9J8jhpIANrlRmSt5Tmnyp5u7sHzdcsN4YvuTqXMxAnIbQ17A7F15yI0gz JzoJTS8gIfhZFV6IWyt1ZNnr2NRc4jQjixMdC/X35GXaqICeM2L/sOH4sofiyx2FvJrv 9WV040HBwHa26wXE9DscqVuuAkqdW/0CHNWXH9IAsskwGJ3zvNlpzdsKBNRHxHpd1bW9 AnopmcrIhj633rILObtQ33zTmpTB3kOxxBMDdauK+Lv1GC4eW2m6JCYY8C9Cie7nja1e nwuFW5z8lXMCUfcdlGjU4SDBkWMQ6MW77LHFW8vnTlC9Qt80rejB9U3OHKkWRjoZSaoW vEWg== X-Gm-Message-State: AOAM5310na1X6n0sKRG9PZKDXxmF7yDRzc0nzgVY2+J9TtZCnjZCXGpq +Ttgy4qTBoWcCF1X9A984C2QAOzXJMfjrA== X-Google-Smtp-Source: ABdhPJxlEzsj/zaUIMcZ1jml40fDX5W9HatDTGpHa++ep0asPzDjUpRl3YoskiSCMJIHIs4RA4SyQQ== X-Received: by 2002:aed:35a1:: with SMTP id c30mr11731970qte.228.1590079409933; Thu, 21 May 2020 09:43:29 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:29 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 11/74] hppa: convert to helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:08 -0400 Message-Id: <20200521164011.638-12-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/hppa/translate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 52d7bea1ea..9c4d5b28b0 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2725,8 +2725,7 @@ static bool trans_or(DisasContext *ctx, arg_rrr_cf *a) /* Tell the qemu main loop to halt until this cpu has work. */ tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); gen_excp_1(EXCP_HALTED); ctx->base.is_jmp = DISAS_NORETURN; From patchwork Thu May 21 16:39:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B05B0739 for ; Thu, 21 May 2020 16:49:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87A832072C for ; Thu, 21 May 2020 16:49:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G+4Hjh5d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87A832072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboOK-0007PC-MX for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboI9-000258-6g for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:33 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:38969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI8-0006WK-87 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:32 -0400 Received: by mail-qk1-x742.google.com with SMTP id w3so2326442qkb.6 for ; Thu, 21 May 2020 09:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p1mJfQgUSajpR9lU6ZTURQdWL9DblhFREsfOMzR9p54=; b=G+4Hjh5dHU44k3Vge8s7hwNhgmKXokOePkqdTPtL48+K/vVTjAEL6y82VbSToKpNNE +CSL+56UL7WLFmtnnRY19Fe27uhwgD82J+CvcG5nhCFZ54MKEiIfVPsskk62NmX/Vs8a Qw16zOpzbKM6722D08ldOTvFXU9Bz31xftGaI5d0RvayZZqpc6vYKS1Q62eeNdZs64NA ctkRHWL2CgHinSI8VBgcDouipdz4hJIL7tlhi+bT2NS5NW7NocZXYeAg7pc2H5QTrWdB vWSXH/Wpsj8Sr4OFa+tMD8PXKnGPsJJuqP92VXPP559eytNMMYTIM2UYVN8lzzGGPPev mKeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p1mJfQgUSajpR9lU6ZTURQdWL9DblhFREsfOMzR9p54=; b=N9N9NX3o3GGdvHgcSOH/vEyLSrtyO71TWSU6R1goo/+xjmGhKeejf+fCYhSrBMSOkX lC7uaLQmjUKAzUCySzHht8ZBGO+PfcLMnp0vM0ISlcXaH4Jgiba1bqSOzyuokJ7mN0Eu RLhZWGfwRi+yK+QbKHn68kYy21kD1iwrUW1WkdKyjkzE/ZJNN4d/2J5XBvztUA8m6g32 ufWND/zbyjWTH0HMof7jgQBUnP2pHnoeOK6BBTpP4cbU3DsvoT0gn+JxzRvNXfYg2iP1 Q6yHnMlJXFhoC5qd1oSVAHLQIgf3Hi6nmR0hUG002mBKxSsROW4O9u+7WZ1OnKcd87zy T6ng== X-Gm-Message-State: AOAM531MqieSlQS+4U6mGfZOcsHy9yZCxQ4a1DFADqS9mJdPc+dlO3FY AkyfHmGttWbgWVqhMmtpjdVrcKIK0qHUOA== X-Google-Smtp-Source: ABdhPJzSYPw/mIcCG6YiyKkWhcoH5A2dsvRWdMJN5BSRBmUQ3z66h1xBQ/BslbS1y4rjvNMcq0RY9A== X-Received: by 2002:a37:8a42:: with SMTP id m63mr10531000qkd.230.1590079411098; Thu, 21 May 2020 09:43:31 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:30 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 12/74] m68k: convert to helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:09 -0400 Message-Id: <20200521164011.638-13-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Laurent Vivier Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/m68k/translate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 0f80888203..16a64e4776 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -44,7 +44,6 @@ #undef DEFO32 #undef DEFO64 -static TCGv_i32 cpu_halted; static TCGv_i32 cpu_exception_index; static char cpu_reg_names[2 * 8 * 3 + 5 * 4]; @@ -80,9 +79,6 @@ void m68k_tcg_init(void) #undef DEFO32 #undef DEFO64 - cpu_halted = tcg_global_mem_new_i32(cpu_env, - -offsetof(M68kCPU, env) + - offsetof(CPUState, halted), "HALTED"); cpu_exception_index = tcg_global_mem_new_i32(cpu_env, -offsetof(M68kCPU, env) + offsetof(CPUState, exception_index), @@ -4698,6 +4694,7 @@ DISAS_INSN(halt) DISAS_INSN(stop) { uint16_t ext; + TCGv_i32 tmp; if (IS_USER(s)) { gen_exception(s, s->base.pc_next, EXCP_PRIVILEGE); @@ -4707,7 +4704,9 @@ DISAS_INSN(stop) ext = read_im16(env, s); gen_set_sr_im(s, ext, 0); - tcg_gen_movi_i32(cpu_halted, 1); + tmp = tcg_const_i32(1); + gen_helper_cpu_halted_set(cpu_env, tmp); + tcg_temp_free_i32(tmp); gen_exception(s, s->pc, EXCP_HLT); } From patchwork Thu May 21 16:39:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA24B159A for ; Thu, 21 May 2020 16:51:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0B9D20738 for ; Thu, 21 May 2020 16:51:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SGKCHWDZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0B9D20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:32792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboQ3-0002nY-S2 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:51:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIA-000284-A7 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:34 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:37276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboI9-0006WW-EC for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:34 -0400 Received: by mail-qk1-x742.google.com with SMTP id m11so7880098qka.4 for ; Thu, 21 May 2020 09:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8O2wd0xMJ+DcB/CefCYufYGHDOjb2p67mBVobEDCvB4=; b=SGKCHWDZY09KK8Z1xny9ksZlvnpuBkaMA+nswHU9X7bUmRqFGzEiucF7NoTK1l/bOJ 64RqsnWqmnCA8xUnECSl5fnKyz3QJtefvmu1ADa400dt+VWbrVgy9cR3hUaSaikLPHVv 0FdV/QuI0AA/R0hjhIDOrMUqbpTcRFK013i7Kh3ib7sjNIkFBxD5eIefrSnL32negTwP CnZRA6fJ5PF6+3c1Vk/q6ZRJxFiC/8+iBCIYzQWCjx2N5lLQmntYOeih63T3wBpUh+XC uHJUgp1ULKWBv+kaItsEHgq6uFBoCnPjdX3HhKd4YL6ADKKscnkOaSWCfIf7jZ1dbO7R VYoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8O2wd0xMJ+DcB/CefCYufYGHDOjb2p67mBVobEDCvB4=; b=F8kSWphnAa7/2nFu7rK82Ez3V8WEgo7awQsx+BRBNPxrjZna6vwU2iME8Vx8CuzO9+ JaKoUt2KiR0VH4LHqa4Ds3LHa0ym9LMpo5Dnx3Zjb33TW5NmH8LSha5uPUsZiFFK7lkd fIO3yFqNDYTzHCLJD498UjKMOC9SIKkTwFFFnCRRlzWFDvNS1DIMQ2uIscf/8Qi9Ook7 qHbwlogMK/FXi+z3cRTPaFSYar1Mf4t0MalvwGdOGIPSwGlpRBmsi6gRoUI214ECvxhS 0oJ5Q0tIaxoqMfvt51vso72r0bJRhAo72K6b5ERo0LKKeNx+T89hohAyEU93OI8Kf1zf /2BA== X-Gm-Message-State: AOAM532yle7yM1m0CGb6yV4mhxpgbfkiznWs1F1I0Jr0qLaq2e28IBCw Lze/w8BHWhhEEJMIJPWHIyvQ7WhR40zZsQ== X-Google-Smtp-Source: ABdhPJx3Mo8GxEYzBapH9hwVYDeYYP9os77fwsP9oUbEzSNSyemMG/NmadXsFafe9NaGAEvoqcgYyg== X-Received: by 2002:a37:6cd:: with SMTP id 196mr1795854qkg.393.1590079412346; Thu, 21 May 2020 09:43:32 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:31 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 13/74] alpha: convert to helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:10 -0400 Message-Id: <20200521164011.638-14-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/alpha/translate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 8870284f57..b1cd55e6ca 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1226,8 +1226,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode) /* WTINT */ { TCGv_i32 tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); } tcg_gen_movi_i64(ctx->ir[IR_V0], 0); @@ -1381,8 +1380,7 @@ static DisasJumpType gen_mtpr(DisasContext *ctx, TCGv vb, int regno) /* WAIT */ { TCGv_i32 tmp = tcg_const_i32(1); - tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + - offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp); tcg_temp_free_i32(tmp); } return gen_excp(ctx, EXCP_HALTED, 0); From patchwork Thu May 21 16:39:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 310C4739 for ; Thu, 21 May 2020 16:51:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0748720738 for ; Thu, 21 May 2020 16:51:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fGlzNEeR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0748720738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboPy-0002aa-6b for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:51:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIB-0002DU-TI for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:35 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:36667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIA-0006Wj-T3 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:35 -0400 Received: by mail-qt1-x842.google.com with SMTP id v4so6011980qte.3 for ; Thu, 21 May 2020 09:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XpDaiKPid7/Y+hg6nqP95tP3OCZMiTwwygoeI2gWXpY=; b=fGlzNEeR+AGHFmUdJLgnarLRXf99CwCGNAMiQCTn9H601nP2Hcg/aUpVO9/5yWrHP8 QDnIMMcoqv5JJTwMsSUwigFsQ4QjNwYqxXoeu75feV6pJerGQSB5ZcWjx5g6tMPXx4GI oxjyFNNy5/hvpsx7cUJq61czTKeq+F4T3WBu7mFlFg8uOlTUQbYE0/fsm6vRXKRMJFpP Yx9mvozDatStV/fMlWujfU3wUke8Kws8BJoSoeNWs2IIEpyGGsbmBvJoHhXsI138CX5l x1YNW5SpSPdcUNEzhVrpIlcQ5NRcRZewK21f2BEfZfToGFS9EaVCurHFUnxEnCNJLjpj UTkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XpDaiKPid7/Y+hg6nqP95tP3OCZMiTwwygoeI2gWXpY=; b=UWJTyAdzbeiMx/cFM7HaiW9wy6G3p4CyR0GEcCMkARzUq/Gze4xN83U7U2QjoB7D1W rcyitfjT+AgYsx44qytG0Qr2cafvZTFIDudJVoIDxUslL9mFRXCpzSkc7WEabo0thZyz Aw+jcJmNMDvFGiCGwEQh4Ars88jPbtsZA9eEqnTyPauTz3B6VGSPimE98cDYdw2eUEyW bz499b/4XJ7i2x+F8rrjIPjJwe+gyPGT2TOdw4eD8v5JRhV2ADuwjia4lOTxRtIRSxk7 WvrYEwgQCgfNQMCILElLBvIWtyzlJaU7caQCh2TO6dfn2yQ81UttzQ8COfb7cGPWVGSk sdxg== X-Gm-Message-State: AOAM5322pF2uTYRbEEK2kegSIjj7nh8mlcU2iS6PgRHGayffjDKr8qx4 +DuMBTPESddb74hLwuQHxn3qYQjnLjdgkw== X-Google-Smtp-Source: ABdhPJxiAkWjnUyncoGUJ64jr9FpbPYwBFXeqvm3swgpTNjekVeAOvAY5DOjk2F/z0dgiMmFWPzjEw== X-Received: by 2002:ac8:543:: with SMTP id c3mr11108406qth.8.1590079413577; Thu, 21 May 2020 09:43:33 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:33 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 14/74] microblaze: convert to helper_cpu_halted_set Date: Thu, 21 May 2020 12:39:11 -0400 Message-Id: <20200521164011.638-15-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, "Edgar E. Iglesias" , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley Reviewed-by: Edgar E. Iglesias --- target/microblaze/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index f6ff2591c3..c08a7f1d39 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1237,9 +1237,7 @@ static void dec_br(DisasContext *dc) LOG_DIS("sleep\n"); t_sync_flags(dc); - tcg_gen_st_i32(tmp_1, cpu_env, - -offsetof(MicroBlazeCPU, env) - +offsetof(CPUState, halted)); + gen_helper_cpu_halted_set(cpu_env, tmp_1); tcg_gen_movi_i64(cpu_SR[SR_PC], dc->pc + 4); gen_helper_raise_exception(cpu_env, tmp_hlt); tcg_temp_free_i32(tmp_hlt); From patchwork Thu May 21 16:39:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563467 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64295739 for ; Thu, 21 May 2020 16:53:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16BE920738 for ; Thu, 21 May 2020 16:53:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bqhwUvOV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16BE920738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboRh-0006Q9-4t for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIC-0002Gi-Ty for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:36 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:39752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIC-0006Wn-0k for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:36 -0400 Received: by mail-qt1-x843.google.com with SMTP id l1so5985664qtp.6 for ; Thu, 21 May 2020 09:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rcwZxV+jbsWTot43K/gufTjtZF8DW6GVBS8lNVigpbk=; b=bqhwUvOV7Cjtw6ugFb1N9dZ3EEjo9o0GTnmP6QidOuapa+BcmL0DCnJum9f52oz0KE BtFyPAlzdcHhALmFS7nKSn+QDnSgyR2JaFXqZvT0vcaFG1CaX8Tn1p/Wramu71uVZmKg l3/nRgjkfyVnkob08USuJMQt+JOHCN8n7g5EWTLIAcntCsTSjyCfkag99oeS45cIZDnm XJI2X2s6z8iu8bcEW9o6C1pz4qnOOqmQq0rHA/U2bbI3Z+VZCRjyIL7AO6KYV+t+ZWH+ qgsJ6MZQCNszVrK6LJyRsJV2Z2gWRcBP5wcG9myL7kAJ/PEQvkOwbSzMsYx1//XW1JI/ 89Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rcwZxV+jbsWTot43K/gufTjtZF8DW6GVBS8lNVigpbk=; b=WTVTYqTC8BpIo/mz/mhlhg19dpW9vmaGst7gIG6CtG7e/S+yYPsmsI81ndBMT1pCE6 9FMh/E/jPtr0/mfBcH3ys68QrYBhfqTAcrHBo++uvg6Gv6qboOTDEbchz0qgOjCIMb1/ dBy6qNcIQ7whjBBLydX4mmJBV9apbVXBDt8z52SGSkvfC0UJzeJExIX+b1NscDwmoHmq W/hDZVb23F64pr302LkwhGNF6Pk6d1Ou7zmohpVfCt4LVUoebFTmrytnwKMQBDdJ29Tk rptR7cKx8L3d3Cj+XllIZrt3ypftbcCrPS3QuaheknmzypIzX8YdaAjdpBa9HAk55K7z H+Fg== X-Gm-Message-State: AOAM533IftXldpUPZihygMcf4yG/VFdzVqoH/zjcIlMLHqY5RSCJU0ug WpN6d4jL34gjdlB+E/VA/4oJdsIDcfgtHw== X-Google-Smtp-Source: ABdhPJw4GgFWIIizQ2ErtYhhqh+n5Ms/82xZ1xNnRzzyy9sBkzmF3x9/oGKDeh+ciVfwbH6l1yqDbw== X-Received: by 2002:aed:3047:: with SMTP id 65mr7301769qte.277.1590079414862; Thu, 21 May 2020 09:43:34 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:34 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 15/74] cpu: define cpu_halted helpers Date: Thu, 21 May 2020 12:39:12 -0400 Message-Id: <20200521164011.638-16-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" cpu->halted will soon be protected by cpu->lock. We will use these helpers to ease the transition, since right now cpu->halted has many direct callers. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- include/hw/core/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 2959ed1b49..820c5b0a9a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -498,6 +498,30 @@ void cpu_mutex_destroy(CPUState *cpu); */ bool no_cpu_mutex_locked(void); +static inline uint32_t cpu_halted(CPUState *cpu) +{ + uint32_t ret; + + if (cpu_mutex_locked(cpu)) { + return cpu->halted; + } + cpu_mutex_lock(cpu); + ret = cpu->halted; + cpu_mutex_unlock(cpu); + return ret; +} + +static inline void cpu_halted_set(CPUState *cpu, uint32_t val) +{ + if (cpu_mutex_locked(cpu)) { + cpu->halted = val; + return; + } + cpu_mutex_lock(cpu); + cpu->halted = val; + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; From patchwork Thu May 21 16:39:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A220159A for ; Thu, 21 May 2020 16:47:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1082F2072C for ; Thu, 21 May 2020 16:47:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TDdqEbk6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1082F2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:42758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboMM-0003OU-Kw for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:47:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIE-0002JW-1B for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:38 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:37865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboID-0006Wu-4V for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:37 -0400 Received: by mail-qv1-xf43.google.com with SMTP id z5so3373977qvw.4 for ; Thu, 21 May 2020 09:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5p5QVMZ54qL4PKza/xfxsC7DswUaUr8tRQACxDFIq5U=; b=TDdqEbk6IX9z4XjZHxvf8HwqY56a2NNvE/lbRvy54fv88C4LqyMEVOTbLkkaL+NQw4 t62o5xVjf0LYZu5vCJ+/1y7FLD9tXneVyGyGaaippzhChniq9ZCc3/E9IsIQEsltvL2L fgvY/kbobS927GncxGuEhQsPSjDrrK7TEtUA0KEEdegBgcafpnf2i23zZmPF17BMHyt6 xhAXQy5w6ydVDYzKE+Pphw25qIXE/s9xKy4A2WzpxwPWHeZpf3EyJpodnuFkzgxwgudB T++Ze6xew05f0IvnVwW0FHo873oI5iD7r72thC1g0/OCR7s1Ree0+PGL+nIQKFnD+CrP 4lkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5p5QVMZ54qL4PKza/xfxsC7DswUaUr8tRQACxDFIq5U=; b=CHfEkyEMV88N4Hx3fCXxJTNDYOClkb/xGchyNH0MDBeS5xKxKsImB3pb9Buqrj6148 6YsuJ5fL8DfTuvbcxWyM6w1BLnhB4nntOWycV79smwQ1l54TgiugDXEowkJzvov9CUTc XR8M7yZOog53TnHTUVSeIIRoTIB4RjZ+U7NqYzAgWv0WEQt7s9U6VMrGma1AYEqhdBaL LJYlnDLnzTaVC0yPW1M6JnZkauIf3DpvCBGR59WlKfs5zskGMM9R3vkG2d7xAvRW0vVf 6fgqyNSjVe4v75+11qkFabgq8jC6oPNkzqsR24qpPZdx0Fy7jWA//n3x1uE05C8aLY9s u2dQ== X-Gm-Message-State: AOAM5303Lz0fdDdHtL+QWaJmkUf0NF5H6fIvg0Ln4KHIj8U7rsxCe/UR 4YuQTVT4Ceu8ytlMf7FqveJoMv79DqaOAA== X-Google-Smtp-Source: ABdhPJyCV5SE2WUnx34e5z2KktJO6u3Sblxv7Y+Ht53ezVG+H7MvsnigQDZ+mXkTtrbsW9fH57j6Wg== X-Received: by 2002:ad4:4141:: with SMTP id z1mr10624562qvp.227.1590079416020; Thu, 21 May 2020 09:43:36 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:35 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 16/74] tcg-runtime: convert to cpu_halted_set Date: Thu, 21 May 2020 12:39:13 -0400 Message-Id: <20200521164011.638-17-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/tcg-runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 32ec18fe40..ca0774d3bf 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -173,5 +173,5 @@ void HELPER(cpu_halted_set)(CPUArchState *env, uint32_t val) { CPUState *cpu = env_cpu(env); - cpu->halted = val; + cpu_halted_set(cpu, val); } From patchwork Thu May 21 16:39:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E71AC739 for ; Thu, 21 May 2020 16:50:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDCC420738 for ; Thu, 21 May 2020 16:50:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="X176vZ6T" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDCC420738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboOY-0007sI-Rl for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:50:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIF-0002MU-4A for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:39 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:33066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIE-0006X6-9r for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:38 -0400 Received: by mail-qt1-x843.google.com with SMTP id e16so118815qtg.0 for ; Thu, 21 May 2020 09:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bFdbQSB6mgaVAkP73ZpxdyRWP8s8cwxd+Gs2aZb+ids=; b=X176vZ6T83RSIA15N/NW0PIad7u0EDLMItBw7GiLqVzDxhQ5rUJoBbSinbFS9RmW3O 5pEu29Hg5kDDpl+KCqf5uPt338u7KtIcsvMBVJmqkHneJjCWDd2RnBCxXpck/u/gmJLu gJVzzlEp0GfuwDYVDXMSDJ+wZovPT7cXgIMTTSzam29y/76InNUQ2inPYHQkSJGoF/MM eUo4NnULI/AWHX32wqqzj7Bx5ZBa2+XqTr6evOzfHKMbcuCi/u4a+rmNHmyPQPK5KMqS fXpbFd5tu0wPCqaceVeQ+n647k9dMdy2oxisu965EoFtDZDSX3Xg0ZUe8ddEMePF9pPb yIKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bFdbQSB6mgaVAkP73ZpxdyRWP8s8cwxd+Gs2aZb+ids=; b=f34XcuSTF2qMpftDiuwPT8SUcOeUVcWknDVelVRae9IvHli84l7PrQcdpAa52PTOz8 NQsuwUY6L8AzJD80ca69TurwYRPhRRJhn2jPAVbNuT+4W/4ukOW2+Fl5k8PmdDI4QDwp WMnBSuQNa/eN/5mrMkW+OeFh+T7Om+6H4lVFDCxLj2OVA5DlLBvEbiZpnJ3vqKUPY1vE ZWoW002J9Dyyaujr9e+9Filixd1KseLjjicfMiCD/D0szXlhxl46Qzlx4rX9MnMVoLGB bvsy1zibU55hJ+ojr6dHJyxt3EXwH7BJk6r/AE9Mbsr1otd3qJ705l09Ecw96bUiQbT3 xiSQ== X-Gm-Message-State: AOAM533/h2/j2TlBPff96SM6NQzotveLkBaBTuY3Z4LMDNQXasGIj4im v/GdRu2y+gOjz0lFxF6P5r0HF09xI/m1SQ== X-Google-Smtp-Source: ABdhPJzS/kIh+IDgTtCgFcgdrgQokicAItbq9vmZFTfp4mz7mBLPtsp9uLt+LBF76wjN5f2X6bOnpw== X-Received: by 2002:ac8:326d:: with SMTP id y42mr11349417qta.243.1590079417200; Thu, 21 May 2020 09:43:37 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:36 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 17/74] hw/semihosting: convert to cpu_halted_set Date: Thu, 21 May 2020 12:39:14 -0400 Message-Id: <20200521164011.638-18-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Robert Foley Reviewed-by: Alex Bennée --- hw/semihosting/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c index 6346bd7f50..f70085f3c1 100644 --- a/hw/semihosting/console.c +++ b/hw/semihosting/console.c @@ -131,7 +131,7 @@ static void console_wake_up(gpointer data, gpointer user_data) { CPUState *cs = (CPUState *) data; /* cpu_handle_halt won't know we have work so just unbung here */ - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); } @@ -154,7 +154,7 @@ target_ulong qemu_semihosting_console_inc(CPUArchState *env) g_assert(current_cpu); if (fifo8_is_empty(&c->fifo)) { c->sleeping_cpus = g_slist_prepend(c->sleeping_cpus, current_cpu); - current_cpu->halted = 1; + cpu_halted_set(current_cpu, 1); current_cpu->exception_index = EXCP_HALTED; cpu_loop_exit(current_cpu); /* never returns */ From patchwork Thu May 21 16:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CFDF739 for ; Thu, 21 May 2020 16:53:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 243C420738 for ; Thu, 21 May 2020 16:53:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qxolO3NH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 243C420738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboRl-0006dT-AQ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:53:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIH-0002Tc-Lz for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:41 -0400 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]:41358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIG-0006XM-Mm for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:41 -0400 Received: by mail-qv1-xf44.google.com with SMTP id v15so3357276qvr.8 for ; Thu, 21 May 2020 09:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dMJD65Hlj8sZEjsVc6zG0Ir/AhvAmDKltVf3k3r4CgY=; b=qxolO3NHBjbuWSRVm36ecn5krJ1xJDM5MsGZe5bSWEmRz2qykCI/o2yo/NPfJ3CxQP UqPRK/+HK3cnZax4qIl/EXV5PqZd/zWzN9uyUetgiB/7NayvCslb5KR2+jKttR6Flm2o oXT0VevNgkoD14jUvTXvMbjiDA++0c8Oxv6GGAMV8JWe2+MxNWrBAx2195PKKvY0FGUv PG/n6uqVOMcQO9T4xYRpIRjbIaoyaCYpJzMPk/pkLqj/XsNniKiEmGjm9TwiyZqI64dO BBWUZDbpuiCo6+JCd2RC0lsYhp/6YKmL9IeXLsLkxmkzObsyg3H/Y7sf+uHiLQXhrWbv 7/sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dMJD65Hlj8sZEjsVc6zG0Ir/AhvAmDKltVf3k3r4CgY=; b=KuYo6IZlTZ1XttfxunsmF1aGxFv4mcvDe0aIuZ31VVzTZ6DAkqGoTEoXH/hBnM+dTj AP7RBtA9iY8mWIQvj5HPQICSUwFqQ+IaGzoYUSOoyfVcrPswBkMMG47xGUHTWq+gJpgM 0f8zY3Cgh2CuHwolhLwB7vI2o+7CIvVy4DUtfs3Pyss60uRE2EAFGma2QbJu0bfkYDB4 FP57VJ0OD4OWpUpz8kIEM95KCIbp1HR5sdWHHnEPvf0al/8/b38wz6HHX1Xh9H4ksLCK jvb98sA5Is5fMQH7qEGkGPiaQ+DfJT4CjB7xo4OlYJ4pNzZ+/0SbblF5XHeFRxBcys4j D1Zw== X-Gm-Message-State: AOAM5332XtZyh+abh8PK8/yt4zD86oNYgCBXHRSlXW7VrP2A8UeW86n4 LjrjaM4h5eunNvDZK7wQYLVJ/iNenEvjMw== X-Google-Smtp-Source: ABdhPJzU6+L9m9eKgmFy4T2CpzBwZGdFhnu+SPFlwBxgP8YjJY+IKwveBx7QWv1alWwOabyJgBzpMA== X-Received: by 2002:a0c:f590:: with SMTP id k16mr11076855qvm.81.1590079418769; Thu, 21 May 2020 09:43:38 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:37 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 18/74] arm: convert to cpu_halted Date: Thu, 21 May 2020 12:39:15 -0400 Message-Id: <20200521164011.638-19-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f44; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf44.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , robert.foley@linaro.org, alex.bennee@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-arm@nongnu.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/arm/omap1.c | 4 ++-- hw/arm/pxa2xx_gpio.c | 2 +- hw/arm/pxa2xx_pic.c | 2 +- target/arm/arm-powerctl.c | 6 +++--- target/arm/cpu.c | 2 +- target/arm/op_helper.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 761cc17ea9..83b1d63f27 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -1776,7 +1776,7 @@ static uint64_t omap_clkdsp_read(void *opaque, hwaddr addr, case 0x18: /* DSP_SYSST */ cpu = CPU(s->cpu); return (s->clkm.clocking_scheme << 11) | s->clkm.cold_start | - (cpu->halted << 6); /* Quite useless... */ + (cpu_halted(cpu) << 6); /* Quite useless... */ } OMAP_BAD_REG(addr); @@ -3797,7 +3797,7 @@ void omap_mpu_wakeup(void *opaque, int irq, int req) struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque; CPUState *cpu = CPU(mpu->cpu); - if (cpu->halted) { + if (cpu_halted(cpu)) { cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB); } } diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index f8df3cc227..23b4a06a4f 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -132,7 +132,7 @@ static void pxa2xx_gpio_set(void *opaque, int line, int level) pxa2xx_gpio_irq_update(s); /* Wake-up GPIOs */ - if (cpu->halted && (mask & ~s->dir[bank] & pxa2xx_gpio_wake[bank])) { + if (cpu_halted(cpu) && (mask & ~s->dir[bank] & pxa2xx_gpio_wake[bank])) { cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB); } } diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 203d4d28af..057448c2ed 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 b75f813b40..f0db413519 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -64,7 +64,7 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state, /* Initialize the cpu we are turning on */ cpu_reset(target_cpu_state); - target_cpu_state->halted = 0; + cpu_halted_set(target_cpu_state, 0); if (info->target_aa64) { if ((info->target_el < 3) && arm_feature(&target_cpu->env, @@ -241,7 +241,7 @@ static void arm_set_cpu_on_and_reset_async_work(CPUState *target_cpu_state, /* Initialize the cpu we are turning on */ cpu_reset(target_cpu_state); - target_cpu_state->halted = 0; + cpu_halted_set(target_cpu_state, 0); /* Finally set the power status */ assert(qemu_mutex_iothread_locked()); @@ -297,7 +297,7 @@ static void arm_set_cpu_off_async_work(CPUState *target_cpu_state, assert(qemu_mutex_iothread_locked()); target_cpu->power_state = PSCI_OFF; - target_cpu_state->halted = 1; + cpu_halted_set(target_cpu_state, 1); target_cpu_state->exception_index = EXCP_HLT; } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 32bec156f2..dc435a18a1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -175,7 +175,7 @@ static void arm_cpu_reset(DeviceState *dev) env->vfp.xregs[ARM_VFP_MVFR2] = cpu->isar.mvfr2; cpu->power_state = cpu->start_powered_off ? PSCI_OFF : PSCI_ON; - s->halted = cpu->start_powered_off; + cpu_halted_set(s, cpu->start_powered_off); if (arm_feature(env, ARM_FEATURE_IWMMXT)) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q'; diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index eb0de080f1..88c86a4346 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -305,7 +305,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) } cs->exception_index = EXCP_HLT; - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_loop_exit(cs); } From patchwork Thu May 21 16:39:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44D17739 for ; Thu, 21 May 2020 16:49:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C1AB2072C for ; Thu, 21 May 2020 16:49:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bN29/13S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C1AB2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboOD-00079B-6L for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:49:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboII-0002VL-N8 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:42 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:38180) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIH-0006Xb-HL for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:42 -0400 Received: by mail-qk1-x742.google.com with SMTP id f189so7857517qkd.5 for ; Thu, 21 May 2020 09:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6NkPzVbp7pB8hvFfdsKA9EEdR2aYnidZNgYq++P2+/c=; b=bN29/13S1TB+Mt2KQKrLcDbSzGXtjcu7xAuASP1uygOxNBrXG1x+JT9OvurLi1TB10 QD9s1V9bZlJZpweuS2rFiinRWa1HgHI4zk+7NERwvi1Gonw/fFaxlbOiXdhU14H6Jmbo kgCmP3LsQ7H1gZe64Iq8YxjdUys6nOf3soRG9pbjrXHlLzfJgPMTq9G4f17EwwTqOndA LpVUct/Fz0p2g6lYVweB9yZKZwezfOHdym/hwIqZDEMDU3cyhhck/VmTj2bxlI+xKzn+ 3XJM8PYl3J/TMDeltrcgWnUXximXal1rUPscxiJRlusBER0ndCRx0CgAaTrOXEkYUAIw q+CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6NkPzVbp7pB8hvFfdsKA9EEdR2aYnidZNgYq++P2+/c=; b=taNYWf+7EzXzGr/71Cr48SZXR+5BZZOD9NcyAt4agHBO9IN/rdm8UOZ/ZbWpDbgGpP M2dsrFMXpA89r/tBWtuzp818WGwouD8+KQ6MCzSjey/eedAwIeD/bx+OqOGBfj0cLmQC 5GW1eCH88WvpAiKJ3r8ZOb3yzEgpiJHgEg7Beb0nVZvE/zWWn8sL+INdgMS6GA/AAaBR MqtS5i7dO+G5GfXkU9X9bLBLza1UXP0rLHRxrhQB+7hBX5lrzEG3gOZUJ0FbrGx4OspI GRFhfT7DxQRRDAUeay7ga8KQ2yV22qF6HYzbgsn5nPEldbGbwfWjrrcnxAEhXw6FIr1Q r6vA== X-Gm-Message-State: AOAM533My6drMsFd3lkiuJPXBbv3+cAlN+C+4A4RaTKwiLiCr5HI39TZ z0+JdNgcYLgStYF6sIiSfF/oEkR/UF0xRQ== X-Google-Smtp-Source: ABdhPJzmlzM24e5Uy8a9AdtYRd+s24yjA2O3qNjMwAtIshkIyQnWHtISZAXAjoru0dtkedjm8lw8PA== X-Received: by 2002:a05:620a:14ac:: with SMTP id x12mr10388327qkj.262.1590079420064; Thu, 21 May 2020 09:43:40 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:39 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 19/74] ppc: convert to cpu_halted Date: Thu, 21 May 2020 12:39:16 -0400 Message-Id: <20200521164011.638-20-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" In ppce500_spin.c, acquire the lock just once to update both cpu->halted and cpu->stopped. In hw/ppc/spapr_hcall.c, acquire the lock just once to update cpu->halted and call cpu_has_work, since later in the series we'll acquire the BQL (if not already held) from cpu_has_work. Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota [RF: hw/ppc/spapr_hcall.c, spapr_rtas.c more conversions] Signed-off-by: Robert Foley --- hw/ppc/e500.c | 4 ++-- hw/ppc/ppc.c | 10 +++++----- hw/ppc/ppce500_spin.c | 6 ++++-- hw/ppc/spapr_cpu_core.c | 4 ++-- hw/ppc/spapr_hcall.c | 14 ++++++++------ hw/ppc/spapr_rtas.c | 8 ++++---- target/ppc/excp_helper.c | 4 ++-- target/ppc/helper_regs.h | 2 +- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 8 ++++---- 10 files changed, 34 insertions(+), 30 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 2a0b66a152..5683a8576e 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -706,7 +706,7 @@ static void ppce500_cpu_reset_sec(void *opaque) /* Secondary CPU starts in halted state for now. Needs to change when implementing non-kernel boot. */ - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } @@ -720,7 +720,7 @@ static void ppce500_cpu_reset(void *opaque) cpu_reset(cs); /* Set initial guest state. */ - cs->halted = 0; + cpu_halted_set(cs, 0); env->gpr[1] = (16 * MiB) - 8; env->gpr[3] = bi->dt_base; env->gpr[4] = 0; diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 4a11fb1640..0e7386ff88 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -149,7 +149,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level) /* XXX: Note that the only way to restart the CPU is to reset it */ if (level) { LOG_IRQ("%s: stop the CPU\n", __func__); - cs->halted = 1; + cpu_halted_set(cs, 1); } break; case PPC6xx_INPUT_HRESET: @@ -228,10 +228,10 @@ static void ppc970_set_irq(void *opaque, int pin, int level) /* XXX: TODO: relay the signal to CKSTP_OUT pin */ if (level) { LOG_IRQ("%s: stop the CPU\n", __func__); - cs->halted = 1; + cpu_halted_set(cs, 1); } else { LOG_IRQ("%s: restart the CPU\n", __func__); - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); } break; @@ -445,10 +445,10 @@ static void ppc40x_set_irq(void *opaque, int pin, int level) /* Level sensitive - active low */ if (level) { LOG_IRQ("%s: stop the CPU\n", __func__); - cs->halted = 1; + cpu_halted_set(cs, 1); } else { LOG_IRQ("%s: restart the CPU\n", __func__); - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); } break; diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index 66c1065db2..79313944cf 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -107,9 +107,11 @@ static void spin_kick(CPUState *cs, run_on_cpu_data data) map_start = ldq_p(&curspin->addr) & ~(map_size - 1); mmubooke_create_initial_mapping(env, 0, map_start, map_size); - cs->halted = 0; - cs->exception_index = -1; + cpu_mutex_lock(cs); + cpu_halted_set(cs, 0); cs->stopped = false; + cpu_mutex_unlock(cs); + cs->exception_index = -1; qemu_cpu_kick(cs); } diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index e1f76c74f3..b5d0b06f3a 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -39,7 +39,7 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu) /* All CPUs start halted. CPU0 is unhalted from the machine level * reset code and the rest are explicitly started up by the guest * using an RTAS call */ - cs->halted = 1; + cpu_halted_set(cs, 1); env->spr[SPR_HIOR] = 0; @@ -88,7 +88,7 @@ void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip, env->gpr[3] = r3; env->gpr[4] = r4; kvmppc_set_reg_ppc_online(cpu, 1); - CPU(cpu)->halted = 0; + cpu_halted_set(CPU(cpu), 0); /* Enable Power-saving mode Exit Cause exceptions */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] | pcc->lpcr_pm); } diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 0f54988f2e..e678ca29a5 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1058,17 +1058,19 @@ static target_ulong h_cede(PowerPCCPU *cpu, SpaprMachineState *spapr, env->msr |= (1ULL << MSR_EE); hreg_compute_hflags(env); + cpu_mutex_lock(cs); if (spapr_cpu->prod) { spapr_cpu->prod = false; + cpu_mutex_unlock(cs); return H_SUCCESS; } if (!cpu_has_work(cs)) { - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cs->exit_request = 1; } - + cpu_mutex_unlock(cs); return H_SUCCESS; } @@ -1085,7 +1087,7 @@ static target_ulong h_confer_self(PowerPCCPU *cpu) spapr_cpu->prod = false; return H_SUCCESS; } - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HALTED; cs->exit_request = 1; @@ -1116,7 +1118,7 @@ static target_ulong h_join(PowerPCCPU *cpu, SpaprMachineState *spapr, } /* Don't have a way to indicate joined, so use halted && MSR[EE]=0 */ - if (!cs->halted || (e->msr & (1ULL << MSR_EE))) { + if (!cpu_halted(cs) || (e->msr & (1ULL << MSR_EE))) { last_unjoined = false; break; } @@ -1199,7 +1201,7 @@ static target_ulong h_prod(PowerPCCPU *cpu, SpaprMachineState *spapr, spapr_cpu = spapr_cpu_state(tcpu); spapr_cpu->prod = true; - cs->halted = 0; + cpu_halted_set(cs, 0); qemu_cpu_kick(cs); return H_SUCCESS; @@ -1685,7 +1687,7 @@ target_ulong do_client_architecture_support(PowerPCCPU *cpu, if (cs == CPU(cpu)) { continue; } - if (!cs->halted) { + if (!cpu_halted(cs)) { warn_report("guest has multiple active vCPUs at CAS, which is not allowed"); return H_MULTI_THREADS_ACTIVE; } diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index bcac0d00e7..2306f2985e 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -111,7 +111,7 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cpu_, id = rtas_ld(args, 0); cpu = spapr_find_cpu(id); if (cpu != NULL) { - if (CPU(cpu)->halted) { + if (cpu_halted(CPU(cpu))) { rtas_st(rets, 1, 0); } else { rtas_st(rets, 1, 2); @@ -155,7 +155,7 @@ static void rtas_start_cpu(PowerPCCPU *callcpu, SpaprMachineState *spapr, env = &newcpu->env; pcc = POWERPC_CPU_GET_CLASS(newcpu); - if (!CPU(newcpu)->halted) { + if (!cpu_halted(CPU(newcpu))) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } @@ -213,7 +213,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, SpaprMachineState *spapr, */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm); env->spr[SPR_PSSCR] |= PSSCR_EC; - cs->halted = 1; + cpu_halted_set(cs, 1); kvmppc_set_reg_ppc_online(cpu, 0); qemu_cpu_kick(cs); } @@ -238,7 +238,7 @@ static void rtas_ibm_suspend_me(PowerPCCPU *cpu, SpaprMachineState *spapr, } /* See h_join */ - if (!cs->halted || (e->msr & (1ULL << MSR_EE))) { + if (!cpu_halted(cs) || (e->msr & (1ULL << MSR_EE))) { rtas_st(rets, 0, H_MULTI_THREADS_ACTIVE); return; } diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index f052979664..4c7da88682 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -293,7 +293,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) { @@ -1095,7 +1095,7 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn_t insn) CPUState *cs; cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); /* * The architecture specifies that HDEC interrupts are discarded diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index d78c2af63e..f84438f639 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -168,7 +168,7 @@ static inline int hreg_store_msr(CPUPPCState *env, target_ulong value, #if !defined(CONFIG_USER_ONLY) if (unlikely(msr_pow == 1)) { if (!env->pending_interrupts && (*env->check_pow)(env)) { - cs->halted = 1; + cpu_halted_set(cs, 1); excp = EXCP_HALTED; } } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2692f76130..aae2ef0ad4 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1342,7 +1342,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *cs) { - return cs->halted; + return cpu_halted(cs); } static int kvmppc_handle_halt(PowerPCCPU *cpu) @@ -1351,7 +1351,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu) CPUPPCState *env = &cpu->env; if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index d8adc1bd49..5838b6f7bc 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8539,7 +8539,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; } @@ -8701,7 +8701,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; } @@ -8901,7 +8901,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - if (cs->halted) { + if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { @@ -9117,7 +9117,7 @@ static bool cpu_has_work_POWER10(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - if (cs->halted) { + if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { From patchwork Thu May 21 16:39:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8208912 for ; Thu, 21 May 2020 16:52:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F2B020738 for ; Thu, 21 May 2020 16:52:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jvGgoa5J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F2B020738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboQL-0003a8-S4 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:52:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIJ-0002Y9-Ku for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:43 -0400 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:33325) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboII-0006Xi-MG for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:43 -0400 Received: by mail-qv1-xf2e.google.com with SMTP id er16so3384918qvb.0 for ; Thu, 21 May 2020 09:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B03XAH5wL6d9wQMcetAjOEJJOmedJjFZih4s04YDqvs=; b=jvGgoa5JZt5CVicHbc16hTgS5Fn5N/TMorjKWHm/EtJ0QfGc1Qd1Dg4L2xIVoTXL4M sv47rnUIQPB8R1OnFOpYz06yhZMr89bfS0cNGrNBq18RChGMckFReojim/2Cz1ftBvVv DnopBTJx1HbEJiTmabP2gOyYgBkMsVfrDrLW/iazS2hsMNzVaNtwttYQbqbzrwM3a13W C3UOfrAoiVszrbk4NgfhstQ/y0hnUilj3M5W8h5BmMVArhh9KPcmBYJSe6z0gi6GkJGb MIsQeNvpoqaGMp5GVagE4J9S8t5g1WdyqjVvLAbGtLzoOcwWdtXeFnbJpPmuaZYUhM60 uD4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B03XAH5wL6d9wQMcetAjOEJJOmedJjFZih4s04YDqvs=; b=Br14/sRPpV2JvDPEeWfCUHZlvAoQF28dKBnwBTqiH9bta3Ng0ITH8C0F8ziM4Thhrp cdFR4e7JH402iEJxPlYJhmQATJ+Pd6dVCKky+WCYax4Rp//ZHSHKxqmB3d8wdTvlLJ/7 QnrORZdXYt0akax7HqMJ5xn68aZXB6hqNWoiIruQFMyAOK4O4oTi6EaR0edm3s7RhZ8D mNKu7FP90KBazRBs3fNT7t3tpHh7vEkH4TUNdenpAEQED7AukJ0dOchLmTlusQ6U0UKM NmvFL0L32h4n8/mLFUJyqRmkwGTl8R/R5LJpf22R5XyDlkg74xsv0UaqqM7gxkJJNoIv XGdw== X-Gm-Message-State: AOAM533gJ6XMXWsC2/nNHHjY8+mVEEDbH2Ypqn7L+2gUxiuzjlFwdAc5 XXB1ox7UDJD1atlDP2VYz3BiBYypESZoKQ== X-Google-Smtp-Source: ABdhPJwauUADvarZIupVpII3EkKwJC6Hl/hp6lE3oS72bnfRn432rctRTAmqR0J6vsXwYWLg269Frg== X-Received: by 2002:ad4:5290:: with SMTP id v16mr11065935qvr.240.1590079421433; Thu, 21 May 2020 09:43:41 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:40 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 20/74] sh4: convert to cpu_halted Date: Thu, 21 May 2020 12:39:17 -0400 Message-Id: <20200521164011.638-21-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2e; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf2e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Aurelien Jarno Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/sh4/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/sh4/op_helper.c b/target/sh4/op_helper.c index 14c3db0f48..d338bbe871 100644 --- a/target/sh4/op_helper.c +++ b/target/sh4/op_helper.c @@ -90,7 +90,7 @@ void helper_sleep(CPUSH4State *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); env->in_sleep = 1; raise_exception(env, EXCP_HLT, 0); } From patchwork Thu May 21 16:39:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 882FF739 for ; Thu, 21 May 2020 16:51:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EB8520738 for ; Thu, 21 May 2020 16:51:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iSj+bopD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EB8520738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboQ3-0002mw-Ef for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:51:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIL-0002d6-CO for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:45 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:34575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIK-0006Xw-06 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:45 -0400 Received: by mail-qt1-x843.google.com with SMTP id a23so6023936qto.1 for ; Thu, 21 May 2020 09:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qtqfEoZBoJ8vkEt8rL/rMli38pXfJMRcQSr/KYX6LMA=; b=iSj+bopDCoBTHZxhZbdSZLYG7WuOx41MlKy2OfnVeNpaZ0cnbPO/y5FoTYouCPDoDz kPrH6h/tjlTnVraLKgYWEvt1CZk1/gC8fmA4fElsaOhcldb6SuHTqvHX0I4GHF6RN7iC gFIbreBnXtDAkxC+BQIy8hbCEJAfYG+WvzxdtEO5arfYc51MNeTDM0qQA5qZVIBQx5e6 jZvN6cSE7zhbiTDZlzBde+0H8lvpHE4NLkQQ9ohz8r0MwDKiCx8TyQoFwJwWqttr/Bur 73XnL0cIlthHROXMhMkZ2g9XmVelmNZwNzHw/XiXkcLbRebrjVrYnc7+KrVWCtqEdt1u ZUog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qtqfEoZBoJ8vkEt8rL/rMli38pXfJMRcQSr/KYX6LMA=; b=ot6Tkx2nB2L4NnvKbG5hbUD1pr8q1ZzgaAyQML/+yRmeczkold01OhO8m2xL/989eg 7G5R10d9krBCqHM3IOOLAmDVBQgCSVaH6YsYpZo8VE2GCbv0CClGVbOyRVqdjWMvzYbG UvA9h6e1bd+BVTti1UOcSTfO6BjOTsLsRnZVA7fTh9qutozzA5dGmRDTS/ujvKpYODxB 3Q8Y3G6JUhwIDX7l5447ZxIEtYBEHsgWnz8lTXIPK1wUjiPMx9AgrD9L872AnJE47HYR VR4Wr/fnZ/FHHbGshEU9atYURyMp5x/IuYehXG8I+/1DzeoNYRC768g8js0u/U5F5OTt 296A== X-Gm-Message-State: AOAM531NucF5YSDBe2qHQH6HMnJYEXAE34bv9r3Joua9w1rUVDDtJsCU mUwsq8hFkdrKOjjdss2zEaYskEe10RMI0g== X-Google-Smtp-Source: ABdhPJy7wRjWvopUVMvBlVkxwj7wInXL6gwDowtForEyWLBXwgtLfBIIXVrHmURwAk8ignRA0Hkasw== X-Received: by 2002:ac8:86:: with SMTP id c6mr11440993qtg.176.1590079422715; Thu, 21 May 2020 09:43:42 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:42 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 21/74] i386: convert to cpu_halted Date: Thu, 21 May 2020 12:39:18 -0400 Message-Id: <20200521164011.638-22-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Eduardo Habkost Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Eduardo Habkost Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted new code in i386/hax-all.c to cpu_halted] Signed-off-by: Robert Foley --- target/i386/cpu.c | 2 +- target/i386/cpu.h | 2 +- target/i386/hax-all.c | 6 +++--- target/i386/helper.c | 4 ++-- target/i386/hvf/hvf.c | 4 ++-- target/i386/hvf/x86hvf.c | 4 ++-- target/i386/kvm.c | 10 +++++----- target/i386/misc_helper.c | 2 +- target/i386/whpx-all.c | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7a4a8e3847..9e8ae1569f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6045,7 +6045,7 @@ static void x86_cpu_reset(DeviceState *dev) /* We hard-wire the BSP to the first CPU. */ apic_designate_bsp(cpu->apic_state, s->cpu_index == 0); - s->halted = !cpu_is_bsp(cpu); + cpu_halted_set(s, !cpu_is_bsp(cpu)); if (kvm_enabled()) { kvm_arch_reset_vcpu(cpu); diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 408392dbf6..ef1dca3f98 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1867,7 +1867,7 @@ static inline void cpu_x86_load_seg_cache_sipi(X86CPU *cpu, sipi_vector << 12, env->segs[R_CS].limit, env->segs[R_CS].flags); - cs->halted = 0; + cpu_halted_set(cs, 0); } int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector, diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index f9c83fff25..25bf80b5f2 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -498,7 +498,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - cpu->halted = 0; + cpu_halted_set(cpu, 0); } if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { @@ -516,7 +516,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) hax_vcpu_sync_state(env, 1); } - if (cpu->halted) { + if (cpu_halted(cpu)) { /* If this vcpu is halted, we must not ask HAXM to run it. Instead, we * break out of hax_smp_cpu_exec() as if this vcpu had executed HLT. * That way, this vcpu thread will be trapped in qemu_wait_io_event(), @@ -581,7 +581,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { /* hlt instruction with interrupt disabled is shutdown */ env->eflags |= IF_MASK; - cpu->halted = 1; + cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; ret = 1; } diff --git a/target/i386/helper.c b/target/i386/helper.c index c3a6e4fabe..058de4073d 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -450,7 +450,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags) (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, (env->a20_mask >> 20) & 1, (env->hflags >> HF_SMM_SHIFT) & 1, - cs->halted); + cpu_halted(cs)); } else #endif { @@ -477,7 +477,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags) (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1, (env->a20_mask >> 20) & 1, (env->hflags >> HF_SMM_SHIFT) & 1, - cs->halted); + cpu_halted(cs)); } for(i = 0; i < 6; i++) { diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index d72543dc31..bf60ce9d66 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -704,7 +704,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; } @@ -738,7 +738,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; break; } diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index edefe5319a..cbb2144724 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_state); } diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 34f838728d..1c1d4c8c0a 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3568,7 +3568,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; } @@ -4126,7 +4126,7 @@ int kvm_arch_process_async_events(CPUState *cs) kvm_queue_exception(env, EXCP12_MCHK, 0, 0); env->has_error_code = 0; - cs->halted = 0; + cpu_halted_set(cs, 0); if (kvm_irqchip_in_kernel() && env->mp_state == KVM_MP_STATE_HALTED) { env->mp_state = KVM_MP_STATE_RUNNABLE; } @@ -4149,7 +4149,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); @@ -4162,7 +4162,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) @@ -4173,7 +4173,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 7d61221024..dace1956a0 100644 --- a/target/i386/misc_helper.c +++ b/target/i386/misc_helper.c @@ -558,7 +558,7 @@ static void do_hlt(X86CPU *cpu) CPUX86State *env = &cpu->env; env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */ - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index c78baac6df..efc2d88810 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -759,7 +759,7 @@ static int whpx_handle_halt(CPUState *cpu) (env->eflags & IF_MASK)) && !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; - cpu->halted = true; + cpu_halted_set(cpu, true); ret = 1; } qemu_mutex_unlock_iothread(); @@ -918,7 +918,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - cpu->halted = false; + cpu_halted_set(cpu, false); } if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { @@ -944,7 +944,7 @@ static int whpx_vcpu_run(CPUState *cpu) int ret; whpx_vcpu_process_async_events(cpu); - if (cpu->halted) { + if (cpu_halted(cpu)) { cpu->exception_index = EXCP_HLT; atomic_set(&cpu->exit_request, false); return 0; From patchwork Thu May 21 16:39:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563475 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43F01739 for ; Thu, 21 May 2020 16:55:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A461207F7 for ; Thu, 21 May 2020 16:55:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fWdhUQ9Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A461207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboTf-0001XE-5M for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:55:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIO-0002l9-A2 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:48 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:40832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIL-0006Y0-Ck for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:47 -0400 Received: by mail-qt1-x843.google.com with SMTP id c24so5986612qtw.7 for ; Thu, 21 May 2020 09:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KjBP9WZwlnczZ3SxEnPdyurMaB67UgSlf8Umf0tpZgo=; b=fWdhUQ9QDGfIDTwPNDlX0mlIPYdDBaAqTFJsRlfJaT5q/AK7gwe/FrEKQp8KiqRTal PSReBmdNn44dU6366N0DN5DmPy6SxGkrlC+9gMyXLFOKH3SvBISVc9Em3255AFVWQa1h q1tpMeKJyNPVgM8FOQGDxey99hRJPfO1Z2Gd+Ta2bQvMKZI7Ncq3oAY5b/i7imRbpz2k f0+Pj52QXw1iR0yuztBfP0YB44aZVi6GmTxI4WR/3gC9Er+GoSq2x5QvkMQUtC3of2u7 IY7W8R1h4PQsc54hJ78/VDFaZ7G4mjo4e+0Evwm4vAiW/Inmwcl3xIkV7bfZUHE9JW9K CuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KjBP9WZwlnczZ3SxEnPdyurMaB67UgSlf8Umf0tpZgo=; b=EasXcB5+JN1Fcr5SQGqNMEbtmvDETbjpY66TI19viISAXXBsN1WXnQ7InRVqbfepeX a0HT1POqYwwGwsFuj4JodfbCiu3a8ZFvjYE6KrXDIMFq3oTBAkqKS4HmPJR5z+QJoBGO uQ8VqgwCZCsvkuUfSV91yk9YQEkfAbj38ngCZhO+Ugt12xrYOwawSmsyupFJw1QOZCwh 3s9xKWIj6K10tKHHvAEIqGBvgugWuiD+sP6isPFrpiR2x43aH/svb3dEzC5k5usPzozE H4MNnpbJ3uuv3ZVagN2716fI4YvzYbagxd8pT7vWRfBsA9cOLyzV7vYb2vmyEOZjO+ru d0xA== X-Gm-Message-State: AOAM530o0M1KG1/L5sujtgERZDk0YOgqbG9yIrPuKYgyfa3O7QJkNAdO 1Ti29GjpMcFiap5GjT+oZHoXgocfHaQS5Q== X-Google-Smtp-Source: ABdhPJywYeTTI0lJosOvvYPrxL5f20+z7SGx3K+ydJOJq4E/Cg9EwW0muTqENoolMaZ3Lz3SeY173w== X-Received: by 2002:ac8:2fb9:: with SMTP id l54mr10849450qta.211.1590079424259; Thu, 21 May 2020 09:43:44 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:43 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 22/74] lm32: convert to cpu_halted Date: Thu, 21 May 2020 12:39:19 -0400 Message-Id: <20200521164011.638-23-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Michael Walle , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Michael Walle Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/lm32/op_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c index e39fcd5647..8e0bd57b9d 100644 --- a/target/lm32/op_helper.c +++ b/target/lm32/op_helper.c @@ -32,7 +32,7 @@ void HELPER(hlt)(CPULM32State *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } @@ -45,7 +45,7 @@ void HELPER(ill)(CPULM32State *env) "Connect a debugger or switch to the monitor console " "to find out more.\n"); vm_stop(RUN_STATE_PAUSED); - cs->halted = 1; + cpu_halted_set(cs, 1); raise_exception(env, EXCP_HALTED); #endif } From patchwork Thu May 21 16:39:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F3B1739 for ; Thu, 21 May 2020 16:55:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56608207F7 for ; Thu, 21 May 2020 16:55:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KiaWPAh3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56608207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboTm-0001kh-E5 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:55:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIO-0002ki-3w for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:48 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:42228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIN-0006Y8-4B for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:47 -0400 Received: by mail-qt1-x841.google.com with SMTP id x12so5965725qts.9 for ; Thu, 21 May 2020 09:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9s3zaT975n7OFyLauiO739G/mW0fqcwhecj+9+iav3g=; b=KiaWPAh38N4S3fL3nVjRC77mYVrMao+P5F0G0zi327mlEdTOHRUjDXZS7qaVSyT90N /iFVBezNTO1Vp8SSSzAnk4h7zTn1F4vUznS+U8swpDx1RKmdTf+sL08loxARBlOkMW3z j+C2EYq1+eYdh9D6JXOClchRUrWVWJHSqP/iX1Oafs9VME/DvIzBqhd5LWe9YkVlzK/V xVTaqdUA3QVHL6wgBOS7D42XVrZk+wMC/A8B31hWxG8c0uL2Oe0aYnTW8lxB77tUKZnU g3C8xKYUAB1OqBu1K7SGuayeYpTjbIq+9hu/9E1p0bsPMvVFLwAaRusmXSIuaJ8FeyqV 0exA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9s3zaT975n7OFyLauiO739G/mW0fqcwhecj+9+iav3g=; b=X5iEf2lbl/AlTo7I95S+JZbgSDVEhV8nZ2DtidkbPiTX8i9tsQl8qbJ2qlRvyph2Ry pT40nN65xNLrGGrw3Gy7DTTIwcd1wJCE0bU56OtlWjq/+HKNpnTYPewVVJ/MFMI4++vI +K52jWWNjaoGIwU1TagDw9FcjSfAiHjZn/CNYMF3ADfHhRperf7CBBxVL8sWDgF0kr5z FnSoCsKkZDlKrMg3IvEcqO4tO8ACEA7kO6fVcF9qPibxK3dHM/OwK8gaGg/4mmp2iKCa 8HRQ2VdUV7QxJ1ypKtY/oq2Qu8xCl6iC5r5WweIO3zLdIj99O7kp+RzL8hZROt60RTnm NfEg== X-Gm-Message-State: AOAM530/6nEtesCibHInp6r/OdNkY1BpF2+nf+9tC6+wS1ahkrAXLBlu MFA9Tmq0+VWKAtOfhS4biXd27ql1SjnoVQ== X-Google-Smtp-Source: ABdhPJzY587YpBTuzBXN/9VxCPFM5wS2+T2U3pwnjrFdxWK9VeQGBAXHNnVW6KkmhZtVpWiSeflnJg== X-Received: by 2002:ac8:699a:: with SMTP id o26mr11128102qtq.92.1590079425655; Thu, 21 May 2020 09:43:45 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:44 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 23/74] m68k: convert to cpu_halted Date: Thu, 21 May 2020 12:39:20 -0400 Message-Id: <20200521164011.638-24-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/m68k/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 202498deb5..4a032a150e 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -222,7 +222,7 @@ static void cf_interrupt_all(CPUM68KState *env, int is_hw) do_m68k_semihosting(env, env->dregs[0]); return; } - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); return; From patchwork Thu May 21 16:39:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563469 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60EB4739 for ; Thu, 21 May 2020 16:53:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37E2B20738 for ; Thu, 21 May 2020 16:53:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pZb91J4+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37E2B20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboRj-0006WN-Bv for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:53:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIP-0002oR-CW for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:49 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:43885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIO-0006YJ-8c for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:49 -0400 Received: by mail-qt1-x844.google.com with SMTP id o19so5959582qtr.10 for ; Thu, 21 May 2020 09:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g63owhhb8d7q+R165WbO0bbEASJ91qSEhs9R7K8DZ68=; b=pZb91J4+YV1jkHgjHuVL16X0gRx2pwVmAFRvZc3r7ppD8tNl4e4ssbPY62XRNoDpZu IE0+VzWruGoYhdw9k2kqB8lrboZGXkAmX0rjGf9V85f7fcoV2ow4k7fHDkYjTeDOPltX s7bJZCktdCI7Gs+RN0YkXSONm7E3cYXLNTCx3HNDjCbkQPJU/19CVBEFH2DuxWWqqSO6 a5s5ZbTwTZeAH/rrJsu2x1jeEWTgZjRQReo7AxajmxTNAiwAcrhNWXDaCQCIZ/7OK4YQ iUpfjJWQtoxw0uP4UB0g9iLOAW+SSfsX1bVeb0wPz2LCWy9xTJtOrqyVhg6J2wiN/idr DKNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g63owhhb8d7q+R165WbO0bbEASJ91qSEhs9R7K8DZ68=; b=eYbEhl1GE0QUvOcv/NaxZT0lNzuoixxQeox1PUad9t/tI7E0lOcboV3KLrqiKtFNyi zIMh2/56BlC4lSA2pxLfwyZdAYuwMPQ0D5FNRKMtIN4RAnzqrQlU/3OR6qVknNRxu+3P SDB3e/FgxrcGBgmZKRI2c/eJwcNXjG4eiuJ9nC/dwoB05ILQb997WqSPckd27Arg3qLe hntgvIyOS62yoV4Ra9KQoL2ltlODHum3VotGLRwCpymSxUlBEHfloA2S4yh9sjowA6Ch dcGTGbA7Fv0YB1ykHOqdOeGudioIP3NUlzDTKYnZc+eBEc69gEKKoRCFSJbfrx9vlqOS fBow== X-Gm-Message-State: AOAM530Td0fp3E6uW5Yi+VyFTwAFtjWLeo9mL6xGU95PMWhxFMuS4fJc rJPp8v4UGJDKVkPb16zdHldwq9zKUcFPVw== X-Google-Smtp-Source: ABdhPJxoSA+WpbJOz0cRapSvWGyFgNqZskC4h70FVJaCxHtB3cxQ7wfGL4lkfk+WXbNiZu8tuO9BHg== X-Received: by 2002:ac8:6c54:: with SMTP id z20mr11445559qtu.76.1590079427042; Thu, 21 May 2020 09:43:47 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:46 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 24/74] mips: convert to cpu_halted Date: Thu, 21 May 2020 12:39:21 -0400 Message-Id: <20200521164011.638-25-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted code in target/mips/kvm.c to cpu_halted.] Signed-off-by: Robert Foley --- hw/mips/cps.c | 2 +- hw/misc/mips_itu.c | 4 ++-- target/mips/cp0_helper.c | 6 +++--- target/mips/kvm.c | 2 +- target/mips/op_helper.c | 2 +- target/mips/translate.c | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 92b9b1a5f6..0123510fab 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -54,7 +54,7 @@ static void main_cpu_reset(void *opaque) cpu_reset(cs); /* All VPs are halted on reset. Leave powering up to CPC. */ - cs->halted = 1; + cpu_halted_set(cs, 1); } static bool cpu_mips_itu_supported(CPUMIPSState *env) diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index 3540985258..623a600ed1 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -183,7 +183,7 @@ static void wake_blocked_threads(ITCStorageCell *c) { CPUState *cs; CPU_FOREACH(cs) { - if (cs->halted && (c->blocked_threads & (1ULL << cs->cpu_index))) { + if (cpu_halted(cs) && (c->blocked_threads & (1ULL << cs->cpu_index))) { cpu_interrupt(cs, CPU_INTERRUPT_WAKE); } } @@ -193,7 +193,7 @@ static void wake_blocked_threads(ITCStorageCell *c) static void QEMU_NORETURN block_thread_and_exit(ITCStorageCell *c) { c->blocked_threads |= 1ULL << current_cpu->cpu_index; - current_cpu->halted = 1; + cpu_halted_set(current_cpu, 1); current_cpu->exception_index = EXCP_HLT; cpu_loop_exit_restore(current_cpu, current_cpu->mem_io_pc); } diff --git a/target/mips/cp0_helper.c b/target/mips/cp0_helper.c index bbf12e4a97..4d413c24d3 100644 --- a/target/mips/cp0_helper.c +++ b/target/mips/cp0_helper.c @@ -43,7 +43,7 @@ static bool mips_vpe_is_wfi(MIPSCPU *c) * If the VPE is halted but otherwise active, it means it's waiting for * an interrupt.\ */ - return cpu->halted && mips_vpe_active(env); + return cpu_halted(cpu) && mips_vpe_active(env); } static bool mips_vp_is_wfi(MIPSCPU *c) @@ -51,7 +51,7 @@ static bool mips_vp_is_wfi(MIPSCPU *c) CPUState *cpu = CPU(c); CPUMIPSState *env = &c->env; - return cpu->halted && mips_vp_active(env); + return cpu_halted(cpu) && mips_vp_active(env); } static inline void mips_vpe_wake(MIPSCPU *c) @@ -74,7 +74,7 @@ static inline void mips_vpe_sleep(MIPSCPU *cpu) * The VPE was shut off, really go to bed. * Reset any old _WAKE requests. */ - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_reset_interrupt(cs, CPU_INTERRUPT_WAKE); } diff --git a/target/mips/kvm.c b/target/mips/kvm.c index de3e26ef1f..2b7d680547 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -162,7 +162,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *cs) { - return cs->halted; + return cpu_halted(cs); } int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run) diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c index 9552b280e0..152b45826c 100644 --- a/target/mips/op_helper.c +++ b/target/mips/op_helper.c @@ -1124,7 +1124,7 @@ void helper_wait(CPUMIPSState *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); cpu_reset_interrupt(cs, CPU_INTERRUPT_WAKE); /* * Last instruction in the block, PC was updated before diff --git a/target/mips/translate.c b/target/mips/translate.c index 25b595a17d..35ea86a49b 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -31328,7 +31328,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. */ @@ -31336,7 +31336,7 @@ void cpu_state_reset(CPUMIPSState *env) env->CP0_VPEConf0 |= (1 << CP0VPEC0_MVP) | (1 << CP0VPEC0_VPA); /* TC0 starts up unhalted. */ - cs->halted = 0; + cpu_halted_set(cs, 0); env->active_tc.CP0_TCHalt = 0; env->tcs[0].CP0_TCHalt = 0; /* With thread 0 active. */ From patchwork Thu May 21 16:39:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563485 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93284912 for ; Thu, 21 May 2020 16:57:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69D62207F7 for ; Thu, 21 May 2020 16:57:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CpxQeAGx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69D62207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboVI-00059H-FT for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:57:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIS-0002w8-6F for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:52 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:34316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIP-0006YT-Ib for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:51 -0400 Received: by mail-qk1-x742.google.com with SMTP id 190so7915052qki.1 for ; Thu, 21 May 2020 09:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bf2M7IKMoOMF6Sjf+JSOoIalG8faUHKpuzaEeGoqpyk=; b=CpxQeAGx8TZeGeXCndTivoFVEPvVHSGlAHKM5Z3h72tFh8Q7dbUmzVtrWIwZGXOuDF H7QeoRrBEdnBPtnHglGne7Zj7GIvtaNs5mTEkCQPvK+YGehvF61Go84gnUiDk0ZkTEJh d/JS6OAOQvuqsAPSAa+S2qI6Ur+wL2E1w7sd7qjKoUUjrlqiYLiIVrVJkaLBYrkpfjWD j3p5TN6bQI/IQo9lPk2zisrB10SEJPvW5b+OEI+OebCqpLgDkA3tO+DcK/QFCB32hdqQ 2MQVzLoenOyiIf2zDNs00ls0VZJ/gvhPiNv16yzK05ikbFPDfwrluxNiYJgaKjvQlmXi PZZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bf2M7IKMoOMF6Sjf+JSOoIalG8faUHKpuzaEeGoqpyk=; b=md27t9Ywitrji/i89v0Rl9Ll9Gdgo2KzKVr79oYm4Oy6pAjZQ/aPRcYmziE4YDts+e gzfuL/Hd5aePReD8WXEqa2tO3nmFhYngaoLDyCVklffIVJUMp7d6vRC17PRzZOcH1p2H 9eaAKYIDD0zTLhhjUO6ECtnfqIqRrMvsk347/Mc7k16PdTuyX1c+AJNFUhIQVnUvb2oZ 9Mm8MCFS8lbF4jcetU4zTCIG3DzoJGXmihG5wn8r1pQix80pIEsoInIDomBjIZVA1FIT oGrmrChxfb0uxjPdmw8RY3YYX8Pi1VCyINP4ZR+a7g3LpNU697bgnhISqO49KfZWgl+B aatQ== X-Gm-Message-State: AOAM532D2dtoHxjZR+1p20v6M+NKjUlpwlZ4zAPt+42BJTd8igOSU4v+ ApNT1H8K0/J3Zu14F4o5/X1HkoxSwGvExw== X-Google-Smtp-Source: ABdhPJz4vA4l4XHRsC/4uwQgyE6lSBXU2jDNFciiYN+8QzeLKfXXraXCSMSE+T92qWXGXwkSamUMmA== X-Received: by 2002:a37:4917:: with SMTP id w23mr5295799qka.161.1590079428361; Thu, 21 May 2020 09:43:48 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:47 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 25/74] riscv: convert to cpu_halted Date: Thu, 21 May 2020 12:39:22 -0400 Message-Id: <20200521164011.638-26-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Sagar Karandikar Cc: Bastian Koppelmann Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/riscv/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index c6412f680c..91f8833c2e 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -182,7 +182,7 @@ void helper_wfi(CPURISCVState *env) riscv_cpu_virt_enabled(env)) { riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); } else { - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; cpu_loop_exit(cs); } From patchwork Thu May 21 16:39:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563473 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 215F5739 for ; Thu, 21 May 2020 16:54:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC54D20738 for ; Thu, 21 May 2020 16:54:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZkfYDUUg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC54D20738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboSy-0000GX-W0 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:54:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIS-0002xs-Pc for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:52 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:42237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIR-0006Yh-3S for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:52 -0400 Received: by mail-qk1-x744.google.com with SMTP id s1so7835957qkf.9 for ; Thu, 21 May 2020 09:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WqInjgZviyNdzW5p2Hg5xhlKpmgDlxcslWkF7JOAFYA=; b=ZkfYDUUgKAGy5gWJ52+BEeFQi29PP6rBSegwRrL7iwnA+lQL8U9jVTc1qVmX3UZ6SB E/2bDy/H69RDUeIB8fHzgZclwxLndyZDP/SFsHfBNghvnUOjmB4puCH+Go78ZUYJ08Zw zcRtGdvEmJpV8Unf7qgLaHRtAQ/bsT4ZAlq9rU4h9ZRd56fSfO2YMlmU3G6qnl7Uz45U JTu4HKBFKLVV17YC1ZR68FVuAPyGyLmwGFG8JL9ijgSMxQNQ8LZzmTpQ8UbJUdxxrJnO mTWB+WlW8I9pDhY1+WOwue8nFcfUtHBPAvzerIJmbJDyC5UXWW3ehRQzYj2Ebj6n7hK8 +l6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WqInjgZviyNdzW5p2Hg5xhlKpmgDlxcslWkF7JOAFYA=; b=bu7/JQyLou0U004XlfA/mMA8yOBANvWGo1eV2NvrjouC6TIVxVr4iOOh2PmtuPF4AH FXPbFcrU+uOdym177cjQ1xCEWxUY5JWquBCvsuwcZzIoHJ9cWUDP+8iVh7Mk5T9gVaL7 ysC3bN3DKnI1kehmW5Bn99YEzQot05JS6/uVh5LFyQmQeqJ6cquFFC/jMvCt3gI8Jm3O /bV4qPEkevEZUQZOY6fxsmUu9V/g9NOLM2R0SLlnP6Zy7Z2PtVw/62s5NYcq+foQmTeF eXpCVQYNRwkju9mxalvuvJp9klQaYqVvb8r1PmZXxB/ibRvD4wvq+3g2DBC8ZWNSPWmW r/gg== X-Gm-Message-State: AOAM5332tqLw1YKKuh08QNY9677FRpwAu5VGL6I+kx3wCc1QhMISmAe+ VZuAaeNbRZWwss4sUJ/svc1mzDAfSOpX2A== X-Google-Smtp-Source: ABdhPJxmQY+QPlxS11ljJsb1F1MnPxOiUEaHhO0JzZc+Ks7lGnlbOkxzAduA0w3S1uY25eTzJoLwUQ== X-Received: by 2002:a37:9d09:: with SMTP id g9mr10906870qke.154.1590079429752; Thu, 21 May 2020 09:43:49 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:49 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 26/74] s390x: convert to cpu_halted Date: Thu, 21 May 2020 12:39:23 -0400 Message-Id: <20200521164011.638-27-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, David Hildenbrand , richard.henderson@linaro.org, Christian Borntraeger , qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Christian Borntraeger Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 22 +++++++++++++++------- target/s390x/excp_helper.c | 2 +- target/s390x/kvm.c | 2 +- target/s390x/sigp.c | 8 ++++---- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index baca4d8a2d..a1c6b8a6f6 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -200,7 +200,7 @@ static void qemu_s390_flic_notify(uint32_t type) } /* we always kick running CPUs for now, this is tricky */ - if (cs->halted) { + if (cpu_halted(cs)) { /* don't check for subclasses, CPUs double check when waking up */ if (type & FLIC_PENDING_SERVICE) { if (!(cpu->env.psw.mask & PSW_MASK_EXT)) { diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index ca50b70451..4b1961694e 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -293,7 +293,7 @@ static void s390_cpu_initfn(Object *obj) S390CPU *cpu = S390_CPU(obj); cpu_set_cpustate_pointers(cpu); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; object_property_add(obj, "crash-information", "GuestPanicInformation", s390_cpu_get_crash_info_qom, NULL, NULL, NULL); @@ -320,8 +320,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) @@ -347,10 +347,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(); } @@ -360,10 +366,12 @@ void s390_cpu_unhalt(S390CPU *cpu) CPUState *cs = CPU(cpu); trace_cpu_unhalt(cs->cpu_index); - if (cs->halted) { - cs->halted = 0; + cpu_mutex_lock(cs); + if (cpu_halted(cs)) { + cpu_halted_set(cs, 0); cs->exception_index = -1; } + cpu_mutex_unlock(cs); } unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 3b58d10df3..db6640ba2c 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -537,7 +537,7 @@ try_deliver: if ((env->psw.mask & PSW_MASK_WAIT) || stopped) { /* don't trigger a cpu_loop_exit(), use an interrupt instead */ cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); - } else if (cs->halted) { + } else if (cpu_halted(cs)) { /* unhalt if we had a WAIT PSW somehwere in our injection chain */ s390_cpu_unhalt(cpu); } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 69881a0da0..ae3e0880f1 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1094,7 +1094,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *cs) { - return cs->halted; + return cpu_halted(cs); } static int s390_kvm_irq_to_interrupt(struct kvm_s390_irq *irq, diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c index c604f17710..44d22ae3bf 100644 --- a/target/s390x/sigp.c +++ b/target/s390x/sigp.c @@ -115,7 +115,7 @@ static void sigp_stop(CPUState *cs, run_on_cpu_data arg) } /* disabled wait - sleeping in user space */ - if (cs->halted) { + if (cpu_halted(cs)) { s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); } else { /* execute the stop function */ @@ -131,7 +131,7 @@ static void sigp_stop_and_store_status(CPUState *cs, run_on_cpu_data arg) SigpInfo *si = arg.host_ptr; /* disabled wait - sleeping in user space */ - if (s390_cpu_get_state(cpu) == S390_CPU_STATE_OPERATING && cs->halted) { + if (s390_cpu_get_state(cpu) == S390_CPU_STATE_OPERATING && cpu_halted(cs)) { s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); } @@ -313,7 +313,7 @@ static void sigp_cond_emergency(S390CPU *src_cpu, S390CPU *dst_cpu, } /* this looks racy, but these values are only used when STOPPED */ - idle = CPU(dst_cpu)->halted; + idle = cpu_halted(CPU(dst_cpu)); psw_addr = dst_cpu->env.psw.addr; psw_mask = dst_cpu->env.psw.mask; asn = si->param; @@ -347,7 +347,7 @@ static void sigp_sense_running(S390CPU *dst_cpu, SigpInfo *si) } /* If halted (which includes also STOPPED), it is not running */ - if (CPU(dst_cpu)->halted) { + if (cpu_halted(CPU(dst_cpu))) { set_sigp_status(si, SIGP_STAT_NOT_RUNNING); } else { si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; From patchwork Thu May 21 16:39:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563483 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C07C5912 for ; Thu, 21 May 2020 16:57:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 973C420826 for ; Thu, 21 May 2020 16:57:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RDIeoaKV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 973C420826 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboVA-00050q-RR for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIT-00030Z-Np for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:53 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:35551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIS-0006Yr-IY for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:53 -0400 Received: by mail-qt1-x832.google.com with SMTP id z18so6021834qto.2 for ; Thu, 21 May 2020 09:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eHaQBXlGwYEJ+LUDpIzgk48KJ4nxL6vb+7Ag6IrpPa0=; b=RDIeoaKVwO60kH/bb4xqU79wAH4A5kAGqh6pg4mG3qUN081R0/NYSQKrYxa7PN2667 UtmNc34vJIS+NZoY7Afx3SgzYhhBxicmb9jME1fbIiqpJX/IFyAWI43BiXziV1rMYwSU EeN+ttXpYvKcKJYnU1vdoSe+3/PIrxGCz7D9Q3eBPJH1Bnh3GaOBQ/4p+3SRt38ppu5T 9z6zLy/f30lhlXCpg3B4zGqRbCZJ02dfUosiCdFiTZl3pa5OCFgeG257UjLD7p7BcBJ/ k4gW8DxwJog+JPsMPoEOuINiOa1yq/ZIuvzqxT7bugiUoQqdWcEFIYkAUF9vEkKtAQPr zJsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eHaQBXlGwYEJ+LUDpIzgk48KJ4nxL6vb+7Ag6IrpPa0=; b=osbgRicbre7dyhmxSN+RjDemT+xwST1YazoWdhAaQNguwDY+3eaCTJPL3bcOCDb4jq fqo8ixQDFCiGKzWHvzbUzT1S5XukMXVkLKIbUsaiIjTQti3YqT3UTxsCYUeoxGrqE2O1 tsmYjFv1elgh4u7XBKHZUtJxr/5gU4AlBnypSvgTx6bjcuWnhZchiVlMb5u41cfyu0Nd ODbG8Z6610rmNyhprn5oB9NhPQvdqixYEYcxANJ8BgLgEoimA19R1zVfQ5F3AclfhHJC 42jqJf41glAVNQJCNMd/NyPA/ZuG4QrszMoYsIbaefewlJ+Zlda/TXY1kIAfORS3fSL1 QPmA== X-Gm-Message-State: AOAM532TrWnrIStI9jRv8XByqG9ibXZ7ZZT7GDUR/4aaiT74QY7k+tru 6LDw+iJJfy0QR5kFgdZWAorMh1NwPLSjAQ== X-Google-Smtp-Source: ABdhPJwYYZXBuUGYIr+NMmiNDPXHRgaTGxjjaIflF4Jg2U0bJb+DXHma+tBagKJqKmP3o7ddWaq2YQ== X-Received: by 2002:aed:20d1:: with SMTP id 75mr11676981qtb.1.1590079431267; Thu, 21 May 2020 09:43:51 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:50 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 27/74] sparc: convert to cpu_halted Date: Thu, 21 May 2020 12:39:24 -0400 Message-Id: <20200521164011.638-28-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::832; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x832.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Fabien Chouteau , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Fabien Chouteau Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/sparc/leon3.c | 2 +- hw/sparc/sun4m.c | 8 ++++---- hw/sparc64/sparc64.c | 4 ++-- target/sparc/helper.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 8f024dab7b..00d1efd430 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -132,7 +132,7 @@ static void main_cpu_reset(void *opaque) cpu_reset(cpu); - cpu->halted = 0; + cpu_halted_set(cpu, 0); env->pc = s->entry; env->npc = s->entry + 4; env->regbase[6] = s->sp; diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 8dda3f7292..e189ba5395 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -192,7 +192,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); } @@ -223,7 +223,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) @@ -232,7 +232,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) @@ -831,7 +831,7 @@ static void cpu_devinit(const char *cpu_type, unsigned int id, } else { qemu_register_reset(secondary_cpu_reset, cpu); cs = CPU(cpu); - cs->halted = 1; + cpu_halted_set(cs, 1); } *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS); env->prom_addr = prom_addr; diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index 100b2fab17..fe9c678459 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -101,7 +101,7 @@ static void cpu_kick_irq(SPARCCPU *cpu) CPUState *cs = CPU(cpu); CPUSPARCState *env = &cpu->env; - cs->halted = 0; + cpu_halted_set(cs, 0); cpu_check_irqs(env); qemu_cpu_kick(cs); } @@ -116,7 +116,7 @@ void sparc64_cpu_set_ivec_irq(void *opaque, int irq, int level) if (!(env->ivec_status & 0x20)) { trace_sparc64_cpu_ivec_raise_irq(irq); cs = CPU(cpu); - cs->halted = 0; + cpu_halted_set(cs, 0); env->interrupt_index = TT_IVEC; env->ivec_status |= 0x20; env->ivec_data[0] = (0x1f << 6) | irq; diff --git a/target/sparc/helper.c b/target/sparc/helper.c index 07d87efa4e..90dfb1e92f 100644 --- a/target/sparc/helper.c +++ b/target/sparc/helper.c @@ -244,7 +244,7 @@ void helper_power_down(CPUSPARCState *env) { CPUState *cs = env_cpu(env); - cs->halted = 1; + cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; env->pc = env->npc; env->npc = env->pc + 4; From patchwork Thu May 21 16:39:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 581C4739 for ; Thu, 21 May 2020 16:59:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F50D207F7 for ; Thu, 21 May 2020 16:59:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rONSTrnG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F50D207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboXg-0000JZ-Be for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:59:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIU-000336-KJ for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:54 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:34317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIT-0006Z0-Lc for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:54 -0400 Received: by mail-qk1-x742.google.com with SMTP id 190so7915286qki.1 for ; Thu, 21 May 2020 09:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LDQ6XQ/3vPiAN54mt6Pw+hfW8ObudV4rT2qqPEmK+8U=; b=rONSTrnGrSZ2PsoIrFLqBFuu6suHGbrMjX8uNyhMJMBGg035NputYOHa8h2uI8xtlF LOjjEFaAEKkn8SxHd9pFLcvc+FgVqlAAsvunyS530dGc7thTweLioc3xQRj6myQtUnLx CI32Z6rrO3nr72JWTeh6hFju0acnpQvitBwwDOgHgXCgLjooWqJ4mHqlHiphU/eby5at k/81cNpVH8haEAfc1pRSpJna3mOqwqfqMr5lAaGKf/+Md/yj69tA2eYbdD1ujFjUAwi8 Lk08Cku5kOH1EfDrI8KUefdy7IkNzG49rii+8nDLJhIBuDwIXpN4P35dTiCr3dA0cXC1 DeMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LDQ6XQ/3vPiAN54mt6Pw+hfW8ObudV4rT2qqPEmK+8U=; b=uGTSVeXZrjtgJ6lS1WsqEVzJkTpf9trALB4MmT+FvLQoY3M9i261vfCyw8y0di2yaQ VWob3VglJdPmSjsuaU4g6KxsGUlmvG6jM1i5o8DLCFwD6MiHM2oI++uJoFw7G8hL5Wp+ nFI0TB3Ts6Yml2oVIPbUx2VBBu6+4TYXklgVnaypDPFFA0CaRE11q6DfLl33iML0Ah0f tceeUVHVd1znBrraPni/A4AAYnQ2gX01J+PzLkiFFEcnVmjO4EyhLBGMy/VeRNpDLkOy MXfG1suSjgFTuwdcPnok/dFNd6rY/vyDwyAzCRYBhzlraNLPkWKb0jCjZ9otkP7untIj 3rDw== X-Gm-Message-State: AOAM531loOJiljYRFHps+dRj+G59Qib0PcirfnkmLMqfGSY1lf/8rNY7 AbEXlqFJr3jIoQZT9xRBqr/hUdtqfnAL2w== X-Google-Smtp-Source: ABdhPJxM86RQ5aNqp9UP/nL9z4Vei3jmWAjYFxbehbX9xxreBnli8ioe3TT9J5WNADneK2sbufq+eg== X-Received: by 2002:a05:620a:634:: with SMTP id 20mr10169315qkv.15.1590079432542; Thu, 21 May 2020 09:43:52 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:51 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 28/74] xtensa: convert to cpu_halted Date: Thu, 21 May 2020 12:39:25 -0400 Message-Id: <20200521164011.638-29-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Max Filippov , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Max Filippov Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/xtensa/cpu.c | 2 +- target/xtensa/exc_helper.c | 2 +- target/xtensa/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 82c2ee0679..fda4a73722 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -102,7 +102,7 @@ static void xtensa_cpu_reset(DeviceState *dev) #ifndef CONFIG_USER_ONLY reset_mmu(env); - s->halted = env->runstall; + cpu_halted_set(s, env->runstall); #endif } diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c index 601341d13a..01d1e56feb 100644 --- a/target/xtensa/exc_helper.c +++ b/target/xtensa/exc_helper.c @@ -115,7 +115,7 @@ void HELPER(waiti)(CPUXtensaState *env, uint32_t pc, uint32_t intlevel) return; } - cpu->halted = 1; + cpu_halted_set(cpu, 1); HELPER(exception)(env, EXCP_HLT); } diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 7073381f03..031a14cf86 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -328,7 +328,7 @@ void xtensa_runstall(CPUXtensaState *env, bool runstall) CPUState *cpu = env_cpu(env); env->runstall = runstall; - cpu->halted = runstall; + cpu_halted_set(cpu, runstall); if (runstall) { cpu_interrupt(cpu, CPU_INTERRUPT_HALT); } else { From patchwork Thu May 21 16:39:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563521 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36014913 for ; Thu, 21 May 2020 17:01:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AA82207F7 for ; Thu, 21 May 2020 17:01:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dofwbhIQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AA82207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboZh-00048v-4r for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIV-000367-Ly for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:55 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:37282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIU-0006Z8-QW for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:55 -0400 Received: by mail-qk1-x744.google.com with SMTP id m11so7881267qka.4 for ; Thu, 21 May 2020 09:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r3ihf6Hm5TzP8tkXXmmJd+HhpHTqUNEyVizEpWsgvtc=; b=dofwbhIQEtWvVwznSPn68P9c4ugfBCTexDdljcODqQWG+DjyYOY5lP7pauQpAYMjjL +aXx0gqXBKheKyeehSQQFJLgDNZ1SGDybjZauKqFAOsNrI0U3goLecHNVlRhKHq6C50A FchHgD+Xf+qTIuoz1daCb4X/xU5kCbrAuJ6vxm/4+uDsM/kOZHP4T3SZfrEGqO1OC4SJ AWVQ36HblfaL7N5JeJXOz2t9y+FEBjSSIgnLbEsAU0O7iddzyrbsEXAUxoWTbRLvtX9T aGfY1h8AbsWMwB8Rd8HeBXzWl1Xqo+a6o6GumqKs7IQhpzn6bdY8FS4x9lNzLEjaX+Zs rx3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r3ihf6Hm5TzP8tkXXmmJd+HhpHTqUNEyVizEpWsgvtc=; b=gyLB74qVdmyUt258HL7zE1KQsQcuEfMJBvL0zxeoJpex1LRtSqp16OQV8X/PbaeCwo TeE8F6MjScb71syhYi+xJQxM5fqw5SeIFLrgEVD7OPd7Hzm59kNi0ZedIX+qHBWjFcSe Az/PdElspcZkpNEP3pb4LRrBJHk3w13f+fjrMFmeLnl65l9KsHbPbdGsfPozm9aK2dLK KsNTiZML059+9Wu7smavWULeddEMa7WHSICAL/Q7YCul+FwEKUJixvSeX3l2u5Mmjlf3 DrJReBIO1vj1leIvvhayE1QJcUOjD8IxqWU5bd1GnpxB5eVZOonlgsULQxIYe8SDjbRE 75yg== X-Gm-Message-State: AOAM532iFTUGCZZBIIcEfidzwpMMmHCszMwTsxLNKATs7u8OhHfAdIDV lVOCaIuMJ8gQo41fMpdZklNjFIKiGT8p9Q== X-Google-Smtp-Source: ABdhPJwl7FNruas9E/6C2KUyEKPpuIlgq7JHEyLeL/y4PTGdEoF+Hz7JoKctY+EQEdSsVLgv2amh2Q== X-Received: by 2002:a37:6fc3:: with SMTP id k186mr7870093qkc.419.1590079433750; Thu, 21 May 2020 09:43:53 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:53 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 29/74] gdbstub: convert to cpu_halted Date: Thu, 21 May 2020 12:39:26 -0400 Message-Id: <20200521164011.638-30-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 6950fd243f..b25796b33d 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2062,10 +2062,10 @@ static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx) g_autofree char *cpu_name = object_get_canonical_path_component(OBJECT(cpu)); g_string_printf(rs, "%s %s [%s]", cpu_model, cpu_name, - cpu->halted ? "halted " : "running"); + cpu_halted(cpu) ? "halted " : "running"); } else { g_string_printf(rs, "CPU#%d [%s]", cpu->cpu_index, - cpu->halted ? "halted " : "running"); + cpu_halted(cpu) ? "halted " : "running"); } trace_gdbstub_op_extra_info(rs->str); memtohex(gdbserver_state.str_buf, (uint8_t *)rs->str, rs->len); From patchwork Thu May 21 16:39:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12BF5912 for ; Thu, 21 May 2020 16:55:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DBCD1207F7 for ; Thu, 21 May 2020 16:55:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Nfc2kIvS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBCD1207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboTk-0001el-27 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:55:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIX-0003AH-5I for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:57 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:35890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIW-0006ZH-9G for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:56 -0400 Received: by mail-qk1-x742.google.com with SMTP id y22so7877338qki.3 for ; Thu, 21 May 2020 09:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O0fBrT3P1tRSLH4phcxb7WjFxDduimB9rIeQgvMHfic=; b=Nfc2kIvSPenViflfeJM4tjswpI4JwXKOCODAyP/Itoxn5rdYCVYjQD+MHLXotXd1vG JVohFIhLLVnNh5VVHD7Y5jkowCoDM/aNYUCGeRic4azba+iVBe8XzxG6PH0F/XDp97Cy XJczMJ6HR2E+agnQsjMpSmv6Gi1a4oCv85tVqPkw8nNLlubJ3R6cun3/UWpvrage2E+f wSavcfef4cVnzGMqCkca+ggKc5neCUsz1qz+bqwmwP7cy79eE10diotJPGjgRrAU6MZ0 m4lRtUDSOaKAg4asH98bPpyZWzm3xXoCWwyz5T/uVjfWwJ/mASHeoGiPdfFhQY1pJHwU RqCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O0fBrT3P1tRSLH4phcxb7WjFxDduimB9rIeQgvMHfic=; b=YxhwCWegS65z5hOq4sTWiSEV3b2N9eCTtMl/dF+jstWZ6RxdlJeA4RVM2GUDpWL7rW nCEs3n9s8gmBucBvVf5XNdUYCNxkqUQS6Lcg53AhehIXaNNbFguH03aWuqrl9WscQ09N obMIP1IIQn4XFxwoBAG9G3MwNOpvWJ/dOGpJ3/HllJgx6qt/mu//4ubjz/71yWMzDSJn uPUTOfHzIbyX8rrgLdw+H74Ttv+0VIzbrKWCiCLypAK5KUSUM2MSXA4KXwsIPHpD+BH4 zFAMy83vkY5Tsy3PxFPtDokG9YnSiK8D2ACkDf5un5vcgeXqhu+SDfjWrYuvLrrpTISQ V4cQ== X-Gm-Message-State: AOAM530vfmGSB7qaE8NuPakwgwj7Ypv4Vj/cJumCyYX/Lsz6ZtIRdDoQ RcoHQKcGlXBxk8Ox+VcF4kbkpkBGH05aRQ== X-Google-Smtp-Source: ABdhPJw0uY5hxNe8Voh6Zzw77Wfi79mdVgVdf+ls36Xz9W/K6hYqMQmPEKZ/zEIJlwNwbgY1vIGhFQ== X-Received: by 2002:a37:b144:: with SMTP id a65mr10557733qkf.462.1590079435014; Thu, 21 May 2020 09:43:55 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:54 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 30/74] openrisc: convert to cpu_halted Date: Thu, 21 May 2020 12:39:27 -0400 Message-Id: <20200521164011.638-31-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, Stafford Horne , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Stafford Horne Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index d9fe6c5948..2615571ce7 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -134,7 +134,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) if (env->pmr & PMR_DME || env->pmr & PMR_SME) { cpu_restore_state(cs, GETPC(), true); env->pc += 4; - cs->halted = 1; + cpu_halted_set(cs, 1); raise_exception(cpu, EXCP_HALTED); } break; From patchwork Thu May 21 16:39:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563481 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAD21912 for ; Thu, 21 May 2020 16:56:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1254207F7 for ; Thu, 21 May 2020 16:56:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IzbY8sNs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1254207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboUa-0003mQ-L7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:56:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIY-0003Dn-GY for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:58 -0400 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]:44595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIX-0006ZU-Gx for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:58 -0400 Received: by mail-qv1-xf42.google.com with SMTP id ee19so3342776qvb.11 for ; Thu, 21 May 2020 09:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pBQreEfimlo/TeCu0za1hNbEWK5jCOhKGwDICZx6xko=; b=IzbY8sNsFCCG7RUPWdXm/GGEFVHfY3p59He/vZwaEPAQf9w6cTazD+Pzt4hJ5nhN6c qJfuJEjJjlOYIklwyaKoRbThan844MI2O1m/oqpQIdQprCnzxLM+wqzqVfpwnrHJdexw 99axPxXW77bY2l2Od7t0JPMWSX9vftYb8xNjtDFFRpAcADxJNk4sAvkiLOiOc5IE0ogC +JmUfSJcGRoEk86Es0ZNZgjd01siy+6azz3JWGhit9c8jey3E9jbu0kkDIHmnHgIn/C+ sAYJiJX9aGS9GyDfiwzsPScSxKwXxHWZePb3Fo0tZzK5x6ieUUBSBmXPMr8++sQAlYaq UsLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pBQreEfimlo/TeCu0za1hNbEWK5jCOhKGwDICZx6xko=; b=pZWCDD4GdUU4L/DO24Jfs2GZmIjaOGZvxriRqXd4OHTQ3uscclxSVg7Zn/6gkOrsz7 93Dha/8TtdobhWO2QZCTZ55w7iTmaPqjbiinDTVWZ/7lXOX+vI5nriAUFWw3kXpMFXvd bDew6GnvLziWaOMoCaec6uCQU1Ip4TXRHUB1EMAZFTpu42LG18ULi5eIJkw5owdpeBtE RIjkQPG1yjJISRu+N/FPSq2ctTK48nhLUOCYbSIoLbV3n/ylYuzAt1U/DFtznLyk2zfJ 1kHgeJ4FyxKHjVkeLnq8CNkljjWNynBvRqvQQ/DFQsIpsGiM0/VN8aFzYznHRTPdzm7m aoqQ== X-Gm-Message-State: AOAM530OoURYh+TGVVBnoFNw9EKv8kTBcJ2NmEcsvRTuGLcAhA9EVsaU 9xS1UKDySfOKBoVJDjZkE4GLcz7kjta7HA== X-Google-Smtp-Source: ABdhPJxoNx5fFIjnVku9ipC3TIG84MGacti5sA/92B2KvHlBg4K2HLVZc29wlhunaUVFz2QYhfSnBQ== X-Received: by 2002:a0c:b259:: with SMTP id k25mr3834404qve.111.1590079436348; Thu, 21 May 2020 09:43:56 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:55 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 31/74] cpu-exec: convert to cpu_halted Date: Thu, 21 May 2020 12:39:28 -0400 Message-Id: <20200521164011.638-32-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f42; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf42.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d95c4848a4..e296894ea1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -425,14 +425,21 @@ static inline TranslationBlock *tb_find(CPUState *cpu, return tb; } -static inline bool cpu_handle_halt(CPUState *cpu) +static inline bool cpu_handle_halt_locked(CPUState *cpu) { - if (cpu->halted) { + g_assert(cpu_mutex_locked(cpu)); + + if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); + + /* prevent deadlock; cpu_mutex must be acquired _after_ the BQL */ + cpu_mutex_unlock(cpu); qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + apic_poll_irq(x86_cpu->apic_state); cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); qemu_mutex_unlock_iothread(); @@ -442,12 +449,22 @@ static inline bool cpu_handle_halt(CPUState *cpu) return true; } - cpu->halted = 0; + cpu_halted_set(cpu, 0); } return false; } +static inline bool cpu_handle_halt(CPUState *cpu) +{ + bool ret; + + cpu_mutex_lock(cpu); + ret = cpu_handle_halt_locked(cpu); + cpu_mutex_unlock(cpu); + return ret; +} + static inline void cpu_handle_debug_exception(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); @@ -546,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; - cpu->halted = 1; + cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); return true; From patchwork Thu May 21 16:39:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563509 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0171E912 for ; Thu, 21 May 2020 16:59:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC7CE207F7 for ; Thu, 21 May 2020 16:59:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ymGxfTzd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC7CE207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboX7-0007MX-VF for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIZ-0003HF-Lu for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:59 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:33282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIY-0006ZZ-Kc for qemu-devel@nongnu.org; Thu, 21 May 2020 12:43:59 -0400 Received: by mail-qk1-x741.google.com with SMTP id z80so7918616qka.0 for ; Thu, 21 May 2020 09:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=84L+h8uFg3q7QdwSmv1gXpJhNAJlpTSMoYkmOBESzcw=; b=ymGxfTzdloXlZM0VfvEF0nI3toXOk1Lfcuzt/jMz2NpgokHLp7j2pSJB9HLhwIlYzy kiVNe9R9XnktkyHSHtS0KrXo9eEAprSSbRb7ywhFj9A2/U4qlQMwQr9XJMOJPbL6cT8g 4EmwaWh7VQ2ANO7A6DhlR0WfulX0UuoyzkxMyNmg7xLBSFzaSO0W2eYiSnLXNCwdbC92 d1Y422hGnTX//BJZRqUtoIcc9pR+qJn4lED1N3aTaxF01akF2ISTMadlSlyLiWmNBTnh H8J4bmXZq90zsJexYTo6ZHtybNVn/F3Cd0Evcu6zKSEl2QkIXow/zjjoTd2RRcOyq0tH vq9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=84L+h8uFg3q7QdwSmv1gXpJhNAJlpTSMoYkmOBESzcw=; b=oquKxzqkmCKCQ12RDd4uuy30fhgLWP0jKqtnCi042wmuGK2X1lecvbblkN9r4KRA7f jnUr3ZmKMabflSQUu0RCv9yjJe9YVkpckpEKolDo1MsT90EPec8GR2/P0UPnjC4vOpjT OHCEsDBpWzIaE9zL5hRg3c2B/qZ8lakFRUmw1ZHU3JUkIYRlbbgeAwsWyJyQoCIm1y2j Nf2qlutOTD5ASN9WU3JHzQUqnfCcKsLeVJXuIKgINRQqJNnYurdpI4RFoWE3q6VcwlJ4 gF9NJfiC01HS0cs+Np51a4XuVtcXgxwKUYbWb8gDFzhIhkxeuPvc7EovuqIVKhWsxkQX h1sg== X-Gm-Message-State: AOAM533qWqd//0rF25jY2qTwTHA6XWn95SzvmkL6hj+QQbNDXLUVnuiF ve425rgfRZb5leuh/VG1F8tnC/wRZSdaoQ== X-Google-Smtp-Source: ABdhPJzDBclugsiMHZuoxNfn75c6deQK9foRsA5qT/IBLEIroFZlSfTD92Lyvdamd9ZiVGJCh+KBfA== X-Received: by 2002:a37:6cd:: with SMTP id 196mr1797829qkg.393.1590079437539; Thu, 21 May 2020 09:43:57 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:56 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 32/74] cpu: convert to cpu_halted Date: Thu, 21 May 2020 12:39:29 -0400 Message-Id: <20200521164011.638-33-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This finishes the conversion to cpu_halted. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 2 +- cpus.c | 4 ++-- hw/core/cpu.c | 2 +- hw/core/machine-qmp-cmds.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e296894ea1..099dd83ee0 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -435,7 +435,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); - /* prevent deadlock; cpu_mutex must be acquired _after_ the BQL */ + /* locking order: cpu_mutex must be acquired _after_ the BQL */ cpu_mutex_unlock(cpu); qemu_mutex_lock_iothread(); cpu_mutex_lock(cpu); diff --git a/cpus.c b/cpus.c index 9cc5f4767e..ff67fa9f5f 100644 --- a/cpus.c +++ b/cpus.c @@ -223,7 +223,7 @@ static bool cpu_thread_is_idle(CPUState *cpu) if (cpu_is_stopped(cpu)) { return true; } - if (!cpu->halted || cpu_has_work(cpu) || + if (!cpu_halted(cpu) || cpu_has_work(cpu) || kvm_halt_in_kernel()) { return false; } @@ -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(); diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 620feed3e9..67a9c2bb16 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -257,7 +257,7 @@ static void cpu_common_reset(DeviceState *dev) } cpu->interrupt_request = 0; - cpu->halted = 0; + cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->icount_extra = 0; atomic_set(&cpu->icount_decr_ptr->u32, 0); diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 2c5da8413d..a35559b5d8 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -62,7 +62,7 @@ CpuInfoList *qmp_query_cpus(Error **errp) info->value = g_malloc0(sizeof(*info->value)); info->value->CPU = cpu->cpu_index; info->value->current = (cpu == first_cpu); - info->value->halted = cpu->halted; + info->value->halted = cpu_halted(cpu); info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); info->value->thread_id = cpu->thread_id; #if defined(TARGET_I386) From patchwork Thu May 21 16:39:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563513 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C09AA912 for ; Thu, 21 May 2020 16:59:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9709A207F7 for ; Thu, 21 May 2020 16:59:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NMj8KPVl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9709A207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboXd-0000B5-Ox for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:59:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIb-0003LY-5h for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:01 -0400 Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]:43923) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIa-0006Zj-4K for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:00 -0400 Received: by mail-qv1-xf32.google.com with SMTP id p4so3346259qvr.10 for ; Thu, 21 May 2020 09:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vmVPXwFQm0m0SAqlzFsT5BhTrQzusWHBnvRHdxyhIFI=; b=NMj8KPVlLlhzODFX4C1vHZ8TOeFAaZ+gz6xo7CPO0X3bl/kX38yuw0Y2fqmoynghIk wVjelWmkoGmWoW+sCxNPVdFLrQtwK526N/a7F9F/Y6iV9GKhHp3I+4Jf/nHNTMQ0ACVl 1Hjz2LDEHqFTH3Rnjxvz6stC42NMzTiUX4sXi0uOJRvFC4TgfCnTL5X+zkpUMi/HXvSN xpeCZrGLKKCUBXYzQSuGeW92KKJFG3BjZaKLyIKvkmC6lw3ERCjZTsBqpWax/H2KDETR kiCAY/giOqioKt1PE95ZJciq+M2jJleN4M1lEsh5u0R9xWMS9Or1jeVVwAjwBUod602r cvgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vmVPXwFQm0m0SAqlzFsT5BhTrQzusWHBnvRHdxyhIFI=; b=GiDw0rhUpma8apRm82mwoSNKc1k4zr29gzUQwc9G74+QH1oAR1F2slUZPeP8YiNxuO UguMSAWCHXIKJwXRyuOYlbZvmWUFlmLnzvX2qXPWEkXcN24oZKkRErQDaLBvD280awpe y09phtaecy5zy1L3BW0lCRAKbwO82J9LybLlsZCWJM/SCQwPkifmoaWPq7U3lZwMoo1Q lHYiXnd0yzSGiC7L3fOJSHWjEQAXytR5uu386/I6pzngCFz4yljX65v8tmZcpwTlIbbr kMK9tcOpPa56qoXuw+1MhO3u7PN3KF0bdF86Kj56l+sB/eYSCc0+QS1TmmhWUWDz2OuO jfcA== X-Gm-Message-State: AOAM5319th99ow/ecG1n/XG0Zfr1Akj4ksPRcCW6e7VrZqfIjRa+jcs1 srM8v6XIf/W5zBqFIckiZ1ViP9uy7pNBqA== X-Google-Smtp-Source: ABdhPJwgDGpkrtjl+AEyv+jblDswv3iCg4HsVm5TEPGbTvq9a1ycy4l9Mc4CWj0kkUa1KzRzSmj00Q== X-Received: by 2002:a0c:ba99:: with SMTP id x25mr10929438qvf.119.1590079438779; Thu, 21 May 2020 09:43:58 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:58 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 33/74] cpu: define cpu_interrupt_request helpers Date: Thu, 21 May 2020 12:39:30 -0400 Message-Id: <20200521164011.638-34-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f32; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf32.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Add a comment about how atomic_read works here. The comment refers to a "BQL-less CPU loop", which will materialize toward the end of this series. Note that the modifications to cpu_reset_interrupt are there to avoid deadlock during the CPU lock transition; once that is complete, cpu_interrupt_request will be simple again. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/core/cpu.c | 27 +++++++++++++++++++++------ include/hw/core/cpu.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 67a9c2bb16..be9efbeaf4 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -99,14 +99,29 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool need_lock = !qemu_mutex_iothread_locked(); + bool has_bql = qemu_mutex_iothread_locked(); + bool has_cpu_lock = cpu_mutex_locked(cpu); - if (need_lock) { - qemu_mutex_lock_iothread(); + if (has_bql) { + if (has_cpu_lock) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + } else { + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + cpu_mutex_unlock(cpu); + } + return; + } + + if (has_cpu_lock) { + cpu_mutex_unlock(cpu); } - cpu->interrupt_request &= ~mask; - if (need_lock) { - qemu_mutex_unlock_iothread(); + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + qemu_mutex_unlock_iothread(); + if (!has_cpu_lock) { + cpu_mutex_unlock(cpu); } } diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 820c5b0a9a..6ed806db60 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -522,6 +522,43 @@ static inline void cpu_halted_set(CPUState *cpu, uint32_t val) cpu_mutex_unlock(cpu); } +/* + * When sending an interrupt, setters OR the appropriate bit and kick the + * destination vCPU. The latter can then read interrupt_request without + * acquiring the CPU lock, because once the kick-induced completes, they'll read + * an up-to-date interrupt_request. + * Setters always acquire the lock, which guarantees that (1) concurrent + * updates from different threads won't result in data races, and (2) the + * BQL-less CPU loop will always see an up-to-date interrupt_request, since the + * loop holds the CPU lock. + */ +static inline uint32_t cpu_interrupt_request(CPUState *cpu) +{ + return atomic_read(&cpu->interrupt_request); +} + +static inline void cpu_interrupt_request_or(CPUState *cpu, uint32_t mask) +{ + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request | mask); + return; + } + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request | mask); + cpu_mutex_unlock(cpu); +} + +static inline void cpu_interrupt_request_set(CPUState *cpu, uint32_t val) +{ + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, val); + return; + } + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, val); + cpu_mutex_unlock(cpu); +} + static inline void cpu_tb_jmp_cache_clear(CPUState *cpu) { unsigned int i; From patchwork Thu May 21 16:39:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CF28739 for ; Thu, 21 May 2020 16:57:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8DC8207F7 for ; Thu, 21 May 2020 16:57:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jI1QZvIP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8DC8207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboVJ-0005A7-0w for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:57:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIc-0003NF-Qm for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:02 -0400 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]:46682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIb-0006Zr-CF for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:02 -0400 Received: by mail-qv1-xf33.google.com with SMTP id dh1so3333586qvb.13 for ; Thu, 21 May 2020 09:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=roYFUSuiQ9xl45PTniWtLw6l9xYhMo+mP3mKLillljc=; b=jI1QZvIP/2Bpw307VN07UNtsqAg6EkOf8nJKGGeG32k11YuTdf7Os/MAxIVfm0V8UW FfGeCrvyUTlYcpKcw6Y4A3p5C8XI7/+kdJ+J4Z8uY/UEjv6a0gzYvrNhg4EOtyFfcjd6 mPjHKTu5RlWjlOdDA7Tq5Q89E1FZCO9cOLNP3lWNmcy3Q8loqXV63cGCnFsKoLGn8qh0 c9o6sRRcTFZZ/LMY8BfZvTELcQHHHY8+mQMobqmPk4FPV6lQVlsmeD3CcCOb9+8JiVsY PZgTWKiPcNsUXuWXPLSKDa5OY6Y5LmubHO8fny797VpTnVL+UX6xBUdIvHgXHQ+PVJ6b 1iPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=roYFUSuiQ9xl45PTniWtLw6l9xYhMo+mP3mKLillljc=; b=KB7pS3DsnSXW1N9UJF4PHMpl+ML8nzZ3I7cqRT3Jna3K7hPI/m4ozMrwsV/pKLqnYR eVhL/giAQpA4xM6OYuPSDQbR35BE95tBiggucfi99Fit7Lyp632V8gM7HeFuB1bn32r2 6H0PGDs4P241gorXTsvOq2FEFdyEwQFnqAhlXI39mczjc33aqstpRqzOnzkonI4ke3ZX 8DmsOx1sYaro5uQwTVDEE03AmCDxyvV2JEmYcTvoBau0IUyZ2TNyfzIPnYMliHTAzEqD DewIer4HmJOnLvAUEIPlpXsrfj0WD9f2Vl94svISyk+rwB4/zPmHA8CH1LnFIs4DRP5M EsYg== X-Gm-Message-State: AOAM532YIpCtY6qAthphFLMmT935gxHiyIaVCgqPBIQRZYH8fHv2AlXJ 23sRkhoxowB22D6HO1x/HWCvII0+wqhA3A== X-Google-Smtp-Source: ABdhPJyZ54sjvjK0vD1kZTsDKqIvPhZgn1FlG5g7K56vOKlZpnsy5Qss9emH0R4JZXIhXEFjhd8mJg== X-Received: by 2002:a0c:e488:: with SMTP id n8mr10324642qvl.172.1590079440158; Thu, 21 May 2020 09:44:00 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:43:59 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 34/74] ppc: use cpu_reset_interrupt Date: Thu, 21 May 2020 12:39:31 -0400 Message-Id: <20200521164011.638-35-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f33; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf33.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, Paolo Bonzini , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: qemu-ppc@nongnu.org Acked-by: David Gibson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 4c7da88682..5fee92c310 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1021,7 +1021,7 @@ bool ppc_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (interrupt_request & CPU_INTERRUPT_HARD) { ppc_hw_interrupt(env); if (env->pending_interrupts == 0) { - cs->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } return true; } From patchwork Thu May 21 16:39:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563519 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7F05739 for ; Thu, 21 May 2020 17:00:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D528207F7 for ; Thu, 21 May 2020 17:00:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Vu7TfWhY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D528207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboYv-0002eD-Eq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:00:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboId-0003OB-F0 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:03 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:38348) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIc-0006a1-I6 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:03 -0400 Received: by mail-qt1-x842.google.com with SMTP id i68so6007140qtb.5 for ; Thu, 21 May 2020 09:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0agZvpWq+VTT3lSSfcqtTtVkY6vnYs4TCtFCyM1LZ9U=; b=Vu7TfWhYT7YpBM4pDqpNjE3JWqId2aVu7IwM5hWvBpFC+CvBIQdAkzs71KoR51Q3st 4uUIwR1alwOgrL2rPTE2puKSH5SnB/fwyPu+DmZr9FP1LXl5tGm43viE1uRg5It76ixO qwJjw9DZ0MoIiuEdGPP78lO3lTKGqHL+i40Yjh8+OMcEQH2NZMPidJGMXTGXwSaOPn2N OPjv4DLFC2gha2NrVdl0XO75RNqxANob/kST3NSgSkVGWi9sb9qqPfqj8dceJRy02J6V t6qgszSm/XPU5PTTsHw+U1GXnJZZb4arWhP2YChGftIFGGjwrxou+6Iy4Jy4e59i1oZt wcKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0agZvpWq+VTT3lSSfcqtTtVkY6vnYs4TCtFCyM1LZ9U=; b=DBB8I/tCNG7yIAP5LEoGK5SeCaa8tFcN8h8TGDjXf1nqIMvXH/umvhVlU8+t5zJnO4 dJrUjm5kWjvdoB6uuzjabZB/w9/INgG18+RFrGjKWEG8w6IfQGGFUl6To86UouOxjCJm Ll879bjWPQsy80bcZq0dV0Squ7/FwJ6PAZuZUYn+Bq5e1WYwiMNpJOExAuXkCDmNJAyu ABpc8CQ3j9TR/p/JQcqlEMM9jcuDhCpKRHYIVag0VHXEh0lLSRWSiyuOElikjAHw36NY xixeXXM/9q6ZtIjtA9Na7cGimxSvnC36EwwgmvN1HRDvsjcKTTYj15SMoW1q0Ns9/V3X oj2A== X-Gm-Message-State: AOAM533JRfgRz9LXEYs5C6KGNkaCL3pSzH8VORvRk654LQu9XfFX/VTC HOnM3/xOOhsTi5QGNPTHVUTTvKBI3SyIyQ== X-Google-Smtp-Source: ABdhPJwPQ7aTqhvtmmyLSpCGIq4Y9efLmXNVnFIndK/3ba+9rtjTl0EC6tqNpRnwJgAaSCvVznvqAg== X-Received: by 2002:aed:2c41:: with SMTP id f59mr11618064qtd.123.1590079441493; Thu, 21 May 2020 09:44:01 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:00 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 35/74] exec: use cpu_reset_interrupt Date: Thu, 21 May 2020 12:39:32 -0400 Message-Id: <20200521164011.638-36-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 5162f0d12f..37e039de06 100644 --- a/exec.c +++ b/exec.c @@ -752,7 +752,7 @@ static int cpu_common_post_load(void *opaque, int version_id) /* 0x01 was CPU_INTERRUPT_EXIT. This line can be removed when the version_id is increased. */ - cpu->interrupt_request &= ~0x01; + cpu_reset_interrupt(cpu, 1); tlb_flush(cpu); /* loadvm has just updated the content of RAM, bypassing the From patchwork Thu May 21 16:39:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563525 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2CFF913 for ; Thu, 21 May 2020 17:01:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A99BD207F7 for ; Thu, 21 May 2020 17:01:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hIxS2GkJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A99BD207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboZq-0004Pb-OI for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:01:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIf-0003Sc-HT for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:05 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:46771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIe-0006aJ-5Z for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:05 -0400 Received: by mail-qt1-x843.google.com with SMTP id p12so5960570qtn.13 for ; Thu, 21 May 2020 09:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dzfw84SBLonEKMo8witPSZf82hddunuWNS4DufYhVeY=; b=hIxS2GkJzQCz6ZrHo85gOXWfg+Uxzi8IO5qLPwIT6PNaXtb+gGM88nrojPgCSFWZoG AVdYYcpnEPYhXe7o7qyendpjFskEiE8tZS2pfF6bd5JwvBCUL5DzcrrQN+cEuBo1X7j4 9r7ibWAYUnjRkFpVVO49Idsp3LOs8xrRRV7bs0PkpWys/JfA9XBBEigz63X7GJjXuTpF t1UJSAqWiO7SJ3oQ5RMkXSMNUKSvo0si+5scRrk62FiJk6Jp9XK7wWgq1urD6BP2T8ps G7/zHnGDB3qq+23EgKc3q9AxSjeiXr4X1KT9SqxPxgXXWP8pOf04Y6QzKpw6C5zBE8F3 n2Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dzfw84SBLonEKMo8witPSZf82hddunuWNS4DufYhVeY=; b=f+hhoHnmxDEeHa7BfKbwwJOwZg73Hq5uBPokyzdIG4GZj/9QBTmDmnQJLUH102lvGR PMgRmhASoxnXX/z4yBVKLLoJZJMN0HxipRD4NV+iwZjbXKgoXubejuliVs+AjrW+ES/j ULGTdPN4S+9eWFLXSCGZI3UldXK9YxEQfx/C5MzaCgzD615avEFpLWo8oYAby6eG/K9+ 0djWptwjIsRQZ95HHIqw2n1cXAOFTiDO/hN8IAxpS4Lw3RMTzBb0n2U9jVlk60qbxqG/ yC1nkyp2d5QuchAQCuHxUKR98OF6Oz8APTcgGKKcUSVOdytUr7QXto7JwrUWm4dHBCP2 AxCg== X-Gm-Message-State: AOAM532G4LeoWkaZreEaqoYyTLThxPp6XWQhF5sjm3sBA6Ajxoyh/GKf /23kjPo9j+zPbUXZ/V3UrFgwDRbtpxlnIw== X-Google-Smtp-Source: ABdhPJw872EUPqlwU4RIQ6cRJtWbNyeM4aSIUKB9AhlvqM8XpRGfajyzFrT6YaXkVXIwaHreaSK80g== X-Received: by 2002:ac8:554c:: with SMTP id o12mr10989452qtr.89.1590079442834; Thu, 21 May 2020 09:44:02 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:02 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 36/74] i386: use cpu_reset_interrupt Date: Thu, 21 May 2020 12:39:33 -0400 Message-Id: <20200521164011.638-37-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, Paolo Bonzini , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/hax-all.c | 4 ++-- target/i386/hvf/x86hvf.c | 8 ++++---- target/i386/kvm.c | 14 +++++++------- target/i386/seg_helper.c | 13 ++++++------- target/i386/svm_helper.c | 2 +- target/i386/whpx-all.c | 10 +++++----- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index 25bf80b5f2..1edd6c77df 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -425,7 +425,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); } } @@ -473,7 +473,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) } if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index cbb2144724..90f1662d0c 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -402,7 +402,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { - cpu_state->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | EXCP02_NMI; wvmcs(cpu_state->hvf_fd, VMCS_ENTRY_INTR_INFO, info); } else { @@ -414,7 +414,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && (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 1c1d4c8c0a..2451840b36 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3632,7 +3632,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; @@ -3995,7 +3995,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); @@ -4006,7 +4006,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); @@ -4042,7 +4042,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; @@ -4113,7 +4113,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); @@ -4143,7 +4143,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) && @@ -4156,7 +4156,7 @@ int kvm_arch_process_async_events(CPUState *cs) do_cpu_sipi(cpu); } if (cs->interrupt_request & CPU_INTERRUPT_TPR) { - cs->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cs, CPU_INTERRUPT_TPR); kvm_cpu_synchronize_state(cs); apic_handle_tpr_access_report(cpu->apic_state, env->eip, env->tpr_access_type); diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c index b96de068ca..818f65f35f 100644 --- a/target/i386/seg_helper.c +++ b/target/i386/seg_helper.c @@ -1332,7 +1332,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) switch (interrupt_request) { #if !defined(CONFIG_USER_ONLY) case CPU_INTERRUPT_POLL: - cs->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cs, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); break; #endif @@ -1341,23 +1341,22 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) break; case CPU_INTERRUPT_SMI: cpu_svm_check_intercept_param(env, SVM_EXIT_SMI, 0, 0); - cs->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cs, CPU_INTERRUPT_SMI); do_smm_enter(cpu); break; case CPU_INTERRUPT_NMI: cpu_svm_check_intercept_param(env, SVM_EXIT_NMI, 0, 0); - cs->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cs, CPU_INTERRUPT_NMI); env->hflags2 |= HF2_NMI_MASK; do_interrupt_x86_hardirq(env, EXCP02_NMI, 1); break; case CPU_INTERRUPT_MCE: - cs->interrupt_request &= ~CPU_INTERRUPT_MCE; + cpu_reset_interrupt(cs, CPU_INTERRUPT_MCE); do_interrupt_x86_hardirq(env, EXCP12_MCHK, 0); break; case CPU_INTERRUPT_HARD: cpu_svm_check_intercept_param(env, SVM_EXIT_INTR, 0, 0); - cs->interrupt_request &= ~(CPU_INTERRUPT_HARD | - CPU_INTERRUPT_VIRQ); + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD | CPU_INTERRUPT_VIRQ); intno = cpu_get_pic_interrupt(env); qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing hardware INT=0x%02x\n", intno); @@ -1372,7 +1371,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) qemu_log_mask(CPU_LOG_TB_IN_ASM, "Servicing virtual hardware INT=0x%02x\n", intno); do_interrupt_x86_hardirq(env, intno, 1); - cs->interrupt_request &= ~CPU_INTERRUPT_VIRQ; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ); break; #endif } diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index 7b8105a1c3..63eb136743 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -700,7 +700,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->hflags &= ~HF_GUEST_MASK; env->intercept = 0; env->intercept_exceptions = 0; - cs->interrupt_request &= ~CPU_INTERRUPT_VIRQ; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ); env->tsc_offset = 0; env->gdt.base = x86_ldq_phys(cs, env->vm_hsave + offsetof(struct vmcb, diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index efc2d88810..d5beb4a5e2 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -790,14 +790,14 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { - cpu->interrupt_request &= ~CPU_INTERRUPT_NMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { - cpu->interrupt_request &= ~CPU_INTERRUPT_SMI; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -820,7 +820,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { - cpu->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { new_int.InterruptionType = WHvX64PendingInterrupt; @@ -911,7 +911,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) } if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - cpu->interrupt_request &= ~CPU_INTERRUPT_POLL; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } @@ -927,7 +927,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) } if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { - cpu->interrupt_request &= ~CPU_INTERRUPT_TPR; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); whpx_cpu_synchronize_state(cpu); apic_handle_tpr_access_report(x86_cpu->apic_state, env->eip, env->tpr_access_type); From patchwork Thu May 21 16:39:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563553 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07BA3739 for ; Thu, 21 May 2020 17:03:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D257B2084C for ; Thu, 21 May 2020 17:03:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="epo1pGI3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D257B2084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbobk-00089o-SP for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:03:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIg-0003Ts-E4 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:06 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:33287) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIf-0006aW-JG for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:06 -0400 Received: by mail-qk1-x744.google.com with SMTP id z80so7918986qka.0 for ; Thu, 21 May 2020 09:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OzUdSzbvDHrAdBgz7T3QQ9Qj/8hER0zlUjzEzhKy+Cs=; b=epo1pGI3gpW88W5PHsy3ZFJt+SK4RoqLsF/r2FtdCz1E1btUeehJKBeB+0OEcyF5iu Rs/5AlC+AJxI8BUUF6VajZyYwQtuXamDh4fSkvY1ZFPPiU4zt8gKNk3Vnj9zJwKJtZtN YYlRewsQ9NRETBvne6hovJAJi0z1oOcTEbG3aCVVKsRfaICHfwloEVbY5r9pNl01EC2j /xFWudmPAZnfintZgM/2Y4hldekthLaS1+ZM/zMBRqgmYZHRru86pDVRRM/WWdHOPtLH 81uQ2NQx2c92eGYM9bavoo/E1CGZ2wbrYecHJa6OuLuo/CfkhG1Onxb4OmeoWx6xVmyp C/1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OzUdSzbvDHrAdBgz7T3QQ9Qj/8hER0zlUjzEzhKy+Cs=; b=tviNCnzwBYuf6n83wjT5g4njfRU9NmpQ30XZ1ylRGbZjI+/y0dt1RW7foRoSGZuZrL xUznilPiW6MN+xyllVyOHtfrdDQQwWTAR1f01Ztxt89ewSiyj7MagdN7XJS0isRG1SZe BCF0lCtJQAZ48MVxVCy9/lGinom8Xi9Idrl3THld0ne7utENWwKeEV/nOsMn0YUn+FFo Qb1BJTXljA0sYcfr2Mo2LXrt+YaQwFL2JQB43oU5jYvKz7bK9X5I5h5W+un+/ADxqYwj EW7rfwxL/zVAMhpQrsFOxpJI14itO6Rt90GPUyvtfBt5hZpsgzbWHRfTPdfBd3HcK6Yb 4+xw== X-Gm-Message-State: AOAM530qxB9r/y4IBANrtZyrD/7C8SI+8Uo9oMB1+L3UXwm2m3aOQvIL pH1TrUrUDrtRqVWkv+Imo/bNJHRJDeUX5Q== X-Google-Smtp-Source: ABdhPJzk8jKKDYcROKl/Jf5+bM0JNQslgUJZHDsKb64J6WlgH4Ky8tuH8t4EGazyHhyxQtp61Re1SA== X-Received: by 2002:a37:7904:: with SMTP id u4mr10743206qkc.297.1590079444291; Thu, 21 May 2020 09:44:04 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:03 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 37/74] s390x: use cpu_reset_interrupt Date: Thu, 21 May 2020 12:39:34 -0400 Message-Id: <20200521164011.638-38-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, Paolo Bonzini , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: qemu-s390x@nongnu.org Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/s390x/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index db6640ba2c..dde7afc2f0 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -530,7 +530,7 @@ try_deliver: /* we might still have pending interrupts, but not deliverable */ if (!env->pending_int && !qemu_s390_flic_has_any(flic)) { - cs->interrupt_request &= ~CPU_INTERRUPT_HARD; + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } /* WAIT PSW during interrupt injection or STOP interrupt */ From patchwork Thu May 21 16:39:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563517 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F6A4912 for ; Thu, 21 May 2020 16:59:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46137207F7 for ; Thu, 21 May 2020 16:59:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e4bgSEXX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46137207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboXi-0000Pm-Cq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 12:59:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIi-0003Wz-Sp for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:08 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:38186) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIh-0006at-Pb for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:08 -0400 Received: by mail-qk1-x742.google.com with SMTP id f189so7858946qkd.5 for ; Thu, 21 May 2020 09:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UAoGpC+tFU+Lrmci3F+3S0Zh/4YRyJd+sLsoLGG3MBc=; b=e4bgSEXXYU4jtFQ+KAAONNIwceOG1mUgyJ1Ijww2v8IqnZ75dWoxmC3vc7sg10DIOY 59VDaLq9hcQnoVctSL+c6jjX+iu25CSkbIp0HyIRf958oqFyAXfpoY12bQQOhh4rw0vD tWStt+y7reh0SO+ZduntebBpRYejvrdF3FhcOZfCHeyZLmcRK8XSnqHKDUcJcKLhhAOH qzLRggIu5pI5/ndS3RQOAWu3m+FX+o3spCE4CIrwUJiXo5cbyOdko1FbHdIIPnxyOEgc 9IA++nfbtQQysJ5oH5phH93HnBJJBl9v4hD38X08yWa3xQ+QnuGvwud6KVOyYQ/NDd1E KCsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UAoGpC+tFU+Lrmci3F+3S0Zh/4YRyJd+sLsoLGG3MBc=; b=phpP1M1y5FG2ZJORwZaxXSqNuoyycbqq5A69Dmpa/Wg12VyQtAIY6opx2T2FU5s6ZV 2irdni9xkWsBeyzapJWm1eImalIjYQ8NvGzrMz7YFqOONyB2Ahx2i5BKCCZ/2k7xcBBa wlwPh2LpIX9JvY64rVO7PO2RPEQR0DAo9sQYF/xhyyVqWCii7jAQpaIQhS0kn2Rap7+V +r3MVkzogv/eM5gDOZPS+qFjmTIdx8+ZrbF/heigWAQiBNgKyN897m0NSVPeuQnP6G9N aa4o8fNWKY8U2aQFOHwjQ5DdqrdPitmUb/R1wSw7U74AD9lkv1iCIa5SwB1E+Z87Uf+a ttaQ== X-Gm-Message-State: AOAM531NVFBNQNGqZGQYJU4iM0Og2q/9faFv7Q1XoCWYwEUdUUNoylPd NrUMUTc9eMlQWdSohnAYrRxC4V4TzXlZMA== X-Google-Smtp-Source: ABdhPJyGea4nAk26guwW5skWogXSPm2ospbnn0HCF2jnL3+uXpVxewMm8FPaptpP2Na3/Ymj/vGigg== X-Received: by 2002:a37:9e06:: with SMTP id h6mr10566458qke.400.1590079445614; Thu, 21 May 2020 09:44:05 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:05 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 38/74] openrisc: use cpu_reset_interrupt Date: Thu, 21 May 2020 12:39:35 -0400 Message-Id: <20200521164011.638-39-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, Paolo Bonzini , Stafford Horne , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Cc: Stafford Horne Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c index 2615571ce7..e54c148d4f 100644 --- a/target/openrisc/sys_helper.c +++ b/target/openrisc/sys_helper.c @@ -167,7 +167,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) env->ttmr = (rb & ~TTMR_IP) | ip; } else { /* Clear IP bit. */ env->ttmr = rb & ~TTMR_IP; - cs->interrupt_request &= ~CPU_INTERRUPT_TIMER; + cpu_reset_interrupt(cs, CPU_INTERRUPT_TIMER); } cpu_openrisc_timer_update(cpu); From patchwork Thu May 21 16:39:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563527 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 747E0739 for ; Thu, 21 May 2020 17:02:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A857207F7 for ; Thu, 21 May 2020 17:02:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PnNuNSdi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A857207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboaw-0006Lw-FC for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:02:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIj-0003YK-Jn for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:09 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:40814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIi-0006b5-Id for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:09 -0400 Received: by mail-qk1-x742.google.com with SMTP id g185so7846555qke.7 for ; Thu, 21 May 2020 09:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yGVX5kDKORVWzWyGlj0YwmQls1Q4ENhSP5KQMqWdryo=; b=PnNuNSdiscK9zZByW9Q9FHuJsaSawEAEhX4G1K9tT0Il1Yy0rgKX38wsSLAoBrT3l4 5Sp1OwBk016raKFaypH/c/EwNpdr1gc/zpv3dC3jqbDoMqJ8aYyzq7PusgBRjO9hpmjO ieL2HrKusmEbRzD27Mn7G2LCviU6YXjLGJqR7+2RE12+jMWaNVzZX7RTvNAb9ZB2KZHs 6QAf1qls0gjP5hVPwMoBULz4bjtpd9dJJ4G0TPrOsECwoU/NCJkODQ8G9rSk6p3Qq32W T0NeTw+xMcpon/Kvfn7Q2m9lT9u8PW6pEpCcAOf68jKFlxZaLftr2LJ1hGEDlCksE/y5 y0OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yGVX5kDKORVWzWyGlj0YwmQls1Q4ENhSP5KQMqWdryo=; b=rUMy1qNK3/5fDq+As+3V6wBJWmJN+U6UuY8HeDGlN2agt9eb9OwkuBxEQmwChskb5V +6U0UDZVWmmMEuKBj0uY18fnCf7CLYSt565DsWZJLwQJn2FrIfHpi3azNhiSX/JIe3+s JB/z5Zf3osNbt9GtfUShw84djQN2TsQCte0IhHpmwAuagrQSOPrBgfDLFZOhQolKDmqo fjnaOfyVgL8eB2lEL7XT4o1cbA9o7FeoG5+vLsRFYLnhBeRTl310aooMyRwGO5xVG9sV zTur3GEUU6v7G6UcA+Ikk55nI2UFlNcS997/AwqP/0NLmNc3kARqYgFd4iZndQFcnHXn LdzQ== X-Gm-Message-State: AOAM532GoGJ8p6J+9qv3Mxv6sGerTbX7QIEtMUArfuezl4Fw0Dmh0/vH XIFy6ru3MG9MHt2gkU+tI6WJm3fsm31Kuw== X-Google-Smtp-Source: ABdhPJwVipEc+70rUkpGn5Lvk1kyNeCvJKL4TGjOc8O6aQBBiWdbJZUaOzHQjJWK3C/nZPGprQpbYg== X-Received: by 2002:a37:46c9:: with SMTP id t192mr7538363qka.3.1590079447298; Thu, 21 May 2020 09:44:07 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:06 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 39/74] arm: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:36 -0400 Message-Id: <20200521164011.638-40-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-arm@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Peter Maydell Cc: qemu-arm@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/arm/cpu.c | 6 +++--- target/arm/helper.c | 16 +++++++--------- target/arm/machine.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index dc435a18a1..6c308268a9 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -75,7 +75,7 @@ static bool arm_cpu_has_work(CPUState *cs) ARMCPU *cpu = ARM_CPU(cs); return (cpu->power_state != PSCI_OFF) - && cs->interrupt_request & + && cpu_interrupt_request(cs) & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_EXITTB); @@ -586,7 +586,7 @@ void arm_cpu_update_virq(ARMCPU *cpu) bool new_state = (env->cp15.hcr_el2 & HCR_VI) || (env->irq_line_state & CPU_INTERRUPT_VIRQ); - if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VIRQ) != 0)) { + if (new_state != ((cpu_interrupt_request(cs) & CPU_INTERRUPT_VIRQ) != 0)) { if (new_state) { cpu_interrupt(cs, CPU_INTERRUPT_VIRQ); } else { @@ -607,7 +607,7 @@ void arm_cpu_update_vfiq(ARMCPU *cpu) bool new_state = (env->cp15.hcr_el2 & HCR_VF) || (env->irq_line_state & CPU_INTERRUPT_VFIQ); - if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VFIQ) != 0)) { + if (new_state != ((cpu_interrupt_request(cs) & CPU_INTERRUPT_VFIQ) != 0)) { if (new_state) { cpu_interrupt(cs, CPU_INTERRUPT_VFIQ); } else { diff --git a/target/arm/helper.c b/target/arm/helper.c index a92ae55672..5d018b2d88 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2079,26 +2079,27 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) CPUState *cs = env_cpu(env); uint64_t hcr_el2 = arm_hcr_el2_eff(env); uint64_t ret = 0; + uint32_t interrupt_request = cpu_interrupt_request(cs); bool allow_virt = (arm_current_el(env) == 1 && (!arm_is_secure_below_el3(env) || (env->cp15.scr_el3 & SCR_EEL2))); if (allow_virt && (hcr_el2 & HCR_IMO)) { - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (interrupt_request & CPU_INTERRUPT_VIRQ) { ret |= CPSR_I; } } else { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { ret |= CPSR_I; } } if (allow_virt && (hcr_el2 & HCR_FMO)) { - if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { + if (interrupt_request & CPU_INTERRUPT_VFIQ) { ret |= CPSR_F; } } else { - if (cs->interrupt_request & CPU_INTERRUPT_FIQ) { + if (interrupt_request & CPU_INTERRUPT_FIQ) { ret |= CPSR_F; } } @@ -9591,10 +9592,7 @@ void arm_cpu_do_interrupt(CPUState *cs) } #endif - /* Hooks may change global state so BQL should be held, also the - * BQL needs to be held for any modification of - * cs->interrupt_request. - */ + /* Hooks may change global state so BQL should be held */ g_assert(qemu_mutex_iothread_locked()); arm_call_pre_el_change_hook(cpu); @@ -9609,7 +9607,7 @@ void arm_cpu_do_interrupt(CPUState *cs) arm_call_el_change_hook(cpu); if (!kvm_enabled()) { - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_EXITTB); } } #endif /* !CONFIG_USER_ONLY */ diff --git a/target/arm/machine.c b/target/arm/machine.c index c5a2114f51..42f4368de3 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -713,7 +713,7 @@ static int cpu_post_load(void *opaque, int version_id) if (env->irq_line_state == UINT32_MAX) { CPUState *cs = CPU(cpu); - env->irq_line_state = cs->interrupt_request & + env->irq_line_state = cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VFIQ); } From patchwork Thu May 21 16:39:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55A41913 for ; Thu, 21 May 2020 17:03:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AF36207F7 for ; Thu, 21 May 2020 17:03:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="meorVK5R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AF36207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbobu-00009L-BO for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:03:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIl-0003cP-4e for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:11 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]:38436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIk-0006bU-2i for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:10 -0400 Received: by mail-qt1-x82d.google.com with SMTP id i68so6007532qtb.5 for ; Thu, 21 May 2020 09:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=my4fqiSIl1w93gA3LXQg9qyTvqo7M4OmKC+VI+dDUhM=; b=meorVK5RVi6Kw55tcaeJQo5fbFT3cQFjgwW/iSnZZGi1g+FIIVpltIQkOO44x5qL+U 3J8rlJ5Z1v9M+Lj8gCoUmPQJ5dDDwR6zbGh12Y8FkXD5MrLWgrTz2I2bPPmM5RrG/z/1 og+XdsGNMHL0IArix27FHvFJF398hD35+CfNT/DuftgLesl4q/kagIiHRdI5M+APcT/F AhqBhuzQ5MGj2tGAGBzVCj2fr6HKJuI+arwpKvasRo1XKOXENwVBjEsxbP8TQ2ZGMp64 d1eqb3e6VBp+RcBacHOJjguFo60+REwW7u+hk3q/6DJBfXf8X1an4uB+Gm0UMy/PgPju ZPOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=my4fqiSIl1w93gA3LXQg9qyTvqo7M4OmKC+VI+dDUhM=; b=J5eiiU8za0wXBo7FFIcSyVR8BI1i8JgiCkNjOOEM73sJn47/pnfjl2B1VIhSFk3/44 JXGUiMI/N/CVBSz+gpFWml0UKqFXbUmZ070s0xB5VR8sWp1F0kIds2BDnzUsuyvuosQ+ XNUsPW+uZRFncLRRbniBAWqlo3re4W8IQlqK4pOVg5FfAa9enIC0Eb8+BRwepJIcdQ+e KpumXgRzgJYb+3TX+4+4YksTGUlPuqCJCP5Wmt+wVy891IpwrlqS0WB2/LfdoxrfVU6D tf6qa4syH9vQnd7sxX6Di7XZ8Bj2+w6YbWF6o8LqHUvlDRyPu+CJDEoP4WIvgJkVlhIC h4xw== X-Gm-Message-State: AOAM533M18bFDD43J9yAQhyZs+WS5k0nRpdFy+eeqDPsXK0oGhP+TtWM 8mC+o6FkBSCSPeXi/PRikaUD3DwRZvvarg== X-Google-Smtp-Source: ABdhPJzkTbji0EJVRIbe+g7AG4Zc0d9NQ3YKJqrOFIIJ4mDFSNtFKwCMjq4+Yj5HMlY1+l+zkx3APA== X-Received: by 2002:ac8:39a4:: with SMTP id v33mr11823361qte.251.1590079448777; Thu, 21 May 2020 09:44:08 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:08 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 40/74] i386: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:37 -0400 Message-Id: <20200521164011.638-41-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x82d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/cpu.c | 2 +- target/i386/helper.c | 4 ++-- target/i386/svm_helper.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9e8ae1569f..2b60537b23 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7051,7 +7051,7 @@ int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request) static bool x86_cpu_has_work(CPUState *cs) { - return x86_cpu_pending_interrupt(cs, cs->interrupt_request) != 0; + return x86_cpu_pending_interrupt(cs, cpu_interrupt_request(cs)) != 0; } static void x86_disas_set_info(CPUState *cs, disassemble_info *info) diff --git a/target/i386/helper.c b/target/i386/helper.c index 058de4073d..623a7299ac 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -1029,12 +1029,12 @@ void do_cpu_init(X86CPU *cpu) CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; CPUX86State *save = g_new(CPUX86State, 1); - int sipi = cs->interrupt_request & CPU_INTERRUPT_SIPI; + int sipi = cpu_interrupt_request(cs) & CPU_INTERRUPT_SIPI; *save = *env; cpu_reset(cs); - cs->interrupt_request = sipi; + cpu_interrupt_request_set(cs, sipi); memcpy(&env->start_init_save, &save->start_init_save, offsetof(CPUX86State, end_init_save) - offsetof(CPUX86State, start_init_save)); diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index 63eb136743..c739bf0d9c 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -316,7 +316,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend) if (int_ctl & V_IRQ_MASK) { CPUState *cs = env_cpu(env); - cs->interrupt_request |= CPU_INTERRUPT_VIRQ; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_VIRQ); } /* maybe we need to inject an event */ @@ -674,7 +674,7 @@ void do_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->vm_vmcb + offsetof(struct vmcb, control.int_ctl)); int_ctl &= ~(V_TPR_MASK | V_IRQ_MASK); int_ctl |= env->v_tpr & V_TPR_MASK; - if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_VIRQ) { int_ctl |= V_IRQ_MASK; } x86_stl_phys(cs, From patchwork Thu May 21 16:39:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563571 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63343739 for ; Thu, 21 May 2020 17:04:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38FE4207F7 for ; Thu, 21 May 2020 17:04:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Jw4Rv8VY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38FE4207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbocc-0002fQ-EJ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:04:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIm-0003gp-KU for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:12 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:39761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIl-0006bt-Ej for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:12 -0400 Received: by mail-qt1-x842.google.com with SMTP id l1so5987283qtp.6 for ; Thu, 21 May 2020 09:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DIHX0WJxTdy28I7CslaN2HbTZg9fiYXdvrHYT2rc2zE=; b=Jw4Rv8VYbT7MbaIHDAhN6osOQq0OX+uMEgUhQO5g5LTA/qyVMoGP5YYTwGPyQf3knH Zhtc8+OPY/rxgEENRsFIxDTRnN/OGJuKv2Q7jdQDR7SREBpwHv6ZdrUMAprwLSJpruaA bqDPRzDkT7TB8OqWVVk0jIWPLY3eSfoERHv1HsMYPQMUFFrkIqlMIbIG72cesI8iXHY2 2t4kyDtUp6wv7WIrnu3NTSXYK2NFK0O3I21oub5x38UjVoE8sCRbuvirgahcYI62TNtY T/Z9QB9HP18GZgrUvHHNWRS5eLSRnlyH2+wjhZRpbPspnY6rkE3hvSb/j4vXCiRhNVMs 3BFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DIHX0WJxTdy28I7CslaN2HbTZg9fiYXdvrHYT2rc2zE=; b=g6XiWm8e7JVONM6wAqWkbMofGkYbi/YS6RbQaN5XPRFZYPQCTNfMzGq5GxplUruAR5 qBMamKWXwUKkkZ6aj/2Z12negBKYLuMlkP76hJwDsSVTIwzqggV5vQjp6GfpfxtCCHI3 E4p0PUcDi2n98oLY4TrDs4N5BK+2stDD3RwYnvbplCY3SaHrylc50ZTqjZ52z0jLlaTP I/vWxSBOOdFh/U4J8jRUYU3g5Y/Smy9E619zWqMgO0ag3bmk3WZayVmxLF1KGM4a+t2T jq8trzR+4WbzybeK2qZB6FMsfr+Qtt/LqqPT9UrutaliNFXqW3JEv/OTrgTu1FDYsNbe YfAA== X-Gm-Message-State: AOAM532pgC6W+izm3Q3ztR3atBcLHlNf8BCqxa/YWGUi51XjNpfjcqgW i14e6JAUWAwAm8SIBjKAYPXEWuehYKJ3jg== X-Google-Smtp-Source: ABdhPJyTy0CW101BwkgecrdUTiCmVzLzVJV7N+fsa0O+1YbP7oWUhLX0I9GwRpj7Os9bbTQn8tOxNg== X-Received: by 2002:ac8:3594:: with SMTP id k20mr11840044qtb.381.1590079450083; Thu, 21 May 2020 09:44:10 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:09 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 41/74] i386/kvm: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:38 -0400 Message-Id: <20200521164011.638-42-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/kvm.c | 58 ++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 2451840b36..9b0080a629 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -3627,11 +3627,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. */ @@ -3989,14 +3992,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) { @@ -4004,10 +4007,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) { @@ -4021,16 +4022,22 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run) qemu_mutex_lock_iothread(); } + /* + * We might have cleared some bits in cpu->interrupt_request since reading + * it; read it again. + */ + interrupt_request = cpu_interrupt_request(cpu); + /* Force the VCPU out of its inner loop to process any INIT requests * or (for userspace APIC, but it is cheap to combine the checks here) * pending TPR access reports. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -4038,7 +4045,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; @@ -4062,7 +4069,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; @@ -4108,8 +4115,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); @@ -4132,7 +4140,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); @@ -4142,20 +4150,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, @@ -4169,10 +4178,13 @@ static int kvm_handle_halt(X86CPU *cpu) { CPUState *cs = CPU(cpu); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; + + interrupt_request = cpu_interrupt_request(cs); - if (!((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cs->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cs, 1); return EXCP_HLT; } From patchwork Thu May 21 16:39:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACA2D159A for ; Thu, 21 May 2020 17:06:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 833F020759 for ; Thu, 21 May 2020 17:06:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="u4Arfkbx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 833F020759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboeP-0000Uh-Os for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:06:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIn-0003jq-Ml for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:13 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:45002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIm-0006c6-Mq for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:13 -0400 Received: by mail-qk1-x743.google.com with SMTP id b6so7813608qkh.11 for ; Thu, 21 May 2020 09:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s4hrOWLlZCdJWXysypnArxYHpdNRngJdlfVjmEHFHi0=; b=u4ArfkbxegKy6OUgbVv2mkmVN0sz0duoLipCvIIiUEPoNRNVN634iz7hLO1AcVv4fE 73Ev/Xkn8zoRWuZlF3FcA384xrqqDbBHYLTposjM2f+njbGox0FUfydWkt+5lEo0lUAV farZEEcSZ3yCpGgpDH5DDGgx1qf6pkJGY7aphwd82lPPcUtHYWD+uJvsZ9DxjGJaEIFU b1Pq/JUZtIQVm/NpUN9tbTCh1PMDQGuOVDp8RZLSrf+OH1HVqWKNYllgCgQhaC08ACk2 H3feNnkzuN4+zlSiZu/Ptm2tSJNZV7uuw47hOsIFwrpNLTXVVMjHxLG6pjlLq/PQuR+d 3lHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s4hrOWLlZCdJWXysypnArxYHpdNRngJdlfVjmEHFHi0=; b=Cw/3VHZF0dMa8iIoPj3SP+8q38hK4ezQCBx8l5KWrOUYTmEnpz3vgVB1mln0NeOqBj 80yMbI59tJMQaqjqGJrkhv5HvVFEf9aQRpOtn2EB+gGyThtYeDaL/7mh0brcT1VDeTFb bZh7LaOWYP6m7lf9KRVyJm4+udfmChLZp0L5Q7asaFaVlyob5QJ72+0Zh04dtoSrY/+U G0Zp46At6w9ks7U7lFuPTe4aJN3KtXgTP+VF6d8Ctqr33mLjyC+eQhODAFLT/IqiihY+ ETOdYEAgtPcJ3RoFK/j4LwFdS7xq4vOUiGKLPYz6xZ+oygI4E45EboWgUzStFbP4Rw+r +nMw== X-Gm-Message-State: AOAM531BxS1lUtYKW89zBs9kZ+fesnsdBhQT+hNZnzbJK1YVWKWpa+na k+hGNbpw8aTEP8UDYroi9Vz0a1oe8qP+nQ== X-Google-Smtp-Source: ABdhPJx1LT88MTQ6mKkBlIW9WI2xe30FN6BuxKYTgY20kHhSMQpkPAUzu7sa6KYBs5IJVi5Fttjq1Q== X-Received: by 2002:a05:620a:204e:: with SMTP id d14mr9449775qka.13.1590079451503; Thu, 21 May 2020 09:44:11 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:10 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 42/74] i386/hax-all: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:39 -0400 Message-Id: <20200521164011.638-43-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota [RF: Converted new code to cpu_interrupt_request] Signed-off-by: Robert Foley --- target/i386/hax-all.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index 1edd6c77df..66de14b27b 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -285,7 +285,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); @@ -419,7 +419,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); @@ -433,7 +433,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; @@ -472,7 +472,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) return 0; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } @@ -495,20 +495,20 @@ static int hax_vcpu_hax_exec(CPUArchState *env) * c) INIT signal; * d) SIPI signal. */ - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + if (((cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (cpu_interrupt_request(cpu) & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, 0); } - if (cpu->interrupt_request & CPU_INTERRUPT_INIT) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) { DPRINTF("\nhax_vcpu_hax_exec: handling INIT for %d\n", cpu->cpu_index); do_cpu_init(x86_cpu); hax_vcpu_sync_state(env, 1); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_SIPI) { DPRINTF("hax_vcpu_hax_exec: handling SIPI for %d\n", cpu->cpu_index); hax_vcpu_sync_state(env, 0); @@ -577,13 +577,17 @@ static int hax_vcpu_hax_exec(CPUArchState *env) ret = -1; break; case HAX_EXIT_HLT: - if (!(cpu->interrupt_request & CPU_INTERRUPT_HARD) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { - /* hlt instruction with interrupt disabled is shutdown */ - env->eflags |= IF_MASK; - cpu_halted_set(cpu, 1); - cpu->exception_index = EXCP_HLT; - ret = 1; + { + uint32_t interrupt_request = cpu_interrupt_request(cpu); + + if (!(interrupt_request & CPU_INTERRUPT_HARD) && + !(interrupt_request & CPU_INTERRUPT_NMI)) { + /* hlt instruction with interrupt disabled is shutdown */ + env->eflags |= IF_MASK; + cpu_halted_set(cpu, 1); + cpu->exception_index = EXCP_HLT; + ret = 1; + } } break; /* these situations will continue to hax module */ From patchwork Thu May 21 16:39:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563575 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20C83159A for ; Thu, 21 May 2020 17:05:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBCD820759 for ; Thu, 21 May 2020 17:05:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="W7AF5Djg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBCD820759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbodK-0005Ag-6m for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:05:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIp-0003pS-Jh for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:15 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:33288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIo-0006cR-CJ for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:15 -0400 Received: by mail-qk1-x742.google.com with SMTP id z80so7919470qka.0 for ; Thu, 21 May 2020 09:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EcsY6TGhrUKNyVg3Ugjl3o+5XwjzyMO1Q9LTdSRFfVg=; b=W7AF5Djgi8fFdX2rYkKCq77FDBTeYnp6uw7LfNlHtCyKignaAXSWm5Ap3eo2KUlKea JncBV6e/XRudH8Lnz1R2opmCOrpr5rxhPan0rFZ3BgJjv0FAz2ESDhx1aImSujS95zWo S/mVORkgCdX3tSZoIwNhmLvE1KKJ/fVcl2uQRMXgD3NSDzo3ZL7QeQ5RPrU85ZvruFFL 0qDghS6SNZ+LYCCI/AYHGZ0fI+vdGoJYwfRSQvWoTgMCEasDYS3L8v1uWskQ0GYVO6UJ JT0wv4gePOP19fzB40QZyHQZOPrENwgEploBaJtqYXJGrSxexwD/BVdhFnAe1bDVYqvc XRKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EcsY6TGhrUKNyVg3Ugjl3o+5XwjzyMO1Q9LTdSRFfVg=; b=ubB2tnSwIIE5VCfIVE1Wtw7iCRDBqlMhsTbYgUKP2l/wWQHMipvC++5LiYaZegsRt4 /k46MTFE54Goi37osib7aTnsPxCX86o89711pRi99rKg+FnWzk1WVaQVyHocz28wfgrP ti7vAr0Nf9ZSbIWO0ilMSY9HrOdtB8+pNRI3Ac8ZhrOtzv/gcheEDTo4AxwMuzGaC1DC MqdaTAxL0kwu/VHh7G/6KQGQu77gFBHjg/XwKV/6jE/XqWw3AJ0OzOU/85bgl8Q14UYh 8PpfuBZUGplGEWmcVzaTI8eossi2xnvhaLhekf77QGYF1l8PbuibnGiAjSUixXHp5gOx VfSQ== X-Gm-Message-State: AOAM5326mCzv2BJ21UqkUOa0X1UCFcAeYqeh4DQyfYXQtb+sCB9gYfaz 53w38CTl2Cx5lOwg1hWB1fwzcQvkbomHGA== X-Google-Smtp-Source: ABdhPJwT37tSny7XPewJSB0zYxkwzwLh/ER8qzfId/AcFZ9/YZugQqFNvRdCWpaw8jVdpHH1g4KTSA== X-Received: by 2002:a37:b144:: with SMTP id a65mr10559117qkf.462.1590079452888; Thu, 21 May 2020 09:44:12 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:12 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 43/74] i386/whpx-all: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:40 -0400 Message-Id: <20200521164011.638-44-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/whpx-all.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index d5beb4a5e2..cb424f04a3 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -752,12 +752,14 @@ static int whpx_handle_portio(CPUState *cpu, static int whpx_handle_halt(CPUState *cpu) { struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); + uint32_t interrupt_request; int ret = 0; qemu_mutex_lock_iothread(); - if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cpu); + if (!((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) && - !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + !(interrupt_request & CPU_INTERRUPT_NMI)) { cpu->exception_index = EXCP_HLT; cpu_halted_set(cpu, true); ret = 1; @@ -775,6 +777,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); int irq; + uint32_t interrupt_request; uint8_t tpr; WHV_X64_PENDING_INTERRUPTION_REGISTER new_int; UINT32 reg_count = 0; @@ -786,17 +789,19 @@ static void whpx_vcpu_pre_run(CPUState *cpu) qemu_mutex_lock_iothread(); + interrupt_request = cpu_interrupt_request(cpu); + /* Inject NMI */ if (!vcpu->interruption_pending && - cpu->interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { - if (cpu->interrupt_request & CPU_INTERRUPT_NMI) { + interrupt_request & (CPU_INTERRUPT_NMI | CPU_INTERRUPT_SMI)) { + if (interrupt_request & CPU_INTERRUPT_NMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_NMI); vcpu->interruptable = false; new_int.InterruptionType = WHvX64PendingNmi; new_int.InterruptionPending = 1; new_int.InterruptionVector = 2; } - if (cpu->interrupt_request & CPU_INTERRUPT_SMI) { + if (interrupt_request & CPU_INTERRUPT_SMI) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_SMI); } } @@ -805,12 +810,12 @@ static void whpx_vcpu_pre_run(CPUState *cpu) * Force the VCPU out of its inner loop to process any INIT requests or * commit pending TPR access. */ - if (cpu->interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if (interrupt_request & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)) { + if ((interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { cpu->exit_request = 1; } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (interrupt_request & CPU_INTERRUPT_TPR) { cpu->exit_request = 1; } } @@ -819,7 +824,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); - if (cpu->interrupt_request & CPU_INTERRUPT_HARD) { + if (interrupt_request & CPU_INTERRUPT_HARD) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD); irq = cpu_get_pic_interrupt(env); if (irq >= 0) { @@ -849,7 +854,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) /* Update the state of the interrupt delivery notification */ if (!vcpu->window_registered && - cpu->interrupt_request & CPU_INTERRUPT_HARD) { + cpu_interrupt_request(cpu) & CPU_INTERRUPT_HARD) { reg_values[reg_count].DeliverabilityNotifications.InterruptNotification = 1; vcpu->window_registered = 1; @@ -902,31 +907,33 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr); X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_vcpu *vcpu = get_whpx_vcpu(cpu); + uint32_t interrupt_request; - if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { whpx_cpu_synchronize_state(cpu); do_cpu_init(x86_cpu); vcpu->interruptable = true; } - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); apic_poll_irq(x86_cpu->apic_state); } - if (((cpu->interrupt_request & CPU_INTERRUPT_HARD) && + interrupt_request = cpu_interrupt_request(cpu); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (env->eflags & IF_MASK)) || - (cpu->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu, false); } - if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { whpx_cpu_synchronize_state(cpu); do_cpu_sipi(x86_cpu); } - if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu, CPU_INTERRUPT_TPR); whpx_cpu_synchronize_state(cpu); apic_handle_tpr_access_report(x86_cpu->apic_state, env->eip, @@ -1413,7 +1420,7 @@ static void whpx_memory_init(void) static void whpx_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Thu May 21 16:39:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F5FA739 for ; Thu, 21 May 2020 17:08:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5665420759 for ; Thu, 21 May 2020 17:08:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ps0vx/oU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5665420759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbogG-0004Nj-HS for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:08:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIq-0003rp-GA for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:16 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:40841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIp-0006ca-CM for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:16 -0400 Received: by mail-qt1-x844.google.com with SMTP id c24so5988102qtw.7 for ; Thu, 21 May 2020 09:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vTZZ/kHNyF+wmPfkKEvG91Ao0Id6+gZs4oPmDCc+3GU=; b=ps0vx/oUNcbiF394xVKpKc2d43SnXgW97RR109R+vPJ4bId3k+t4kJQENqluPE9Jf1 rYI+yDSIz1QU4VHyi4Eq2Gv4YM5C1kOZQ1bIpBZ/DwvBD4qrZgmsxIyKmPDgqh5wyAq+ qUsApAt0gVLMo+los8hoXGiVyH8Da6CL8WZ0nR1ItgfVtU9jU60HTJcdqgCJCiSatwZH MGI0KcJ4/2LmmGZyV3LmsatrZ1WnUhRJtfQfrxn4ScVrJTT4Rxa/Hv0Sa+jTX8hdF0Y/ Pq6lBXOFibyGR89nx6DSBS5n+6yinTlWRNPu9aYRnfOssSve3MJDVxB9fCjwVZ4oIbJL yy9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vTZZ/kHNyF+wmPfkKEvG91Ao0Id6+gZs4oPmDCc+3GU=; b=ChZV7ukIMHSG9KWb+MhGSIQB2vwiXZW+mGYUck3FAyg0upnjWjq7qLuQeDoEtXy6Ja 0SgfyhML0eWJ7pvoeHnjgzvyqB5NQjm+a1zhHTeX/XB7epXi8d3K/Vk9Z3MKcWQ9XLBW 4TcFDSNs91v2n5y+un0dZbRZ9YzG7fKNz9vRAfGa/U7MGznqnMdgHf3pDhMi1M5taBJQ QC9iD/hab+AqZsfEXyDCABWduphA47MOtpCUWxqAVu/ilcEPPNfB/O24f26GpawI/618 QDlZYiOovNLtVu0zkZ+qPHWmrN/jKt48JTIPUQQz3HjwDryws9ANKLwCrfP0EqurRkNh GHng== X-Gm-Message-State: AOAM5309Rb2d/sAGsqOQMVuh/9V1Rrq8aYG3/KLzFW1p8Fs3+qpJS5b4 k/Vn2o9Pb7W3DOZbA/qCC2xYET66vnVWow== X-Google-Smtp-Source: ABdhPJzgvbghOskls/22BeTZxyWRtAtdRw/lT7VTUfQeyL2/S6zMj2TNdVGAj8ScXWm/IIn5QcfWgw== X-Received: by 2002:ac8:2fb9:: with SMTP id l54mr10851777qta.211.1590079454245; Thu, 21 May 2020 09:44:14 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:13 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 44/74] i386/hvf: convert to cpu_request_interrupt Date: Thu, 21 May 2020 12:39:41 -0400 Message-Id: <20200521164011.638-45-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/i386/hvf/hvf.c | 8 +++++--- target/i386/hvf/x86hvf.c | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index bf60ce9d66..52ccdf85e4 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -262,7 +262,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); } @@ -733,10 +733,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 90f1662d0c..892ae0e99a 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -352,6 +352,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) uint8_t vector; uint64_t intr_type; + uint32_t interrupt_request; bool have_event = true; if (env->interrupt_injected != -1) { vector = env->interrupt_injected; @@ -400,7 +401,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) }; } - if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_NMI) { if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI); info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | EXCP02_NMI; @@ -411,7 +412,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state) } if (!(env->hflags & HF_INHIBIT_IRQ_MASK) && - (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK) && !(info & VMCS_INTR_VALID)) { int line = cpu_get_pic_interrupt(&x86cpu->env); cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD); @@ -420,39 +421,42 @@ bool hvf_inject_interrupts(CPUState *cpu_state) VMCS_INTR_VALID | VMCS_INTR_T_HWINTR); } } - if (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) { vmx_set_int_window_exiting(cpu_state); } - return (cpu_state->interrupt_request - & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR)); + return cpu_interrupt_request(cpu_state) & (CPU_INTERRUPT_INIT | + CPU_INTERRUPT_TPR); } int hvf_process_events(CPUState *cpu_state) { X86CPU *cpu = X86_CPU(cpu_state); CPUX86State *env = &cpu->env; + uint32_t interrupt_request; EFLAGS(env) = rreg(cpu_state->hvf_fd, HV_X86_RFLAGS); - if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_INIT) { hvf_cpu_synchronize_state(cpu_state); do_cpu_init(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_POLL) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL); apic_poll_irq(cpu->apic_state); } - if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) && + + interrupt_request = cpu_interrupt_request(cpu_state); + if (((interrupt_request & CPU_INTERRUPT_HARD) && (EFLAGS(env) & IF_MASK)) || - (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) { + (interrupt_request & CPU_INTERRUPT_NMI)) { cpu_halted_set(cpu_state, 0); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) { + if (interrupt_request & CPU_INTERRUPT_SIPI) { hvf_cpu_synchronize_state(cpu_state); do_cpu_sipi(cpu); } - if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) { + if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_TPR) { cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR); hvf_cpu_synchronize_state(cpu_state); apic_handle_tpr_access_report(cpu->apic_state, env->eip, From patchwork Thu May 21 16:39:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B56EE14C0 for ; Thu, 21 May 2020 17:06:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88E7520759 for ; Thu, 21 May 2020 17:06:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Hv5Mpjgx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88E7520759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboe2-0007q3-Mo for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:06:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIr-0003vu-Ur for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:17 -0400 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]:46680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIq-0006co-Vn for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:17 -0400 Received: by mail-qv1-xf30.google.com with SMTP id dh1so3333959qvb.13 for ; Thu, 21 May 2020 09:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tPdNOnecxbiLcmdfOUrNbZfK0O1sIcOj2h20T8/5h6g=; b=Hv5MpjgxKmzxDRaA2DFfvRV5Rpmcj9BGOuOOnjTSIfPpY2jJ91RNqmwDNk7A2I/jlP zsNDkrASEIbTI7bvU3WypoeLEplAnysfLFCSRi8lTzE5S2UkA7rZWvDPXzv9RoBhSF2x DWUYhQZPCqe9x9xfDswkebcHlUD6eTGqyqMe4U9VvHv1Chny9x2smDR+gR+pVAMmcWRy uUPs9gISWWdD3ONjNyaMbNwCvVJO+7g7aMNWX9sji/slNVCm/Y50xpsIiRL5GZI/Z3Kc q4HD/erjV9D4KQXb8mKMMsqduxYjHLVqgs3Ol4gMVQRlwnRnI5uv9GxabShNyYTvIIpx 279w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tPdNOnecxbiLcmdfOUrNbZfK0O1sIcOj2h20T8/5h6g=; b=JnWDBWOmQGazjBOaU6zCZFv5KlhidunuRmGxsejc2SaV83DPSAwpviTakToAcgYZyp O21PidPQKFycvHFzlm/MK+6ibUAEa65TbhT2Dwf78sfbpUSMANdGZVRsJDwnRjbBNA/Y EjwdwiJLgfLy2zfzgOxADQG017SoJ5PdSiRCU8iLLa5ZA8EAh2DUa1WW+QHTR7VnRNla koqZoT9A27e+1gV5L7yKaeJa3lhtnwqxhVu3958uRAKOCpcDW/5CPvw1TdEy3/bg3sZy TwUIYuWBATEJFoNJhnWmrKA+lizKsXJNqTylEEkHpeYcLovRVKs6xibldC0tyacFt076 9fzg== X-Gm-Message-State: AOAM5314ZJhFbEBEoZH1eu9CzaOURtr2SYG0+ok8XyQVW+TkL69o2RY4 YWcqXhzJmQHs920tVSPiybWc0XdGGhTNUg== X-Google-Smtp-Source: ABdhPJzVe3NqVMCMik4u7ARBkDJQYEcHYgLYOE8jFJRizC5Frs0wSWNII3wxEx6ks6PxrpzKDyiR5A== X-Received: by 2002:a05:6214:6a7:: with SMTP id s7mr11101743qvz.142.1590079455521; Thu, 21 May 2020 09:44:15 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:14 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 45/74] ppc: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:42 -0400 Message-Id: <20200521164011.638-46-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::f30; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf30.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota [RF: Minor adjustment for new code in hvf_inject_interrupts] Signed-off-by: Robert Foley --- hw/ppc/ppc.c | 2 +- target/i386/hvf/x86hvf.c | 1 - target/ppc/kvm.c | 2 +- target/ppc/translate_init.inc.c | 14 +++++++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 0e7386ff88..89f92c4a88 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -89,7 +89,7 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, - env->pending_interrupts, CPU(cpu)->interrupt_request); + env->pending_interrupts, cpu_interrupt_request(CPU(cpu))); if (locked) { qemu_mutex_unlock_iothread(); diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index 892ae0e99a..68175074e4 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -352,7 +352,6 @@ bool hvf_inject_interrupts(CPUState *cpu_state) uint8_t vector; uint64_t intr_type; - uint32_t interrupt_request; bool have_event = true; if (env->interrupt_injected != -1) { vector = env->interrupt_injected; diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index aae2ef0ad4..084e158c34 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1350,7 +1350,7 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu) CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && (msr_ee)) { cpu_halted_set(cs, 1); cs->exception_index = EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 5838b6f7bc..e61ba39982 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8540,7 +8540,7 @@ static bool cpu_has_work_POWER7(CPUState *cs) 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)) && @@ -8564,7 +8564,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); } } @@ -8702,7 +8702,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)) && @@ -8734,7 +8734,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); } } @@ -8904,7 +8904,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } @@ -8950,7 +8950,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); } } @@ -10655,7 +10655,7 @@ static bool ppc_cpu_has_work(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD); } static void ppc_cpu_reset(DeviceState *dev) From patchwork Thu May 21 16:39:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25746739 for ; Thu, 21 May 2020 17:07:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F09A620759 for ; Thu, 21 May 2020 17:07:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CfujEWZn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F09A620759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboff-0002z1-6m for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:07:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIs-0003z0-Te for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:18 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:42555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIr-0006ct-Ve for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:18 -0400 Received: by mail-qv1-xf43.google.com with SMTP id g20so3345197qvb.9 for ; Thu, 21 May 2020 09:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cJAv+EbsefdW66yr8LjRtj+7g6Sr3jeK6hHxTVUkhJA=; b=CfujEWZnCTXFPZ9auk2CPEj0Hxw0F4l/8hAAjB2gUlQOCOxDHMLLp1OGcX1W+lUngG rfnOEA0I1hzQ1u0mYCUIlZMyARu4kLf2/d9VuJBzncz+Ta5isApzSg7VejYmuOTNDSPo 1c8ZV6RYfBL9i9E6y80ILhxHRB3igsGM13ao2qJJEv/yUILzfwTPYNB8PFYv3QlviYtd z7sul4WjYnIWwY6Yv5Scwx3SCZci7bFpvnuY2+EtIuJYr65bDUCcGRdoquQMHd3auBLs 2q4dq6fmFXHFINABhKuK4ZFyuexO3Akq++Avwgqn+pKuQJjQqBCVaAwJaO1QiY0ART9i +v5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cJAv+EbsefdW66yr8LjRtj+7g6Sr3jeK6hHxTVUkhJA=; b=DVGz5PSL2JPuiMdrrJBFw01oH/ngG77LYPlxc+rScLHtjDbaz5NNP6lzDHR7vIDmeR skB4jdPnyGGV9Wjotcv8BfZaQUZ9tIOZCsbIWE1XAVbXmyCok/oLsDcgM/WteVG1wxg3 cySPENf8gxAG2MywBZXX+UgRVXnCQ7e4pLNlUTR4IMtrUnYPfLN4rq/ZVi4caMX2zXM/ QGnNr+CibdDxO5L+OkNwVGo96Bhkj/UDTVbwTRr9KViQF3ukl45QGkhpgRpXPd2hNJco H3RRj28ii0N4J64AGmI260cWvIXSTqP0sd98S/HB5PJDSRelIjcQXKo1wXHfNTGc/DNI KeKQ== X-Gm-Message-State: AOAM531CgPdgLUCr12WhYzrXsjQrMY8JwXHrkxtlaX9ETPoskNOOUbZw 0mzmHnPQHU+Hxy6FVgOC1JcrCMZRwWQLwg== X-Google-Smtp-Source: ABdhPJz2TSxG9laS5gW1TVM6nOt/7g+Xlz2FXHIZ/RIjKH8laIpAmAo8uN9iimexu69D7Q7VPboCGw== X-Received: by 2002:a0c:d981:: with SMTP id y1mr11099259qvj.64.1590079456735; Thu, 21 May 2020 09:44:16 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:16 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 46/74] sh4: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:43 -0400 Message-Id: <20200521164011.638-47-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Aurelien Jarno Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/sh4/cpu.c | 2 +- target/sh4/helper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 3c68021c56..18f3448183 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -44,7 +44,7 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) static bool superh_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void superh_cpu_reset(DeviceState *dev) diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 408478ce5d..1e32365c75 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -62,7 +62,7 @@ void superh_cpu_do_interrupt(CPUState *cs) { SuperHCPU *cpu = SUPERH_CPU(cs); CPUSH4State *env = &cpu->env; - int do_irq = cs->interrupt_request & CPU_INTERRUPT_HARD; + int do_irq = cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; int do_exp, irq_vector = cs->exception_index; /* prioritize exceptions over interrupts */ From patchwork Thu May 21 16:39:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563523 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC3AE739 for ; Thu, 21 May 2020 17:01:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A3347207F7 for ; Thu, 21 May 2020 17:01:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yOGgn9Bg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3347207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboZi-0004EG-QX for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:01:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIu-00042h-74 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:20 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:42242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIt-0006d9-6x for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:19 -0400 Received: by mail-qk1-x742.google.com with SMTP id s1so7837515qkf.9 for ; Thu, 21 May 2020 09:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SQwt3BlCMlkRrdpIoHWlR7VL+MoMENIbhHHtRYB6xLo=; b=yOGgn9BgznS/yS1LrJvqdJnaqQUv3Vd+eeNO8HyHHNLDVC3F/tIV+2EBndyiFxhUzj 5+5AAik2xy0mLAimDWl5ECgK9p5NXiNwX8lqUMSVya+pxVxplE+KhndczpqjZ/pdqh6Y 2vHUOC7B4KQsQifWJ+aJic+rA2yRGI11vEoyCnIM6R0QIBGrYaZ34b3s29zlFu2jUvrB yQKTRDVwp2pbmEO2/NoC0RztdQj1MIxQ9uAI5GpyyiWw5gt/u0J38OY/sPH+BwREzxm4 O/TCLpxzGgd0WgM0YYFITRIrSmOOWWUZAtpllgqlCcVo6RyRMC6dLCjnZerGFVOWcSaU imZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SQwt3BlCMlkRrdpIoHWlR7VL+MoMENIbhHHtRYB6xLo=; b=Uyfcn6wqC8Ia8NoU0ptgFQif/EFOTlza+jGDtmF3/3C54/E99gEjKW/v9WcM2IZM4E c8l+gfcU680kK5NTGdNppjQHQTcJKwmoXsYR9bzeSrkquJbijhOguiAy8hczoCHdkuM0 VW53Q4SEoAoWYedyLyZVZxwSZoNHhNpmrLrWizza4RVFbra0PPRz4VOjQYyVzpolR+6U PGG1r8zSeytcBnKrSqnhgbJy32v3KcLnDDNa7LrIzRGmGCPZGaZCSr7vXmR8tD75e8Oo 8Gz+krw02hS6GRse+BgPg26oKmdXwiWzjJf1YbEoV3mclJglAAYy6zdAF0Zk0qKZPYCE GiMg== X-Gm-Message-State: AOAM530cQHQfz/dOWWQ5MMDfGrsNo3tq+UJfSivbyoZBR2rM2dgsiIfX AGcMrbR+NKQguMfe0gMgeaGkBuTK+/t9xA== X-Google-Smtp-Source: ABdhPJynGFq8Df6BbQkCk9y0uQHmLjSnNZXdVpOM8i/YmIf7kfEZTOhJ7Yy0mAUPRxi0840riiMMTQ== X-Received: by 2002:a05:620a:a83:: with SMTP id v3mr10996261qkg.84.1590079458051; Thu, 21 May 2020 09:44:18 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:17 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 47/74] cris: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:44 -0400 Message-Id: <20200521164011.638-48-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, "Edgar E. Iglesias" , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley Reviewed-by: Edgar E. Iglesias --- target/cris/cpu.c | 2 +- target/cris/helper.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/cris/cpu.c b/target/cris/cpu.c index cff6b9eabf..6d7e266042 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -37,7 +37,7 @@ static void cris_cpu_set_pc(CPUState *cs, vaddr value) static bool cris_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } static void cris_cpu_reset(DeviceState *dev) diff --git a/target/cris/helper.c b/target/cris/helper.c index b5159b8357..67946d9246 100644 --- a/target/cris/helper.c +++ b/target/cris/helper.c @@ -131,7 +131,7 @@ void crisv10_cpu_do_interrupt(CPUState *cs) D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, - cs->interrupt_request); + cpu_interrupt_request(cs)); if (env->dslot) { /* CRISv10 never takes interrupts while in a delay-slot. */ @@ -193,7 +193,7 @@ void cris_cpu_do_interrupt(CPUState *cs) D_LOG("exception index=%d interrupt_req=%d\n", cs->exception_index, - cs->interrupt_request); + cpu_interrupt_request(cs)); switch (cs->exception_index) { case EXCP_BREAK: From patchwork Thu May 21 16:39:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F718739 for ; Thu, 21 May 2020 17:10:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7623920759 for ; Thu, 21 May 2020 17:10:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PApIav66" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7623920759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboiN-0000Kz-Hw for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:10:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIv-00045l-8M for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:21 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:43430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIu-0006dQ-C7 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:20 -0400 Received: by mail-qk1-x743.google.com with SMTP id i14so7815678qka.10 for ; Thu, 21 May 2020 09:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oS4OFCHOXLNPVShms1TjWbnrC15wr+ouKwB5TcDXaeE=; b=PApIav66WsDc1bFqajYu0cRHwN7mfnbvpm1wtAm6l9c+Kn/zD+Xi7kBv3kOikQn8of ue3AN3ddkcbx9dyNM7kcu+nsKgbO8n8E/IJZdEoY3c508n9Cvl4brDZolFBg5u/Cg84Y Ty1sVQgraHCo313hncSfyLg6WTFIEJWBmoNn6RpBanz1HlHPPhm8JpFXj+ZIFh6iT8PG 8a3r60+NYc/pafcnPd3DfgIjIpv7l4TMGYgAVMTyK3kWoEoMkspRgIMKco7hKFVT+RFn Tqwgo4sH/B3ji0TT+eLIrlZhZtSJ7FyYcBl9poOgA2x2H5b5bERkMDAZ5wU5GsT0sJhL MNnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oS4OFCHOXLNPVShms1TjWbnrC15wr+ouKwB5TcDXaeE=; b=HgO3Co6IACo7UmWWAAMqqujfQPuyqCXla5Ttnre2/siSGYJUkoHZyMXVYOp5e6Orix +ET4rFPXj2LqM5fkpEKCzYZBKLz4XluR8QQGP+Xyz5fLNInYWEaSHrNVxKjHSmiBG2hw x/z1e2wSV2H1HkBesD9c44SR8EhoNdV+OVyeGR7pXTKptxox6Y+vDbQybgVOyH8uXfFW WC39tN40yzq/SWoI8HfgDRICzJ57LmJBlixGAkfeg4Sz/z0kUGmPtJTJ4p1n8spVtYY3 Vdj/eovr6fU6gukNjRcsw4ETaFfi4B22IsICOXpRCVNMNO7WKwAFtqJBNihaHw8JfvTe jU9w== X-Gm-Message-State: AOAM530sb60ZKP0g7oMnTQFalloeyGuuPWiyqdhCNhgZeRM28i1ofEDA 7AQqW6s/j5feU4+vw5XX25B+iuHhbQluew== X-Google-Smtp-Source: ABdhPJxVo3qqeqqFsltgKt+Cr6IXu1GmbYY9pxNhyBFpd20suueKSQEfcrWEgSFIH4RVdZe22f/GaQ== X-Received: by 2002:a37:8d85:: with SMTP id p127mr9862865qkd.35.1590079459260; Thu, 21 May 2020 09:44:19 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:18 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 48/74] hppa: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:45 -0400 Message-Id: <20200521164011.638-49-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/hppa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 71b6aca45d..287055f96e 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -61,7 +61,7 @@ static void hppa_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) static bool hppa_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info) From patchwork Thu May 21 16:39:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 264A6739 for ; Thu, 21 May 2020 17:09:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F10D220759 for ; Thu, 21 May 2020 17:09:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G5aczt2d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F10D220759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:54570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbohR-0006oY-3K for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:09:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIw-000493-Ii for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:22 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:41362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIv-0006dj-MM for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:22 -0400 Received: by mail-qv1-xf43.google.com with SMTP id v15so3358333qvr.8 for ; Thu, 21 May 2020 09:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=leGMjXpK2HH4jKgWKo9xRsuJr3HkPgiK0233yCfpGgs=; b=G5aczt2dpOKIKi9IgJcGV67xlqm5xPcdhGw4lK+DpCsr5YXe95LUhE4rFDIi4lofkb X4RVjQIWs5VxNiFHfoWr65rESg+N/TnxSY00KrrgBIvLL2bh6t3CWLBu9oe38w1HqTZt RVRstxlcE1JofmLuBd30bJYfkLu4V3/eBT1XEY19y8F6UyfxgEcyEPDD+PFhIC9W2NOW j/xfznMaiFTPQkeZ5uPFpqeq0pgA+j1Z+C4gLMHNVSPTbm6pJQwZQRhs++MFLeJT1a3d 7S0sO1GIvzgYjyr1HyIy4HILq++AHGtXX/ST7tG5Oy1c3SR6bJwMGNBT8nfWqeR2qr5I pv8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=leGMjXpK2HH4jKgWKo9xRsuJr3HkPgiK0233yCfpGgs=; b=GReuuiWywltA/IHgwbCFtEy5o6YXUx7mIH8iFG+rk8P5ssorbotkRjWqoiEBPSJMut nE2I0/8KNM9GnfBB95oZZxjcYHnxF/QzBk9YMyDly6WdXTVfIgpWnit/bsfCE2ZMCVN2 gAQecjWMr8NqhROvX4ILeMTs9D8P4Q5NZ44w06/HnV3g9R74kWvFAalodlX7CtHmir5s 9r3O4IiKMnb4e4RFCG4inkndfqfg6Vf2rcetPsjXWIFCUqZEdf+y2vYSYQSzAg/6T90Q NMvFNpcj1FY8q/kI+wGJG3ElXt//aBHfvswDdEEUo6+1cqby3ZeRB+61gaghOgotxuwY Js0Q== X-Gm-Message-State: AOAM532j+QfxqN8t9bqZbgwEXYKGD3NJ63QiP6Ygx3ZR1c3GuYL7ig6A xRTr02Kb/E0shnI5/4hWWutCC4JNO3LnLw== X-Google-Smtp-Source: ABdhPJxrqItGbtLUe1XkxIEFvZ1PQ2Fa+E7wcn0uQrojUd9HYX5HOHWg/OXPm+EnJxhGhWyc8Yp6Tg== X-Received: by 2002:a0c:f887:: with SMTP id u7mr10969837qvn.32.1590079460585; Thu, 21 May 2020 09:44:20 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:20 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 49/74] lm32: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:46 -0400 Message-Id: <20200521164011.638-50-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Michael Walle , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Michael Walle Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/lm32/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index c50ad5fa15..9e7d8ca929 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -96,7 +96,7 @@ static void lm32_cpu_init_cfg_reg(LM32CPU *cpu) static bool lm32_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void lm32_cpu_reset(DeviceState *dev) From patchwork Thu May 21 16:39:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 631B714E3 for ; Thu, 21 May 2020 17:12:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A89B20759 for ; Thu, 21 May 2020 17:12:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gyGnLVoc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A89B20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbojx-0003zY-9m for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIx-0004CU-Mn for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:23 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:33294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIw-0006f2-RX for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:23 -0400 Received: by mail-qk1-x744.google.com with SMTP id z80so7920000qka.0 for ; Thu, 21 May 2020 09:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lvs+qOX6bs/iZi7N2ZR8e7cxDlqBQWqbjCB2CJTYkPk=; b=gyGnLVocNsqusg7aysasSPmEq8EbrQoPhaHALMkIrdkI+AvNly4pE78i1Bu1PYCNVD qlwnYH/llKom/fosGdp5qKqr4tG0Bvu1HorIXbHU2OdqMzKE/yMgU5yaAnJSKCNVmlPX JUCtdVcIqLC2ZHA2WjvAYgz6FO+Fxyu8aeBBJCJUnZpS4FTYGucfwybRYqvDR44cPSt3 Fj99KATnODezSf+3PzcfC4DGqJY0aNyxit2B8gGq8iLoYOwWxJ524ZAV2stAqCYd5IAN NQ+ORLLPWNthNBYWAEEro2JtgzfmEPJWdkM6k9/P/T4XDJIk+bRtVv0VtXMmBCozn0i/ 8xnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lvs+qOX6bs/iZi7N2ZR8e7cxDlqBQWqbjCB2CJTYkPk=; b=Dp5P22OouW/LEkMvxv2MD5TtNOAo+7B3wGoeAtE2ayY+5kegQRlO96Qw2isNCgyr6J A9J4oNnGIZsoBBMhWULW3ktK1LSvfHhuuh2TOMWe/PpGf7T39RjcpWU+8Mnicp/cet/z fGji7ywHe11pGePQRMRP6Q21x3M3x4AmxHr3XFwpFt5guu55i9d529oIafS6JX8EWw67 VY2egJkbqd/VkXJVa9Zuhb75+rEF6c0ykfJ7HmpX1ltdO7bANU8zn/Jhr/1PLfqidEDd KXbm6MLedDLVVzREy8ynjoP8kBADaAQ+LLlFZo4kdz+7mm0jAvDl+YtyFvJKjHaVimZK Iujw== X-Gm-Message-State: AOAM532vLt9h4dR1VJ9h2W3XmpJZGfnFyfZLTSA0HSwvrkFx8RvLF4yR jC4RwhPLqlBkMLM/wLAz/jRNNAsupF1l1g== X-Google-Smtp-Source: ABdhPJxCRsKEYiJ3IXN2Q52UA5s5EvSSEwU90+lzihNA4bvHZNdyuNl2InPb3URfRHRSpFG/HqrcAw== X-Received: by 2002:a37:6fc3:: with SMTP id k186mr7872318qkc.419.1590079461789; Thu, 21 May 2020 09:44:21 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:21 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 50/74] m68k: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:47 -0400 Message-Id: <20200521164011.638-51-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/m68k/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 72c545149e..f2585154f5 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -33,7 +33,7 @@ static void m68k_cpu_set_pc(CPUState *cs, vaddr value) static bool m68k_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void m68k_set_feature(CPUM68KState *env, int feature) From patchwork Thu May 21 16:39:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563611 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 738E614E3 for ; Thu, 21 May 2020 17:14:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A1B220759 for ; Thu, 21 May 2020 17:14:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="q81pMuSf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A1B220759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbolr-0007ud-FF for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:14:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboIz-0004Gp-6z for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:25 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:46379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIy-0006fA-4U for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:24 -0400 Received: by mail-qk1-x743.google.com with SMTP id f83so7781462qke.13 for ; Thu, 21 May 2020 09:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V+COCY1tch1+h8AFER7aKTPV6Dtrz1h9iyiTM5X9pZo=; b=q81pMuSfHpaSQP0Bg6AOmJQPY1Vlzu4VEsHUhanDswxU9oDMvvuwuHCItNV6UMUlSN WJE6cPs1TGCrcbYeiXqWQBLwP+jrqDLqK2Bx1EDHupkPAN/EZ8jtNlqfB1kfYWMpvlgO LO8wcmOyMgbak/4n5Ha2hcsfA1zukYy9zYxDet9wmyy7AaZ4sZkhcjUOALHD59K5w9bd A6e3bp7AKFZ44F4dimb101S0HIlqh4Wul5Xi2U6R/+EGLIOo/7dNSJ7i3m0kI6R3n7yl YywP9XkFwuzvjbB18qSf6Q83W203JDvYYimzN69TwngzwR8VXqfsEzx6rT4vBzdt1K1t iQ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=V+COCY1tch1+h8AFER7aKTPV6Dtrz1h9iyiTM5X9pZo=; b=fQnBFE3HkzlpRu8Tzb8FuC6IRdj5NrKfPVy7xkgBA4uq9qs/D0rSolWsdM6we02F8C D5rTlegvUeN+jttwpiBH5GY6DIDvNvxNnie59oB2bjL9r6JNZD7KvMJJJa8+e0/iS60f 8dz01uRphVaWG9o4O6COjDRKubNVVhHjsfVeUaSKU5po2CDqGqQ5duBVPlv7j5fSLV4N 9/Op1TcdTqP2kN9EzWCJbXar8JFf4AWfZcIkPpLZdMISpMXP21AIsLnW+Y4/0/Zt1UBF PsiRvmRyB4RBwmjqi9dU5HMlR5QaGRuZ5O8uPsWEyM99wk29vH8myOXgeEZTbIvmsSsu KJVA== X-Gm-Message-State: AOAM532+Vn38hGiLqfxSepLfzmnTfBK6G1LiEB7xp4QePkzshKSYWzNN kZXt+ngrPVaYEhdhnh8jp0f0PhNtaojQgQ== X-Google-Smtp-Source: ABdhPJzk2WbH9zDu6VpBbJowVTHiZDut64J9RM4Lw81nXXoP3MK2OSLzjko3PeLhAn/miy5AUBSTGw== X-Received: by 2002:a37:f517:: with SMTP id l23mr10962919qkk.475.1590079463093; Thu, 21 May 2020 09:44:23 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:22 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 51/74] mips: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:48 -0400 Message-Id: <20200521164011.638-52-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Aleksandar Markovic , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Aurelien Jarno Cc: Aleksandar Markovic Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/mips/cpu.c | 7 ++++--- target/mips/kvm.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index e86cd06548..761d8aaa54 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -56,13 +56,14 @@ static bool mips_cpu_has_work(CPUState *cs) MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; bool has_work = false; + uint32_t interrupt_request = cpu_interrupt_request(cs); /* * Prior to MIPS Release 6 it is implementation dependent if non-enabled * interrupts wake-up the CPU, however most of the implementations only * check for interrupts that can be taken. */ - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((interrupt_request & CPU_INTERRUPT_HARD) && cpu_mips_hw_interrupts_pending(env)) { if (cpu_mips_hw_interrupts_enabled(env) || (env->insn_flags & ISA_MIPS32R6)) { @@ -76,7 +77,7 @@ static bool mips_cpu_has_work(CPUState *cs) * The QEMU model will issue an _WAKE request whenever the CPUs * should be woken up. */ - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } @@ -86,7 +87,7 @@ static bool mips_cpu_has_work(CPUState *cs) } /* MIPS Release 6 has the ability to halt the CPU. */ if (env->CP0_Config5 & (1 << CP0C5_VP)) { - if (cs->interrupt_request & CPU_INTERRUPT_WAKE) { + if (interrupt_request & CPU_INTERRUPT_WAKE) { has_work = true; } if (!mips_vp_active(env)) { diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 2b7d680547..e9b7a9f2ad 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -141,7 +141,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) qemu_mutex_lock_iothread(); - if ((cs->interrupt_request & CPU_INTERRUPT_HARD) && + if ((cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_mips_io_interrupts_pending(cpu)) { intr.cpu = -1; intr.irq = 2; From patchwork Thu May 21 16:39:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37D89159A for ; Thu, 21 May 2020 17:08:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F0CB20759 for ; Thu, 21 May 2020 17:08:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="q/TnoCI4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F0CB20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbog6-0003x4-8W for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:08:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJ1-0004I5-7K for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:29 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:33295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboIz-0006fx-FF for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:26 -0400 Received: by mail-qk1-x744.google.com with SMTP id z80so7920154qka.0 for ; Thu, 21 May 2020 09:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1YbnvmhNqAhmF66BGNb4cMj4pII5ByUEQJWinpDd9pc=; b=q/TnoCI4H+ymq812X+QylsSs+yotoXQHuK5XQ86dskxT4XUhLhFLdQVMcnjRfoFsg8 oKZVAJCxcTmyu/d3++GU+ySi7Jt0Pab4RI3MMXd4zpB0/07baKfTt1MYNNXY8+7SdcYF X5FxOt+FgsttBlc72MuzGEpTC5XAhRC28vE92qUF6Yrx8Tz/a/wpaso16TwqNZxPtIcN HM1gLuVYeiMfGtxF75GFjk8dpFweDqBie8HTni8Iz/+U2x70fS7SwbEX/ZHUUcAvvLXY ojgltGTB8F0gcASjoYFNTiU4+3S8cS2Tg6fxdQCmJMsPbCKoSFKNDy+Wln+3WkNm045I RTlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1YbnvmhNqAhmF66BGNb4cMj4pII5ByUEQJWinpDd9pc=; b=FKW/umluEyKL4BevTPOf6dZQ4V1NmNm6CbVHEFoJ8nRaeIVzEEWWwS9dJd3O6S3hoy adFW70fvv8YHd/059a9wIaTW7eceKkotH1dK2+CqVv5D6ymrhUuxH1KPNDbmYkD5uv4v FbtvSRtmG+k53eYmgwKhfxBRtd5vzMlYukNBNABkOWhuhjjOJVuNAxcQqTrHv0gXaWL9 XCjq0iC/ASTP6JKwSozKsqYOpq2OCk3EcgeTM4Fgir5jcB5opEtR0HXF6ufLan/r3DCF DscWYs+TzVC7hrOa3PAqMSCJVP1alAgbKmTS4PbpGtv0yCNOM/kKo/ZrSkTT7NP4YX2A rzxg== X-Gm-Message-State: AOAM531OONGRHHt9qNimBm2gB5SgyWb1Ywmd/8KppFj6cgwTOUrxRSsF jH4VDnTMTFn3wdX4GVDrp4fLRA90OvBVlg== X-Google-Smtp-Source: ABdhPJwfYjwdxv/a49GNC97mzxqnoK92+WnjvQMHgER9RdhbwMDUYzqbEoJSW7wubEu6A+nU+t+RbQ== X-Received: by 2002:a37:4cd:: with SMTP id 196mr10736716qke.455.1590079464352; Thu, 21 May 2020 09:44:24 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:23 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 52/74] nios: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:49 -0400 Message-Id: <20200521164011.638-53-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , robert.foley@linaro.org, Chris Wulff , richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Chris Wulff Cc: Marek Vasut Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/nios2/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 8f7011fcb9..fe5fd9adfd 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -36,7 +36,7 @@ static void nios2_cpu_set_pc(CPUState *cs, vaddr value) static bool nios2_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } static void nios2_cpu_reset(DeviceState *dev) From patchwork Thu May 21 16:39:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB419912 for ; Thu, 21 May 2020 17:16:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1CA720759 for ; Thu, 21 May 2020 17:16:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="v5ZpjIYG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1CA720759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbonl-0003Is-N7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:16:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJ1-0004Ia-No for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:29 -0400 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:37756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ1-0006h6-1g for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:27 -0400 Received: by mail-qv1-xf2d.google.com with SMTP id z5so3375396qvw.4 for ; Thu, 21 May 2020 09:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rdoJqb1IBk9SgvYZUNMM+KSW8M0ZuxcTTKuiIiIMCBs=; b=v5ZpjIYGOvlPCrZUyNTyCt6JWDyWc3FctG1uKuwFMq/oFAcQLPRSG3lM8g/KdEKCnU 5j4hCb+6fotCXd6RUDlwoUqAYVHNZlZlP/atalJIJpW0nRJtxemhdeQ/MydYJmzlvGsB LxpjxKjk1veQQqQ1XfO4qrUxjVcwkVpVZsUk+ruwG0wkzrfGxG5dpMgM12g1kT7yF0jo bztlncEi3L0X4CWeHN6ZenhqmP2RU0iFZ4TM1uMhfdtIQg8+Jpn7/E+fZ6Gvw4AqzCR6 YY4+QFC+Y/U4MCaUvpiMPoGXHyjvWg8NSM1W72KZyy8UMzKBFjf3BabvozC0SMUgl02/ nw+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rdoJqb1IBk9SgvYZUNMM+KSW8M0ZuxcTTKuiIiIMCBs=; b=Q2j0ogNGatzT1ZoYDuMaVBRH/NBK1McPDK6lTga02Ip2nOtBWfBpdA3YnC9lz01nqM 55rHYRFJ4kmYvpnFGdqPAGl6hGCjTkNVqzAeUzbs81BJjQEJBI8JDe/lccoB9vvnqmFc PDz2SeKcxo05RAdH8THjbCEV117cGNdb6uvSvLOM7h48LyTKzs44UwaalWKniPnM0cl6 k0QVpxqASbQvqkusj0iWCQaE5lWMtJ9zs1FuaDT4xdlwIMOmmoXJ/PlD+5VQUHawNhV6 0FFpLyxAD2NOy6FqSp0+ZV2r0bvZanfUYH9xkq0J1/oAR4MDpSyl+0vDaPbQPZ8thjf6 sKOA== X-Gm-Message-State: AOAM533mE5VRdV4U38R1AM7RPTQQ6X+pw/jxNgLSnLA0QxHjzktXA1GP cyD4z2lcb0jg/Dyhk2xiygrqtBzyX66YFw== X-Google-Smtp-Source: ABdhPJwXHdqedXKFL1D/wKc3KhFF0h4/83SSDqa5vR2yunPozcJaGcVLxE1urNGeSGLZIxeZAUyl8w== X-Received: by 2002:a0c:90e7:: with SMTP id p94mr11208478qvp.219.1590079465710; Thu, 21 May 2020 09:44:25 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:25 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 53/74] s390x: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:50 -0400 Message-Id: <20200521164011.638-54-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf2d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, David Hildenbrand , richard.henderson@linaro.org, Christian Borntraeger , qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Christian Borntraeger Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/intc/s390_flic.c | 2 +- target/s390x/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index a1c6b8a6f6..40b1a5b940 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -191,7 +191,7 @@ static void qemu_s390_flic_notify(uint32_t type) CPU_FOREACH(cs) { S390CPU *cpu = S390_CPU(cs); - cs->interrupt_request |= CPU_INTERRUPT_HARD; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_HARD); /* ignore CPUs that are not sleeping */ if (s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING && diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 4b1961694e..490644e12b 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -65,7 +65,7 @@ static bool s390_cpu_has_work(CPUState *cs) return false; } - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD)) { return false; } From patchwork Thu May 21 16:39:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E75C14E3 for ; Thu, 21 May 2020 17:11:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 055DA20759 for ; Thu, 21 May 2020 17:11:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xo2yYsbX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 055DA20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbojL-0002VF-4r for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:11:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJ2-0004Ie-O1 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:29 -0400 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]:38477) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ1-0006hF-WA for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:28 -0400 Received: by mail-qv1-xf44.google.com with SMTP id fb16so3366126qvb.5 for ; Thu, 21 May 2020 09:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E/tQbITHc97dgORFyK3tE34tNsNJB0LGdPZMzeOAZ2A=; b=xo2yYsbXMAYWcZxDsNeGRW8GPlpUHMnVUMqE+npgdAvvBTMJ4zLTNBUeognUwKOa9/ v/HIbnYn5Bn6AwN050T3TEZhj48pBqOUh3gcAwQFluN6qt4dTnyOSO841BOvSNk7odn/ WfpcB+Z8qVUKrsHjOE6eWLk6KsIQZiu0RGKcyrOYCgUxweZRZwc9VAG0/NnmbQxuTinY cElnvomWcGhm1jbv720+BxZRNKMET/FATNZhYODBDYUQsYjeQTRY48Vo4oRs1OCRCwnS pLD01f4u3P2LQwO3NPs9Y5Ys8PurP8bM+fHCJGCdDYfBKjfthe7+Oagmmlez8K+HuYAU 5RJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E/tQbITHc97dgORFyK3tE34tNsNJB0LGdPZMzeOAZ2A=; b=ddqNINA2qshbT3rZAVP/57jzw7iTynsupgZzRgn6oP4X61+f1AQG0Qmym6a0ysTOaN E13pZj9KKAzPpuPG9js2nJVVlzxUhk0iaxTntbjmBjR46d4xHVhiBCV22qRFQopP0CBC KcbCMnr6EiEj8We2EKhfYUXcFA1kgQnaTMTxc5TzDZbcrF9BU0Soe1bGDfb5pnFSyP/H 7tV0DlkWmX8jKW3paalf5yk+YXb3KJ9i10Vx+wY1rLP1OVEMGMAtzTOyn1AOWdDalgFZ 9IkiwyqokbQaZlr6iD03URhOPrREVpZjm4gFE1AITABou4MFLWHDVWosBGp2KY2LwFPv p8og== X-Gm-Message-State: AOAM5311A7NdmX0/eQKpygCeOQuSF/L+oie/B6Ls1z2zOr2okocK/iD6 eKdopbwKFkIMbwacbRD7OANe5s6Dd8gc3w== X-Google-Smtp-Source: ABdhPJwto4RstkhwO2dZaQUBcN7/lRGVXAsx4K+KaMtCaTG01RIU/7xnCwC6LeP+nX387ko7L9yD4A== X-Received: by 2002:a0c:b2c5:: with SMTP id d5mr10934829qvf.36.1590079466923; Thu, 21 May 2020 09:44:26 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:26 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 54/74] alpha: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:51 -0400 Message-Id: <20200521164011.638-55-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f44; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf44.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/alpha/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index b3fd6643e8..09677c6c44 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -42,10 +42,10 @@ static bool alpha_cpu_has_work(CPUState *cs) assume that if a CPU really wants to stay asleep, it will mask interrupts at the chipset level, which will prevent these bits from being set in the first place. */ - return cs->interrupt_request & (CPU_INTERRUPT_HARD - | CPU_INTERRUPT_TIMER - | CPU_INTERRUPT_SMP - | CPU_INTERRUPT_MCHK); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD + | CPU_INTERRUPT_TIMER + | CPU_INTERRUPT_SMP + | CPU_INTERRUPT_MCHK); } static void alpha_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Thu May 21 16:39:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29C2814E3 for ; Thu, 21 May 2020 17:10:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0144220829 for ; Thu, 21 May 2020 17:10:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SZCbqRKn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0144220829 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:56982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbohw-0007yb-4D for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:10:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJ4-0004Kf-EO for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:30 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:41254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ3-0006hP-Kg for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:30 -0400 Received: by mail-qk1-x72e.google.com with SMTP id n11so2380437qkn.8 for ; Thu, 21 May 2020 09:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TvYnAkjAppdRPxTCTiIdH7gnvDHcZXb4SiVpZ+2G8IY=; b=SZCbqRKnD6kX2rklKe58WjtOJUKa76jLfuo0z0tviYcxZkVDslo0k7VXSOPiRp6/lS Fx1wFNgogr6K1FDXtyargnSC2hM+KJ/dRp2Tv4BoJUF2C76hsl2+JWsajjz/DANcOwdz wSUslRyV+NfonoiDOs2888qJ5Gqu6AGRb4dyPO3B05gO86Nso093Yg/LHdoRZnXhzF2Z QY6karxwYVutqUJ7sWmP6Vhuru6bREsJxnaEJVnr6WPWT1Ai2uM8fPV+s2r30DvbiqnV OEZfcN9QOdH6nhfHdekjn7SCOxO6CkLHyFuQjZaKdsOa5GDHZFHHEVZNKtNmUXGSmLA/ p5sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TvYnAkjAppdRPxTCTiIdH7gnvDHcZXb4SiVpZ+2G8IY=; b=rFkT60pBXXoSKgsw/nJpOYXbQnNNyNzrMYOvLe4T5ytiS6mYa25ltuKOQfW9fWp/5j nNt1e7DzgsNx0RCL83i11PXkJR6wxz2JtgTC8+9UdJb8nc4JbNdv9AuhvyvZOS5zRQaj MKqKbiew4LBnfi4G7kyBUhwj3gi64uprZrJAJ+Pi2cso6JcyQ5rkhtQ3reKcJdHt0U7R 7CVsmIxlhx3pUwwNhZ836q9sSVJE27OPMl0qHTJNBggx1U3ycUcKhkN5Tz2WBm2fTTic 9KfAnKRS/iHxHfQyum8lShP7WzW7H80lqXsW4/J9JGgqpE9mR/NDuNUwZCHWu1vcb9lD 7uOA== X-Gm-Message-State: AOAM533igwHPB8RR09uxfE//EHvC8U435LmvCVknABvRk/9BpBhgpBzc 2Zk7PfYymt2kNzaP2Jbs0lIeB32GgjX7Jg== X-Google-Smtp-Source: ABdhPJzTqVkDF+TGfwNvb8OX8JY4NnECGsH7Gf7K5rpeHojDhksTuYShrgNosEBooR9WBT/hRN3zSA== X-Received: by 2002:a37:a1c7:: with SMTP id k190mr10996168qke.166.1590079468173; Thu, 21 May 2020 09:44:28 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:27 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 55/74] moxie: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:52 -0400 Message-Id: <20200521164011.638-56-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x72e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Anthony Green , richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Anthony Green Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/moxie/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index 6e0443ccb7..f823eb234d 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -32,7 +32,7 @@ static void moxie_cpu_set_pc(CPUState *cs, vaddr value) static bool moxie_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & CPU_INTERRUPT_HARD; + return cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD; } static void moxie_cpu_reset(DeviceState *dev) From patchwork Thu May 21 16:39:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3618A739 for ; Thu, 21 May 2020 17:12:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CC9720759 for ; Thu, 21 May 2020 17:12:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DAhu+KMm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CC9720759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:37374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbojj-0003QP-8Q for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:12:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJ6-0004L8-GB for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:32 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:40821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ5-0006hd-FA for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:32 -0400 Received: by mail-qk1-x741.google.com with SMTP id g185so7847863qke.7 for ; Thu, 21 May 2020 09:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cWfP+0MUzrrNImWYZpz2KO/NSgj5qKMFSKUqs77s2xU=; b=DAhu+KMmtFGINUOHDZ4Q4aM3giQponNsqp92LFUNsEYUuNFf9gOFBt/bz07NCt6YW/ ++Qx/BgVOiQ/lqFc69hWm+EIOvTLO6+IFspteIoJR0OCROpruA1x8l1qAY19hJA6aY+b dEPTYRWOcXc1C3kCLZEbv45/vHzjC/DO5vIU+uRZeEVZsj/xyOIcbezLbwfsOCCHQDBn HscOo0j7SNsaQwg5nrEqagLHhTLdVmZLBSTPcIgHEbREvU9mYeM87qf4TnjmGpQdYmLn 2T3sEuzAhX/+SlZ/SGgblnWO0YdzufuSplf4AJ5bs/CEbMVFZf1rzcqHpAjaQG6sAdw1 Aukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cWfP+0MUzrrNImWYZpz2KO/NSgj5qKMFSKUqs77s2xU=; b=qK44mAZmmT9fa0tAfzpTJq7tV1x0bfeZG5bOVoae2DCho99/g6FZ6eNNQVU4tEkJOr rh+Wjei4jw+pNyW812GvWtEUhaTJQHapIQobNYttb9fAb0WWWP5uEUsWodeRr4nGGXI8 qvHBcZSow7dWaC0GsPa8U6zrMS5jMAsj59LvF7iS/oRJB1X5+Sbcf2YK/QRVGN7wEGO5 6TRc/6ntq9ALJx3O4KZ5pBCcJqIF1rtCkOb2jNPQ3DCna+zJ/PmTInoYkguq4qoAjTOX qejrXlnBqP7xrGxEI4XS8vcc3L0Olz8wVmxsUdvMa+yg9HohdiJe1DnDorXen6VnGnIn 6jcg== X-Gm-Message-State: AOAM53089VQzdrBctFISjoRDA7a6gakVuxZihUIrmxCwSRw9zL0cg25H ucdGNfVsjWnFmRdoD9cOVTPf4Qz0cDWuyQ== X-Google-Smtp-Source: ABdhPJzlQUpsoiL3MmVIR2NRHmaDBT2W71HWdond+YZy0Nm0+xGd6FV/8Z8c4PD3YheznV8IVdFvBA== X-Received: by 2002:a05:620a:634:: with SMTP id 20mr10172139qkv.15.1590079470076; Thu, 21 May 2020 09:44:30 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:28 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 56/74] sparc: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:53 -0400 Message-Id: <20200521164011.638-57-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/sparc64/sparc64.c | 4 ++-- target/sparc/cpu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c index fe9c678459..191ebfbb93 100644 --- a/hw/sparc64/sparc64.c +++ b/hw/sparc64/sparc64.c @@ -57,7 +57,7 @@ void cpu_check_irqs(CPUSPARCState *env) /* The bit corresponding to psrpil is (1<< psrpil), the next bit is (2 << psrpil). */ if (pil < (2 << env->psrpil)) { - if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_reset_irq(env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); @@ -88,7 +88,7 @@ void cpu_check_irqs(CPUSPARCState *env) break; } } - } else if (cs->interrupt_request & CPU_INTERRUPT_HARD) { + } else if (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) { trace_sparc64_cpu_check_irqs_disabled(pil, env->pil_in, env->softint, env->interrupt_index); env->interrupt_index = 0; diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 3f05aba9d6..cef25238a5 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -704,7 +704,7 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; - return (cs->interrupt_request & CPU_INTERRUPT_HARD) && + return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } From patchwork Thu May 21 16:39:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563609 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 246EE739 for ; Thu, 21 May 2020 17:13:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DED2F20759 for ; Thu, 21 May 2020 17:13:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AYshm8sm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DED2F20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbolP-0007D4-3M for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJ8-0004LX-E4 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:34 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:41364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ6-0006iM-Bz for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:34 -0400 Received: by mail-qv1-xf43.google.com with SMTP id v15so3358620qvr.8 for ; Thu, 21 May 2020 09:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1b+dD7RxLqaUPVVNgXTFGKKstOqQ+qP/ZFHAKJHyCiE=; b=AYshm8smL28Oeb1t6aqqiZYVQrMvEjRj6sVGSTq6eTH3Ez6KB0obAZIVm/dJrRO77O Z7cgyObMfKdmGt2IgDNnfLnGh6GYZWJHEyuxIqCIBoMYp2LhrUuDBksisUygP0jFIyWf btH/LCjZ8sDGZ+m6miMpOnekuCJFLAcOOYpTxNxCsH9guXwaENK24qiNbJMQXtItblRF qgmWllJH5K88LHXcer/LJWjgs7HnlyILmJpCZBudyqfXkCZSp1Ok+UMQM0fSgV7fwChx D2oumm7Z72Qnv+/tknijNfTXswVssZWw6R6fvCQxui7CKshDxbONJhboyavuAbyFFoyA VVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1b+dD7RxLqaUPVVNgXTFGKKstOqQ+qP/ZFHAKJHyCiE=; b=a5EfG+uO+qHKfVCHOie9v4l6duSWCB7rkns6Lu88cKHq/yJ4MJFhRuLDnJxq91R/tC EfZm97nFmtImWyEOIMcSYTepyxqr27L4zOsezJ2LUnZifMQKbjTPEg/S8gGyXMGsONya 6rljbqcf5EbAJDbr9wHNXTt++e1xnMb2gsORKezpf2paXogj14SNW7DnTKFZBUvlUwzY ZFApwdrntMiAau6WkqTkpcwQv1IsUr3baoDEOtuxPDk3gDyp6aHRubvbPtqitx1AlC9T Coeoad2wUMz+bVTmvY19PVQ6RRPou+Tk1Sb7hzKkfS9OQ12zYV/i2TYgaYD8TYLb3UUV 3Xtg== X-Gm-Message-State: AOAM531Mh5ywzKaHnFECZ3s/Dj0y59YzIpncFRHnf5BR3hq8k6KhNXJQ FMAqguGFfSGmNEuEw0DBdu1kW30TNVrCvQ== X-Google-Smtp-Source: ABdhPJwEX2e/2ePxWwf/PCCM2LwHHOfFyeBnlTON+yahqZJdmE2z/aCjk44QX4Bo6740BOgFeEjaSA== X-Received: by 2002:ad4:4b01:: with SMTP id r1mr10604609qvw.38.1590079471367; Thu, 21 May 2020 09:44:31 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:30 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 57/74] openrisc: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:54 -0400 Message-Id: <20200521164011.638-58-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f43; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf43.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, Stafford Horne , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Stafford Horne Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/openrisc/cputimer.c | 2 +- target/openrisc/cpu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/openrisc/cputimer.c b/hw/openrisc/cputimer.c index 93268815d8..9475b77d0a 100644 --- a/hw/openrisc/cputimer.c +++ b/hw/openrisc/cputimer.c @@ -102,7 +102,7 @@ static void openrisc_timer_cb(void *opaque) CPUState *cs = CPU(cpu); cpu->env.ttmr |= TTMR_IP; - cs->interrupt_request |= CPU_INTERRUPT_TIMER; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_TIMER); } switch (cpu->env.ttmr & TTMR_M) { diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 5528c0918f..fd2da39124 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -32,8 +32,8 @@ static void openrisc_cpu_set_pc(CPUState *cs, vaddr value) static bool openrisc_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | - CPU_INTERRUPT_TIMER); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | + CPU_INTERRUPT_TIMER); } static void openrisc_disas_set_info(CPUState *cpu, disassemble_info *info) From patchwork Thu May 21 16:39:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBE1414E3 for ; Thu, 21 May 2020 17:18:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B160620759 for ; Thu, 21 May 2020 17:18:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MF8FyNqJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B160620759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbopb-0007b1-Td for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:18:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJA-0004Ns-EJ for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:37 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:45008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ8-0006iT-4R for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:36 -0400 Received: by mail-qk1-x743.google.com with SMTP id b6so7814837qkh.11 for ; Thu, 21 May 2020 09:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NQ/BbjaNmbkm5KQOy7Vv4O17R/NYOg7qZF+hAsl6NgU=; b=MF8FyNqJb/RGFP/09QrjTIyVf34prruwqZ1AceBOSuOm48II948vnFxI3xzdmRnPzi DZ7vpfin3Nkm/cEGHA5V00jSHaM1SbzLyUgeh/y4kELaczI5vmcNnFTvDGPblHmyWgZM 2XVUUDlCEmzs6o5EB91D8YsjrT5tR2ijt0fVlWrDKNdTGEQMYZnpIS4ENx3zW5wZ8oB4 zyrLZQRiBpOpJgRxh7kXQUgR81wTWAKlVYsTyGIcKbMZOtnZOBQ40kNvemJZk+zNfrMU UMioW8CgE4Q0pNRWwSOd96K4NEybvbsefSuVVpS8TYGQpGtLYrtdMs9oizX/pYXMdHkv c0gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NQ/BbjaNmbkm5KQOy7Vv4O17R/NYOg7qZF+hAsl6NgU=; b=amixXc/iZmNttRfyb+aLIBYCS6Bte22NvMY3vQr9+4uJWEnYTvG6+NdWROzvAeqW7V FXFX3q/up+jgE1eKNxDxjuDul5gCtz88f9HUaQM/fLZp3FFow1DQZoQ7jQa67djwHXip YUZOfidS/Ow+lhcM8JGWHI56K6f55z8Iw9mJpaE3wxbiRz4379KLCSzLI+TPzCfP4bCK rfQMWOi59ghwgI63BGDHN+yNsMaMk8jmhQSINK9UmeO0DXD0aOW/KZsSNbXf6osohWTC 5JBZ0MYLd9n/DUbBQSooubr5PQpnGyQGIDfLjTuLcghDefV9UPAdoOgRMpspRBnGC8y0 cU8A== X-Gm-Message-State: AOAM531W9e6UIWOsMuSHpW+G/FkXrLDHfprZA40NW4IGK9LHUhFVM0iM 2jgtdXBg6D+N9iARLHPgpHzS999eRaNBVA== X-Google-Smtp-Source: ABdhPJzeBkaDp+FqKVcdVk/W/8+ZVXtC1PPJ04dX03wXjgBff+z9ucLK+bNXteXW28K7hFHCFRtVSw== X-Received: by 2002:a05:620a:204e:: with SMTP id d14mr9451256qka.13.1590079472636; Thu, 21 May 2020 09:44:32 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:32 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 58/74] unicore32: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:55 -0400 Message-Id: <20200521164011.638-59-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, Guan Xuetao , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: Guan Xuetao Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/unicore32/cpu.c | 2 +- target/unicore32/softmmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index b27fb9689f..06bf4b4b63 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -27,7 +27,7 @@ static void uc32_cpu_set_pc(CPUState *cs, vaddr value) static bool uc32_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB); } diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index cbdaa500b7..9660bd2a27 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -117,7 +117,7 @@ void uc32_cpu_do_interrupt(CPUState *cs) /* The PC already points to the proper instruction. */ env->regs[30] = env->regs[31]; env->regs[31] = addr; - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; + cpu_interrupt_request_or(cs, CPU_INTERRUPT_EXITTB); } static int get_phys_addr_ucv2(CPUUniCore32State *env, uint32_t address, From patchwork Thu May 21 16:39:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43BFD913 for ; Thu, 21 May 2020 17:03:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BE0920829 for ; Thu, 21 May 2020 17:03:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WpGaaZar" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BE0920829 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbobo-0008Iv-Aq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:03:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJC-0004PH-Fk for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:38 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:40457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJ8-0006id-UZ for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:38 -0400 Received: by mail-qv1-xf41.google.com with SMTP id l3so3360505qvo.7 for ; Thu, 21 May 2020 09:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DUz6IjE+KDBm1v/EkLkpXtyZ6YOnw3SSFHn8L1s2bt0=; b=WpGaaZarln1buUQsPXvXV7MU1b2/sArJI8g/dPlZ2GY3Nlu3exrW6lezhy2Lp3rKb3 uZ6a25KZprT5fFh9P7YuWIL7gQlKdva7U7qzbuksba8OByJMhrAEoGD2nYQ+ezJZElsN 78y6NUVTBTSP04t9ik7Uh1hl+uYXm9nxyIiFIYS96BUbKav/Z2Y/f3HrdcxsLb/HZjgY JA8QT/Wy/IqQrFk6ByAa5yyZiqCBlFAY8Fpfd06Z9ZGGI+kwkbtQvTin8g0zAMASt6K3 sK8oywFXPH9bYkv4q9ZEMJIf5sn+yOvuJdFBVdjzAq7WfjCxCSToYih9MJyh8TsFAAd7 KNhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DUz6IjE+KDBm1v/EkLkpXtyZ6YOnw3SSFHn8L1s2bt0=; b=aAgXV5ULeut5Nhgf13rw0700t5bvydMlJ2sRMOK516LFJ1o3LerV6o+p2UgsKpAC9j Z7MWC803b7AhLMhPUQvfCi3WqzknNp+k/WJb6Kx6BYVYfWoahtAvWhqWvFDl+tedghdE KHBich0bgkpZF/0Rc/UvuQKr1EPJSQhwFp4vHb3EiNSw3au+otXX6XtGo0mIpU3LQAHW unRaBn/FELKLqiXpDy+apeeAoV66qAsVqJVYPeFZ5EXgdvUIRYNHXwJMpDmjOJ7tjC3o AtEKpn32O1i2tngSTMyFvg27M5StILMCR2CMS5+vUzvxXHeI7hQhv8B0YLUTYUiLQ/lL ruUA== X-Gm-Message-State: AOAM531fvdiMprVc22U60RjQ1pTmp07RHHuoX89zKofrG1BhbUi1uHNM 5R2G9vjLz/Cfb3JO6YYB1WaJMtsaRJRJRg== X-Google-Smtp-Source: ABdhPJxs5z/Sr+EzwlmkDN9oHJhMg+boja1xDSBUrrfurptRHOEUYYGQ/6vfUmT6K9RihcgGyiwG0Q== X-Received: by 2002:a0c:b259:: with SMTP id k25mr3837154qve.111.1590079473900; Thu, 21 May 2020 09:44:33 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:33 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 59/74] microblaze: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:56 -0400 Message-Id: <20200521164011.638-60-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=robert.foley@linaro.org; helo=mail-qv1-xf41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, "Edgar E. Iglesias" , alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Cc: "Edgar E. Iglesias" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley Reviewed-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 51e5c85b10..ce70f7d281 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -84,7 +84,7 @@ static void mb_cpu_set_pc(CPUState *cs, vaddr value) static bool mb_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); + return cpu_interrupt_request(cs) & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI); } #ifndef CONFIG_USER_ONLY From patchwork Thu May 21 16:39:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 819AD1392 for ; Thu, 21 May 2020 17:05:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 585E920759 for ; Thu, 21 May 2020 17:05:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wbkhvCZL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 585E920759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:36260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbodE-0004nP-DD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:05:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJF-0004Ud-Ck for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:41 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:40824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJB-0006im-Pz for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:40 -0400 Received: by mail-qk1-x744.google.com with SMTP id g185so7848143qke.7 for ; Thu, 21 May 2020 09:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sh7ma3RXOutsPCVp5vgyQfkJaobdB9KSp9Dt7UwZtpM=; b=wbkhvCZLW0BSpV2AtX9VeMZE0g8qqRM09Exw85cXX+CGsV8LO9g8zyEqLosyrb5O6l 4VxFF4FefEF6VTqjX2s7saivoJk0R5TSSCIpjsMkIDyRb/PVvHlvGY79msMzyGpzy2AJ VNJ//fKzhVGsZyo10teOYQt2lLtGTJnhxihKdXmj70Wj1oQjC2l3NSwJqCC+QjuceXE1 8eJPv7TdaTLpzq/Q8h+v+d9VVwkgdYcH+iiOq5+oaSCR2Kmw2HMlNPSCD32p5LpaMWZW VqeCXfYwDTbl1MVCfIcUqqH4rJZhiU3Qg7qHRWCrZrzrq6Xshh9PRSsSv1UJ8NeySu0i PKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sh7ma3RXOutsPCVp5vgyQfkJaobdB9KSp9Dt7UwZtpM=; b=LyTReodp0ORcT3qfF9NuMN9c77wrBaHeRD2diM9HKVsV7xJRjOjLUC8zCIL5UtqwWq KrgYG17Puh/h42XbgTppwX7ATTZBeQIopmRQyf+Ig0a6x0tN/QFzAmba3HyLECEZvnck S3WTElz53xMcJ76NPEtWr7urSeXehj3+lWAS6MaANrzoe3LqNl3HQo8GmWOgte1YrtW9 fJ08ghejVgcMuf+UVCcAG7kIljLx4zKLBG+BYhIvlew8UQI23DVTxCuGwIjLiSMxEwdb dQUk+EeryXVL0r3N6pho9AdigOOpar8oxGU8/AasbIbkeZkcnhT1KW45zi431fDPbuyD DWrg== X-Gm-Message-State: AOAM531/e3qx+4Wk3ST4YpDbNiJkrE4H9zXxHaiHALQzTchIzLt5Z5GW Ansv+4SQQztaOS6+1aEolOBCC9MSp4GIaA== X-Google-Smtp-Source: ABdhPJzHs0MUtY/2A9UzgOPzdfE2sMyX7tgZ3GCQLUjvZjXUaIQAACSgVs+COH+9AhOe7/nf1ciyyg== X-Received: by 2002:a37:6cd:: with SMTP id 196mr1800690qkg.393.1590079475064; Thu, 21 May 2020 09:44:35 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:34 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 60/74] accel/tcg: convert to cpu_interrupt_request Date: Thu, 21 May 2020 12:39:57 -0400 Message-Id: <20200521164011.638-61-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 15 ++++++++------- accel/tcg/tcg-all.c | 12 +++++++++--- accel/tcg/translate-all.c | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 099dd83ee0..b549a37847 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -431,7 +431,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu) if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) - if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu = X86_CPU(cpu); @@ -544,16 +544,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, */ atomic_mb_set(&cpu_neg(cpu)->icount_decr.u16.high, 0); - if (unlikely(atomic_read(&cpu->interrupt_request))) { + if (unlikely(cpu_interrupt_request(cpu))) { int interrupt_request; + qemu_mutex_lock_iothread(); - interrupt_request = cpu->interrupt_request; + interrupt_request = cpu_interrupt_request(cpu); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { - cpu->interrupt_request &= ~CPU_INTERRUPT_DEBUG; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index = EXCP_DEBUG; qemu_mutex_unlock_iothread(); return true; @@ -562,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* Do nothing */ } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); - cpu->interrupt_request &= ~CPU_INTERRUPT_HALT; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu_halted_set(cpu, 1); cpu->exception_index = EXCP_HLT; qemu_mutex_unlock_iothread(); @@ -599,10 +600,10 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } /* The target hook may have updated the 'cpu->interrupt_request'; * reload the 'interrupt_request' value */ - interrupt_request = cpu->interrupt_request; + interrupt_request = cpu_interrupt_request(cpu); } if (interrupt_request & CPU_INTERRUPT_EXITTB) { - cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB); /* ensure that no TB jump will be modified as the program flow was changed */ *last_tb = NULL; diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 3b4fda5640..5eda24d87b 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -52,10 +52,16 @@ typedef struct TCGState { static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; - g_assert(qemu_mutex_iothread_locked()); - old_mask = cpu->interrupt_request; - cpu->interrupt_request |= mask; + if (!cpu_mutex_locked(cpu)) { + cpu_mutex_lock(cpu); + old_mask = cpu_interrupt_request(cpu); + cpu_interrupt_request_or(cpu, mask); + cpu_mutex_unlock(cpu); + } else { + old_mask = cpu_interrupt_request(cpu); + cpu_interrupt_request_or(cpu, mask); + } /* * If called from iothread context, wake the target cpu in diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 42ce1dfcff..af8ecf3380 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2392,7 +2392,7 @@ void dump_opcount_info(void) void cpu_interrupt(CPUState *cpu, int mask) { g_assert(qemu_mutex_iothread_locked()); - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); atomic_set(&cpu_neg(cpu)->icount_decr.u16.high, -1); } From patchwork Thu May 21 16:39:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563619 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35438912 for ; Thu, 21 May 2020 17:16:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C73820759 for ; Thu, 21 May 2020 17:16:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hNvaKt/c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C73820759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbooA-0003z8-83 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:16:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJD-0004Qu-4l for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:39 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:41135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJC-0006iw-3C for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:38 -0400 Received: by mail-qk1-x744.google.com with SMTP id n11so2380952qkn.8 for ; Thu, 21 May 2020 09:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5ikNoVs9W43MQHNtBQQlhNjgAh1VrOkQ69KYUdVCDpg=; b=hNvaKt/cGY4AMEGn8KNxL/Mha+loy3VFykuKGtc3go4qnetkx+mUcaxqYPVsTxmF2Z 0JKVAhnSiWWq2dNkLROUxLIvUAJnvj/oIJUDq+2ODlflOFYYxbp6HAzKFOxc54BLWUA3 HU0vZS1l3Y1WgRqaRBsFrWlYr30EStf3xFz1xiNraaH3qhM5VEZaWvnXmFVakAh8exui Z0XMzlv+DCcOW4A9+lyDMHpuedZC3y5BPnk4SNU12w52WuquAfE7LP/0I8plkCqzOTI8 kEezx+SKu2yu1VjUFvSw4CMwMB3AOSSTNureLFGjWizLmPAPoYO9LTylePy2Jt9NNR93 zsSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5ikNoVs9W43MQHNtBQQlhNjgAh1VrOkQ69KYUdVCDpg=; b=bQwbdE8vNJJUCZg2NqGCcv1zRqPOoE7y8roagNiXF0+tY/b+sjdCNBXv93Gin7VmQo ubAiBzszD3EGpp73R8+L6lhQRf7SZz56Pv5FHdc1b71riW8ZsR2MvG1wbtwZQ8z/eR5y AGbjpCkX7/SIXv0y0mr71da0hTUpdL/LOoNJQfMGR+L8eY2QSpWxbob7M0wD1K0j4Eo1 oiKA8aUDTZyKu2TqSt8RuPXrDxQk8e4QfyvcuiYczmiLp2vpSyt36FXgEzycEAfHlbxs q2YfG7OjcvgrtKGKebyStshnIZyUMCUbMKYfnO/uFmNE/YJANA43gYK4PBnrtTy+irbB qtDA== X-Gm-Message-State: AOAM532mmkwhnDD5MQSHNe2S4XXsMCsN97+zkNpR4qbvCW+OsqaVJLXV yDUNsVCXKF51FB/VdS+08jpyRXERWVw//g== X-Google-Smtp-Source: ABdhPJyNV9i1GfxxH6cjnTXP8fhw3zeC9wecTSvuRzS+TaCtETcm7Cltxr62+oFXLHNfnnS/5n09Ag== X-Received: by 2002:a37:9e8a:: with SMTP id h132mr10497691qke.48.1590079476494; Thu, 21 May 2020 09:44:36 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:35 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 61/74] cpu: convert to interrupt_request Date: Thu, 21 May 2020 12:39:58 -0400 Message-Id: <20200521164011.638-62-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::744; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x744.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This finishes the conversion to interrupt_request. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- hw/core/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index be9efbeaf4..ee20f8e0ad 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -271,7 +271,7 @@ static void cpu_common_reset(DeviceState *dev) log_cpu_state(cpu, cc->reset_dump_flags); } - cpu->interrupt_request = 0; + cpu_interrupt_request_set(cpu, 0); cpu_halted_set(cpu, 0); cpu->mem_io_pc = 0; cpu->icount_extra = 0; @@ -411,7 +411,7 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len) static void generic_handle_interrupt(CPUState *cpu, int mask) { - cpu->interrupt_request |= mask; + cpu_interrupt_request_or(cpu, mask); if (!qemu_cpu_is_self(cpu)) { qemu_cpu_kick(cpu); From patchwork Thu May 21 16:39:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563625 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8E37159A for ; Thu, 21 May 2020 17:19:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A04442083E for ; Thu, 21 May 2020 17:19:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Jsk7EHgC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A04442083E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbor0-0002iP-Qz for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:19:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJD-0004Su-Px for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:39 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:34330) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJC-0006j4-R6 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:39 -0400 Received: by mail-qk1-x741.google.com with SMTP id 190so7917992qki.1 for ; Thu, 21 May 2020 09:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DROR1j7T4nvT3Kb9/UW2YDjxvm1xSx4iyEWd3x/xCYw=; b=Jsk7EHgCy0F5z0OqfBb9qvVNN1MWfkVXUS5hylU8y/EYU03wvdaRFqRXrbzaapZeq1 kW++2lZfsFYNJ0h2NR0XFTWVobJS3D01QoIsvIDMydnamlic1uhsCZpOEEPa6nSa3Dn3 9zjBSi1O9hOg422U4dl9OYNbZ28soZWNWdtSzgVLvIUZiHKhZgdCt/9cGXert1KBqj0S e8qmVFkOyFoe8RpdrlePkU2jq6GA1YeMy8FZ3/3R19xJy6Tw399OpkVLuwH5Uqv+f11Q PPN/Zgj7OOpGvnokyqjIPfk7UCddI3jA+OSqco6pwAgJP89wOME7jqZ2j2ue998aJtBQ v5Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DROR1j7T4nvT3Kb9/UW2YDjxvm1xSx4iyEWd3x/xCYw=; b=XMWHSxuhV7Wfi3yv+90RbgMcBaD/4MqqAMYPIe1yyRWEjPVtztWuyeH/YKuyinKgCn 3uotd1nM5nWsVo69zBd6ewXUAKbzTiYM1f51HsDnSis6h6MnTxJRq7+GzBqdx/QGgpI7 hy+s5NPMGtTAEjDs/n2Y6mS7pPIJ+AZWHuym3xnfpAVUdHABMR+WOmbC3J8uo/uOQB6l KSIB+p4J4fkUDjKvyN6NoI6bFDDJ8+JnL8vUwIb1veVF16qGgm1h3+Pw9X+PH/pwvsQR GEu3cPpMpJ+mQHWyrzHEuVxcr6lPWv+ZZhhFeGbkNi1yzINKi4GLm2a0uh97ioAb0Bal znOQ== X-Gm-Message-State: AOAM531UaonHtgDZ4RpQza/0Wb4RwDtoZFb5s7PwizyRZME+gLyNLuf/ hfwrIpI5cRsWg6sOx0+UzCtafF0ZFxdadA== X-Google-Smtp-Source: ABdhPJzTSei10pjMgAv459Ojig7dcZWcbVkLQL+4ciRUS3g86QEZdDSCSCW6/UKMdUpELJHx4Si0Sg== X-Received: by 2002:a05:620a:14ac:: with SMTP id x12mr10392691qkj.262.1590079477697; Thu, 21 May 2020 09:44:37 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:37 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 62/74] cpu: call .cpu_has_work with the CPU lock held Date: Thu, 21 May 2020 12:39:59 -0400 Message-Id: <20200521164011.638-63-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- include/hw/core/cpu.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 6ed806db60..7bf7700630 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -80,7 +80,8 @@ struct TranslationBlock; * instantiatable CPU type. * @parse_features: Callback to parse command line arguments. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. - * @has_work: Callback for checking if there is work to do. + * @has_work: Callback for checking if there is work to do. Called with the + * CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unaligned_access: Callback for unaligned access handling, if * the target defines #TARGET_ALIGNED_ONLY. @@ -799,9 +800,16 @@ const char *parse_cpu_option(const char *cpu_option); static inline bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + bool ret; g_assert(cc->has_work); - return cc->has_work(cpu); + if (cpu_mutex_locked(cpu)) { + return cc->has_work(cpu); + } + cpu_mutex_lock(cpu); + ret = cc->has_work(cpu); + cpu_mutex_unlock(cpu); + return ret; } /** From patchwork Thu May 21 16:40:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563623 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F15E912 for ; Thu, 21 May 2020 17:18:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25BBE20759 for ; Thu, 21 May 2020 17:18:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U+GT93lC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25BBE20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:37504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbopm-00087W-A5 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:18:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJG-0004Vu-9A for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:42 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:34331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJF-0006ke-98 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:41 -0400 Received: by mail-qk1-x741.google.com with SMTP id 190so7918081qki.1 for ; Thu, 21 May 2020 09:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f6jTs4l1FUMMcryMnS/4lJD5Ni20LOW4nBzyszoy3L4=; b=U+GT93lCYq8RuQBsNpW0FvQNeYBg/ZDm0UBcKUlTv6NGzMx5QowNjosWOW4Hh6fFBR o5qDdlykIEaKgxcHDCZrh0HJ16sSegni6A1tRjV5ajlB8OSq/P9VYMlC97qb/fqIg3of S0nXOoxsvgybjD9x4aHyL8bpD+6ECZ+AiciwPI+wF3l4jMmaNOVjkZIKKXOMOCvo7pMC wD/EOQIucPF0VtHzaL9kiB1ZcSUCpn5DVo/M0XlXjCjoUXRSOay/HD30DSnsGFQmSGkv UsihxjAu/dVejODKWx423p61s7tP4sKGJCz6oVCbzwZ3QkmTiXLwaMlKsr/dPAdTR3lu uBwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f6jTs4l1FUMMcryMnS/4lJD5Ni20LOW4nBzyszoy3L4=; b=WBvvlwrGDB1Gx8EyMZzJkjDUmReYOXutqoCGeTSsUhU+HeOqsiPh5/rapK/2dnY+Si YQebIMUPPhF+7cqAUj3S8A5xmQ7oLWQUKnHqZoCZHHNp2rGtsiLZOMmgMSLBfndV9IAG /F+Z7kJPnuLgy1MWxPD00nx4O3KYYrWaVijlW8POLuYyy57tTBXPDHqkqjqnVWH9mFxn VXp/Etoerx9pRbgZ0g3dRKWtp7MvvwPegym5QpTg6J4SnFNPQG2aLkDgd7SmEdil37r/ C7Y+WwLQprlW5wFlMS6hyncVC1cKLeYMYZuGmTTomvuQmk8VUJGA+tENA2aWS2sHxnM6 puOA== X-Gm-Message-State: AOAM533NlcToEzmcSqsNOJ8dnl3GbfsBQOTbkUa3CzsMmiGKgQREb5fb +Npf5Ss+qhi8NOOKorv4oPR2EOs5d4J/NQ== X-Google-Smtp-Source: ABdhPJzs90Pwp95Q4YWsVV7Q0rqm4Bp7Xbmm0LmluS7V13wMY2eWTxpv/A7YYTYSJEJaQQV1CfDbRg== X-Received: by 2002:a05:620a:a83:: with SMTP id v3mr10997896qkg.84.1590079478970; Thu, 21 May 2020 09:44:38 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:38 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 63/74] cpu: introduce cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:00 -0400 Message-Id: <20200521164011.638-64-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::741; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x741.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" It will gain some users soon. Suggested-by: Paolo Bonzini Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- include/hw/core/cpu.h | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 7bf7700630..9766477e62 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -26,6 +26,7 @@ #include "exec/memattrs.h" #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" +#include "qemu/main-loop.h" #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" @@ -82,6 +83,8 @@ struct TranslationBlock; * @reset_dump_flags: #CPUDumpFlags to use for reset logging. * @has_work: Callback for checking if there is work to do. Called with the * CPU lock held. + * @has_work_with_iothread_lock: Callback for checking if there is work to do. + * Called with both the BQL and the CPU lock held. * @do_interrupt: Callback for interrupt handling. * @do_unaligned_access: Callback for unaligned access handling, if * the target defines #TARGET_ALIGNED_ONLY. @@ -167,6 +170,7 @@ typedef struct CPUClass { int reset_dump_flags; bool (*has_work)(CPUState *cpu); + bool (*has_work_with_iothread_lock)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); void (*do_unaligned_access)(CPUState *cpu, vaddr addr, MMUAccessType access_type, @@ -800,14 +804,41 @@ const char *parse_cpu_option(const char *cpu_option); static inline bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + bool has_cpu_lock = cpu_mutex_locked(cpu); + bool (*func)(CPUState *cpu); bool ret; + /* some targets require us to hold the BQL when checking for work */ + if (cc->has_work_with_iothread_lock) { + if (qemu_mutex_iothread_locked()) { + func = cc->has_work_with_iothread_lock; + goto call_func; + } + + if (has_cpu_lock) { + /* avoid deadlock by acquiring the locks in order */ + cpu_mutex_unlock(cpu); + } + qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); + + ret = cc->has_work_with_iothread_lock(cpu); + + qemu_mutex_unlock_iothread(); + if (!has_cpu_lock) { + cpu_mutex_unlock(cpu); + } + return ret; + } + g_assert(cc->has_work); - if (cpu_mutex_locked(cpu)) { - return cc->has_work(cpu); + func = cc->has_work; + call_func: + if (has_cpu_lock) { + return func(cpu); } cpu_mutex_lock(cpu); - ret = cc->has_work(cpu); + ret = func(cpu); cpu_mutex_unlock(cpu); return ret; } From patchwork Thu May 21 16:40:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1301D14E3 for ; Thu, 21 May 2020 17:07:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD7D520759 for ; Thu, 21 May 2020 17:07:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cKtTSVcT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD7D520759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbofA-0002GX-3E for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:07:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJH-0004YG-3G for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:43 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:43435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJF-0006l6-CD for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:42 -0400 Received: by mail-qk1-x742.google.com with SMTP id i14so7816886qka.10 for ; Thu, 21 May 2020 09:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VF7BD2whUFR8MWRbhBIqKLqcFA5T5WPcm/utxP5IxZE=; b=cKtTSVcTuHFg4AgrSgyFw+NjxSSeQxb4iUmg9alZt9c42owUxVIqYidjp6XfGiUdI5 h3/wEWpa8mFUoJrbDC2e2VK/E3vorawcAGDLnhCtANxr7OptRUtvGnXfYVRww7+OBHrU ycSufMA28vVlidWfKqP9PEfKp+WYuLf2n+H0w5DpQgzblvfy0fmm9jL2/EUB9kqo22ww vlb/Vuw4V1lXgkyDTv2IIHyNPlrF/0hnJCqk2RTpyIduaUJFN85b0eVaaVmDlLUuWAbn 8vDgWEDpF2Ol65IXhFbkLlwNj9MQISmqyvEENh3pP+8HhLUzU0IQPPN9X2wnhwDl+zYZ ZlLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VF7BD2whUFR8MWRbhBIqKLqcFA5T5WPcm/utxP5IxZE=; b=ad0QZ9HzFC5XUUS+NQd5DYwWkvGvkI/ERtYEdKBZJrgFr4esX35TXsMSWPHcDGzX/V KEIEGSJK3l+lhQnC5ywgBCKpiDRVRU1wp7EYxlYDccuuma/tE7c5ktX/Xqr4Cpd3hxAT LJAB2DvkdVSXyY3aEo+HkEkONyFwNtGh1kB3A5xfU9E+gCIh9/MruYnfoF+7Q2ZWwIap CxIDreav/Epqt+bVeBUC3WKWtDPKy9C7lp6jmizewZyHOnlxcRLCvxNEcyssfgp5MF7+ 9VAoyh/ovjNwWAkCbUEtkLqz/LbbRb+ETe9JAnWEQyO7H+zA9dsftbsJwKChDvfjjkwH SPwA== X-Gm-Message-State: AOAM533BuwWlS507EfihURL1hves0qwfXtKlfIrlwWIW5pBXPOGg0N/M b+ImxX6ymfYDOco/zHf5jGgULal4tp/0yA== X-Google-Smtp-Source: ABdhPJy/vBFlrhfn3FKIHC+iiqJkYk9iASmktnvneJiq6VgHPiGq/WU1W9kDqGd50MvSSe1vKSNfkA== X-Received: by 2002:a37:8d85:: with SMTP id p127mr9864351qkd.35.1590079480259; Thu, 21 May 2020 09:44:40 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:39 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 64/74] ppc: convert to cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:01 -0400 Message-Id: <20200521164011.638-65-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, qemu-ppc@nongnu.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: qemu-ppc@nongnu.org Reviewed-by: Richard Henderson Acked-by: David Gibson Signed-off-by: Emilio G. Cota [RF: Converted new code related to POWER10] Signed-off-by: Robert Foley --- target/ppc/translate_init.inc.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index e61ba39982..0aeddf3eef 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8539,6 +8539,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; @@ -8581,7 +8583,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 | @@ -8701,6 +8703,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; @@ -8751,7 +8755,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 | @@ -8901,6 +8905,8 @@ static bool cpu_has_work_POWER9(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; @@ -8968,7 +8974,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 | @@ -9117,6 +9123,7 @@ static bool cpu_has_work_POWER10(CPUState *cs) PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); if (cpu_halted(cs)) { uint64_t psscr = env->spr[SPR_PSSCR]; @@ -9185,7 +9192,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) PCR_COMPAT_2_06 | PCR_COMPAT_2_05; pcc->init_proc = init_proc_POWER10; pcc->check_pow = check_pow_nocheck; - cc->has_work = cpu_has_work_POWER10; + cc->has_work_with_iothread_lock = cpu_has_work_POWER10; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | @@ -10655,6 +10662,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); } @@ -10879,7 +10888,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = ppc_cpu_class_by_name; pcc->parent_parse_features = cc->parse_features; cc->parse_features = ppc_cpu_parse_featurestr; - cc->has_work = ppc_cpu_has_work; + cc->has_work_with_iothread_lock = ppc_cpu_has_work; cc->do_interrupt = ppc_cpu_do_interrupt; cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt; cc->dump_state = ppc_cpu_dump_state; From patchwork Thu May 21 16:40:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EC4F739 for ; Thu, 21 May 2020 17:09:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75A3020759 for ; Thu, 21 May 2020 17:09:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w6ewQJaV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75A3020759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboh5-00061V-JU for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:09:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJH-0004ab-SH for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:43 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:33301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJG-0006n2-Ms for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:43 -0400 Received: by mail-qk1-x743.google.com with SMTP id z80so7921281qka.0 for ; Thu, 21 May 2020 09:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Gn2vKDOISxQzKy44RYpzzeOAg/5NGEBTOA6wtcYZvN4=; b=w6ewQJaVNHlfqxUwmcl94B40fhD4pjmyTDUwV9aACZqsZay3ux3wsq6a9AedtIdZ4O 9TBgFrhwzNqBYP8y1lISG4kf3zfd6vpiBY11hAFTCoTPzeCEVCDriJ7s2PnBKZszu1Gz PFOKQi8J4XEkujUsy4qrCyJbW/Qachj+BP4hUAD3Rx0KOghPOIVK6hcPjW7ag9+FKIW7 y7reI1ZjXcm3+QnH3IpHMc+YdbWNN2+v/TIbR1vVP/JwLe7SL4qvvrDjAoGUwQ2clk7Z pVnDGNF+Wwwlji3Z+xE1CpSPz9N3b98mgXi0YqUCl47NyHLOqMN2jpxK8CflPflZ1xoz UT7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Gn2vKDOISxQzKy44RYpzzeOAg/5NGEBTOA6wtcYZvN4=; b=JDCrlwHu6nngK9OgD/CeifUm+MPmPzxShbf2BwOzgY567Bzu8g1miikzTuUzOR4C6I RkX29sP36m8tnwjFi3s/2IrzF5ytVblBkqLytQTot4lmtOVS2VS9hwCnxmvgj4F+JLal ulcuNy4MBJ4Cdb6ClLAFNvcs6YSDAu9asVR/FK1hqiwq/nwltwZHaYOw/jOWw+RqLv1R YbyNW6vmJDleGLsbG1S8SZfOCxy/mCf19sdwQQKLNW8xxk1kbrDmYwPY1fxwr0oQt2Wz P9A/ilvk9NQXDyMQR0Gj4LeZXryFRZNzQi/2x2/bxIQWJ06Lf7vvJfI3tEVOyQ4eRazJ QOrA== X-Gm-Message-State: AOAM533HSRgAEbf2f2U54h2vJrynjmYavU68v2ZEVQcIDCWIeMXQmc7E nXEkOfXHb6LQFri7CsuVdzHQsAPcNfoa3g== X-Google-Smtp-Source: ABdhPJxUOFG5AU32hHpb9iIRytixrzjcqFY3Ps0ryUK3ULJpyzY+5i0HLTIM22K4qI8eeSzfb8JyVA== X-Received: by 2002:a37:a42:: with SMTP id 63mr11126690qkk.399.1590079481587; Thu, 21 May 2020 09:44:41 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:40 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 65/74] mips: convert to cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:02 -0400 Message-Id: <20200521164011.638-66-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Aleksandar Markovic , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Aurelien Jarno Cc: Aleksandar Markovic Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/mips/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 761d8aaa54..ec9dde5100 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -58,6 +58,8 @@ static bool mips_cpu_has_work(CPUState *cs) bool has_work = false; uint32_t interrupt_request = cpu_interrupt_request(cs); + g_assert(qemu_mutex_iothread_locked()); + /* * Prior to MIPS Release 6 it is implementation dependent if non-enabled * interrupts wake-up the CPU, however most of the implementations only @@ -193,7 +195,7 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) device_class_set_parent_reset(dc, mips_cpu_reset, &mcc->parent_reset); cc->class_by_name = mips_cpu_class_by_name; - cc->has_work = mips_cpu_has_work; + cc->has_work_with_iothread_lock = mips_cpu_has_work; cc->do_interrupt = mips_cpu_do_interrupt; cc->cpu_exec_interrupt = mips_cpu_exec_interrupt; cc->dump_state = mips_cpu_dump_state; From patchwork Thu May 21 16:40:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA27D1391 for ; Thu, 21 May 2020 17:21:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E8572072C for ; Thu, 21 May 2020 17:21:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FTMsvZlO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E8572072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbosq-0007XL-Pf for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:21:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJJ-0004eF-5b for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:45 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:34595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJI-0006pe-AF for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:44 -0400 Received: by mail-qt1-x844.google.com with SMTP id a23so6026633qto.1 for ; Thu, 21 May 2020 09:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JFBVbjLhWvz//NfxtqcWhFsd9jqQkkiik7lq07yLP/0=; b=FTMsvZlOso8oYjZX/jmcx9fwfOIyj7GdWbF+mpCOnbWKcNISDe51SA/G+Sd61s5Rnh TvQ1rDtZsDu2dJIOjrM/lO9l4o+pyLWX/yLm7e1A2iJveDcBi0lbflWV+NMLLjRrQ0kh S1nB2vn0P/goDYLLn7jSp7Uq0ZpwaT1YY9KJSSzVEedjixm8hmGmZ5xn1rYxYi34/pgM UOQn0kWKPsi5+cyszesRgHLvrwMjMhoMhbHKP0agP4Os1Rdy91OvXo5F8H61n48dFV0U YrQxXG0QdhR6ZCCC3eVRMZb7pIlVRlLs3ypdfrP4jvUPInluw3hu6DkZ/9ZxDGxkz3+v gBcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JFBVbjLhWvz//NfxtqcWhFsd9jqQkkiik7lq07yLP/0=; b=kteZZKuNSMWkYt9QF6DBocro41dG6mOTIsfbuLXj2p5E+mYT+t9V+KMBA5RKOfJnLZ 0ffLjz4oah5pFpksoQUKAvnvrPZVJEfegL19ZPKnWbjGJl+CZtgqBObdODKn/eVuzgDb ZYmV0HDD6iXgVXtAysp2/He+dDwP8GdtTFF+5E9fX2ExF6tK8ZXJRLLcVM6d67isJca7 W3DpS3uCy6DCf76a/YiecjWPL4m4wGY0cmVqWqcFJCETPwZ2i4bhshmguObT/2OLwRzQ JKOET8s9usREeVIbbqRYu9wDQXDa6k2s1EuzKig7LyPSTef5tC3Gp0VkE8TtcCccuVhh I+0w== X-Gm-Message-State: AOAM531fWwDNz2alCxo9tl3uklzCxCV/uJF2j2GMC8fZJCFNJJJLfWBJ VoaSOlGfBUD+OU6Pr9ryRDYzaIvYpvPRDg== X-Google-Smtp-Source: ABdhPJxNSiyYPNp4rWI7ciQinjtzUAF7aqML7mIt6wtirdZz2ZEii8kXa14B2f2xea9LFo9NkjIFZQ== X-Received: by 2002:ac8:3f5d:: with SMTP id w29mr11407970qtk.192.1590079483088; Thu, 21 May 2020 09:44:43 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:42 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 66/74] s390x: convert to cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:03 -0400 Message-Id: <20200521164011.638-67-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, David Hildenbrand , richard.henderson@linaro.org, qemu-s390x@nongnu.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: David Hildenbrand Cc: qemu-s390x@nongnu.org Reviewed-by: Richard Henderson Reviewed-by: Cornelia Huck Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/s390x/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 490644e12b..e9a014bd02 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) { @@ -491,7 +493,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) #endif scc->reset = s390_cpu_reset; cc->class_by_name = s390_cpu_class_by_name, - cc->has_work = s390_cpu_has_work; + cc->has_work_with_iothread_lock = s390_cpu_has_work; #ifdef CONFIG_TCG cc->do_interrupt = s390_cpu_do_interrupt; #endif From patchwork Thu May 21 16:40:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B556F912 for ; Thu, 21 May 2020 17:19:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C2C820759 for ; Thu, 21 May 2020 17:19:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OETcZUng" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C2C820759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jborD-0003E8-Qe for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:19:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJK-0004iL-Is for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:46 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:38358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJJ-0006ri-FR for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:46 -0400 Received: by mail-qt1-x843.google.com with SMTP id i68so6009353qtb.5 for ; Thu, 21 May 2020 09:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6TzpYxGK0GGtfS/yX1tAPOw7mokCgDn/OgQamWItqo8=; b=OETcZUngW8+ch1W5uE52zNiye3q1W86VbkyEv5+fZbPKIvyJ8FqVOOeZo6eM67GIa3 eUf4HSTMgUepe8mDcxX3dbJUgBKa09kkL6HRaYKXIY3yOdIu7KB02ecI8czeI62YHRPE oKQ8N4VxjagC99xTXzKcgulzWJmJkTPuxPT3r6o7kLOTz62sQ4VeiX5UTaNdhciNdY+1 4GcWSAU404xmKt8uCXIiU26rR9816/ZULVQamL5aihOYVKGZa+qzDmtKV91i8iR7f6uZ x4/RiSIJFqMxvMyllcrFu+dHqRKRnFTrum3UwYRf99Dg7rKOOX566s9/cqJM0lW6lw0g XC0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6TzpYxGK0GGtfS/yX1tAPOw7mokCgDn/OgQamWItqo8=; b=of/8UV8QSooBxpikm9mbIacL14BQ75BtmlfczKEWCb7MPuWpHTbWaVe4C9+fQTVGFJ bc1Mmg6S4/7Et+VgqBYn3cJSeSYUL5F9DZFd4PdO6xQEJQ4sZSofF6/Wx0IXIYt17tM3 wmXftrzenQitKqEy4FarZ5Z0RV18opXxZGiU65AkDL6i33++1uNbBMUZvItYTka4XMZh R2hzizWanBRF/S40BIst1h90Y3y/b4NMAb0Es4C0eXAtl2ecdkTqeU1OqKd/QWb5FS4I xp5az1ka+/s8RqGTaCM0vGM6bONeZ9MQI+kIPoDBpMhQ1/4+/TqAZzLLwM5m2J+ZFGi7 MMHQ== X-Gm-Message-State: AOAM532FSXqgXOdDd7H8q5f7f477m3Z5zyzgI/tQ9XZaJkt0XkLM18hZ Wy8yAagjZCABjqVumQuvKB+cAQKLX2xELQ== X-Google-Smtp-Source: ABdhPJwCVdm4ttUpG+5C4hsMaCbaRlO93N/CTXcAeNfp16J3FqN61YkaCfNzlinFeDjcYA7b/SohSg== X-Received: by 2002:aed:3047:: with SMTP id 65mr7307271qte.277.1590079484343; Thu, 21 May 2020 09:44:44 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:43 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 67/74] riscv: convert to cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:04 -0400 Message-Id: <20200521164011.638-68-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Sagar Karandikar Cc: Bastian Koppelmann Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Reviewed-by: Alistair Francis Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/riscv/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 059d71f2c7..87827f69cd 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -323,6 +323,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 @@ -524,7 +527,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) device_class_set_parent_reset(dc, riscv_cpu_reset, &mcc->parent_reset); cc->class_by_name = riscv_cpu_class_by_name; - cc->has_work = riscv_cpu_has_work; + cc->has_work_with_iothread_lock = riscv_cpu_has_work; cc->do_interrupt = riscv_cpu_do_interrupt; cc->cpu_exec_interrupt = riscv_cpu_exec_interrupt; cc->dump_state = riscv_cpu_dump_state; From patchwork Thu May 21 16:40:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A80FE739 for ; Thu, 21 May 2020 17:11:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7EB4C20759 for ; Thu, 21 May 2020 17:11:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WOlVPG7o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EB4C20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboj6-0001ry-NT for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:11:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJL-0004m4-R9 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:47 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:45697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJK-0006tD-PV for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:47 -0400 Received: by mail-qk1-x742.google.com with SMTP id i5so7791409qkl.12 for ; Thu, 21 May 2020 09:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xM5F5VKH4+4sC5/UG8rh4cawXyjUH8jNOSP42/FFGNs=; b=WOlVPG7otck/gVRhYO+Jc23elD7wfUNztElUGh7nG+igheI00J51UQJQnwIRTmqjde r2OUVB73e5ZfrGfinTwDfveRWcJYSCSCoZN330heJ9DkmVi766yaIN4l8bbsY3sPCjTA MZE1wRYzk+B9NLd7PmL1Ow+QnpgFTlPX5YnJEuz2wQMVuGX7uXw9dT2Lkk3+y5uK3ckN NEkIg55JonbPVUg7Xzaj7yrGU2VzMXBSbOWxmfKiq58HW6DfBfs09/DXG+6JAMZKNzvN sD66XKl6u9uVYSCM3Ic74b0h1cdpHZIHCpQB6sNC3uiNaiuQloCHOd7nQm67V2cNJSZo rHmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xM5F5VKH4+4sC5/UG8rh4cawXyjUH8jNOSP42/FFGNs=; b=k+UW4guuhHqbjOjoLUGsUuycQXrqQ3EAm0uiCMVSzPDfuZ3PD+1RZPOcAstJe0Ppih gTli3o7qTu45BvaCLX39Er5yil11d/8gzhIgsy8OQOl+lORT8lebg6fm7H2Vu3Bjnc3u DZZGue1gF1I5qcgxFIUBiNDpDKizLN5vS91nXUH9KKtmuMmMqPuhLvXCA1144Sbjb6ex CmBYqARUHssmQkrEIMOUWY6sxVS/ozlCTNQZBlsWt5sw32R8OAqFq7TdrUW+cgAM249y phSzdq3s4/Cn7jVysswkjcpGJ6HdoWtR4LOEpSA+xKcJXoOclUgOGc6MEFthtnjCNJki /rkQ== X-Gm-Message-State: AOAM533KmkmXFDK3TctC18aKkwDR01kg+V5by0J7s+gowITT4jLkAPV0 NW2DPEc7W7tNGm7NCOadSz6g2S3rV1WNZg== X-Google-Smtp-Source: ABdhPJxX5hXseZH8WZi3XJU4bMVgeGrhs/VO2QA9caPKh+vvAU/1WOMHJBk5WcDmk4Wa2wAc+co/xg== X-Received: by 2002:a37:4e81:: with SMTP id c123mr10463609qkb.467.1590079485560; Thu, 21 May 2020 09:44:45 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:45 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 68/74] sparc: convert to cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:05 -0400 Message-Id: <20200521164011.638-69-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Artyom Tarasenko Reviewed-by: Richard Henderson Acked-by: Mark Cave-Ayland Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/sparc/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index cef25238a5..3fa1a535d9 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -704,6 +704,8 @@ static bool sparc_cpu_has_work(CPUState *cs) SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; + g_assert(qemu_mutex_iothread_locked()); + return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) && cpu_interrupts_enabled(env); } @@ -863,7 +865,7 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = sparc_cpu_class_by_name; cc->parse_features = sparc_cpu_parse_features; - cc->has_work = sparc_cpu_has_work; + cc->has_work_with_iothread_lock = sparc_cpu_has_work; cc->do_interrupt = sparc_cpu_do_interrupt; cc->cpu_exec_interrupt = sparc_cpu_exec_interrupt; cc->dump_state = sparc_cpu_dump_state; From patchwork Thu May 21 16:40:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 007AE912 for ; Thu, 21 May 2020 17:21:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CBB522072C for ; Thu, 21 May 2020 17:21:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ssOVXhEK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBB522072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboss-0007Za-2q for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:21:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJN-0004pe-3n for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:49 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:46885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJM-0006wx-5H for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:48 -0400 Received: by mail-qk1-x731.google.com with SMTP id f83so7783071qke.13 for ; Thu, 21 May 2020 09:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FcchR0Kiy3cS07PsythDlOBOqbmqT9MEDX8/TYIcoYY=; b=ssOVXhEK6Z62VXfIfsH/COP+Fd77hFrjpA8KjOFhyLqtpHqSG3Oyh0sIOHsjrjPUSL nyjYyXPxfHs8Wo/8OP+sUkzB+j25EH09I7m4C+pGWfjuSaVl6NDVULdvZu31A0q1lPgE 44HIUcYV0ahm96G5y7TrfLwcOjOK3HrJjZoOuZWtqYuXtaVfnsUSBPr26kzJzeREt65C D/pCe+2bEuT7uZg1ecmRLZ6kuzKdiMwKpANF4Wm5ZxmliBx4Go69ALhBnSGfrt+LD5J1 /yzUsOnFotN9/mdgRdiecSHFFPtQCIV+oXh86YMXJf1hSs9odlX0c4V+MpUGB3FLupl3 9g2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FcchR0Kiy3cS07PsythDlOBOqbmqT9MEDX8/TYIcoYY=; b=O5Alz5hgoAkwdHfElxmgqpcO6xakJR/8w6S3PqYQYHfR5++CX9ukp4of1hhbTYfq0y ug536XbHYRJYFcrVzRq8CxGucVNXStUS8CLMBKhilMd1nNBAjKdG4w09W9LnqD8NE5Wu wik5gHX50fQyXzme0v5wD530BQUWy/teNiaG94TH6anQdjwIJILxfqNUs6yiPDqV3hBx 0clN0gYkw5qXDkOMJKrxEdKRWjL1Sp8FKU6c+WTNMbvW+X8AUtL3T7l7m7QqaNeCFzbQ 3yCl+xrO7r9Gq7z7JDakhys6fvjwB9wdtrq+/Kr+544cNoZ0iELdyH3H6HdDmN0T7bcu E7fA== X-Gm-Message-State: AOAM53122MVUxav4yPPJ/Pq8IAD62GMTdsCZPrn0VyBq6tlgnrMIRn29 cJO1NW5XaMeTkz2GxPnpqTbkzNc2SvCCrw== X-Google-Smtp-Source: ABdhPJwYDzCsf/NOUruPxe0+/ZMq+Xn2vKo0dk4BooVAsFboa0LdHnZzaQBwBPTieISf3DpDEh5FyQ== X-Received: by 2002:a37:46c9:: with SMTP id t192mr7541261qka.3.1590079486957; Thu, 21 May 2020 09:44:46 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:46 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 69/74] xtensa: convert to cpu_has_work_with_iothread_lock Date: Thu, 21 May 2020 12:40:06 -0400 Message-Id: <20200521164011.638-70-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x731.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, richard.henderson@linaro.org, Max Filippov , cota@braap.org, peter.puhov@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Soon we will call cpu_has_work without the BQL. Cc: Max Filippov Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- target/xtensa/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index fda4a73722..0f96483563 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -47,6 +47,8 @@ static bool xtensa_cpu_has_work(CPUState *cs) #ifndef CONFIG_USER_ONLY XtensaCPU *cpu = XTENSA_CPU(cs); + g_assert(qemu_mutex_iothread_locked()); + return !cpu->env.runstall && cpu->env.pending_irq_level; #else return true; @@ -187,7 +189,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) device_class_set_parent_reset(dc, xtensa_cpu_reset, &xcc->parent_reset); cc->class_by_name = xtensa_cpu_class_by_name; - cc->has_work = xtensa_cpu_has_work; + cc->has_work_with_iothread_lock = xtensa_cpu_has_work; cc->do_interrupt = xtensa_cpu_do_interrupt; cc->cpu_exec_interrupt = xtensa_cpu_exec_interrupt; cc->dump_state = xtensa_cpu_dump_state; From patchwork Thu May 21 16:40:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563607 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17514739 for ; Thu, 21 May 2020 17:12:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2E1D20759 for ; Thu, 21 May 2020 17:12:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CZjevvvF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2E1D20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:42046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbokb-0005OY-3N for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:12:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJO-0004tf-Jc for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:50 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:36688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJN-0006yJ-HY for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:50 -0400 Received: by mail-qt1-x842.google.com with SMTP id v4so6015583qte.3 for ; Thu, 21 May 2020 09:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wDuYpfs9QlEw4aXWAwthoPylqu8S5OXh9Q7CXYLnZi8=; b=CZjevvvF6bG4rCc0U5MLQJHndBYJxGCsV3rZ6cqVid5/gU7z5/OLRRXWDlHzJEYLKg MqGFVdFeTgG95hEhesAEUceMWkuoXakdW7it+cVZ5h69dHCvFwMaEQCPbg8A+5hKcNcG PlczMlUEeDA3YFl69KyA+c01SQjvMbmAqmEAuuP1JTv1CkCIoWySh1tT7TmCpzcSMX6O fkSzA7zgf284yCKefG6Rbg3scpsfGMtvtAKkyVXe/ImUy7A74ez1sljGsXCdO0VgXjpg 2makoZ+nIuJgc1D6ykPsxl33oXEG0s8hC33OOOi1A6I/Gtrj88YUtnh2EjaYIuwYH2oc uSHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wDuYpfs9QlEw4aXWAwthoPylqu8S5OXh9Q7CXYLnZi8=; b=CcXS9E6BAx2Evo+4qB17bEaCJVlXU0IJaLwi9AQloC5fp4/8ndGnh9R2nlx7h4D2Sd ZFbVzl9Z1TXONOSSqGBxFpzp4VnT8meKwVa0if0dDmfYAuwyYhPXOrdmi96zpxXQuNpB 7ucfPCkMLeo3GXhHWGV6DUUNezCO7hKaAF0hFmH5Ev24tAx6pbE1T+0rEq/cVTZOB5/F T5rQcAew7IHNWOJEsgFiUvXiUbYBKsgDKdp08br86PvKjGplqAmjY6KYtXL+UkBL8LW5 YIVD3EVREXoV8bokxX1sgFDjVaxtyhTvSAuejtzDSY9QCZko7HQaOWJImfBlv7MAlHm3 KDQQ== X-Gm-Message-State: AOAM531CW0KuKDOgvyMwtQ/aeJa1MjiZcj+QlLST70KXo1NovrPs2DTw Nqusu2qsNQtKzbU6OM7QOXytv8Bw7fpl8Q== X-Google-Smtp-Source: ABdhPJy+ztiScICekgyUDMqsyocmXAcMSbF2lnIgx3oJ6lD6op6mruD+TTzT3uALuY/JD6U/qXWbKQ== X-Received: by 2002:ac8:393a:: with SMTP id s55mr11528006qtb.48.1590079488317; Thu, 21 May 2020 09:44:48 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:47 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 70/74] cpu: rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle Date: Thu, 21 May 2020 12:40:07 -0400 Message-Id: <20200521164011.638-71-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::842; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x842.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This function is only called from TCG rr mode, so add a prefix to mark this as well as an assertion. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index ff67fa9f5f..bcba0552bf 100644 --- a/cpus.c +++ b/cpus.c @@ -230,10 +230,12 @@ static bool cpu_thread_is_idle(CPUState *cpu) return true; } -static bool all_cpu_threads_idle(void) +static bool qemu_tcg_rr_all_cpu_threads_idle(void) { CPUState *cpu; + g_assert(qemu_is_tcg_rr()); + CPU_FOREACH(cpu) { if (!cpu_thread_is_idle(cpu)) { return false; @@ -641,7 +643,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; } @@ -1300,7 +1302,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); } @@ -1656,7 +1658,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 Thu May 21 16:40:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E82A14E3 for ; Thu, 21 May 2020 17:15:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22B9220759 for ; Thu, 21 May 2020 17:15:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uew8HBlH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22B9220759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbomo-00014W-8a for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:15:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJR-00051r-Be for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:53 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:45013) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJP-0006zh-BC for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:53 -0400 Received: by mail-qk1-x742.google.com with SMTP id b6so7816050qkh.11 for ; Thu, 21 May 2020 09:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xi82Dss/1dzX4RRWOX+gmxTFQne7MTM9AwBHg22gc90=; b=uew8HBlHDGKl7AHSLrM6zhF2B2VIbz40qRDe2F8phBk3GmkTTJCRJL9m79oi6yt1b1 8UXDL07aXRWPRUdhDQJTV99CpolE7sCPlZY6w4lHdgKMTS8a6q9iDCIdotFbq3No++kh oHGEEA3H1rhrnbSP04fG0aJkVvpJalEnVBgAGYoN4QAbhGnrDYvVi+rx0sClfAyyUzLc PntO5yUXKv0a2O5WOd4EIftxr5SgTqazxjlZfbYwijWrMECVqmZ53Z2hbSOSA4bVYgUg 6PZ4VZ/bXbDp0zY7PwdywTfM4+sz4Gfjgi3oBNxNm2yLUadiZD46hQXffXyt4ehWUWSO b8Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xi82Dss/1dzX4RRWOX+gmxTFQne7MTM9AwBHg22gc90=; b=PLRlbeEUOVmSgpwZ/PYxQbw2ER7x6QV6zKeZ+o5xjJPitXXG7gx0bBZEV/JtmYwu5W G4c8+D0Z3iMf/2iFkmPms4GHLXYH9c2CF940b6xWFaD8cGCASSELaa8z7AoI50tUw8hn zXi6vNFyFXc0JL4OoJJgTh/UBh0qpkPrCC46ocZboShTKQDE64iRfsGkqlbDgMsYQ2FZ uQO3HGrZbnsh695QrhjDLdXYBxkqmYzJVYGWq/axu13qjqAFWuBm7EEhI2kpgkiv4ezk ACKJKeqceY8pXBQlISUc1qIitLpmy5SiTeu5Oo28IobaTyBViATnGTKyc3PjILX9z4Pv U81g== X-Gm-Message-State: AOAM532s3cMXcDo8wzWilRlVYsgUa3/YHLPnB93om/OLX7djp8iHJRYM ej1ogmo1l58OdHbUGgTFP7pqVWXnTJJLGw== X-Google-Smtp-Source: ABdhPJxuEwmZS2kChHZwKmgHZMT1JfjgNoY4ynoETgUcKz/b+EAu9p1u0wGrNZSwp0ZZbwk/j4ifRQ== X-Received: by 2002:a05:620a:14ac:: with SMTP id x12mr10393538qkj.262.1590079489618; Thu, 21 May 2020 09:44:49 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:48 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 71/74] cpu: protect CPU state with cpu->lock instead of the BQL Date: Thu, 21 May 2020 12:40:08 -0400 Message-Id: <20200521164011.638-72-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Use the per-CPU locks to protect the CPUs' state, instead of using the BQL. These locks are uncontended (they are mostly acquired by the corresponding vCPU thread), so acquiring them is cheaper than acquiring the BQL, which particularly in MTTCG can be contended at high core counts. In this conversion we drop qemu_cpu_cond and qemu_pause_cond, and use cpu->cond instead. In qom/cpu.c we can finally remove the ugliness that results from having to hold both the BQL and the CPU lock; now we just have to grab the CPU lock. Removed g_assert(qemu_mutex_iothread_locked()) from qemu_tcg_rr_all_cpu_threads_idle(). There is an existing case where we call qemu_tcg_rr_all_cpu_threads_idle() without the BQL held. Also changed qemu_cond_wait() to qemu_cond_timed_wait() in qemu_tcg_rr_cpu_thread_fn() to fix issue where we might miss the broadcast wakeup. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota [RF: Adjusted assert and changed to use timed_wait] Signed-off-by: Robert Foley --- cpus.c | 288 +++++++++++++++++++++++++++++++----------- hw/core/cpu.c | 29 +---- include/hw/core/cpu.h | 20 +-- 3 files changed, 232 insertions(+), 105 deletions(-) diff --git a/cpus.c b/cpus.c index bcba0552bf..1dbb2fb3f9 100644 --- a/cpus.c +++ b/cpus.c @@ -200,24 +200,30 @@ void cpu_mutex_destroy(CPUState *cpu) } } -bool cpu_is_stopped(CPUState *cpu) +/* Called with the CPU's lock held */ +static bool cpu_is_stopped_locked(CPUState *cpu) { return cpu->stopped || !runstate_is_running(); } -static inline bool cpu_work_list_empty(CPUState *cpu) +bool cpu_is_stopped(CPUState *cpu) { - bool ret; + if (!cpu_mutex_locked(cpu)) { + bool ret; - cpu_mutex_lock(cpu); - ret = QSIMPLEQ_EMPTY(&cpu->work_list); - cpu_mutex_unlock(cpu); - return ret; + cpu_mutex_lock(cpu); + ret = cpu_is_stopped_locked(cpu); + cpu_mutex_unlock(cpu); + return ret; + } + return cpu_is_stopped_locked(cpu); } static bool cpu_thread_is_idle(CPUState *cpu) { - if (cpu->stop || !cpu_work_list_empty(cpu)) { + g_assert(cpu_mutex_locked(cpu)); + + if (cpu->stop || !QSIMPLEQ_EMPTY(&cpu->work_list)) { return false; } if (cpu_is_stopped(cpu)) { @@ -235,9 +241,16 @@ static bool qemu_tcg_rr_all_cpu_threads_idle(void) CPUState *cpu; g_assert(qemu_is_tcg_rr()); + g_assert(no_cpu_mutex_locked()); CPU_FOREACH(cpu) { - if (!cpu_thread_is_idle(cpu)) { + bool is_idle; + + cpu_mutex_lock(cpu); + is_idle = cpu_thread_is_idle(cpu); + cpu_mutex_unlock(cpu); + + if (!is_idle) { return false; } } @@ -730,6 +743,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; } @@ -1066,6 +1081,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); @@ -1078,6 +1094,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); } @@ -1179,6 +1196,8 @@ int vm_shutdown(void) static bool cpu_can_run(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + if (cpu->stop) { return false; } @@ -1251,16 +1270,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); @@ -1278,39 +1290,60 @@ static void qemu_tcg_destroy_vcpu(CPUState *cpu) { } -static void qemu_cpu_stop(CPUState *cpu, bool exit) +static void qemu_cpu_stop_locked(CPUState *cpu, bool exit) { + g_assert(cpu_mutex_locked(cpu)); g_assert(qemu_cpu_is_self(cpu)); cpu->stop = false; cpu->stopped = true; if (exit) { cpu_exit(cpu); } - qemu_cond_broadcast(&qemu_pause_cond); + qemu_cond_broadcast(&cpu->cond); +} + +static void qemu_cpu_stop(CPUState *cpu, bool exit) +{ + cpu_mutex_lock(cpu); + qemu_cpu_stop_locked(cpu, exit); + cpu_mutex_unlock(cpu); } static void qemu_wait_io_event_common(CPUState *cpu) { + g_assert(cpu_mutex_locked(cpu)); + atomic_mb_set(&cpu->thread_kicked, false); if (cpu->stop) { - qemu_cpu_stop(cpu, false); + qemu_cpu_stop_locked(cpu, false); } + /* + * unlock+lock cpu_mutex, so that other vCPUs have a chance to grab the + * lock and queue some work for this vCPU. + */ + cpu_mutex_unlock(cpu); process_queued_cpu_work(cpu); + cpu_mutex_lock(cpu); } static void qemu_tcg_rr_wait_io_event(void) { CPUState *cpu; + g_assert(qemu_mutex_iothread_locked()); + g_assert(no_cpu_mutex_locked()); + while (qemu_tcg_rr_all_cpu_threads_idle()) { stop_tcg_kick_timer(); - qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(first_cpu->halt_cond, first_cpu->lock); } start_tcg_kick_timer(); CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); qemu_wait_io_event_common(cpu); + cpu_mutex_unlock(cpu); } } @@ -1318,12 +1351,15 @@ static void qemu_wait_io_event(CPUState *cpu) { bool slept = false; + g_assert(cpu_mutex_locked(cpu)); + g_assert(!qemu_mutex_iothread_locked()); + while (cpu_thread_is_idle(cpu)) { if (!slept) { slept = true; qemu_plugin_vcpu_idle_cb(cpu); } - qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(cpu->halt_cond, cpu->lock); } if (slept) { qemu_plugin_vcpu_resume_cb(cpu); @@ -1346,6 +1382,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; @@ -1358,15 +1395,21 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) } kvm_init_cpu_signals(cpu); + qemu_mutex_unlock_iothread(); /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = kvm_cpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1374,10 +1417,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; } @@ -1394,7 +1443,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; @@ -1405,11 +1454,11 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); do { int sig; r = sigwait(&waitset, &sig); @@ -1418,11 +1467,11 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) perror("sigwait"); exit(1); } - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_wait_io_event(cpu); } while (!cpu->unplug); - qemu_mutex_unlock_iothread(); + cpu_mutex_unlock(cpu); rcu_unregister_thread(); return NULL; #endif @@ -1462,6 +1511,8 @@ static int64_t tcg_get_icount_limit(void) static void handle_icount_deadline(void) { assert(qemu_in_vcpu_thread()); + g_assert(qemu_mutex_iothread_locked()); + if (use_icount) { int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, QEMU_TIMER_ATTR_ALL); @@ -1542,12 +1593,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); } } @@ -1568,25 +1622,45 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) rcu_register_thread(); tcg_register_thread(); + /* + * We call cpu_mutex_lock/unlock just to please the assertions in common + * code, since here cpu->lock is an alias to the BQL. + */ qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); - cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); qemu_guest_random_seed_thread_part2(cpu->random_seed); /* wait for initial kick-off after machine start */ + cpu_mutex_lock(first_cpu); while (first_cpu->stopped) { - qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex); + /* + * a timedwait is needed since this gets kicked off + * by a cond_broadcast, and it is possible + * to not be woken up by the broadcast if we are + * not waiting when the broadcast is sent. + */ + qemu_cond_timedwait(first_cpu->halt_cond, + first_cpu->lock, + 100); + cpu_mutex_unlock(first_cpu); /* process any pending work */ CPU_FOREACH(cpu) { current_cpu = cpu; + cpu_mutex_lock(cpu); qemu_wait_io_event_common(cpu); + cpu_mutex_unlock(cpu); } + + cpu_mutex_lock(first_cpu); } + cpu_mutex_unlock(first_cpu); start_tcg_kick_timer(); @@ -1613,7 +1687,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; @@ -1624,6 +1703,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); @@ -1631,11 +1711,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(); @@ -1645,11 +1728,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); @@ -1681,6 +1768,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(); @@ -1688,12 +1776,18 @@ static void *qemu_hax_cpu_thread_fn(void *arg) current_cpu = cpu; hax_init_vcpu(cpu); - qemu_cond_signal(&qemu_cpu_cond); + qemu_mutex_unlock_iothread(); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = hax_smp_cpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1701,6 +1795,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; } @@ -1718,6 +1814,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(); @@ -1725,15 +1822,21 @@ static void *qemu_hvf_cpu_thread_fn(void *arg) current_cpu = cpu; hvf_init_vcpu(cpu); + qemu_mutex_unlock_iothread(); /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = hvf_vcpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1741,10 +1844,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; } @@ -1757,6 +1866,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; @@ -1766,29 +1876,41 @@ static void *qemu_whpx_cpu_thread_fn(void *arg) fprintf(stderr, "whpx_init_vcpu failed: %s\n", strerror(-r)); exit(1); } + qemu_mutex_unlock_iothread(); /* signal CPU creation */ cpu->created = true; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); do { if (cpu_can_run(cpu)) { + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); r = whpx_vcpu_exec(cpu); + qemu_mutex_unlock_iothread(); + cpu_mutex_lock(cpu); + if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } } while (cpu_thread_is_idle(cpu)) { - qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); + qemu_cond_wait(cpu->halt_cond, cpu->lock); } qemu_wait_io_event_common(cpu); } while (!cpu->unplug || cpu_can_run(cpu)); + cpu_mutex_unlock(cpu); + qemu_mutex_lock_iothread(); whpx_destroy_vcpu(cpu); - cpu->created = false; - qemu_cond_signal(&qemu_cpu_cond); qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); + cpu->created = false; + qemu_cond_signal(&cpu->cond); + cpu_mutex_unlock(cpu); + rcu_unregister_thread(); return NULL; } @@ -1816,14 +1938,14 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) rcu_register_thread(); tcg_register_thread(); - qemu_mutex_lock_iothread(); + cpu_mutex_lock(cpu); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->created = true; cpu->can_do_io = 1; current_cpu = cpu; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_signal(&cpu->cond); qemu_guest_random_seed_thread_part2(cpu->random_seed); /* process any pending work */ @@ -1832,9 +1954,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 +1972,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 +1987,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; } @@ -1973,54 +2095,69 @@ void qemu_cond_wait_iothread(QemuCond *cond) qemu_cond_wait(cond, &qemu_global_mutex); } -static bool all_vcpus_paused(void) -{ - CPUState *cpu; - - CPU_FOREACH(cpu) { - if (!cpu->stopped) { - return false; - } - } - - return true; -} - void pause_all_vcpus(void) { CPUState *cpu; + g_assert(no_cpu_mutex_locked()); + qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false); CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); if (qemu_cpu_is_self(cpu)) { qemu_cpu_stop(cpu, true); } else { cpu->stop = true; qemu_cpu_kick(cpu); } + cpu_mutex_unlock(cpu); } + drop_locks_and_stop_all_vcpus: /* We need to drop the replay_lock so any vCPU threads woken up * can finish their replay tasks */ replay_mutex_unlock(); + qemu_mutex_unlock_iothread(); - while (!all_vcpus_paused()) { - qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex); - CPU_FOREACH(cpu) { + CPU_FOREACH(cpu) { + cpu_mutex_lock(cpu); + if (!cpu->stopped) { + cpu->stop = true; qemu_cpu_kick(cpu); + qemu_cond_wait(&cpu->cond, cpu->lock); } + cpu_mutex_unlock(cpu); } - qemu_mutex_unlock_iothread(); replay_mutex_lock(); qemu_mutex_lock_iothread(); + + /* a CPU might have been hot-plugged while we weren't holding the BQL */ + CPU_FOREACH(cpu) { + bool stopped; + + cpu_mutex_lock(cpu); + stopped = cpu->stopped; + cpu_mutex_unlock(cpu); + + if (!stopped) { + goto drop_locks_and_stop_all_vcpus; + } + } } void cpu_resume(CPUState *cpu) { - cpu->stop = false; - cpu->stopped = false; + if (cpu_mutex_locked(cpu)) { + cpu->stop = false; + cpu->stopped = false; + } else { + cpu_mutex_lock(cpu); + cpu->stop = false; + cpu->stopped = false; + cpu_mutex_unlock(cpu); + } qemu_cpu_kick(cpu); } @@ -2040,8 +2177,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); @@ -2225,9 +2365,15 @@ void qemu_init_vcpu(CPUState *cpu) qemu_dummy_start_vcpu(cpu); } + qemu_mutex_unlock_iothread(); + + cpu_mutex_lock(cpu); while (!cpu->created) { - qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); + qemu_cond_wait(&cpu->cond, cpu->lock); } + cpu_mutex_unlock(cpu); + + qemu_mutex_lock_iothread(); } void cpu_stop_current(void) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index ee20f8e0ad..2288de90f8 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -95,32 +95,13 @@ static void cpu_common_get_memory_mapping(CPUState *cpu, error_setg(errp, "Obtaining memory mappings is unsupported on this CPU."); } -/* Resetting the IRQ comes from across the code base so we take the - * BQL here if we need to. cpu_interrupt assumes it is held.*/ void cpu_reset_interrupt(CPUState *cpu, int mask) { - bool has_bql = qemu_mutex_iothread_locked(); - bool has_cpu_lock = cpu_mutex_locked(cpu); - - if (has_bql) { - if (has_cpu_lock) { - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - } else { - cpu_mutex_lock(cpu); - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - cpu_mutex_unlock(cpu); - } - return; - } - - if (has_cpu_lock) { - cpu_mutex_unlock(cpu); - } - qemu_mutex_lock_iothread(); - cpu_mutex_lock(cpu); - atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); - qemu_mutex_unlock_iothread(); - if (!has_cpu_lock) { + if (cpu_mutex_locked(cpu)) { + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); + } else { + cpu_mutex_lock(cpu); + atomic_set(&cpu->interrupt_request, cpu->interrupt_request & ~mask); cpu_mutex_unlock(cpu); } } diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 9766477e62..8478628fdb 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -312,10 +312,6 @@ struct qemu_work_item; * valid under cpu_list_lock. * @created: Indicates whether the CPU thread has been successfully created. * @interrupt_request: Indicates a pending interrupt request. - * @halted: Nonzero if the CPU is in suspended state. - * @stop: Indicates a pending stop request. - * @stopped: Indicates the CPU has been artificially stopped. - * @unplug: Indicates a pending CPU unplug request. * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU * @singlestep_enabled: Flags for single-stepping. * @icount_extra: Instructions until next timer event. @@ -340,6 +336,10 @@ struct qemu_work_item; * after the BQL. * @cond: Condition variable for per-CPU events. * @work_list: List of pending asynchronous work. + * @halted: Nonzero if the CPU is in suspended state. + * @stop: Indicates a pending stop request. + * @stopped: Indicates the CPU has been artificially stopped. + * @unplug: Indicates a pending CPU unplug request. * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes * to @trace_dstate). * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask). @@ -364,12 +364,7 @@ struct CPUState { #endif int thread_id; bool running, has_waiter; - struct QemuCond *halt_cond; bool thread_kicked; - bool created; - bool stop; - bool stopped; - bool unplug; bool crash_occurred; bool exit_request; bool in_exclusive_context; @@ -385,7 +380,13 @@ struct CPUState { QemuMutex *lock; /* fields below protected by @lock */ QemuCond cond; + QemuCond *halt_cond; QSIMPLEQ_HEAD(, qemu_work_item) work_list; + uint32_t halted; + bool created; + bool stop; + bool stopped; + bool unplug; CPUAddressSpace *cpu_ases; int num_ases; @@ -431,7 +432,6 @@ struct CPUState { /* TODO Move common fields from CPUArchState here. */ int cpu_index; int cluster_index; - uint32_t halted; uint32_t can_do_io; int32_t exception_index; From patchwork Thu May 21 16:40:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 109BA912 for ; Thu, 21 May 2020 17:23:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB7182072C for ; Thu, 21 May 2020 17:23:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="D7TRfDNX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB7182072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:33008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbouK-0002aF-WB for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJS-00053q-4f for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:54 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:36690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJQ-0006zm-99 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:53 -0400 Received: by mail-qt1-x843.google.com with SMTP id v4so6015721qte.3 for ; Thu, 21 May 2020 09:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PofzzyIN8ZoMX3VcbhKeSDmt2Z4USbgC222e6DzhLWQ=; b=D7TRfDNXXyAbBnWHO/BW6jNN13ajx8i1EgERkdVyXr7GHH7kmYc0qcFfaEv5z90mzQ wuvWFcuTFMYe71jc8dK6Y2eoiVzeROO9SJ9UUrEn+f3GWXJtoDS2vX35PSfUxnt5pjqj mN+dngBfIAC/cBXTS6iZr4GQwqmbZtdKo4nCDSs0SFAXFIwu2016qImQ/07+1jtxPI8Z d3ADahoV8cHN5EuQ/AODEBRx1+bgj3hHTM7JXBwTn428UCS2ubzjGjZg1vUHrNnoCpkT iTwapSBkDSCLFB9eswwIDfEMcKt6soQndSmfdQSUjpSLNSZwFz1S4760QCUkkhgHpv2J fosA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PofzzyIN8ZoMX3VcbhKeSDmt2Z4USbgC222e6DzhLWQ=; b=LzEeLx75ILLDLVcF/5JjIzNMJnmKM3udi1zMIwTcOi6vzaeyJrz2p9jOk0BTm5HZwA 2eKISy2cGBVAWlkgQiqoOm6W1UQCTryS7re9wiYuSIGfzIlOctNwrhhyNZ9nEHy7rlhI pSzsMPlmDLTXmutfEsBnu6f+WgPZMUkbBF/kG6A0lhbAi3GOgGP7wG0u75EOMjkLQI54 dArk9YyoKnwC8BGZY7/99eFra1QlPDsUVLRYeO57HK6qLRRFyjB0vsTbiPmcYtc2P9eH 9PV5OKpuBJnz3iVY4HswY5IOKCmn6uSDcVCaYJfB7cs/UG8HbuXaEKyRjhOkQroWqZz6 HRyQ== X-Gm-Message-State: AOAM531+4Prox6WkOvjhxFcgSYZmPn87ykTZDK9R5KWI7SK4yUtYa052 0WjMWYJA0fvXQz7xZIPw6NnVZMR2yj+mZQ== X-Google-Smtp-Source: ABdhPJx3PBSSY/7rEerhpOl51AZ6/Gz54wzFVddOmzO2JQv5TK1tTCuB4g454I66N4X7v6gG/JbQHw== X-Received: by 2002:ac8:6c54:: with SMTP id z20mr11450617qtu.76.1590079491175; Thu, 21 May 2020 09:44:51 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:50 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 72/74] cpus-common: release BQL earlier in run_on_cpu Date: Thu, 21 May 2020 12:40:09 -0400 Message-Id: <20200521164011.638-73-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index d418eb5aef..7ccc7df876 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -135,6 +135,11 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) return; } + /* We are going to sleep on the CPU lock, so release the BQL */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + wi.func = func; wi.data = data; wi.done = false; @@ -143,21 +148,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); - - /* - * We are going to sleep on the CPU lock, so release the BQL. - * - * During the transition to per-CPU locks, we release the BQL _after_ - * having kicked the destination CPU (from queue_work_on_cpu_locked above). - * This makes sure that the enqueued work will be seen by the CPU - * after being woken up from the kick, since the CPU sleeps on the BQL. - * Once we complete the transition to per-CPU locks, we will release - * the BQL earlier in this function. - */ - if (has_bql) { - qemu_mutex_unlock_iothread(); - } - while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu; From patchwork Thu May 21 16:40:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BA3F912 for ; Thu, 21 May 2020 17:24:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 50BBA2072C for ; Thu, 21 May 2020 17:24:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="veO3K/vj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50BBA2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbovv-0006zR-Dp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:24:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJS-000569-V8 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:54 -0400 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]:39771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJR-0006zw-Ra for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:54 -0400 Received: by mail-qt1-x841.google.com with SMTP id l1so5989489qtp.6 for ; Thu, 21 May 2020 09:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GxlpAA+PZ/IrNPvmGjLlDG9tH8eZcMlAHM/CkfDCuY4=; b=veO3K/vjcVpuQ+C+yQY2XAkmnfKBO7Fk/QZ6Uq7Ad74lHb6rjDuwWx3jbsLltck3Ef IuVf0lyi1gbyPazl0nzvdZFR0CAFpcRet/R1ApaXwdbTLb2bpwAStPS5/A7pAx+H6YeW 8KvyhX3H7cg5fO6ntD2B1rV3hf2ge+s6hXr+dhcEAojlBHDwsNtGlsrqvNM5foLRsLhL dmjV0jN701NWNAdQA8B9Ys1P0vio0BgTBYyFr5p0XSNi6b0RbScbN1ct+Gq1HSfjSAfU MYxcLwRMpegzOBs0kBOFbE9dLQ/dYAXjM12bfNK0fFAFxM4xngkSobQHZGyxRP+vniFy gaaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GxlpAA+PZ/IrNPvmGjLlDG9tH8eZcMlAHM/CkfDCuY4=; b=SNdGzfjV3CyPgu+cu6T5kOzHhj7k103pF7XsWdrmgd3fZWKu1mb9Qththmt4SEGLXj 4rCjwqE7t5BRdlHy4BQN2RBzTzat2Q9JXORD1I6VSuRAk+z0l+seem7jEMx2eNVqMNFd epOSLMhxMNVZNN+tmqkWc/Jn0rCzoEYJpYEN2hSpKC0vvPNran2ls96v9wvz0B6OwG+M kR/5jB7bWAqN6ssTkK4EsAs9Q8rwHW/9OiAKq9dUlY4JmJQRXybDPFIAmVyZIuuwuV8g Fet8c1tCgu9+hcBy0mfUkSlhrIPSuT2iie3ypay/pQ6tOhWpc+e8ounZa4LLasyY8pHR wiIw== X-Gm-Message-State: AOAM532QymB8PiqrWuz6KJNizrnUI4oUolaYxI0TxM8dtmpuTUGOqsIw vmuuxtbAaKokrs0sEGbQoABCLz0vEarIug== X-Google-Smtp-Source: ABdhPJypdGKUc8YKxGycEvbQX/1ExOqOFr03PfU8cnNsFj1yxnihx20FzBrsV/KPceK0sFFuIisTIg== X-Received: by 2002:aed:35a1:: with SMTP id c30mr11738669qte.228.1590079492546; Thu, 21 May 2020 09:44:52 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:51 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 73/74] cpu: add async_run_on_cpu_no_bql Date: Thu, 21 May 2020 12:40:10 -0400 Message-Id: <20200521164011.638-74-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::841; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x841.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Some async jobs do not need the BQL. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 39 ++++++++++++++++++++++++++++++++++----- include/hw/core/cpu.h | 14 ++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 7ccc7df876..651f9b31cc 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -99,6 +99,7 @@ struct qemu_work_item { run_on_cpu_func func; run_on_cpu_data data; bool free, exclusive, done; + bool bql; }; /* Called with the CPU's lock held */ @@ -145,6 +146,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi.done = false; wi.free = false; wi.exclusive = false; + wi.bql = true; cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); @@ -169,6 +171,21 @@ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) wi->func = func; wi->data = data; wi->free = true; + wi->bql = true; + + queue_work_on_cpu(cpu, wi); +} + +void async_run_on_cpu_no_bql(CPUState *cpu, run_on_cpu_func func, + run_on_cpu_data data) +{ + struct qemu_work_item *wi; + + wi = g_malloc0(sizeof(struct qemu_work_item)); + wi->func = func; + wi->data = data; + wi->free = true; + /* wi->bql initialized to false */ queue_work_on_cpu(cpu, wi); } @@ -315,6 +332,7 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, wi->data = data; wi->free = true; wi->exclusive = true; + /* wi->bql initialized to false */ queue_work_on_cpu(cpu, wi); } @@ -339,6 +357,7 @@ static void process_queued_cpu_work_locked(CPUState *cpu) * BQL, so it goes to sleep; start_exclusive() is sleeping too, so * neither CPU can proceed. */ + g_assert(!wi->bql); if (has_bql) { qemu_mutex_unlock_iothread(); } @@ -349,12 +368,22 @@ static void process_queued_cpu_work_locked(CPUState *cpu) qemu_mutex_lock_iothread(); } } else { - if (has_bql) { - wi->func(cpu, wi->data); + if (wi->bql) { + if (has_bql) { + wi->func(cpu, wi->data); + } else { + qemu_mutex_lock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_unlock_iothread(); + } } else { - qemu_mutex_lock_iothread(); - wi->func(cpu, wi->data); - qemu_mutex_unlock_iothread(); + if (has_bql) { + qemu_mutex_unlock_iothread(); + wi->func(cpu, wi->data); + qemu_mutex_lock_iothread(); + } else { + wi->func(cpu, wi->data); + } } } cpu_mutex_lock(cpu); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 8478628fdb..b061618666 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -889,9 +889,23 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); * @data: Data to pass to the function. * * Schedules the function @func for execution on the vCPU @cpu asynchronously. + * See also: async_run_on_cpu_no_bql() */ void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data); +/** + * async_run_on_cpu_no_bql: + * @cpu: The vCPU to run on. + * @func: The function to be executed. + * @data: Data to pass to the function. + * + * Schedules the function @func for execution on the vCPU @cpu asynchronously. + * This function is run outside the BQL. + * See also: async_run_on_cpu() + */ +void async_run_on_cpu_no_bql(CPUState *cpu, run_on_cpu_func func, + run_on_cpu_data data); + /** * async_safe_run_on_cpu: * @cpu: The vCPU to run on. From patchwork Thu May 21 16:40:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 11563637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 189461391 for ; Thu, 21 May 2020 17:26:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C15A72072C for ; Thu, 21 May 2020 17:26:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Zuhg0Qro" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C15A72072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jboxr-0003LD-Mq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 May 2020 13:26:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJU-0005Bk-Kp for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:56 -0400 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:45014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJT-00070A-9a for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:56 -0400 Received: by mail-qk1-x742.google.com with SMTP id b6so7816260qkh.11 for ; Thu, 21 May 2020 09:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Un0q+TORCXPo2kVgpbtgd18wfbS4+otCPFQoRusR5X8=; b=Zuhg0QrosnDSJQQxuQjaE/0Eu0Js7LvHll0Nvbo2CnQtqJVgS+XrY6NeZ7LnkEqn48 T+zYdv2JQVHfhRdFU28o9OsIloC3ngptnf8RMaWErOGe4W9kF4y7Qx7vEcjiKwdGC29T jGhVIo6VQRIuMRcLHUVaMlBU6cxWMlgKfOG4E2Bj0PJd1NFQbUziCU02+IsapsMZhVny O2RESxqHKCLGIShZNIPbvlGwfgTNzJFubrWvZV8/oyIJDPQXBtpVWGLRC0NZDxqxAJuM NIHb+7PqRHhbxm46gw0Nbnl87ZbVQ9gdVkxvp35bk5ZQkvNDQa5dNUhy31L5pSxNVNYN UzLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Un0q+TORCXPo2kVgpbtgd18wfbS4+otCPFQoRusR5X8=; b=T0v23/QoqMWsQB0WuhBgmc6jddcEU19q1lrQFlHUX/ccNJzldD0aK6GNuNaX5QdMVj XcYTC+bVkF6xmQuPdFu1TR6vCNwJw3RiKlJPKC7OHHxey79Qp19SfsVLbaaiKHOHMH4L n0CNkyEBCcbX9jijZLJkcucxQCEzUsDz2xMtYYQtfq9MpFHuzibN/GxQ9ADCC99ES2GY saP2K3DC4VGsHYecuaE7XvvQ5qOrsc28rfpsUaEV2bc5E5X0tsq/rWDn7p6pvx1IgBhh 0sG4UjiWxBpm3ZsySSU9Qmd/Wd5xBYETjr4oKGweG5MWNrAi6GHKYZod+O2Ieus0+X14 oohA== X-Gm-Message-State: AOAM5331HJKBjXpP2iY0Q4HoIJbGwxbcqJv7p3PFrRU3Ah5M3yQU+Zn5 z8WXjBHAAiJF19FJYY3VEPszxDe49U158g== X-Google-Smtp-Source: ABdhPJzMblJhAhzoYHS5DfaBinSuUyW+zVxNd3v3lVSB1hOavCWX4tXZAOwexRuTdCuRP+tE4cWLqQ== X-Received: by 2002:a05:620a:1524:: with SMTP id n4mr10997938qkk.490.1590079493846; Thu, 21 May 2020 09:44:53 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:53 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 74/74] cputlb: queue async flush jobs without the BQL Date: Thu, 21 May 2020 12:40:11 -0400 Message-Id: <20200521164011.638-75-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::742; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x742.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This yields sizable scalability improvements, as the below results show. Host: Two Intel Xeon Silver 4114 10-core CPUs at 2.20 GHz VM: Ubuntu 18.04 ppc64 Speedup vs a single thread for kernel build                                                                                                     7 +-----------------------------------------------------------------------+       |         +          +         +         +         +          +         |       |                                    ###########       baseline ******* |       |                               #####           ####   cpu lock ####### |       |                             ##                    ####                |     6 |-+                         ##                          ##            +-|       |                         ##                              ####          |       |                       ##                                    ###       |       |                     ##        *****                            #      |       |                   ##      ****     ***                          #     |       |                 ##     ***            *                               |     5 |-+             ##    ***                ****                         +-|       |              #  ****                       **                         |       |             # **                             **                       |       |             #*                                 **                     |       |          #*                                          **               |       |         #*                                             *              |       |         #                                               ******        |       |        #                                                      **      |       |       #                                                         *     |     3 |-+     #                                                             +-|       |      #                                                                |       |      #                                                                |       |     #                                                                 |       |     #                                                                 |     2 |-+  #                                                                +-|       |    #                                                                  |       |   #                                                                   |       |   #                                                                   |       |  #                                                                    |       |  #      +          +         +         +         +          +         |     1 +-----------------------------------------------------------------------+       0         5          10        15        20        25         30        35                                      Guest vCPUs   Pictures are also here: https://drive.google.com/file/d/1ASg5XyP9hNfN9VysXC3qe5s9QSJlwFAt/view?usp=sharing Some notes: - baseline corresponds to the commit before this series - cpu-lock is this series Single-threaded performance is affected very lightly. Results below for debian aarch64 bootup+test for the entire series on an Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz host: - Before: Performance counter stats for 'taskset -c 0 ../img/aarch64/die.sh' (10 runs): 7269.033478 task-clock (msec) # 0.998 CPUs utilized ( +- 0.06% ) 30,659,870,302 cycles # 4.218 GHz ( +- 0.06% ) 54,790,540,051 instructions # 1.79 insns per cycle ( +- 0.05% ) 9,796,441,380 branches # 1347.695 M/sec ( +- 0.05% ) 165,132,201 branch-misses # 1.69% of all branches ( +- 0.12% ) 7.287011656 seconds time elapsed ( +- 0.10% ) - After: 7375.924053 task-clock (msec) # 0.998 CPUs utilized ( +- 0.13% ) 31,107,548,846 cycles # 4.217 GHz ( +- 0.12% ) 55,355,668,947 instructions # 1.78 insns per cycle ( +- 0.05% ) 9,929,917,664 branches # 1346.261 M/sec ( +- 0.04% ) 166,547,442 branch-misses # 1.68% of all branches ( +- 0.09% ) 7.389068145 seconds time elapsed ( +- 0.13% ) That is, a 1.37% slowdown. Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Tested-by: Alex Bennée Signed-off-by: Emilio G. Cota [Updated the speedup chart results for re-based series.] Signed-off-by: Robert Foley --- accel/tcg/cputlb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index eb2cf9de5e..50bc76fb61 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -284,7 +284,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); } } } @@ -352,8 +352,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)); } @@ -547,7 +547,7 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, uint16_t idxmap) * we can stuff idxmap into the low TARGET_PAGE_BITS, avoid * allocating memory for this operation. */ - async_run_on_cpu(cpu, tlb_flush_page_by_mmuidx_async_1, + async_run_on_cpu_no_bql(cpu, tlb_flush_page_by_mmuidx_async_1, RUN_ON_CPU_TARGET_PTR(addr | idxmap)); } else { TLBFlushPageByMMUIdxData *d = g_new(TLBFlushPageByMMUIdxData, 1); @@ -555,7 +555,7 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, uint16_t idxmap) /* Otherwise allocate a structure, freed by the worker. */ d->addr = addr; d->idxmap = idxmap; - async_run_on_cpu(cpu, tlb_flush_page_by_mmuidx_async_2, + async_run_on_cpu_no_bql(cpu, tlb_flush_page_by_mmuidx_async_2, RUN_ON_CPU_HOST_PTR(d)); } }