@samitouri / QOSamiQemu / commits / 7b0516912e

whpx: i386: synchronise PAT too

https://github.com/cmspam/winq-emu hints that this might be wanted for some use-cases and it's a step towards full state sync: > Linux uses PAT to mark virtio-gpu / Venus shared memory as > Write-Combining. Previously the partition's PAT was not > synchronised with the guest, so the guest's MTRR/PAT cache-type > computation could fall back to UC for memory that should be WC. Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260812082814.27217-5-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Mohamed Mediouni committed Aug 12, 2026 at 10:28 UTC 7b0516912e44e73ba0859e91aed848d5be26f05e
1 file changed +5 -7
target/i386/whpx/whpx-all.c
+5 -7
@@ -115,7 +115,7 @@ static const WHV_REGISTER_NAME whpx_register_names[] = {
115 #ifdef TARGET_X86_64
116 WHvX64RegisterKernelGsBase,
117 #endif
118 - /* WHvX64RegisterPat, */
118 + WHvX64RegisterPat,
119 WHvX64RegisterSysenterCs,
120 WHvX64RegisterSysenterEip,
121 WHvX64RegisterSysenterEsp,
@@ -624,9 +624,8 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel level)
624 assert(whpx_register_names[idx] == WHvX64RegisterKernelGsBase);
625 vcxt.values[idx++].Reg64 = env->kernelgsbase;
626 #endif
627 -
628 - /* WHvX64RegisterPat - Skipped */
629 -
627 + assert(whpx_register_names[idx] == WHvX64RegisterPat);
628 + vcxt.values[idx++].Reg64 = env->pat;
629 assert(whpx_register_names[idx] == WHvX64RegisterSysenterCs);
630 vcxt.values[idx++].Reg64 = env->sysenter_cs;
631 assert(whpx_register_names[idx] == WHvX64RegisterSysenterEip);
@@ -962,9 +961,8 @@ void whpx_get_registers(CPUState *cpu, WHPXStateLevel level)
961 assert(whpx_register_names[idx] == WHvX64RegisterKernelGsBase);
962 env->kernelgsbase = vcxt.values[idx++].Reg64;
963 #endif
965 -
966 - /* WHvX64RegisterPat - Skipped */
967 -
964 + assert(whpx_register_names[idx] == WHvX64RegisterPat);
965 + env->pat = vcxt.values[idx++].Reg64;
966 assert(whpx_register_names[idx] == WHvX64RegisterSysenterCs);
967 env->sysenter_cs = vcxt.values[idx++].Reg64;
968 assert(whpx_register_names[idx] == WHvX64RegisterSysenterEip);