From nobody Fri Dec 27 12:43:25 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1732641301; cv=none; d=zohomail.com; s=zohoarc; b=DwDTRRbbvPfQtBdN64Qun1MHaN7NcyxNitT44nLh+UfntZ3GTQ4vblC8UMkA/lJfPVAdW3ZPWruhTiM5LEi4kF1tTLoUbbqT90m93xHWVCAwuFQABVsNJGylcLGgW+IKDUPrVR45JewRGrTomhIxtcgYa8O4qFTI446xbtSRq2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732641301; h=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=er6EAmnjAudD3kPiQB9zkLV3SUfbN2uxnS0cWpglFxE=; b=ShIsuOgaUyGQIYgTcV50SD4WuxePeC/arpEmymQKMpJjMZwsvO2Nh08Ll/fuy1fjWn87AYFPpx3rmqfZJThm9kAbo7drud0Z5Nm6wXGTm/VcZOH3ks7aMFYB0gaHJD8C4qaQ5PreLMkq06Gj0EMN4K9nKWQLeK3FNpTkQlByTPE= 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 1732641301757236.0832303205766; Tue, 26 Nov 2024 09:15:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFz7v-0007Cc-7J; Tue, 26 Nov 2024 12:13:28 -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 1tFz7j-00079C-0d; Tue, 26 Nov 2024 12:13:15 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tFz7h-0004Hu-BL; Tue, 26 Nov 2024 12:13:14 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-214d1c6d724so20477345ad.3; Tue, 26 Nov 2024 09:13:12 -0800 (PST) Received: from wheely.local0.net (124-171-72-210.tpgi.com.au. [124.171.72.210]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2129dc21c28sm87321175ad.246.2024.11.26.09.13.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641191; x=1733245991; 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=er6EAmnjAudD3kPiQB9zkLV3SUfbN2uxnS0cWpglFxE=; b=hWTsozBEg4fBr/w3MGcqXvPvRWoIfDymNGpfCZYeRufnbhBDUDD0bt1OWSuBAZFMg9 O7Fi5hZl66UZdED7auem+lmRa4XnpOF3TcMS5F1niHCERHC3XDmPJpKMdZViXmmJ3eOO K2aBuKKpCFv11bZraZ2txw8PRiWCGNbHilVau6y1J6rIFQ3GGPLsj7SmLP+ne8ndeW5u VjNod05/sf568Z5a3TRH6Lg+srE8uhuD1c1JFIfw8y65u0I9l+dREhH+lFCo6SQVkt3X DW3BGwNWobNLqO3xZfo7DA/ltRV9TdW5a3QakqiQ2pvoeDliU43UtR9FX/Yk78GwLCn7 WHjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641191; x=1733245991; 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=er6EAmnjAudD3kPiQB9zkLV3SUfbN2uxnS0cWpglFxE=; b=YdSJPpEKgaCaTe6he1AbShFUE6K3csWJiog9ixpLvXkwslCDljxdzl9G8UYxU2V1QQ gV4oe/JUNomMmCzxIoPknq8EMn+gJoIY/RNvel6z1k+T7F2jQLm312ubpqyBBCZ9f+vF n5xR9lRzlQo7SZ4o8JHV1MnH2pzh2J8rfu/US0BYsWL05P2KIwG1zKQJJ/zJpe7r/vzQ xhTRTXkNkafaTahMdbIdpvHb7gcEJZfnjnwiflzJADJuLGfIO1sDaCQ5+/oSMAsSV6X5 hfeDMVBC6GZMR0BwPax+vcGfQlcd9JgxJRDI5XhOnhq1vFlZOJ3gF8NJXUtT/DASKi5f 0a2Q== X-Forwarded-Encrypted: i=1; AJvYcCWA2vYVG/PRsSbBlmuUWSekQSK261qxyDZI5Ay+gZUcTbF3xze/16LCYc9+bIuBeoF24wzdazvGUw==@nongnu.org X-Gm-Message-State: AOJu0YzAqBE7qMEaFkG6ZMHxB+AZY1T4O24LEBGUIHfg8LqGjW2T3IHf Qzb58SUnbEiCqgEIvQT42TVuOg3UWFgTpT5X/2mVYPrwN910IXdoBbQHPQ== X-Gm-Gg: ASbGncu3csmlCCIrvyuD+ryzxqe54F84vCDtQz2QzhAI1oDYU24afZ4y+hcCOzNVez4 cglfLivdGHgpCt/ycmH65mZkKX0LWBpVQ+hk55Au5oh7/NiubLrR3ny/l3nOIWdFVEMTtFe/UKF FgmaMqBdjqednY03S+hAgtAAYKF/Y+8rIC3m+GsIvYO4Kd5OAPrmUYPsNdBCOHcEiKB5ANxwGS8 3wJ/y4B9lUgK9Mn7wbGSgHiqH+ZEV3pljVwyi0CaLldU6IFHnJ/MJAM8fnXQnHOZY52W3vN0YQb UcO16Q== X-Google-Smtp-Source: AGHT+IE5flv56BZkzOAFRRII/6UguyQi2QW7K7yaJWrdcGa555DTHLRJtWJj68CmzlMLrLrNcFKL0A== X-Received: by 2002:a17:902:ea0b:b0:211:f10e:2dce with SMTP id d9443c01a7336-2129f233babmr185866065ad.21.1732641191148; Tue, 26 Nov 2024 09:13:11 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, BALATON Zoltan Subject: [PULL 6/6] hw/ppc/pegasos2: Fix IRQ routing from pci.0 Date: Wed, 27 Nov 2024 03:12:35 +1000 Message-ID: <20241126171235.362916-7-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241126171235.362916-1-npiggin@gmail.com> References: <20241126171235.362916-1-npiggin@gmail.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::632; envelope-from=npiggin@gmail.com; helo=mail-pl1-x632.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1732641303970019100 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan The MV64361 has two PCI buses one of which is used for AGP on PegasosII. So far we only emulated the PCI bus on pci.1 but some graphics cards are only recognised by some guests when connected to pci.0 corresponding to the AGP port. So far the interrupts were not routed from pci.0 so this patch fixes that allowing the use of both PCI buses. On real board only INTA and INTB are connected for AGP but to avoid surprises we connect all 4 PCI interrupt lines so pci.0 can be used for all PCI cards as well. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin Signed-off-by: Nicholas Piggin --- hw/pci-host/mv64361.c | 1 + hw/ppc/pegasos2.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/mv64361.c b/hw/pci-host/mv64361.c index 1036d8600d..421c287eb0 100644 --- a/hw/pci-host/mv64361.c +++ b/hw/pci-host/mv64361.c @@ -95,6 +95,7 @@ static void mv64361_pcihost_realize(DeviceState *dev, Err= or **errp) &s->mem, &s->io, 0, 4, TYPE_PCI_BUS); g_free(name); pci_create_simple(h->bus, 0, TYPE_MV64361_PCI_BRIDGE); + qdev_init_gpio_out(dev, s->irq, ARRAY_SIZE(s->irq)); } =20 static Property mv64361_pcihost_props[] =3D { diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 8ff4a00c34..16abeaac82 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -14,6 +14,7 @@ #include "hw/sysbus.h" #include "hw/pci/pci_host.h" #include "hw/irq.h" +#include "hw/or-irq.h" #include "hw/pci-host/mv64361.h" #include "hw/isa/vt82c686.h" #include "hw/ide/pci.h" @@ -73,8 +74,11 @@ OBJECT_DECLARE_TYPE(Pegasos2MachineState, MachineClass, = PEGASOS2_MACHINE) =20 struct Pegasos2MachineState { MachineState parent_obj; + PowerPCCPU *cpu; DeviceState *mv; + IRQState pci_irqs[PCI_NUM_PINS]; + OrIRQState orirq[PCI_NUM_PINS]; qemu_irq mv_pirq[PCI_NUM_PINS]; qemu_irq via_pirq[PCI_NUM_PINS]; Vof *vof; @@ -177,7 +181,6 @@ static void pegasos2_init(MachineState *machine) pm->mv_pirq[i] =3D qdev_get_gpio_in_named(pm->mv, "gpp", 12 + i); } pci_bus =3D mv64361_get_pci_bus(pm->mv, 1); - pci_bus_irqs(pci_bus, pegasos2_pci_irq, pm, PCI_NUM_PINS); =20 /* VIA VT8231 South Bridge (multifunction PCI device) */ via =3D OBJECT(pci_new_multifunction(PCI_DEVFN(12, 0), TYPE_VT8231_ISA= )); @@ -209,6 +212,31 @@ static void pegasos2_init(MachineState *machine) /* other PC hardware */ pci_vga_init(pci_bus); =20 + /* PCI interrupt routing: lines from pci.0 and pci.1 are ORed */ + for (int h =3D 0; h < 2; h++) { + DeviceState *pd; + g_autofree const char *pn =3D g_strdup_printf("pcihost%d", h); + + pd =3D DEVICE(object_resolve_path_component(OBJECT(pm->mv), pn)); + assert(pd); + for (i =3D 0; i < PCI_NUM_PINS; i++) { + OrIRQState *ori =3D &pm->orirq[i]; + + if (h =3D=3D 0) { + g_autofree const char *n =3D g_strdup_printf("pci-orirq[%d= ]", i); + + object_initialize_child_with_props(OBJECT(pm), n, + ori, sizeof(*ori), + TYPE_OR_IRQ, &error_fat= al, + "num-lines", "2", NULL); + qdev_realize(DEVICE(ori), NULL, &error_fatal); + qemu_init_irq(&pm->pci_irqs[i], pegasos2_pci_irq, pm, i); + qdev_connect_gpio_out(DEVICE(ori), 0, &pm->pci_irqs[i]); + } + qdev_connect_gpio_out(pd, i, qdev_get_gpio_in(DEVICE(ori), h)); + } + } + if (machine->kernel_filename) { sz =3D load_elf(machine->kernel_filename, NULL, NULL, NULL, &pm->kernel_entry, &pm->kernel_addr, NULL, NULL, 1, --=20 2.45.2