On MacBookPros with switchable graphics, the firmware puts VRAM at MC
address 0 when the iGPU is enabled.  A later post (S3 resume, GPU
reset) moves VRAM back to the VBIOS default.  The SI fix resets and
posts the ASIC at load, so the driver uses the VBIOS layout from the
start:

  "drm/amdgpu: reset SI ASIC on MacBookPros with VRAM at 0"

No MacBookPro has a CIK GPU, and no affected CIK board is known.  Add
the same test to cik_need_reset_on_init(), so that SI, CIK and VI
handle this firmware layout in the same way.  gmc_v7_0 reads
MC_VM_FB_LOCATION once at init and does not reprogram it.  A CIK board
with VRAM at 0 therefore has the same problem as the SI boards.

After the reset, FB_BASE is not 0, so the new test does not fire again
on a module reload.

Only compile-tested.

Suggested-by: Alex Deucher <[email protected]>
Cc: [email protected]
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Maciej Kucharek <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/cik.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index d29991a4a..e1029239b 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1927,6 +1927,16 @@ static bool cik_need_reset_on_init(struct amdgpu_device 
*adev)
 {
        u32 clock_cntl, pc;
 
+       /*
+        * MacBookPros with switchable graphics put VRAM at 0 when the iGPU
+        * is enabled.  Any later post (S3 resume, GPU reset) moves it back to
+        * the vbios default, so reset and post on load to start with the
+        * vbios layout.
+        */
+       if (adev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
+           !(RREG32(mmMC_VM_FB_LOCATION) & MC_VM_FB_LOCATION__FB_BASE_MASK))
+               return true;
+
        if (adev->flags & AMD_IS_APU)
                return false;
 
-- 
2.55.0

Reply via email to