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
ed40356b
Commit
ed40356b
authored
Mar 07, 2014
by
David Woodhouse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iommu/vt-d: Add ACPI devices into dmaru->devices[] array
Signed-off-by:
David Woodhouse
<
David.Woodhouse@intel.com
>
parent
832bd858
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
drivers/iommu/dmar.c
drivers/iommu/dmar.c
+75
-0
No files found.
drivers/iommu/dmar.c
View file @
ed40356b
...
...
@@ -612,6 +612,79 @@ dmar_find_matched_drhd_unit(struct pci_dev *dev)
return
dmaru
;
}
static
void
__init
dmar_acpi_insert_dev_scope
(
u8
device_number
,
struct
acpi_device
*
adev
)
{
struct
dmar_drhd_unit
*
dmaru
;
struct
acpi_dmar_hardware_unit
*
drhd
;
struct
acpi_dmar_device_scope
*
scope
;
struct
device
*
tmp
;
int
i
;
struct
acpi_dmar_pci_path
*
path
;
for_each_drhd_unit
(
dmaru
)
{
drhd
=
container_of
(
dmaru
->
hdr
,
struct
acpi_dmar_hardware_unit
,
header
);
for
(
scope
=
(
void
*
)(
drhd
+
1
);
(
unsigned
long
)
scope
<
((
unsigned
long
)
drhd
)
+
drhd
->
header
.
length
;
scope
=
((
void
*
)
scope
)
+
scope
->
length
)
{
if
(
scope
->
entry_type
!=
ACPI_DMAR_SCOPE_TYPE_ACPI
)
continue
;
if
(
scope
->
enumeration_id
!=
device_number
)
continue
;
path
=
(
void
*
)(
scope
+
1
);
pr_info
(
"ACPI device
\"
%s
\"
under DMAR at %llx as %02x:%02x.%d
\n
"
,
dev_name
(
&
adev
->
dev
),
dmaru
->
reg_base_addr
,
scope
->
bus
,
path
->
device
,
path
->
function
);
for_each_dev_scope
(
dmaru
->
devices
,
dmaru
->
devices_cnt
,
i
,
tmp
)
if
(
tmp
==
NULL
)
{
dmaru
->
devices
[
i
].
bus
=
scope
->
bus
;
dmaru
->
devices
[
i
].
devfn
=
PCI_DEVFN
(
path
->
device
,
path
->
function
);
rcu_assign_pointer
(
dmaru
->
devices
[
i
].
dev
,
get_device
(
&
adev
->
dev
));
return
;
}
BUG_ON
(
i
>=
dmaru
->
devices_cnt
);
}
}
pr_warn
(
"No IOMMU scope found for ANDD enumeration ID %d (%s)
\n
"
,
device_number
,
dev_name
(
&
adev
->
dev
));
}
static
int
__init
dmar_acpi_dev_scope_init
(
void
)
{
struct
acpi_dmar_andd
*
andd
=
(
void
*
)
dmar_tbl
+
sizeof
(
struct
acpi_table_dmar
);
while
(((
unsigned
long
)
andd
)
<
((
unsigned
long
)
dmar_tbl
)
+
dmar_tbl
->
length
)
{
if
(
andd
->
header
.
type
==
ACPI_DMAR_TYPE_ANDD
)
{
acpi_handle
h
;
struct
acpi_device
*
adev
;
if
(
!
ACPI_SUCCESS
(
acpi_get_handle
(
ACPI_ROOT_OBJECT
,
andd
->
object_name
,
&
h
)))
{
pr_err
(
"Failed to find handle for ACPI object %s
\n
"
,
andd
->
object_name
);
continue
;
}
acpi_bus_get_device
(
h
,
&
adev
);
if
(
!
adev
)
{
pr_err
(
"Failed to get device for ACPI object %s
\n
"
,
andd
->
object_name
);
continue
;
}
dmar_acpi_insert_dev_scope
(
andd
->
device_number
,
adev
);
}
andd
=
((
void
*
)
andd
)
+
andd
->
header
.
length
;
}
return
0
;
}
int
__init
dmar_dev_scope_init
(
void
)
{
struct
pci_dev
*
dev
=
NULL
;
...
...
@@ -620,6 +693,8 @@ int __init dmar_dev_scope_init(void)
if
(
dmar_dev_scope_status
!=
1
)
return
dmar_dev_scope_status
;
dmar_acpi_dev_scope_init
();
if
(
list_empty
(
&
dmar_drhd_units
))
{
dmar_dev_scope_status
=
-
ENODEV
;
}
else
{
...
...
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