linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: iommu@lists.linux-foundation.org, Yong Wu <yong.wu@mediatek.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-mediatek@lists.infradead.org (moderated list:MEDIATEK
	IOMMU DRIVER),
	linux-arm-kernel@lists.infradead.org (moderated
	list:ARM/Mediatek SoC support),
	linux-kernel@vger.kernel.org (open list),
	dafna.hirschfeld@collabora.com, kernel@collabora.com,
	linux-media@vger.kernel.org, sebastian.reichel@collabora.com
Subject: [PATCH v2 0/5] iommu/mediatek: Fix tlb flush logic
Date: Wed,  8 Dec 2021 14:07:39 +0200	[thread overview]
Message-ID: <20211208120744.2415-1-dafna.hirschfeld@collabora.com> (raw)

Often devices allocate DMA buffers before they do
runtime pm resume. This is the case for example with v4l2
devices where buffers are allocated during 'VIDIOC_REQBUFS`
and runtime resume happens later usually during 'VIDIOC_STREAMON'.
In such cases the partial tlb flush when allocating will fail
since the iommu is runtime suspended. This will print a warning
and try to do full flush. But there is actually no need to flush
the tlb before the consumer device is turned on.

Fix the warning by skipping partial flush when allocating and instead
do full flash in runtime resume.

In order to do full flush from the resume cb, the test:

if (pm_runtime_get_if_in_use(data->dev) <= 0)
	    continue;

needs to be removed from the flush all func since pm_runtime_get_if_in_use
returns 0 while resuming and will skip the flush


This patchset is a combination of 4 patches already sent in a different
patchset: [1] and a warning fix from Sebastian Reichel

[1] https://lore.kernel.org/linux-devicetree/20210923115840.17813-1-yong.wu@mediatek.com/

changes since v1:
-----------------

* Added preparation patches to remove the unneeded 'for_each_m4u' usage
and add a spinlock to protect access to tlb control registers.
* remove the pm runtime status check as explained above.
* refactor commit logs and inline doc
* move the call to full flush to the bottom of the resume cb after all registers are updated.


Sebastian Reichel (1):
  iommu/mediatek: Always check runtime PM status in tlb flush range
    callback

Yong Wu (4):
  iommu/mediatek: Remove for_each_m4u in tlb_sync_all
  iommu/mediatek: Remove the power status checking in tlb flush all
  iommu/mediatek: Add tlb_lock in tlb_flush_all
  iommu/mediatek: Always tlb_flush_all when each PM resume

 drivers/iommu/mtk_iommu.c | 42 ++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

-- 
2.17.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

             reply	other threads:[~2021-12-08 12:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 12:07 Dafna Hirschfeld [this message]
2021-12-08 12:07 ` [PATCH v2 1/5] iommu/mediatek: Remove for_each_m4u in tlb_sync_all Dafna Hirschfeld
2022-01-10 11:42   ` AngeloGioacchino Del Regno
2021-12-08 12:07 ` [PATCH v2 2/5] iommu/mediatek: Always check runtime PM status in tlb flush range callback Dafna Hirschfeld
2021-12-13  7:53   ` Yong Wu
2022-01-10 11:43   ` AngeloGioacchino Del Regno
2021-12-08 12:07 ` [PATCH v2 3/5] iommu/mediatek: Remove the power status checking in tlb flush all Dafna Hirschfeld
2022-01-10 11:43   ` AngeloGioacchino Del Regno
2021-12-08 12:07 ` [PATCH v2 4/5] iommu/mediatek: Add tlb_lock in tlb_flush_all Dafna Hirschfeld
2022-01-10 11:44   ` AngeloGioacchino Del Regno
2021-12-08 12:07 ` [PATCH v2 5/5] iommu/mediatek: Always tlb_flush_all when each PM resume Dafna Hirschfeld
2022-01-10 11:44   ` AngeloGioacchino Del Regno
2022-03-04 10:05 ` [PATCH v2 0/5] iommu/mediatek: Fix tlb flush logic Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211208120744.2415-1-dafna.hirschfeld@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=will@kernel.org \
    --cc=yong.wu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).