Skip to content

Commit 408ec8e

Browse files
cyndisthierryreding
authored andcommitted
drm/tegra: falcon: Pipeline firmware copy
The Falcon DMA engine allows queueing multiple operations for improved performance. Do this to optimize firmware loading. A performance improvement of 4x to 6x is observed. Co-developed-by: Ivan Raul Guadarrama <[email protected]> Signed-off-by: Ivan Raul Guadarrama <[email protected]> Signed-off-by: Mikko Perttunen <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 61a8588 commit 408ec8e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

drivers/gpu/drm/tegra/falcon.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ int falcon_wait_idle(struct falcon *falcon)
3030
(value == 0), 10, 100000);
3131
}
3232

33+
static int falcon_dma_wait_not_full(struct falcon *falcon)
34+
{
35+
u32 value;
36+
37+
return readl_poll_timeout(falcon->regs + FALCON_DMATRFCMD, value,
38+
!(value & FALCON_DMATRFCMD_FULL), 10, 100000);
39+
}
40+
3341
static int falcon_dma_wait_idle(struct falcon *falcon)
3442
{
3543
u32 value;
@@ -44,6 +52,7 @@ static int falcon_copy_chunk(struct falcon *falcon,
4452
enum falcon_memory target)
4553
{
4654
u32 cmd = FALCON_DMATRFCMD_SIZE_256B;
55+
int err;
4756

4857
if (target == FALCON_MEMORY_IMEM)
4958
cmd |= FALCON_DMATRFCMD_IMEM;
@@ -56,11 +65,15 @@ static int falcon_copy_chunk(struct falcon *falcon,
5665
*/
5766
cmd |= FALCON_DMATRFCMD_DMACTX(1);
5867

68+
err = falcon_dma_wait_not_full(falcon);
69+
if (err < 0)
70+
return err;
71+
5972
falcon_writel(falcon, offset, FALCON_DMATRFMOFFS);
6073
falcon_writel(falcon, base, FALCON_DMATRFFBOFFS);
6174
falcon_writel(falcon, cmd, FALCON_DMATRFCMD);
6275

63-
return falcon_dma_wait_idle(falcon);
76+
return 0;
6477
}
6578

6679
static void falcon_copy_firmware_image(struct falcon *falcon,
@@ -191,6 +204,11 @@ int falcon_boot(struct falcon *falcon)
191204
falcon_copy_chunk(falcon, falcon->firmware.code.offset + offset,
192205
offset, FALCON_MEMORY_IMEM);
193206

207+
/* wait for DMA to complete */
208+
err = falcon_dma_wait_idle(falcon);
209+
if (err < 0)
210+
return err;
211+
194212
/* setup falcon interrupts */
195213
falcon_writel(falcon, FALCON_IRQMSET_EXT(0xff) |
196214
FALCON_IRQMSET_SWGEN1 |

drivers/gpu/drm/tegra/falcon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#define FALCON_DMATRFMOFFS 0x00001114
4848

4949
#define FALCON_DMATRFCMD 0x00001118
50+
#define FALCON_DMATRFCMD_FULL (1 << 0)
5051
#define FALCON_DMATRFCMD_IDLE (1 << 1)
5152
#define FALCON_DMATRFCMD_IMEM (1 << 4)
5253
#define FALCON_DMATRFCMD_SIZE_256B (6 << 8)

0 commit comments

Comments
 (0)