Commit 6b70299
committed
fix(pci): disable decoding while sizing BARs
Determining the size of a BAR writes all-ones into it and restores the
previous value afterwards. While decoding is enabled, the device decodes
those intermediate values as real addresses and relocates itself. For a
passed-through device the host follows that relocation and tries to map
the BAR outside of the guest, which aborts the VM:
kvm_set_user_memory_region: KVM_SET_USER_MEMORY_REGION failed,
slot=5, start=0xfffffffffe000000, size=0x400000: Invalid argument
Disable decoding around the probe, as the PCI specification requires,
and route the informational bus dump through get_bar so that it is
covered as well.1 parent d0854f9 commit 6b70299
1 file changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
79 | 93 | | |
80 | 94 | | |
81 | 95 | | |
| |||
268 | 282 | | |
269 | 283 | | |
270 | 284 | | |
271 | | - | |
| 285 | + | |
272 | 286 | | |
273 | 287 | | |
274 | 288 | | |
| |||
0 commit comments