bring back getting framebuffer size from efifb (rev 1.3)
authorjsg <jsg@openbsd.org>
Tue, 29 Mar 2022 02:15:51 +0000 (02:15 +0000)
committerjsg <jsg@openbsd.org>
Tue, 29 Mar 2022 02:15:51 +0000 (02:15 +0000)
avoids the following on BESSTAR TECH HM90 with Ryzen 9 4900H (renoir)
reported by Fredrik Engberg

drm:pid0:gmc_v9_0_process_interrupt *ERROR* [mmhub0] no-retry page fault (src_id:0 ring:158 vmid:0 pasid:0, for process  pid 0 thread pid 0)
drm:pid0:gmc_v9_0_process_interrupt *ERROR*   in page starting at address 0x0000000000561000 from IH client 0x12 (VMC)
drm:pid0:gmc_v9_0_process_interrupt *ERROR* VM_L2_PROTECTION_FAULT_STATUS:0x00003B3C
drm:pid0:gmc_v9_0_process_interrupt *ERROR* Faulty UTCL2 client ID: VCNU (0x1d)
drm:pid0:gmc_v9_0_process_interrupt *ERROR* MORE_FAULTS: 0x0
drm:pid0:gmc_v9_0_process_interrupt *ERROR* WALKER_ERROR: 0x6
drm:pid0:gmc_v9_0_process_interrupt *ERROR* PERMISSION_FAULTS: 0x3
drm:pid0:gmc_v9_0_process_interrupt *ERROR* MAPPING_ERROR: 0x1
drm:pid0:gmc_v9_0_process_interrupt *ERROR* RW: 0x0
[drm] *ERROR* ring vcn_dec test failed (-60)
[drm] *ERROR* hw_init of IP block <vcn_v2_0> failed -60
drm:pid0:amdgpu_device_init *ERROR* amdgpu_device_ip_init failed
drm:pid0:amdgpu_attachhook *ERROR* Fatal error during GPU init

sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c

index 82706b5..a8e4e89 100644 (file)
@@ -704,6 +704,15 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
        } else {
                size = amdgpu_gmc_get_vbios_fb_size(adev);
 
+#ifdef __amd64__
+               /*
+                * XXX Workaround for machines where the framebuffer
+                * size reported by the hardware is incorrect.
+                */
+               extern psize_t efifb_stolen();
+               size = max(size, efifb_stolen());
+#endif
+
                if (adev->mman.keep_stolen_vga_memory)
                        size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION);
        }