Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
dd12d158
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dd12d158
编写于
11月 01, 2017
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/mmu/nv04: implement new vmm backend
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
eb813999
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
62 addition
and
58 deletion
+62
-58
drivers/gpu/drm/nouveau/include/nvif/if000d.h
drivers/gpu/drm/nouveau/include/nvif/if000d.h
+4
-0
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
+0
-57
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
+1
-0
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv04.c
+57
-1
未找到文件。
drivers/gpu/drm/nouveau/include/nvif/if000d.h
浏览文件 @
dd12d158
...
...
@@ -5,4 +5,8 @@
struct
nv04_vmm_vn
{
/* nvif_vmm_vX ... */
};
struct
nv04_vmm_map_vn
{
/* nvif_vmm_map_vX ... */
};
#endif
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/nv04.c
浏览文件 @
dd12d158
...
...
@@ -26,71 +26,14 @@
#include <nvif/class.h>
#define NV04_PDMA_SIZE (128 * 1024 * 1024)
#define NV04_PDMA_PAGE ( 4 * 1024)
/*******************************************************************************
* VM map/unmap callbacks
******************************************************************************/
static
void
nv04_vm_map_sg
(
struct
nvkm_vma
*
vma
,
struct
nvkm_memory
*
pgt
,
struct
nvkm_mem
*
mem
,
u32
pte
,
u32
cnt
,
dma_addr_t
*
list
)
{
pte
=
0x00008
+
(
pte
*
4
);
nvkm_kmap
(
pgt
);
while
(
cnt
)
{
u32
page
=
PAGE_SIZE
/
NV04_PDMA_PAGE
;
u32
phys
=
(
u32
)
*
list
++
;
while
(
cnt
&&
page
--
)
{
nvkm_wo32
(
pgt
,
pte
,
phys
|
3
);
phys
+=
NV04_PDMA_PAGE
;
pte
+=
4
;
cnt
-=
1
;
}
}
nvkm_done
(
pgt
);
}
static
void
nv04_vm_unmap
(
struct
nvkm_vma
*
vma
,
struct
nvkm_memory
*
pgt
,
u32
pte
,
u32
cnt
)
{
pte
=
0x00008
+
(
pte
*
4
);
nvkm_kmap
(
pgt
);
while
(
cnt
--
)
{
nvkm_wo32
(
pgt
,
pte
,
0x00000000
);
pte
+=
4
;
}
nvkm_done
(
pgt
);
}
static
void
nv04_vm_flush
(
struct
nvkm_vm
*
vm
)
{
}
/*******************************************************************************
* MMU subdev
******************************************************************************/
static
int
nv04_mmu_oneinit
(
struct
nvkm_mmu
*
mmu
)
{
mmu
->
vmm
->
pgt
[
0
].
mem
[
0
]
=
mmu
->
vmm
->
pd
->
pt
[
0
]
->
memory
;
mmu
->
vmm
->
pgt
[
0
].
refcount
[
0
]
=
1
;
return
0
;
}
const
struct
nvkm_mmu_func
nv04_mmu
=
{
.
oneinit
=
nv04_mmu_oneinit
,
.
limit
=
NV04_PDMA_SIZE
,
.
dma_bits
=
32
,
.
pgt_bits
=
32
-
12
,
.
spg_shift
=
12
,
.
lpg_shift
=
12
,
.
map_sg
=
nv04_vm_map_sg
,
.
unmap
=
nv04_vm_unmap
,
.
flush
=
nv04_vm_flush
,
.
vmm
=
{{
-
1
,
-
1
,
NVIF_CLASS_VMM_NV04
},
nv04_vmm_new
,
true
},
};
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
浏览文件 @
dd12d158
...
...
@@ -157,6 +157,7 @@ void nvkm_vmm_ptes_unmap(struct nvkm_vmm *, const struct nvkm_vmm_page *,
int
nv04_vmm_new_
(
const
struct
nvkm_vmm_func
*
,
struct
nvkm_mmu
*
,
u32
,
u64
,
u64
,
void
*
,
u32
,
struct
lock_class_key
*
,
const
char
*
,
struct
nvkm_vmm
**
);
int
nv04_vmm_valid
(
struct
nvkm_vmm
*
,
void
*
,
u32
,
struct
nvkm_vmm_map
*
);
int
gf100_vmm_new_
(
const
struct
nvkm_vmm_func
*
,
const
struct
nvkm_vmm_func
*
,
struct
nvkm_mmu
*
,
u64
,
u64
,
void
*
,
u32
,
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv04.c
浏览文件 @
dd12d158
...
...
@@ -24,8 +24,50 @@
#include <nvif/if000d.h>
#include <nvif/unpack.h>
static
inline
void
nv04_vmm_pgt_pte
(
struct
nvkm_vmm
*
vmm
,
struct
nvkm_mmu_pt
*
pt
,
u32
ptei
,
u32
ptes
,
struct
nvkm_vmm_map
*
map
,
u64
addr
)
{
u32
data
=
addr
|
0x00000003
;
/* PRESENT, RW. */
while
(
ptes
--
)
{
VMM_WO032
(
pt
,
vmm
,
8
+
ptei
++
*
4
,
data
);
data
+=
0x00001000
;
}
}
static
void
nv04_vmm_pgt_sgl
(
struct
nvkm_vmm
*
vmm
,
struct
nvkm_mmu_pt
*
pt
,
u32
ptei
,
u32
ptes
,
struct
nvkm_vmm_map
*
map
)
{
VMM_MAP_ITER_SGL
(
vmm
,
pt
,
ptei
,
ptes
,
map
,
nv04_vmm_pgt_pte
);
}
static
void
nv04_vmm_pgt_dma
(
struct
nvkm_vmm
*
vmm
,
struct
nvkm_mmu_pt
*
pt
,
u32
ptei
,
u32
ptes
,
struct
nvkm_vmm_map
*
map
)
{
#if PAGE_SHIFT == 12
nvkm_kmap
(
pt
->
memory
);
while
(
ptes
--
)
VMM_WO032
(
pt
,
vmm
,
8
+
(
ptei
++
*
4
),
*
map
->
dma
++
|
0x00000003
);
nvkm_done
(
pt
->
memory
);
#else
VMM_MAP_ITER_DMA
(
vmm
,
pt
,
ptei
,
ptes
,
map
,
nv04_vmm_pgt_pte
);
#endif
}
static
void
nv04_vmm_pgt_unmap
(
struct
nvkm_vmm
*
vmm
,
struct
nvkm_mmu_pt
*
pt
,
u32
ptei
,
u32
ptes
)
{
VMM_FO032
(
pt
,
vmm
,
8
+
(
ptei
*
4
),
0
,
ptes
);
}
static
const
struct
nvkm_vmm_desc_func
nv04_vmm_desc_pgt
=
{
.
unmap
=
nv04_vmm_pgt_unmap
,
.
dma
=
nv04_vmm_pgt_dma
,
.
sgl
=
nv04_vmm_pgt_sgl
,
};
static
const
struct
nvkm_vmm_desc
...
...
@@ -34,8 +76,22 @@ nv04_vmm_desc_12[] = {
{}
};
int
nv04_vmm_valid
(
struct
nvkm_vmm
*
vmm
,
void
*
argv
,
u32
argc
,
struct
nvkm_vmm_map
*
map
)
{
union
{
struct
nv04_vmm_map_vn
vn
;
}
*
args
=
argv
;
int
ret
=
-
ENOSYS
;
if
((
ret
=
nvif_unvers
(
ret
,
&
argv
,
&
argc
,
args
->
vn
)))
VMM_DEBUG
(
vmm
,
"args"
);
return
ret
;
}
static
const
struct
nvkm_vmm_func
nv04_vmm
=
{
.
valid
=
nv04_vmm_valid
,
.
page
=
{
{
12
,
&
nv04_vmm_desc_12
[
0
],
NVKM_VMM_PAGE_HOST
},
{}
...
...
@@ -65,8 +121,8 @@ nv04_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc,
struct
lock_class_key
*
key
,
const
char
*
name
,
struct
nvkm_vmm
**
pvmm
)
{
struct
nvkm_vmm
*
vmm
;
struct
nvkm_memory
*
mem
;
struct
nvkm_vmm
*
vmm
;
int
ret
;
ret
=
nv04_vmm_new_
(
&
nv04_vmm
,
mmu
,
8
,
addr
,
size
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录