Skip to content

BYT: byt_irq_handler() is entered multiple times for a single IPC interrupt #1492

@keyonjie

Description

@keyonjie

On BYT, byt_irq_handler() is entered multiple times for a single IPC interrupt, as we don't mask the interrupt in time in the handler.

experiment patch and dmesg attached below:

diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c
index 2abf80b3eb52..307b4a03f4c5 100644
--- a/sound/soc/sof/intel/byt.c
+++ b/sound/soc/sof/intel/byt.c
@@ -189,6 +189,7 @@ static irqreturn_t byt_irq_handler(int irq, void *context)
 
        /* Interrupt arrived, check src */
        isr = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_ISRX);
+       printk(KERN_DEBUG "Keyon: %s, %d, isr:0x%llx\n", __func__, __LINE__, isr);
        if (isr & (SHIM_ISRX_DONE | SHIM_ISRX_BUSY))
                ret = IRQ_WAKE_THREAD;
 
@@ -203,10 +204,15 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
 
        imrx = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IMRX);
        ipcx = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCX);
+       ipcd = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCD);
+
+       printk(KERN_DEBUG "Keyon: %s, %d, imrx:0x%llx, ipcx:0x%llx, ipcd:0x%llx\n",
+              __func__, __LINE__, imrx, ipcx, ipcd);
 
        /* reply message from DSP */
        if (ipcx & SHIM_BYT_IPCX_DONE &&
            !(imrx & SHIM_IMRX_DONE)) {
+               printk(KERN_DEBUG "Keyon: %s, %d\n", __func__, __LINE__);
                /* Mask Done interrupt before first */
                snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR,
                                                   SHIM_IMRX,
@@ -231,9 +237,9 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
        }
 
        /* new message from DSP */
-       ipcd = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCD);
        if (ipcd & SHIM_BYT_IPCD_BUSY &&
            !(imrx & SHIM_IMRX_BUSY)) {
+               printk(KERN_DEBUG "Keyon: %s, %d\n", __func__, __LINE__);
                /* Mask Busy interrupt before return */
                snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR,
                                                   SHIM_IMRX,

dmesg logs during set volume IPC as below:

[    9.602493] sof-audio-acpi 808622A8:00: ipc tx: 0x50010000
[    9.602545] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602592] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602605] Keyon: byt_irq_thread, 210, imrx:0x0, ipcx:0x4000000000000000, ipcd:0x0
[    9.602609] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602617] Keyon: byt_irq_thread, 215
[    9.602626] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602687] Keyon: byt_irq_thread, 210, imrx:0x0, ipcx:0x0, ipcd:0x0
[    9.602699] sof-audio-acpi 808622A8:00: ipc tx succeeded: 0x50010000
[    9.602773] sof-audio-acpi 808622A8:00: ipc tx: 0x50010000
[    9.602884] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602950] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602971] Keyon: byt_irq_handler, 192, isr:0x1
[    9.602983] Keyon: byt_irq_thread, 210, imrx:0x0, ipcx:0x4000000000000000, ipcd:0x0
[    9.602986] Keyon: byt_irq_thread, 215
[    9.602997] Keyon: byt_irq_handler, 192, isr:0x1
[    9.603054] Keyon: byt_irq_thread, 210, imrx:0x0, ipcx:0x0, ipcd:0x0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions