diff mbox

[edk2] apparent KVM problem with LRET in TianoCore S3 resume trampoline

Message ID 52A0AEBB.4070701@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laszlo Ersek Dec. 5, 2013, 4:50 p.m. UTC
Small addition -- apologies for the self-followup:

On 12/05/13 17:12, Laszlo Ersek wrote:
> I tried to trace the problem with ftrace, but I didn't get any mentions of
> em_ret_far(). (Maybe I was looking in the wrong place.)

I applied the following small patch (to the original code):


This turns the code right under AsmTransferControl into a working, 64-bit mode
loop. (Recall that 0x38 selects a descriptor that has the L ("64-bitC") bit
set:

>   0x0038: 0x00AF9B000000FFFF: Base=0x00000000 Limit=0xFFFFF Type=0xB (C ER A     ) S=0x1 (code/data) DPL=0x0 Present=1 Avail=0 64-bitC=1 D/B=0 LimitGran=0x1 (4KB)
)

While this was spinning (I checked the RIP several times with the qemu monitor
and it was alternating between a few close values -- ie. not stuck), I ran
trace-cmd. The report seems to confirm that the lret is not emulated, because
the only lines I'm seeing are:

 qemu-system-x86-3901  [001] 38939.599663: kvm_exit:             reason EXTERNAL_INTERRUPT rip 0x9c75be0a info 0 800000ef
 qemu-system-x86-3901  [001] 38939.599684: kvm_entry:            vcpu 0

repeated infinitely. The rip varies between a few close values,

    458 rip 0x9c75be04
    313 rip 0x9c75be0a
      5 rip 0x9c75be17
      4 rip 0x9c75be18
      3 rip 0x9c75be22
      8 rip 0x9c75be28

Thanks again and sorry for the noise.
Laszlo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
index e59fd04..daa4f7e 100644
--- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
+++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
@@ -18,8 +18,8 @@  ASM_GLOBAL ASM_PFX(AsmTransferControl)
 ASM_PFX(AsmTransferControl):
     # rcx S3WakingVector    :DWORD
     # rdx AcpiLowMemoryBase :DWORD
-    lea   _AsmTransferControl_al_0000(%rip), %eax
-    movq  $0x2800000000, %r8
+    lea   AsmTransferControl(%rip), %eax
+    movq  $0x3800000000, %r8
     orq   %r8, %rax
     pushq %rax
     shrd  $20, %ecx, %ebx