]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2022 14:25:13 +0000 (16:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2022 14:25:13 +0000 (16:25 +0200)
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

queue-4.9/mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch [new file with mode: 0644]
queue-4.9/mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch [new file with mode: 0644]
queue-4.9/mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch b/queue-4.9/mmc-block-use-generic_cmd6_time-when-modifying-inand_cmd38_arg_ext_csd.patch
new file mode 100644 (file)
index 0000000..33da5ee
--- /dev/null
@@ -0,0 +1,58 @@
+From foo@baz Thu May 19 04:19:55 PM CEST 2022
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Tue, 17 May 2022 11:32:06 -0700
+Subject: mmc: block: Use generic_cmd6_time when modifying INAND_CMD38_ARG_EXT_CSD
+To: stable@vger.kernel.org
+Cc: "Ulf Hansson" <ulf.hansson@linaro.org>, "Kamal Dasu" <kdasu.kdev@gmail.com>, "Florian Fainelli" <f.fainelli@gmail.com>, "Adrian Hunter" <adrian.hunter@intel.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Avri Altman" <avri.altman@wdc.com>, "Bean Huo" <beanhuo@micron.com>, "Nishad Kamdar" <nishadkamdar@gmail.com>, "Christian Löhle" <CLoehle@hyperstone.com>, linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com
+Message-ID: <20220517183207.258065-3-f.fainelli@gmail.com>
+
+From: Ulf Hansson <ulf.hansson@linaro.org>
+
+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 <ulf.hansson@linaro.org>
+Link: https://lore.kernel.org/r/20200122142747.5690-3-ulf.hansson@linaro.org
+Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/card/block.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/mmc/card/block.c
++++ b/drivers/mmc/card/block.c
+@@ -1192,7 +1192,7 @@ retry:
+                                arg == MMC_TRIM_ARG ?
+                                INAND_CMD38_ARG_TRIM :
+                                INAND_CMD38_ARG_ERASE,
+-                               0);
++                               card->ext_csd.generic_cmd6_time);
+               if (err)
+                       goto out;
+       }
+@@ -1235,7 +1235,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;
+       }
+@@ -1251,7 +1251,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-4.9/mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch b/queue-4.9/mmc-core-default-to-generic_cmd6_time-as-timeout-in-__mmc_switch.patch
new file mode 100644 (file)
index 0000000..b76c966
--- /dev/null
@@ -0,0 +1,55 @@
+From foo@baz Thu May 19 04:19:55 PM CEST 2022
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Tue, 17 May 2022 11:32:07 -0700
+Subject: mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch()
+To: stable@vger.kernel.org
+Cc: "Ulf Hansson" <ulf.hansson@linaro.org>, "Kamal Dasu" <kdasu.kdev@gmail.com>, "Florian Fainelli" <f.fainelli@gmail.com>, "Adrian Hunter" <adrian.hunter@intel.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Avri Altman" <avri.altman@wdc.com>, "Bean Huo" <beanhuo@micron.com>, "Nishad Kamdar" <nishadkamdar@gmail.com>, "Christian Löhle" <CLoehle@hyperstone.com>, linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com
+Message-ID: <20220517183207.258065-4-f.fainelli@gmail.com>
+
+From: Ulf Hansson <ulf.hansson@linaro.org>
+
+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 <ulf.hansson@linaro.org>
+Link: https://lore.kernel.org/r/20200122142747.5690-4-ulf.hansson@linaro.org
+Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
+[kamal: Drop non-existent hunks in 4.9's __mmc_switch]
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/core/mmc_ops.c |    9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/drivers/mmc/core/mmc_ops.c
++++ b/drivers/mmc/core/mmc_ops.c
+@@ -22,8 +22,6 @@
+ #include "host.h"
+ #include "mmc_ops.h"
+-#define MMC_OPS_TIMEOUT_MS    (10 * 60 * 1000) /* 10 minute timeout */
+-
+ static const u8 tuning_blk_pattern_4bit[] = {
+       0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
+       0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef,
+@@ -530,8 +528,11 @@ int __mmc_switch(struct mmc_card *card,
+               ignore_crc = false;
+       /* We have an unspecified cmd timeout, use the fallback value. */
+-      if (!timeout_ms)
+-              timeout_ms = MMC_OPS_TIMEOUT_MS;
++      if (!timeout_ms) {
++              pr_warn("%s: unspecified timeout for CMD6 - use generic\n",
++                      mmc_hostname(host));
++              timeout_ms = card->ext_csd.generic_cmd6_time;
++      }
+       /* Must check status to be sure of no errors. */
+       timeout = jiffies + msecs_to_jiffies(timeout_ms) + 1;
diff --git a/queue-4.9/mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch b/queue-4.9/mmc-core-specify-timeouts-for-bkops-and-cache_flush-for-emmc.patch
new file mode 100644 (file)
index 0000000..403f750
--- /dev/null
@@ -0,0 +1,49 @@
+From foo@baz Thu May 19 04:19:55 PM CEST 2022
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Tue, 17 May 2022 11:32:05 -0700
+Subject: mmc: core: Specify timeouts for BKOPS and CACHE_FLUSH for eMMC
+To: stable@vger.kernel.org
+Cc: "Ulf Hansson" <ulf.hansson@linaro.org>, "Kamal Dasu" <kdasu.kdev@gmail.com>, "Florian Fainelli" <f.fainelli@gmail.com>, "Adrian Hunter" <adrian.hunter@intel.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, "Avri Altman" <avri.altman@wdc.com>, "Bean Huo" <beanhuo@micron.com>, "Nishad Kamdar" <nishadkamdar@gmail.com>, "Christian Löhle" <CLoehle@hyperstone.com>, linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-kernel@vger.kernel.org (open list), alcooperx@gmail.com
+Message-ID: <20220517183207.258065-2-f.fainelli@gmail.com>
+
+From: Ulf Hansson <ulf.hansson@linaro.org>
+
+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 <ulf.hansson@linaro.org>
+Link: https://lore.kernel.org/r/20200122142747.5690-2-ulf.hansson@linaro.org
+Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
+[kamal: Drop mmc_run_bkops hunk, non-existent]
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/core/core.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/mmc/core/core.c
++++ b/drivers/mmc/core/core.c
+@@ -61,6 +61,8 @@
+ /* The max erase timeout, used when host->max_busy_timeout isn't specified */
+ #define MMC_ERASE_TIMEOUT_MS  (60 * 1000) /* 60 s */
++#define MMC_CACHE_FLUSH_TIMEOUT_MS     (30 * 1000) /* 30s */
++
+ static const unsigned freqs[] = { 400000, 300000, 200000, 100000 };
+ /*
+@@ -2936,7 +2938,8 @@ int mmc_flush_cache(struct mmc_card *car
+                       (card->ext_csd.cache_size > 0) &&
+                       (card->ext_csd.cache_ctrl & 1)) {
+               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);
index 935c4aea9f881befb2b5cf4c4d6b0ad1988463bc..ac5e767a004612bd0e12ad8a2b74c75f9e0d272b 100644 (file)
@@ -5,3 +5,6 @@ input-add-bounds-checking-to-input_set_capability.patch
 mips-lantiq-check-the-return-value-of-kzalloc.patch
 drbd-remove-usage-of-list-iterator-variable-after-lo.patch
 arm-9191-1-arm-stacktrace-kasan-silence-kasan-warnin.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