From nobody Fri Jan 05 00:28:20 2024 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 4T5knw4jtzz55g4h; Fri, 5 Jan 2024 00:28: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 4T5knw2xBXz4hwd; Fri, 5 Jan 2024 00:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704414500; 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=3+py28czMQZWD8x9SS0taiPsPscuaQkC+tfsd9Hz+6k=; b=dDyULmJUzUK7WWFpp23/fxDWYZyoDPrF39wIvjBp4fcAqhx5LhD1sO0yMP9Bnbu7VKInQD iDXY4iTvM6bu3/x1gM3U/HTqxAb9hd5lZQ6K4PYaNX2PGNhTIHuunYVCnX2qoSFjqTqXdz Bueg7kuNd5TMwZPinfqrby8ufIZdT6RCCQtDqGira8IMGifAJANJJjWKpps5q1R42Hm6RG IPkYv42sz0FxkjA4WHkT8ijeu4nfxUhgu8smOUmBzgDT6nWfy+P9BZzGiw0CmdWme4WEEN XnPJ3TnfHd+l/ORG6MsvLKLZCCcojVfuSZI3l55EU9YoCRMwKDM1KVKSdjOqeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704414500; 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=3+py28czMQZWD8x9SS0taiPsPscuaQkC+tfsd9Hz+6k=; b=Haz5sX6OmuyXtfePlHpoDTgdrntk8uKM5zbdcihvQRMx9u2x4mKsa+sSkXKu4/1UTRc2hD yiYmZKv75H8z3fDIr+J0oC3PK2yVhq8WSrzEJzei/4a3RXXQqnCQWxXfOBF7ZNEBcD/MEa QDrAq1HRsTbrrXeDVer9P7E2I9zC8mJ5zk9RViM19VrXide8hhUIJPiYH0mvstf5r+JKhI 9q6za3VDHz89bajBHAeNOEfzI3Yc4fCR5m/gNeRVrJkHF52qBThRgSWyKjxmsFJa9qkm4N bFmHztG2Wh7cHPv01QvV5rLHe0Nyt6iyHMalJu2AzXvwSxwYeQaOZrTP/iX/sw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704414500; a=rsa-sha256; cv=none; b=BJCAgZFX6zONo/gRvPRWBxr2ujI9/shlCZ/Ffvdtj8L/Ri2JpED6x/k1VPdWkmf7QZFw5K TyG811Zjf1YONA++pJojjGITdxqKaOrBAb8rX5XFzshAOZ1KYyrYmUww5CvwKmuoZtPxKz hhmj2Siv9iDyOSNLVvU+JrJ0U2wnPb9Io391MjkqOKY4qUDKE2oRe1YxWZFTTnhQC5kDyZ I+HUEZEVR5WAbR2eXP/hR++M7XmHKmLptJ/+UprIZz4dEmHf6l4P3nQ27/X5f/wh+woz7w 1MBUQ4uDCQ4kHNKRXhHcwLEpQcMIKJZ/mq72iQB0tkc32vo9CRoVpPse34RYhg== 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 4T5knw21hLzbvy; Fri, 5 Jan 2024 00:28: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 4050SKxF026790; Fri, 5 Jan 2024 00:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4050SKHM026787; Fri, 5 Jan 2024 00:28:20 GMT (envelope-from git) Date: Fri, 5 Jan 2024 00:28:20 GMT Message-Id: <202401050028.4050SKHM026787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: b879ddc755b7 - stable/14 - vmm: implement VM_CAP_MASK_HWINTR on AMD CPUs 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: b879ddc755b7eb36e1cd2468f9b55ddb3088c850 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b879ddc755b7eb36e1cd2468f9b55ddb3088c850 commit b879ddc755b7eb36e1cd2468f9b55ddb3088c850 Author: Bojan Novković AuthorDate: 2023-12-07 23:08:58 +0000 Commit: John Baldwin CommitDate: 2024-01-05 00:25:49 +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 (cherry picked from commit 181afaaaee0025f948346fe8b9ec5356a0cdef97) --- 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;