From nobody Wed Nov 24 18:34:36 2021 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 0CFC2189A1E5; Wed, 24 Nov 2021 18:34:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HzqRd6CMPz3nlj; Wed, 24 Nov 2021 18:34:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0A5DA1493; Wed, 24 Nov 2021 18:34:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <133897a3-6db4-9353-cccd-c1d82e23146e@FreeBSD.org> Date: Wed, 24 Nov 2021 10:34:36 -0800 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 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: git: 3a60869237b8 - main - Add assembly optimized code for OpenSSL on powerpc, powerpc64 and powerpc64le Content-Language: en-US To: Piotr Kubaj Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202111232227.1ANMRCYk070382@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637778877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lA0Ndo7objBkI9mjM3geAFMXiw0FDRMCeICvjqvHyyc=; b=QTwSDk2BUIN/GBLovS3bm1uKkcDihKDyJmTVdb1RSZD8XVy6hmaZ6ogFiHmxXyTyvf6UGV ql1+nwndOu3caKNxabHfu6X2nVTwcr+aDbAi2kVB69jlt+Zfs+dVwbQieJdiL8DX8kH/77 9tinlB/gLUaVoNWL9nf4pjYbzYRpEZx84ZjQGrVUoieamz43qYIPY/2SY1XfS+d5r31oEo DyGqlfSyooXy2iB7WTj/YT9Thz2g/49G75WoV/eVrN4UcBkJSLAPiArYapdc5AJhM2YC3Y 8ffTtOckmlSTlrNZkLdbXR4vKTw4zgSaJGeue/ZMgGS1c8s4OA1iemLNB/ro/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637778877; a=rsa-sha256; cv=none; b=kW186fZds43hFEiREFCOv5dMDlxf6SfTFck2aut1fShEV809TPYstd/ZPH1KkU0wDyaei8 Bt1NHGq5Th+CchmCxqMeyPZq29N9gwZVB6gyfIernvvx33BLpSNRgw42K+l0B/in516QPU A9/V4wsj4ZAWg//GVyrL+qjucgv2I6BuFSqzPGD6CFogs8oVUhK/IpVT8dk7QpY+OvTxyp YJHhfAfxUqkAKCIbz+20k+0aUrhGX2CGcMS6lAqDRYHaGy7xbgEJF/VXzasyB3FZ5h7Erk DpC8y2iDhuAFRUPP7HGdBXpgekEEuaoJJfApMamBzXlerzpQo01mWF7P/LT6ZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 11/24/21 10:24 AM, Piotr Kubaj wrote: > OK, it looks like ossl uses fpu_kern functions and those are available only an aarch64, amd64 and i386: > cc -O2 -pipe -fno-common -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -include /usr/obj/usr/src/powerpc.powerpc64/sys/modules/ossl/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fPIC -mlongcall -fno-omit-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/powerpc/include -MD -MF.depend.ossl.o -MTossl.o -mno-altivec -msoft-float -mabi=elfv2 -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length -std=iso9899:1999 -c /usr/src/sys/crypto/openssl/ossl.c -o ossl.o > /usr/src/sys/crypto/openssl/ossl.c:190:4: error: implicit declaration of function 'fpu_kern_enter' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); > ^ > /usr/src/sys/crypto/openssl/ossl.c:190:36: error: use of undeclared identifier 'FPU_KERN_NOCTX' > fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); > ^ > /usr/src/sys/crypto/openssl/ossl.c:193:4: error: implicit declaration of function 'fpu_kern_leave' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > fpu_kern_leave(curthread, NULL); > ^ > /usr/src/sys/crypto/openssl/ossl.c:193:4: note: did you mean 'fpu_kern_enter'? > /usr/src/sys/crypto/openssl/ossl.c:190:4: note: 'fpu_kern_enter' declared here > fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); > ^ > /usr/src/sys/crypto/openssl/ossl.c:214:6: error: implicit declaration of function 'is_fpu_kern_thread' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > if (is_fpu_kern_thread(0)) { > ^ > /usr/src/sys/crypto/openssl/ossl.c:217:3: error: implicit declaration of function 'fpu_kern_enter' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); > ^ > /usr/src/sys/crypto/openssl/ossl.c:217:35: error: use of undeclared identifier 'FPU_KERN_NOCTX' > fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); > ^ > /usr/src/sys/crypto/openssl/ossl.c:263:3: error: implicit declaration of function 'fpu_kern_leave' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > fpu_kern_leave(curthread, NULL); > ^ > 7 errors generated. > > AFAIK porting those is not easy and it's certainly above my pay grade. Do the powerpc instructions use additional registers that are not part of the normal GPRs saved/restored on a context switch? If so, then, yes, you will need to implement something here (though the FPU_KERN_NOCTX variant is a bit simpler as it disables context switches and it's sufficient just to init the registers and permit accesses without raising a trap until fpu_kern_leave). If not, then you can make the use of those functions conditional on architecture. > On 21-11-24 08:15:26, John Baldwin wrote: >> On 11/23/21 2:27 PM, Piotr Kubaj wrote: >>> The branch main has been updated by pkubaj (ports committer): >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3a60869237b8b315fe66497cf5299ec08b688533 >>> >>> commit 3a60869237b8b315fe66497cf5299ec08b688533 >>> Author: Piotr Kubaj >>> AuthorDate: 2021-11-22 02:28:46 +0000 >>> Commit: Piotr Kubaj >>> CommitDate: 2021-11-23 22:26:53 +0000 >>> >>> Add assembly optimized code for OpenSSL on powerpc, powerpc64 and powerpc64le >>> >>> Summary: >>> 1. https://github.com/openssl/openssl/commit/34ab13b7d8e3e723adb60be8142e38b7c9cd382a >>> needs to be merged for ELFv2 support on big-endian. >>> 2. crypto/openssl/crypto/ppccap.c needs to be patched. >>> Same reason as in https://github.com/openssl/openssl/pull/17082. >> >> Have you looked at adding powerpc support to ossl(4)? It should be fairly simple >> (just adding the right asm files in Makefiles and the powerpc equivalent of >> OSSL_cpuid). >> >> -- >> John Baldwin -- John Baldwin