Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4047237pxb; Mon, 1 Feb 2021 10:58:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzowfpIdSS7RLun4yHjoZnjYwt45wBSLteLcD6XUmxRFGo41wc7NG6E97Wp6hg21pi108iD X-Received: by 2002:a05:6402:26d3:: with SMTP id x19mr20242245edd.0.1612205927427; Mon, 01 Feb 2021 10:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612205927; cv=none; d=google.com; s=arc-20160816; b=JSKNe0olZH74yhtQH3xXhpfyxvK/zs593KgtazfyPW858F5UkZsfiTBlaWk+cOVxlr QvYWrGcO31k3D6HUKEkgE/MJ2qxOI7HCV8zeZQrL1O/DMV+D8JVpRr9BAF+m+7Y75PQi /tzzgEQjypGJ3taalBJx0c85RiHTIUa+f4joWmJNDJ0p7jl1OhJzLvU1JQQYR0rr4Isq QY8yAz4L5MKkyH6chqMKVG/8a2Flxl1W7flCFIkl3j7pIANRYUUlW5eNh7kVs+PFCxv8 8ZOexdvxurnyybE2nljocmcYr9LfUvDTg45iGTCUf2jXAUHte2cpl6lMoEehtfkQPkZG vnHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=PjZ6Kr5qG5vK3ZuNBRvGM/z0o/74Bw5EOy33r8ysmfc=; b=zbh/m6g50c2XEl5opNYgQxCm0MKhqOohChxUDB2wzOBw4eghxV69OW3uMc9qqS1zdv xEoJT11dL4kKKu06SdvBqgUw0sqJmRSLdrnmUtvDXYA+NWkhdL3aVdXKcPmkRkjiWh78 1uo2b4dLSE0g4X0lOgYNHdOfOrnKRCRGQIVMrkSDTaz6QN7A4ps4K2Lv2edrT6I8Kq/4 FTJgCQeprt8SZEpY1EbvtBgfdwMR72/yQlyijdy6scpzuas0Eu5QKEpsX4uXP4y4qHI0 9qjXRJgtjxpKWdUcHMRkMmGbLWM3vRZN0VZL/8N50N1MVLoSct0KE7cuJzcf6YdDYRds Di6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ke2si3143118ejc.619.2021.02.01.10.58.16; Mon, 01 Feb 2021 10:58:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232224AbhBAS5i (ORCPT + 99 others); Mon, 1 Feb 2021 13:57:38 -0500 Received: from mga02.intel.com ([134.134.136.20]:11279 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbhBAS5f (ORCPT ); Mon, 1 Feb 2021 13:57:35 -0500 IronPort-SDR: jq10xaR0xQKBUZoy5qhb2WCnTxEYfRw4LHXFfLqdwd6175v1LbGzrkFsurQaDk04PLcKplWekf x9vfjsP4TQXw== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="167840794" X-IronPort-AV: E=Sophos;i="5.79,393,1602572400"; d="scan'208";a="167840794" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 10:55:49 -0800 IronPort-SDR: bO/77yFnFXEOvVyCwMRy9yRPe9Z8Uz08vIlmz+yDqMAbErP+xmmIjp8vozdpxGVV29C+RLOqEn iFkP5v0/f/hQ== X-IronPort-AV: E=Sophos;i="5.79,393,1602572400"; d="scan'208";a="405865932" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 10:55:44 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1l6eMO-001Czv-JO; Mon, 01 Feb 2021 20:55:40 +0200 Date: Mon, 1 Feb 2021 20:55:40 +0200 From: Andy Shevchenko To: Jianxiong Gao Cc: erdemaktas@google.com, marcorr@google.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, gregkh@linuxfoundation.org, saravanak@google.com, 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.wilk@oracle.com, kbusch@kernel.org, axboe@fb.com, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver. Message-ID: References: <20210201183017.3339130-1-jxgao@google.com> <20210201183017.3339130-4-jxgao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201183017.3339130-4-jxgao@google.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 10:30:17AM -0800, Jianxiong Gao wrote: > NVMe driver relies on the address offset to function properly. > This patch adds the offset preserve mask to NVMe driver when mapping > via dma_map_sg_attrs and unmapping via nvme_unmap_sg. The mask > depends on the page size defined by CC.MPS register of NVMe > controller. ... > if (is_pci_p2pdma_page(sg_page(iod->sg))) > nr_mapped = pci_p2pdma_map_sg_attrs(dev->dev, iod->sg, > iod->nents, rq_dma_dir(req), DMA_ATTR_NO_WARN); > else > nr_mapped = dma_map_sg_attrs(dev->dev, iod->sg, iod->nents, > rq_dma_dir(req), DMA_ATTR_NO_WARN); > + > + offset_ret = dma_set_min_align_mask(dev->dev, 0); > + if (offset_ret) { > + dev_warn(dev->dev, "dma_set_min_align_mask failed to reset offset\n"); > + goto out_free_sg; > + } Seems like rebasing effect which makes empty line goes in the middle of some other group of code lines. > if (!nr_mapped) > goto out_free_sg; Perhaps it should be here? -- With Best Regards, Andy Shevchenko