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文章
1412瀏覽量
41190 -
cpu
+關注
關注
68文章
11055瀏覽量
216318 -
多核
+關注
關注
0文章
43瀏覽量
12513 -
SMP
+關注
關注
0文章
78瀏覽量
20198
發布評論請先 登錄
AliOS Things SMP系統及其在esp32上實現示例
典型的支持多核處理器的RTOS功能解析
ARM64 SMP多核啟動相關資料推薦(上)
ARM64 SMP多核啟動相關資料推薦(下)
Linux在SMP系統上的移植研究

Linux內核源碼分析--內核啟動命令行的傳遞過程
用戶與內核空間數據交換的方式之一:內核啟動參數
BootLoader與Linux內核的參數傳遞詳細資料說明

如何解讀內核的oops
Linux內核模塊參數傳遞與sysfs文件系統
ARM64 SMP多核啟動(下)—PSCI

SMP是什么?多核芯片(SMP)的啟動方法

SMP是什么 啟動方式介紹
SMP多核啟動cpu操作函數

評論