]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.175/iommu-amd-set-exclusion-range-correctly.patch
drop xtensa-fix-initialization-of-pt_regs-syscall-in-star.patch from most trees
[thirdparty/kernel/stable-queue.git] / releases / 4.9.175 / iommu-amd-set-exclusion-range-correctly.patch
1 From c5a45c25141ee6be666e25c122bfc00a94057e11 Mon Sep 17 00:00:00 2001
2 From: Joerg Roedel <jroedel@suse.de>
3 Date: Fri, 12 Apr 2019 12:50:31 +0200
4 Subject: iommu/amd: Set exclusion range correctly
5
6 [ Upstream commit 3c677d206210f53a4be972211066c0f1cd47fe12 ]
7
8 The exlcusion range limit register needs to contain the
9 base-address of the last page that is part of the range, as
10 bits 0-11 of this register are treated as 0xfff by the
11 hardware for comparisons.
12
13 So correctly set the exclusion range in the hardware to the
14 last page which is _in_ the range.
15
16 Fixes: b2026aa2dce44 ('x86, AMD IOMMU: add functions for programming IOMMU MMIO space')
17 Signed-off-by: Joerg Roedel <jroedel@suse.de>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 ---
20 drivers/iommu/amd_iommu_init.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23 diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
24 index 157e93421fb81..13bbe5795e4e4 100644
25 --- a/drivers/iommu/amd_iommu_init.c
26 +++ b/drivers/iommu/amd_iommu_init.c
27 @@ -318,7 +318,7 @@ static void iommu_write_l2(struct amd_iommu *iommu, u8 address, u32 val)
28 static void iommu_set_exclusion_range(struct amd_iommu *iommu)
29 {
30 u64 start = iommu->exclusion_start & PAGE_MASK;
31 - u64 limit = (start + iommu->exclusion_length) & PAGE_MASK;
32 + u64 limit = (start + iommu->exclusion_length - 1) & PAGE_MASK;
33 u64 entry;
34
35 if (!iommu->exclusion_start)
36 --
37 2.20.1
38