Commit da24a12
pci: preserve full BAR layout across guest sizing
This replaces bar_is_io_space[6] with bar_layout[6] so the full
PCI_BASE_ADDRESS_* bitmask written by pci_set_bar() survives a guest BAR
write. Previously only bit 0 (space) was retained; MEM_TYPE and PREFETCH
bits were silently dropped on the first config-space probe, which meant
pci_set_bar()'s new `layout` parameter was a partial lie.
pci_config_bar() now restores all non-address bits via (bar_layout[bar]
& ~mask) and assigns space_dev[bar].base to the masked address only,
fixing a latent I/O BAR routing bug where the SPACE_IO bit in 'base'
made bus_find_dev() miss the first port.
Header parameter renamed is_io_space -> layout to match the
implementation, and the magic 0x1U mask in pci_set_bar() now uses the
standard PCI_BASE_ADDRESS_SPACE_IO constant.
64-bit BARs still need a paired adjacent slot for the upper dword; that
limitation is now documented in pci_set_bar().
Co-authored-by: Jim Huang <jserv@ccns.ncku.edu.tw>1 parent 1a8f3b9 commit da24a12
3 files changed
Lines changed: 18 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | | - | |
| 159 | + | |
155 | 160 | | |
156 | 161 | | |
157 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
77 | 53 | | |
78 | 54 | | |
79 | 55 | | |
80 | 56 | | |
81 | | - | |
| 57 | + | |
82 | 58 | | |
83 | 59 | | |
84 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
273 | | - | |
| 272 | + | |
274 | 273 | | |
275 | 274 | | |
276 | 275 | | |
| |||
0 commit comments