Date: Fri, 7 Nov 2025 14:59:10 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 129cedd20bc6 - stable/15 - riscv/vmm: Remove a redundant maxcpu check in vm_alloc_vcpu() Message-ID: <202511071459.5A7ExAlZ083943@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=129cedd20bc61a4851d3699c8afeed321bb03ae1 commit 129cedd20bc61a4851d3699c8afeed321bb03ae1 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-10-31 14:08:45 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-11-07 14:10:29 +0000 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 (cherry picked from commit 5baa83cfcbd87109dc8a61fbb2e183998cc2d5c5) --- sys/riscv/vmm/vmm.c | 4 ---- sys/riscv/vmm/vmm_aplic.c | 10 ---------- sys/riscv/vmm/vmm_aplic.h | 1 - 3 files changed, 15 deletions(-) diff --git a/sys/riscv/vmm/vmm.c b/sys/riscv/vmm/vmm.c index fda444d6461b..7944c3d7a214 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_ */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202511071459.5A7ExAlZ083943>
