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

Commit ef5480ad authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa2: Add changes compatible to kernel-4.19"

parents 688bf7b7 fc218ba2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -350,6 +350,8 @@ struct ipa_api_controller {

	enum ipa_client_type (*ipa_get_client_mapping)(int pipe_idx);

	enum ipa_rm_resource_name (*ipa_get_rm_resource_from_ep)(int pipe_idx);

	bool (*ipa_get_modem_cfg_emb_pipe_flt)(void);

	enum ipa_transport_type (*ipa_get_transport_type)(void);
@@ -442,6 +444,7 @@ struct ipa_api_controller {
		struct ipa_smmu_out_params *out);
	int (*ipa_is_vlan_mode)(enum ipa_vlan_ifaces iface, bool *res);

	bool (*ipa_pm_is_used)(void);
	int (*ipa_wigig_internal_init)(
		struct ipa_wdi_uc_ready_params *inout,
		ipa_wigig_misc_int_cb int_notify,
+152 −231
Original line number Diff line number Diff line
@@ -388,44 +388,30 @@ static void ipa2_active_clients_log_destroy(void)
			IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES - 1;
}

enum ipa_smmu_cb_type {
	IPA_SMMU_CB_AP,
	IPA_SMMU_CB_WLAN,
	IPA_SMMU_CB_UC,
	IPA_SMMU_CB_MAX

};

static struct ipa_smmu_cb_ctx smmu_cb[IPA_SMMU_CB_MAX];

struct iommu_domain *ipa2_get_smmu_domain(void)
struct iommu_domain *ipa2_get_smmu_domain_by_type(enum ipa_smmu_cb_type cb_type)
{
	if (smmu_cb[IPA_SMMU_CB_AP].valid)
		return smmu_cb[IPA_SMMU_CB_AP].mapping->domain;

	IPAERR("CB not valid\n");
	if (VALID_IPA_SMMU_CB_TYPE(cb_type) && smmu_cb[cb_type].valid)
		return smmu_cb[cb_type].iommu_domain;

	IPAERR("cb_type(%d) not valid\n", cb_type);
	return NULL;
}

struct iommu_domain *ipa2_get_uc_smmu_domain(void)
struct iommu_domain *ipa2_get_smmu_domain(void)
{
	if (smmu_cb[IPA_SMMU_CB_UC].valid)
		return smmu_cb[IPA_SMMU_CB_UC].mapping->domain;

	IPAERR("CB not valid\n");
	return ipa2_get_smmu_domain_by_type(IPA_SMMU_CB_AP);
}

	return NULL;
struct iommu_domain *ipa2_get_uc_smmu_domain(void)
{
	return ipa2_get_smmu_domain_by_type(IPA_SMMU_CB_UC);
}

struct iommu_domain *ipa2_get_wlan_smmu_domain(void)
{
	if (smmu_cb[IPA_SMMU_CB_WLAN].valid)
		return smmu_cb[IPA_SMMU_CB_WLAN].iommu;

	IPAERR("CB not valid\n");

	return NULL;
	return ipa2_get_smmu_domain_by_type(IPA_SMMU_CB_WLAN);
}

struct device *ipa2_get_dma_dev(void)
@@ -438,9 +424,9 @@ struct device *ipa2_get_dma_dev(void)
 *
 * Return value: pointer to smmu context address
 */
struct ipa_smmu_cb_ctx *ipa2_get_smmu_ctx(void)
struct ipa_smmu_cb_ctx *ipa2_get_smmu_ctx(enum ipa_smmu_cb_type cb_type)
{
	return &smmu_cb[IPA_SMMU_CB_AP];
	return &smmu_cb[cb_type];
}


@@ -1675,6 +1661,7 @@ static int ipa_init_smem_region(int memory_region_size,
	desc.len = sizeof(*cmd);
	desc.type = IPA_IMM_CMD_DESC;


	rc = ipa_send_cmd(1, &desc);
	if (rc) {
		IPAERR("failed to send immediate command (error %d)\n", rc);
@@ -1704,13 +1691,14 @@ int ipa_init_q6_smem(void)

	IPA_ACTIVE_CLIENTS_INC_SIMPLE();

	if (ipa_ctx->ipa_hw_type == IPA_HW_v2_0)
	if (ipa_ctx->ipa_hw_type == IPA_HW_v2_0) {
		rc = ipa_init_smem_region(IPA_MEM_PART(modem_size) -
			IPA_MEM_RAM_MODEM_NETWORK_STATS_SIZE,
			IPA_MEM_PART(modem_ofst));
	else
	} else {
		rc = ipa_init_smem_region(IPA_MEM_PART(modem_size),
			IPA_MEM_PART(modem_ofst));
	}

	if (rc) {
		IPAERR("failed to initialize Modem RAM memory\n");
@@ -3453,7 +3441,7 @@ void ipa_inc_acquire_wakelock(enum ipa_wakelock_ref_client ref_client)
		ref_client, ipa_ctx->wakelock_ref_cnt.cnt);
	ipa_ctx->wakelock_ref_cnt.cnt |= (1 << ref_client);
	if (ipa_ctx->wakelock_ref_cnt.cnt)
		__pm_stay_awake(&ipa_ctx->w_lock);
		__pm_stay_awake(ipa_ctx->w_lock);
	IPADBG_LOW("active wakelock ref cnt = %d client enum %d\n",
		ipa_ctx->wakelock_ref_cnt.cnt, ref_client);
	spin_unlock_irqrestore(&ipa_ctx->wakelock_ref_cnt.spinlock, flags);
@@ -3478,7 +3466,7 @@ void ipa_dec_release_wakelock(enum ipa_wakelock_ref_client ref_client)
	IPADBG_LOW("active wakelock ref cnt = %d client enum %d\n",
		ipa_ctx->wakelock_ref_cnt.cnt, ref_client);
	if (ipa_ctx->wakelock_ref_cnt.cnt == 0)
		__pm_relax(&ipa_ctx->w_lock);
		__pm_relax(ipa_ctx->w_lock);
	spin_unlock_irqrestore(&ipa_ctx->wakelock_ref_cnt.spinlock, flags);
}

@@ -4300,10 +4288,15 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
		goto fail_nat_dev_add;
	}

	/* Register a wakeup source. */
	ipa_ctx->w_lock =
		wakeup_source_register(&ipa_pdev->dev, "IPA_WS");
	if (!ipa_ctx->w_lock) {
		IPAERR("IPA wakeup source register failed\n");
		result = -ENOMEM;
		goto fail_w_source_register;
	}


	/* Create a wakeup source. */
	wakeup_source_init(&ipa_ctx->w_lock, "IPA_WS");
	spin_lock_init(&ipa_ctx->wakelock_ref_cnt.spinlock);

	/* Initialize the SPS PM lock. */
@@ -4389,6 +4382,9 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
fail_create_apps_resource:
	ipa_rm_exit();
fail_ipa_rm_init:
	wakeup_source_unregister(ipa_ctx->w_lock);
	ipa_ctx->w_lock = NULL;
fail_w_source_register:
fail_nat_dev_add:
	cdev_del(&ipa_ctx->cdev);
fail_cdev_add:
@@ -4665,164 +4661,117 @@ static int get_ipa_dts_configuration(struct platform_device *pdev,

static int ipa_smmu_wlan_cb_probe(struct device *dev)
{
	struct ipa_smmu_cb_ctx *cb = ipa2_get_wlan_smmu_ctx();
	int atomic_ctx = 1;
	int fast = 1;
	int bypass = 1;
	int ret;
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx(IPA_SMMU_CB_WLAN);
	int fast = 0;
	int bypass = 0;
	u32 iova_ap_mapping[2];

	IPADBG("sub pdev=%p\n", dev);
	IPADBG("WLAN CB PROBE dev=%pK retrieving IOMMU mapping\n", dev);

	cb->dev = dev;
	cb->iommu = iommu_domain_alloc(&platform_bus_type);
	if (!cb->iommu) {
		IPAERR("could not alloc iommu domain\n");
		/* assume this failure is because iommu driver is not ready */
		return -EPROBE_DEFER;
	cb->iommu_domain = iommu_get_domain_for_dev(dev);
	if (IS_ERR_OR_NULL(cb->iommu_domain)) {
		IPAERR("could not get iommu domain\n");
		return -EINVAL;
	}
	IPADBG("WLAN CB PROBE mapping retrieved\n");

	cb->dev   = dev;
	cb->valid = true;

	if (smmu_info.s1_bypass) {
		if (iommu_domain_set_attr(cb->iommu,
			DOMAIN_ATTR_S1_BYPASS,
			&bypass)) {
			IPAERR("couldn't set bypass\n");
			cb->valid = false;
			return -EIO;
		}
		IPADBG("SMMU S1 BYPASS\n");
	} else {
		if (iommu_domain_set_attr(cb->iommu,
			DOMAIN_ATTR_ATOMIC,
			&atomic_ctx)) {
			IPAERR("couldn't set domain as atomic\n");
			cb->valid = false;
			return -EIO;
		}
		IPADBG("SMMU atomic set\n");
		if (smmu_info.fast_map) {
			if (iommu_domain_set_attr(cb->iommu,
				DOMAIN_ATTR_FAST,
				&fast)) {
				IPAERR("couldn't set fast map\n");
				cb->valid = false;
				return -EIO;
			}
			IPADBG("SMMU fast map set\n");
		}
	cb->va_start = cb->va_end  = cb->va_size = 0;
	if (of_property_read_u32_array(
			dev->of_node, "qcom,iommu-dma-addr-pool",
			iova_ap_mapping, 2) == 0) {
		cb->va_start = iova_ap_mapping[0];
		cb->va_size  = iova_ap_mapping[1];
		cb->va_end   = cb->va_start + cb->va_size;
	}

	ret = iommu_attach_device(cb->iommu, dev);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		cb->valid = false;
		return ret;
	}
	IPADBG("WLAN CB PROBE dev=%pK va_start=0x%x va_size=0x%x\n",
		   dev, cb->va_start, cb->va_size);

	if (!smmu_info.s1_bypass) {
		IPAERR("map IPA region to WLAN_CB IOMMU\n");
		ret = ipa_iommu_map(cb->iommu,
			rounddown(smmu_info.ipa_base, PAGE_SIZE),
			rounddown(smmu_info.ipa_base, PAGE_SIZE),
			roundup(smmu_info.ipa_size, PAGE_SIZE),
			IOMMU_READ | IOMMU_WRITE | IOMMU_MMIO);
		if (ret) {
			IPAERR("map IPA to WLAN_CB IOMMU failed ret=%d\n",
				ret);
			arm_iommu_detach_device(cb->dev);
			cb->valid = false;
			return ret;
		}
	}
	/*
	 * Prior to these calls to iommu_domain_get_attr(), these
	 * attributes were set in this function relative to dtsi values
	 * defined for this driver.  In other words, if corresponding ipa
	 * driver owned values were found in the dtsi, they were read and
	 * set here.
	 *
	 * In this new world, the developer will use iommu owned dtsi
	 * settings to set them there.  This new logic below, simply
	 * checks to see if they've been set in dtsi.  If so, the logic
	 * further below acts accordingly...
	 */
	iommu_domain_get_attr(cb->iommu_domain, DOMAIN_ATTR_S1_BYPASS, &bypass);
	iommu_domain_get_attr(cb->iommu_domain, DOMAIN_ATTR_FAST, &fast);

	IPADBG(
	  "WLAN CB PROBE dev=%pK DOMAIN ATTRS bypass=%d fast=%d\n",
	  dev, bypass, fast);

	return 0;
}

static int ipa_smmu_uc_cb_probe(struct device *dev)
{
	struct ipa_smmu_cb_ctx *cb = ipa2_get_uc_smmu_ctx();
	int atomic_ctx = 1;
	int ret;
	int fast = 1;
	int bypass = 1;
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx(IPA_SMMU_CB_UC);
	int fast = 0;
	int bypass = 0;
	u32 iova_ap_mapping[2];

	IPADBG("UC CB PROBE sub pdev=%p\n", dev);

	ret = of_property_read_u32_array(dev->of_node, "qcom,iova-mapping",
		iova_ap_mapping, 2);
	if (ret) {
		IPAERR("Fail to read UC start/size iova addresses\n");
		return ret;
	}
	cb->va_start = iova_ap_mapping[0];
	cb->va_size = iova_ap_mapping[1];
	cb->va_end = cb->va_start + cb->va_size;
	IPADBG("UC va_start=0x%x va_sise=0x%x\n", cb->va_start, cb->va_size);

	if (dma_set_mask(dev, DMA_BIT_MASK(32)) ||
		    dma_set_coherent_mask(dev, DMA_BIT_MASK(32))) {
		IPAERR("DMA set mask failed\n");
		return -EOPNOTSUPP;
	}

	IPADBG("UC CB PROBE=%p create IOMMU mapping\n", dev);
	IPADBG("UC CB PROBE dev=%pK retrieving IOMMU mapping\n", dev);

	cb->dev = dev;
	cb->mapping = arm_iommu_create_mapping(&platform_bus_type,
				cb->va_start, cb->va_size);
	if (IS_ERR_OR_NULL(cb->mapping)) {
		IPADBG("Fail to create mapping\n");
	cb->iommu_domain = iommu_get_domain_for_dev(dev);
	if (IS_ERR_OR_NULL(cb->iommu_domain)) {
		IPAERR("could not get iommu domain\n");
		/* assume this failure is because iommu driver is not ready */
		return -EPROBE_DEFER;
	}
	IPADBG("SMMU mapping created\n");
	IPADBG("UC CB PROBE mapping retrieved\n");

	cb->dev   = dev;
	cb->valid = true;

	IPADBG("UC CB PROBE sub pdev=%p set attribute\n", dev);
	if (smmu_info.s1_bypass) {
		if (iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_S1_BYPASS,
			&bypass)) {
			IPAERR("couldn't set bypass\n");
			arm_iommu_release_mapping(cb->mapping);
			cb->valid = false;
			return -EIO;
		}
		IPADBG("SMMU S1 BYPASS\n");
	} else {
		if (iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_ATOMIC,
			&atomic_ctx)) {
			IPAERR("couldn't set domain as atomic\n");
			arm_iommu_release_mapping(cb->mapping);
			cb->valid = false;
			return -EIO;
		}
		IPADBG("SMMU atomic set\n");
		if (smmu_info.fast_map) {
			if (iommu_domain_set_attr(cb->mapping->domain,
				DOMAIN_ATTR_FAST,
				&fast)) {
				IPAERR("couldn't set fast map\n");
				arm_iommu_release_mapping(cb->mapping);
				cb->valid = false;
				return -EIO;
			}
			IPADBG("SMMU fast map set\n");
		}
	}
	cb->va_start = cb->va_end  = cb->va_size = 0;

	IPADBG("UC CB PROBE sub pdev=%p attaching IOMMU device\n", dev);
	ret = arm_iommu_attach_device(cb->dev, cb->mapping);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		arm_iommu_release_mapping(cb->mapping);
		cb->valid = false;
		return ret;
	if (of_property_read_u32_array(
			dev->of_node, "qcom,iommu-dma-addr-pool",
			iova_ap_mapping, 2) == 0) {
		cb->va_start = iova_ap_mapping[0];
		cb->va_size  = iova_ap_mapping[1];
		cb->va_end   = cb->va_start + cb->va_size;
	}

	cb->next_addr = cb->va_end;
	IPADBG("UC CB PROBE dev=%pK va_start=0x%x va_size=0x%x\n",
		   dev, cb->va_start, cb->va_size);

	/*
	 * Prior to these calls to iommu_domain_get_attr(), these
	 * attributes were set in this function relative to dtsi values
	 * defined for this driver.  In other words, if corresponding ipa
	 * driver owned values were found in the dtsi, they were read and
	 * set here.
	 *
	 * In this new world, the developer will use iommu owned dtsi
	 * settings to set them there.  This new logic below, simply
	 * checks to see if they've been set in dtsi.  If so, the logic
	 * further below acts accordingly...
	 */

	iommu_domain_get_attr(cb->iommu_domain, DOMAIN_ATTR_S1_BYPASS, &bypass);
	iommu_domain_get_attr(cb->iommu_domain, DOMAIN_ATTR_FAST, &fast);

	IPADBG("UC CB PROBE dev=%pK DOMAIN ATTRS bypass=%d fast=%d\n",
		   dev, bypass, fast);

	ipa_ctx->uc_pdev = dev;

	IPADBG("UC CB PROBE pdev=%p attached\n", dev);
@@ -4831,25 +4780,13 @@ static int ipa_smmu_uc_cb_probe(struct device *dev)

static int ipa_smmu_ap_cb_probe(struct device *dev)
{
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx();
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx(IPA_SMMU_CB_AP);
	int result;
	int atomic_ctx = 1;
	int fast = 1;
	int bypass = 1;
	int fast = 0;
	int bypass = 0;
	u32 iova_ap_mapping[2];

	IPADBG("AP CB probe: sub pdev=%p\n", dev);

	result = of_property_read_u32_array(dev->of_node, "qcom,iova-mapping",
		 iova_ap_mapping, 2);
	if (result) {
		IPAERR("Fail to read AP start/size iova addresses\n");
		return result;
	}
	cb->va_start = iova_ap_mapping[0];
	cb->va_size = iova_ap_mapping[1];
	cb->va_end = cb->va_start + cb->va_size;
	IPADBG("AP va_start=0x%x va_sise=0x%x\n", cb->va_start, cb->va_size);
	IPADBG("AP CB probe: dev=%pK\n", dev);

	if (dma_set_mask(dev, DMA_BIT_MASK(32)) ||
		    dma_set_coherent_mask(dev, DMA_BIT_MASK(32))) {
@@ -4857,60 +4794,52 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
		return -EOPNOTSUPP;
	}

	cb->dev = dev;
	cb->mapping = arm_iommu_create_mapping(&platform_bus_type,
					       cb->va_start,
					       cb->va_size);
	if (IS_ERR_OR_NULL(cb->mapping)) {
		IPADBG("Fail to create mapping\n");
	IPADBG("AP CB PROBE dev=%pK retrieving IOMMU mapping\n", dev);
	cb->iommu_domain = iommu_get_domain_for_dev(dev);
	if (IS_ERR_OR_NULL(cb->iommu_domain)) {
		IPAERR("could not get iommu domain\n");
		/* assume this failure is because iommu driver is not ready */
		return -EPROBE_DEFER;
	}
	IPADBG("SMMU mapping created\n");

	IPADBG("AP CB PROBE mapping retrieved\n");

	cb->dev = dev;
	cb->valid = true;

	if (smmu_info.s1_bypass) {
		if (iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_S1_BYPASS,
			&bypass)) {
			IPAERR("couldn't set bypass\n");
			arm_iommu_release_mapping(cb->mapping);
			cb->valid = false;
			return -EIO;
		}
		IPADBG("SMMU S1 BYPASS\n");
	} else {
		if (iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_ATOMIC,
			&atomic_ctx)) {
			IPAERR("couldn't set domain as atomic\n");
			arm_iommu_release_mapping(cb->mapping);
			cb->valid = false;
			return -EIO;
	cb->va_start = cb->va_end  = cb->va_size = 0;
	if (of_property_read_u32_array(
				dev->of_node, "qcom,iommu-dma-addr-pool",
				iova_ap_mapping, 2) == 0) {
		cb->va_start = iova_ap_mapping[0];
		cb->va_size  = iova_ap_mapping[1];
		cb->va_end   = cb->va_start + cb->va_size;
	}
		IPADBG("SMMU atomic set\n");

		if (iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_FAST,
			&fast)) {
			IPAERR("couldn't set fast map\n");
			arm_iommu_release_mapping(cb->mapping);
			cb->valid = false;
			return -EIO;
		}
		IPADBG("SMMU fast map set\n");
	}

	result = arm_iommu_attach_device(cb->dev, cb->mapping);
	if (result) {
		IPAERR("couldn't attach to IOMMU ret=%d\n", result);
		cb->valid = false;
		return result;
	}
	IPADBG("AP va_start=0x%x va_sise=0x%x\n", cb->va_start, cb->va_size);

	/*
	 * Prior to these calls to iommu_domain_get_attr(), these
	 * attributes were set in this function relative to dtsi values
	 * defined for this driver.  In other words, if corresponding ipa
	 * driver owned values were found in the dtsi, they were read and
	 * set here.
	 *
	 * In this new world, the developer will use iommu owned dtsi
	 * settings to set them there.  This new logic below, simply
	 * checks to see if they've been set in dtsi.  If so, the logic
	 * further below acts accordingly...
	 */
	iommu_domain_get_attr(cb->iommu_domain, DOMAIN_ATTR_S1_BYPASS, &bypass);
	iommu_domain_get_attr(cb->iommu_domain, DOMAIN_ATTR_FAST, &fast);

	IPADBG("AP CB PROBE dev=%pK DOMAIN ATTRS bypass=%d fast=%d\n",
			dev, bypass, fast);

	if (!smmu_info.s1_bypass) {
		IPAERR("map IPA region to AP_CB IOMMU\n");
		result = ipa_iommu_map(cb->mapping->domain,
		result = ipa_iommu_map(cb->iommu_domain,
				rounddown(smmu_info.ipa_base, PAGE_SIZE),
				rounddown(smmu_info.ipa_base, PAGE_SIZE),
				roundup(smmu_info.ipa_size, PAGE_SIZE),
@@ -4918,7 +4847,6 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
		if (result) {
			IPAERR("map IPA region to AP_CB IOMMU failed ret=%d\n",
					result);
			arm_iommu_release_mapping(cb->mapping);
			cb->valid = false;
			return result;
		}
@@ -4933,8 +4861,6 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
	result = ipa_init(&ipa_res, dev);
	if (result) {
		IPAERR("ipa_init failed\n");
		arm_iommu_detach_device(cb->dev);
		arm_iommu_release_mapping(cb->mapping);
		cb->valid = false;
		return result;
	}
@@ -5010,18 +4936,12 @@ int ipa_plat_drv_probe(struct platform_device *pdev_p,
		if (of_property_read_bool(pdev_p->dev.of_node,
		    "qcom,smmu-s1-bypass"))
			smmu_info.s1_bypass = true;
		if (of_property_read_bool(pdev_p->dev.of_node,
		    "qcom,smmu-fast-map"))
			smmu_info.fast_map = true;
		smmu_info.arm_smmu = true;
		pr_info("IPA smmu_info.s1_bypass=%d smmu_info.fast_map=%d\n",
			smmu_info.s1_bypass, smmu_info.fast_map);
		result = of_platform_populate(pdev_p->dev.of_node,
				pdrv_match, NULL, &pdev_p->dev);
	} else if (of_property_read_bool(pdev_p->dev.of_node,
				"qcom,msm-smmu")) {
		IPAERR("Legacy IOMMU not supported\n");
		result = -EOPNOTSUPP;

	} else {
		if (dma_set_mask(&pdev_p->dev, DMA_BIT_MASK(32)) ||
			    dma_set_coherent_mask(&pdev_p->dev,
@@ -5040,6 +4960,7 @@ int ipa_plat_drv_probe(struct platform_device *pdev_p,
			return result;
		}
	}
	IPADBG("IPA PROBE SUCCESSFUL, result %d\n", result);

	return result;
}
@@ -5100,7 +5021,7 @@ struct ipa_context *ipa_get_ctx(void)
int ipa_iommu_map(struct iommu_domain *domain,
	unsigned long iova, phys_addr_t paddr, size_t size, int prot)
{
	struct ipa_smmu_cb_ctx *ap_cb = ipa2_get_smmu_ctx();
	struct ipa_smmu_cb_ctx *ap_cb = ipa2_get_smmu_ctx(IPA_SMMU_CB_AP);
	struct ipa_smmu_cb_ctx *uc_cb = ipa2_get_uc_smmu_ctx();

	IPADBG("domain =0x%p iova 0x%lx\n", domain, iova);
+2 −2
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ static int ipa2_smmu_map_peer_bam(unsigned long dev)
	phys_addr_t base;
	u32 size;
	struct iommu_domain *smmu_domain;
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx();
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx(IPA_SMMU_CB_AP);

	if (!ipa_ctx->smmu_s1_bypass) {
		if (ipa_ctx->peer_bam_map_cnt == 0) {
@@ -529,7 +529,7 @@ static int ipa2_smmu_unmap_peer_bam(unsigned long dev)
{
	size_t len;
	struct iommu_domain *smmu_domain;
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx();
	struct ipa_smmu_cb_ctx *cb = ipa2_get_smmu_ctx(IPA_SMMU_CB_AP);

	if (!ipa_ctx->smmu_s1_bypass) {
		WARN_ON(dev != ipa_ctx->peer_bam_dev);
+15 −4
Original line number Diff line number Diff line
@@ -229,14 +229,25 @@ struct ipa_client_names {
struct ipa_smmu_cb_ctx {
	bool valid;
	struct device *dev;
	struct dma_iommu_mapping *mapping;
	struct iommu_domain *iommu;
	struct iommu_domain *iommu_domain;
	unsigned long next_addr;
	u32 va_start;
	u32 va_size;
	u32 va_end;
};


enum ipa_smmu_cb_type {
	IPA_SMMU_CB_AP,
	IPA_SMMU_CB_WLAN,
	IPA_SMMU_CB_UC,
	IPA_SMMU_CB_MAX

};
#define VALID_IPA_SMMU_CB_TYPE(t) \
	((t) >= IPA_SMMU_CB_AP && (t) < IPA_SMMU_CB_MAX)


/**
 * struct ipa_flt_entry - IPA filtering table entry
 * @link: entry's link in global filtering enrties list
@@ -1208,7 +1219,7 @@ struct ipa_context {
	u32 peer_bam_map_cnt;
	u32 wdi_map_cnt;
	bool use_dma_zone;
	struct wakeup_source w_lock;
	struct wakeup_source *w_lock;
	struct ipa_wakelock_ref_cnt wakelock_ref_cnt;

	/* RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA */
@@ -1945,7 +1956,7 @@ int ipa2_uc_mhi_print_stats(char *dbg_buff, int size);
int ipa_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len);
u32 ipa_get_num_pipes(void);
u32 ipa_get_sys_yellow_wm(struct ipa_sys_context *sys);
struct ipa_smmu_cb_ctx *ipa2_get_smmu_ctx(void);
struct ipa_smmu_cb_ctx *ipa2_get_smmu_ctx(enum ipa_smmu_cb_type cb_type);
struct ipa_smmu_cb_ctx *ipa2_get_wlan_smmu_ctx(void);
struct ipa_smmu_cb_ctx *ipa2_get_uc_smmu_ctx(void);
struct iommu_domain *ipa_get_uc_smmu_domain(void);
+249 −249

File changed.

Preview size limit exceeded, changes collapsed.

Loading