From nobody Fri Nov 14 22:02:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1760383184; cv=none; d=zohomail.com; s=zohoarc; b=Sqdihh4A0aUbZySzD3T5Mc4lnBOcwvUcaIyjrFxFeoGYqxh1wAJbeb4gSS+H3v8/XxbVi/Dth0eKdnYP1YSI2JWfikxgCw+mTs/DAxk7K0r12bO9X464VaJhkmFtHBIJTGqZdz0CX0r7Zp/eKWVAJoD2V0fvI7pb1s5yyJxqXuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760383184; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=Z3OmPpMLr5a1yvZb58CoYa8yVy1NYMyFvJnwaus/3Ok=; b=BwY04cdcaoLdwucGHH3MRwJpPn8D7ORcFB6KIPIq5nRNVmKGTGtN9T2Nzu9R3Ph3Yc62tQVozbgfoMyRgufnkbFCcppa+OofoI5bLXJXBrjSIot7t0WaZZwckNwpaU0cNRVTZQwzKaVWaAUfnR6nTbgzjqvf0khSAGDZtutfQTg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176038318435650.21694122403983; Mon, 13 Oct 2025 12:19:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v8O4Z-0007Wu-6K; Mon, 13 Oct 2025 15:19:07 -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 1v8O4X-0007K6-7d for qemu-devel@nongnu.org; Mon, 13 Oct 2025 15:19:05 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1v8O4U-0001uJ-Pi for qemu-devel@nongnu.org; Mon, 13 Oct 2025 15:19:04 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3ee12332f3dso2784166f8f.2 for ; Mon, 13 Oct 2025 12:19:02 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-426ce583424sm19444347f8f.21.2025.10.13.12.18.59 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Oct 2025 12:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1760383140; x=1760987940; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Z3OmPpMLr5a1yvZb58CoYa8yVy1NYMyFvJnwaus/3Ok=; b=kYB2UAa9Ab13jkeGKUF/Shwsb5kDZ3NVxPndqdLQeClnLLBkHmOdCx6jrAG/iffAp6 KdCiB3goD4tDRu/zsfZtOliPuZlV+km4qeEQeyGj5eKevpU4LX7g/b+el3fq7rGAuE/r UZe9+F1NzRNVpqrMT7puHwZlLd0CcU5xXZsyLKIAEojBvkKm5c3caSKJMObmTe9asD6h ti62QcX1B+UGdnNefHkCdJG1c/cMENvknOfSf46GyrnZBLsWEXZChAXoc1WTbVZdB6kl Gekm30zWGZiQZEChDSsUhg8JuMf5+idBpUBoiDtrRC+WAybpDfNXZZeNPC9MM4m0kVtp Mjfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760383140; x=1760987940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z3OmPpMLr5a1yvZb58CoYa8yVy1NYMyFvJnwaus/3Ok=; b=T5Ms+08jEfNcKgtinsalzJ854mMlrNyJFlMX+xfAPcUb+wpnU/EH4B1DPtHnDXCd8y lvalBS6d9Ao8eqHsiASpjvw3CfdM2NL1MZukdIZguERu5BVKJ7cpK7BygIunFu5YOGVL 8Q1WW7HOrlYVM0TC5o2N7NznOgldVUHj33pmA6BhVbuVy7ljtfTefDW9IYrl1SetgxHN SCq19nBqC3juU92LOVxsuJFMNnjWS6LAOnFI539UDasP6UGQAGL2OyvTvWYwQqmYZvKl ShG9A7hbK93i5H17yUWOqrMz6AkrvXfh/9W4x2doOTMEL2uieZaivZdya5zd3QIbnfJ+ eJyQ== X-Gm-Message-State: AOJu0Yzq4QKVScnADvwHR2ZV5BBY7c46BdjEactlmmUkWjYB4XwApVy8 x3dHS1e5IPagCq1LuQExlKrY06qAptYwtmB4FiaGQ9HlxMCtbCBmMSnNYx8VLW6AlKao035G+cZ QQhd8cnxu4A== X-Gm-Gg: ASbGncsRZymElWDqZ+YDswyCgCg99pKuKv5IaQoS+vdzHBhVcSqCMOOkbOapGWamC+e YLqB6mSSos9TE5d5PV43S2OzAlHTcoS4YQ2f7SE/MuG0tGgN/flW485ej4fSbhDg5eMCrAqM2c/ l+M+7H0b0i5BQj2/I7uiz4deXg9C5ag6dZcvTO0HZBLlDAVt3TYKx0atTS0CdEKTl+UJBWj3BUo sw1gOkGgSjv+ngJM4JYY76efCFSWvkXzjNABelNDcT3nqczCf4R/MamsxRP5IfG31GpBE/GXbDp vQfR5qq4D2YtdQl4noqqyZfbH8pwMcgIaZ8bIezSSQWkh8+QyWRqBnh6ZDTLe8+o+2g3+xWqGpZ OY4jhX367hHxSKFXAIvqqjXSoGQye6bwIaLfxj/+yJ33I06t/APY2EwXeh0KcjkfikWubPSDeDM YYvfRcw8lNJtQVo/5DnfU= X-Google-Smtp-Source: AGHT+IHAxGuD9lYVfM5Ei4GyR/TO2HxvXtPOe/VG9qVDgyQm5Wd4eLiE+VUH3kwBdHnm/GOZVstxFA== X-Received: by 2002:a05:6000:230e:b0:3ea:5f76:3f7a with SMTP id ffacd0b85a97d-4266e7d6b9bmr14846273f8f.22.1760383140477; Mon, 13 Oct 2025 12:19:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 11/12] hw/hppa: Factor QOM HPPA_COMMON_MACHINE out Date: Mon, 13 Oct 2025 21:18:06 +0200 Message-ID: <20251013191807.84550-12-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013191807.84550-1-philmd@linaro.org> References: <20251013191807.84550-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1760383186400154100 B160L and C3700 share a lot of common code. Factor it out as an abstract HPPA_COMMON_MACHINE QOM parent. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20251009143106.22724-4-philmd@linaro.org> --- hw/hppa/machine.c | 61 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 2ab5fcb471a..c8da159a114 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -36,6 +36,13 @@ #include "net/net.h" #include "qemu/log.h" =20 +#define TYPE_HPPA_COMMON_MACHINE MACHINE_TYPE_NAME("hppa-common") +OBJECT_DECLARE_SIMPLE_TYPE(HppaMachineState, HPPA_COMMON_MACHINE) + +struct HppaMachineState { + MachineState parent_obj; +}; + #define MIN_SEABIOS_HPPA_VERSION 12 /* require at least this fw version */ =20 #define HPA_POWER_BUTTON (FIRMWARE_END - 0x10) @@ -683,6 +690,22 @@ static void hppa_nmi(NMIState *n, int cpu_index, Error= **errp) } } =20 +static void hppa_machine_common_class_init(ObjectClass *oc, const void *da= ta) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + NMIClass *nc =3D NMI_CLASS(oc); + + mc->reset =3D hppa_machine_reset; + mc->block_default_type =3D IF_SCSI; + mc->default_cpus =3D 1; + mc->max_cpus =3D HPPA_MAX_CPUS; + mc->default_boot_order =3D "cd"; + mc->default_ram_id =3D "ram"; + mc->default_nic =3D "tulip"; + + nc->nmi_monitor_handler =3D hppa_nmi; +} + static void HP_B160L_machine_init_class_init(ObjectClass *oc, const void *= data) { static const char * const valid_cpu_types[] =3D { @@ -690,23 +713,13 @@ static void HP_B160L_machine_init_class_init(ObjectCl= ass *oc, const void *data) NULL }; MachineClass *mc =3D MACHINE_CLASS(oc); - NMIClass *nc =3D NMI_CLASS(oc); =20 mc->desc =3D "HP B160L workstation"; mc->default_cpu_type =3D TYPE_HPPA_CPU; mc->valid_cpu_types =3D valid_cpu_types; mc->init =3D machine_HP_B160L_init; - mc->reset =3D hppa_machine_reset; - mc->block_default_type =3D IF_SCSI; - mc->max_cpus =3D HPPA_MAX_CPUS; - mc->default_cpus =3D 1; mc->is_default =3D true; mc->default_ram_size =3D 512 * MiB; - mc->default_boot_order =3D "cd"; - mc->default_ram_id =3D "ram"; - mc->default_nic =3D "tulip"; - - nc->nmi_monitor_handler =3D hppa_nmi; } =20 static void HP_C3700_machine_init_class_init(ObjectClass *oc, const void *= data) @@ -716,42 +729,34 @@ static void HP_C3700_machine_init_class_init(ObjectCl= ass *oc, const void *data) NULL }; MachineClass *mc =3D MACHINE_CLASS(oc); - NMIClass *nc =3D NMI_CLASS(oc); =20 mc->desc =3D "HP C3700 workstation"; mc->default_cpu_type =3D TYPE_HPPA64_CPU; mc->valid_cpu_types =3D valid_cpu_types; mc->init =3D machine_HP_C3700_init; - mc->reset =3D hppa_machine_reset; - mc->block_default_type =3D IF_SCSI; mc->max_cpus =3D HPPA_MAX_CPUS; - mc->default_cpus =3D 1; - mc->is_default =3D false; mc->default_ram_size =3D 1024 * MiB; - mc->default_boot_order =3D "cd"; - mc->default_ram_id =3D "ram"; - mc->default_nic =3D "tulip"; - - nc->nmi_monitor_handler =3D hppa_nmi; } =20 static const TypeInfo hppa_machine_types[] =3D { { - .name =3D MACHINE_TYPE_NAME("B160L"), - .parent =3D TYPE_MACHINE, - .class_init =3D HP_B160L_machine_init_class_init, + .name =3D TYPE_HPPA_COMMON_MACHINE, + .parent =3D TYPE_MACHINE, + .instance_size =3D sizeof(HppaMachineState), + .class_init =3D hppa_machine_common_class_init, + .abstract =3D true, .interfaces =3D (const InterfaceInfo[]) { { TYPE_NMI }, { } }, + }, { + .name =3D MACHINE_TYPE_NAME("B160L"), + .parent =3D TYPE_HPPA_COMMON_MACHINE, + .class_init =3D HP_B160L_machine_init_class_init, }, { .name =3D MACHINE_TYPE_NAME("C3700"), - .parent =3D TYPE_MACHINE, + .parent =3D TYPE_HPPA_COMMON_MACHINE, .class_init =3D HP_C3700_machine_init_class_init, - .interfaces =3D (const InterfaceInfo[]) { - { TYPE_NMI }, - { } - }, }, }; =20 --=20 2.51.0