From nobody Fri Nov 7 14:59:10 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d32JZ49zpz6G3GT; Fri, 07 Nov 2025 14:59:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d32JZ1Qm0z3P07; Fri, 07 Nov 2025 14:59:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762527550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZYfZstQFBvEln1IEVBHemQ/lpA+7H89ud14cndmwpzo=; b=Nu2GA7wNXa44cEIFwfGOs6ZTM0VBi6s4wb3N8FBn6Tt2VDYHumQhHI8kyLlmQ6DmtguhPr QMKMCE3L8dHL8Nh/4Vjfr4MVc2Jtga71y8ePSjoWi3Q8J/d4y4UQhB0T8ua5rcQ/EzSjU3 Uel50/p5lonf8mE+2Io9Y6DF5YF7zLyqaY7iKQkfR6WRlP20MsbBaXSwoK8ICsrqRFYo6y 8hEwKuQM16sFP+e+d85CunrFp4zQogV/UwmgRMHpo9zN2ITpssesZjLGhNiqiczd4DvKlE QF1m1xqTJgIHDpl0GWO5f8+68ClKUdBPMGPwigK1y3xKgyNNL3+J+t4FkWUAzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762527550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZYfZstQFBvEln1IEVBHemQ/lpA+7H89ud14cndmwpzo=; b=CxZJMtjb2b7QlftxAvdRdsh6rxUX2gGWq7Lmcpj1R7m595jprXHUaaTMxOeLwiYe2zRUwq 3GbRALImX08bwyaXLOBnFwaH7LUV1w03mI/VchE1KsZOAStvqgqx2kj6nuZQZuN3zB4nXn dKkYdwsnWGsvApOFEd0NkXHVx8saCPqk7A2s+lXRfybuiaYNhZr8kVQpYUDaoKyVvdndDx iaQkOsBOG+KBNfV34VJSgf6VIE4fVfHy05qW+Br508Ni+c5A4ZmCQZpceuWpyXSiO7hR0A u6axoegQDBVry+xrgNyo55/d9b3+eA63Yf0W4CE5b5wStmQnjd7l3YKZaDenww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762527550; a=rsa-sha256; cv=none; b=iVB8SnJGLjbqtpM3c3IJQMD4OvexuC8S5D8xrc/+e7yRoefL++xEWLf/QlR2wpaFD5rEM3 zlmlHnEPy+39olPJE0ghmLQKTEKZ1VcBJKXxZJlAxcl9uXAnQM5ag9eYXi66POoXSc8big ow3cfsJrOHz/T10h5HGO/GU6WS/cbGu+zmNEwf8PNu9ET3YLSPTBSyKD0hVT5Z4TmYBDFj pMw9WCxg/2/LEfQZgZ/yUh9LzvWXUZSStTftKJOHYY1HYVqgREir4BgWIQUu4QGqhfU07U ama5TlRlLM9Oz20XtyN+r9EOeZIPLrRf1hpoxTIifNEddLfyLgy+7Y2+c+KwYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d32JZ0x90z13kG; Fri, 07 Nov 2025 14:59:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5A7ExATT083946; Fri, 7 Nov 2025 14:59:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A7ExAlZ083943; Fri, 7 Nov 2025 14:59:10 GMT (envelope-from git) Date: Fri, 7 Nov 2025 14:59:10 GMT Message-Id: <202511071459.5A7ExAlZ083943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 129cedd20bc6 - stable/15 - riscv/vmm: Remove a redundant maxcpu check in vm_alloc_vcpu() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 129cedd20bc61a4851d3699c8afeed321bb03ae1 Auto-Submitted: auto-generated The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=129cedd20bc61a4851d3699c8afeed321bb03ae1 commit 129cedd20bc61a4851d3699c8afeed321bb03ae1 Author: Mark Johnston AuthorDate: 2025-10-31 14:08:45 +0000 Commit: Mark Johnston 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_ */