diff options
author | Dave Airlie <airlied@redhat.com> | 2010-07-14 22:13:50 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-08-01 20:00:09 -0400 |
commit | 4c712e6c7ef19e7e8e1f38b27bb65290def39b40 (patch) | |
tree | c2f5d3663f849f445ff1154762188904e0633c2d /drivers/gpu | |
parent | e376573f7267390f4e1bdc552564b6fb913bce76 (diff) |
drm/radeon/kms: check/restore sanity before doing anything else with GPU.
On systems using kexec, the new kernel is booted straight from the old kernel, without any warning to the graphics driver. So the GPU is basically left as-is in a running state, however the CPU side is completly reset.
Without stating the saneness of anyone using kexec on live systems, we should at least try not to crash the GPU. This patch resets 3 registers to 0 that could cause bad things to happen to the running system.
This allows kexec to work on a Power6/RN50 system.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r300.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r420.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r520.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_asic.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs400.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs600.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs690.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv515.c | 2 |
9 files changed, 42 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 5aa29952731..5d14732dc28 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3809,6 +3809,31 @@ void r100_fini(struct radeon_device *rdev) | |||
3809 | rdev->bios = NULL; | 3809 | rdev->bios = NULL; |
3810 | } | 3810 | } |
3811 | 3811 | ||
3812 | /* | ||
3813 | * Due to how kexec works, it can leave the hw fully initialised when it | ||
3814 | * boots the new kernel. However doing our init sequence with the CP and | ||
3815 | * WB stuff setup causes GPU hangs on the RN50 at least. So at startup | ||
3816 | * do some quick sanity checks and restore sane values to avoid this | ||
3817 | * problem. | ||
3818 | */ | ||
3819 | void r100_restore_sanity(struct radeon_device *rdev) | ||
3820 | { | ||
3821 | u32 tmp; | ||
3822 | |||
3823 | tmp = RREG32(RADEON_CP_CSQ_CNTL); | ||
3824 | if (tmp) { | ||
3825 | WREG32(RADEON_CP_CSQ_CNTL, 0); | ||
3826 | } | ||
3827 | tmp = RREG32(RADEON_CP_RB_CNTL); | ||
3828 | if (tmp) { | ||
3829 | WREG32(RADEON_CP_RB_CNTL, 0); | ||
3830 | } | ||
3831 | tmp = RREG32(RADEON_SCRATCH_UMSK); | ||
3832 | if (tmp) { | ||
3833 | WREG32(RADEON_SCRATCH_UMSK, 0); | ||
3834 | } | ||
3835 | } | ||
3836 | |||
3812 | int r100_init(struct radeon_device *rdev) | 3837 | int r100_init(struct radeon_device *rdev) |
3813 | { | 3838 | { |
3814 | int r; | 3839 | int r; |
@@ -3821,6 +3846,8 @@ int r100_init(struct radeon_device *rdev) | |||
3821 | radeon_scratch_init(rdev); | 3846 | radeon_scratch_init(rdev); |
3822 | /* Initialize surface registers */ | 3847 | /* Initialize surface registers */ |
3823 | radeon_surface_init(rdev); | 3848 | radeon_surface_init(rdev); |
3849 | /* sanity check some register to avoid hangs like after kexec */ | ||
3850 | r100_restore_sanity(rdev); | ||
3824 | /* TODO: disable VGA need to use VGA request */ | 3851 | /* TODO: disable VGA need to use VGA request */ |
3825 | /* BIOS*/ | 3852 | /* BIOS*/ |
3826 | if (!radeon_get_bios(rdev)) { | 3853 | if (!radeon_get_bios(rdev)) { |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 7e81db5eb80..3c34da0c899 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -1377,6 +1377,8 @@ int r300_init(struct radeon_device *rdev) | |||
1377 | /* Initialize surface registers */ | 1377 | /* Initialize surface registers */ |
1378 | radeon_surface_init(rdev); | 1378 | radeon_surface_init(rdev); |
1379 | /* TODO: disable VGA need to use VGA request */ | 1379 | /* TODO: disable VGA need to use VGA request */ |
1380 | /* restore some register to sane defaults */ | ||
1381 | r100_restore_sanity(rdev); | ||
1380 | /* BIOS*/ | 1382 | /* BIOS*/ |
1381 | if (!radeon_get_bios(rdev)) { | 1383 | if (!radeon_get_bios(rdev)) { |
1382 | if (ASIC_IS_AVIVO(rdev)) | 1384 | if (ASIC_IS_AVIVO(rdev)) |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index e6c89142bb4..59f7bccc5be 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -343,6 +343,8 @@ int r420_init(struct radeon_device *rdev) | |||
343 | /* Initialize surface registers */ | 343 | /* Initialize surface registers */ |
344 | radeon_surface_init(rdev); | 344 | radeon_surface_init(rdev); |
345 | /* TODO: disable VGA need to use VGA request */ | 345 | /* TODO: disable VGA need to use VGA request */ |
346 | /* restore some register to sane defaults */ | ||
347 | r100_restore_sanity(rdev); | ||
346 | /* BIOS*/ | 348 | /* BIOS*/ |
347 | if (!radeon_get_bios(rdev)) { | 349 | if (!radeon_get_bios(rdev)) { |
348 | if (ASIC_IS_AVIVO(rdev)) | 350 | if (ASIC_IS_AVIVO(rdev)) |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 34330df2848..213e2e0027a 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -230,6 +230,8 @@ int r520_init(struct radeon_device *rdev) | |||
230 | radeon_scratch_init(rdev); | 230 | radeon_scratch_init(rdev); |
231 | /* Initialize surface registers */ | 231 | /* Initialize surface registers */ |
232 | radeon_surface_init(rdev); | 232 | radeon_surface_init(rdev); |
233 | /* restore some register to sane defaults */ | ||
234 | r100_restore_sanity(rdev); | ||
233 | /* TODO: disable VGA need to use VGA request */ | 235 | /* TODO: disable VGA need to use VGA request */ |
234 | /* BIOS*/ | 236 | /* BIOS*/ |
235 | if (!radeon_get_bios(rdev)) { | 237 | if (!radeon_get_bios(rdev)) { |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index c0bbaa64157..a5aff755f0d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -113,6 +113,7 @@ void r100_wb_fini(struct radeon_device *rdev); | |||
113 | int r100_wb_init(struct radeon_device *rdev); | 113 | int r100_wb_init(struct radeon_device *rdev); |
114 | int r100_cp_reset(struct radeon_device *rdev); | 114 | int r100_cp_reset(struct radeon_device *rdev); |
115 | void r100_vga_render_disable(struct radeon_device *rdev); | 115 | void r100_vga_render_disable(struct radeon_device *rdev); |
116 | void r100_restore_sanity(struct radeon_device *rdev); | ||
116 | int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p, | 117 | int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p, |
117 | struct radeon_cs_packet *pkt, | 118 | struct radeon_cs_packet *pkt, |
118 | struct radeon_bo *robj); | 119 | struct radeon_bo *robj); |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 9e4240b3bf0..c178481101e 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -480,6 +480,8 @@ int rs400_init(struct radeon_device *rdev) | |||
480 | /* Initialize surface registers */ | 480 | /* Initialize surface registers */ |
481 | radeon_surface_init(rdev); | 481 | radeon_surface_init(rdev); |
482 | /* TODO: disable VGA need to use VGA request */ | 482 | /* TODO: disable VGA need to use VGA request */ |
483 | /* restore some register to sane defaults */ | ||
484 | r100_restore_sanity(rdev); | ||
483 | /* BIOS*/ | 485 | /* BIOS*/ |
484 | if (!radeon_get_bios(rdev)) { | 486 | if (!radeon_get_bios(rdev)) { |
485 | if (ASIC_IS_AVIVO(rdev)) | 487 | if (ASIC_IS_AVIVO(rdev)) |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 27d2e706c65..c5760921d16 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -879,6 +879,8 @@ int rs600_init(struct radeon_device *rdev) | |||
879 | radeon_scratch_init(rdev); | 879 | radeon_scratch_init(rdev); |
880 | /* Initialize surface registers */ | 880 | /* Initialize surface registers */ |
881 | radeon_surface_init(rdev); | 881 | radeon_surface_init(rdev); |
882 | /* restore some register to sane defaults */ | ||
883 | r100_restore_sanity(rdev); | ||
882 | /* BIOS */ | 884 | /* BIOS */ |
883 | if (!radeon_get_bios(rdev)) { | 885 | if (!radeon_get_bios(rdev)) { |
884 | if (ASIC_IS_AVIVO(rdev)) | 886 | if (ASIC_IS_AVIVO(rdev)) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 23676b659e6..3dde54d57d0 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -707,6 +707,8 @@ int rs690_init(struct radeon_device *rdev) | |||
707 | radeon_scratch_init(rdev); | 707 | radeon_scratch_init(rdev); |
708 | /* Initialize surface registers */ | 708 | /* Initialize surface registers */ |
709 | radeon_surface_init(rdev); | 709 | radeon_surface_init(rdev); |
710 | /* restore some register to sane defaults */ | ||
711 | r100_restore_sanity(rdev); | ||
710 | /* TODO: disable VGA need to use VGA request */ | 712 | /* TODO: disable VGA need to use VGA request */ |
711 | /* BIOS*/ | 713 | /* BIOS*/ |
712 | if (!radeon_get_bios(rdev)) { | 714 | if (!radeon_get_bios(rdev)) { |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 7d9a7b0a180..3f04f735dea 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -468,6 +468,8 @@ int rv515_init(struct radeon_device *rdev) | |||
468 | /* Initialize surface registers */ | 468 | /* Initialize surface registers */ |
469 | radeon_surface_init(rdev); | 469 | radeon_surface_init(rdev); |
470 | /* TODO: disable VGA need to use VGA request */ | 470 | /* TODO: disable VGA need to use VGA request */ |
471 | /* restore some register to sane defaults */ | ||
472 | r100_restore_sanity(rdev); | ||
471 | /* BIOS*/ | 473 | /* BIOS*/ |
472 | if (!radeon_get_bios(rdev)) { | 474 | if (!radeon_get_bios(rdev)) { |
473 | if (ASIC_IS_AVIVO(rdev)) | 475 | if (ASIC_IS_AVIVO(rdev)) |