Commit 096ee786 authored by Clement Leger's avatar Clement Leger Committed by Bjorn Andersson

remoteproc: Use size_t instead of int for rproc_mem_entry len

Now that rproc_da_to_va uses a size_t for length, use a size_t for len
field of rproc_mem_entry. Function used to create such structures now
takes a size_t instead of int to allow full size range to be handled.
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarClement Leger <cleger@kalray.eu>
Link: https://lore.kernel.org/r/20200302093902.27849-3-cleger@kalray.euSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 9ce3bf22
...@@ -319,8 +319,9 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) ...@@ -319,8 +319,9 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
struct device *dev = &rproc->dev; struct device *dev = &rproc->dev;
struct rproc_vring *rvring = &rvdev->vring[i]; struct rproc_vring *rvring = &rvdev->vring[i];
struct fw_rsc_vdev *rsc; struct fw_rsc_vdev *rsc;
int ret, size, notifyid; int ret, notifyid;
struct rproc_mem_entry *mem; struct rproc_mem_entry *mem;
size_t size;
/* actual size of vring (in bytes) */ /* actual size of vring (in bytes) */
size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));
...@@ -750,11 +751,12 @@ static int rproc_alloc_carveout(struct rproc *rproc, ...@@ -750,11 +751,12 @@ static int rproc_alloc_carveout(struct rproc *rproc,
va = dma_alloc_coherent(dev->parent, mem->len, &dma, GFP_KERNEL); va = dma_alloc_coherent(dev->parent, mem->len, &dma, GFP_KERNEL);
if (!va) { if (!va) {
dev_err(dev->parent, dev_err(dev->parent,
"failed to allocate dma memory: len 0x%x\n", mem->len); "failed to allocate dma memory: len 0x%zx\n",
mem->len);
return -ENOMEM; return -ENOMEM;
} }
dev_dbg(dev, "carveout va %pK, dma %pad, len 0x%x\n", dev_dbg(dev, "carveout va %pK, dma %pad, len 0x%zx\n",
va, &dma, mem->len); va, &dma, mem->len);
if (mem->da != FW_RSC_ADDR_ANY && !rproc->domain) { if (mem->da != FW_RSC_ADDR_ANY && !rproc->domain) {
...@@ -962,7 +964,7 @@ EXPORT_SYMBOL(rproc_add_carveout); ...@@ -962,7 +964,7 @@ EXPORT_SYMBOL(rproc_add_carveout);
*/ */
struct rproc_mem_entry * struct rproc_mem_entry *
rproc_mem_entry_init(struct device *dev, rproc_mem_entry_init(struct device *dev,
void *va, dma_addr_t dma, int len, u32 da, void *va, dma_addr_t dma, size_t len, u32 da,
int (*alloc)(struct rproc *, struct rproc_mem_entry *), int (*alloc)(struct rproc *, struct rproc_mem_entry *),
int (*release)(struct rproc *, struct rproc_mem_entry *), int (*release)(struct rproc *, struct rproc_mem_entry *),
const char *name, ...) const char *name, ...)
...@@ -1004,7 +1006,7 @@ EXPORT_SYMBOL(rproc_mem_entry_init); ...@@ -1004,7 +1006,7 @@ EXPORT_SYMBOL(rproc_mem_entry_init);
* provided by client. * provided by client.
*/ */
struct rproc_mem_entry * struct rproc_mem_entry *
rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len,
u32 da, const char *name, ...) u32 da, const char *name, ...)
{ {
struct rproc_mem_entry *mem; struct rproc_mem_entry *mem;
...@@ -1275,7 +1277,7 @@ static void rproc_resource_cleanup(struct rproc *rproc) ...@@ -1275,7 +1277,7 @@ static void rproc_resource_cleanup(struct rproc *rproc)
unmapped = iommu_unmap(rproc->domain, entry->da, entry->len); unmapped = iommu_unmap(rproc->domain, entry->da, entry->len);
if (unmapped != entry->len) { if (unmapped != entry->len) {
/* nothing much to do besides complaining */ /* nothing much to do besides complaining */
dev_err(dev, "failed to unmap %u/%zu\n", entry->len, dev_err(dev, "failed to unmap %zx/%zu\n", entry->len,
unmapped); unmapped);
} }
......
...@@ -293,7 +293,7 @@ static int rproc_carveouts_show(struct seq_file *seq, void *p) ...@@ -293,7 +293,7 @@ static int rproc_carveouts_show(struct seq_file *seq, void *p)
seq_printf(seq, "\tVirtual address: %pK\n", carveout->va); seq_printf(seq, "\tVirtual address: %pK\n", carveout->va);
seq_printf(seq, "\tDMA address: %pad\n", &carveout->dma); seq_printf(seq, "\tDMA address: %pad\n", &carveout->dma);
seq_printf(seq, "\tDevice address: 0x%x\n", carveout->da); seq_printf(seq, "\tDevice address: 0x%x\n", carveout->da);
seq_printf(seq, "\tLength: 0x%x Bytes\n\n", carveout->len); seq_printf(seq, "\tLength: 0x%zx Bytes\n\n", carveout->len);
} }
return 0; return 0;
......
...@@ -329,7 +329,7 @@ struct rproc; ...@@ -329,7 +329,7 @@ struct rproc;
struct rproc_mem_entry { struct rproc_mem_entry {
void *va; void *va;
dma_addr_t dma; dma_addr_t dma;
int len; size_t len;
u32 da; u32 da;
void *priv; void *priv;
char name[32]; char name[32];
...@@ -599,13 +599,13 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem); ...@@ -599,13 +599,13 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem);
struct rproc_mem_entry * struct rproc_mem_entry *
rproc_mem_entry_init(struct device *dev, rproc_mem_entry_init(struct device *dev,
void *va, dma_addr_t dma, int len, u32 da, void *va, dma_addr_t dma, size_t len, u32 da,
int (*alloc)(struct rproc *, struct rproc_mem_entry *), int (*alloc)(struct rproc *, struct rproc_mem_entry *),
int (*release)(struct rproc *, struct rproc_mem_entry *), int (*release)(struct rproc *, struct rproc_mem_entry *),
const char *name, ...); const char *name, ...);
struct rproc_mem_entry * struct rproc_mem_entry *
rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len,
u32 da, const char *name, ...); u32 da, const char *name, ...);
int rproc_boot(struct rproc *rproc); int rproc_boot(struct rproc *rproc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment