From ca7d52ebc081300885953199a5a64a5b926422c7 Mon Sep 17 00:00:00 2001 From: Michiel van Tol Date: Wed, 13 Nov 2019 17:01:14 +0000 Subject: [PATCH] dev-arm: Fix SMMUv3 walkMasks in page table ops The masks did not include the high bits above the active addressing bits. This could cause overlapping issues when using high addresses. (Translated with TTBR1) Change-Id: Ib705558aac456c1b3f069e1bd3ccdd9229a1c1d2 Reviewed-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23764 Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/dev/arm/smmu_v3_ptops.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dev/arm/smmu_v3_ptops.cc b/src/dev/arm/smmu_v3_ptops.cc index 05c8bc022..569b59e8a 100644 --- a/src/dev/arm/smmu_v3_ptops.cc +++ b/src/dev/arm/smmu_v3_ptops.cc @@ -114,9 +114,9 @@ Addr V7LPageTableOps::walkMask(unsigned level) const { switch (level) { - case 1: return mask(39, 30); - case 2: return mask(39, 21); - case 3: return mask(39, 12); + case 1: return ~mask(30); + case 2: return ~mask(21); + case 3: return ~mask(12); default: panic("bad level %d", level); } } @@ -207,10 +207,10 @@ Addr V8PageTableOps4k::walkMask(unsigned level) const { switch (level) { - case 0: return mask(47, 39); - case 1: return mask(47, 30); - case 2: return mask(47, 21); - case 3: return mask(47, 12); + case 0: return ~mask(39); + case 1: return ~mask(30); + case 2: return ~mask(21); + case 3: return ~mask(12); default: panic("bad level %d", level); } } @@ -401,9 +401,9 @@ Addr V8PageTableOps64k::walkMask(unsigned level) const { switch (level) { - case 1: return mask(47, 42); - case 2: return mask(47, 29); - case 3: return mask(47, 16); + case 1: return ~mask(42); + case 2: return ~mask(29); + case 3: return ~mask(16); default: panic("bad level %d", level); } } -- 2.30.2