Skip to content

ASoC: SOF: add sof vBE and vFE support - #142

Merged
lgirdwood merged 1 commit into
thesofproject:topic/sof-devfrom
libinyang:porting_4
Oct 18, 2018
Merged

lgirdwood merged 1 commit into
thesofproject:topic/sof-devfrom
libinyang:porting_4

Conversation

@libinyang

Copy link
Copy Markdown

This patch adds the sof virtio BE and FE support.
It will create a dev node for the communication to the userspace.

It also handles the virtio vq event. It dispatches the different
vq kicks to different handlers. In the virtio vq handling, it handles
all the ipc events from vFE.

When there is position update from FW, it will check whether there is
an available entry in notification vq. If yes, send the position update
notification immediately. If there is no available entry, add the position
update event in a list. As soon as the notification vq has an available
entry, send the position update to the vFE.

For vFE, it will create a virtual audio device driver and communite with
vBE audio driver to create PCMs and playback/capture streams.

Signed-off-by: Libin Yang libin.yang@intel.com

@lgirdwood lgirdwood 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.

Can you update C files where possible with runtime checks for vfe or vbe and resend (using same PR)

Comment thread sound/soc/intel/boards/bxt_tdf8532.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.

Why do we need this ? If it's for tmp debug then lets put a big comment here stating it's tmp debug for feature XXX and will be removed.

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.

This is a tmp solution for BE link. I will change it to a new solution with the new topology mode later.

Comment thread sound/soc/sof/core.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.

As suggested on V3, lets use a runtime sdev->is_vfe or sdev->is_vbe to select this code at runtime. These states will be set at probe() time.

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.

Although we can use such flag to judge whether it is vFE or not, we still need such '#ifdef' because acrn has compile conflict as you know. We have already talked about that before. vFE and vBE must use such '#ifdef' to avoid the compiling error. After acrn has fixed these issues, I will switch to flag and remove the '#ifdef'

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.

@libinyang the point I'm making is that we only use the ifdef in as few places as possible. To minimize the contamination.

Comment thread sound/soc/sof/core.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.

so this looks like a boolean ? fedev should be "is_vfe"

Comment thread sound/soc/sof/core.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.

So the above ifdef could be replaced with if (sdev->is_vbe) and then the assignement above could be static inline within the header VBE section. Just trying to eliminate all the ifdefs in common code and keeping it to header and one other place.

@libinyang

Copy link
Copy Markdown
Author

@lgirdwood
updated, removed the ifdef which is caused by the conflict of FE and BE header files in ACRN.

@lgirdwood lgirdwood 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.

@libinyang getting close, but I need to see comments on each conditional piece of code so that anyone can understand each descision the code is making. Some funcs have this but some functions dont have any comments at all.

Comment thread sound/soc/sof/core.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.

I think we only need to do this if vBE support has been selected by kconfig ?

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. And I define static inline function to do nothing in the header file if vBE is not selected.

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.

ok, change comment to "optionally register virtio miscdev "

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.

OK.

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.

I just need ?* optionally register virtio miscdev */ here, the remaining comment detail can go in sof_virtio_miscdev_register()

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.

got it

Comment thread sound/soc/sof/core.c Resolved
Comment thread sound/soc/sof/core.c Resolved
Comment thread sound/soc/sof/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.

do we always need to do this ? - we have three operating modes, VBE, VFE and standalone. sure we dont need to always do this ?

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.

This function is also defined to update the position only in vBE. It will do nothing in standalone and vFE.

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.

ok, change comment to "optionally update position for vBE". Also func prefix should be sof_vbe_

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.

OK

Comment thread sound/soc/sof/virtio-be.c Resolved
Comment thread sound/soc/sof/virtio-be.c Resolved
Comment thread sound/soc/sof/virtio-be.c Resolved
@libinyang

Copy link
Copy Markdown
Author

@lgirdwood
updated:
Add more comments;
add sdev->is_vfe;
use goto xxxx

Comment thread include/uapi/sound/sof-ipc.h 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.

Why do we need raw when this in in the type enum ? The requester would send a request SOF_IPC_TPLG_REQUEST and fill in the type, the replier would then reply with the data or an error.

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.

This is added in your commit: aebf20cc in very-clean branch. What I guess is that we will use it later for FW transition. As We don't use it currently, I will remove it.

Comment thread sound/soc/sof/core.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.

ok, change comment to "optionally register virtio miscdev "

Comment thread sound/soc/sof/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.

ok, change comment to "optionally update position for vBE". Also func prefix should be sof_vbe_

@libinyang

Copy link
Copy Markdown
Author

@lgirdwood

patch updated based on Liam's comments.

@lgirdwood lgirdwood 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.

Mainly cosmetic changes needed now.

Comment thread sound/soc/sof/core.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.

if (sdev->is_vfe)

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.

Can this whole vFE init be placed in sof_virtio_vfe_init(sdev) and be placed after all the list heads are initialised.

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, i will do it.

Comment thread sound/soc/sof/core.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.

This comment uses magic numbers whence we should be using macros

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.

OK

Comment thread sound/soc/sof/core.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.

keep the new line

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.

OK

Comment thread sound/soc/sof/core.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.

I just need ?* optionally register virtio miscdev */ here, the remaining comment detail can go in sof_virtio_miscdev_register()

Comment thread sound/soc/sof/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.

keep the new line

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.

OK

Comment thread sound/soc/sof/virtio-miscdev.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.

dont return void *

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.

ok

Comment thread sound/soc/sof/virtio-miscdev.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.

fix line length - which userspace API doe this use - Pls add link.

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 don't understand this comment. What shall I do here? Make the line shorter?

Comment thread sound/soc/sof/virtio-miscdev.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.

these static func declarations can be deleted if the functions are moved further up the file

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.

ok

Comment thread sound/soc/sof/virtio-miscdev.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.

no need for the snd_ prefix as this is static and only used here.

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.

ok

Comment thread sound/soc/sof/virtio-miscdev.c Outdated

ghost Oct 16, 2018

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_ not needed

ghost Oct 17, 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.

ok

@libinyang

ghost commented Oct 17, 2018

Copy link
Copy Markdown
Author

@lgirdwood

updated based on Liam's comments

ghost 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.

Still a few minor comments to cleanup.

Comment thread sound/soc/sof/core.c Outdated

ghost Oct 17, 2018

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.

A new line should always precede a comment to make it obvious where the comment applies and to break the code into easier to follow blocks. This need fixed in several places.

Comment thread sound/soc/sof/ipc.c Outdated

ghost Oct 17, 2018

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.

after here

Comment thread sound/soc/sof/sof-priv.h Outdated

ghost Oct 17, 2018

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.

indentation of variable names - some members use a tab and others a space in this struct.

ghost Oct 18, 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.

got it. I misunderstood your meaning last time.

Comment thread sound/soc/sof/virtio-be.c Outdated

ghost Oct 17, 2018

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.

pls comment what this function does

Comment thread sound/soc/sof/virtio-be.c Outdated

ghost Oct 17, 2018

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.

dev_err

ghost Oct 18, 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.

no dev is available here

Comment thread sound/soc/sof/virtio-miscdev.c Outdated

ghost Oct 17, 2018

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.

system includes should precede local includes

This patch adds the sof virtio BE and FE support.
It will create a dev node for the communication to the userspace.

It also handles the virtio vq event. It dispatches the different
vq kicks to different handlers. In the virtio vq handling, it handles
all the ipc events from vFE.

When there is position update from FW, it will check whether there is
an available entry in notification vq. If yes, send the position update
notification immediately. If there is no available entry, add the position
update event in a list. As soon as the notification vq has an available
entry, send the position update to the vFE.

For vFE, it will create a virtual audio device driver and communite with
vBE audio driver to create PCMs and playback/capture streams.

Signed-off-by: Libin Yang <libin.yang@intel.com>
@libinyang

ghost commented Oct 18, 2018

Copy link
Copy Markdown
Author

@lgirdwood
updated based on the comments

@lgirdwood
lgirdwood merged commit 481973c into thesofproject:topic/sof-dev Oct 18, 2018
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