mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-17 03:07:27 +00:00
HV:treewide:Update cpu_id type as uint_16
There are extra type conversion in the HV since cpu_id type is uint32_t and the return value type of get_cpu_id is uint16_t. BTW, the name of cpu_id is not clear enough to express its usage. So the following updates are made in this patch: Update cpu_id type as unit_16 to reduce type casting; Update related temporary variables type; Update related print argument; Change the input parameter name of interrupt_init as cpu_id to keep align with function implement; Rename cpu_id as pcpu_id as needed. Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
188210ab03
commit
b76c92bf3e
@ -31,22 +31,22 @@ struct vcpu *get_ever_run_vcpu(uint16_t pcpu_id)
|
|||||||
* for physical CPU 1 : vcpu->pcpu_id = 1, vcpu->vcpu_id = 1, vmid = 1;
|
* for physical CPU 1 : vcpu->pcpu_id = 1, vcpu->vcpu_id = 1, vmid = 1;
|
||||||
*
|
*
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
int create_vcpu(uint16_t cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
||||||
{
|
{
|
||||||
struct vcpu *vcpu;
|
struct vcpu *vcpu;
|
||||||
|
|
||||||
ASSERT(vm != NULL, "");
|
ASSERT(vm != NULL, "");
|
||||||
ASSERT(rtn_vcpu_handle != NULL, "");
|
ASSERT(rtn_vcpu_handle != NULL, "");
|
||||||
|
|
||||||
pr_info("Creating VCPU %d", cpu_id);
|
pr_info("Creating VCPU %hu", pcpu_id);
|
||||||
|
|
||||||
/* Allocate memory for VCPU */
|
/* Allocate memory for VCPU */
|
||||||
vcpu = calloc(1, sizeof(struct vcpu));
|
vcpu = calloc(1, sizeof(struct vcpu));
|
||||||
ASSERT(vcpu != NULL, "");
|
ASSERT(vcpu != NULL, "");
|
||||||
|
|
||||||
/* Initialize the physical CPU ID for this VCPU */
|
/* Initialize the physical CPU ID for this VCPU */
|
||||||
vcpu->pcpu_id = cpu_id;
|
vcpu->pcpu_id = pcpu_id;
|
||||||
per_cpu(ever_run_vcpu, cpu_id) = vcpu;
|
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;
|
||||||
|
|
||||||
/* Initialize the parent VM reference */
|
/* Initialize the parent VM reference */
|
||||||
vcpu->vm = vm;
|
vcpu->vm = vm;
|
||||||
@ -72,7 +72,7 @@ int create_vcpu(uint16_t cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
|||||||
ASSERT(vcpu->vcpu_id < vm->hw.num_vcpus,
|
ASSERT(vcpu->vcpu_id < vm->hw.num_vcpus,
|
||||||
"Allocated vcpu_id is out of range!");
|
"Allocated vcpu_id is out of range!");
|
||||||
|
|
||||||
per_cpu(vcpu, cpu_id) = vcpu;
|
per_cpu(vcpu, pcpu_id) = vcpu;
|
||||||
|
|
||||||
pr_info("PCPU%d is working as VM%d VCPU%d, Role: %s",
|
pr_info("PCPU%d is working as VM%d VCPU%d, Role: %s",
|
||||||
vcpu->pcpu_id, vcpu->vm->attr.id, vcpu->vcpu_id,
|
vcpu->pcpu_id, vcpu->vm->attr.id, vcpu->vcpu_id,
|
||||||
|
@ -376,19 +376,19 @@ int init_default_irqs(uint16_t cpu_id)
|
|||||||
|
|
||||||
void dispatch_exception(struct intr_excp_ctx *ctx)
|
void dispatch_exception(struct intr_excp_ctx *ctx)
|
||||||
{
|
{
|
||||||
unsigned int cpu_id = get_cpu_id();
|
uint16_t pcpu_id = get_cpu_id();
|
||||||
|
|
||||||
/* Obtain lock to ensure exception dump doesn't get corrupted */
|
/* Obtain lock to ensure exception dump doesn't get corrupted */
|
||||||
spinlock_obtain(&exception_spinlock);
|
spinlock_obtain(&exception_spinlock);
|
||||||
|
|
||||||
/* Dump exception context */
|
/* Dump exception context */
|
||||||
dump_exception(ctx, cpu_id);
|
dump_exception(ctx, pcpu_id);
|
||||||
|
|
||||||
/* Release lock to let other CPUs handle exception */
|
/* Release lock to let other CPUs handle exception */
|
||||||
spinlock_release(&exception_spinlock);
|
spinlock_release(&exception_spinlock);
|
||||||
|
|
||||||
/* Halt the CPU */
|
/* Halt the CPU */
|
||||||
cpu_dead(cpu_id);
|
cpu_dead(pcpu_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_spurious_interrupt(uint32_t vector)
|
void handle_spurious_interrupt(uint32_t vector)
|
||||||
@ -710,19 +710,19 @@ void get_cpu_interrupt_info(char *str, int str_max)
|
|||||||
}
|
}
|
||||||
#endif /* HV_DEBUG */
|
#endif /* HV_DEBUG */
|
||||||
|
|
||||||
int interrupt_init(uint32_t cpu_id)
|
int interrupt_init(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
struct host_idt_descriptor *idtd = &HOST_IDTR;
|
struct host_idt_descriptor *idtd = &HOST_IDTR;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
set_idt(idtd);
|
set_idt(idtd);
|
||||||
|
|
||||||
status = init_lapic(cpu_id);
|
status = init_lapic(pcpu_id);
|
||||||
ASSERT(status == 0, "lapic init failed");
|
ASSERT(status == 0, "lapic init failed");
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
status = init_default_irqs(cpu_id);
|
status = init_default_irqs(pcpu_id);
|
||||||
ASSERT(status == 0, "irqs init failed");
|
ASSERT(status == 0, "irqs init failed");
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -211,11 +211,11 @@ int early_init_lapic(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int init_lapic(uint16_t cpu_id)
|
int init_lapic(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
/* Set the Logical Destination Register */
|
/* Set the Logical Destination Register */
|
||||||
write_lapic_reg32(LAPIC_LOGICAL_DESTINATION_REGISTER,
|
write_lapic_reg32(LAPIC_LOGICAL_DESTINATION_REGISTER,
|
||||||
((1U << cpu_id) << 24));
|
((1U << pcpu_id) << 24U));
|
||||||
|
|
||||||
/* Set the Destination Format Register */
|
/* Set the Destination Format Register */
|
||||||
write_lapic_reg32(LAPIC_DESTINATION_FORMAT_REGISTER, 0xf << 28);
|
write_lapic_reg32(LAPIC_DESTINATION_FORMAT_REGISTER, 0xf << 28);
|
||||||
|
@ -18,11 +18,11 @@ void enable_softirq(uint16_t cpu_id)
|
|||||||
|
|
||||||
void init_softirq(void)
|
void init_softirq(void)
|
||||||
{
|
{
|
||||||
uint16_t cpu_id;
|
uint16_t pcpu_id;
|
||||||
|
|
||||||
for (cpu_id = 0; cpu_id < phys_cpu_num; cpu_id++) {
|
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
|
||||||
per_cpu(softirq_pending, cpu_id) = 0;
|
per_cpu(softirq_pending, pcpu_id) = 0;
|
||||||
bitmap_set(SOFTIRQ_ATOMIC, &per_cpu(softirq_pending, cpu_id));
|
bitmap_set(SOFTIRQ_ATOMIC, &per_cpu(softirq_pending, pcpu_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,33 +104,33 @@ static bool is_vm0_bsp(uint16_t pcpu_id)
|
|||||||
return pcpu_id == vm0_desc.vm_hw_logical_core_ids[0];
|
return pcpu_id == vm0_desc.vm_hw_logical_core_ids[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t hv_main(uint16_t cpu_id)
|
int32_t hv_main(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
|
|
||||||
pr_info("%s, Starting common entry point for CPU %d",
|
pr_info("%s, Starting common entry point for CPU %hu",
|
||||||
__func__, cpu_id);
|
__func__, pcpu_id);
|
||||||
|
|
||||||
if (cpu_id >= phys_cpu_num) {
|
if (pcpu_id >= phys_cpu_num) {
|
||||||
pr_err("%s, cpu_id %d out of range %d\n",
|
pr_err("%s, cpu_id %hu out of range %d\n",
|
||||||
__func__, cpu_id, phys_cpu_num);
|
__func__, pcpu_id, phys_cpu_num);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpu_id != get_cpu_id()) {
|
if (pcpu_id != get_cpu_id()) {
|
||||||
pr_err("%s, cpu_id %d mismatch\n", __func__, cpu_id);
|
pr_err("%s, cpu_id %hu mismatch\n", __func__, pcpu_id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable virtualization extensions */
|
/* Enable virtualization extensions */
|
||||||
ret = exec_vmxon_instr(cpu_id);
|
ret = exec_vmxon_instr(pcpu_id);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* X2APIC mode is disabled by default. */
|
/* X2APIC mode is disabled by default. */
|
||||||
x2apic_enabled = false;
|
x2apic_enabled = false;
|
||||||
|
|
||||||
if (is_vm0_bsp(cpu_id)) {
|
if (is_vm0_bsp(pcpu_id)) {
|
||||||
ret = prepare_vm0();
|
ret = prepare_vm0();
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -167,11 +167,11 @@ static void show_guest_call_trace(struct vcpu *vcpu)
|
|||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_guest_context(uint32_t cpu_id)
|
static void dump_guest_context(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
struct vcpu *vcpu;
|
struct vcpu *vcpu;
|
||||||
|
|
||||||
vcpu = per_cpu(vcpu, cpu_id);
|
vcpu = per_cpu(vcpu, pcpu_id);
|
||||||
if (vcpu != NULL) {
|
if (vcpu != NULL) {
|
||||||
dump_guest_reg(vcpu);
|
dump_guest_reg(vcpu);
|
||||||
dump_guest_stack(vcpu);
|
dump_guest_stack(vcpu);
|
||||||
@ -179,13 +179,13 @@ static void dump_guest_context(uint32_t cpu_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint32_t cpu_id)
|
static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
uint32_t i = 0U;
|
uint32_t i = 0U;
|
||||||
uint32_t cb_hierarchy = 0U;
|
uint32_t cb_hierarchy = 0U;
|
||||||
uint64_t *sp = (uint64_t *)rsp;
|
uint64_t *sp = (uint64_t *)rsp;
|
||||||
|
|
||||||
printf("\r\nHost Stack: CPU_ID = %d\r\n", cpu_id);
|
printf("\r\nHost Stack: CPU_ID = %hu\r\n", pcpu_id);
|
||||||
for (i = 0U; i < DUMP_STACK_SIZE/32U; i++) {
|
for (i = 0U; i < DUMP_STACK_SIZE/32U; i++) {
|
||||||
printf("addr(0x%llx) 0x%016llx 0x%016llx 0x%016llx "
|
printf("addr(0x%llx) 0x%016llx 0x%016llx 0x%016llx "
|
||||||
"0x%016llx\r\n", (rsp+i*32U), sp[i*4U], sp[i*4U+1U],
|
"0x%016llx\r\n", (rsp+i*32U), sp[i*4U], sp[i*4U+1U],
|
||||||
@ -195,8 +195,8 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint32_t cpu_id)
|
|||||||
|
|
||||||
printf("Host Call Trace:\r\n");
|
printf("Host Call Trace:\r\n");
|
||||||
if (rsp >
|
if (rsp >
|
||||||
(uint64_t)&per_cpu(stack, cpu_id)[CONFIG_STACK_SIZE - 1]
|
(uint64_t)&per_cpu(stack, pcpu_id)[CONFIG_STACK_SIZE - 1]
|
||||||
|| rsp < (uint64_t)&per_cpu(stack, cpu_id)[0]) {
|
|| rsp < (uint64_t)&per_cpu(stack, pcpu_id)[0]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,8 +214,8 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint32_t cpu_id)
|
|||||||
* if the address is invalid, it will cause hv page fault
|
* if the address is invalid, it will cause hv page fault
|
||||||
* then halt system */
|
* then halt system */
|
||||||
while ((rbp <=
|
while ((rbp <=
|
||||||
(uint64_t)&per_cpu(stack, cpu_id)[CONFIG_STACK_SIZE - 1])
|
(uint64_t)&per_cpu(stack, pcpu_id)[CONFIG_STACK_SIZE - 1])
|
||||||
&& (rbp >= (uint64_t)&per_cpu(stack, cpu_id)[0])
|
&& (rbp >= (uint64_t)&per_cpu(stack, pcpu_id)[0])
|
||||||
&& (cb_hierarchy++ < CALL_TRACE_HIERARCHY_MAX)) {
|
&& (cb_hierarchy++ < CALL_TRACE_HIERARCHY_MAX)) {
|
||||||
printf("----> 0x%016llx\r\n",
|
printf("----> 0x%016llx\r\n",
|
||||||
*(uint64_t *)(rbp + sizeof(uint64_t)));
|
*(uint64_t *)(rbp + sizeof(uint64_t)));
|
||||||
@ -230,14 +230,14 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint32_t cpu_id)
|
|||||||
|
|
||||||
void __assert(uint32_t line, const char *file, char *txt)
|
void __assert(uint32_t line, const char *file, char *txt)
|
||||||
{
|
{
|
||||||
uint32_t cpu_id = get_cpu_id();
|
uint16_t pcpu_id = get_cpu_id();
|
||||||
uint64_t rsp = cpu_rsp_get();
|
uint64_t rsp = cpu_rsp_get();
|
||||||
uint64_t rbp = cpu_rbp_get();
|
uint64_t rbp = cpu_rbp_get();
|
||||||
|
|
||||||
pr_fatal("Assertion failed in file %s,line %u : %s",
|
pr_fatal("Assertion failed in file %s,line %u : %s",
|
||||||
file, line, txt);
|
file, line, txt);
|
||||||
show_host_call_trace(rsp, rbp, cpu_id);
|
show_host_call_trace(rsp, rbp, pcpu_id);
|
||||||
dump_guest_context(cpu_id);
|
dump_guest_context(pcpu_id);
|
||||||
do {
|
do {
|
||||||
asm volatile ("pause" ::: "memory");
|
asm volatile ("pause" ::: "memory");
|
||||||
} while (1);
|
} while (1);
|
||||||
@ -278,14 +278,14 @@ void dump_intr_excp_frame(struct intr_excp_ctx *ctx)
|
|||||||
printf("===========================\n");
|
printf("===========================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_exception(struct intr_excp_ctx *ctx, uint32_t cpu_id)
|
void dump_exception(struct intr_excp_ctx *ctx, uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
/* Dump host context */
|
/* Dump host context */
|
||||||
dump_intr_excp_frame(ctx);
|
dump_intr_excp_frame(ctx);
|
||||||
/* Show host stack */
|
/* Show host stack */
|
||||||
show_host_call_trace(ctx->rsp, ctx->rbp, cpu_id);
|
show_host_call_trace(ctx->rsp, ctx->rbp, pcpu_id);
|
||||||
/* Dump guest context */
|
/* Dump guest context */
|
||||||
dump_guest_context(cpu_id);
|
dump_guest_context(pcpu_id);
|
||||||
|
|
||||||
/* Save registers*/
|
/* Save registers*/
|
||||||
crash_ctx = ctx;
|
crash_ctx = ctx;
|
||||||
|
@ -20,24 +20,24 @@ struct logmsg {
|
|||||||
|
|
||||||
static struct logmsg logmsg;
|
static struct logmsg logmsg;
|
||||||
|
|
||||||
static inline void alloc_earlylog_sbuf(uint32_t cpu_id)
|
static inline void alloc_earlylog_sbuf(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
uint32_t ele_size = LOG_ENTRY_SIZE;
|
uint32_t ele_size = LOG_ENTRY_SIZE;
|
||||||
uint32_t ele_num = ((HVLOG_BUF_SIZE >> 1) / phys_cpu_num
|
uint32_t ele_num = ((HVLOG_BUF_SIZE >> 1) / phys_cpu_num
|
||||||
- SBUF_HEAD_SIZE) / ele_size;
|
- SBUF_HEAD_SIZE) / ele_size;
|
||||||
|
|
||||||
per_cpu(earlylog_sbuf, cpu_id) = sbuf_allocate(ele_num, ele_size);
|
per_cpu(earlylog_sbuf, pcpu_id) = sbuf_allocate(ele_num, ele_size);
|
||||||
if (per_cpu(earlylog_sbuf, cpu_id) == NULL)
|
if (per_cpu(earlylog_sbuf, pcpu_id) == NULL)
|
||||||
printf("failed to allcate sbuf for hvlog - %d\n", cpu_id);
|
printf("failed to allcate sbuf for hvlog - %hu\n", pcpu_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void free_earlylog_sbuf(uint32_t cpu_id)
|
static inline void free_earlylog_sbuf(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
if (per_cpu(earlylog_sbuf, cpu_id) == NULL)
|
if (per_cpu(earlylog_sbuf, pcpu_id) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(per_cpu(earlylog_sbuf, cpu_id));
|
free(per_cpu(earlylog_sbuf, pcpu_id));
|
||||||
per_cpu(earlylog_sbuf, cpu_id) = NULL;
|
per_cpu(earlylog_sbuf, pcpu_id) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_copy_earlylog(struct shared_buf *dst_sbuf,
|
static int do_copy_earlylog(struct shared_buf *dst_sbuf,
|
||||||
@ -69,21 +69,21 @@ static int do_copy_earlylog(struct shared_buf *dst_sbuf,
|
|||||||
|
|
||||||
void init_logmsg(__unused uint32_t mem_size, uint32_t flags)
|
void init_logmsg(__unused uint32_t mem_size, uint32_t flags)
|
||||||
{
|
{
|
||||||
int32_t idx;
|
int16_t pcpu_id;
|
||||||
|
|
||||||
logmsg.flags = flags;
|
logmsg.flags = flags;
|
||||||
logmsg.seq = 0;
|
logmsg.seq = 0;
|
||||||
|
|
||||||
/* allocate sbuf for log before sos booting */
|
/* allocate sbuf for log before sos booting */
|
||||||
for (idx = 0; idx < phys_cpu_num; idx++)
|
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++)
|
||||||
alloc_earlylog_sbuf(idx);
|
alloc_earlylog_sbuf(pcpu_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_logmsg(uint32_t severity, const char *fmt, ...)
|
void do_logmsg(uint32_t severity, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
uint64_t timestamp;
|
uint64_t timestamp;
|
||||||
uint32_t cpu_id;
|
uint16_t pcpu_id;
|
||||||
bool do_console_log;
|
bool do_console_log;
|
||||||
bool do_mem_log;
|
bool do_mem_log;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
@ -104,14 +104,14 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
|
|||||||
timestamp = ticks_to_us(timestamp);
|
timestamp = ticks_to_us(timestamp);
|
||||||
|
|
||||||
/* Get CPU ID */
|
/* Get CPU ID */
|
||||||
cpu_id = get_cpu_id();
|
pcpu_id = get_cpu_id();
|
||||||
buffer = per_cpu(logbuf, cpu_id);
|
buffer = per_cpu(logbuf, pcpu_id);
|
||||||
|
|
||||||
memset(buffer, 0, LOG_MESSAGE_MAX_SIZE);
|
memset(buffer, 0, LOG_MESSAGE_MAX_SIZE);
|
||||||
/* Put time-stamp, CPU ID and severity into buffer */
|
/* Put time-stamp, CPU ID and severity into buffer */
|
||||||
snprintf(buffer, LOG_MESSAGE_MAX_SIZE,
|
snprintf(buffer, LOG_MESSAGE_MAX_SIZE,
|
||||||
"[%lluus][cpu=%u][sev=%u][seq=%u]:",
|
"[%lluus][cpu=%hu][sev=%u][seq=%u]:",
|
||||||
timestamp, cpu_id, severity,
|
timestamp, pcpu_id, severity,
|
||||||
atomic_inc_return(&logmsg.seq));
|
atomic_inc_return(&logmsg.seq));
|
||||||
|
|
||||||
/* Put message into remaining portion of local buffer */
|
/* Put message into remaining portion of local buffer */
|
||||||
@ -135,14 +135,14 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
|
|||||||
if (do_mem_log) {
|
if (do_mem_log) {
|
||||||
int i, msg_len;
|
int i, msg_len;
|
||||||
struct shared_buf *sbuf = (struct shared_buf *)
|
struct shared_buf *sbuf = (struct shared_buf *)
|
||||||
per_cpu(sbuf, cpu_id)[ACRN_HVLOG];
|
per_cpu(sbuf, pcpu_id)[ACRN_HVLOG];
|
||||||
struct shared_buf *early_sbuf = per_cpu(earlylog_sbuf, cpu_id);
|
struct shared_buf *early_sbuf = per_cpu(earlylog_sbuf, pcpu_id);
|
||||||
|
|
||||||
if (early_sbuf != NULL) {
|
if (early_sbuf != NULL) {
|
||||||
if (sbuf != NULL) {
|
if (sbuf != NULL) {
|
||||||
/* switch to sbuf from sos */
|
/* switch to sbuf from sos */
|
||||||
do_copy_earlylog(sbuf, early_sbuf);
|
do_copy_earlylog(sbuf, early_sbuf);
|
||||||
free_earlylog_sbuf(cpu_id);
|
free_earlylog_sbuf(pcpu_id);
|
||||||
} else
|
} else
|
||||||
/* use earlylog sbuf if no sbuf from sos */
|
/* use earlylog sbuf if no sbuf from sos */
|
||||||
sbuf = early_sbuf;
|
sbuf = early_sbuf;
|
||||||
@ -160,7 +160,7 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_logmsg_buffer(uint32_t cpu_id)
|
void print_logmsg_buffer(uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
spinlock_rflags;
|
spinlock_rflags;
|
||||||
char buffer[LOG_ENTRY_SIZE + 1];
|
char buffer[LOG_ENTRY_SIZE + 1];
|
||||||
@ -168,20 +168,20 @@ void print_logmsg_buffer(uint32_t cpu_id)
|
|||||||
struct shared_buf **sbuf;
|
struct shared_buf **sbuf;
|
||||||
int is_earlylog = 0;
|
int is_earlylog = 0;
|
||||||
|
|
||||||
if (cpu_id >= (uint32_t)phys_cpu_num)
|
if (pcpu_id >= phys_cpu_num)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (per_cpu(earlylog_sbuf, cpu_id) != NULL) {
|
if (per_cpu(earlylog_sbuf, pcpu_id) != NULL) {
|
||||||
sbuf = &per_cpu(earlylog_sbuf, cpu_id);
|
sbuf = &per_cpu(earlylog_sbuf, pcpu_id);
|
||||||
is_earlylog = 1;
|
is_earlylog = 1;
|
||||||
} else
|
} else
|
||||||
sbuf = (struct shared_buf **)
|
sbuf = (struct shared_buf **)
|
||||||
&per_cpu(sbuf, cpu_id)[ACRN_HVLOG];
|
&per_cpu(sbuf, pcpu_id)[ACRN_HVLOG];
|
||||||
|
|
||||||
spinlock_irqsave_obtain(&(logmsg.lock));
|
spinlock_irqsave_obtain(&(logmsg.lock));
|
||||||
if ((*sbuf) != NULL)
|
if ((*sbuf) != NULL)
|
||||||
printf("CPU%d: head: 0x%x, tail: 0x%x %s\n\r",
|
printf("CPU%hu: head: 0x%x, tail: 0x%x %s\n\r",
|
||||||
cpu_id, (*sbuf)->head, (*sbuf)->tail,
|
pcpu_id, (*sbuf)->head, (*sbuf)->tail,
|
||||||
(is_earlylog != 0) ? "[earlylog]" : "");
|
(is_earlylog != 0) ? "[earlylog]" : "");
|
||||||
spinlock_irqrestore_release(&(logmsg.lock));
|
spinlock_irqrestore_release(&(logmsg.lock));
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ struct vcpu {
|
|||||||
|
|
||||||
/* External Interfaces */
|
/* External Interfaces */
|
||||||
struct vcpu* get_ever_run_vcpu(uint16_t pcpu_id);
|
struct vcpu* get_ever_run_vcpu(uint16_t pcpu_id);
|
||||||
int create_vcpu(uint16_t cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle);
|
int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle);
|
||||||
int start_vcpu(struct vcpu *vcpu);
|
int start_vcpu(struct vcpu *vcpu);
|
||||||
int shutdown_vcpu(struct vcpu *vcpu);
|
int shutdown_vcpu(struct vcpu *vcpu);
|
||||||
void destroy_vcpu(struct vcpu *vcpu);
|
void destroy_vcpu(struct vcpu *vcpu);
|
||||||
|
@ -105,7 +105,7 @@ int exception_vmexit_handler(struct vcpu *vcpu);
|
|||||||
int interrupt_window_vmexit_handler(struct vcpu *vcpu);
|
int interrupt_window_vmexit_handler(struct vcpu *vcpu);
|
||||||
int external_interrupt_vmexit_handler(struct vcpu *vcpu);
|
int external_interrupt_vmexit_handler(struct vcpu *vcpu);
|
||||||
int acrn_handle_pending_request(struct vcpu *vcpu);
|
int acrn_handle_pending_request(struct vcpu *vcpu);
|
||||||
int interrupt_init(uint32_t logical_id);
|
int interrupt_init(uint16_t pcpu_id);
|
||||||
|
|
||||||
void cancel_event_injection(struct vcpu *vcpu);
|
void cancel_event_injection(struct vcpu *vcpu);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ struct intr_excp_ctx;
|
|||||||
#define DUMP_STACK_SIZE 0x200U
|
#define DUMP_STACK_SIZE 0x200U
|
||||||
|
|
||||||
void dump_intr_excp_frame(struct intr_excp_ctx *ctx);
|
void dump_intr_excp_frame(struct intr_excp_ctx *ctx);
|
||||||
void dump_exception(struct intr_excp_ctx *ctx, uint32_t cpu_id);
|
void dump_exception(struct intr_excp_ctx *ctx, uint16_t pcpu_id);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static inline void dump_intr_excp_frame(__unused struct intr_excp_ctx *ctx)
|
static inline void dump_intr_excp_frame(__unused struct intr_excp_ctx *ctx)
|
||||||
@ -22,7 +22,7 @@ static inline void dump_intr_excp_frame(__unused struct intr_excp_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void dump_exception(__unused struct intr_excp_ctx *ctx,
|
static inline void dump_exception(__unused struct intr_excp_ctx *ctx,
|
||||||
__unused uint32_t cpu_id)
|
__unused uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
extern uint32_t console_loglevel;
|
extern uint32_t console_loglevel;
|
||||||
extern uint32_t mem_loglevel;
|
extern uint32_t mem_loglevel;
|
||||||
void init_logmsg(uint32_t mem_size, uint32_t flags);
|
void init_logmsg(uint32_t mem_size, uint32_t flags);
|
||||||
void print_logmsg_buffer(uint32_t cpu_id);
|
void print_logmsg_buffer(uint16_t pcpu_id);
|
||||||
void do_logmsg(uint32_t severity, const char *fmt, ...);
|
void do_logmsg(uint32_t severity, const char *fmt, ...);
|
||||||
|
|
||||||
#else /* HV_DEBUG */
|
#else /* HV_DEBUG */
|
||||||
@ -45,7 +45,7 @@ static inline void do_logmsg(__unused uint32_t severity,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void print_logmsg_buffer(__unused uint32_t cpu_id)
|
static inline void print_logmsg_buffer(__unused uint16_t pcpu_id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user