pci: Detect masked BAR size probes#183
Draft
Coffeeri wants to merge 1 commit into
Draft
Conversation
Coffeeri
marked this pull request as draft
July 17, 2026 06:53
Author
|
Setting it to draft as upstreams CI failed the windows integration tests. Currently investigating and running our pipeline, including unused - fixed. |
Coffeeri
force-pushed
the
backport/pci-bar-size-probe-fix
branch
from
July 17, 2026 07:33
aebe8cb to
0f4e234
Compare
A PCI BAR stores its address in the upper bits and type information in the lower bits. To determine the BAR size, an operating system disables memory decoding, writes ones to the BAR's address bits, and reads the value back. Bits that remain zero reveal the required alignment and therefore the size. We currently recognize only 0xffffffff as a size probe. OpenBSD instead writes the memory BAR address mask 0xfffffff0, without setting the lower four non-address bits [0][1]. We misinterpret that probe as a real BAR relocation. Because OpenBSD has disabled memory space, the relocation remains pending. We apply it when OpenBSD enables memory space again, moving the virtio block BAR away from its mapped address and preventing the guest from booting. Recognize probes using the address mask for each BAR type and exclude them from BAR reprogramming. Add a test for the OpenBSD memory BAR probe. [0]: https://github.com/openbsd/src/blob/54a2bc1e5457a3dc555cb0cc642641a62266c778/sys/dev/pci/pci_map.c#L154-L180 [1]: https://github.com/openbsd/src/blob/54a2bc1e5457a3dc555cb0cc642641a62266c778/sys/dev/pci/pcireg.h#L429-L443 Co-authored-by: Thomas Prescher <thomas.prescher@cyberus-technology.de> On-behalf-of: SAP leander.kohler@sap.com Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
Coffeeri
force-pushed
the
backport/pci-bar-size-probe-fix
branch
from
July 17, 2026 09:11
0f4e234 to
7f99f90
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backporting cloud-hypervisor#8598 (https://github.com/cobaltcore-dev/cobaltcore/issues/632), as it just landed upstream and is therefore not included in v53 nor in the later rebase on top of it.
This change fixes a problem when the guest OS probes the pci bar size and was until now incompatible with OpenBSD.
Pipeline