From nobody Thu Dec 07 23:17:18 2023 X-Original-To: dev-commits-src-main@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 4SmVXv20sZz53mrP; Thu, 7 Dec 2023 23:17:19 +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 4SmVXt6NTxz3WsM; Thu, 7 Dec 2023 23:17:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701991038; 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=GrKyJtSxqAVrxz7X8FSULqLFqlO8MwuJlm1mM2RP0Uk=; b=UslKgHI/oz/kypIjjvTp9uyhAYXGeQhfyevsBy/gNB4JSyMoR+hwWLrgCsHF9whYWfJwlW M45xEg0qiQ6F4oXaOuMiz4I1ipcJyoxOUjI47dNXyVcGX1aRC4zXJd5SqPsXdS/BqXm4ho dGMXRpmYMZOu6GR6QBXYX+siSpXw+A1KKeKyncxdbPSeml+E/H59ki+PipIwr4ktd8TqO1 J4tGfE+i0VdwqGtBXHNuxMRnjh9ejNIzE9iFW8KRlv/s3QFMGuISGkChnJHNHK06WR5PYk Sw2TJfWgjYu7KLEXAjUZDeMTUoCC0E6YNn8v2rgVfEqiOehNIZEsQsRYGUbbGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701991038; a=rsa-sha256; cv=none; b=Bt4jx9/zGW4sTAiNgeaOVzBRp8NlXtsdlrxF64n/Ak2Y0kDRZdInh6lobaKhhtjnV+w7gC HZ3yPH31x5QZM2uOx8FUezDsDvqdKtoVPUZmH45fscX3qAmMwi3ZrfpyyRUvzJS1IGMKLI agdeE6qpWNrpuzQIKWiv4+NUK6i++2rKeyDCkEtC2Z1seb3qJZPGw1m9gnJZcwmjq6ZASO PbOAN9hJlJ+G4eUcJmQFL5BsbPxreVpR6GE/eAkullOIM69RGFnva2uX0JB10W3GMaSyCL Ur1pOM4rrR3Gr2jUnNoP04tnl+ouG6wNad55b6yNuKMVLOk6x4SpPCY2laPyqg== 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=1701991038; 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=GrKyJtSxqAVrxz7X8FSULqLFqlO8MwuJlm1mM2RP0Uk=; b=qz0gs4/N/b6rfRr6ORKHaz7jz0T3rPcA19JgOX2qBLXS2J7MH8R/WXVFZDWZvrrKDAh4TV pI/3+xaIWR93PPazGjPID/HfFp1M0MuQKbC6mk4gqo/FJoFr7/Hqg4mBFaP8bvT0pJ4xhq iQt/akFBWWMkhFEmu+5zN909piutPWcLrhGNFPBGktYsLR5qwiN7Kq8aHuvkC7HBGrrDX9 lYJtN2FF43AQDDvuU0ageGFmfS5nBEfvU2W78A9iJdKMvdwrJHpZWdys7Z3pSUbEUNXOYi rRrSpvjeVqSsHt//RvlndvtfJ/JJ6JH5g5VX3VrL2RJsKJCwEA8QAXt/n1tTsQ== 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 4SmVXt5Tj0zx8N; Thu, 7 Dec 2023 23:17:18 +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 3B7NHIEL026783; Thu, 7 Dec 2023 23:17:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B7NHIwC026780; Thu, 7 Dec 2023 23:17:18 GMT (envelope-from git) Date: Thu, 7 Dec 2023 23:17:18 GMT Message-Id: <202312072317.3B7NHIwC026780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 181afaaaee00 - main - vmm: implement VM_CAP_MASK_HWINTR on AMD CPUs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 181afaaaee0025f948346fe8b9ec5356a0cdef97 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=181afaaaee0025f948346fe8b9ec5356a0cdef97 commit 181afaaaee0025f948346fe8b9ec5356a0cdef97 Author: Bojan Novković AuthorDate: 2023-12-07 23:08:58 +0000 Commit: John Baldwin CommitDate: 2023-12-07 23:11:04 +0000 vmm: implement VM_CAP_MASK_HWINTR on AMD CPUs This patch implements the interrupt blocking VM capability on AMD CPUs. Implementing this capability allows the GDB stub to single-step a virtual machine without landing inside interrupt handlers. Reviewed by: jhb, corvink Sponsored by: Google, Inc. (GSoC 2022) Differential Revision: https://reviews.freebsd.org/D42299 --- sys/amd64/vmm/amd/svm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c index 1507377a0cfe..3fda9454090b 100644 --- a/sys/amd64/vmm/amd/svm.c +++ b/sys/amd64/vmm/amd/svm.c @@ -1725,6 +1725,10 @@ svm_inj_interrupts(struct svm_softc *sc, struct svm_vcpu *vcpu, int vector, need_intr_window; int extint_pending; + if (vcpu->caps & (1 << VM_CAP_MASK_HWINTR)) { + return; + } + state = svm_get_vmcb_state(vcpu); ctrl = svm_get_vmcb_ctrl(vcpu); @@ -2446,6 +2450,10 @@ svm_setcap(void *vcpui, int type, int val) vlapic = vm_lapic(vcpu->vcpu); vlapic->ipi_exit = val; break; + case VM_CAP_MASK_HWINTR: + vcpu->caps &= ~(1 << VM_CAP_MASK_HWINTR); + vcpu->caps |= (val << VM_CAP_MASK_HWINTR); + break; case VM_CAP_RFLAGS_TF: { uint64_t rflags; @@ -2529,6 +2537,9 @@ svm_getcap(void *vcpui, int type, int *retval) case VM_CAP_RFLAGS_TF: *retval = !!(vcpu->caps & (1 << VM_CAP_RFLAGS_TF)); break; + case VM_CAP_MASK_HWINTR: + *retval = !!(vcpu->caps & (1 << VM_CAP_MASK_HWINTR)); + break; default: error = ENOENT; break;