From patchwork Thu Sep 16 15:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 512939 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1323718jao; Thu, 16 Sep 2021 08:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCXivmrYOqyIun+33rNFRJa8RlIKokkGjDUDcyLf3vswH2l4JhsozTUiTBCfueD0XNLDKY X-Received: by 2002:ac8:744e:: with SMTP id h14mr5654243qtr.252.1631806361534; Thu, 16 Sep 2021 08:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806361; cv=none; d=google.com; s=arc-20160816; b=d7wc0gWmOLkYTilKexvp05ODTaSqP/LnQPob5H37oVlK+t0Uy07yPgUSjCe8ZMphLH 54j7oAiTezarUHkaI1qjPZF4BM5D/VMgO/21UD8AMo25U+9pfDDK1prTT3ODLwzmyLAB mV/Nh3XJTO5HNH+CaEz6f/CHRnQwjL2+titaGO1oPf7GEuSU5N+1b1xGWCR4V3ABW8o2 JQ+4WX5ZNVbmJ3498csiNLs+P+NCRgwiC0S5magjtL876/y+xPtgMszPC+rzIDDkiifK MvFw1t1qo3nuU0Ap5DvEVFsv36nXhIIAvTD/ROIgUGaUYK4daR503Gyn7iO7XnhBb0MT jkTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+2Hxp80Fi+o3vSY5VLA0rrEE2x+zxZah+yk4DEWnBqQ=; b=g3zkZFC+mtNYNsQ7QDXO4huWMYw36RYMkz0zc9opl332dpDenajbcbrLNMi/Gyqp5Q kOBV+j7BVJI9NdLneH7iupjUsoD7aXYTHwSdIvAixbK/qspyp5rM3cvky6Ll/25heZIQ vqQ3hDll2LSdC2AzKG57UARnJmAN75bd/zUVWIgGusgSapxueXaZ01APCep2FtJqf94q /J++337dFzKG4QM54mzOMKUPjIEU1UhxUx9gi5Pi3IL4wIjwtwqUqKHKDppdsSI897Gc 9v+SaRdRsAbn46jxz6PUIe/xL/H4iUIIpdFYJTRwrgwlX0qaCFsLp/fYe62joxEW7X6j 1/Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n/bBt6Fq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x2si1865639qtf.280.2021.09.16.08.32.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Sep 2021 08:32:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n/bBt6Fq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQtNQ-0002Be-Vj for patch@linaro.org; Thu, 16 Sep 2021 11:32:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQtLR-0001HI-50 for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:30:37 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:41872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQtLO-0002Pn-2q for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:30:36 -0400 Received: by mail-pg1-x531.google.com with SMTP id k24so6474200pgh.8 for ; Thu, 16 Sep 2021 08:30: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=+2Hxp80Fi+o3vSY5VLA0rrEE2x+zxZah+yk4DEWnBqQ=; b=n/bBt6FqUP/oIaWoyfHhqzVjfad66TEbRLTvpe+XZkQLJTJ7j5SzOzmEnu8ALBzD5V Bys7O3m04CaI4NWXab0TNlJepZsPngHhFjlx9kFp3qQlQoFwGEjrfVyp58IAQhBvBGUh kS/IdG1PkKU5WtI9rw6lPYg5XW1QQ1Z4hRxEkr7S9Oqh0JABKhT0o/3ah71sI0ybgfhk fAqA9pw5mk5rbpo/bJSH2adNA9vhA5mkboJoh2qCplU6E7Yq+uGM6vtslDIpNOdacdcC lj2WMIpn0/S9woDbB5gFg/rpCGPrRfV3CaMhIyBdCK1f/lAXGmU7MbREnA35HVDr3r71 MqXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+2Hxp80Fi+o3vSY5VLA0rrEE2x+zxZah+yk4DEWnBqQ=; b=0dMmh45NrPMZajNlTj0VtqvCd8J2ea1qShvVlCoqi9RJHuqNTCS9UO9DnlfsV8UP/q 37dKkIUq1TbUq0PCStDD9LnlloDxTsV6GH0UrtiKyBZsaMAdpmcGXW86fEWNnHpO0lUa 2zBRk5dlDv0sXw5l4EfOT0YUlE8DOld4iCBylpGgnmx8+/0qCOp8au3gH+sazdYM4JfI vCmQTnCyKIyuRF+iA+nz288nWvYLFYsn9zSVeyvb7Zvwd/vGRZ3N5tqc4hq1agzBy24M G1Ay9FPpAEGFxmBby/AGnB6kHO8ljpGVkiizUQ8tgAtvZoOYd6leW960h/UoKtYWyiVF TWFQ== X-Gm-Message-State: AOAM5326OUVCTsOL34kLJmQNOuEsBiWwebggrl92m4MZhXWx4/ACZIoK syclJ73XZSw79eIt4NwdjnV1FMcRRpp94g== X-Received: by 2002:a62:4e0f:0:b0:3ee:668d:b841 with SMTP id c15-20020a624e0f000000b003ee668db841mr6122077pfb.48.1631806231697; Thu, 16 Sep 2021 08:30:31 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id b7sm3779447pgs.64.2021.09.16.08.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 08:30:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/35] accel/tcg: Implement AccelOpsClass::has_work() as stub Date: Thu, 16 Sep 2021 08:29:58 -0700 Message-Id: <20210916153025.1944763-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210916153025.1944763-1-richard.henderson@linaro.org> References: <20210916153025.1944763-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Add TCG target-specific has_work() handler in TCGCPUOps, and add tcg_cpu_has_work() as AccelOpsClass has_work() implementation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210912172731.789788-8-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/tcg-cpu-ops.h | 4 ++++ accel/tcg/tcg-accel-ops.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) -- 2.25.1 diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 55123cb4d2..4a4c4053e3 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -66,6 +66,10 @@ struct TCGCPUOps { void (*do_interrupt)(CPUState *cpu); #endif /* !CONFIG_USER_ONLY || !TARGET_I386 */ #ifdef CONFIG_SOFTMMU + /** + * @has_work: Callback for checking if there is work to do. + */ + bool (*has_work)(CPUState *cpu); /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */ bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request); /** diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 1a8e8390bd..ed4ebe735f 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -32,6 +32,7 @@ #include "qemu/main-loop.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "hw/core/tcg-cpu-ops.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h" @@ -73,6 +74,16 @@ int tcg_cpus_exec(CPUState *cpu) return ret; } +static bool tcg_cpu_has_work(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + if (!cc->tcg_ops->has_work) { + return false; + } + return cc->tcg_ops->has_work(cpu); +} + /* mask must never be zero, except for A20 change call */ void tcg_handle_interrupt(CPUState *cpu, int mask) { @@ -108,6 +119,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops) ops->kick_vcpu_thread = rr_kick_vcpu_thread; ops->handle_interrupt = tcg_handle_interrupt; } + ops->has_work = tcg_cpu_has_work; } static void tcg_accel_ops_class_init(ObjectClass *oc, void *data)