Skip to content

Commit e36f4a7

Browse files
sudeep-hollagregkh
authored andcommitted
mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone
commit 33cd712 upstream Currently the mailbox framework sets txdone_method to TXDONE_BY_POLL if the controller sets txdone_by_poll. However some clients can have a mechanism to do TXDONE_BY_ACK which they can specify by knows_txdone. However, we endup setting both TXDONE_BY_POLL and TXDONE_BY_ACK in that case. In such scenario, we may end up with below warnings as the tx ticker is run both by mailbox framework and the client. WARNING: CPU: 1 PID: 0 at kernel/time/hrtimer.c:805 hrtimer_forward+0x88/0xd8 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.12.0-rc5 torvalds#242 Hardware name: ARM LTD ARM Juno Development Platform task: ffff8009768ca700 task.stack: ffff8009768f8000 PC is at hrtimer_forward+0x88/0xd8 LR is at txdone_hrtimer+0xd4/0xf8 Call trace: hrtimer_forward+0x88/0xd8 __hrtimer_run_queues+0xe4/0x158 hrtimer_interrupt+0xa4/0x220 arch_timer_handler_phys+0x30/0x40 handle_percpu_devid_irq+0x78/0x130 generic_handle_irq+0x24/0x38 __handle_domain_irq+0x5c/0xb8 gic_handle_irq+0x54/0xa8 This patch fixes the issue by resetting TXDONE_BY_POLL if client has set knows_txdone. Cc: Alexey Klimov <alexey.klimov@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3f2beab commit e36f4a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/mailbox/mailbox.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
351351
init_completion(&chan->tx_complete);
352352

353353
if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone)
354-
chan->txdone_method |= TXDONE_BY_ACK;
354+
chan->txdone_method = TXDONE_BY_ACK;
355355

356356
spin_unlock_irqrestore(&chan->lock, flags);
357357

@@ -420,7 +420,7 @@ void mbox_free_channel(struct mbox_chan *chan)
420420
spin_lock_irqsave(&chan->lock, flags);
421421
chan->cl = NULL;
422422
chan->active_req = NULL;
423-
if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK))
423+
if (chan->txdone_method == TXDONE_BY_ACK)
424424
chan->txdone_method = TXDONE_BY_POLL;
425425

426426
module_put(chan->mbox->dev->driver->owner);

drivers/mailbox/pcc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
266266
init_completion(&chan->tx_complete);
267267

268268
if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone)
269-
chan->txdone_method |= TXDONE_BY_ACK;
269+
chan->txdone_method = TXDONE_BY_ACK;
270270

271271
spin_unlock_irqrestore(&chan->lock, flags);
272272

@@ -312,7 +312,7 @@ void pcc_mbox_free_channel(struct mbox_chan *chan)
312312
spin_lock_irqsave(&chan->lock, flags);
313313
chan->cl = NULL;
314314
chan->active_req = NULL;
315-
if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK))
315+
if (chan->txdone_method == TXDONE_BY_ACK)
316316
chan->txdone_method = TXDONE_BY_POLL;
317317

318318
spin_unlock_irqrestore(&chan->lock, flags);

0 commit comments

Comments
 (0)