Skip to content

Commit

Permalink
arm64: Fix boot-up spinlock
Browse files Browse the repository at this point in the history
Actually use the same acquire instructions as the
other implementation of the spinlock, such that
broadcasting on release works.

This fixes some issue in MP CPU bring up.

Change-Id: Idcc746153bdfd53de717015e0f57264497d4542f
  • Loading branch information
admlck authored and kk-infra committed Sep 7, 2021
1 parent be0cb5a commit 6bc2f71
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/kern/arm/64/tramp-mp.S
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,15 @@ defvar _tramp_mp_gic_cpu_base
_tramp_mp_virt:
// spinlock on cpu-init
adr x0, _tramp_mp_spinlock
1: ldr x1, [x0]
cbz x1, 2f
wfe
b 1b

2: ldxr x1, [x0]
cbnz x1, 1b
mov x1, #2
stxr w2, x1, [x0]
cbnz w2, 1b
sevl
prfm pstl1keep, [x0]
1: wfe
ldaxr x1, [x0]
tst x1, #2
bne 1b
orr x2, x1, #2
stxr w1, x2, [x0]
cbnz w1, 1b

adr x8, _tramp_mp_init_stack_top
mov sp, x8
Expand Down

0 comments on commit 6bc2f71

Please sign in to comment.