soc: qcom: ramdump: Fix 'complete ramdump' collection

The PIL driver sets up the mappings for the segments' address
based on the size of the segments. However, for the case of
'complete ramdump' collection, the ramdump driver re-sizes the
segments, thus causing a mismatch in the mappings created by
PIL driver. Hence, fix this by only initializing the physical
address in the PIL driver and let the ramdump driver take
care of the re-sizing and mapping.

Change-Id: Ia07eae2b1873f1fc9d3e9a1c8089f14ffd37dcd3
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
This commit is contained in:
Raghavendra Rao Ananta 2020-08-21 21:30:18 -07:00
parent aec59fab94
commit 21eaad120e
2 changed files with 4 additions and 24 deletions

View File

@ -498,10 +498,7 @@ int pil_do_ramdump(struct pil_desc *desc,
s = ramdump_segs;
list_for_each_entry(seg, &priv->segs, list) {
s->v_address = ioremap_wc(seg->paddr, seg->sz);
if (!s->v_address)
goto ioremap_err;
s->address = seg->paddr;
s->size = seg->sz;
s++;
map_cnt++;
@ -509,12 +506,6 @@ int pil_do_ramdump(struct pil_desc *desc,
ret = do_elf_ramdump(ramdump_dev, ramdump_segs, count);
s = ramdump_segs;
list_for_each_entry(seg, &priv->segs, list) {
iounmap(s->v_address);
s++;
}
kfree(ramdump_segs);
if (ret)
@ -526,17 +517,6 @@ int pil_do_ramdump(struct pil_desc *desc,
(priv->region_end - priv->region_start));
return ret;
ioremap_err:
/* Undo all the previous mappings */
s = ramdump_segs;
while (map_cnt--) {
iounmap(s->v_address);
s++;
}
kfree(ramdump_segs);
return -ENOMEM;
}
EXPORT_SYMBOL(pil_do_ramdump);

View File

@ -213,9 +213,7 @@ static ssize_t ramdump_read(struct file *filep, char __user *buf, size_t count,
copy_size = min_t(size_t, count, (size_t)MAX_IOREMAP_SIZE);
copy_size = min_t(unsigned long, (unsigned long)copy_size, data_left);
device_mem = (void __iomem *) vaddr;
origdevice_mem = device_mem;
device_mem = vaddr ? : ioremap_wc(addr, copy_size);
if (device_mem == NULL) {
pr_err("Ramdump(%s): Virtual addr is NULL:addr %lx, size %zd\n",
rd_dev->name, addr, copy_size);
@ -224,6 +222,8 @@ static ssize_t ramdump_read(struct file *filep, char __user *buf, size_t count,
goto ramdump_done;
}
origdevice_mem = device_mem;
alignbuf = kzalloc(copy_size, GFP_KERNEL);
if (!alignbuf) {
rd_dev->ramdump_status = -1;