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
846e831d
Commit
846e831d
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/pm: switch to device pri macros
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
f2d85ad1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
30 deletions
+40
-30
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
+4
-2
drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c
+24
-19
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
+12
-9
No files found.
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
View file @
846e831d
...
@@ -126,6 +126,7 @@ nvkm_perfsrc_find(struct nvkm_pm *pm, struct nvkm_perfsig *sig, int si)
...
@@ -126,6 +126,7 @@ nvkm_perfsrc_find(struct nvkm_pm *pm, struct nvkm_perfsig *sig, int si)
static
int
static
int
nvkm_perfsrc_enable
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfctr
*
ctr
)
nvkm_perfsrc_enable
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfctr
*
ctr
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
struct
nvkm_perfdom
*
dom
=
NULL
;
struct
nvkm_perfdom
*
dom
=
NULL
;
struct
nvkm_perfsig
*
sig
;
struct
nvkm_perfsig
*
sig
;
struct
nvkm_perfsrc
*
src
;
struct
nvkm_perfsrc
*
src
;
...
@@ -151,7 +152,7 @@ nvkm_perfsrc_enable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
...
@@ -151,7 +152,7 @@ nvkm_perfsrc_enable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
value
|=
((
ctr
->
source
[
i
][
j
]
>>
32
)
<<
src
->
shift
);
value
|=
((
ctr
->
source
[
i
][
j
]
>>
32
)
<<
src
->
shift
);
/* enable the source */
/* enable the source */
nv
_mask
(
pm
,
src
->
addr
,
mask
,
value
);
nv
km_mask
(
device
,
src
->
addr
,
mask
,
value
);
nv_debug
(
pm
,
"enabled source 0x%08x 0x%08x 0x%08x
\n
"
,
nv_debug
(
pm
,
"enabled source 0x%08x 0x%08x 0x%08x
\n
"
,
src
->
addr
,
mask
,
value
);
src
->
addr
,
mask
,
value
);
}
}
...
@@ -162,6 +163,7 @@ nvkm_perfsrc_enable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
...
@@ -162,6 +163,7 @@ nvkm_perfsrc_enable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
static
int
static
int
nvkm_perfsrc_disable
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfctr
*
ctr
)
nvkm_perfsrc_disable
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfctr
*
ctr
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
struct
nvkm_perfdom
*
dom
=
NULL
;
struct
nvkm_perfdom
*
dom
=
NULL
;
struct
nvkm_perfsig
*
sig
;
struct
nvkm_perfsig
*
sig
;
struct
nvkm_perfsrc
*
src
;
struct
nvkm_perfsrc
*
src
;
...
@@ -186,7 +188,7 @@ nvkm_perfsrc_disable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
...
@@ -186,7 +188,7 @@ nvkm_perfsrc_disable(struct nvkm_pm *pm, struct nvkm_perfctr *ctr)
mask
|=
(
src
->
mask
<<
src
->
shift
);
mask
|=
(
src
->
mask
<<
src
->
shift
);
/* disable the source */
/* disable the source */
nv
_mask
(
pm
,
src
->
addr
,
mask
,
0
);
nv
km_mask
(
device
,
src
->
addr
,
mask
,
0
);
nv_debug
(
pm
,
"disabled source 0x%08x 0x%08x
\n
"
,
nv_debug
(
pm
,
"disabled source 0x%08x 0x%08x
\n
"
,
src
->
addr
,
mask
);
src
->
addr
,
mask
);
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/engine/pm/gf100.c
View file @
846e831d
...
@@ -128,6 +128,7 @@ static void
...
@@ -128,6 +128,7 @@ static void
gf100_perfctr_init
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
gf100_perfctr_init
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
struct
nvkm_perfctr
*
ctr
)
struct
nvkm_perfctr
*
ctr
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
struct
gf100_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
struct
gf100_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
u32
log
=
ctr
->
logic_op
;
u32
log
=
ctr
->
logic_op
;
u32
src
=
0x00000000
;
u32
src
=
0x00000000
;
...
@@ -136,32 +137,34 @@ gf100_perfctr_init(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
...
@@ -136,32 +137,34 @@ gf100_perfctr_init(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
src
|=
ctr
->
signal
[
i
]
<<
(
i
*
8
);
src
|=
ctr
->
signal
[
i
]
<<
(
i
*
8
);
nv
_wr32
(
pm
,
dom
->
addr
+
0x09c
,
0x00040002
|
(
dom
->
mode
<<
3
));
nv
km_wr32
(
device
,
dom
->
addr
+
0x09c
,
0x00040002
|
(
dom
->
mode
<<
3
));
nv
_wr32
(
pm
,
dom
->
addr
+
0x100
,
0x00000000
);
nv
km_wr32
(
device
,
dom
->
addr
+
0x100
,
0x00000000
);
nv
_wr32
(
pm
,
dom
->
addr
+
0x040
+
(
cntr
->
base
.
slot
*
0x08
),
src
);
nv
km_wr32
(
device
,
dom
->
addr
+
0x040
+
(
cntr
->
base
.
slot
*
0x08
),
src
);
nv
_wr32
(
pm
,
dom
->
addr
+
0x044
+
(
cntr
->
base
.
slot
*
0x08
),
log
);
nv
km_wr32
(
device
,
dom
->
addr
+
0x044
+
(
cntr
->
base
.
slot
*
0x08
),
log
);
}
}
static
void
static
void
gf100_perfctr_read
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
gf100_perfctr_read
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
struct
nvkm_perfctr
*
ctr
)
struct
nvkm_perfctr
*
ctr
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
struct
gf100_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
struct
gf100_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
switch
(
cntr
->
base
.
slot
)
{
switch
(
cntr
->
base
.
slot
)
{
case
0
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
dom
->
addr
+
0x08c
);
break
;
case
0
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
dom
->
addr
+
0x08c
);
break
;
case
1
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
dom
->
addr
+
0x088
);
break
;
case
1
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
dom
->
addr
+
0x088
);
break
;
case
2
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
dom
->
addr
+
0x080
);
break
;
case
2
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
dom
->
addr
+
0x080
);
break
;
case
3
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
dom
->
addr
+
0x090
);
break
;
case
3
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
dom
->
addr
+
0x090
);
break
;
}
}
dom
->
clk
=
nv
_rd32
(
pm
,
dom
->
addr
+
0x070
);
dom
->
clk
=
nv
km_rd32
(
device
,
dom
->
addr
+
0x070
);
}
}
static
void
static
void
gf100_perfctr_next
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
)
gf100_perfctr_next
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
)
{
{
nv_wr32
(
pm
,
dom
->
addr
+
0x06c
,
dom
->
signal_nr
-
0x40
+
0x27
);
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
nv_wr32
(
pm
,
dom
->
addr
+
0x0ec
,
0x00000011
);
nvkm_wr32
(
device
,
dom
->
addr
+
0x06c
,
dom
->
signal_nr
-
0x40
+
0x27
);
nvkm_wr32
(
device
,
dom
->
addr
+
0x0ec
,
0x00000011
);
}
}
const
struct
nvkm_funcdom
const
struct
nvkm_funcdom
...
@@ -175,8 +178,9 @@ int
...
@@ -175,8 +178,9 @@ int
gf100_pm_fini
(
struct
nvkm_object
*
object
,
bool
suspend
)
gf100_pm_fini
(
struct
nvkm_object
*
object
,
bool
suspend
)
{
{
struct
nvkm_pm
*
pm
=
(
void
*
)
object
;
struct
nvkm_pm
*
pm
=
(
void
*
)
object
;
nv_mask
(
pm
,
0x000200
,
0x10000000
,
0x00000000
);
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
nv_mask
(
pm
,
0x000200
,
0x10000000
,
0x10000000
);
nvkm_mask
(
device
,
0x000200
,
0x10000000
,
0x00000000
);
nvkm_mask
(
device
,
0x000200
,
0x10000000
,
0x10000000
);
return
nvkm_pm_fini
(
pm
,
suspend
);
return
nvkm_pm_fini
(
pm
,
suspend
);
}
}
...
@@ -186,6 +190,7 @@ gf100_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
...
@@ -186,6 +190,7 @@ gf100_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct
nvkm_object
**
pobject
)
struct
nvkm_object
**
pobject
)
{
{
struct
gf100_pm_oclass
*
mclass
=
(
void
*
)
oclass
;
struct
gf100_pm_oclass
*
mclass
=
(
void
*
)
oclass
;
struct
nvkm_device
*
device
=
(
void
*
)
parent
;
struct
nvkm_pm
*
pm
;
struct
nvkm_pm
*
pm
;
u32
mask
;
u32
mask
;
int
ret
;
int
ret
;
...
@@ -202,9 +207,9 @@ gf100_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
...
@@ -202,9 +207,9 @@ gf100_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
return
ret
;
return
ret
;
/* GPC */
/* GPC */
mask
=
(
1
<<
nv
_rd32
(
pm
,
0x022430
))
-
1
;
mask
=
(
1
<<
nv
km_rd32
(
device
,
0x022430
))
-
1
;
mask
&=
~
nv
_rd32
(
pm
,
0x022504
);
mask
&=
~
nv
km_rd32
(
device
,
0x022504
);
mask
&=
~
nv
_rd32
(
pm
,
0x022584
);
mask
&=
~
nv
km_rd32
(
device
,
0x022584
);
ret
=
nvkm_perfdom_new
(
pm
,
"gpc"
,
mask
,
0x180000
,
ret
=
nvkm_perfdom_new
(
pm
,
"gpc"
,
mask
,
0x180000
,
0x1000
,
0x200
,
mclass
->
doms_gpc
);
0x1000
,
0x200
,
mclass
->
doms_gpc
);
...
@@ -212,9 +217,9 @@ gf100_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
...
@@ -212,9 +217,9 @@ gf100_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
return
ret
;
return
ret
;
/* PART */
/* PART */
mask
=
(
1
<<
nv
_rd32
(
pm
,
0x022438
))
-
1
;
mask
=
(
1
<<
nv
km_rd32
(
device
,
0x022438
))
-
1
;
mask
&=
~
nv
_rd32
(
pm
,
0x022548
);
mask
&=
~
nv
km_rd32
(
device
,
0x022548
);
mask
&=
~
nv
_rd32
(
pm
,
0x0225c8
);
mask
&=
~
nv
km_rd32
(
device
,
0x0225c8
);
ret
=
nvkm_perfdom_new
(
pm
,
"part"
,
mask
,
0x1a0000
,
ret
=
nvkm_perfdom_new
(
pm
,
"part"
,
mask
,
0x1a0000
,
0x1000
,
0x200
,
mclass
->
doms_part
);
0x1000
,
0x200
,
mclass
->
doms_part
);
...
...
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
View file @
846e831d
...
@@ -27,6 +27,7 @@ static void
...
@@ -27,6 +27,7 @@ static void
nv40_perfctr_init
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
nv40_perfctr_init
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
struct
nvkm_perfctr
*
ctr
)
struct
nvkm_perfctr
*
ctr
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
struct
nv40_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
struct
nv40_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
u32
log
=
ctr
->
logic_op
;
u32
log
=
ctr
->
logic_op
;
u32
src
=
0x00000000
;
u32
src
=
0x00000000
;
...
@@ -35,31 +36,33 @@ nv40_perfctr_init(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
...
@@ -35,31 +36,33 @@ nv40_perfctr_init(struct nvkm_pm *pm, struct nvkm_perfdom *dom,
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
src
|=
ctr
->
signal
[
i
]
<<
(
i
*
8
);
src
|=
ctr
->
signal
[
i
]
<<
(
i
*
8
);
nv
_wr32
(
pm
,
0x00a7c0
+
dom
->
addr
,
0x00000001
|
(
dom
->
mode
<<
4
));
nv
km_wr32
(
device
,
0x00a7c0
+
dom
->
addr
,
0x00000001
|
(
dom
->
mode
<<
4
));
nv
_wr32
(
pm
,
0x00a400
+
dom
->
addr
+
(
cntr
->
base
.
slot
*
0x40
),
src
);
nv
km_wr32
(
device
,
0x00a400
+
dom
->
addr
+
(
cntr
->
base
.
slot
*
0x40
),
src
);
nv
_wr32
(
pm
,
0x00a420
+
dom
->
addr
+
(
cntr
->
base
.
slot
*
0x40
),
log
);
nv
km_wr32
(
device
,
0x00a420
+
dom
->
addr
+
(
cntr
->
base
.
slot
*
0x40
),
log
);
}
}
static
void
static
void
nv40_perfctr_read
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
nv40_perfctr_read
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
,
struct
nvkm_perfctr
*
ctr
)
struct
nvkm_perfctr
*
ctr
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
struct
nv40_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
struct
nv40_pm_cntr
*
cntr
=
(
void
*
)
ctr
;
switch
(
cntr
->
base
.
slot
)
{
switch
(
cntr
->
base
.
slot
)
{
case
0
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
0x00a700
+
dom
->
addr
);
break
;
case
0
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
0x00a700
+
dom
->
addr
);
break
;
case
1
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
0x00a6c0
+
dom
->
addr
);
break
;
case
1
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
0x00a6c0
+
dom
->
addr
);
break
;
case
2
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
0x00a680
+
dom
->
addr
);
break
;
case
2
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
0x00a680
+
dom
->
addr
);
break
;
case
3
:
cntr
->
base
.
ctr
=
nv
_rd32
(
pm
,
0x00a740
+
dom
->
addr
);
break
;
case
3
:
cntr
->
base
.
ctr
=
nv
km_rd32
(
device
,
0x00a740
+
dom
->
addr
);
break
;
}
}
dom
->
clk
=
nv
_rd32
(
pm
,
0x00a600
+
dom
->
addr
);
dom
->
clk
=
nv
km_rd32
(
device
,
0x00a600
+
dom
->
addr
);
}
}
static
void
static
void
nv40_perfctr_next
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
)
nv40_perfctr_next
(
struct
nvkm_pm
*
pm
,
struct
nvkm_perfdom
*
dom
)
{
{
struct
nvkm_device
*
device
=
pm
->
engine
.
subdev
.
device
;
if
(
pm
->
sequence
!=
pm
->
sequence
)
{
if
(
pm
->
sequence
!=
pm
->
sequence
)
{
nv
_wr32
(
pm
,
0x400084
,
0x00000020
);
nv
km_wr32
(
device
,
0x400084
,
0x00000020
);
pm
->
sequence
=
pm
->
sequence
;
pm
->
sequence
=
pm
->
sequence
;
}
}
}
}
...
...
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