From nobody Fri Jun 14 01:21:20 2024 X-Original-To: dev-commits-src-all@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 4W0hLm4Fyhz5N2lS; Fri, 14 Jun 2024 01:21:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W0hLm2gbBz4VHB; Fri, 14 Jun 2024 01:21:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718328080; 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=WOPF2D5O9Uvz5PRNJUqmew1E4pMLeX6JlCmZoy+4ZuM=; b=lrop7gJdKYrWnXi7XeWqcwJ66KZKQvVD8mexMb14gecYWsuy3pcJmaEich4/g9XK91tSIn 5myh8r5vPo4nuOGDTjqbDOhhbIFGcEzPLpd38W8pWW7Xc1Emf2jVSYZ9W68Qsf2vzfW6GB vhI6ueWfNhUZH6Lyep2Bk8msiCNpNdc2uhDap/1iXdZ8HIJWKp4L4mCjx6KI8NC8W+R6US EmkDOQKAweJTEjU44q1B0iU5+Q+XWSS/J0pytvgTA1UJ8ONYm/mkAfAK7RYW27bVDzGtHR 4N/1Di6zgmsqrq77nmNmMGDvwh95lc91sOBmtZqpIhLRX4FmQFxkYF0R7e6uxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718328080; a=rsa-sha256; cv=none; b=FDWakaIrsl63KkGmU+T31PndlAYciTFyNZZf0gpdZ18gLkIptbNISsMol0HofQeq9M6p0U kLWe9aMLvSUlHKZn6ujmoyDJDYn5y0iTcYoST7t9BNMlRTrtr18kD6+cGM1xnnFBJk4ymK nGKxW/QzPXzPDUL8cV2nS5t+lpCftzJ74BCUjJV3UZ8NCun2jzPYOV5HBnK7sXmGltrejr p2tvVVWGCTlZeYMfo7Ey+jtg4THg/fZp+4mKopw9qp4Rww7jXZhwp+SmgDR5G61YlAKRmc +LHPdckiNFBZwMMtqsXswSii7oZozUO01SQdgxcBZ6AtV0kXYRyVBRDTbVYlng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718328080; 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=WOPF2D5O9Uvz5PRNJUqmew1E4pMLeX6JlCmZoy+4ZuM=; b=XiXtbOYEbHnMrR4ZMKCkRlBCR57uEs03vBrLeqteXsUplP9sxKCrtU9f2YX3YlBcwtlbWZ cCdVRfjmnGC2UDOXZ0mZk/UMG8asUQvCG/9g6WFt+RScS9OyyeB1+LnPa3xITfiK//iLcM 2EyoA/AaWo9F8sFv9/chc1E5nNqH1Vf5SBrCRY4LVgOpAp9bGrfNdD7YVZ4kT1ITPUB2GS GZo9ns3Yi/IeziaAqM4qasOFvi0JxX6EVguxPUhiJLPba8w9wkSsbVHAORQiDvTVWvoa7A PPkQ5kB1DD74VlDFWpG5OsfJ6mSeXFMUx+0lwxbfuaSJ7jEvTZsJaZLMMpSc9w== 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 4W0hLm2G7Bz1097; Fri, 14 Jun 2024 01:21:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45E1LK8f054993; Fri, 14 Jun 2024 01:21:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45E1LKZN054979; Fri, 14 Jun 2024 01:21:20 GMT (envelope-from git) Date: Fri, 14 Jun 2024 01:21:20 GMT Message-Id: <202406140121.45E1LKZN054979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a03354b00238 - main - arm64/vmm: Implement vm_disable_vcpu_creation() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: a03354b00238b73568efe225c754cba197393f77 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a03354b00238b73568efe225c754cba197393f77 commit a03354b00238b73568efe225c754cba197393f77 Author: Mark Johnston AuthorDate: 2024-06-14 00:16:28 +0000 Commit: Mark Johnston CommitDate: 2024-06-14 01:19:00 +0000 arm64/vmm: Implement vm_disable_vcpu_creation() No functional change intended. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D45556 --- sys/arm64/include/vmm.h | 1 + sys/arm64/vmm/vmm.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/arm64/include/vmm.h b/sys/arm64/include/vmm.h index c06d2ad947e4..cf00dd60a43f 100644 --- a/sys/arm64/include/vmm.h +++ b/sys/arm64/include/vmm.h @@ -127,6 +127,7 @@ struct vm_eventinfo { int vm_create(const char *name, struct vm **retvm); struct vcpu *vm_alloc_vcpu(struct vm *vm, int vcpuid); +void vm_disable_vcpu_creation(struct vm *vm); void vm_slock_vcpus(struct vm *vm); void vm_unlock_vcpus(struct vm *vm); void vm_destroy(struct vm *vm); diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c index a2cc63448f19..c6a49ebc4b03 100644 --- a/sys/arm64/vmm/vmm.c +++ b/sys/arm64/vmm/vmm.c @@ -141,6 +141,7 @@ struct vm { volatile cpuset_t active_cpus; /* (i) active vcpus */ volatile cpuset_t debug_cpus; /* (i) vcpus stopped for debug */ int suspend; /* (i) stop VM execution */ + bool dying; /* (o) is dying */ volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */ volatile cpuset_t halted_cpus; /* (x) cpus in a hard halt */ struct mem_map mem_maps[VM_MAX_MEMMAPS]; /* (i) guest address space */ @@ -405,6 +406,14 @@ vm_init(struct vm *vm, bool create) } } +void +vm_disable_vcpu_creation(struct vm *vm) +{ + sx_xlock(&vm->vcpus_init_lock); + vm->dying = true; + sx_xunlock(&vm->vcpus_init_lock); +} + struct vcpu * vm_alloc_vcpu(struct vm *vm, int vcpuid) { @@ -423,7 +432,7 @@ vm_alloc_vcpu(struct vm *vm, int vcpuid) sx_xlock(&vm->vcpus_init_lock); vcpu = vm->vcpu[vcpuid]; - if (vcpu == NULL/* && !vm->dying*/) { + if (vcpu == NULL && !vm->dying) { vcpu = vcpu_alloc(vm, vcpuid); vcpu_init(vcpu);