From: Ma Wupeng mawupeng1@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7ZC0H
--------------------------------
Commit 0d65528c8526 ("arm64: mm: Detect and enable PBHA bit0 at early startup") create and use "cpus" node to pass "arm,pbha-performance-only" info to kernel. However this will lead to kernel unable to boot on a real machine. To fix this, use "chosed" node instead.
Fixes: 0d65528c8526 ("arm64: mm: Detect and enable PBHA bit0 at early startup") Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- arch/arm64/kernel/cpufeature.c | 2 +- drivers/firmware/efi/libstub/fdt.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 6c07804d9466..74fb98d30a01 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1791,7 +1791,7 @@ void __init early_pbha_init(void) if (!fdt) goto unlock;
- node = fdt_path_offset(fdt, "/cpus"); + node = fdt_path_offset(fdt, "/chosen"); if (node < 0) goto unlock;
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index cb8e8e4e3f63..c709829d74d6 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -44,6 +44,7 @@ static efi_status_t fdt_init_hbm_mode(void *fdt, int node) if (!efi_pbha) goto out;
+ size = sizeof(hbm_mode); efi_status = get_efi_var(L"HBMMode", &oem_config_guid, NULL, &size, &hbm_mode); if (efi_status != EFI_SUCCESS) @@ -52,18 +53,17 @@ static efi_status_t fdt_init_hbm_mode(void *fdt, int node) if (hbm_mode != HBM_MODE_CACHE) goto out;
+ node = fdt_subnode_offset(fdt, 0, "chosen"); + if (node < 0) { + efi_err("find sub node chosen failed. node: %d\n", node); + return EFI_LOAD_ERROR; + } + fdt_val32 = 1; status = fdt_setprop_var(fdt, node, "linux,pbha-bit0", fdt_val32); if (status) return EFI_LOAD_ERROR;
- node = fdt_subnode_offset(fdt, 0, "cpus"); - if (node < 0) { - node = fdt_add_subnode(fdt, 0, "cpus"); - if (node < 0) - return EFI_LOAD_ERROR; - } - /* Current PBHA bit59 is need to enable PBHA bit0 mode. */ status = fdt_setprop_var(fdt, node, "arm,pbha-performance-only", arr); if (status) {