This patch series is a fix for the recent merge of the outdated patch series:
https://lore.kernel.org/all/20260428135053.251200-1-dblanzeanu@linux.microsoft.com/
The above patch series had some newer versions that fixed addressed feedback
from reviewers.
The commits do the following:
1. Moves the definition for the `hv_vp_register_page` to `hvhdk.h`
Fixes: 8afb40b7fe
2. Changes the register page setup to fail in case the mmap of the page fails.
This way it signals an issue early.
Fixes: a173f8f170
3. Rename functions local to the `mshv-cpu.c` linked to register page get.
Use the register page to read registers on VM exit. General purpose
registers, RIP, RFLAGS, segment registers, and control registers
(CR0, CR4, CR4, CR8, EFER) are read directly from the page. Registers
not present on the page (TR, LDTR, GDTR, IDTR, CR2, APIC_BASE) are not
fetched anymore for performance reasons.
Removes the fallback to ioctls in case the register page is not correctly set
up and aborts.
Fixes: 40072a7391
4. Changes the registers storing to only use the register page and not rely on
ioctls for perfomance improvements. From local tests, the special registers
that are not stored, do not get modified when emulating. However, if there's
an issue discovered, we'll fix later.
Fixes: 80c7f8e9cd
5. When a device handler (e.g. vmport) calls cpu_synchronize_state() during
I/O port dispatch, it sets cpu->accel->dirty = true and may modify
registers directly in env. The old PIO code ignored this: it
unconditionally wrote the stale info->rax from the VM-exit intercept
message back to the hypervisor and then cleared dirty, discarding any
register changes made by the device.
Note: This was a change present in version 3 of the patch series but not
present in the version 1 of the patch series (the one merged)
The register page is only used when it has been successfully mmapped and
the hypervisor has marked it as valid (`isvalid != 0`). Otherwise, an error is
returned and execution aborted to signal something faulty and unexpected.
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAAE0AAAAac2stc3NoLWVkMjU1MTlAb3BlbnNzaC5jb20AAAAgF4l9Pi
ZyIMDy0ZI4SCYaMCvjXS3h6Dpo3xDFvSh0I7oAAAAHc3NoOmdpdAAAAANnaXQAAAAAAAAA
BnNoYTUxMgAAAGcAAAAac2stc3NoLWVkMjU1MTlAb3BlbnNzaC5jb20AAABA4egRAbnGLI
XkdzHMqxAMQj1wQNIw+Ja9we8xUkEiJW96FaummDyD2h2TxplwF93KnWYW/sUYZMX5b1C3
3OOcBgUAACUF
-----END SSH SIGNATURE-----
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAAE0AAAAac2stc3NoLWVkMjU1MTlAb3BlbnNzaC5jb20AAAAgF4l9Pi
ZyIMDy0ZI4SCYaMCvjXS3h6Dpo3xDFvSh0I7oAAAAHc3NoOmdpdAAAAANnaXQAAAAAAAAA
BnNoYTUxMgAAAGcAAAAac2stc3NoLWVkMjU1MTlAb3BlbnNzaC5jb20AAABAqkJRImazba
3Xjj17Hi7FDcJ5XC7f+rFXUvDc58gax1GyCHtOu16ldDx3ldSi2Zl8iGFtauFsLHRAdPpK
IoPyDAUAACUR
-----END SSH SIGNATURE-----
Doru Blânzeanu (5):
include/hw/hyperv: move hv_vp_register_page struct definition
target/i386/mshv: abort when hv_vp_register_page setup fails
target/i386/mshv: remove fallback for register page get registers
target/i386/mshv: remove fallback for register page set registers
target/i386/mshv: fix pio handlers clobbering device-modified
registers
include/hw/hyperv/hvgdk.h | 2 +
include/hw/hyperv/hvgdk_mini.h | 103 --------------
include/hw/hyperv/hvhdk.h | 106 ++++++++++++++
target/i386/mshv/mshv-cpu.c | 249 +++++++++++++++------------------
4 files changed, 220 insertions(+), 240 deletions(-)
--
2.53.0