Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
24bd0930
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看板
提交
24bd0930
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/client: convert to new-style nvkm_object
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
61570911
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
70 addition
and
52 deletion
+70
-52
drivers/gpu/drm/nouveau/include/nvif/client.h
drivers/gpu/drm/nouveau/include/nvif/client.h
+1
-1
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
+18
-18
drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h
drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h
+1
-0
drivers/gpu/drm/nouveau/nvkm/core/client.c
drivers/gpu/drm/nouveau/nvkm/core/client.c
+43
-29
drivers/gpu/drm/nouveau/nvkm/core/handle.c
drivers/gpu/drm/nouveau/nvkm/core/handle.c
+1
-0
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
+3
-3
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
+1
-0
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
+1
-0
未找到文件。
drivers/gpu/drm/nouveau/include/nvif/client.h
浏览文件 @
24bd0930
...
@@ -23,6 +23,6 @@ int nvif_client_resume(struct nvif_client *);
...
@@ -23,6 +23,6 @@ int nvif_client_resume(struct nvif_client *);
#include <core/client.h>
#include <core/client.h>
#define nvxx_client(a) ({ \
#define nvxx_client(a) ({ \
struct nvif_client *_client = (a); \
struct nvif_client *_client = (a); \
nvkm_client(_client->object.priv);
\
(struct nvkm_client *)_client->object.priv;
\
})
})
#endif
#endif
drivers/gpu/drm/nouveau/include/nvkm/core/client.h
浏览文件 @
24bd0930
#ifndef __NVKM_CLIENT_H__
#ifndef __NVKM_CLIENT_H__
#define __NVKM_CLIENT_H__
#define __NVKM_CLIENT_H__
#include <core/
namedb
.h>
#include <core/
object
.h>
struct
nvkm_client
{
struct
nvkm_client
{
struct
nvkm_namedb
namedb
;
struct
nvkm_object
object
;
struct
nvkm_handle
*
root
;
u64
device
;
char
name
[
32
];
char
name
[
32
];
u64
device
;
u32
debug
;
u32
debug
;
struct
nvkm_vm
*
vm
;
struct
nvkm_client_notify
*
notify
[
16
];
struct
rb_root
objroot
;
struct
nvkm_handle
*
root
;
bool
super
;
bool
super
;
void
*
data
;
void
*
data
;
int
(
*
ntfy
)(
const
void
*
,
u32
,
const
void
*
,
u32
);
int
(
*
ntfy
)(
const
void
*
,
u32
,
const
void
*
,
u32
);
struct
nvkm_client_notify
*
notify
[
16
];
struct
rb_root
objroot
;
struct
nvkm_vm
*
vm
;
};
};
bool
nvkm_client_insert
(
struct
nvkm_client
*
,
struct
nvkm_handle
*
);
bool
nvkm_client_insert
(
struct
nvkm_client
*
,
struct
nvkm_handle
*
);
void
nvkm_client_remove
(
struct
nvkm_client
*
,
struct
nvkm_handle
*
);
void
nvkm_client_remove
(
struct
nvkm_client
*
,
struct
nvkm_handle
*
);
struct
nvkm_handle
*
nvkm_client_search
(
struct
nvkm_client
*
,
u64
handle
);
struct
nvkm_handle
*
nvkm_client_search
(
struct
nvkm_client
*
,
u64
handle
);
static
inline
struct
nvkm_client
*
nvkm_client
(
struct
nvkm_object
*
object
)
{
while
(
object
&&
object
->
parent
)
object
=
object
->
parent
;
if
(
object
&&
nv_iclass
(
object
,
NV_CLIENT_CLASS
))
return
container_of
(
object
,
struct
nvkm_client
,
namedb
.
parent
.
object
);
return
NULL
;
}
int
nvkm_client_new
(
const
char
*
name
,
u64
device
,
const
char
*
cfg
,
int
nvkm_client_new
(
const
char
*
name
,
u64
device
,
const
char
*
cfg
,
const
char
*
dbg
,
struct
nvkm_client
**
);
const
char
*
dbg
,
struct
nvkm_client
**
);
void
nvkm_client_del
(
struct
nvkm_client
**
);
void
nvkm_client_del
(
struct
nvkm_client
**
);
...
@@ -39,6 +31,14 @@ int nvkm_client_init(struct nvkm_client *);
...
@@ -39,6 +31,14 @@ int nvkm_client_init(struct nvkm_client *);
int
nvkm_client_fini
(
struct
nvkm_client
*
,
bool
suspend
);
int
nvkm_client_fini
(
struct
nvkm_client
*
,
bool
suspend
);
const
char
*
nvkm_client_name
(
void
*
obj
);
const
char
*
nvkm_client_name
(
void
*
obj
);
static
inline
struct
nvkm_client
*
nvkm_client
(
struct
nvkm_object
*
object
)
{
while
(
object
&&
object
->
parent
)
object
=
object
->
parent
;
return
container_of
(
object
,
struct
nvkm_client
,
object
);
}
int
nvkm_client_notify_new
(
struct
nvkm_object
*
,
struct
nvkm_event
*
,
int
nvkm_client_notify_new
(
struct
nvkm_object
*
,
struct
nvkm_event
*
,
void
*
data
,
u32
size
);
void
*
data
,
u32
size
);
int
nvkm_client_notify_del
(
struct
nvkm_client
*
,
int
index
);
int
nvkm_client_notify_del
(
struct
nvkm_client
*
,
int
index
);
...
...
drivers/gpu/drm/nouveau/include/nvkm/core/engctx.h
浏览文件 @
24bd0930
#ifndef __NVKM_ENGCTX_H__
#ifndef __NVKM_ENGCTX_H__
#define __NVKM_ENGCTX_H__
#define __NVKM_ENGCTX_H__
#include <core/gpuobj.h>
#include <core/gpuobj.h>
#include <core/parent.h>
#include <subdev/mmu.h>
#include <subdev/mmu.h>
...
...
drivers/gpu/drm/nouveau/nvkm/core/client.c
浏览文件 @
24bd0930
...
@@ -176,11 +176,35 @@ nvkm_client_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
...
@@ -176,11 +176,35 @@ nvkm_client_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
static
struct
nvkm_oclass
static
int
nvkm_client_oclass
=
{
nvkm_client_child_new
(
const
struct
nvkm_oclass
*
oclass
,
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
void
*
data
,
u32
size
,
struct
nvkm_object
**
pobject
)
.
mthd
=
nvkm_client_mthd
,
{
},
static
struct
nvkm_oclass
devobj
=
{
.
handle
=
NV_DEVICE
,
.
ofuncs
=
&
nvkm_udevice_ofuncs
,
};
return
nvkm_object_old
(
oclass
->
parent
,
NULL
,
&
devobj
,
data
,
size
,
pobject
);
}
static
int
nvkm_client_child_get
(
struct
nvkm_object
*
object
,
int
index
,
struct
nvkm_oclass
*
oclass
)
{
if
(
index
==
0
)
{
oclass
->
base
.
oclass
=
NV_DEVICE
;
oclass
->
base
.
minver
=
0
;
oclass
->
base
.
maxver
=
0
;
oclass
->
ctor
=
nvkm_client_child_new
;
return
0
;
}
return
-
EINVAL
;
}
static
const
struct
nvkm_object_func
nvkm_client_object_func
=
{
.
mthd
=
nvkm_client_mthd
,
.
sclass
=
nvkm_client_child_get
,
};
};
void
void
...
@@ -235,7 +259,7 @@ nvkm_client_search(struct nvkm_client *client, u64 handle)
...
@@ -235,7 +259,7 @@ nvkm_client_search(struct nvkm_client *client, u64 handle)
int
int
nvkm_client_fini
(
struct
nvkm_client
*
client
,
bool
suspend
)
nvkm_client_fini
(
struct
nvkm_client
*
client
,
bool
suspend
)
{
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
struct
nvkm_object
*
object
=
&
client
->
object
;
const
char
*
name
[
2
]
=
{
"fini"
,
"suspend"
};
const
char
*
name
[
2
]
=
{
"fini"
,
"suspend"
};
int
ret
,
i
;
int
ret
,
i
;
nvif_trace
(
object
,
"%s running
\n
"
,
name
[
suspend
]);
nvif_trace
(
object
,
"%s running
\n
"
,
name
[
suspend
]);
...
@@ -251,7 +275,7 @@ nvkm_client_fini(struct nvkm_client *client, bool suspend)
...
@@ -251,7 +275,7 @@ nvkm_client_fini(struct nvkm_client *client, bool suspend)
int
int
nvkm_client_init
(
struct
nvkm_client
*
client
)
nvkm_client_init
(
struct
nvkm_client
*
client
)
{
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
struct
nvkm_object
*
object
=
&
client
->
object
;
int
ret
;
int
ret
;
nvif_trace
(
object
,
"init running
\n
"
);
nvif_trace
(
object
,
"init running
\n
"
);
ret
=
nvkm_handle_init
(
client
->
root
);
ret
=
nvkm_handle_init
(
client
->
root
);
...
@@ -269,43 +293,33 @@ nvkm_client_del(struct nvkm_client **pclient)
...
@@ -269,43 +293,33 @@ nvkm_client_del(struct nvkm_client **pclient)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
client
->
notify
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
client
->
notify
);
i
++
)
nvkm_client_notify_del
(
client
,
i
);
nvkm_client_notify_del
(
client
,
i
);
nvkm_handle_destroy
(
client
->
root
);
nvkm_handle_destroy
(
client
->
root
);
nvkm_namedb_destroy
(
&
client
->
namedb
);
kfree
(
*
pclient
);
*
pclient
=
NULL
;
*
pclient
=
NULL
;
}
}
}
}
static
struct
nvkm_oclass
nvkm_client_sclass
[]
=
{
{
NV_DEVICE
,
&
nvkm_udevice_ofuncs
},
{}
};
int
int
nvkm_client_new
(
const
char
*
name
,
u64
device
,
const
char
*
cfg
,
nvkm_client_new
(
const
char
*
name
,
u64
device
,
const
char
*
cfg
,
const
char
*
dbg
,
struct
nvkm_client
**
pclient
)
const
char
*
dbg
,
struct
nvkm_client
**
pclient
)
{
{
struct
nvkm_oclass
oclass
=
{};
struct
nvkm_client
*
client
;
struct
nvkm_client
*
client
;
int
ret
;
int
ret
;
ret
=
nvkm_namedb_create
(
NULL
,
NULL
,
&
nvkm_client_oclass
,
if
(
!
(
client
=
*
pclient
=
kzalloc
(
sizeof
(
*
client
),
GFP_KERNEL
)))
NV_CLIENT_CLASS
,
nvkm_client_sclass
,
return
-
ENOMEM
;
0
,
&
client
);
oclass
.
client
=
client
;
*
pclient
=
client
;
if
(
ret
)
return
ret
;
ret
=
nvkm_handle_create
(
NULL
,
~
0
,
nv_object
(
client
),
&
client
->
root
);
if
(
ret
)
return
ret
;
/* prevent init/fini being called, os in in charge of this */
atomic_set
(
&
nv_object
(
client
)
->
usecount
,
2
);
client
->
device
=
device
;
nvkm_object_ctor
(
&
nvkm_client_object_func
,
&
oclass
,
&
client
->
object
)
;
snprintf
(
client
->
name
,
sizeof
(
client
->
name
),
"%s"
,
name
);
snprintf
(
client
->
name
,
sizeof
(
client
->
name
),
"%s"
,
name
);
client
->
device
=
device
;
client
->
debug
=
nvkm_dbgopt
(
dbg
,
"CLIENT"
);
client
->
debug
=
nvkm_dbgopt
(
dbg
,
"CLIENT"
);
client
->
objroot
=
RB_ROOT
;
client
->
objroot
=
RB_ROOT
;
return
0
;
ret
=
nvkm_handle_create
(
NULL
,
~
0
,
&
client
->
object
,
&
client
->
root
);
if
(
ret
)
nvkm_client_del
(
pclient
);
return
ret
;
}
}
const
char
*
const
char
*
...
...
drivers/gpu/drm/nouveau/nvkm/core/handle.c
浏览文件 @
24bd0930
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
*/
*/
#include <core/handle.h>
#include <core/handle.h>
#include <core/client.h>
#include <core/client.h>
#include <core/namedb.h>
#define hprintk(h,l,f,a...) do { \
#define hprintk(h,l,f,a...) do { \
struct nvkm_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \
struct nvkm_handle *p = (h)->parent; u32 n = p ? p->name : ~0; \
...
...
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
浏览文件 @
24bd0930
...
@@ -535,12 +535,12 @@ nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type,
...
@@ -535,12 +535,12 @@ nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type,
else
else
object
=
client
->
root
;
object
=
client
->
root
;
if
(
unlikely
(
!
object
))
{
if
(
unlikely
(
!
object
))
{
nvif_ioctl
(
&
client
->
namedb
.
parent
.
object
,
"object not found
\n
"
);
nvif_ioctl
(
&
client
->
object
,
"object not found
\n
"
);
return
-
ENOENT
;
return
-
ENOENT
;
}
}
if
(
owner
!=
NVIF_IOCTL_V0_OWNER_ANY
&&
owner
!=
object
->
route
)
{
if
(
owner
!=
NVIF_IOCTL_V0_OWNER_ANY
&&
owner
!=
object
->
route
)
{
nvif_ioctl
(
&
client
->
namedb
.
parent
.
object
,
"route != owner
\n
"
);
nvif_ioctl
(
&
client
->
object
,
"route != owner
\n
"
);
return
-
EACCES
;
return
-
EACCES
;
}
}
*
route
=
object
->
route
;
*
route
=
object
->
route
;
...
@@ -558,7 +558,7 @@ int
...
@@ -558,7 +558,7 @@ int
nvkm_ioctl
(
struct
nvkm_client
*
client
,
bool
supervisor
,
nvkm_ioctl
(
struct
nvkm_client
*
client
,
bool
supervisor
,
void
*
data
,
u32
size
,
void
**
hack
)
void
*
data
,
u32
size
,
void
**
hack
)
{
{
struct
nvkm_object
*
object
=
&
client
->
namedb
.
parent
.
object
;
struct
nvkm_object
*
object
=
&
client
->
object
;
union
{
union
{
struct
nvif_ioctl_v0
v0
;
struct
nvif_ioctl_v0
v0
;
}
*
args
=
data
;
}
*
args
=
data
;
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
浏览文件 @
24bd0930
...
@@ -1988,7 +1988,7 @@ nv_device(void *obj)
...
@@ -1988,7 +1988,7 @@ nv_device(void *obj)
if
(
device
->
engine
==
NULL
)
{
if
(
device
->
engine
==
NULL
)
{
while
(
device
&&
device
->
parent
)
{
while
(
device
&&
device
->
parent
)
{
if
(
!
nv_iclass
(
device
,
NV_SUBDEV_CLASS
)
&&
if
(
!
nv_iclass
(
device
,
NV_SUBDEV_CLASS
)
&&
device
->
parent
==
&
nvkm_client
(
device
)
->
namedb
.
parent
.
object
)
{
device
->
parent
==
&
nvkm_client
(
device
)
->
object
)
{
struct
{
struct
{
struct
nvkm_parent
base
;
struct
nvkm_parent
base
;
struct
nvkm_device
*
device
;
struct
nvkm_device
*
device
;
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
浏览文件 @
24bd0930
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "priv.h"
#include "priv.h"
#include <core/client.h>
#include <core/client.h>
#include <core/parent.h>
#include <subdev/fb.h>
#include <subdev/fb.h>
#include <subdev/instmem.h>
#include <subdev/instmem.h>
#include <subdev/timer.h>
#include <subdev/timer.h>
...
...
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
浏览文件 @
24bd0930
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <core/client.h>
#include <core/client.h>
#include <core/option.h>
#include <core/option.h>
#include <core/parent.h>
#include <nvif/class.h>
#include <nvif/class.h>
#include <nvif/ioctl.h>
#include <nvif/ioctl.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录