ipa: Fix system header adding size check
In case a new header is intended to be local, but there is no space in the SRAM, it is reassigned to be system, but then the DDR buffer size is not checked. Fixing this by looping the size check twice. Change-Id: Ie74346e191b54376870a744de03568720ac7f102 Signed-off-by: Ilia Lin <quic_ilial@quicinc.com>
This commit is contained in:

gecommit door
Gerrit - the friendly Code Review server

bovenliggende
e17cac37d5
commit
8a04c9e398
@@ -609,13 +609,22 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr, bool user,
|
||||
mem_size = entry->is_lcl ? IPA_MEM_PART(apps_hdr_size) : IPA_MEM_PART(apps_hdr_size_ddr);
|
||||
|
||||
if (list_empty(&htbl->head_free_offset_list[bin])) {
|
||||
/* if header does not fit to table, place it in DDR */
|
||||
if (htbl->end + ipa_hdr_bin_sz[bin] > mem_size) {
|
||||
/*
|
||||
* In case of a local header entry,
|
||||
* first iteration will check against SRAM partition space,
|
||||
* and the second iteration will check against DDR partition space.
|
||||
* In case of a system header entry, the loop will iterate only once,
|
||||
* and check against DDR partition space.
|
||||
*/
|
||||
while (htbl->end + ipa_hdr_bin_sz[bin] > mem_size) {
|
||||
if (entry->is_lcl) {
|
||||
/* if header does not fit to SRAM table, place it in DDR */
|
||||
htbl = &ipa3_ctx->hdr_tbl[HDR_TBL_SYS];
|
||||
mem_size = IPA_MEM_PART(apps_hdr_size_ddr);
|
||||
entry->is_lcl = false;
|
||||
} else {
|
||||
/* if the entry is intended to be in DDR,
|
||||
and there is no space -> error */
|
||||
IPAERR("No space in DDR header buffer! Requested: %d Left: %d\n",
|
||||
ipa_hdr_bin_sz[bin], mem_size - htbl->end);
|
||||
goto bad_hdr_len;
|
||||
|
Verwijs in nieuw issue
Block a user