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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 46ADAC433DB for ; Fri, 15 Jan 2021 17:56:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A0A822262 for ; Fri, 15 Jan 2021 17:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbhAOR44 (ORCPT ); Fri, 15 Jan 2021 12:56:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:35720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbhAOR44 (ORCPT ); Fri, 15 Jan 2021 12:56:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA79F22262; Fri, 15 Jan 2021 17:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610733375; bh=vj26FR8f+iU2PtcYdkiiX4Rofrx/+1bCKnemSD3ZlAQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JBsK2t1VzsBu7KmHfRB8fFQdKPeEXnjNV8szW2jRZ4QDkGhXgm0jdcVxgilxe9p4n 3rr27iUbtfupeVQ9dSztg52vZ+fqiF5Ttg75ixVu2Lvbu50jVCt8kYGzkOhia4psYj uOvJvb3YOwdvG7agAGkKP6W2DfqhlHuM+a0NRLQFu+Y4mRQR2ck9zbXfOyG53Yu0TO R8OBrPn6JClmTKnHxfX7MInKY5GFT6fNowCH7A5VjTF9kPc3k2FDlCzVg5UYjyx/Pk tq0rw2Dzn10iP4FC6v4i6FDJ+0+5VgTyrUJz3OsrN8AIVDGK5sc9H+SYtmRF59xAD6 SUv6kieT6g8lw== Date: Fri, 15 Jan 2021 09:56:13 -0800 From: Eric Biggers To: Ulf Hansson Cc: "linux-mmc@vger.kernel.org" , linux-arm-msm , DTML , linux-fscrypt@vger.kernel.org, Satya Tangirala , Andy Gross , Bjorn Andersson , Adrian Hunter , Asutosh Das , Rob Herring , Neeraj Soni , Barani Muthukumaran , Peng Zhou , Stanley Chu , Konrad Dybcio Subject: Re: [PATCH v4 1/9] mmc: add basic support for inline encryption Message-ID: References: <20210104184542.4616-1-ebiggers@kernel.org> <20210104184542.4616-2-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Fri, Jan 15, 2021 at 10:22:03AM +0100, Ulf Hansson wrote: > On Mon, 4 Jan 2021 at 19:48, Eric Biggers wrote: > > > > From: Eric Biggers > > > > In preparation for adding CQHCI crypto engine (inline encryption) > > support, add the code required to make mmc_core and mmc_block aware of > > inline encryption. Specifically: > > > > - Add a capability flag MMC_CAP2_CRYPTO to struct mmc_host. Drivers > > will set this if the host and driver support inline encryption. > > > > - Embed a blk_keyslot_manager in struct mmc_host. Drivers will > > initialize this if the host and driver support inline encryption. > > mmc_block registers this keyslot manager with the request_queue of any > > MMC card attached to the host. mmc_core destroys this keyslot manager > > when freeing the mmc_host. > > > > - Make mmc_block copy the crypto keyslot and crypto data unit number > > from struct request to struct mmc_request, so that drivers will have > > access to them. > > > > - If the MMC host is reset, reprogram all the keyslots to ensure that > > the software state stays in sync with the hardware state. > > > > Co-developed-by: Satya Tangirala > > Signed-off-by: Satya Tangirala > > Acked-by: Adrian Hunter > > Reviewed-by: Satya Tangirala > > Reviewed-and-tested-by: Peng Zhou > > Signed-off-by: Eric Biggers > > Eric, again, my apologies for the delay. Overall, I think this looks good. > > My only hesitation to merge this as is, is that I want to make sure > you have thought of the life cycle issues for the struct > blk_keyslot_manager ksm. It's being used both from the mmc core/block > device driver and the mmc host driver. I am looking at this right now > and will get back to you very soon, if I find some issues with it. > > If you have some time, feel free to elaborate around how this is > intended to work. > > Kind regards > Uffe The blk_keyslot_manager is initialized early on when the other host structures (struct mmc_host, struct cqhci_host, struct sdhci_host, struct sdhci_msm_host) are initialized, prior to mmc_add_host(). It is destroyed when the struct mmc_host is freed by mmc_free_host(). So it should just work; it's the same lifecycle as the existing host structures. Is there something you think I'm overlooking? - Eric