New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SKL/KBL support - basic code #1667
Conversation
@ranj063 can you check the last patch w/ the boot_complete stuff (different now that we have different states) |
@plbossart it looks fine. The state machine for FW boot is all handled in the common loader and PM callbacks. The platform-specific loader code does not touch the state machine. |
cl_cleanup_skl(sdev); | ||
|
||
dev_err(sdev->dev, "error: load fw failed err: %d\n", ret); | ||
return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart the hda_dsp_cl_boot_firmware_skl() needs to be aligned with hda_dsp_cl_boot_firmware() to fix the retries and error handling properly.
ROM codes for SKL & KBL are different from other platforms. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Add operations for SKL and KBL platforms. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Add ops and PCI IDs Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Add build support for SKL and KBL based PCI devices. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
837c5bf
to
e83a963
Compare
@lgirdwood I tested the updated version on a KBL NUC, this goes all the way to the firmware load. I guess your version was very very old so hopefully this helps rebase with a more recent tree. I only tested with the SST firmware since I don't have a firmware compiled/signed on my side.
|
u32 total_size, u32 bufsize) | ||
{ | ||
unsigned int bytes_left = total_size; | ||
const u8 *curr_pos = (u8 *)bin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this cast isn't correct - it drops const
even though the goal variable is const
too, and I don't think it's needed at all.
|
||
static int | ||
cl_skl_cldma_copy_to_buf(struct snd_sof_dev *sdev, const void *bin, | ||
u32 total_size, u32 bufsize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be better to split it like
static int cl_skl_cldma_copy_to_buf(struct snd_sof_dev *sdev,
const void *bin, u32 total_size, u32 bufsize)
return -EINVAL; | ||
|
||
while (bytes_left > 0) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I don't think anyone of us is still using 25x80 terminals, but still empty lines like the above - after while () {
or if () {
etc. - seem like a waste of screen real estate to me, and there are 3 of them just in this snippet...
|
||
while (bytes_left > 0) { | ||
|
||
if (bytes_left > bufsize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be reverted like
if (bytes_left <= bufsize) {
...
return 0;
}
to avoid the additional indentation level. caused by the else
const struct firmware *fw = plat_data->fw; | ||
unsigned int bufsize = HDA_SKL_CLDMA_MAX_BUFFER_SIZE; | ||
unsigned int status; | ||
int ret = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
superfluous initialisation
ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, | ||
HDA_ADSP_FW_STATUS_SKL, status, | ||
((status & SKL_DSP_ROM_SKL_STS_MASK) | ||
== SKL_DSP_ROM_BASEFW_ENTERED), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
superfluous external parentheses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart good progress, can you confirm if closed source FW authenticates ?
I could get FW loading (but failing to validate) on old RVP (with early silicon) but production HW uses IRQ mode for FW loading, this flow needs some extra logic to be added to a couple of the codeloader functions and can be based on SKL flow.
Interestingly the upstream SKL driver would never load FW on my KBL NUC, not even with some hacks. I guess you will need a working SKL flow to base any updates on.
sound/soc/sof/intel/hda-loader-skl.c
Outdated
@@ -491,7 +491,6 @@ int hda_dsp_cl_boot_firmware_skl(struct snd_sof_dev *sdev) | |||
|
|||
/* init for booting wait */ | |||
init_waitqueue_head(&sdev->boot_wait); | |||
sdev->boot_complete = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this will be squashed into the previous code loader patch.
can you confirm if closed source FW authenticates ?
what information can I look for? I attached the dmesg log, not sure what
you would want to look for.
Stepping back, do we agree that using the existing SST firmware should
be downloaded but will fail when the first IPCs come, right? I am not
sure when the two solutions will start to differ and at what points
errors would be normal/expected.
I could get FW loading (but failing to validate) on old RVP (with early
silicon) but production HW uses IRQ mode for FW loading, this flow needs
some extra logic to be added to a couple of the codeloader functions and
can be based on SKL flow.
Interestingly the upstream SKL driver would never load FW on my KBL NUC,
not even with some hacks. I guess you will need a working SKL flow to
base any updates on.
ok, I will retry with the SKL driver. I am pretty sure the same tree
will work, I tested it back in the day. That will indeed ensure we are
starting from a know valid point.
/* init for booting wait */
init_waitqueue_head(&sdev->boot_wait);
- sdev->boot_complete = false;
I guess this will be squashed into the previous code loader patch.
Yes, but I wanted Ranjani to ack that part. I wasn't sure if it was
needed or not.
|
Sorry, didn't see dmesg. ROM code 3 is SKL_DSP_ROM_MANIFEST_LOADED so it looks like it's only partially processing the data.
Yes, I would expect it to send a FW ready and fail at FW boot timeout. |
Comment out widgets/routes that are not defined in the SST topology [ 27.471575] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: no source widget found for codec1_out [ 27.471577] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to add route codec1_out -> direct -> Digital CPU Playback [ 27.471580] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: no source widget found for codec2_out [ 27.471581] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to add route codec2_out -> direct -> Alt Analog CPU Playback [ 27.471585] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: no sink widget found for codec1_in [ 27.471586] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to add route Digital CPU Capture -> direct -> codec1_in [ 27.471588] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: no sink widget found for codec2_in [ 27.471589] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Failed to add route Alt Analog CPU Capture -> direct -> codec2_in Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@lgirdwood Instructions to test SST driver on KBL NUC
scp fwdt_kbl_hda_dsp.bin root@192.168.1.138:/lib/firmware/dfw_sst.bin The name of the topology does matter
see resulting dmesg (still some bugs obviously so time to ditch this driver...) |
Add traces to show interrupts are taking place. No luck so something is obviously missing. [ 47.767695] sof-audio-pci 0000:00:1f.3: ROM init successful [ 47.767696] sof-audio-pci 0000:00:1f.3: firmware size: 0x3c548 buffer size 0x20000 [ 47.767697] sof-audio-pci 0000:00:1f.3: cldma copy 0x20000 bytes [ 47.767702] sof-audio-pci 0000:00:1f.3: plb: cl_skl_cldma_set_intr interrupt enable 1 [ 47.767709] sof-audio-pci 0000:00:1f.3: cl_skl_cldma_copy_to_buf: plb: sleeping 100ms [ 47.874371] sof-audio-pci 0000:00:1f.3: cldma copy 0x1c548 bytes [ 47.874376] sof-audio-pci 0000:00:1f.3: plb: cl_skl_cldma_set_intr interrupt enable 0 [ 50.860527] sof-audio-pci 0000:00:1f.3: FW Poll Status: reg=0x3 timedout [ 50.860532] sof-audio-pci 0000:00:1f.3: error: firmware loading failed! [ 50.860560] sof-audio-pci 0000:00:1f.3: error: load firmware failed : -110 [ 50.860567] sof-audio-pci 0000:00:1f.3: unknown ROM status value 00000003 [ 50.860572] sof-audio-pci 0000:00:1f.3: error: status = 0x00000000 panic = 0x00000000 [ 50.860576] sof-audio-pci 0000:00:1f.3: unknown ROM status value 00000003 [ 50.860583] sof-audio-pci 0000:00:1f.3: FW Poll Status: reg=0x1010303 successful [ 50.860589] sof-audio-pci 0000:00:1f.3: FW Poll Status: reg=0x303 successful [ 50.860593] sof-audio-pci 0000:00:1f.3: DSP core(s) enabled? 0 : core_mask 1 [ 50.860606] sof-audio-pci 0000:00:1f.3: error: load fw failed err: -110 [ 50.860610] sof-audio-pci 0000:00:1f.3: error: failed to reset DSP [ 50.860614] sof-audio-pci 0000:00:1f.3: error: failed to boot DSP firmware -110 [ 50.860618] sof-audio-pci 0000:00:1f.3: error: sof_probe_work failed err: -110 root@plb-kblnuc7 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@lgirdwood @keyonjie I checked the code and compared with the SST flows, the main difference seems to be in how the code loader DMA is actually handled. There was no interrupt handler and the buffer copy doesn't seem to wait that the data is actually consumed by the DSP, so not really a surprise it's seen as corrupted. See last patch and the results showing the dmesg excerpts. I really wonder if this was ever tested... What is the expectation for the code loader in terms of data handling? |
closing for now, someone will have to take over |
clean-up of @lgirdwood topic/kbl-fw-loader branch (w/o the WIP parts)
SKL/KBL was re-added to default kconfig so this should compile and have no adverse effects on existing platforms.