From nobody Fri May 17 16:12:52 2024 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 4VgsSP1CvJz5LPGs; Fri, 17 May 2024 16:12:53 +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 4VgsSN5tC6z4Q2j; Fri, 17 May 2024 16:12:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715962372; 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=KhZxDd7z4I12n2UGIktn27DH5vJ2E1e6WiqoFlFwtM4=; b=rqwMYRisKSsey14kalJUgipmdk/yY144cpTH9maB/mmKSFRTM3AB8ZSGqIngYJsOu/25Tm o5+AhlnaugX0Bku6s+Puo4gtFBSyXp3LWBGghz71fpYR7c3pDwh8KNvF9xE02IY0akNkpo nat3kPgc6BEPkJGPSqd6NhmbQ8QEzyG7AFpNW/3chnoxtHGvjdPBOx6aQWBv5C0x4N/PmK XSqCNcqYrY4w3u9RDuw+/SyVOF8xZIENbCfIIWSxxHDtSvNSg+cb7zesmlR54uurj4HmGZ LG7qcdfeFnMqkWy/kU3E3uHkXU+P/4FiJwsd/YHcK0EZa1WKzWdvd6nMboktxg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715962372; a=rsa-sha256; cv=none; b=cKJjzfgPgtZ99nEaDqAQi/Ra2MDknY9dZwTM1lTY12F/xuIjsq4lBCN70aPvlpcNxoZpRG dn/j9H8qAZAiwjA1urb4C96HZZWqePlAdDysIULuCl2y1A3S0fyPXlrCKEZUO0Gh5kpPxy c7WNNvtbkEDZArdfeI1fTm43noHhwAlZOtkMEQj6Y++3+h/EyrmGIbOMJyQb+gnA+EdsV0 rsXLwlKuS/n5gZRX1Jad494/wkJm1QHjM1GKwqxTSf+qlzZcj5Wip+NuTpzmU65AOxmLo8 sFlp0wJ7ZrPexN2pSHV3MLXKb3hzf8KHLB3KjkJ8ZWQjhj/KAW2/SVVeE9tJ0w== 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=1715962372; 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=KhZxDd7z4I12n2UGIktn27DH5vJ2E1e6WiqoFlFwtM4=; b=RMmkfo2A3qJ2reCC0SR00bVSIDzeBB21VTq6MQcFs5E9QaSFCFzpvObEK4xGmKrDBVGQAu 1R/O96ChYjFqcyyx4lC3L8BW62wv29v7T3/kg5rhGwDe3nzQUL24/QCh6TzZ0iSa2wUwC8 hZu/DjmPw30yXHNZDMZ3wA7akm676v2QViwbHHUgTt/w3uzfQvNFcakPl2zG7hKjG3phN4 iY7TiQQuRguIlPyKCHpeb+rGBgd8nriv9dSpWpPPs8FYK0YNCdbaPiIU6wYqSvK/Rj3AxX ZxJbe+e2OfU3g/ZBo0VNM42BM81eoEVdS5++1c+4E0NLygJBuuzmXu4ldqOV5A== 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 4VgsSN5PM9zpBx; Fri, 17 May 2024 16:12:52 +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 44HGCq3N065228; Fri, 17 May 2024 16:12:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44HGCqND065225; Fri, 17 May 2024 16:12:52 GMT (envelope-from git) Date: Fri, 17 May 2024 16:12:52 GMT Message-Id: <202405171612.44HGCqND065225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 457fa0f69ce0 - main - arm64: Support break and watch points in VHE 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 457fa0f69ce07f24070261376f1ea724324ec621 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=457fa0f69ce07f24070261376f1ea724324ec621 commit 457fa0f69ce07f24070261376f1ea724324ec621 Author: Andrew Turner AuthorDate: 2024-03-14 18:01:24 +0000 Commit: Andrew Turner CommitDate: 2024-05-17 16:07:16 +0000 arm64: Support break and watch points in VHE When booting the kernel with VHE it will be running at EL2. The current config register values only enable the reaces at EL1 when tracing the kernel. Set the HMC flag to also trap from EL2. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45121 --- sys/arm64/arm64/debug_monitor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/arm64/arm64/debug_monitor.c b/sys/arm64/arm64/debug_monitor.c index 2e1a956ad75c..d92d3fb37ce4 100644 --- a/sys/arm64/arm64/debug_monitor.c +++ b/sys/arm64/arm64/debug_monitor.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -86,6 +87,7 @@ void dbg_monitor_exit(struct thread *, struct trapframe *); #define DBG_WATCH_CTRL_ACCESS_MASK(x) ((x) & (0x3 << 3)) /* Common for breakpoint and watchpoint */ +#define DBG_WB_CTRL_HMC (0x1 << 13) #define DBG_WB_CTRL_EL1 (0x1 << 1) #define DBG_WB_CTRL_EL0 (0x2 << 1) #define DBG_WB_CTRL_ELX_MASK(x) ((x) & (0x3 << 1)) @@ -457,6 +459,8 @@ dbg_setup_breakpoint(struct debug_monitor_state *monitor, vm_offset_t addr) if ((monitor->dbg_flags & DBGMON_KERNEL) == 0) bcr_priv = DBG_WB_CTRL_EL0; + else if (in_vhe()) + bcr_priv = DBG_WB_CTRL_EL1 | DBG_WB_CTRL_HMC; else bcr_priv = DBG_WB_CTRL_EL1; @@ -530,6 +534,8 @@ dbg_setup_watchpoint(struct debug_monitor_state *monitor, vm_offset_t addr, if ((monitor->dbg_flags & DBGMON_KERNEL) == 0) wcr_priv = DBG_WB_CTRL_EL0; + else if (in_vhe()) + wcr_priv = DBG_WB_CTRL_EL1 | DBG_WB_CTRL_HMC; else wcr_priv = DBG_WB_CTRL_EL1;