From nobody Mon Sep 8 14:33:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cL8Zx2r5yz66ggx; Mon, 08 Sep 2025 14:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cL8Zx28jLz3G3v; Mon, 08 Sep 2025 14:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757342025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fSK1+FOIq3XUZ9u9cd1WWkJwmMgMbY0YYVAcPAgmbFA=; b=DfE7Kb3aeqUbWjxp3iGqHZvWrH2KXT6dkvNANsVj7zIYPBy11ltFgWE5uEXXyNYPF2AuqZ gE0x6PXn8Tfdt5Di6fpO7ybfptj3lW/oL7ndC7StxjYnaajeZHKwLjxqcUmrJ4yOKXWThe cqOdoivyQexjwwUXHRbyNboLDhAfaer5LeFFdMaJxJZ808KZSJiq+HiDIxoGBl9+WWFUXO o73m1gKr16Vu/mdazEGtJpAHUFN9EXefKsN4QbROnP25gzgyAX6rFIBLWQ6Rbf5uL8JnEr wrkjawTkv90V7g9nxRvNxWjAawEyTR50eMtsGTwS1iK/tmbIItveNIgd7YGiBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757342025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fSK1+FOIq3XUZ9u9cd1WWkJwmMgMbY0YYVAcPAgmbFA=; b=H4+hW3m8WphmcU4AEvj/a26HLeFETY3VWZP32LKMpBat9XAxwteBM03guCAGyB6uX0y4Fs 9aDMmHDObPNO/myRVJkdTBHZ1aTu93BDjczsLMj+Sbs3tmXCvqszuJB4zcDf/cq6NFWKrn QoReoxXj2ojbXi1vUFhFoVHec06EeMhUIrn5FP7eL8SEFMhNDl5pv4j/gCVCzObK+7RA5w ONaXAZxdqAOg29J/TA+u0x/UX7RDaZCEywzNoitni0mBNokRyjFuE/mrRjEvDXHZI9D+4o RMj7uxPvGlrrsKS+rr51xvi73x4CsnILjm0W17S1K5Gq1/PSCz3YPuxNzm+1LA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757342025; a=rsa-sha256; cv=none; b=lBwCM7+gLGKPL5y8M8n7S7QbwD+hELqvMQNuLy2wX6jDmkGLbqC9Apeaz9v4ELAuESgW9b ID3Wr6WSg/lBiJYMmEqlGuo8RNvzbnWq4hNTK7pDGiHLA6IStAvuRWYxjaOULEmZMiAfYn vY8Qgn6UKDPfcOYcSMQnN//brBX1tjCWkzDMLMR+7GluQyRUCGALVkkxfS16MevP8xBOAd yZ0mcXGkm8y4luiIypOzcFOPj9MZ/fHoJk0lI2v6uTVhnFzKY6Z0xe64iJxXpo84e3NG00 vRH40NV62fdZVl+77NTKINyAd1lbrMOZKm1vUSAtH8/4RMJb8v2h94P4qWUbeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cL8Zx1hqtz195j; Mon, 08 Sep 2025 14:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 588EXjrk080936; Mon, 8 Sep 2025 14:33:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 588EXj6s080933; Mon, 8 Sep 2025 14:33:45 GMT (envelope-from git) Date: Mon, 8 Sep 2025 14:33:45 GMT Message-Id: <202509081433.588EXj6s080933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3860afe99ec3 - main - Revert "LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on attach" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3860afe99ec39b9942967941181f28f27f3fc548 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3860afe99ec39b9942967941181f28f27f3fc548 commit 3860afe99ec39b9942967941181f28f27f3fc548 Author: Bjoern A. Zeeb AuthorDate: 2025-09-08 14:32:24 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-09-08 14:32:24 +0000 Revert "LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on attach" It turns out this breaks the nvidia-drm drviers. We'll try to rework things and put it back later. This reverts commit bbeeb585315645db20118ef349a4e3dc83b148cc. --- sys/compat/linuxkpi/common/src/linux_pci.c | 47 +++++------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index d0f1d5e3f9c5..43fd6ad28ac4 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -342,7 +342,6 @@ lkpi_pci_dev_release(struct device *dev) static int lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) { - struct pci_devinfo *dinfo; int error; error = kobject_init_and_add(&pdev->dev.kobj, &linux_dev_ktype, @@ -363,24 +362,15 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) pdev->path_name = kasprintf(GFP_KERNEL, "%04d:%02d:%02d.%d", pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev)); - pdev->bus = malloc(sizeof(*pdev->bus), M_DEVBUF, M_WAITOK | M_ZERO); + /* + * This should be the upstream bridge; pci_upstream_bridge() + * handles that case on demand as otherwise we'll shadow the + * entire PCI hierarchy. + */ + pdev->bus->self = pdev; pdev->bus->number = pci_get_bus(dev); pdev->bus->domain = pci_get_domain(dev); - - /* Check if we have reached the root to satisfy pci_is_root_bus() */ - dinfo = device_get_ivars(dev); - if (dinfo->cfg.pcie.pcie_location != 0 && - dinfo->cfg.pcie.pcie_type == PCIEM_TYPE_ROOT_PORT) { - pdev->bus->self = NULL; - } else { - /* - * This should be the upstream bridge; pci_upstream_bridge() - * handles that case on demand as otherwise we'll shadow the - * entire PCI hierarchy. - */ - pdev->bus->self = pdev; - } pdev->dev.bsddev = dev; pdev->dev.parent = &linux_root_device; pdev->dev.release = lkpi_pci_dev_release; @@ -405,7 +395,7 @@ lkpinew_pci_dev_release(struct device *dev) pdev = to_pci_dev(dev); if (pdev->root != NULL) pci_dev_put(pdev->root); - if (pdev->bus->self != pdev && pdev->bus->self != NULL) + if (pdev->bus->self != pdev) pci_dev_put(pdev->bus->self); free(pdev->bus, M_DEVBUF); if (pdev->msi_desc != NULL) { @@ -561,7 +551,6 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, { struct resource_list_entry *rle; device_t parent; - struct pci_dev *pbus, *ppbus; uintptr_t rid; int error; bool isdrm; @@ -605,27 +594,6 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, list_add(&pdev->links, &pci_devices); spin_unlock(&pci_lock); - /* - * Create the hierarchy now as we cannot on demand later. - * Take special care of DRM as there is a non-PCI device in the chain. - */ - pbus = pdev; - if (isdrm) { - pbus = lkpinew_pci_dev(parent); - if (pbus == NULL) { - error = ENXIO; - goto out_dma_init; - } - } - pcie_find_root_port(pbus); - if (isdrm) - pdev->root = pbus->root; - ppbus = pci_upstream_bridge(pbus); - while (ppbus != NULL && ppbus != pbus) { - pbus = ppbus; - ppbus = pci_upstream_bridge(pbus); - } - if (pdrv != NULL) { error = pdrv->probe(pdev, id); if (error) @@ -633,7 +601,6 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, } return (0); -/* XXX the cleanup does not match the allocation up there. */ out_probe: free(pdev->bus, M_DEVBUF); spin_lock_destroy(&pdev->pcie_cap_lock);