Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
d5cc7d54
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
14
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d5cc7d54
编写于
11月 17, 2018
作者:
X
xuzaibo
提交者:
Xie XiuQi
12月 27, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add iommu share/unshare domain APIs
Feature or Bugfix:Feature Signed-off-by:
N
xuzaibo
<
xuzaibo@huawei.com
>
上级
533224cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
1 deletion
+42
-1
drivers/iommu/iommu.c
drivers/iommu/iommu.c
+28
-1
include/linux/iommu.h
include/linux/iommu.h
+14
-0
未找到文件。
drivers/iommu/iommu.c
浏览文件 @
d5cc7d54
...
@@ -59,6 +59,9 @@ struct iommu_group {
...
@@ -59,6 +59,9 @@ struct iommu_group {
int
id
;
int
id
;
struct
iommu_domain
*
default_domain
;
struct
iommu_domain
*
default_domain
;
struct
iommu_domain
*
domain
;
struct
iommu_domain
*
domain
;
atomic_t
domain_shared_ref
;
/* Number of user of current domain.
* The domain cannot be modified if ref > 0
*/
};
};
struct
group_device
{
struct
group_device
{
...
@@ -392,6 +395,7 @@ struct iommu_group *iommu_group_alloc(void)
...
@@ -392,6 +395,7 @@ struct iommu_group *iommu_group_alloc(void)
return
ERR_PTR
(
ret
);
return
ERR_PTR
(
ret
);
}
}
group
->
id
=
ret
;
group
->
id
=
ret
;
atomic_set
(
&
group
->
domain_shared_ref
,
0
);
ret
=
kobject_init_and_add
(
&
group
->
kobj
,
&
iommu_group_ktype
,
ret
=
kobject_init_and_add
(
&
group
->
kobj
,
&
iommu_group_ktype
,
NULL
,
"%d"
,
group
->
id
);
NULL
,
"%d"
,
group
->
id
);
...
@@ -525,6 +529,26 @@ int iommu_group_set_name(struct iommu_group *group, const char *name)
...
@@ -525,6 +529,26 @@ int iommu_group_set_name(struct iommu_group *group, const char *name)
}
}
EXPORT_SYMBOL_GPL
(
iommu_group_set_name
);
EXPORT_SYMBOL_GPL
(
iommu_group_set_name
);
struct
iommu_domain
*
iommu_group_share_domain
(
struct
iommu_group
*
group
)
{
/* the domain can be shared only when the default domain is used */
/* todo: more shareable check */
if
(
group
->
domain
!=
group
->
default_domain
)
return
ERR_PTR
(
-
EINVAL
);
atomic_inc
(
&
group
->
domain_shared_ref
);
return
group
->
domain
;
}
EXPORT_SYMBOL_GPL
(
iommu_group_share_domain
);
struct
iommu_domain
*
iommu_group_unshare_domain
(
struct
iommu_group
*
group
)
{
atomic_dec
(
&
group
->
domain_shared_ref
);
WARN_ON
(
atomic_read
(
&
group
->
domain_shared_ref
)
<
0
);
return
group
->
domain
;
}
EXPORT_SYMBOL_GPL
(
iommu_group_unshare_domain
);
static
int
iommu_group_create_direct_mappings
(
struct
iommu_group
*
group
,
static
int
iommu_group_create_direct_mappings
(
struct
iommu_group
*
group
,
struct
device
*
dev
)
struct
device
*
dev
)
{
{
...
@@ -1460,7 +1484,8 @@ static int __iommu_attach_group(struct iommu_domain *domain,
...
@@ -1460,7 +1484,8 @@ static int __iommu_attach_group(struct iommu_domain *domain,
{
{
int
ret
;
int
ret
;
if
(
group
->
default_domain
&&
group
->
domain
!=
group
->
default_domain
)
if
((
group
->
default_domain
&&
group
->
domain
!=
group
->
default_domain
)
||
atomic_read
(
&
group
->
domain_shared_ref
)
>
0
)
return
-
EBUSY
;
return
-
EBUSY
;
ret
=
__iommu_group_for_each_dev
(
group
,
domain
,
ret
=
__iommu_group_for_each_dev
(
group
,
domain
,
...
@@ -1497,6 +1522,8 @@ static void __iommu_detach_group(struct iommu_domain *domain,
...
@@ -1497,6 +1522,8 @@ static void __iommu_detach_group(struct iommu_domain *domain,
{
{
int
ret
;
int
ret
;
WARN_ON
(
atomic_read
(
&
group
->
domain_shared_ref
)
>
0
);
if
(
!
group
->
default_domain
)
{
if
(
!
group
->
default_domain
)
{
__iommu_group_for_each_dev
(
group
,
domain
,
__iommu_group_for_each_dev
(
group
,
domain
,
iommu_group_do_detach_device
);
iommu_group_do_detach_device
);
...
...
include/linux/iommu.h
浏览文件 @
d5cc7d54
...
@@ -346,6 +346,9 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
...
@@ -346,6 +346,9 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
void
*
data
);
void
*
data
);
extern
int
iommu_domain_set_attr
(
struct
iommu_domain
*
domain
,
enum
iommu_attr
,
extern
int
iommu_domain_set_attr
(
struct
iommu_domain
*
domain
,
enum
iommu_attr
,
void
*
data
);
void
*
data
);
extern
struct
iommu_domain
*
iommu_group_share_domain
(
struct
iommu_group
*
group
);
extern
struct
iommu_domain
*
iommu_group_unshare_domain
(
struct
iommu_group
*
group
);
/* Window handling function prototypes */
/* Window handling function prototypes */
extern
int
iommu_domain_window_enable
(
struct
iommu_domain
*
domain
,
u32
wnd_nr
,
extern
int
iommu_domain_window_enable
(
struct
iommu_domain
*
domain
,
u32
wnd_nr
,
...
@@ -686,6 +689,17 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
...
@@ -686,6 +689,17 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
return
NULL
;
return
NULL
;
}
}
static
inline
struct
iommu_domain
*
iommu_group_share_domain
(
struct
iommu_group
*
group
)
{
return
NULL
;
}
static
inline
struct
iommu_domain
*
iommu_group_unshare_domain
(
struct
iommu_group
*
group
)
{
return
NULL
;
}
#endif
/* CONFIG_IOMMU_API */
#endif
/* CONFIG_IOMMU_API */
#ifdef CONFIG_IOMMU_DEBUGFS
#ifdef CONFIG_IOMMU_DEBUGFS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录