Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2227947/?format=api
{ "id": 2227947, "url": "http://patchwork.ozlabs.org/api/patches/2227947/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/7f673ce8-fa00-47aa-a50f-812ae5073279@lankhorst.se/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<7f673ce8-fa00-47aa-a50f-812ae5073279@lankhorst.se>", "list_archive_url": null, "date": "2026-04-24T14:43:26", "name": "PCI: Fix resizable bar fails due to bridge memory region", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5de7f83272c783b68f3e1204a68d1083a2b6c3f3", "submitter": { "id": 93251, "url": "http://patchwork.ozlabs.org/api/people/93251/?format=api", "name": "Maarten Lankhorst", "email": "dev@lankhorst.se" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/7f673ce8-fa00-47aa-a50f-812ae5073279@lankhorst.se/mbox/", "series": [ { "id": 501378, "url": "http://patchwork.ozlabs.org/api/series/501378/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=501378", "date": "2026-04-24T14:43:26", "name": "PCI: Fix resizable bar fails due to bridge memory region", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501378/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227947/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227947/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-53141-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.a=rsa-sha256\n header.s=default header.b=RezyCm9T;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-53141-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=lankhorst.se header.i=@lankhorst.se\n header.b=\"RezyCm9T\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=141.105.120.124", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=lankhorst.se", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=lankhorst.se" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2GBW1znpz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 25 Apr 2026 00:51:47 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 10CDF302291F\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 14:51:14 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id A007A3E1206;\n\tFri, 24 Apr 2026 14:51:04 +0000 (UTC)", "from lankhorst.se (unknown [141.105.120.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F1023DDDBC\n\tfor <linux-pci@vger.kernel.org>; Fri, 24 Apr 2026 14:51:01 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777042264; cv=none;\n b=QB78RKpHqiUAMOYGulwxpWzho3VRMz6AtrlmgGIbGsa+0s0vnELOiauUCTa3sHX4cpKOgjjN5iFC8cX03gwHbZcIuDCxXxFzptsOzb/kxYTBrhLMNqa8ZEig0lApzmGOrVBXeZ320dxKQWyuW7h2VI3FvJQZvQxogLyHcOV3MJg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777042264; c=relaxed/simple;\n\tbh=IkZ4HmVZrnr3YrXmiO7B9vcFYv7HAS2JPSowEZKO4fw=;\n\th=Message-ID:Date:MIME-Version:From:Subject:To:Content-Type;\n b=EhVUSYYHEbBuZ9QjET3qByYma9R27/Vw1dqSFW26Wb9vr72FKWjular2Em4qAwLbdAmxJyRSC4M+nz4KlnLK958FluDFe8n2CqlvnLV2+6aHKVo0cVug+h3dm6HVeYVdnTeF4z3DH4rMRIc/2U+O/ZOMQiK1rhSpeaib5HzDdAk=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=lankhorst.se;\n spf=pass smtp.mailfrom=lankhorst.se;\n dkim=pass (2048-bit key) header.d=lankhorst.se header.i=@lankhorst.se\n header.b=RezyCm9T; arc=none smtp.client-ip=141.105.120.124", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se;\n\ts=default; t=1777041807;\n\tbh=IkZ4HmVZrnr3YrXmiO7B9vcFYv7HAS2JPSowEZKO4fw=;\n\th=Date:From:Subject:To:From;\n\tb=RezyCm9TMidJBfoKFzHLEtwVnR7qVjIFWQMikwHEC+Ut7H2413nKoh3N1yNXSfua4\n\t zjw3tIpSdB/L7JEUN4ZoMGzfLFKrLPrrSjG/S2PRBav7C3X4FIAlUYb/4bx+ZPGIrU\n\t 7ITHmhrEWPwaIjt3Xcn88zcwRQD1CDgoJU/HkLU+VTNmewWu6p7GDOQM8rvXMR5zMq\n\t OXbSXI/8kWV8cooup4IKkSjsDCpfa65sMSulgVzChZyV/XQ6Mo28bRHda+tvykydtH\n\t F6rPuZqpw5jo/56a2jGGQ8uHpfajTf+me0nPKe/M/NUFMGFCTdz+O2yxmvMwcPiaiZ\n\t hdYp2c/s1Ffhw==", "Message-ID": "<7f673ce8-fa00-47aa-a50f-812ae5073279@lankhorst.se>", "Date": "Fri, 24 Apr 2026 16:43:26 +0200", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "User-Agent": "Mozilla Thunderbird", "From": "Maarten Lankhorst <dev@lankhorst.se>", "Subject": "[PATCH] PCI: Fix resizable bar fails due to bridge memory region", "To": "linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,\n \"intel-xe@lists.freedesktop.org\" <intel-xe@lists.freedesktop.org>", "Content-Language": "en-US", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "7bit" }, "content": "I encountered a problem that I have on my system, where I cannot resize\nthe bar because one of the bridges has a \n\nIf I take a look at the topology, the GPU shares the memory region with a bridge,\n\n+-[0000:64]-+-00.0-[65-68]----00.0-[66-68]--+-01.0-[67]----00.0\n\nThe specific bridge likely causing a failure is:\n\n65:00.0 PCI bridge: Intel Corporation Device e2ff (rev 01) (prog-if 00 [Normal decode])\n Flags: bus master, fast devsel, latency 0, IRQ 32, IOMMU group 1\n Memory at 382400000000 (64-bit, prefetchable) [size=8M]\n ....\n\nWhich causes upstream bridge 64:00.0 initially to allocate the region\n[38fe0000000-38ff0000000) for the GPU, and [382ff0000000..382ff07fffff]\nfor the bridge device.\n\nBridge 64 is big enough for 1 BMG with a 32 GB bar and the second 8 MB allocation:\npci_bus 0000:64: resource 9 [mem 0x382000000000-0x382fffffffff window] (64GB window)\n\nThe reason for failure is that bridge 65 has a 8 MB memory region assigned,\nand previously it was ignored when reallocating.\n\nFailing case:\nxe 0000:67:00.0: [drm] Attempting to resize bar from 256MiB -> 16384MiB\nxe 0000:67:00.0: BAR 2 [mem 0x382fe0000000-0x382fefffffff 64bit pref]: releasing\npcieport 0000:66:01.0: bridge window [mem 0x382fe0000000-0x382fefffffff 64bit pref]: releasing\npcieport 0000:65:00.0: bridge window [mem 0x382fe0000000-0x382fefffffff 64bit pref]: releasing\npcieport 0000:64:00.0: bridge window [mem 0x382fe0000000-0x382ff07fffff 64bit pref]: was not released (still contains assigned resources)\npcieport 0000:65:00.0: bridge window [mem size 0x400000000 64bit pref]: can't assign; no space\npcieport 0000:65:00.0: bridge window [mem size 0x400000000 64bit pref]: failed to assign\npcieport 0000:65:00.0: bridge window [mem size 0x400000000 64bit pref]: can't assign; no space\npcieport 0000:65:00.0: bridge window [mem size 0x400000000 64bit pref]: failed to assign\npcieport 0000:66:01.0: bridge window [mem size 0x400000000 64bit pref]: can't assign; no space\npcieport 0000:66:01.0: bridge window [mem size 0x400000000 64bit pref]: failed to assign\npcieport 0000:66:01.0: bridge window [mem size 0x400000000 64bit pref]: can't assign; no space\npcieport 0000:66:01.0: bridge window [mem size 0x400000000 64bit pref]: failed to assign\nxe 0000:67:00.0: BAR 2 [mem size 0x400000000 64bit pref]: can't assign; no space\nxe 0000:67:00.0: BAR 2 [mem size 0x400000000 64bit pref]: failed to assign\nxe 0000:67:00.0: BAR 2 [mem size 0x400000000 64bit pref]: can't assign; no space\nxe 0000:67:00.0: BAR 2 [mem size 0x400000000 64bit pref]: failed to assign\npcieport 0000:64:00.0: PCI bridge to [bus 65-68]\npcieport 0000:64:00.0: bridge window [mem 0xd7000000-0xd83fffff]\npcieport 0000:64:00.0: bridge window [mem 0x382fe0000000-0x382ff07fffff 64bit pref]\npcieport 0000:65:00.0: PCI bridge to [bus 66-68]\npcieport 0000:65:00.0: bridge window [mem 0xd7000000-0xd83fffff]\npcieport 0000:65:00.0: bridge window [mem 0x382fe0000000-0x382fefffffff 64bit pref]\npcieport 0000:66:01.0: PCI bridge to [bus 67]\npcieport 0000:66:01.0: bridge window [mem 0xd7000000-0xd81fffff]\npcieport 0000:66:01.0: bridge window [mem 0x382fe0000000-0x382fefffffff 64bit pref]\n\nWorking with the patch below:\nxe 0000:67:00.0: [drm] Attempting to resize bar from 256MiB -> 16384MiB\nxe 0000:67:00.0: BAR 2 [mem 0x382fe0000000-0x382fefffffff 64bit pref]: releasing\npcieport 0000:66:01.0: bridge window [mem 0x382fe0000000-0x382fefffffff 64bit pref]: releasing\npcieport 0000:65:00.0: bridge window [mem 0x382fe0000000-0x382fefffffff 64bit pref]: releasing\npcieport 0000:65:00.0: BAR 0 [mem 0x382ff0000000-0x382ff07fffff 64bit pref]: releasing\npcieport 0000:64:00.0: bridge window [mem 0x382fe0000000-0x382ff07fffff 64bit pref]: releasing\npcieport 0000:64:00.0: bridge window [mem 0x382000000000-0x3824007fffff 64bit pref]: assigned\npcieport 0000:65:00.0: bridge window [mem 0x382000000000-0x3823ffffffff 64bit pref]: assigned\npcieport 0000:65:00.0: BAR 0 [mem 0x382400000000-0x3824007fffff 64bit pref]: assigned\npcieport 0000:66:01.0: bridge window [mem 0x382000000000-0x3823ffffffff 64bit pref]: assigned\nxe 0000:67:00.0: BAR 2 [mem 0x382000000000-0x3823ffffffff 64bit pref]: assigned\npcieport 0000:64:00.0: PCI bridge to [bus 65-68]\npcieport 0000:64:00.0: bridge window [mem 0xd7000000-0xd83fffff]\npcieport 0000:64:00.0: bridge window [mem 0x382000000000-0x3824007fffff 64bit pref]\npcieport 0000:65:00.0: PCI bridge to [bus 66-68]\npcieport 0000:65:00.0: bridge window [mem 0xd7000000-0xd83fffff]\npcieport 0000:65:00.0: bridge window [mem 0x382000000000-0x3823ffffffff 64bit pref]\npcieport 0000:65:00.0: PCI bridge to [bus 66-68]\npcieport 0000:65:00.0: bridge window [mem 0xd7000000-0xd83fffff]\npcieport 0000:65:00.0: bridge window [mem 0x382000000000-0x3823ffffffff 64bit pref]\npcieport 0000:66:01.0: PCI bridge to [bus 67]\npcieport 0000:66:01.0: bridge window [mem 0xd7000000-0xd81fffff]\npcieport 0000:66:01.0: bridge window [mem 0x382000000000-0x3823ffffffff 64bit pref]\nxe 0000:67:00.0: [drm] BAR2 resized to 16384MiB\n\n\nSigned-off-by: Maarten Lankhorst <dev@lankhorst.se>\n---\nI'm not 100% this is the correct fix, I don't know why the bridge itself has\na memory region, why the kernel allocates it and when it's supposed to\nbe used. Not a PCI expert. :-)\n---", "diff": "diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c\nindex 61f769aaa2f6c..98692dccc4721 100644\n--- a/drivers/pci/setup-bus.c\n+++ b/drivers/pci/setup-bus.c\n@@ -2258,6 +2258,7 @@ static int pbus_reassign_bridge_resources(struct pci_bus *bus, struct resource *\n \tunsigned long type = res->flags;\n \tstruct pci_dev_resource *dev_res;\n \tstruct pci_dev *bridge = NULL;\n+\tstruct resource *r;\n \tLIST_HEAD(added);\n \tLIST_HEAD(failed);\n \tunsigned int i;\n@@ -2286,6 +2287,21 @@ static int pbus_reassign_bridge_resources(struct pci_bus *bus, struct resource *\n \t\t\t\t res_name, res);\n \t\t}\n \n+\t\tpci_dev_for_each_resource(bridge, r, i) {\n+\t\t\tif (!resource_assigned(r) || r->child)\n+\t\t\t\tcontinue;\n+\n+\t\t\tif ((r->flags & IORESOURCE_TYPE_BITS) !=\n+\t\t\t (type & IORESOURCE_TYPE_BITS))\n+\t\t\t\tcontinue;\n+\n+\t\t\tret = pci_dev_res_add_to_list(saved, bridge, r, 0, 0);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\n+\t\t\tpci_release_resource(bridge, i);\n+\t\t}\n+\n \t\tbus = bus->parent;\n \t}\n \n", "prefixes": [] }