Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mailbox: mtk-cmdq: Add cmdq private data to cmdq_pkt for generating instruction

Add the cmdq_mbox_priv structure to store the private data of GCE,
such as the shift bits of the physical address. Then, include the
cmdq_mbox_priv structure within the cmdq_pkt structure.

This allows CMDQ users to utilize the private data in cmdq_pkt to
generate GCE instructions when needed. Additionally, having
cmdq_mbox_priv makes it easier to expand and reference other GCE
private data in the future.

Add cmdq_get_mbox_priv() for CMDQ users to get all the private data
into the cmdq_mbox_priv of the cmdq_pkt.

Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>

authored by

Jason-JH Lin and committed by
Jassi Brar
7d834d5c c2b69f71

+26
+8
drivers/mailbox/mtk-cmdq-mailbox.c
··· 104 104 return (dma_addr_t)addr << pdata->shift; 105 105 } 106 106 107 + void cmdq_get_mbox_priv(struct mbox_chan *chan, struct cmdq_mbox_priv *priv) 108 + { 109 + struct cmdq *cmdq = container_of(chan->mbox, struct cmdq, mbox); 110 + 111 + priv->shift_pa = cmdq->pdata->shift; 112 + } 113 + EXPORT_SYMBOL(cmdq_get_mbox_priv); 114 + 107 115 u8 cmdq_get_shift_pa(struct mbox_chan *chan) 108 116 { 109 117 struct cmdq *cmdq = container_of(chan->mbox, struct cmdq, mbox);
+18
include/linux/mailbox/mtk-cmdq-mailbox.h
··· 70 70 struct cmdq_pkt *pkt; 71 71 }; 72 72 73 + struct cmdq_mbox_priv { 74 + u8 shift_pa; 75 + }; 76 + 73 77 struct cmdq_pkt { 74 78 void *va_base; 75 79 dma_addr_t pa_base; 76 80 size_t cmd_buf_size; /* command occupied size */ 77 81 size_t buf_size; /* real buffer size */ 82 + struct cmdq_mbox_priv priv; /* for generating instruction */ 78 83 }; 84 + 85 + /** 86 + * cmdq_get_mbox_priv() - get the private data of mailbox channel 87 + * @chan: mailbox channel 88 + * @priv: pointer to store the private data of mailbox channel 89 + * 90 + * While generating the GCE instruction to command buffer, the private data 91 + * of GCE hardware may need to be referenced, such as the shift bits of 92 + * physical address. 93 + * 94 + * This function should be called before generating the GCE instruction. 95 + */ 96 + void cmdq_get_mbox_priv(struct mbox_chan *chan, struct cmdq_mbox_priv *priv); 79 97 80 98 /** 81 99 * cmdq_get_shift_pa() - get the shift bits of physical address