On Sun, Sep 06, 2015 at 11:44:11AM +0200, Stefan Fritsch wrote:
> Hi,
> 
> the diff below is necessary to make suspend/resume work when x2apic is
> enabled (i.e. on qemu/kvm/...). While I don't expect problems, it would be 
> nice if I could get some reports that this doesn't break suspend/resume on 
> real machines, especially older ones (like core 2 duo and older) and ones 
> with an amd cpu.
> 
> Thanks in advance.
> 
> Cheers,
> Stefan

This looks ok to me, so ok mlarkin@ if you don't get any reports of breakage.

-ml

> 
> --- a/sys/arch/amd64/amd64/acpi_wakecode.S
> +++ b/sys/arch/amd64/amd64/acpi_wakecode.S
> @@ -52,6 +52,7 @@
>  #include <machine/param.h>
>  #include <machine/segments.h>
>  #include <dev/acpi/acpivar.h>
> +#include "lapic.h"
>  
>  #define _ACPI_TRMP_LABEL(a) a = . - _C_LABEL(acpi_real_mode_resume) + \
>       ACPI_TRAMPOLINE
> @@ -245,6 +246,13 @@ _C_LABEL(acpi_long_mode_resume):
>       movw    %ax, %gs
>  
>       /* Restore registers - start with the MSRs */
> +#if NLAPIC > 0
> +     movl    $MSR_APICBASE, %ecx
> +     movl    acpi_saved_apicbase, %eax
> +     movl    acpi_saved_apicbase+4, %edx
> +     wrmsr
> +#endif
> +
>       movl    $MSR_STAR, %ecx
>       movl    acpi_saved_star, %eax
>       movl    acpi_saved_star+4, %edx
> @@ -623,6 +631,10 @@ _ACPI_TRMP_DATA_LABEL(acpi_saved_cstar)
>       .quad 0
>  _ACPI_TRMP_DATA_LABEL(acpi_saved_sfmask)
>       .quad 0
> +#if NLAPIC > 0
> +_ACPI_TRMP_DATA_LABEL(acpi_saved_apicbase)
> +     .quad 0
> +#endif
>  
>       .align 4
>  _ACPI_TRMP_DATA_LABEL(acpi_pdirpa)
> @@ -682,6 +694,13 @@ NENTRY(acpi_savecpu)
>       
>       pushq   %rcx
>       pushq   %rdx
> +#if NLAPIC > 0
> +     movl    $MSR_APICBASE, %ecx
> +     rdmsr
> +     movl    %eax, acpi_saved_apicbase
> +     movl    %edx, acpi_saved_apicbase+4
> +#endif
> +
>       movl    $MSR_STAR, %ecx
>       rdmsr
>       movl    %eax, acpi_saved_star
> 

Reply via email to