Skip to content

Commit 3b6fe57

Browse files
lijinxiajren1
authored andcommitted
Revert "HV: Prepare cpu_secondary.S for AP trampoline code relocation"
This reverts commit bfa67fa.
1 parent b3dd135 commit 3b6fe57

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

hypervisor/arch/x86/cpu_secondary.S

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
.align 4
4747
.code16
4848
.global cpu_secondary_reset
49-
.org 0
5049
cpu_secondary_reset:
5150

5251
/* Disable local interrupts */
@@ -62,9 +61,8 @@ cpu_secondary_reset:
6261

6362
/* Set CR3 to PML4 table address */
6463

65-
movl $CPU_Boot_Page_Tables_ptr, %ebx
66-
mov (%ebx), %eax
67-
mov %eax, %cr3
64+
movl $CPU_Boot_Page_Tables_Start, %edi
65+
mov %edi, %cr3
6866

6967
/* Set LME bit in EFER */
7068

@@ -85,14 +83,7 @@ cpu_secondary_reset:
8583

8684
/* Perform a long jump based to start executing in 64-bit mode */
8785

88-
movl $ap_long_mode_jump_ref, %ebx
89-
ljmpl *(%ebx)
90-
91-
.align 8
92-
.global ap_long_mode_jump_ref
93-
ap_long_mode_jump_ref:
94-
.long cpu_secondary_long_mode
95-
.word HOST_GDT_RING0_CODE_SEL
86+
data32 ljmp $HOST_GDT_RING0_CODE_SEL, $cpu_secondary_long_mode
9687

9788
.code64
9889
cpu_secondary_long_mode:
@@ -109,8 +100,7 @@ cpu_secondary_long_mode:
109100
/* Obtain secondary CPU spin-lock to serialize
110101
booting of secondary cores for a bit */
111102

112-
mov $cpu_secondary_spinlock, %rdi
113-
spinlock_obtain(%rdi)
103+
spinlock_obtain(cpu_secondary_spinlock)
114104

115105
/* Initialize temporary stack pointer
116106
NOTE: Using the PML4 memory (PDPT address is top of memory
@@ -120,15 +110,21 @@ cpu_secondary_long_mode:
120110
the top of this page. This stack is only
121111
used for a VERY short period of time, so
122112
this reuse of PML4 memory should be acceptable. */
123-
lea cpu_secondary_pdpt_addr(%rip), %rsp
113+
114+
movq $cpu_secondary_pdpt_addr, %rsp
124115

125116
/* Push sp magic to top of stack for call trace */
126117
pushq $SP_BOTTOM_MAGIC
127118

128119
/* Jump to C entry for the AP */
129120

130-
mov $cpu_secondary_init, %rax
131-
jmp *%rax
121+
call cpu_secondary_init
122+
123+
cpu_secondary_error:
124+
125+
/* Error condition trap */
126+
127+
jmp cpu_secondary_error
132128

133129
/* GDT table */
134130
.align 4
@@ -140,23 +136,17 @@ cpu_secondary_gdt_end:
140136

141137
/* GDT pointer */
142138
.align 2
143-
.global cpu_secondary_gdt_ptr
144139
cpu_secondary_gdt_ptr:
145140
.short (cpu_secondary_gdt_end - cpu_secondary_gdt) - 1
146141
.quad cpu_secondary_gdt
147142

148143
/* PML4, PDPT, and PD tables initialized to map first 4 GBytes of memory */
149-
.align 4
150-
.global CPU_Boot_Page_Tables_ptr
151-
CPU_Boot_Page_Tables_ptr:
152-
.long CPU_Boot_Page_Tables_Start
153144

154145
.align CPU_PAGE_SIZE
155146
.global CPU_Boot_Page_Tables_Start
156147
CPU_Boot_Page_Tables_Start:
157148
.quad cpu_secondary_pdpt_addr + (IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT)
158149
.align CPU_PAGE_SIZE
159-
.global cpu_secondary_pdpt_addr
160150
cpu_secondary_pdpt_addr:
161151
address = 0
162152
.rept 4

hypervisor/bsp/ld/link_ram.ld.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ENTRY(cpu_primary_start_32)
55
MEMORY
66
{
77
/* Low 1MB of memory for secondary processor start-up */
8-
lowram : ORIGIN = 0, LENGTH = CONFIG_LOW_RAM_SIZE
8+
lowram : ORIGIN = CONFIG_LOW_RAM_START, LENGTH = CONFIG_LOW_RAM_SIZE
99

1010
/* 32 MBytes of RAM for HV */
1111
ram : ORIGIN = CONFIG_RAM_START, LENGTH = CONFIG_RAM_SIZE
@@ -43,7 +43,6 @@ SECTIONS
4343

4444
.cpu_secondary : AT (_ld_cpu_secondary_reset_load)
4545
{
46-
/* entry point of AP wakeup, must be at the beginning of this section*/
4746
_ld_cpu_secondary_reset_start = .;
4847
*(.cpu_secondary_reset);
4948
. = ALIGN(4);

hypervisor/bsp/sbl/include/bsp/bsp_cfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define HEAP_SIZE 0x100000
4242
#define CONSOLE_LOGLEVEL_DEFAULT 2
4343
#define MEM_LOGLEVEL_DEFAULT 4
44+
#define CONFIG_LOW_RAM_START 0x00001000
4445
#define CONFIG_LOW_RAM_SIZE 0x000CF000
4546
#define CONFIG_RAM_START 0x6E000000
4647
#define CONFIG_RAM_SIZE 0x02000000 /* 32M */

hypervisor/bsp/uefi/include/bsp/bsp_cfg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define HEAP_SIZE 0x100000
4242
#define CONSOLE_LOGLEVEL_DEFAULT 2
4343
#define MEM_LOGLEVEL_DEFAULT 4
44+
#define CONFIG_LOW_RAM_START 0x00008000
4445
#define CONFIG_LOW_RAM_SIZE 0x00010000
4546
#define CONFIG_RAM_START 0x20000000
4647
#define CONFIG_RAM_SIZE 0x02000000 /* 32M */

0 commit comments

Comments
 (0)