Message ID | 20221107131038.201724-2-beanhuo@iokpp.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2041320wru; Mon, 7 Nov 2022 05:13:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf6uXe/T/1CwQ8E1F+PJct/Ad9uc9ARO94mAcarXirBygvzJr/LSKsVHcT9kmK6XMORfQlSA X-Received: by 2002:a17:906:18e2:b0:7ae:563c:7bf8 with SMTP id e2-20020a17090618e200b007ae563c7bf8mr9838112ejf.391.1667826823869; Mon, 07 Nov 2022 05:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667826823; cv=none; d=google.com; s=arc-20160816; b=NjcnfXRe8CvLj/VhyskaUQqpFw/3J8jeb702J+M2r4/tT2M5jwpELNZIzkMbBQy1Ma 6QMo7kup7BQFmXgApRaaLxrm5JnVAhWdGbK35HBvuE4hy6wCWqdGeGih0zbfXWkoJdC7 rt5U/gxC3Xn47JTZ1QTOUwdDqrhxykZmMr96uXOv0O3W5umFWrWCx1V9PTcPZrsbeB18 Blyx0e9BVgJZtdV2f7d6QoVkVcr/GeN859howviKjCu5gXmpcgtQEFqO/iRv+rTKI4QV EyFFsNN5wJotI6h1iVflVUeB15V3x4AILm3WY6CL+dNCypO0YY14loAyMgKZ4u/5vzr8 8C9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x0ChwJ2vaiy1SWOkttW7ZHW/S8+rHXWSvSwa65vCkNw=; b=XWPsbNglfELJ5TSTZV3G2t6Y5QyuuGOAp4JwGCdi1MTrqibryoZCt+J+Qwivq82pjJ HfCgnN3FdI4gOXJ8l7TyMQXExuOqn4C4/XcXQhXcgHKQ0HiY1i9fxfdNHwodhLi4YGjt yVMsn3RUMxHXt+s5xnt0WPkFCyoqqUMR9dRy3dgw6pLiZI3kvayIUul5GGh02A9OHydI mspOi+KA6OlGg3fVv4XHQfmtoy1x15I9m6e2xPxefogq0iC0FJ/ya1o0h61T9UZ96Hie fzS26NCq4e+0NknBz08x+6/5uCB+yTQiHhTbJnc7fiF30jeX6fOoHd2sCtoo7O3pkWAC L6/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@iokpp.de header.s=strato-dkim-0002 header.b=dSEri47t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170906124900b007ae4717bf0fsi7060574eja.158.2022.11.07.05.13.19; Mon, 07 Nov 2022 05:13:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@iokpp.de header.s=strato-dkim-0002 header.b=dSEri47t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232236AbiKGNLL (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 08:11:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232096AbiKGNLD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 08:11:03 -0500 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BE11C924; Mon, 7 Nov 2022 05:11:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1667826655; s=strato-dkim-0002; d=iokpp.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=x0ChwJ2vaiy1SWOkttW7ZHW/S8+rHXWSvSwa65vCkNw=; b=dSEri47t1GEzZxTYXqvVC5tnr7NEBZL0M6SNWlSx2MmfyUSl+va+fNUI7TXCpwMm/9 fjL+8f2ceMZZU30OfpnTOCpd1mgsggupQXaCGBjSG+GWfcJS/Kx5M5BqRNz0HC6YysFG fTAuOoEzQrLk9Q0eW+9kNpdSK6/m9NPeYgPN/cx/U9QbeoDeZPzL1Le2MuQCtWeckAIR 97pwZf3bW+BCJanhZcU6A7o3XaHvLrGXt8ldu4J0Lmr6EIIavGYQM1qek2yYxwBmA9dn 2Vnr+t2NriWeNBOgxxrZwba634ZLFpHGymC/sFtS5jKtjNimwELrNtcJRN7AgjuCAo5w xA+g== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":LmkFe0i9dN8c2t4QQyGBB/NDXvjDB6pBSedrgBzPc9DUyubU4DD1QLj68UeUr1+U1RvWtIeMr7Q/U8vM/+oObyVBycbphAC+CkWyag==" X-RZG-CLASS-ID: mo01 Received: from blinux.speedport.ip by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id z9cfbfyA7DAsjG9 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 7 Nov 2022 14:10:54 +0100 (CET) From: Bean Huo <beanhuo@iokpp.de> To: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, daejun7.park@samsung.com, quic_cang@quicinc.com, quic_nguyenb@quicinc.com, quic_xiaosenh@quicinc.com, quic_richardp@quicinc.com, quic_asutoshd@quicinc.com, hare@suse.de Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 1/2] ufs: core: Advanced RPMB detection Date: Mon, 7 Nov 2022 14:10:37 +0100 Message-Id: <20221107131038.201724-2-beanhuo@iokpp.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107131038.201724-1-beanhuo@iokpp.de> References: <20221107131038.201724-1-beanhuo@iokpp.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748843179974812512?= X-GMAIL-MSGID: =?utf-8?q?1748843179974812512?= |
Series |
UFS Advanced RPMB
|
|
Commit Message
Bean Huo
Nov. 7, 2022, 1:10 p.m. UTC
From: Bean Huo <beanhuo@micron.com> Check UFS Advanced RPMB LU enablement during ufshcd_lu_init(). Signed-off-by: Bean Huo <beanhuo@micron.com> --- drivers/ufs/core/ufshcd.c | 4 ++++ include/ufs/ufs.h | 3 +++ 2 files changed, 7 insertions(+)
Comments
> From: Bean Huo <beanhuo@micron.com> > > Check UFS Advanced RPMB LU enablement during ufshcd_lu_init(). > > Signed-off-by: Bean Huo <beanhuo@micron.com> > --- > drivers/ufs/core/ufshcd.c | 4 ++++ > include/ufs/ufs.h | 3 +++ > 2 files changed, 7 insertions(+) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index > ee73d7036133..d49e7a0b82ca 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -4940,6 +4940,10 @@ static void ufshcd_lu_init(struct ufs_hba *hba, > struct scsi_device *sdev) > desc_buf[UNIT_DESC_PARAM_LU_WR_PROTECT] == > UFS_LU_POWER_ON_WP) > hba->dev_info.is_lu_power_on_wp = true; > > + if (desc_buf[UNIT_DESC_PARAM_UNIT_INDEX] == UFS_RPMB_UNIT && Please remind me why do we need both UFS_RPMB_UNIT and UFS_UPIU_RPMB_WLUN ? > + desc_buf[UNIT_DESC_PARAM_RPMB_REGION_EN] & 1 << 4) (1 << 4) or BIT(4) ? > + hba->dev_info.b_advanced_rpmb_en = true; > + > kfree(desc_buf); > set_qdepth: > /* > diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h index > 1bba3fead2ce..2e617ab87750 100644 > --- a/include/ufs/ufs.h > +++ b/include/ufs/ufs.h > @@ -199,6 +199,7 @@ enum unit_desc_param { > UNIT_DESC_PARAM_PSA_SENSITIVE = 0x7, > UNIT_DESC_PARAM_MEM_TYPE = 0x8, > UNIT_DESC_PARAM_DATA_RELIABILITY = 0x9, > + UNIT_DESC_PARAM_RPMB_REGION_EN = 0x9, This is awkward. Better to define it, or - Maybe it's time for rpmb to have its own unit descriptor - it surely deserve it. Thanks, Avri > UNIT_DESC_PARAM_LOGICAL_BLK_SIZE = 0xA, > UNIT_DESC_PARAM_LOGICAL_BLK_COUNT = 0xB, > UNIT_DESC_PARAM_ERASE_BLK_SIZE = 0x13, > @@ -601,6 +602,8 @@ struct ufs_dev_info { > > bool b_rpm_dev_flush_capable; > u8 b_presrv_uspc_en; > + > + bool b_advanced_rpmb_en; > }; > > /* > -- > 2.25.1
Avri, thanks for your review. On Tue, 2022-11-08 at 13:40 +0000, Avri Altman wrote: > > From: Bean Huo <beanhuo@micron.com> > > > > Check UFS Advanced RPMB LU enablement during ufshcd_lu_init(). > > > > Signed-off-by: Bean Huo <beanhuo@micron.com> > > --- > > drivers/ufs/core/ufshcd.c | 4 ++++ > > include/ufs/ufs.h | 3 +++ > > 2 files changed, 7 insertions(+) > > > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > > index > > ee73d7036133..d49e7a0b82ca 100644 > > --- a/drivers/ufs/core/ufshcd.c > > +++ b/drivers/ufs/core/ufshcd.c > > @@ -4940,6 +4940,10 @@ static void ufshcd_lu_init(struct ufs_hba > > *hba, > > struct scsi_device *sdev) > > desc_buf[UNIT_DESC_PARAM_LU_WR_PROTECT] == > > UFS_LU_POWER_ON_WP) > > hba->dev_info.is_lu_power_on_wp = true; > > > > + if (desc_buf[UNIT_DESC_PARAM_UNIT_INDEX] == UFS_RPMB_UNIT > > && > Please remind me why do we need both UFS_RPMB_UNIT and > UFS_UPIU_RPMB_WLUN ? I see. they are the same value, we should remove one, will change it in next version. > > > + desc_buf[UNIT_DESC_PARAM_RPMB_REGION_EN] & 1 << 4) > (1 << 4) or BIT(4) ? > > > + hba->dev_info.b_advanced_rpmb_en = true; > > + > > kfree(desc_buf); > > set_qdepth: > > /* > > diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h index > > 1bba3fead2ce..2e617ab87750 100644 > > --- a/include/ufs/ufs.h > > +++ b/include/ufs/ufs.h > > @@ -199,6 +199,7 @@ enum unit_desc_param { > > UNIT_DESC_PARAM_PSA_SENSITIVE = 0x7, > > UNIT_DESC_PARAM_MEM_TYPE = 0x8, > > UNIT_DESC_PARAM_DATA_RELIABILITY = 0x9, > > + UNIT_DESC_PARAM_RPMB_REGION_EN = 0x9, > This is awkward. Better to define it, or - > Maybe it's time for rpmb to have its own unit descriptor - it surely > deserve it. > no problem, let me think about it, will add in the next version. Kind regards, Bean
> Avri, > > thanks for your review. > > On Tue, 2022-11-08 at 13:40 +0000, Avri Altman wrote: > > > From: Bean Huo <beanhuo@micron.com> > > > > > > Check UFS Advanced RPMB LU enablement during ufshcd_lu_init(). > > > > > > Signed-off-by: Bean Huo <beanhuo@micron.com> > > > --- > > > drivers/ufs/core/ufshcd.c | 4 ++++ > > > include/ufs/ufs.h | 3 +++ > > > 2 files changed, 7 insertions(+) > > > > > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > > > index ee73d7036133..d49e7a0b82ca 100644 > > > --- a/drivers/ufs/core/ufshcd.c > > > +++ b/drivers/ufs/core/ufshcd.c > > > @@ -4940,6 +4940,10 @@ static void ufshcd_lu_init(struct ufs_hba > > > *hba, struct scsi_device *sdev) > > > desc_buf[UNIT_DESC_PARAM_LU_WR_PROTECT] == > > > UFS_LU_POWER_ON_WP) > > > hba->dev_info.is_lu_power_on_wp = true; > > > > > > + if (desc_buf[UNIT_DESC_PARAM_UNIT_INDEX] == UFS_RPMB_UNIT > > > && > > Please remind me why do we need both UFS_RPMB_UNIT and > > UFS_UPIU_RPMB_WLUN ? > > I see. they are the same value, we should remove one, will change it in next > version. > > > > > + desc_buf[UNIT_DESC_PARAM_RPMB_REGION_EN] & 1 << 4) > > (1 << 4) or BIT(4) ? Not saying that testing bit 4 of bRPMBRegionEnable is wrong, Have you considered using bit 10 of dExtendedUFSFeaturesSupport and decided otherwise? Thanks, Avri
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index ee73d7036133..d49e7a0b82ca 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4940,6 +4940,10 @@ static void ufshcd_lu_init(struct ufs_hba *hba, struct scsi_device *sdev) desc_buf[UNIT_DESC_PARAM_LU_WR_PROTECT] == UFS_LU_POWER_ON_WP) hba->dev_info.is_lu_power_on_wp = true; + if (desc_buf[UNIT_DESC_PARAM_UNIT_INDEX] == UFS_RPMB_UNIT && + desc_buf[UNIT_DESC_PARAM_RPMB_REGION_EN] & 1 << 4) + hba->dev_info.b_advanced_rpmb_en = true; + kfree(desc_buf); set_qdepth: /* diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h index 1bba3fead2ce..2e617ab87750 100644 --- a/include/ufs/ufs.h +++ b/include/ufs/ufs.h @@ -199,6 +199,7 @@ enum unit_desc_param { UNIT_DESC_PARAM_PSA_SENSITIVE = 0x7, UNIT_DESC_PARAM_MEM_TYPE = 0x8, UNIT_DESC_PARAM_DATA_RELIABILITY = 0x9, + UNIT_DESC_PARAM_RPMB_REGION_EN = 0x9, UNIT_DESC_PARAM_LOGICAL_BLK_SIZE = 0xA, UNIT_DESC_PARAM_LOGICAL_BLK_COUNT = 0xB, UNIT_DESC_PARAM_ERASE_BLK_SIZE = 0x13, @@ -601,6 +602,8 @@ struct ufs_dev_info { bool b_rpm_dev_flush_capable; u8 b_presrv_uspc_en; + + bool b_advanced_rpmb_en; }; /*