<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/drivers/firmware/arm_scmi/perf.c, branch jd/unified-crypt-queue</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/drivers/firmware/arm_scmi/perf.c?h=jd%2Funified-crypt-queue</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/drivers/firmware/arm_scmi/perf.c?h=jd%2Funified-crypt-queue'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2020-02-20T17:12:24Z</updated>
<entry>
<title>firmware: arm_scmi/perf: Replace zero-length array with flexible-array member</title>
<updated>2020-02-20T17:12:24Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavo@embeddedor.com</email>
</author>
<published>2020-02-11T23:12:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=8694548ae1f245ad164d90d7aeafc7ab3bee71a4'/>
<id>urn:sha1:8694548ae1f245ad164d90d7aeafc7ab3bee71a4</id>
<content type='text'>
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertenly introduced[3] to the codebase from now on.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Replace the zero-length member "opp" in scmi_msg_resp_perf_describe_levels
structure with flexible-array.

Link: https://lore.kernel.org/r/20200211231252.GA14830@embeddedor
Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: Stash version in protocol init functions</title>
<updated>2019-12-24T11:35:49Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2019-11-22T14:48:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=b55b06b79445574fa031158fe2ae2946cde0d1b7'/>
<id>urn:sha1:b55b06b79445574fa031158fe2ae2946cde0d1b7</id>
<content type='text'>
In order to avoid querying the individual protocol versions multiple
time with more that one device created for each protocol, we can simple
store the copy in the protocol specific private data and use them whenever
required.

Reviewed-by: Cristian Marussi &lt;cristian.marussi@arm.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: Fix doorbell ring logic for !CONFIG_64BIT</title>
<updated>2019-11-14T11:13:50Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2019-11-11T16:25:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=7bd39bc6bfdf96f5df0f92199bbc1a3ee2f2adb8'/>
<id>urn:sha1:7bd39bc6bfdf96f5df0f92199bbc1a3ee2f2adb8</id>
<content type='text'>
The logic to ring the scmi performance fastchannel ignores the
value read from the doorbell register in case of !CONFIG_64BIT.
This bug also shows up as warning with '-Wunused-but-set-variable' gcc
flag:

drivers/firmware/arm_scmi/perf.c: In function scmi_perf_fc_ring_db:
drivers/firmware/arm_scmi/perf.c:323:7: warning: variable val set but
			not used [-Wunused-but-set-variable]

Fix the same by aligning the logic with CONFIG_64BIT as used in the
macro SCMI_PERF_FC_RING_DB().

Fixes: 823839571d76 ("firmware: arm_scmi: Make use SCMI v2.0 fastchannel for performance protocol")
Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Reported-by: Zheng Yongjun &lt;zhengyongjun3@huawei.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: Make use SCMI v2.0 fastchannel for performance protocol</title>
<updated>2019-08-12T11:23:01Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2019-07-08T08:41:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=823839571d76d465c6e454495864b085d699adb5'/>
<id>urn:sha1:823839571d76d465c6e454495864b085d699adb5</id>
<content type='text'>
SCMI v2.0 adds support for "FastChannel" which do not use a message
header as they are specialized for a single message.

Only PERFORMANCE_LIMITS_{SET,GET} and PERFORMANCE_LEVEL_{SET,GET}
commands are supported over fastchannels. As they are optional, they
need to be discovered by PERFORMANCE_DESCRIBE_FASTCHANNEL command.
Further {LIMIT,LEVEL}_SET commands can have optional doorbell support.

Add support for making use of these fastchannels.

Cc: Ionela Voinescu &lt;Ionela.Voinescu@arm.com&gt;
Cc: Chris Redpath &lt;Chris.Redpath@arm.com&gt;
Cc: Quentin Perret &lt;Quentin.Perret@arm.com&gt;
Reviewed-by: Peng Fan &lt;peng.fan@nxp.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: Add discovery of SCMI v2.0 performance fastchannels</title>
<updated>2019-08-12T11:23:01Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2019-07-08T08:41:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=ac8aaf348cf54a07aff8e709329ef82ecfa230cc'/>
<id>urn:sha1:ac8aaf348cf54a07aff8e709329ef82ecfa230cc</id>
<content type='text'>
SCMI v2.0 adds support for "FastChannel", a lightweight unidirectional
channel that is dedicated to a single SCMI message type for controlling
a specific platform resource. They do not use a message header as they
are specialized for a single message.

Only PERFORMANCE_LIMITS_{SET,GET} and PERFORMANCE_LEVEL_{SET,GET}
commands are supported over fastchannels. As they are optional, they
need to be discovered by PERFORMANCE_DESCRIBE_FASTCHANNEL command.
Further {LIMIT,LEVEL}_SET commands can have optional doorbell support.

Add support for discovery of these fastchannels.

Cc: Ionela Voinescu &lt;Ionela.Voinescu@arm.com&gt;
Cc: Chris Redpath &lt;Chris.Redpath@arm.com&gt;
Cc: Quentin Perret &lt;Quentin.Perret@arm.com&gt;
Reviewed-by: Peng Fan &lt;peng.fan@nxp.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: Use {get,put}_unaligned_le{32,64} accessors</title>
<updated>2019-08-12T11:23:01Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2019-08-07T12:46:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=aa90ac45bc88e6a8efb199e45dab5d5a6b01c3d2'/>
<id>urn:sha1:aa90ac45bc88e6a8efb199e45dab5d5a6b01c3d2</id>
<content type='text'>
Instead of type-casting the {tx,rx}.buf all over the place while
accessing them to read/write __le{32,64} from/to the firmware, let's
use the existing {get,put}_unaligned_le{32,64} accessors to hide all
the type cast ugliness.

Suggested-by: Philipp Zabel &lt;p.zabel@pengutronix.de&gt;
Reviewed-by: Philipp Zabel &lt;p.zabel@pengutronix.de&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: add a getter for power of performance states</title>
<updated>2018-09-10T16:37:06Z</updated>
<author>
<name>Quentin Perret</name>
<email>quentin.perret@arm.com</email>
</author>
<published>2018-09-10T16:28:10Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=1a63fe9a2b1f47af5b2b7436b41824b14999c17a'/>
<id>urn:sha1:1a63fe9a2b1f47af5b2b7436b41824b14999c17a</id>
<content type='text'>
The SCMI protocol can be used to get power estimates from firmware
corresponding to each performance state of a device. Although these power
costs are already managed by the SCMI firmware driver, they are not
exposed to any external subsystem yet.

Fix this by adding a new get_power() interface to the exisiting perf_ops
defined for the SCMI protocol.

Signed-off-by: Quentin Perret &lt;quentin.perret@arm.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings</title>
<updated>2018-09-10T09:08:44Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2018-09-07T16:03:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=ca64b719a1e665ac7449b6a968059176af7365a8'/>
<id>urn:sha1:ca64b719a1e665ac7449b6a968059176af7365a8</id>
<content type='text'>
Replace all the memcpy() for copying name strings from the firmware with
strlcpy() to make sure we are bounded by the source buffer size and we
also always have NULL-terminated strings.

This is needed to avoid out of bounds accesses if the firmware returns
a non-terminated string.

Reported-by: Olof Johansson &lt;olof@lixom.net&gt;
Acked-by: Olof Johansson &lt;olof@lixom.net&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero</title>
<updated>2018-09-06T16:59:40Z</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2018-09-06T15:10:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=96d529bac562574600eda85726fcfa3eef6dde8e'/>
<id>urn:sha1:96d529bac562574600eda85726fcfa3eef6dde8e</id>
<content type='text'>
Firmware can provide zero as values for sustained performance level and
corresponding sustained frequency in kHz in order to hide the actual
frequencies and provide only abstract values. It may endup with divide
by zero scenario resulting in kernel panic.

Let's set the multiplication factor to one if either one or both of them
(sustained_perf_level and sustained_freq) are set to zero.

Fixes: a9e3fbfaa0ff ("firmware: arm_scmi: add initial support for performance protocol")
Reported-by: Ionela Voinescu &lt;ionela.voinescu@arm.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
Signed-off-by: Olof Johansson &lt;olof@lixom.net&gt;
</content>
</entry>
<entry>
<title>firmware: arm_scmi: remove some unnecessary checks</title>
<updated>2018-07-09T09:50:20Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-05-19T06:37:15Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=23cae492b4ed8cb2eb741f21a48bfd712960e87f'/>
<id>urn:sha1:23cae492b4ed8cb2eb741f21a48bfd712960e87f</id>
<content type='text'>
The "pi-&gt;dom_info" buffer is allocated in init() and it can't be NULL
here.  These tests are sort of weird as well because if "pi-&gt;dom_info"
was NULL but "domain" was non-zero then it would lead to an Oops.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
</content>
</entry>
</feed>
