From c25a1d7d7351433cc7e87c4e2ef3fe3247cbcf10 Mon Sep 17 00:00:00 2001 From: mlarkin Date: Fri, 10 Jan 2014 22:34:41 +0000 Subject: [PATCH] Resurrect the "park APs in realmode" idea that we explored back at t2k13 (and which didn't work at that time due to a bug which has since been fixed). The APs are now demoted to real mode and placed in a HLT loop while the hibernated image is being unpacked. Helps my x230 significantly, no more spurious reboots on resume. ok deraadt --- sys/arch/amd64/amd64/acpi_wakecode.S | 12 ++++++------ sys/arch/amd64/amd64/hibernate_machdep.c | 10 +++++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sys/arch/amd64/amd64/acpi_wakecode.S b/sys/arch/amd64/amd64/acpi_wakecode.S index e8c54e7a14f..670568eb4ed 100644 --- a/sys/arch/amd64/amd64/acpi_wakecode.S +++ b/sys/arch/amd64/amd64/acpi_wakecode.S @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_wakecode.S,v 1.23 2014/01/05 20:23:56 mlarkin Exp $ */ +/* $OpenBSD: acpi_wakecode.S,v 1.24 2014/01/10 22:34:41 mlarkin Exp $ */ /* * Copyright (c) 2001 Takanori Watanabe * Copyright (c) 2001 Mitsuru IWASAKI @@ -394,12 +394,12 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector_2) /* Get out of 64 bit CS */ lgdtq tmp_gdt6416 - rex64 ljmp *(hibernate_indirect_16) + rex64 ljmpq *(hibernate_indirect_16) _ACPI_TRMP_LABEL(hibernate_indirect_16) .quad hibernate_resume_vector_3 .word 0x18 -_ACPI_TRMP_LABEL(hibernate_resume_vector_3) +_ACPI_TRMP_OFFSET(hibernate_resume_vector_3) .code16 movl %cr0, %eax @@ -432,12 +432,12 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector_2b) /* Get out of 64 bit CS */ lgdtq tmp_gdt6416 - rex64 ljmp *(hibernate_indirect_16b) + rex64 ljmpq *(hibernate_indirect_16b) _ACPI_TRMP_LABEL(hibernate_indirect_16b) .quad hibernate_resume_vector_3b .word 0x18 -_ACPI_TRMP_LABEL(hibernate_resume_vector_3b) +_ACPI_TRMP_OFFSET(hibernate_resume_vector_3b) .code16 movl %cr0, %eax @@ -622,7 +622,7 @@ _ACPI_TRMP_LABEL(tmp_gdtable6416) .quad 0x0000000000000000 .quad 0x00af9a000000ffff .quad 0x00cf92000000ffff - .quad 0x00009a000000ffff + .quad 0x00009a0110000fff _ACPI_TRMP_LABEL(tmp_gdt6416_end) .align 4 diff --git a/sys/arch/amd64/amd64/hibernate_machdep.c b/sys/arch/amd64/amd64/hibernate_machdep.c index 4d429770751..8143947bd4d 100644 --- a/sys/arch/amd64/amd64/hibernate_machdep.c +++ b/sys/arch/amd64/amd64/hibernate_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hibernate_machdep.c,v 1.18 2014/01/05 23:06:54 mlarkin Exp $ */ +/* $OpenBSD: hibernate_machdep.c,v 1.19 2014/01/10 22:34:41 mlarkin Exp $ */ /* * Copyright (c) 2012 Mike Larkin @@ -398,7 +398,11 @@ hibernate_quiesce_cpus(void) /* Start the hatched (but idling) APs */ cpu_boot_secondary_processors(); - /* Now shut them down */ - acpi_sleep_mp(); + /* Demote the APs to real mode */ + x86_broadcast_ipi(X86_IPI_HALT_REALMODE); + + /* Wait a bit for the APs to park themselves */ + delay(1000000); + } #endif /* MULTIPROCESSOR */ -- 2.20.1