mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
hv: wrap function to check software SRAM support
Below boolean function are defined in this patch: - is_software_sram_enabled() to check if SW SRAM feature is enabled or not. - set global variable 'is_sw_sram_initialized' to file static. Tracked-On: #5649 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: Fei Li <fei1.li@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
768e483cd2
commit
ea44bb6c4d
@ -231,7 +231,7 @@ static void prepare_prelaunched_vm_memmap(struct acrn_vm *vm, const struct acrn_
|
|||||||
if (entry->length == 0UL) {
|
if (entry->length == 0UL) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (is_sw_sram_initialized && (entry->baseaddr == PRE_RTVM_SW_SRAM_BASE_GPA) &&
|
if (is_software_sram_enabled() && (entry->baseaddr == PRE_RTVM_SW_SRAM_BASE_GPA) &&
|
||||||
((vm_config->guest_flags & GUEST_FLAG_RT) != 0U)){
|
((vm_config->guest_flags & GUEST_FLAG_RT) != 0U)){
|
||||||
/* pass through Software SRAM to pre-RTVM */
|
/* pass through Software SRAM to pre-RTVM */
|
||||||
ept_add_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp,
|
ept_add_mr(vm, (uint64_t *)vm->arch_vm.nworld_eptp,
|
||||||
|
@ -408,7 +408,7 @@ static int32_t wbinvd_vmexit_handler(struct acrn_vcpu *vcpu)
|
|||||||
struct acrn_vcpu *other;
|
struct acrn_vcpu *other;
|
||||||
|
|
||||||
/* GUEST_FLAG_RT has not set in post-launched RTVM before it has been created */
|
/* GUEST_FLAG_RT has not set in post-launched RTVM before it has been created */
|
||||||
if ((!is_sw_sram_initialized) && (!has_rt_vm())) {
|
if ((!is_software_sram_enabled()) && (!has_rt_vm())) {
|
||||||
cache_flush_invalidate_all();
|
cache_flush_invalidate_all();
|
||||||
} else {
|
} else {
|
||||||
if (is_rt_vm(vcpu->vm)) {
|
if (is_rt_vm(vcpu->vm)) {
|
||||||
|
@ -16,7 +16,7 @@ static uint64_t software_sram_bottom_hpa;
|
|||||||
static uint64_t software_sram_top_hpa;
|
static uint64_t software_sram_top_hpa;
|
||||||
|
|
||||||
/* is_sw_sram_initialized is used to tell whether Software SRAM is successfully initialized for all cores */
|
/* is_sw_sram_initialized is used to tell whether Software SRAM is successfully initialized for all cores */
|
||||||
volatile bool is_sw_sram_initialized = false;
|
static volatile bool is_sw_sram_initialized = false;
|
||||||
|
|
||||||
#ifdef CONFIG_PSRAM_ENABLED
|
#ifdef CONFIG_PSRAM_ENABLED
|
||||||
|
|
||||||
@ -173,6 +173,12 @@ void init_software_sram(__unused bool is_bsp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* @pre called after 'init_software_sram()' done. */
|
||||||
|
bool is_software_sram_enabled(void)
|
||||||
|
{
|
||||||
|
return is_sw_sram_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t get_software_sram_base(void)
|
uint64_t get_software_sram_base(void)
|
||||||
{
|
{
|
||||||
return software_sram_bottom_hpa;
|
return software_sram_bottom_hpa;
|
||||||
|
@ -575,7 +575,7 @@ static void add_vm_memory_region(struct acrn_vm *vm, struct acrn_vm *target_vm,
|
|||||||
* TODO: We can enforce WB for any region has overlap with Software SRAM, for simplicity,
|
* TODO: We can enforce WB for any region has overlap with Software SRAM, for simplicity,
|
||||||
* and leave it to SOS to make sure it won't violate.
|
* and leave it to SOS to make sure it won't violate.
|
||||||
*/
|
*/
|
||||||
if (is_sw_sram_initialized) {
|
if (is_software_sram_enabled()) {
|
||||||
base_paddr = get_software_sram_base();
|
base_paddr = get_software_sram_base();
|
||||||
if ((hpa >= base_paddr) &&
|
if ((hpa >= base_paddr) &&
|
||||||
((hpa + region->size) <= (base_paddr + get_software_sram_size()))) {
|
((hpa + region->size) <= (base_paddr + get_software_sram_size()))) {
|
||||||
|
@ -26,7 +26,7 @@ struct rtcm_header {
|
|||||||
uint64_t command_offset;
|
uint64_t command_offset;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
extern volatile bool is_sw_sram_initialized;
|
|
||||||
void init_software_sram(bool is_bsp);
|
void init_software_sram(bool is_bsp);
|
||||||
void set_rtct_tbl(void *rtct_tbl_addr);
|
void set_rtct_tbl(void *rtct_tbl_addr);
|
||||||
|
bool is_software_sram_enabled(void);
|
||||||
#endif /* RTCM_H */
|
#endif /* RTCM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user