msm: ipa3: Fix to save sgt table info in proper context

Sg table tables are not contiguous page due to this while copying
total sg table it failing. To avoid this copying the each sg
table individually

Change-Id: I08dfceaaee674ab642126c42d6978af5749d9909
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
This commit is contained in:
Ashok Vuyyuru
2021-05-17 15:44:17 +05:30
parent 089976fc29
commit bc67a6408e

View File

@@ -418,6 +418,8 @@ int ipa_smmu_store_sgt(struct sg_table **out_ch_ptr,
struct sg_table *in_sgt_ptr) struct sg_table *in_sgt_ptr)
{ {
unsigned int nents; unsigned int nents;
int i;
struct scatterlist *in_sg, *out_sg;
if (in_sgt_ptr != NULL) { if (in_sgt_ptr != NULL) {
*out_ch_ptr = kzalloc(sizeof(struct sg_table), GFP_KERNEL); *out_ch_ptr = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
@@ -435,8 +437,12 @@ int ipa_smmu_store_sgt(struct sg_table **out_ch_ptr,
return -ENOMEM; return -ENOMEM;
} }
memcpy((*out_ch_ptr)->sgl, in_sgt_ptr->sgl, out_sg = (*out_ch_ptr)->sgl;
nents*sizeof((*out_ch_ptr)->sgl)); for_each_sg(in_sgt_ptr->sgl, in_sg, in_sgt_ptr->nents, i) {
memcpy(out_sg, in_sg, sizeof(struct scatterlist));
out_sg++;
}
(*out_ch_ptr)->nents = nents; (*out_ch_ptr)->nents = nents;
(*out_ch_ptr)->orig_nents = in_sgt_ptr->orig_nents; (*out_ch_ptr)->orig_nents = in_sgt_ptr->orig_nents;
} }