Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a2bfb50e
Commit
a2bfb50e
authored
Jan 15, 2020
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/gr/gk20a,gm200-: use nvkm_firmware_load_blob for sw init
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
6f0add0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
48 deletions
+44
-48
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
+2
-8
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
+39
-35
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
+3
-5
No files found.
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
View file @
a2bfb50e
...
@@ -244,6 +244,8 @@ void gp100_gr_zbc_clear_depth(struct gf100_gr *, int);
...
@@ -244,6 +244,8 @@ void gp100_gr_zbc_clear_depth(struct gf100_gr *, int);
void
gp102_gr_init_swdx_pes_mask
(
struct
gf100_gr
*
);
void
gp102_gr_init_swdx_pes_mask
(
struct
gf100_gr
*
);
extern
const
struct
gf100_gr_func_zbc
gp102_gr_zbc
;
extern
const
struct
gf100_gr_func_zbc
gp102_gr_zbc
;
int
gk20a_gr_load_sw
(
struct
gf100_gr
*
,
const
char
*
path
,
int
ver
);
#define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object)
#define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object)
#include <core/object.h>
#include <core/object.h>
...
@@ -304,14 +306,6 @@ void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *);
...
@@ -304,14 +306,6 @@ void gf100_gr_icmd(struct gf100_gr *, const struct gf100_gr_pack *);
void
gf100_gr_mthd
(
struct
gf100_gr
*
,
const
struct
gf100_gr_pack
*
);
void
gf100_gr_mthd
(
struct
gf100_gr
*
,
const
struct
gf100_gr_pack
*
);
int
gf100_gr_init_ctxctl
(
struct
gf100_gr
*
);
int
gf100_gr_init_ctxctl
(
struct
gf100_gr
*
);
/* external bundles loading functions */
int
gk20a_gr_av_to_init
(
struct
gf100_gr
*
,
const
char
*
,
struct
gf100_gr_pack
**
);
int
gk20a_gr_aiv_to_init
(
struct
gf100_gr
*
,
const
char
*
,
struct
gf100_gr_pack
**
);
int
gk20a_gr_av_to_method
(
struct
gf100_gr
*
,
const
char
*
,
struct
gf100_gr_pack
**
);
int
gm200_gr_new_
(
const
struct
gf100_gr_func
*
,
struct
nvkm_device
*
,
int
,
int
gm200_gr_new_
(
const
struct
gf100_gr_func
*
,
struct
nvkm_device
*
,
int
,
struct
nvkm_gr
**
);
struct
nvkm_gr
**
);
...
...
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
View file @
a2bfb50e
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "gf100.h"
#include "gf100.h"
#include "ctxgf100.h"
#include "ctxgf100.h"
#include <core/firmware.h>
#include <subdev/timer.h>
#include <subdev/timer.h>
#include <nvif/class.h>
#include <nvif/class.h>
...
@@ -33,21 +34,22 @@ struct gk20a_fw_av
...
@@ -33,21 +34,22 @@ struct gk20a_fw_av
};
};
int
int
gk20a_gr_av_to_init
(
struct
gf100_gr
*
gr
,
const
char
*
fw_
name
,
gk20a_gr_av_to_init
(
struct
gf100_gr
*
gr
,
const
char
*
path
,
const
char
*
name
,
struct
gf100_gr_pack
**
ppack
)
int
ver
,
struct
gf100_gr_pack
**
ppack
)
{
{
struct
nvkm_blob
fuc
;
struct
nvkm_subdev
*
subdev
=
&
gr
->
base
.
engine
.
subdev
;
struct
nvkm_blob
blob
;
struct
gf100_gr_init
*
init
;
struct
gf100_gr_init
*
init
;
struct
gf100_gr_pack
*
pack
;
struct
gf100_gr_pack
*
pack
;
int
nent
;
int
nent
;
int
ret
;
int
ret
;
int
i
;
int
i
;
ret
=
gf100_gr_ctor_fw
(
gr
,
fw_name
,
&
fuc
);
ret
=
nvkm_firmware_load_blob
(
subdev
,
path
,
name
,
ver
,
&
blob
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
nent
=
(
fuc
.
size
/
sizeof
(
struct
gk20a_fw_av
));
nent
=
(
blob
.
size
/
sizeof
(
struct
gk20a_fw_av
));
pack
=
vzalloc
((
sizeof
(
*
pack
)
*
2
)
+
(
sizeof
(
*
init
)
*
(
nent
+
1
)));
pack
=
vzalloc
((
sizeof
(
*
pack
)
*
2
)
+
(
sizeof
(
*
init
)
*
(
nent
+
1
)));
if
(
!
pack
)
{
if
(
!
pack
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
...
@@ -59,7 +61,7 @@ gk20a_gr_av_to_init(struct gf100_gr *gr, const char *fw_name,
...
@@ -59,7 +61,7 @@ gk20a_gr_av_to_init(struct gf100_gr *gr, const char *fw_name,
for
(
i
=
0
;
i
<
nent
;
i
++
)
{
for
(
i
=
0
;
i
<
nent
;
i
++
)
{
struct
gf100_gr_init
*
ent
=
&
init
[
i
];
struct
gf100_gr_init
*
ent
=
&
init
[
i
];
struct
gk20a_fw_av
*
av
=
&
((
struct
gk20a_fw_av
*
)
fuc
.
data
)[
i
];
struct
gk20a_fw_av
*
av
=
&
((
struct
gk20a_fw_av
*
)
blob
.
data
)[
i
];
ent
->
addr
=
av
->
addr
;
ent
->
addr
=
av
->
addr
;
ent
->
data
=
av
->
data
;
ent
->
data
=
av
->
data
;
...
@@ -70,7 +72,7 @@ gk20a_gr_av_to_init(struct gf100_gr *gr, const char *fw_name,
...
@@ -70,7 +72,7 @@ gk20a_gr_av_to_init(struct gf100_gr *gr, const char *fw_name,
*
ppack
=
pack
;
*
ppack
=
pack
;
end:
end:
nvkm_blob_dtor
(
&
fuc
);
nvkm_blob_dtor
(
&
blob
);
return
ret
;
return
ret
;
}
}
...
@@ -82,21 +84,22 @@ struct gk20a_fw_aiv
...
@@ -82,21 +84,22 @@ struct gk20a_fw_aiv
};
};
int
int
gk20a_gr_aiv_to_init
(
struct
gf100_gr
*
gr
,
const
char
*
fw_
name
,
gk20a_gr_aiv_to_init
(
struct
gf100_gr
*
gr
,
const
char
*
path
,
const
char
*
name
,
struct
gf100_gr_pack
**
ppack
)
int
ver
,
struct
gf100_gr_pack
**
ppack
)
{
{
struct
nvkm_blob
fuc
;
struct
nvkm_subdev
*
subdev
=
&
gr
->
base
.
engine
.
subdev
;
struct
nvkm_blob
blob
;
struct
gf100_gr_init
*
init
;
struct
gf100_gr_init
*
init
;
struct
gf100_gr_pack
*
pack
;
struct
gf100_gr_pack
*
pack
;
int
nent
;
int
nent
;
int
ret
;
int
ret
;
int
i
;
int
i
;
ret
=
gf100_gr_ctor_fw
(
gr
,
fw_name
,
&
fuc
);
ret
=
nvkm_firmware_load_blob
(
subdev
,
path
,
name
,
ver
,
&
blob
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
nent
=
(
fuc
.
size
/
sizeof
(
struct
gk20a_fw_aiv
));
nent
=
(
blob
.
size
/
sizeof
(
struct
gk20a_fw_aiv
));
pack
=
vzalloc
((
sizeof
(
*
pack
)
*
2
)
+
(
sizeof
(
*
init
)
*
(
nent
+
1
)));
pack
=
vzalloc
((
sizeof
(
*
pack
)
*
2
)
+
(
sizeof
(
*
init
)
*
(
nent
+
1
)));
if
(
!
pack
)
{
if
(
!
pack
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
...
@@ -108,7 +111,7 @@ gk20a_gr_aiv_to_init(struct gf100_gr *gr, const char *fw_name,
...
@@ -108,7 +111,7 @@ gk20a_gr_aiv_to_init(struct gf100_gr *gr, const char *fw_name,
for
(
i
=
0
;
i
<
nent
;
i
++
)
{
for
(
i
=
0
;
i
<
nent
;
i
++
)
{
struct
gf100_gr_init
*
ent
=
&
init
[
i
];
struct
gf100_gr_init
*
ent
=
&
init
[
i
];
struct
gk20a_fw_aiv
*
av
=
&
((
struct
gk20a_fw_aiv
*
)
fuc
.
data
)[
i
];
struct
gk20a_fw_aiv
*
av
=
&
((
struct
gk20a_fw_aiv
*
)
blob
.
data
)[
i
];
ent
->
addr
=
av
->
addr
;
ent
->
addr
=
av
->
addr
;
ent
->
data
=
av
->
data
;
ent
->
data
=
av
->
data
;
...
@@ -119,15 +122,16 @@ gk20a_gr_aiv_to_init(struct gf100_gr *gr, const char *fw_name,
...
@@ -119,15 +122,16 @@ gk20a_gr_aiv_to_init(struct gf100_gr *gr, const char *fw_name,
*
ppack
=
pack
;
*
ppack
=
pack
;
end:
end:
nvkm_blob_dtor
(
&
fuc
);
nvkm_blob_dtor
(
&
blob
);
return
ret
;
return
ret
;
}
}
int
int
gk20a_gr_av_to_method
(
struct
gf100_gr
*
gr
,
const
char
*
fw_
name
,
gk20a_gr_av_to_method
(
struct
gf100_gr
*
gr
,
const
char
*
path
,
const
char
*
name
,
struct
gf100_gr_pack
**
ppack
)
int
ver
,
struct
gf100_gr_pack
**
ppack
)
{
{
struct
nvkm_blob
fuc
;
struct
nvkm_subdev
*
subdev
=
&
gr
->
base
.
engine
.
subdev
;
struct
nvkm_blob
blob
;
struct
gf100_gr_init
*
init
;
struct
gf100_gr_init
*
init
;
struct
gf100_gr_pack
*
pack
;
struct
gf100_gr_pack
*
pack
;
/* We don't suppose we will initialize more than 16 classes here... */
/* We don't suppose we will initialize more than 16 classes here... */
...
@@ -137,11 +141,11 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
...
@@ -137,11 +141,11 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
int
ret
;
int
ret
;
int
i
;
int
i
;
ret
=
gf100_gr_ctor_fw
(
gr
,
fw_name
,
&
fuc
);
ret
=
nvkm_firmware_load_blob
(
subdev
,
path
,
name
,
ver
,
&
blob
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
nent
=
(
fuc
.
size
/
sizeof
(
struct
gk20a_fw_av
));
nent
=
(
blob
.
size
/
sizeof
(
struct
gk20a_fw_av
));
pack
=
vzalloc
((
sizeof
(
*
pack
)
*
(
max_classes
+
1
))
+
pack
=
vzalloc
((
sizeof
(
*
pack
)
*
(
max_classes
+
1
))
+
(
sizeof
(
*
init
)
*
(
nent
+
max_classes
+
1
)));
(
sizeof
(
*
init
)
*
(
nent
+
max_classes
+
1
)));
...
@@ -153,7 +157,7 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
...
@@ -153,7 +157,7 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
init
=
(
void
*
)(
pack
+
max_classes
+
1
);
init
=
(
void
*
)(
pack
+
max_classes
+
1
);
for
(
i
=
0
;
i
<
nent
;
i
++
,
init
++
)
{
for
(
i
=
0
;
i
<
nent
;
i
++
,
init
++
)
{
struct
gk20a_fw_av
*
av
=
&
((
struct
gk20a_fw_av
*
)
fuc
.
data
)[
i
];
struct
gk20a_fw_av
*
av
=
&
((
struct
gk20a_fw_av
*
)
blob
.
data
)[
i
];
u32
class
=
av
->
addr
&
0xffff
;
u32
class
=
av
->
addr
&
0xffff
;
u32
addr
=
(
av
->
addr
&
0xffff0000
)
>>
14
;
u32
addr
=
(
av
->
addr
&
0xffff0000
)
>>
14
;
...
@@ -179,7 +183,7 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
...
@@ -179,7 +183,7 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name,
*
ppack
=
pack
;
*
ppack
=
pack
;
end:
end:
nvkm_blob_dtor
(
&
fuc
);
nvkm_blob_dtor
(
&
blob
);
return
ret
;
return
ret
;
}
}
...
@@ -303,6 +307,18 @@ gk20a_gr = {
...
@@ -303,6 +307,18 @@ gk20a_gr = {
}
}
};
};
int
gk20a_gr_load_sw
(
struct
gf100_gr
*
gr
,
const
char
*
path
,
int
ver
)
{
if
(
gk20a_gr_av_to_init
(
gr
,
path
,
"sw_nonctx"
,
ver
,
&
gr
->
fuc_sw_nonctx
)
||
gk20a_gr_aiv_to_init
(
gr
,
path
,
"sw_ctx"
,
ver
,
&
gr
->
fuc_sw_ctx
)
||
gk20a_gr_av_to_init
(
gr
,
path
,
"sw_bundle_init"
,
ver
,
&
gr
->
fuc_bundle
)
||
gk20a_gr_av_to_method
(
gr
,
path
,
"sw_method_init"
,
ver
,
&
gr
->
fuc_method
))
return
-
ENOENT
;
return
0
;
}
int
int
gk20a_gr_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_gr
**
pgr
)
gk20a_gr_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_gr
**
pgr
)
{
{
...
@@ -323,21 +339,9 @@ gk20a_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
...
@@ -323,21 +339,9 @@ gk20a_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr)
gf100_gr_ctor_fw
(
gr
,
"gpccs_data"
,
&
gr
->
fuc41ad
))
gf100_gr_ctor_fw
(
gr
,
"gpccs_data"
,
&
gr
->
fuc41ad
))
return
-
ENODEV
;
return
-
ENODEV
;
ret
=
gk20a_gr_av_to_init
(
gr
,
"sw_nonctx"
,
&
gr
->
fuc_sw_nonctx
);
ret
=
gk20a_gr_load_sw
(
gr
,
""
,
0
);
if
(
ret
)
return
ret
;
ret
=
gk20a_gr_aiv_to_init
(
gr
,
"sw_ctx"
,
&
gr
->
fuc_sw_ctx
);
if
(
ret
)
return
ret
;
ret
=
gk20a_gr_av_to_init
(
gr
,
"sw_bundle_init"
,
&
gr
->
fuc_bundle
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
-
ENODEV
;
ret
=
gk20a_gr_av_to_method
(
gr
,
"sw_method_init"
,
&
gr
->
fuc_method
);
if
(
ret
)
return
ret
;
return
0
;
return
0
;
}
}
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
View file @
a2bfb50e
...
@@ -153,11 +153,9 @@ gm200_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
...
@@ -153,11 +153,9 @@ gm200_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
return
ret
;
return
ret
;
}
}
if
((
ret
=
gk20a_gr_av_to_init
(
gr
,
"gr/sw_nonctx"
,
&
gr
->
fuc_sw_nonctx
))
||
ret
=
gk20a_gr_load_sw
(
gr
,
"gr/"
,
0
);
(
ret
=
gk20a_gr_aiv_to_init
(
gr
,
"gr/sw_ctx"
,
&
gr
->
fuc_sw_ctx
))
||
if
(
ret
)
(
ret
=
gk20a_gr_av_to_init
(
gr
,
"gr/sw_bundle_init"
,
&
gr
->
fuc_bundle
))
||
return
-
ENODEV
;
(
ret
=
gk20a_gr_av_to_method
(
gr
,
"gr/sw_method_init"
,
&
gr
->
fuc_method
)))
return
ret
;
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment