Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
b536d24d
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
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看板
提交
b536d24d
编写于
6月 28, 2009
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
intel-iommu: Clean up intel_map_sg(), remove domain_page_mapping()
Signed-off-by:
N
David Woodhouse
<
David.Woodhouse@intel.com
>
上级
ad051221
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
35 deletion
+19
-35
drivers/pci/intel-iommu.c
drivers/pci/intel-iommu.c
+19
-35
未找到文件。
drivers/pci/intel-iommu.c
浏览文件 @
b536d24d
...
...
@@ -1674,17 +1674,6 @@ static int domain_pfn_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
return
0
;
}
static
int
domain_page_mapping
(
struct
dmar_domain
*
domain
,
dma_addr_t
iova
,
u64
hpa
,
size_t
size
,
int
prot
)
{
unsigned
long
first_pfn
=
hpa
>>
VTD_PAGE_SHIFT
;
unsigned
long
last_pfn
=
(
hpa
+
size
-
1
)
>>
VTD_PAGE_SHIFT
;
return
domain_pfn_mapping
(
domain
,
iova
>>
VTD_PAGE_SHIFT
,
first_pfn
,
last_pfn
-
first_pfn
+
1
,
prot
);
}
static
void
iommu_detach_dev
(
struct
intel_iommu
*
iommu
,
u8
bus
,
u8
devfn
)
{
if
(
!
iommu
)
...
...
@@ -2745,17 +2734,16 @@ static int intel_nontranslate_map_sg(struct device *hddev,
static
int
intel_map_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sglist
,
int
nelems
,
enum
dma_data_direction
dir
,
struct
dma_attrs
*
attrs
)
{
phys_addr_t
addr
;
int
i
;
struct
pci_dev
*
pdev
=
to_pci_dev
(
hwdev
);
struct
dmar_domain
*
domain
;
size_t
size
=
0
;
int
prot
=
0
;
size_t
offset
=
0
;
size_t
offset
_pfn
=
0
;
struct
iova
*
iova
=
NULL
;
int
ret
;
struct
scatterlist
*
sg
;
unsigned
long
start_
addr
;
unsigned
long
start_
vpfn
;
struct
intel_iommu
*
iommu
;
BUG_ON
(
dir
==
DMA_NONE
);
...
...
@@ -2768,10 +2756,8 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne
iommu
=
domain_get_iommu
(
domain
);
for_each_sg
(
sglist
,
sg
,
nelems
,
i
)
{
addr
=
page_to_phys
(
sg_page
(
sg
))
+
sg
->
offset
;
size
+=
aligned_size
((
u64
)
addr
,
sg
->
length
);
}
for_each_sg
(
sglist
,
sg
,
nelems
,
i
)
size
+=
aligned_size
(
sg
->
offset
,
sg
->
length
);
iova
=
__intel_alloc_iova
(
hwdev
,
domain
,
size
,
pdev
->
dma_mask
);
if
(
!
iova
)
{
...
...
@@ -2789,36 +2775,34 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne
if
(
dir
==
DMA_FROM_DEVICE
||
dir
==
DMA_BIDIRECTIONAL
)
prot
|=
DMA_PTE_WRITE
;
start_
addr
=
iova
->
pfn_lo
<<
PAGE_SHIFT
;
offset
=
0
;
start_
vpfn
=
mm_to_dma_pfn
(
iova
->
pfn_lo
)
;
offset
_pfn
=
0
;
for_each_sg
(
sglist
,
sg
,
nelems
,
i
)
{
addr
=
page_to_phys
(
sg_page
(
sg
))
+
sg
->
offset
;
size
=
aligned_size
((
u64
)
addr
,
sg
->
length
);
ret
=
domain_page_mapping
(
domain
,
start_addr
+
offset
,
((
u64
)
addr
)
&
PHYSICAL_PAGE_MASK
,
size
,
prot
);
int
nr_pages
=
aligned_size
(
sg
->
offset
,
sg
->
length
)
>>
VTD_PAGE_SHIFT
;
ret
=
domain_pfn_mapping
(
domain
,
start_vpfn
+
offset_pfn
,
page_to_dma_pfn
(
sg_page
(
sg
)),
nr_pages
,
prot
);
if
(
ret
)
{
/* clear the page */
dma_pte_clear_range
(
domain
,
start_addr
>>
VTD_PAGE_SHIFT
,
(
start_addr
+
offset
-
1
)
>>
VTD_PAGE_SHIFT
);
dma_pte_clear_range
(
domain
,
start_vpfn
,
start_vpfn
+
offset_pfn
);
/* free page tables */
dma_pte_free_pagetable
(
domain
,
start_
addr
>>
VTD_PAGE_SHIFT
,
(
start_addr
+
offset
-
1
)
>>
VTD_PAGE_SHIFT
);
dma_pte_free_pagetable
(
domain
,
start_
vpfn
,
start_vpfn
+
offset_pfn
);
/* free iova */
__free_iova
(
&
domain
->
iovad
,
iova
);
return
0
;
}
sg
->
dma_address
=
start_addr
+
offset
+
((
u64
)
addr
&
(
~
PAGE_MASK
))
;
sg
->
dma_address
=
((
dma_addr_t
)(
start_vpfn
+
offset_pfn
)
<<
VTD_PAGE_SHIFT
)
+
sg
->
offset
;
sg
->
dma_length
=
sg
->
length
;
offset
+=
size
;
offset
_pfn
+=
nr_pages
;
}
/* it's a non-present to present mapping. Only flush if caching mode */
if
(
cap_caching_mode
(
iommu
->
cap
))
iommu_flush_iotlb_psi
(
iommu
,
0
,
start_
addr
,
offset
>>
VTD_PAGE_SHIFT
);
iommu_flush_iotlb_psi
(
iommu
,
0
,
start_
vpfn
<<
VTD_PAGE_SHIFT
,
offset
_pfn
);
else
iommu_flush_write_buffer
(
iommu
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录