Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
b0a11f44
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看板
提交
b0a11f44
编写于
1月 03, 2009
作者:
J
Joerg Roedel
浏览文件
操作
浏览文件
下载
差异文件
Merge branches 'iommu/api' and 'iommu/amd' into for-linus
上级
7398ca79
0e93dd88
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
676 addition
and
87 deletion
+676
-87
arch/x86/Kconfig
arch/x86/Kconfig
+10
-0
arch/x86/include/asm/amd_iommu_types.h
arch/x86/include/asm/amd_iommu_types.h
+42
-19
arch/x86/kernel/amd_iommu.c
arch/x86/kernel/amd_iommu.c
+618
-59
arch/x86/kernel/amd_iommu_init.c
arch/x86/kernel/amd_iommu_init.c
+6
-9
未找到文件。
arch/x86/Kconfig
浏览文件 @
b0a11f44
...
...
@@ -586,6 +586,16 @@ config AMD_IOMMU
your BIOS for an option to enable it or if you have an IVRS ACPI
table.
config AMD_IOMMU_STATS
bool "Export AMD IOMMU statistics to debugfs"
depends on AMD_IOMMU
select DEBUG_FS
help
This option enables code in the AMD IOMMU driver to collect various
statistics about whats happening in the driver and exports that
information to userspace via debugfs.
If unsure, say N.
# need this always selected by IOMMU for the VIA workaround
config SWIOTLB
def_bool y if X86_64
...
...
arch/x86/include/asm/amd_iommu_types.h
浏览文件 @
b0a11f44
...
...
@@ -190,16 +190,23 @@
/* FIXME: move this macro to <linux/pci.h> */
#define PCI_BUS(x) (((x) >> 8) & 0xff)
/* Protection domain flags */
#define PD_DMA_OPS_MASK (1UL << 0)
/* domain used for dma_ops */
#define PD_DEFAULT_MASK (1UL << 1)
/* domain is a default dma_ops
domain for an IOMMU */
/*
* This structure contains generic data for IOMMU protection domains
* independent of their use.
*/
struct
protection_domain
{
spinlock_t
lock
;
/* mostly used to lock the page table*/
u16
id
;
/* the domain id written to the device table */
int
mode
;
/* paging mode (0-6 levels) */
u64
*
pt_root
;
/* page table root pointer */
void
*
priv
;
/* private data */
spinlock_t
lock
;
/* mostly used to lock the page table*/
u16
id
;
/* the domain id written to the device table */
int
mode
;
/* paging mode (0-6 levels) */
u64
*
pt_root
;
/* page table root pointer */
unsigned
long
flags
;
/* flags to find out type of domain */
unsigned
dev_cnt
;
/* devices assigned to this domain */
void
*
priv
;
/* private data */
};
/*
...
...
@@ -295,7 +302,7 @@ struct amd_iommu {
bool
int_enabled
;
/* if one, we need to send a completion wait command */
int
need_sync
;
bool
need_sync
;
/* default dma_ops domain for that IOMMU */
struct
dma_ops_domain
*
default_dom
;
...
...
@@ -374,7 +381,7 @@ extern struct protection_domain **amd_iommu_pd_table;
extern
unsigned
long
*
amd_iommu_pd_alloc_bitmap
;
/* will be 1 if device isolation is enabled */
extern
int
amd_iommu_isolate
;
extern
bool
amd_iommu_isolate
;
/*
* If true, the addresses will be flushed on unmap time, not when
...
...
@@ -382,18 +389,6 @@ extern int amd_iommu_isolate;
*/
extern
bool
amd_iommu_unmap_flush
;
/* takes a PCI device id and prints it out in a readable form */
static
inline
void
print_devid
(
u16
devid
,
int
nl
)
{
int
bus
=
devid
>>
8
;
int
dev
=
devid
>>
3
&
0x1f
;
int
fn
=
devid
&
0x07
;
printk
(
"%02x:%02x.%x"
,
bus
,
dev
,
fn
);
if
(
nl
)
printk
(
"
\n
"
);
}
/* takes bus and device/function and returns the device id
* FIXME: should that be in generic PCI code? */
static
inline
u16
calc_devid
(
u8
bus
,
u8
devfn
)
...
...
@@ -401,4 +396,32 @@ static inline u16 calc_devid(u8 bus, u8 devfn)
return
(((
u16
)
bus
)
<<
8
)
|
devfn
;
}
#ifdef CONFIG_AMD_IOMMU_STATS
struct
__iommu_counter
{
char
*
name
;
struct
dentry
*
dent
;
u64
value
;
};
#define DECLARE_STATS_COUNTER(nm) \
static struct __iommu_counter nm = { \
.name = #nm, \
}
#define INC_STATS_COUNTER(name) name.value += 1
#define ADD_STATS_COUNTER(name, x) name.value += (x)
#define SUB_STATS_COUNTER(name, x) name.value -= (x)
#else
/* CONFIG_AMD_IOMMU_STATS */
#define DECLARE_STATS_COUNTER(name)
#define INC_STATS_COUNTER(name)
#define ADD_STATS_COUNTER(name, x)
#define SUB_STATS_COUNTER(name, x)
static
inline
void
amd_iommu_stats_init
(
void
)
{
}
#endif
/* CONFIG_AMD_IOMMU_STATS */
#endif
/* _ASM_X86_AMD_IOMMU_TYPES_H */
arch/x86/kernel/amd_iommu.c
浏览文件 @
b0a11f44
此差异已折叠。
点击以展开。
arch/x86/kernel/amd_iommu_init.c
浏览文件 @
b0a11f44
...
...
@@ -122,7 +122,8 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have
LIST_HEAD
(
amd_iommu_unity_map
);
/* a list of required unity mappings
we find in ACPI */
unsigned
amd_iommu_aperture_order
=
26
;
/* size of aperture in power of 2 */
int
amd_iommu_isolate
=
1
;
/* if 1, device isolation is enabled */
bool
amd_iommu_isolate
=
true
;
/* if true, device isolation is
enabled */
bool
amd_iommu_unmap_flush
;
/* if true, flush on every unmap */
LIST_HEAD
(
amd_iommu_list
);
/* list of all AMD IOMMUs in the
...
...
@@ -245,12 +246,8 @@ static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
/* Function to enable the hardware */
void
__init
iommu_enable
(
struct
amd_iommu
*
iommu
)
{
printk
(
KERN_INFO
"AMD IOMMU: Enabling IOMMU "
"at %02x:%02x.%x cap 0x%hx
\n
"
,
iommu
->
dev
->
bus
->
number
,
PCI_SLOT
(
iommu
->
dev
->
devfn
),
PCI_FUNC
(
iommu
->
dev
->
devfn
),
iommu
->
cap_ptr
);
printk
(
KERN_INFO
"AMD IOMMU: Enabling IOMMU at %s cap 0x%hx
\n
"
,
dev_name
(
&
iommu
->
dev
->
dev
),
iommu
->
cap_ptr
);
iommu_feature_enable
(
iommu
,
CONTROL_IOMMU_EN
);
}
...
...
@@ -1218,9 +1215,9 @@ static int __init parse_amd_iommu_options(char *str)
{
for
(;
*
str
;
++
str
)
{
if
(
strncmp
(
str
,
"isolate"
,
7
)
==
0
)
amd_iommu_isolate
=
1
;
amd_iommu_isolate
=
true
;
if
(
strncmp
(
str
,
"share"
,
5
)
==
0
)
amd_iommu_isolate
=
0
;
amd_iommu_isolate
=
false
;
if
(
strncmp
(
str
,
"fullflush"
,
9
)
==
0
)
amd_iommu_unmap_flush
=
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录