vmm: return all-ones for unregistered MMIO and PIO reads - #8237
Conversation
|
I could also fix 'read to unregistered address' with 'read from unregistered address' in the two info! messages while we're touching this code if you like? [Edit: saw the 👍 so now done.] |
rbradford
left a comment
There was a problem hiding this comment.
Nice! This has been around a long time!
|
FWIW - QEMU returns all zeroes for MMIO (and all ones for PIO) - should we worry about incompatibility here? |
Ah, interesting. The 0xff behaviour seems 'standard' and is certainly what https://github.com/torvalds/linux/blob/v6.17/arch/x86/kernel/cpu/amd.c#L1343 and torvalds/linux@e9576e0 suggest is the correct error value, but I'm not strongly wedded to it. Either value would fix the strange FCH behaviour in #7415. |
When reading from an unregistered MMIO address, mmio_read() wasn't initialising the buffer, so guests were reading stale bytes from the previous MMIO transaction rather than all 0xff bytes like master abort on real hardware. Fill data with 0xff on invalid reads. Correct 'read to unregistered address' info message to 'read from unregistered address' while we're touching this block. Signed-off-by: Chris Webb <[email protected]>
When reading from an unregistered PIO address, pio_read() wasn't initialising the buffer, so guests were reading stale bytes from the previous PIO transaction rather than all 0xff bytes like master abort on real hardware. Fill data with 0xff on invalid reads. Correct 'read to unregistered address' info message to 'read from unregistered address' while we're touching this block. Signed-off-by: Chris Webb <[email protected]>
|
Sorry to follow up to my own reply, but this thread: https://lore.kernel.org/all/[email protected]/ suggests that qemu is returning 0xffffffff to at least the S5_RESET_STATUS mmio read. (Qemu isn't named in the first message, but it is further down the thread.) |
When reading from an unregistered MMIO or PIO address,
mmio_read()andpio_read()weren't initialising the buffer, so guests were reading stale bytes from the previous MMIO/PIO transaction rather than all 0xff bytes like master abort on real hardware.Fill the buffer with 0xff on invalid reads in each case.
Fixes #7415