Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6660c63a
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看板
提交
6660c63a
编写于
6月 27, 2009
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
intel-iommu: Make dma_pte_free_pagetable() use pfns
Signed-off-by:
N
David Woodhouse
<
David.Woodhouse@intel.com
>
上级
595badf5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
18 deletion
+22
-18
drivers/pci/intel-iommu.c
drivers/pci/intel-iommu.c
+22
-18
未找到文件。
drivers/pci/intel-iommu.c
浏览文件 @
6660c63a
...
@@ -669,27 +669,27 @@ static inline int width_to_agaw(int width)
...
@@ -669,27 +669,27 @@ static inline int width_to_agaw(int width)
static
inline
unsigned
int
level_to_offset_bits
(
int
level
)
static
inline
unsigned
int
level_to_offset_bits
(
int
level
)
{
{
return
(
12
+
(
level
-
1
)
*
LEVEL_STRIDE
)
;
return
(
level
-
1
)
*
LEVEL_STRIDE
;
}
}
static
inline
int
pfn_level_offset
(
unsigned
long
pfn
,
int
level
)
static
inline
int
pfn_level_offset
(
unsigned
long
pfn
,
int
level
)
{
{
return
(
pfn
>>
(
level_to_offset_bits
(
level
)
-
12
))
&
LEVEL_MASK
;
return
(
pfn
>>
level_to_offset_bits
(
level
))
&
LEVEL_MASK
;
}
}
static
inline
u
64
level_mask
(
int
level
)
static
inline
u
nsigned
long
level_mask
(
int
level
)
{
{
return
((
u64
)
-
1
<<
level_to_offset_bits
(
level
)
);
return
-
1UL
<<
level_to_offset_bits
(
level
);
}
}
static
inline
u
64
level_size
(
int
level
)
static
inline
u
nsigned
long
level_size
(
int
level
)
{
{
return
((
u64
)
1
<<
level_to_offset_bits
(
level
)
);
return
1UL
<<
level_to_offset_bits
(
level
);
}
}
static
inline
u
64
align_to_level
(
u64
addr
,
int
level
)
static
inline
u
nsigned
long
align_to_level
(
unsigned
long
pfn
,
int
level
)
{
{
return
(
(
addr
+
level_size
(
level
)
-
1
)
&
level_mask
(
level
)
);
return
(
pfn
+
level_size
(
level
)
-
1
)
&
level_mask
(
level
);
}
}
static
struct
dma_pte
*
addr_to_dma_pte
(
struct
dmar_domain
*
domain
,
u64
addr
)
static
struct
dma_pte
*
addr_to_dma_pte
(
struct
dmar_domain
*
domain
,
u64
addr
)
...
@@ -798,25 +798,29 @@ static void dma_pte_clear_range(struct dmar_domain *domain,
...
@@ -798,25 +798,29 @@ static void dma_pte_clear_range(struct dmar_domain *domain,
static
void
dma_pte_free_pagetable
(
struct
dmar_domain
*
domain
,
static
void
dma_pte_free_pagetable
(
struct
dmar_domain
*
domain
,
u64
start
,
u64
end
)
u64
start
,
u64
end
)
{
{
int
addr_width
=
agaw_to_width
(
domain
->
agaw
);
int
addr_width
=
agaw_to_width
(
domain
->
agaw
)
-
VTD_PAGE_SHIFT
;
unsigned
long
start_pfn
=
start
>>
VTD_PAGE_SHIFT
;
unsigned
long
last_pfn
=
(
end
-
1
)
>>
VTD_PAGE_SHIFT
;
struct
dma_pte
*
pte
;
struct
dma_pte
*
pte
;
int
total
=
agaw_to_level
(
domain
->
agaw
);
int
total
=
agaw_to_level
(
domain
->
agaw
);
int
level
;
int
level
;
u
64
tmp
;
u
nsigned
long
tmp
;
BUG_ON
(
start
>>
addr_width
);
BUG_ON
(
addr_width
<
BITS_PER_LONG
&&
start_pfn
>>
addr_width
);
BUG_ON
(
end
>>
addr_width
);
BUG_ON
(
addr_width
<
BITS_PER_LONG
&&
last_pfn
>>
addr_width
);
/* we don't need lock here, nobody else touches the iova range */
/* we don't need lock here, nobody else touches the iova range */
level
=
2
;
level
=
2
;
while
(
level
<=
total
)
{
while
(
level
<=
total
)
{
tmp
=
align_to_level
(
start
,
level
);
tmp
=
align_to_level
(
start_pfn
,
level
);
if
(
tmp
>=
end
||
(
tmp
+
level_size
(
level
)
>
end
))
/* Only clear this pte/pmd if we're asked to clear its
_whole_ range */
if
(
tmp
+
level_size
(
level
)
-
1
>
last_pfn
)
return
;
return
;
while
(
tmp
<
end
)
{
while
(
tmp
<=
last_pfn
)
{
pte
=
dma_pfn_level_pte
(
domain
,
tmp
>>
VTD_PAGE_SHIFT
,
pte
=
dma_pfn_level_pte
(
domain
,
tmp
,
level
);
level
);
if
(
pte
)
{
if
(
pte
)
{
free_pgtable_page
(
free_pgtable_page
(
phys_to_virt
(
dma_pte_addr
(
pte
)));
phys_to_virt
(
dma_pte_addr
(
pte
)));
...
@@ -828,7 +832,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
...
@@ -828,7 +832,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
level
++
;
level
++
;
}
}
/* free pgd */
/* free pgd */
if
(
start
==
0
&&
end
>=
((((
u64
)
1
)
<<
addr_width
)
-
1
))
{
if
(
start
==
0
&&
last_pfn
==
DOMAIN_MAX_PFN
(
domain
->
gaw
))
{
free_pgtable_page
(
domain
->
pgd
);
free_pgtable_page
(
domain
->
pgd
);
domain
->
pgd
=
NULL
;
domain
->
pgd
=
NULL
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录