From patchwork Mon Feb 26 13:17:05 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: 10242343 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 8CBA3602DC for ; Mon, 26 Feb 2018 13:23:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D15B2A007 for ; Mon, 26 Feb 2018 13:23:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 720752A00B; Mon, 26 Feb 2018 13:23:53 +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 0C8E92A007 for ; Mon, 26 Feb 2018 13:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521AbeBZNXw (ORCPT ); Mon, 26 Feb 2018 08:23:52 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37145 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753112AbeBZNRd (ORCPT ); Mon, 26 Feb 2018 08:17:33 -0500 Received: by mail-wm0-f66.google.com with SMTP id 139so4028363wmn.2 for ; Mon, 26 Feb 2018 05:17:33 -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=A25a2DP4qiAEbLbJ4DnsdPFIAfWUOWQgr03I2wjZWcw=; b=FUxHlwO714lPPI/bFNdViUdI4HMCy6ZFSQV1Hb0PR+M84Ia8OvFul8PC28Z6+ngBMe 3UaCWbhNjn9Mf4BT4ui/f/MfKRcZg5WyFAyyEWobrWtoopyzRgVoxtg0kSKzG9CxP0Sa SvqHgs1dwq9GbA6eQyor9+jc5qMSk+hW57Ki7njPQNcMbvhl3S3IZMS6zH3xIII40tlM ssc9vRCtZPeWiiOiEjWhBQOTjD+N/OUbNyuo9frvrgNglRvvG18CV1qJT8UKbupc/pAf 1vb6ufyul5yKXGWf8WcdM0htODy2DX6UX9bPEjxoSjYQKw/ywCY2vWEKlTt3CUyG0bg1 ubJg== 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=A25a2DP4qiAEbLbJ4DnsdPFIAfWUOWQgr03I2wjZWcw=; b=WhoD33TQUU3JTnfcuIk53CSpPioEKkHWDvSW4DkAoS1IxnQVDgj+/HnSpkvqsOgwXj FDFb549BqzTlWQ2pzCj1a+3j9LIs9/ESvpbgYT5pUg5pYb5hBqnQKlI1jpfllZPatJk2 pgaCshjYktMq8/Zf6sgXf8vSQML898xYUM7l40oIFK7jVHRp7VBJTbORQ68ByQOFcNYC 1JLjyyRZ32Kn2ZJi72RbK7qVSHWIn0psQNI6l52pjla2/fByXlXN1FHQlVxoBN0fVjuY TTeMAQ1UE5lwmG56g3pZY6Y4btCXfIAx7xqT0qZLneltoJ0aRXHNEfaSFdZAe4RNR3qg khug== X-Gm-Message-State: APf1xPAnmRL6w4CPyJWTzA2opgFxG7AJsg1JTQ8Y1kBJVob55ZiOTWkj OAl0Dx+P684vweLB5JhVNt327g== X-Google-Smtp-Source: AG47ELuTpwQ+E5BCW4+DHuij4jGw0kT/dJiq6VqyGW2YFlMA1j3uHuR+1hh2rSgeb77ZojYTfupOtw== X-Received: by 10.80.158.76 with SMTP id z70mr9850305ede.89.1519651052763; Mon, 26 Feb 2018 05:17:32 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id g59sm7097451ede.19.2018.02.26.05.17.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 05:17:32 -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 06/19] lightnvm: pblk: check for supported version Date: Mon, 26 Feb 2018 14:17:05 +0100 Message-Id: <1519651038-16845-7-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519651038-16845-1-git-send-email-javier@cnexlabs.com> References: <1519651038-16845-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 95ecb0ec736b..6e0567971cf6 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); }