From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CFEAC2D0D2 for ; Fri, 20 Dec 2019 04:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE73C24685 for ; Fri, 20 Dec 2019 04:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576817322; bh=JG9lA6TKxyPsQrVZPp69bCwvWZBiXcOFmTMqWztJ2MI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=Q3r3wMYXmQdtKH6xyzJcrEix/yEhwExASCLO9eZiuOrJd5xD7L25CbobEU1cR1Bz4 /6fUV4mjQTHL4A9krd3nKsfagkyNppro8Nw2aMA9p1f/6Te/J0tgT4O+UQ48kC02ID 6HJp4DHtZTfReH580u8fbJhc/dD7KlxwfVccxpGw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbfLTEsl (ORCPT ); Thu, 19 Dec 2019 23:48:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:53104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbfLTEsl (ORCPT ); Thu, 19 Dec 2019 23:48:41 -0500 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (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 DE98624680; Fri, 20 Dec 2019 04:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576817320; bh=JG9lA6TKxyPsQrVZPp69bCwvWZBiXcOFmTMqWztJ2MI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FlfVl8k5h5A+pN0Rd73Jym68ICrvv5/gzvjdKHAZ81xLao5L19ZMM080e9HpgkFtF Y9qHpiDIQchO8s19CxgxgVn+xkynNfO41KHYC3Tyl0D4gj09rYMGuQNYjqCIMbFG6C ft8Tdz8/nGcBIPoXD1tl6uAOj9d0JG/XGhhpWqbs= Date: Thu, 19 Dec 2019 20:48:38 -0800 From: Eric Biggers To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Barani Muthukumaran , Kuohong Wang , Kim Boojin Subject: Re: [PATCH v6 5/9] scsi: ufs: UFS crypto API Message-ID: <20191220044838.GD718@sol.localdomain> References: <20191218145136.172774-1-satyat@google.com> <20191218145136.172774-6-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191218145136.172774-6-satyat@google.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Dec 18, 2019 at 06:51:32AM -0800, Satya Tangirala wrote: > +/** > + * ufshcd_hba_init_crypto - Read crypto capabilities, init crypto fields in hba > + * @hba: Per adapter instance > + * > + * Return: 0 if crypto was initialized or is not supported, else a -errno value. > + */ > +int ufshcd_hba_init_crypto(struct ufs_hba *hba) > +{ > + int cap_idx = 0; > + int err = 0; > + unsigned int crypto_modes_supported[BLK_ENCRYPTION_MODE_MAX]; > + enum blk_crypto_mode_num blk_mode_num; > + > + /* Default to disabling crypto */ > + hba->caps &= ~UFSHCD_CAP_CRYPTO; > + > + /* Return 0 if crypto support isn't present */ > + if (!(hba->capabilities & MASK_CRYPTO_SUPPORT)) > + goto out; > + Note that unfortunately, this patch doesn't work yet on some UFS host controllers that claim to support the UFS standard crypto, due to issues like deviations from the UFS standard and missing device tree changes -- and this can even cause boot-time crashes. So if we can't fix everything right away (which can be really hard without help from the relevant vendor) I think we have to define a bit UFSHCD_QUIRK_BROKEN_CRYPTO in ufs_hba::quirks which can be set on host controllers where the proper tricks to get the crypto working correctly haven't been figured out yet. The crypto support would be ignored if that bit is set. - Eric