From patchwork Sat Nov 28 15:49:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 7717101 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9DAFA9F71A for ; Sat, 28 Nov 2015 15:51:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDA43205F9 for ; Sat, 28 Nov 2015 15:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDAC2205FE for ; Sat, 28 Nov 2015 15:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752271AbbK1Pu6 (ORCPT ); Sat, 28 Nov 2015 10:50:58 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38353 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbbK1Ptt (ORCPT ); Sat, 28 Nov 2015 10:49:49 -0500 Received: by wmec201 with SMTP id c201so88503258wme.1 for ; Sat, 28 Nov 2015 07:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=sLiTBYM12xtndG/Xh/iQfWuxYP5GjWr3M+jMBt/bTj0=; b=UGIs8cAEAj/fzMOgujdg649byh/mIZwir7dFboQuCoqNwjSPfWAi7d9UNKFcdUojtW OeWkSDUcZ6zgbTAFVanQvEaJIlGxioaNlxmYbwWxG33G2kxKsLILJFJBEfqM5OOs9Jfo FEd2VLH4hv0FnvMZxL1dMgHMZ/BWj5Cn9rkvM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=sLiTBYM12xtndG/Xh/iQfWuxYP5GjWr3M+jMBt/bTj0=; b=BaR8N0+6GCibfSFloofpcBSch4ckFSqFfuxayPuFjqpLihmIAWmFQoAWjHfsMt3YPb 735camGTBcggDiIY0Sv3h1CbdJrUai4XGNgchXFw/9Ekb98KulXCtDiejxD7K0sxseiq yuy9miUaRFlf8IXy3E/XIScT7FQbOWiqo0o5ot/eTiUPwJ2m9AEAdIu/HOI8uXkItK38 akA8VNEX/pAJwJP5AjHW+cWYjYpmrKeDua7Dmyz/LBGZl3LTIKy+/KRaeMH47H5hnsHq o3RVl82VjiQlKFwpaCUUWyqaAQ4xV6TGG8gF24qq/UwGL4FC5SWDYGdsLr9+ouNQ9cLC HCog== X-Gm-Message-State: ALoCoQmvDoYRDKnGB87Kmhll3QgNgq3BG+UIw5h8GsnqEylO6ZxUl8aSrixPvA3b/06l74dwSAU2 X-Received: by 10.194.222.135 with SMTP id qm7mr15591271wjc.106.1448725788627; Sat, 28 Nov 2015 07:49:48 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id z1sm37937179wje.35.2015.11.28.07.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Nov 2015 07:49:48 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: hch@infradead.org, keith.busch@intel.com, sudipm.mukherjee@gmail.com, ww.tao0320@gmail.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 5/7] lightnvm: refactor and change vendor id for qemu Date: Sat, 28 Nov 2015 16:49:26 +0100 Message-Id: <1448725768-11992-6-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448725768-11992-1-git-send-email-m@bjorling.me> References: <1448725768-11992-1-git-send-email-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The QEMU NVMe implementation uses Intel vendor, Intel device id, and the first vendor specific byte to identify a LightNVM compatible nvme instance. Instead of using the Intel specific, use a preallocated from CNEX Labs instead. This lets us uniquely identify a QEMU lightnvm device without breaking other vendor specific work in the qemu device driver. Reported-by: Christoph Hellwig Signed-off-by: Matias Bjørling --- drivers/nvme/host/lightnvm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 07451d6..b9e5cc7 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -569,18 +569,25 @@ void nvme_nvm_unregister(struct request_queue *q, char *disk_name) nvm_unregister(disk_name); } +/* move to shared place when used in multiple places. */ +#define PCI_VENDOR_ID_CNEX 0x1d1d +#define PCI_DEVICE_ID_CNEX_WL 0x2807 +#define PCI_DEVICE_ID_CNEX_QEMU 0x1f1f + int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) { struct nvme_dev *dev = ns->dev; struct pci_dev *pdev = to_pci_dev(dev->dev); /* QEMU NVMe simulator - PCI ID + Vendor specific bit */ - if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x5845 && + if (pdev->vendor == PCI_VENDOR_ID_CNEX && + pdev->device == PCI_DEVICE_ID_CNEX_QEMU && id->vs[0] == 0x1) return 1; /* CNEX Labs - PCI ID + Vendor specific bit */ - if (pdev->vendor == 0x1d1d && pdev->device == 0x2807 && + if (pdev->vendor == PCI_VENDOR_ID_CNEX && + pdev->device == PCI_DEVICE_ID_CNEX_WL && id->vs[0] == 0x1) return 1;