forked from luck/tmp_suning_uos_patched
dma-mapping fixes for 5.8
- add a warning when the atomic pool is depleted (David Rientjes) - protect the parameters of the new scatterlist helper macros (Marek Szyprowski ) -----BEGIN PGP SIGNATURE----- iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAl8IjBILHGhjaEBsc3Qu ZGUACgkQD55TZVIEUYN10RAAjCGeb2ImNmGHgqZEbJ5KM99g/gVeGJO2aUOLQWCx qr3Jx0PX6TaGi/tg4OMJFwA8oErHh6bZO1OWVp7PShmeEHRdRp+FPmcb0PzRM1pO gNxgouJIj+B47enkFwRjLpiST5YVoP90Sn61I8Vr9hiC88TaLho0Kj2hkvTcKRln NCahkT9NTQpoC1iFR+lMje1yodEzWum3+aAEmjIaebeMJor1v8RRGkYXJASdD1V2 whchfZCWM6Jhr9PUAL3NnTbQXccI7qOkCCsxssW652SysIN6dV8XmBmoH/VUC5QE soScl93T0EZvBdUreEvKSjVO3BOCRuemuzQ9myFk4c/olKGqQO675G1sCs9RIawz UEAtWEWYC/CluKvzjJuJl2pGmfNRuazsylLA6WDQGqQoe8uJ/9qKKpCr9jRn3shl dUccyFQWrmXrh76qXPvB05D0/qb4JNVhyXYLiD8DhzR3DlH1d5z52TWDT9g/J84Q usq69gwZq65MZYMHWRlRRXYdEuvQxgEZvl2ecYA/ZaW1wh6XYGBCQI5CtG5E2sOP 8THs5E+u1PQaJWqdIR57xCuNxpWS+r6nv0N7z4vIQtwVkXPO3lS7aVNClIOY1u5/ m7SEeJ4ZBtVZsA4nQbG3sxAiA1GT8nm5JugwfOIgmMyxrpRbNWj8IrIe49Ckbhqa YZQ= =KI5i -----END PGP SIGNATURE----- Merge tag 'dma-mapping-5.8-5' of git://git.infradead.org/users/hch/dma-mapping Pull dma-mapping fixes from Christoph Hellwig: - add a warning when the atomic pool is depleted (David Rientjes) - protect the parameters of the new scatterlist helper macros (Marek Szyprowski ) * tag 'dma-mapping-5.8-5' of git://git.infradead.org/users/hch/dma-mapping: scatterlist: protect parameters of the sg_table related macros dma-mapping: warn when coherent pool is depleted
This commit is contained in:
commit
1bfde03742
|
@ -155,7 +155,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
|
|||
* Loop over each sg element in the given sg_table object.
|
||||
*/
|
||||
#define for_each_sgtable_sg(sgt, sg, i) \
|
||||
for_each_sg(sgt->sgl, sg, sgt->orig_nents, i)
|
||||
for_each_sg((sgt)->sgl, sg, (sgt)->orig_nents, i)
|
||||
|
||||
/*
|
||||
* Loop over each sg element in the given *DMA mapped* sg_table object.
|
||||
|
@ -163,7 +163,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
|
|||
* of the each element.
|
||||
*/
|
||||
#define for_each_sgtable_dma_sg(sgt, sg, i) \
|
||||
for_each_sg(sgt->sgl, sg, sgt->nents, i)
|
||||
for_each_sg((sgt)->sgl, sg, (sgt)->nents, i)
|
||||
|
||||
/**
|
||||
* sg_chain - Chain two sglists together
|
||||
|
@ -451,7 +451,7 @@ sg_page_iter_dma_address(struct sg_dma_page_iter *dma_iter)
|
|||
* See also for_each_sg_page(). In each loop it operates on PAGE_SIZE unit.
|
||||
*/
|
||||
#define for_each_sgtable_page(sgt, piter, pgoffset) \
|
||||
for_each_sg_page(sgt->sgl, piter, sgt->orig_nents, pgoffset)
|
||||
for_each_sg_page((sgt)->sgl, piter, (sgt)->orig_nents, pgoffset)
|
||||
|
||||
/**
|
||||
* for_each_sgtable_dma_page - iterate over the DMA mapped sg_table object
|
||||
|
@ -465,7 +465,7 @@ sg_page_iter_dma_address(struct sg_dma_page_iter *dma_iter)
|
|||
* unit.
|
||||
*/
|
||||
#define for_each_sgtable_dma_page(sgt, dma_iter, pgoffset) \
|
||||
for_each_sg_dma_page(sgt->sgl, dma_iter, sgt->nents, pgoffset)
|
||||
for_each_sg_dma_page((sgt)->sgl, dma_iter, (sgt)->nents, pgoffset)
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -239,12 +239,16 @@ void *dma_alloc_from_pool(struct device *dev, size_t size,
|
|||
}
|
||||
|
||||
val = gen_pool_alloc(pool, size);
|
||||
if (val) {
|
||||
if (likely(val)) {
|
||||
phys_addr_t phys = gen_pool_virt_to_phys(pool, val);
|
||||
|
||||
*ret_page = pfn_to_page(__phys_to_pfn(phys));
|
||||
ptr = (void *)val;
|
||||
memset(ptr, 0, size);
|
||||
} else {
|
||||
WARN_ONCE(1, "DMA coherent pool depleted, increase size "
|
||||
"(recommended min coherent_pool=%zuK)\n",
|
||||
gen_pool_size(pool) >> 9);
|
||||
}
|
||||
if (gen_pool_avail(pool) < atomic_pool_size)
|
||||
schedule_work(&atomic_pool_work);
|
||||
|
|
Loading…
Reference in New Issue
Block a user