hv: risc-v: use tp register directly for arch_get_pcpu_id

Use tp register directly for arch_get_pcpu_id. This can eliminate the
unnecessary mv instruction.

Tracked-On: #8791
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Jian Jun Chen
2025-10-10 13:31:05 +08:00
committed by acrnsi-robot
parent 0a8eb09454
commit 3449b62dfb

View File

@@ -117,9 +117,7 @@ struct stack_frame {
*/
static inline uint16_t arch_get_pcpu_id(void)
{
uint16_t pcpu_id;
asm volatile ("mv %0, tp" : "=r" (pcpu_id) : : );
register uint16_t pcpu_id asm ("tp");
return pcpu_id;
}