OSDN Git Service

iommu/amd: Enforce 4k mapping for certain IOMMU data structures
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Thu, 5 Nov 2020 14:58:32 +0000 (14:58 +0000)
committerWill Deacon <will@kernel.org>
Mon, 23 Nov 2020 12:52:04 +0000 (12:52 +0000)
commit6d39bdee238f9799718653a9d4d61ebf2922e23d
treeb0e3ab5e5730bbde6358dc42f37f418cfeb8de5e
parent91c2c28d8de34815ea9bb4d16e9db7308ad33d3e
iommu/amd: Enforce 4k mapping for certain IOMMU data structures

AMD IOMMU requires 4k-aligned pages for the event log, the PPR log,
and the completion wait write-back regions. However, when allocating
the pages, they could be part of large mapping (e.g. 2M) page.
This causes #PF due to the SNP RMP hardware enforces the check based
on the page level for these data structures.

So, fix by calling set_memory_4k() on the allocated pages.

Fixes: c69d89aff393 ("iommu/amd: Use 4K page for completion wait write-back semaphore")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Link: https://lore.kernel.org/r/20201105145832.3065-1-suravee.suthikulpanit@amd.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/amd/init.c