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=-6.0 required=3.0 tests=BAYES_00,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 F2BDFC63777 for ; Fri, 20 Nov 2020 19:44:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92F8E2240B for ; Fri, 20 Nov 2020 19:44:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="milKTEWe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729164AbgKTTow (ORCPT ); Fri, 20 Nov 2020 14:44:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:47264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728761AbgKTTov (ORCPT ); Fri, 20 Nov 2020 14:44:51 -0500 Received: from sol.localdomain (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (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 67868206B6; Fri, 20 Nov 2020 19:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605901490; bh=U0R2L6SLf4RlCEnDC+EL/JGmb0bqclzNqE0fv9JhD9Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=milKTEWesqBTPEPTOJKPvfjdpUqAUUm1tobPFHoLIGdmBVbaw3zUsC0HDgqO8Uu1o DXQXUdPzL7agRO97w6EDYWt/F17d/6PWv7sxoHZlDRr/60E4JZeCt7TVMLF3xR1OAl t8BzScTFkyLBhUcNOabkz9ZWNgW7UPvbyJTw16qc= Date: Fri, 20 Nov 2020 11:44:48 -0800 From: Eric Biggers To: Adrian Hunter 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 Subject: Re: [PATCH 0/8] eMMC inline encryption support Message-ID: References: <20201112194011.103774-1-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 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(). > 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.) - Eric