diff options
5 files changed, 383 insertions, 0 deletions
diff --git a/queue-6.6/firmware-arm_scmi-add-a-common-helper-to-check-if-a-message-is-supported.patch b/queue-6.6/firmware-arm_scmi-add-a-common-helper-to-check-if-a-message-is-supported.patch new file mode 100644 index 0000000000..6e4b1ed995 --- /dev/null +++ b/queue-6.6/firmware-arm_scmi-add-a-common-helper-to-check-if-a-message-is-supported.patch @@ -0,0 +1,88 @@ +From 637b6d6cae9c42db5a9525da67c991294924d2cd Mon Sep 17 00:00:00 2001 +From: Cristian Marussi <cristian.marussi@arm.com> +Date: Mon, 12 Feb 2024 12:32:24 +0000 +Subject: firmware: arm_scmi: Add a common helper to check if a message is supported + +From: Cristian Marussi <cristian.marussi@arm.com> + +commit 637b6d6cae9c42db5a9525da67c991294924d2cd upstream. + +A common helper is provided to check if a specific protocol message is +supported or not. + +Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> +Link: https://lore.kernel.org/r/20240212123233.1230090-3-cristian.marussi@arm.com +Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/firmware/arm_scmi/driver.c | 34 ++++++++++++++++++++++++++++++++++ + drivers/firmware/arm_scmi/protocols.h | 4 ++++ + 2 files changed, 38 insertions(+) + +--- a/drivers/firmware/arm_scmi/driver.c ++++ b/drivers/firmware/arm_scmi/driver.c +@@ -1820,10 +1820,44 @@ static void scmi_common_fastchannel_db_r + #endif + } + ++/** ++ * scmi_protocol_msg_check - Check protocol message attributes ++ * ++ * @ph: A reference to the protocol handle. ++ * @message_id: The ID of the message to check. ++ * @attributes: A parameter to optionally return the retrieved message ++ * attributes, in case of Success. ++ * ++ * An helper to check protocol message attributes for a specific protocol ++ * and message pair. ++ * ++ * Return: 0 on SUCCESS ++ */ ++static int scmi_protocol_msg_check(const struct scmi_protocol_handle *ph, ++ u32 message_id, u32 *attributes) ++{ ++ int ret; ++ struct scmi_xfer *t; ++ ++ ret = xfer_get_init(ph, PROTOCOL_MESSAGE_ATTRIBUTES, ++ sizeof(__le32), 0, &t); ++ if (ret) ++ return ret; ++ ++ put_unaligned_le32(message_id, t->tx.buf); ++ ret = do_xfer(ph, t); ++ if (!ret && attributes) ++ *attributes = get_unaligned_le32(t->rx.buf); ++ xfer_put(ph, t); ++ ++ return ret; ++} ++ + static const struct scmi_proto_helpers_ops helpers_ops = { + .extended_name_get = scmi_common_extended_name_get, + .iter_response_init = scmi_iterator_init, + .iter_response_run = scmi_iterator_run, ++ .protocol_msg_check = scmi_protocol_msg_check, + .fastchannel_init = scmi_common_fastchannel_init, + .fastchannel_db_ring = scmi_common_fastchannel_db_ring, + }; +--- a/drivers/firmware/arm_scmi/protocols.h ++++ b/drivers/firmware/arm_scmi/protocols.h +@@ -250,6 +250,8 @@ struct scmi_fc_info { + * provided in @ops. + * @iter_response_run: A common helper to trigger the run of a previously + * initialized iterator. ++ * @protocol_msg_check: A common helper to check is a specific protocol message ++ * is supported. + * @fastchannel_init: A common helper used to initialize FC descriptors by + * gathering FC descriptions from the SCMI platform server. + * @fastchannel_db_ring: A common helper to ring a FC doorbell. +@@ -262,6 +264,8 @@ struct scmi_proto_helpers_ops { + unsigned int max_resources, u8 msg_id, + size_t tx_size, void *priv); + int (*iter_response_run)(void *iter); ++ int (*protocol_msg_check)(const struct scmi_protocol_handle *ph, ++ u32 message_id, u32 *attributes); + void (*fastchannel_init)(const struct scmi_protocol_handle *ph, + u8 describe_id, u32 message_id, + u32 valid_size, u32 domain, diff --git a/queue-6.6/firmware-arm_scmi-ensure-that-the-message-id-supports-fastchannel.patch b/queue-6.6/firmware-arm_scmi-ensure-that-the-message-id-supports-fastchannel.patch new file mode 100644 index 0000000000..059a48829d --- /dev/null +++ b/queue-6.6/firmware-arm_scmi-ensure-that-the-message-id-supports-fastchannel.patch @@ -0,0 +1,153 @@ +From 94a263f981a3fa3d93f65c31e0fed0756736be43 Mon Sep 17 00:00:00 2001 +From: Sibi Sankar <quic_sibis@quicinc.com> +Date: Tue, 29 Apr 2025 15:11:06 +0100 +Subject: firmware: arm_scmi: Ensure that the message-id supports fastchannel + +From: Sibi Sankar <quic_sibis@quicinc.com> + +commit 94a263f981a3fa3d93f65c31e0fed0756736be43 upstream. + +Currently the perf and powercap protocol relies on the protocol domain +attributes, which just ensures that one fastchannel per domain, before +instantiating fastchannels for all possible message-ids. Fix this by +ensuring that each message-id supports fastchannel before initialization. + +Logs: + | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:0] - ret:-95. Using regular messaging + | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:1] - ret:-95. Using regular messaging + | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:2] - ret:-95. Using regular messaging + +CC: stable@vger.kernel.org +Reported-by: Johan Hovold <johan+linaro@kernel.org> +Closes: https://lore.kernel.org/lkml/ZoQjAWse2YxwyRJv@hovoldconsulting.com/ +Fixes: 6f9ea4dabd2d ("firmware: arm_scmi: Generalize the fast channel support") +Reviewed-by: Johan Hovold <johan+linaro@kernel.org> +Tested-by: Johan Hovold <johan+linaro@kernel.org> +Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> +[Cristian: Modified the condition checked to establish support or not] +Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> +Message-Id: <20250429141108.406045-2-cristian.marussi@arm.com> +Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/firmware/arm_scmi/driver.c | 76 +++++++++++++++++++--------------- + drivers/firmware/arm_scmi/protocols.h | 2 + 2 files changed, 45 insertions(+), 33 deletions(-) + +--- a/drivers/firmware/arm_scmi/driver.c ++++ b/drivers/firmware/arm_scmi/driver.c +@@ -1548,6 +1548,39 @@ out: + } + + /** ++ * scmi_protocol_msg_check - Check protocol message attributes ++ * ++ * @ph: A reference to the protocol handle. ++ * @message_id: The ID of the message to check. ++ * @attributes: A parameter to optionally return the retrieved message ++ * attributes, in case of Success. ++ * ++ * An helper to check protocol message attributes for a specific protocol ++ * and message pair. ++ * ++ * Return: 0 on SUCCESS ++ */ ++static int scmi_protocol_msg_check(const struct scmi_protocol_handle *ph, ++ u32 message_id, u32 *attributes) ++{ ++ int ret; ++ struct scmi_xfer *t; ++ ++ ret = xfer_get_init(ph, PROTOCOL_MESSAGE_ATTRIBUTES, ++ sizeof(__le32), 0, &t); ++ if (ret) ++ return ret; ++ ++ put_unaligned_le32(message_id, t->tx.buf); ++ ret = do_xfer(ph, t); ++ if (!ret && attributes) ++ *attributes = get_unaligned_le32(t->rx.buf); ++ xfer_put(ph, t); ++ ++ return ret; ++} ++ ++/** + * struct scmi_iterator - Iterator descriptor + * @msg: A reference to the message TX buffer; filled by @prepare_message with + * a proper custom command payload for each multi-part command request. +@@ -1688,6 +1721,7 @@ scmi_common_fastchannel_init(const struc + int ret; + u32 flags; + u64 phys_addr; ++ u32 attributes; + u8 size; + void __iomem *addr; + struct scmi_xfer *t; +@@ -1696,6 +1730,15 @@ scmi_common_fastchannel_init(const struc + struct scmi_msg_resp_desc_fc *resp; + const struct scmi_protocol_instance *pi = ph_to_pi(ph); + ++ /* Check if the MSG_ID supports fastchannel */ ++ ret = scmi_protocol_msg_check(ph, message_id, &attributes); ++ if (ret || !MSG_SUPPORTS_FASTCHANNEL(attributes)) { ++ dev_dbg(ph->dev, ++ "Skip FC init for 0x%02X/%d domain:%d - ret:%d\n", ++ pi->proto->id, message_id, domain, ret); ++ return; ++ } ++ + if (!p_addr) { + ret = -EINVAL; + goto err_out; +@@ -1820,39 +1863,6 @@ static void scmi_common_fastchannel_db_r + #endif + } + +-/** +- * scmi_protocol_msg_check - Check protocol message attributes +- * +- * @ph: A reference to the protocol handle. +- * @message_id: The ID of the message to check. +- * @attributes: A parameter to optionally return the retrieved message +- * attributes, in case of Success. +- * +- * An helper to check protocol message attributes for a specific protocol +- * and message pair. +- * +- * Return: 0 on SUCCESS +- */ +-static int scmi_protocol_msg_check(const struct scmi_protocol_handle *ph, +- u32 message_id, u32 *attributes) +-{ +- int ret; +- struct scmi_xfer *t; +- +- ret = xfer_get_init(ph, PROTOCOL_MESSAGE_ATTRIBUTES, +- sizeof(__le32), 0, &t); +- if (ret) +- return ret; +- +- put_unaligned_le32(message_id, t->tx.buf); +- ret = do_xfer(ph, t); +- if (!ret && attributes) +- *attributes = get_unaligned_le32(t->rx.buf); +- xfer_put(ph, t); +- +- return ret; +-} +- + static const struct scmi_proto_helpers_ops helpers_ops = { + .extended_name_get = scmi_common_extended_name_get, + .iter_response_init = scmi_iterator_init, +--- a/drivers/firmware/arm_scmi/protocols.h ++++ b/drivers/firmware/arm_scmi/protocols.h +@@ -29,6 +29,8 @@ + #define PROTOCOL_REV_MAJOR(x) ((u16)(FIELD_GET(PROTOCOL_REV_MAJOR_MASK, (x)))) + #define PROTOCOL_REV_MINOR(x) ((u16)(FIELD_GET(PROTOCOL_REV_MINOR_MASK, (x)))) + ++#define MSG_SUPPORTS_FASTCHANNEL(x) ((x) & BIT(0)) ++ + enum scmi_common_cmd { + PROTOCOL_VERSION = 0x0, + PROTOCOL_ATTRIBUTES = 0x1, diff --git a/queue-6.6/nvme-always-punt-polled-uring_cmd-end_io-work-to-task_work.patch b/queue-6.6/nvme-always-punt-polled-uring_cmd-end_io-work-to-task_work.patch new file mode 100644 index 0000000000..49269ffa2b --- /dev/null +++ b/queue-6.6/nvme-always-punt-polled-uring_cmd-end_io-work-to-task_work.patch @@ -0,0 +1,54 @@ +From 11f32872aeb581d9a2007f74a0f0c1a534e4e361 Mon Sep 17 00:00:00 2001 +From: Jens Axboe <axboe@kernel.dk> +Date: Fri, 13 Jun 2025 13:37:41 -0600 +Subject: nvme: always punt polled uring_cmd end_io work to task_work + +From: Jens Axboe <axboe@kernel.dk> + +Commit 9ce6c9875f3e995be5fd720b65835291f8a609b1 upstream. + +Currently NVMe uring_cmd completions will complete locally, if they are +polled. This is done because those completions are always invoked from +task context. And while that is true, there's no guarantee that it's +invoked under the right ring context, or even task. If someone does +NVMe passthrough via multiple threads and with a limited number of +poll queues, then ringA may find completions from ringB. For that case, +completing the request may not be sound. + +Always just punt the passthrough completions via task_work, which will +redirect the completion, if needed. + +Cc: stable@vger.kernel.org +Fixes: 585079b6e425 ("nvme: wire up async polling for io passthrough commands") +Signed-off-by: Jens Axboe <axboe@kernel.dk> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/nvme/host/ioctl.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +--- a/drivers/nvme/host/ioctl.c ++++ b/drivers/nvme/host/ioctl.c +@@ -526,16 +526,14 @@ static enum rq_end_io_ret nvme_uring_cmd + pdu->u.result = le64_to_cpu(nvme_req(req)->result.u64); + + /* +- * For iopoll, complete it directly. +- * Otherwise, move the completion to task work. ++ * IOPOLL could potentially complete this request directly, but ++ * if multiple rings are polling on the same queue, then it's possible ++ * for one ring to find completions for another ring. Punting the ++ * completion via task_work will always direct it to the right ++ * location, rather than potentially complete requests for ringA ++ * under iopoll invocations from ringB. + */ +- if (blk_rq_is_poll(req)) { +- WRITE_ONCE(ioucmd->cookie, NULL); +- nvme_uring_task_cb(ioucmd, IO_URING_F_UNLOCKED); +- } else { +- io_uring_cmd_do_in_task_lazy(ioucmd, nvme_uring_task_cb); +- } +- ++ io_uring_cmd_do_in_task_lazy(ioucmd, nvme_uring_task_cb); + return RQ_END_IO_FREE; + } + diff --git a/queue-6.6/series b/queue-6.6/series index 84ca2dc1b0..2e7383bc55 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -143,3 +143,7 @@ s390-entry-fix-last-breaking-event-handling-in-case-of-stack-corruption.patch kunit-to-check-the-longest-symbol-length.patch x86-tools-drop-duplicate-unlikely-definition-in-insn_decoder_test.c.patch revert-ipv6-save-dontfrag-in-cork.patch +spi-spi-cadence-quadspi-fix-pm-runtime-unbalance.patch +nvme-always-punt-polled-uring_cmd-end_io-work-to-task_work.patch +firmware-arm_scmi-add-a-common-helper-to-check-if-a-message-is-supported.patch +firmware-arm_scmi-ensure-that-the-message-id-supports-fastchannel.patch diff --git a/queue-6.6/spi-spi-cadence-quadspi-fix-pm-runtime-unbalance.patch b/queue-6.6/spi-spi-cadence-quadspi-fix-pm-runtime-unbalance.patch new file mode 100644 index 0000000000..bd9b908a44 --- /dev/null +++ b/queue-6.6/spi-spi-cadence-quadspi-fix-pm-runtime-unbalance.patch @@ -0,0 +1,84 @@ +From b07f349d1864abe29436f45e3047da2bdd476462 Mon Sep 17 00:00:00 2001 +From: Khairul Anuar Romli <khairul.anuar.romli@altera.com> +Date: Mon, 16 Jun 2025 09:13:53 +0800 +Subject: spi: spi-cadence-quadspi: Fix pm runtime unbalance + +From: Khairul Anuar Romli <khairul.anuar.romli@altera.com> + +commit b07f349d1864abe29436f45e3047da2bdd476462 upstream. + +Having PM put sync in remove function is causing PM underflow during +remove operation. This is caused by the function, runtime_pm_get_sync, +not being called anywhere during the op. Ensure that calls to +pm_runtime_enable()/pm_runtime_disable() and +pm_runtime_get_sync()/pm_runtime_put_sync() match. + +echo 108d2000.spi > /sys/bus/platform/drivers/cadence-qspi/unbind +[ 49.644256] Deleting MTD partitions on "108d2000.spi.0": +[ 49.649575] Deleting u-boot MTD partition +[ 49.684087] Deleting root MTD partition +[ 49.724188] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! + +Continuous bind/unbind will result in an "Unbalanced pm_runtime_enable" error. +Subsequent unbind attempts will return a "No such device" error, while bind +attempts will return a "Resource temporarily unavailable" error. + +[ 47.592434] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! +[ 49.592233] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) +[ 53.232309] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! +[ 55.828550] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) +[ 57.940627] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! +[ 59.912490] cadence-qspi 108d2000.spi: detected FIFO depth (1024) different from config (128) +[ 61.876243] cadence-qspi 108d2000.spi: Runtime PM usage count underflow! +[ 61.883000] platform 108d2000.spi: Unbalanced pm_runtime_enable! +[ 532.012270] cadence-qspi 108d2000.spi: probe with driver cadence-qspi failed1 + +Also, change clk_disable_unprepare() to clk_disable() since continuous +bind and unbind operations will trigger a warning indicating that the clock is +already unprepared. + +Fixes: 4892b374c9b7 ("mtd: spi-nor: cadence-quadspi: Add runtime PM support") +cc: stable@vger.kernel.org # 6.6+ +Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@altera.com> +Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com> +Link: https://patch.msgid.link/4e7a4b8aba300e629b45a04f90bddf665fbdb335.1749601877.git.khairul.anuar.romli@altera.com +Signed-off-by: Mark Brown <broonie@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/spi/spi-cadence-quadspi.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-cadence-quadspi.c ++++ b/drivers/spi/spi-cadence-quadspi.c +@@ -1868,6 +1868,13 @@ static int cqspi_probe(struct platform_d + goto probe_setup_failed; + } + ++ pm_runtime_enable(dev); ++ ++ if (cqspi->rx_chan) { ++ dma_release_channel(cqspi->rx_chan); ++ goto probe_setup_failed; ++ } ++ + ret = spi_register_controller(host); + if (ret) { + dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret); +@@ -1877,6 +1884,7 @@ static int cqspi_probe(struct platform_d + return 0; + probe_setup_failed: + cqspi_controller_enable(cqspi, 0); ++ pm_runtime_disable(dev); + probe_reset_failed: + if (cqspi->is_jh7110) + cqspi_jh7110_disable_clk(pdev, cqspi); +@@ -1898,7 +1906,8 @@ static void cqspi_remove(struct platform + if (cqspi->rx_chan) + dma_release_channel(cqspi->rx_chan); + +- clk_disable_unprepare(cqspi->clk); ++ if (pm_runtime_get_sync(&pdev->dev) >= 0) ++ clk_disable(cqspi->clk); + + if (cqspi->is_jh7110) + cqspi_jh7110_disable_clk(pdev, cqspi); |