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
nexedi
linux
Commits
ed3d1489
Commit
ed3d1489
authored
Feb 17, 2020
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/nvif: protect waits against GPU falling off the bus
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
58e92b5e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
102 additions
and
22 deletions
+102
-22
drivers/gpu/drm/nouveau/dispnv04/dac.c
drivers/gpu/drm/nouveau/dispnv04/dac.c
+2
-1
drivers/gpu/drm/nouveau/dispnv04/hw.c
drivers/gpu/drm/nouveau/dispnv04/hw.c
+1
-0
drivers/gpu/drm/nouveau/dispnv50/base507c.c
drivers/gpu/drm/nouveau/dispnv50/base507c.c
+1
-0
drivers/gpu/drm/nouveau/dispnv50/core507d.c
drivers/gpu/drm/nouveau/dispnv50/core507d.c
+1
-0
drivers/gpu/drm/nouveau/dispnv50/corec37d.c
drivers/gpu/drm/nouveau/dispnv50/corec37d.c
+2
-0
drivers/gpu/drm/nouveau/dispnv50/disp.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
+1
-0
drivers/gpu/drm/nouveau/dispnv50/ovly827e.c
drivers/gpu/drm/nouveau/dispnv50/ovly827e.c
+2
-0
drivers/gpu/drm/nouveau/include/nvif/device.h
drivers/gpu/drm/nouveau/include/nvif/device.h
+0
-21
drivers/gpu/drm/nouveau/include/nvif/timer.h
drivers/gpu/drm/nouveau/include/nvif/timer.h
+35
-0
drivers/gpu/drm/nouveau/nvif/Kbuild
drivers/gpu/drm/nouveau/nvif/Kbuild
+1
-0
drivers/gpu/drm/nouveau/nvif/timer.c
drivers/gpu/drm/nouveau/nvif/timer.c
+56
-0
No files found.
drivers/gpu/drm/nouveau/dispnv04/dac.c
View file @
ed3d1489
...
@@ -35,7 +35,8 @@
...
@@ -35,7 +35,8 @@
#include <subdev/bios/gpio.h>
#include <subdev/bios/gpio.h>
#include <subdev/gpio.h>
#include <subdev/gpio.h>
#include <subdev/timer.h>
#include <nvif/timer.h>
int
nv04_dac_output_offset
(
struct
drm_encoder
*
encoder
)
int
nv04_dac_output_offset
(
struct
drm_encoder
*
encoder
)
{
{
...
...
drivers/gpu/drm/nouveau/dispnv04/hw.c
View file @
ed3d1489
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "hw.h"
#include "hw.h"
#include <subdev/bios/pll.h>
#include <subdev/bios/pll.h>
#include <nvif/timer.h>
#define CHIPSET_NFORCE 0x01a0
#define CHIPSET_NFORCE 0x01a0
#define CHIPSET_NFORCE2 0x01f0
#define CHIPSET_NFORCE2 0x01f0
...
...
drivers/gpu/drm/nouveau/dispnv50/base507c.c
View file @
ed3d1489
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <nvif/cl507c.h>
#include <nvif/cl507c.h>
#include <nvif/event.h>
#include <nvif/event.h>
#include <nvif/timer.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_fourcc.h>
...
...
drivers/gpu/drm/nouveau/dispnv50/core507d.c
View file @
ed3d1489
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "head.h"
#include "head.h"
#include <nvif/cl507d.h>
#include <nvif/cl507d.h>
#include <nvif/timer.h>
#include "nouveau_bo.h"
#include "nouveau_bo.h"
...
...
drivers/gpu/drm/nouveau/dispnv50/corec37d.c
View file @
ed3d1489
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include <nouveau_bo.h>
#include <nouveau_bo.h>
#include <nvif/timer.h>
void
void
corec37d_wndw_owner
(
struct
nv50_core
*
core
)
corec37d_wndw_owner
(
struct
nv50_core
*
core
)
{
{
...
...
drivers/gpu/drm/nouveau/dispnv50/disp.c
View file @
ed3d1489
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
#include <nvif/cl5070.h>
#include <nvif/cl5070.h>
#include <nvif/cl507d.h>
#include <nvif/cl507d.h>
#include <nvif/event.h>
#include <nvif/event.h>
#include <nvif/timer.h>
#include "nouveau_drv.h"
#include "nouveau_drv.h"
#include "nouveau_dma.h"
#include "nouveau_dma.h"
...
...
drivers/gpu/drm/nouveau/dispnv50/ovly827e.c
View file @
ed3d1489
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include <nouveau_bo.h>
#include <nouveau_bo.h>
#include <nvif/timer.h>
static
void
static
void
ovly827e_image_set
(
struct
nv50_wndw
*
wndw
,
struct
nv50_wndw_atom
*
asyw
)
ovly827e_image_set
(
struct
nv50_wndw
*
wndw
,
struct
nv50_wndw_atom
*
asyw
)
{
{
...
...
drivers/gpu/drm/nouveau/include/nvif/device.h
View file @
ed3d1489
...
@@ -23,27 +23,6 @@ int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
...
@@ -23,27 +23,6 @@ int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32,
void
nvif_device_fini
(
struct
nvif_device
*
);
void
nvif_device_fini
(
struct
nvif_device
*
);
u64
nvif_device_time
(
struct
nvif_device
*
);
u64
nvif_device_time
(
struct
nvif_device
*
);
/* Delay based on GPU time (ie. PTIMER).
*
* Will return -ETIMEDOUT unless the loop was terminated with 'break',
* where it will return the number of nanoseconds taken instead.
*/
#define nvif_nsec(d,n,cond...) ({ \
struct nvif_device *_device = (d); \
u64 _nsecs = (n), _time0 = nvif_device_time(_device); \
s64 _taken = 0; \
\
do { \
cond \
} while (_taken = nvif_device_time(_device) - _time0, _taken < _nsecs);\
\
if (_taken >= _nsecs) \
_taken = -ETIMEDOUT; \
_taken; \
})
#define nvif_usec(d,u,cond...) nvif_nsec((d), (u) * 1000, ##cond)
#define nvif_msec(d,m,cond...) nvif_usec((d), (m) * 1000, ##cond)
/*XXX*/
/*XXX*/
#include <subdev/bios.h>
#include <subdev/bios.h>
#include <subdev/fb.h>
#include <subdev/fb.h>
...
...
drivers/gpu/drm/nouveau/include/nvif/timer.h
0 → 100644
View file @
ed3d1489
#ifndef __NVIF_TIMER_H__
#define __NVIF_TIMER_H__
#include <nvif/os.h>
struct
nvif_timer_wait
{
struct
nvif_device
*
device
;
u64
limit
;
u64
time0
;
u64
time1
;
int
reads
;
};
void
nvif_timer_wait_init
(
struct
nvif_device
*
,
u64
nsec
,
struct
nvif_timer_wait
*
);
s64
nvif_timer_wait_test
(
struct
nvif_timer_wait
*
);
/* Delay based on GPU time (ie. PTIMER).
*
* Will return -ETIMEDOUT unless the loop was terminated with 'break',
* where it will return the number of nanoseconds taken instead.
*/
#define nvif_nsec(d,n,cond...) ({ \
struct nvif_timer_wait _wait; \
s64 _taken = 0; \
\
nvif_timer_wait_init((d), (n), &_wait); \
do { \
cond \
} while ((_taken = nvif_timer_wait_test(&_wait)) >= 0); \
\
_taken; \
})
#define nvif_usec(d,u,cond...) nvif_nsec((d), (u) * 1000, ##cond)
#define nvif_msec(d,m,cond...) nvif_usec((d), (m) * 1000, ##cond)
#endif
drivers/gpu/drm/nouveau/nvif/Kbuild
View file @
ed3d1489
...
@@ -8,6 +8,7 @@ nvif-y += nvif/fifo.o
...
@@ -8,6 +8,7 @@ nvif-y += nvif/fifo.o
nvif-y += nvif/mem.o
nvif-y += nvif/mem.o
nvif-y += nvif/mmu.o
nvif-y += nvif/mmu.o
nvif-y += nvif/notify.o
nvif-y += nvif/notify.o
nvif-y += nvif/timer.o
nvif-y += nvif/vmm.o
nvif-y += nvif/vmm.o
# Usermode classes
# Usermode classes
...
...
drivers/gpu/drm/nouveau/nvif/timer.c
0 → 100644
View file @
ed3d1489
/*
* Copyright 2020 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.
*/
#include <nvif/timer.h>
#include <nvif/device.h>
s64
nvif_timer_wait_test
(
struct
nvif_timer_wait
*
wait
)
{
u64
time
=
nvif_device_time
(
wait
->
device
);
if
(
wait
->
reads
==
0
)
{
wait
->
time0
=
time
;
wait
->
time1
=
time
;
}
if
(
wait
->
time1
==
time
)
{
if
(
WARN_ON
(
wait
->
reads
++
==
16
))
return
-
ETIMEDOUT
;
}
else
{
wait
->
time1
=
time
;
wait
->
reads
=
1
;
}
if
(
wait
->
time1
-
wait
->
time0
>
wait
->
limit
)
return
-
ETIMEDOUT
;
return
wait
->
time1
-
wait
->
time0
;
}
void
nvif_timer_wait_init
(
struct
nvif_device
*
device
,
u64
nsec
,
struct
nvif_timer_wait
*
wait
)
{
wait
->
device
=
device
;
wait
->
limit
=
nsec
;
wait
->
reads
=
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