spin_table_cpu_release_addr的傳遞
由于在armv8架構(gòu)下, uboot只能通過devicetree向內(nèi)核傳遞參數(shù)信息 ,因此當(dāng)其開啟了CONFIG_ARMV8_SPIN_TABLE配置選項后,就需要在適當(dāng)?shù)臅r候?qū)⒃撝祵懭雂evicetree中。
我們知道uboot一般通過bootm命令啟動操作系統(tǒng)(aarch64支持的booti命令,其底層實現(xiàn)與bootm相同),因此在bootm中會執(zhí)行一系列啟動前的準(zhǔn)備工作,其中就包括將spin-table地寫入devicetree的工作。以下其執(zhí)行流程圖:
spin_table_update_dt的代碼實現(xiàn)如下:
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節(jié)點
(3)遍歷該節(jié)點的所有cpu子節(jié)點,并校驗其enable-method是否為spin-table。若不是所有cpu的都該類型,則不設(shè)置
(4)若所有cpu的enable-method都為spin-table,則將該參數(shù)設(shè)置到cpu-release-addr屬性中
(5)由于這段地址有特殊用途,內(nèi)核的內(nèi)存管理系統(tǒng)不能將其分配給其它模塊。因此,需要將其添加到保留內(nèi)存中
-
內(nèi)核
+關(guān)注
關(guān)注
3文章
1406瀏覽量
41048 -
cpu
+關(guān)注
關(guān)注
68文章
11028瀏覽量
215756 -
多核
+關(guān)注
關(guān)注
0文章
43瀏覽量
12496 -
SMP
+關(guān)注
關(guān)注
0文章
77瀏覽量
20146
發(fā)布評論請先 登錄
AliOS Things SMP系統(tǒng)及其在esp32上實現(xiàn)示例
典型的支持多核處理器的RTOS功能解析
ARM64 SMP多核啟動相關(guān)資料推薦(上)
ARM64 SMP多核啟動相關(guān)資料推薦(下)
Linux在SMP系統(tǒng)上的移植研究

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

如何解讀內(nèi)核的oops
Linux內(nèi)核模塊參數(shù)傳遞與sysfs文件系統(tǒng)
ARM64 SMP多核啟動(下)—PSCI

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

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

評論