From nobody Wed Apr 8 04:39:54 2026 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=reject dis=none) header.from=yodel.dev ARC-Seal: i=1; a=rsa-sha256; t=1773182064; cv=none; d=zohomail.com; s=zohoarc; b=C5I1o0hjMcLCMDOK2ue5hNUxyRxvzUrz0BdQkCzMuUGcp4vqB7UJe0mPxf5tj7RuXPBrScAED4aF62KGcXuksW+erIMWmupSdMjcQKRcGuqe4Grm2HES0+nufju8AYmtoGH0jkdR3fpO+9DJM8/jyOpFAn1tekgoi2/sq92q5EI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773182064; h=Content-Type:Content-Transfer-Encoding:Cc:Cc: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; bh=hQaP5s3ISCv4eAllTXeIOtMsXtpjISci5pifsWQo1QE=; b=JnZUmgrzOFOGgxsWNPSqxDS1zFLNMXMQ9KU+TO43qf8dPuYG/+Oo2Z5dCqyylUsqUjMFbuWZnajhGOC26NCwSOUirTt5X8uKHDJ+wP0GthbSQ1SvTvPK4ZexVGTvTWmaPiOIEt1e5lDewVTX22TJmWmt8omNlGS55twOTAGA4Mw= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773182064750695.5625740786658; Tue, 10 Mar 2026 15:34:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w05d4-0001Jm-Jl; Tue, 10 Mar 2026 18:32:42 -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 1w05cy-0001GW-HT for qemu-devel@nongnu.org; Tue, 10 Mar 2026 18:32:37 -0400 Received: from v512.v5f06b487.use4.send.mailgun.net ([143.55.232.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w05cw-000748-3b for qemu-devel@nongnu.org; Tue, 10 Mar 2026 18:32:36 -0400 Received: from mail.yodel.dev (mail.yodel.dev [35.209.39.246]) by 59befe239210a9067304c1807e217930d26569ebb6d96a1813f799eec60f96ca with SMTP id 69b09bf7257cb0394ecd10f9; Tue, 10 Mar 2026 22:32:23 GMT X-Mailgun-Sid: WyI4ZDFlNiIsInFlbXUtZGV2ZWxAbm9uZ251Lm9yZyIsIjk3NjA3ZSJd X-Mailgun-Sending-Ip: 143.55.232.12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yodel.dev; s=rsa2048; t=1773181942; bh=hQaP5s3ISCv4eAllTXeIOtMsXtpjISci5pifsWQo1QE=; h=X-Mailgun-Dkim:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Developer-Signature:X-Developer-Key:From:Reply-to:Subject:Date: Message-id:To:Cc:Mime-version:Content-type: Content-transfer-encoding:In-reply-to:References; b=LxzinN8gx+LSq+8gkz+8m9XSkP7jNgW5E4kdDLE5jYnIak60AKqhFUblaUmwdLcrn //2sFRV56+MMSn4oHjTIKDXGt1jdf9GW4JG8D41FTO1KpU3WP1DO/Syd/FRFJBXhha gXBvNq145WyuBOVj4NQAq2NyFJmrPWMLf/M5j8QH2Onv2Pob+bTToLMLlkNGmYAHyc JbNeW4A+510RtRFakqux1gLTG2o2+pOOdllxetYaID5KcAMCSDALN4mvUB5/Myqnu0 ithswY4QEZC3xS7MEuM6p1Fkyulu07jk4WQh03L3amIxs9L47BOshDAnw6Lko7qoec +qmnx4fhZQRAQ== X-Mailgun-Dkim: no X-Mailgun-Dkim: no From: Yodel Eldar Date: Tue, 10 Mar 2026 17:31:52 -0500 Subject: [PATCH 12/15] hw/alpha: Move PCI IRQ mapping to TyphoonClass subclass MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-MS-Reactions: disallow Message-Id: <20260310-qomify-alpha-v1-12-4375b00a85ff@yodel.dev> References: <20260310-qomify-alpha-v1-0-4375b00a85ff@yodel.dev> In-Reply-To: <20260310-qomify-alpha-v1-0-4375b00a85ff@yodel.dev> To: qemu-devel@nongnu.org Cc: Richard Henderson , Yodel Eldar X-Developer-Signature: v=1; a=openpgp-sha256; l=4969; i=yodel.eldar@yodel.dev; h=from:subject:message-id; bh=vDZXyJH4edZYehJqPMXlDN152GUNXimB25E96Z1r70Q=; b=owGbwMvMwCU29Z3/drNU3zWMp9WSGDI3zP4kwlxe3jt15bwwm7N1iW/lpwnn/G2dkyhvxzTlY Pm3sNlKHaUsDGJcDLJiiiyXz0qcdcjd3ZW28sd9mDmsTCBDGLg4BWAiLqqMDNf/O6bcuOM2mcfK VZRlJod0e1pK0quHe7nYFxl5eV9ZvZGRYcNxgcDuJybnGrN+fqj627PQ5/aG8NDdoUaiL8Rzjyn o8AEA X-Developer-Key: i=yodel.eldar@yodel.dev; a=openpgp; fpr=D3CD18CD406DBB8A66A9F8DF95EE4FB736654DAC 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=143.55.232.12; envelope-from=bounce+0e9322.97607e-qemu-devel=nongnu.org@yodel.dev; helo=v512.v5f06b487.use4.send.mailgun.net X-Spam_score_int: 10 X-Spam_score: 1.0 X-Spam_bar: + X-Spam_report: (1.0 / 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, HELO_STATIC_HOST=-0.001, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, 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: qemu development 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 @yodel.dev) X-ZM-MESSAGEID: 1773182067214158500 Introduce a Clipper-specific subclass of TyphoonClass, and set the pci_map_irq_fn class member in the subclass init. Since the board must provide the PCI IRQ mapping to the Typhoon, mark the base Typhoon type as abstract. Eliminate the pci_map_irq_fn parameter of typhoon_init(). Note: This commit brings us closer to the splitting of typhoon_init() into instance_init and realize hooks. Signed-off-by: Yodel Eldar --- hw/alpha/alpha_sys.h | 4 +++- hw/alpha/dp264.c | 19 +++++++++++++++++-- hw/alpha/typhoon.c | 9 ++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h index 794a47127d..fdfe96dcb4 100644 --- a/hw/alpha/alpha_sys.h +++ b/hw/alpha/alpha_sys.h @@ -13,11 +13,13 @@ =20 typedef struct TyphoonClass { PCIHostBridgeClass parent_class; + + pci_map_irq_fn sys_map_irq; } TyphoonClass; =20 OBJECT_DECLARE_TYPE(TyphoonState, TyphoonClass, TYPHOON_PCI_HOST_BRIDGE) =20 -PCIBus *typhoon_init(pci_map_irq_fn, uint8_t devfn_min, TyphoonState *); +PCIBus *typhoon_init(uint8_t devfn_min, TyphoonState *); =20 #define TYPHOON_PROP_RAM "ram" =20 diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index a7fc137e70..8c3c8fec67 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -21,6 +21,8 @@ #define TYPE_CLIPPER_MACHINE MACHINE_TYPE_NAME("clipper") OBJECT_DECLARE_SIMPLE_TYPE(ClipperMachineState, CLIPPER_MACHINE) =20 +#define TYPE_TYPHOON_PCIHOST_CLIPPER "typhoon-pcihost-clipper" + struct ClipperMachineState { MachineState parent_obj; =20 @@ -72,7 +74,7 @@ static void clipper_init(MachineState *machine) uint64_t kernel_entry, kernel_low, kernel_high; unsigned int smp_cpus =3D machine->smp.cpus; =20 - Object * const typhoon_obj =3D object_new(TYPE_TYPHOON_PCI_HOST_BRIDGE= ); + Object * const typhoon_obj =3D object_new(TYPE_TYPHOON_PCIHOST_CLIPPER= ); TyphoonState * const typhoon =3D TYPHOON_PCI_HOST_BRIDGE(typhoon_obj); cms->typhoon =3D typhoon; object_property_add_child(OBJECT(machine), "typhoon", typhoon_obj); @@ -109,7 +111,7 @@ static void clipper_init(MachineState *machine) * Init the chipset. Because we're using CLIPPER IRQ mappings, * the minimum PCI device IdSel is 1. */ - pci_bus =3D typhoon_init(clipper_pci_map_irq, PCI_DEVFN(1, 0), typhoon= ); + pci_bus =3D typhoon_init(PCI_DEVFN(1, 0), typhoon); =20 /* * Init the PCI -> ISA bridge. @@ -251,6 +253,14 @@ static void clipper_machine_init(ObjectClass *oc, cons= t void *data) mc->default_nic =3D "e1000"; } =20 +static void typhoon_pcihost_clipper_class_init(ObjectClass *oc, + const void *data) +{ + TyphoonClass *tc =3D TYPHOON_PCI_HOST_BRIDGE_CLASS(oc); + + tc->sys_map_irq =3D clipper_pci_map_irq; +} + static const TypeInfo clipper_types[] =3D { { .name =3D TYPE_CLIPPER_MACHINE, @@ -258,6 +268,11 @@ static const TypeInfo clipper_types[] =3D { .instance_size =3D sizeof(ClipperMachineState), .class_init =3D clipper_machine_init, }, + { + .name =3D TYPE_TYPHOON_PCIHOST_CLIPPER, + .parent =3D TYPE_TYPHOON_PCI_HOST_BRIDGE, + .class_init =3D typhoon_pcihost_clipper_class_init, + }, }; =20 DEFINE_TYPES(clipper_types); diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 8745025319..b261dd7bc5 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -833,15 +833,17 @@ static void typhoon_alarm_timer(void *opaque) cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER); } =20 -PCIBus *typhoon_init(pci_map_irq_fn sys_map_irq, uint8_t devfn_min, - TyphoonState *s) +PCIBus *typhoon_init(uint8_t devfn_min, TyphoonState *s) { + TyphoonClass *tc =3D TYPHOON_PCI_HOST_BRIDGE_GET_CLASS(s); MemoryRegion *addr_space =3D get_system_memory(); DeviceState *dev =3D DEVICE(s); PCIHostState *phb; PCIBus *b; int i; =20 + assert(tc->sys_map_irq !=3D NULL); + phb =3D PCI_HOST_BRIDGE(dev); =20 s->cchip.misc =3D 0x800000000ull; /* Revision: Typhoon. */ @@ -899,7 +901,7 @@ PCIBus *typhoon_init(pci_map_irq_fn sys_map_irq, uint8_= t devfn_min, &s->pchip.reg_io); =20 b =3D pci_register_root_bus(dev, "pci", - typhoon_set_irq, sys_map_irq, s, + typhoon_set_irq, tc->sys_map_irq, s, &s->pchip.reg_mem, &s->pchip.reg_io, devfn_min, 64, TYPE_PCI_BUS); phb->bus =3D b; @@ -978,6 +980,7 @@ static const TypeInfo typhoon_pcihost_info =3D { .instance_init =3D typhoon_pcihost_init, .class_size =3D sizeof(TyphoonClass), .class_init =3D typhoon_pcihost_class_init, + .abstract =3D true, }; =20 static void typhoon_iommu_memory_region_class_init(ObjectClass *klass, --=20 2.53.0