<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/soc/qcom/cmd-db.c, branch v5.15.208</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-03-04T12:19:29+00:00</updated>
<entry>
<title>soc: qcom: cmd-db: Use devm_memremap() to fix memory leak in cmd_db_dev_probe</title>
<updated>2026-03-04T12:19:29+00:00</updated>
<author>
<name>Haotian Zhang</name>
<email>vulab@iscas.ac.cn</email>
</author>
<published>2025-12-16T01:39:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a5b4b9a8df2a499160fb1c5f6815a378d6e3d6a7'/>
<id>urn:sha1:a5b4b9a8df2a499160fb1c5f6815a378d6e3d6a7</id>
<content type='text'>
[ Upstream commit 0da7824734d8d83e6a844dd0207f071cb0c50cf4 ]

If cmd_db_magic_matches() fails after memremap() succeeds, the function
returns -EINVAL without unmapping the memory region, causing a
potential resource leak.

Switch to devm_memremap to automatically manage the map resource.

Fixes: 312416d9171a ("drivers: qcom: add command DB driver")
Suggested-by: Dmitry Baryshkov &lt;dmitry.baryshkov@oss.qualcomm.com&gt;
Signed-off-by: Haotian Zhang &lt;vulab@iscas.ac.cn&gt;
Link: https://lore.kernel.org/r/20251216013933.773-1-vulab@iscas.ac.cn
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Map shared memory as WC, not WB</title>
<updated>2024-09-04T11:23:40+00:00</updated>
<author>
<name>Volodymyr Babchuk</name>
<email>Volodymyr_Babchuk@epam.com</email>
</author>
<published>2024-07-18T06:03:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eaff392c1e34fb77cc61505a31b0191e5e46e271'/>
<id>urn:sha1:eaff392c1e34fb77cc61505a31b0191e5e46e271</id>
<content type='text'>
commit f9bb896eab221618927ae6a2f1d566567999839d upstream.

Linux does not write into cmd-db region. This region of memory is write
protected by XPU. XPU may sometime falsely detect clean cache eviction
as "write" into the write protected region leading to secure interrupt
which causes an endless loop somewhere in Trust Zone.

The only reason it is working right now is because Qualcomm Hypervisor
maps the same region as Non-Cacheable memory in Stage 2 translation
tables. The issue manifests if we want to use another hypervisor (like
Xen or KVM), which does not know anything about those specific mappings.

Changing the mapping of cmd-db memory from MEMREMAP_WB to MEMREMAP_WT/WC
removes dependency on correct mappings in Stage 2 tables. This patch
fixes the issue by updating the mapping to MEMREMAP_WC.

I tested this on SA8155P with Xen.

Fixes: 312416d9171a ("drivers: qcom: add command DB driver")
Cc: stable@vger.kernel.org # 5.4+
Signed-off-by: Volodymyr Babchuk &lt;volodymyr_babchuk@epam.com&gt;
Tested-by: Nikita Travkin &lt;nikita@trvn.ru&gt; # sc7180 WoA in EL2
Signed-off-by: Maulik Shah &lt;quic_mkshah@quicinc.com&gt;
Tested-by: Pavankumar Kondeti &lt;quic_pkondeti@quicinc.com&gt;
Reviewed-by: Caleb Connolly &lt;caleb.connolly@linaro.org&gt;
Link: https://lore.kernel.org/r/20240718-cmd_db_uncached-v2-1-f6cf53164c90@quicinc.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: rpmh-rsc: Enhance check for VRM in-flight request</title>
<updated>2024-06-16T11:39:55+00:00</updated>
<author>
<name>Maulik Shah</name>
<email>quic_mkshah@quicinc.com</email>
</author>
<published>2024-02-15T05:25:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=83c4aba920e380ea093b555ac164aa3ea1fa05c1'/>
<id>urn:sha1:83c4aba920e380ea093b555ac164aa3ea1fa05c1</id>
<content type='text'>
commit f592cc5794747b81e53b53dd6e80219ee25f0611 upstream.

Each RPMh VRM accelerator resource has 3 or 4 contiguous 4-byte aligned
addresses associated with it. These control voltage, enable state, mode,
and in legacy targets, voltage headroom. The current in-flight request
checking logic looks for exact address matches. Requests for different
addresses of the same RPMh resource as thus not detected as in-flight.

Add new cmd-db API cmd_db_match_resource_addr() to enhance the in-flight
request check for VRM requests by ignoring the address offset.

This ensures that only one request is allowed to be in-flight for a given
VRM resource. This is needed to avoid scenarios where request commands are
carried out by RPMh hardware out-of-order leading to LDO regulator
over-current protection triggering.

Fixes: 658628e7ef78 ("drivers: qcom: rpmh-rsc: add RPMH controller for QCOM SoCs")
Cc: stable@vger.kernel.org
Reviewed-by: Konrad Dybcio &lt;konrad.dybcio@linaro.org&gt;
Tested-by: Elliot Berman &lt;quic_eberman@quicinc.com&gt; # sm8650-qrd
Signed-off-by: Maulik Shah &lt;quic_mkshah@quicinc.com&gt;
Link: https://lore.kernel.org/r/20240215-rpmh-rsc-fixes-v4-1-9cbddfcba05b@quicinc.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: allow loading as a module</title>
<updated>2020-10-26T21:02:29+00:00</updated>
<author>
<name>Lina Iyer</name>
<email>ilina@codeaurora.org</email>
</author>
<published>2020-10-01T15:41:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=778279f4f5e4e89ff31803ba48135256563825c2'/>
<id>urn:sha1:778279f4f5e4e89ff31803ba48135256563825c2</id>
<content type='text'>
This patch enables Command DB driver to be loaded as a module. Command
DB is inherent to RPMH interaction and as such would never be unloaded.
Add supress_bind_attrs to make it a permanently loaded module.

Reviewed-by: John Stultz &lt;john.stultz@linaro.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Tested-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Lina Iyer &lt;ilina@codeaurora.org&gt;
Link: https://lore.kernel.org/r/20201001154144.5226-1-ilina@codeaurora.org
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Properly endian swap the slv_id for debugfs</title>
<updated>2020-04-20T06:06:29+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2020-04-17T00:06:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=704887278b3fb6e72ef767e56fbae4129e567c48'/>
<id>urn:sha1:704887278b3fb6e72ef767e56fbae4129e567c48</id>
<content type='text'>
Read the slv_id properly by making sure the 16-bit number is endian
swapped from little endian to CPU native before we read it to figure out
what to print for the human readable name. Otherwise we may just show
that all the elements in the cmd-db are "Unknown" which isn't right.

Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Cc: Lina Iyer &lt;ilina@codeaurora.org&gt;
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Link: https://lore.kernel.org/r/20200417000645.234693-1-swboyd@chromium.org
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Use 5 digits for printing address</title>
<updated>2020-04-20T06:06:29+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2020-04-15T19:29:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3adaf26e7b01691eeee4086b7ac70c7750ff126e'/>
<id>urn:sha1:3adaf26e7b01691eeee4086b7ac70c7750ff126e</id>
<content type='text'>
The top few bits aren't relevant to pad out because they're always zero.
Let's just print 5 digits instead of 8 so that it's a little shorter and
more readable.

Reviewed-by: Lina Iyer &lt;ilina@codeaurora.org&gt;
Suggested-by: Lina Iyer &lt;ilina@codeaurora.org&gt;
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Link: https://lore.kernel.org/r/20200415192916.78339-1-swboyd@chromium.org
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning</title>
<updated>2020-04-20T06:06:17+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2020-04-15T06:20:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9d6ba921acf43bf1894564eb3d51ced2145e0147'/>
<id>urn:sha1:9d6ba921acf43bf1894564eb3d51ced2145e0147</id>
<content type='text'>
We pass the result of sizeof() here to tell the printk format specifier
how many bytes to print. That expects an int though and sizeof() isn't
that type. Cast to int to silence this warning:

drivers/soc/qcom/cmd-db.c: In function 'cmd_db_debugfs_dump':
drivers/soc/qcom/cmd-db.c:281:30: warning: field width specifier '*' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Fixes: d6815c5c43d4 ("soc: qcom: cmd-db: Add debugfs dumping file")
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Link: https://lore.kernel.org/r/20200415062033.66406-1-swboyd@chromium.org
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Add debugfs dumping file</title>
<updated>2020-04-14T01:10:11+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2020-03-09T18:57:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d6815c5c43d4f9d18e557d27fd27ae8d9cfd450c'/>
<id>urn:sha1:d6815c5c43d4f9d18e557d27fd27ae8d9cfd450c</id>
<content type='text'>
It's useful for kernel devs to understand what resources and data is
stored inside command db. Add a file in debugufs called 'cmd-db' to dump
the memory contents and strings for resources along with their
addresses. E.g.

 Command DB DUMP
 Slave ARC (v16.0)
 -------------------------
 0x00030000: cx.lvl [00 00 10 00 40 00 80 00 c0 00 00 01 80 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00]
 0x00030004: cx.tmr
 0x00030010: mx.lvl [00 00 10 00 00 01 80 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00]
 0x00030014: mx.tmr

Cc: Lina Iyer &lt;ilina@codeaurora.org&gt;
Cc: Maulik Shah &lt;mkshah@codeaurora.org&gt;
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Link: https://lore.kernel.org/r/20200309185704.2491-1-swboyd@chromium.org
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Fix an error code in cmd_db_dev_probe()</title>
<updated>2019-03-28T04:32:26+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2019-02-28T05:48:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=93b260528020792032e50725383f27a27897bb0f'/>
<id>urn:sha1:93b260528020792032e50725383f27a27897bb0f</id>
<content type='text'>
The memremap() function doesn't return error pointers, it returns NULL.
This code is returning "ret = PTR_ERR(NULL);" which is success, but it
should return -ENOMEM.

Fixes: 312416d9171a ("drivers: qcom: add command DB driver")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Signed-off-by: Andy Gross &lt;andy.gross@linaro.org&gt;
</content>
</entry>
<entry>
<title>soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()</title>
<updated>2018-11-14T18:06:24+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2018-09-26T18:02:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ed3cafa79ea756be653d22087c017af95ea78a49'/>
<id>urn:sha1:ed3cafa79ea756be653d22087c017af95ea78a49</id>
<content type='text'>
Let's change the function signature to return the pointer to memory or
an error pointer on failure, and take an argument that lets us return
the size of the aux data read. This way we can remove the
cmd_db_read_aux_data_len() API entirely and also get rid of the memcpy
operation from cmd_db to the caller. Updating the only user of this code
shows that making this change allows us to remove a function and put the
lookup where the user is.

Cc: Mahesh Sivasubramanian &lt;msivasub@codeaurora.org&gt;
Cc: Lina Iyer &lt;ilina@codeaurora.org&gt;
Cc: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Cc: Evan Green &lt;evgreen@chromium.org&gt;
Cc: Jordan Crouse &lt;jcrouse@codeaurora.org&gt;
Cc: Rob Clark &lt;robdclark@gmail.com&gt;
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Signed-off-by: Andy Gross &lt;andy.gross@linaro.org&gt;
</content>
</entry>
</feed>
