mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-14 19:02:02 +00:00
Move phys_cpu_num and pcpu_active_bitmap to common, which could be only accessed by interfaces provided by smp.h. v2->v3: 1. move ALL_CPUS_MASK/AP_MASK to common cpu.h v1->v2: 1. preserve phys_cpu_num in x86 but implement arch_get_num_available_cpus() to provide interface for common code to access. 2. change function name test_xx to check_xx Tracked-On: #8801 Signed-off-by: hangliu1 <hang1.liu@intel.com> Reviewed-by: Wang, Yu1 <yu1.wang@intel.com> Reviewed-by: Liu, Yifan1 <yifan1.liu@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
40 lines
844 B
C
40 lines
844 B
C
/*
|
|
* Copyright (C) 2025 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
*/
|
|
|
|
#ifndef RISCV_CPU_H
|
|
#define RISCV_CPU_H
|
|
|
|
#include <types.h>
|
|
#include <lib/util.h>
|
|
|
|
static inline void wait_sync_change(__unused volatile const uint64_t *sync, __unused uint64_t wake_sync)
|
|
{
|
|
/**
|
|
* Dummy implementation.
|
|
* Official implementations are to be provided in the platform initialization patchset (by Hang).
|
|
*/
|
|
}
|
|
|
|
static inline uint16_t get_pcpu_id(void)
|
|
{
|
|
/**
|
|
* Dummy implementation.
|
|
* Official implementations are to be provided in the platform initialization patchset (by Hang).
|
|
*/
|
|
return 0U;
|
|
}
|
|
|
|
/* Write CSR */
|
|
#define cpu_csr_write(reg, csr_val) \
|
|
({ \
|
|
uint64_t val = (uint64_t)csr_val; \
|
|
asm volatile (" csrw " STRINGIFY(reg) ", %0 \n\t" \
|
|
:: "r"(val): "memory"); \
|
|
})
|
|
|
|
#endif /* RISCV_CPU_H */
|