Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
4c74eb7f
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4c74eb7f
编写于
11月 10, 2010
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nvc0: import initial vm backend
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
3ee01281
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
169 addition
and
7 deletion
+169
-7
drivers/gpu/drm/nouveau/Makefile
drivers/gpu/drm/nouveau/Makefile
+1
-1
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/nouveau/nouveau_bo.c
+3
-2
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_drv.h
+1
-0
drivers/gpu/drm/nouveau/nouveau_mem.c
drivers/gpu/drm/nouveau/nouveau_mem.c
+4
-0
drivers/gpu/drm/nouveau/nouveau_vm.c
drivers/gpu/drm/nouveau/nouveau_vm.c
+27
-4
drivers/gpu/drm/nouveau/nouveau_vm.h
drivers/gpu/drm/nouveau/nouveau_vm.h
+10
-0
drivers/gpu/drm/nouveau/nvc0_vm.c
drivers/gpu/drm/nouveau/nvc0_vm.c
+123
-0
未找到文件。
drivers/gpu/drm/nouveau/Makefile
浏览文件 @
4c74eb7f
...
...
@@ -28,7 +28,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
nv10_gpio.o nv50_gpio.o
\
nv50_calc.o
\
nv04_pm.o nv50_pm.o nva3_pm.o
\
nv50_vram.o nv50_vm.o
nv50_vram.o nv50_vm.o
nvc0_vm.o
nouveau-$(CONFIG_DRM_NOUVEAU_DEBUG)
+=
nouveau_debugfs.o
nouveau-$(CONFIG_COMPAT)
+=
nouveau_ioc32.o
...
...
drivers/gpu/drm/nouveau/nouveau_bo.c
浏览文件 @
4c74eb7f
...
...
@@ -909,8 +909,9 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
break
;
}
ret
=
nouveau_vm_get
(
dev_priv
->
bar1_vm
,
mem
->
bus
.
size
,
12
,
NV_MEM_ACCESS_RW
,
&
vram
->
bar_vma
);
ret
=
nouveau_vm_get
(
dev_priv
->
bar1_vm
,
mem
->
bus
.
size
,
vram
->
page_shift
,
NV_MEM_ACCESS_RW
,
&
vram
->
bar_vma
);
if
(
ret
)
return
ret
;
...
...
drivers/gpu/drm/nouveau/nouveau_drv.h
浏览文件 @
4c74eb7f
...
...
@@ -69,6 +69,7 @@ struct nouveau_vram {
struct
drm_device
*
dev
;
struct
nouveau_vma
bar_vma
;
u8
page_shift
;
struct
list_head
regions
;
u32
memtype
;
...
...
drivers/gpu/drm/nouveau/nouveau_mem.c
浏览文件 @
4c74eb7f
...
...
@@ -731,6 +731,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
if
(
ret
)
return
ret
;
node
->
page_shift
=
12
;
if
(
nvbo
->
vma
.
node
)
node
->
page_shift
=
nvbo
->
vma
.
node
->
type
;
mem
->
mm_node
=
node
;
mem
->
start
=
node
->
offset
>>
PAGE_SHIFT
;
return
0
;
...
...
drivers/gpu/drm/nouveau/nouveau_vm.c
浏览文件 @
4c74eb7f
...
...
@@ -295,7 +295,34 @@ nouveau_vm_new(struct drm_device *dev, u64 offset, u64 length, u64 mm_offset,
vm
->
flush
=
nv50_vm_flush
;
vm
->
spg_shift
=
12
;
vm
->
lpg_shift
=
16
;
pgt_bits
=
29
;
block
=
(
1
<<
pgt_bits
);
if
(
length
<
block
)
block
=
length
;
}
else
if
(
dev_priv
->
card_type
==
NV_C0
)
{
vm
->
map_pgt
=
nvc0_vm_map_pgt
;
vm
->
map
=
nvc0_vm_map
;
vm
->
map_sg
=
nvc0_vm_map_sg
;
vm
->
unmap
=
nvc0_vm_unmap
;
vm
->
flush
=
nvc0_vm_flush
;
vm
->
spg_shift
=
12
;
vm
->
lpg_shift
=
17
;
pgt_bits
=
27
;
/* Should be 4096 everywhere, this is a hack that's
* currently necessary to avoid an elusive bug that
* causes corruption when mixing small/large pages
*/
if
(
length
<
(
1ULL
<<
40
))
block
=
4096
;
else
{
block
=
(
1
<<
pgt_bits
);
if
(
length
<
block
)
block
=
length
;
}
}
else
{
kfree
(
vm
);
return
-
ENOSYS
;
...
...
@@ -314,10 +341,6 @@ nouveau_vm_new(struct drm_device *dev, u64 offset, u64 length, u64 mm_offset,
vm
->
refcount
=
1
;
vm
->
pgt_bits
=
pgt_bits
-
12
;
block
=
(
1
<<
pgt_bits
);
if
(
length
<
block
)
block
=
length
;
ret
=
nouveau_mm_init
(
&
vm
->
mm
,
mm_offset
>>
12
,
mm_length
>>
12
,
block
>>
12
);
if
(
ret
)
{
...
...
drivers/gpu/drm/nouveau/nouveau_vm.h
浏览文件 @
4c74eb7f
...
...
@@ -100,4 +100,14 @@ void nv50_vm_unmap(struct nouveau_gpuobj *, u32 pte, u32 cnt);
void
nv50_vm_flush
(
struct
nouveau_vm
*
);
void
nv50_vm_flush_engine
(
struct
drm_device
*
,
int
engine
);
/* nvc0_vm.c */
void
nvc0_vm_map_pgt
(
struct
nouveau_gpuobj
*
pgd
,
u32
pde
,
struct
nouveau_gpuobj
*
pgt
[
2
]);
void
nvc0_vm_map
(
struct
nouveau_vma
*
,
struct
nouveau_gpuobj
*
,
struct
nouveau_vram
*
,
u32
pte
,
u32
cnt
,
u64
phys
);
void
nvc0_vm_map_sg
(
struct
nouveau_vma
*
,
struct
nouveau_gpuobj
*
,
u32
pte
,
dma_addr_t
*
,
u32
cnt
);
void
nvc0_vm_unmap
(
struct
nouveau_gpuobj
*
,
u32
pte
,
u32
cnt
);
void
nvc0_vm_flush
(
struct
nouveau_vm
*
);
#endif
drivers/gpu/drm/nouveau/nvc0_vm.c
0 → 100644
浏览文件 @
4c74eb7f
/*
* Copyright 2010 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "drmP.h"
#include "nouveau_drv.h"
#include "nouveau_vm.h"
void
nvc0_vm_map_pgt
(
struct
nouveau_gpuobj
*
pgd
,
u32
index
,
struct
nouveau_gpuobj
*
pgt
[
2
])
{
u32
pde
[
2
]
=
{
0
,
0
};
if
(
pgt
[
0
])
pde
[
1
]
=
0x00000001
|
(
pgt
[
0
]
->
vinst
>>
8
);
if
(
pgt
[
1
])
pde
[
0
]
=
0x00000001
|
(
pgt
[
1
]
->
vinst
>>
8
);
nv_wo32
(
pgd
,
(
index
*
8
)
+
0
,
pde
[
0
]);
nv_wo32
(
pgd
,
(
index
*
8
)
+
4
,
pde
[
1
]);
}
static
inline
u64
nvc0_vm_addr
(
struct
nouveau_vma
*
vma
,
u64
phys
,
u32
memtype
,
u32
target
)
{
phys
>>=
8
;
phys
|=
0x00000001
;
/* present */
// if (vma->access & NV_MEM_ACCESS_SYS)
// phys |= 0x00000002;
phys
|=
((
u64
)
target
<<
32
);
phys
|=
((
u64
)
memtype
<<
36
);
return
phys
;
}
void
nvc0_vm_map
(
struct
nouveau_vma
*
vma
,
struct
nouveau_gpuobj
*
pgt
,
struct
nouveau_vram
*
mem
,
u32
pte
,
u32
cnt
,
u64
phys
)
{
u32
next
=
1
<<
(
vma
->
node
->
type
-
8
);
phys
=
nvc0_vm_addr
(
vma
,
phys
,
mem
->
memtype
,
0
);
pte
<<=
3
;
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
phys
+=
next
;
pte
+=
8
;
}
}
void
nvc0_vm_map_sg
(
struct
nouveau_vma
*
vma
,
struct
nouveau_gpuobj
*
pgt
,
u32
pte
,
dma_addr_t
*
list
,
u32
cnt
)
{
pte
<<=
3
;
while
(
cnt
--
)
{
u64
phys
=
nvc0_vm_addr
(
vma
,
*
list
++
,
0
,
5
);
nv_wo32
(
pgt
,
pte
+
0
,
lower_32_bits
(
phys
));
nv_wo32
(
pgt
,
pte
+
4
,
upper_32_bits
(
phys
));
pte
+=
8
;
}
}
void
nvc0_vm_unmap
(
struct
nouveau_gpuobj
*
pgt
,
u32
pte
,
u32
cnt
)
{
pte
<<=
3
;
while
(
cnt
--
)
{
nv_wo32
(
pgt
,
pte
+
0
,
0x00000000
);
nv_wo32
(
pgt
,
pte
+
4
,
0x00000000
);
pte
+=
8
;
}
}
void
nvc0_vm_flush
(
struct
nouveau_vm
*
vm
)
{
struct
drm_nouveau_private
*
dev_priv
=
vm
->
dev
->
dev_private
;
struct
nouveau_instmem_engine
*
pinstmem
=
&
dev_priv
->
engine
.
instmem
;
struct
drm_device
*
dev
=
vm
->
dev
;
struct
nouveau_vm_pgd
*
vpgd
;
u32
r100c80
,
engine
;
pinstmem
->
flush
(
vm
->
dev
);
if
(
vm
==
dev_priv
->
chan_vm
)
engine
=
1
;
else
engine
=
5
;
list_for_each_entry
(
vpgd
,
&
vm
->
pgd_list
,
head
)
{
r100c80
=
nv_rd32
(
dev
,
0x100c80
);
nv_wr32
(
dev
,
0x100cb8
,
vpgd
->
obj
->
vinst
>>
8
);
nv_wr32
(
dev
,
0x100cbc
,
0x80000000
|
engine
);
if
(
!
nv_wait
(
dev
,
0x100c80
,
0xffffffff
,
r100c80
))
NV_ERROR
(
dev
,
"vm flush timeout eng %d
\n
"
,
engine
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录