Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp726422pxb; Thu, 9 Sep 2021 10:32:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPdgSPFd4iyjZG4nLZiqKdhy2wpvn6RvQQHkaBwnBF9X7E+Kz7K61MbBtfLQUiN4Goul+Y X-Received: by 2002:a17:906:43d2:: with SMTP id j18mr4546790ejn.363.1631208735441; Thu, 09 Sep 2021 10:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631208735; cv=none; d=google.com; s=arc-20160816; b=tqwZTtsZMhVSfTocEMiT+0d0VP6ZqBkztSkc2/XobOQkkiPQDBT/SDu0UHiYeV47Sb meYjABnXRGUn3GtSeTOLQOLUWHUDHDUFLevU77oC7ADgoVOfY1VVOZbDkvN4rqD1FezZ BDSJqgLxil+Qw78b4jD/jglik2/IxRfEPH/+ciiDPCVIE8KdF3CPSE7hojxPfSlIpfKW NKFmq3wbkGgK0RaxAXayC6qqCnHcqF5+4dI7zumnXCTI1Ok2N08jg1rH8JmScB6rznG5 VvxVfYOj4Onvycv/uqD1OMzx9N5NcDJEAyoCLwb97PubZirEHxQGcx8KL45zJtfgPYp9 IM5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=7uwhPpl0wSHNyhyhbOE7ZcJgxhCMzXR5Yn0Z20GpEgA=; b=uXw6UJbDztdDuOfH5Q+3ka0Zl6yUtlQ7e+h5KQKJ1p9ch/swgg4yUSylHT2L6l9CJd 6bI4NzVaOtNcqQxIFBzA/uKogGx0hF/yD9GVJANPM3ZGf5uTHHm/DQYJay5UokZ2TzB4 DRUp199utIs/DCc8FztvAY1ZhQZfTJzvehv25BRlAoeizYQ6x8F2/SZvT0yNJ/K2Gf8l Rh8UFnTaGExb/JzBZKa+reNEu7SajfZ3CG+HM9DwyyfjHl1DyTiKHp7lv9nTfpN8ND+8 eCtFfMlDyGbvFuEU2mDAduHbmyaJrpB1M4S9RBPYFJoZ8VOKk8ea5be1u3JbC4h9lYcB 5uMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nui7oIhX; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si2519672eds.540.2021.09.09.10.31.50; Thu, 09 Sep 2021 10:32:15 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=Nui7oIhX; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241230AbhIIRaE (ORCPT + 99 others); Thu, 9 Sep 2021 13:30:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:48898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbhIIRaC (ORCPT ); Thu, 9 Sep 2021 13:30:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E05E361100; Thu, 9 Sep 2021 17:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631208533; bh=Umswx7+uonqXD36E95PpN0EL1S7smPEf/QAyAdE3hqU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Nui7oIhXJ+N/OsBXgzWi/sXccwelVq4VXDEKB5HeBUtJEnLK6n6Au580d63TXW51J JAbdt6Swi1PO9pjMWFNnc2YG+Wr/Dgpa0pkvc3cKA18aa4NeDop+CQ3ybfzR0J1htv +cIUisrmLfzaUBPLbg2yMuBK0xtsftPz7cSC/cUUK+vfW9M3d+XnpPhjcWog24BDeT Rru6aOPYL/x5jODoZ+wyXa9dd2cdM0boDFx48/ReCLCPuZYIYAFxFXGe5FGvnVAqXt s2w6r7lMh4rwmxAFuJVwwZiYyNyjmLQ38fBabqg4OzLj/4cGU18yQPnw/SKnPT7RB0 ipyRIdU4c47Hg== Date: Thu, 9 Sep 2021 12:28:51 -0500 From: Bjorn Helgaas To: Wang Lu Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Logan Gunthorpe Subject: Re: [PATCH] PCI/P2PDMA: fix the wrong dma address calculation when map sg Message-ID: <20210909172851.GA993207@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210909032528.24517-1-wanglu@dapustor.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 09, 2021 at 11:25:28AM +0800, Wang Lu wrote: > The bus offset is bus address - physical address, > so the calculation in __pci_p2pdma_map_sg should be: > bus address = physical address + bus offset. > > Signed-off-by: Wang Lu Applied with Logan's reviewed-by to pci/p2pdma for v5.16, thanks! I fixed the subject line and commit log for you to follow the usual conventions. > --- > drivers/pci/p2pdma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c > index 50cdde3e9a8b..327882638b30 100644 > --- a/drivers/pci/p2pdma.c > +++ b/drivers/pci/p2pdma.c > @@ -874,7 +874,7 @@ static int __pci_p2pdma_map_sg(struct pci_p2pdma_pagemap *p2p_pgmap, > int i; > > for_each_sg(sg, s, nents, i) { > - s->dma_address = sg_phys(s) - p2p_pgmap->bus_offset; > + s->dma_address = sg_phys(s) + p2p_pgmap->bus_offset; > sg_dma_len(s) = s->length; > } > > -- > 2.17.1 > > >