Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1527763ybm; Sat, 30 May 2020 11:44:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM515uW7DKj2+dsUCaaXZQEXa+Ab4fX9vxPBV5I2+8/FT6UQNATog+ilcuhiFwHJGvWxdm X-Received: by 2002:aa7:da42:: with SMTP id w2mr432176eds.176.1590864264267; Sat, 30 May 2020 11:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590864264; cv=none; d=google.com; s=arc-20160816; b=gZyKTKmMTDt1111bxbcbQt6zHMdyUr+NfYoXKHubNJvRkaUD81lto9TBg5FSGjhil+ NU+NiAIJzjbw9xXNE6hsL6BtX9DHZ8LxM0uHmU5Et0KCZgNVwrvpNN+J7qA2ygq9Kt7c 40mAFpy/9C5gPsvcLfjplm1qU1oKLi81VrjhmWt1dcbaHwqXNGwKFu4gbHiI1O7ok9sm fzOhDS4lEBBWOTz530m17Wnwo0InAtCHdXDi9fMJ3QUh3iNFbIHPWgFvtscFNcuJK0yT PW3pxwVhwCFb9eTQ/moMChfM8HWXU8U//t38ZjsvJhOWh3pmpF3IGBjvycLWaLldaIr7 jNEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=4YRgg4mVe6S4HVEN1nXvVtBG5wYMm2wu66O3xco6nK4=; b=ep0MbtntY8IxaHKqdPzLk4K8LVqP8gcV3TsdDvlJtZvLHxD4t9Gu967fTf2jRpwthr AqSPxPpEJHgOWxZPSWUTfj91q4aaLrw5BNl78rKz3RwF62O12gYARWsxMolIeTK92/mP fo/MjAevq0lkxCnR7Q5UZgqDIeRTS3cI3TZ6mFIlqtjf5JCBDPe9jM9Dmf3E5YU/cP5P ihFZj3/A6fWdTthwNLMkPtnGzlJ0XYBcKqM95OvVqgUEP4R0uIMSGBrioZPFJaIvuzZr /lhxI3Xxfg+vjR4ieaXhTde7KHQteNy9pAIg03RYToY8Etz1HUY/YhZP6GRSL0XsUtuN 7Tzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JKP8yotI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f2si3077347ejq.657.2020.05.30.11.43.25; Sat, 30 May 2020 11:44:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JKP8yotI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729090AbgE3Sdf (ORCPT + 99 others); Sat, 30 May 2020 14:33:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728741AbgE3Sde (ORCPT ); Sat, 30 May 2020 14:33:34 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61AAC03E969; Sat, 30 May 2020 11:33:33 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id l1so3376694ede.11; Sat, 30 May 2020 11:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=4YRgg4mVe6S4HVEN1nXvVtBG5wYMm2wu66O3xco6nK4=; b=JKP8yotI2lzkKDIIsMN7pn2Ki5qkpzzv5z4VvI3VIwk/h7VdUpS6AMQa4tonQ3P87d fJA0YW2pPZfwX77UzRSisHOtKDZ0pAdhoptxuYGB2VLtSL+6NSDnsS5KehE4L7y7qwqF xVfi8aXKMUaeKz5N3OJad/N139247jeuAO994Svnx5TaBGAwVYYpQifVNZiBFQO2y7WM EkvBPrHc/PUoVf3ZzNQiE7PVenuEHQolkGyvCrKPHMyu4d6HanUZ1OeoOaHcQFA0wzPx 1DNgQQ94vi1qtH/AwIvQlxMRqk6ZiVLFbBD0Zy147rh10sYy1q4nttumLXkSIBLo4+N3 dIMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=4YRgg4mVe6S4HVEN1nXvVtBG5wYMm2wu66O3xco6nK4=; b=iaCAZd4Af0lpE3I0OCfL/PJ5DEK9RgzrwSLRBurKcU5oUgMcjWGNDJnylo837/Wfyt 46HeF+DZM2zQdqBmTxJpiHRpLDn6kzcR8hNavOTCrChaMMhpsmO8EUZLr1BC5PM8fHu3 FqPIzRPlcELuPCVvj+6Tg6eEC1k1t/8jxkUAm0o4NdtsNogOESe3f2+bDYZFbs787q/f cHcnvJ7Cw1XUgB9L3pa81kK9Qc+mM5B9CFjuIINkowHEYgSgHZQj2PQtN3HrAXihbrxd WHEKnf5Z5v41+ztVQDESxme7Mt0GkQGSVzNL3ArSkMWiUyYswsWPOxCsTlnN4yUrQ28t ym4Q== X-Gm-Message-State: AOAM532+gYurmq+RuTA+swGJcJtt/0R9m5QYWvExqxuRh9aYy/cmtDHi uzC2viZIHYlKUULBq8qx8p4= X-Received: by 2002:a05:6402:1ac1:: with SMTP id ba1mr524185edb.91.1590863612448; Sat, 30 May 2020 11:33:32 -0700 (PDT) Received: from ubuntu-laptop (ip5f5bfcfd.dynamic.kabel-deutschland.de. [95.91.252.253]) by smtp.googlemail.com with ESMTPSA id dt7sm10440171ejb.33.2020.05.30.11.33.31 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 May 2020 11:33:31 -0700 (PDT) Message-ID: <07b197a84394a20cf175e37d1a442d52535856ae.camel@gmail.com> Subject: Re: [PATCH v4 4/4] scsi: ufs: add compatibility with 3.1 UFS unit descriptor length From: Bean Huo To: Avri Altman , "alim.akhtar@samsung.com" , "asutoshd@codeaurora.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "stanley.chu@mediatek.com" , "beanhuo@micron.com" , "bvanassche@acm.org" , "tomas.winkler@intel.com" , "cang@codeaurora.org" Cc: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Sat, 30 May 2020 20:33:30 +0200 In-Reply-To: References: <20200529164054.27552-1-huobean@gmail.com> <20200529164054.27552-5-huobean@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avri, On Sat, 2020-05-30 at 06:56 +0000, Avri Altman wrote: > > > > > From: Bean Huo > > > > For UFS 3.1, the normal unit descriptor is 10 bytes larger > > than the RPMB unit, however, both descriptors share the same > > desc_idn, to cover both unit descriptors with one length, we > > choose the normal unit descriptor length by desc_index. > > This is not what your code is doing. > For RPMB - desc size will not be 0x2d but remain 256. sorry, I'm afraid I didn't quite get your point here. would you go over it again in detail please? > > Your strategy is still correct IMO - if you assign the larger size, > The device will not reply with error, but with the proper buffer. > > You can also rely that reading the rpmb unit descriptor will not > happen before > Reading regular luns, because this is happening in the first > slave_alloc. > On my side, I saw the Well-know LU descriptor is read before regulaer/normal LU descritptor. see ufshcd_add_lus(); I did further debug to verify my patch, and the unit descriptor read sequence: 1. read RPMB descriptor: desc_id 2, desc_index 0xc4 2. read LU 0 descriptor: desc_id 2, desc_index 0 3. read LU 0 descriptor: desc_id 2, desc_index 1 4. read LU 0 descriptor: desc_id 2, desc_index 2 5. read LU 0 descriptor: desc_id 2, desc_index 4 .... > Hence, I think you can drop the extra if, and just add the comment. > so, this 'if' is still needed. otherwise, LU descriptor length will be initialized as 0x23(RPMB descriptor length). if I am wrong, please correct me. thanks, Bean