panvk: Fix instrumentation on v12+

Ensure we stay within the maximum tuple size when copying.

Fixes: 172dead3df ("panvk: Increase CSF scratch limits on v12+")
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36519>
(cherry picked from commit e5b828e808)
This commit is contained in:
Lars-Ivar Hesselberg Simonsen 2025-07-23 10:53:31 +02:00 committed by Eric Engestrom
parent 354e3b96a8
commit 9429399bc8
3 changed files with 6 additions and 3 deletions

View file

@ -4564,7 +4564,7 @@
"description": "panvk: Fix instrumentation on v12+",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "172dead3df385c43c1de8291a3bd154c3f0f6530",
"notes": null

View file

@ -432,12 +432,14 @@ cs_dst64(struct cs_builder *b, struct cs_index dst)
return cs_dst_tuple(b, dst, 2, BITFIELD_MASK(2));
}
#define CS_MAX_REG_TUPLE_SIZE 16
static inline struct cs_index
cs_reg_tuple(ASSERTED struct cs_builder *b, uint8_t reg, uint8_t size)
{
assert(reg + size <= b->conf.nr_registers - b->conf.nr_kernel_registers &&
"overflowed register file");
assert(size <= 16 && "unsupported");
assert(size <= CS_MAX_REG_TUPLE_SIZE && "unsupported");
return (struct cs_index){
.type = CS_INDEX_REGISTER,

View file

@ -40,7 +40,8 @@ cmd_copy_data(struct cs_builder *b, uint64_t dst_addr, uint64_t src_addr,
*/
const struct cs_index dst_addr_reg = cs_scratch_reg64(b, 0);
const struct cs_index src_addr_reg = cs_scratch_reg64(b, 2);
const uint32_t temp_count = CS_REG_SCRATCH_COUNT - 4;
const uint32_t temp_count =
MIN2(CS_REG_SCRATCH_COUNT - 4, CS_MAX_REG_TUPLE_SIZE);
while (size) {
cs_move64_to(b, dst_addr_reg, dst_addr);