From: Jan Kiszka <[email protected]>

This step prepares for configurable cell reset addresses. In order to
enable them, we need a stable parking code address so that we do not
need to generate per-cell mappings for this purpose.

Simply place the parking loop at address 0. Use a regular SIPI vector 0
for resetting the affected CPUs. This means on Intel that we have to
issue the DEBUGCTL reset separately in vcpu_park because we no longer
take the APIC_BSP_PSEUDO_SIPI path.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/x86/svm.c  |  2 +-
 hypervisor/arch/x86/vcpu.c | 12 +++++-------
 hypervisor/arch/x86/vmx.c  |  3 ++-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/hypervisor/arch/x86/svm.c b/hypervisor/arch/x86/svm.c
index 35d15e7e..d830f8bc 100644
--- a/hypervisor/arch/x86/svm.c
+++ b/hypervisor/arch/x86/svm.c
@@ -987,7 +987,7 @@ void vcpu_park(void)
                return;
        }
 #endif
-       vcpu_vendor_reset(APIC_BSP_PSEUDO_SIPI);
+       vcpu_vendor_reset(0);
        /* No need to clear VMCB Clean bit: vcpu_vendor_reset() already does
         * this. */
        this_cpu_data()->vmcb.n_cr3 = paging_hvirt2phys(parking_pt.root_table);
diff --git a/hypervisor/arch/x86/vcpu.c b/hypervisor/arch/x86/vcpu.c
index e8afd0f5..b4e1dbde 100644
--- a/hypervisor/arch/x86/vcpu.c
+++ b/hypervisor/arch/x86/vcpu.c
@@ -26,12 +26,11 @@
 #include <asm/percpu.h>
 #include <asm/vcpu.h>
 
-/* This page is mapped so the code begins at 0x000ffff0 */
 static u8 __attribute__((aligned(PAGE_SIZE))) parking_code[PAGE_SIZE] = {
-       [0xff0] = 0xfa, /* 1: cli */
-       [0xff1] = 0xf4, /*    hlt */
-       [0xff2] = 0xeb,
-       [0xff3] = 0xfc  /*    jmp 1b */
+       0xfa, /* 1: cli */
+       0xf4, /*    hlt */
+       0xeb,
+       0xfc  /*    jmp 1b */
 };
 
 struct paging_structures parking_pt;
@@ -49,8 +48,7 @@ int vcpu_early_init(void)
        if (!parking_pt.root_table)
                return -ENOMEM;
        return paging_create(&parking_pt, paging_hvirt2phys(parking_code),
-                            PAGE_SIZE, 0x000ff000,
-                            PAGE_READONLY_FLAGS | PAGE_FLAG_US,
+                            PAGE_SIZE, 0, PAGE_READONLY_FLAGS | PAGE_FLAG_US,
                             PAGING_NON_COHERENT);
 }
 
diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c
index 0a6e0ce8..0ee944ff 100644
--- a/hypervisor/arch/x86/vmx.c
+++ b/hypervisor/arch/x86/vmx.c
@@ -908,7 +908,8 @@ void vcpu_park(void)
                return;
        }
 #endif
-       vcpu_vendor_reset(APIC_BSP_PSEUDO_SIPI);
+       vcpu_vendor_reset(0);
+       vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
        vmcs_write64(EPT_POINTER, paging_hvirt2phys(parking_pt.root_table) |
                                  EPT_TYPE_WRITEBACK | EPT_PAGE_WALK_LEN);
 }
-- 
2.12.3

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to