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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 1229CC63697 for ; Mon, 23 Nov 2020 07:05:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B329E206D9 for ; Mon, 23 Nov 2020 07:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727442AbgKWHE7 (ORCPT ); Mon, 23 Nov 2020 02:04:59 -0500 Received: from mga09.intel.com ([134.134.136.24]:54305 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726861AbgKWHE6 (ORCPT ); Mon, 23 Nov 2020 02:04:58 -0500 IronPort-SDR: eswpywBM+ziv7WMyYhncKA/dGbh8sb5TkRhufoxuB0tT0lRLDw6rhKomGO6ZTSyxUhtY1e04lk ALEsxwy0vCJw== X-IronPort-AV: E=McAfee;i="6000,8403,9813"; a="171875377" X-IronPort-AV: E=Sophos;i="5.78,361,1599548400"; d="scan'208";a="171875377" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2020 23:04:41 -0800 IronPort-SDR: Qp6vNE+Kp14DbsXd3hs6+OEJ2ZFTg3BdgKZcqb/Zhp2InkvPwMD8tGF2FrBqmQ3LjiQkQ2LR0t g39Ocph5fDYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,361,1599548400"; d="scan'208";a="327099501" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.94]) ([10.237.72.94]) by orsmga003.jf.intel.com with ESMTP; 22 Nov 2020 23:04:33 -0800 Subject: Re: [PATCH 0/8] eMMC inline encryption support To: Eric Biggers Cc: linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-fscrypt@vger.kernel.org, Satya Tangirala , Ulf Hansson , Andy Gross , Bjorn Andersson , Ritesh Harjani , Asutosh Das , Rob Herring , Neeraj Soni , Barani Muthukumaran , Peng Zhou , Stanley Chu , Konrad Dybcio References: <20201112194011.103774-1-ebiggers@kernel.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <9010afea-1075-8f72-99c7-c471840685db@intel.com> Date: Mon, 23 Nov 2020 09:04:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 20/11/20 9:44 pm, Eric Biggers wrote: > Hi Adrian, > > On Fri, Nov 20, 2020 at 09:29:59PM +0200, Adrian Hunter wrote: >> I haven't had a chance to look at it properly, but I do have a couple of >> dumb questions. How do you ensure the host controller is not runtime >> suspended when the key is programmed? > > This is handled by the block layer, in block/keyslot-manager.c. It ensures that > the device is resumed before calling blk_ksm_ll_ops::keyslot_program() or > blk_ksm_ll_ops::keyslot_evict(). See blk_ksm_hw_enter(). Cool, although cqhci is doing a lazy kind of resume, so maybe not be enabled when a key is programmed? Would that be a problem? > >> Are the keys lost when the host controller is reset, and then how do you know >> the host controller does not get reset after the key is programmed but before >> the I/O is submitted? > > As with UFS, keys might be lost when the host controller is reset, so we're > reprogramming all the keys when that happens. See patch 1: > > mmc_set_initial_state() > mmc_crypto_set_initial_state() > blk_ksm_reprogram_all_keys() > > (That's the intent, at least. For MMC, I'm not sure if resets were properly > covered by the testing I've done so far. But the code looks right to me.) After reset, cqhci will not necessarily be enabled at this point. Is that OK?