Skip to content

soundwire: slave: force fwnode as primary - #2635

Merged
bardliao merged 1 commit into
thesofproject:topic/sof-devfrom
plbossart:sdw/force-primary-fwnode
Dec 18, 2020
Merged

bardliao merged 1 commit into
thesofproject:topic/sof-devfrom
plbossart:sdw/force-primary-fwnode

Conversation

@plbossart

Copy link
Copy Markdown
Member

Recent changes in drivers/base/core.c modified the behavior for
fwnodes. While the changes are legit and make sense, they have a
ripple effect on SoundWire Slave devices.

Intel validation found a corner case where in module load/unload
loops, the dev->fwnode pointer is overridden with device properties,
which as a result caused suspend-resume timeouts since the dev->fwnode
is detected as problematic in ACPI layers.

This patch forces the fwnode to be properly reinitialized as a primary
node.

Fixes: d5dcce0 ("device property: Keep secondary firmware node secondary by type")
Tested-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com

Recent changes in drivers/base/core.c modified the behavior for
fwnodes. While the changes are legit and make sense, they have a
ripple effect on SoundWire Slave devices.

Intel validation found a corner case where in module load/unload
loops, the dev->fwnode pointer is overridden with device properties,
which as a result caused suspend-resume timeouts since the dev->fwnode
is detected as problematic in ACPI layers.

This patch forces the fwnode to be properly reinitialized as a primary
node.

Fixes: d5dcce0 ("device property: Keep secondary firmware node secondary by type")
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@plbossart

Copy link
Copy Markdown
Member Author

@andy-shev @bardliao this is a tentative improvement on PR #2625, with a better commit message and removal of one change that didn't seem necessary. This works for me with 180 cycles of suspend-resume and counting.

@bardliao

Copy link
Copy Markdown
Collaborator

@andy-shev Sorry for the dumb question. I read the commit message of andy-shev@d5dcce0, but I still didn't get why we need it.
As you said, a primary fwnode could be either primary --> NULL or primary --> secondary --> -ENODEV.
Under the if (fwnode_is_primary(fn)) condition, fn is a primary node. But after the fn->secondary = ERR_PTR(-ENODEV); operation, fn will become a secondary node.
Let's take primary(A) --> secondary(B) --> -ENODEV case for example.
After calling set_primary_fwnode(dev, NULL); dev->fwnode will be secondary(B) --> -ENODEV, and fn will be (A) --> ERR_PTR(-ENODEV). Shouldn't fn be (A) --> NULL ?
I suppose that (A) should be still marked as primary.
Sorry, but I really need your help to understand this.

@andy-shev

Copy link
Copy Markdown

@andy-shev @bardliao this is a tentative improvement on PR #2625, with a better commit message and removal of one change that didn't seem necessary. This works for me with 180 cycles of suspend-resume and counting.

Cool! From my perspective as long as it doesn't touch driver core, I'm fine with it, thanks!

@andy-shev andy-shev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As long as it doesn't touch driver core, fine to me, thanks

@bardliao bardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@bardliao
bardliao merged commit 03b55f5 into thesofproject:topic/sof-dev Dec 18, 2020
@andy-shev

Copy link
Copy Markdown

Just to me, what kind is the check that didn't pass and why it's not critical for you?

@andy-shev

andy-shev commented Dec 18, 2020 •

Copy link
Copy Markdown

@andy-shev Sorry for the dumb question. I read the commit message of andy-shev@d5dcce0, but I still didn't get why we need it.
As you said, a primary fwnode could be either primary --> NULL or primary --> secondary --> -ENODEV.
Under the if (fwnode_is_primary(fn)) condition, fn is a primary node. But after the fn->secondary = ERR_PTR(-ENODEV); operation, fn will become a secondary node.
Let's take primary(A) --> secondary(B) --> -ENODEV case for example.
After calling set_primary_fwnode(dev, NULL); dev->fwnode will be secondary(B) --> -ENODEV, and fn will be (A) --> ERR_PTR(-ENODEV). Shouldn't fn be (A) --> NULL ?
I suppose that (A) should be still marked as primary.
Sorry, but I really need your help to understand this.

Hmm... I'm now puzzled what I was thinking about that time. Seems like your analysis is clear and my commit should be reverted.

Seems what we need is to compile that commit message and discussion(s) here to some kind of a documentation and revert andy-shev@d5dcce0.

Sorry guys for a confusion.

@bardliao

Copy link
Copy Markdown
Collaborator

Thanks @andy-shev much appreciated. So we don't really need this PR if andy-shev@d5dcce0 is reverted.

@andy-shev

Copy link
Copy Markdown

Thanks @andy-shev much appreciated.

Thanks for patience.

So we don't really need this PR if andy-shev@d5dcce0 is reverted.

Correct. Please, prepare a revert as a new patch that brings documentation based on our discussions here somewhere in the kernel (maybe as part of set_primary_fwnode() description) followed by the revert. So we won't change that in the future.

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.

3 participants