* [PATCH] iommu/amd: Enable Guest Translation after reading IOMMU feature register
@ 2024-05-06 8:20 Vasant Hegde
2024-05-06 8:25 ` Joerg Roedel
0 siblings, 1 reply; 2+ messages in thread
From: Vasant Hegde @ 2024-05-06 8:20 UTC (permalink / raw)
To: iommu, joro; +Cc: suravee.suthikulpanit, Vasant Hegde, Klara Modin
Commit 8e0179733172 ("iommu/amd: Enable Guest Translation before
registering devices") moved IOMMU Guest Translation (GT) enablement to
early init path. It does feature check based on Global EFR value (got from
ACPI IVRS table). Later it adjusts EFR value based on IOMMU feature
register (late_iommu_features_init()).
It seems in some systems BIOS doesn't set gloabl EFR value properly.
This is causing mismatch. Hence move IOMMU GT enablement after
late_iommu_features_init() so that it does check based on IOMMU EFR
value.
Link: https://lore.kernel.org/linux-iommu/333e6eb6-361c-4afb-8107-2573324bf689@gmail.com/
Fixes: 8e0179733172 ("iommu/amd: Enable Guest Translation before registering devices")
Reported-by: Klara Modin <klarasmodin@gmail.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Tested-by: Klara Modin <klarasmodin@gmail.com>
---
drivers/iommu/amd/init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index fd3e76e43699..b292181995b7 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -2046,6 +2046,8 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
amd_iommu_max_glx_val = glxval;
else
amd_iommu_max_glx_val = min(amd_iommu_max_glx_val, glxval);
+
+ iommu_enable_gt(iommu);
}
if (check_feature(FEATURE_PPR) && amd_iommu_alloc_ppr_log(iommu))
@@ -2732,7 +2734,6 @@ static void early_enable_iommu(struct amd_iommu *iommu)
iommu_enable_command_buffer(iommu);
iommu_enable_event_buffer(iommu);
iommu_set_exclusion_range(iommu);
- iommu_enable_gt(iommu);
iommu_enable_ga(iommu);
iommu_enable_xt(iommu);
iommu_enable_irtcachedis(iommu);
@@ -2789,7 +2790,6 @@ static void early_enable_iommus(void)
iommu_disable_irtcachedis(iommu);
iommu_enable_command_buffer(iommu);
iommu_enable_event_buffer(iommu);
- iommu_enable_gt(iommu);
iommu_enable_ga(iommu);
iommu_enable_xt(iommu);
iommu_enable_irtcachedis(iommu);
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/amd: Enable Guest Translation after reading IOMMU feature register
2024-05-06 8:20 [PATCH] iommu/amd: Enable Guest Translation after reading IOMMU feature register Vasant Hegde
@ 2024-05-06 8:25 ` Joerg Roedel
0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2024-05-06 8:25 UTC (permalink / raw)
To: Vasant Hegde; +Cc: iommu, suravee.suthikulpanit, Klara Modin
On Mon, May 06, 2024 at 08:20:39AM +0000, Vasant Hegde wrote:
> Commit 8e0179733172 ("iommu/amd: Enable Guest Translation before
> registering devices") moved IOMMU Guest Translation (GT) enablement to
> early init path. It does feature check based on Global EFR value (got from
> ACPI IVRS table). Later it adjusts EFR value based on IOMMU feature
> register (late_iommu_features_init()).
>
> It seems in some systems BIOS doesn't set gloabl EFR value properly.
> This is causing mismatch. Hence move IOMMU GT enablement after
> late_iommu_features_init() so that it does check based on IOMMU EFR
> value.
>
> Link: https://lore.kernel.org/linux-iommu/333e6eb6-361c-4afb-8107-2573324bf689@gmail.com/
> Fixes: 8e0179733172 ("iommu/amd: Enable Guest Translation before registering devices")
> Reported-by: Klara Modin <klarasmodin@gmail.com>
> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
> Tested-by: Klara Modin <klarasmodin@gmail.com>
> ---
> drivers/iommu/amd/init.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Wow, that was quick. Applied now, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-06 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 8:20 [PATCH] iommu/amd: Enable Guest Translation after reading IOMMU feature register Vasant Hegde
2024-05-06 8:25 ` 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.