Commit 2ae8305b authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Zheng Zengkai
Browse files

arm64/mpam: resctrl: Add rmid file in resctrl sysfs



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

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

rmid is used to mark each resctrl group for monitoring, anyhow, also
following corresponding resctrl group's configuration, we export rmid
sysfile to resctrl sysfs for any usage elsewhere such as SMMU io, user
can get rmid from a resctrl group and set this rmid to a target io
through SMMU driver if SMMU MPAM implemented, so make related io devices
can be monitored or accomplish aimed configuration for resource's usage.

Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 0c564931
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -1728,6 +1728,29 @@ static int resctrl_group_tasks_show(struct kernfs_open_file *of,
	return ret;
}

static int resctrl_group_rmid_show(struct kernfs_open_file *of,
			       struct seq_file *s, void *v)
{
	int ret = 0;
	struct rdtgroup *rdtgrp;
	u32 flag, times;

	hw_alloc_times_validate(times, flag);

	rdtgrp = resctrl_group_kn_lock_live(of->kn);
	if (rdtgrp) {
		if (flag)
			seq_printf(s, "%u-%u\n", rdtgrp->mon.rmid,
				rdtgrp->mon.rmid + 1);
		else
			seq_printf(s, "%u\n", rdtgrp->mon.rmid);
	} else
		ret = -ENOENT;
	resctrl_group_kn_unlock(of->kn);

	return ret;
}

/* rdtgroup information files for one cache resource. */
static struct rftype res_specific_files[] = {
	{
@@ -1825,6 +1848,13 @@ static struct rftype res_specific_files[] = {
		.seq_show	= resctrl_group_tasks_show,
		.fflags		= RFTYPE_BASE,
	},
	{
		.name		= "rmid",
		.mode		= 0444,
		.kf_ops		= &resctrl_group_kf_single_ops,
		.seq_show	= resctrl_group_rmid_show,
		.fflags		= RFTYPE_BASE,
	},
	{
		.name		= "schemata",
		.mode		= 0644,