virt inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ID7MBH ------------------------------------------------------------------------ IPIV is a per-VM feature. When checking whether IPIV is supported, it is more appropriate to use kvm as the input parameter. Fixes: cd77c03a1ee1 ("KVM: arm64: Implement PV_SGI related calls") Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- arch/arm64/kvm/hisilicon/hisi_virt.c | 10 +++++----- arch/arm64/kvm/hisilicon/hisi_virt.h | 4 ++-- arch/arm64/kvm/hypercalls.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kvm/hisilicon/hisi_virt.c b/arch/arm64/kvm/hisilicon/hisi_virt.c index cf22f247f00f..5731d337b228 100644 --- a/arch/arm64/kvm/hisilicon/hisi_virt.c +++ b/arch/arm64/kvm/hisilicon/hisi_virt.c @@ -201,27 +201,27 @@ bool hisi_ipiv_supported(void) extern struct static_key_false ipiv_enable; -bool hisi_ipiv_supported_per_vm(struct kvm_vcpu *vcpu) +bool hisi_ipiv_supported_per_vm(struct kvm *kvm) { /* IPIV is supported by the hardware */ if (!static_branch_unlikely(&ipiv_enable)) return false; /* vSGI passthrough is configured */ - if (!vcpu->kvm->arch.vgic.nassgireq) + if (!kvm->arch.vgic.nassgireq) return false; /* IPIV is enabled by the user */ - if (!vcpu->kvm->arch.vgic.its_vm.enable_ipiv_from_vmm) + if (!kvm->arch.vgic.its_vm.enable_ipiv_from_vmm) return false; return true; } -void hisi_ipiv_enable_per_vm(struct kvm_vcpu *vcpu) +void hisi_ipiv_enable_per_vm(struct kvm *kvm) { /* Enable IPIV feature */ - vcpu->kvm->arch.vgic.its_vm.enable_ipiv_from_guest = true; + kvm->arch.vgic.its_vm.enable_ipiv_from_guest = true; } void ipiv_gicd_init(void) diff --git a/arch/arm64/kvm/hisilicon/hisi_virt.h b/arch/arm64/kvm/hisilicon/hisi_virt.h index 74f469a1c2f6..fcf65cec942e 100644 --- a/arch/arm64/kvm/hisilicon/hisi_virt.h +++ b/arch/arm64/kvm/hisilicon/hisi_virt.h @@ -96,8 +96,8 @@ bool hisi_ncsnp_supported(void); bool hisi_dvmbm_supported(void); #ifdef CONFIG_ARM64_HISI_IPIV bool hisi_ipiv_supported(void); -bool hisi_ipiv_supported_per_vm(struct kvm_vcpu *vcpu); -void hisi_ipiv_enable_per_vm(struct kvm_vcpu *vcpu); +bool hisi_ipiv_supported_per_vm(struct kvm *kvm); +void hisi_ipiv_enable_per_vm(struct kvm *kvm); void ipiv_gicd_init(void); #endif /* CONFIG_ARM64_HISI_IPIV */ void kvm_get_pg_cfg(void); diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c index 3e17e4620895..e71fed7f7135 100644 --- a/arch/arm64/kvm/hypercalls.c +++ b/arch/arm64/kvm/hypercalls.c @@ -377,14 +377,14 @@ int kvm_smccc_call_handler(struct kvm_vcpu *vcpu) #endif /* CONFIG_PARAVIRT_SCHED */ #ifdef CONFIG_ARM64_HISI_IPIV case ARM_SMCCC_VENDOR_PV_SGI_FEATURES: - if (hisi_ipiv_supported_per_vm(vcpu)) + if (hisi_ipiv_supported_per_vm(vcpu->kvm)) val[0] = SMCCC_RET_SUCCESS; else val[0] = SMCCC_RET_NOT_SUPPORTED; break; case ARM_SMCCC_VENDOR_PV_SGI_ENABLE: - if (hisi_ipiv_supported_per_vm(vcpu)) { - hisi_ipiv_enable_per_vm(vcpu); + if (hisi_ipiv_supported_per_vm(vcpu->kvm)) { + hisi_ipiv_enable_per_vm(vcpu->kvm); val[0] = SMCCC_RET_SUCCESS; } else { val[0] = SMCCC_RET_NOT_SUPPORTED; -- 2.33.0