Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp264176pxu; Thu, 7 Jan 2021 04:32:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPIe1DfTrfDWnyHaiDCGtTqiq4DdR/98Sxkx+ONSVGRCSMX8Z6buZbFzi46jCLw4MP8mG4 X-Received: by 2002:a17:906:4443:: with SMTP id i3mr5861214ejp.133.1610022766925; Thu, 07 Jan 2021 04:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610022766; cv=none; d=google.com; s=arc-20160816; b=sn5tcM3rom91LT4Q0ZrBhS121rjAptxtD9iIQ6dAwNA5yAeQnUSU3AEw1RBaxOeJ3t 0bztaa7AsgO8Jv87hnrolZqzbUObMW6xgM7WRkxaQl4R2oQCJrqUgfKBZWEi5wt8OEQG lN+nt/blyuIzVaTFl8f/MGM+kyb6Rf6BV5xc+d3MA377Aq/PCvUItkR+1VC+NkQlbJ3d 0nwdqkc7qgPsFtPeJD+lD4mpSgZhwAauWay3mgQULVA0NX6hc47a4X3hlUDU1MaDfR95 8trydwhxAsZ1uP4gMtdoT6DvE6rGtu01wygjEFioKU2ydgS3OpX0xCEiFKbUje7anPek G9vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=mCqQv5YoEVBSY5MY+L5OUvlt0V+zzdXYTy/MjKyJd2Q=; b=WYyIlSVjfCgVhBbHALPcouFWWyJCCTPxjhDlqk6qYLuTCSfjZVx/XvAhR16e1oLvhj OOWXXpSoRtcImT1TIwTBGdNkOlWRk1BXgNA79RUjOfv+qfKVqFsr33gzbUb9XQ5lWdjB ukppTuIZWd47foq5iqAIliTge+EDMOqKA2Vd4J/lj0hMs14OdAIKbQGfw2QqK8E0CDM6 9uDIkXGKN7pPMxcVrOCLpbRU286DixdkM2Gego4mLPX++Zv1hBLmVgkmFhI+6QBqeTbB 6z1JYRup5irWoSBnEDJlt4WhI/dJVV9jLIkD6Sldiy9ep+NDogmY+/gvyIJOSgpwWt5a bOig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si2221202edb.389.2021.01.07.04.32.23; Thu, 07 Jan 2021 04:32:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbhAGMa1 (ORCPT + 99 others); Thu, 7 Jan 2021 07:30:27 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:57198 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725835AbhAGMa1 (ORCPT ); Thu, 7 Jan 2021 07:30:27 -0500 X-UUID: 83247eb64f6e4c4291ca48533de2d8f8-20210107 X-UUID: 83247eb64f6e4c4291ca48533de2d8f8-20210107 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 848856395; Thu, 07 Jan 2021 20:29:54 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 7 Jan 2021 20:29:53 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 7 Jan 2021 20:29:52 +0800 From: Yong Wu To: Joerg Roedel , Will Deacon , Robin Murphy CC: Matthias Brugger , Krzysztof Kozlowski , Tomasz Figa , , , , , , , , Nicolas Boichat , , , Greg Kroah-Hartman , , Christoph Hellwig , David Laight Subject: [PATCH v4 3/7] iommu/mediatek: Add iotlb_sync_map to sync whole the iova range Date: Thu, 7 Jan 2021 20:29:05 +0800 Message-ID: <20210107122909.16317-4-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210107122909.16317-1-yong.wu@mediatek.com> References: <20210107122909.16317-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove IO_PGTABLE_QUIRK_TLBI_ON_MAP to avoid tlb sync for each a small chunk memory, Use the new iotlb_sync_map to tlb_sync once for whole the iova range of iommu_map. Signed-off-by: Yong Wu Reviewed-by: Robin Murphy --- drivers/iommu/mtk_iommu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 8e56cec532e7..f579fc21971e 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -322,7 +322,6 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom) dom->cfg = (struct io_pgtable_cfg) { .quirks = IO_PGTABLE_QUIRK_ARM_NS | IO_PGTABLE_QUIRK_NO_PERMS | - IO_PGTABLE_QUIRK_TLBI_ON_MAP | IO_PGTABLE_QUIRK_ARM_MTK_EXT, .pgsize_bitmap = mtk_iommu_ops.pgsize_bitmap, .ias = 32, @@ -453,6 +452,14 @@ static void mtk_iommu_iotlb_sync(struct iommu_domain *domain, data); } +static void mtk_iommu_sync_map(struct iommu_domain *domain, unsigned long iova, + size_t size) +{ + struct mtk_iommu_data *data = mtk_iommu_get_m4u_data(); + + mtk_iommu_tlb_flush_range_sync(iova, size, size, data); +} + static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova) { @@ -539,6 +546,7 @@ static const struct iommu_ops mtk_iommu_ops = { .unmap = mtk_iommu_unmap, .flush_iotlb_all = mtk_iommu_flush_iotlb_all, .iotlb_sync = mtk_iommu_iotlb_sync, + .iotlb_sync_map = mtk_iommu_sync_map, .iova_to_phys = mtk_iommu_iova_to_phys, .probe_device = mtk_iommu_probe_device, .release_device = mtk_iommu_release_device, -- 2.18.0