Skip to content

Commit 946f179

Browse files
Dennis YC Hsiehmbgg
authored andcommitted
soc: mediatek: cmdq: add jump function
Add jump function so that client can jump to any address which contains instruction. Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com> Link: https://lore.kernel.org/r/1594136714-11650-8-git-send-email-dennis-yc.hsieh@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
1 parent 88a2ffc commit 946f179

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

drivers/soc/mediatek/mtk-cmdq-helper.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define CMDQ_POLL_ENABLE_MASK BIT(0)
1414
#define CMDQ_EOC_IRQ_EN BIT(0)
1515
#define CMDQ_REG_TYPE 1
16+
#define CMDQ_JUMP_RELATIVE 1
1617

1718
struct cmdq_instruction {
1819
union {
@@ -407,6 +408,18 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
407408
}
408409
EXPORT_SYMBOL(cmdq_pkt_assign);
409410

411+
int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
412+
{
413+
struct cmdq_instruction inst = {};
414+
415+
inst.op = CMDQ_CODE_JUMP;
416+
inst.offset = CMDQ_JUMP_RELATIVE;
417+
inst.value = addr >>
418+
cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan);
419+
return cmdq_pkt_append_command(pkt, inst);
420+
}
421+
EXPORT_SYMBOL(cmdq_pkt_jump);
422+
410423
int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
411424
{
412425
struct cmdq_instruction inst = { {0} };

include/linux/soc/mediatek/mtk-cmdq.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,17 @@ int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
252252
*/
253253
int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value);
254254

255+
/**
256+
* cmdq_pkt_jump() - Append jump command to the CMDQ packet, ask GCE
257+
* to execute an instruction that change current thread PC to
258+
* a physical address which should contains more instruction.
259+
* @pkt: the CMDQ packet
260+
* @addr: physical address of target instruction buffer
261+
*
262+
* Return: 0 for success; else the error code is returned
263+
*/
264+
int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr);
265+
255266
/**
256267
* cmdq_pkt_finalize() - Append EOC and jump command to pkt.
257268
* @pkt: the CMDQ packet

0 commit comments

Comments
 (0)