From nobody Thu Oct 09 16:32:26 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 4cjFlb2KF5z6Bjr4; Thu, 09 Oct 2025 16:32:27 +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 4cjFlb09mpz435t; Thu, 09 Oct 2025 16:32:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760027547; 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=QfQ59FgZ5QMS3YPjNr90iMs2tSyVilHjIIjBm0TETDA=; b=jOab6ITfHJA9+sli6bfTRkkRZ4LLHy79bp5jcdgteqsPEQRaDJR2bd0hbxvZbpHk0Vw9kO pCxfX7NbQC5WtDvr7CYrLEq7MKXphjvOOwb+3QCau4bLsROl8e+UYJi+WWNvRR1DU70hru +aeIXRnaaY1Vk7cn5CuiiUDhaXQjTVrfZmajoiRy5HSbo694TcMqW3YcoBN47mEZw/1zNJ ucJ/OFZlVr+yySOm37d/v7Pl37sTk9MHM0K3Xry9Y1Kau5QfPPyR6+J6STddYDSr95xjwx jjqeLARLgfhEjZlUFIxr8eLDQ0iQjSv6TjLgRu8VGU6JzFV/g+p0ZZI4UKEF9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760027547; 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=QfQ59FgZ5QMS3YPjNr90iMs2tSyVilHjIIjBm0TETDA=; b=MVJbFPs5fVSqfyZxnLnk7bGcx7EvMj7Br8USyzMFJJ4XY7b7u90n/E0nxgA61F1qs67Zqg W7ApslzIO+HPGmerjsv5f3BSfAKgwKwMXl8qij2BDs4Ta73I9HwlV5PfAFWejnv03BgNmh zpE9GXSIRhErP3+ImrSqL9qGDkhcRGuVe++tYwbkGWNIwGUfMfZUwetKTLVsSOP3IWzCmd 9ZeGQnA/u2UPpDgrpsx05CaS3B7ndVanRzN+FxWparRM0OPQElDD2TwsXepDq9KulPEYPV rg0Mya9UvkgtNnQ8vHNd/kqhL5rJHsTFGQ96IxX88j+jaqWmQq6QVKKwCGCDuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760027547; a=rsa-sha256; cv=none; b=cQnHD+z6JDbh8W3LqDonQSn2atzgSgZOlcPaSDtcAT+vIf+ltLNd25XKcbnIc/4xAryVIb DVQvfRFHHH2KuUb5kPZy/RbqNLQcVqt7qq+lzM6h8QMFXrYEnkCf01iyZErKR289oxg+jp rpkohmPBAlxI+tG7UKCFPlUYeQd5Ui4eXxPu1MORrh94BhYZAlAD2pEmUb+yd5Ksbbarn9 oda38FPAhLJr5HjD8WqfFQd+VKXOTA4qmqOjKQ5DCLT84sZvBjCV2pk9zdmavVkhIS4OnE xjoF9CpNrlUwfRwsbYdji563LPQPFlR3kbfWUPAh1DMyfVpDfWoJZTm9pZEzsw== 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 4cjFlZ6ZRWz8kN; Thu, 09 Oct 2025 16:32:26 +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 599GWQe3023762; Thu, 9 Oct 2025 16:32:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 599GWQUQ023759; Thu, 9 Oct 2025 16:32:26 GMT (envelope-from git) Date: Thu, 9 Oct 2025 16:32:26 GMT Message-Id: <202510091632.599GWQUQ023759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 9f85826c88ea - stable/15 - arm64/vmm: Handle debug exits 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 9f85826c88ea1c5f07c2d3b9fbc8458f91c4f097 Auto-Submitted: auto-generated The branch stable/15 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9f85826c88ea1c5f07c2d3b9fbc8458f91c4f097 commit 9f85826c88ea1c5f07c2d3b9fbc8458f91c4f097 Author: Andrew Turner AuthorDate: 2025-10-07 08:26:00 +0000 Commit: Andrew Turner CommitDate: 2025-10-09 16:31:50 +0000 arm64/vmm: Handle debug exits This is enough to boot FreeBSD again. PR: 290044 Reported by: Siva Mahadevan Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D52931 (cherry picked from commit 534aec00976c18c4c4b485b2fade9d5f33de89c8) --- sys/arm64/vmm/arm64.h | 1 + sys/arm64/vmm/vmm.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index 6a4af47ac60a..10261c6a6499 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -119,6 +119,7 @@ struct hypctx { struct vgic_v3_regs vgic_v3_regs; struct vgic_v3_cpu *vgic_cpu; bool has_exception; + bool dbg_oslock; }; struct hyp { diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c index 1dcefa1489e9..a551a2807183 100644 --- a/sys/arm64/vmm/vmm.c +++ b/sys/arm64/vmm/vmm.c @@ -651,6 +651,33 @@ vmm_reg_wi(struct vcpu *vcpu, uint64_t wval, void *arg) return (0); } +static int +vmm_write_oslar_el1(struct vcpu *vcpu, uint64_t wval, void *arg) +{ + struct hypctx *hypctx; + + hypctx = vcpu_get_cookie(vcpu); + /* All other fields are RES0 & we don't do anything with this */ + /* TODO: Disable access to other debug state when locked */ + hypctx->dbg_oslock = (wval & OSLAR_OSLK) == OSLAR_OSLK; + return (0); +} + +static int +vmm_read_oslsr_el1(struct vcpu *vcpu, uint64_t *rval, void *arg) +{ + struct hypctx *hypctx; + uint64_t val; + + hypctx = vcpu_get_cookie(vcpu); + val = OSLSR_OSLM_1; + if (hypctx->dbg_oslock) + val |= OSLSR_OSLK; + *rval = val; + + return (0); +} + static const struct vmm_special_reg vmm_special_regs[] = { #define SPECIAL_REG(_reg, _read, _write) \ { \ @@ -707,6 +734,13 @@ static const struct vmm_special_reg vmm_special_regs[] = { SPECIAL_REG(CNTP_TVAL_EL0, vtimer_phys_tval_read, vtimer_phys_tval_write), SPECIAL_REG(CNTPCT_EL0, vtimer_phys_cnt_read, vtimer_phys_cnt_write), + + /* Debug registers */ + SPECIAL_REG(DBGPRCR_EL1, vmm_reg_raz, vmm_reg_wi), + SPECIAL_REG(OSDLR_EL1, vmm_reg_raz, vmm_reg_wi), + /* TODO: Exceptions on invalid access */ + SPECIAL_REG(OSLAR_EL1, vmm_reg_raz, vmm_write_oslar_el1), + SPECIAL_REG(OSLSR_EL1, vmm_read_oslsr_el1, vmm_reg_wi), #undef SPECIAL_REG };