Commit 457e77b26428ab4a24998eecfb99f27fa4195397
1 parent
420b946977
Exists in
master
and in
13 other branches
drm/nouveau/bios: add more checks to PRAMIN image fetching
Prevents an attempt to access VRAM on an un-posted board, which, on a particular system with a GRID K1 installed, causes a MCE and chokes the entire system. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff
drivers/gpu/drm/nouveau/core/subdev/bios/base.c
... | ... | @@ -99,7 +99,17 @@ |
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - addr = (u64)(nv_rd32(bios, 0x619f04) & 0xffffff00) << 8; | |
102 | + addr = nv_rd32(bios, 0x619f04); | |
103 | + if (!(addr & 0x00000008)) { | |
104 | + nv_debug(bios, "... not enabled\n"); | |
105 | + return; | |
106 | + } | |
107 | + if ( (addr & 0x00000003) != 1) { | |
108 | + nv_debug(bios, "... not in vram\n"); | |
109 | + return; | |
110 | + } | |
111 | + | |
112 | + addr = (u64)(addr >> 8) << 8; | |
103 | 113 | if (!addr) { |
104 | 114 | addr = (u64)nv_rd32(bios, 0x001700) << 16; |
105 | 115 | addr += 0xf0000; |