spin_table_cpu_release_addr的传递
由于在armv8架构下, uboot只能通过devicetree向内核传递参数信息 ,因此当其开启了CONFIG_ARMV8_SPIN_TABLE配置选项后,就需要在适当的时候将该值写入devicetree中。
我们知道uboot一般通过bootm命令启动操作系统(aarch64支持的booti命令,其底层实现与bootm相同),因此在bootm中会执行一系列启动前的准备工作,其中就包括将spin-table地写入devicetree的工作。以下其执行流程图:
spin_table_update_dt的代码实现如下:
int spin_table_update_dt(void *fdt)
{
…
unsigned long rsv_addr = (unsigned long)&spin_table_reserve_begin;
unsigned long rsv_size = &spin_table_reserve_end -
&spin_table_reserve_begin; (1)
cpus_offset = fdt_path_offset(fdt, "/cpus"); (2)
if (cpus_offset < 0)
return -ENODEV;
for (offset = fdt_first_subnode(fdt, cpus_offset);
offset >= 0;
offset = fdt_next_subnode(fdt, offset)) {
prop = fdt_getprop(fdt, offset, "device_type", NULL);
if (!prop || strcmp(prop, "cpu"))
continue;
prop = fdt_getprop(fdt, offset, "enable-method", NULL); (3)
if (!prop || strcmp(prop, "spin-table"))
return 0;
}
for (offset = fdt_first_subnode(fdt, cpus_offset);
offset >= 0;
offset = fdt_next_subnode(fdt, offset)) {
prop = fdt_getprop(fdt, offset, "device_type", NULL);
if (!prop || strcmp(prop, "cpu"))
continue;
ret = fdt_setprop_u64(fdt, offset, "cpu-release-addr",
(unsigned long)&spin_table_cpu_release_addr); (4)
if (ret)
return -ENOSPC;
}
ret = fdt_add_mem_rsv(fdt, rsv_addr, rsv_size); (5)
…
}
(1)获取其起始地址和长度
(2)从devicetree中获取cpus节点
(3)遍历该节点的所有cpu子节点,并校验其enable-method是否为spin-table。若不是所有cpu的都该类型,则不设置
(4)若所有cpu的enable-method都为spin-table,则将该参数设置到cpu-release-addr属性中
(5)由于这段地址有特殊用途,内核的内存管理系统不能将其分配给其它模块。因此,需要将其添加到保留内存中
-
内核
+关注
关注
3文章
1384浏览量
40458 -
cpu
+关注
关注
68文章
10922浏览量
213282 -
多核
+关注
关注
0文章
43浏览量
12397 -
SMP
+关注
关注
0文章
76浏览量
19767
发布评论请先 登录
相关推荐
AliOS Things SMP系统及其在esp32上实现示例
典型的支持多核处理器的RTOS功能解析
ARM64 SMP多核启动相关资料推荐(上)
ARM64 SMP多核启动相关资料推荐(下)
Linux在SMP系统上的移植研究
![Linux在<b class='flag-5'>SMP</b>系统上的移植研究](https://file.elecfans.com/web2/M00/49/55/poYBAGKhwKKAa_YcAAAerYXXdvY537.jpg)
Linux内核源码分析--内核启动命令行的传递过程
用户与内核空间数据交换的方式之一:内核启动参数
BootLoader与Linux内核的参数传递详细资料说明
![BootLoader与Linux<b class='flag-5'>内核</b>的<b class='flag-5'>参数</b><b class='flag-5'>传递</b>详细资料说明](https://file.elecfans.com/web1/M00/E5/A8/pIYBAGBQHEuACGXBAAEYxBLLLYo205.png)
如何解读内核的oops
Linux内核模块参数传递与sysfs文件系统
ARM64 SMP多核启动(下)—PSCI
![ARM64 <b class='flag-5'>SMP</b><b class='flag-5'>多核</b><b class='flag-5'>启动</b>(下)—PSCI](https://file1.elecfans.com/web2/M00/89/66/wKgaomSCxymAMT8RAAEl_qxJBsY504.jpg)
SMP是什么?多核芯片(SMP)的启动方法
![<b class='flag-5'>SMP</b>是什么?<b class='flag-5'>多核</b>芯片(<b class='flag-5'>SMP</b>)的<b class='flag-5'>启动</b>方法](https://file1.elecfans.com/web2/M00/8D/CD/wKgZomTAdmSAUhL7AAEiLn9UGVs698.png)
SMP是什么 启动方式介绍
SMP多核启动cpu操作函数
![<b class='flag-5'>SMP</b><b class='flag-5'>多核</b><b class='flag-5'>启动</b>cpu操作函数](https://file1.elecfans.com/web2/M00/B4/71/wKgZomVu12OAJXJZAAGW5cqGuKU424.jpg)
评论