Allow a 4-byte write to PCI config space to overlap
the 2 read-only bytes at the start of a PCI capability. This is the sequence that OpenBSD uses when enabling MSI interrupts, and works fine on real h/w. In bhyve, convert the 4 byte write to a 2-byte write to the r/w area past the first 2 r/o bytes of a capability. Reviewed by: neel Approved by: re@ (blanket)
This commit is contained in:
parent
d5cc57e6ab
commit
2a8d400a2e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256248
@ -941,10 +941,19 @@ pci_emul_capwrite(struct pci_devinst *pi, int offset, int bytes, uint32_t val)
|
||||
assert(offset >= capoff);
|
||||
|
||||
/*
|
||||
* Capability ID and Next Capability Pointer are readonly
|
||||
* Capability ID and Next Capability Pointer are readonly.
|
||||
* However, some o/s's do 4-byte writes that include these.
|
||||
* For this case, trim the write back to 2 bytes and adjust
|
||||
* the data.
|
||||
*/
|
||||
if (offset == capoff || offset == capoff + 1)
|
||||
return;
|
||||
if (offset == capoff || offset == capoff + 1) {
|
||||
if (offset == capoff && bytes == 4) {
|
||||
bytes = 2;
|
||||
offset += 2;
|
||||
val >>= 16;
|
||||
} else
|
||||
return;
|
||||
}
|
||||
|
||||
switch (capid) {
|
||||
case PCIY_MSI:
|
||||
|
Loading…
Reference in New Issue
Block a user