Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
5a8f40e8
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5a8f40e8
编写于
10年前
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iommu/vt-d: Always store iommu in device_domain_info
Signed-off-by:
N
David Woodhouse
<
David.Woodhouse@intel.com
>
上级
e2f8c5f6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
16 deletion
+31
-16
drivers/iommu/intel-iommu.c
drivers/iommu/intel-iommu.c
+31
-16
未找到文件。
drivers/iommu/intel-iommu.c
浏览文件 @
5a8f40e8
...
...
@@ -1274,8 +1274,6 @@ iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu,
if
(
!
dmar_find_matched_atsr_unit
(
pdev
))
return
NULL
;
info
->
iommu
=
iommu
;
return
info
;
}
...
...
@@ -2134,7 +2132,7 @@ static struct dmar_domain *find_domain(struct device *dev)
return
NULL
;
}
static
inline
struct
d
mar_domain
*
static
inline
struct
d
evice_domain_info
*
dmar_search_domain_by_dev_info
(
int
segment
,
int
bus
,
int
devfn
)
{
struct
device_domain_info
*
info
;
...
...
@@ -2142,16 +2140,17 @@ dmar_search_domain_by_dev_info(int segment, int bus, int devfn)
list_for_each_entry
(
info
,
&
device_domain_list
,
global
)
if
(
info
->
segment
==
segment
&&
info
->
bus
==
bus
&&
info
->
devfn
==
devfn
)
return
info
->
domain
;
return
info
;
return
NULL
;
}
static
struct
dmar_domain
*
dmar_insert_dev_info
(
int
segment
,
int
bus
,
int
devfn
,
static
struct
dmar_domain
*
dmar_insert_dev_info
(
struct
intel_iommu
*
iommu
,
int
segment
,
int
bus
,
int
devfn
,
struct
device
*
dev
,
struct
dmar_domain
*
domain
)
{
struct
dmar_domain
*
found
;
struct
dmar_domain
*
found
=
NULL
;
struct
device_domain_info
*
info
;
unsigned
long
flags
;
...
...
@@ -2164,14 +2163,19 @@ static struct dmar_domain *dmar_insert_dev_info(int segment, int bus, int devfn,
info
->
devfn
=
devfn
;
info
->
dev
=
dev
;
info
->
domain
=
domain
;
info
->
iommu
=
iommu
;
if
(
!
dev
)
domain
->
flags
|=
DOMAIN_FLAG_P2P_MULTIPLE_DEVICES
;
spin_lock_irqsave
(
&
device_domain_lock
,
flags
);
if
(
dev
)
found
=
find_domain
(
dev
);
else
found
=
dmar_search_domain_by_dev_info
(
segment
,
bus
,
devfn
);
else
{
struct
device_domain_info
*
info2
;
info2
=
dmar_search_domain_by_dev_info
(
segment
,
bus
,
devfn
);
if
(
info2
)
found
=
info2
->
domain
;
}
if
(
found
)
{
spin_unlock_irqrestore
(
&
device_domain_lock
,
flags
);
free_devinfo_mem
(
info
);
...
...
@@ -2192,7 +2196,8 @@ static struct dmar_domain *dmar_insert_dev_info(int segment, int bus, int devfn,
static
struct
dmar_domain
*
get_domain_for_dev
(
struct
pci_dev
*
pdev
,
int
gaw
)
{
struct
dmar_domain
*
domain
,
*
free
=
NULL
;
struct
intel_iommu
*
iommu
;
struct
intel_iommu
*
iommu
=
NULL
;
struct
device_domain_info
*
info
;
struct
dmar_drhd_unit
*
drhd
;
struct
pci_dev
*
dev_tmp
;
unsigned
long
flags
;
...
...
@@ -2215,10 +2220,13 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
devfn
=
dev_tmp
->
devfn
;
}
spin_lock_irqsave
(
&
device_domain_lock
,
flags
);
domain
=
dmar_search_domain_by_dev_info
(
segment
,
bus
,
devfn
);
info
=
dmar_search_domain_by_dev_info
(
segment
,
bus
,
devfn
);
if
(
info
)
{
iommu
=
info
->
iommu
;
domain
=
info
->
domain
;
}
spin_unlock_irqrestore
(
&
device_domain_lock
,
flags
);
/* pcie-pci bridge already has a domain, uses it */
if
(
domain
)
if
(
info
)
goto
found_domain
;
}
...
...
@@ -2244,14 +2252,15 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
/* register pcie-to-pci device */
if
(
dev_tmp
)
{
domain
=
dmar_insert_dev_info
(
segment
,
bus
,
devfn
,
NULL
,
domain
);
domain
=
dmar_insert_dev_info
(
iommu
,
segment
,
bus
,
devfn
,
NULL
,
domain
);
if
(
!
domain
)
goto
error
;
}
found_domain:
domain
=
dmar_insert_dev_info
(
segment
,
pdev
->
bus
->
number
,
pdev
->
devfn
,
&
pdev
->
dev
,
domain
);
domain
=
dmar_insert_dev_info
(
iommu
,
segment
,
pdev
->
bus
->
number
,
pdev
->
devfn
,
&
pdev
->
dev
,
domain
);
error:
if
(
free
!=
domain
)
domain_exit
(
free
);
...
...
@@ -2453,9 +2462,15 @@ static int domain_add_dev_info(struct dmar_domain *domain,
int
translation
)
{
struct
dmar_domain
*
ndomain
;
struct
intel_iommu
*
iommu
;
int
ret
;
ndomain
=
dmar_insert_dev_info
(
pci_domain_nr
(
pdev
->
bus
),
iommu
=
device_to_iommu
(
pci_domain_nr
(
pdev
->
bus
),
pdev
->
bus
->
number
,
pdev
->
devfn
);
if
(
!
iommu
)
return
-
ENODEV
;
ndomain
=
dmar_insert_dev_info
(
iommu
,
pci_domain_nr
(
pdev
->
bus
),
pdev
->
bus
->
number
,
pdev
->
devfn
,
&
pdev
->
dev
,
domain
);
if
(
ndomain
!=
domain
)
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部