* [PATCH v2 0/4] Miscellaneous Apple RTKit fixes
@ 2025-02-26 19:00 Sven Peter via B4 Relay
2025-02-26 19:00 ` [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON Sven Peter via B4 Relay
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Sven Peter via B4 Relay @ 2025-02-26 19:00 UTC (permalink / raw)
To: Alyssa Rosenzweig, Janne Grunau, Sven Peter
Cc: asahi, linux-arm-kernel, linux-kernel, Hector Martin
Hi,
This series contains four unrelated minor fixes to our RTKit driver.
These are mainly required for drivers which aren't upstream yet but
have been part of our downstream tree for quite a while now.
Best,
Sven
---
Changes in v2:
- Changed commit message for APPLE_RTKIT_PWR_STATE_INIT to make it clear
this is a behavioral change
- Added a comment for the new oslog logic that the asymetric shifts are
indeed correct
- Collected r-b tags
- Link to v1: https://lore.kernel.org/r/20250222-apple-soc-misc-v1-0-1a3af494a48a@svenpeter.dev
---
Hector Martin (1):
soc: apple: rtkit: Implement OSLog buffers properly
Janne Grunau (3):
soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON
soc: apple: rtkit: Use high prio work queue
soc: apple: rtkit: Cut syslog messages after the first '\0'
drivers/soc/apple/rtkit-internal.h | 1 +
drivers/soc/apple/rtkit.c | 63 +++++++++++++++++++++++---------------
2 files changed, 39 insertions(+), 25 deletions(-)
---
base-commit: 00834971f0d9e38beae37e92055b1432782827d0
change-id: 20250220-apple-soc-misc-55ec124184fd
Best regards,
--
Sven Peter <sven@svenpeter.dev>
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON 2025-02-26 19:00 [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter via B4 Relay @ 2025-02-26 19:00 ` Sven Peter via B4 Relay 2025-02-26 19:06 ` Alyssa Rosenzweig 2025-02-26 19:00 ` [PATCH v2 2/4] soc: apple: rtkit: Implement OSLog buffers properly Sven Peter via B4 Relay ` (3 subsequent siblings) 4 siblings, 1 reply; 8+ messages in thread From: Sven Peter via B4 Relay @ 2025-02-26 19:00 UTC (permalink / raw) To: Alyssa Rosenzweig, Janne Grunau, Sven Peter Cc: asahi, linux-arm-kernel, linux-kernel From: Janne Grunau <j@jannau.net> 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 <j@jannau.net> Signed-off-by: Sven Peter <sven@svenpeter.dev> --- drivers/soc/apple/rtkit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index 2f5f878bf899..be0d08861168 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -12,6 +12,7 @@ enum { APPLE_RTKIT_PWR_STATE_IDLE = 0x201, /* sleeping, retain state */ APPLE_RTKIT_PWR_STATE_QUIESCED = 0x10, /* running but no communication */ APPLE_RTKIT_PWR_STATE_ON = 0x20, /* normal operating state */ + APPLE_RTKIT_PWR_STATE_INIT = 0x220, /* init after starting the coproc */ }; enum { @@ -898,7 +899,7 @@ int apple_rtkit_wake(struct apple_rtkit *rtk) * Use open-coded apple_rtkit_set_iop_power_state since apple_rtkit_boot * will wait for the completion anyway. */ - msg = FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, APPLE_RTKIT_PWR_STATE_ON); + msg = FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, APPLE_RTKIT_PWR_STATE_INIT); ret = apple_rtkit_management_send(rtk, APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE, msg); if (ret) -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON 2025-02-26 19:00 ` [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON Sven Peter via B4 Relay @ 2025-02-26 19:06 ` Alyssa Rosenzweig 0 siblings, 0 replies; 8+ messages in thread From: Alyssa Rosenzweig @ 2025-02-26 19:06 UTC (permalink / raw) To: sven; +Cc: Janne Grunau, asahi, linux-arm-kernel, linux-kernel Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Le Wed , Feb 26, 2025 at 07:00:03PM +0000, Sven Peter via B4 Relay a écrit : > From: Janne Grunau <j@jannau.net> > > 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 <j@jannau.net> > Signed-off-by: Sven Peter <sven@svenpeter.dev> > --- > drivers/soc/apple/rtkit.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c > index 2f5f878bf899..be0d08861168 100644 > --- a/drivers/soc/apple/rtkit.c > +++ b/drivers/soc/apple/rtkit.c > @@ -12,6 +12,7 @@ enum { > APPLE_RTKIT_PWR_STATE_IDLE = 0x201, /* sleeping, retain state */ > APPLE_RTKIT_PWR_STATE_QUIESCED = 0x10, /* running but no communication */ > APPLE_RTKIT_PWR_STATE_ON = 0x20, /* normal operating state */ > + APPLE_RTKIT_PWR_STATE_INIT = 0x220, /* init after starting the coproc */ > }; > > enum { > @@ -898,7 +899,7 @@ int apple_rtkit_wake(struct apple_rtkit *rtk) > * Use open-coded apple_rtkit_set_iop_power_state since apple_rtkit_boot > * will wait for the completion anyway. > */ > - msg = FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, APPLE_RTKIT_PWR_STATE_ON); > + msg = FIELD_PREP(APPLE_RTKIT_MGMT_PWR_STATE, APPLE_RTKIT_PWR_STATE_INIT); > ret = apple_rtkit_management_send(rtk, APPLE_RTKIT_MGMT_SET_IOP_PWR_STATE, > msg); > if (ret) > > -- > 2.34.1 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/4] soc: apple: rtkit: Implement OSLog buffers properly 2025-02-26 19:00 [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter via B4 Relay 2025-02-26 19:00 ` [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON Sven Peter via B4 Relay @ 2025-02-26 19:00 ` Sven Peter via B4 Relay 2025-02-26 19:07 ` Alyssa Rosenzweig 2025-02-26 19:00 ` [PATCH v2 3/4] soc: apple: rtkit: Use high prio work queue Sven Peter via B4 Relay ` (2 subsequent siblings) 4 siblings, 1 reply; 8+ messages in thread From: Sven Peter via B4 Relay @ 2025-02-26 19:00 UTC (permalink / raw) To: Alyssa Rosenzweig, Janne Grunau, Sven Peter Cc: asahi, linux-arm-kernel, linux-kernel, Hector Martin From: Hector Martin <marcan@marcan.st> 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 <marcan@marcan.st> Signed-off-by: Sven Peter <sven@svenpeter.dev> --- drivers/soc/apple/rtkit-internal.h | 1 + drivers/soc/apple/rtkit.c | 56 +++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/drivers/soc/apple/rtkit-internal.h b/drivers/soc/apple/rtkit-internal.h index 27c9fa745fd5..b8d5244678f0 100644 --- a/drivers/soc/apple/rtkit-internal.h +++ b/drivers/soc/apple/rtkit-internal.h @@ -44,6 +44,7 @@ struct apple_rtkit { struct apple_rtkit_shmem ioreport_buffer; struct apple_rtkit_shmem crashlog_buffer; + struct apple_rtkit_shmem oslog_buffer; struct apple_rtkit_shmem syslog_buffer; char *syslog_msg_buffer; diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index be0d08861168..7e7b4f64ab17 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -67,8 +67,9 @@ enum { #define APPLE_RTKIT_SYSLOG_MSG_SIZE GENMASK_ULL(31, 24) #define APPLE_RTKIT_OSLOG_TYPE GENMASK_ULL(63, 56) -#define APPLE_RTKIT_OSLOG_INIT 1 -#define APPLE_RTKIT_OSLOG_ACK 3 +#define APPLE_RTKIT_OSLOG_BUFFER_REQUEST 1 +#define APPLE_RTKIT_OSLOG_SIZE GENMASK_ULL(55, 36) +#define APPLE_RTKIT_OSLOG_IOVA GENMASK_ULL(35, 0) #define APPLE_RTKIT_MIN_SUPPORTED_VERSION 11 #define APPLE_RTKIT_MAX_SUPPORTED_VERSION 12 @@ -259,15 +260,21 @@ static int apple_rtkit_common_rx_get_buffer(struct apple_rtkit *rtk, struct apple_rtkit_shmem *buffer, u8 ep, u64 msg) { - size_t n_4kpages = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg); u64 reply; int err; + /* The different size vs. IOVA shifts look odd but are indeed correct this way */ + if (ep == APPLE_RTKIT_EP_OSLOG) { + buffer->size = FIELD_GET(APPLE_RTKIT_OSLOG_SIZE, msg); + buffer->iova = FIELD_GET(APPLE_RTKIT_OSLOG_IOVA, msg) << 12; + } else { + buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12; + buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg); + } + buffer->buffer = NULL; buffer->iomem = NULL; buffer->is_mapped = false; - buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg); - buffer->size = n_4kpages << 12; dev_dbg(rtk->dev, "RTKit: buffer request for 0x%zx bytes at %pad\n", buffer->size, &buffer->iova); @@ -292,11 +299,21 @@ static int apple_rtkit_common_rx_get_buffer(struct apple_rtkit *rtk, } if (!buffer->is_mapped) { - reply = FIELD_PREP(APPLE_RTKIT_SYSLOG_TYPE, - APPLE_RTKIT_BUFFER_REQUEST); - reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_SIZE, n_4kpages); - reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_IOVA, - buffer->iova); + /* oslog uses different fields and needs a shifted IOVA instead of size */ + if (ep == APPLE_RTKIT_EP_OSLOG) { + reply = FIELD_PREP(APPLE_RTKIT_OSLOG_TYPE, + APPLE_RTKIT_OSLOG_BUFFER_REQUEST); + reply |= FIELD_PREP(APPLE_RTKIT_OSLOG_SIZE, buffer->size); + reply |= FIELD_PREP(APPLE_RTKIT_OSLOG_IOVA, + buffer->iova >> 12); + } else { + reply = FIELD_PREP(APPLE_RTKIT_SYSLOG_TYPE, + APPLE_RTKIT_BUFFER_REQUEST); + reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_SIZE, + buffer->size >> 12); + reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_IOVA, + buffer->iova); + } apple_rtkit_send_message(rtk, ep, reply, NULL, false); } @@ -494,25 +511,18 @@ static void apple_rtkit_syslog_rx(struct apple_rtkit *rtk, u64 msg) } } -static void apple_rtkit_oslog_rx_init(struct apple_rtkit *rtk, u64 msg) -{ - u64 ack; - - dev_dbg(rtk->dev, "RTKit: oslog init: msg: 0x%llx\n", msg); - ack = FIELD_PREP(APPLE_RTKIT_OSLOG_TYPE, APPLE_RTKIT_OSLOG_ACK); - apple_rtkit_send_message(rtk, APPLE_RTKIT_EP_OSLOG, ack, NULL, false); -} - static void apple_rtkit_oslog_rx(struct apple_rtkit *rtk, u64 msg) { u8 type = FIELD_GET(APPLE_RTKIT_OSLOG_TYPE, msg); switch (type) { - case APPLE_RTKIT_OSLOG_INIT: - apple_rtkit_oslog_rx_init(rtk, msg); + case APPLE_RTKIT_OSLOG_BUFFER_REQUEST: + apple_rtkit_common_rx_get_buffer(rtk, &rtk->oslog_buffer, + APPLE_RTKIT_EP_OSLOG, msg); break; default: - dev_warn(rtk->dev, "RTKit: Unknown oslog message: %llx\n", msg); + dev_warn(rtk->dev, "RTKit: Unknown oslog message: %llx\n", + msg); } } @@ -729,6 +739,7 @@ int apple_rtkit_reinit(struct apple_rtkit *rtk) apple_rtkit_free_buffer(rtk, &rtk->ioreport_buffer); apple_rtkit_free_buffer(rtk, &rtk->crashlog_buffer); + apple_rtkit_free_buffer(rtk, &rtk->oslog_buffer); apple_rtkit_free_buffer(rtk, &rtk->syslog_buffer); kfree(rtk->syslog_msg_buffer); @@ -916,6 +927,7 @@ void apple_rtkit_free(struct apple_rtkit *rtk) apple_rtkit_free_buffer(rtk, &rtk->ioreport_buffer); apple_rtkit_free_buffer(rtk, &rtk->crashlog_buffer); + apple_rtkit_free_buffer(rtk, &rtk->oslog_buffer); apple_rtkit_free_buffer(rtk, &rtk->syslog_buffer); kfree(rtk->syslog_msg_buffer); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/4] soc: apple: rtkit: Implement OSLog buffers properly 2025-02-26 19:00 ` [PATCH v2 2/4] soc: apple: rtkit: Implement OSLog buffers properly Sven Peter via B4 Relay @ 2025-02-26 19:07 ` Alyssa Rosenzweig 0 siblings, 0 replies; 8+ messages in thread From: Alyssa Rosenzweig @ 2025-02-26 19:07 UTC (permalink / raw) To: sven; +Cc: Janne Grunau, asahi, linux-arm-kernel, linux-kernel, Hector Martin Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Le Wed , Feb 26, 2025 at 07:00:04PM +0000, Sven Peter via B4 Relay a écrit : > From: Hector Martin <marcan@marcan.st> > > 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 <marcan@marcan.st> > Signed-off-by: Sven Peter <sven@svenpeter.dev> > --- > drivers/soc/apple/rtkit-internal.h | 1 + > drivers/soc/apple/rtkit.c | 56 +++++++++++++++++++++++--------------- > 2 files changed, 35 insertions(+), 22 deletions(-) > > diff --git a/drivers/soc/apple/rtkit-internal.h b/drivers/soc/apple/rtkit-internal.h > index 27c9fa745fd5..b8d5244678f0 100644 > --- a/drivers/soc/apple/rtkit-internal.h > +++ b/drivers/soc/apple/rtkit-internal.h > @@ -44,6 +44,7 @@ struct apple_rtkit { > > struct apple_rtkit_shmem ioreport_buffer; > struct apple_rtkit_shmem crashlog_buffer; > + struct apple_rtkit_shmem oslog_buffer; > > struct apple_rtkit_shmem syslog_buffer; > char *syslog_msg_buffer; > diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c > index be0d08861168..7e7b4f64ab17 100644 > --- a/drivers/soc/apple/rtkit.c > +++ b/drivers/soc/apple/rtkit.c > @@ -67,8 +67,9 @@ enum { > #define APPLE_RTKIT_SYSLOG_MSG_SIZE GENMASK_ULL(31, 24) > > #define APPLE_RTKIT_OSLOG_TYPE GENMASK_ULL(63, 56) > -#define APPLE_RTKIT_OSLOG_INIT 1 > -#define APPLE_RTKIT_OSLOG_ACK 3 > +#define APPLE_RTKIT_OSLOG_BUFFER_REQUEST 1 > +#define APPLE_RTKIT_OSLOG_SIZE GENMASK_ULL(55, 36) > +#define APPLE_RTKIT_OSLOG_IOVA GENMASK_ULL(35, 0) > > #define APPLE_RTKIT_MIN_SUPPORTED_VERSION 11 > #define APPLE_RTKIT_MAX_SUPPORTED_VERSION 12 > @@ -259,15 +260,21 @@ static int apple_rtkit_common_rx_get_buffer(struct apple_rtkit *rtk, > struct apple_rtkit_shmem *buffer, > u8 ep, u64 msg) > { > - size_t n_4kpages = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg); > u64 reply; > int err; > > + /* The different size vs. IOVA shifts look odd but are indeed correct this way */ > + if (ep == APPLE_RTKIT_EP_OSLOG) { > + buffer->size = FIELD_GET(APPLE_RTKIT_OSLOG_SIZE, msg); > + buffer->iova = FIELD_GET(APPLE_RTKIT_OSLOG_IOVA, msg) << 12; > + } else { > + buffer->size = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_SIZE, msg) << 12; > + buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg); > + } > + > buffer->buffer = NULL; > buffer->iomem = NULL; > buffer->is_mapped = false; > - buffer->iova = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg); > - buffer->size = n_4kpages << 12; > > dev_dbg(rtk->dev, "RTKit: buffer request for 0x%zx bytes at %pad\n", > buffer->size, &buffer->iova); > @@ -292,11 +299,21 @@ static int apple_rtkit_common_rx_get_buffer(struct apple_rtkit *rtk, > } > > if (!buffer->is_mapped) { > - reply = FIELD_PREP(APPLE_RTKIT_SYSLOG_TYPE, > - APPLE_RTKIT_BUFFER_REQUEST); > - reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_SIZE, n_4kpages); > - reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_IOVA, > - buffer->iova); > + /* oslog uses different fields and needs a shifted IOVA instead of size */ > + if (ep == APPLE_RTKIT_EP_OSLOG) { > + reply = FIELD_PREP(APPLE_RTKIT_OSLOG_TYPE, > + APPLE_RTKIT_OSLOG_BUFFER_REQUEST); > + reply |= FIELD_PREP(APPLE_RTKIT_OSLOG_SIZE, buffer->size); > + reply |= FIELD_PREP(APPLE_RTKIT_OSLOG_IOVA, > + buffer->iova >> 12); > + } else { > + reply = FIELD_PREP(APPLE_RTKIT_SYSLOG_TYPE, > + APPLE_RTKIT_BUFFER_REQUEST); > + reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_SIZE, > + buffer->size >> 12); > + reply |= FIELD_PREP(APPLE_RTKIT_BUFFER_REQUEST_IOVA, > + buffer->iova); > + } > apple_rtkit_send_message(rtk, ep, reply, NULL, false); > } > > @@ -494,25 +511,18 @@ static void apple_rtkit_syslog_rx(struct apple_rtkit *rtk, u64 msg) > } > } > > -static void apple_rtkit_oslog_rx_init(struct apple_rtkit *rtk, u64 msg) > -{ > - u64 ack; > - > - dev_dbg(rtk->dev, "RTKit: oslog init: msg: 0x%llx\n", msg); > - ack = FIELD_PREP(APPLE_RTKIT_OSLOG_TYPE, APPLE_RTKIT_OSLOG_ACK); > - apple_rtkit_send_message(rtk, APPLE_RTKIT_EP_OSLOG, ack, NULL, false); > -} > - > static void apple_rtkit_oslog_rx(struct apple_rtkit *rtk, u64 msg) > { > u8 type = FIELD_GET(APPLE_RTKIT_OSLOG_TYPE, msg); > > switch (type) { > - case APPLE_RTKIT_OSLOG_INIT: > - apple_rtkit_oslog_rx_init(rtk, msg); > + case APPLE_RTKIT_OSLOG_BUFFER_REQUEST: > + apple_rtkit_common_rx_get_buffer(rtk, &rtk->oslog_buffer, > + APPLE_RTKIT_EP_OSLOG, msg); > break; > default: > - dev_warn(rtk->dev, "RTKit: Unknown oslog message: %llx\n", msg); > + dev_warn(rtk->dev, "RTKit: Unknown oslog message: %llx\n", > + msg); > } > } > > @@ -729,6 +739,7 @@ int apple_rtkit_reinit(struct apple_rtkit *rtk) > > apple_rtkit_free_buffer(rtk, &rtk->ioreport_buffer); > apple_rtkit_free_buffer(rtk, &rtk->crashlog_buffer); > + apple_rtkit_free_buffer(rtk, &rtk->oslog_buffer); > apple_rtkit_free_buffer(rtk, &rtk->syslog_buffer); > > kfree(rtk->syslog_msg_buffer); > @@ -916,6 +927,7 @@ void apple_rtkit_free(struct apple_rtkit *rtk) > > apple_rtkit_free_buffer(rtk, &rtk->ioreport_buffer); > apple_rtkit_free_buffer(rtk, &rtk->crashlog_buffer); > + apple_rtkit_free_buffer(rtk, &rtk->oslog_buffer); > apple_rtkit_free_buffer(rtk, &rtk->syslog_buffer); > > kfree(rtk->syslog_msg_buffer); > > -- > 2.34.1 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] soc: apple: rtkit: Use high prio work queue 2025-02-26 19:00 [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter via B4 Relay 2025-02-26 19:00 ` [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON Sven Peter via B4 Relay 2025-02-26 19:00 ` [PATCH v2 2/4] soc: apple: rtkit: Implement OSLog buffers properly Sven Peter via B4 Relay @ 2025-02-26 19:00 ` Sven Peter via B4 Relay 2025-02-26 19:00 ` [PATCH v2 4/4] soc: apple: rtkit: Cut syslog messages after the first '\0' Sven Peter via B4 Relay 2025-02-28 21:46 ` [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter 4 siblings, 0 replies; 8+ messages in thread From: Sven Peter via B4 Relay @ 2025-02-26 19:00 UTC (permalink / raw) To: Alyssa Rosenzweig, Janne Grunau, Sven Peter Cc: asahi, linux-arm-kernel, linux-kernel From: Janne Grunau <j@jannau.net> 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 <j@jannau.net> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Sven Peter <sven@svenpeter.dev> --- drivers/soc/apple/rtkit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index 7e7b4f64ab17..4b78463dd5a1 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -696,7 +696,7 @@ struct apple_rtkit *apple_rtkit_init(struct device *dev, void *cookie, rtk->mbox->rx = apple_rtkit_rx; rtk->mbox->cookie = rtk; - rtk->wq = alloc_ordered_workqueue("rtkit-%s", WQ_MEM_RECLAIM, + rtk->wq = alloc_ordered_workqueue("rtkit-%s", WQ_HIGHPRI | WQ_MEM_RECLAIM, dev_name(rtk->dev)); if (!rtk->wq) { ret = -ENOMEM; -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/4] soc: apple: rtkit: Cut syslog messages after the first '\0' 2025-02-26 19:00 [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter via B4 Relay ` (2 preceding siblings ...) 2025-02-26 19:00 ` [PATCH v2 3/4] soc: apple: rtkit: Use high prio work queue Sven Peter via B4 Relay @ 2025-02-26 19:00 ` Sven Peter via B4 Relay 2025-02-28 21:46 ` [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter 4 siblings, 0 replies; 8+ messages in thread From: Sven Peter via B4 Relay @ 2025-02-26 19:00 UTC (permalink / raw) To: Alyssa Rosenzweig, Janne Grunau, Sven Peter Cc: asahi, linux-arm-kernel, linux-kernel From: Janne Grunau <j@jannau.net> 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 <j@jannau.net> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Sven Peter <sven@svenpeter.dev> --- drivers/soc/apple/rtkit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c index 4b78463dd5a1..5fffd0f003dc 100644 --- a/drivers/soc/apple/rtkit.c +++ b/drivers/soc/apple/rtkit.c @@ -477,7 +477,7 @@ static void apple_rtkit_syslog_rx_log(struct apple_rtkit *rtk, u64 msg) log_context[sizeof(log_context) - 1] = 0; - msglen = rtk->syslog_msg_size - 1; + msglen = strnlen(rtk->syslog_msg_buffer, rtk->syslog_msg_size - 1); while (msglen > 0 && should_crop_syslog_char(rtk->syslog_msg_buffer[msglen - 1])) msglen--; -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] Miscellaneous Apple RTKit fixes 2025-02-26 19:00 [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter via B4 Relay ` (3 preceding siblings ...) 2025-02-26 19:00 ` [PATCH v2 4/4] soc: apple: rtkit: Cut syslog messages after the first '\0' Sven Peter via B4 Relay @ 2025-02-28 21:46 ` Sven Peter 4 siblings, 0 replies; 8+ messages in thread From: Sven Peter @ 2025-02-28 21:46 UTC (permalink / raw) To: Alyssa Rosenzweig, Janne Grunau, Sven Peter Cc: asahi, linux-arm-kernel, linux-kernel, Hector Martin On Wed, 26 Feb 2025 19:00:02 +0000, Sven Peter wrote: > This series contains four unrelated minor fixes to our RTKit driver. > These are mainly required for drivers which aren't upstream yet but > have been part of our downstream tree for quite a while now. > > Best, > > Sven > > [...] Applied, thanks! [1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON commit: 3e46b6df8465e7a1c0d8e87a0966ecfb753ae84b [2/4] soc: apple: rtkit: Implement OSLog buffers properly commit: a06398687065e0c334dc5fc4d2778b5b87292e43 [3/4] soc: apple: rtkit: Use high prio work queue commit: 22af2fac88fa5dbc310bfe7d0b66d4de3ac47305 [4/4] soc: apple: rtkit: Cut syslog messages after the first '\0' commit: e210227f0259d2666cc41b28ed1b7b0b0a99ed4d Best regards, -- Sven Peter <sven@svenpeter.dev> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-02-28 21:51 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-26 19:00 [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter via B4 Relay 2025-02-26 19:00 ` [PATCH v2 1/4] soc: apple: rtkit: Add and use PWR_STATE_INIT instead of _ON Sven Peter via B4 Relay 2025-02-26 19:06 ` Alyssa Rosenzweig 2025-02-26 19:00 ` [PATCH v2 2/4] soc: apple: rtkit: Implement OSLog buffers properly Sven Peter via B4 Relay 2025-02-26 19:07 ` Alyssa Rosenzweig 2025-02-26 19:00 ` [PATCH v2 3/4] soc: apple: rtkit: Use high prio work queue Sven Peter via B4 Relay 2025-02-26 19:00 ` [PATCH v2 4/4] soc: apple: rtkit: Cut syslog messages after the first '\0' Sven Peter via B4 Relay 2025-02-28 21:46 ` [PATCH v2 0/4] Miscellaneous Apple RTKit fixes Sven Peter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).