m1n1.agx: Add printing IRQs

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2022-10-26 15:45:40 +09:00 committed by Hector Martin
parent 2fe37d6dfa
commit b4d5ff7520

View file

@ -36,6 +36,8 @@ class AGX:
self.log("Initializing allocations") self.log("Initializing allocations")
self.aic_base = u.adt["/arm-io/aic"].get_reg(0)[0]
self.all_objects = {} self.all_objects = {}
self.tracked_objects = {} self.tracked_objects = {}
@ -187,6 +189,14 @@ class AGX:
def kick_firmware(self): def kick_firmware(self):
self.asc.db.doorbell(0x10) self.asc.db.doorbell(0x10)
def show_irqs(self):
hw_state = self.aic_base + 0x4200
irqs = []
for irq in self.sgx_dev.interrupts:
v = int(bool((self.p.read32(hw_state + (irq // 32) * 4) & (1 << (irq % 32)))))
irqs.append(v)
self.log(f' SGX IRQ state: {irqs}')
def timeout(self, msg): def timeout(self, msg):
if self.mon: if self.mon:
self.mon.poll() self.mon.poll()
@ -206,6 +216,7 @@ class AGX:
self.log(f' Fault info:') self.log(f' Fault info:')
self.log(self.initdata.regionC.fault_info) self.log(self.initdata.regionC.fault_info)
self.show_irqs()
self.check_fault() self.check_fault()
self.recover() self.recover()
@ -227,6 +238,7 @@ class AGX:
self.log(f' Fault info:') self.log(f' Fault info:')
self.log(self.initdata.regionC.fault_info) self.log(self.initdata.regionC.fault_info)
self.show_irqs()
self.check_fault() self.check_fault()
self.recover() self.recover()
@ -275,8 +287,9 @@ class AGX:
status.resume.val = 1 status.resume.val = 1
else: else:
raise Exception("Cannot recover") raise Exception("Cannot recover")
self.show_irqs()
def start(self): def resume(self):
self.log("Starting ASC") self.log("Starting ASC")
self.asc.start() self.asc.start()
@ -284,6 +297,9 @@ class AGX:
self.asc.start_ep(0x20) self.asc.start_ep(0x20)
self.asc.start_ep(0x21) self.asc.start_ep(0x21)
def start(self):
self.resume()
self.init_channels() self.init_channels()
self.log("Building initdata") self.log("Building initdata")