Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
b026fd28
Commit
b026fd28
authored
Jun 28, 2009
by
David Woodhouse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intel-iommu: Change addr_to_dma_pte() to pfn_to_dma_pte()
Signed-off-by:
David Woodhouse
<
David.Woodhouse@intel.com
>
parent
163cc52c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
drivers/pci/intel-iommu.c
drivers/pci/intel-iommu.c
+7
-6
No files found.
drivers/pci/intel-iommu.c
View file @
b026fd28
...
...
@@ -692,23 +692,24 @@ static inline unsigned long align_to_level(unsigned long pfn, int 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
*
pfn_to_dma_pte
(
struct
dmar_domain
*
domain
,
unsigned
long
pfn
)
{
int
addr_width
=
agaw_to_width
(
domain
->
agaw
);
int
addr_width
=
agaw_to_width
(
domain
->
agaw
)
-
VTD_PAGE_SHIFT
;
struct
dma_pte
*
parent
,
*
pte
=
NULL
;
int
level
=
agaw_to_level
(
domain
->
agaw
);
int
offset
;
unsigned
long
flags
;
BUG_ON
(
!
domain
->
pgd
);
BUG_ON
(
addr
>>
addr_width
);
BUG_ON
(
addr
_width
<
BITS_PER_LONG
&&
pfn
>>
addr_width
);
parent
=
domain
->
pgd
;
spin_lock_irqsave
(
&
domain
->
mapping_lock
,
flags
);
while
(
level
>
0
)
{
void
*
tmp_page
;
offset
=
pfn_level_offset
(
addr
>>
VTD_PAGE_SHIFT
,
level
);
offset
=
pfn_level_offset
(
pfn
,
level
);
pte
=
&
parent
[
offset
];
if
(
level
==
1
)
break
;
...
...
@@ -1660,7 +1661,7 @@ domain_page_mapping(struct dmar_domain *domain, dma_addr_t iova,
end_pfn
=
(
VTD_PAGE_ALIGN
(((
u64
)
hpa
)
+
size
))
>>
VTD_PAGE_SHIFT
;
index
=
0
;
while
(
start_pfn
<
end_pfn
)
{
pte
=
addr_to_dma_pte
(
domain
,
iova
+
VTD_PAGE_SIZE
*
index
);
pte
=
pfn_to_dma_pte
(
domain
,
(
iova
>>
VTD_PAGE_SHIFT
)
+
index
);
if
(
!
pte
)
return
-
ENOMEM
;
/* We don't need lock here, nobody else
...
...
@@ -3533,7 +3534,7 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
struct
dma_pte
*
pte
;
u64
phys
=
0
;
pte
=
addr_to_dma_pte
(
dmar_domain
,
iova
);
pte
=
pfn_to_dma_pte
(
dmar_domain
,
iova
>>
VTD_PAGE_SHIFT
);
if
(
pte
)
phys
=
dma_pte_addr
(
pte
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment