From nobody Thu Aug 3 17:51:57 2023 X-Original-To: freebsd-hackers@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 4RGxHh5FFhz4TlMX; Thu, 3 Aug 2023 17:52:00 +0000 (UTC) (envelope-from sanastasio@raptorengineering.com) Received: from raptorengineering.com (mail.raptorengineering.com [23.155.224.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4RGxHg623Sz4ky9; Thu, 3 Aug 2023 17:51:59 +0000 (UTC) (envelope-from sanastasio@raptorengineering.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=raptorengineering.com header.s=B8E824E6-0BE2-11E6-931D-288C65937AAD header.b=M6CZ4diZ; spf=pass (mx1.freebsd.org: domain of sanastasio@raptorengineering.com designates 23.155.224.40 as permitted sender) smtp.mailfrom=sanastasio@raptorengineering.com; dmarc=pass (policy=quarantine) header.from=raptorengineering.com Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id F2AD78285406; Thu, 3 Aug 2023 12:51:58 -0500 (CDT) Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id WHesxDq3Ddyv; Thu, 3 Aug 2023 12:51:58 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id 38EDC8285487; Thu, 3 Aug 2023 12:51:58 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.rptsys.com 38EDC8285487 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raptorengineering.com; s=B8E824E6-0BE2-11E6-931D-288C65937AAD; t=1691085118; bh=4Vxg2XWsA+qqr2qM1uCaK1pdP62hIVl9UNC0n3PncmM=; h=Message-ID:Date:MIME-Version:From:To; b=M6CZ4diZaEnLKE2cZZP2jmAn2rYkI1hjrPXsEgGyt/VlVEWROZbHwcwJI9vVnoDwP gyWg/UV9nlzSAOSwgU2q0/jAbeMBuTjWydgiFomYSf0QOesPyR6ex53NROki6yL6Nq M4ExyFp4OUYBO0k8okMu0bGmxPtUG6XY2Pxvl1CA= X-Virus-Scanned: amavisd-new at rptsys.com Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4Bon8-AhG5I6; Thu, 3 Aug 2023 12:51:58 -0500 (CDT) Received: from [10.11.0.2] (5.edge.rptsys.com [23.155.224.38]) by mail.rptsys.com (Postfix) with ESMTPSA id C86158285406; Thu, 3 Aug 2023 12:51:57 -0500 (CDT) Message-ID: <0c24b4b7-b4c8-242d-6187-15b171c50c19@raptorengineering.com> Date: Thu, 3 Aug 2023 12:51:57 -0500 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux ppc64le; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US From: Shawn Anastasio Subject: Implementing in-kernel AES crypto acceleration on ppc (POWER8+) To: freebsd-ppc@FreeBSD.org Cc: freebsd-hackers@FreeBSD.org, Timothy Pearson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-2.00 / 15.00]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[raptorengineering.com,quarantine]; R_SPF_ALLOW(-0.20)[+mx:c]; R_DKIM_ALLOW(-0.20)[raptorengineering.com:s=B8E824E6-0BE2-11E6-931D-288C65937AAD]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@FreeBSD.org,freebsd-ppc@FreeBSD.org]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[raptorengineering.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ASN(0.00)[asn:46246, ipnet:23.155.224.0/24, country:US]; RCVD_COUNT_FIVE(0.00)[5]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spamd-Bar: - X-Rspamd-Queue-Id: 4RGxHg623Sz4ky9 Hello all, Raptor Engineering is interested in adding support for in-kernel AES acceleration on ppc64 via the VMX crypto instructions added in ISA 2.07B, and I wanted to reach out to the community with a few questions. 1. As I understand it, FreeBSD already has support for in-kernel crypto acceleration on x86 and ARM via the aesni and armv8_crypto drivers respectively that each implement the cryptodev interface. Am I correct in understanding that adding AES acceleration for Power would just involve creating another driver here, or are there other pieces of the puzzle that I've missed? 2. I see that both the aesni and armv8 drivers make use of the fpu_kern_enter/fpu_kern_leave functions to guard access to vector registers, but it appears that these functions aren't implemented on ppc. Is that correct, or does an in-kernel facility for safely accessing vector registers on ppc already exist? 3. For the accelerated AES implementation itself, I've noticed that cryptogams[*] contains an implementation that is both widely deployed (and thus tested and likely to be correct) and also BSD licensed. Would it be acceptable to import the relevant routines to the FreeBSD kernel and have the new cryptodev driver simply call into them, or are there other considerations involved? 4. Is there a userspace test framework for the cryptodev API that could be used to validate and benchmark the new implementation, or would I have to write that myself? It appears that OpenSSL had support for /dev/crypto at one point, but I'm not sure that is the case any longer. My apologies for the large number of questions, but I look forward to hearing back and working with the FreeBSD community to get this implemented. Thanks, Shawn Anastasio [*] https://github.com/dot-asm/cryptogams