Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4072540pxb; Mon, 1 Feb 2021 11:38:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzl1Bbzix5OlUwQmyxxs1iqDBZEQJyNDd5uSFX4SKdlT6YBZ04QhoeAgKAUi1VkhiaTc9ki X-Received: by 2002:a17:906:9401:: with SMTP id q1mr19727754ejx.516.1612208302769; Mon, 01 Feb 2021 11:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612208302; cv=none; d=google.com; s=arc-20160816; b=kAU/3kVonvj6np20gE6K8Lx3asf1CzBopdHi0v0fx/3j2ANZ6vDp+NURtD0yq5la4p 4qXvIqO9T89Iwh8buiHUmwHbYbcnmHorNQ5URRHmatq9luITl09XONtq/NRY8H+izkSJ iiiJKKjqRYgRO7C8zOf2KdAkOc5NjWKyCJPMGJCM1eid9avFBVUKQ+ZnH9g1qlKREfjb OUx3j240cyVgQ/oMJIG+iNxzLz6+TjYy6pmxWjHxDLgAUiInMYJJoC6PPCiOf11B0kkO urL+rZlmKPt/96Ryox7EOktVpNv+skFufCv/VBeoqjiQDBUAxA34gTB8a129cFzSR1f2 i3vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JWBkNAaNFyDailoNLvfd01F/RWQlC5hp7A6f+h/cyqY=; b=FgAif6JkV51/Tqf5bmVRWfOmYJb1X2nMi66I+NVhS4xw5MIKW7gaYzrr2TQ12JrPjJ 9qalsX2JCpS2jVcrkz7UcmR0s3JUf/B9IhOh4UawUf0ieiSxYVbWcHLX0CGsHDy1D5sx nbW1dpX/iElecyXQPDLwUlr7B3g2JpGG+sx4vRJLSUMGKnvF71vUn6oqzvhfcOV0l5E0 ToPDgbGfEXySrAhY6wNjz1mYOnQmHKwLBUmnDXW6bOAr4BMj4ExIrRIwSKxDMBX3xkUi 8urLmYjL0O0ZJfIyGLeQYFKbF3NXkCCB4tmOhMppjsmfQ1MKM97O5pK01UKhX3zIJqdJ tluA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TZxvbVNi; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si1714345ejc.262.2021.02.01.11.37.57; Mon, 01 Feb 2021 11:38:22 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=TZxvbVNi; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230479AbhBATgs (ORCPT + 99 others); Mon, 1 Feb 2021 14:36:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbhBATgp (ORCPT ); Mon, 1 Feb 2021 14:36:45 -0500 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67BB2C061573 for ; Mon, 1 Feb 2021 11:36:05 -0800 (PST) Received: by mail-ot1-x330.google.com with SMTP id 63so17513013oty.0 for ; Mon, 01 Feb 2021 11:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JWBkNAaNFyDailoNLvfd01F/RWQlC5hp7A6f+h/cyqY=; b=TZxvbVNiXKihvb482TRxj/6WLckWUH8R84HUFz+GyZcJj4bDdqokogc8XZdjFuz66J B5QIJRO4vCDoGUNuyOgOqgmW4qpUurcYdQlvQjwMAo1AQsqhPVzf3x57z1YVHxjLLjMw BBPPaSfpe8ATUSfRZboIsbLfkbp2hi++WS0OCvjShV6qCf3THh8G2i3/vW4NTkCUBy83 qtF4MRc/5EkX8POcuGFwClV2jvLeIQ/dCU/onWhEa3tZJ/1pr/lwn/AauK+RlpCaSDdu vD0tFxi8yEzu4n2K4AQ2p2GH3p6j7qrx3lQADHKCizJNfZatHNzTyRm4avKI55+xUqZn kkzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JWBkNAaNFyDailoNLvfd01F/RWQlC5hp7A6f+h/cyqY=; b=kf2HXPL5pSMvu0S3JNUowHoyU5lUg7J26A6QWJC0CPLvX988LshzAo3WBUcUWjdJCn JE/Wrgb1fSODBecSPTo/M6v0pmTqMlbPJSFow/jt3pzW6SDjUPWWtWylVg6H8DmPfPA+ F0XjhU5cZXsmsJQAGt8qSyq0FiSK0t824Bj8dSN1Z9V9R8JeL03BmQmnIwjEBgNd+wzS Uwc5/nIEIEzFNsaD9xu/WmDZmTkthXAFlmeJC1vvbRoPJErYeGLqU5wd0DJr0Q17BsZJ 73+KBxdiV5uD/UQureEdhxCOI+kG6TR6xbYchbivG1Ov/+S5cHraZhwGIucV9CYeOMQM yR/Q== X-Gm-Message-State: AOAM530Nl32amgtoZH4r0AUjbU+gWVSt/FjX/kkWG6EQPfT44oaZJnKO 9t/TrVv+/EIBQc0wFtvs2p0pywxPiyy2Br9y+s2Tfw== X-Received: by 2002:a9d:7d12:: with SMTP id v18mr12655165otn.205.1612208164558; Mon, 01 Feb 2021 11:36:04 -0800 (PST) MIME-Version: 1.0 References: <20210201183017.3339130-1-jxgao@google.com> <20210201183017.3339130-4-jxgao@google.com> In-Reply-To: From: Jianxiong Gao Date: Mon, 1 Feb 2021 11:35:52 -0800 Message-ID: Subject: Re: [PATCH V2 3/3] Adding device_dma_parameters->offset_preserve_mask to NVMe driver. To: Andy Shevchenko Cc: Erdem Aktas , Marc Orr , Christoph Hellwig , m.szyprowski@samsung.com, Robin Murphy , 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 , Keith Busch , axboe@fb.com, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 1, 2021 at 10:56 AM Andy Shevchenko wrote: > > 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? Yes you are correct, it should be else nr_mapped = dma_map_sg_attrs(dev->dev, iod->sg, iod->nents, rq_dma_dir(req), DMA_ATTR_NO_WARN); if (!nr_mapped) goto out_free_sg; + + 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; + } Thanks for pointing it out. > > -- > With Best Regards, > Andy Shevchenko > > -- Jianxiong Gao