Commit 143014f7 authored by Xie XiuQi's avatar Xie XiuQi Committed by Zheng Zengkai
Browse files

arm64/mpam: get num_partids from system regs instead of hard code



hulk inclusion
category: bugfix
bugzilla: 48265
CVE: NA

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

Previously hard coded for num of partids, now get them
through the system registers.

Signed-off-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 8a74962d
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -322,9 +322,17 @@ static int closid_free_map;

void closid_init(void)
{
	int resctrl_min_closid = 32;
	struct resctrl_resource *r;
	struct raw_resctrl_resource *rr;
	int num_closid = INT_MAX;

	closid_free_map = BIT_MASK(resctrl_min_closid) - 1;
	for_each_resctrl_resource(r) {
		if (r->alloc_enabled) {
			rr = r->res;
			num_closid = min(num_closid, rr->num_partid);
		}
	}
	closid_free_map = BIT_MASK(num_closid) - 1;

	/* CLOSID 0 is always reserved for the default group */
	closid_free_map &= ~1;