MLK-23754-19 remoteproc: add rproc_memcpy
Some platforms has limitation using memcpy to/from memory that will be used by remote processor. To i.MX8 Chips, TCM memory not support 64bit access, and non 64bit aligned access will cause issue. So introduce rproc_memory to let driver could have their own memcpy variants. Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
357a08460c
commit
ad144fec7a
|
@ -71,6 +71,23 @@ static const char *rproc_crash_to_string(enum rproc_crash_type type)
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rproc_memcpy() - memcpy verison for remoteproc usage
|
||||||
|
* @flags:
|
||||||
|
* - 0 means to DA
|
||||||
|
* - 1 means from DA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void *rproc_memcpy(struct rproc *rproc, void *dest,
|
||||||
|
const void *src, size_t count, int flags)
|
||||||
|
{
|
||||||
|
if (rproc->ops->memcpy)
|
||||||
|
return rproc->ops->memcpy(rproc, dest, src, count, flags);
|
||||||
|
|
||||||
|
return memcpy(dest, src, count);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(rproc_memcpy);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the IOMMU fault handler we register with the IOMMU API
|
* This is the IOMMU fault handler we register with the IOMMU API
|
||||||
* (when relevant; not all remote processors access memory through
|
* (when relevant; not all remote processors access memory through
|
||||||
|
@ -1642,7 +1659,8 @@ static void rproc_coredump(struct rproc *rproc)
|
||||||
&segment->da, segment->size);
|
&segment->da, segment->size);
|
||||||
memset(data + offset, 0xff, segment->size);
|
memset(data + offset, 0xff, segment->size);
|
||||||
} else {
|
} else {
|
||||||
memcpy(data + offset, ptr, segment->size);
|
rproc_memcpy(rproc, data + offset, ptr,
|
||||||
|
segment->size, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,8 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw)
|
||||||
|
|
||||||
/* put the segment where the remote processor expects it */
|
/* put the segment where the remote processor expects it */
|
||||||
if (phdr->p_filesz)
|
if (phdr->p_filesz)
|
||||||
memcpy(ptr, elf_data + phdr->p_offset, filesz);
|
rproc_memcpy(rproc, ptr, elf_data + phdr->p_offset,
|
||||||
|
filesz, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ void rproc_exit_sysfs(void);
|
||||||
void rproc_free_vring(struct rproc_vring *rvring);
|
void rproc_free_vring(struct rproc_vring *rvring);
|
||||||
int rproc_alloc_vring(struct rproc_vdev *rvdev, int i);
|
int rproc_alloc_vring(struct rproc_vdev *rvdev, int i);
|
||||||
|
|
||||||
|
void *rproc_memcpy(struct rproc *rproc, void *dest, const void *src,
|
||||||
|
size_t count, int);
|
||||||
void *rproc_da_to_va(struct rproc *rproc, u64 da, int len);
|
void *rproc_da_to_va(struct rproc *rproc, u64 da, int len);
|
||||||
phys_addr_t rproc_va_to_pa(void *cpu_addr);
|
phys_addr_t rproc_va_to_pa(void *cpu_addr);
|
||||||
int rproc_trigger_recovery(struct rproc *rproc);
|
int rproc_trigger_recovery(struct rproc *rproc);
|
||||||
|
|
|
@ -383,6 +383,8 @@ struct rproc_ops {
|
||||||
int (*load)(struct rproc *rproc, const struct firmware *fw);
|
int (*load)(struct rproc *rproc, const struct firmware *fw);
|
||||||
int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
|
int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
|
||||||
u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
|
u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
|
||||||
|
void * (*memcpy)(struct rproc *rproc, void *dest,
|
||||||
|
const void *src, size_t count, int flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue