Skip to content

Commit 5cc1816

Browse files
hegdevasantmehmetb0
authored andcommitted
iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path
BugLink: https://bugs.launchpad.net/bugs/2104873 [ Upstream commit ef75966 ] With recent kernel, AMDGPU failed to resume after suspend on certain laptop. Sample log: ----------- Nov 14 11:52:19 Thinkbook kernel: iommu ivhd0: AMD-Vi: Event logged [ILLEGAL_DEV_TABLE_ENTRY device=0000:06:00.0 pasid=0x00000 address=0x135300000 flags=0x0080] Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[0]: 7d90000000000003 Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[1]: 0000100103fc0009 Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[2]: 2000000117840013 Nov 14 11:52:19 Thinkbook kernel: AMD-Vi: DTE[3]: 0000000000000000 This is because in resume path, CNTRL[EPHEn] is not set. Fix this by setting CNTRL[EPHEn] to 1 in resume path if EFR[EPHSUP] is set. Note May be better approach is to save the control register in suspend path and restore it in resume path instead of trying to set indivisual bits. We will have separate patch for that. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219499 Fixes: c4cb231 ("iommu/amd: Add support for enable/disable IOPF") Tested-by: Hamish McIntyre-Bhatty <kernel-bugzilla@regd.hamishmb.com> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Link: https://lore.kernel.org/r/20250127094411.5931-1-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Noah Wager <noah.wager@canonical.com>
1 parent f803feb commit 5cc1816

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
#define CONTROL_GAM_EN 25
180180
#define CONTROL_GALOG_EN 28
181181
#define CONTROL_GAINT_EN 29
182+
#define CONTROL_EPH_EN 45
182183
#define CONTROL_XT_EN 50
183184
#define CONTROL_INTCAPXT_EN 51
184185
#define CONTROL_IRTCACHEDIS 59

drivers/iommu/amd/init.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,6 +2647,10 @@ static void iommu_init_flags(struct amd_iommu *iommu)
26472647

26482648
/* Set IOTLB invalidation timeout to 1s */
26492649
iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);
2650+
2651+
/* Enable Enhanced Peripheral Page Request Handling */
2652+
if (check_feature(FEATURE_EPHSUP))
2653+
iommu_feature_enable(iommu, CONTROL_EPH_EN);
26502654
}
26512655

26522656
static void iommu_apply_resume_quirks(struct amd_iommu *iommu)

0 commit comments

Comments
 (0)