Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit c362f32a authored by Vasant Hegde's avatar Vasant Hegde Committed by Joerg Roedel
Browse files

iommu/amd: Invalidate cache before removing device from domain list

Commit 87a6f1f2

 ("iommu/amd: Introduce per-device domain ID to fix
potential TLB aliasing issue") introduced per device domain ID when
domain is configured with v2 page table. And in invalidation path, it
uses per device structure (dev_data->gcr3_info.domid) to get the domain ID.

In detach_device() path, current code tries to invalidate IOMMU cache
after removing dev_data from domain device list. This means when domain
is configured with v2 page table, amd_iommu_domain_flush_all() will not be
able to invalidate cache as device is already removed from domain device
list.

This is causing change domain tests (changing domain type from identity to DMA)
to fail with IO_PAGE_FAULT issue.

Hence invalidate cache and update DTE before updating data structures.

Reported-by: default avatarFahHean Lee <fahhean.lee@amd.com>
Reported-by: default avatarDheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Fixes: 87a6f1f2

 ("iommu/amd: Introduce per-device domain ID to fix potential TLB aliasing issue")
Tested-by: default avatarDheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Tested-by: default avatarSairaj Arun Kodilkar <sairaj.arunkodilkar@amd.com>
Tested-by: default avatarFahHean Lee <fahhean.lee@amd.com>
Signed-off-by: default avatarVasant Hegde <vasant.hegde@amd.com>
Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20240620060552.13984-1-vasant.hegde@amd.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent f2661062
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