[PATCH] x86/S3: Restore Xen's MSR_PAT value on S3 resume

Andrew Cooper posted 1 patch 1 year, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230105204839.3676-1-andrew.cooper3@citrix.com
Test gitlab-ci failed
xen/arch/x86/boot/wakeup.S | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] x86/S3: Restore Xen's MSR_PAT value on S3 resume
Posted by Andrew Cooper 1 year, 3 months ago
There are two paths in the trampoline, and Xen's PAT needs setting up in both,
not just the boot path.

Fixes: 4304ff420e51 ("x86/S3: Drop {save,restore}_rest_processor_state() completely")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
CC: Demi Marie Obenour <demi@invisiblethingslab.com>

Entirely untested, but this a fairly embarassing mistake in hindsight.
---
 xen/arch/x86/boot/wakeup.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index c17d613b61ff..08447e193496 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -130,6 +130,11 @@ wakeup_32:
         and     %edi, %edx
         wrmsr
 1:
+        /* Set up PAT before enabling paging. */
+        mov     $XEN_MSR_PAT & 0xffffffff, %eax
+        mov     $XEN_MSR_PAT >> 32, %edx
+        mov     $MSR_IA32_CR_PAT, %ecx
+        wrmsr
 
         /* Set up EFER (Extended Feature Enable Register). */
         movl    $MSR_EFER,%ecx
-- 
2.11.0


Re: [PATCH] x86/S3: Restore Xen's MSR_PAT value on S3 resume
Posted by Jan Beulich 1 year, 3 months ago
On 05.01.2023 21:48, Andrew Cooper wrote:
> There are two paths in the trampoline, and Xen's PAT needs setting up in both,
> not just the boot path.
> 
> Fixes: 4304ff420e51 ("x86/S3: Drop {save,restore}_rest_processor_state() completely")
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>