hv: add param to control INIT used to kick pCPU

By default, notification IPI used to kick sharing pCPU, INIT
used to kick partition pCPU. If USE_INIT_IPI flag is passed to
hypervisor, only INIT will be used to kick pCPU.

Tracked-On: #8207
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Minggui Cao 2022-09-21 15:27:57 +08:00 committed by acrnsi-robot
parent 2c140addaf
commit bc4c773cf8
4 changed files with 18 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include <lib/sprintf.h> #include <lib/sprintf.h>
#include <asm/lapic.h> #include <asm/lapic.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <console.h>
/* stack_frame is linked with the sequence of stack operation in arch_switch_to() */ /* stack_frame is linked with the sequence of stack operation in arch_switch_to() */
struct stack_frame { struct stack_frame {
@ -526,11 +527,13 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
vcpu->vcpu_id = vcpu_id; vcpu->vcpu_id = vcpu_id;
per_cpu(ever_run_vcpu, pcpu_id) = vcpu; per_cpu(ever_run_vcpu, pcpu_id) = vcpu;
if (is_lapic_pt_configured(vm)) { if (is_lapic_pt_configured(vm) || is_using_init_ipi()) {
per_cpu(mode_to_kick_pcpu, pcpu_id) = DEL_MODE_INIT; per_cpu(mode_to_kick_pcpu, pcpu_id) = DEL_MODE_INIT;
} else { } else {
per_cpu(mode_to_kick_pcpu, pcpu_id) = DEL_MODE_IPI; per_cpu(mode_to_kick_pcpu, pcpu_id) = DEL_MODE_IPI;
} }
pr_info("pcpu=%d, kick-mode=%d, use_init_flag=%d", pcpu_id,
per_cpu(mode_to_kick_pcpu, pcpu_id), is_using_init_ipi());
/* Initialize the parent VM reference */ /* Initialize the parent VM reference */
vcpu->vm = vm; vcpu->vm = vm;

View File

@ -25,6 +25,14 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */ #define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */
uint16_t console_vmid = ACRN_INVALID_VMID; uint16_t console_vmid = ACRN_INVALID_VMID;
/* if use INIT to kick pcpu only, if not notification IPI still is used for sharing CPU */
static bool use_init_ipi = false;
bool is_using_init_ipi(void)
{
return use_init_ipi;
}
static void parse_hvdbg_cmdline(void) static void parse_hvdbg_cmdline(void)
{ {
const char *start = NULL; const char *start = NULL;
@ -43,6 +51,9 @@ static void parse_hvdbg_cmdline(void)
if (!handle_dbg_cmd(start, (int32_t)(end - start))) { if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can be handled further */ /* if not handled by handle_dbg_cmd, it can be handled further */
if (strncmp(start, "USE_INIT_IPI", (size_t)(end - start)) == 0) {
use_init_ipi = true;
}
} }
start = end; start = end;
} }

View File

@ -41,5 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu *vcpu);
void suspend_console(void); void suspend_console(void);
void resume_console(void); void resume_console(void);
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm); struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
bool is_using_init_ipi(void);
#endif /* CONSOLE_H */ #endif /* CONSOLE_H */

View File

@ -29,5 +29,7 @@ void resume_console(void) {}
bool handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) { return false; } bool handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) { return false; }
void console_vmexit_callback(__unused struct acrn_vcpu *vcpu) {} void console_vmexit_callback(__unused struct acrn_vcpu *vcpu) {}
bool is_using_init_ipi(void) { return false; }
void shell_init(void) {} void shell_init(void) {}
void shell_kick(void) {} void shell_kick(void) {}