-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
🎯 [libcpu/arm/cortex-a]修改arm/cortex-a启动方式,解决cortex-a开启SMP工作异常问题 #8517
Conversation
Good Job! |
这里也帮忙做个调整吧,原来的代码有些不太规范 |
已修改 rt_mpr_start = (void *)((rt_size_t)0 - rt_mpr_size); |
你好 这份代码先挂在这里 等#8537 合并之后再麻烦您重新rebase和测试一下~ |
好的,这份代码和刚才合入的有一些冲突,我只是重新修改提交一下 |
#8537 已经合并 麻烦重新rebase到最新基线并测试一下把~ |
bsp/phytium/board/board.c
Outdated
@@ -189,27 +189,28 @@ void rt_hw_board_aarch64_init(void) | |||
} | |||
#else | |||
|
|||
|
|||
extern void rt_hw_mmu_init(void) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最好是放到头文件里面。否则后续原型修改很容易不一致,而且发现不了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
放在mmu.h里了
@@ -64,12 +64,16 @@ void idle_wfi(void) | |||
asm volatile ("wfi"); | |||
} | |||
|
|||
|
|||
extern void rt_hw_mmu_init(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同理,应该是引用个头文件。
libcpu/arm/cortex-a/start_gcc.S
Outdated
wfe | ||
b _halt | ||
.weak rt_asm_cpu_id | ||
rt_asm_cpu_id: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个命名得改成 rt_hw_cpu_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
libcpu/arm/cortex-a/start_gcc.S
Outdated
.macro get_phy, reg, symbol | ||
ldr \reg, =\symbol | ||
add \reg, pv_off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 pv_off 最好是个参数,否则用这个宏的时候,就依赖于 pv_off 这个寄存器的初始化。后面加代码,或者维护起来容易疏忽。
.macro get_phy, reg, symbol | |
ldr \reg, =\symbol | |
add \reg, pv_off | |
.macro get_phy, reg, symbol, _pvoff | |
ldr \reg, =\symbol | |
add \reg, \_pvoff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.macro get_phy, reg, symbol, _pvoff
ldr \reg, =\symbol
add \reg, _pvoff
.endm
/Calculate the offset between the physical address and the virtual address of the "_reset"./
.macro get_pvoff, tmp, out
ldr \tmp, =_reset
adr \out, _reset
sub \out, \out, \tmp
.endm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个函数修改成这样可以吗?
libcpu/arm/cortex-a/start_gcc.S
Outdated
ldr r0, =_reset | ||
adr pv_off, _reset | ||
sub pv_off, pv_off, r0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果修改了,这个就可以用 get_pvoff
宏替换。
libcpu/arm/cortex-a/start_gcc.S
Outdated
.macro get_pvoff, tmp, out | ||
ldr \tmp, =_reset | ||
get_phy \out, _reset | ||
sub \out, \out, \tmp | ||
.endm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
而且,按照现在的参数设计, get_pvoff 依赖了 get_phy,get_phy 依赖了 pv_off。虽然 pv_off 可以单独先初始化,结果上也对。但是逻辑上很奇怪。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.macro get_pvoff, tmp, out
ldr \tmp, =_reset
adr \out, _reset
sub \out, \out, \tmp
.endm
libcpu/arm/cortex-a/start_gcc.S
Outdated
get_phy r0, init_mtbl | ||
get_pvoff r2,r1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里就是 get_phy
的参数设计很容易造成混乱的例子。get_phy 依赖于 pvoff 的,但是这里又先计算了 get_phy,然后计算一个新的 pvoff。看的时候就很别扭。
如果给 get_phy 加入 pvoff 作为第三个参数,修改后个人感觉是更清晰可读的。
get_phy r0, init_mtbl | |
get_pvoff r2,r1 | |
get_phy r0, init_mtbl, pv_off | |
mov r1, pv_off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请您再检查一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没别的建议了 👍
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
#8469 解决issue
你的解决方案是什么 (what is your solution)
对cortex-a cpu的启动步骤仿照aarch64的风格进行了整理,使逻辑更加清晰,并解决了上述问题。已在qemu-vexpress-a9,raspi4-32,phytium开发板上进行测试,目前可以正常启动
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up