mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-13 09:02:53 +00:00
Move x86 architecture dependent per cpu data into a seperate structure and embeded it in per_cpu_region. caller could access architecture dependent member by using prefix 'arch.'. v2->v3: move whose_iwkey, profiling_info and tsc_suspend to x86 v1->v2: rebased on latest repo Tracked-On: #8801 Signed-off-by: hangliu1 <hang1.liu@intel.com> Reviewed-by: Wang, Yu1 <yu1.wang@intel.com> Reviewed-by: Liu, Yifan1 <yifan1.liu@intel.com> Reviewed-by: Chen, Jian Jun<jian.jun.chen@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
37 lines
655 B
C
37 lines
655 B
C
/*
|
|
* Copyright (C) 2023 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <types.h>
|
|
#include <softirq.h>
|
|
#include <trace.h>
|
|
#include <asm/guest/virq.h>
|
|
#include <hw/hw_thermal.h>
|
|
#include <per_cpu.h>
|
|
|
|
static void thermal_softirq(uint16_t pcpu_id)
|
|
{
|
|
struct acrn_vcpu *vcpu;
|
|
uint32_t idx;
|
|
|
|
for (idx = 0; idx < CONFIG_MAX_VM_NUM; idx++) {
|
|
vcpu = per_cpu(vcpu_array, pcpu_id)[idx];
|
|
if (vcpu != NULL) {
|
|
vcpu_inject_thermal_interrupt(vcpu);
|
|
}
|
|
}
|
|
}
|
|
|
|
void thermal_init(void)
|
|
{
|
|
uint16_t pcpu_id = get_pcpu_id();
|
|
|
|
if (pcpu_id == BSP_CPU_ID) {
|
|
register_softirq(SOFTIRQ_THERMAL, thermal_softirq);
|
|
}
|
|
|
|
init_hw_thermal();
|
|
}
|