anolis: kvm: fix compilation error when kvm is compiled as m

ANBZ: #11194

when kvm is compiled as m, there is a compilation error.

Signed-off-by: Min Li <gumi@linux.alibaba.com>
Reviewed-by: Bin Guo <guobin@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/4355
This commit is contained in:
Min Li 2024-12-23 11:52:04 +08:00 committed by gumi@linux.alibaba.com
parent 63c90de544
commit 392a2a5f7c
5 changed files with 15 additions and 20 deletions

View File

@ -263,8 +263,7 @@ struct tmi_tec_run {
#define KVM_CAP_ARM_TMM_CFG_PMU 4
DECLARE_STATIC_KEY_FALSE(kvm_cvm_is_available);
DECLARE_STATIC_KEY_FALSE(kvm_cvm_is_enable);
bool hisi_kvm_cvm_is_enabled(void);
struct kvm_cap_arm_tmm_config_item {
__u32 cfg;
union {

View File

@ -2048,7 +2048,7 @@ int kvm_arch_init(void *opaque)
return -ENODEV;
}
#ifdef CONFIG_CVM_HOST
if (static_branch_unlikely(&kvm_cvm_is_enable) && in_hyp_mode) {
if (hisi_kvm_cvm_is_enabled() && in_hyp_mode) {
err = kvm_init_tmm();
if (err)
return err;

View File

@ -17,27 +17,22 @@
static DEFINE_SPINLOCK(cvm_vmid_lock);
static unsigned long *cvm_vmid_bitmap;
DEFINE_STATIC_KEY_FALSE(kvm_cvm_is_available);
DEFINE_STATIC_KEY_FALSE(kvm_cvm_is_enable);
static bool kvm_cvm_is_enable;
#define SIMD_PAGE_SIZE 0x3000
static int __init setup_cvm_host(char *str)
bool hisi_kvm_cvm_is_enabled(void)
{
int ret;
unsigned int val;
if (!str)
return 0;
ret = kstrtouint(str, 10, &val);
if (ret) {
pr_warn("Unable to parse cvm_guest.\n");
} else {
if (val)
static_branch_enable(&kvm_cvm_is_enable);
}
return ret;
return kvm_cvm_is_enable;
}
#ifdef MODULE
module_param_named(cvm_host, kvm_cvm_is_enable, bool, 0444);
#else
static int __init setup_cvm_host(char *buf)
{
return strtobool(buf, &kvm_cvm_is_enable);
}
early_param("cvm_host", setup_cvm_host);
#endif
static int cvm_vmid_init(void)
{

View File

@ -161,7 +161,7 @@ static void hardware_disable_dvmbm(void *data)
bool hisi_dvmbm_supported(void)
{
#ifdef CONFIG_CVM_HOST
if (static_branch_unlikely(&kvm_cvm_is_enable))
if (hisi_kvm_cvm_is_enabled())
return false;
#endif
if (cpu_type != HI_IP09)

View File

@ -781,6 +781,7 @@ void arm_pmu_set_phys_irq(bool enable)
put_cpu();
}
EXPORT_SYMBOL_GPL(arm_pmu_set_phys_irq);
#endif
#ifdef CONFIG_CPU_PM