Skip to content

Commit 15a2e56

Browse files
committed
standalone_systests: fix tlbp64 to probe HSV39 extended TLB entries
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>
1 parent 6e9fb41 commit 15a2e56

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

standalone_systests/include/hsv39.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,9 @@ static inline void remove_hsv39_trans(int index)
8787

8888
static inline uint32_t tlbp64(uint32_t asid, uint64_t VA)
8989
{
90-
uint32_t lookup_hi = ((VA >> 32) & 0xfffff) | ((asid & 0x7f) << 20);
91-
uint32_t lookup_lo = (VA >> 12) & 0xfffff;
90+
uint64_t lookup = (asid & 0x7f) | (uint64_t)(VA & 0xfffffffffffff000);
9291
uint32_t ret;
93-
94-
/* For 64-bit TLB lookup, we need to handle the upper bits appropriately */
95-
/* This is a simplified implementation - actual HW may differ */
96-
asm volatile ("%0 = tlbp(%1)\n\t" : "=r"(ret) : "r"(lookup_hi));
97-
if (ret == TLB_NOT_FOUND) {
98-
asm volatile ("%0 = tlbp(%1)\n\t" : "=r"(ret) : "r"(lookup_lo));
99-
}
92+
asm volatile ("%0 = tlbp(%1)\n\t" : "=r"(ret) : "r"(lookup));
10093
return ret;
10194
}
10295

0 commit comments

Comments
 (0)