From nobody Wed Apr 26 17:24:47 2023 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 4Q65Mz6SsGz472b7; Wed, 26 Apr 2023 17:24:47 +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 4Q65Mz5t3fz3npr; Wed, 26 Apr 2023 17:24:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682529887; 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=Rwq6fwt4NhS/U3kR5OkpBcSi1g9PanxFKYJu9nFq2ss=; b=h0ccqwhZstCOMfFE0lCSWIeCiiuvTTDE2IvxfW+ANtqbPIm3YoaWukhUkf00wcuK4jaIPs iUqqUQLBP+XmxMr2DvopfYpf0xQjpBR9Yq8WA3uqCczWF5Q7eGfYL0bXVYJ4qGedqjI4mb MULOul+qhszViI4WMP35dK0UkC2DgLsOjf2cZquGwfkOwA4jcrLIephPTCUN55SpmCkpV3 zfbNor3Z01CnK3cVEVhFD9ZMbZjC3zerH+07FYUEVdxy/m9YVipSyVU+4IijJ7AMnaNza/ 2mKWHRrvCZRROqp3zBQJzHNgOJ1VgJHPBEk5M5SBerdqsrFoeRibxFkVCHL+EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682529887; 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=Rwq6fwt4NhS/U3kR5OkpBcSi1g9PanxFKYJu9nFq2ss=; b=c50YaQpWkuZtBorM0fokwxe/JKjV85RyG6xFowz3+sx850iphXJUlTSqzvom3O4GUAZnTX crTgBHt8oeokb1uTdnv5lMDAY9RjbM0EZMQQAImIvN+UrZRn9UxwC+tMXMXGqrumHLukMj PXH1t9MYscPxZxZvUhj+X+OnRKHhs6yLHvIU0cWAUHiLENStzTHkF1vFaJ4lmDfY4Ep6qQ /z5xx9j1PPhOKDEiQOZpExZDiBmXsXjO/mN1OiLB1ygyQhNA8kjaXDgum1kV0RzY+WJy8a iDyS6/eiQ1PEyQ6HgaTz4onPDREVaR4rHiAH8dsYofY6+Fpo8QSdjMloy4C/dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682529887; a=rsa-sha256; cv=none; b=l5GRlN01DEa+0GtgC6rvnl6WXGvD3Gr49UUHZTzhVv1HlNa/qyYaSoQ+QQCgOoPbCwcLH7 v08wVK4VNUrNgLxjbCU/i5+aW8A40oUrnEemiiYsPI49JxBVkFwpX7yX8sXvCStI40W1fQ rSNaLUtg0f0YXOlt6EXIECwDOwQvKXWabUTa4BXHrcS6HQ7xdFyFsOMB/1M75k+ccD7AF/ Y1Y+yaTmAZxQBVqHebtVBUpzx89BxDmnBQpJ+NGBSgrlUwr3Be14W8t/7thuXFOA98m2vl JtDiGA6k/cigVRzmue2lBgPRGlPwLDk3tiPWLq9HchRs5gUx3kFd3FRqO5rpIQ== 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 4Q65Mz4wFVzkGh; Wed, 26 Apr 2023 17:24:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33QHOl7K001200; Wed, 26 Apr 2023 17:24:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33QHOl6x001199; Wed, 26 Apr 2023 17:24:47 GMT (envelope-from git) Date: Wed, 26 Apr 2023 17:24:47 GMT Message-Id: <202304261724.33QHOl6x001199@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: ce5a210997da - main - openzfs: arm64: implement kfpu_begin/kfpu_end 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce5a210997da3c4064cfe162e760379f1fa8b587 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ce5a210997da3c4064cfe162e760379f1fa8b587 commit ce5a210997da3c4064cfe162e760379f1fa8b587 Author: Kyle Evans AuthorDate: 2023-04-26 17:23:48 +0000 Commit: Kyle Evans CommitDate: 2023-04-26 17:24:00 +0000 openzfs: arm64: implement kfpu_begin/kfpu_end This is part one of a fix for booting with ZFS on arm64 using accelerated checksum implementations. Checksum benchmarking will attempt to use the FPU, so we currently panic quickly on boot. BLAKE3 is still broken, as it clobbers x18 and we promptly discover that fact as soon as we attempt to fetch curthread in kfpu_end(). Note that _STANDALONE is special-cased here, but ideally we wouldn't be building the code that uses kfpu_begin()/kfpu_end() at all in the loader environment. Discussed with: imp (a bit) Differential Revision: https://reviews.freebsd.org/D39448 --- .../include/os/freebsd/spl/sys/simd_aarch64.h | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_aarch64.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_aarch64.h index 7d2e2db28017..9edbc5f40455 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_aarch64.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_aarch64.h @@ -44,13 +44,39 @@ #define _FREEBSD_SIMD_AARCH64_H #include +#include #include +#include #include +#include + +#ifdef _STANDALONE #define kfpu_allowed() 0 -#define kfpu_initialize(tsk) do {} while (0) #define kfpu_begin() do {} while (0) #define kfpu_end() do {} while (0) + +#else + +/* + * XXX kfpu_allowed() should be 1, but this is pending a fix to the BLAKE3 + * generated assembly to avoid clobbering x18. Turn it back on after that + * lands. + */ +#define kfpu_allowed() 0 +#define kfpu_begin() do { \ + if (__predict_false(!is_fpu_kern_thread(0))) \ + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); \ +} while(0) + +#define kfpu_end() do { \ + if (__predict_false(curthread->td_pcb->pcb_fpflags & PCB_FP_NOSAVE)) \ + fpu_kern_leave(curthread, NULL); \ +} while(0) + +#endif + +#define kfpu_initialize(tsk) do {} while (0) #define kfpu_init() (0) #define kfpu_fini() do {} while (0)