mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-25 23:13:26 +00:00
dm: add ssram support for user VM
Hook ssram init && de-init functions to vdev devices lifecycle management: 1) initialize ssram when vdev devices are initialized. 2) de-initialize ssram when vdev devices are reset or destroyed. notes: ssram configuration data can be released only when user VM shutdown, hence it can't be done in deinit_vssram(). - VM reboot: do deinit_vssram() only. - VM shutdown: do both deinit_vssram() and clean_vssram_config(). Tracked-On: #7010 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Wang Yu1 <yu1.wang@intel.com>
This commit is contained in:
parent
5ff532b08c
commit
6bf70e3e35
@ -484,6 +484,9 @@ vm_init_vdevs(struct vmctx *ctx)
|
||||
if (debugexit_enabled)
|
||||
init_debugexit();
|
||||
|
||||
if ((ssram) && (init_vssram(ctx) < 0))
|
||||
goto ssram_fail;
|
||||
|
||||
ret = monitor_init(ctx);
|
||||
if (ret < 0)
|
||||
goto monitor_fail;
|
||||
@ -505,6 +508,9 @@ pci_fail:
|
||||
deinit_mmio_devs(ctx);
|
||||
mmio_dev_fail:
|
||||
monitor_close();
|
||||
ssram_fail:
|
||||
if (ssram)
|
||||
deinit_vssram(ctx);
|
||||
monitor_fail:
|
||||
if (debugexit_enabled)
|
||||
deinit_debugexit();
|
||||
@ -539,6 +545,9 @@ vm_deinit_vdevs(struct vmctx *ctx)
|
||||
if (debugexit_enabled)
|
||||
deinit_debugexit();
|
||||
|
||||
if (ssram)
|
||||
deinit_vssram(ctx);
|
||||
|
||||
vhpet_deinit(ctx);
|
||||
vpit_deinit(ctx);
|
||||
vrtc_deinit(ctx);
|
||||
@ -574,6 +583,9 @@ vm_reset_vdevs(struct vmctx *ctx)
|
||||
if (debugexit_enabled)
|
||||
deinit_debugexit();
|
||||
|
||||
if (ssram)
|
||||
deinit_vssram(ctx);
|
||||
|
||||
vhpet_deinit(ctx);
|
||||
vpit_deinit(ctx);
|
||||
vrtc_deinit(ctx);
|
||||
@ -591,6 +603,9 @@ vm_reset_vdevs(struct vmctx *ctx)
|
||||
if (debugexit_enabled)
|
||||
init_debugexit();
|
||||
|
||||
if (ssram)
|
||||
init_vssram(ctx);
|
||||
|
||||
ioapic_init(ctx);
|
||||
init_pci(ctx);
|
||||
|
||||
|
@ -1302,6 +1302,28 @@ exit:
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief De-initialize software SRAM device
|
||||
*
|
||||
* @param ctx Pointer to context of user VM.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void deinit_vssram(struct vmctx *ctx)
|
||||
{
|
||||
vssram_close_buffers();
|
||||
if (vssram_buffers) {
|
||||
free(vssram_buffers);
|
||||
vssram_buffers = NULL;
|
||||
}
|
||||
|
||||
if (vrtct_table != NULL) {
|
||||
free(vrtct_table);
|
||||
vrtct_table = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cleanup vSSRAM configurations resource.
|
||||
*
|
||||
|
@ -52,6 +52,7 @@ uint64_t get_vssram_size(void);
|
||||
uint8_t *get_vssram_vrtct(void);
|
||||
void clean_vssram_configs(void);
|
||||
int init_vssram(struct vmctx *ctx);
|
||||
void deinit_vssram(struct vmctx *ctx);
|
||||
int parse_vssram_buf_params(const char *opt);
|
||||
|
||||
#endif /* RTCT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user