提交 c4695bab 编写于 作者: P Peng Liang 提交者: Zheng Zengkai

arm64: add a helper function to traverse arm64_ftr_regs

hulk inclusion
category: feature
bugzilla: 48052
CVE: NA

------------------------------

If we want to emulate ID registers, we need to initialize ID registers
firstly.  This commit is to add a helper function to traverse
arm64_ftr_regs so that we can initialize ID registers from
arm64_ftr_regs.
Signed-off-by: Nzhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: NPeng Liang <liangpeng10@huawei.com>
Reviewed-by: NZhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 fab413f6
...@@ -79,6 +79,8 @@ struct arm64_ftr_reg { ...@@ -79,6 +79,8 @@ struct arm64_ftr_reg {
extern struct arm64_ftr_reg arm64_ftr_reg_ctrel0; extern struct arm64_ftr_reg arm64_ftr_reg_ctrel0;
int arm64_cpu_ftr_regs_traverse(int (*op)(u32, u64, void *), void *argp);
/* /*
* CPU capabilities: * CPU capabilities:
* *
......
...@@ -1116,6 +1116,19 @@ u64 read_sanitised_ftr_reg(u32 id) ...@@ -1116,6 +1116,19 @@ u64 read_sanitised_ftr_reg(u32 id)
} }
EXPORT_SYMBOL_GPL(read_sanitised_ftr_reg); EXPORT_SYMBOL_GPL(read_sanitised_ftr_reg);
int arm64_cpu_ftr_regs_traverse(int (*op)(u32, u64, void *), void *argp)
{
int i, ret;
for (i = 0; i < ARRAY_SIZE(arm64_ftr_regs); i++) {
ret = (*op)(arm64_ftr_regs[i].sys_id,
arm64_ftr_regs[i].reg->sys_val, argp);
if (ret < 0)
return ret;
}
return 0;
}
#define read_sysreg_case(r) \ #define read_sysreg_case(r) \
case r: return read_sysreg_s(r) case r: return read_sysreg_s(r)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册