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
Kirill Smelkov
linux
Commits
3bdb2591
Commit
3bdb2591
authored
Mar 09, 2014
by
David Woodhouse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iommu/vt-d: Make iommu_should_identity_map() take struct device
Signed-off-by:
David Woodhouse
<
David.Woodhouse@intel.com
>
parent
0b9d9753
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
50 deletions
+57
-50
drivers/iommu/intel-iommu.c
drivers/iommu/intel-iommu.c
+57
-50
No files found.
drivers/iommu/intel-iommu.c
View file @
3bdb2591
...
@@ -2518,9 +2518,12 @@ static bool device_has_rmrr(struct device *dev)
...
@@ -2518,9 +2518,12 @@ static bool device_has_rmrr(struct device *dev)
return
false
;
return
false
;
}
}
static
int
iommu_should_identity_map
(
struct
pci_dev
*
p
dev
,
int
startup
)
static
int
iommu_should_identity_map
(
struct
device
*
dev
,
int
startup
)
{
{
if
(
dev_is_pci
(
dev
))
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
/*
/*
* We want to prevent any device associated with an RMRR from
* We want to prevent any device associated with an RMRR from
* getting placed into the SI Domain. This is done because
* getting placed into the SI Domain. This is done because
...
@@ -2529,7 +2532,7 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
...
@@ -2529,7 +2532,7 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
* from this process due to their usage of RMRRs that are known
* from this process due to their usage of RMRRs that are known
* to not be needed after BIOS hand-off to OS.
* to not be needed after BIOS hand-off to OS.
*/
*/
if
(
device_has_rmrr
(
&
pdev
->
dev
)
&&
if
(
device_has_rmrr
(
dev
)
&&
(
pdev
->
class
>>
8
)
!=
PCI_CLASS_SERIAL_USB
)
(
pdev
->
class
>>
8
)
!=
PCI_CLASS_SERIAL_USB
)
return
0
;
return
0
;
...
@@ -2566,10 +2569,14 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
...
@@ -2566,10 +2569,14 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
return
0
;
return
0
;
}
else
if
(
pci_pcie_type
(
pdev
)
==
PCI_EXP_TYPE_PCI_BRIDGE
)
}
else
if
(
pci_pcie_type
(
pdev
)
==
PCI_EXP_TYPE_PCI_BRIDGE
)
return
0
;
return
0
;
}
else
{
if
(
device_has_rmrr
(
dev
))
return
0
;
}
/*
/*
* At boot time, we don't yet know if devices will be 64-bit capable.
* At boot time, we don't yet know if devices will be 64-bit capable.
* Assume that they will
-- if they turn out not to be, then we can
* Assume that they will
— if they turn out not to be, then we can
* take them out of the 1:1 domain later.
* take them out of the 1:1 domain later.
*/
*/
if
(
!
startup
)
{
if
(
!
startup
)
{
...
@@ -2577,13 +2584,13 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
...
@@ -2577,13 +2584,13 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
* If the device's dma_mask is less than the system's memory
* If the device's dma_mask is less than the system's memory
* size then this is not a candidate for identity mapping.
* size then this is not a candidate for identity mapping.
*/
*/
u64
dma_mask
=
p
dev
->
dma_mask
;
u64
dma_mask
=
*
dev
->
dma_mask
;
if
(
pdev
->
dev
.
coherent_dma_mask
&&
if
(
dev
->
coherent_dma_mask
&&
pdev
->
dev
.
coherent_dma_mask
<
dma_mask
)
dev
->
coherent_dma_mask
<
dma_mask
)
dma_mask
=
pdev
->
dev
.
coherent_dma_mask
;
dma_mask
=
dev
->
coherent_dma_mask
;
return
dma_mask
>=
dma_get_required_mask
(
&
pdev
->
dev
);
return
dma_mask
>=
dma_get_required_mask
(
dev
);
}
}
return
1
;
return
1
;
...
@@ -2599,7 +2606,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
...
@@ -2599,7 +2606,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
return
-
EFAULT
;
return
-
EFAULT
;
for_each_pci_dev
(
pdev
)
{
for_each_pci_dev
(
pdev
)
{
if
(
iommu_should_identity_map
(
p
dev
,
1
))
{
if
(
iommu_should_identity_map
(
&
pdev
->
dev
,
1
))
{
ret
=
domain_add_dev_info
(
si_domain
,
pdev
,
ret
=
domain_add_dev_info
(
si_domain
,
pdev
,
hw
?
CONTEXT_TT_PASS_THROUGH
:
hw
?
CONTEXT_TT_PASS_THROUGH
:
CONTEXT_TT_MULTI_LEVEL
);
CONTEXT_TT_MULTI_LEVEL
);
...
@@ -2917,7 +2924,7 @@ static int iommu_no_mapping(struct device *dev)
...
@@ -2917,7 +2924,7 @@ static int iommu_no_mapping(struct device *dev)
pdev
=
to_pci_dev
(
dev
);
pdev
=
to_pci_dev
(
dev
);
found
=
identity_mapping
(
dev
);
found
=
identity_mapping
(
dev
);
if
(
found
)
{
if
(
found
)
{
if
(
iommu_should_identity_map
(
p
dev
,
0
))
if
(
iommu_should_identity_map
(
&
pdev
->
dev
,
0
))
return
1
;
return
1
;
else
{
else
{
/*
/*
...
@@ -2934,7 +2941,7 @@ static int iommu_no_mapping(struct device *dev)
...
@@ -2934,7 +2941,7 @@ static int iommu_no_mapping(struct device *dev)
* In case of a detached 64 bit DMA device from vm, the device
* In case of a detached 64 bit DMA device from vm, the device
* is put into si_domain for identity mapping.
* is put into si_domain for identity mapping.
*/
*/
if
(
iommu_should_identity_map
(
p
dev
,
0
))
{
if
(
iommu_should_identity_map
(
&
pdev
->
dev
,
0
))
{
int
ret
;
int
ret
;
ret
=
domain_add_dev_info
(
si_domain
,
pdev
,
ret
=
domain_add_dev_info
(
si_domain
,
pdev
,
hw_pass_through
?
hw_pass_through
?
...
...
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