Bug 218975

Summary: [6.10-rc3 and rc4] When AMD IOMMU is enabled, PC can't wake up from suspend
Product: Drivers Reporter: Błażej Szczygieł (mumei6102)
Component: IOMMUAssignee: drivers_iommu
Status: RESOLVED CODE_FIX    
Severity: normal CC: mario.limonciello, regressions, vasant.hegde, W_Armin
Priority: P3    
Hardware: AMD   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:
Attachments: iommu/amd: Fix GT feature enablement again

Description Błażej Szczygieł 2024-06-20 22:21:49 UTC
When I use `iommu=pt` or `iommu=soft` I can't wake up my PC from suspend. Tested on two AMD platforms:

- Ryzen 7950X with Radeon RX6900 XT and iommu=pt
- Ryzen 2500U with Radeon RX Vega 8 and iommu=soft

Behavior changed between 6.10-rc1 and 6.10-rc4, but it's still not working correctly.

Original bug report (with logs): https://gitlab.freedesktop.org/drm/amd/-/issues/3435
Comment 1 Mario Limonciello (AMD) 2024-06-21 01:20:42 UTC
Just to be clear in this bug - this is a regression from 6.9.y to 6.10-rc1.

Błażej,

With *no* iommu parameters does 6.9.y work?  Or did you previously add those parameters because of some issue?

Does 6.10-rc1 work with no parameters?
Comment 2 Vasant Hegde 2024-06-21 04:39:04 UTC
Thanks for the bug report. 

Looking into gitlab report I am bit confused.

1 - What is the exact behaviour with v6.10-rc4 kernel? Do you still see ILLEGAL_DEV_TABLE_ENTRY  with rc4 kernel?

2 - Can you add amd_iommu_dump=1 to kernel command line, get me the full dmesg (before suspend test also fine). So that I can compare EFR advertised VS DTE and see anything I missed.

-Vasant
Comment 3 Vasant Hegde 2024-06-21 04:40:45 UTC
Unfortunately I don't have HW handy to reproduce this issue. I will check internally and see if I can get something to test.

I am looking into AMD IOMMU driver changes. We have not done any suspend/resume specific changes. Nothing is striking me immediately. I will continue to dig further and will keep this bug updated.

-Vasant
Comment 4 Vasant Hegde 2024-06-21 05:21:35 UTC
Created attachment 306481 [details]
iommu/amd: Fix GT feature enablement again
Comment 5 Vasant Hegde 2024-06-21 05:22:37 UTC
My bad. I was trying to workaround the broken BIOS and looks like I broke the resume path :-( 

Can you apply attached patch on top of -rc4 and test it please?

-Vasant
Comment 6 Błażej Szczygieł 2024-06-21 08:44:53 UTC
Vasant, thanks for the patch. Applied on top of -rc4 and tested on 2 machines (configuration mentioned in bug description). Suspend is now working correctly!
Comment 7 Vasant Hegde 2024-06-21 10:17:08 UTC
Thanks for testing. I have sent patch to upstream with your Reported-by and Tested-by tag.

[1] https://lore.kernel.org/linux-iommu/20240621101533.20216-1-vasant.hegde@amd.com/T/#u

-Vasant
Comment 8 Błażej Szczygieł 2024-06-21 11:40:15 UTC
Thanks!

// Forgot to change email here earlier, but it doesn't really matter.
Comment 9 Armin Wolf 2024-06-22 06:40:23 UTC
Hi,

i just wanted to add that this patch also fixes the suspend issue on my machine (Ryten 5 7600, Radeon RX6600), which was introduced with 6.10-rc1.

Thanks!
Comment 10 Vasant Hegde 2024-06-24 06:33:14 UTC
(In reply to Armin Wolf from comment #9)
> Hi,
> 
> i just wanted to add that this patch also fixes the suspend issue on my
> machine (Ryten 5 7600, Radeon RX6600), which was introduced with 6.10-rc1.
> 

Thanks Armin.

-Vasant