[PATCH v3 00/11] tcg/riscv64: Fix AUIPC pair range validation

Richard Henderson posted 11 patches 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260914000814.785155-1-richard.henderson@linaro.org
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <Alistair.Francis@wdc.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Richard Henderson <richard.henderson@linaro.org>
tcg/riscv64/tcg-target.c.inc | 230 ++++++++++++++++++-----------------
1 file changed, 121 insertions(+), 109 deletions(-)
[PATCH v3 00/11] tcg/riscv64: Fix AUIPC pair range validation
Posted by Richard Henderson 1 week, 5 days ago
Hi Max,

In v2, the change from int32_t to uint32_t is pretty much
the opposite of what should have been done, since all of
these are logically signed values.  I've adjusted all of
the encoders to take signed inputs and assert in range.

In the process, I noticed tha the branch range tests were
off by one.  Now all performed in exactly one place.

Finally, tcg_out_ldst needed updates for AUIPC as well.

I've tested this lightly so far; full testing on a rather
slow riscv machine is still on-going.


r~


Max Chou (2):
  tcg/riscv64: Validate AUIPC relocation range
  tcg/riscv64: Fall back when AUIPC pairs are out of range

Richard Henderson (9):
  tcg/riscv64: Return tcg_insn_unit from insn encoders
  tcg/riscv64: Rename sb-type to b-type format
  tcg/riscv64: Rename uj-type to j-type format
  tcg/riscv64: Use signed type for encoding immediates
  tcg/riscv64: Adjust sign of lui immediate in tcg_out_movi
  tcg/riscv64: Assert immediate in range for [isu]-type insns
  tcg/riscv64: Return success from encode_jimm
  tcg/riscv64: Return success from encode_bimm
  tcg/riscv64: Fix off-by-one in branch range tests

 tcg/riscv64/tcg-target.c.inc | 230 ++++++++++++++++++-----------------
 1 file changed, 121 insertions(+), 109 deletions(-)

-- 
2.53.0
Re: [PATCH v3 00/11] tcg/riscv64: Fix AUIPC pair range validation
Posted by Max Chou 1 week, 4 days ago
On 2026-09-13 14:08, Richard Henderson wrote:
> Hi Max,
> 
> In v2, the change from int32_t to uint32_t is pretty much
> the opposite of what should have been done, since all of
> these are logically signed values.  I've adjusted all of
> the encoders to take signed inputs and assert in range.
> 
> In the process, I noticed tha the branch range tests were
> off by one.  Now all performed in exactly one place.
> 
> Finally, tcg_out_ldst needed updates for AUIPC as well.
> 
> I've tested this lightly so far; full testing on a rather
> slow riscv machine is still on-going.
> 

Hi Richard,

Thank you for the v3 patchset series.
I’m currently reviewing and trying to test it in my environment.
Could you please let me know what full testing you used to test this
patchset?

Thanks,
rnax

> 
> r~
> 
> 
> Max Chou (2):
>   tcg/riscv64: Validate AUIPC relocation range
>   tcg/riscv64: Fall back when AUIPC pairs are out of range
> 
> Richard Henderson (9):
>   tcg/riscv64: Return tcg_insn_unit from insn encoders
>   tcg/riscv64: Rename sb-type to b-type format
>   tcg/riscv64: Rename uj-type to j-type format
>   tcg/riscv64: Use signed type for encoding immediates
>   tcg/riscv64: Adjust sign of lui immediate in tcg_out_movi
>   tcg/riscv64: Assert immediate in range for [isu]-type insns
>   tcg/riscv64: Return success from encode_jimm
>   tcg/riscv64: Return success from encode_bimm
>   tcg/riscv64: Fix off-by-one in branch range tests
> 
>  tcg/riscv64/tcg-target.c.inc | 230 ++++++++++++++++++-----------------
>  1 file changed, 121 insertions(+), 109 deletions(-)
> 
> -- 
> 2.53.0
>