Skip to content

ASoC: SOF: Do not send cmd via SHIM register - #586

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
dbaluta:dbaluta/sof-dev-remove-cmd
May 22, 2019
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
dbaluta:dbaluta/sof-dev-remove-cmd

Conversation

@dbaluta

@dbaluta dbaluta commented Jan 23, 2019

Copy link
Copy Markdown
Collaborator

We use shim registers only to notify the other
side that a message was sent. The actual information
for the message is transmitted via mailbox.

cmd information inside shim register is not used by
the DSP, so we remove it to avoid confusion.

Signed-off-by: Daniel Baluta daniel.baluta@gmail.com

We use shim registers only to notify the other
side that a message was sent. The actual information
for the message is transmitted via mailbox.

cmd information inside shim register is not used by
the DSP, so we remove it to avoid confusion.

Signed-off-by: Daniel Baluta <daniel.baluta@gmail.com>
@keyonjie

Copy link
Copy Markdown

Why you are saying "cmd information inside shim register is not used by the DSP"? if the DSP you mentioned is SOF firmware on Intel Audio DSP, I think you are wrong here.

@plbossart

Copy link
Copy Markdown
Member

Why you are saying "cmd information inside shim register is not used by the DSP"? if the DSP you mentioned is SOF firmware on Intel Audio DSP, I think you are wrong here.

The explanations from @lgirdwood is that the SHIM registers are only used for doorbell operation (are you ready, here's data, etc)., all the data goes over the memory windows. So if you are using the SHIM register to pass any information, you have information that's passed twice through different mechanisms, and this model doesn't scale to other platforms. Not to mention that ORing a software-defined command with a hardware register is a big no-no in general, if a hardware dude adds a chicken bit your solution is DOA.

@keyonjie

Copy link
Copy Markdown

Why you are saying "cmd information inside shim register is not used by the DSP"? if the DSP you mentioned is SOF firmware on Intel Audio DSP, I think you are wrong here.

The explanations from @lgirdwood is that the SHIM registers are only used for doorbell operation (are you ready, here's data, etc)., all the data goes over the memory windows. So if you are using the SHIM register to pass any information, you have information that's passed twice through different mechanisms, and this model doesn't scale to other platforms. Not to mention that ORing a software-defined command with a hardware register is a big no-no in general, if a hardware dude adds a chicken bit your solution is DOA.

I actually like the solution only use SHIM registers as doorbell and send IPC cmd/data via mailbox(memory window), what I concern here is that we need to change this in both FW and driver at the same time, otherwise, platforms may be blocked if this single PR is merged.

@plbossart

Copy link
Copy Markdown
Member

Are you saying this would result in a backwards compatibility issue if we clean this up? Gah.

@keyonjie

Copy link
Copy Markdown

Sorry, just went through the FW side, we already discarded use SHIM message for host initiated IPC, but still writing message to SHIM for FW initiated IPC, so this PR(change the former ones only) should be fine except that FW will printing some logs with msg read from SHIM(e.g. trace_ipc("ipc: msg rx -> 0x%x", ipc->host_msg);).

@keyonjie
keyonjie requested a review from RanderWang January 24, 2019 02:46
@RanderWang

Copy link
Copy Markdown

I also discussed it with Liam about this issue. For HSW or BDW, we don't send cmd via SHIM register because the cmd can't be included by SHIM register. Now, cmd is read from mailbox, so it is good to remove cmd in SHIM register on all platforms. But we need to refine trace log in FW.

And last time I said some one in community would send a patch to remove cmd in SHIM, now it comes true.

@RanderWang

Copy link
Copy Markdown

And more, we need to do more refinement in kernel.
In our IRQ thread, we get cmd from SHIM register to find msg from reply_list.
Actually, cmd is always zero, and always the first msg (and the only one msg) in reply_list is found.
So we need to refine the algorithm to process reply_msg.

@keyonjie

keyonjie commented Jan 24, 2019 •

Copy link
Copy Markdown

And more, we need to do more refinement in kernel.
In our IRQ thread, we get cmd from SHIM register to find msg from reply_list.
Actually, cmd is always zero, and always the first msg (and the only one msg) in reply_list is found.
So we need to refine the algorithm to process reply_msg.

yes, that's the issue #516, after this SHIM register cleanup, we can fix #516 more easily. something like this:
dc4e87b

@dbaluta

dbaluta commented Jan 24, 2019 •

Copy link
Copy Markdown
Collaborator Author

Sorry, just went through the FW side, we already discarded use SHIM message for host initiated IPC, but still writing message to SHIM for FW initiated IPC, so this PR(change the former ones only) should be fine except that FW will printing some logs with msg read from SHIM(e.g. trace_ipc("ipc: msg rx -> 0x%x", ipc->host_msg);).

@keyonjie Those logs are removed with thesofproject/sof#877

@dbaluta dbaluta closed this Jan 26, 2019
@dbaluta
dbaluta deleted the dbaluta/sof-dev-remove-cmd branch January 26, 2019 17:58
@dbaluta
dbaluta restored the dbaluta/sof-dev-remove-cmd branch January 29, 2019 08:20
@dbaluta dbaluta reopened this Jan 29, 2019
@dbaluta

dbaluta commented Jan 29, 2019

Copy link
Copy Markdown
Collaborator Author

Reopened this because I've "accidentally" deleted my local branch. @keyonjie can you have a look?

@wenqingfu
wenqingfu requested a review from lyakh February 1, 2019 23:39
@wenqingfu

wenqingfu commented Feb 1, 2019 •

Copy link
Copy Markdown

Reopened this because I've "accidentally" deleted my local branch. @keyonjie can you have a look?

Sounds like an "approve" from @RanderWang and @keyonjie. You probably won't see a feedback from them shortly for the Chinese new year holiday break. Add @lyakh for his information anyway

@lyakh

lyakh commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator

FWIW this also matches the SPI use-case better, where there's only one data path between the host and the DSP and the doorbell function is implemented by GPIO(s).

@plbossart

Copy link
Copy Markdown
Member

Looks good to me, but I want to test it on Baytrail/Up2 before merging. will do it later today.

@dbaluta

dbaluta commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator Author

@plbossart thanks for doing that!

With this patch, there is no info passed between AP -> DSP using the SHIM registers. The next topic would be why do we need to pass info using SHIM registers in the direction DSP -> AP.

This will greatly help my implementation on i.MX. I will need to take some time to investigate the RX side (looking from AP).

@plbossart

Copy link
Copy Markdown
Member

@dbaluta i don't see any issues with APL but I see odd results on CHT that I don't see without this PR, e.g.

root@plb-T100HAN:~/kmod_scripts# speaker-test -Dhw:0,0 -c2 -r48000 -t tone

speaker-test 1.1.6

Playback device is hw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Playback open error: -16,Device or resource busy
root@plb-T100HAN:~/kmod_scripts# speaker-test -Dhw:0,0 -c2 -r48000 -t tone

speaker-test 1.1.6

Playback device is hw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 384 to 16320
Period size range from 192 to 4032
Using max buffer size 16320
Periods = 4

I would really prefer it if we waited for the rest of the team to double-check the results.

@dbaluta

dbaluta commented Feb 7, 2019

Copy link
Copy Markdown
Collaborator Author

@plbossart sure! Thanks for trying it.

@plbossart

Copy link
Copy Markdown
Member

@lyakh are you planning to include this change from @dbaluta in your IPC work? If yes maybe we can close this?

@plbossart

Copy link
Copy Markdown
Member

@lyakh friendly reminder that this change probably needs to be folded into your IPC work.

@ranj063

ranj063 commented May 9, 2019 •

Copy link
Copy Markdown
Collaborator

@plbossart @dbaluta we've waited long enough to decide the fate of this PR. But with the FW counterpart proposing to use the doorbell registers for sending the IPC payload, I think it makes sense to make the proper change now.
thesofproject/sof@851ff9f

If I read the FW commit correctly, if the cmd is added to the doorbell register, it means we want to send the IPC payload via the register and not the shared memory.

@plbossart

Copy link
Copy Markdown
Member

@ranj063 the suggested change is only for cAVS platforms. BYT cannot use the IPC registers for communication, we have to use the mailbox

@ranj063

ranj063 commented May 10, 2019

Copy link
Copy Markdown
Collaborator

@ranj063 the suggested change is only for cAVS platforms. BYT cannot use the IPC registers for communication, we have to use the mailbox

@plbossart then it makes sense to remove the cmd by default as suggested in this PR, isnt it? It should be used only when needed explicitly

@plbossart

plbossart commented May 10, 2019 via email

Copy link
Copy Markdown
Member

@dbaluta

dbaluta commented May 20, 2019

Copy link
Copy Markdown
Collaborator Author

@ranj063 @plbossart agree.

@RanderWang

Copy link
Copy Markdown

APPROVE

@plbossart
plbossart merged commit 4d1fc20 into thesofproject:topic/sof-dev May 22, 2019
@dbaluta
dbaluta deleted the dbaluta/sof-dev-remove-cmd branch August 8, 2019 08:54
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.

7 participants