From patchwork Thu Sep 16 15:29:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 512942 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1326694jao; Thu, 16 Sep 2021 08:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt/+dwPc/NfMJt2EVQNx+o4e6F3c7f86WGgcI/usnnajRx56ffhxH26kOiEuydAZZJqbOV X-Received: by 2002:a05:620a:789:: with SMTP id 9mr5703293qka.400.1631806571305; Thu, 16 Sep 2021 08:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631806571; cv=none; d=google.com; s=arc-20160816; b=AOW02lD0jIUwzU97oDAjCgAz+EWAGlk0fH6Ym+2euWKlCBejlISypIwI3lfOxC2J3m aoadX6/OQXmBgbr6SsWNG1gDVEmwzlduj0sgiqRncInuLh1YN+mrqFNpEpUvPspg+zor g3X3CKJTI1j2Q6wyBwW3IpbGJicYIiab5neKZ5L1tPKE/WQUnnaL5HPj5MkmvkkyZURt 95pXKQfLouE9MCtYAaWcoOWTi7qhIwBrTuz10Ui/Wkgy4jP7LA816RZXvplYw04yCJka U2utATI0RK9aOV4XnK+jgwt38+k6Xs1y6Ec/eZ0WWAI7X84ZJGuGwNyma0XhwHVX/XLe qk1A== 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=kZ2VcPtLko9Bov3EWMO38HipWq5pDjJDr/5HXHOEyEY=; b=icDMZYbUYwzoa+cknGOXBzdmMAdXF+lGm+XfmClzgugh+2d+mQf8UuGEyahdOyY4/O rZVWAHMwYxgNvoBSlouBlf2ERReA1FMLAe8LpyijuH4EGlD/aESGXEndI4344b1rgeXW ZjIFUCXi86HgBf5l+rusOpTilU1gN6ftL9qdY+2aseGOlloDpnckxdHXja20FufwN5FR v5/l3uhjyVy1dTiM2O/R7nFWw2XnxV5+eWxI40aVS7IFgLy7TGmaWzPBhe0dz8Hsx3mI Sqk//IobzW4aPpjNlJZLpImTGklus3fw2jVBQa4p4y+jlxNSAIiPhsbcmHafzCvk9xrF NaUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="U/kmVse9"; 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 u11si1606156qtq.430.2021.09.16.08.36.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Sep 2021 08:36:11 -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="U/kmVse9"; 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]:42068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQtQo-0006ev-QE for patch@linaro.org; Thu, 16 Sep 2021 11:36:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQtLP-0001Dw-54 for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:30:35 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:38472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQtLK-0002O5-W9 for qemu-devel@nongnu.org; Thu, 16 Sep 2021 11:30:32 -0400 Received: by mail-pl1-x62b.google.com with SMTP id 5so4101993plo.5 for ; Thu, 16 Sep 2021 08:30: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=kZ2VcPtLko9Bov3EWMO38HipWq5pDjJDr/5HXHOEyEY=; b=U/kmVse9pnGo3yBBJVKIvJTwXw+EOBLtslNLebgeXsm1WkQFnKo4hMXwNggux30wcq WjLSHaMtnzL72OXhFIeHyAOfxzNXprClw56i88xPU8G7+AlG67ICuOSKpZLlcoDIAA2O UJoDYolq4RL0Aa7SO7cV0R/+YIDOUg/UmnphJzs2Tb1Au4t/mAtTd1AD4vpIXY37mBC0 GDzv9+I8DuIagn8LXnOmtXHfhLxDeQDBwJUnq/nFGgWObNes5AY++j04mYmFA60Bo9s3 4fGu4LtNJ3egwlMjpWs868IHKNpDvXk4CMbjI6ZbWoYVX3fsOP7PrgBQbJmZwNZQiFlZ 8POQ== 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=kZ2VcPtLko9Bov3EWMO38HipWq5pDjJDr/5HXHOEyEY=; b=nn5AjmZ+MgB8EreP0fkuZ5ysDdD8U6KfA2NngyN7zh60pxVdyY+Kvyu6r7VgL4d5o3 TRdS7teVautL5z4Z5EAurJOeVvjnSXzO27OEx99F+tyI0ggAK3cPwy1wzDJeWczzcmS+ 0lgOKj4a0sHb2lqw1lY/22NjNTfyHmoBItRzb9aH9VMVnPEaLasoEbTx+In3aX6fog9+ rquLu9sbb7gxKl4rJYlZYCcNhHMV9XpRZlK4+3KMl2MWpNvup4ckCwF3cwQwCpjZ64QX Zf5VzS/doknuVu23dv4NpaIqKFG3zRmF2/vDOS5xMSGLfSObpLJSqjx8to4LFPEjwQVP mSzg== X-Gm-Message-State: AOAM53223eYCpOmytltAme718tXJ16meTUoP5Rj5deyoDcSpEe06RqZy w1nKwqtGlwCq1GeDb71IjXFNgnK0TlNUcg== X-Received: by 2002:a17:90a:1610:: with SMTP id n16mr15525033pja.59.1631806229600; Thu, 16 Sep 2021 08:30:29 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id b7sm3779447pgs.64.2021.09.16.08.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 08:30:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/35] sysemu: Introduce AccelOpsClass::has_work() Date: Thu, 16 Sep 2021 08:29:55 -0700 Message-Id: <20210916153025.1944763-6-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::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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é Introduce an accelerator-specific has_work() handler. Eventually call it from cpu_has_work(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210912172731.789788-5-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/sysemu/accel-ops.h | 5 +++++ softmmu/cpus.c | 3 +++ 2 files changed, 8 insertions(+) -- 2.25.1 diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index 032f6979d7..de83f095f2 100644 --- a/include/sysemu/accel-ops.h +++ b/include/sysemu/accel-ops.h @@ -31,6 +31,11 @@ struct AccelOpsClass { void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */ void (*kick_vcpu_thread)(CPUState *cpu); + /** + * @has_work: Callback for checking if there is work to do. + */ + bool (*has_work)(CPUState *cpu); + void (*synchronize_post_reset)(CPUState *cpu); void (*synchronize_post_init)(CPUState *cpu); void (*synchronize_state)(CPUState *cpu); diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 7e2cb2c571..2a61dfd628 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -255,6 +255,9 @@ bool cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); + if (cpus_accel->has_work) { + return cpus_accel->has_work(cpu); + } g_assert(cc->has_work); return cc->has_work(cpu); }