Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
9051aa02
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9051aa02
编写于
6月 29, 2009
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
intel-iommu: Combine domain_pfn_mapping() and domain_sg_mapping()
Signed-off-by:
N
David Woodhouse
<
David.Woodhouse@intel.com
>
上级
e1605495
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
40 deletion
+22
-40
drivers/pci/intel-iommu.c
drivers/pci/intel-iommu.c
+22
-40
未找到文件。
drivers/pci/intel-iommu.c
浏览文件 @
9051aa02
...
@@ -1635,14 +1635,14 @@ static int domain_context_mapped(struct pci_dev *pdev)
...
@@ -1635,14 +1635,14 @@ static int domain_context_mapped(struct pci_dev *pdev)
tmp
->
devfn
);
tmp
->
devfn
);
}
}
static
int
domain_sg
_mapping
(
struct
dmar_domain
*
domain
,
unsigned
long
iov_pfn
,
static
int
__domain
_mapping
(
struct
dmar_domain
*
domain
,
unsigned
long
iov_pfn
,
struct
scatterlist
*
sg
,
unsigned
long
nr_pages
,
struct
scatterlist
*
sg
,
unsigned
long
phys_pfn
,
int
prot
)
unsigned
long
nr_pages
,
int
prot
)
{
{
struct
dma_pte
*
first_pte
=
NULL
,
*
pte
=
NULL
;
struct
dma_pte
*
first_pte
=
NULL
,
*
pte
=
NULL
;
uint64_t
pteval
;
phys_addr_t
uninitialized_var
(
pteval
)
;
int
addr_width
=
agaw_to_width
(
domain
->
agaw
)
-
VTD_PAGE_SHIFT
;
int
addr_width
=
agaw_to_width
(
domain
->
agaw
)
-
VTD_PAGE_SHIFT
;
unsigned
long
sg_res
=
0
;
unsigned
long
sg_res
;
BUG_ON
(
addr_width
<
BITS_PER_LONG
&&
(
iov_pfn
+
nr_pages
-
1
)
>>
addr_width
);
BUG_ON
(
addr_width
<
BITS_PER_LONG
&&
(
iov_pfn
+
nr_pages
-
1
)
>>
addr_width
);
...
@@ -1651,6 +1651,13 @@ static int domain_sg_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
...
@@ -1651,6 +1651,13 @@ static int domain_sg_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
prot
&=
DMA_PTE_READ
|
DMA_PTE_WRITE
|
DMA_PTE_SNP
;
prot
&=
DMA_PTE_READ
|
DMA_PTE_WRITE
|
DMA_PTE_SNP
;
if
(
sg
)
sg_res
=
0
;
else
{
sg_res
=
nr_pages
+
1
;
pteval
=
((
phys_addr_t
)
phys_pfn
<<
VTD_PAGE_SHIFT
)
|
prot
;
}
while
(
nr_pages
--
)
{
while
(
nr_pages
--
)
{
if
(
!
sg_res
)
{
if
(
!
sg_res
)
{
sg_res
=
(
sg
->
offset
+
sg
->
length
+
VTD_PAGE_SIZE
-
1
)
>>
VTD_PAGE_SHIFT
;
sg_res
=
(
sg
->
offset
+
sg
->
length
+
VTD_PAGE_SIZE
-
1
)
>>
VTD_PAGE_SHIFT
;
...
@@ -1685,43 +1692,18 @@ static int domain_sg_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
...
@@ -1685,43 +1692,18 @@ static int domain_sg_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
return
0
;
return
0
;
}
}
static
in
t
domain_pfn
_mapping
(
struct
dmar_domain
*
domain
,
unsigned
long
iov_pfn
,
static
in
line
int
domain_sg
_mapping
(
struct
dmar_domain
*
domain
,
unsigned
long
iov_pfn
,
unsigned
long
phys_pfn
,
unsigned
long
nr_pages
,
struct
scatterlist
*
sg
,
unsigned
long
nr_pages
,
int
prot
)
int
prot
)
{
{
struct
dma_pte
*
first_pte
=
NULL
,
*
pte
=
NULL
;
return
__domain_mapping
(
domain
,
iov_pfn
,
sg
,
0
,
nr_pages
,
prot
);
int
addr_width
=
agaw_to_width
(
domain
->
agaw
)
-
VTD_PAGE_SHIFT
;
}
BUG_ON
(
addr_width
<
BITS_PER_LONG
&&
(
iov_pfn
+
nr_pages
-
1
)
>>
addr_width
);
if
((
prot
&
(
DMA_PTE_READ
|
DMA_PTE_WRITE
))
==
0
)
return
-
EINVAL
;
prot
&=
DMA_PTE_READ
|
DMA_PTE_WRITE
|
DMA_PTE_SNP
;
while
(
nr_pages
--
)
{
static
inline
int
domain_pfn_mapping
(
struct
dmar_domain
*
domain
,
unsigned
long
iov_pfn
,
if
(
!
pte
)
{
unsigned
long
phys_pfn
,
unsigned
long
nr_pages
,
first_pte
=
pte
=
pfn_to_dma_pte
(
domain
,
iov_pfn
);
int
prot
)
if
(
!
pte
)
{
return
-
ENOMEM
;
return
__domain_mapping
(
domain
,
iov_pfn
,
NULL
,
phys_pfn
,
nr_pages
,
prot
);
}
/* We don't need lock here, nobody else
* touches the iova range
*/
BUG_ON
(
dma_pte_addr
(
pte
));
pte
->
val
=
(
phys_pfn
<<
VTD_PAGE_SHIFT
)
|
prot
;
pte
++
;
if
(
!
nr_pages
||
(
unsigned
long
)
pte
>>
VTD_PAGE_SHIFT
!=
(
unsigned
long
)
first_pte
>>
VTD_PAGE_SHIFT
)
{
domain_flush_cache
(
domain
,
first_pte
,
(
void
*
)
pte
-
(
void
*
)
first_pte
);
pte
=
NULL
;
}
iov_pfn
++
;
phys_pfn
++
;
}
return
0
;
}
}
static
void
iommu_detach_dev
(
struct
intel_iommu
*
iommu
,
u8
bus
,
u8
devfn
)
static
void
iommu_detach_dev
(
struct
intel_iommu
*
iommu
,
u8
bus
,
u8
devfn
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录