Skip to content

Fix IPC timeout issue on APL&CNL - #28

Merged
plbossart merged 8 commits into
thesofproject:topic/sof-devfrom
RanderWang:ipx_fix
Jul 11, 2018
Merged

plbossart merged 8 commits into
thesofproject:topic/sof-devfrom
RanderWang:ipx_fix

Conversation

@RanderWang

Copy link
Copy Markdown

I fix merge conflict issue on latest code

The IPC algorithm depends on the status of snd_sof_ipc_reply.
The failed case is processed different with success one

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
There are two direction now in cmd_done, one is reply of host to DSP,
another is reply of DSP to host.The origin cmd_done is for reply of
host to DSP.

Cmd_done should be called after host has processed the reply msg
from dsp. This function is for some platforms to do extra steps to
make the following ipc msgs sent safely. Now the direction supported
by cmd_done would be host reply to dsp or dsp reply to host.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Refine the implementation of is_dsp_ready on APL&CNL
BUSY bit means dsp is ready, DONE bit means host has
processed the reply msg. The next ipc msg should check
both bits to make sure both dsp and host is ready

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix multi-line comment issues.
Also please explain what you do with the results from snd_sof_ipc_reply(). It looks like you are executing the test cases only when there is an error, not sure if this is really what you intended - or the comments are not self-explanatory

Comment thread sound/soc/sof/intel/hda-ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: fix multi-line comments

Comment thread sound/soc/sof/intel/hda-ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment style here as well

Comment thread sound/soc/sof/intel/hda-ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snd_soc_ipc_reply returns 0 or -EINVAL, the 1 isn't incorrect but misleading. Change to -EINVAL for consistency?

@RanderWang RanderWang Jul 10, 2018 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change it to -EINVAL

Comment thread sound/soc/sof/intel/hda-ipc.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this what you want to do when the reply is -EINVAL?

@RanderWang RanderWang Jul 10, 2018 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if the return value is 0, the cmd_done would be called at the end of msg processing function.
But if is -EINVAL, no msg processing function would be called, so it could be called at here to make interrupt status correct in dsp

Comment thread sound/soc/sof/intel/cnl.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiline-comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will refine it

Comment thread sound/soc/sof/intel/cnl.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as for APL, this is done when the snd_soc_ipc_reply returns -EINVAL, is this intentional?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is for unknown msgs

Comment thread sound/soc/sof/intel/cnl.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multi-line comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refine it

Comment thread sound/soc/sof/intel/hsw.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multi-line comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refine it

Comment thread sound/soc/sof/intel/hsw.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multi-line comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refine it

Comment thread sound/soc/sof/intel/byt.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multi-line comments

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refine it

@RanderWang

Copy link
Copy Markdown
Author

I update my patches. Why I change snd_sof_ipc_reply(), just have a look at following section.

When host receive reply messages from dsp, the done bit should be set. Before my change, it is set in IRQ function. Now I move it to cmd_done function which is called at end of message processing function. In some cases, unknown message is gotten in IRQ function and no message processing function is called for this message. So done bit can't be set in cmd_done function, and it could only be set in IRQ function

Set DONE bit in cmd_done function which processes msgs,
rather than doing it in IRQ function. But if a msg is not
in the rx list, it can only be done at IRQ function

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Set DONE bit in cmd_done function if direction is DSP_REPLY
rather than doing it in IRQ function. But if a msg is not
in the rx list, it can only be done at IRQ function

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
(1) Set DONE bit in cmd_done function which processes msgs,
rather than doing it in IRQ function. But if a msg is not
in the rx list, it can only be done at IRQ function

(2) Check DONE bit in hsw_is_ready function

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
(1) Set DONE bit in cmd_done function which processes msgs,
rather than doing it in IRQ function. But if a msg is not
in the rx list, it can only be done at IRQ function

(2) Check DONE bit in bdw_is_ready function

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
(1) Set DONE bit in cmd_done function which processes msgs,
rather than doing it in IRQ function. But if a msg is not
in the rx list, it can only be done at IRQ function

(2) Check DONE bit in byt_is_ready function

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I still don't get why in the APL case you ignore the ROM messages and in CNL you don't?

I am referring to this code in hda-ipc.c:
if (msg != 0x1004000)
reply = snd_sof_ipc_reply(sdev, msg);

which isn't present for CNL

@RanderWang

Copy link
Copy Markdown
Author

The code if(msg != 0x1004000) is added by Keyon. Because at boot up time, ROM send a reply msg to host, but host cant found it , so a error msg would be in dmesg. Customer complaint about error msg on APL . So Keyon did this on APL.

@RanderWang

Copy link
Copy Markdown
Author

For ROM messages on CNL & APL, both would call cmd_done in IRQ function. For ROM messages on
CNL, the snd_sof_ipc_reply would return -EINVL, the cmd_done would be called. On APL, For ROM messages 0x1004000, cmd_done would called for reply = -EINVL, and other ROM msgs work as on CNL. So no difference.

@plbossart

Copy link
Copy Markdown
Member

@RanderWang I did not understand your explanations at all... I was asking why there is a difference between two platforms that are mostly identical, and you didn't give me the root cause.

Anyway, I will merge this since it's been dragging for a long-time and I am tired of this thread, but be prepared for a revert if this introduces problems.

@plbossart
plbossart merged commit a3a39f2 into thesofproject:topic/sof-dev Jul 11, 2018
@RanderWang
RanderWang deleted the ipx_fix branch July 24, 2018 05:35
keyonjie pushed a commit that referenced this pull request Oct 15, 2018
Applying dynamic usbcore quirks in early booting when the slab is
not yet ready would cause kernel panic of null pointer dereference
because the quirk_count has been counted as 1 while the quirk_list
was failed to allocate.

i.e.,
[    1.044970] BUG: unable to handle kernel NULL pointer dereference at           (null)
[    1.044995] IP: [<ffffffffb0953ec7>] usb_detect_quirks+0x88/0xd1
[    1.045016] PGD 0
[    1.045026] Oops: 0000 [#1] PREEMPT SMP
[    1.046986] gsmi: Log Shutdown Reason 0x03
[    1.046995] Modules linked in:
[    1.047008] CPU: 0 PID: 81 Comm: kworker/0:3 Not tainted 4.4.154 #28
[    1.047016] Hardware name: Google Coral/Coral, BIOS Google_Coral.10068.27.0 12/04/2017
[    1.047028] Workqueue: usb_hub_wq hub_event
[    1.047037] task: ffff88017a321c80 task.stack: ffff88017a384000
[    1.047044] RIP: 0010:[<ffffffffb0953ec7>]  [<ffffffffb0953ec7>] usb_detect_quirks+0x88/0xd1

To tackle this odd, let's balance the quirk_count to 0 when the kcalloc
call fails, and defer the quirk setting into a lower level callback
which ensures that the kernel memory management has been initialized.

Fixes: 027bd6c ("usb: core: Add "quirks" parameter for usbcore")
Signed-off-by: Harry Pan <harry.pan@intel.com>
Acked-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants