Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4928464pxv; Tue, 29 Jun 2021 20:31:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu8q2oQZs3TLpWYw2SxEvjK5jcF9McjAH1Bv/JSlIXndW3Dsa4EMOQK08j/CsX+tcfbrL1 X-Received: by 2002:aa7:c996:: with SMTP id c22mr4040501edt.374.1625023911323; Tue, 29 Jun 2021 20:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625023911; cv=none; d=google.com; s=arc-20160816; b=Svpw/eaChdaAvPfKkyUFasx6AUR4zJvEpVDhKAwIYtvqPpzN7oyxB3LPzmBoLQhXJb K62jkZxfUfAzx0X4wO2/V+3dpjVZFH063cAFUlC6pE8QnE/2gSGkWDlTGNhaVE9S9U81 x/ZB99UtvkmFC1+HqK14QzchkMDS94rStbaVGxBC4dYxqwRGMqtpUU2Aei5b1RW8P35b uMOGTGCyj7SJZXJboYrfelfgV9veZVp3tqqhAFWvTN9NYGmm76lSKvl8GialzDWsPdVp IanJ3Cuu9jljNjoNVC+8Kixmr97I0m9239TSQnaZPwD0kEnbuDQcaY88UbUxoQ9euNza NiQw== 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=vb0fKbToahCMy8uEw9rRTtSuJcnS1nsSvYe64YEY39g=; b=tyky2VoZodgZuMccanDzMkz1LAGOlQR63Dhh4j1V1kMtvFa57+t30LJ56QgLlMQ9pt 4zuoF3w0RyakGB3xVeSlbkYViL2FhcF40i3AzCPC54dLH70t2GVJcehH8+rFql6k90J2 HZaMISFc1DPffTApjmRwBhYPDjRBG943aZ9wjcq8YLdRjJtsrqpRZPUYSpo0t0NiRSW2 JFU0mieTwn921zUpvbeiv6pMeYxXP1x9OC3gXio6TbQZjL6qefz5eBhp6utbCirTXIvl KwxeOvjtk4lsnwEAH1MhtKpvrfxjQ7N6LiYPDAeuCFPejHB6aZLkNTD9Yu7m6aK7Z6xC uRQg== 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 o23si387704edr.359.2021.06.29.20.31.10; Tue, 29 Jun 2021 20:31:51 -0700 (PDT) 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 S233148AbhF3CjG (ORCPT + 99 others); Tue, 29 Jun 2021 22:39:06 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:34431 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232990AbhF3CjG (ORCPT ); Tue, 29 Jun 2021 22:39:06 -0400 X-UUID: b4cb33e6b3634fb2a6ee3674bccd518a-20210630 X-UUID: b4cb33e6b3634fb2a6ee3674bccd518a-20210630 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 41645959; Wed, 30 Jun 2021 10:36:34 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Jun 2021 10:36:32 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Jun 2021 10:36:31 +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 09/24] iommu/mediatek: Always pm_runtime_get while tlb flush Date: Wed, 30 Jun 2021 10:34:49 +0800 Message-ID: <20210630023504.18177-10-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210630023504.18177-1-yong.wu@mediatek.com> References: <20210630023504.18177-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 In previous soc, some SoC don't have PM. Only mt8192 has power-domain, and it's display's power-domain which nearly always is enabled. When there are 2 M4U HW, 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 can not get the real power-domain status, thus I always pm_runtime_get here. This pach is only a preparing patch for 2 HW sharing pgtable in different power-domains, like mt8195 case. 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. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index ed3455b5cef0..fcf70787d3d1 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -231,7 +231,7 @@ 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) + if (pm_runtime_resume_and_get(data->dev) < 0) continue; } -- 2.18.0