提交 8e823cb0 编写于 作者: J Jiankang Chen 提交者: Xie XiuQi

svm: driver probe to read l2buff addr

ascend inclusion
category: feature
bugzilla: 16554
CVE: NA

--------

svm probe to read l2buff addr and size, this is rts
to set l2buff
Signed-off-by: Nchenjiankang (A) <chenjiankang1@huawei.com>
Signed-off-by: NLijun Fang <fanglijun3@huawei.com>
Reviewed-by: NLi Zefan <lizefan@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 38f52955
......@@ -1012,6 +1012,30 @@ static const struct file_operations svm_fops = {
.open = svm_open,
.unlocked_ioctl = svm_ioctl,
};
#ifndef CONFIG_ACPI
static int svm_setup_l2buff(struct svm_device *sdev, struct device_node *np)
{
struct device_node *l2buff = of_parse_phandle(np, "memory-region", 0);
if (l2buff) {
struct resource r;
int err = of_address_to_resource(l2buff, 0, &r);
if (err) {
of_node_put(l2buff);
return err;
}
sdev->l2buff = r.start;
sdev->l2size = resource_size(&r);
}
of_node_put(l2buff);
return 0;
}
#endif
/*svm device probe this is init the svm device*/
static int svm_device_probe(struct platform_device *pdev)
{
......@@ -1066,6 +1090,14 @@ static int svm_device_probe(struct platform_device *pdev)
#ifdef CONFIG_ACPI
err = svm_init_core(sdev);
#else
/*
* Get the l2buff phys address and size, if it do not exist
* just warn and continue, and runtime can not use L2BUFF.
*/
err = svm_setup_l2buff(sdev, np);
if (err)
dev_warn(dev, "Cannot get l2buff\n");
err = svm_init_core(sdev, np);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册