Commit 8e017973 authored by Vasant Hegde's avatar Vasant Hegde Committed by Joerg Roedel

iommu/amd: Enable Guest Translation before registering devices

IOMMU Guest Translation (GT) feature needs to be enabled before
invalidating guest translations (CMD_INV_IOMMU_PAGES with GN=1).

Currently GT feature is enabled after setting up interrupt handler.
So far it was fine as we were not invalidating guest page table
before this point.

Upcoming series will introduce per device GCR3 table and it will
invalidate guest pages after configuring. Hence move GT feature
enablement to early_enable_iommu().
Signed-off-by: default avatarVasant Hegde <vasant.hegde@amd.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240205115615.6053-3-vasant.hegde@amd.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent a6ffb9b3
...@@ -2769,6 +2769,7 @@ static void early_enable_iommu(struct amd_iommu *iommu) ...@@ -2769,6 +2769,7 @@ static void early_enable_iommu(struct amd_iommu *iommu)
iommu_enable_command_buffer(iommu); iommu_enable_command_buffer(iommu);
iommu_enable_event_buffer(iommu); iommu_enable_event_buffer(iommu);
iommu_set_exclusion_range(iommu); iommu_set_exclusion_range(iommu);
iommu_enable_gt(iommu);
iommu_enable_ga(iommu); iommu_enable_ga(iommu);
iommu_enable_xt(iommu); iommu_enable_xt(iommu);
iommu_enable_irtcachedis(iommu); iommu_enable_irtcachedis(iommu);
...@@ -2825,6 +2826,7 @@ static void early_enable_iommus(void) ...@@ -2825,6 +2826,7 @@ static void early_enable_iommus(void)
iommu_disable_irtcachedis(iommu); iommu_disable_irtcachedis(iommu);
iommu_enable_command_buffer(iommu); iommu_enable_command_buffer(iommu);
iommu_enable_event_buffer(iommu); iommu_enable_event_buffer(iommu);
iommu_enable_gt(iommu);
iommu_enable_ga(iommu); iommu_enable_ga(iommu);
iommu_enable_xt(iommu); iommu_enable_xt(iommu);
iommu_enable_irtcachedis(iommu); iommu_enable_irtcachedis(iommu);
...@@ -2838,10 +2840,8 @@ static void enable_iommus_v2(void) ...@@ -2838,10 +2840,8 @@ static void enable_iommus_v2(void)
{ {
struct amd_iommu *iommu; struct amd_iommu *iommu;
for_each_iommu(iommu) { for_each_iommu(iommu)
iommu_enable_ppr_log(iommu); iommu_enable_ppr_log(iommu);
iommu_enable_gt(iommu);
}
} }
static void enable_iommus_vapic(void) static void enable_iommus_vapic(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment