HV: add cpu affinity info for SOS VM

Previously the CPU affinity of SOS VM is initialized at runtime during
sanitize_vm_config() stage, follow the policy that all physical CPUs
except ocuppied by Pre-launched VMs are all belong to SOS_VM. Now change
the process that SOS CPU affinity should be initialized at build time
and has the assumption that its validity is guarenteed before runtime.

Tracked-On: #5077

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2020-07-16 14:45:41 +08:00
committed by wenlingz
parent 3acafd140f
commit b9ad04d24d
8 changed files with 18 additions and 23 deletions

View File

@@ -45,6 +45,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Allow SOS to reboot the host since there is supposed to be the highest severity guest */
.guest_flags = 0UL,
.cpu_affinity = SOS_VM_CONFIG_CPU_AFFINITY,
.memory = {
.start_hpa = 0UL,
.size = CONFIG_SOS_RAM_SIZE,

View File

@@ -34,6 +34,8 @@
SOS_IDLE \
SOS_BOOTARGS_DIFF
#define SOS_VM_CONFIG_CPU_AFFINITY (AFFINITY_CPU(0U) | AFFINITY_CPU(1U) | AFFINITY_CPU(2U))
#define VM2_CONFIG_CPU_AFFINITY (AFFINITY_CPU(2U))
#endif /* VM_CONFIGURATIONS_H */

View File

@@ -58,6 +58,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Allow SOS to reboot the host since there is supposed to be the highest severity guest */
.guest_flags = 0UL,
.cpu_affinity = SOS_VM_CONFIG_CPU_AFFINITY,
.memory = {
.start_hpa = 0UL,
.size = CONFIG_SOS_RAM_SIZE,

View File

@@ -34,6 +34,8 @@
SOS_IDLE \
SOS_BOOTARGS_DIFF
#define SOS_VM_CONFIG_CPU_AFFINITY (AFFINITY_CPU(0U) | AFFINITY_CPU(1U))
#define VM2_CONFIG_CPU_AFFINITY (AFFINITY_CPU(1U))
#endif /* VM_CONFIGURATIONS_H */

View File

@@ -14,6 +14,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Allow SOS to reboot the host since there is supposed to be the highest severity guest */
.guest_flags = 0UL,
.cpu_affinity = SOS_VM_CONFIG_CPU_AFFINITY,
.memory = {
.start_hpa = 0UL,
.size = CONFIG_SOS_RAM_SIZE,

View File

@@ -27,6 +27,8 @@
SOS_IDLE \
SOS_BOOTARGS_DIFF
#define SOS_VM_CONFIG_CPU_AFFINITY (AFFINITY_CPU(0U) | AFFINITY_CPU(1U) | AFFINITY_CPU(2U) | AFFINITY_CPU(3U))
#define VM1_CONFIG_CPU_AFFINITY (AFFINITY_CPU(0U) | AFFINITY_CPU(1U))
#define VM2_CONFIG_CPU_AFFINITY (AFFINITY_CPU(2U) | AFFINITY_CPU(3U))
#define VM3_CONFIG_CPU_AFFINITY (AFFINITY_CPU(0U) | AFFINITY_CPU(1U))