From patchwork Fri Sep 22 10:31:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hieagle X-Patchwork-Id: 9965791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA65B600C5 for ; Fri, 22 Sep 2017 10:32:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB17D2984F for ; Fri, 22 Sep 2017 10:32:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFE652986B; Fri, 22 Sep 2017 10:32:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 749072984F for ; Fri, 22 Sep 2017 10:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751974AbdIVKb6 (ORCPT ); Fri, 22 Sep 2017 06:31:58 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36081 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751872AbdIVKb5 (ORCPT ); Fri, 22 Sep 2017 06:31:57 -0400 Received: by mail-pg0-f66.google.com with SMTP id d8so409998pgt.3; Fri, 22 Sep 2017 03:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6b9uDzvoJCz2A6RdLpH5UIAkmSsgd4Aw+/Dy+vn0EHg=; b=eDKVOZ0Ek8BCipDz9W2c5nAVvuHKGDzQ2kAhH0N4XYWKO0ybg6HPbt95QYi4I0E5dQ yPzEdalDRaeEhKKkqg8t2e26YjHyRHw0Y0RP4GepfYDqAiuVZsvFz15VtYeWGF2kR74I UAFR6OAEDyCQnk+Tm2PksWAQIFJwlQMS/CnOyh6auqv+DsVnKGDPREY6aCUIRGVo7Jzk Lv8tHupr2kGPo6Gc0VTu1uxebWgKSsPPKx4lbmRhijWKJHtwQ3wq/izcrMTbsRqwagom hfbZOB3Z8dA9EvNjFPjsoPpx9XCmPtceFP7qVmasWbNmOF/lx36CMYKT0a73Pb4kTjMM m4mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6b9uDzvoJCz2A6RdLpH5UIAkmSsgd4Aw+/Dy+vn0EHg=; b=ae7pHHD/uXNPAMLcpTVk2lMpW/R/xO4GCvEexNyUlcMDjBxv1PuCxslwveCq3SjWCd XqbMwztJlEeQAkxsfQxMssp9nThiSSun73ZICxuIqMBnojgfDZCR27tuT+bDlPPQ2+UW kYmoN8//i1qK1wscshVEqvPvTmVuR5e8dGf2VtPUSMAH8ESzAlzu0ofrcBlqCKcRUU34 k14ks6sGQ5h9sLRMluAuMUV0WRmiKxy3msBcdqSyOeWWLayg8y0XKGmOhDV/NKVz7/7E R6mucxdxeorPVeF3sEXotkY8TlDSfrNOxMqt2Tbx0tDLIHw9W22Av1O9H6talufDZc5g 3oPA== X-Gm-Message-State: AHPjjUjDowYDSJR3vs/FmStlBRTSKwesIlgM7pPyaX3Ru75oubqZaxPd vBtVCVch1K0nC+avanHh1xtu9Q== X-Google-Smtp-Source: AOwi7QDqPJh4ExZUbBFvp43TVDF8K3p88Hmf6bH/tUyc+3Zoid2dD0pIPSuGFQggliqFHG8TpXfTeQ== X-Received: by 10.84.242.12 with SMTP id ba12mr2964021plb.69.1506076317461; Fri, 22 Sep 2017 03:31:57 -0700 (PDT) Received: from localhost.localdomain (outboundhk.mxmail.xiaomi.com. [207.226.244.123]) by smtp.googlemail.com with ESMTPSA id h9sm6907895pfh.98.2017.09.22.03.31.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 03:31:56 -0700 (PDT) From: Huanlin Ke X-Google-Original-From: Huanlin Ke To: vinholikatti@gmail.com Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kehuanlin@pinecone.net Subject: [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled Date: Fri, 22 Sep 2017 18:31:47 +0800 Message-Id: <1506076307-8462-1-git-send-email-kehuanlin@pinecone.net> X-Mailer: git-send-email 2.7.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Several configurable fields of the Device Descriptor and the Unit Descriptors determine the Boot LUN status. The bBootEnable field and the bBootLunEn attribute is set to zero by default, so the Boot LUN is disabled by default. At which point the scsi device add for Boot LUN will fail, but we can continue to use the ufs device in fact. This failure shouldn't abort the device boot. Signed-off-by: Huanlin Ke Reviewed-by: Subhash Jadavani --- drivers/scsi/ufs/ufshcd.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 794a460..bff84be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5998,25 +5998,22 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) } scsi_device_put(hba->sdev_ufs_device); - sdev_boot = __scsi_add_device(hba->host, 0, 0, - ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); - if (IS_ERR(sdev_boot)) { - ret = PTR_ERR(sdev_boot); - goto remove_sdev_ufs_device; - } - scsi_device_put(sdev_boot); - sdev_rpmb = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); if (IS_ERR(sdev_rpmb)) { ret = PTR_ERR(sdev_rpmb); - goto remove_sdev_boot; + goto remove_sdev_ufs_device; } scsi_device_put(sdev_rpmb); + + sdev_boot = __scsi_add_device(hba->host, 0, 0, + ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); + if (IS_ERR(sdev_boot)) + dev_err(hba->dev, "%s: BOOT WLUN not found\n", __func__); + else + scsi_device_put(sdev_boot); goto out; -remove_sdev_boot: - scsi_remove_device(sdev_boot); remove_sdev_ufs_device: scsi_remove_device(hba->sdev_ufs_device); out: