From nobody Sun Jul 26 10:06:47 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784983405; cv=none; d=zohomail.com; s=zohoarc; b=IoIGukXEf5m3xCLQmkPqZpWR/UVlrLFs+aJ8arUeL+zoGI+yC4Ky2QvkZNZspP/J5tMNVRgGSroPDgqgAsA/PPwbpZzEM30XbEYP5H4zthpvyxEQ5ygPsBO3drkyKVZIwtkkaK6Lek9Qdv5nS5a6R8U9QA6lON9eL0RGZlGpDkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784983405; 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=xzTrwt+CYtUDeTugoSkgG6+9Bi2XZhlh3ec515Ut764=; b=PuWzAv4Eelyd8JVFrw6F+0H3wi5RtrOZlFQ8KVapU+7aiEUwee7vkcaioaUC8ioXqPPhzs7vCWauD94zmD0AKXkjG7qLzu8M2c6ZxZEG34eTQLaAFowjZIKHIjuISxXEqBZgEeELldold29wY0CPZLUMne6wrUliJtHlZGr8Ji8= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784983405042250.5198119756783; Sat, 25 Jul 2026 05:43:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wnbiB-0001i2-Co; Sat, 25 Jul 2026 08:42:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wnbi9-0001gv-Op for qemu-devel@nongnu.org; Sat, 25 Jul 2026 08:42:37 -0400 Received: from mail-vk1-xa31.google.com ([2607:f8b0:4864:20::a31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wnbi7-0003g6-8e for qemu-devel@nongnu.org; Sat, 25 Jul 2026 08:42:37 -0400 Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-5bf959b820cso816940e0c.3 for ; Sat, 25 Jul 2026 05:42:34 -0700 (PDT) Received: from localhost.localdomain ([146.71.8.128]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c305734410sm1457106e0c.16.2026.07.25.05.42.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jul 2026 05:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784983354; x=1785588154; 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:content-type; bh=xzTrwt+CYtUDeTugoSkgG6+9Bi2XZhlh3ec515Ut764=; b=MSAhZU4EOpGg6VWybptKoJu0BamkQEUjUUFzexQN71B2Lalhib10CZw7hwA1PxKcLK 2UTXoQHalz5FjZ9E/ANUFeRRpyIT+wfBjEKljthAS8KCmdwS90cA8D+avKzBDqDR8MML HrAFWjjWjLn97RId77bHwGUMsW5gDsvoh+UCj4pnErZ+cggL7FMCoia6zNgLMZgwzA6P JrT2zPegMyDEZ7eG/IHcxH6umc63QKySY7snrXH30rZ7u0oJBv0n1JbiUHTwGtJkbSs+ 1ZXNM+fmPMNskeJrxvsPGaVeYunw6VAtTKOCP/JBgGIhitfZfDO3itsvf+mMY39uEKs/ r8Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784983354; x=1785588154; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=xzTrwt+CYtUDeTugoSkgG6+9Bi2XZhlh3ec515Ut764=; b=OhYX6QEEsq00vrJSEisiLRxeMhdLEl6g9aqrONXKMR+t+nCqXu74kZuVFcOK7986gZ oi+XarltjiNtljFMxxl4LHi7qNxZ2Kom2zY8Z28nFQPCMAiIJG5CsiU2hHS5xWI4L3Nv Gu08qqERGYkZZkRlCJ+viAbjQysgp6cOt+a81KQqrjyzgdb8ztUbkzUD1/pL758TG1xo hHzZkkUiE/HWptvgB9bgb8MpK0qsnaFmQPs+y+BJR7ZTg4hYMFtoozs47AdOuhy2bidT 7hp9BNKW8xgWrQTaHyXPTbu2v1y1KQUYwExEreJl5BOUBFcWrS0NBVEHBJFhDqFg6JgF 7Zwg== X-Gm-Message-State: AOJu0YyVi6iw1aPvRR0CRBcGklKrJShHnSv1a29n3kQ683QVr5tQBzm1 mrgCZeq1KrsFyNjrlN+9uyJM35HMbsPSFm8yNrT35Sf7WeZSI0xcCeX/GCEEoj1S X-Gm-Gg: AR+sD1201PQnIq4BRpdA+7PBW0xIvQH7x/3ZxD4s4WMx/dzQU7/HYSRwrB+5J7UdY++ YlXHul7Uqz+lySjLslIiYa9CjifnlzmdgF1nqbEy7/cmHGc8WSqafn7oV4ms48uXSHKtbVJkaHE dUlGaRoLmU7Cu7UteaH2RcCL8T+oFQ4bMrxm5ipC0yFyhyk7oSc/AXupLXEhRKp9eG/pyFakkNj 2AiFcWCIKFcYaEsu73fc+sR74qNQk4E5GkEcCNgXxkjVwjEYGFNSo/tYfnRWcvUmtnlHKQzy22Z fNt0syNRkYUfI3EJb4EW3dIOrozjseaI+72c/LHc9gQIaHM3T/KayKBzI6IxQjwYCruCl014lZp +LuAmhWL0fQYUORQ+OclF6AfmofExyeYJu9bp0KeVCiuiBdLaapQ6CztZKf+7Gz4crOK7ubh7OW 5K7MKegzPEGWlJfqMUEfABG+Tb16BobbVfP0GsGcieIH4= X-Received: by 2002:a05:6122:4889:b0:59b:396b:cea7 with SMTP id 71dfb90a1353d-5c306d21176mr1170596e0c.9.1784983353880; Sat, 25 Jul 2026 05:42:33 -0700 (PDT) From: Marcelo Manzo To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcelo Manzo , Pierrick Bouvier Subject: [PATCH 1/2] hw/arm/bcm2838_pcie: make PCI device enumeration actually work Date: Sat, 25 Jul 2026 08:42:30 -0400 Message-ID: <20260725124231.86233-2-marcelomanzo@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20260725124231.86233-1-marcelomanzo@gmail.com> References: <20260725124231.86233-1-marcelomanzo@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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::a31; envelope-from=marcelomanzo@gmail.com; helo=mail-vk1-xa31.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=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: 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 @gmail.com) X-ZM-MESSAGEID: 1784983408363154100 Content-Type: text/plain; charset="utf-8" raspi4b's PCIe root complex brought the link up but no device was ever enumerated: "lspci" was empty and /sys/bus/pci/devices/ had no entries. Nothing exercised this before, since GENET is a sysbus device rather than a PCI one. Four separate defects, all on the same path: 1. bcm2838_pcie_host_read/write computed "offset - PCIE_CONFIG_SPACE_SIZE" on an unsigned hwaddr, which underflows for every offset below 4KB. The root port's own config space -- including vendor/device ID at offset 0 -- therefore always fell into the out-of-range branch and read back as all-ones, i.e. "no device present", so the guest stopped scanning immediately. 2. pcie_host_mmcfg_init() was never called, yet both accessors dereference pcie_hb->mmio.ops to service EXT_CFG_DATA. Once (1) was fixed and the guest actually reached that path, it touched an uninitialised MemoryRegion. 3. The root port overrode PCIDeviceClass::config_read/config_write with plain pci_default_*_config(). That bypasses rp_write_config() -> pci_bridge_write_config(), so programming the bridge's memory window never updated the bridge's address space and BARs behind the root port stayed unreachable. Drop the overrides and dispatch through pci_host_config_{read,write}_common() so the device's real handlers run. 4. The PCI MMIO window was mapped at the ARM base address with no address translation, even though PCIE_MMIO_OFFSET was defined for exactly that purpose (and otherwise unused). The DTB declares CPU 0x600000000 as mapping to PCI 0xc0000000, so the guest was reading PCI address 0 where it expected a device BAR. Map an alias at the correct PCI offset instead. With these, a PCIe device is enumerated and its driver binds: xhci_hcd 0000:01:00.0: xHCI Host Controller xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 1 xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed Note this is not yet complete: devices attached behind the xHCI are still not enumerated by the guest, which looks like a separate interrupt-delivery problem rather than an enumeration one. Signed-off-by: Marcelo Manzo --- docs/system/arm/raspi.rst | 2 ++ hw/arm/bcm2838_pcie.c | 45 +++++++++++++++++----------- hw/arm/bcm2838_peripherals.c | 16 ++++++++-- include/hw/arm/bcm2838_peripherals.h | 1 + 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/docs/system/arm/raspi.rst b/docs/system/arm/raspi.rst index a4f83d0a..a8fc37e9 100644 --- a/docs/system/arm/raspi.rst +++ b/docs/system/arm/raspi.rst @@ -43,3 +43,5 @@ Missing devices --------------- =20 * Pulse Width Modulation (PWM) + * PCIe MSI/MSI-X interrupt delivery (raspi4b) -- INTx works; a PCIe + device that only signals via MSI/MSI-X needs ``msi=3Doff,msix=3Doff`` diff --git a/hw/arm/bcm2838_pcie.c b/hw/arm/bcm2838_pcie.c index 1596145b..88166d1f 100644 --- a/hw/arm/bcm2838_pcie.c +++ b/hw/arm/bcm2838_pcie.c @@ -11,24 +11,13 @@ #include "qapi/error.h" #include "hw/core/irq.h" #include "hw/pci-host/gpex.h" +#include "hw/pci/pci_host.h" #include "hw/core/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/module.h" #include "hw/arm/bcm2838_pcie.h" #include "trace.h" =20 -static uint32_t bcm2838_pcie_config_read(PCIDevice *d, - uint32_t address, int len) -{ - return pci_default_read_config(d, address, len); -} - -static void bcm2838_pcie_config_write(PCIDevice *d, uint32_t addr, uint32_= t val, - int len) -{ - return pci_default_write_config(d, addr, val, len); -} - static uint64_t bcm2838_pcie_host_read(void *opaque, hwaddr offset, unsigned size) { hwaddr mmcfg_addr; @@ -39,7 +28,18 @@ static uint64_t bcm2838_pcie_host_read(void *opaque, hwa= ddr offset, uint32_t *cfg_idx =3D (uint32_t *)(root_regs + BCM2838_PCIE_EXT_CFG_IN= DEX - PCIE_CONFIG_SPACE_SIZE); =20 - if (offset - PCIE_CONFIG_SPACE_SIZE + size <=3D sizeof(s->root_port.re= gs)) { + if (offset < PCIE_CONFIG_SPACE_SIZE) { + /* + * The first 4KB of the window is the root port's own PCI config + * space (vendor/device ID, BARs, capabilities). Serve it from the + * real PCIDevice, not from the raw regs[] shadow buffer, which is + * only backing store for the controller registers above 4KB. + */ + value =3D pci_host_config_read_common(PCI_DEVICE(&s->root_port), + offset, PCIE_CONFIG_SPACE_SIZE, + size); + } else if (offset - PCIE_CONFIG_SPACE_SIZE + size + <=3D sizeof(s->root_port.regs)) { switch (offset) { case BCM2838_PCIE_EXT_CFG_DATA ... BCM2838_PCIE_EXT_CFG_DATA + PCIE_CONFIG_SPACE_SIZE - 1: @@ -72,7 +72,12 @@ static void bcm2838_pcie_host_write(void *opaque, hwaddr= offset, =20 trace_bcm2838_pcie_host_write(size, offset, value); =20 - if (offset - PCIE_CONFIG_SPACE_SIZE + size <=3D sizeof(s->root_port.re= gs)) { + if (offset < PCIE_CONFIG_SPACE_SIZE) { + /* Root port's own PCI config space -- see read path above */ + pci_host_config_write_common(PCI_DEVICE(&s->root_port), offset, + PCIE_CONFIG_SPACE_SIZE, value, size); + } else if (offset - PCIE_CONFIG_SPACE_SIZE + size + <=3D sizeof(s->root_port.regs)) { switch (offset) { case BCM2838_PCIE_EXT_CFG_DATA ... BCM2838_PCIE_EXT_CFG_DATA + PCIE_CONFIG_SPACE_SIZE - 1: @@ -137,9 +142,18 @@ static void bcm2838_pcie_host_realize(DeviceState *dev= , Error **errp) PCIHostState *pci =3D PCI_HOST_BRIDGE(dev); BCM2838PcieHostState *s =3D BCM2838_PCIE_HOST(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + PCIExpressHost *pex =3D PCIE_HOST_BRIDGE(dev); =20 int i; =20 + /* + * Initialise the ECAM config-space window. The BCM2838 does not expose + * it to the guest directly; config accesses are made indirectly throu= gh + * the EXT_CFG_INDEX/EXT_CFG_DATA register pair, which dispatch into + * pex->mmio. Without this the ops pointer is never set up. + */ + pcie_host_mmcfg_init(pex, PCIE_MMCFG_SIZE_MAX); + memory_region_init_io(&s->cfg_regs, OBJECT(s), &bcm2838_pcie_host_ops,= s, "bcm2838_pcie_cfg_regs", BCM2838_PCIE_REGS_SIZE); sysbus_init_mmio(sbd, &s->cfg_regs); @@ -273,9 +287,6 @@ static void bcm2838_pcie_root_class_init(ObjectClass *c= lass, const void *data) k->device_id =3D BCM2838_PCIE_DEVICE_ID; k->revision =3D BCM2838_PCIE_REVISION; =20 - k->config_read =3D bcm2838_pcie_config_read; - k->config_write =3D bcm2838_pcie_config_write; - rpc->exp_offset =3D BCM2838_PCIE_EXP_CAP_OFFSET; rpc->aer_offset =3D BCM2838_PCIE_AER_CAP_OFFSET; } diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c index de49f48b..012a4567 100644 --- a/hw/arm/bcm2838_peripherals.c +++ b/hw/arm/bcm2838_peripherals.c @@ -204,10 +204,22 @@ static void bcm2838_peripherals_realize(DeviceState *= dev, Error **errp) /* RC registers region */ regs_mr =3D sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->pcie_host), 0); memory_region_add_subregion(&s->peri_low_mr, PCIE_RC_OFFSET, regs_mr); - /* MMIO region */ + /* + * MMIO region. + * + * The BCM2711 PCIe controller translates addresses between the ARM and + * PCI address spaces: the DTB declares CPU 0x600000000 as mapping to = PCI + * 0xc0000000. Map an alias of the PCI window starting at that PCI off= set + * so accesses land on the right addresses; mapping the window directly + * would expose PCI address 0 at the ARM base instead, and every BAR + * behind the root port would be read at the wrong address. + */ mmio_mr =3D sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->pcie_host), 1); + memory_region_init_alias(&s->pcie_mmio_alias, OBJECT(s), + "bcm2838_pcie_mmio_alias", mmio_mr, + PCIE_MMIO_OFFSET, PCIE_MMIO_SIZE); memory_region_add_subregion(get_system_memory(), PCIE_MMIO_ARM_OFFSET, - mmio_mr); + &s->pcie_mmio_alias); =20 /* Gigabit Ethernet */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->genet), errp)) { diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_= peripherals.h index 5da340f2..c05709f4 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -70,6 +70,7 @@ struct BCM2838PeripheralState { =20 SDHCIState emmc2; BCM2838PcieHostState pcie_host; + MemoryRegion pcie_mmio_alias; BCM2838GenetState genet; BCM2838GpioState gpio; =20 --=20 2.47.1 From nobody Sun Jul 26 10:06:47 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1784983411; cv=none; d=zohomail.com; s=zohoarc; b=K3BKZdIMF1HnK+5TKXd9OZjvhPhINArZxSr6Djtu1LdL6gKJNNmHKuiHFkllAtkflXnc8uxWzAr7uv2WnrcE99ls9WyA7qcONdqIB5QF92nruxiF9deT7mrUgnOMktet4ok47F1lb0apf1YQ1nUTxR/6m8jU5oxppT+g3YuqdOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784983411; 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=9AD+CeF8E5+1gZsnV8qJ0ILiMhnlxUFvylSOWxouULw=; b=f5mRFf2IZdYXk3huPns9zdCrcd2w64SudQCmFTnt7IsYSPn/Z79/+e47gqgAtG43Vzcbn7K8qyku68kVoIqtaf/K5P2Nnw6LcjXzpwYSvMT2AVxU09Srwu0Xm6a+MlPzwynn1AyHHGN1PP4Sg0OUrSoJi7shqJQQs1qDJ3MHvb8= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784983411097828.0877281694111; Sat, 25 Jul 2026 05:43:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wnbiC-0001iz-OJ; Sat, 25 Jul 2026 08:42:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wnbi9-0001gX-ET for qemu-devel@nongnu.org; Sat, 25 Jul 2026 08:42:37 -0400 Received: from mail-vk1-xa31.google.com ([2607:f8b0:4864:20::a31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wnbi7-0003gF-JF for qemu-devel@nongnu.org; Sat, 25 Jul 2026 08:42:37 -0400 Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-5c276bfce7eso973271e0c.2 for ; Sat, 25 Jul 2026 05:42:35 -0700 (PDT) Received: from localhost.localdomain ([146.71.8.128]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c305734410sm1457106e0c.16.2026.07.25.05.42.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 25 Jul 2026 05:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784983355; x=1785588155; 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:content-type; bh=9AD+CeF8E5+1gZsnV8qJ0ILiMhnlxUFvylSOWxouULw=; b=GSy+Op33hrTfur9dcGIEgahLxBEcauW2Ep7eM0xE9oqNhAZKu9sTFNin8mypoati4/ 8qvytxfh8oRuUULQvbf/vyX0MT/0bbuUV9hzhGPCID6w4qPJBrIlaMYLcyKRFQg48PLT fu/qn7HJq8c2QguJncgFn958d8FikNM4hGs4Uiuh4BvTBEKfU4j6P+oJ23RYIC484qOI 9P4g8NGmQOF71rswDHAVcsmdxVm71SLx5DxL7k5th0jf6O1z6i5lmlQxVY3JvZi/0Xdj IzEByCSxvEAqHi/WCWHwGH2c8aP+xb9IOniRh4CeOqNMr8wYeQLwnwt5kqbQL5iJmZxW Q/Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784983355; x=1785588155; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=9AD+CeF8E5+1gZsnV8qJ0ILiMhnlxUFvylSOWxouULw=; b=BDOftkr9dVoP7NXHmnAga743FPp/S/EDL+im2J2ZK+H5CJmbwzl6+TLoVHwmDFWHWj BHxyA0mHR24roawKblV742HGAC8bAg4IsIiAGj2GJG1QxEIp173knqwqHkvP4a1TBAxq y5M1FGqWwA3VaJ1zYzahwdIBm1aZ6OV5LH4LSlQLV5S4kHJZhulb6a2M6+O9ywAtJePY nH//37CTIQ/mJ1pzzKbI1OMcM8s00fxfY9DbS+YdmIw//yzypigvyLlmCGrSPpD94r16 8laTrpLXL0CSxUbjlGOBzvy01pydD2F3nOb14k7cUP+Zmfefk6RJtlaGS36lQPvomH8a WfNA== X-Gm-Message-State: AOJu0Yxnh+Q8JP+w+PS+ZwpKYT1rOK+ywtG5t0HsyxKFFLcU88Tt+hfq nrC4x8c9dvdTn48j6UEEh/DKaBpdSgIp9O4uUhUg8WsmRGd7A6UyYc/+0loYgg== X-Gm-Gg: AR+sD13jK1XtQ1QTS8zI9onTlpYrhUvowGVVoAGnASKlSTjdzamnsmHYd+0RGZ9hvR8 g1RWjQD2rnYOwIgRhWtzIKZb7AAJd6mGbq2orJ2gx5gk7IP2uf5tjAu0SauuTN2JZFcVuP8mzYW jWqxSmVdHyMyYVwYHw7ijhwHhJvuU6wBqgimSofGaLUMAyCegoL2lxfl781FI3feZ/9B170hAWV XRVzijL/Qokm4oV0cyoN6s0O7o1uTggCeGeMqImYNFWUmFhLeYfWRrBIBI+A4pks2MX5DPN5vOZ iHxEEdNOqDbFYSwbu52fcEJg6wPDHhyDph4gNzMbaIFeGivnxdVHEetORQOls11eX4W7PBaMVj8 bUISPmb8TlWRb/LU7F6dW7wiHnYisfsuMjG6Xcr39qyaTs7Xdk/Q3eIzPoIMyha4HJksrOT+Prd 5IbSJKdbFddQ+FStWdTI4dS8+lO/r75h36 X-Received: by 2002:a05:6122:1d86:b0:5bf:9bfa:53a0 with SMTP id 71dfb90a1353d-5c306bd1f69mr1142693e0c.1.1784983354697; Sat, 25 Jul 2026 05:42:34 -0700 (PDT) From: Marcelo Manzo To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcelo Manzo Subject: [PATCH 2/2] tests/functional/aarch64: add raspi4b PCIe enumeration test Date: Sat, 25 Jul 2026 08:42:31 -0400 Message-ID: <20260725124231.86233-3-marcelomanzo@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20260725124231.86233-1-marcelomanzo@gmail.com> References: <20260725124231.86233-1-marcelomanzo@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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::a31; envelope-from=marcelomanzo@gmail.com; helo=mail-vk1-xa31.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=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: 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 @gmail.com) X-ZM-MESSAGEID: 1784983412317154100 Content-Type: text/plain; charset="utf-8" Add test_arm_raspi4_pcie, exercising the fix in the previous patch: attach a qemu-xhci controller to the PCIe root port, confirm the guest's driver binds it, and confirm both the root port (00:00.0) and the xHCI controller (01:00.0) show up in /sys/bus/pci/devices/. Before the previous patch this would find no devices at all. Attaches with msi=3Doff,msix=3Doff: the BCM2838 PCIe root complex's own MSI controller is not implemented, so a device relying on MSI/MSI-X for interrupts never signals its driver. INTx works and is what this test (and any real device behind this root port, for now) relies on. Signed-off-by: Marcelo Manzo --- tests/functional/aarch64/test_raspi4.py | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/functional/aarch64/test_raspi4.py b/tests/functional/aar= ch64/test_raspi4.py index 0e254a20..32542b84 100755 --- a/tests/functional/aarch64/test_raspi4.py +++ b/tests/functional/aarch64/test_raspi4.py @@ -122,5 +122,42 @@ def test_arm_raspi4_genet(self): exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System ha= lted') =20 =20 + def test_arm_raspi4_pcie(self): + kernel_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'boot/kernel8.img') + dtb_path =3D self.archive_extract(self.ASSET_KERNEL_20190215, + member=3D'boot/bcm2711-rpi-4-b.dtb= ') + initrd_path =3D self.uncompress(self.ASSET_INITRD) + + self.set_machine('raspi4b') + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=3Dpl011,mmio32,0xfe201000 ' + + 'console=3DttyAMA0,115200 ' + + 'panic=3D-1 noreboot ' + + 'dwc_otg.fiq_fsm_enable=3D0') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot', + # msi=3Doff,msix=3Doff: the BCM2838 PCIe root com= plex's + # MSI controller is not implemented, so a device + # relying on MSI/MSI-X for interrupts never signa= ls + # and its driver never probes. INTx works. + '-device', + 'qemu-xhci,bus=3Dpcie.1,id=3Dxhci,msi=3Doff,msix= =3Doff') + self.vm.launch() + self.wait_for_console_pattern( + 'xhci_hcd 0000:01:00.0: xHCI Host Controller') + self.wait_for_console_pattern('Boot successful.') + + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', + '0000:00:00.0') + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/pci/devices/', + '0000:01:00.0') + exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System ha= lted') + + if __name__ =3D=3D '__main__': LinuxKernelTest.main() --=20 2.47.1