From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FE5EC433F5 for ; Fri, 24 Sep 2021 10:19: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 93206610CB for ; Fri, 24 Sep 2021 10:19:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 93206610CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTiIS-0007Qp-QR for qemu-devel@archiver.kernel.org; Fri, 24 Sep 2021 06:19:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mThiU-00088j-12 for qemu-devel@nongnu.org; Fri, 24 Sep 2021 05:42:02 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:46000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mThiS-0008U6-Lj for qemu-devel@nongnu.org; Fri, 24 Sep 2021 05:42:01 -0400 Received: by mail-wr1-x42c.google.com with SMTP id d21so25384457wra.12 for ; Fri, 24 Sep 2021 02:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lsD8NWGZdgfbGQhaRvFJOuKgMHvFJkt23n3sZARQWU8=; b=UwDdJkXdPu+UwIOLG7cF1DpN08NOVjUXh5QxZO3b8BlxRdAye0OJz2hLqKgxw0ZKDG PzPuRnVN0Hcwvs9ZnlPJBOVuyUiE5Wibc1gFbRerxlFnnfoCR6m5gcEaRGIRw6flshnx eKifOQnMKcSSPap9xcmf4wa0TYhT3HsYptzq8553VGvUn4ZHNZlKA4MnxYoP9K5hQV7R lLE/TCBgRrYvCvnP6+FbiCLac7cjuVYnGRwe7QyKDzOhYCfBflTL06U6GT3YPkIwozTj Kp3qDVZS0fvkxnYKCFUI2Ya3nOV56tP3mPcK8INiJEdk+MEH85+SQXa14dlfdHNGLro3 Fycg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lsD8NWGZdgfbGQhaRvFJOuKgMHvFJkt23n3sZARQWU8=; b=vzcRaPNiK+otTAzANYUaKtGYWipPLvqvdMcdoAX2XbKI7eBMzSdnw94jHO6DN1KmOV NvLjoh/Lv0gF2Tpmpo0nRzLTjYYSLuOQzHVM0j2ZPYhZ1o5sAJXlmNJYsRD2YLtmWxJn nWE4imCX0tfQ4sXuIC+6mAJR10Y2rH5Mkw5Jmwe9RY+AMmfE+l8qllV29A8cOVhxA6p6 1MAkSXz7vCMV/pwH7BISY9HLjAdxZW0H92UyIcHMT2V1/Jqymwk/LIx9/65i+XvvKpJg XTXDLPEGY9Idc8UshXkuuE09djfF0wZiq6aaJvuYKei0v5WeEgM5tx8IpdC155BDiWw3 oZTQ== X-Gm-Message-State: AOAM531Y8yTZFk3BEk663Perh7tjC4glbJ1Y33D+ndBDBb59o69JPGUF IQAp3D+WH6YB4AmwFdFuBaH7LYSLhxM= X-Google-Smtp-Source: ABdhPJwRCbd+wpqeirpoZIHuJdD3JA83d7V/aSnH6KC/kwAqhcT7iG/DayNhWUkLO3DFjrX2xrvT/A== X-Received: by 2002:adf:ecd2:: with SMTP id s18mr10164901wro.99.1632476519278; Fri, 24 Sep 2021 02:41:59 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id y7sm5082791wrs.95.2021.09.24.02.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 02:41:58 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v6 40/40] accel/tcg: Simplify tcg_cpu_has_work() Date: Fri, 24 Sep 2021 11:38:47 +0200 Message-Id: <20210924093847.1014331-41-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924093847.1014331-1-f4bug@amsat.org> References: <20210924093847.1014331-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" All TCG targets implement the TCGCPUOps::has_work() handler. We can remove the non-NULL handler check in tcg_cpu_has_work(). Add an assertion in tcg_exec_realizefn() for future TCG targets. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 4 ++++ accel/tcg/tcg-accel-ops.c | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5fd1ed34222..18c20e5759b 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -993,6 +993,10 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp) CPUClass *cc = CPU_GET_CLASS(cpu); if (!tcg_target_initialized) { + /* Mandatory non-NULL handlers */ + g_assert(cc->tcg_ops->initialize); + g_assert(cc->tcg_ops->has_work); + cc->tcg_ops->initialize(); tcg_target_initialized = true; } diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 3c75ed2cccc..6cd32f04cb9 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -78,10 +78,7 @@ static bool tcg_cpu_has_work(CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->tcg_ops->has_work) { - return cc->tcg_ops->has_work(cpu); - } - return false; + return cc->tcg_ops->has_work(cpu); } /* mask must never be zero, except for A20 change call */ -- 2.31.1