From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67990C4338F for ; Fri, 13 Aug 2021 06:59:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31E3760234 for ; Fri, 13 Aug 2021 06:59:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 31E3760234 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9Fs9jmvd1wPpvDFnMkIfZMLcayCSQKpRnVzDuKkwVSY=; b=QLH0Hh2MQekZQu xB50P1AyozkXdeoDwHI9pUy3+3wh6zoCEcoljO5DGObJ/m3u/b4Xr4lZp8YV9aLMqWIiOF7xbD4pd 79TWOKHYcqqgnvesVJmCT+Uv8WrizzTGai/eYrwevrIBFfWMVxIqQdMZXAj8CODloAUSfVFn76xUm Hu68CdTJ1Dyp7aGrdAZyxbVW2Qp9VAgoImoPac/EI43EgC9bbqUHm77wwU04V03U2GDY8E6WgqsnA FWQXGryHviKhPQt7G12tdkVrjcjAC59fs6niPsyc/Q2hiZsjZLCa2/j7lWy3kdnTYpby8MftHcEqS /QXtPsvpulQZjrQl2L+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mER8J-00Bw5r-4E; Fri, 13 Aug 2021 06:57:35 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mER7e-00Bvm8-4P; Fri, 13 Aug 2021 06:56:57 +0000 X-UUID: 3a3805386d9e41df86ecb192d8171346-20210812 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=kSpHvYducDKn4Ch3v5WxajHzXcI7IuON1UfQJhJ3Egc=; b=guMGixo6rZubGJ0VtLeDwz2oHxMrjwd5gCYs7b/iN8+FRkemT/d9OM9cET8+/5cL5LkOyhBq7nCvOVJpr08SI9D1FTkomjW1Q6e6y6tv0Q7o5WlBQO56WOEwhxV2sQxj6917unm8IysnATEpPV5I3EsJ8eztBk8MUU0vb+yM+qE=; X-UUID: 3a3805386d9e41df86ecb192d8171346-20210812 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2090462678; Thu, 12 Aug 2021 23:56:46 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 Aug 2021 23:55:12 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Aug 2021 14:55:11 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:55:10 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , "Matthias Brugger" , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v2 11/29] iommu/mediatek: Always pm_runtime_get while tlb flush Date: Fri, 13 Aug 2021 14:53:06 +0800 Message-ID: <20210813065324.29220-12-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_235654_205951_7C7FCA35 X-CRM114-Status: GOOD ( 17.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Prepare for 2 HWs that sharing pgtable in different power-domains. The previous SoC don't have PM. Only mt8192 has power-domain, and it is display's power-domain which nearly always is enabled. When there are 2 M4U HWs, it may has problem. In this function, we get the pm_status via the m4u dev, but it don't reflect the real power-domain status of the HW since there may be other HW also use that power-domain. Currently we could not get the real power-domain status, thus always pm_runtime_get here. Prepare for mt8195, thus, no need fix tags here. This patch may drop the performance, we expect the user could pm_runtime_get_sync before dma_alloc_attrs which need tlb ops. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index add23a36a5e2..abc721a1da21 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -238,8 +238,11 @@ static void mtk_iommu_tlb_flush_range_sync(unsigned long iova, size_t size, for_each_m4u(data, head) { if (has_pm) { - if (pm_runtime_get_if_in_use(data->dev) <= 0) + ret = pm_runtime_resume_and_get(data->dev); + if (ret < 0) { + dev_err(data->dev, "tlb flush: pm get fail %d.\n", ret); continue; + } } spin_lock_irqsave(&data->tlb_lock, flags); -- 2.18.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel