Skip to contentSkip to conversation

drm/omap: Workaround for errata i878

PATCH Superseded Peter Ujfalusi 2 participants 5 messages Apr 10, 2018 – May 23, 2018

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover drm/omap: Workaround for errata i878

Hi,

Changes since v2:
- Use threaded irq when the i878 workaround is used to avoid unlikely system
freeze: dma_sync_wait() have 5 second timeout
- Use mutex instead of spinlock as wa_lock
- use the dmaengine_prep_dma_memcpy() wrapper
- do not explicitly call dma_async_issue_pending() as it is done as part of dma_sync_wait()
- Use define for the DMM register size (4 bytes)
- Cleanup patch for the remove path: no need to check if the irq is valid. The driver would not probe w/o valid interrupt.

Changes since v1:
- rebased on drm-next
- comments for the v1 (https://patchwork.kernel.org/patch/8358741/) addressed
- u32 -> dma_addr_t when applicable
- additional wmb()/rmb() added to make sure we have correct behavior

Errata i878 says that MPU should not be used to access RAM and DMM at the same time. As it's not possible to prevent MPU accessing RAM, we need to access DMM via a proxy.

Regards,
Peter
---
Peter Ujfalusi (1):
drm/omap: dmm_tiler: No need to check if irq is valid in
omap_dmm_remove

Tomi Valkeinen (2):
dt-bindings: arm: omap: dmm: Document new compatible for DRA7xx family drm/omap: partial workaround for DRA7xx DMM errata i878

 .../devicetree/bindings/arm/omap/dmm.txt      |   3 +-
 drivers/gpu/drm/omapdrm/omap_dmm_priv.h       |   8 +
 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c      | 164 +++++++++++++++++-
 3 files changed, 168 insertions(+), 7 deletions(-)
Signature · 9 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v3 1/3 drm/omap: dmm_tiler: No need to check if irq is valid in omap_dmm_remove

The driver probe would fail if the irq is not available.

---
 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +1 -2
index e84871e74615..8671d06c0eb4 100644
@@ -632,8 +632,7 @@ static int omap_dmm_remove(struct platform_device *dev)
 		if (omap_dmm->dummy_page)
 			__free_page(omap_dmm->dummy_page);
 
-		if (omap_dmm->irq > 0)
-			free_irq(omap_dmm->irq, omap_dmm);
+		free_irq(omap_dmm->irq, omap_dmm);
 
 		iounmap(omap_dmm->base);
 		kfree(omap_dmm);
Signature · 9 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH v3 2/3 dt-bindings: arm: omap: dmm: Document new compatible for DRA7xx family

In reply to Peter Ujfalusi

From: Tomi Valkeinen <[email protected]>

Define unique compatible string for the DMM in DRA7xx family.

The new compatible can be used to apply DRA7xx specific workarounds for ERRATAs, like i878 (MPU Lockup with concurrent DMM and EMIF accesses)

---
 Documentation/devicetree/bindings/arm/omap/dmm.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/omap/dmm.txt +2 -1
index 8bd6d0a238a8..bbbe7cdba30c 100644
@@ -8,7 +8,8 @@ translation for initiators which need contiguous dma bus addresses.
 
 Required properties:
 - compatible:	Should contain "ti,omap4-dmm" for OMAP4 family
-		Should contain "ti,omap5-dmm" for OMAP5 and DRA7x family
+		Should contain "ti,omap5-dmm" for OMAP5 family
+		Should contain "ti,dra7-dmm" for DRA7xx family
 - reg:		Contains DMM register address range (base address and length)
 - interrupts:	Should contain an interrupt-specifier for DMM_IRQ.
 - ti,hwmods:	Name of the hwmod associated to DMM, which is typically "dmm"
Signature · 9 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH v3 2/3] dt-bindings: arm: omap: dmm: Document new compatible for DRA7xx family

Quoted 21 lines · Peter Ujfalusi

From: Tomi Valkeinen <[email protected]>

Define unique compatible string for the DMM in DRA7xx family.

The new compatible can be used to apply DRA7xx specific workarounds for ERRATAs, like i878 (MPU Lockup with concurrent DMM and EMIF accesses)

---
 Documentation/devicetree/bindings/arm/omap/dmm.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/omap/dmm.txt +0 -0
index 8bd6d0a238a8..bbbe7cdba30c 100644

Documentation/devicetree/bindings/arm/omap/dmm.txt translation for initiators which need contiguous dma bus addresses. · line 15

Quoted 9 lines
Documentation/devicetree/bindings/arm/omap/dmm.txt +2 -1
@@ -8,7 +8,8 @@ translation for initiators which need contiguous dma bus addresses.
 
 Required properties:
 - compatible:	Should contain "ti,omap4-dmm" for OMAP4 family
-		Should contain "ti,omap5-dmm" for OMAP5 and DRA7x family
+		Should contain "ti,omap5-dmm" for OMAP5 family
+		Should contain "ti,dra7-dmm" for DRA7xx family
 - reg:		Contains DMM register address range (base address and length)
 - interrupts:	Should contain an interrupt-specifier for DMM_IRQ.
 - ti,hwmods:	Name of the hwmod associated to DMM, which is typically "dmm"

Thinking about this now, wouldn't it be better to add a DT property to enable the work-around? Or we could use soc_device_match() to figure out that this is a DRA7 SoC.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH v3 3/3 drm/omap: partial workaround for DRA7xx DMM errata i878

In reply to Peter Ujfalusi

From: Tomi Valkeinen <[email protected]>

Errata i878 says that MPU should not be used to access RAM and DMM at the same time. As it's not possible to prevent MPU accessing RAM, we need to access DMM via a proxy.

This patch changes:
- DMM driver to access DMM registers via sDMA. Instead of doing a normal readl/writel call to read/write a register, we use sDMA to copy 4 bytes from/to the DMM registers.
- When the i878 workaround is needed we use threaded irq. It is not a good practice to busy loop for completion of the DMA register access in the interrupt handler. The DMA transfer should not take long time to complete, but if something prevents the transfer to be completed we might end up waiting for 5 seconds.

This patch provides only a partial workaround for i878, as not only DMM register reads/writes are affected, but also accesses to the DMM mapped buffers (framebuffers, usually).

---
 drivers/gpu/drm/omapdrm/omap_dmm_priv.h  |   8 ++
 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 161 ++++++++++++++++++++++-
 2 files changed, 165 insertions(+), 4 deletions(-)
drivers/gpu/drm/omapdrm/omap_dmm_priv.h +8 -0
index c2785cc98dc9..a0164652db1e 100644
@@ -155,10 +155,12 @@ struct refill_engine {
 
 struct dmm_platform_data {
 	u32 cpu_cache_flags;
+	bool errata_i878_wa;
 };
 
 struct dmm {
 	struct device *dev;
+	dma_addr_t phys_base;
 	void __iomem *base;
 	int irq;
 
@@ -189,6 +191,12 @@ struct dmm {
 	struct list_head alloc_head;
 
 	const struct dmm_platform_data *plat_data;
+
+	bool dmm_workaround;
+	struct mutex wa_lock;
+	u32 *wa_dma_data;
+	dma_addr_t wa_dma_handle;
+	struct dma_chan *wa_dma_chan;
 };
 
 #endif
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +157 -4

227 lines not on this page · raw message

Signature · 9 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel