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
dde57a21
Commit
dde57a21
authored
Dec 03, 2008
by
Joerg Roedel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VT-d: adapt domain map and unmap functions for IOMMU API
Signed-off-by:
Joerg Roedel
<
joerg.roedel@amd.com
>
parent
4c5478c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
drivers/pci/intel-iommu.c
drivers/pci/intel-iommu.c
+20
-13
include/linux/intel-iommu.h
include/linux/intel-iommu.h
+0
-4
No files found.
drivers/pci/intel-iommu.c
View file @
dde57a21
...
@@ -3047,20 +3047,28 @@ static void intel_iommu_detach_device(struct iommu_domain *domain,
...
@@ -3047,20 +3047,28 @@ static void intel_iommu_detach_device(struct iommu_domain *domain,
vm_domain_remove_one_dev_info
(
dmar_domain
,
pdev
);
vm_domain_remove_one_dev_info
(
dmar_domain
,
pdev
);
}
}
int
intel_iommu_map_address
(
struct
dmar_domain
*
domain
,
dma_addr_t
iova
,
static
int
intel_iommu_map_range
(
struct
iommu_domain
*
domain
,
u64
hpa
,
size_t
size
,
int
prot
)
unsigned
long
iova
,
phys_addr_t
hpa
,
size_t
size
,
int
iommu_prot
)
{
{
struct
dmar_domain
*
dmar_domain
=
domain
->
priv
;
u64
max_addr
;
u64
max_addr
;
int
addr_width
;
int
addr_width
;
int
prot
=
0
;
int
ret
;
int
ret
;
if
(
iommu_prot
&
IOMMU_READ
)
prot
|=
DMA_PTE_READ
;
if
(
iommu_prot
&
IOMMU_WRITE
)
prot
|=
DMA_PTE_WRITE
;
max_addr
=
(
iova
&
VTD_PAGE_MASK
)
+
VTD_PAGE_ALIGN
(
size
);
max_addr
=
(
iova
&
VTD_PAGE_MASK
)
+
VTD_PAGE_ALIGN
(
size
);
if
(
domain
->
max_addr
<
max_addr
)
{
if
(
d
mar_d
omain
->
max_addr
<
max_addr
)
{
int
min_agaw
;
int
min_agaw
;
u64
end
;
u64
end
;
/* check if minimum agaw is sufficient for mapped address */
/* check if minimum agaw is sufficient for mapped address */
min_agaw
=
vm_domain_min_agaw
(
domain
);
min_agaw
=
vm_domain_min_agaw
(
d
mar_d
omain
);
addr_width
=
agaw_to_width
(
min_agaw
);
addr_width
=
agaw_to_width
(
min_agaw
);
end
=
DOMAIN_MAX_ADDR
(
addr_width
);
end
=
DOMAIN_MAX_ADDR
(
addr_width
);
end
=
end
&
VTD_PAGE_MASK
;
end
=
end
&
VTD_PAGE_MASK
;
...
@@ -3070,28 +3078,27 @@ int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova,
...
@@ -3070,28 +3078,27 @@ int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova,
__func__
,
min_agaw
,
max_addr
);
__func__
,
min_agaw
,
max_addr
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
domain
->
max_addr
=
max_addr
;
d
mar_d
omain
->
max_addr
=
max_addr
;
}
}
ret
=
domain_page_mapping
(
domain
,
iova
,
hpa
,
size
,
prot
);
ret
=
domain_page_mapping
(
d
mar_d
omain
,
iova
,
hpa
,
size
,
prot
);
return
ret
;
return
ret
;
}
}
EXPORT_SYMBOL_GPL
(
intel_iommu_map_address
);
void
intel_iommu_unmap_address
(
struct
dmar
_domain
*
domain
,
static
void
intel_iommu_unmap_range
(
struct
iommu
_domain
*
domain
,
dma_addr_t
iova
,
size_t
size
)
unsigned
long
iova
,
size_t
size
)
{
{
struct
dmar_domain
*
dmar_domain
=
domain
->
priv
;
dma_addr_t
base
;
dma_addr_t
base
;
/* The address might not be aligned */
/* The address might not be aligned */
base
=
iova
&
VTD_PAGE_MASK
;
base
=
iova
&
VTD_PAGE_MASK
;
size
=
VTD_PAGE_ALIGN
(
size
);
size
=
VTD_PAGE_ALIGN
(
size
);
dma_pte_clear_range
(
domain
,
base
,
base
+
size
);
dma_pte_clear_range
(
d
mar_d
omain
,
base
,
base
+
size
);
if
(
domain
->
max_addr
==
base
+
size
)
if
(
d
mar_d
omain
->
max_addr
==
base
+
size
)
domain
->
max_addr
=
base
;
d
mar_d
omain
->
max_addr
=
base
;
}
}
EXPORT_SYMBOL_GPL
(
intel_iommu_unmap_address
);
int
intel_iommu_found
(
void
)
int
intel_iommu_found
(
void
)
{
{
...
...
include/linux/intel-iommu.h
View file @
dde57a21
...
@@ -330,10 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
...
@@ -330,10 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
extern
void
qi_submit_sync
(
struct
qi_desc
*
desc
,
struct
intel_iommu
*
iommu
);
extern
void
qi_submit_sync
(
struct
qi_desc
*
desc
,
struct
intel_iommu
*
iommu
);
int
intel_iommu_map_address
(
struct
dmar_domain
*
domain
,
dma_addr_t
iova
,
u64
hpa
,
size_t
size
,
int
prot
);
void
intel_iommu_unmap_address
(
struct
dmar_domain
*
domain
,
dma_addr_t
iova
,
size_t
size
);
u64
intel_iommu_iova_to_phys
(
struct
dmar_domain
*
domain
,
u64
iova
);
u64
intel_iommu_iova_to_phys
(
struct
dmar_domain
*
domain
,
u64
iova
);
#ifdef CONFIG_DMAR
#ifdef CONFIG_DMAR
...
...
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