dma-mapping fixes for Linux 7.1
Three more fixes for the DMA-mapping code, related to PCI P2PDMA, DMA debug and DMA link ranges API (Li RongQing and Jason Gunthorpe). -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSrngzkoBtlA8uaaJ+Jp1EFxbsSRAUCaisf2gAKCRCJp1EFxbsS RASLAP953EuMof1qqGoMSNpDMIYNO0392Tdqyiq+nm1BwnLWfgEA/Q0m9yVtxbR7 zP/dxo+H95OforpTNJYdEWnXOBaAbwM= =o0ql -----END PGP SIGNATURE----- Merge tag 'dma-mapping-7.1-2026-06-11' of git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux Pull dma-mapping fix from Marek Szyprowski: "Three more fixes for the DMA-mapping code, related to PCI P2PDMA, DMA debug and DMA link ranges API (Li RongQing and Jason Gunthorpe)" * tag 'dma-mapping-7.1-2026-06-11' of git://git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux: iommu/dma: Do not try to iommu_map a 0 length region in swiotlb dma-debug: fix physical address retrieval in debug_dma_sync_sg_for_device dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments
This commit is contained in:
commit
f51cae6603
3 changed files with 15 additions and 8 deletions
|
|
@ -1918,12 +1918,18 @@ static int iommu_dma_iova_link_swiotlb(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* After removing the partial head and tail, there may be no aligned
|
||||
* middle left to map. The tail still gets bounced below.
|
||||
*/
|
||||
size -= iova_end_pad;
|
||||
error = __dma_iova_link(dev, addr + mapped, phys + mapped, size, dir,
|
||||
attrs);
|
||||
if (error)
|
||||
goto out_unmap;
|
||||
mapped += size;
|
||||
if (size) {
|
||||
error = __dma_iova_link(dev, addr + mapped, phys + mapped,
|
||||
size, dir, attrs);
|
||||
if (error)
|
||||
goto out_unmap;
|
||||
mapped += size;
|
||||
}
|
||||
|
||||
if (iova_end_pad) {
|
||||
error = iommu_dma_iova_bounce_and_link(dev, addr + mapped,
|
||||
|
|
@ -1936,7 +1942,8 @@ static int iommu_dma_iova_link_swiotlb(struct device *dev,
|
|||
return 0;
|
||||
|
||||
out_unmap:
|
||||
dma_iova_unlink(dev, state, 0, mapped, dir, attrs);
|
||||
if (mapped)
|
||||
dma_iova_unlink(dev, state, offset, mapped, dir, attrs);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1556,7 +1556,7 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
|
|||
struct dma_debug_entry ref = {
|
||||
.type = dma_debug_sg,
|
||||
.dev = dev,
|
||||
.paddr = sg_phys(sg),
|
||||
.paddr = sg_phys(s),
|
||||
.dev_addr = sg_dma_address(s),
|
||||
.size = sg_dma_len(s),
|
||||
.direction = direction,
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
|
|||
* must be mapped with CPU physical address and not PCI
|
||||
* bus addresses.
|
||||
*/
|
||||
break;
|
||||
fallthrough;
|
||||
case PCI_P2PDMA_MAP_NONE:
|
||||
need_sync = true;
|
||||
sg->dma_address = dma_direct_map_phys(dev, sg_phys(sg),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue