Bladeren bron

msm: camera: smmu: set 64bit mask to utilize 64GB space for camera CBs

To utilize more than 32-bit address space, clients need to call
dma_set_mask_and_coherent API. When called with particular value,
the max address range thats mapped on this context bank is
min of this mask value and value_from_iommu-dma_addr_pool.

CRs-Fixed: 3128094
Change-Id: Ib48dc0b00f8e915ca7faa367bec7473aed9931b4
Signed-off-by: Pavan Kumar Chilamkurthi <[email protected]>
Pavan Kumar Chilamkurthi 3 jaren geleden
bovenliggende
commit
fdce68821f
1 gewijzigde bestanden met toevoegingen van 10 en 0 verwijderingen
  1. 10 0
      drivers/cam_smmu/cam_smmu_api.c

+ 10 - 0
drivers/cam_smmu/cam_smmu_api.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/module.h>
@@ -4317,6 +4318,15 @@ static int cam_populate_smmu_context_banks(struct device *dev,
 	dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
 	dma_set_seg_boundary(dev, (unsigned long)DMA_BIT_MASK(64));
 
+	if (iommu_cb_set.is_expanded_memory) {
+		CAM_DBG(CAM_SMMU, "[%s] setting max address mask", cb->name[0]);
+		/* the largest address is the min(dma_mask, value_from_iommu-dma_addr_pool) */
+		rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
+		if (rc)
+			CAM_ERR(CAM_SMMU, "[%s] Failed in setting max address mask, rc %d",
+				cb->name[0], rc);
+	}
+
 end:
 	/* increment count to next bank */
 	iommu_cb_set.cb_init_count++;