<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/soc/qcom/mdt_loader.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/soc/qcom/mdt_loader.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/soc/qcom/mdt_loader.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-02-23T19:13:12Z</updated>
<entry>
<title>soc: qcom: mdt_loader: Fix split-firmware condition</title>
<updated>2022-02-23T19:13:12Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-02-15T03:48:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a1b019872693c74d919db4e267f451fc7af9a21c'/>
<id>urn:sha1:a1b019872693c74d919db4e267f451fc7af9a21c</id>
<content type='text'>
The updated condition checking if a segment can be found in the loaded
firmware blob, or need to be loaded from a separate file, incorrectly
classifies segments that ends at the end of the loaded blob. The result
is that the mdt loader attempts to load the segment from a separate
file.

Correct the conditional to use the loaded segment instead.

Fixes: ea90330fa329 ("soc: qcom: mdt_loader: Extend check for split firmware")
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Vinod Koul &lt;vkoul@kernel.org&gt;
Link: https://lore.kernel.org/r/20220215034819.1209367-1-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Extract PAS operations</title>
<updated>2022-02-04T03:54:48Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:08Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f4e526ff7e38e27bb87d53131d227a6fd6f73ab5'/>
<id>urn:sha1:f4e526ff7e38e27bb87d53131d227a6fd6f73ab5</id>
<content type='text'>
Rather than passing a boolean to indicate if the PAS operations should
be performed from within __mdt_load(), extract them to their own helper
function.

This will allow clients to invoke this directly, with some
qcom_scm_pas_metadata context that they later needs to release, without
further having to complicate the prototype of qcom_mdt_load().

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-9-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Always invoke PAS mem_setup</title>
<updated>2022-02-03T21:32:30Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:07Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ebeb20a9cd3f045a3371ccf3782b6cbcce62a7c9'/>
<id>urn:sha1:ebeb20a9cd3f045a3371ccf3782b6cbcce62a7c9</id>
<content type='text'>
After spelunking various old kernel trees no finds has been found
indicating that the PAS mem_setup call should actually be made
conditional on the image being relocatable.

Group the two PAS operations together, to facilitate splitting them out
in a following patch.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-8-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Reorder parts of __qcom_mdt_load()</title>
<updated>2022-02-03T21:32:30Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=75d7213ce19135b8f309099f6618a03e9b397271'/>
<id>urn:sha1:75d7213ce19135b8f309099f6618a03e9b397271</id>
<content type='text'>
Move the traversal of the program headers to the start of the function,
to make sure that min_ and max_addr are in scope as the call to
qcom_scm_pas_mem_setup() is moved in the next commit.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-7-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Extend check for split firmware</title>
<updated>2022-02-03T21:32:30Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ea90330fa329e4bee009223a1d5a7d9bcc364df2'/>
<id>urn:sha1:ea90330fa329e4bee009223a1d5a7d9bcc364df2</id>
<content type='text'>
Some of the Qualcomm SM8450 firmware files are padded such that the
start of the first segment falls within the .mdt file but the segment to
be loaded is stored as a separate .bNN file.

Extend the condition to only attempt to read a segment inline if the
entire segment would be available.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-6-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Allow hash to reside in any segment</title>
<updated>2022-02-03T21:32:30Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:04Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=64fb5eb87d5815ff3811b7dc85f87abc5c38b580'/>
<id>urn:sha1:64fb5eb87d5815ff3811b7dc85f87abc5c38b580</id>
<content type='text'>
It's been observed that some firmware found on Qualcomm SM8450 devices
carries the hash segment as the last segment in the ELF. Extend the
support to allow picking the hash from any segment in the MDT/MBN.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-5-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Allow hash segment to be split out</title>
<updated>2022-02-03T21:32:30Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:03Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8bd42e2341a7857010001f08ee1729ced3b0e394'/>
<id>urn:sha1:8bd42e2341a7857010001f08ee1729ced3b0e394</id>
<content type='text'>
It's been observed that some firmware found in a Qualcomm SM8450 device
has the hash table in a separate .bNN file. Use the newly extracted
helper function to load this segment from the separate file, if it's
determined that the hashes are not part of the already loaded firmware.

In order to do this, the function needs access to the firmware basename
and to provide more useful error messages a struct device to associate
the errors with.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-4-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Split out split-file-loader</title>
<updated>2022-02-03T21:32:29Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:02Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=26c1f17013a8292fa2bd59917bace883e1fe6afa'/>
<id>urn:sha1:26c1f17013a8292fa2bd59917bace883e1fe6afa</id>
<content type='text'>
Spotted in a SM8450 device, the hash metadata segment is split out in a
separate .bNN file which means that the logic for loading split out
segmenents needs to be duplicated in qcom_mdt_read_metadata().

Split out the existing logic to a helper function that can be used in
both code paths.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-3-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>firmware: qcom: scm: Introduce pas_metadata context</title>
<updated>2022-02-03T21:32:29Z</updated>
<author>
<name>Bjorn Andersson</name>
<email>bjorn.andersson@linaro.org</email>
</author>
<published>2022-01-28T02:55:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3a99f121fe0bfa4b65ff74d9e980018caf54c2d4'/>
<id>urn:sha1:3a99f121fe0bfa4b65ff74d9e980018caf54c2d4</id>
<content type='text'>
Starting with Qualcomm SM8450, some new security enhancements has been
done in the secure world, which results in the requirement to keep the
metadata segment accessible by the secure world from init_image() until
auth_and_reset().

Introduce a "PAS metadata context" object that can be passed to
init_image() for tracking the mapped memory and a related release
function for client drivers to release the mapping once either
auth_and_reset() has been invoked or in error handling paths on the way
there.

Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Link: https://lore.kernel.org/r/20220128025513.97188-2-bjorn.andersson@linaro.org
</content>
</entry>
<entry>
<title>soc: qcom: mdt_loader: Drop PT_LOAD check on hash segment</title>
<updated>2021-09-20T00:55:20Z</updated>
<author>
<name>Shawn Guo</name>
<email>shawn.guo@linaro.org</email>
</author>
<published>2021-08-28T07:02:02Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=833d51d7c66d6708abbc02398892b96b950167b9'/>
<id>urn:sha1:833d51d7c66d6708abbc02398892b96b950167b9</id>
<content type='text'>
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: 498b98e93900 ("soc: qcom: mdt_loader: Support loading non-split images")
Signed-off-by: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Reviewed-by: Marijn Suijten &lt;marijn.suijten@somainline.org&gt;
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Link: https://lore.kernel.org/r/20210828070202.7033-1-shawn.guo@linaro.org
</content>
</entry>
</feed>
