aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2025-10-31 14:08:45 +0000
committerMark Johnston <markj@FreeBSD.org>2025-10-31 14:08:45 +0000
commit5baa83cfcbd87109dc8a61fbb2e183998cc2d5c5 (patch)
tree972785c6196b83b28ea27afa54f4c642766fc104
parent44ad7d4844b7b5387cfad603a28501ac5c70e37d (diff)
riscv/vmm: Remove a redundant maxcpu check in vm_alloc_vcpu()
aplic_max_cpu_count() just returns the VM's max vCPU count, and vm_alloc_vcpu() already checks that. Just remove this check so that it's easier to merge vm_alloc_vcpu() into MI code. If the APLIC really does require us to lower the limit, we should instead adjust vm->maxcpu in vm_create(). No functional change intended. Reviewed by: br MFC after: 1 week Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D53496
-rw-r--r--sys/riscv/vmm/vmm.c4
-rw-r--r--sys/riscv/vmm/vmm_aplic.c10
-rw-r--r--sys/riscv/vmm/vmm_aplic.h1
3 files changed, 0 insertions, 15 deletions
diff --git a/sys/riscv/vmm/vmm.c b/sys/riscv/vmm/vmm.c
index 24b4be89af48..a9eb9d144336 100644
--- a/sys/riscv/vmm/vmm.c
+++ b/sys/riscv/vmm/vmm.c
@@ -319,10 +319,6 @@ vm_alloc_vcpu(struct vm *vm, int vcpuid)
if (vcpuid < 0 || vcpuid >= vm_get_maxcpus(vm))
return (NULL);
- /* Some interrupt controllers may have a CPU limit */
- if (vcpuid >= aplic_max_cpu_count(vm->cookie))
- return (NULL);
-
vcpu = (struct vcpu *)
atomic_load_acq_ptr((uintptr_t *)&vm->vcpu[vcpuid]);
if (__predict_true(vcpu != NULL))
diff --git a/sys/riscv/vmm/vmm_aplic.c b/sys/riscv/vmm/vmm_aplic.c
index 4df41f2de1a5..74cb4fef4273 100644
--- a/sys/riscv/vmm/vmm_aplic.c
+++ b/sys/riscv/vmm/vmm_aplic.c
@@ -577,13 +577,3 @@ aplic_sync_hwstate(struct hypctx *hypctx)
{
}
-
-int
-aplic_max_cpu_count(struct hyp *hyp)
-{
- int16_t max_count;
-
- max_count = vm_get_maxcpus(hyp->vm);
-
- return (max_count);
-}
diff --git a/sys/riscv/vmm/vmm_aplic.h b/sys/riscv/vmm/vmm_aplic.h
index 49510221b419..96018fe9adda 100644
--- a/sys/riscv/vmm/vmm_aplic.h
+++ b/sys/riscv/vmm/vmm_aplic.h
@@ -49,6 +49,5 @@ void aplic_cpuinit(struct hypctx *hypctx);
void aplic_cpucleanup(struct hypctx *hypctx);
void aplic_flush_hwstate(struct hypctx *hypctx);
void aplic_sync_hwstate(struct hypctx *hypctx);
-int aplic_max_cpu_count(struct hyp *hyp);
#endif /* !_VMM_APLIC_H_ */