Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp768375ybh; Mon, 13 Jul 2020 00:05:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoDFFEj494R2e98k4ihFc7xQwVA44W4zHS7UIE906EjiEa3U8CxewbMBm4jg3pkRyIqV2c X-Received: by 2002:a17:906:494a:: with SMTP id f10mr76135027ejt.428.1594623922143; Mon, 13 Jul 2020 00:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594623922; cv=none; d=google.com; s=arc-20160816; b=oCnXdyGnwFweA5zZc4ckiFPHeEQ8AvbLmI5xElVHofOwD5uHgWhA57H64+UprEOaXa MZG/dDNlcZa02yLvDk0JMqxIfgELKZKIc4nLP7f50VfDZj+YDpfdBR7tAMqr9zTqTBey Zpt8HzN2HOhsG9xwAvllSSO/1xJ9WhRjr1Mt4dtd5iJzWOZsi/+GsnCm6CETG0AhDXuV 06C21NDHo4+dF3E0x2PFv8R9/JtNzN4PjXqe2pjmZxVDlSMUrFpjTD/dCwaa839xTDG5 NzdivHtz4m5f2v5LpJMePevTUgJRJiQEZjKcO8ot0cr7mCqbQ2WH5sFUHKY/JlnPX8df 0HqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9He2Y/cj2b1yofJp3r0tciWRU0GFm0a2fXfgV5d2ZsM=; b=MDjRJ5smi+ZPxExjUV87S8FzrGHor2YvP59C3lbVwy8UJkihGdZ6dbPa94H9twS+Bb BwMsqwvNT/dzHyq387OrTjs7TeejVorIcySkhQI17Wryvet3RU0AubDK3acW0eW+bEIa rSrl+arFgU/Iuw9osCjpsh2yy0FeEpnI1+d/TyX6aDTNVeq0oV2hGmYcmw/t0ThAdto0 on86/ARQzew9x8dF0dThZL0Gbqao4oVwe+YO2of0Xj5rYYY5uFht+Bd0+5fOTJ9STncb hfXN9LpEyUS0SvhnzXJTXRI2joksZrGvDVH9Cuj7+4ZHpR89t1cw6pKMNg6R34nyaGmA Wtrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oBSA29ZR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi2si8173703ejb.531.2020.07.13.00.04.58; Mon, 13 Jul 2020 00:05:22 -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; dkim=pass header.i=@chromium.org header.s=google header.b=oBSA29ZR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbgGMHEJ (ORCPT + 99 others); Mon, 13 Jul 2020 03:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbgGMHEJ (ORCPT ); Mon, 13 Jul 2020 03:04:09 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA505C061794 for ; Mon, 13 Jul 2020 00:04:08 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id a1so15042746ejg.12 for ; Mon, 13 Jul 2020 00:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9He2Y/cj2b1yofJp3r0tciWRU0GFm0a2fXfgV5d2ZsM=; b=oBSA29ZRXnyX5uNrdKdKimE/m7zWdZXNnhrXmKWKgnyN/SH230LhrcwzyL4D5IYCjQ q+j9awO4n+F2erswVyiQg/WMcIkxFh/IgNX4JZT8Q8aB3qp0IaeT4wjmr6f/xn1O58TX 4LtOfoBBudGY9551aEhRNWgZVLL5lJSfEBVd8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9He2Y/cj2b1yofJp3r0tciWRU0GFm0a2fXfgV5d2ZsM=; b=FMlJV2vfAdC+zopzUy4qHcXT9pTUs9/HmbLovFEUhCfArfBmSd27cliuJv5UYqsVoU 4Y1MszZV4+J531JKCxEnVneJz7Y6Gim+CaGwpdFLnlgrHzxUF1XR3xuPVj36pZorMsvr AfrgYhOB5DqgvG5DXE4jrLwXILR5tme2PV+M6zQq1aRQPXn+OPrhp70bjodxmcKfgzP1 OBb9mAJT/3oPYF1v4KZvK25MvnzAIag+i6bjxK3lP2Qu817kvAjLutth/wjBmpE2ojQh 0MoO2OimubHp2w4JoXDt6rx63OmtB+JncgUi+d/PeBgHx8qPeyG7P/0DUiiOYDOq8SUn A7Ww== X-Gm-Message-State: AOAM532ZFxqIwyaAZqnRDH3fo2GbZ6ZteHIdbwhWoC2l1zkS01O301ev a3aMVpdjUFYYO2WLfmCjCXsfBpxCOmVdNYiIlhsLcBPYZMs2bQ== X-Received: by 2002:a17:906:f117:: with SMTP id gv23mr43961935ejb.528.1594623847288; Mon, 13 Jul 2020 00:04:07 -0700 (PDT) MIME-Version: 1.0 References: <20200711064846.16007-1-yong.wu@mediatek.com> <20200711064846.16007-12-yong.wu@mediatek.com> In-Reply-To: <20200711064846.16007-12-yong.wu@mediatek.com> From: Pi-Hsun Shih Date: Mon, 13 Jul 2020 15:03:31 +0800 Message-ID: Subject: Re: [PATCH 11/21] iommu/mediatek: Add power-domain operation To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Rob Herring , Robin Murphy , Will Deacon , Evan Green , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream@mediatek.com, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , "moderated list:ARM/Mediatek SoC support" , iommu@lists.linux-foundation.org, =?UTF-8?B?WW91bGluIFBlaSAo6KO05Y+L5p6XKQ==?= , Nicolas Boichat , anan.sun@mediatek.com, cui.zhang@mediatek.com, chao.hao@mediatek.com, ming-fan.chen@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2020 at 2:51 PM Yong Wu wrote: > > In the previous SoC, the M4U HW is in the EMI power domain which is > always on. the latest M4U is in the display power domain which may be > turned on/off, thus we have to add pm_runtime interface for it. > > we should enable its power before M4U hw initial. and disable it after HW > initialize. > > When the engine work, the engine always enable the power and clocks for > smi-larb/smi-common, then the M4U's power will always be powered on > automatically via the device link with smi-common. > > Note: we don't enable the M4U power in iommu_map/unmap for tlb flush. > If its power already is on, of course it is ok. if the power is off, > the main tlb will be reset while M4U power on, thus the tlb flush while > m4u power off is unnecessary, just skip it. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 54 ++++++++++++++++++++++++++++++++++----- > 1 file changed, 47 insertions(+), 7 deletions(-) > ... > for_each_m4u(data) { > + /* skip tlb flush when pm is not active */ > + if (pm_runtime_enabled(data->dev) && > + !pm_runtime_active(data->dev)) > + continue; > + pm_runtime_active(dev) == false implies dev->power.disable_depth == 0, which implies pm_runtime_enabled(dev) == true, so the pm_runtime_enabled(data->dev) can be omitted here. > spin_lock_irqsave(&data->tlb_lock, flags); > writel_relaxed(F_INVLD_EN1 | F_INVLD_EN0, > data->base + data->plat_data->inv_sel_reg); > ...