From patchwork Thu Jan 30 11:26:15 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: 860854 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp100962wrr; Thu, 30 Jan 2025 03:27:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXSjEpCVxeDBgDtzWK/VJg3XFfgmh5BMM8OwNM26hAX3n6RQ+bxcLC6a86fVbFZCFMqopmYoA==@linaro.org X-Google-Smtp-Source: AGHT+IHb5wiC0InJPSsnpLC9Jm2isgPxTiRSScuVJyl82yYFmvq8tOebognPSkFv/GXMxMqd0jQP X-Received: by 2002:a05:622a:608a:b0:463:648d:32 with SMTP id d75a77b69052e-46fd0906d71mr91971611cf.0.1738236459941; Thu, 30 Jan 2025 03:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738236459; cv=none; d=google.com; s=arc-20240605; b=UbhkhDVKIJV/INSeIJyvH8O5MfOBm8N+FI6N+VX5GCpWsT8113OhRopSeJMBDwT3i3 oooq5OtqkGyPb5GBWxtPALhOyr+QM7NgEMQo9Srf/5MnrWTOf4HrVU21AnLpwlM3/EwE +mTtEQxBMEJ2nXv86FpKJGP8hdJHFbyBliV6upsoS8JFE++U+IQNS8+g5wcKH6HD67f/ BfZ5nyiNJRvd6jMe1H6eUXnMEo/rgDb+p/aUaGGzvOmGBInKbhBeNjcAjU4aIsdNpL9y nJfUjWCbGj7ERjIDD7Yi9ztAa4cOUzQFCILUNDdM4v1ipIzwSx9MVmmMr56HALKxKaWw dp0A== 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=xSaUbuyfnLvYbO/DID0qsOMcuNsSrGpZQtfLQrK9hjI=; fh=wXYnM2Xe6CLi/jjNhqKsBwYc7XquNHKu73845APGzhA=; b=U1v/iMUj6AFsZD5iffMRwfhvtN3R+AaDc9dqP0xERQAxciI1BAj0/7JGj9jqciV97m Ht4W0DKOS+SleQqhmysc99lqpOW+j9J5K1ymXtFOXDUQ6+MZpiJZxJMG974Zfj3Yb3tD Pi1Esqtsj9St0xTSFE5NmtLCL4wb6e9sJPOg1YUiZpEDy/u3+333lRZ+pykdBPW6N7Se cKPU6bIKBfsigwKXqrkPpqCIP3RI56eoQ+ecTDkeH/v3LWML5qAkzh63Ke+vH0v38Ryf blKO2zylejojBJux3rW4aKyxHAfMfF1fYtRvFMIhwV/ZIb5AOT3Hroktqo2gHG1+fGux aRJw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GNjXzhqS; 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-46fdf1ba329si14503051cf.265.2025.01.30.03.27.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Jan 2025 03:27:39 -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=GNjXzhqS; 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 1tdSh9-0001ZA-4L; Thu, 30 Jan 2025 06:26:51 -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 1tdSh7-0001Yh-Dj for qemu-devel@nongnu.org; Thu, 30 Jan 2025 06:26:49 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tdSh5-0001kz-NX for qemu-devel@nongnu.org; Thu, 30 Jan 2025 06:26:49 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4361f664af5so7699745e9.1 for ; Thu, 30 Jan 2025 03:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738236406; x=1738841206; 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=xSaUbuyfnLvYbO/DID0qsOMcuNsSrGpZQtfLQrK9hjI=; b=GNjXzhqS6ZHMXEjVLrHGwoKsGY2QVYa5c+KZwACyCMuO+dLMkENBlEl0ts7HkkqneE JTaFA10JniLOGOBD3/0uuhE9h1ZTL+cIYgErh+3JQ9q/ybRh2lxlWoccZQDlQU6OCUBH H+gjRoIzi53a7Qy5UvYASVP+/K63faVu9IXTKWAxwKc5j/cz1kHUbaOsS07SPU1AoleH c4cvC6yUNQb+0HKf3KG9NJF7Ijhivxbp7a3V37FbU4/pY+NqDr6jYfFZuNRgDwIO49Dn f8GbxfEIIksa351W7ygTCTBKsuWfI9pvr6tqJZCEIvSLR1idZmfB4reFQSpH/6OpKvta 10+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738236406; x=1738841206; 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=xSaUbuyfnLvYbO/DID0qsOMcuNsSrGpZQtfLQrK9hjI=; b=DQZNfOmz/GzY+ly1ig4r2Sk05aXlbNrZ8VCwt+DxLBx4FevAj2IihsKUKWASbU5ggW OUPKLB+oQGkZAkkGr1nEfHHv7VFVIuHPYiTPnIv0b1zt4dO/KRH6zX2yL78m9tuQsaO/ gULM04E19F4/WokN70pVmh4y7Uc1M4juVlGaPM+iRX/TqsCoGHXUzsmYrHiCCO9rr4ZH PGjGVzxj1DRz6OFRI0d+3J8/gjD/Q0zt2oCedQAzsoNWtjD6HHuqozx4LKzCJQ46goMi L2ehRepze7Ym4nRykrI60qsHnzY0CVuZS/9Lfnyix9l+sCYy6tinwKDurH5wHh2zT0dI Sd+g== X-Gm-Message-State: AOJu0Yx+bGQP3rCLdqjZ5lw4DDxERiU5NboMHSB9WDq7krT0EVnVq5gr hSeG328mYdVlwu8ZkobOPsA9xwpkvZLJ78CtwlQ56qJwi20DPSKj2OdLa5NfcrT53srw0Gq/sE3 5Xxs= X-Gm-Gg: ASbGncvendZYRg4SqW9zldjMjOeCCAyi7Lucpa2KeQlnpALJaobMtpc5BCk7wEpHTzf be2Pw5d3ZgZGjXrWW7V4NFrMGdDfIX3aupPDsg0GrZL+ejpcRivuCFq+3lTutZY4vVZBrJxTcV5 67p9A9QJnZk5L3amqs15vIQOaHpuWETcnNZSinYV6QWSLjb6b/SS0Ma2HTR9UWQXNxJyu4IgA81 h9sUvNRONZgbUvAoAitJ1m5PXAiNT+PRjriiGqzRPZWB5VlWDYza+Mjg967k98K6t0K8231l3+B yDqMRVyUOSgAq/5WgxmXGqGygzkw3ze907UEiENqTW/bcT0E/+gmW6l9uUglmnuX5w== X-Received: by 2002:a05:6000:1788:b0:386:459f:67e0 with SMTP id ffacd0b85a97d-38c5194d438mr6926474f8f.21.1738236405652; Thu, 30 Jan 2025 03:26:45 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c5c1b57c1sm1694529f8f.75.2025.01.30.03.26.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Jan 2025 03:26:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PATCH v2 6/6] hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro Date: Thu, 30 Jan 2025 12:26:15 +0100 Message-ID: <20250130112615.3219-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250130112615.3219-1-philmd@linaro.org> References: <20250130112615.3219-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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=unavailable 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 When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater --- hw/cpu/a15mpcore.c | 21 +++++++++------------ hw/cpu/a9mpcore.c | 21 +++++++++------------ hw/cpu/arm11mpcore.c | 21 +++++++++------------ hw/cpu/realview_mpcore.c | 21 +++++++++------------ 4 files changed, 36 insertions(+), 48 deletions(-) diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index 3b0897e54ee..d24ab0a6ab2 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -164,17 +164,14 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data) /* We currently have no saveable state */ } -static const TypeInfo a15mp_priv_info = { - .name = TYPE_A15MPCORE_PRIV, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(A15MPPrivState), - .instance_init = a15mp_priv_initfn, - .class_init = a15mp_priv_class_init, +static const TypeInfo a15mp_types[] = { + { + .name = TYPE_A15MPCORE_PRIV, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(A15MPPrivState), + .instance_init = a15mp_priv_initfn, + .class_init = a15mp_priv_class_init, + }, }; -static void a15mp_register_types(void) -{ - type_register_static(&a15mp_priv_info); -} - -type_init(a15mp_register_types) +DEFINE_TYPES(a15mp_types) diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c index 9671585b5f9..25416c5032b 100644 --- a/hw/cpu/a9mpcore.c +++ b/hw/cpu/a9mpcore.c @@ -177,17 +177,14 @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data) device_class_set_props(dc, a9mp_priv_properties); } -static const TypeInfo a9mp_priv_info = { - .name = TYPE_A9MPCORE_PRIV, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(A9MPPrivState), - .instance_init = a9mp_priv_initfn, - .class_init = a9mp_priv_class_init, +static const TypeInfo a9mp_types[] = { + { + .name = TYPE_A9MPCORE_PRIV, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(A9MPPrivState), + .instance_init = a9mp_priv_initfn, + .class_init = a9mp_priv_class_init, + }, }; -static void a9mp_register_types(void) -{ - type_register_static(&a9mp_priv_info); -} - -type_init(a9mp_register_types) +DEFINE_TYPES(a9mp_types) diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c index 94861a06d94..b56bee6d543 100644 --- a/hw/cpu/arm11mpcore.c +++ b/hw/cpu/arm11mpcore.c @@ -152,17 +152,14 @@ static void mpcore_priv_class_init(ObjectClass *klass, void *data) device_class_set_props(dc, mpcore_priv_properties); } -static const TypeInfo mpcore_priv_info = { - .name = TYPE_ARM11MPCORE_PRIV, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(ARM11MPCorePriveState), - .instance_init = mpcore_priv_initfn, - .class_init = mpcore_priv_class_init, +static const TypeInfo arm11mp_types[] = { + { + .name = TYPE_ARM11MPCORE_PRIV, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(ARM11MPCorePriveState), + .instance_init = mpcore_priv_initfn, + .class_init = mpcore_priv_class_init, + }, }; -static void arm11mpcore_register_types(void) -{ - type_register_static(&mpcore_priv_info); -} - -type_init(arm11mpcore_register_types) +DEFINE_TYPES(arm11mp_types) diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c index 7480b38d1ab..b1408886184 100644 --- a/hw/cpu/realview_mpcore.c +++ b/hw/cpu/realview_mpcore.c @@ -114,17 +114,14 @@ static void mpcore_rirq_class_init(ObjectClass *klass, void *data) dc->realize = realview_mpcore_realize; } -static const TypeInfo mpcore_rirq_info = { - .name = TYPE_REALVIEW_MPCORE_RIRQ, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(mpcore_rirq_state), - .instance_init = mpcore_rirq_init, - .class_init = mpcore_rirq_class_init, +static const TypeInfo realview_mpcore_types[] = { + { + .name = TYPE_REALVIEW_MPCORE_RIRQ, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(mpcore_rirq_state), + .instance_init = mpcore_rirq_init, + .class_init = mpcore_rirq_class_init, + }, }; -static void realview_mpcore_register_types(void) -{ - type_register_static(&mpcore_rirq_info); -} - -type_init(realview_mpcore_register_types) +DEFINE_TYPES(realview_mpcore_types)