Repository navigation
Conversation
|
I did a basic function test and found no issue. |
| HDA_DSP_REG_ADSPIC, | ||
| HDA_DSP_ADSPIC_IPC, 0); | ||
| ret = IRQ_WAKE_THREAD; | ||
| spin_unlock(&sdev->hw_lock); |
There was a problem hiding this comment.
careful with the unlock. we could have an IPC and SoundWire interrupt at the same time (different registers used for status), so the two if cases are not mutually exclusive in corner cases
There was a problem hiding this comment.
Thanks for the reminding, now I separate the handler and thread. So no problem here now.
| ret = request_threaded_irq(sdev->ipc_irq, hda_dsp_ipc_irq_handler, | ||
| sof_ops(sdev)->irq_thread, IRQF_SHARED, | ||
| ret = request_threaded_irq(sdev->ipc_irq, NULL, | ||
| hda_dsp_ipc_irq_handler, IRQF_SHARED, |
There was a problem hiding this comment.
sorry I don't get this one. this would mean we use a generic handler and the current handler becomes a thread?
Is this needed?
There was a problem hiding this comment.
Yeah, I thought there are no other interrupt share the irq and want to do a quick test yesterday. Now I change it back as it is.
| return IRQ_NONE; | ||
| return false; | ||
| } | ||
| EXPORT_SYMBOL(is_sdw_intel_irq); |
There was a problem hiding this comment.
maybe a static inline instead?
| HDA_DSP_ADSPIC_IPC, 0); | ||
| ret = IRQ_WAKE_THREAD; | ||
| spin_unlock(&sdev->hw_lock); | ||
| sof_ops(sdev)->irq_thread(irq, context); |
There was a problem hiding this comment.
The sof_ops(sdev)->irq_thread was the irq thread in request_thread_irq(). So we have to call it in the irq thread.
|
@bardliao please check the interrupt design in Linux. handler is in interrupt context and the PCI |
18c255a to
259ceb3
Compare
259ceb3 to
43ec27c
Compare
Thanks @RanderWang I separate the irq handler and thread in the updated version. :) |
f417f1c to
fcf05e1
Compare
| sof_ops(sdev)->irq_thread(irq, context); | ||
|
|
||
| if (sdev->irq_event & SOF_IRQ_SDW) | ||
| sdw_intel_thread(irq, hdev->sdw); |
There was a problem hiding this comment.
@bardliao I understand the intention here but the naming is incorrent. hda_dsp_irq_thread() is the IRQ thread, sof_ops(sdev)->irq_thread() and sdw_intel_thread() are not threads but just normal methods. So I think we should remove the "thread" from their names.
There was a problem hiding this comment.
@bardliao I understand the intention here but the naming is incorrent. hda_dsp_irq_thread() is the IRQ thread, sof_ops(sdev)->irq_thread() and sdw_intel_thread() are not threads but just normal methods. So I think we should remove the "thread" from their names.
@ranj063 I agree with you. I have a concern regarding sof_ops(sdev)->irq_thread(). Is there anywhere use sof_ops(sdev)->irq_thread() except here? And it looks confusing, too if we remove the _thread suffix. i.e. sof_ops(sdev)->irq. irq_handler may be a better name, but we already have it. Do you have any suggestion for irq_thread?
|
@bardliao the commit message is very sparse. Why do we need to merge the 2 interrupts? What advantage does it bring? |
we still see IPC issues with SoundWire, that go way if we disable MSI. We did improve the results by merging 4 SoundWire handlers into one, this is an attempt to go further and have a single handler for all interrupts. |
@plbossart what confuses me is that even if you had separate IRQ handlers for the SDW and IPC interrupts, they will both get invoked when an interrupt is raised. Why does it help to service them in one handler? Is there a race because of the order the 2 interrupt handlers get invoked? |
We have no idea how edge interrupts like MSI are handled if you have multiple handlers. It just works better if we avoid this in the first place. |
43ec27c to
2c007d8
Compare
eff3c3c to
8085159
Compare
| { | ||
| u32 int_status; | ||
|
|
||
| int_status = readl(ctx->mmio_base + 0x14); |
There was a problem hiding this comment.
@plbossart HDA_DSP_REG_ADSPIS2 is defined at sound/soc/sof/intel/hda.h, but we don't include hda.h in soundwire driver. I am not sure include hda.h in sdw_intel.h is a good idea or not. If we just add the HDA_DSP_REG_ADSPIS2 define in sdw_intel.h, we will see redefine warning in compiling. Or we can define another name for HDA_DSP_REG_ADSPIS2 in sdw_intel.h?
There was a problem hiding this comment.
just redefine them SDW_ADSPIC2 and SDW_ADSIS2. that's fine.
| u32 int_status; | ||
|
|
||
| int_status = readl(ctx->mmio_base + 0x14); | ||
| if (int_status & BIT(5)) |
| snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, | ||
| HDA_DSP_REG_ADSPIC, | ||
| HDA_DSP_ADSPIC_IPC, 0); | ||
| sdev->irq_event |= SOF_IRQ_IPC; |
There was a problem hiding this comment.
the use of a field that's set in the handler is problematic. We know we can have new interrupts before the thread is scheduled (that's e.g. how SoundWire handled the commands before, with the wait_for_completion in the thread and the complete() bin the handler
So it's possible that while you have an SoundWire thread scheduled an IPC interrupt quicks in, and you would reset sdev->irq_event.
I don't think this can work...
So we can use single irq to handle both ipc and sdw interrupts. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2c007d8 to
13f05a2
Compare
|
replaced by #1451 which is on top of integration/soundwire-debug-fixes. |
So we can use single irq to handle both ipc and sdw interrupts.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com