* [PATCH v1 0/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec"
@ 2021-03-10 7:42 Yongqiang Niu
2021-03-10 7:42 ` [PATCH v1 1/2] Revert "drm/mediatek: Make sure previous message done or be aborted before send" Yongqiang Niu
2021-03-10 7:42 ` [PATCH v1 2/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
0 siblings, 2 replies; 4+ messages in thread
From: Yongqiang Niu @ 2021-03-10 7:42 UTC (permalink / raw)
To: Rob Herring, Matthias Brugger, CK Hu
Cc: Jassi Brar, Bibby Hsieh, Yongqiang Niu, Dennis YC Hsieh,
devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group
This series base linux 5.12-rc1
these two patches will cause home ui flick when cursor moved,
there is no fix solution yet, revert these patches first.
Yongqiang Niu (2):
Revert "drm/mediatek: Make sure previous message done or be aborted
before send"
Revert "mailbox: mediatek: remove implementation related to
atomic_exec"
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 -
drivers/mailbox/mtk-cmdq-mailbox.c | 80 +++++++++++++++++++++++++++++----
2 files changed, 71 insertions(+), 10 deletions(-)
--
1.8.1.1.dirty
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/2] Revert "drm/mediatek: Make sure previous message done or be aborted before send"
2021-03-10 7:42 [PATCH v1 0/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
@ 2021-03-10 7:42 ` Yongqiang Niu
2021-03-10 7:42 ` [PATCH v1 2/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
1 sibling, 0 replies; 4+ messages in thread
From: Yongqiang Niu @ 2021-03-10 7:42 UTC (permalink / raw)
To: Rob Herring, Matthias Brugger, CK Hu
Cc: Jassi Brar, Bibby Hsieh, Yongqiang Niu, Dennis YC Hsieh,
devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group
This reverts commit 839cbf0531428f3f9535077a461b8631359c1165.
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 8b0de90..c76f446 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -463,7 +463,6 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
}
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
if (mtk_crtc->cmdq_client) {
- mbox_flush(mtk_crtc->cmdq_client->chan, 2000);
cmdq_handle = cmdq_pkt_create(mtk_crtc->cmdq_client, PAGE_SIZE);
cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event);
cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, false);
--
1.8.1.1.dirty
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec"
2021-03-10 7:42 [PATCH v1 0/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
2021-03-10 7:42 ` [PATCH v1 1/2] Revert "drm/mediatek: Make sure previous message done or be aborted before send" Yongqiang Niu
@ 2021-03-10 7:42 ` Yongqiang Niu
2021-03-10 10:04 ` kernel test robot
1 sibling, 1 reply; 4+ messages in thread
From: Yongqiang Niu @ 2021-03-10 7:42 UTC (permalink / raw)
To: Rob Herring, Matthias Brugger, CK Hu
Cc: Jassi Brar, Bibby Hsieh, Yongqiang Niu, Dennis YC Hsieh,
devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group
This reverts commit c9ea564f3d9dd20d88bd34f40a6ff6d31a0d7e8c.
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com
---
drivers/mailbox/mtk-cmdq-mailbox.c | 80 +++++++++++++++++++++++++++++++++-----
1 file changed, 71 insertions(+), 9 deletions(-)
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index 5665b6e..1eac05f 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -56,6 +56,7 @@ struct cmdq_thread {
void __iomem *base;
struct list_head task_busy_list;
u32 priority;
+ bool atomic_exec;
};
struct cmdq_task {
@@ -168,18 +169,56 @@ static void cmdq_task_insert_into_thread(struct cmdq_task *task)
dma_sync_single_for_cpu(dev, prev_task->pa_base,
prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
prev_task_base[CMDQ_NUM_CMD(prev_task->pkt) - 1] =
- (u64)CMDQ_JUMP_BY_PA << 32 | task->pa_base;
+ (u64)CMDQ_JUMP_BY_PA << 32 |
+ (task->pa_base >> cmdq->shift_pa);
dma_sync_single_for_device(dev, prev_task->pa_base,
prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
cmdq_thread_invalidate_fetched_data(thread);
}
+static bool cmdq_command_is_wfe(u64 cmd)
+{
+ u64 wfe_option = CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE;
+ u64 wfe_op = (u64)(CMDQ_CODE_WFE << CMDQ_OP_CODE_SHIFT) << 32;
+ u64 wfe_mask = (u64)CMDQ_OP_CODE_MASK << 32 | 0xffffffff;
+
+ return ((cmd & wfe_mask) == (wfe_op | wfe_option));
+}
+
+/* we assume tasks in the same display GCE thread are waiting the same event. */
+static void cmdq_task_remove_wfe(struct cmdq_task *task)
+{
+ struct device *dev = task->cmdq->mbox.dev;
+ u64 *base = task->pkt->va_base;
+ int i;
+
+ dma_sync_single_for_cpu(dev, task->pa_base, task->pkt->cmd_buf_size,
+ DMA_TO_DEVICE);
+ for (i = 0; i < CMDQ_NUM_CMD(task->pkt); i++)
+ if (cmdq_command_is_wfe(base[i]))
+ base[i] = (u64)CMDQ_JUMP_BY_OFFSET << 32 |
+ (CMDQ_JUMP_PASS >> task->cmdq->shift_pa);
+ dma_sync_single_for_device(dev, task->pa_base, task->pkt->cmd_buf_size,
+ DMA_TO_DEVICE);
+}
+
static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread)
{
return readl(thread->base + CMDQ_THR_WAIT_TOKEN) & CMDQ_THR_IS_WAITING;
}
+static void cmdq_thread_wait_end(struct cmdq_thread *thread,
+ unsigned long end_pa)
+{
+ struct device *dev = thread->chan->mbox->dev;
+ unsigned long curr_pa;
+
+ if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_CURR_ADDR,
+ curr_pa, curr_pa == end_pa, 1, 20))
+ dev_err(dev, "GCE thread cannot run to end.\n");
+}
+
static void cmdq_task_exec_done(struct cmdq_task *task, enum cmdq_cb_status sta)
{
struct cmdq_task_cb *cb = &task->pkt->async_cb;
@@ -371,15 +410,37 @@ static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
cmdq->shift_pa;
end_pa = readl(thread->base + CMDQ_THR_END_ADDR) <<
cmdq->shift_pa;
- /* check boundary */
- if (curr_pa == end_pa - CMDQ_INST_SIZE ||
- curr_pa == end_pa) {
- /* set to this task directly */
- writel(task->pa_base >> cmdq->shift_pa,
- thread->base + CMDQ_THR_CURR_ADDR);
+
+ /*
+ * Atomic execution should remove the following wfe, i.e. only
+ * wait event at first task, and prevent to pause when running.
+ */
+ if (thread->atomic_exec) {
+ /* GCE is executing if command is not WFE */
+ if (!cmdq_thread_is_in_wfe(thread)) {
+ cmdq_thread_resume(thread);
+ cmdq_thread_wait_end(thread,
+ end_pa >> cmdq->shift_pa);
+ WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
+ /* set to this task directly */
+ writel(task->pa_base >> cmdq->shift_pa,
+ thread->base + CMDQ_THR_CURR_ADDR);
+ } else {
+ cmdq_task_insert_into_thread(task);
+ cmdq_task_remove_wfe(task);
+ smp_mb(); /* modify jump before enable thread */
+ }
} else {
- cmdq_task_insert_into_thread(task);
- smp_mb(); /* modify jump before enable thread */
+ /* check boundary */
+ if (curr_pa == end_pa - CMDQ_INST_SIZE ||
+ curr_pa == end_pa) {
+ /* set to this task directly */
+ writel(task->pa_base >> cmdq->shift_pa,
+ thread->base + CMDQ_THR_CURR_ADDR);
+ } else {
+ cmdq_task_insert_into_thread(task);
+ smp_mb(); /* modify jump before enable thread */
+ }
}
writel((task->pa_base + pkt->cmd_buf_size) >> cmdq->shift_pa,
thread->base + CMDQ_THR_END_ADDR);
@@ -500,6 +561,7 @@ static struct mbox_chan *cmdq_xlate(struct mbox_controller *mbox,
thread = (struct cmdq_thread *)mbox->chans[ind].con_priv;
thread->priority = sp->args[1];
+ thread->atomic_exec = (sp->args[2] != 0);
thread->chan = &mbox->chans[ind];
return &mbox->chans[ind];
--
1.8.1.1.dirty
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 2/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec"
2021-03-10 7:42 ` [PATCH v1 2/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
@ 2021-03-10 10:04 ` kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-03-10 10:04 UTC (permalink / raw)
To: Yongqiang Niu, Rob Herring, Matthias Brugger, CK Hu
Cc: kbuild-all, Jassi Brar, Bibby Hsieh, Yongqiang Niu,
Dennis YC Hsieh, devicetree, linux-arm-kernel, linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 2990 bytes --]
Hi Yongqiang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.12-rc2 next-20210310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yongqiang-Niu/Revert-mailbox-mediatek-remove-implementation-related-to-atomic_exec/20210310-154512
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 05a59d79793d482f628a31753c671f2e92178a21
config: microblaze-randconfig-r011-20210308 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/876bcec7aee51ac5f6f0697523f91a72b85d6a5d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yongqiang-Niu/Revert-mailbox-mediatek-remove-implementation-related-to-atomic_exec/20210310-154512
git checkout 876bcec7aee51ac5f6f0697523f91a72b85d6a5d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/mailbox/mtk-cmdq-mailbox.c: In function 'cmdq_task_insert_into_thread':
>> drivers/mailbox/mtk-cmdq-mailbox.c:173:21: error: 'cmdq' undeclared (first use in this function)
173 | (task->pa_base >> cmdq->shift_pa);
| ^~~~
drivers/mailbox/mtk-cmdq-mailbox.c:173:21: note: each undeclared identifier is reported only once for each function it appears in
vim +/cmdq +173 drivers/mailbox/mtk-cmdq-mailbox.c
159
160 static void cmdq_task_insert_into_thread(struct cmdq_task *task)
161 {
162 struct device *dev = task->cmdq->mbox.dev;
163 struct cmdq_thread *thread = task->thread;
164 struct cmdq_task *prev_task = list_last_entry(
165 &thread->task_busy_list, typeof(*task), list_entry);
166 u64 *prev_task_base = prev_task->pkt->va_base;
167
168 /* let previous task jump to this task */
169 dma_sync_single_for_cpu(dev, prev_task->pa_base,
170 prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
171 prev_task_base[CMDQ_NUM_CMD(prev_task->pkt) - 1] =
172 (u64)CMDQ_JUMP_BY_PA << 32 |
> 173 (task->pa_base >> cmdq->shift_pa);
174 dma_sync_single_for_device(dev, prev_task->pa_base,
175 prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
176
177 cmdq_thread_invalidate_fetched_data(thread);
178 }
179
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31533 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-10 10:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 7:42 [PATCH v1 0/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
2021-03-10 7:42 ` [PATCH v1 1/2] Revert "drm/mediatek: Make sure previous message done or be aborted before send" Yongqiang Niu
2021-03-10 7:42 ` [PATCH v1 2/2] Revert "mailbox: mediatek: remove implementation related to atomic_exec" Yongqiang Niu
2021-03-10 10:04 ` kernel test robot
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).