Skip to content

Topic/skl rom init timeout - #717

Merged
plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
zhuyingjiang:topic/skl-ROM-init-timeout
Apr 3, 2019
Merged

plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
zhuyingjiang:topic/skl-ROM-init-timeout

Conversation

@zhuyingjiang

Copy link
Copy Markdown

As part of #704
make the ROM init timeout SKL platform specific, setting to 150 ms.
change the core mask, so the two cores can be enabled.
unlike DSP core of APL, CNL which must power up, reset and unstall core 0 first, the SKL DSP cores can be enabled at the same time.

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

I don't understand why you enable 2 cores by default, and I have questions on the changes that have nothing to do with the rom timeout.

Comment thread sound/soc/sof/intel/hda-loader-skl.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 is this changed?

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.

@plbossart This is a bug, using goto will dump and call powerdown two times. so if fail, just return.

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.

@zhuyingjiang sorry, I don't see what would cause this loop to be executed twice. the flow is quite unclear to me here.

Comment thread sound/soc/sof/intel/skl.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 is really not related to the timeout, you need to provide patches that match the commit message

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.

@plbossart OK, will sub another PR

Comment thread sound/soc/sof/intel/hda-loader-skl.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 would you use 2 cores by default? This makes no sense. It's not because you can that you should, it's horrible in terms of power consumption.

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.

iirc, this is copied exactly from SKL driver.

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.

@lgirdwood @zhuyingjiang I dont think the SKL driver does this. But even if it does, we have the means to bring up the cores when there are pipelines scheduled to run on them. I dont think it is necessary to power them all up at boot.

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, let's keep only one core enabled at first, so just remove the second commit is OK.

@zhuyingjiang
zhuyingjiang force-pushed the topic/skl-ROM-init-timeout branch from 8d033fa to 3e3a2fb Compare March 15, 2019 12:00
@zhuyingjiang

Copy link
Copy Markdown
Author

@plbossart Updated

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

the explanations on patch2 aren't clear to me. You know I am paranoid about error flows so I'd like to understand a bit more what problem this patch2 solves.

Comment thread sound/soc/sof/intel/hda-loader-skl.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.

@zhuyingjiang sorry, I don't see what would cause this loop to be executed twice. the flow is quite unclear to me here.

@zhuyingjiang

Copy link
Copy Markdown
Author

@plbossart It is not loop twice, when cl_dsp_init_skl can't enable the core, it will return a ret which is less than 0, and will execute the following flow inside cl_dsp_init_skl to dump the registers and reset/power down the core:

hda_dsp_dump_skl(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX);
cl_cleanup_skl(sdev);
hda_dsp_core_reset_power_down(sdev, HDA_DSP_CORE_MASK(0));

if here is goto irq_err;, it will execute the same flow at the end of hda_dsp_cl_boot_firmware_skl, it means the dump and reset has been execute twice. So this is a bug and just return here can solve this.

@ranj063

ranj063 commented Mar 16, 2019

Copy link
Copy Markdown
Collaborator

@plbossart It is not loop twice, when cl_dsp_init_skl can't enable the core, it will return a ret which is less than 0, and will execute the following flow inside cl_dsp_init_skl to dump the registers and reset/power down the core:

hda_dsp_dump_skl(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX);
cl_cleanup_skl(sdev);
hda_dsp_core_reset_power_down(sdev, HDA_DSP_CORE_MASK(0));

if here is goto irq_err;, it will execute the same flow at the end of hda_dsp_cl_boot_firmware_skl, it means the dump and reset has been execute twice. So this is a bug and just return here can solve this.

@zhuyingjiang the sequence in boot_firmware() in loader.c has recently been updated to do a proper cleanup in case of failures. Could you please take a look and align the skl loader along similar lines?

@plbossart

Copy link
Copy Markdown
Member

Agree with @ranj063 the error flow doesn't seem quite right

@zhuyingjiang

Copy link
Copy Markdown
Author

@plbossart @ranj063 Thanks for the comments, I am working on the S3 issue and will change this PR some later.

@zhuyingjiang

Copy link
Copy Markdown
Author

@zhuyingjiang the sequence in boot_firmware() in loader.c has recently been updated to do a proper cleanup in case of failures. Could you please take a look and align the skl loader along similar lines?

@ranj063
As i checked the hda_dsp_cl_boot_firmware in hda-loader.c, there are two goto: "cleanup:" and "err:", I think that is for fail of get_stream_with_tag and error handle of cl_dsp_init, but in SKL, we use codeloader DMA instead of one of the stream DMA, so no get_stream_with_tag there. That means we can handle the error with one "goto". So my understand is that hda_dsp_cl_boot_firmware_skl don't need change to align with hda_dsp_cl_boot_firmware

@ranj063

ranj063 commented Mar 29, 2019

Copy link
Copy Markdown
Collaborator

@zhuyingjiang the skl loader needs a bit of rework. here're my comments:

  1. Your argument that there's no need to dump regs if cl_dsp_init_skl() fails is correct. But we still need to indicate fw load failure and return the return value.
  2. Secondly, looking into cl_copy_fw_skl(), it looks like this funcions performs cl_cleanup_skl() in case it is successful. But when it fails, there doesnt seem to be a need to perform the clean up at all. So I would remove the cleanup_skl() call in hda_dsp_cl_boot_firmware_skl() after the irq_err:
  3. In the function cl_skl_cldma_copy_to_buf(), although the logic is correct, it looks like we will never hit the "return bytes". bytes_left will never be 0 to begin with. So I'd rather just have a break in the else {} block and return 0 at the end.

@zhuyingjiang

Copy link
Copy Markdown
Author

@zhuyingjiang the skl loader needs a bit of rework. here're my comments:

  1. Your argument that there's no need to dump regs if cl_dsp_init_skl() fails is correct. But we still need to indicate fw load failure and return the return value.
  2. Secondly, looking into cl_copy_fw_skl(), it looks like this funcions performs cl_cleanup_skl() in case it is successful. But when it fails, there doesnt seem to be a need to perform the clean up at all. So I would remove the cleanup_skl() call in hda_dsp_cl_boot_firmware_skl() after the irq_err:
  3. In the function cl_skl_cldma_copy_to_buf(), although the logic is correct, it looks like we will never hit the "return bytes". bytes_left will never be 0 to begin with. So I'd rather just have a break in the else {} block and return 0 at the end.

@ranj063 seems what you mention is not related to the "ROM init timeout", Should that go with another refine PR? I heard that it will lost track if the title message and the code are not related.

@ranj063

ranj063 commented Mar 30, 2019

Copy link
Copy Markdown
Collaborator

@ranj063 seems what you mention is not related to the "ROM init timeout", Should that go with another refine PR? I heard that it will lost track if the title message and the code are not related.

Yes,please.

@zhuyingjiang
zhuyingjiang force-pushed the topic/skl-ROM-init-timeout branch from 3e3a2fb to 96d46dd Compare March 31, 2019 04:44
@zhuyingjiang

Copy link
Copy Markdown
Author

OK, I removed the "skl fix a bug of error handle" commit and keep the commit for "skl make ROM init timeout skl specific" and "skl fix some comments error". @plbossart @ranj063 Could you approve and merge the kept ROM init part? I will create a issue and a follow PR to refine the skl loader code.

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

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.

@zhuyingjiang i just looked back into my PR and i've not touched the HDA_DSP_INIT_TIMEOUT but only removed the HDA_ROM_INIT_TIMEOUT. Although it looks like we should be using the rom init timeout here, I wonder why we were using HDA_DSP_INIT_TIMEOUT before.

How did you test this? I am confused about whether this is correct or not.

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.

besides the register poll method has been changed recently. Can you please fix the conflicts?

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.

@ranj063 As I have mentioned in #704

Yes, SKL still need this timeout. As I test, the HDA_ROM_INIT_TIMEOUT which is 70ms is some short, So I use the already defined HDA_DSP_INIT_TIMEOUT 500ms, If this can be platform specific, 150 ms can work for SKL.

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.

besides the register poll method has been changed recently. Can you please fix the conflicts?

Done.

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.

@ranj063 As I have mentioned in #704

Yes, SKL still need this timeout. As I test, the HDA_ROM_INIT_TIMEOUT which is 70ms is some short, So I use the already defined HDA_DSP_INIT_TIMEOUT 500ms, If this can be platform specific, 150 ms can work for SKL.

@zhuyingjiang sorry I missed the previous comment. Thanks

make ROM init timeout platform specific, change from
define to platform structure assigned.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
fix two comments, Apollolake should be Skylake

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
@zhuyingjiang
zhuyingjiang force-pushed the topic/skl-ROM-init-timeout branch from 96d46dd to 7b223da Compare April 1, 2019 09:31
@zhuyingjiang

Copy link
Copy Markdown
Author

@plbossart Could you approve and merge this? I will create a issue and follow a PR to do the refine of skl code loader.

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

@zhuyingjiang I will merge this one but this is the last one. I don't want anything related to SKL unless we have a real plan to support this platform.

@plbossart
plbossart merged commit 48ae1e3 into thesofproject:topic/sof-dev Apr 3, 2019
@zhuyingjiang

Copy link
Copy Markdown
Author

@plbossart OK, thanks!

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.

4 participants