android_kernel_samsung_sm8650/drivers/iommu/amd
Vasant Hegde 4a9d63181f iommu/amd/pgtbl_v2: Fix domain max address
commit 11c439a19466e7feaccdbce148a75372fddaf4e9 upstream.

IOMMU v2 page table supports 4 level (47 bit) or 5 level (56 bit) virtual
address space. Current code assumes it can support 64bit IOVA address
space. If IOVA allocator allocates virtual address > 47/56 bit (depending
on page table level) then it will do wrong mapping and cause invalid
translation.

Hence adjust aperture size to use max address supported by the page table.

Reported-by: Jerry Snitselaar <jsnitsel@redhat.com>
Fixes: aaac38f614 ("iommu/amd: Initial support for AMD IOMMU v2 page table")
Cc: <Stable@vger.kernel.org>  # v6.0+
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20230518054351.9626-1-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
[ Modified to work with "V2 with 4 level page table" only - Vasant ]
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-09 10:34:28 +02:00
..
amd_iommu_types.h iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE 2023-05-11 23:03:04 +09:00
amd_iommu.h iommu/amd: Fix up merge conflict resolution 2023-06-09 10:34:00 +02:00
debugfs.c
init.c iommu/amd: Handle GALog overflows 2023-06-09 10:34:00 +02:00
io_pgtable_v2.c iommu/amd: Initial support for AMD IOMMU v2 page table 2022-09-07 16:12:35 +02:00
io_pgtable.c iommu/amd/io-pgtable: Implement unmap_pages io_pgtable_ops callback 2022-09-07 16:12:33 +02:00
iommu_v2.c iommu/amd: Fix pci device refcount leak in ppr_notifier() 2022-12-31 13:32:50 +01:00
iommu.c iommu/amd/pgtbl_v2: Fix domain max address 2023-06-09 10:34:28 +02:00
Kconfig iommu/dma: Clean up Kconfig 2022-09-07 14:46:59 +02:00
Makefile iommu/amd: Initial support for AMD IOMMU v2 page table 2022-09-07 16:12:35 +02:00
quirks.c iommu/amd: Include PCI segment ID when initialize IOMMU 2022-07-07 09:37:51 +02:00