Commit Graph

32 Commits

Author SHA1 Message Date
Erik Faye-Lund 9bcd538643 freedreno: remove stale makefile
We don't use this makefile, so there's no point in keeping it in the
repo. It's also a generated one, so it contains a lot of... mess.

Fixes: 536f43cb96 ("freedreno: slurp in afuc")
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16790>
2022-06-02 09:13:23 +00:00
Thomas H.P. Andersen d71c6eebe2 freedreno: silence sometimes-uninitialized warning
Clang does not see that this is unreachable and thus
thinks that opc will be used uninitialized later.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14500>
2022-01-12 21:20:23 +00:00
Emma Anholt 80d5e40fd1 freedreno/afuc: Disable the disassembler on 32-bit builds.
There's an mmap(2 << 32), which armhf can't handle.

Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5514
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13421>
2021-10-19 18:55:07 +00:00
Emma Anholt 5209a0ae16 freedreno: Move afuc tests to meson unit tests.
Now they run automatically in parallel with other unit testing, rather
than needing a separate script and environment to run them.

Instead of doing shell script filtering afterwards, I just added a little
flag to suppress printing the path name.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6360>
2021-10-01 23:16:04 +00:00
Emma Anholt d5a80781aa freedreno/afuc: Avoid ubsan warns about shifting to the top bit of 'int'
I think maybe it's being promoted to int due to the mismatched bitfield
sizes of the uint32_t values being referenced here?

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6360>
2021-10-01 23:16:04 +00:00
Matt Turner 09935c0dde freedreno/afuc: Print uintptr_t with PRIxPTR
Fixes a compilation error on 32-bit.

Fixes: bba61cef38 ("freedreno/afuc: Add emulator mode to afuc-disasm")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11118>
2021-06-02 03:57:20 +00:00
Rob Clark ff5e17f1f8 freedreno/afuc: Use emulator to extract jmptbl
This runs through the SQE bootstrap code to extract the packet-table,
rather than relying on heuristics.  As a bonus, it can detect the start
of the LPAC fw in a660+ fw so that we can properly decode the LPAC fw
and packet-table.

Note that this decodes the jmptable as normal instructions, which is a
change in behavior from the previous heuristic based jmptbl extraction.
Not sure if that is a good or bad thing.

For a5xx, for now the legacy heuristic based jmptable decoding is
preserved, at least until enough control regs are figured out.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark df14af6480 freedreno/afuc: Add emulator support to run bootstrap
Run until the packet-table is populated, so the disassembler can use
this to know the offsets of various pm4 packet handlers without having
to rely on heuristics.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark ea2e244198 freedreno/afuc: Split out helpers to parse labels and packet-table
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 9a4ca194e8 freedreno/afuc: Extract full gpu-id
Some of the a6xx gens will require some control reg initialization, and
go into an infinite loop if they don't see the values they expect, so
we'll need to extract the compute gpu-id.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark bba61cef38 freedreno/afuc: Add emulator mode to afuc-disasm
This is an (at least somewhat complete) logical emulator of the a6xx SQE
that lets us step through firmware execution (bootstrap, cmdstream pkt
handling, etc).  It lets us poke at various fw visible state and run
through pm4 packet(s) to better understand what the fw is doing when it
handles various packets.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 745dad0446 freedreno/afuc: Add pipe reg name decoding
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 184f474574 freedreno/afuc: Clean up special regs
Allow for different mnemonics depending on whether they are used as
source or destination register, to better reflect what they do.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 2876253f28 freedreno/afuc: Split out utils
With disasm emulator mode, we'll start wanting some things that are
duplicationg what the assembler does, so just split out all the rnndb
bits into shared utils.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark d367d84d87 freedreno/afuc: Split out instruction decode helper
Split the giant switch/decode out into a helper function so that we can
re-use it for emulator mode.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 33b9445a68 freedreno: Move pkt parsing helpers to common
I'll be needing these in afuc as well.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark f5918f750f freedreno/afuc: Re-indent
clang-format -fallback-style=none --style=file -i src/freedreno/afuc/*.[ch]

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10293>
2021-04-17 15:38:56 +00:00
Vinson Lee 03999595e7 freedreno/afuc: Replace readfile with os_read_file.
Tested afuc-disasm produced same output.

$ ./builddir/src/freedreno/afuc/afuc-disasm -g 6 src/freedreno/.gitlab-ci/reference/afuc_test.fw > /tmp/afuc_test.asm
$ diff ./src/freedreno/.gitlab-ci/reference/afuc_test.asm /tmp/afuc_test.asm
$ echo $?
0

Suggested-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8290>
2021-01-06 18:12:34 +00:00
Eric Anholt 06f2516696 freedreno/afuc: Fix up some sprintf format security warnings.
Showed up when I tried enabling asan.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7695>
2020-12-02 20:43:33 +00:00
Eric Anholt 8ae38885d6 freedreno: Fix uninitialized var warning in afuc using unreachable().
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7664>
2020-11-18 18:15:02 +00:00
Eric Anholt a512e9eecd freedreno/tools: Fix compiler warnings about using sz in the error paths.
If we don't check for a NULL str, then sz might be undefined (as was
happening in the match_compatible path, and returning 0 makes us not match
as we should).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
2020-10-20 22:16:59 +00:00
Connor Abbott d145fcc1c1 freedreno/afuc: Install asm/disasm
Make the name a bit longer, since when installed it's not tucked away
under afuc/ anymore.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott f0b87186df freedreno/afuc: Make 0 a valid number
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott 66dd248593 freedreno/afuc: Handle xmov modifiers
Although it's kind-of similar to "(rptN)" in the shader ISA, I called it
"xmov" to make it clear that it's completely orthogonal to "(rep)",
although you certainly can use both modifiers on the same instruction.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott b2b19234d8 freedreno/afuc: Add iret
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott a2c14ac070 freedreno/afuc: Handle setsecure opcode
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott 0acc394486 freedreno/afuc: Fix printing preemptleave on a5xx
This opcode is actually used on a5xx, but I'm not sure what it's for.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6368>
2020-08-18 16:17:31 +00:00
Connor Abbott 27eea627ef freedreno/afuc: Fix PM4 enum parsing
We were open-coding it, and getting variant parsing wrong for things
like "A4XX-" which don't explicitly include the version being
disassembled. Use the rnn function instead. This makes CP_INDIRECT show
up again. Also propagate const-ness to users.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
2020-08-01 17:51:01 +00:00
Connor Abbott a5daaed587 freedreno/afuc: Add missing rnn_prepdb()
It's totally not obvious, but this runs extra error checking and is
necessary for correct variant handling, and variant handling will
silently not work if it's not enabled. Add it asm.c even though it's not
strictly necessary, to prevent anyone from missing this in the future.

Missing this really should be an error.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
2020-08-01 17:51:01 +00:00
Rob Clark 751af16e1d freedreno/tools: check rnn parse status
Don't silently ignore issues.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6107>
2020-07-29 14:30:35 +00:00
Rob Clark b62e4a8e9e freedreno/afuc: warnings cleanup
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6070>
2020-07-28 09:45:08 +00:00
Rob Clark 536f43cb96 freedreno: slurp in afuc
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6070>
2020-07-28 09:45:08 +00:00