From: Lukas Wunner <lukas@wunner.de>
To: "Alexandre N." <an.tech@mailo.com>
Cc: "Bernd Schumacher" <bernd@bschu.de>,
"Uwe Kleine-König" <ukleinek@debian.org>,
1131025@bugs.debian.org,
"Salvatore Bonaccorso" <carnil@debian.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Mario Limonciello" <mario.limonciello@amd.com>,
regressions@lists.linux.dev, stable@vger.kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
"Alex Williamson" <alex@shazbot.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: Re: Bug#1131025: [6.12.y regression] Regression with 58130e7ce6cb ("PCI/ERR: Ensure error recoverability at all times"): echo vfio-pci >driver_override does not work for DVB Adapter
Date: Mon, 13 Apr 2026 05:40:31 +0200 [thread overview]
Message-ID: <adxlr9lWBTZIQMev@wunner.de> (raw)
In-Reply-To: <dd3c3358-de0f-4a56-9c81-04aceaab4058@mailo.com>
On Sun, Apr 12, 2026 at 08:04:02PM +0200, Alexandre N. wrote:
> Independent confirmation on different hardware and a different
> stable branch, plus test results for the proposed fix on 6.19.11.
>
> Hardware: PCI 1b4b:9215 Marvell 88SE9215 PCIe 2.0 x1 4-port
> SATA 6 Gb/s controller, whole-device passthrough to a
> Windows 10 guest via QEMU/libvirt on
> an AMD Ryzen 7 7700 8-Core x86_64 host (Arch Linux).
> Last good: linux 6.18.9
> First bad: linux 6.18.13 (contains stable backport 71c50e60421b
> of upstream a2f1e22390ac, "PCI/ERR:
> Ensure error recoverability at all
> times", first backported in 6.18.10)
> Also bad: linux 6.19.11 (mainline carries a2f1e22390ac)
>
> Confirmed by rolling linux back to 6.18.9 with everything else
> untouched: problem vanishes. Rolling forward to 6.18.13 or any
> later versions in 6.18/6.19 reproduces it everytime.
Hm, that's unexpected. I cooked up the patch below on Saturday
but didn't immediately get around to sending it because of a
security bug report that came in later that day.
Could both of you, Alexandre and Bernd, give that patch a spin
to see if it fixes the issue? I believe the patch should at least
fix things for Bernd. If it doesn't fix things for you Alexandre,
I'll have to dig deeper.
Thanks!
Lukas
-- >8 --
Subject: [PATCH] PCI: Update saved_config_space upon resource assignment
Bernd reports passthrough failure of a Digital Devices Cine S2 V6 DVB
adapter plugged into an ASRock X570S PG Riptide board with BIOS version
P5.41 (09/07/2023):
ddbridge 0000:07:00.0: detected Digital Devices Cine S2 V6 DVB adapter
ddbridge 0000:07:00.0: cannot read registers
ddbridge 0000:07:00.0: fail
The BIOS assigns an incorrect BAR to the DVB adapter which has the upper
32 bits set to "all ones". This doesn't fit into the upstream bridge
window, which has those bits set to "all zeroes". The kernel therefore
corrects the BAR assignment:
pci 0000:07:00.0: BAR 0 [mem 0xfffffffffc500000-0xfffffffffc50ffff 64bit]: can't claim; no compatible bridge window
pci 0000:07:00.0: BAR 0 [mem 0xfc500000-0xfc50ffff 64bit]: assigned
Correction of the BAR assignment happens in an x86-specific fs_initcall,
pcibios_assign_resources(), after PCI devices have been enumerated in a
subsys_initcall. This order was introduced at the behest of Linus in
2004:
https://git.kernel.org/tglx/history/c/a06a30144bbc
No other architecture performs such a late BAR correction.
Bernd bisected the issue to commit a2f1e22390ac ("PCI/ERR: Ensure error
recoverability at all times"), but it only occurs in the absence of commit
4d4c10f763d7 ("PCI: Explicitly put devices into D0 when initializing").
This combination exists in stable kernel v6.12.70, but not in mainline,
hence mainline does not exhibit the issue.
Since commit a2f1e22390ac, config space is saved on enumeration (in a
subsys_initcall), i.e. prior to the BAR correction. Upon passthrough,
the corrected BAR is overwritten with the incorrect saved value by:
vfio_pci_core_register_device()
vfio_pci_set_power_state()
pci_restore_state()
But only if the device's current_state is PCI_UNKNOWN, as it was prior to
commit 4d4c10f763d7. Since the commit it is PCI_D0, which changes the
behavior of vfio_pci_set_power_state() to no longer restore the state
without saving it first.
Although the issue could be fixed in v6.12-stable by backporting
4d4c10f763d7 or by changing vfio_pci_set_power_state(), a more robust fix
is to update saved_config_space upon resource assignment.
Reported-by: Bernd Schumacher <bernd@bschu.de>
Closes: https://lore.kernel.org/r/acfZrlP0Ua_5D3U4@eldamar.lan/
Fixes: a2f1e22390ac ("PCI/ERR: Ensure error recoverability at all times")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org # v6.12+
---
drivers/pci/setup-res.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index e5fcadfc58b0..1769ba960197 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -102,6 +102,7 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
}
pci_write_config_dword(dev, reg, new);
+ dev->saved_config_space[reg / 4] = new;
pci_read_config_dword(dev, reg, &check);
if ((new ^ check) & mask) {
@@ -112,6 +113,7 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
if (res->flags & IORESOURCE_MEM_64) {
new = region.start >> 16 >> 16;
pci_write_config_dword(dev, reg + 4, new);
+ dev->saved_config_space[(reg + 4) / 4] = new;
pci_read_config_dword(dev, reg + 4, &check);
if (check != new) {
pci_err(dev, "%s: error updating (high %#010x != %#010x)\n",
--
2.51.0
next prev parent reply other threads:[~2026-04-13 3:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <177373189751.7987.7156982489427825197.reportbug@obelix-trixie.bs.de>
2026-03-28 13:37 ` [6.12.y regression] Regression with 58130e7ce6cb ("PCI/ERR: Ensure error recoverability at all times"): echo vfio-pci >driver_override does not work for DVB Adapter Salvatore Bonaccorso
2026-03-28 14:11 ` Lukas Wunner
2026-03-28 16:16 ` Bernd Schumacher
2026-03-28 19:14 ` Lukas Wunner
2026-03-29 13:52 ` Bernd Schumacher
2026-03-29 16:22 ` Lukas Wunner
2026-03-30 6:14 ` Bernd Schumacher
2026-03-30 13:56 ` Ilpo Järvinen
2026-03-31 13:09 ` Lukas Wunner
2026-03-31 13:13 ` Lukas Wunner
2026-03-31 23:01 ` Alex Williamson
2026-04-01 4:11 ` Lukas Wunner
2026-04-01 13:10 ` Bug#1131025: " Uwe Kleine-König
2026-04-01 16:16 ` Bernd Schumacher
2026-04-01 20:18 ` Lukas Wunner
2026-04-02 5:53 ` Bernd Schumacher
2026-04-03 14:58 ` Lukas Wunner
2026-04-04 9:54 ` Bernd Schumacher
[not found] ` <dd3c3358-de0f-4a56-9c81-04aceaab4058@mailo.com>
2026-04-13 3:40 ` Lukas Wunner [this message]
2026-04-13 6:48 ` Bernd Schumacher
2026-03-28 14:40 ` Thorsten Leemhuis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adxlr9lWBTZIQMev@wunner.de \
--to=lukas@wunner.de \
--cc=1131025@bugs.debian.org \
--cc=alex@shazbot.org \
--cc=an.tech@mailo.com \
--cc=bernd@bschu.de \
--cc=bhelgaas@google.com \
--cc=carnil@debian.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=rafael@kernel.org \
--cc=regressions@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=ukleinek@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox