Skip to content

Commit 30c2c32

Browse files
committed
Merge tag 'drm-fixes-2018-07-10' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "This just contains some etnaviv fixes and a MAINTAINERS update for the new drm tree locations" * tag 'drm-fixes-2018-07-10' of git://anongit.freedesktop.org/drm/drm: MAINTAINERS: update drm tree drm/etnaviv: bring back progress check in job timeout handler drm/etnaviv: Fix driver unregistering drm/etnaviv: Check for platform_device_register_simple() failure
2 parents 092150a + dc81aab commit 30c2c32

File tree

4 files changed

+49
-6
lines changed

4 files changed

+49
-6
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ W: https://www.infradead.org/~dhowells/kafs/
581581

582582
AGPGART DRIVER
583583
M: David Airlie <[email protected]>
584-
T: git git://people.freedesktop.org/~airlied/linux (part of drm maint)
584+
T: git git://anongit.freedesktop.org/drm/drm
585585
S: Maintained
586586
F: drivers/char/agp/
587587
F: include/linux/agp*
@@ -4630,7 +4630,7 @@ F: include/uapi/drm/vmwgfx_drm.h
46304630
DRM DRIVERS
46314631
M: David Airlie <[email protected]>
46324632
4633-
T: git git://people.freedesktop.org/~airlied/linux
4633+
T: git git://anongit.freedesktop.org/drm/drm
46344634
B: https://bugs.freedesktop.org/
46354635
C: irc://chat.freenode.net/dri-devel
46364636
S: Maintained

drivers/gpu/drm/etnaviv/etnaviv_drv.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,11 @@ static struct platform_driver etnaviv_platform_driver = {
631631
},
632632
};
633633

634+
static struct platform_device *etnaviv_drm;
635+
634636
static int __init etnaviv_init(void)
635637
{
638+
struct platform_device *pdev;
636639
int ret;
637640
struct device_node *np;
638641

@@ -644,7 +647,7 @@ static int __init etnaviv_init(void)
644647

645648
ret = platform_driver_register(&etnaviv_platform_driver);
646649
if (ret != 0)
647-
platform_driver_unregister(&etnaviv_gpu_driver);
650+
goto unregister_gpu_driver;
648651

649652
/*
650653
* If the DT contains at least one available GPU device, instantiate
@@ -653,20 +656,33 @@ static int __init etnaviv_init(void)
653656
for_each_compatible_node(np, NULL, "vivante,gc") {
654657
if (!of_device_is_available(np))
655658
continue;
656-
657-
platform_device_register_simple("etnaviv", -1, NULL, 0);
659+
pdev = platform_device_register_simple("etnaviv", -1,
660+
NULL, 0);
661+
if (IS_ERR(pdev)) {
662+
ret = PTR_ERR(pdev);
663+
of_node_put(np);
664+
goto unregister_platform_driver;
665+
}
666+
etnaviv_drm = pdev;
658667
of_node_put(np);
659668
break;
660669
}
661670

671+
return 0;
672+
673+
unregister_platform_driver:
674+
platform_driver_unregister(&etnaviv_platform_driver);
675+
unregister_gpu_driver:
676+
platform_driver_unregister(&etnaviv_gpu_driver);
662677
return ret;
663678
}
664679
module_init(etnaviv_init);
665680

666681
static void __exit etnaviv_exit(void)
667682
{
668-
platform_driver_unregister(&etnaviv_gpu_driver);
683+
platform_device_unregister(etnaviv_drm);
669684
platform_driver_unregister(&etnaviv_platform_driver);
685+
platform_driver_unregister(&etnaviv_gpu_driver);
670686
}
671687
module_exit(etnaviv_exit);
672688

drivers/gpu/drm/etnaviv/etnaviv_gpu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ struct etnaviv_gpu {
131131
struct work_struct sync_point_work;
132132
int sync_point_event;
133133

134+
/* hang detection */
135+
u32 hangcheck_dma_addr;
136+
134137
void __iomem *mmio;
135138
int irq;
136139

drivers/gpu/drm/etnaviv/etnaviv_sched.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "etnaviv_gem.h"
1111
#include "etnaviv_gpu.h"
1212
#include "etnaviv_sched.h"
13+
#include "state.xml.h"
1314

1415
static int etnaviv_job_hang_limit = 0;
1516
module_param_named(job_hang_limit, etnaviv_job_hang_limit, int , 0444);
@@ -85,6 +86,29 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
8586
{
8687
struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
8788
struct etnaviv_gpu *gpu = submit->gpu;
89+
u32 dma_addr;
90+
int change;
91+
92+
/*
93+
* If the GPU managed to complete this jobs fence, the timout is
94+
* spurious. Bail out.
95+
*/
96+
if (fence_completed(gpu, submit->out_fence->seqno))
97+
return;
98+
99+
/*
100+
* If the GPU is still making forward progress on the front-end (which
101+
* should never loop) we shift out the timeout to give it a chance to
102+
* finish the job.
103+
*/
104+
dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
105+
change = dma_addr - gpu->hangcheck_dma_addr;
106+
if (change < 0 || change > 16) {
107+
gpu->hangcheck_dma_addr = dma_addr;
108+
schedule_delayed_work(&sched_job->work_tdr,
109+
sched_job->sched->timeout);
110+
return;
111+
}
88112

89113
/* block scheduler */
90114
kthread_park(gpu->sched.thread);

0 commit comments

Comments
 (0)