提交 9ed38372 编写于 作者: W Wang ShaoBo 提交者: Zheng Zengkai

arm64/mpam: Support cdp in mpam_sched_in()

hulk inclusion
category: feature
feature: ARM MPAM support
bugzilla: 48265
CVE: NA

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

For MPAM, Processing elements (PEs) issue memory-system requests, PEs must
implement the MPAMn_ELx registers and their behaviors to generate the
PARTID and PMG fields of memory-system requests.

So far schemata supports cdp writing and reading, to grab MPAM info from
cpu for downstream MSCs, SYS_MPAMx_ELx registers should be filled in both
partid_d and partid_i (mapped from closids) of LxDATA and LxCODE and pmg_d
and pmg_i (mapped from rmid).
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 64493b5f
......@@ -1366,7 +1366,8 @@ int __init mpam_resctrl_init(void)
void __mpam_sched_in(void)
{
struct intel_pqr_state *state = this_cpu_ptr(&pqr_state);
u64 partid = state->default_closid;
u64 closid = state->default_closid;
u64 partid_d, partid_i;
u64 pmg = state->default_rmid;
/*
......@@ -1375,7 +1376,7 @@ void __mpam_sched_in(void)
*/
if (static_branch_likely(&resctrl_alloc_enable_key)) {
if (current->closid)
partid = current->closid;
closid = current->closid;
}
if (static_branch_likely(&resctrl_mon_enable_key)) {
......@@ -1383,22 +1384,56 @@ void __mpam_sched_in(void)
pmg = current->rmid;
}
if (partid != state->cur_closid || pmg != state->cur_rmid) {
if (closid != state->cur_closid || pmg != state->cur_rmid) {
u64 reg;
state->cur_closid = partid;
state->cur_rmid = pmg;
/* set in EL0 */
reg = mpam_read_sysreg_s(SYS_MPAM0_EL1, "SYS_MPAM0_EL1");
reg = PARTID_SET(reg, partid);
reg = PMG_SET(reg, pmg);
mpam_write_sysreg_s(reg, SYS_MPAM0_EL1, "SYS_MPAM0_EL1");
/* set in EL1 */
reg = mpam_read_sysreg_s(SYS_MPAM1_EL1, "SYS_MPAM1_EL1");
reg = PARTID_SET(reg, partid);
reg = PMG_SET(reg, pmg);
mpam_write_sysreg_s(reg, SYS_MPAM1_EL1, "SYS_MPAM1_EL1");
if (resctrl_cdp_enabled) {
hw_closid_t hw_closid;
resctrl_cdp_map(clos, closid, CDP_DATA, hw_closid);
partid_d = hw_closid_val(hw_closid);
resctrl_cdp_map(clos, closid, CDP_CODE, hw_closid);
partid_i = hw_closid_val(hw_closid);
/*
* when cdp enabled, we use partid_i to label cur_closid
* of cpu state instead of partid_d, because each task/
* rdtgrp's closid is labeled by CDP_BOTH/CDP_CODE but not
* CDP_DATA.
*/
state->cur_closid = partid_i;
state->cur_rmid = pmg;
/* set in EL0 */
reg = mpam_read_sysreg_s(SYS_MPAM0_EL1, "SYS_MPAM0_EL1");
reg = PARTID_D_SET(reg, partid_d);
reg = PARTID_I_SET(reg, partid_i);
reg = PMG_SET(reg, pmg);
mpam_write_sysreg_s(reg, SYS_MPAM0_EL1, "SYS_MPAM0_EL1");
/* set in EL1 */
reg = mpam_read_sysreg_s(SYS_MPAM1_EL1, "SYS_MPAM1_EL1");
reg = PARTID_D_SET(reg, partid_d);
reg = PARTID_I_SET(reg, partid_i);
reg = PMG_SET(reg, pmg);
mpam_write_sysreg_s(reg, SYS_MPAM1_EL1, "SYS_MPAM1_EL1");
} else {
state->cur_closid = closid;
state->cur_rmid = pmg;
/* set in EL0 */
reg = mpam_read_sysreg_s(SYS_MPAM0_EL1, "SYS_MPAM0_EL1");
reg = PARTID_SET(reg, closid);
reg = PMG_SET(reg, pmg);
mpam_write_sysreg_s(reg, SYS_MPAM0_EL1, "SYS_MPAM0_EL1");
/* set in EL1 */
reg = mpam_read_sysreg_s(SYS_MPAM1_EL1, "SYS_MPAM1_EL1");
reg = PARTID_SET(reg, closid);
reg = PMG_SET(reg, pmg);
mpam_write_sysreg_s(reg, SYS_MPAM1_EL1, "SYS_MPAM1_EL1");
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册