Skip to content

Commit 4dd27f5

Browse files
committed
soc: qcom: mdt-loader: Return relocation base
In order to implement support for grabbing core dumps in remoteproc it's necessary to know the relocated base of the image, as the offsets from the virtual memory base might not be based on the physical address. Return the adjusted physical base address to the caller. Acked-by: Andy Gross <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
1 parent c1d35c1 commit 4dd27f5

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

drivers/gpu/drm/msm/adreno/a5xx_gpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname)
8989
*/
9090
if (to_adreno_gpu(gpu)->fwloc == FW_LOCATION_LEGACY) {
9191
ret = qcom_mdt_load(dev, fw, fwname, GPU_PAS_ID,
92-
mem_region, mem_phys, mem_size);
92+
mem_region, mem_phys, mem_size, NULL);
9393
} else {
9494
char newname[strlen("qcom/") + strlen(fwname) + 1];
9595

9696
sprintf(newname, "qcom/%s", fwname);
9797

9898
ret = qcom_mdt_load(dev, fw, newname, GPU_PAS_ID,
99-
mem_region, mem_phys, mem_size);
99+
mem_region, mem_phys, mem_size, NULL);
100100
}
101101
if (ret)
102102
goto out;

drivers/media/platform/qcom/venus/firmware.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int venus_boot(struct device *dev, const char *fwname)
7676
}
7777

7878
ret = qcom_mdt_load(dev, mdt, fwname, VENUS_PAS_ID, mem_va, mem_phys,
79-
mem_size);
79+
mem_size, NULL);
8080

8181
release_firmware(mdt);
8282

drivers/remoteproc/qcom_adsp_pil.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
8282
struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
8383

8484
return qcom_mdt_load(adsp->dev, fw, rproc->firmware, adsp->pas_id,
85-
adsp->mem_region, adsp->mem_phys, adsp->mem_size);
85+
adsp->mem_region, adsp->mem_phys, adsp->mem_size,
86+
&adsp->mem_reloc);
87+
8688
}
8789

8890
static int adsp_start(struct rproc *rproc)

drivers/remoteproc/qcom_wcnss.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
153153
struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv;
154154

155155
return qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID,
156-
wcnss->mem_region, wcnss->mem_phys, wcnss->mem_size);
156+
wcnss->mem_region, wcnss->mem_phys,
157+
wcnss->mem_size, &wcnss->mem_reloc);
157158
}
158159

159160
static void wcnss_indicate_nv_download(struct qcom_wcnss *wcnss)

drivers/soc/qcom/mdt_loader.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ EXPORT_SYMBOL_GPL(qcom_mdt_get_size);
8383
* @mem_region: allocated memory region to load firmware into
8484
* @mem_phys: physical address of allocated memory region
8585
* @mem_size: size of the allocated memory region
86+
* @reloc_base: adjusted physical address after relocation
8687
*
8788
* Returns 0 on success, negative errno otherwise.
8889
*/
8990
int qcom_mdt_load(struct device *dev, const struct firmware *fw,
9091
const char *firmware, int pas_id, void *mem_region,
91-
phys_addr_t mem_phys, size_t mem_size)
92+
phys_addr_t mem_phys, size_t mem_size,
93+
phys_addr_t *reloc_base)
9294
{
9395
const struct elf32_phdr *phdrs;
9496
const struct elf32_phdr *phdr;
@@ -192,6 +194,9 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
192194
memset(ptr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz);
193195
}
194196

197+
if (reloc_base)
198+
*reloc_base = mem_reloc;
199+
195200
out:
196201
kfree(fw_name);
197202

include/linux/soc/qcom/mdt_loader.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct firmware;
1414
ssize_t qcom_mdt_get_size(const struct firmware *fw);
1515
int qcom_mdt_load(struct device *dev, const struct firmware *fw,
1616
const char *fw_name, int pas_id, void *mem_region,
17-
phys_addr_t mem_phys, size_t mem_size);
17+
phys_addr_t mem_phys, size_t mem_size,
18+
phys_addr_t *reloc_base);
1819

1920
#endif

0 commit comments

Comments
 (0)