Skip to content

Fix systests#35

Merged
quic-mliebel merged 3 commits into
qualcomm:mainfrom
quic-mliebel:fix-tlbp64-for-hsv39
Jun 10, 2026
Merged

Fix systests#35
quic-mliebel merged 3 commits into
qualcomm:mainfrom
quic-mliebel:fix-tlbp64-for-hsv39

Conversation

@quic-mliebel

Copy link
Copy Markdown
Contributor

No description provided.

@quic-mliebel quic-mliebel requested a review from androm3da June 10, 2026 15:39
@quic-mliebel quic-mliebel force-pushed the fix-tlbp64-for-hsv39 branch from 9911843 to aee9655 Compare June 10, 2026 15:47
Comment thread standalone_systests/include/hsv39.h Outdated
Comment thread standalone_systests/include/hsv39.h Outdated
The previous tlbp64 split the 64-bit lookup key into two uint32_t
halves and probed each separately.  Each probe used `"r"(<uint32_t>)`
as the inline-asm constraint, which made the compiler allocate a
single 32-bit register.  The assembler's `tlbp` mnemonic is
operand-width-driven: a single 32-bit register selects the legacy
Y2_tlbp instruction (which only searches legacy TLB entries at
indices 0-511); a 64-bit register pair (Rss) selects Y2_tlbpp
(which searches the full TLB including HSV39 extended entries at
indices 512+).

The hsv39_tlb test writes its TLB entries at indices >=512.  The
old tlbp64 always emitted Y2_tlbp and so never found those entries,
making the test fail with bogus TLB_NOT_FOUND results.

Pass the lookup key as a single uint64_t.  This forces a register
pair and makes the assembler emit Y2_tlbpp.

Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
@quic-mliebel quic-mliebel force-pushed the fix-tlbp64-for-hsv39 branch from aee9655 to 030bc8c Compare June 10, 2026 17:53
hsv39.h's HSV39_PageSize, TLBEntry64, hsv39_make_tlb_entry(), and
hsv39_write_tlb_entry() were locally redefined when __HEXAGON_ARCH__
was 80 or earlier.  But the only consumer of this header is
hsv39_tlb.c, which is forced to build with -mv81 by CMakeLists.txt
(the next commit).  So the fallback was unreachable in practice.

The fallbacks were also semantically wrong: the local TLBEntry64
omitted the HSV39:1 bit field that the toolchain's version sets, so
even if reached the fallback would have produced incorrect TLB
entries.

Delete them.  The toolchain's tlb.h provides the correct definitions
when __HEXAGON_ARCH__ > 80.  Keep pow4() — it is used directly by
hsv39_tlb.c, not just by the deleted helpers.

Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
hsv39_tlb's tlbp64() probes HSV39 extended TLB entries by passing a
64-bit register pair to the tlbp mnemonic, which the assembler encodes
as Y2_tlbpp.  That instruction form requires -mv81, while the suite
otherwise defaults to -mv68.

Add compile and link options for hsv39_tlb only, leaving the global
HEXAGON_ARCH and unrelated tests unchanged.

Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
@quic-mliebel quic-mliebel force-pushed the fix-tlbp64-for-hsv39 branch from 030bc8c to 81bbccd Compare June 10, 2026 18:52
@quic-mliebel quic-mliebel merged commit c0f407d into qualcomm:main Jun 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants