#
✕ nick:marcan
#asahi · 2021-06-15 17:34
marcan(note the auto reg dump at the end)
#asahi · 2021-06-15 17:34
marcansample output: https://marcan.st/paste/N6fDRn02.txt
#asahi · 2021-06-15 17:33
marcansven, jannau & co: you might enjoy the new magic: https://github.com/AsahiLinux/m1n1/commit/9ff7566dc3f393b22c016951769fb1d724de6848
#asahi · 2021-06-15 15:23
marcanbloom: this is for that :p
#asahi · 2021-06-15 13:38
marcanI hope python metaclasses don't scare people off :-)
#asahi · 2021-06-15 12:25
marcanobviously the cache is somewhat best effort but I expect it will be useful
#asahi · 2021-06-15 12:25
marcanif you're in sync context, reading will give you current data (and update the cache, as will trace events from the guest)
#asahi · 2021-06-15 12:24
marcanif you're in async context, "reading" from the hardware will return values cached from previous mmiotrace data (which might be out of date, but is useful if we're doing whatever the guest did and beats nothing)
#asahi · 2021-06-15 12:24
marcanit's to avoid clobbering them
#asahi · 2021-06-15 12:24
marcanwe don't manage those from python so we never want to touch them
#asahi · 2021-06-15 12:23
marcanlike the vuart map
#asahi · 2021-06-15 12:23
marcanit's meant for when those are taken on the C side
#asahi · 2021-06-15 12:23
marcanRESERVED is a no-op
#asahi · 2021-06-15 12:23
marcanI'm also going to make the hardware regmap view behave differently depending on which context you're in
#asahi · 2021-06-15 12:22
marcanso for example, trigger on a GPU command submission and be able to dump the command buffer
#asahi · 2021-06-15 12:22
marcanyes
#asahi · 2021-06-15 12:21
marcanyou can only have one HOOK but as many SYNC or lower as you want for any given address
#asahi · 2021-06-15 12:21
marcanSYNC is the same thing behind the scenes, but you don't get to override anything; it behaves like a normal trace but is synchronous since the guest is suspended until it completes
#asahi · 2021-06-15 12:20
marcanwe only use that for those pmgr hijacks right now
#asahi · 2021-06-15 12:20
marcanHOOK is a virtual peripheral, it overrides the hardware read/write
#asahi · 2021-06-15 12:20
marcanand then a tracer class that will reference a regmap, and then just defining methods like SOMEREG_r() and SOMEREG_w() gives you mmiotrace hooks, with decorators to set modes like HOOK/SYNC/UNBUF
#asahi · 2021-06-15 12:19
marcanso I'm going to build a class that represents a peripheral register map (similar to Register32 but one level up) which can double as both metadata for mmiotrace and a general register accessor for convenience
#asahi · 2021-06-15 12:17
marcanj_ey: ah yes, thanks :)
#asahi · 2021-06-15 12:17
marcanUNBUF and ASYNC are normal mmiotrace, UNBUF is for the thing where the hv flushes the USB buffers after every write (mostly to get the thing through when the hv dies subsequently)
#asahi · 2021-06-15 12:17
marcanSYNC is actually the same as HOOK on the C side, but it's a synchronous mmiotrace hook. the core (or an overlying HOOK user) does the read/write synchronously and all the tracers are guaranteed to be called before the guest continues exceution
#asahi · 2021-06-15 12:16
marcanHOOK means a python-side virtual device hook (override). there can only be one user for any given address.
#asahi · 2021-06-15 12:15
marcanRESERVED is for vuart/vaic, it just overrides everything else and means it will never touch those mappings
#asahi · 2021-06-15 12:15
marcanwhich have priority in that order
#asahi · 2021-06-15 12:15
marcanso I have 5 modes for mapping/tracing now, RESERVED > HOOK > SYNC > UNBUF > ASYNC > NONE
#asahi · 2021-06-15 12:14
marcanso that's why I'm kind of reworking how this is all done
#asahi · 2021-06-15 12:14
marcanone issue we have is maintaining the page tables imperatively is very flaky; I want to be able to add/remove tracers and have the page tables updated as required to the union of what is needed, with multiple modes that stack, and also be able to spare C-side virtual peripherals (e.g. never clobber vuart/the aic hook)
#asahi · 2021-06-15 12:12
marcanI just wrote ScalarRangeMap and DictRangeMap (not pushed yet)
#asahi · 2021-06-15 12:12
marcanthat's why I made it a more generic base class
#asahi · 2021-06-15 12:12
marcanfor tracking page table modes, mmiotrace/hook modes, etc
#asahi · 2021-06-15 12:12
marcanthough I'm going to start using more of these
#asahi · 2021-06-15 12:11
marcanj_ey: mmio/address lookups
#asahi · 2021-06-15 11:40
marcanpossibly tomorrow, once I get to use this to build the mmiotrace/hook framework I have in my head
#asahi · 2021-06-15 11:40
marcanactually thought of it today, but data structures aren't the most interesting thing :p
#asahi · 2021-06-15 11:40
marcanFireFox317: I did one on saturday!
#asahi · 2021-06-15 10:53
marcanI also made it a more generic base class, eyeing a different way of keeping track of mmiotrace handlers/modes
#asahi · 2021-06-15 10:52
marcanit has a test now too :-)
#asahi · 2021-06-15 10:52
marcanjannau: ended up having to rewrite AddrLookup due to some issues, let me know what you think if you have a chance: https://github.com/AsahiLinux/m1n1/commit/48b4466abf6de6e149b887cad54c8fee5105899c
#asahi · 2021-06-13 17:02
marcanbut you can certainly set the default in 1TR
#asahi · 2021-06-13 17:01
marcanbloom: order of partitions in 1TR does seem to be random
#asahi · 2021-06-12 10:55
marcan(vuart will fail in python trying to find an interface that doesn't exist)
#asahi · 2021-06-12 10:55
marcanjannau: no, hv over uart is not supported
#asahi · 2021-06-12 09:12
marcanif it boots without it it can go away
#asahi · 2021-06-12 09:12
marcanjannau: might've been a bad guess, I was throwing things at the wall back then
#asahi · 2021-06-12 06:52
marcanjust added chapters to yesterday's stream: https://www.youtube.com/watch?v=igYgGH6PnOw
#asahi · 2021-06-10 15:18
marcanincluding things like redirecting sysregs to RAM

plus ›