diff options
| author | Mark Brown <broonie@kernel.org> | 2026-10-30 11:00:29 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-30 11:00:29 +0000 |
| commit | 63931564c77108f1350ed2537b2ef0b8d9f79cc3 (patch) | |
| tree | d704791d58fff4610b45d2da8ff050f4fcbc7618 /drivers/dma-buf | |
| parent | f7e88613fdcbef305e9f46ccd22c362d733bb177 (diff) | |
| parent | 6c6200ffebf9766fd5d9293002298ea371c261c1 (diff) | |
| download | linux-next-pending-fixes.tar.gz linux-next-pending-fixes.zip | |
Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.gitpending-fixes
# Conflicts:
# drivers/gpu/drm/drm_panic.c
Diffstat (limited to 'drivers/dma-buf')
| -rw-r--r-- | drivers/dma-buf/dma-buf-mapping.c | 8 | ||||
| -rw-r--r-- | drivers/dma-buf/dma-buf.c | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/dma-buf/dma-buf-mapping.c b/drivers/dma-buf/dma-buf-mapping.c index 833be519e1e6..5167cda7ea21 100644 --- a/drivers/dma-buf/dma-buf-mapping.c +++ b/drivers/dma-buf/dma-buf-mapping.c @@ -111,12 +111,12 @@ struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, size_t i; int ret; - dma_resv_assert_held(attach->dmabuf->resv); - if (WARN_ON(!attach || !attach->dmabuf || !provider)) /* This function is supposed to work on MMIO memory only */ return ERR_PTR(-EINVAL); + dma_resv_assert_held(attach->dmabuf->resv); + dma = kzalloc_obj(*dma); if (!dma) return ERR_PTR(-ENOMEM); @@ -156,7 +156,7 @@ struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, phys_vec[i].paddr); } else if (dma_use_iova(dma->state)) { ret = dma_iova_link(attach->dev, dma->state, - phys_vec[i].paddr, 0, + phys_vec[i].paddr, mapped_len, phys_vec[i].len, dir, DMA_ATTR_MMIO); if (ret) @@ -251,6 +251,8 @@ void dma_buf_free_sgt(struct dma_buf_attachment *attach, struct sg_table *sgt, sg_dma_len(sgl), dir, DMA_ATTR_MMIO); } + /* Restore the allocation count cleared for the DMA-only table. */ + sgt->orig_nents = sgt->nents; sg_free_table(sgt); kfree(dma->state); kfree(dma); diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 36cdc342627e..0dac2c4fb968 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -904,6 +904,10 @@ static int dma_buf_wrap_sg_table(struct sg_table **sg_table) sg_assign_page(to_sg, NULL); sg_dma_address(to_sg) = sg_dma_address(from_sg); sg_dma_len(to_sg) = sg_dma_len(from_sg); +#ifdef CONFIG_NEED_SG_DMA_FLAGS + /* the flags describe the DMA side, e.g. SG_DMA_BUS_ADDRESS */ + to_sg->dma_flags = from_sg->dma_flags; +#endif to_sg = sg_next(to_sg); } |
