Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2197267/?format=api
{ "id": 2197267, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2197267/?format=api", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.0/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 }, "msgid": "<20260217160836.2709885-3-kbusch@meta.com>", "date": "2026-02-17T16:08:35", "name": "[PATCHv5,2/3] PCI: allow all bus devices to use the same slot", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "65b29c9bcf7643152e4dce6342b3584c9fbafa05", "submitter": { "id": 84963, "url": "http://patchwork.ozlabs.org/api/1.0/people/84963/?format=api", "name": "Keith Busch", "email": "kbusch@meta.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260217160836.2709885-3-kbusch@meta.com/mbox/", "series": [ { "id": 492447, "url": "http://patchwork.ozlabs.org/api/1.0/series/492447/?format=api", "date": "2026-02-17T16:08:34", "name": "pci slot reset handling fixes", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/492447/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197267/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-47468-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=meta.com header.i=@meta.com header.a=rsa-sha256\n header.s=s2048-2025-q2 header.b=VQgSuzbJ;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-47468-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com\n header.b=\"VQgSuzbJ\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=67.231.153.30", "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=meta.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=meta.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fFl294DX7z1xwD\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Feb 2026 03:09:05 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 55FBB3031EBD\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 16:08:58 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0255A36D516;\n\tTue, 17 Feb 2026 16:08:58 +0000 (UTC)", "from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com\n [67.231.153.30])\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 7B8FF36D51B\n\tfor <linux-pci@vger.kernel.org>; Tue, 17 Feb 2026 16:08:56 +0000 (UTC)", "from pps.filterd (m0089730.ppops.net [127.0.0.1])\n\tby m0089730.ppops.net (8.18.1.11/8.18.1.11) with ESMTP id 61HEr0D2546040\n\tfor <linux-pci@vger.kernel.org>; Tue, 17 Feb 2026 08:08:55 -0800", "from maileast.thefacebook.com ([163.114.135.16])\n\tby m0089730.ppops.net (PPS) with ESMTPS id 4cctg217jb-3\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Tue, 17 Feb 2026 08:08:55 -0800 (PST)", "from twshared10186.03.snb1.facebook.com (2620:10d:c0a8:1b::30) by\n mail.thefacebook.com (2620:10d:c0a9:6f::237c) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.2.2562.35; Tue, 17 Feb 2026 16:08:53 +0000", "by devbig197.nha3.facebook.com (Postfix, from userid 544533)\n\tid 5D515811FAF9; Tue, 17 Feb 2026 08:08:39 -0800 (PST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1771344537; cv=none;\n b=cW2gpSTvh+clPXcieYdktcZ+tOynSrB7VcWcHE75Dqy4u6SxCdqfiRE5vpyqGbGg28Kd1AopGQ86q4DLcjF030cnEFjFpV1xWD65hrB4h30CwHD9ydkwIo23tlN5sR7bk8AnLYf5iH6o5QHnkimekWLyC7SXGkhLYCXbvzR7agE=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1771344537; c=relaxed/simple;\n\tbh=JLVgi8q6f3sQJATnw9sxLY9D6/Yo8lWQM/rllZpPTvY=;\n\th=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=nMRfaLw+8CaAbq8do4Cv6S4I1WCHA4K8anDAHD42EDnzhfnoquo5q6sfNS4D3blQuHlH5ZJPZVjA8uOC1dHydTh2PwKMYfGlyZ0BNiT3HZ76VzOtvgfuhBQFmUmnHS34CMkfdcjUlGD7XYjW9Jpejn8iP651Ks1sk5ptGVup6/w=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=meta.com;\n spf=pass smtp.mailfrom=meta.com;\n dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com\n header.b=VQgSuzbJ; arc=none smtp.client-ip=67.231.153.30", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=cc\n\t:content-transfer-encoding:content-type:date:from:in-reply-to\n\t:message-id:mime-version:references:subject:to; s=s2048-2025-q2;\n\t bh=KBw06S5crApuXlHs1nrTIyurzMj3sXa8L5hqLN/NtVM=; b=VQgSuzbJh91p\n\tACk1G3D5DcmTyk89Pb7kohdlXUIKFZPYLqjjNtUha9AdNbQrPs5Ku+mCjAi9liEc\n\tPaEOmCaje2RJNKa5FuDg7vY8uTPeiK5sNfu8I6CaVbUc+r3teNdEe1GCLa7wq7o5\n\tUQ+iEjDsZ+iUw7/CaON//W2sK7/IJKywl1NPcWXM0kS4hOUk4yyzd0OBsdeVOX3y\n\tiVqIYfyBbjv8Pig7bw87gs5oTQYqIoW0xyZMAOFTfr92fbab8Nbe/ePOdiLwwj8V\n\tvhVaSjZQXVq46sNzcoeHVBeQHJ+UEh3RPTNoho0aEVmBC/ViTDWNPFgQKc7S+y5v\n\t84hMax0clw==", "From": "Keith Busch <kbusch@meta.com>", "To": "<linux-pci@vger.kernel.org>, <helgaas@kernel.org>,\n <dan.j.williams@intel.com>", "CC": "<alex@shazbot.org>, <ilpo.jarvinen@linux.intel.com>,\n Keith Busch\n\t<kbusch@kernel.org>", "Subject": "[PATCHv5 2/3] PCI: allow all bus devices to use the same slot", "Date": "Tue, 17 Feb 2026 08:08:35 -0800", "Message-ID": "<20260217160836.2709885-3-kbusch@meta.com>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260217160836.2709885-1-kbusch@meta.com>", "References": "<20260217160836.2709885-1-kbusch@meta.com>", "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", "Content-Transfer-Encoding": "quoted-printable", "X-FB-Internal": "Safe", "Content-Type": "text/plain", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMjE3MDEzMSBTYWx0ZWRfX7pFFri50C5Xf\n tW+QfeMz4P5nDE4zjJTdNC19126BJ8kM1AnxeUnTV+8wRD2m+URuvhd0XXTskcvYqfB7ZCMKV/m\n aPHUmSYf+JuZRp+VvCEd0gIBR651HmDDDF77faQpcwW0cfXbr8nBULmRHb/SVmxnIHWXCsw6FQs\n /5frYnI9LNsO5Op8yWSgFs13g0CiKX/yVcez1Cgkhdf5yZFihOc/g9Ljhl3z+qOez9i5HOj44/v\n FKfqsg1C+xRaYK82eg0m4idAZndiwnfqmiJUn9K0zfKtgEsRnyYFocQv2PkfsTNSr/BWxMGnPsX\n e2lNehMuBgp0VPROgvr42c5U4LRW4+Ij4hQwDhrvRtBqlLiWdisL3eAS8vI5aHwpKalFIHo2RlP\n uOCdFaq/RnCFFeWwUm4XDvc72ZD3URjBmkqW4x8LUELVXgCsukjH5ErnTLhcg8co3JWwJ/Z/erX\n 6eA32jiryAe2VGuw4Ng==", "X-Authority-Analysis": "v=2.4 cv=RbWdyltv c=1 sm=1 tr=0 ts=69949297 cx=c_pps\n a=MfjaFnPeirRr97d5FC5oHw==:117 a=MfjaFnPeirRr97d5FC5oHw==:17\n a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22\n a=GgsMoib0sEa3-_RKJdDe:22 a=VwQbUJbxAAAA:8 a=QyXUC8HyAAAA:8\n a=zHBkS0eXDblhuCRJbxAA:9", "X-Proofpoint-ORIG-GUID": "hhaIcouuNJHN2P8e688_CeWxRHnta4gB", "X-Proofpoint-GUID": "hhaIcouuNJHN2P8e688_CeWxRHnta4gB", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-02-17_02,2026-02-16_04,2025-10-01_01" }, "content": "From: Keith Busch <kbusch@kernel.org>\n\nA pcie hotplug slot applies to the entire subordinate bus. Thus, pciehp\nonly allocates a single hotplug_slot for the bridge to that bus. The pci\nslot, though, would only match to functions on device 0, meaning all\ndevice beyond that are not matched to any slot even though they share\nit. A slot reset will break all the missing devices because the handling\nskips them.\n\nFor example, ARI devices with more than 8 functions fail because their state is\nnot properly handled, nor is the attached driver notified of the reset. In the\nbest case, the device will appear unresponsive to the driver, resulting in\nunexpected errors. A worse possibility may panic the kernel if in flight\ntransactions trigger hardware reported errors like this real observation:\n\n vfio-pci 0000:01:00.0: resetting\n vfio-pci 0000:01:00.0: reset done\n {1}[Hardware Error]: Error 1, type: fatal\n {1}[Hardware Error]: section_type: PCIe error\n {1}[Hardware Error]: port_type: 0, PCIe end point\n {1}[Hardware Error]: version: 0.2\n {1}[Hardware Error]: command: 0x0140, status: 0x0010\n {1}[Hardware Error]: device_id: 0000:01:01.0\n {1}[Hardware Error]: slot: 0\n {1}[Hardware Error]: secondary_bus: 0x00\n {1}[Hardware Error]: vendor_id: 0x1d9b, device_id: 0x0207\n {1}[Hardware Error]: class_code: 020000\n {1}[Hardware Error]: bridge: secondary_status: 0x0000, control: 0x0000\n {1}[Hardware Error]: aer_cor_status: 0x00008000, aer_cor_mask: 0x00002000\n {1}[Hardware Error]: aer_uncor_status: 0x00010000, aer_uncor_mask: 0x00100000\n {1}[Hardware Error]: aer_uncor_severity: 0x006f6030\n {1}[Hardware Error]: TLP Header: 0a412800 00192080 60000004 00000004\n GHES: Fatal hardware error but panic disabled\n Kernel panic - not syncing: GHES: Fatal hardware error\n\nAllow a slot to be created to claim all devices on a bus, not just a\nmatching device. This is done by introducing a sentinel value, named\nPCI_SLOT_ALL_DEVICES, which then has the pci slot match to any device on\nthe bus. This fixes slot resets for pciehp.\n\nSince 0xff already has special meaning, the chosen value for this new\nfeature is 0xfe. This will not clash with any actual slot number since\nthey are limited to 5 bits.\n\nReviewed-by: Dan Williams <dan.j.williams@intel.com>\nSigned-off-by: Keith Busch <kbusch@kernel.org>\n---\n drivers/pci/hotplug/pciehp_core.c | 3 ++-\n drivers/pci/slot.c | 27 +++++++++++++++++++++++----\n include/linux/pci.h | 8 +++++++-\n 3 files changed, 32 insertions(+), 6 deletions(-)", "diff": "diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c\nindex f59baa9129709..d80346d567049 100644\n--- a/drivers/pci/hotplug/pciehp_core.c\n+++ b/drivers/pci/hotplug/pciehp_core.c\n@@ -79,7 +79,8 @@ static int init_slot(struct controller *ctrl)\n \tsnprintf(name, SLOT_NAME_SIZE, \"%u\", PSN(ctrl));\n \n \tretval = pci_hp_initialize(&ctrl->hotplug_slot,\n-\t\t\t\t ctrl->pcie->port->subordinate, 0, name);\n+\t\t\t\t ctrl->pcie->port->subordinate,\n+\t\t\t\t PCI_SLOT_ALL_DEVICES, name);\n \tif (retval) {\n \t\tctrl_err(ctrl, \"pci_hp_initialize failed: error %d\\n\", retval);\n \t\tkfree(ops);\ndiff --git a/drivers/pci/slot.c b/drivers/pci/slot.c\nindex 50fb3eb595fe6..bf6f265454a84 100644\n--- a/drivers/pci/slot.c\n+++ b/drivers/pci/slot.c\n@@ -42,6 +42,15 @@ static ssize_t address_read_file(struct pci_slot *slot, char *buf)\n \t\t\t\t pci_domain_nr(slot->bus),\n \t\t\t\t slot->bus->number);\n \n+\t/*\n+\t * Preserve legacy ABI expectations that hotplug drivers that manage\n+\t * multiple devices per slot emit 0 for the device number.\n+\t */\n+\tif (slot->number == PCI_SLOT_ALL_DEVICES)\n+\t\treturn sysfs_emit(buf, \"%04x:%02x:00\\n\",\n+\t\t\t\t pci_domain_nr(slot->bus),\n+\t\t\t\t slot->bus->number);\n+\n \treturn sysfs_emit(buf, \"%04x:%02x:%02x\\n\",\n \t\t\t pci_domain_nr(slot->bus),\n \t\t\t slot->bus->number,\n@@ -73,7 +82,8 @@ static void pci_slot_release(struct kobject *kobj)\n \n \tdown_read(&pci_bus_sem);\n \tlist_for_each_entry(dev, &slot->bus->devices, bus_list)\n-\t\tif (PCI_SLOT(dev->devfn) == slot->number)\n+\t\tif (slot->number == PCI_SLOT_ALL_DEVICES ||\n+\t\t PCI_SLOT(dev->devfn) == slot->number)\n \t\t\tdev->slot = NULL;\n \tup_read(&pci_bus_sem);\n \n@@ -166,7 +176,8 @@ void pci_dev_assign_slot(struct pci_dev *dev)\n \n \tmutex_lock(&pci_slot_mutex);\n \tlist_for_each_entry(slot, &dev->bus->slots, list)\n-\t\tif (PCI_SLOT(dev->devfn) == slot->number)\n+\t\tif (slot->number == PCI_SLOT_ALL_DEVICES ||\n+\t\t PCI_SLOT(dev->devfn) == slot->number)\n \t\t\tdev->slot = slot;\n \tmutex_unlock(&pci_slot_mutex);\n }\n@@ -188,7 +199,7 @@ static struct pci_slot *get_slot(struct pci_bus *parent, int slot_nr)\n /**\n * pci_create_slot - create or increment refcount for physical PCI slot\n * @parent: struct pci_bus of parent bridge\n- * @slot_nr: PCI_SLOT(pci_dev->devfn) or -1 for placeholder\n+ * @slot_nr: PCI_SLOT(pci_dev->devfn), -1 for placeholder, or PCI_SLOT_ALL_DEVICES\n * @name: user visible string presented in /sys/bus/pci/slots/<name>\n * @hotplug: set if caller is hotplug driver, NULL otherwise\n *\n@@ -222,6 +233,13 @@ static struct pci_slot *get_slot(struct pci_bus *parent, int slot_nr)\n * consist solely of a dddd:bb tuple, where dddd is the PCI domain of the\n * %struct pci_bus and bb is the bus number. In other words, the devfn of\n * the 'placeholder' slot will not be displayed.\n+ *\n+ * Bus-wide slots:\n+ * For PCIe hotplug, the physical slot encompasses the entire subordinate\n+ * bus, not just a single device number. Pass @slot_nr == PCI_SLOT_ALL_DEVICES\n+ * to create a slot that matches all devices on the bus. Unlike placeholder\n+ * slots, bus-wide slots go through normal slot lookup and reuse existing\n+ * slots if present.\n */\n struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,\n \t\t\t\t const char *name,\n@@ -285,7 +303,8 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,\n \n \tdown_read(&pci_bus_sem);\n \tlist_for_each_entry(dev, &parent->devices, bus_list)\n-\t\tif (PCI_SLOT(dev->devfn) == slot_nr)\n+\t\tif (slot_nr == PCI_SLOT_ALL_DEVICES ||\n+\t\t PCI_SLOT(dev->devfn) == slot_nr)\n \t\t\tdev->slot = slot;\n \tup_read(&pci_bus_sem);\n \ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex edf792a79193f..7073519bcc1ad 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -72,12 +72,18 @@\n /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */\n #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)\n \n+/*\n+ * PCI_SLOT_ALL_DEVICES indicates a slot that covers all devices on the bus.\n+ * Used for PCIe hotplug where the physical slot is the entire subordinate bus.\n+ */\n+#define PCI_SLOT_ALL_DEVICES\t0xfe\n+\n /* pci_slot represents a physical slot */\n struct pci_slot {\n \tstruct pci_bus\t\t*bus;\t\t/* Bus this slot is on */\n \tstruct list_head\tlist;\t\t/* Node in list of slots */\n \tstruct hotplug_slot\t*hotplug;\t/* Hotplug info (move here) */\n-\tunsigned char\t\tnumber;\t\t/* PCI_SLOT(pci_dev->devfn) */\n+\tunsigned char\t\tnumber;\t\t/* Device nr, or PCI_SLOT_ALL_DEVICES */\n \tstruct kobject\t\tkobj;\n };\n \n", "prefixes": [ "PATCHv5", "2/3" ] }