From 29fa6d3d554c8fd11cad0306e4a4af70c67d1edd Mon Sep 17 00:00:00 2001 From: Elson Roy Serrao Date: Mon, 13 Sep 2021 18:05:41 -0700 Subject: [PATCH] usb: dwc3: Add support to enable best fit algorithm This change adds the needed support to enable best fit algorithm for iova allocation. Best fit algorithm helps in reducing fragmentation and thus utilizing the iova address space more efficiently. Change-Id: Icaa9bf1db534eba75c1b5724b6210240e4e6faef Signed-off-by: Elson Roy Serrao --- drivers/usb/dwc3/dwc3-msm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index c22c535d9107..f2ab25825082 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -44,6 +44,7 @@ #include #include #include +#include #ifdef CONFIG_QGKI_MSM_BOOT_TIME_MARKER #include #endif @@ -4803,6 +4804,9 @@ static int dwc3_msm_probe(struct platform_device *pdev) "qcom,use-pdc-interrupts"); dwc3_set_notifier(&dwc3_msm_notify_event); + if (of_property_read_bool(node, "qcom,iommu-best-fit-algo")) + iommu_dma_enable_best_fit_algo(dev); + if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) { dev_err(&pdev->dev, "setting DMA mask to 64 failed.\n"); if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {