Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2587955rdb; Mon, 5 Feb 2024 11:01:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWVqRtJTDUh+pihhjLe2r6YrMceekNcSAEyVC8/gHxAk6IU96VEQdP/u/ChZldVzhsLuKu X-Received: by 2002:a1f:fccb:0:b0:4c0:e29:c438 with SMTP id a194-20020a1ffccb000000b004c00e29c438mr482836vki.8.1707159705020; Mon, 05 Feb 2024 11:01:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707159704; cv=pass; d=google.com; s=arc-20160816; b=kvvdTyYcXirhZWgb+d0eG/jJYEUt19Dswk7NK3IZoYFEtFMPU63jUcbo9WbEzIYh/r MN87IPo0Q+GEmuKeytZShsYaXl4YfAIJJo55jTcw7tpcDHpP7r28aqqovDUb6Ck1HYnc Z4Lz7pgsSauZ6VWGcK4Fz5lVGe1j8cD6aRKFSW33ICcRvHsZH5PW76B13jqzBM4Pg3Jk tQk7bb4t8okgS3WT2ZmdQy79/vBJujCEYgXjq1Y2GbB/HWXGYs2o8BEcTaHktxKs1rhP orFrArjiK2GuCm6fdZmUgolGRDOS0ovuycYZf6mm5nTg2Jcnzkl1olxZFCRQHY44R4qT nSoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=LBmqhbGx6f84e6T5h03SQhOocsnVabU6PUYhi2PETL4=; fh=Ed1l3AfA/MLvvT6uHxDAo+/gKz4lGknrMTfx8PLY3tQ=; b=wsyUTqGW8y4weE314drZFWbyF1L4eFCu6oLJWO/1tyYN8G6o2fQns+MnWujR9gzZ9u YgZ7O0LBPfNgJrsXcRZlvJ99aI7Wfd9Dnkwk9Rr37Si2nAUJydegJ4DDjJMzFJXuy+IT JywqEoLxIBHQ3kM7/2zgALHdZG6pEhm9W68+bKLweZsiWnsv14gZOUV/QYH6GloyrTO0 Z20234qX04lYCD8gGNaYJpEwlUG2bMfunqBkHB3lKR8lOCY91ncQjFkb9zznjneeoqpD HQXHjwuHF8s+uzxxzHwURd7THy3twkEYEJXcPVqTE902JTGcyL6B9snd+2u+bpslM84B Ep9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MOmpDQLK; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-53271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCV+5dv6dfuRTjSEOdjhpN2JvhSc7iPCX9x31q0bV4NswY5SFu8ut9z5uvBtn8GjCSNM+F9kMXviLexrWCRbE/mWHhEoOn3rQQXr5T6TKg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s4-20020a1ff404000000b004bd402c96basi122212vkh.96.2024.02.05.11.01.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 11:01:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MOmpDQLK; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-53271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 83DF41C248ED for ; Mon, 5 Feb 2024 19:01:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F695495DB; Mon, 5 Feb 2024 19:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MOmpDQLK" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC5242E3FD; Mon, 5 Feb 2024 19:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707159608; cv=none; b=gkiUSySgPeHw3YbSZXc1tPiY8yTqSGg9Q4aY4L5/ZLSbElLx4Igrqrm3kkrW/yQ7mUBNzfyy4qa9G6PZBnWKQiqOT+74fnLMnhlTK32ESguNnfhwbKHRz0xUrWBDZMSpCRSe8MPE1xLNRuyGWMgfC5BbSrhOBq/7lGMeCM2Z6Nk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707159608; c=relaxed/simple; bh=HNYrnp9WLIKqhOXfadNXBc7gufyxT44WSMQVNI9swv8=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=Mc/8t45TwHEqS2kB8uy7ulOBC+z2ix4IzpNcHlAVxYa917QhmuE8Wq1MHswYY8BR2HGzgutkn72hY1lrowsw82w/PY43T/pZ/IbbA64hLsEpkcXSn5EIBw9L/hMMmhj6VXql5Of8tqwFvCTWO3yFVAQf5erHprV8IJxmQvghGpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=MOmpDQLK; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 415EwfiI003365; Mon, 5 Feb 2024 18:59:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=LBmqhbGx6f84e6T5h03SQhOocsnVabU6PUYhi2PETL4=; b=MO mpDQLKDvDWAwLBja6peMLUL7JSoH8y+pS96NAt2lbWYQgl+mYZUtj0BMHfUz8fpV CYBt/AIwi3qRlj+cxxvS+MeGsH+Fq4Lrhxrmv+ZBVjKmcPQ0BCPq/dmEWDLDcEMO frA5Zi2nY2jZD0abNi10MQSSxSThTkZivAc4l4EyHvJvppqOAzq6wU/EeOo5ThcC xsYI8z0rhJV/yEVxdXUXUhQqmAt87KoDj6zk9UjF2gNelJ3+kM9ndSUlFQQtMU2V TqGBWxncVohJCQsVf267e0D4B0yRpkdXfyUzsXz3D6B5BFCj1TtFzHLnVcSf6Qb6 GchIhTiGvLrr6sHnTEsw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w31wnrjp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Feb 2024 18:59:54 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 415IxrEW017665 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 5 Feb 2024 18:59:53 GMT Received: from [10.216.24.76] (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 5 Feb 2024 10:59:42 -0800 Message-ID: Date: Tue, 6 Feb 2024 00:29:38 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 10/15] ufs: host: wrapped keys support in ufs qcom Content-Language: en-US To: Gaurav Kashyap , , , , , , , , , CC: , , , , , , , , , , , , , References: <20240127232436.2632187-1-quic_gaurkash@quicinc.com> <20240127232436.2632187-11-quic_gaurkash@quicinc.com> From: Om Prakash Singh In-Reply-To: <20240127232436.2632187-11-quic_gaurkash@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: SHzNTd1x01RGFKe2FX5ORZBspHnLzBtT X-Proofpoint-GUID: SHzNTd1x01RGFKe2FX5ORZBspHnLzBtT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-05_13,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 phishscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 clxscore=1015 malwarescore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402050141 On 1/28/2024 4:44 AM, Gaurav Kashyap wrote: > Use the wrapped keys quirk when hwkm is supported/used. > Whether to use HWKM or not would be decided during an ICE > probe, and based on this information, UFS can decide to use > wrapped keys or standard keys. > > Also, propagate the appropriate key size to the ICE driver > when wrapped keys are used. > > Signed-off-by: Gaurav Kashyap > Tested-by: Neil Armstrong > --- Reviewed-by: Om Prakash Singh > drivers/ufs/host/ufs-qcom.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index acf352594362..5c9ba06438a9 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -123,6 +123,8 @@ static int ufs_qcom_ice_init(struct ufs_qcom_host *host) > > host->ice = ice; > hba->caps |= UFSHCD_CAP_CRYPTO; > + if (qcom_ice_hwkm_supported(host->ice)) > + hba->quirks |= UFSHCD_QUIRK_USES_WRAPPED_CRYPTO_KEYS; > > return 0; > } > @@ -160,7 +162,11 @@ static int ufs_qcom_ice_program_key(struct ufs_hba *hba, > cap.key_size != UFS_CRYPTO_KEY_SIZE_256) > return -EOPNOTSUPP; > > - ice_key_size = QCOM_ICE_CRYPTO_KEY_SIZE_256; > + if (bkey->crypto_cfg.key_type == BLK_CRYPTO_KEY_TYPE_HW_WRAPPED) > + ice_key_size = QCOM_ICE_CRYPTO_KEY_SIZE_WRAPPED; > + else > + ice_key_size = QCOM_ICE_CRYPTO_KEY_SIZE_256; > + > if (config_enable) > return qcom_ice_program_key(host->ice, > QCOM_ICE_CRYPTO_ALG_AES_XTS,