]> git.baikalelectronics.ru Git - kernel.git/commit
soc: qcom: mdt_loader: Drop PT_LOAD check on hash segment
authorShawn Guo <shawn.guo@linaro.org>
Sat, 28 Aug 2021 07:02:02 +0000 (15:02 +0800)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Mon, 20 Sep 2021 00:55:20 +0000 (19:55 -0500)
commit9a03c7c200067e2d7b90ecb1114b7a8eceee4330
tree5c203defe78e96759aaffbdb54affba70c13e46b
parente8e81f0b4048ddf05fe33d6e5917591fe78d02dc
soc: qcom: mdt_loader: Drop PT_LOAD check on hash segment

PT_LOAD type denotes that the segment should be loaded into the final
firmware memory region.  Hash segment is not one such, because it's only
needed for PAS init and shouldn't be in the final firmware memory region.
That's why mdt_phdr_valid() explicitly reject non PT_LOAD segment and
hash segment.  This actually makes the hash segment type check in
qcom_mdt_read_metadata() unnecessary and redundant.  For a hash segment,
it won't be loaded into firmware memory region anyway, due to the
QCOM_MDT_TYPE_HASH check in mdt_phdr_valid(), even if it has a PT_LOAD
type for some reason (misusing or abusing?).

Some firmware files on Sony phones are such examples, e.g WCNSS firmware
of Sony Xperia M4 Aqua phone.  The type of hash segment is just PT_LOAD.
Drop the unnecessary hash segment type check in qcom_mdt_read_metadata()
to fix firmware loading failure on these phones, while hash segment is
still kept away from the final firmware memory region.

Fixes: d13e5c7e7a3e ("soc: qcom: mdt_loader: Support loading non-split images")
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210828070202.7033-1-shawn.guo@linaro.org
drivers/soc/qcom/mdt_loader.c