[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v2] Hexagon (decode): look for pkts with multiple insns at th
From: |
Taylor Simpson |
Subject: |
RE: [PATCH v2] Hexagon (decode): look for pkts with multiple insns at the same slot |
Date: |
Tue, 9 May 2023 16:46:22 +0000 |
> -----Original Message-----
> From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> Sent: Monday, May 8, 2023 8:37 AM
> To: qemu-devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>
> Subject: [PATCH v2] Hexagon (decode): look for pkts with multiple insns at
> the same slot
>
> Each slot in a packet can be assigned to at most one instruction.
> Although the assembler generally ought to enforce this rule, we better be
> safe than sorry and also do some check to properly throw an "invalid packet"
> exception on wrong slot assignments.
>
> This should also make it easier to debug possible future errors caused by
> missing updates to `find_iclass_slots()` rules in target/hexagon/iclass.c.
>
> Co-authored-by: Taylor Simpson <tsimpson@quicinc.com>
> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
> Changes in v2:
> - Only call decode_set_slot_number() with !disas_only, fixing the -d
> in_asm case.
>
> v1: https://lore.kernel.org/qemu-
> devel/7a90f0925f182e56cf49ec3ec01484739fa2f174.1683226473.git.quic_mat
> hbern@quicinc.com/
>
> target/hexagon/decode.c | 30 +++++++++++++++++++++++++++---
> tests/tcg/hexagon/invalid-slots.c | 29 +++++++++++++++++++++++++++++
> tests/tcg/hexagon/Makefile.target | 11 +++++++++++
> 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644
> tests/tcg/hexagon/invalid-slots.c
>
> diff --git a/tests/tcg/hexagon/Makefile.target
> b/tests/tcg/hexagon/Makefile.target
> index 7c94db4bc4..0c69216c6c 100644
> --- a/tests/tcg/hexagon/Makefile.target
> +++ b/tests/tcg/hexagon/Makefile.target
> @@ -49,6 +49,17 @@ HEX_TESTS += vector_add_int HEX_TESTS +=
> scatter_gather HEX_TESTS += hvx_misc HEX_TESTS += hvx_histogram
> +HEX_TESTS += invalid-slots
> +
> +run-and-check-exception = $(call run-test,$2,$3 2>$2.stderr; \
> + test $$? -eq 1 && grep -q "exception $(strip $1)" $2.stderr)
> +
> +run-invalid-slots: invalid-slots
> + $(call run-and-check-exception, 0x15, $@, $(QEMU) $(QEMU_OPTS)
> $<)
> +
> +run-plugin-invalid-slots-with-%: invalid-slots
> + $(call run-and-check-exception, 0x15, $@, $(QEMU) $(QEMU_OPTS)
> \
> + -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) $(call
> +strip-plugin,$<))
This isn't invoked and is missing some pieces. I'll remove it from the PR.
Otherwise,
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>