Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp734232pxu; Fri, 23 Oct 2020 11:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdsgRYcOq4rgPrfnJbglCmRUgiuoBR9SwW0fyZSPd0PGfx50XFNecB5JlKOCfmL+G452/I X-Received: by 2002:a17:906:d292:: with SMTP id ay18mr3512445ejb.244.1603479401768; Fri, 23 Oct 2020 11:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603479401; cv=none; d=google.com; s=arc-20160816; b=CLP8ZtCEqgGfULG9VG3K7FxCWB2FeIqHITgSQ+WXCXs5ACVxWO4PyIWxL0PpiARcOZ XinW9bjLxG5iO5XzlE5kUBiampX2ihmkcfCJaMoAE6FUNwBTHxifYusOaZsY10NvylXY R7cv+jPMVHX78TaIAbVsf/O2q05svhokwNFSB7id8lm1sa0ZL47rpbcPts1NGzOG8Q4K r6Vhyf85j6jGQ66e35ObomHLYrwithlKBk2iPZPS/ee8CpR+isSVpnXFCkf11EmtNMB+ 4YN5t+W81bQrIz9ZlBWSc1n3Sg4RYVtP/5r9Z2SuS6Q1hFBZRnNEt1TeM7O0ygesuB1o 81gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q1heblkU3pGeZEbMUQGsUbsz6dUGe1FNCc2Btnj0cpc=; b=LmlDtMHpibN7QXf7d05263FauRXEQov152QspV9iEU+pnnRdnFf9OmEwMxoiNUkeNT G47hu9bsgK1/lZOsqzvWlN3rnHU98X8XjU6FrxS5tZQgKWacxO7rYpdPrF3HFlpL3Mw5 6Tpn1V+4gXyyvmHjQH/NgmHcbwNsuVgs8sKtCo5mDGvI0gUmy+qvd8fV8403HFH/Wwsd 28AVapxEk7WwYaFkq8QxPcWaFlHXzqEvv9lxRhI+zyyJLrkSZgk4JPYNzL+eyfvoqQgs mZemdeJcAOmfWgB7DdHZo38Plc/9RLoGxM2Lchbhs8wr+bmH2wg2wMbrEblIXHoFBGmi /P3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QfQdRr83; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj23si1496926ejb.725.2020.10.23.11.56.10; Fri, 23 Oct 2020 11:56:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QfQdRr83; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750572AbgJWRAH (ORCPT + 99 others); Fri, 23 Oct 2020 13:00:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:51756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S465168AbgJWRAG (ORCPT ); Fri, 23 Oct 2020 13:00:06 -0400 Received: from gmail.com (unknown [104.132.1.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ADEB9206BE; Fri, 23 Oct 2020 17:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603472406; bh=JbINGNb1wfDyaqjNDKC5RrjbUiFD1VruFriCCFRJSIY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QfQdRr83Pwxc4s7oxCoXyNiSw+gc1EIlexY2GVX6Te+36OoIRWO2g1SqhbkmqLzWI 2BOvtAKicV1yBmYKqjsav+bWQf94GI2EbZowoQRTCu0UZbVC3H/v/f5lxVYnUTZkAW gHhaMD4eyBx3v02/B84OCkMTSrDsPoAv7psWp64Y= Date: Fri, 23 Oct 2020 10:00:03 -0700 From: Eric Biggers To: Konrad Dybcio Cc: linux-crypto@vger.kernel.org, Satya Tangirala Subject: Re: Qualcomm Crypto Engine driver Message-ID: <20201023170003.GC3908702@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Konrad, On Fri, Oct 23, 2020 at 01:55:13PM +0200, Konrad Dybcio wrote: > Hi, > > I was investigating Qualcomm Crypto Engine support on my sdm630 > smartphone and found out that the already-present driver is > compatible. In meantime I found two issues: > > 1. The driver doesn't seem to have a maintainer? drivers/crypto/qce > doesn't seem to exist in the MAINTAINERS file.. > > 2. The person who first submitted it likely faced an issue with memory > allocation. On downstream (taking sdm630 as example) Qualcomm decided > to allocate 0x20000@1de0000 for the device and 0x24000@1dc4000 for > BAM, which isn't something upstream driver agrees with (these memory > regions overlap and the driver straight up doesn't probe..). > I "fixed" it by giving (QCE register) - (DMA register) memory size to > the DMA (which doesn't seem to cause any issues) and changing all the > registers in the header file by 0x1A000 (just like it is downstream > [1]), but the former person "fixed" it by offsetting the QCE node in > qcom-ipq4019.dtsi by 0x1A000. > > Which fix is more correct? I'd advocate for my one as the more > accurate, but I can adapt to what's already been invented.. Test > results ("cryptsetup benchmark") don't differ between these two > (though they are worse than without the QCE, which is most likely > related to unimplemented bus bandwidth scaling). > > > [1] https://github.com/sonyxperiadev/kernel/blob/aosp/LA.UM.7.1.r1/drivers/crypto/msm/qcryptohw_50.h > > Konrad Dybcio Out of curiosity, what use cases do you have in mind for drivers/crypto/qce/ on SDM630? I can't help you with that driver, but it may be worth mentioning that that the SDM630 (and most other Snapdragon SoCs) also includes an Inline Crypto Engine (ICE) as part of the eMMC host controller. The "Inline Crypto Engine" is very different from the regular "Crypto Engine" which drivers/crypto/qce/ is for. And in practice, ICE is what is used on Snapdragon-based Android devices to accelerate the storage encryption; drivers/crypto/qce/ isn't used. So if your goal is to run Android with an upstream kernel on SDM630, ICE support would probably be more useful. On the other hand, dm-crypt doesn't currently support inline encryption, so if your goal is just to run other Linux distros, ICE wouldn't be as useful (since outside Android, dm-crypt is more commonly used than fscrypt, which is what Android uses). FWIW, I'm interested in adding support for the eMMC interface to ICE, but I haven't had hardware with upstream support to use. (I was able to add upstream support for the UFS interface to ICE, since there is a SDM845 development board with upstream support, and upstream Linux now has a framework "blk-crypto" for supporting inline encryption hardware.) I see there's been recent upstreaming work on SDM630 by yourself and others. I haven't had much luck getting a Sony Xperia 10 to boot with an upstream kernel, though -- and I've also tried some of the branches at https://github.com/SoMainline/linux, including yours I think. If you're able to give some tips to getting it working (probably off-list, since it's a bit off-topic for linux-crypto) I'd appreciate it -- thanks! - Eric