Commit Graph

310 Commits

Author SHA1 Message Date
Marc Herbert 8960097403 Revert "ext_manifest: Fix incorrect signature"
This reverts commit 241af313da so the DSP
can boot again.

On my APL UP2 this fixes:

10:06:38: 00:0e.0: unstall/run core: core_mask = 1
10:06:38: 00:0e.0: DSP core(s) enabled? 1 : core_mask 1
10:06:38: 00:0e.0: FW Poll Status: reg[0x4c]=0x40000000 successful
10:06:38: 00:0e.0: FW Poll Status: reg[0x4]=0x3030202 successful
10:06:38: 00:0e.0: FW Poll Status: reg[0x4]=0x1010202 successful
10:06:38: 00:0e.0: DSP core(s) enabled? 0 : core_mask 2
10:06:38: 00:0e.0: FW Poll Status: reg[0x80000]=0x5000001 successful
10:06:41: 00:0e.0: FW Poll Status: reg[0x80000]=0x80000007 timedout
10:06:41: 00:0e.0: error: cl_copy_fw: timeout HDA_DSP_SRAM_REG_ROM_STATUS read
10:06:41: 00:0e.0: FW Poll Status: reg[0x160]=0x140000 successful
10:06:41: 00:0e.0: ------------[ DSP dump start ]------------
10:06:41: 00:0e.0: unknown ROM status value 80000007
10:06:41: 00:0e.0: error: extended rom status:  0x80000007 0x2f 0x0 0x0 \
                                                0x0 0x0 0x1522100 0x0
10:06:41: 00:0e.0: ------------[ DSP dump end ]------------
10:06:41: 00:0e.0: error: load fw failed ret: -110
10:06:41: 00:0e.0: error: failed to start DSP
10:06:41: 00:0e.0: error: failed to boot DSP firmware -110
10:06:41: 00:0e.0: FW Poll Status: reg[0x4]=0x1d003c timedout
10:06:41: 00:0e.0: error: hda_dsp_core_reset_enter: timeout on  \
                                                  HDA_DSP_REG_ADSPCS read
10:06:41: 00:0e.0: error: dsp core reset failed: core_mask 3
10:06:41: probe of 0000:00:0e.0 failed with error -110

Test PR https://github.com/thesofproject/sof/pull/4782 show this commit
broke the DSP boot on ALL platforms
  https://sof-ci.01.org/sofpr/PR4782/build10387/devicetest/

```
[    7.798750] kernel: sof-audio-acpi-intel-bdw INT3438:00: error: invalid firmware signature
[    7.798827] kernel: sof-audio-acpi-intel-bdw INT3438:00: error: invalid FW header
[    7.798943] kernel: sof-audio-acpi-intel-bdw INT3438:00: error: failed to load DSP firmware -22
[    7.810348] kernel: sof-audio-acpi-intel-bdw INT3438:00: error:
sof_probe_work failed err: -22
```

This also broke QEMU boot on a number of platforms: BDW, BYT and CHT, see
`error: invalid firmware signature` in

https://sof-ci.01.org/sofpr/PR4782/build10387/boottest/ and
https://github.com/thesofproject/sof/pull/4782/checks?check_run_id=3634915322

How was it tested?

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-17 15:16:19 -05:00
Marc Herbert 0d7f2d4a34 Do not exit(0) on invalid options or parameters
When some automation script gets some rimage flag wrong then rimage
exits and does not run at all. In such a case we want the build to fail
immediately and see the error at the bottom of the build logs and not
obscured by other, consecutive failures caused by the lack of rimage
output.

Take control of the exit code away from usage() and give it back to
main() where it belongs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-17 15:05:50 +01:00
Marc Herbert 6e22944e05 README.md: explain how to run SOF tests on new rimage code
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-17 09:18:19 +01:00
Marcin Rajwa a9faf85fe5 remove '-x' option
This patch removes the unnecessary and unscalable -x option.
This option aims to add an offset to the .data section of
its parent .module section. This is horrible idea because this
offset will vary depend on the compiler used. It is better and
much easier to just store only the .data section so the offset
is always 0.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-09-14 14:02:41 +01:00
Marcin Rajwa 241af313da ext_manifest: Fix incorrect signature
This patch changes the incorrect signature of extended manifest
to the correct one "$AE1"

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-09-14 13:58:58 +01:00
Marc Herbert 4823e87f29 pkcs: quote the name of key file when logging it
This makes is more obvious when the filename is empty, which happened in
bug https://github.com/thesofproject/sof/pull/4711

Also prefix identical log statements with their different __func__
names.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-06 12:01:18 +01:00
Karol Trzcinski dcfcef80cb config: Remove unused, platform specific, memory region definitions
After commit 916fc2cd73ff: "config: Remove unused adsp structs"
those defines are unused.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-09-01 09:58:27 +03:00
Karol Trzcinski fc4d7b8519 rimage: Fix error message content after adsp malloc fail
Message should reflect error root cause.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-09-01 09:58:12 +03:00
Karol Trzcinski 3e20076f97 config: Return error value in parse_uint32_* functions when key is not found
Return value, for error case should be unified.
For those functions, default error value is UINT32_MAX.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-08-31 21:26:14 +01:00
Karol Trzcinski ada30c15b5 config: Explicit state return value for error cases in parse_uint32_* functions
Developer should know what is ther return value for error cases.
Improved doxydoc may be used eg. by IDE to speed-up code development.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-08-31 21:26:14 +01:00
Karol Trzcinski de9177b841 config: Adjust return type with function name
Function with `parse_uint32` should return uint32_t value

Signed-off-by: Karol Trzcinski <karolx.trzcinski@intel.com>
2021-08-31 21:26:14 +01:00
Karol Trzcinski c4a7456254 config: Remove machine_id field
This enum value is used only to distinguish suecreek from other
platforms, which can be done also by platform name.

Manual enumeration, in separate toml files with manual synchronization
in enum definition is quite error prone. After commit
9bf46d3: "rimage: Add support for mt8195" and
9716e10: "config: Add imx8ulp.toml" there are two different
platform with the same enum value 15 specified, which proves such a
thesis.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-08-31 21:23:28 +01:00
Karol Trzcinski 916fc2cd73 config: Remove unused adsp structs
After commit 2965908 "manifest: Remove -m option" those
structs are unused. ADSP configuration comes from toml
configuration files.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-08-31 16:15:04 +01:00
Allen-kh Cheng 9bf46d3fe2 rimage: Add support for mt8195
Add mt8195.toml to support sof-mt8195.ri binary build.
Add mt8195 memory layout
Add mt8195 machine_id

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-08-27 13:56:56 +01:00
Marcin Rajwa aea1969225 adsp_config: fix potential overflow in strtol()
This patch fixes the potential overflow which may happen during
conversion of signed long. On a platforms where signed long
is only 32 bits the address which is stored in temp_s will experience
overflow.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-08-27 13:49:27 +01:00
Zhang Peng 9716e10a3e config: Add imx8ulp.toml
Add imx8ulp toml file to support sof-imx8ulp.ri binary build.

Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
2021-07-29 14:22:39 +03:00
sunil b28b9939dc fixing incorrect data offset in ri_manifest_sign_v1_5 2021-07-27 17:40:10 +01:00
balakishorepati d1553e9321 config: add rn toml file to support renoir build
Add rn toml file to support sof-rn.ri binary build

Signed-off-by: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
Signed-off-by: Anup Kulkarni <anup.kulkarni@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
2021-07-26 14:44:51 +01:00
Keyon Jie 246ea6469a config: skl: change image_size to the real SRAM size
We have 30 bank HP and 2 bank LP SRAM on SKL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-23 13:58:03 +08:00
Keyon Jie 9c9e07c650 config: kbl: change image_size to the real SRAM size
We have 30 bank HP and 2 bank LP SRAM on KBL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-23 13:58:03 +08:00
Keyon Jie 44b37d19a2 config: sue: change image_size to the real SRAM size
We have 47 bank HP and 1 bank LP SRAM on Suecreek, change the toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-21 11:58:20 +01:00
Rander Wang 580e4d674e config: tgl-cavs: change image_size to the real SRAM size
Apply "config: tgl: change image_size to the real SRAM size"
(9e50a02f1b) to tgl-cavs

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-07-21 18:03:59 +08:00
Keyon Jie 9a26e45580 config: apl: change image_size to the real SRAM size
We have 8 bank HP and 2 bank LP SRAM on APL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-02 12:51:46 +01:00
Keyon Jie 8a2ea0044d config: cnl: change image_size to the real SRAM size
We have 47 bank HP and 1 bank LP SRAM on CNL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-02 12:51:46 +01:00
Keyon Jie 1de9ccca33 config: jsl: change image_size to the real SRAM size
We have 16 bank HP and 1 bank LP SRAM on JSL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-02 12:51:46 +01:00
Keyon Jie f52a078aad config: icl: change image_size to the real SRAM size
We have 47 bank HP and 1 bank LP SRAM on ICL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-02 12:51:46 +01:00
Keyon Jie 8073ea3ef9 config: tgl-h: change image_size to the real SRAM size
We have 30 bank HP and 1 bank LP SRAM on TGL-H, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-02 12:51:46 +01:00
Keyon Jie 9e50a02f1b config: tgl: change image_size to the real SRAM size
We have 46 bank HP and 1 bank LP SRAM on TGL, change to toml config file
to reflect that.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-07-02 12:51:46 +01:00
Slawomir Blauciak 5aeb95b19b sanity check allocated memory
Issue detected by Klocwork

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2021-05-26 13:22:32 +01:00
Curtis Malainey 6f45b61921 actions: add cppcheck and yamllint
CI saves lives

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-19 11:12:14 +01:00
Curtis Malainey 7764a8bd31 manifest: close file on error
found via cppcheck

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-19 11:12:14 +01:00
Curtis Malainey 1cca9bf01d ext_manifest: cppcheck: refactor to silence false positive
memory clearly has exit path through argument, factor out temporary
variable to silence cppcheck

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-19 11:12:14 +01:00
Curtis Malainey 8f42ee88cc adsp_config: fix out of bounds error
cppcheck find

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-19 11:12:14 +01:00
Karol Trzcinski 0297c671fc config: Fix 'module' parsing error messages
'key' argument must describe 'key' which triggered error message
to keep stderr output helpful.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-05-05 12:26:10 +01:00
Karol Trzcinski 994ee247e1 ext_man: Fix code formating
Function parameters should be separated by ', '.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-04-27 11:08:40 +01:00
Karol Trzcinski 6c44aefb1f ext_man: Fix memory leak after manifest build
sec_buffer allocated inside elf_read_section()
was not being freed before and is freed now.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2021-04-27 11:08:40 +01:00
Rander Wang dbb49e03b9 rimage: add cavs fw layout support
Add support of cavs extended manifest and modules. Now
we will have another config tgl-cavs for tgl.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-04-21 09:13:28 +01:00
Marc Herbert 0d641a7b05 minor -h fix: -s meu_offset disables rimage signing
It wasn't exactly obvious who does what.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 20:15:02 +00:00
Marc Herbert 0dba230832 pkcs_v1_5_sign_man_v2_5(): add "salt length" comment
This comment is meant for "git grep salt", that's its main purpose.

Much more obvious timestamps aside, this new code is the only
non-deterministic part of rimage - learned the very hard way
(OpenSSL "documentation" calls it "sLen"...)

A/B testing of build system changes is much, much easier when
locally and temporarily making the build 100% deterministic.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-01-06 11:05:07 +00:00
Pan Xiuli d1f91efdc1 config: add tgl-h toml file to support tglh build
Add tgl-h toml file to support sof-tgl-h.ri binary build

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-12-07 09:54:14 +00:00
Pan Xiuli 2e29db4523 config: merge icl and jsl toml file
ICL and JSL is same DSP with differnt HW config.
They can share same toml file

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-12-07 09:54:14 +00:00
Liam Girdwood 7b7c192e70 verify: add signature verification support
Add support to verify signatures of cavs firmware binaries.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood 1c1c09ce7e manifest: cavs25: Add support for ext data type 0x16
This type was used by early versions of meu, but the hash is not
used in later versions. Leave the code in in case it has to come back.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood db40934e57 cavs: add support for cavs2.5 code signing
cavs 2.5 uses a larger key and the RSA signing PSS mode.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood 68b3693de1 plat_auth: use cavs 2.5 plat auth offsets
cavs2.5 has different offsets for plat auth data.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood f84676f5d9 hash: make module_sha384_create non static.
Used by other clients now.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood df204853b9 pkcs: Add PSS signing mechanism for CAVS2.5
Add RSA PSS signing support for CAVS 2.5 platforms.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood 0c3f8e29c5 user: manifest: add macros for SHA385 modulus length
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Liam Girdwood 7e9952f2c8 manifest: Add cavs2.5 structures and offsets
cavs2.5 has different offsets and structures.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00
Jaska Uimonen 8478c03483 cse: add simple crc32 function to calculate the v2.5 header checksum
Add simple crc32 function to calculate the checksum for v2.5 headers.
Implementation is very simple using shift register as we don't require
speed. Calculate the v2.5 header checksum with crc-32/iso-hdlc
parameters.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-11-16 11:56:58 +00:00