From patchwork Wed Feb 21 09:26:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 10231645 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 1B38260392 for ; Wed, 21 Feb 2018 09:30:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2309028AA8 for ; Wed, 21 Feb 2018 09:30:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17C1828AAB; Wed, 21 Feb 2018 09:30:27 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 C008A28AA8 for ; Wed, 21 Feb 2018 09:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932382AbeBUJaL (ORCPT ); Wed, 21 Feb 2018 04:30:11 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41970 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753267AbeBUJ1W (ORCPT ); Wed, 21 Feb 2018 04:27:22 -0500 Received: by mail-wr0-f194.google.com with SMTP id f14so2427258wre.8 for ; Wed, 21 Feb 2018 01:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3fgLEzEw9C5Xeld+vsfAyLjjhxc2P+hbrYmLNQUwJ5Q=; b=os3wr6uXoPTY7W3W06VpYfxzrElZB5cATBNsMwGEKohuCcHRl3x6c7RbvcejXg911o yiilKowzuMICO+2GMxo/VjiA3mDTpiYkkeavwjG8ZfuDzgcg+w6OyY5Og/dyRSMbjxaG 6kOhqjC00QaVAUWkN5zU2GGBMqOE5DeNlo+f/ohkq4nz0UrJ5z03PnVHjp3Nt+G70DlL mcuwd3SE+8uPyq4VAB5nlnGCkg0NDIdMnIGb5mmviCDgtfMPzbL3qIPp7NINFruhhaMX hgEj+Mdnj/TU35kEWVWAj+d7QF/9QYycp0V4TVDzQtTNfxAY5Z0sAGC3R/A9cJfx6ZxE 3IXw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=3fgLEzEw9C5Xeld+vsfAyLjjhxc2P+hbrYmLNQUwJ5Q=; b=Sr12jYssQle5ovTyWnPNn+j6p9CsyDvambL3/S0HMJQNg19AiNOeqkgzRxWU7KenXd WU2ENaIgCGWz+sC5K047NOmPRjY1im+hoNbcnAexj6pTPH7Vl7CzQlaLiS0dVyn99fRZ 5mloGJY7PEEz141s3bSsN4cmTPC2gq7hJZqzuiTxeBIloNiy6SRcsydDLvMBtQBcya9C 4Ry+IQMHP19NKa5OuGf2h8eJLXMVzScA0OM64XWFCEhITgIkAnv0aYe9tyOBa7C/uA3a 6VLMEDutok1Kz4ALaLxyRdissF5stYrksNif37iIkKsUfNuOWoj22CmbT7Hlcn0dvrwl PDXQ== X-Gm-Message-State: APf1xPCpcm4yb5QyNFZQ6gOckMNZkJcg2jVObmrJ06aGz7d9g9tUfr2t vY0nyym4yOYUbYXCeujP5FglNQ== X-Google-Smtp-Source: AH8x224ClL1O95yeRTmdLl+yyK7lYpwMy+r3OyFgVb2TzeabSbauY+9IU/8pPMBw757jQrUMdeXEJg== X-Received: by 10.80.182.245 with SMTP id f50mr4055551ede.157.1519205241081; Wed, 21 Feb 2018 01:27:21 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id a17sm3389955eda.42.2018.02.21.01.27.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 01:27:20 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 11/20] lightnvm: pblk: check for supported version Date: Wed, 21 Feb 2018 10:26:49 +0100 Message-Id: <1519205218-26994-12-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> References: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP At this point, only 1.2 spec is supported, thus check for it. Also, since device-side L2P is only supported in the 1.2 spec, make sure to only check its value under 1.2. Signed-off-by: Javier González --- drivers/lightnvm/pblk-init.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 56b4afc27add..ec39800eea42 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -990,9 +990,15 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk, struct pblk *pblk; int ret; - if (dev->geo.c.dom & NVM_RSP_L2P) { + if (geo->c.version != NVM_OCSSD_SPEC_12) { + pr_err("pblk: OCSSD version not supported (%u)\n", + geo->c.version); + return ERR_PTR(-EINVAL); + } + + if (geo->c.version == NVM_OCSSD_SPEC_12 && geo->c.dom & NVM_RSP_L2P) { pr_err("pblk: host-side L2P table not supported. (%x)\n", - dev->geo.c.dom); + geo->c.dom); return ERR_PTR(-EINVAL); }