Browse Source

qcacmn: assert on IPA SMMU map/unmap failures

The status of the IPA SMMU MAP/UNMAP operation is stored in the
result field of the mem info structure that is passed to the
IPA driver. Currently, this field is not checked for MAP/UNMAP
failures; when IPA HW accesses such a buffer for which
mapping is not correctly setup, it will lead to SMMU faults.
Check the result and assert(on failures) to avoid such issues.

Also, check if the physical address passed to the IPA driver is
non zero value.

Change-Id: Iec0702bdf4a07ea37e1213a33dc970028da654df
CRs-Fixed: 2928744
Manikanta Pubbisetty 4 năm trước cách đây
mục cha
commit
9f6ccf3fe6
1 tập tin đã thay đổi với 16 bổ sung2 xóa
  1. 16 2
      dp/wifi3.0/dp_ipa.c

+ 16 - 2
dp/wifi3.0/dp_ipa.c

@@ -106,11 +106,25 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
 				 qdf_nbuf_get_frag_paddr(nbuf, 0),
 				 size);
 
-	if (create)
+	if (create) {
+		/* Assert if PA is zero */
+		qdf_assert_always(mem_map_table.pa);
+
 		ret = qdf_ipa_wdi_create_smmu_mapping(1, &mem_map_table);
-	else
+	} else {
 		ret = qdf_ipa_wdi_release_smmu_mapping(1, &mem_map_table);
+	}
 	qdf_assert_always(!ret);
+
+	/* Return status of mapping/unmapping is stored in
+	 * mem_map_table.result field, assert if the result
+	 * is failure
+	 */
+	if (create)
+		qdf_assert_always(!mem_map_table.result);
+	else
+		qdf_assert_always(mem_map_table.result >= mem_map_table.size);
+
 	return ret;
 }