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

Commit 83b03a20 authored by Bojun Pan's avatar Bojun Pan
Browse files

msm: ipa: update the iommu mapping for WDI rings



In IPA4.5, Lower-16_bits of Ring base + ring length can’t exceed 16 bits.
The fix here is to adjust the iova for ring base in smmu enable case.

Change-Id: I55ef76e6482b08e69976f1e7da9e2aa7fa9d7e09
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent 1e453d39
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -98,6 +98,10 @@
#define IPA_WDI2_OVER_GSI() (ipa3_ctx->ipa_wdi2_over_gsi \
		&& (ipa3_get_wdi_version() == IPA_WDI_2))

/* Bit alignment for IPA4.5 GSI rings */
#define IPA_LOW_16_BIT_MASK (0xFFFF)
#define IPA4_5_GSI_RING_SIZE_ALIGN (16 * PAGE_SIZE)

#define IPADBG(fmt, args...) \
	do { \
		pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
+11 −0
Original line number Diff line number Diff line
@@ -641,6 +641,17 @@ static int ipa_create_ap_smmu_mapping_sgt(struct sg_table *sgt,
		start_iova = va;
	}

	/*
	 * In IPA4.5, GSI HW has such requirement:
	 * Lower 16_bits of Ring base + ring length can’t exceed 16 bits
	 */
	if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_5 &&
		((u32)(va & IPA_LOW_16_BIT_MASK) + len) >=
		IPA4_5_GSI_RING_SIZE_ALIGN) {
		va = roundup(cb->next_addr, IPA4_5_GSI_RING_SIZE_ALIGN);
		start_iova = va;
	}

	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
		/* directly get sg_tbl PA from wlan-driver */
		phys = sg->dma_address;