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

Commit efb82662 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss2: Add device tree option to enable SMMU S1 stage"

parents 885635e1 4dac45dc
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ Optional properties:
                              always on regulator in VDDmin.
  - vdd-wlan-core-supply: phandle to the 1.3V CORE regulator for QCA6174
  - vdd-wlan-sp2t-supply: phandle to the 2.7V SP2T regulator for QCA6174
  - qcom,smmu-s1-enable: Boolean property to decide whether to enable SMMU
                         S1 stage or not
  - qcom,wlan-smmu-iova-address: I/O virtual address range as <start length>
                                 format to be used for allocations associated
                                 between WLAN/PCIe and SMMU
+37 −17
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -223,10 +223,13 @@ static int cnss_pci_init_smmu(struct cnss_pci_data *pci_priv)
	struct dma_iommu_mapping *mapping;
	int atomic_ctx = 1;
	int s1_bypass = 1;
	int fast = 1;

	cnss_pr_dbg("Initializing SMMU\n");

	dev = &pci_priv->pci_dev->dev;

	mapping = arm_iommu_create_mapping(&platform_bus_type,
	mapping = arm_iommu_create_mapping(dev->bus,
					   pci_priv->smmu_iova_start,
					   pci_priv->smmu_iova_len);
	if (IS_ERR(mapping)) {
@@ -235,6 +238,9 @@ static int cnss_pci_init_smmu(struct cnss_pci_data *pci_priv)
		goto out;
	}

	if (pci_priv->smmu_s1_enable) {
		cnss_pr_dbg("Enabling SMMU S1 stage\n");

		ret = iommu_domain_set_attr(mapping->domain,
					    DOMAIN_ATTR_ATOMIC,
					    &atomic_ctx);
@@ -244,6 +250,15 @@ static int cnss_pci_init_smmu(struct cnss_pci_data *pci_priv)
			goto release_mapping;
		}

		ret = iommu_domain_set_attr(mapping->domain,
					    DOMAIN_ATTR_FAST,
					    &fast);
		if (ret) {
			pr_err("Failed to set SMMU fast attribute, err = %d\n",
			       ret);
			goto release_mapping;
		}
	} else {
		ret = iommu_domain_set_attr(mapping->domain,
					    DOMAIN_ATTR_S1_BYPASS,
					    &s1_bypass);
@@ -252,6 +267,7 @@ static int cnss_pci_init_smmu(struct cnss_pci_data *pci_priv)
			       ret);
			goto release_mapping;
		}
	}

	ret = arm_iommu_attach_device(dev, mapping);
	if (ret) {
@@ -1443,6 +1459,10 @@ static int cnss_pci_probe(struct pci_dev *pci_dev,
	res = platform_get_resource_byname(plat_priv->plat_dev, IORESOURCE_MEM,
					   "smmu_iova_base");
	if (res) {
		if (of_property_read_bool(plat_priv->plat_dev->dev.of_node,
					  "qcom,smmu-s1-enable"))
			pci_priv->smmu_s1_enable = true;

		pci_priv->smmu_iova_start = res->start;
		pci_priv->smmu_iova_len = resource_size(res);
		cnss_pr_dbg("smmu_iova_start: %pa, smmu_iova_len: %zu\n",
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -70,6 +70,7 @@ struct cnss_pci_data {
	atomic_t auto_suspended;
	bool monitor_wake_intr;
	struct dma_iommu_mapping *smmu_mapping;
	bool smmu_s1_enable;
	dma_addr_t smmu_iova_start;
	size_t smmu_iova_len;
	void __iomem *bar;