* [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path
@ 2025-01-27 9:44 Vasant Hegde
2025-02-05 9:53 ` Vasant Hegde
2025-02-10 13:51 ` Joerg Roedel
0 siblings, 2 replies; 3+ messages in thread
From: Vasant Hegde @ 2025-01-27 9:44 UTC (permalink / raw)
To: iommu, joro; +Cc: suravee.suthikulpanit, Vasant Hegde, Hamish McIntyre-Bhatty
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: c4cb2311110 ("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>
---
drivers/iommu/amd/amd_iommu_types.h | 1 +
drivers/iommu/amd/init.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
index 0bbda60d3cdc..23caea22f8dc 100644
--- a/drivers/iommu/amd/amd_iommu_types.h
+++ b/drivers/iommu/amd/amd_iommu_types.h
@@ -175,6 +175,7 @@
#define CONTROL_GAM_EN 25
#define CONTROL_GALOG_EN 28
#define CONTROL_GAINT_EN 29
+#define CONTROL_EPH_EN 45
#define CONTROL_XT_EN 50
#define CONTROL_INTCAPXT_EN 51
#define CONTROL_IRTCACHEDIS 59
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index c5cd92edada0..438848b0682f 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -2653,6 +2653,10 @@ static void iommu_init_flags(struct amd_iommu *iommu)
/* Set IOTLB invalidation timeout to 1s */
iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);
+
+ /* Enable Enhanced Peripheral Page Request Handling */
+ if (check_feature(FEATURE_EPHSUP))
+ iommu_feature_enable(iommu, CONTROL_EPH_EN);
}
static void iommu_apply_resume_quirks(struct amd_iommu *iommu)
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path
2025-01-27 9:44 [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path Vasant Hegde
@ 2025-02-05 9:53 ` Vasant Hegde
2025-02-10 13:51 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Vasant Hegde @ 2025-02-05 9:53 UTC (permalink / raw)
To: iommu, joro; +Cc: suravee.suthikulpanit, Hamish McIntyre-Bhatty
Hi Joerg,
Ping. Since this is the Fix, can you please pick this for -rc ?
-Vasant
On 1/27/2025 3:14 PM, Vasant Hegde wrote:
> 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: c4cb2311110 ("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>
> ---
> drivers/iommu/amd/amd_iommu_types.h | 1 +
> drivers/iommu/amd/init.c | 4 ++++
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
> index 0bbda60d3cdc..23caea22f8dc 100644
> --- a/drivers/iommu/amd/amd_iommu_types.h
> +++ b/drivers/iommu/amd/amd_iommu_types.h
> @@ -175,6 +175,7 @@
> #define CONTROL_GAM_EN 25
> #define CONTROL_GALOG_EN 28
> #define CONTROL_GAINT_EN 29
> +#define CONTROL_EPH_EN 45
> #define CONTROL_XT_EN 50
> #define CONTROL_INTCAPXT_EN 51
> #define CONTROL_IRTCACHEDIS 59
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index c5cd92edada0..438848b0682f 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -2653,6 +2653,10 @@ static void iommu_init_flags(struct amd_iommu *iommu)
>
> /* Set IOTLB invalidation timeout to 1s */
> iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);
> +
> + /* Enable Enhanced Peripheral Page Request Handling */
> + if (check_feature(FEATURE_EPHSUP))
> + iommu_feature_enable(iommu, CONTROL_EPH_EN);
> }
>
> static void iommu_apply_resume_quirks(struct amd_iommu *iommu)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path
2025-01-27 9:44 [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path Vasant Hegde
2025-02-05 9:53 ` Vasant Hegde
@ 2025-02-10 13:51 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2025-02-10 13:51 UTC (permalink / raw)
To: Vasant Hegde; +Cc: iommu, suravee.suthikulpanit, Hamish McIntyre-Bhatty
Applied, thanks Vasant.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-10 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-27 9:44 [PATCH] iommu/amd: Expicitly enable CNTRL.EPHEn bit in resume path Vasant Hegde
2025-02-05 9:53 ` Vasant Hegde
2025-02-10 13:51 ` Joerg Roedel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.