<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/soc/apple/rtkit.c, branch v6.16</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>soc: apple: rtkit: Cut syslog messages after the first '\0'</title>
<updated>2025-02-28T21:36:45+00:00</updated>
<author>
<name>Janne Grunau</name>
<email>j@jannau.net</email>
</author>
<published>2025-02-26T19:00:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e210227f0259d2666cc41b28ed1b7b0b0a99ed4d'/>
<id>e210227f0259d2666cc41b28ed1b7b0b0a99ed4d</id>
<content type='text'>
Certain messages from DCP contain NUL bytes in the random data after the
NUL terminated syslog message. Since the syslog message ends with '\n'
this results in a dev_info() message terminated with two newlines and an
empty printed line in the kernel log.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-4-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Certain messages from DCP contain NUL bytes in the random data after the
NUL terminated syslog message. Since the syslog message ends with '\n'
this results in a dev_info() message terminated with two newlines and an
empty printed line in the kernel log.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-4-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Use high prio work queue</title>
<updated>2025-02-28T21:36:45+00:00</updated>
<author>
<name>Janne Grunau</name>
<email>j@jannau.net</email>
</author>
<published>2025-02-26T19:00:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=22af2fac88fa5dbc310bfe7d0b66d4de3ac47305'/>
<id>22af2fac88fa5dbc310bfe7d0b66d4de3ac47305</id>
<content type='text'>
rtkit messages as communication with the DCP firmware for framebuffer
swaps or input events are time critical so use WQ_HIGHPRI to prevent
user space CPU load to increase latency.
With kwin_wayland 6's explicit sync mode user space load was able to
delay the IOMFB rtkit communication enough to miss vsync for surface
swaps. Minimal test scenario is constantly resizing a glxgears
Xwayland window.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-3-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rtkit messages as communication with the DCP firmware for framebuffer
swaps or input events are time critical so use WQ_HIGHPRI to prevent
user space CPU load to increase latency.
With kwin_wayland 6's explicit sync mode user space load was able to
delay the IOMFB rtkit communication enough to miss vsync for surface
swaps. Minimal test scenario is constantly resizing a glxgears
Xwayland window.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-3-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Implement OSLog buffers properly</title>
<updated>2025-02-28T21:36:45+00:00</updated>
<author>
<name>Hector Martin</name>
<email>marcan@marcan.st</email>
</author>
<published>2025-02-26T19:00:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a06398687065e0c334dc5fc4d2778b5b87292e43'/>
<id>a06398687065e0c334dc5fc4d2778b5b87292e43</id>
<content type='text'>
Apparently nobody can figure out where the old logic came from, but it
seems like it has never been actually used on any supported firmware to
this day. OSLog buffers were apparently never requested.

But starting with 13.3, we actually need this implemented properly for
MTP (and later AOP) to work, so let's actually do that.

Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-2-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Apparently nobody can figure out where the old logic came from, but it
seems like it has never been actually used on any supported firmware to
this day. OSLog buffers were apparently never requested.

But starting with 13.3, we actually need this implemented properly for
MTP (and later AOP) to work, so let's actually do that.

Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-2-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON</title>
<updated>2025-02-28T21:36:45+00:00</updated>
<author>
<name>Janne Grunau</name>
<email>j@jannau.net</email>
</author>
<published>2025-02-26T19:00:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3e46b6df8465e7a1c0d8e87a0966ecfb753ae84b'/>
<id>3e46b6df8465e7a1c0d8e87a0966ecfb753ae84b</id>
<content type='text'>
This state is needed to wake the dcp IOP after m1n1 shut it down
and works for all other co-processors as well.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-1-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This state is needed to wake the dcp IOP after m1n1 shut it down
and works for all other co-processors as well.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Reviewed-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Link: https://lore.kernel.org/r/20250226-apple-soc-misc-v2-1-c3ec37f9021b@svenpeter.dev
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Fix use-after-free in apple_rtkit_crashlog_rx()</title>
<updated>2025-02-18T17:01:20+00:00</updated>
<author>
<name>Harshit Mogalapalli</name>
<email>harshit.m.mogalapalli@oracle.com</email>
</author>
<published>2025-02-12T08:58:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=00834971f0d9e38beae37e92055b1432782827d0'/>
<id>00834971f0d9e38beae37e92055b1432782827d0</id>
<content type='text'>
This code calls kfree(bfr); and then passes "bfr" to rtk-&gt;ops-&gt;crashed()
which is a use after free.  The -&gt;crashed function pointer is implemented
by apple_nvme_rtkit_crashed() and it doesn't use the "bfr" pointer so
this doesn't cause a problem.  But it still looks sketchy as can be.

Fix this by moving kfree() after the last usage of bfr.

Fixes: bf8b4e49777d ("soc: apple: rtkit: Pass the crashlog to the crashed() callback")
Signed-off-by: Harshit Mogalapalli &lt;harshit.m.mogalapalli@oracle.com&gt;
Reviewed-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Link: https://lore.kernel.org/r/20250212085853.1357906-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This code calls kfree(bfr); and then passes "bfr" to rtk-&gt;ops-&gt;crashed()
which is a use after free.  The -&gt;crashed function pointer is implemented
by apple_nvme_rtkit_crashed() and it doesn't use the "bfr" pointer so
this doesn't cause a problem.  But it still looks sketchy as can be.

Fix this by moving kfree() after the last usage of bfr.

Fixes: bf8b4e49777d ("soc: apple: rtkit: Pass the crashlog to the crashed() callback")
Signed-off-by: Harshit Mogalapalli &lt;harshit.m.mogalapalli@oracle.com&gt;
Reviewed-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Link: https://lore.kernel.org/r/20250212085853.1357906-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Pass the crashlog to the crashed() callback</title>
<updated>2025-02-18T16:59:11+00:00</updated>
<author>
<name>Asahi Lina</name>
<email>lina@asahilina.net</email>
</author>
<published>2025-02-02T13:48:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bf8b4e49777d944f84cf7d47360fe80dd3f69d96'/>
<id>bf8b4e49777d944f84cf7d47360fe80dd3f69d96</id>
<content type='text'>
Client drivers might want a copy of the crashlog to stash into a
devcoredump blob. Since device memory management can be very variable,
the actual devcoredump implementation is left to client drivers. Pass
the raw crashlog buffer to the client callback so it can use it if
desired.

Signed-off-by: Asahi Lina &lt;lina@asahilina.net&gt;
Reviewed-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Link: https://lore.kernel.org/r/20250202-rtkit-crashdump-v1-1-9d38615b4e12@asahilina.net
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Client drivers might want a copy of the crashlog to stash into a
devcoredump blob. Since device memory management can be very variable,
the actual devcoredump implementation is left to client drivers. Pass
the raw crashlog buffer to the client callback so it can use it if
desired.

Signed-off-by: Asahi Lina &lt;lina@asahilina.net&gt;
Reviewed-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Link: https://lore.kernel.org/r/20250202-rtkit-crashdump-v1-1-9d38615b4e12@asahilina.net
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Check &amp; log more failures</title>
<updated>2025-02-18T15:32:44+00:00</updated>
<author>
<name>Asahi Lina</name>
<email>lina@asahilina.net</email>
</author>
<published>2025-02-11T17:59:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=ca0272d8638a4c50ecc2c63719f81e022d3450f1'/>
<id>ca0272d8638a4c50ecc2c63719f81e022d3450f1</id>
<content type='text'>
Check and log the following failures:

* regular messages
* management messages
* failed buffer requests

This helps debugging.

Signed-off-by: Asahi Lina &lt;lina@asahilina.net&gt;
Signed-off-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Reviewed-by: Neal Gompa &lt;neal@gompa.dev&gt;
Link: https://lore.kernel.org/r/20250211-rtkit-more-logging-v1-1-93334e9c1c77@rosenzweig.io
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Check and log the following failures:

* regular messages
* management messages
* failed buffer requests

This helps debugging.

Signed-off-by: Asahi Lina &lt;lina@asahilina.net&gt;
Signed-off-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Reviewed-by: Neal Gompa &lt;neal@gompa.dev&gt;
Link: https://lore.kernel.org/r/20250211-rtkit-more-logging-v1-1-93334e9c1c77@rosenzweig.io
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Port to the internal mailbox driver</title>
<updated>2023-11-23T10:10:17+00:00</updated>
<author>
<name>Hector Martin</name>
<email>marcan@marcan.st</email>
</author>
<published>2023-03-14T10:46:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bb538effdc71397f2d08bb98df6b326d3b5b2333'/>
<id>bb538effdc71397f2d08bb98df6b326d3b5b2333</id>
<content type='text'>
Now that we have a mailbox driver in drivers/soc/apple, port the RTKit
code to it. This mostly just entails replacing calls through the mailbox
subsystem with direct calls into the driver.

Acked-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Acked-by: Neal Gompa &lt;neal@gompa.dev&gt;
Acked-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we have a mailbox driver in drivers/soc/apple, port the RTKit
code to it. This mostly just entails replacing calls through the mailbox
subsystem with direct calls into the driver.

Acked-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Acked-by: Neal Gompa &lt;neal@gompa.dev&gt;
Acked-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Get rid of apple_rtkit_send_message_wait</title>
<updated>2023-11-23T10:09:24+00:00</updated>
<author>
<name>Hector Martin</name>
<email>marcan@marcan.st</email>
</author>
<published>2022-05-04T16:25:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=57b79ac9f43dc71fc8b55af51d1c9f469cb7a0de'/>
<id>57b79ac9f43dc71fc8b55af51d1c9f469cb7a0de</id>
<content type='text'>
It is fundamentally broken and has no users. Just remove it.

Acked-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Acked-by: Neal Gompa &lt;neal@gompa.dev&gt;
Acked-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is fundamentally broken and has no users. Just remove it.

Acked-by: Eric Curtin &lt;ecurtin@redhat.com&gt;
Acked-by: Neal Gompa &lt;neal@gompa.dev&gt;
Acked-by: Alyssa Rosenzweig &lt;alyssa@rosenzweig.io&gt;
Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>soc: apple: rtkit: Crop syslog messages</title>
<updated>2023-03-28T10:59:34+00:00</updated>
<author>
<name>Martin Povišer</name>
<email>povik+lin@cutebit.org</email>
</author>
<published>2023-02-24T16:21:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bdfe6de2695c5bccc663a5a7d530f81925d8bc10'/>
<id>bdfe6de2695c5bccc663a5a7d530f81925d8bc10</id>
<content type='text'>
Crop trailing whitespace, null, and newline characters in syslog
messages received from coprocessors. Notably DCP sends its messages
including a trailing newline, so prior to this change we would end up
cluttering the kernel log by repeated newlines at the end of messages.

Signed-off-by: Martin Povišer &lt;povik+lin@cutebit.org&gt;
Reviewed-by: Hector Martin &lt;marcan@marcan.st&gt;
Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Crop trailing whitespace, null, and newline characters in syslog
messages received from coprocessors. Notably DCP sends its messages
including a trailing newline, so prior to this change we would end up
cluttering the kernel log by repeated newlines at the end of messages.

Signed-off-by: Martin Povišer &lt;povik+lin@cutebit.org&gt;
Reviewed-by: Hector Martin &lt;marcan@marcan.st&gt;
Signed-off-by: Hector Martin &lt;marcan@marcan.st&gt;
</pre>
</div>
</content>
</entry>
</feed>
