1 /*
2  * Copyright (C) 2018-2022 Intel Corporation.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <asm/vm_config.h>
8 #include <util.h>
9 #include <rtl.h>
10 
11 /*
12  * @pre vm_id < CONFIG_MAX_VM_NUM
13  * @post return != NULL
14  */
get_vm_config(uint16_t vm_id)15 struct acrn_vm_config *get_vm_config(uint16_t vm_id)
16 {
17 	return &vm_configs[vm_id];
18 }
19 
20 /*
21  * @pre vm_id < CONFIG_MAX_VM_NUM
22  */
get_vm_severity(uint16_t vm_id)23 uint8_t get_vm_severity(uint16_t vm_id)
24 {
25 	return vm_configs[vm_id].severity;
26 }
27 
28 /**
29  * return true if the input vm-name is configured in VM
30  *
31  * @pre vmid < CONFIG_MAX_VM_NUM
32  */
vm_has_matched_name(uint16_t vmid,const char * name)33 bool vm_has_matched_name(uint16_t vmid, const char *name)
34 {
35 	struct acrn_vm_config *vm_config = get_vm_config(vmid);
36 
37 	return (strncmp(vm_config->name, name, MAX_VM_NAME_LEN) == 0);
38 }
39