From patchwork Thu Apr 17 23:58:14 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: 882121 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp573786wrs; Thu, 17 Apr 2025 17:01:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWazUjIgmyBSJd9VmLeOh6WEL+7+NkzkoqJd9ZlvxUmer/OfIdZSrUFVBG+Rr1auw+jqrPw4A==@linaro.org X-Google-Smtp-Source: AGHT+IFY6ZEw7P1/v0QzL1ARW8nBCpmik3N2OKCMJU6tdB/Vbxut3PHvCHgRCQMph//VCxdj5l6t X-Received: by 2002:a05:6102:3170:b0:4c2:ff6c:6043 with SMTP id ada2fe7eead31-4cb7d9a626emr2119673137.0.1744934519750; Thu, 17 Apr 2025 17:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744934519; cv=none; d=google.com; s=arc-20240605; b=Axy4xT9YNS3TfegA75YG3TlO9kBrkUgFY037+VRtRIkPALX6IZKNwnz+vz9qCoDShV A77Xva20K+rLQYT7e2E7Rg5Ewr9wPGYEi+GwAJEf2etBwlkIz9OUB0MRL6DsxpArxkOD 6KklLItEX3h4mqFTndYBdPpd/eIoGFuPg1SezTCLNKAhU5kgj/YiQ7Wc130ZdQDoyq8Z Zk4s0mMqzk+u6UMdxpEYLK2cIRBwlB+POO+a6hzbnTvz7hpsGGS9F9Kr4GD05dPzhizi bweB51XQFvJxSluMbzhSCkUtCC7FsU6BF+BPKRAtq9GtlsIOfKnV4mhfQjRdI6ixK1M8 tQow== 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=PYqZLGf8zmbZFL30Ike2RIyikST1A7pLxDDWpbB2TD0=; fh=85A14eJQxmox6rRllN7x+op8M8OdlWn4Uar9szblyk8=; b=YVL2leWiDnkaxZI/SLTJstF+qyStkZvj2JZsjtFFJEL3uAbK74kdI8EhIoRN307TnZ ZO6rML3Ihg3JfVYcqm340tXAfOnam+MfDZcWnY4XTWCrGg61LySpojQAGQeKkNfk705D eKickC30wTGlY/8rNuV9pPbXuDbXP+ri4SvMYqE+pz3pQ7YFjqQuINd5sQ2q2wfTEqK+ N8w32r9hwCj+lfcgxSquitj31znPDVwwaqYV1CGA2wGUa0kIBLKEtRJw7i4/pqAz+/4S i7rma/JbvvalNI2qzH1jxNzIcPqqHPtK7KTLhrwVqQjrlx3xWxBUyOAd4macS+csSMdS pnLw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SaKp7Ejg; 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 ada2fe7eead31-4cb7dd3ccf8si422337137.59.2025.04.17.17.01.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Apr 2025 17:01:59 -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=SaKp7Ejg; 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 1u5Z8r-0007jM-RS; Thu, 17 Apr 2025 19:59:38 -0400 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 1u5Z8b-0007Wu-GB for qemu-devel@nongnu.org; Thu, 17 Apr 2025 19:59:23 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u5Z8Y-00043y-Hj for qemu-devel@nongnu.org; Thu, 17 Apr 2025 19:59:21 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43d2d952eb1so9672565e9.1 for ; Thu, 17 Apr 2025 16:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744934356; x=1745539156; 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=PYqZLGf8zmbZFL30Ike2RIyikST1A7pLxDDWpbB2TD0=; b=SaKp7EjgfIqzFtkuNxD4GGT/ezwJwqluK5E621OGUovQ9fmgQH3YHb6U2kP3VEgp37 O+MibXr86Dw0cUU6oTZfobPECTsVTm8OftyhJCvqBRgQyv26DVCs59NGYd/fkRczWtR1 qCGajpb6y2+bedcxWTMda73UuvVPSvCxPMn5Inl69QKXwup8h1DGvHxuHgdoY6uUC+tH otc4LNxdm56xrBsUPu2F5yKd2u4C3/uQAQUEpaZMMtvNT6e12vOL4Q7PVs4lkdCWpEkM mZz6UUXrZGehZvgA1RMKZPBoFZieqTpfKH4WxIzoy2krBJY+eRyN51PdWZOUu8bjiOzu LyBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744934356; x=1745539156; 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=PYqZLGf8zmbZFL30Ike2RIyikST1A7pLxDDWpbB2TD0=; b=MFeCOemOxcrOCVAoEoxmm5ZpiwrDhpYBWp+C2d+3wxvzrQv21/nhV4ZZ3Scc4YQBZg tc+Sfq1zXT9yKlPRjhMmqysoL7Dnk9H9imsRByZOFza84+pyTE/xo9IrQjefkqzOYJfG OuhcveiwkFCOTL3w7TOJVmxSlT3fbGY3aef4rR9JpJ8lEuLMFyDHEvPkUFl1l1zqMAwy UrkE1XMdBtXjv1lKEsemnve9+dx/Ob73C3EJjOED13msVzdmRSfa7xtYVOwn7nGlPg3X YYlOn5hLlxTvBv67+MPbfB+P5HucMzbZUPeHhvVS0p/mH/aEVHfmr5TkSEwVd6zsWHte VaPQ== X-Gm-Message-State: AOJu0YwTz1xje2i56NkEegsWaedWsfS87JQHOzxe+1qiTqojI8EftiXT tB0K3pybypj3fwes4SD6vUh+seRaLb4yW+LkDZTzj5SCPVB7yh5ODFWErVZTDPB7/ewXugOF6sn G X-Gm-Gg: ASbGncvvBfvy8y/lJxovftQ9vWVi/8l++lFYcjqkH49YWzqdE3xlckR1EfTBNQfeJyj BU268GF7FvsIHDVfdKAUbFKig7tKbyWuuoxRKIXwSmudjxvljtsSJLEKQL6PfwPVPxU7V7vsGJK G2Sdibr28l0xqyZUo19Kn98PhyRGhhk9fDSsZsKrx4eCxl2yJUL/ToHjHuhmyNW9wWEAo95sUNz gnNoE//icjmtWtZVLMAveo4uj1HT5BwnW4RPCIyJZNeKvjqe/w0TvKFpjbwC7HStHVKPi7+zSkS iFUo6xQGJUIW18kK5bMBckv66+E5w9//CS/FvDptO6fgThqYaJFUijuvgFUM+PnGNN9RewVu5GR p40whffGZc+f0MBNPyP0c X-Received: by 2002:a05:600c:3107:b0:43d:24d:bbe2 with SMTP id 5b1f17b1804b1-4406ac1ff5bmr3586335e9.28.1744934356424; Thu, 17 Apr 2025 16:59:16 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4406d6dfe4esm808665e9.33.2025.04.17.16.59.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 17 Apr 2025 16:59:15 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrey Smirnov , Antony Pavlov , Zhao Liu , Beniamino Galvani , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Eduardo Habkost , Niek Linnenbank , qemu-arm@nongnu.org, Jean-Christophe Dubois , Felipe Balbi , Bernhard Beschow , Strahinja Jankovic , Jan Kiszka , Alistair Francis , Pierrick Bouvier , Subbaraya Sundeep , Alexandre Iooss , Peter Maydell , Marcel Apfelbaum , Yanan Wang Subject: [PATCH 11/11] hw/arm/stm32: Define machines as generic QOM types Date: Fri, 18 Apr 2025 01:58:14 +0200 Message-ID: <20250417235814.98677-12-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250417235814.98677-1-philmd@linaro.org> References: <20250417235814.98677-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 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, RCVD_IN_XBL=0.375, 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.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 While DEFINE_MACHINE() is a succinct macro, it doesn't allow registering QOM interfaces to the defined machine. Convert to the generic DEFINE_TYPES() in preparation to register interfaces. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/netduino2.c | 13 +++++++++++-- hw/arm/netduinoplus2.c | 13 +++++++++++-- hw/arm/olimex-stm32-h405.c | 13 +++++++++++-- hw/arm/stm32vldiscovery.c | 13 +++++++++++-- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c index df793c77fe1..52c30055d44 100644 --- a/hw/arm/netduino2.c +++ b/hw/arm/netduino2.c @@ -52,12 +52,13 @@ static void netduino2_init(MachineState *machine) 0, FLASH_SIZE); } -static void netduino2_machine_init(MachineClass *mc) +static void netduino2_machine_class_init(ObjectClass *oc, void *data) { static const char * const valid_cpu_types[] = { ARM_CPU_TYPE_NAME("cortex-m3"), NULL }; + MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Netduino 2 Machine (Cortex-M3)"; mc->init = netduino2_init; @@ -65,4 +66,12 @@ static void netduino2_machine_init(MachineClass *mc) mc->ignore_memory_transaction_failures = true; } -DEFINE_MACHINE("netduino2", netduino2_machine_init) +static const TypeInfo netduino_machine_types[] = { + { + .name = MACHINE_TYPE_NAME("netduino2"), + .parent = TYPE_MACHINE, + .class_init = netduino2_machine_class_init, + }, +}; + +DEFINE_TYPES(netduino_machine_types) diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c index 81b6334cf72..2735d3a0e2b 100644 --- a/hw/arm/netduinoplus2.c +++ b/hw/arm/netduinoplus2.c @@ -53,16 +53,25 @@ static void netduinoplus2_init(MachineState *machine) 0, FLASH_SIZE); } -static void netduinoplus2_machine_init(MachineClass *mc) +static void netduinoplus2_machine_class_init(ObjectClass *oc, void *data) { static const char * const valid_cpu_types[] = { ARM_CPU_TYPE_NAME("cortex-m4"), NULL }; + MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Netduino Plus 2 Machine (Cortex-M4)"; mc->init = netduinoplus2_init; mc->valid_cpu_types = valid_cpu_types; } -DEFINE_MACHINE("netduinoplus2", netduinoplus2_machine_init) +static const TypeInfo netduino_machine_types[] = { + { + .name = MACHINE_TYPE_NAME("netduinoplus2"), + .parent = TYPE_MACHINE, + .class_init = netduinoplus2_machine_class_init, + }, +}; + +DEFINE_TYPES(netduino_machine_types) diff --git a/hw/arm/olimex-stm32-h405.c b/hw/arm/olimex-stm32-h405.c index 1f15620f9fd..795218c93cf 100644 --- a/hw/arm/olimex-stm32-h405.c +++ b/hw/arm/olimex-stm32-h405.c @@ -56,12 +56,13 @@ static void olimex_stm32_h405_init(MachineState *machine) 0, FLASH_SIZE); } -static void olimex_stm32_h405_machine_init(MachineClass *mc) +static void olimex_stm32_machine_class_init(ObjectClass *oc, void *data) { static const char * const valid_cpu_types[] = { ARM_CPU_TYPE_NAME("cortex-m4"), NULL }; + MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Olimex STM32-H405 (Cortex-M4)"; mc->init = olimex_stm32_h405_init; @@ -71,4 +72,12 @@ static void olimex_stm32_h405_machine_init(MachineClass *mc) mc->default_ram_size = 0; } -DEFINE_MACHINE("olimex-stm32-h405", olimex_stm32_h405_machine_init) +static const TypeInfo olimex_stm32_machine_types[] = { + { + .name = MACHINE_TYPE_NAME("olimex-stm32-h405"), + .parent = TYPE_MACHINE, + .class_init = olimex_stm32_machine_class_init, + }, +}; + +DEFINE_TYPES(olimex_stm32_machine_types) diff --git a/hw/arm/stm32vldiscovery.c b/hw/arm/stm32vldiscovery.c index e6c1f5b8d7d..3a9728ca719 100644 --- a/hw/arm/stm32vldiscovery.c +++ b/hw/arm/stm32vldiscovery.c @@ -56,16 +56,25 @@ static void stm32vldiscovery_init(MachineState *machine) 0, FLASH_SIZE); } -static void stm32vldiscovery_machine_init(MachineClass *mc) +static void stm32vldiscovery_machine_class_init(ObjectClass *oc, void *data) { static const char * const valid_cpu_types[] = { ARM_CPU_TYPE_NAME("cortex-m3"), NULL }; + MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "ST STM32VLDISCOVERY (Cortex-M3)"; mc->init = stm32vldiscovery_init; mc->valid_cpu_types = valid_cpu_types; } -DEFINE_MACHINE("stm32vldiscovery", stm32vldiscovery_machine_init) +static const TypeInfo stm32vldiscovery_machine_types[] = { + { + .name = MACHINE_TYPE_NAME("stm32vldiscovery"), + .parent = TYPE_MACHINE, + .class_init = stm32vldiscovery_machine_class_init, + }, +}; + +DEFINE_TYPES(stm32vldiscovery_machine_types)