From: Greg Kroah-Hartman Date: Thu, 19 May 2022 14:25:43 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.9.316~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c783da97436d9905307c569f7070496858dad1c8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch --- diff --git a/queue-5.4/mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch b/queue-5.4/mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch new file mode 100644 index 00000000000..cfa2c6582ac --- /dev/null +++ b/queue-5.4/mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch @@ -0,0 +1,57 @@ +From foo@baz Thu May 19 04:18:43 PM CEST 2022 +From: Florian Fainelli +Date: Tue, 17 May 2022 11:09:10 -0700 +Subject: mmc: block: Use generic_cmd6_time when modifying INAND_CMD38_ARG_EXT_CSD +To: stable@vger.kernel.org +Cc: "Ulf Hansson" , "Florian Fainelli" , "Adrian Hunter" , "Greg Kroah-Hartman" , "Avri Altman" , "Bean Huo" , "Nishad Kamdar" , "Christian Löhle" , linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com, kdasu.kdev@gmail.com +Message-ID: <20220517180911.246016-3-f.fainelli@gmail.com> + +From: Ulf Hansson + +commit ad91619aa9d78ab1c6d4a969c3db68bc331ae76c upstream + +The INAND_CMD38_ARG_EXT_CSD is a vendor specific EXT_CSD register, which is +used to prepare an erase/trim operation. However, it doesn't make sense to +use a timeout of 10 minutes while updating the register, which becomes the +case when the timeout_ms argument for mmc_switch() is set to zero. + +Instead, let's use the generic_cmd6_time, as that seems like a reasonable +timeout to use for these cases. + +Signed-off-by: Ulf Hansson +Link: https://lore.kernel.org/r/20200122142747.5690-3-ulf.hansson@linaro.org +Signed-off-by: Florian Fainelli +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/block.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -1126,7 +1126,7 @@ static void mmc_blk_issue_discard_rq(str + card->erase_arg == MMC_TRIM_ARG ? + INAND_CMD38_ARG_TRIM : + INAND_CMD38_ARG_ERASE, +- 0); ++ card->ext_csd.generic_cmd6_time); + } + if (!err) + err = mmc_erase(card, from, nr, card->erase_arg); +@@ -1168,7 +1168,7 @@ retry: + arg == MMC_SECURE_TRIM1_ARG ? + INAND_CMD38_ARG_SECTRIM1 : + INAND_CMD38_ARG_SECERASE, +- 0); ++ card->ext_csd.generic_cmd6_time); + if (err) + goto out_retry; + } +@@ -1186,7 +1186,7 @@ retry: + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + INAND_CMD38_ARG_EXT_CSD, + INAND_CMD38_ARG_SECTRIM2, +- 0); ++ card->ext_csd.generic_cmd6_time); + if (err) + goto out_retry; + } diff --git a/queue-5.4/mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch b/queue-5.4/mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch new file mode 100644 index 00000000000..9d40a0c4f4b --- /dev/null +++ b/queue-5.4/mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch @@ -0,0 +1,74 @@ +From foo@baz Thu May 19 04:18:43 PM CEST 2022 +From: Florian Fainelli +Date: Tue, 17 May 2022 11:09:11 -0700 +Subject: mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch() +To: stable@vger.kernel.org +Cc: "Ulf Hansson" , "Florian Fainelli" , "Adrian Hunter" , "Greg Kroah-Hartman" , "Avri Altman" , "Bean Huo" , "Nishad Kamdar" , "Christian Löhle" , linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com, kdasu.kdev@gmail.com +Message-ID: <20220517180911.246016-4-f.fainelli@gmail.com> + +From: Ulf Hansson + +commit 533a6cfe08f96a7b5c65e06d20916d552c11b256 upstream + +All callers of __mmc_switch() should now be specifying a valid timeout for +the CMD6 command. However, just to be sure, let's print a warning and +default to use the generic_cmd6_time in case the provided timeout_ms +argument is zero. + +In this context, let's also simplify some of the corresponding code and +clarify some related comments. + +Signed-off-by: Ulf Hansson +Link: https://lore.kernel.org/r/20200122142747.5690-4-ulf.hansson@linaro.org +Signed-off-by: Florian Fainelli +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/mmc_ops.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +--- a/drivers/mmc/core/mmc_ops.c ++++ b/drivers/mmc/core/mmc_ops.c +@@ -460,10 +460,6 @@ static int mmc_poll_for_busy(struct mmc_ + bool expired = false; + bool busy = false; + +- /* We have an unspecified cmd timeout, use the fallback value. */ +- if (!timeout_ms) +- timeout_ms = MMC_OPS_TIMEOUT_MS; +- + /* + * In cases when not allowed to poll by using CMD13 or because we aren't + * capable of polling by using ->card_busy(), then rely on waiting the +@@ -536,6 +532,12 @@ int __mmc_switch(struct mmc_card *card, + + mmc_retune_hold(host); + ++ if (!timeout_ms) { ++ pr_warn("%s: unspecified timeout for CMD6 - use generic\n", ++ mmc_hostname(host)); ++ timeout_ms = card->ext_csd.generic_cmd6_time; ++ } ++ + /* + * If the cmd timeout and the max_busy_timeout of the host are both + * specified, let's validate them. A failure means we need to prevent +@@ -544,7 +546,7 @@ int __mmc_switch(struct mmc_card *card, + * which also means they are on their own when it comes to deal with the + * busy timeout. + */ +- if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && + host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) + use_r1b_resp = false; + +@@ -556,10 +558,6 @@ int __mmc_switch(struct mmc_card *card, + cmd.flags = MMC_CMD_AC; + if (use_r1b_resp) { + cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B; +- /* +- * A busy_timeout of zero means the host can decide to use +- * whatever value it finds suitable. +- */ + cmd.busy_timeout = timeout_ms; + } else { + cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1; diff --git a/queue-5.4/mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch b/queue-5.4/mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch new file mode 100644 index 00000000000..d101c3288f0 --- /dev/null +++ b/queue-5.4/mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch @@ -0,0 +1,58 @@ +From foo@baz Thu May 19 04:18:43 PM CEST 2022 +From: Florian Fainelli +Date: Tue, 17 May 2022 11:09:09 -0700 +Subject: mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC +To: stable@vger.kernel.org +Cc: "Ulf Hansson" , "Florian Fainelli" , "Adrian Hunter" , "Greg Kroah-Hartman" , "Avri Altman" , "Bean Huo" , "Nishad Kamdar" , "Christian Löhle" , linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com, kdasu.kdev@gmail.com +Message-ID: <20220517180911.246016-2-f.fainelli@gmail.com> + +From: Ulf Hansson + +commit 24ed3bd01d6a844fd5e8a75f48d0a3d10ed71bf9 upstream + +The timeout values used while waiting for a CMD6 for BKOPS or a CACHE_FLUSH +to complete, are not defined by the eMMC spec. However, a timeout of 10 +minutes as is currently being used, is just silly for both of these cases. +Instead, let's specify more reasonable timeouts, 120s for BKOPS and 30s for +CACHE_FLUSH. + +Signed-off-by: Ulf Hansson +Link: https://lore.kernel.org/r/20200122142747.5690-2-ulf.hansson@linaro.org +Signed-off-by: Florian Fainelli +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/mmc_ops.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/mmc/core/mmc_ops.c ++++ b/drivers/mmc/core/mmc_ops.c +@@ -19,7 +19,9 @@ + #include "host.h" + #include "mmc_ops.h" + +-#define MMC_OPS_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ ++#define MMC_OPS_TIMEOUT_MS (10 * 60 * 1000) /* 10min*/ ++#define MMC_BKOPS_TIMEOUT_MS (120 * 1000) /* 120s */ ++#define MMC_CACHE_FLUSH_TIMEOUT_MS (30 * 1000) /* 30s */ + + static const u8 tuning_blk_pattern_4bit[] = { + 0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc, +@@ -943,7 +945,7 @@ void mmc_run_bkops(struct mmc_card *card + * urgent levels by using an asynchronous background task, when idle. + */ + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +- EXT_CSD_BKOPS_START, 1, MMC_OPS_TIMEOUT_MS); ++ EXT_CSD_BKOPS_START, 1, MMC_BKOPS_TIMEOUT_MS); + if (err) + pr_warn("%s: Error %d starting bkops\n", + mmc_hostname(card->host), err); +@@ -961,7 +963,8 @@ int mmc_flush_cache(struct mmc_card *car + + if (mmc_cache_enabled(card->host)) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +- EXT_CSD_FLUSH_CACHE, 1, 0); ++ EXT_CSD_FLUSH_CACHE, 1, ++ MMC_CACHE_FLUSH_TIMEOUT_MS); + if (err) + pr_err("%s: cache flush error %d\n", + mmc_hostname(card->host), err); diff --git a/queue-5.4/series b/queue-5.4/series index 7f5a64a5c8e..cb8f2f823b7 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -17,3 +17,6 @@ platform-chrome-cros_ec_debugfs-detach-log-reader-wq.patch arm-9191-1-arm-stacktrace-kasan-silence-kasan-warnin.patch nilfs2-fix-lockdep-warnings-in-page-operations-for-b.patch nilfs2-fix-lockdep-warnings-during-disk-space-reclam.patch +mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch +mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch +mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch