Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warm reset fix #84

Merged
merged 3 commits into from Mar 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion firmware/fw_base.S
Expand Up @@ -25,6 +25,8 @@ _start:
csrr a6, CSR_MHARTID
blt zero, a6, _wait_for_boot_hart

li ra, 0
call _reset_regs
/* Zero-out BSS */
la a4, _bss_start
la a5, _bss_end
Expand Down Expand Up @@ -114,9 +116,12 @@ _fdt_reloc_done:

/* Wait for boot hart */
_wait_for_boot_hart:
fence rw, rw
la a4, _boot_hart_done
REG_L a5, (a4)
/* Reduce the bus traffic so that boot hart may proceed faster */
nop
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a comment inline to describe why this is required?

Also, why can't this be a fence? That seems like a bug somewhere else if a fence doesn't work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a comment inline to describe why this is required?

Done.

Also, why can't this be a fence? That seems like a bug somewhere else if a fence doesn't work

One possible explanation is non-boot cpu cache may have some stale corrupt DTB data which gets written. But this is a just theory and no way to prove it.

That's why commit text says that it's being reverted just for the time being until we figure out the actual reason.

nop
nop
beqz a5, _wait_for_boot_hart

_start_warm:
Expand Down Expand Up @@ -389,6 +394,8 @@ _trap_handler_all_mode:
.globl _reset_regs
_reset_regs:

/* flush the instruction cache */
fence.i
/* Reset all registers except ra, a0,a1 */
li sp, 0
li gp, 0
Expand Down