]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: fix vio handshake issue
authorThomas Tai <thomas.tai@oracle.com>
Mon, 10 Jul 2017 16:55:55 +0000 (10:55 -0600)
committerAllen Pais <allen.pais@oracle.com>
Tue, 18 Jul 2017 12:25:00 +0000 (17:55 +0530)
When rebooting multiple LDoms together with bind/unbind a separate
LDom, kernel panic with vio handshake error. The panic is caused by
vio trying to allocate a buffer which is not freed properly. The
ldc_unbind should unconfigure and stop the ldc queue before freeing
the irq. If the irq is freed before stopping the queue, interrupts
can continue to happen after the irq is freed which may cause
issue.

Orabug: 26259622

Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
arch/sparc/kernel/ldc.c

index 87be2d13532cf714a5aee84ff4f53602e2bad6bd..10fdbe63bc897069d2884778be2e02eca7f57609 100644 (file)
@@ -1319,12 +1319,6 @@ EXPORT_SYMBOL(ldc_alloc);
 
 void ldc_unbind(struct ldc_channel *lp)
 {
-       if (lp->flags & LDC_FLAG_REGISTERED_IRQS) {
-               free_irq(lp->cfg.rx_irq, lp);
-               free_irq(lp->cfg.tx_irq, lp);
-               lp->flags &= ~LDC_FLAG_REGISTERED_IRQS;
-       }
-
        if (lp->flags & LDC_FLAG_REGISTERED_QUEUES) {
                sun4v_ldc_tx_qconf(lp->id, 0, 0);
                sun4v_ldc_rx_qconf(lp->id, 0, 0);
@@ -1335,6 +1329,11 @@ void ldc_unbind(struct ldc_channel *lp)
                free_queue(lp->rx_num_entries, lp->rx_base);
                lp->flags &= ~LDC_FLAG_ALLOCED_QUEUES;
        }
+       if (lp->flags & LDC_FLAG_REGISTERED_IRQS) {
+               free_irq(lp->cfg.rx_irq, lp);
+               free_irq(lp->cfg.tx_irq, lp);
+               lp->flags &= ~LDC_FLAG_REGISTERED_IRQS;
+       }
 
        ldc_set_state(lp, LDC_STATE_INIT);
 }