Closed tmakatos closed 2 years ago
This is done in function vfio_pci_load_config
. Upstream QEMU doesn't seem to do this, the two implementations are quite different in that area.
According to section 6.8.2. ("MSI-X Capability and Table Structures") of "PCI Local Bus Specification Revision 3.0", writtig 2 bytes at offset pdev->msix_cap + PCI_MSIX_FLAGS + 1
means that we write the upper byte of "Message Control", "Table BIR" and the lower bits (0-4) of "Table Offset".
The 1st byte writes to the following parts: the upper 8 bits of "Message Control" is the 3 uppermost bits of "Table Size" which is RO so we can ignore, next are the 3 Reserved bits which again we ignore, and then it's the "Function Mask" and "MSI-X Enable" bits which is must set.
The 2nd byte write to the following parts: the table BIR and the lower 5 bits of the table offset, both are RO so we can ignore.
What's curious is why does QEMU do a 2-byte write (where the 2nd byte touches RO registers so it doesn't have any effect), when a 1-byte write would suffice? I quickly looked at the code and my impression is that there might be a reason (e.g. minimum alignemnt) for writing at leat a word (2 bytes) over the PCI bus.
fixed?
Yes, by 2d1d87016133b6c2f38e4f6a5fca6be5b820653c.
When live migrating back to a host QEMU does this:
But we don't handle it:
IIUC this writes to 2nd half (byte) of
struct mxc
and to the 1st byte ofstruct mtab
(the MSI-X table), which we didn't previously handle at all as QEMU was handling MSI-X.