Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
f0290215
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f0290215
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/subdev: implement support for new-style nvkm_subdev
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
cbea21e2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
217 addition
and
17 deletion
+217
-17
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
+0
-3
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
+26
-4
drivers/gpu/drm/nouveau/nvkm/core/engctx.c
drivers/gpu/drm/nouveau/nvkm/core/engctx.c
+4
-4
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
+185
-4
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
+1
-1
未找到文件。
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
浏览文件 @
f0290215
...
...
@@ -106,13 +106,10 @@ struct nvkm_sclass {
struct
nvkm_object
**
);
};
/* Don't allocate dynamically, because lockdep needs lock_class_keys to be in
* ".data". */
struct
nvkm_oclass
{
s32
handle
;
struct
nvkm_ofuncs
*
const
ofuncs
;
struct
nvkm_omthds
*
const
omthds
;
struct
lock_class_key
lock_class_key
;
int
(
*
ctor
)(
const
struct
nvkm_oclass
*
,
void
*
data
,
u32
size
,
struct
nvkm_object
**
);
...
...
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
浏览文件 @
f0290215
...
...
@@ -7,17 +7,37 @@
struct
nvkm_subdev
{
struct
nvkm_object
object
;
const
struct
nvkm_subdev_func
*
func
;
struct
nvkm_device
*
device
;
int
index
;
u32
pmc_enable
;
struct
mutex
mutex
;
const
char
*
name
,
*
sname
;
u32
debug
;
bool
oneinit
;
void
(
*
intr
)(
struct
nvkm_subdev
*
);
u32
unit
;
};
struct
nvkm_subdev_func
{
void
*
(
*
dtor
)(
struct
nvkm_subdev
*
);
int
(
*
preinit
)(
struct
nvkm_subdev
*
);
int
(
*
oneinit
)(
struct
nvkm_subdev
*
);
int
(
*
init
)(
struct
nvkm_subdev
*
);
int
(
*
fini
)(
struct
nvkm_subdev
*
,
bool
suspend
);
void
(
*
intr
)(
struct
nvkm_subdev
*
);
};
extern
const
char
*
nvkm_subdev_name
[
64
];
void
nvkm_subdev_ctor
(
const
struct
nvkm_subdev_func
*
,
struct
nvkm_device
*
,
int
index
,
u32
pmc_enable
,
struct
nvkm_subdev
*
);
void
nvkm_subdev_del
(
struct
nvkm_subdev
**
);
int
nvkm_subdev_preinit
(
struct
nvkm_subdev
*
);
int
nvkm_subdev_init
(
struct
nvkm_subdev
*
);
int
nvkm_subdev_fini
(
struct
nvkm_subdev
*
,
bool
suspend
);
void
nvkm_subdev_intr
(
struct
nvkm_subdev
*
);
static
inline
struct
nvkm_subdev
*
nv_subdev
(
void
*
obj
)
{
...
...
@@ -55,8 +75,10 @@ int _nvkm_subdev_fini(struct nvkm_object *, bool suspend);
/* subdev logging */
#define nvkm_printk_(s,l,p,f,a...) do { \
struct nvkm_subdev *_subdev = (s); \
if (_subdev->debug >= (l)) \
dev_##p(_subdev->device->dev, "%s: "f, _subdev->sname, ##a); \
if (_subdev->debug >= (l)) { \
dev_##p(_subdev->device->dev, "%s: "f, \
nvkm_subdev_name[_subdev->index], ##a); \
} \
} while(0)
#define nvkm_printk(s,l,p,f,a...) nvkm_printk_((s), NV_DBG_##l, p, f, ##a)
#define nvkm_fatal(s,f,a...) nvkm_printk((s), FATAL, crit, f, ##a)
...
...
drivers/gpu/drm/nouveau/nvkm/core/engctx.c
浏览文件 @
f0290215
...
...
@@ -144,11 +144,11 @@ nvkm_engctx_init(struct nvkm_engctx *engctx)
if
(
ret
)
{
nvkm_error
(
pardev
,
"failed to attach %s context, %d
\n
"
,
subdev
->
name
,
ret
);
nvkm_subdev_name
[
subdev
->
index
]
,
ret
);
return
ret
;
}
nvkm_trace
(
pardev
,
"attached %s context
\n
"
,
subdev
->
name
);
nvkm_trace
(
pardev
,
"attached %s context
\n
"
,
nvkm_subdev_name
[
subdev
->
index
]
);
return
0
;
}
...
...
@@ -171,11 +171,11 @@ nvkm_engctx_fini(struct nvkm_engctx *engctx, bool suspend)
if
(
ret
)
{
nvkm_error
(
pardev
,
"failed to detach %s context, %d
\n
"
,
subdev
->
name
,
ret
);
nvkm_subdev_name
[
subdev
->
index
]
,
ret
);
return
ret
;
}
nvkm_trace
(
pardev
,
"detached %s context
\n
"
,
subdev
->
name
);
nvkm_trace
(
pardev
,
"detached %s context
\n
"
,
nvkm_subdev_name
[
subdev
->
index
]
);
return
nvkm_gpuobj_fini
(
&
engctx
->
gpuobj
,
suspend
);
}
...
...
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
浏览文件 @
f0290215
...
...
@@ -25,6 +25,186 @@
#include <core/device.h>
#include <core/option.h>
static
struct
lock_class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ENGINE_MSENC
]
=
"msenc"
,
[
NVDEV_ENGINE_MSPDEC
]
=
"mspdec"
,
[
NVDEV_ENGINE_MSPPP
]
=
"msppp"
,
[
NVDEV_ENGINE_MSVLD
]
=
"msvld"
,
[
NVDEV_ENGINE_PM
]
=
"pm"
,
[
NVDEV_ENGINE_SEC
]
=
"sec"
,
[
NVDEV_ENGINE_SW
]
=
"sw"
,
[
NVDEV_ENGINE_VIC
]
=
"vic"
,
[
NVDEV_ENGINE_VP
]
=
"vp"
,
};
void
nvkm_subdev_intr
(
struct
nvkm_subdev
*
subdev
)
{
if
(
subdev
->
func
->
intr
)
subdev
->
func
->
intr
(
subdev
);
}
int
nvkm_subdev_fini
(
struct
nvkm_subdev
*
subdev
,
bool
suspend
)
{
struct
nvkm_device
*
device
=
subdev
->
device
;
const
char
*
action
=
suspend
?
"suspend"
:
"fini"
;
u32
pmc_enable
=
subdev
->
pmc_enable
;
s64
time
;
nvkm_trace
(
subdev
,
"%s running...
\n
"
,
action
);
time
=
ktime_to_us
(
ktime_get
());
if
(
subdev
->
func
->
fini
)
{
int
ret
=
subdev
->
func
->
fini
(
subdev
,
suspend
);
if
(
ret
)
{
nvkm_error
(
subdev
,
"%s failed, %d
\n
"
,
action
,
ret
);
if
(
suspend
)
return
ret
;
}
}
if
(
pmc_enable
)
{
nvkm_mask
(
device
,
0x000200
,
pmc_enable
,
0x00000000
);
nvkm_mask
(
device
,
0x000200
,
pmc_enable
,
pmc_enable
);
nvkm_rd32
(
device
,
0x000200
);
}
time
=
ktime_to_us
(
ktime_get
())
-
time
;
nvkm_trace
(
subdev
,
"%s completed in %lldus
\n
"
,
action
,
time
);
return
0
;
}
int
nvkm_subdev_preinit
(
struct
nvkm_subdev
*
subdev
)
{
s64
time
;
nvkm_trace
(
subdev
,
"preinit running...
\n
"
);
time
=
ktime_to_us
(
ktime_get
());
if
(
subdev
->
func
->
preinit
)
{
int
ret
=
subdev
->
func
->
preinit
(
subdev
);
if
(
ret
)
{
nvkm_error
(
subdev
,
"preinit failed, %d
\n
"
,
ret
);
return
ret
;
}
}
time
=
ktime_to_us
(
ktime_get
())
-
time
;
nvkm_trace
(
subdev
,
"preinit completed in %lldus
\n
"
,
time
);
return
0
;
}
int
nvkm_subdev_init
(
struct
nvkm_subdev
*
subdev
)
{
s64
time
;
int
ret
;
nvkm_trace
(
subdev
,
"init running...
\n
"
);
time
=
ktime_to_us
(
ktime_get
());
if
(
subdev
->
func
->
oneinit
&&
!
subdev
->
oneinit
)
{
s64
time
;
nvkm_trace
(
subdev
,
"one-time init running...
\n
"
);
time
=
ktime_to_us
(
ktime_get
());
ret
=
subdev
->
func
->
oneinit
(
subdev
);
if
(
ret
)
{
nvkm_error
(
subdev
,
"one-time init failed, %d
\n
"
,
ret
);
return
ret
;
}
subdev
->
oneinit
=
true
;
time
=
ktime_to_us
(
ktime_get
())
-
time
;
nvkm_trace
(
subdev
,
"one-time init completed in %lldus
\n
"
,
time
);
}
if
(
subdev
->
func
->
init
)
{
ret
=
subdev
->
func
->
init
(
subdev
);
if
(
ret
)
{
nvkm_error
(
subdev
,
"init failed, %d
\n
"
,
ret
);
return
ret
;
}
}
time
=
ktime_to_us
(
ktime_get
())
-
time
;
nvkm_trace
(
subdev
,
"init completed in %lldus
\n
"
,
time
);
return
0
;
}
void
nvkm_subdev_del
(
struct
nvkm_subdev
**
psubdev
)
{
struct
nvkm_subdev
*
subdev
=
*
psubdev
;
s64
time
;
if
(
subdev
&&
!
WARN_ON
(
!
subdev
->
func
))
{
nvkm_trace
(
subdev
,
"destroy running...
\n
"
);
time
=
ktime_to_us
(
ktime_get
());
if
(
subdev
->
func
->
dtor
)
*
psubdev
=
subdev
->
func
->
dtor
(
subdev
);
time
=
ktime_to_us
(
ktime_get
())
-
time
;
nvkm_trace
(
subdev
,
"destroy completed in %lldus
\n
"
,
time
);
kfree
(
*
psubdev
);
*
psubdev
=
NULL
;
}
}
static
const
struct
nvkm_object_func
nvkm_subdev_func
=
{
};
void
nvkm_subdev_ctor
(
const
struct
nvkm_subdev_func
*
func
,
struct
nvkm_device
*
device
,
int
index
,
u32
pmc_enable
,
struct
nvkm_subdev
*
subdev
)
{
const
char
*
name
=
nvkm_subdev_name
[
index
];
struct
nvkm_oclass
hack
=
{};
nvkm_object_ctor
(
&
nvkm_subdev_func
,
&
hack
,
&
subdev
->
object
);
subdev
->
func
=
func
;
subdev
->
device
=
device
;
subdev
->
index
=
index
;
subdev
->
pmc_enable
=
pmc_enable
;
__mutex_init
(
&
subdev
->
mutex
,
name
,
&
nvkm_subdev_lock_class
[
index
]);
subdev
->
debug
=
nvkm_dbgopt
(
device
->
dbgopt
,
name
);
}
struct
nvkm_subdev
*
nvkm_subdev
(
void
*
obj
,
int
idx
)
{
...
...
@@ -103,6 +283,8 @@ nvkm_subdev_create_(struct nvkm_object *parent, struct nvkm_object *engine,
const
char
*
subname
,
const
char
*
sysname
,
int
size
,
void
**
pobject
)
{
const
int
subidx
=
oclass
->
handle
&
0xff
;
const
char
*
name
=
nvkm_subdev_name
[
subidx
];
struct
nvkm_subdev
*
subdev
;
int
ret
;
...
...
@@ -112,13 +294,12 @@ nvkm_subdev_create_(struct nvkm_object *parent, struct nvkm_object *engine,
if
(
ret
)
return
ret
;
__mutex_init
(
&
subdev
->
mutex
,
subname
,
&
oclass
->
lock_class_key
);
subdev
->
name
=
subname
;
subdev
->
sname
=
sysname
;
__mutex_init
(
&
subdev
->
mutex
,
name
,
&
nvkm_subdev_lock_class
[
subidx
]);
subdev
->
index
=
subidx
;
if
(
parent
)
{
struct
nvkm_device
*
device
=
nv_device
(
parent
);
subdev
->
debug
=
nvkm_dbgopt
(
device
->
dbgopt
,
sub
name
);
subdev
->
debug
=
nvkm_dbgopt
(
device
->
dbgopt
,
name
);
subdev
->
device
=
device
;
}
else
{
subdev
->
device
=
nv_device
(
subdev
);
...
...
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
浏览文件 @
f0290215
...
...
@@ -471,7 +471,7 @@ gf100_fifo_recover(struct gf100_fifo *fifo, struct nvkm_engine *engine,
unsigned
long
flags
;
nvkm_error
(
subdev
,
"%s engine fault on channel %d, recovering...
\n
"
,
engine
->
subdev
.
name
,
chid
);
nvkm_subdev_name
[
engine
->
subdev
.
index
]
,
chid
);
nvkm_mask
(
device
,
0x003004
+
(
chid
*
0x08
),
0x00000001
,
0x00000000
);
chan
->
state
=
KILLED
;
...
...
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
浏览文件 @
f0290215
...
...
@@ -517,7 +517,7 @@ gk104_fifo_recover(struct gk104_fifo *fifo, struct nvkm_engine *engine,
unsigned
long
flags
;
nvkm_error
(
subdev
,
"%s engine fault on channel %d, recovering...
\n
"
,
nv
_subdev
(
engine
)
->
name
,
chid
);
nv
km_subdev_name
[
nv_subdev
(
engine
)
->
index
]
,
chid
);
nvkm_mask
(
device
,
0x800004
+
(
chid
*
0x08
),
0x00000800
,
0x00000800
);
chan
->
state
=
KILLED
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录