From ad53766d22fd07bcdbd7b3fcfff05e1965f954e8 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Mon, 10 Apr 2023 23:24:32 +0900 Subject: [PATCH] m1n1.fw.asc.{crash, ioreporting}: Do not align prealloc buffer sizes On SMC on t602x, this is a small SRAM and we can run off the edge. Signed-off-by: Hector Martin --- proxyclient/m1n1/fw/asc/crash.py | 3 ++- proxyclient/m1n1/fw/asc/ioreporting.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/proxyclient/m1n1/fw/asc/crash.py b/proxyclient/m1n1/fw/asc/crash.py index 7f590c87..79773564 100644 --- a/proxyclient/m1n1/fw/asc/crash.py +++ b/proxyclient/m1n1/fw/asc/crash.py @@ -210,12 +210,13 @@ class ASCCrashLogEndpoint(ASCBaseEndpoint): return self.handle_getbuf(msg) def handle_getbuf(self, msg): - size = align(0x1000 * msg.SIZE, 0x4000) if msg.DVA: + size = 0x1000 * msg.SIZE self.iobuffer_dva = msg.DVA self.log(f"buf prealloc at dva {self.iobuffer_dva:#x}") else: + size = align(0x1000 * msg.SIZE, 0x4000) self.iobuffer, self.iobuffer_dva = self.asc.ioalloc(size) self.log(f"buf {self.iobuffer:#x} / {self.iobuffer_dva:#x}") self.send(CrashLogMessage(TYPE=1, SIZE=size // 0x1000, DVA=self.iobuffer_dva)) diff --git a/proxyclient/m1n1/fw/asc/ioreporting.py b/proxyclient/m1n1/fw/asc/ioreporting.py index f81b6c69..da24df0b 100644 --- a/proxyclient/m1n1/fw/asc/ioreporting.py +++ b/proxyclient/m1n1/fw/asc/ioreporting.py @@ -30,12 +30,13 @@ class ASCIOReportingEndpoint(ASCBaseEndpoint): if self.iobuffer: self.log("WARNING: trying to reset iobuffer!") - self.bufsize = align(0x1000 * msg.SIZE, 0x4000) if msg.DVA != 0: + self.bufsize = 0x1000 * msg.SIZE self.iobuffer = self.iobuffer_dva = msg.DVA - self.log(f"buf {self.iobuffer:#x} / {self.iobuffer_dva:#x}") + self.log(f"buf prealloc {self.iobuffer:#x} / {self.iobuffer_dva:#x}") else: + self.bufsize = align(0x1000 * msg.SIZE, 0x4000) self.iobuffer, self.iobuffer_dva = self.asc.ioalloc(self.bufsize) self.log(f"buf {self.iobuffer:#x} / {self.iobuffer_dva:#x}") self.send(IOReporting_GetBuf(DVA=self.iobuffer_dva, SIZE=self.bufsize // 0x1000))