Commit graph

863 commits

Author SHA1 Message Date
Martin Povišer
e1b50f9ced experiments/aop.py: Bring up AOP
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:27:04 +09:00
Martin Povišer
d924c97a0c tools/second_proxy.py: Add setup of second proxy stream
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
e78cd14fee experiments/mmio_sweep.py: Add MMIO sweep tool
Tool can do blanket sweep or isolate ranges associated with a power
domain.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
96d4b5dd07 m1n1.proxyutils: Fortify against non-working disassembler
If not caught it can lead to an ugly crash...

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
d040e61aa8 m1n1.hw.admac: Add UNK4 report flag
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
f0ff2e9eaf m1n1.hw.admac: Do without an ADT node
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
38ca45816f m1n1.hw.admac: Support early poll() exit
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
f353017ac6 m1n1.hw.loadobjs: Accept queer call methods
Let user specify a call method to use on symbols.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
dcc75ab4f1 m1n1.hw.mca: Document the feedback disable
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
9e32a75bc6 experiments/speaker_amp.py: Remove dead power-domain call
/arm-io/mca0 doesn't have a PD (instead /arm-io/mca-switch has the MCA0
domain).

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
2579a97fde m1n1.loadobjs: Avoid pasting paths into cmdline strings
Do not go through a formatted cmdline string when invoking tools. There
are user-controlled paths involved which can contain spaces (and other
foul characters).

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Martin Povišer
72c6170ee8 m1n1.loadobjs: Support loading of inline C snippets
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Hector Martin
9212ac2036 m1n1.hw.asc: Add more mailbox control fields
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 23:23:37 +09:00
Janne Grunau
12db5c3910 tools/reset_panic_counter.py: Use ADT to support t600x
In addition make it executable and add python shebang as for the other
tools.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:56:43 +09:00
Janne Grunau
8a90ced4b4 tools/reset_panic_counter.py: minor fixes
- add SPDX-License-Identifier
 - make it executable
 - add python shebang
 - remove unused import

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:56:43 +09:00
Sven Peter
afe9c9bb16 proxyclient: add AES experiment
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-05-30 22:54:50 +09:00
Sven Peter
ee045af977 proxyclient: add AES registers
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-05-30 22:54:50 +09:00
Janne Grunau
8c82a7cb92 m1n1.fw.dcp.ipc: Add Call/Callbacks observed while tracing macos 12.3
Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:49:00 +09:00
Janne Grunau
5ef9197edc m1n1.fw.dcp.ipc: Annotate 'swap_complete_ap_gated' arguments
Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:49:00 +09:00
Janne Grunau
8119130e88 hv/trace_dcp.py: update to mac OS 12.3 API
Verified calls A000 through A358 due to inconsistencies in the trace
log for A104 and A105.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:49:00 +09:00
Janne Grunau
8366bcd859 m1n1.fw.dcp.ipc: Update struct sizes to macos 12.3 firmware
Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 22:49:00 +09:00
Akihiko Odaki
4a67fbe10e m1n1.shell: Don't save history if init failed
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
2022-05-30 22:48:40 +09:00
Akihiko Odaki
3440aadc3c proxy: Specify coordinates in fb_fill method
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
2022-05-30 22:47:26 +09:00
Hector Martin
45ac8633bd m1n1.shell: Don't print bools as hex
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 22:38:30 +09:00
Hector Martin
e9080b8139 hv: Don't allow lower() on non-fault states
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 22:38:11 +09:00
Hector Martin
984b22cd51 m1n1.hv,proxyutils: Refactor how faults are printed re: context
Instead of directly taking a proxy entry code to determine what to
decode, just take an is_fault argument and only show and decode ESR/FAR
if true.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 22:36:37 +09:00
Hector Martin
7c5d47ff85 m1n1.hv: Use hv.run_shell() everywhere
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 22:35:49 +09:00
Hector Martin
8eeb7966aa hv: Refactor CPU switch logic, make hv.cpu() not exit shell
Get rid of the hv_rearm() thing (which was always a bit dodgy) and
instead properly make sure that all CPUs rendezvous when needed and
switch the active proxy thread without ever exiting exception context.

The Python side can now switch proxy context (by waiting directly for
a proxy boot) without having to exit out of the hypervisor callback,
so cpu() now works as a normal Python method.

Add a cpus() iterator so you can do things like:

>>> for i in cpus(): bt()

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 22:33:44 +09:00
Hector Martin
01a1a0f597 hv: Make time stealing run-time configurable
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-05-30 19:37:23 +09:00
R
dd111b22b8 prores: test 36-bit iova; fix tracer
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
8406d44db3 prores: some cleanups
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
fb968ef3fe prores: figure out output size
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
2cc5c9488f prores: rename some variables
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
200bdf9ce6 prores: figure out alpha
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
270da3849b prores: input format / chroma flags
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
b95baad365 prores: figure out offset
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
846b1cb37b prores: get data into block the correct way
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
fbd63c4bc7 prores: legible image with wrong colors
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
6986aa9c81 prores: sizes are less huge now
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
da6c8379fd prores: make container hack slightly smarter
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
479fe52128 prores: play with sizes
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
95ff15f2bd prores: load in some luma stuff
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
2b6e1ed218 prores: this bug got perturbed away
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
6fff4af32f prores: add a big fat hack so we can actually look at the output
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
baf5ebcde9 prores: clarify
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
0328517051 prores: picture header fields
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
af8ebc03ef prores: figure out frame header stuff
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
014edb643c prores: ack IRQ
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
7af2335cda prores: initial work on an experiment
it appears to succeed, but no data is written to the output

Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
66c019cfec prores: trace enough to dump some buffers
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
3970b25add prores: start tracing descriptors
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
3f60769b39 prores: add results of register bruteforce
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
R
6a8a816bfa prores: initial commit
Signed-off-by: R <rqou@berkeley.edu>
2022-05-30 18:05:16 +09:00
Janne Grunau
d5ceafe41d m1n1.hv: fix argument names in HV.trace_range()
event_mmio() uses 'start' kwarg since 'zone' conflicts with
add_tracer()'s argument of the same name.

Fixes
TypeError: HV.add_tracer() got multiple values for argument 'zone'

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-25 15:24:05 +09:00
Asahi Lina
d44306a1c7 m1n1.agx: Initial AGX client scaffolding
Moves things from m1n1.fw.agx to here; the fw object will only do the
basic ASC stuff, GPU management gets its own object.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
ae1a8ad504 m1n1.fw.agx.initdata: Remove complex creation code
Moving this to its own place

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
891bdd3101 m1n1.fw.agx.channels: Remove creation code
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
3133dcfa15 m1n1.trace.agx: Many improvements to tracer
Also fix how cmdqueues are interpreted

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
2af56cbc0a m1n1.fw.agx.cmdqueue: Lots of struct improvements
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
9893219052 m1n1.fw.agx.controllist: Add lots more structs/fields
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
7fb99adf10 m1n1.fw.agx.channels: Add meta_fn arg to get_message()
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
8df6f6d060 m1n1.fw.agx.channels: s/DeviceControl_17/DC_DestroyContext/
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
01d7c5f6cd m1n1.fw.agx.channels.NotifyCmdQueueWork: Show more info
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
a993f35874 hv/trace_agx.py: Add hypercalls for pause/resume, disable bulk tracers
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
f5ba42e3bb tools/reset_panic_counter.py: New tool
Also adds m1n1.hw.spmi

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
25472a4373 m1n1.hw.uat: Remove init stuff, single allocator, make flags kwargs
Let's use this allocator only for ASC stuff. GPU stuff will have its own
va space allocators.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
4de4fdfb27 m1n1.fw.asc.mgmt: Allow being less verbose
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
cbe0e98f4c m1n1.fw.asc: Add boot_or_start()
This tries both ways so it'll work regardless of how the ASC was shut
down.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
f3830c034f m1n1.constructutils: Add debug (commented out)
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
797e58568b m1n1.constructutils: Make Pointers useful for builds
- Add ROPointer subclass which is not built through
- Add build hook to detect (RO)Pointers and assign the address field

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
b681de37c5 m1n1.constructutils: Add colors, offsets, support additional metadata
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
4320d065c0 m1n1.constructutils: Support Switch() properly
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
5b6afed509 m1n1.constructutils: Add Dec(), improve printing
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
3ec82d989d m1n1.hw.uat: Always print through translation failures
Make sure it's loud in case exceptions get eaten by Construct

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
87e0b69fc6 m1n1.trace: Propagate show_cpu in log()
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
9201ce3a13 m1n1.utils: Work around Register reloads breaking Constants
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
88c443008f m1n1.hv: Handle atomic instructions by disabling those pages
Ugly hack, but enough for now

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
2f2794508a m1n1.hv: Make SIGQUIT dump stacks and exit
This is useful in case a tracer is stuck in an infinite loop

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
802b37aaf3 m1n1.hv: Add support for "hypercalls" via BRK
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
c746549c2e hv: Map RAM via tracer infra, handle carveouts in Python
Previously RAM was mapped ad-hoc, but this can end up interacting
poorly with the tracer infrastructure which we are now using for RAM
too. Move to mapping guest RAM via the tracer infra, and also unmap the
TZ carveouts in the Python side so it knows about them.

This is a HV ABI break.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
30c4503966 m1n1.hv: Support names and bases for PrintTracers
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
22228934bd m1n1.fw.agx.channels: EventMsg structure
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:12 +09:00
Asahi Lina
6b6dfde814 m1n1.fw.agx: Lots of GPU work
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:54:10 +09:00
Asahi Lina
dc21c15537 m1n1.fw.agx.channels/initdata: Use __repr__ instead of __str__
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:52:43 +09:00
Asahi Lina
08c34dbc37 hv/trace_agx.py: Reload some stuff
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:52:43 +09:00
Asahi Lina
dc4673c03b m1n1.constructutils: Propagate force arg in _reloadcls()
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:52:43 +09:00
Asahi Lina
57d23f8491 m1n1.constructutils: Use repr() instead of str()
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-05-21 03:52:43 +09:00
Scott Mansell
a17e9e4f5e m1n1.fw.agx: WIP generate initdata
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:43 +09:00
Scott Mansell
79b01a7bcb m1n1.fw.agx: enough of a driver to boot gfx-asc
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
fe9c1f4bca m1n1.hw.uat: Implement iomap
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
43e3e0f3c2 m1n1.hw.uat: Reflect ARMv8 nature
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
f72417b78f m1n1.trace.agx: Add support for Work submission
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
636ebe70d7 m1n1.hw.uat: Allow accessing as a stream
This allows us to use construct's Pointer

Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
804e944a1b m1n1.constructutils: Add ConstructClass wrapper around construct
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
42edf41e37 m1n1.hw.uat: fix VA_MASK
Was missing the lowest bits, which broke unaligned reads/writes

Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:52:32 +09:00
Scott Mansell
980b9241d2 m1n1.trace.agx: Trace AGX wip
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:46:36 +09:00
Scott Mansell
90eae66b33 m1n1.hw.uat: Intitial UAT implementaiton
Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:46:26 +09:00
Scott Mansell
254f01b3ea m1n1.proxyutils.RegMon: Allow custom read lambda
Useful for monitoring ranges beind an iommu

Signed-off-by: Scott Mansell <phiren@gmail.com>
2022-05-21 03:46:14 +09:00
Hector Martin
144c3da78e experiments/amcc_err_handler.py: New old thing to dump AMCC errors 2022-04-19 23:32:11 +09:00
Janne Grunau
d4637513e0 WIP: m1n1.hv: add support for starting CPUs on the second M1 Ultra die
notes:
 - macos guest only works if the display is not initialized
 - macos guest appears to be very slow

Signed-off-by: Janne Grunau <j@jannau.net>
2022-04-19 21:39:52 +09:00
R
90479ac755 jpeg: Add documentation
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
04fc26639b jpeg: Unbreak encode for RGB formats
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
d28ab8cc81 jpeg: Figured out how to activate tiling
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
b2a0352a8f jpeg: Implement encoding from planar formats
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
f2b8054309 jpeg: Support encoding linear YUV
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
c71d341ff1 jpeg: Implement YUV10 mode for encoding
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
4681053ea9 jpeg: Implement encoding other RGB formats
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
970b2789d0 jpeg: Implement encoding subsampling modes
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
45876d09a1 jpeg: Import working encode experiment
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
9fca773c8f jpeg: Implement decoding into planar formats
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
3a18075d89 jpeg: Decode linear YUV
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
4c8807fcca jpeg: Add RGB565 to decoder
Note that dithering does not get configured

Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
7350baf58b jpeg: Implement decoding other subsampling modes
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
0c1f89d1f9 jpeg: Import working basic decode experiment
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
49cdf7fe22 jpeg: probe registers more thoroughly
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
c6169c1c15 jpeg: Import register definitions
This comes from experiments that were performed out-of-tree

Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:40:44 +09:00
R
0f6991ccbc dart-t8110: fill in more details from poking
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
96b2d584fe dart-t8110: Import more stuff pulled from symbols
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
ce5e5fe476 dart-t8110: Add other seen registers; poke protect
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
18535a2385 dart-t8110: uncomment helper functions
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
25ebf8adb1 dart-t8110: map/translate
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
5b07956e43 dart-t8110: flush/init
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
ecb9d1210c dart-t8110: dumping appears to work completely
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
16028224f9 dart-t8110: dump first-level translation tables
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
R
4a09eca74a dart-t8110: Initial commit
Signed-off-by: R <rqou@berkeley.edu>
2022-04-16 19:24:00 +09:00
Kyle Evans
0ba2027e5e proxyclient: tools: add a FreeBSD loader
The differences are documented in the script itself, but the main odd
bit is that we pass the provided kernel as an initramfs.  Our modified
loader will probe for the initramfs start/end props in FDT and put up
a memdisk that we load the kernel from.  This choice was made for two
reasons:

1.) Avoid ad-hoc interpretations of a memory region in m1n1, it doesn't
    care if we actually passed it an initramfs or not anyways.

2.) We already had some code on hand to do this in our loader, so I
    suspect we've done similar shenanigans elsewhere anyways.

This also requires a U-Boot change to allow bootefi of an arbitrary
location, as long the size is provided.

The alignment constraints for loader/kernel were kept arbitrarily.  The
kernel will be bounced anyways by loader. I don't recall what
alignment requirements UEFI payloads have, but 2M seems reasonable.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
2022-04-16 19:22:55 +09:00
Kyle Evans
3b68165900 proxyclient: tools: fix linux U-Boot support
-t is optional, we may not have a tty_dev, so we can avoid trying to
grab the baudrate from it if it's unspecified.

We don't want to use dtb_addr for booti; this is the unmodified payload.
m1n1 will load it and add bits to it at a separate address for passing
on to U-Boot.  For booti purposes, we actually want the augmented FDT
rather than the user-specified.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
2022-04-16 19:18:06 +09:00
Davide Cavalca
eeebd9dad3 Make scripts executable
Signed-off-by: Davide Cavalca <davide@cavalca.name>
2022-04-16 19:17:33 +09:00
Asahi Lina
87a849287a m1n1.utils.Reloadable: Add force argument to _reloadcls()
Useful to force reload classes that haven't changed when their
dependencies might have.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Asahi Lina
8b10324815 m1n1.trace: Add space after CPU number in PrintTracer logs
This makes the logs align properly with other trace logs.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Asahi Lina
6c57d3ded9 m1n1.proxyutils.RegMonitor: Add support for custom log function
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Asahi Lina
e2f63a07b2 hv: Improve VM emulation for tracer
Adds support for up to 64-byte ops and more SIMD/paired operations.
This is good enough to trace a lot of GPU VM address space.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Asahi Lina
cf8be42aa9 hv: Fix bug when unmapping IO ranges
Sometimes ranges were not properly unmapped if they did not overlap the
currently defined range maps.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Asahi Lina
302a9ec4c0 m1n1.hv: Add BYPASS trace mode
Forces SW mapping but does not do any hooking. This can be useful for
testing the emulation or to work around issues with HW/SW map
differences.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-04-16 19:06:22 +09:00
Hector Martin
9af9e834bf chainload.py: Pad image to terminate payloads
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-27 18:34:53 +09:00
Janne Grunau
df53f16f76 m1n1.hv: Copy /chosen/memory-map/preoslog if it exists
preoslog was added in macos 12.3 and seems to contain iBootStage1 log
output. Since macos 12.3 accesses it it has to be copied to after the
guest image.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-20 03:04:13 +09:00
Hector Martin
94d640aa20 tools/run_guest.py: Support restricting CPU list available to guest
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-14 21:08:23 +09:00
Hector Martin
be1421d2ad m1n1.hw.spi: Update register definitions
This had been sitting in my worktree...

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-11 22:14:46 +09:00
Hector Martin
822b3c3cca m1n1.trace.spi: Remove UNBUF mode
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-11 22:13:27 +09:00
Janne Grunau
c2a48da4c1 m1n1.hv: Add trace script keyboard/trackpad
Input devices use HID over SPI. HID communication is obscured by "sio"
DMA.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
387fab6132 m1n1.utils: Add CRC-16 (polygon 0xA001)
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
025fa41e90 m1n1.trace: Add SPI tracer
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
45824d2676 m1n1: move SPI register to m1n1.hw
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
e90be797a8 m1n1.trace.gpio: Update register description based on the Linux driver
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
9c80a69266 m1n1.hv: Use dynamic pin maps in trace_gpio.py
Hardcoded pin maps do not make sense with additional HW support.
Allows tracing of a single pin in another tracing module, for example
for tracing the SPI cs pin.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:06:01 +09:00
Janne Grunau
5e8beca9fe experiments/dcp.py: Upload fb in 512k chunks for slow (v)UARTs
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
f297decfb4 experiments/dcp.py: Use display size for frame buffers
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
6a8016a8e3 experiments/dcp.py: set DVA offset from ADT
This does not appear to be necessary. It worked on t8103 before and I
see no different behavior on t6001.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
66f4d625b8 experiments/dcp.py: Use t8103/t600x specific code paths
MMIO space differes between t8103 and t600x so the hardcoded RegMonitor
addresses make only sens on the former.
set_display_device difference is taken from macOS trace on t6001.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
d1d93eb2b5 m1n1.fw.dcp: Add callbacks used by t600x-dcp
Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Janne Grunau
7028f3e2d8 m1n1.fw.dcp: Zero dcpep's shared memeory
Fixes a crash of DCP with experiments/dcp.py after chainloading m1n1 on
j314c.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-03-11 12:05:21 +09:00
Hector Martin
99124a41fe tools/chainload.py: Support chainloading raw binaries
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-10 00:30:15 +09:00
Hector Martin
123d1df1a7 kboot: Replace kboot_set_bootargs with kboot_set_chosen
This allows setting arbitrary /chosen string props

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
adb1cb943e proxy: Export smp_set_wfe_mode
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-08 00:02:06 +09:00
Janne Grunau
d76f3a6631 m1n1.hw.DART: coalesce continuos l2 ptes
Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Janne Grunau
e1c5df5037 experiments/dart_dump.py: Use DART.from_adt()
The label of the ADT node is easier to use. Uses the proper DART type on
t600x SoCs.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Janne Grunau
a57696366f hv/trace_dcp.py: Update to macOS 12.x API
DCP API seems to be mostly unchanged from 12 beta to 12.2.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Janne Grunau
fb49d88d90 m1n1.fw.dcp.ipc: annotate swap_complete_intent_gated
Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-24 23:55:46 +09:00
Sven Peter
53af416b07 hv.py: Add helper to break on symbols
We already have breakpoints and symbols, let's make our life easier
by also allowing to break on symbols.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-24 23:55:25 +09:00
Hector Martin
08b77c2b1b m1n1.adt: Handle underscores in properties as __
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:31:31 +09:00
Hector Martin
5bf8c5ac83 m1n1.hv: Use p.mcc_hv_unmap_carveouts()
Fixes random SErrors due to the guest issuing speculative instruction
fetches into TZ regions.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:30:25 +09:00
Hector Martin
50a9593034 mcc: Add mcc_hv_unmap_carveouts() and proxy op
This is necessary to stop the guest from speculating into carveouts.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:30:21 +09:00
Hector Martin
a8a93a3b5f hv/trace_smc.py: Add GetKeyByIndex decoding
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
ec126bb16a experiments/smc.py: Turn into SMC key dumper
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
d381341865 m1n1.trace.asc: Add missing power control messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
45c3682f60 m1n1.fw.smc: Handle notifications
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Hector Martin
a0680a2678 m1n1.adt: Better parse PMU props
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-15 14:05:13 +09:00
Martin Povišer
41f0874f99 experiments/audio_capture.py: Demonstrate audio capture
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
78aa55f0bc experiments/speaker_amp.py: Revamp hardware setup
Use register definitions where they are now available. Start from full
AUDIO_P reset and set NCO ourselves (instead of relying on iBoot
values).

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
0d4c7af26b m1n1.hw.mca: Add MCA register definitions
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
90c4a1ae46 m1n1.hw.admac: Improve polling
Make sure we read any reports before we start submitting new
descriptors. Also put sleep in busy-wait loop and make speaker_amp.py
exit once EOF is reached.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
9bd84dfbb9 experiments/speaker_amp.py: Drop 'polling console'
Drop the 'polling console' code as there are now better ways to achieve
the same. (One can use USB_VUART for second proxy session, see 85ee2f24)

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
532f260fae m1n1.hw.admac: Label burst size, buswidth registers
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
3a8ae74907 m1n1.hw.admac: Introduce RX channels
Fill in register definitions and extend the driver code to introduce
support for RX channels. This involves change of channel numbering.

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
590722b29d m1n1.hw.admac: Use stderr for debug prints
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:18:20 +09:00
Martin Povišer
64d8f9d1b3 m1n1.loadobjs: Add util for loading objects on target
For those of us who can't write assembly but still need to run code on
the other side.

  >>> from m1n1.loadobjs import *
  >>> lp = LinkedProgram(u)
  >>> lp.debug_printf("hello from the other side (%d)\n", 42)
  TTY> hello from the other side (42)
  0x1f
  >>> lp.load_obj("build/test.o")
  >>> lp.test()
  TTY> hello from loaded object
  0x19
  >>> lp.clear_objs()

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-08 14:14:38 +09:00
Hector Martin
0d35eb3da7 m1n1.proxyutils: Wrap ADT base to 64 bits
This works around a wraparound issue when the virt base ends up causing
the ADT address to go negative, when on 12.1+ using a dummy virt base.

Fixes: #155
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-06 20:49:54 +09:00
Mikhail Gusarov
88874936c6 proxyclient: utils.py: add ehexdump()
ehexdump is similar to chexdump, and uses CP437 control characters
and Braille to improve eyeballability of character output.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2022-01-26 15:39:23 +09:00
Sven Peter
ccf4b20a1d proxy: add nvme_{read,flush}
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
f44d5db4fa proxyclient/asc: s/Mgmt_StartSyslog/Mgmt_SetAPPower/
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
6816c151bb proxyclient/epic: Add support for SubHeader.version = 3
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-19 03:24:20 +09:00
Hector Martin
e2b87b695f tools/smccli.py: Shut down cleanly, increase verbosity
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:22:33 +09:00
Hector Martin
434a3b6c78 hv/trace_smc.py: Support RW ops
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:22:16 +09:00
Hector Martin
07c695926d hv/trace_dcp.py: Fix typo
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:55 +09:00
Hector Martin
ce2f705b16 m1n1.trace.asc: Handle prealloc'd syslog buffers
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:30 +09:00
Hector Martin
293d78fd7f m1n1.hw.asc: Add verbose flag
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:15 +09:00
Hector Martin
a79200ef1e m1n1.fw.smc: Many improvements
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:21:04 +09:00
Hector Martin
c7d42837e4 m1n1.fw.asc.mgmt: Fix the IOP/AP power state stuff
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:19:48 +09:00
Hector Martin
db0eaa86ca experiments/dcp_iboot.py: Clean up after shell
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:19:08 +09:00
Hector Martin
9cdf2b5d06 experiments/dcp_iboot.py: Do not dump DART
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:18:55 +09:00
Hector Martin
e468e08603 m1n1.fw.asc.{crashlog,syslog}: Do not ack prealloced bufs
This is wrong and causes IOP crashes due to unacked crashlog msgs.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:18:18 +09:00
Hector Martin
bacb19b301 m1n1.fw.asc: Make DVA_OFFSET dynamic
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:16:12 +09:00
Hector Martin
f98723bb81 m1n1.trace.dart: Prime register cache on startup
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
7969d2c689 m1n1.fw.dcp.iboot: Cleanup & fixes
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
323e163eb4 hv/trace_dcp.py: Fix reinitialization
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
e3e2d05967 experiments/dcp_iboot.py: New experiment
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-16 20:23:01 +09:00
Hector Martin
d2535159a5 m1n1.fw.dcp.iboot: Add iBoot DCP interface client
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-16 19:39:03 +09:00
Hector Martin
17e0dfceab hv/trace_dcp.py: Add EPIC support and refactor
This now partially uses the scaffolding in m1n1.fw.afk.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-16 19:39:03 +09:00
Hector Martin
1d79711e79 m1n1.fw.afk: Add AFK/EPIC endpoint support
These cover the non-dcpep endpoints of the DCP interface, including
the iBoot interface (disp0).

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-16 19:39:03 +09:00
Hector Martin
b2da9faac7 m1n1.fw.dcp.ipc: Add some more struct fields
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-16 19:39:03 +09:00