Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
9202d732
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
9202d732
编写于
11月 01, 2017
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/imem/nv50-: use new interfaces for vmm operations
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
6f4dc18c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
32 deletion
+41
-32
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+26
-19
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
+15
-13
未找到文件。
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
浏览文件 @
9202d732
...
...
@@ -52,7 +52,7 @@
struct
gk20a_instobj
{
struct
nvkm_memory
memory
;
struct
nvkm_m
em
mem
;
struct
nvkm_m
m_node
*
mn
;
struct
gk20a_instmem
*
imem
;
/* CPU mapping */
...
...
@@ -129,13 +129,13 @@ gk20a_instobj_page(struct nvkm_memory *memory)
static
u64
gk20a_instobj_addr
(
struct
nvkm_memory
*
memory
)
{
return
gk20a_instobj
(
memory
)
->
mem
.
offset
;
return
(
u64
)
gk20a_instobj
(
memory
)
->
mn
->
offset
<<
12
;
}
static
u64
gk20a_instobj_size
(
struct
nvkm_memory
*
memory
)
{
return
(
u64
)
gk20a_instobj
(
memory
)
->
m
em
.
size
<<
12
;
return
(
u64
)
gk20a_instobj
(
memory
)
->
m
n
->
length
<<
12
;
}
/*
...
...
@@ -284,8 +284,22 @@ gk20a_instobj_map(struct nvkm_memory *memory, u64 offset, struct nvkm_vmm *vmm,
struct
nvkm_vma
*
vma
,
void
*
argv
,
u32
argc
)
{
struct
gk20a_instobj
*
node
=
gk20a_instobj
(
memory
);
nvkm_vm_map_at
(
vma
,
0
,
&
node
->
mem
);
return
0
;
struct
nvkm_vmm_map
map
=
{
.
memory
=
&
node
->
memory
,
.
offset
=
offset
,
.
mem
=
node
->
mn
,
};
if
(
vma
->
vm
)
{
struct
nvkm_mem
mem
=
{
.
mem
=
node
->
mn
,
.
memory
=
&
node
->
memory
,
};
nvkm_vm_map_at
(
vma
,
0
,
&
mem
);
return
0
;
}
return
nvkm_vmm_map
(
vmm
,
vma
,
argv
,
argc
,
&
map
);
}
static
void
*
...
...
@@ -298,8 +312,8 @@ gk20a_instobj_dtor_dma(struct nvkm_memory *memory)
if
(
unlikely
(
!
node
->
base
.
vaddr
))
goto
out
;
dma_free_attrs
(
dev
,
node
->
base
.
mem
.
size
<<
PAGE_SHIFT
,
node
->
base
.
vaddr
,
node
->
handle
,
imem
->
attrs
);
dma_free_attrs
(
dev
,
(
u64
)
node
->
base
.
mn
->
length
<<
PAGE_SHIFT
,
node
->
base
.
vaddr
,
node
->
handle
,
imem
->
attrs
);
out:
return
node
;
...
...
@@ -311,7 +325,7 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
struct
gk20a_instobj_iommu
*
node
=
gk20a_instobj_iommu
(
memory
);
struct
gk20a_instmem
*
imem
=
node
->
base
.
imem
;
struct
device
*
dev
=
imem
->
base
.
subdev
.
device
->
dev
;
struct
nvkm_mm_node
*
r
=
node
->
base
.
m
em
.
mem
;
struct
nvkm_mm_node
*
r
=
node
->
base
.
m
n
;
int
i
;
if
(
unlikely
(
!
r
))
...
...
@@ -329,7 +343,7 @@ gk20a_instobj_dtor_iommu(struct nvkm_memory *memory)
r
->
offset
&=
~
BIT
(
imem
->
iommu_bit
-
imem
->
iommu_pgshift
);
/* Unmap pages from GPU address space and free them */
for
(
i
=
0
;
i
<
node
->
base
.
m
em
.
size
;
i
++
)
{
for
(
i
=
0
;
i
<
node
->
base
.
m
n
->
length
;
i
++
)
{
iommu_unmap
(
imem
->
domain
,
(
r
->
offset
+
i
)
<<
imem
->
iommu_pgshift
,
PAGE_SIZE
);
dma_unmap_page
(
dev
,
node
->
dma_addrs
[
i
],
PAGE_SIZE
,
...
...
@@ -410,8 +424,7 @@ gk20a_instobj_ctor_dma(struct gk20a_instmem *imem, u32 npages, u32 align,
node
->
r
.
offset
=
node
->
handle
>>
12
;
node
->
r
.
length
=
(
npages
<<
PAGE_SHIFT
)
>>
12
;
node
->
base
.
mem
.
offset
=
node
->
handle
;
node
->
base
.
mem
.
mem
=
&
node
->
r
;
node
->
base
.
mn
=
&
node
->
r
;
return
0
;
}
...
...
@@ -488,8 +501,7 @@ gk20a_instobj_ctor_iommu(struct gk20a_instmem *imem, u32 npages, u32 align,
/* IOMMU bit tells that an address is to be resolved through the IOMMU */
r
->
offset
|=
BIT
(
imem
->
iommu_bit
-
imem
->
iommu_pgshift
);
node
->
base
.
mem
.
offset
=
((
u64
)
r
->
offset
)
<<
imem
->
iommu_pgshift
;
node
->
base
.
mem
.
mem
=
r
;
node
->
base
.
mn
=
r
;
return
0
;
release_area:
...
...
@@ -537,13 +549,8 @@ gk20a_instobj_new(struct nvkm_instmem *base, u32 size, u32 align, bool zero,
node
->
imem
=
imem
;
/* present memory for being mapped using small pages */
node
->
mem
.
size
=
size
>>
12
;
node
->
mem
.
memtype
=
0
;
node
->
mem
.
memory
=
&
node
->
memory
;
nvkm_debug
(
subdev
,
"alloc size: 0x%x, align: 0x%x, gaddr: 0x%llx
\n
"
,
size
,
align
,
node
->
mem
.
offset
);
size
,
align
,
(
u64
)
node
->
mn
->
offset
<<
12
);
return
0
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
浏览文件 @
9202d732
...
...
@@ -46,7 +46,7 @@ struct nv50_instobj {
struct
nvkm_instobj
base
;
struct
nv50_instmem
*
imem
;
struct
nvkm_memory
*
ram
;
struct
nvkm_vma
bar
;
struct
nvkm_vma
*
bar
;
refcount_t
maps
;
void
*
map
;
struct
list_head
lru
;
...
...
@@ -124,7 +124,7 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)
struct
nvkm_memory
*
memory
=
&
iobj
->
base
.
memory
;
struct
nvkm_subdev
*
subdev
=
&
imem
->
base
.
subdev
;
struct
nvkm_device
*
device
=
subdev
->
device
;
struct
nvkm_vma
bar
=
{},
ebar
;
struct
nvkm_vma
*
bar
=
NULL
,
*
ebar
;
u64
size
=
nvkm_memory_size
(
memory
);
void
*
emap
;
int
ret
;
...
...
@@ -134,7 +134,7 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)
* to the possibility of recursion for page table allocation.
*/
mutex_unlock
(
&
subdev
->
mutex
);
while
((
ret
=
nvkm_vm
_get
(
vmm
,
size
,
12
,
NV_MEM_ACCESS_RW
,
&
bar
)))
{
while
((
ret
=
nvkm_vm
m_get
(
vmm
,
12
,
size
,
&
bar
)))
{
/* Evict unused mappings, and keep retrying until we either
* succeed,or there's no more objects left on the LRU.
*/
...
...
@@ -144,10 +144,10 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)
nvkm_debug
(
subdev
,
"evict %016llx %016llx @ %016llx
\n
"
,
nvkm_memory_addr
(
&
eobj
->
base
.
memory
),
nvkm_memory_size
(
&
eobj
->
base
.
memory
),
eobj
->
bar
.
offset
);
eobj
->
bar
->
addr
);
list_del_init
(
&
eobj
->
lru
);
ebar
=
eobj
->
bar
;
eobj
->
bar
.
node
=
NULL
;
eobj
->
bar
=
NULL
;
emap
=
eobj
->
map
;
eobj
->
map
=
NULL
;
}
...
...
@@ -155,16 +155,16 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)
if
(
!
eobj
)
break
;
iounmap
(
emap
);
nvkm_vm
_put
(
&
ebar
);
nvkm_vm
m_put
(
vmm
,
&
ebar
);
}
if
(
ret
==
0
)
ret
=
nvkm_memory_map
(
memory
,
0
,
vmm
,
&
bar
,
NULL
,
0
);
ret
=
nvkm_memory_map
(
memory
,
0
,
vmm
,
bar
,
NULL
,
0
);
mutex_lock
(
&
subdev
->
mutex
);
if
(
ret
||
iobj
->
bar
.
node
)
{
if
(
ret
||
iobj
->
bar
)
{
/* We either failed, or another thread beat us. */
mutex_unlock
(
&
subdev
->
mutex
);
nvkm_vm
_put
(
&
bar
);
nvkm_vm
m_put
(
vmm
,
&
bar
);
mutex_lock
(
&
subdev
->
mutex
);
return
;
}
...
...
@@ -172,10 +172,10 @@ nv50_instobj_kmap(struct nv50_instobj *iobj, struct nvkm_vmm *vmm)
/* Make the mapping visible to the host. */
iobj
->
bar
=
bar
;
iobj
->
map
=
ioremap_wc
(
device
->
func
->
resource_addr
(
device
,
3
)
+
(
u32
)
iobj
->
bar
.
offset
,
size
);
(
u32
)
iobj
->
bar
->
addr
,
size
);
if
(
!
iobj
->
map
)
{
nvkm_warn
(
subdev
,
"PRAMIN ioremap failed
\n
"
);
nvkm_vm
_put
(
&
iobj
->
bar
);
nvkm_vm
m_put
(
vmm
,
&
iobj
->
bar
);
}
}
...
...
@@ -299,7 +299,7 @@ nv50_instobj_dtor(struct nvkm_memory *memory)
{
struct
nv50_instobj
*
iobj
=
nv50_instobj
(
memory
);
struct
nvkm_instmem
*
imem
=
&
iobj
->
imem
->
base
;
struct
nvkm_vma
bar
;
struct
nvkm_vma
*
bar
;
void
*
map
=
map
;
mutex_lock
(
&
imem
->
subdev
.
mutex
);
...
...
@@ -310,8 +310,10 @@ nv50_instobj_dtor(struct nvkm_memory *memory)
mutex_unlock
(
&
imem
->
subdev
.
mutex
);
if
(
map
)
{
struct
nvkm_vmm
*
vmm
=
nvkm_bar_bar2_vmm
(
imem
->
subdev
.
device
);
iounmap
(
map
);
nvkm_vm_put
(
&
bar
);
if
(
likely
(
vmm
))
/* Can be NULL during BAR destructor. */
nvkm_vmm_put
(
vmm
,
&
bar
);
}
nvkm_memory_unref
(
&
iobj
->
ram
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录