From: Greg Kroah-Hartman Date: Sun, 1 Jul 2018 09:01:19 +0000 (+0200) Subject: 4.17-stable patches X-Git-Tag: v3.18.114~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ffb7c893d32d6c3f3419539ee5a9646ccfa5401b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.17-stable patches added patches: 1wire-family-module-autoload-fails-because-of-upper-lower-case-mismatch.patch acpi-lpss-avoid-pm-quirks-on-suspend-and-resume-from-s3.patch asoc-cirrus-i2s-fix-lrclk-configuration.patch asoc-cirrus-i2s-fix-tx-rx-linctrldata-setup.patch asoc-cs35l35-add-use_single_rw-to-regmap-config.patch asoc-dapm-delete-dapm_kcontrol_data-paths-list-before-freeing-it.patch asoc-mediatek-preallocate-pages-use-platform-device.patch clk-renesas-cpg-mssr-stop-using-printk-format-pcr.patch ftrace-selftest-have-the-reset_trigger-code-be-a-bit-more-careful.patch hwmon-k10temp-add-support-for-stoney-ridge-and-bristol-ridge-cpus.patch lib-vsprintf-remove-atomic-unsafe-support-for-pcr.patch m68k-mac-fix-swim-memory-resource-end-address.patch m68k-mm-adjust-vm-area-to-be-unmapped-by-gap-size-for-__iounmap.patch mips-ftrace-fix-static-function-graph-tracing.patch mmc-renesas_sdhi-really-fix-wp-logic-regressions.patch mtd-spi-nor-intel-spi-fix-atomic-sequence-handling.patch pci-pm-do-not-clear-state_saved-for-devices-that-remain-suspended.patch platform-chrome-cros_ec_lpc-do-not-try-dmi-match-when-acpi-device-found.patch pm-core-fix-supplier-device-runtime-pm-usage-counter-imbalance.patch pm-domains-fix-error-path-during-attach-in-genpd.patch pm-opp-update-voltage-in-case-freq-old_freq.patch serial-sh-sci-use-spin_-try-lock_irqsave-instead-of-open-coding-version.patch signal-xtensa-consistenly-use-sigbus-in-do_unaligned_user.patch thermal-bcm2835-stop-using-printk-format-pcr.patch usb-do-not-reset-if-a-low-speed-or-full-speed-device-timed-out.patch --- diff --git a/queue-4.17/1wire-family-module-autoload-fails-because-of-upper-lower-case-mismatch.patch b/queue-4.17/1wire-family-module-autoload-fails-because-of-upper-lower-case-mismatch.patch new file mode 100644 index 00000000000..bb7a4e7ec95 --- /dev/null +++ b/queue-4.17/1wire-family-module-autoload-fails-because-of-upper-lower-case-mismatch.patch @@ -0,0 +1,35 @@ +From 065c09563c872e52813a17218c52cd642be1dca6 Mon Sep 17 00:00:00 2001 +From: Ingo Flaschberger +Date: Tue, 1 May 2018 16:10:33 +0200 +Subject: 1wire: family module autoload fails because of upper/lower case mismatch. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ingo Flaschberger + +commit 065c09563c872e52813a17218c52cd642be1dca6 upstream. + +1wire family module autoload fails because of upper/lower +  case mismatch. + +Signed-off-by: Ingo Flaschberger +Acked-by: Evgeniy Polyakov +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/w1/w1.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/w1/w1.c ++++ b/drivers/w1/w1.c +@@ -751,7 +751,7 @@ int w1_attach_slave_device(struct w1_mas + + /* slave modules need to be loaded in a context with unlocked mutex */ + mutex_unlock(&dev->mutex); +- request_module("w1-family-0x%02x", rn->family); ++ request_module("w1-family-0x%02X", rn->family); + mutex_lock(&dev->mutex); + + spin_lock(&w1_flock); diff --git a/queue-4.17/acpi-lpss-avoid-pm-quirks-on-suspend-and-resume-from-s3.patch b/queue-4.17/acpi-lpss-avoid-pm-quirks-on-suspend-and-resume-from-s3.patch new file mode 100644 index 00000000000..29b0eeecb37 --- /dev/null +++ b/queue-4.17/acpi-lpss-avoid-pm-quirks-on-suspend-and-resume-from-s3.patch @@ -0,0 +1,108 @@ +From a09c591306881dfb04387c6ee7b7e2e4683fa531 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Wed, 13 Jun 2018 13:17:26 +0200 +Subject: ACPI / LPSS: Avoid PM quirks on suspend and resume from S3 + +From: Rafael J. Wysocki + +commit a09c591306881dfb04387c6ee7b7e2e4683fa531 upstream. + +It is reported that commit a192aa923b66a (ACPI / LPSS: Consolidate +runtime PM and system sleep handling) introduced a system suspend +regression on some machines, but the only functional change made by +it was to cause the PM quirks in the LPSS to also be used during +system suspend and resume. While that should always work for +suspend-to-idle, it turns out to be problematic for S3 +(suspend-to-RAM). + +To address that issue restore the previous S3 suspend and resume +behavior of the LPSS to avoid applying PM quirks then. + +Fixes: a192aa923b66a (ACPI / LPSS: Consolidate runtime PM and system sleep handling) +Link: https://bugs.launchpad.net/bugs/1774950 +Reported-by: Kai-Heng Feng +Tested-by: Kai-Heng Feng +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Ulf Hansson +Reviewed-by: Andy Shevchenko +Acked-by: Mika Westerberg +Cc: 4.15+ # 4.15+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/acpi_lpss.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +--- a/drivers/acpi/acpi_lpss.c ++++ b/drivers/acpi/acpi_lpss.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + + #include "internal.h" +@@ -940,9 +941,10 @@ static void lpss_iosf_exit_d3_state(void + mutex_unlock(&lpss_iosf_mutex); + } + +-static int acpi_lpss_suspend(struct device *dev, bool wakeup) ++static int acpi_lpss_suspend(struct device *dev, bool runtime) + { + struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); ++ bool wakeup = runtime || device_may_wakeup(dev); + int ret; + + if (pdata->dev_desc->flags & LPSS_SAVE_CTX) +@@ -955,13 +957,14 @@ static int acpi_lpss_suspend(struct devi + * wrong status for devices being about to be powered off. See + * lpss_iosf_enter_d3_state() for further information. + */ +- if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) ++ if ((runtime || !pm_suspend_via_firmware()) && ++ lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) + lpss_iosf_enter_d3_state(); + + return ret; + } + +-static int acpi_lpss_resume(struct device *dev) ++static int acpi_lpss_resume(struct device *dev, bool runtime) + { + struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); + int ret; +@@ -970,7 +973,8 @@ static int acpi_lpss_resume(struct devic + * This call is kept first to be in symmetry with + * acpi_lpss_runtime_suspend() one. + */ +- if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) ++ if ((runtime || !pm_resume_via_firmware()) && ++ lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) + lpss_iosf_exit_d3_state(); + + ret = acpi_dev_resume(dev); +@@ -994,12 +998,12 @@ static int acpi_lpss_suspend_late(struct + return 0; + + ret = pm_generic_suspend_late(dev); +- return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev)); ++ return ret ? ret : acpi_lpss_suspend(dev, false); + } + + static int acpi_lpss_resume_early(struct device *dev) + { +- int ret = acpi_lpss_resume(dev); ++ int ret = acpi_lpss_resume(dev, false); + + return ret ? ret : pm_generic_resume_early(dev); + } +@@ -1014,7 +1018,7 @@ static int acpi_lpss_runtime_suspend(str + + static int acpi_lpss_runtime_resume(struct device *dev) + { +- int ret = acpi_lpss_resume(dev); ++ int ret = acpi_lpss_resume(dev, true); + + return ret ? ret : pm_generic_runtime_resume(dev); + } diff --git a/queue-4.17/asoc-cirrus-i2s-fix-lrclk-configuration.patch b/queue-4.17/asoc-cirrus-i2s-fix-lrclk-configuration.patch new file mode 100644 index 00000000000..37236559132 --- /dev/null +++ b/queue-4.17/asoc-cirrus-i2s-fix-lrclk-configuration.patch @@ -0,0 +1,80 @@ +From 2d534113be9a2aa532a1ae127a57e83558aed358 Mon Sep 17 00:00:00 2001 +From: Alexander Sverdlin +Date: Sat, 28 Apr 2018 22:51:38 +0200 +Subject: ASoC: cirrus: i2s: Fix LRCLK configuration + +From: Alexander Sverdlin + +commit 2d534113be9a2aa532a1ae127a57e83558aed358 upstream. + +The bit responsible for LRCLK polarity is i2s_tlrs (0), not i2s_trel (2) +(refer to "EP93xx User's Guide"). + +Previously card drivers which specified SND_SOC_DAIFMT_NB_IF actually got +SND_SOC_DAIFMT_NB_NF, an adaptation is necessary to retain the old +behavior. + +Signed-off-by: Alexander Sverdlin +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/cirrus/edb93xx.c | 2 +- + sound/soc/cirrus/ep93xx-i2s.c | 8 ++++---- + sound/soc/cirrus/snappercl15.c | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +--- a/sound/soc/cirrus/edb93xx.c ++++ b/sound/soc/cirrus/edb93xx.c +@@ -67,7 +67,7 @@ static struct snd_soc_dai_link edb93xx_d + .cpu_dai_name = "ep93xx-i2s", + .codec_name = "spi0.0", + .codec_dai_name = "cs4271-hifi", +- .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + .ops = &edb93xx_ops, + }; +--- a/sound/soc/cirrus/ep93xx-i2s.c ++++ b/sound/soc/cirrus/ep93xx-i2s.c +@@ -213,24 +213,24 @@ static int ep93xx_i2s_set_dai_fmt(struct + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: + /* Negative bit clock, lrclk low on left word */ +- clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL); ++ clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_LRS); + break; + + case SND_SOC_DAIFMT_NB_IF: + /* Negative bit clock, lrclk low on right word */ + clk_cfg &= ~EP93XX_I2S_CLKCFG_CKP; +- clk_cfg |= EP93XX_I2S_CLKCFG_REL; ++ clk_cfg |= EP93XX_I2S_CLKCFG_LRS; + break; + + case SND_SOC_DAIFMT_IB_NF: + /* Positive bit clock, lrclk low on left word */ + clk_cfg |= EP93XX_I2S_CLKCFG_CKP; +- clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; ++ clk_cfg &= ~EP93XX_I2S_CLKCFG_LRS; + break; + + case SND_SOC_DAIFMT_IB_IF: + /* Positive bit clock, lrclk low on right word */ +- clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL; ++ clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_LRS; + break; + } + +--- a/sound/soc/cirrus/snappercl15.c ++++ b/sound/soc/cirrus/snappercl15.c +@@ -72,7 +72,7 @@ static struct snd_soc_dai_link snappercl + .codec_dai_name = "tlv320aic23-hifi", + .codec_name = "tlv320aic23-codec.0-001a", + .platform_name = "ep93xx-i2s", +- .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | ++ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + .ops = &snappercl15_ops, + }; diff --git a/queue-4.17/asoc-cirrus-i2s-fix-tx-rx-linctrldata-setup.patch b/queue-4.17/asoc-cirrus-i2s-fix-tx-rx-linctrldata-setup.patch new file mode 100644 index 00000000000..26de25e7ce8 --- /dev/null +++ b/queue-4.17/asoc-cirrus-i2s-fix-tx-rx-linctrldata-setup.patch @@ -0,0 +1,85 @@ +From 5d302ed3cc80564fb835bed5fdba1e1250ecc9e5 Mon Sep 17 00:00:00 2001 +From: Alexander Sverdlin +Date: Sat, 28 Apr 2018 22:51:39 +0200 +Subject: ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alexander Sverdlin + +commit 5d302ed3cc80564fb835bed5fdba1e1250ecc9e5 upstream. + +According to "EP93xx User’s Guide", I2STXLinCtrlData and I2SRXLinCtrlData +registers actually have different format. The only currently used bit +(Left_Right_Justify) has different position. Fix this and simplify the +whole setup taking into account the fact that both registers have zero +default value. + +The practical effect of the above is repaired SND_SOC_DAIFMT_RIGHT_J +support (currently unused). + +Signed-off-by: Alexander Sverdlin +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/cirrus/ep93xx-i2s.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +--- a/sound/soc/cirrus/ep93xx-i2s.c ++++ b/sound/soc/cirrus/ep93xx-i2s.c +@@ -51,7 +51,9 @@ + #define EP93XX_I2S_WRDLEN_24 (1 << 0) + #define EP93XX_I2S_WRDLEN_32 (2 << 0) + +-#define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2) /* Right justify */ ++#define EP93XX_I2S_RXLINCTRLDATA_R_JUST BIT(1) /* Right justify */ ++ ++#define EP93XX_I2S_TXLINCTRLDATA_R_JUST BIT(2) /* Right justify */ + + #define EP93XX_I2S_CLKCFG_LRS (1 << 0) /* lrclk polarity */ + #define EP93XX_I2S_CLKCFG_CKP (1 << 1) /* Bit clock polarity */ +@@ -170,25 +172,25 @@ static int ep93xx_i2s_set_dai_fmt(struct + unsigned int fmt) + { + struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai); +- unsigned int clk_cfg, lin_ctrl; ++ unsigned int clk_cfg; ++ unsigned int txlin_ctrl = 0; ++ unsigned int rxlin_ctrl = 0; + + clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG); +- lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA); + + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: + clk_cfg |= EP93XX_I2S_CLKCFG_REL; +- lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; + break; + + case SND_SOC_DAIFMT_LEFT_J: + clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; +- lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST; + break; + + case SND_SOC_DAIFMT_RIGHT_J: + clk_cfg &= ~EP93XX_I2S_CLKCFG_REL; +- lin_ctrl |= EP93XX_I2S_LINCTRLDATA_R_JUST; ++ rxlin_ctrl |= EP93XX_I2S_RXLINCTRLDATA_R_JUST; ++ txlin_ctrl |= EP93XX_I2S_TXLINCTRLDATA_R_JUST; + break; + + default: +@@ -237,8 +239,8 @@ static int ep93xx_i2s_set_dai_fmt(struct + /* Write new register values */ + ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg); + ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg); +- ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl); +- ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl); ++ ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, rxlin_ctrl); ++ ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, txlin_ctrl); + return 0; + } + diff --git a/queue-4.17/asoc-cs35l35-add-use_single_rw-to-regmap-config.patch b/queue-4.17/asoc-cs35l35-add-use_single_rw-to-regmap-config.patch new file mode 100644 index 00000000000..62c19b81f9d --- /dev/null +++ b/queue-4.17/asoc-cs35l35-add-use_single_rw-to-regmap-config.patch @@ -0,0 +1,31 @@ +From 6a6ad7face95af0b9e6aaf1eb2261eb70240b89b Mon Sep 17 00:00:00 2001 +From: Paul Handrigan +Date: Fri, 4 May 2018 16:37:41 -0500 +Subject: ASoC: cs35l35: Add use_single_rw to regmap config + +From: Paul Handrigan + +commit 6a6ad7face95af0b9e6aaf1eb2261eb70240b89b upstream. + +Add the use_single_rw flag to regmap config since the +device does not support bulk transactions over i2c. + +Signed-off-by: Paul Handrigan +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/cs35l35.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/soc/codecs/cs35l35.c ++++ b/sound/soc/codecs/cs35l35.c +@@ -1105,6 +1105,7 @@ static struct regmap_config cs35l35_regm + .readable_reg = cs35l35_readable_register, + .precious_reg = cs35l35_precious_register, + .cache_type = REGCACHE_RBTREE, ++ .use_single_rw = true, + }; + + static irqreturn_t cs35l35_irq(int irq, void *data) diff --git a/queue-4.17/asoc-dapm-delete-dapm_kcontrol_data-paths-list-before-freeing-it.patch b/queue-4.17/asoc-dapm-delete-dapm_kcontrol_data-paths-list-before-freeing-it.patch new file mode 100644 index 00000000000..31d9dbabd5f --- /dev/null +++ b/queue-4.17/asoc-dapm-delete-dapm_kcontrol_data-paths-list-before-freeing-it.patch @@ -0,0 +1,38 @@ +From ff2faf1289c1f81b5b26b9451dd1c2006aac8db8 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Mon, 4 Jun 2018 12:13:26 +0100 +Subject: ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it + +From: Srinivas Kandagatla + +commit ff2faf1289c1f81b5b26b9451dd1c2006aac8db8 upstream. + +dapm_kcontrol_data is freed as part of dapm_kcontrol_free(), leaving the +paths pointer dangling in the list. + +This leads to system crash when we try to unload and reload sound card. +I hit this bug during ADSP crash/reboot test case on Dragon board DB410c. + +Without this patch, on SLAB Poisoning enabled build, kernel crashes with +"BUG kmalloc-128 (Tainted: G W ): Poison overwritten" + +Signed-off-by: Srinivas Kandagatla +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/soc-dapm.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/soc/soc-dapm.c ++++ b/sound/soc/soc-dapm.c +@@ -433,6 +433,8 @@ err_data: + static void dapm_kcontrol_free(struct snd_kcontrol *kctl) + { + struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); ++ ++ list_del(&data->paths); + kfree(data->wlist); + kfree(data); + } diff --git a/queue-4.17/asoc-mediatek-preallocate-pages-use-platform-device.patch b/queue-4.17/asoc-mediatek-preallocate-pages-use-platform-device.patch new file mode 100644 index 00000000000..a595a8c9c9a --- /dev/null +++ b/queue-4.17/asoc-mediatek-preallocate-pages-use-platform-device.patch @@ -0,0 +1,40 @@ +From 5845e6155d8f4a4a9bae2d4c1d1bb4a4d9a925c2 Mon Sep 17 00:00:00 2001 +From: Kai Chieh Chuang +Date: Fri, 27 Apr 2018 10:11:35 +0800 +Subject: ASoC: mediatek: preallocate pages use platform device + +From: Kai Chieh Chuang + +commit 5845e6155d8f4a4a9bae2d4c1d1bb4a4d9a925c2 upstream. + +preallocate pages should use platform device, +since we set dma mask for platform device. + +Signed-off-by: KaiChieh Chuang +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/mediatek/common/mtk-afe-platform-driver.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c ++++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c +@@ -64,14 +64,14 @@ static const struct snd_pcm_ops mtk_afe_ + static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd) + { + size_t size; +- struct snd_card *card = rtd->card->snd_card; + struct snd_pcm *pcm = rtd->pcm; + struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); + + size = afe->mtk_afe_hardware->buffer_bytes_max; + return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, +- card->dev, size, size); ++ rtd->platform->dev, ++ size, size); + } + + static void mtk_afe_pcm_free(struct snd_pcm *pcm) diff --git a/queue-4.17/clk-renesas-cpg-mssr-stop-using-printk-format-pcr.patch b/queue-4.17/clk-renesas-cpg-mssr-stop-using-printk-format-pcr.patch new file mode 100644 index 00000000000..d5579f6006a --- /dev/null +++ b/queue-4.17/clk-renesas-cpg-mssr-stop-using-printk-format-pcr.patch @@ -0,0 +1,79 @@ +From ef4b0be62641d296cf4c0ad8f75ab83ab066ed51 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Fri, 1 Jun 2018 11:28:19 +0200 +Subject: clk: renesas: cpg-mssr: Stop using printk format %pCr + +From: Geert Uytterhoeven + +commit ef4b0be62641d296cf4c0ad8f75ab83ab066ed51 upstream. + +Printk format "%pCr" will be removed soon, as clk_get_rate() must not be +called in atomic context. + +Replace it by open-coding the operation. This is safe here, as the code +runs in task context. + +Link: http://lkml.kernel.org/r/1527845302-12159-2-git-send-email-geert+renesas@glider.be +To: Jia-Ju Bai +To: Jonathan Corbet +To: Michael Turquette +To: Stephen Boyd +To: Zhang Rui +To: Eduardo Valentin +To: Eric Anholt +To: Stefan Wahren +To: Greg Kroah-Hartman +Cc: Sergey Senozhatsky +Cc: Petr Mladek +Cc: Linus Torvalds +Cc: Steven Rostedt +Cc: linux-doc@vger.kernel.org +Cc: linux-clk@vger.kernel.org +Cc: linux-pm@vger.kernel.org +Cc: linux-serial@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-renesas-soc@vger.kernel.org +Cc: linux-kernel@vger.kernel.org +Cc: Geert Uytterhoeven +Cc: stable@vger.kernel.org # 4.5+ +Signed-off-by: Geert Uytterhoeven +Acked-by: Stephen Boyd +Signed-off-by: Petr Mladek +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clk/renesas/renesas-cpg-mssr.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/clk/renesas/renesas-cpg-mssr.c ++++ b/drivers/clk/renesas/renesas-cpg-mssr.c +@@ -258,8 +258,9 @@ struct clk *cpg_mssr_clk_src_twocell_get + dev_err(dev, "Cannot get %s clock %u: %ld", type, clkidx, + PTR_ERR(clk)); + else +- dev_dbg(dev, "clock (%u, %u) is %pC at %pCr Hz\n", +- clkspec->args[0], clkspec->args[1], clk, clk); ++ dev_dbg(dev, "clock (%u, %u) is %pC at %lu Hz\n", ++ clkspec->args[0], clkspec->args[1], clk, ++ clk_get_rate(clk)); + return clk; + } + +@@ -326,7 +327,7 @@ static void __init cpg_mssr_register_cor + if (IS_ERR_OR_NULL(clk)) + goto fail; + +- dev_dbg(dev, "Core clock %pC at %pCr Hz\n", clk, clk); ++ dev_dbg(dev, "Core clock %pC at %lu Hz\n", clk, clk_get_rate(clk)); + priv->clks[id] = clk; + return; + +@@ -392,7 +393,7 @@ static void __init cpg_mssr_register_mod + if (IS_ERR(clk)) + goto fail; + +- dev_dbg(dev, "Module clock %pC at %pCr Hz\n", clk, clk); ++ dev_dbg(dev, "Module clock %pC at %lu Hz\n", clk, clk_get_rate(clk)); + priv->clks[id] = clk; + priv->smstpcr_saved[clock->index / 32].mask |= BIT(clock->index % 32); + return; diff --git a/queue-4.17/ftrace-selftest-have-the-reset_trigger-code-be-a-bit-more-careful.patch b/queue-4.17/ftrace-selftest-have-the-reset_trigger-code-be-a-bit-more-careful.patch new file mode 100644 index 00000000000..26061308a62 --- /dev/null +++ b/queue-4.17/ftrace-selftest-have-the-reset_trigger-code-be-a-bit-more-careful.patch @@ -0,0 +1,66 @@ +From 756b56a9e832e063edc83be7c3889e98c536dd2b Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (VMware)" +Date: Mon, 14 May 2018 15:40:29 -0400 +Subject: ftrace/selftest: Have the reset_trigger code be a bit more careful + +From: Steven Rostedt (VMware) + +commit 756b56a9e832e063edc83be7c3889e98c536dd2b upstream. + +The trigger code is picky in how it can be disabled as there may be +dependencies between different events and synthetic events. Change the order +on how triggers are reset. + + 1) Reset triggers of all synthetic events first + 2) Remove triggers with actions attached to them + 3) Remove all other triggers + +If this order isn't followed, then some triggers will not be reset, and an +error may happen because a trigger is busy. + +Cc: stable@vger.kernel.org +Fixes: cfa0963dc474f ("kselftests/ftrace : Add event trigger testcases") +Reviewed-by: Namhyung Kim +Acked-by: Masami Hiramatsu +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Greg Kroah-Hartman + +--- + tools/testing/selftests/ftrace/test.d/functions | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +--- a/tools/testing/selftests/ftrace/test.d/functions ++++ b/tools/testing/selftests/ftrace/test.d/functions +@@ -15,14 +15,29 @@ reset_tracer() { # reset the current tra + echo nop > current_tracer + } + +-reset_trigger() { # reset all current setting triggers +- grep -v ^# events/*/*/trigger | ++reset_trigger_file() { ++ # remove action triggers first ++ grep -H ':on[^:]*(' $@ | ++ while read line; do ++ cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` ++ file=`echo $line | cut -f1 -d:` ++ echo "!$cmd" >> $file ++ done ++ grep -Hv ^# $@ | + while read line; do + cmd=`echo $line | cut -f2- -d: | cut -f1 -d" "` +- echo "!$cmd" > `echo $line | cut -f1 -d:` ++ file=`echo $line | cut -f1 -d:` ++ echo "!$cmd" > $file + done + } + ++reset_trigger() { # reset all current setting triggers ++ if [ -d events/synthetic ]; then ++ reset_trigger_file events/synthetic/*/trigger ++ fi ++ reset_trigger_file events/*/*/trigger ++} ++ + reset_events_filter() { # reset all current setting filters + grep -v ^none events/*/*/filter | + while read line; do diff --git a/queue-4.17/hwmon-k10temp-add-support-for-stoney-ridge-and-bristol-ridge-cpus.patch b/queue-4.17/hwmon-k10temp-add-support-for-stoney-ridge-and-bristol-ridge-cpus.patch new file mode 100644 index 00000000000..fc63b78020b --- /dev/null +++ b/queue-4.17/hwmon-k10temp-add-support-for-stoney-ridge-and-bristol-ridge-cpus.patch @@ -0,0 +1,42 @@ +From ccaf63b4d6eaf3447037cefbb0b1038fa80c6639 Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Sun, 29 Apr 2018 09:16:45 -0700 +Subject: hwmon: (k10temp) Add support for Stoney Ridge and Bristol Ridge CPUs + +From: Guenter Roeck + +commit ccaf63b4d6eaf3447037cefbb0b1038fa80c6639 upstream. + +Add support for Stoney Ridge and Bristol Ridge (Family 15h Model 0x70) +CPUs. Registers match those of Family 15h Model 0x60. + +Cc: stable@vger.kernel.org # v4.16+ +Tested-by: Gabriel Craciunescu +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/k10temp.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/hwmon/k10temp.c ++++ b/drivers/hwmon/k10temp.c +@@ -37,6 +37,10 @@ MODULE_PARM_DESC(force, "force loading o + /* Provide lock for writing to NB_SMU_IND_ADDR */ + static DEFINE_MUTEX(nb_smu_ind_mutex); + ++#ifndef PCI_DEVICE_ID_AMD_15H_M70H_NB_F3 ++#define PCI_DEVICE_ID_AMD_15H_M70H_NB_F3 0x15b3 ++#endif ++ + #ifndef PCI_DEVICE_ID_AMD_17H_DF_F3 + #define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463 + #endif +@@ -320,6 +324,7 @@ static const struct pci_device_id k10tem + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M60H_NB_F3) }, ++ { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M70H_NB_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, diff --git a/queue-4.17/lib-vsprintf-remove-atomic-unsafe-support-for-pcr.patch b/queue-4.17/lib-vsprintf-remove-atomic-unsafe-support-for-pcr.patch new file mode 100644 index 00000000000..83a7627c5aa --- /dev/null +++ b/queue-4.17/lib-vsprintf-remove-atomic-unsafe-support-for-pcr.patch @@ -0,0 +1,80 @@ +From 666902e42fd8344b923c02dc5b0f37948ff4f225 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Fri, 1 Jun 2018 11:28:22 +0200 +Subject: lib/vsprintf: Remove atomic-unsafe support for %pCr + +From: Geert Uytterhoeven + +commit 666902e42fd8344b923c02dc5b0f37948ff4f225 upstream. + +"%pCr" formats the current rate of a clock, and calls clk_get_rate(). +The latter obtains a mutex, hence it must not be called from atomic +context. + +Remove support for this rarely-used format, as vsprintf() (and e.g. +printk()) must be callable from any context. + +Any remaining out-of-tree users will start seeing the clock's name +printed instead of its rate. + +Reported-by: Jia-Ju Bai +Fixes: 900cca2944254edd ("lib/vsprintf: add %pC{,n,r} format specifiers for clocks") +Link: http://lkml.kernel.org/r/1527845302-12159-5-git-send-email-geert+renesas@glider.be +To: Jia-Ju Bai +To: Jonathan Corbet +To: Michael Turquette +To: Stephen Boyd +To: Zhang Rui +To: Eduardo Valentin +To: Eric Anholt +To: Stefan Wahren +To: Greg Kroah-Hartman +Cc: Sergey Senozhatsky +Cc: Petr Mladek +Cc: Linus Torvalds +Cc: Steven Rostedt +Cc: linux-doc@vger.kernel.org +Cc: linux-clk@vger.kernel.org +Cc: linux-pm@vger.kernel.org +Cc: linux-serial@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-renesas-soc@vger.kernel.org +Cc: linux-kernel@vger.kernel.org +Cc: Geert Uytterhoeven +Cc: stable@vger.kernel.org # 4.1+ +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Petr Mladek +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/core-api/printk-formats.rst | 3 +-- + lib/vsprintf.c | 3 --- + 2 files changed, 1 insertion(+), 5 deletions(-) + +--- a/Documentation/core-api/printk-formats.rst ++++ b/Documentation/core-api/printk-formats.rst +@@ -419,11 +419,10 @@ struct clk + + %pC pll1 + %pCn pll1 +- %pCr 1560000000 + + For printing struct clk structures. %pC and %pCn print the name + (Common Clock Framework) or address (legacy clock framework) of the +-structure; %pCr prints the current clock rate. ++structure. + + Passed by reference. + +--- a/lib/vsprintf.c ++++ b/lib/vsprintf.c +@@ -1456,9 +1456,6 @@ char *clock(char *buf, char *end, struct + return string(buf, end, NULL, spec); + + switch (fmt[1]) { +- case 'r': +- return number(buf, end, clk_get_rate(clk), spec); +- + case 'n': + default: + #ifdef CONFIG_COMMON_CLK diff --git a/queue-4.17/m68k-mac-fix-swim-memory-resource-end-address.patch b/queue-4.17/m68k-mac-fix-swim-memory-resource-end-address.patch new file mode 100644 index 00000000000..3c8257c8d45 --- /dev/null +++ b/queue-4.17/m68k-mac-fix-swim-memory-resource-end-address.patch @@ -0,0 +1,35 @@ +From 3e2816c1078eb2b5a3276eb83d4da156b3e2d04f Mon Sep 17 00:00:00 2001 +From: Finn Thain +Date: Wed, 11 Apr 2018 20:50:14 -0400 +Subject: m68k/mac: Fix SWIM memory resource end address + +From: Finn Thain + +commit 3e2816c1078eb2b5a3276eb83d4da156b3e2d04f upstream. + +The resource size is 0x2000 == end - start + 1. +Therefore end == start + 0x2000 - 1. + +Cc: Laurent Vivier +Cc: stable@vger.kernel.org # v4.14+ +Tested-by: Stan Johnson +Signed-off-by: Finn Thain +Acked-by: Laurent Vivier +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Greg Kroah-Hartman + +--- + arch/m68k/mac/config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/m68k/mac/config.c ++++ b/arch/m68k/mac/config.c +@@ -1005,7 +1005,7 @@ int __init mac_platform_init(void) + struct resource swim_rsrc = { + .flags = IORESOURCE_MEM, + .start = (resource_size_t)swim_base, +- .end = (resource_size_t)swim_base + 0x2000, ++ .end = (resource_size_t)swim_base + 0x1FFF, + }; + + platform_device_register_simple("swim", -1, &swim_rsrc, 1); diff --git a/queue-4.17/m68k-mm-adjust-vm-area-to-be-unmapped-by-gap-size-for-__iounmap.patch b/queue-4.17/m68k-mm-adjust-vm-area-to-be-unmapped-by-gap-size-for-__iounmap.patch new file mode 100644 index 00000000000..b1f7a127f0b --- /dev/null +++ b/queue-4.17/m68k-mm-adjust-vm-area-to-be-unmapped-by-gap-size-for-__iounmap.patch @@ -0,0 +1,56 @@ +From 3f90f9ef2dda316d64e420d5d51ba369587ccc55 Mon Sep 17 00:00:00 2001 +From: Michael Schmitz +Date: Mon, 14 May 2018 23:10:53 +1200 +Subject: m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap() + +From: Michael Schmitz + +commit 3f90f9ef2dda316d64e420d5d51ba369587ccc55 upstream. + +If 020/030 support is enabled, get_io_area() leaves an IO_SIZE gap +between mappings which is added to the vm_struct representing the +mapping. __ioremap() uses the actual requested size (after alignment), +while __iounmap() is passed the size from the vm_struct. + +On 020/030, early termination descriptors are used to set up mappings of +extent 'size', which are validated on unmapping. The unmapped gap of +size IO_SIZE defeats the sanity check of the pmd tables, causing +__iounmap() to loop forever on 030. + +On 040/060, unmapping of page table entries does not check for a valid +mapping, so the umapping loop always completes there. + +Adjust size to be unmapped by the gap that had been added in the +vm_struct prior. + +This fixes the hang in atari_platform_init() reported a long time ago, +and a similar one reported by Finn recently (addressed by removing +ioremap() use from the SWIM driver. + +Tested on my Falcon in 030 mode - untested but should work the same on +040/060 (the extra page tables cleared there would never have been set +up anyway). + +Signed-off-by: Michael Schmitz +[geert: Minor commit description improvements] +[geert: This was fixed in 2.4.23, but not in 2.5.x] +Signed-off-by: Geert Uytterhoeven +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + arch/m68k/mm/kmap.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/m68k/mm/kmap.c ++++ b/arch/m68k/mm/kmap.c +@@ -89,7 +89,8 @@ static inline void free_io_area(void *ad + for (p = &iolist ; (tmp = *p) ; p = &tmp->next) { + if (tmp->addr == addr) { + *p = tmp->next; +- __iounmap(tmp->addr, tmp->size); ++ /* remove gap added in get_io_area() */ ++ __iounmap(tmp->addr, tmp->size - IO_SIZE); + kfree(tmp); + return; + } diff --git a/queue-4.17/mips-ftrace-fix-static-function-graph-tracing.patch b/queue-4.17/mips-ftrace-fix-static-function-graph-tracing.patch new file mode 100644 index 00000000000..e74e90cf513 --- /dev/null +++ b/queue-4.17/mips-ftrace-fix-static-function-graph-tracing.patch @@ -0,0 +1,80 @@ +From 6fb8656646f996d1eef42e6d56203c4915cb9e08 Mon Sep 17 00:00:00 2001 +From: Matthias Schiffer +Date: Sat, 24 Mar 2018 17:57:49 +0100 +Subject: mips: ftrace: fix static function graph tracing + +From: Matthias Schiffer + +commit 6fb8656646f996d1eef42e6d56203c4915cb9e08 upstream. + +ftrace_graph_caller was never run after calling ftrace_trace_function, +breaking the function graph tracer. Fix this, bringing it in line with the +x86 implementation. + +While we're at it, also streamline the control flow of _mcount a bit to +reduce the number of branches. + +This issue was reported before: +https://www.linux-mips.org/archives/linux-mips/2014-11/msg00295.html + +Signed-off-by: Matthias Schiffer +Tested-by: Matt Redfearn +Patchwork: https://patchwork.linux-mips.org/patch/18929/ +Signed-off-by: Paul Burton +Cc: stable@vger.kernel.org # v3.17+ +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/kernel/mcount.S | 27 ++++++++++++--------------- + 1 file changed, 12 insertions(+), 15 deletions(-) + +--- a/arch/mips/kernel/mcount.S ++++ b/arch/mips/kernel/mcount.S +@@ -119,10 +119,20 @@ NESTED(_mcount, PT_SIZE, ra) + EXPORT_SYMBOL(_mcount) + PTR_LA t1, ftrace_stub + PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */ +- bne t1, t2, static_trace ++ beq t1, t2, fgraph_trace + nop + ++ MCOUNT_SAVE_REGS ++ ++ move a0, ra /* arg1: self return address */ ++ jalr t2 /* (1) call *ftrace_trace_function */ ++ move a1, AT /* arg2: parent's return address */ ++ ++ MCOUNT_RESTORE_REGS ++ ++fgraph_trace: + #ifdef CONFIG_FUNCTION_GRAPH_TRACER ++ PTR_LA t1, ftrace_stub + PTR_L t3, ftrace_graph_return + bne t1, t3, ftrace_graph_caller + nop +@@ -131,24 +141,11 @@ EXPORT_SYMBOL(_mcount) + bne t1, t3, ftrace_graph_caller + nop + #endif +- b ftrace_stub +-#ifdef CONFIG_32BIT +- addiu sp, sp, 8 +-#else +- nop +-#endif +- +-static_trace: +- MCOUNT_SAVE_REGS +- +- move a0, ra /* arg1: self return address */ +- jalr t2 /* (1) call *ftrace_trace_function */ +- move a1, AT /* arg2: parent's return address */ + +- MCOUNT_RESTORE_REGS + #ifdef CONFIG_32BIT + addiu sp, sp, 8 + #endif ++ + .globl ftrace_stub + ftrace_stub: + RETURN_BACK diff --git a/queue-4.17/mmc-renesas_sdhi-really-fix-wp-logic-regressions.patch b/queue-4.17/mmc-renesas_sdhi-really-fix-wp-logic-regressions.patch new file mode 100644 index 00000000000..80b9bf951e4 --- /dev/null +++ b/queue-4.17/mmc-renesas_sdhi-really-fix-wp-logic-regressions.patch @@ -0,0 +1,99 @@ +From ef5332c10d4f332a2ac79e9ad5452f4e89d1815a Mon Sep 17 00:00:00 2001 +From: Wolfram Sang +Date: Fri, 1 Jun 2018 13:00:37 +0200 +Subject: mmc: renesas_sdhi: really fix WP logic regressions + +From: Wolfram Sang + +commit ef5332c10d4f332a2ac79e9ad5452f4e89d1815a upstream. + +This reverts commit e060d376cc61 ("mmc: renesas_sdhi: fix WP detection") +and adds some code to really fix the regressions. + +It was missed so far that Renesas R-Car instantiations of SDHI chose to +disable internal WP and used the existence of "wp-gpios" to en/disable +WP at all. + +With the first refactoring by Yamada-san with commit 2ad1db059b9a ("mmc: +renesas_sdhi: use MMC_CAP2_NO_WRITE_PROTECT instead of TMIO own flag"), +WP was always disabled even when GPIOs were present. With Wolfram's +first fix which gets now reverted, GPIOs were honored. But when not +available, the fallback was to internal WP and not to disabled WP. This +caused wrong WP status on uSD card slots. + +Restore the old behaviour now. By default, WP is disabled. When a GPIO +is found, the GPIO re-enables WP. We will think about possible better +ways to handle this in the future. + +Tested on a previously regressing Renesas Lager board (H2) and a still +working Renesas Salvator-X board (M3-W). + +Reported-by: Yoshihiro Shimoda +Signed-off-by: Wolfram Sang +Cc: stable@vger.kernel.org # v4.17+ +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/renesas_sdhi_core.c | 5 +++++ + drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + + drivers/mmc/host/renesas_sdhi_sys_dmac.c | 3 +++ + 3 files changed, 9 insertions(+) + +--- a/drivers/mmc/host/renesas_sdhi_core.c ++++ b/drivers/mmc/host/renesas_sdhi_core.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -534,6 +535,10 @@ int renesas_sdhi_probe(struct platform_d + host->multi_io_quirk = renesas_sdhi_multi_io_quirk; + host->dma_ops = dma_ops; + ++ /* For some SoC, we disable internal WP. GPIO may override this */ ++ if (mmc_can_gpio_ro(host->mmc)) ++ mmc_data->capabilities2 &= ~MMC_CAP2_NO_WRITE_PROTECT; ++ + /* SDR speeds are only available on Gen2+ */ + if (mmc_data->flags & TMIO_MMC_MIN_RCAR2) { + /* card_busy caused issues on r8a73a4 (pre-Gen2) CD-less SDHI */ +--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c ++++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c +@@ -87,6 +87,7 @@ static const struct renesas_sdhi_of_data + TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2, + .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | + MMC_CAP_CMD23, ++ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT, + .bus_shift = 2, + .scc_offset = 0x1000, + .taps = rcar_gen3_scc_taps, +--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c ++++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c +@@ -42,6 +42,7 @@ static const struct renesas_sdhi_of_data + static const struct renesas_sdhi_of_data of_rcar_gen1_compatible = { + .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_CLK_ACTUAL, + .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, ++ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT, + }; + + /* Definitions for sampling clocks */ +@@ -61,6 +62,7 @@ static const struct renesas_sdhi_of_data + TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2, + .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | + MMC_CAP_CMD23, ++ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT, + .dma_buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES, + .dma_rx_offset = 0x2000, + .scc_offset = 0x0300, +@@ -81,6 +83,7 @@ static const struct renesas_sdhi_of_data + TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2, + .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | + MMC_CAP_CMD23, ++ .capabilities2 = MMC_CAP2_NO_WRITE_PROTECT, + .bus_shift = 2, + .scc_offset = 0x1000, + .taps = rcar_gen3_scc_taps, diff --git a/queue-4.17/mtd-spi-nor-intel-spi-fix-atomic-sequence-handling.patch b/queue-4.17/mtd-spi-nor-intel-spi-fix-atomic-sequence-handling.patch new file mode 100644 index 00000000000..b3b45965dcf --- /dev/null +++ b/queue-4.17/mtd-spi-nor-intel-spi-fix-atomic-sequence-handling.patch @@ -0,0 +1,205 @@ +From c7d6a82d90e193b1e4daba957e3908f26306d491 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Mon, 5 Feb 2018 14:32:59 +0300 +Subject: mtd: spi-nor: intel-spi: Fix atomic sequence handling + +From: Mika Westerberg + +commit c7d6a82d90e193b1e4daba957e3908f26306d491 upstream. + +On many older systems using SW sequencer the PREOP_OPTYPE register +contains two preopcodes as following: + + PREOP_OPTYPE=0xf2785006 + +The last two bytes are the opcodes decoded to: + + 0x50 - Write enable for volatile status register + 0x06 - Write enable + +The former is used to modify volatile bits in the status register. For +non-volatile bits the latter is needed. Preopcodes are used in SW +sequencer to send one command "atomically" without anything else +interfering the transfer. The sequence that gets executed is: + + - Send preopcode (write enable) from PREOP_OPTYPE register + - Send the actual SPI command + - Poll busy bit in the status register (0x05, RDSR) + +Commit 8c473dd61bb5 ("spi-nor: intel-spi: Don't assume OPMENU0/1 to be +programmed by BIOS") enabled atomic sequence handling but because both +preopcodes are programmed, the following happens: + + if (preop >> 8) + val |= SSFSTS_CTL_SPOP; + +Since on these systems preop >> 8 == 0x50 we end up picking volatile +write enable instead. Because of this the actual write command is pretty +much NOP unless there is a WREN latched in the chip already. + +Furthermore we should not really just assume that WREN was issued in +previous call to intel_spi_write_reg() because that might not be the +case. + +This updates driver to first check that the opcode is actually available +in PREOP_OPTYPE register and if not return error back to the spi-nor +core (if the controller is not locked we program it now). In addition we +save the opcode to ispi->atomic_preopcode field which is checked in next +call to intel_spi_sw_cycle() to actually enable atomic sequence using +the requested preopcode. + +Fixes: 8c473dd61bb5 ("spi-nor: intel-spi: Don't assume OPMENU0/1 to be programmed by BIOS") +Signed-off-by: Mika Westerberg +Cc: stable@vger.kernel.org +Reviewed-by: Marek Vasut +Signed-off-by: Boris Brezillon +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/spi-nor/intel-spi.c | 76 +++++++++++++++++++++++++++++++++++----- + 1 file changed, 67 insertions(+), 9 deletions(-) + +--- a/drivers/mtd/spi-nor/intel-spi.c ++++ b/drivers/mtd/spi-nor/intel-spi.c +@@ -136,6 +136,7 @@ + * @swseq_reg: Use SW sequencer in register reads/writes + * @swseq_erase: Use SW sequencer in erase operation + * @erase_64k: 64k erase supported ++ * @atomic_preopcode: Holds preopcode when atomic sequence is requested + * @opcodes: Opcodes which are supported. This are programmed by BIOS + * before it locks down the controller. + */ +@@ -153,6 +154,7 @@ struct intel_spi { + bool swseq_reg; + bool swseq_erase; + bool erase_64k; ++ u8 atomic_preopcode; + u8 opcodes[8]; + }; + +@@ -474,7 +476,7 @@ static int intel_spi_sw_cycle(struct int + int optype) + { + u32 val = 0, status; +- u16 preop; ++ u8 atomic_preopcode; + int ret; + + ret = intel_spi_opcode_index(ispi, opcode, optype); +@@ -484,17 +486,42 @@ static int intel_spi_sw_cycle(struct int + if (len > INTEL_SPI_FIFO_SZ) + return -EINVAL; + ++ /* ++ * Always clear it after each SW sequencer operation regardless ++ * of whether it is successful or not. ++ */ ++ atomic_preopcode = ispi->atomic_preopcode; ++ ispi->atomic_preopcode = 0; ++ + /* Only mark 'Data Cycle' bit when there is data to be transferred */ + if (len > 0) + val = ((len - 1) << SSFSTS_CTL_DBC_SHIFT) | SSFSTS_CTL_DS; + val |= ret << SSFSTS_CTL_COP_SHIFT; + val |= SSFSTS_CTL_FCERR | SSFSTS_CTL_FDONE; + val |= SSFSTS_CTL_SCGO; +- preop = readw(ispi->sregs + PREOP_OPTYPE); +- if (preop) { +- val |= SSFSTS_CTL_ACS; +- if (preop >> 8) +- val |= SSFSTS_CTL_SPOP; ++ if (atomic_preopcode) { ++ u16 preop; ++ ++ switch (optype) { ++ case OPTYPE_WRITE_NO_ADDR: ++ case OPTYPE_WRITE_WITH_ADDR: ++ /* Pick matching preopcode for the atomic sequence */ ++ preop = readw(ispi->sregs + PREOP_OPTYPE); ++ if ((preop & 0xff) == atomic_preopcode) ++ ; /* Do nothing */ ++ else if ((preop >> 8) == atomic_preopcode) ++ val |= SSFSTS_CTL_SPOP; ++ else ++ return -EINVAL; ++ ++ /* Enable atomic sequence */ ++ val |= SSFSTS_CTL_ACS; ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ + } + writel(val, ispi->sregs + SSFSTS_CTL); + +@@ -538,13 +565,31 @@ static int intel_spi_write_reg(struct sp + + /* + * This is handled with atomic operation and preop code in Intel +- * controller so skip it here now. If the controller is not locked, +- * program the opcode to the PREOP register for later use. ++ * controller so we only verify that it is available. If the ++ * controller is not locked, program the opcode to the PREOP ++ * register for later use. ++ * ++ * When hardware sequencer is used there is no need to program ++ * any opcodes (it handles them automatically as part of a command). + */ + if (opcode == SPINOR_OP_WREN) { +- if (!ispi->locked) ++ u16 preop; ++ ++ if (!ispi->swseq_reg) ++ return 0; ++ ++ preop = readw(ispi->sregs + PREOP_OPTYPE); ++ if ((preop & 0xff) != opcode && (preop >> 8) != opcode) { ++ if (ispi->locked) ++ return -EINVAL; + writel(opcode, ispi->sregs + PREOP_OPTYPE); ++ } + ++ /* ++ * This enables atomic sequence on next SW sycle. Will ++ * be cleared after next operation. ++ */ ++ ispi->atomic_preopcode = opcode; + return 0; + } + +@@ -569,6 +614,13 @@ static ssize_t intel_spi_read(struct spi + u32 val, status; + ssize_t ret; + ++ /* ++ * Atomic sequence is not expected with HW sequencer reads. Make ++ * sure it is cleared regardless. ++ */ ++ if (WARN_ON_ONCE(ispi->atomic_preopcode)) ++ ispi->atomic_preopcode = 0; ++ + switch (nor->read_opcode) { + case SPINOR_OP_READ: + case SPINOR_OP_READ_FAST: +@@ -627,6 +679,9 @@ static ssize_t intel_spi_write(struct sp + u32 val, status; + ssize_t ret; + ++ /* Not needed with HW sequencer write, make sure it is cleared */ ++ ispi->atomic_preopcode = 0; ++ + while (len > 0) { + block_size = min_t(size_t, len, INTEL_SPI_FIFO_SZ); + +@@ -707,6 +762,9 @@ static int intel_spi_erase(struct spi_no + return 0; + } + ++ /* Not needed with HW sequencer erase, make sure it is cleared */ ++ ispi->atomic_preopcode = 0; ++ + while (len > 0) { + writel(offs, ispi->base + FADDR); + diff --git a/queue-4.17/pci-pm-do-not-clear-state_saved-for-devices-that-remain-suspended.patch b/queue-4.17/pci-pm-do-not-clear-state_saved-for-devices-that-remain-suspended.patch new file mode 100644 index 00000000000..4c06162223d --- /dev/null +++ b/queue-4.17/pci-pm-do-not-clear-state_saved-for-devices-that-remain-suspended.patch @@ -0,0 +1,52 @@ +From 656088aa9b513907833ba091d0dcde87571fe05b Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Fri, 18 May 2018 10:17:42 +0200 +Subject: PCI / PM: Do not clear state_saved for devices that remain suspended + +From: Rafael J. Wysocki + +commit 656088aa9b513907833ba091d0dcde87571fe05b upstream. + +The state_saved flag should not be cleared in pci_pm_suspend() if the +given device is going to remain suspended, or the device's config +space will not be restored properly during the subsequent resume. + +Namely, if the device is going to stay in suspend, both the late +and noirq callbacks return early for it, so if its state_saved flag +is cleared in pci_pm_suspend(), it will remain unset throughout the +remaining part of suspend and resume and pci_restore_state() called +for the device going forward will return without doing anything. + +For this reason, change pci_pm_suspend() to only clear state_saved +if the given device is not going to remain suspended. [This is +analogous to what commit ae860a19f37c (PCI / PM: Do not clear +state_saved in pci_pm_freeze() when smart suspend is set) did for +hibernation.] + +Fixes: c4b65157aeef (PCI / PM: Take SMART_SUSPEND driver flag into account) +Cc: 4.15+ # 4.15+ +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Mika Westerberg +Acked-by: Bjorn Helgaas +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/pci-driver.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/pci/pci-driver.c ++++ b/drivers/pci/pci-driver.c +@@ -753,10 +753,11 @@ static int pci_pm_suspend(struct device + * better to resume the device from runtime suspend here. + */ + if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) || +- !pci_dev_keep_suspended(pci_dev)) ++ !pci_dev_keep_suspended(pci_dev)) { + pm_runtime_resume(dev); ++ pci_dev->state_saved = false; ++ } + +- pci_dev->state_saved = false; + if (pm->suspend) { + pci_power_t prev = pci_dev->current_state; + int error; diff --git a/queue-4.17/platform-chrome-cros_ec_lpc-do-not-try-dmi-match-when-acpi-device-found.patch b/queue-4.17/platform-chrome-cros_ec_lpc-do-not-try-dmi-match-when-acpi-device-found.patch new file mode 100644 index 00000000000..e645b82d2bd --- /dev/null +++ b/queue-4.17/platform-chrome-cros_ec_lpc-do-not-try-dmi-match-when-acpi-device-found.patch @@ -0,0 +1,56 @@ +From b410b1226620b6c959f1e9c87529acd058e90caf Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Tue, 22 May 2018 16:08:41 -0700 +Subject: platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device found + +From: Dmitry Torokhov + +commit b410b1226620b6c959f1e9c87529acd058e90caf upstream. + +Older models of Chromebooks did not describe the LPC EC in their ACPI +tables; starting with Strago-based devices Google is using GOOG0004 device +to describe EC LPC. + +DMI-based match is fragile and does not work reliably, especially when +using custom firmware. It is also not needed when we can locate the right +ACPI device, so let's stop bailing out when DMI does not match but the +right ACPI device is present. + +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Benson Leung +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/platform/chrome/cros_ec_lpc.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/platform/chrome/cros_ec_lpc.c ++++ b/drivers/platform/chrome/cros_ec_lpc.c +@@ -435,7 +435,13 @@ static int __init cros_ec_lpc_init(void) + int ret; + acpi_status status; + +- if (!dmi_check_system(cros_ec_lpc_dmi_table)) { ++ status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device, ++ &cros_ec_lpc_acpi_device_found, NULL); ++ if (ACPI_FAILURE(status)) ++ pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME); ++ ++ if (!cros_ec_lpc_acpi_device_found && ++ !dmi_check_system(cros_ec_lpc_dmi_table)) { + pr_err(DRV_NAME ": unsupported system.\n"); + return -ENODEV; + } +@@ -450,11 +456,6 @@ static int __init cros_ec_lpc_init(void) + return ret; + } + +- status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device, +- &cros_ec_lpc_acpi_device_found, NULL); +- if (ACPI_FAILURE(status)) +- pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME); +- + if (!cros_ec_lpc_acpi_device_found) { + /* Register the device, and it'll get hooked up automatically */ + ret = platform_device_register(&cros_ec_lpc_device); diff --git a/queue-4.17/pm-core-fix-supplier-device-runtime-pm-usage-counter-imbalance.patch b/queue-4.17/pm-core-fix-supplier-device-runtime-pm-usage-counter-imbalance.patch new file mode 100644 index 00000000000..bed14541233 --- /dev/null +++ b/queue-4.17/pm-core-fix-supplier-device-runtime-pm-usage-counter-imbalance.patch @@ -0,0 +1,72 @@ +From 47e5abfb546a3ace23a77453dc2e9db92704c5ac Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Thu, 14 Jun 2018 10:01:52 +0200 +Subject: PM / core: Fix supplier device runtime PM usage counter imbalance + +From: Rafael J. Wysocki + +commit 47e5abfb546a3ace23a77453dc2e9db92704c5ac upstream. + +If a device link is added via device_link_add() by the driver of the +link's consumer device, the supplier's runtime PM usage counter is +going to be dropped by the pm_runtime_put_suppliers() call in +driver_probe_device(). However, in that case it is not incremented +unless the supplier driver is already present and the link is not +stateless. That leads to a runtime PM usage counter imbalance for +the supplier device in a few cases. + +To prevent that from happening, bump up the supplier runtime +PM usage counter in device_link_add() for all links with the +DL_FLAG_PM_RUNTIME flag set that are added at the consumer probe +time. Use pm_runtime_get_noresume() for that as the callers of +device_link_add() who want the supplier to be resumed by it are +expected to pass DL_FLAG_RPM_ACTIVE in flags to it anyway, but +additionally resume the supplier if the link is added during +consumer driver probe to retain the existing behavior for the +callers depending on it. + +Fixes: 21d5c57b3726 (PM / runtime: Use device links) +Reported-by: Ulf Hansson +Reviewed-by: Ulf Hansson +Tested-by: Marek Szyprowski +Cc: 4.10+ # 4.10+ +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/core.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -216,6 +216,13 @@ struct device_link *device_link_add(stru + link->rpm_active = true; + } + pm_runtime_new_link(consumer); ++ /* ++ * If the link is being added by the consumer driver at probe ++ * time, balance the decrementation of the supplier's runtime PM ++ * usage counter after consumer probe in driver_probe_device(). ++ */ ++ if (consumer->links.status == DL_DEV_PROBING) ++ pm_runtime_get_noresume(supplier); + } + get_device(supplier); + link->supplier = supplier; +@@ -235,12 +242,12 @@ struct device_link *device_link_add(stru + switch (consumer->links.status) { + case DL_DEV_PROBING: + /* +- * Balance the decrementation of the supplier's +- * runtime PM usage counter after consumer probe +- * in driver_probe_device(). ++ * Some callers expect the link creation during ++ * consumer driver probe to resume the supplier ++ * even without DL_FLAG_RPM_ACTIVE. + */ + if (flags & DL_FLAG_PM_RUNTIME) +- pm_runtime_get_sync(supplier); ++ pm_runtime_resume(supplier); + + link->status = DL_STATE_CONSUMER_PROBE; + break; diff --git a/queue-4.17/pm-domains-fix-error-path-during-attach-in-genpd.patch b/queue-4.17/pm-domains-fix-error-path-during-attach-in-genpd.patch new file mode 100644 index 00000000000..62e89616884 --- /dev/null +++ b/queue-4.17/pm-domains-fix-error-path-during-attach-in-genpd.patch @@ -0,0 +1,45 @@ +From 72038df3c580c4c326b83c86149d7ac34007532a Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Thu, 26 Apr 2018 10:53:00 +0200 +Subject: PM / Domains: Fix error path during attach in genpd + +From: Ulf Hansson + +commit 72038df3c580c4c326b83c86149d7ac34007532a upstream. + +In case the PM domain fails to be powered on in genpd_dev_pm_attach(), it +returns -EPROBE_DEFER, but keeping the device attached to its PM domain. +This leads to problems when the next attempt to attach is re-tried. More +precisely, in that situation an -EEXIST error code is returned, because the +device already has its PM domain pointer assigned, from the first attempt. + +Now, because of the sloppy error handling by the existing callers of +dev_pm_domain_attach(), probing is allowed to continue when -EEXIST is +returned. However, in such case there are no guarantees that the PM domain +is powered on by genpd, which may lead to hangs when buses/drivers tried to +access their devices. + +Let's fix this behaviour, simply by detaching the device when powering on +fails in genpd_dev_pm_attach(). + +Cc: v4.11+ # v4.11+ +Signed-off-by: Ulf Hansson +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/power/domain.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/base/power/domain.c ++++ b/drivers/base/power/domain.c +@@ -2246,6 +2246,9 @@ int genpd_dev_pm_attach(struct device *d + genpd_lock(pd); + ret = genpd_power_on(pd, 0); + genpd_unlock(pd); ++ ++ if (ret) ++ genpd_remove_device(pd, dev); + out: + return ret ? -EPROBE_DEFER : 0; + } diff --git a/queue-4.17/pm-opp-update-voltage-in-case-freq-old_freq.patch b/queue-4.17/pm-opp-update-voltage-in-case-freq-old_freq.patch new file mode 100644 index 00000000000..edd43f672bb --- /dev/null +++ b/queue-4.17/pm-opp-update-voltage-in-case-freq-old_freq.patch @@ -0,0 +1,71 @@ +From c5c2a97b3ac7d1ec19e7cff9e38caca6afefc3de Mon Sep 17 00:00:00 2001 +From: Waldemar Rymarkiewicz +Date: Thu, 14 Jun 2018 15:56:08 +0200 +Subject: PM / OPP: Update voltage in case freq == old_freq + +From: Waldemar Rymarkiewicz + +commit c5c2a97b3ac7d1ec19e7cff9e38caca6afefc3de upstream. + +This commit fixes a rare but possible case when the clk rate is updated +without update of the regulator voltage. + +At boot up, CPUfreq checks if the system is running at the right freq. This +is a sanity check in case a bootloader set clk rate that is outside of freq +table present with cpufreq core. In such cases system can be unstable so +better to change it to a freq that is preset in freq-table. + +The CPUfreq takes next freq that is >= policy->cur and this is our +target_freq that needs to be set now. + +dev_pm_opp_set_rate(dev, target_freq) checks the target_freq and the +old_freq (a current rate). If these are equal it returns early. If not, +it searches for OPP (old_opp) that fits best to old_freq (not listed in +the table) and updates old_freq (!). + +Here, we can end up with old_freq = old_opp.rate = target_freq, which +is not handled in _generic_set_opp_regulator(). It's supposed to update +voltage only when freq > old_freq || freq > old_freq. + +if (freq > old_freq) { + ret = _set_opp_voltage(dev, reg, new_supply); +[...] +if (freq < old_freq) { + ret = _set_opp_voltage(dev, reg, new_supply); + if (ret) + +It results in, no voltage update while clk rate is updated. + +Example: +freq-table = { + 1000MHz 1.15V + 666MHZ 1.10V + 333MHz 1.05V +} +boot-up-freq = 800MHz # not listed in freq-table +freq = target_freq = 1GHz +old_freq = 800Mhz +old_opp = _find_freq_ceil(opp_table, &old_freq); #(old_freq is modified!) +old_freq = 1GHz + +Fixes: 6a0712f6f199 ("PM / OPP: Add dev_pm_opp_set_rate()") +Cc: 4.6+ # v4.6+ +Signed-off-by: Waldemar Rymarkiewicz +Signed-off-by: Viresh Kumar +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/opp/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/opp/core.c ++++ b/drivers/opp/core.c +@@ -591,7 +591,7 @@ static int _generic_set_opp_regulator(co + } + + /* Scaling up? Scale voltage before frequency */ +- if (freq > old_freq) { ++ if (freq >= old_freq) { + ret = _set_opp_voltage(dev, reg, new_supply); + if (ret) + goto restore_voltage; diff --git a/queue-4.17/serial-sh-sci-use-spin_-try-lock_irqsave-instead-of-open-coding-version.patch b/queue-4.17/serial-sh-sci-use-spin_-try-lock_irqsave-instead-of-open-coding-version.patch new file mode 100644 index 00000000000..a651297f0bd --- /dev/null +++ b/queue-4.17/serial-sh-sci-use-spin_-try-lock_irqsave-instead-of-open-coding-version.patch @@ -0,0 +1,104 @@ +From 8afb1d2c12163f77777f84616a8e9444d0050ebe Mon Sep 17 00:00:00 2001 +From: Daniel Wagner +Date: Tue, 8 May 2018 10:55:09 +0200 +Subject: serial: sh-sci: Use spin_{try}lock_irqsave instead of open coding version + +From: Daniel Wagner + +commit 8afb1d2c12163f77777f84616a8e9444d0050ebe upstream. + +Commit 40f70c03e33a ("serial: sh-sci: add locking to console write +function to avoid SMP lockup") copied the strategy to avoid locking +problems in conjuncture with the console from the UART8250 +driver. Instead using directly spin_{try}lock_irqsave(), +local_irq_save() followed by spin_{try}lock() was used. While this is +correct on mainline, for -rt it is a problem. spin_{try}lock() will +check if it is running in a valid context. Since the local_irq_save() +has already been executed, the context has changed and +spin_{try}lock() will complain. The reason why spin_{try}lock() +complains is that on -rt the spin locks are turned into mutexes and +therefore can sleep. Sleeping with interrupts disabled is not valid. + +BUG: sleeping function called from invalid context at /home/wagi/work/rt/v4.4-cip-rt/kernel/locking/rtmutex.c:995 +in_atomic(): 0, irqs_disabled(): 128, pid: 778, name: irq/76-eth0 +CPU: 0 PID: 778 Comm: irq/76-eth0 Not tainted 4.4.126-test-cip22-rt14-00403-gcd03665c8318 #12 +Hardware name: Generic RZ/G1 (Flattened Device Tree) +Backtrace: +[] (dump_backtrace) from [] (show_stack+0x18/0x1c) + r7:c06b01f0 r6:60010193 r5:00000000 r4:c06b01f0 +[] (show_stack) from [] (dump_stack+0x78/0x94) +[] (dump_stack) from [] (___might_sleep+0x134/0x194) + r7:60010113 r6:c06d3559 r5:00000000 r4:ffffe000 +[] (___might_sleep) from [] (rt_spin_lock+0x20/0x74) + r5:c06f4d60 r4:c06f4d60 +[] (rt_spin_lock) from [] (serial_console_write+0x100/0x118) + r5:c06f4d60 r4:c06f4d60 +[] (serial_console_write) from [] (call_console_drivers.constprop.15+0x10c/0x124) + r10:c06d2894 r9:c04e18b0 r8:00000028 r7:00000000 r6:c06d3559 r5:c06d2798 + r4:c06b9914 r3:c02576e4 +[] (call_console_drivers.constprop.15) from [] (console_unlock+0x32c/0x430) + r10:c06d30d8 r9:00000028 r8:c06dd518 r7:00000005 r6:00000000 r5:c06d2798 + r4:c06d2798 r3:00000028 +[] (console_unlock) from [] (vprintk_emit+0x394/0x4f0) + r10:c06d2798 r9:c06d30ee r8:00000006 r7:00000005 r6:c06a78fc r5:00000027 + r4:00000003 +[] (vprintk_emit) from [] (vprintk+0x28/0x30) + r10:c060bd46 r9:00001000 r8:c06b9a90 r7:c06b9a90 r6:c06b994c r5:c06b9a3c + r4:c0062fa8 +[] (vprintk) from [] (vprintk_default+0x10/0x14) +[] (vprintk_default) from [] (printk+0x78/0x84) +[] (printk) from [] (credit_entropy_bits+0x17c/0x2cc) + r3:00000001 r2:decade60 r1:c061a5ee r0:c061a523 + r4:00000006 +[] (credit_entropy_bits) from [] (add_interrupt_randomness+0x160/0x178) + r10:466e7196 r9:1f536000 r8:fffeef74 r7:00000000 r6:c06b9a60 r5:c06b9a3c + r4:dfbcf680 +[] (add_interrupt_randomness) from [] (irq_thread+0x1e8/0x248) + r10:c006537c r9:c06cdf21 r8:c0064fcc r7:df791c24 r6:df791c00 r5:ffffe000 + r4:df525180 +[] (irq_thread) from [] (kthread+0x108/0x11c) + r10:00000000 r9:00000000 r8:c0065184 r7:df791c00 r6:00000000 r5:df791d00 + r4:decac000 +[] (kthread) from [] (ret_from_fork+0x14/0x3c) + r8:00000000 r7:00000000 r6:00000000 r5:c003fa9c r4:df791d00 + +Cc: Sebastian Andrzej Siewior +Signed-off-by: Daniel Wagner +Reviewed-by: Geert Uytterhoeven +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/sh-sci.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/drivers/tty/serial/sh-sci.c ++++ b/drivers/tty/serial/sh-sci.c +@@ -2890,16 +2890,15 @@ static void serial_console_write(struct + unsigned long flags; + int locked = 1; + +- local_irq_save(flags); + #if defined(SUPPORT_SYSRQ) + if (port->sysrq) + locked = 0; + else + #endif + if (oops_in_progress) +- locked = spin_trylock(&port->lock); ++ locked = spin_trylock_irqsave(&port->lock, flags); + else +- spin_lock(&port->lock); ++ spin_lock_irqsave(&port->lock, flags); + + /* first save SCSCR then disable interrupts, keep clock source */ + ctrl = serial_port_in(port, SCSCR); +@@ -2919,8 +2918,7 @@ static void serial_console_write(struct + serial_port_out(port, SCSCR, ctrl); + + if (locked) +- spin_unlock(&port->lock); +- local_irq_restore(flags); ++ spin_unlock_irqrestore(&port->lock, flags); + } + + static int serial_console_setup(struct console *co, char *options) diff --git a/queue-4.17/series b/queue-4.17/series index 0593302dd5b..b97cec90436 100644 --- a/queue-4.17/series +++ b/queue-4.17/series @@ -8,3 +8,28 @@ x86-mce-check-for-alternate-indication-of-machine-check-recovery-on-skylake.patc x86-mce-fix-incorrect-machine-check-from-unknown-source-message.patch x86-mce-do-not-overwrite-mci_status-in-mce_no_way_out.patch x86-call-fixup_exception-before-notify_die-in-math_error.patch +m68k-mm-adjust-vm-area-to-be-unmapped-by-gap-size-for-__iounmap.patch +m68k-mac-fix-swim-memory-resource-end-address.patch +platform-chrome-cros_ec_lpc-do-not-try-dmi-match-when-acpi-device-found.patch +hwmon-k10temp-add-support-for-stoney-ridge-and-bristol-ridge-cpus.patch +mtd-spi-nor-intel-spi-fix-atomic-sequence-handling.patch +serial-sh-sci-use-spin_-try-lock_irqsave-instead-of-open-coding-version.patch +signal-xtensa-consistenly-use-sigbus-in-do_unaligned_user.patch +pm-domains-fix-error-path-during-attach-in-genpd.patch +pci-pm-do-not-clear-state_saved-for-devices-that-remain-suspended.patch +acpi-lpss-avoid-pm-quirks-on-suspend-and-resume-from-s3.patch +pm-core-fix-supplier-device-runtime-pm-usage-counter-imbalance.patch +pm-opp-update-voltage-in-case-freq-old_freq.patch +mmc-renesas_sdhi-really-fix-wp-logic-regressions.patch +usb-do-not-reset-if-a-low-speed-or-full-speed-device-timed-out.patch +1wire-family-module-autoload-fails-because-of-upper-lower-case-mismatch.patch +asoc-dapm-delete-dapm_kcontrol_data-paths-list-before-freeing-it.patch +asoc-cs35l35-add-use_single_rw-to-regmap-config.patch +asoc-mediatek-preallocate-pages-use-platform-device.patch +asoc-cirrus-i2s-fix-lrclk-configuration.patch +asoc-cirrus-i2s-fix-tx-rx-linctrldata-setup.patch +thermal-bcm2835-stop-using-printk-format-pcr.patch +clk-renesas-cpg-mssr-stop-using-printk-format-pcr.patch +lib-vsprintf-remove-atomic-unsafe-support-for-pcr.patch +ftrace-selftest-have-the-reset_trigger-code-be-a-bit-more-careful.patch +mips-ftrace-fix-static-function-graph-tracing.patch diff --git a/queue-4.17/signal-xtensa-consistenly-use-sigbus-in-do_unaligned_user.patch b/queue-4.17/signal-xtensa-consistenly-use-sigbus-in-do_unaligned_user.patch new file mode 100644 index 00000000000..2e8bacbfc8d --- /dev/null +++ b/queue-4.17/signal-xtensa-consistenly-use-sigbus-in-do_unaligned_user.patch @@ -0,0 +1,39 @@ +From 7de712ccc096b81d23cc0a941cd9b8cb3956605d Mon Sep 17 00:00:00 2001 +From: "Eric W. Biederman" +Date: Fri, 20 Apr 2018 09:14:56 -0500 +Subject: signal/xtensa: Consistenly use SIGBUS in do_unaligned_user + +From: Eric W. Biederman + +commit 7de712ccc096b81d23cc0a941cd9b8cb3956605d upstream. + +While working on changing this code to use force_sig_fault I +discovered that do_unaliged_user is sets si_signo to SIGBUS and passes +SIGSEGV to force_sig_info. Which is just b0rked. + +The code is reporting a SIGBUS error so replace the SIGSEGV with SIGBUS. + +Cc: Chris Zankel +Cc: Max Filippov +Cc: linux-xtensa@linux-xtensa.org +Cc: stable@vger.kernel.org +Acked-by: Max Filippov +Fixes: 5a0015d62668 ("[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 3") +Signed-off-by: "Eric W. Biederman" +Signed-off-by: Greg Kroah-Hartman + +--- + arch/xtensa/kernel/traps.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/xtensa/kernel/traps.c ++++ b/arch/xtensa/kernel/traps.c +@@ -338,7 +338,7 @@ do_unaligned_user (struct pt_regs *regs) + info.si_errno = 0; + info.si_code = BUS_ADRALN; + info.si_addr = (void *) regs->excvaddr; +- force_sig_info(SIGSEGV, &info, current); ++ force_sig_info(SIGBUS, &info, current); + + } + #endif diff --git a/queue-4.17/thermal-bcm2835-stop-using-printk-format-pcr.patch b/queue-4.17/thermal-bcm2835-stop-using-printk-format-pcr.patch new file mode 100644 index 00000000000..d226b991fda --- /dev/null +++ b/queue-4.17/thermal-bcm2835-stop-using-printk-format-pcr.patch @@ -0,0 +1,60 @@ +From bd2a07f71a1e2e198f8a30cb551d9defe422d83d Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Fri, 1 Jun 2018 11:28:20 +0200 +Subject: thermal: bcm2835: Stop using printk format %pCr + +From: Geert Uytterhoeven + +commit bd2a07f71a1e2e198f8a30cb551d9defe422d83d upstream. + +Printk format "%pCr" will be removed soon, as clk_get_rate() must not be +called in atomic context. + +Replace it by printing the variable that already holds the clock rate. +Note that calling clk_get_rate() is safe here, as the code runs in task +context. + +Link: http://lkml.kernel.org/r/1527845302-12159-3-git-send-email-geert+renesas@glider.be +To: Jia-Ju Bai +To: Jonathan Corbet +To: Michael Turquette +To: Stephen Boyd +To: Zhang Rui +To: Eduardo Valentin +To: Eric Anholt +To: Stefan Wahren +To: Greg Kroah-Hartman +Cc: Sergey Senozhatsky +Cc: Petr Mladek +Cc: Linus Torvalds +Cc: Steven Rostedt +Cc: linux-doc@vger.kernel.org +Cc: linux-clk@vger.kernel.org +Cc: linux-pm@vger.kernel.org +Cc: linux-serial@vger.kernel.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-renesas-soc@vger.kernel.org +Cc: linux-kernel@vger.kernel.org +Cc: stable@vger.kernel.org # 4.12+ +Signed-off-by: Geert Uytterhoeven +Acked-by: Stefan Wahren +Signed-off-by: Petr Mladek +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/thermal/broadcom/bcm2835_thermal.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/thermal/broadcom/bcm2835_thermal.c ++++ b/drivers/thermal/broadcom/bcm2835_thermal.c +@@ -213,8 +213,8 @@ static int bcm2835_thermal_probe(struct + rate = clk_get_rate(data->clk); + if ((rate < 1920000) || (rate > 5000000)) + dev_warn(&pdev->dev, +- "Clock %pCn running at %pCr Hz is outside of the recommended range: 1.92 to 5MHz\n", +- data->clk, data->clk); ++ "Clock %pCn running at %lu Hz is outside of the recommended range: 1.92 to 5MHz\n", ++ data->clk, rate); + + /* register of thermal sensor and get info from DT */ + tz = thermal_zone_of_sensor_register(&pdev->dev, 0, data, diff --git a/queue-4.17/usb-do-not-reset-if-a-low-speed-or-full-speed-device-timed-out.patch b/queue-4.17/usb-do-not-reset-if-a-low-speed-or-full-speed-device-timed-out.patch new file mode 100644 index 00000000000..95cefed7f76 --- /dev/null +++ b/queue-4.17/usb-do-not-reset-if-a-low-speed-or-full-speed-device-timed-out.patch @@ -0,0 +1,37 @@ +From 6e01827ed93947895680fbdad68c072a0f4e2450 Mon Sep 17 00:00:00 2001 +From: Maxim Moseychuk +Date: Thu, 4 Jan 2018 21:43:03 +0300 +Subject: usb: do not reset if a low-speed or full-speed device timed out + +From: Maxim Moseychuk + +commit 6e01827ed93947895680fbdad68c072a0f4e2450 upstream. + +Some low-speed and full-speed devices (for example, bluetooth) +do not have time to initialize. For them, ETIMEDOUT is a valid error. +We need to give them another try. Otherwise, they will +never be initialized correctly and in dmesg will be messages +"Bluetooth: hci0 command 0x1002 tx timeout" or similars. + +Fixes: 264904ccc33c ("usb: retry reset if a device times out") +Cc: stable +Signed-off-by: Maxim Moseychuk +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/hub.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -4551,7 +4551,9 @@ hub_port_init(struct usb_hub *hub, struc + * reset. But only on the first attempt, + * lest we get into a time out/reset loop + */ +- if (r == 0 || (r == -ETIMEDOUT && retries == 0)) ++ if (r == 0 || (r == -ETIMEDOUT && ++ retries == 0 && ++ udev->speed > USB_SPEED_FULL)) + break; + } + udev->descriptor.bMaxPacketSize0 =