|
@@ -443,6 +443,51 @@ static int cnss_get_audio_iommu_domain(struct cnss_plat_data *plat_priv)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+bool cnss_get_audio_shared_iommu_group_cap(struct device *dev)
|
|
|
+{
|
|
|
+ struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
|
|
|
+ struct device_node *audio_ion_node;
|
|
|
+ struct device_node *cnss_iommu_group_node;
|
|
|
+ struct device_node *audio_iommu_group_node;
|
|
|
+
|
|
|
+ if (!plat_priv)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ audio_ion_node = of_find_compatible_node(NULL, NULL,
|
|
|
+ "qcom,msm-audio-ion");
|
|
|
+ if (!audio_ion_node) {
|
|
|
+ cnss_pr_err("Unable to get Audio ion node");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ audio_iommu_group_node = of_parse_phandle(audio_ion_node,
|
|
|
+ "qcom,iommu-group", 0);
|
|
|
+ of_node_put(audio_ion_node);
|
|
|
+ if (!audio_iommu_group_node) {
|
|
|
+ cnss_pr_err("Unable to get audio iommu group phandle");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ of_node_put(audio_iommu_group_node);
|
|
|
+
|
|
|
+ cnss_iommu_group_node = of_parse_phandle(dev->of_node,
|
|
|
+ "qcom,iommu-group", 0);
|
|
|
+ if (!cnss_iommu_group_node) {
|
|
|
+ cnss_pr_err("Unable to get cnss iommu group phandle");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ of_node_put(cnss_iommu_group_node);
|
|
|
+
|
|
|
+ if (cnss_iommu_group_node == audio_iommu_group_node) {
|
|
|
+ plat_priv->is_audio_shared_iommu_group = true;
|
|
|
+ cnss_pr_info("CNSS and Audio share IOMMU group");
|
|
|
+ } else {
|
|
|
+ cnss_pr_info("CNSS and Audio do not share IOMMU group");
|
|
|
+ }
|
|
|
+
|
|
|
+ return plat_priv->is_audio_shared_iommu_group;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(cnss_get_audio_shared_iommu_group_cap);
|
|
|
+
|
|
|
int cnss_set_feature_list(struct cnss_plat_data *plat_priv,
|
|
|
enum cnss_feature_v01 feature)
|
|
|
{
|
|
@@ -752,6 +797,9 @@ int cnss_audio_smmu_map(struct device *dev, phys_addr_t paddr,
|
|
|
if (!plat_priv->audio_iommu_domain)
|
|
|
return -EINVAL;
|
|
|
|
|
|
+ if (plat_priv->is_audio_shared_iommu_group)
|
|
|
+ return 0;
|
|
|
+
|
|
|
page_offset = iova & (PAGE_SIZE - 1);
|
|
|
if (page_offset + size > PAGE_SIZE)
|
|
|
size += PAGE_SIZE;
|
|
@@ -770,10 +818,8 @@ void cnss_audio_smmu_unmap(struct device *dev, dma_addr_t iova, size_t size)
|
|
|
struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev);
|
|
|
uint32_t page_offset;
|
|
|
|
|
|
- if (!plat_priv)
|
|
|
- return;
|
|
|
-
|
|
|
- if (!plat_priv->audio_iommu_domain)
|
|
|
+ if (!plat_priv || !plat_priv->audio_iommu_domain ||
|
|
|
+ plat_priv->is_audio_shared_iommu_group)
|
|
|
return;
|
|
|
|
|
|
page_offset = iova & (PAGE_SIZE - 1);
|