From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C39B7C433E0 for ; Tue, 2 Feb 2021 12:10:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 701D764F64 for ; Tue, 2 Feb 2021 12:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbhBBMJn (ORCPT ); Tue, 2 Feb 2021 07:09:43 -0500 Received: from foss.arm.com ([217.140.110.172]:48600 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230419AbhBBMIo (ORCPT ); Tue, 2 Feb 2021 07:08:44 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ED3261396; Tue, 2 Feb 2021 04:07:57 -0800 (PST) Received: from [10.57.35.163] (unknown [10.57.35.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 13D6C3F718; Tue, 2 Feb 2021 04:07:54 -0800 (PST) Subject: Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver. To: Andy Shevchenko , Jianxiong Gao Cc: Keith Busch , Erdem Aktas , Marc Orr , Christoph Hellwig , m.szyprowski@samsung.com, gregkh@linuxfoundation.org, Saravana Kannan , heikki.krogerus@linux.intel.com, rafael.j.wysocki@intel.com, dan.j.williams@intel.com, bgolaszewski@baylibre.com, jroedel@suse.de, iommu@lists.linux-foundation.org, Konrad Rzeszutek Wilk , axboe@fb.com, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210201183017.3339130-1-jxgao@google.com> <20210201183017.3339130-4-jxgao@google.com> <20210201205759.GA2128135@dhcp-10-100-145-180.wdc.com> From: Robin Murphy Message-ID: Date: Tue, 2 Feb 2021 12:07:52 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-02-02 11:21, Andy Shevchenko wrote: > On Mon, Feb 01, 2021 at 04:25:55PM -0800, Jianxiong Gao wrote: > >> + if (dma_set_min_align_mask(dev->dev, NVME_CTRL_PAGE_SIZE - 1)) > > Side note: we have DMA_BIT_MASK(), please use it. FWIW I'd actually disagree on that point. Conceptually, this is a very different thing from dev->{coherent_}dma_mask. It does not need to handle everything up to 2^64-1 correctly without overflow issues, and data alignments typically *are* defined in terms of sizes rather than numbers of bits. In fact, it might be neat to just have callers pass a size directly to a dma_set_min_align() interface which asserts that it is a power of two and stores it as a mask internally. Robin. > >> + dev_warn(dev->dev, "dma_set_min_align_mask failed to >> set offset\n"); >