From: Wang Lu <wanglu@dapustor.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Wang Lu <wanglu@dapustor.com>
Subject: [PATCH] PCI/P2PDMA: fix the wrong dma address calculation when map sg
Date: Thu, 9 Sep 2021 11:25:28 +0800 [thread overview]
Message-ID: <20210909032528.24517-1-wanglu@dapustor.com> (raw)
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 <wanglu@dapustor.com>
---
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
next reply other threads:[~2021-09-09 3:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 3:25 Wang Lu [this message]
2021-09-09 16:51 ` [PATCH] PCI/P2PDMA: fix the wrong dma address calculation when map sg Logan Gunthorpe
2021-09-09 17:28 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210909032528.24517-1-wanglu@dapustor.com \
--to=wanglu@dapustor.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).