提交 ad424230 编写于 作者: W Wang ShaoBo 提交者: Yang Yingliang

arm64/mpam: Support cdp on allocating monitors

hulk inclusion
category: feature
bugzilla: 34278
CVE: NA

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

This prepares for simultaneously monitoring LxDATA and LxCODE when cdp
is open, under our implementation, LxDATA and LxCODE is allocated closid
and closid+1, so we should keep two monitor once time for each.

Why there needs one monitors for each closid when cdp is open, but not
switch one between the two LxDATA and LxCODE is because this monitor kept
by target closid maybe busy for a long time, it would cause inaccuracy if
we force switching.
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: NCheng Jian <cj.chengjian@huawei.com>
上级 4876ac32
......@@ -93,20 +93,28 @@ void mon_init(void)
int alloc_mon(void)
{
u32 mon = ffs(mon_free_map);
u32 mon = 0;
u32 times, flag;
hw_alloc_times_validate(mon, times, flag);
mon = ffs(mon_free_map);
if (mon == 0)
return -ENOSPC;
mon--;
mon_free_map &= ~(1 << mon);
mon_free_map &= ~(GENMASK(mon, mon + times - 1));
return mon;
}
void free_mon(u32 mon)
{
mon_free_map |= 1 << mon;
u32 times, flag;
hw_alloc_times_validate(mon, times, flag);
mon_free_map |= GENMASK(mon, mon + times - 1);
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册