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

arm64/mpam: Implement intpartid narrowing process

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

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

According to Arm MPAM spec definition, register MPAMCFG_PART_SEL's high
16 bit should be set to 0 and MPAMCFG_INTPARTID's high 16 bit should be
set to 1 when establishing intpartid association, and we should use
intpartid in MPAMCFG_PART_SEL instead of reqpartid as long as intpartid
narrowing is implemented.
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>
上级 17c6439e
......@@ -91,6 +91,10 @@
#define MSMON_CFG_CSU_TYPE 0x43
#define MSMON_CFG_MBWU_TYPE 0x42
/*
* Set MPAMCFG_INTPARTID internal bit
*/
#define MPAMCFG_INTPARTID_INTERNAL BIT(16)
/*
* Set MPAMCFG_PART_SEL internal bit
*/
......
......@@ -1076,16 +1076,29 @@ static int mpam_device_frob_mon(struct mpam_device *dev,
return 0;
}
static int mpam_device_narrow_map(struct mpam_device *dev, u32 partid,
static void mpam_device_narrow_map(struct mpam_device *dev, u32 partid,
u32 intpartid)
{
return 0;
int cur_intpartid;
lockdep_assert_held(&dev->lock);
mpam_write_reg(dev, MPAMCFG_PART_SEL, partid);
wmb(); /* subsequent writes must be applied to our new partid */
cur_intpartid = mpam_read_reg(dev, MPAMCFG_INTPARTID);
/* write association, this need set 16 bit to 1 */
intpartid = intpartid | MPAMCFG_INTPARTID_INTERNAL;
/* reqpartid has already been associated to this intpartid */
if (cur_intpartid == intpartid)
return;
mpam_write_reg(dev, MPAMCFG_INTPARTID, intpartid);
}
static int mpam_device_config(struct mpam_device *dev, u32 partid,
struct mpam_config *cfg)
{
int ret;
u16 cmax = GENMASK(dev->cmax_wd, 0);
u32 pri_val = 0;
u16 intpri, dspri, max_intpri, max_dspri;
......@@ -1101,15 +1114,10 @@ static int mpam_device_config(struct mpam_device *dev, u32 partid,
* upstream(resctrl) keep this order
*/
if (mpam_has_feature(mpam_feat_part_nrw, dev->features)) {
if (cfg && mpam_has_feature(mpam_feat_part_nrw, cfg->valid)) {
ret = mpam_device_narrow_map(dev, partid,
cfg->intpartid);
if (ret)
goto out;
partid = PART_SEL_SET_INTERNAL(cfg->intpartid);
} else {
partid = PART_SEL_SET_INTERNAL(cfg->intpartid);
}
if (cfg && mpam_has_feature(mpam_feat_part_nrw, cfg->valid))
mpam_device_narrow_map(dev, partid, cfg->intpartid);
/* intpartid success, set 16 bit to 1*/
partid = PART_SEL_SET_INTERNAL(cfg->intpartid);
}
mpam_write_reg(dev, MPAMCFG_PART_SEL, partid);
......@@ -1185,8 +1193,7 @@ static int mpam_device_config(struct mpam_device *dev, u32 partid,
*/
mb();
out:
return ret;
return 0;
}
static void mpam_component_device_sync(void *__ctx)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册