linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] iommu/mediatek: Fix tlb flush logic
@ 2021-12-08 12:07 Dafna Hirschfeld
  2021-12-08 12:07 ` [PATCH v2 1/5] iommu/mediatek: Remove for_each_m4u in tlb_sync_all Dafna Hirschfeld
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Dafna Hirschfeld @ 2021-12-08 12:07 UTC (permalink / raw)
  To: iommu, Yong Wu, Joerg Roedel, Will Deacon, Matthias Brugger,
	moderated list:MEDIATEK IOMMU DRIVER,
	moderated list:ARM/Mediatek SoC support, open list,
	dafna.hirschfeld, kernel, linux-media, sebastian.reichel

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-03-04 10:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 12:07 [PATCH v2 0/5] iommu/mediatek: Fix tlb flush logic Dafna Hirschfeld
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

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).