From patchwork Thu Nov 19 11:50:09 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: 7656641 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 02D9E9F2E2 for ; Thu, 19 Nov 2015 11:51:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ABB720699 for ; Thu, 19 Nov 2015 11:51:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0629C2069A for ; Thu, 19 Nov 2015 11:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758437AbbKSLvT (ORCPT ); Thu, 19 Nov 2015 06:51:19 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34786 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756140AbbKSLuS (ORCPT ); Thu, 19 Nov 2015 06:50:18 -0500 Received: by wmvv187 with SMTP id v187so21454958wmv.1 for ; Thu, 19 Nov 2015 03:50:17 -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=uyZsYJTquSXYlcV8zHZkJw4fzdCyS4HNX8CLhgRk8M4=; b=dY6BrKMf7yvk8GYVGBJQWDppGJQWwpFfCKRhy3i/W0ewZrdPTMbR6XbcUY/h8i0TYg UPYXqoSJgIy9CMdN12zggNEPLPkdg05g84XWok/SBIyXVBTfZdWbswOSidDKdt3uGLj8 OVHKqrL8KBqG+cIwtWcIOEn0RT7T6osNX8swQ= 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=uyZsYJTquSXYlcV8zHZkJw4fzdCyS4HNX8CLhgRk8M4=; b=juYM7bmtb8mupw/993GYDnIWjW8skrVIpXr03tpTWr7GwB/v007ITpY/nBlw7CK5Sk +xukrJiZ+5DrddHBn6RUb3QaptFFtdEuKBJV9n5L4lsizdcd9RerjN6/8MkQNB4FSVnw tXnXBoTGihPkJf13mHcaxbPkJpX9cLM7+iAzRuPmgpK/cQ1ytLLB4BKo/YhKRliikJpS evgmFdYdvzkpIWpCEYk243QRTskMYJCT83mahFouAN6Y0nAHriGyMqoab1dfmCQqJxQ3 WJf6ppswvjzeuYLGZcpRrterzzeWJvyGxVpxgRveCOc00r9pXeVZRNzPVXkcpyHjyyaL eL7g== X-Gm-Message-State: ALoCoQltq+c3DWdAmoyQe92H21AcPIwmO2UcAPmYXidZXLddM1bppdcLqq+EPSABAF6YVObAqHWG X-Received: by 10.194.243.6 with SMTP id wu6mr7731052wjc.14.1447933816948; Thu, 19 Nov 2015 03:50:16 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id a186sm7950653wmh.4.2015.11.19.03.50.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 03:50:16 -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: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 2/3] null_blk: use device addressing mode Date: Thu, 19 Nov 2015 12:50:09 +0100 Message-Id: <1447933810-10267-3-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447933810-10267-1-git-send-email-m@bjorling.me> References: <1447933810-10267-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=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 linear addressing mode was removed in 7386af2. Make null_blk instead expose the ppa format geometry and support the generic addressing mode. Signed-off-by: Matias Bjørling --- drivers/block/null_blk.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 173ba24..6184b82 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c @@ -486,6 +486,7 @@ static int null_lnvm_submit_io(struct request_queue *q, struct nvm_rq *rqd) static int null_lnvm_id(struct request_queue *q, struct nvm_id *id) { sector_t size = gb * 1024 * 1024 * 1024ULL; + sector_t blksize; struct nvm_id_group *grp; id->ver_id = 0x1; @@ -493,17 +494,34 @@ static int null_lnvm_id(struct request_queue *q, struct nvm_id *id) id->cgrps = 1; id->cap = 0x3; id->dom = 0x1; - id->ppat = NVM_ADDRMODE_LINEAR; + + id->ppaf.blk_offset = 0; + id->ppaf.blk_len = 16; + id->ppaf.pg_offset = 16; + id->ppaf.pg_len = 16; + id->ppaf.sect_offset = 32; + id->ppaf.sect_len = 8; + id->ppaf.pln_offset = 40; + id->ppaf.pln_len = 8; + id->ppaf.lun_offset = 48; + id->ppaf.lun_len = 8; + id->ppaf.ch_offset = 56; + id->ppaf.ch_len = 8; do_div(size, bs); /* convert size to pages */ + do_div(size, 256); /* concert size to pgs pr blk */ grp = &id->groups[0]; grp->mtype = 0; - grp->fmtype = 1; + grp->fmtype = 0; grp->num_ch = 1; - grp->num_lun = 1; - grp->num_pln = 1; - grp->num_blk = size / 256; grp->num_pg = 256; + blksize = size; + do_div(size, (1 << 16)); + grp->num_lun = size + 1; + do_div(blksize, grp->num_lun); + grp->num_blk = blksize; + grp->num_pln = 1; + grp->fpg_sz = bs; grp->csecs = bs; grp->trdt = 25000;