Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp222840pxb; Wed, 18 Nov 2020 22:21:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKslUeD9MQzduz6xbyTtB/yY+EzgxoA8yK9hgX/wOVs6s+HxQDsxct1euf11uS90zDz2KZ X-Received: by 2002:aa7:db53:: with SMTP id n19mr1095631edt.73.1605766898864; Wed, 18 Nov 2020 22:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605766898; cv=none; d=google.com; s=arc-20160816; b=c0FYotL0DXDVyzsGx8tK+4fArKBozFkGXUHy4nDjZoarWMH8bFcJk82fHI78Xh0fLR PU0sFPp6E0RLsziQ2BYERETzUBbm/1fMg1lhludR4nWJIfOmAl/HpWqeZc8zBpDlQP1M rdeoT3ZJKPu1kAE1fmt5Z1iWoQTeAfk1xQeFiMVBkWkDOVE0isUxxiRLxir08ionwszj f7Niuf/UvfkHfv8uMj8NjKHhX9mwwOG/+zOUdJjQsQcJDkk0g0Zjr+JRzPq2HEwHLENL /MTnWhrMjdYHERFrhuaERz4SO61jpnwzUhzS9L6WbvmJA0QQ9uQnJuY6UrltuwCrkoDK cDXQ== 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=5RIwBqd7C0Vty4VE3k8O72rjmVuJx5hNbyMVM4v6+eE=; b=PQTtyBlMrQmS3/9i/yDNYXFwzLHv0Wz2I5DK7hulFSL33uk4mIqPM3v7aWhIFFwP/L KpWbONA+B9urUDCOZP67ICQZ5ZA2ciCoLl4N2ss37rGgL06bAjS8wWD9YPhdqxXYNSj4 5sObhiPUyk+s7u1TeaHB3DoNqkGGImGL34wgPsiTrkAjqgNXhRx88yNdtnLugQN1ab3b Xf0H93S81LNlZIYwfT/oWp5kyo0KyP2G4fErmP5ZXcG1jh35U/JNvfYxLbsiRjoaiKoF AEgEYeDlxLQa5tj0wWhsfG+QuwPk6P3skiMARqpnbad/O07iBnPAU+kFLRfj9Z/HXfWn Ywbg== 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 y19si17481316edu.12.2020.11.18.22.21.15; Wed, 18 Nov 2020 22:21:38 -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 S1726407AbgKSGTS (ORCPT + 99 others); Thu, 19 Nov 2020 01:19:18 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:40137 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726224AbgKSGTS (ORCPT ); Thu, 19 Nov 2020 01:19:18 -0500 X-UUID: c699f1342b924e3fb40ede5a158461b5-20201119 X-UUID: c699f1342b924e3fb40ede5a158461b5-20201119 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] 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 1858901902; Thu, 19 Nov 2020 14:19:14 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 19 Nov 2020 14:19:12 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 19 Nov 2020 14:19:11 +0800 From: Yong Wu To: Joerg Roedel , Will Deacon , Robin Murphy CC: Matthias Brugger , Krzysztof Kozlowski , Tomasz Figa , , , , , , , , Nicolas Boichat , , , Subject: [PATCH v2 4/6] iommu: Add granule_ignore when tlb gather Date: Thu, 19 Nov 2020 14:18:34 +0800 Message-ID: <20201119061836.15238-5-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201119061836.15238-1-yong.wu@mediatek.com> References: <20201119061836.15238-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 Add a granule_ignore option when tlb gather for some HW which don't care about granule when it flush tlb. Signed-off-by: Yong Wu --- include/linux/iommu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 794d4085edd3..1aad32238510 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -171,6 +171,7 @@ enum iommu_dev_features { * @start: IOVA representing the start of the range to be flushed * @end: IOVA representing the end of the range to be flushed (exclusive) * @pgsize: The interval at which to perform the flush + * @granule_ignore: For tlb flushing that could be regardless of granule. * * This structure is intended to be updated by multiple calls to the * ->unmap() function in struct iommu_ops before eventually being passed @@ -180,6 +181,7 @@ struct iommu_iotlb_gather { unsigned long start; unsigned long end; size_t pgsize; + bool granule_ignore; }; /** @@ -544,7 +546,7 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain, * a different granularity, then sync the TLB so that the gather * structure can be rewritten. */ - if (gather->pgsize != size || + if ((!gather->granule_ignore && gather->pgsize != size) || end < gather->start || start > gather->end) { if (gather->pgsize) iommu_iotlb_sync(domain, gather); -- 2.18.0