summaryrefslogtreecommitdiff
path: root/drivers/pci/p2pdma.c
diff options
context:
space:
mode:
authorWang Lu <wanglu@dapustor.com>2021-09-09 06:25:28 +0300
committerBjorn Helgaas <bhelgaas@google.com>2021-09-20 22:46:02 +0300
commit3a19407913e8e43d6b799a59bc0f6cae889b5446 (patch)
tree8e5776fb87a881e1671a396b4d102f566089e127 /drivers/pci/p2pdma.c
parente4e737bb5c170df6135a127739a9e6148ee3da82 (diff)
downloadlinux-3a19407913e8e43d6b799a59bc0f6cae889b5446.tar.xz
PCI/P2PDMA: Apply bus offset correctly in DMA address calculation
The bus offset is bus address - physical address, so the calculation in __pci_p2pdma_map_sg should be: bus address = physical address + bus offset. Correct the dma_address computation in __pci_p2pdma_map_sg(). Link: https://lore.kernel.org/r/20210909032528.24517-1-wanglu@dapustor.com Signed-off-by: Wang Lu <wanglu@dapustor.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Diffstat (limited to 'drivers/pci/p2pdma.c')
-rw-r--r--drivers/pci/p2pdma.c2
1 files changed, 1 insertions, 1 deletions
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;
}