From patchwork Sat Jan 25 16:05:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 859798 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:18c8:b0:385:e875:8a9e with SMTP id w8csp1321594wrq; Sat, 25 Jan 2025 08:12:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXQ2VNTGKo4ENXRB2dT7MZArh+ABVaxoDU8BXbPq0uYdZ15GKCPc/LHnzU6qm/tV/DjaSHteg==@linaro.org X-Google-Smtp-Source: AGHT+IEyaPau0599KUUdes/RvbInwQY/NvNI3gLuAvP3USiYQlq6Vnm++3HO7mXhOJTzHBIrU6wW X-Received: by 2002:a05:6214:1bc7:b0:6d4:586:6292 with SMTP id 6a1803df08f44-6e1b21aea0bmr467001896d6.26.1737821563440; Sat, 25 Jan 2025 08:12:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737821563; cv=none; d=google.com; s=arc-20240605; b=SWteT72uOJb0QbE6pOSCXxaJMhSWCEklQABs4hdOBfRnVusFpAwEJyuG9ZVMIvf45o H6ujpZU2Xv+lmQzIOElDiOpGpSwefGzFWo1yFhf/yNP0xZw/eS0xVIfCXGdbxvrq+gYQ xeKDgkzEdjalJgestLqL8a8gd5xyq8qqsZLgaL7AZZn2VHJxZfoCkKHVjTGPSiQp0lN1 VHjH+Hj00SNaZ19kdroOnUJ21JDJwotM7oEs5cqb9I7qgfC5MZvps/qtXIjtNMlrvDMR V2o2DSwV/gJKoHxl4w39n5avSi9CCBif+jry3n+nY5PlCnkg0hiXJZ062XyMjclFVVRl xMHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=5jEVe+YJcTp7UAkGQALuSFnfsOHF6JbuBlxYoBxiLJI=; fh=ZXDWg7hKG7Hj19AbRuutTLw+Zvn/B9RsGUUw/YagpFI=; b=SmYJcna2a5SaToTEpz4raepfOrvP04jVV8IJ/uU7pjqKjjtz23TyspWph0tugrYMhb d4ezei7BCjZ9AsGtsomZ2fwcHyT/2nwHvd1d5uBiVUryu99khJFjPE8KxCqo2Grwz5iQ fvUrKwlywvk0it3JCwCWq8D3ftwGX7vvosgZFXH3VP85rHcrn75/hTXUqBcZ4iYwZJAc 18XeM6u/NaM+p/X40Vj4PMJ0Yd2OHXRJIizs2KOaQuHLm8iG0ewOPPcgl5dvYsqQI8n7 ReRvDkVexAXsYNa77QhEetyml8xNsuiIK1NTiZVb5bVet6NjrxEQAPG5Esl+hAtVUJiU j0Dg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=emGWG8f+; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e66886c51si57877811cf.158.2025.01.25.08.12.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Jan 2025 08:12:43 -0800 (PST) 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=emGWG8f+; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tbiiM-0006Rw-6n; Sat, 25 Jan 2025 11:08:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tbihT-0005iE-QB for qemu-devel@nongnu.org; Sat, 25 Jan 2025 11:08:02 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tbihQ-0000r4-O0 for qemu-devel@nongnu.org; Sat, 25 Jan 2025 11:07:59 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43622267b2eso31632395e9.0 for ; Sat, 25 Jan 2025 08:07:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737821273; x=1738426073; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5jEVe+YJcTp7UAkGQALuSFnfsOHF6JbuBlxYoBxiLJI=; b=emGWG8f+wSEEV1snF87Hselcan53i0B9UvyG/dkNohGE3oR05W5oqp5z6G+gvVwiN/ TblnoxW1KNLA2Gloe2VjBxj1QJMPHGsG5OuvGVsZ2RCaF1rWUWoz0tkWCHtXkVNZV80v M5j15cFKKJg8CdUpPeUsFIltplN6hJqfVxneabffXF161GhZn0Mt+YgeGJkD3Sae+LsD yfomMMwwz0lJ0/bifvcrXtnvSi47C8sWnDI6IwPquRITo+xDo6phJdPGV9snsCbp62Pv Mf2C/kNqz+rxtK1xthdySyZYWtoGo+HGe6UoOHBDKWPbzV0KK89fBpTE9b6rwPiECTMi DZ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737821273; x=1738426073; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5jEVe+YJcTp7UAkGQALuSFnfsOHF6JbuBlxYoBxiLJI=; b=E1RAHCGGjW2J7D/FEn+MUTbzOTvjulXK7Io4h5L6FS+TBGV8IRx272C73rxewLqKBP 03cFrltuI9o4sriNHHP4+/46cLLmEyn5mvtHBjg84XBPevkjVbmOOe/H2z6ZDXjDVJFd /uxu6TkymfnYHcSK1OPEXQvx/c4Ov7GaqF8oUMr4Xizbhd72eOFtuo8NwCUVRxiWIho2 93sUvJ138XK2mnX0b4KlWXpDuC6r00bX0IQInvaEl0HJhLa9niwjec38aZReTq6M+W81 CNiVN2xTzMkMamZJng76nWh7ugKy3wYv3xFR7NsvOwqS43FiEbYzGzvAXMllEqtgcpAa HLqQ== X-Gm-Message-State: AOJu0YxZN7SlPszphpPvj+2bCYphM/mZV7Sfzq20JM9s/QLrwcLkF74Z 0HVOOWh0wmjA9jZnpkv7vmvDcpzPH4uu8p0h4OCgDYrpzjba7+BhJ9i84zw5Zpa7G67hJ05WTBG YwCk= X-Gm-Gg: ASbGncsfS+/l3i+kBhAlsnnT9vFfWWTgyS+EPUsjryNC2CQ0wSNtM/UnycXcsp+/+ee sTljSwB+R1YZIH6+zZBMSanVTSiNiUvURWV37Qog0xundPMJsy91Bt0EXoLnPyT2lPg0ORh10t7 yCKIRPaicTsfE/1FrrrLW/IiWGHtnpxUTC40a4rBtwmu6/YKRbdUtoacSPYV9rtViAHd//Mv7pK KL19oVJpKXVb4jAE9wc9wLjrdCSQDXKCcaIyi1TZmK0cYRIdYzkYIscaUmcbaHGr61SRiXrmMfX MPw3QdWHTN99nnaHIzPystdYSXd75A3Kj80eDSjX4RM9rk3Lw0ySUAiKDbLq X-Received: by 2002:a05:600c:524c:b0:432:7c08:d0ff with SMTP id 5b1f17b1804b1-4389143768fmr316253995e9.23.1737821273389; Sat, 25 Jan 2025 08:07:53 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd501c38sm63952545e9.11.2025.01.25.08.07.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jan 2025 08:07:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH v2 24/24] cpus: Remove CPUClass::has_work() handler Date: Sat, 25 Jan 2025 17:05:52 +0100 Message-ID: <20250125160552.20546-25-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250125160552.20546-1-philmd@linaro.org> References: <20250125160552.20546-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org All handlers have been converted to SysemuCPUOps::has_work(). Remove CPUClass::has_work along with cpu_common_has_work() and simplify cpu_has_work(), making SysemuCPUOps::has_work handler mandatory. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 2 -- include/hw/core/sysemu-cpu-ops.h | 2 +- cpu-target.c | 4 ++++ hw/core/cpu-common.c | 6 ------ hw/core/cpu-system.c | 7 +------ 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d64c823e768..2bcad4b16bf 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -104,7 +104,6 @@ struct SysemuCPUOps; * 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. * @mmu_index: Callback for choosing softmmu mmu index; * may be used internally by memory_rw_debug without TCG. * @memory_rw_debug: Callback for GDB memory access. @@ -151,7 +150,6 @@ struct CPUClass { ObjectClass *(*class_by_name)(const char *cpu_model); void (*parse_features)(const char *typename, char *str, Error **errp); - bool (*has_work)(CPUState *cpu); int (*mmu_index)(CPUState *cpu, bool ifetch); int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index dee8a62ca98..877892373f9 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -19,7 +19,7 @@ typedef struct SysemuCPUOps { /** * @has_work: Callback for checking if there is work to do. */ - bool (*has_work)(CPUState *cpu); + bool (*has_work)(CPUState *cpu); /* MANDATORY NON-NULL */ /** * @get_memory_mapping: Callback for obtaining the memory mappings. */ diff --git a/cpu-target.c b/cpu-target.c index 98e9e7cc4a1..15aa8afef55 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -217,6 +217,10 @@ void cpu_class_init_props(DeviceClass *dc) { #ifndef CONFIG_USER_ONLY ObjectClass *oc = OBJECT_CLASS(dc); + const CPUClass *cc = CPU_CLASS(OBJECT_CLASS(oc)); + + /* Check mandatory SysemuCPUOps handlers */ + g_assert(cc->sysemu_ops->has_work); /* * We can't use DEFINE_PROP_BOOL in the Property array for this diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 886aa793c04..c933de1416c 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -134,11 +134,6 @@ static void cpu_common_reset_hold(Object *obj, ResetType type) cpu_exec_reset_hold(cpu); } -static bool cpu_common_has_work(CPUState *cs) -{ - return false; -} - ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) { ObjectClass *oc; @@ -304,7 +299,6 @@ static void cpu_common_class_init(ObjectClass *klass, void *data) k->parse_features = cpu_common_parse_features; k->get_arch_id = cpu_common_get_arch_id; - k->has_work = cpu_common_has_work; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; set_bit(DEVICE_CATEGORY_CPU, dc->categories); diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 7b16bda2250..32d09757169 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -25,12 +25,7 @@ bool cpu_has_work(CPUState *cpu) { - if (cpu->cc->sysemu_ops->has_work) { - return cpu->cc->sysemu_ops->has_work(cpu); - } - - g_assert(cpu->cc->has_work); - return cpu->cc->has_work(cpu); + return cpu->cc->sysemu_ops->has_work(cpu); } bool cpu_paging_enabled(const CPUState *cpu)