<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/platform/chrome, branch v6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-03-24T02:56:28Z</updated>
<entry>
<title>platform/chrome: cros_ec_chardev: fix kernel data leak from ioctl</title>
<updated>2023-03-24T02:56:28Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-03-24T01:06:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b20cf3f89c56b5f6a38b7f76a8128bf9f291bbd3'/>
<id>urn:sha1:b20cf3f89c56b5f6a38b7f76a8128bf9f291bbd3</id>
<content type='text'>
It is possible to peep kernel page's data by providing larger `insize`
in struct cros_ec_command[1] when invoking EC host commands.

Fix it by using zeroed memory.

[1]: https://elixir.bootlin.com/linux/v6.2/source/include/linux/platform_data/cros_ec_proto.h#L74

Fixes: eda2e30c6684 ("mfd / platform: cros_ec: Miscellaneous character device to talk with the EC")
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Link: https://lore.kernel.org/r/20230324010658.1082361-1-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_typec: Fix spelling mistake</title>
<updated>2023-02-08T18:21:03Z</updated>
<author>
<name>Colin Ian King</name>
<email>colin.i.king@gmail.com</email>
</author>
<published>2023-02-07T09:14:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b0d8a67715dae445c065c83a40a581d6563a341f'/>
<id>urn:sha1:b0d8a67715dae445c065c83a40a581d6563a341f</id>
<content type='text'>
There is a spelling mistake in a dev_warn message, make it lower case
and fix the spelling.

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Reviewed-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Link: https://lore.kernel.org/r/20230207091443.143995-1-colin.i.king@gmail.com
Signed-off-by: Prashant Malani &lt;pmalani@chromium.org&gt;
[pmalani fixed up commit message based on tzungbi comment]
</content>
</entry>
<entry>
<title>platform/chrome: cros_typec_vdm: Add Attention support</title>
<updated>2023-01-31T18:12:18Z</updated>
<author>
<name>Prashant Malani</name>
<email>pmalani@chromium.org</email>
</author>
<published>2023-01-26T20:55:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f54c013e7eef2962e610c9223e13659e65dfb550'/>
<id>urn:sha1:f54c013e7eef2962e610c9223e13659e65dfb550</id>
<content type='text'>
Add support to retrieve VDM attention messages and forward them to the
appropriate alt mode driver.

Signed-off-by: Prashant Malani &lt;pmalani@chromium.org&gt;
Reviewed-by: Benson Leung &lt;bleung@chromium.org&gt;
Reviewed-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20230126205620.3714994-2-pmalani@chromium.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_typec_vdm: Fix VDO copy</title>
<updated>2023-01-24T19:02:38Z</updated>
<author>
<name>Prashant Malani</name>
<email>pmalani@chromium.org</email>
</author>
<published>2023-01-13T18:26:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=478f32ab4daae8a9bae3723d1040c6e4e3a09bc5'/>
<id>urn:sha1:478f32ab4daae8a9bae3723d1040c6e4e3a09bc5</id>
<content type='text'>
The usage of memcpy() affects the representation of the VDOs as they are
copied to the EC Host Command buffer. Specifically, all higher order
bits get dropped (for example: a VDO of 0x406 just gets copied as 0x6).

Avoid this by explicitly copying each VDO in the array. The number of
VDOs generated by alternate mode drivers in their VDMs is almost always
just 1 (apart from the header) so this doesn't affect performance in a
meaningful way).

Fixes: 40a9b13a09ef ("platform/chrome: cros_typec_vdm: Add VDM send support")
Signed-off-by: Prashant Malani &lt;pmalani@chromium.org&gt;
Reviewed-by: Benson Leung &lt;bleung@chromium.org&gt;
Link: https://lore.kernel.org/r/20230113182626.1149539-1-pmalani@chromium.org
Signed-off-by: Prashant Malani &lt;pmalani@chromium.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_typec: allow deferred probe of switch handles</title>
<updated>2023-01-24T19:02:38Z</updated>
<author>
<name>Victor Ding</name>
<email>victording@chromium.org</email>
</author>
<published>2023-01-24T07:56:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=13aba1e532f047459a683f76439ad90fb29eab05'/>
<id>urn:sha1:13aba1e532f047459a683f76439ad90fb29eab05</id>
<content type='text'>
`fwnode_typec_{retimer,mux,switch}_get()` could return `-EPROBE_DEFER`,
which is called from `cros_typec_get_switch_handles`. When this happens,
it does not indicate absence of switches; instead, it only hints that
probing of switches should occur at a later time.

Progagate `-EPROBE_DEFER` to upper layer logic so that they can re-try
probing switches as a better time.

Signed-off-by: Victor Ding &lt;victording@chromium.org&gt;
Reviewed-by: Benson Leung &lt;bleung@chromium.org&gt;
Reviewed-by: Guenter Roeck &lt;groeck@chromium.org&gt;
Reviewed-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20230124075555.v3.1.I6c0a089123fdf143f94ef4cca8677639031856cf@changeid
Signed-off-by: Prashant Malani &lt;pmalani@chromium.org&gt;
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_proto: remove big stub objects from stack</title>
<updated>2023-01-18T02:57:56Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-01-17T08:02:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6514bac4a321daaf2fdf3a116a644c77e4908f20'/>
<id>urn:sha1:6514bac4a321daaf2fdf3a116a644c77e4908f20</id>
<content type='text'>
sizeof(struct device) = 680
sizeof(struct cros_ec_dev) = 720

They tend to exceed the stack frame size limit in some specific
environment which results in the following compilation error:

&gt;&gt; drivers/platform/chrome/cros_ec_proto_test.c:2530:13: error: stack
frame size (2128) exceeds limit (2048) in
'cros_ec_proto_test_get_sensor_count_legacy'

Remove the big stub objects from stack.

This is:
$ sed -i 's/struct cros_ec_dev /static struct cros_ec_dev /' \
    drivers/platform/chrome/cros_ec_proto_test.c

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20230117080254.2725536-1-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_uart: fix negative type promoted to high</title>
<updated>2023-01-18T02:57:51Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-01-09T08:15:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8bb233b27fb7c11deefbe2318e75490b22cf3d1a'/>
<id>urn:sha1:8bb233b27fb7c11deefbe2318e75490b22cf3d1a</id>
<content type='text'>
serdev_device_write_buf() returns negative numbers on errors.  When
the return value compares to unsigned integer `len`, it promotes to
quite large positive number.

Fix it.

Fixes: 04a8bdd135cc ("platform/chrome: cros_ec_uart: Add transport layer")
Reported-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reviewed-by: Benson Leung &lt;bleung@chromium.org&gt;
Link: https://lore.kernel.org/r/20230109081554.3792547-1-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec: Use per-device lockdep key</title>
<updated>2023-01-13T01:30:50Z</updated>
<author>
<name>Chen-Yu Tsai</name>
<email>wenst@chromium.org</email>
</author>
<published>2023-01-11T07:41:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=961a325becd9a142ae5c8b258e5c2f221f8bfac8'/>
<id>urn:sha1:961a325becd9a142ae5c8b258e5c2f221f8bfac8</id>
<content type='text'>
Lockdep reports a bogus possible deadlock on MT8192 Chromebooks due to
the following lock sequences:

1. lock(i2c_register_adapter) [1]; lock(&amp;ec_dev-&gt;lock)
2. lock(&amp;ec_dev-&gt;lock); lock(prepare_lock);

The actual dependency chains are much longer. The shortened version
looks somewhat like:

1. cros-ec-rpmsg on mtk-scp
   ec_dev-&gt;lock -&gt; prepare_lock
2. In rt5682_i2c_probe() on native I2C bus:
   prepare_lock -&gt; regmap-&gt;lock -&gt; (possibly) i2c_adapter-&gt;bus_lock
3. In rt5682_i2c_probe() on native I2C bus:
   regmap-&gt;lock -&gt; i2c_adapter-&gt;bus_lock
4. In sbs_probe() on i2c-cros-ec-tunnel I2C bus attached on cros-ec:
   i2c_adapter-&gt;bus_lock -&gt; ec_dev-&gt;lock

While lockdep is correct that the shared lockdep classes have a circular
dependency, it is bogus because

  a) 2+3 happen on a native I2C bus
  b) 4 happens on the actual EC on ChromeOS devices
  c) 1 happens on the SCP coprocessor on MediaTek Chromebooks that just
     happens to expose a cros-ec interface, but does not have an
     i2c-cros-ec-tunnel I2C bus

In short, the "dependencies" are actually on different devices.

Setup a per-device lockdep key for cros_ec devices so lockdep can tell
the two instances apart. This helps with getting rid of the bogus
lockdep warning. For ChromeOS devices that only have one cros-ec
instance this doesn't change anything.

Also add a missing mutex_destroy, just to make the teardown complete.

[1] This is likely the per I2C bus lock with shared lockdep class

Signed-off-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20230111074146.2624496-1-wenst@chromium.org
</content>
</entry>
<entry>
<title>platform/chrome: fix kernel-doc warnings for panic notifier</title>
<updated>2023-01-13T01:30:49Z</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-01-11T05:57:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=16d73129f1fd8e91eb565482245233809647c649'/>
<id>urn:sha1:16d73129f1fd8e91eb565482245233809647c649</id>
<content type='text'>
Fix the following kernel-doc warnings:

$ ./scripts/kernel-doc -none drivers/platform/chrome/*
drivers/platform/chrome/cros_ec_debugfs.c:54: warning: Function
parameter or member 'notifier_panic' not described in 'cros_ec_debugfs'

$ ./scripts/kernel-doc -none include/linux/platform_data/cros_ec_proto.h
include/linux/platform_data/cros_ec_proto.h:187: warning: Function
parameter or member 'panic_notifier' not described in 'cros_ec_device'

Cc: Rob Barnes &lt;robbarnes@google.com&gt;
Fixes: d90fa2c64d59 ("platform/chrome: cros_ec: Poll EC log on EC panic")
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Reviewed-by: Guenter Roeck &lt;groweck@chromium.org&gt;
Link: https://lore.kernel.org/r/20230111055728.708990-2-tzungbi@kernel.org
</content>
</entry>
<entry>
<title>platform/chrome: cros_ec_lpc: initialize the buf variable</title>
<updated>2023-01-11T03:27:56Z</updated>
<author>
<name>Tom Rix</name>
<email>trix@redhat.com</email>
</author>
<published>2023-01-10T19:36:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ae3c610e7d21bc4a27da2b71f7007f2c4efce01'/>
<id>urn:sha1:2ae3c610e7d21bc4a27da2b71f7007f2c4efce01</id>
<content type='text'>
Clang static analysis reports this problem
drivers/platform/chrome/cros_ec_lpc.c:379:13: warning: The left operand
  of '!=' is a garbage value [core.UndefinedBinaryOperatorResult]
    if (buf[0] != 'E' || buf[1] != 'C') {
         ~~~~~~ ^

The check depends on the side effect of the read.  When the read fails
or is short, a buf containing garbage could be mistaken as correct.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20230110193611.3573777-1-trix@redhat.com
</content>
</entry>
</feed>
