Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aef0eadb authored by Manikanta Pubbisetty's avatar Manikanta Pubbisetty Committed by Madan Koyyalamudi
Browse files

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
parent 0abcbd53
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
						   bool create)
{
	qdf_mem_info_t mem_map_table = {0};
	QDF_STATUS ret = QDF_STATUS_SUCCESS;

	if (!qdf_ipa_is_ready())
		return QDF_STATUS_SUCCESS;
@@ -108,10 +109,27 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
				 qdf_nbuf_get_frag_paddr(nbuf, 0),
				 size);

	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 {
		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)
		return qdf_ipa_wdi_create_smmu_mapping(1, &mem_map_table);
		qdf_assert_always(!mem_map_table.result);
	else
		return qdf_ipa_wdi_release_smmu_mapping(1, &mem_map_table);
		qdf_assert_always(mem_map_table.result >= mem_map_table.size);

	return ret;
}

QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,