get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2223562/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2223562,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2223562/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/febc3f354e0c1f5a9f5b3ee9ffddaa44caccf651.1776268054.git.lukas@wunner.de/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": "<febc3f354e0c1f5a9f5b3ee9ffddaa44caccf651.1776268054.git.lukas@wunner.de>",
    "date": "2026-04-15T15:56:06",
    "name": "PCI: Update saved_config_space upon resource assignment",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d1cf15d7b6d4d41e2a903672604f1f33313cfa9d",
    "submitter": {
        "id": 68499,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/68499/?format=api",
        "name": "Lukas Wunner",
        "email": "lukas@wunner.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/febc3f354e0c1f5a9f5b3ee9ffddaa44caccf651.1776268054.git.lukas@wunner.de/mbox/",
    "series": [
        {
            "id": 500009,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/500009/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=500009",
            "date": "2026-04-15T15:56:06",
            "name": "PCI: Update saved_config_space upon resource assignment",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500009/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2223562/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2223562/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-52559-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 spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-52559-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=144.76.133.104",
            "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=wunner.de",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=wunner.de"
        ],
        "Received": [
            "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::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 4fwm326nGfz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 01:56:14 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 6E8B93001CF9\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 15:56:12 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 954A23D4125;\n\tWed, 15 Apr 2026 15:56:09 +0000 (UTC)",
            "from mailout3.hostsharing.net (mailout3.hostsharing.net\n [144.76.133.104])\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 1EF5F3E314D\n\tfor <linux-pci@vger.kernel.org>; Wed, 15 Apr 2026 15:56:04 +0000 (UTC)",
            "from h08.hostsharing.net (h08.hostsharing.net\n [IPv6:2a01:37:1000::53df:5f1c:0])\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 client-signature ECDSA (secp384r1) client-digest SHA384)\n\t(Client CN \"*.hostsharing.net\",\n Issuer \"GlobalSign GCC R6 AlphaSSL CA 2025\" (verified OK))\n\tby mailout3.hostsharing.net (Postfix) with ESMTPS id 6CE23C81;\n\tWed, 15 Apr 2026 17:56:03 +0200 (CEST)",
            "by h08.hostsharing.net (Postfix, from userid 100393)\n\tid 422B06017606; Wed, 15 Apr 2026 17:56:03 +0200 (CEST)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776268569; cv=none;\n b=b0EL2YxIESpfnNanrH0ncGbxDR7jilGg25Z1fX6ykk4kAJ79QqCARFLMOv0dLz/kWhxOoiO5DJk9TviOc5X4eY1X+aGIIC/VG+OKzjfSHNAiENAo6S4DDDEzfM4GtocWEJcZIqDbE4hvqnwpXOqksyVM20fqjdQth24UjPE5S34=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776268569; c=relaxed/simple;\n\tbh=d1UU5ZXPZHtItb3fz+Vnqm12sYKrz0Zq+3sQFJsVmxQ=;\n\th=Message-Id:From:Date:Subject:To:Cc;\n b=ks2UI3h+QQcpi/j8Zy/zO6sA+QJXLwdp97TDCYJFy++Y5Inmo1SI5sFBfqNP53J1gvbcdabd4N/hPu+Vh/uJ11DpaWCF7xuvulyV2XfTw1JNCF82xOYWotcKUmjesJ0ETI1wvH2IxsEZjtY4oTi9OuZcjNQsr5dGx88CnUXObmM=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=wunner.de;\n spf=pass smtp.mailfrom=wunner.de; arc=none smtp.client-ip=144.76.133.104",
        "Message-Id": "\n <febc3f354e0c1f5a9f5b3ee9ffddaa44caccf651.1776268054.git.lukas@wunner.de>",
        "From": "Lukas Wunner <lukas@wunner.de>",
        "Date": "Wed, 15 Apr 2026 17:56:06 +0200",
        "Subject": "[PATCH] PCI: Update saved_config_space upon resource assignment",
        "To": "Bjorn Helgaas <helgaas@kernel.org>",
        "Cc": "Bernd Schumacher <bernd@bschu.de>, \"Alexandre N.\" <an.tech@mailo.com>,\n Salvatore Bonaccorso <carnil@debian.org>, 1131025@bugs.debian.org,\n Uwe Kleine-Koenig <ukleinek@debian.org>,\n \"Rafael J. Wysocki\" <rafael@kernel.org>,\n Mario Limonciello <mario.limonciello@amd.com>,\n Alex Williamson <alex@shazbot.org>,\n Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>, regressions@lists.linux.dev,\n linux-pci@vger.kernel.org",
        "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>"
    },
    "content": "Bernd reports passthrough failure of a Digital Devices Cine S2 V6 DVB\nadapter plugged into an ASRock X570S PG Riptide board with BIOS version\nP5.41 (09/07/2023):\n\n  ddbridge 0000:05:00.0: detected Digital Devices Cine S2 V6 DVB adapter\n  ddbridge 0000:05:00.0: cannot read registers\n  ddbridge 0000:05:00.0: fail\n\nBIOS assigns an incorrect BAR to the DVB adapter which doesn't fit into\nthe upstream bridge window.  The kernel corrects the BAR assignment:\n\n  pci 0000:07:00.0: BAR 0 [mem 0xfffffffffc500000-0xfffffffffc50ffff 64bit]: can't claim; no compatible bridge window\n  pci 0000:07:00.0: BAR 0 [mem 0xfc500000-0xfc50ffff 64bit]: assigned\n\nCorrection of the BAR assignment happens in an x86-specific fs_initcall,\npcibios_assign_resources(), after device enumeration in a subsys_initcall.\nThis order was introduced at the behest of Linus in 2004:\n\n    https://git.kernel.org/tglx/history/c/a06a30144bbc\n\nNo other architecture performs such a late BAR correction.\n\nBernd bisected the issue to commit a2f1e22390ac (\"PCI/ERR: Ensure error\nrecoverability at all times\"), but it only occurs in the absence of commit\n4d4c10f763d7 (\"PCI: Explicitly put devices into D0 when initializing\").\nThis combination exists in stable kernel v6.12.70, but not in mainline,\nhence Bernd cannot reproduce the issue with mainline.\n\nSince a2f1e22390ac, config space is saved on enumeration, prior to BAR\ncorrection.  Upon passthrough, the corrected BAR is overwritten with the\nincorrect saved value by:\n\n  vfio_pci_core_register_device()\n    vfio_pci_set_power_state()\n      pci_restore_state()\n\nBut only if the device's current_state is PCI_UNKNOWN, as it was prior to\ncommit 4d4c10f763d7.  Since the commit, it is PCI_D0, which changes the\nbehavior of vfio_pci_set_power_state() to no longer restore the state\nwithout saving it first.\n\nAlexandre is reporting the same issue as Bernd, but in his case, mainline\nis affected as well.  The difference is that on Alexandre's system, the\nhost kernel binds a driver to the device which is unbound prior to\npassthrough, whereas on Bernd's system no driver gets bound by the host\nkernel.\n\nUnbinding sets current_state to PCI_UNKNOWN in pci_device_remove(), so\nwhen vfio-pci is subsequently bound to the device, pci_restore_state() is\nonce again called without invoking pci_save_state() first.\n\nTo robustly fix the issue, always update saved_config_space upon resource\nassignment.\n\nReported-by: Bernd Schumacher <bernd@bschu.de>\nTested-by: Bernd Schumacher <bernd@bschu.de>\nCloses: https://lore.kernel.org/r/acfZrlP0Ua_5D3U4@eldamar.lan/\nReported-by: Alexandre N. <an.tech@mailo.com>\nTested-by: Alexandre N. <an.tech@mailo.com>\nCloses: https://lore.kernel.org/r/dd3c3358-de0f-4a56-9c81-04aceaab4058@mailo.com/\nFixes: a2f1e22390ac (\"PCI/ERR: Ensure error recoverability at all times\")\nSigned-off-by: Lukas Wunner <lukas@wunner.de>\nCc: stable@vger.kernel.org # v6.12+\n---\n drivers/pci/setup-res.c | 2 ++\n 1 file changed, 2 insertions(+)",
    "diff": "diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c\nindex e5fcadf..1769ba9 100644\n--- a/drivers/pci/setup-res.c\n+++ b/drivers/pci/setup-res.c\n@@ -102,6 +102,7 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)\n \t}\n \n \tpci_write_config_dword(dev, reg, new);\n+\tdev->saved_config_space[reg / 4] = new;\n \tpci_read_config_dword(dev, reg, &check);\n \n \tif ((new ^ check) & mask) {\n@@ -112,6 +113,7 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)\n \tif (res->flags & IORESOURCE_MEM_64) {\n \t\tnew = region.start >> 16 >> 16;\n \t\tpci_write_config_dword(dev, reg + 4, new);\n+\t\tdev->saved_config_space[(reg + 4) / 4] = new;\n \t\tpci_read_config_dword(dev, reg + 4, &check);\n \t\tif (check != new) {\n \t\t\tpci_err(dev, \"%s: error updating (high %#010x != %#010x)\\n\",\n",
    "prefixes": []
}