Skip to content

Commit 6d00957

Browse files
authored
Merge pull request #3589 from chipsalliance/precise_tlb_perms
Support managers with < pageSize alignment
2 parents 2af9fe6 + bf6e57d commit 6d00957

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Diff for: src/main/scala/rocket/PTW.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ class PTW(n: Int)(implicit edge: TLEdgeOut, p: Parameters) extends CoreModule()(
552552
require(TLBPageLookup.homogeneous(edge.manager.managers, pgSize), s"All memory regions must be $pgSize-byte aligned")
553553
true.B
554554
} else {
555-
TLBPageLookup(edge.manager.managers, xLen, p(CacheBlockBytes), pgSize)(r_pte.ppn << pgIdxBits).homogeneous
555+
TLBPageLookup(edge.manager.managers, xLen, p(CacheBlockBytes), pgSize, xLen/8)(r_pte.ppn << pgIdxBits).homogeneous
556556
}
557557
}
558558
val pmaHomogeneous = pmaPgLevelHomogeneous(count)

Diff for: src/main/scala/rocket/TLB.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ class TLB(instruction: Boolean, lgMaxSize: Int, cfg: TLBConfig)(implicit edge: T
412412
pma.io.paddr := mpu_physaddr
413413
// todo: using DataScratchpad doesn't support cacheable.
414414
val cacheable = pma.io.resp.cacheable && (instruction || !usingDataScratchpad).B
415-
val homogeneous = TLBPageLookup(edge.manager.managers, xLen, p(CacheBlockBytes), BigInt(1) << pgIdxBits)(mpu_physaddr).homogeneous
415+
val homogeneous = TLBPageLookup(edge.manager.managers, xLen, p(CacheBlockBytes), BigInt(1) << pgIdxBits, 1 << lgMaxSize)(mpu_physaddr).homogeneous
416+
// In M mode, if access DM address(debug module program buffer)
416417
val deny_access_to_debug = mpu_priv <= PRV.M.U && p(DebugModuleKey).map(dmp => dmp.address.contains(mpu_physaddr)).getOrElse(false.B)
417418
val prot_r = pma.io.resp.r && !deny_access_to_debug && pmp.io.r
418419
val prot_w = pma.io.resp.w && !deny_access_to_debug && pmp.io.w

Diff for: src/main/scala/rocket/TLBPermissions.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ object TLBPageLookup
5151
}
5252

5353
// Unmapped memory is considered to be inhomogeneous
54-
def apply(managers: Seq[TLManagerParameters], xLen: Int, cacheBlockBytes: Int, pageSize: BigInt): UInt => TLBPermissions = {
54+
def apply(managers: Seq[TLManagerParameters], xLen: Int, cacheBlockBytes: Int, pageSize: BigInt, maxRequestBytes: Int): UInt => TLBPermissions = {
5555
require (isPow2(xLen) && xLen >= 8)
5656
require (isPow2(cacheBlockBytes) && cacheBlockBytes >= xLen/8)
5757
require (isPow2(pageSize) && pageSize >= cacheBlockBytes)
5858

5959
val xferSizes = TransferSizes(cacheBlockBytes, cacheBlockBytes)
60-
val allSizes = TransferSizes(1, cacheBlockBytes)
60+
val allSizes = TransferSizes(1, maxRequestBytes)
6161
val amoSizes = TransferSizes(4, xLen/8)
6262

6363
val permissions = managers.foreach { m =>

0 commit comments

Comments
 (0)