From nobody Thu Jan 23 17:27:27 2025 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 4Yf7Dc1Z7vz5lDWd; Thu, 23 Jan 2025 17:27:28 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf7Db4Pc8z43R0; Thu, 23 Jan 2025 17:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653247; 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=HxfipjERwRnVh/++WHeSYkZxmA8spQ1sQkLYCMRCybg=; b=mtBAZRVY13oDGR8y8NO3dYCEWBI+x+5++WPzPMBLBsAsn7r1PNqtV9H1wz5DhFKna96zpz 6MhrqDhBlnYoIVBJGKDBQuAASG2zpRoc9kmvLnf0AUZZPCbmSEwZ/pTNKfglSE50WN2Wqd pmi5uxR1h2cz+tGUEvwuoGVB/rsnEib3J24d5Q1ibkd91gDOoyceioPN4ACbS+4ftaChYa wiVuUTzGelPwtIp1BsRqMoAS5ild4MpGJAAucnwhADluXw7AfW8s330pMlIznHSdcURyrf btwyLQWGRXqxOyUjCJwvIl1D47gRKEM0vpe7+w6KBwy6Q3CIZUp72A2qbFTxmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737653247; 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=HxfipjERwRnVh/++WHeSYkZxmA8spQ1sQkLYCMRCybg=; b=RlsBW+JLDINUDDvxOcr+H+5Rm/yIydeBon87kPbdWVxfbfPENvVYbQEl/l6wOUwGd7+ryK 6VCp5PJ3+xSL4zC4288ofhOOzIrBZ6bN0RqkNtyCD2IIwAFXUC+sHbx+dfBBJhav+biH0O LtaYbtQfRUuXBEePuG6iyETUIzOisJXMYh7Ee8rZGnCskJPF4mvTV0m2SMedFqM178qCc1 qrz13MFFLGeNtknXBgmVXgo9Avg1Pf1yIcUfDrWODeHOxSlOhio1vVwVeRkxQnrWAgthW6 vU9DiZddCqOeBsG3evH9KG8C+5stzAN0k+s+Mh5bha38gIbo/x0pv8Qj+MWN4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737653247; a=rsa-sha256; cv=none; b=ZdFVBrcAZxObr2DPVwOIufMIPUz2+tNxiGXT/yz6y6diK11BmfuRzZbtiWdIupo5BNyoP4 DrL3sOTUh4HKUHOVg94IXwp9KvXGLBqejBSstEyVqaTC83DkbV8FF64C8BMLxF9lHU99j8 6TvJw+iJUBsubc01FXV47Vks0rxt1KdZsIXa95kztpzsPojtd/7FgvKNGBGq9oQJTEfuCl iAqMgVK5EcX+anEvbQ/sOtkbu6oXH172s1NmUoCvJoyPCA27E6TZ7WC/Wkc8ztQKIEwSh6 mp7cr/t0wxb+P2RQIwcaH7V8p/ZcU36filu5AFfsDjVUjv6B/GzBL7XKdmLovw== 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 4Yf7Db3mswzpBH; Thu, 23 Jan 2025 17:27:27 +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 50NHRRxX022453; Thu, 23 Jan 2025 17:27:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NHRRQX022450; Thu, 23 Jan 2025 17:27:27 GMT (envelope-from git) Date: Thu, 23 Jan 2025 17:27:27 GMT Message-Id: <202501231727.50NHRRQX022450@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: e1c77d783206 - main - arm64: add inline functions for FEAT_WFxT instructions 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1c77d783206bceee1f8d5fcbb0b3df214b4b282 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e1c77d783206bceee1f8d5fcbb0b3df214b4b282 commit e1c77d783206bceee1f8d5fcbb0b3df214b4b282 Author: Harry Moulton AuthorDate: 2025-01-23 12:27:28 +0000 Commit: Andrew Turner CommitDate: 2025-01-23 17:26:25 +0000 arm64: add inline functions for FEAT_WFxT instructions This adds inline functions for WFET/WFIT instructions introduced with ARMv8.7 FEAT_WFxT. These instructions allow for regular WFE/WFI instructions to be bound by a timeout. Once the value of CNTVCT_EL0 reaches, or exceeds, that of the timeout value, the WFE/WFI state will be exited and the PE will continue. These instructions are implemented as inline functions, with a write to the corresponding system register acting as an alias for the two instructions. Writing to these registers is only valid on ARMv8.7 and above, therefore the use of these functions must be guarded by a feature check. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D48579 Signed-off-by: Harry Moulton --- sys/arm64/include/cpufunc.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index ba712f48b262..c948799eb7b9 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -160,6 +160,26 @@ invalidate_local_icache(void) "isb \n"); } +static __inline void +wfet(uint64_t val) +{ + __asm __volatile( + "msr s0_3_c1_c0_0, %0\n" + : + : "r" ((val)) + : "memory"); +} + +static __inline void +wfit(uint64_t val) +{ + __asm __volatile( + "msr s0_3_c1_c0_1, %0\n" + : + : "r" ((val)) + : "memory"); +} + extern bool icache_aliasing; extern bool icache_vmid;