Skip to contentSkip to conversation

arm64/kvm: Drop unnecessary check in kvm_vcpu_preferred_target()

PATCH New Gavin Shan 1 participant 2 messages Aug 25, 2020

Subsystems (2)
lore
Share & tools
lore

Gavin Shan

author
#0 lore raw

PATCH 1/2 arm64/kvm: Drop unnecessary check in kvm_vcpu_preferred_target()

Since commit <bca556ac468a> ("arm64/kvm: Add generic v8 KVM target"), there is no negative number returned from kvm_target_cpu(). So it's not needed to validate its return value in kvm_vcpu_preferred_target() and this just drops the unnecessary check.

---
 arch/arm64/kvm/guest.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm64/kvm/guest.c +0 -3
index dfb5218137ca..2365449ea32e 100644
@@ -835,9 +835,6 @@ int kvm_vcpu_preferred_target(struct kvm_vcpu_init *init)
 {
 	int target = kvm_target_cpu();
 
-	if (target < 0)
-		return -ENODEV;
-
 	memset(init, 0, sizeof(*init));
 
 	/*
Signature · 6 lines
2.23.0

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#1 lore raw

PATCH 2/2 arm64/kvm: Drop checking target CPU type on initializing module

The target CPU type is validated when KVM module is initialized. However, we always have a valid target CPU type since commit <bca556ac468a> ("arm64/kvm: Add generic v8 KVM target").

So it's unnecessary to validate the target CPU type at that time and this just drops it.

---
 arch/arm64/kvm/arm.c | 14 --------------
 1 file changed, 14 deletions(-)
arch/arm64/kvm/arm.c +0 -14
index 691d21e4c717..faf4bc208a4a 100644
@@ -1561,11 +1561,6 @@ static int init_hyp_mode(void)
 	return err;
 }
 
-static void check_kvm_target_cpu(void *ret)
-{
-	*(int *)ret = kvm_target_cpu();
-}
-
 struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr)
 {
 	struct kvm_vcpu *vcpu;
@@ -1625,7 +1620,6 @@ void kvm_arch_irq_bypass_start(struct irq_bypass_consumer *cons)
 int kvm_arch_init(void *opaque)
 {
 	int err;
-	int ret, cpu;
 	bool in_hyp_mode;
 
 	if (!is_hyp_mode_available()) {
@@ -1640,14 +1634,6 @@ int kvm_arch_init(void *opaque)
 		return -ENODEV;
 	}
 
-	for_each_online_cpu(cpu) {
-		smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
-		if (ret < 0) {
-			kvm_err("Error, CPU %d not supported!\n", cpu);
-			return -ENODEV;
-		}
-	}
-
 	err = init_common_resources();
 	if (err)
 		return err;
Signature · 6 lines
2.23.0

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm