From 622d5fee231901cb055ef09592d2bf47e9334ba1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 6 Mar 2018 10:50:25 -0800 Subject: [PATCH] 4.9-stable patches added patches: alsa-hda-add-a-power_save-blacklist.patch alsa-hda-fix-pincfg-at-resume-on-lenovo-t470-dock.patch alsa-usb-audio-add-a-quirck-for-b-w-px-headphones.patch cpufreq-s3c24xx-fix-broken-s3c_cpufreq_init.patch dax-fix-vma_is_fsdax-helper.patch parisc-fix-ordering-of-cache-and-tlb-flushes.patch timers-forward-timer-base-before-migrating-timers.patch x86-platform-intel-mid-handle-intel-edison-reboot-correctly.patch x86-xen-zero-msr_ia32_spec_ctrl-before-suspend.patch --- .../alsa-hda-add-a-power_save-blacklist.patch | 110 +++++++++ ...pincfg-at-resume-on-lenovo-t470-dock.patch | 48 ++++ ...o-add-a-quirck-for-b-w-px-headphones.patch | 75 ++++++ ...tching-for-qca-reset_resume-quirking.patch | 121 ---------- ...-s3c24xx-fix-broken-s3c_cpufreq_init.patch | 47 ++++ queue-4.9/dax-fix-vma_is_fsdax-helper.patch | 37 +++ ...ix-ordering-of-cache-and-tlb-flushes.patch | 214 ++++++++++++++++++ queue-4.9/series | 10 +- ...d-timer-base-before-migrating-timers.patch | 84 +++++++ ...handle-intel-edison-reboot-correctly.patch | 45 ++++ ...ro-msr_ia32_spec_ctrl-before-suspend.patch | 78 +++++++ 11 files changed, 747 insertions(+), 122 deletions(-) create mode 100644 queue-4.9/alsa-hda-add-a-power_save-blacklist.patch create mode 100644 queue-4.9/alsa-hda-fix-pincfg-at-resume-on-lenovo-t470-dock.patch create mode 100644 queue-4.9/alsa-usb-audio-add-a-quirck-for-b-w-px-headphones.patch delete mode 100644 queue-4.9/bluetooth-btusb-use-dmi-matching-for-qca-reset_resume-quirking.patch create mode 100644 queue-4.9/cpufreq-s3c24xx-fix-broken-s3c_cpufreq_init.patch create mode 100644 queue-4.9/dax-fix-vma_is_fsdax-helper.patch create mode 100644 queue-4.9/parisc-fix-ordering-of-cache-and-tlb-flushes.patch create mode 100644 queue-4.9/timers-forward-timer-base-before-migrating-timers.patch create mode 100644 queue-4.9/x86-platform-intel-mid-handle-intel-edison-reboot-correctly.patch create mode 100644 queue-4.9/x86-xen-zero-msr_ia32_spec_ctrl-before-suspend.patch diff --git a/queue-4.9/alsa-hda-add-a-power_save-blacklist.patch b/queue-4.9/alsa-hda-add-a-power_save-blacklist.patch new file mode 100644 index 00000000000..d405ab7c138 --- /dev/null +++ b/queue-4.9/alsa-hda-add-a-power_save-blacklist.patch @@ -0,0 +1,110 @@ +From 1ba8f9d308174e647b864c36209b4d7934d99888 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 22 Feb 2018 14:20:35 +0100 +Subject: ALSA: hda: Add a power_save blacklist + +From: Hans de Goede + +commit 1ba8f9d308174e647b864c36209b4d7934d99888 upstream. + +On some boards setting power_save to a non 0 value leads to clicking / +popping sounds when ever we enter/leave powersaving mode. Ideally we would +figure out how to avoid these sounds, but that is not always feasible. + +This commit adds a blacklist for devices where powersaving is known to +cause problems and disables it on these devices. + +Note I tried to put this blacklist in userspace first: +https://github.com/systemd/systemd/pull/8128 + +But the systemd maintainers rightfully pointed out that it would be +impossible to then later remove entries once we actually find a way to +make power-saving work on listed boards without issues. Having this list +in the kernel will allow removal of the blacklist entry in the same commit +which fixes the clicks / plops. + +The blacklist only applies to the default power_save module-option value, +if a user explicitly sets the module-option then the blacklist is not +used. + +[ added an ifdef CONFIG_PM for the build error -- tiwai] + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104 +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=198611 +Cc: stable@vger.kernel.org +Signed-off-by: Hans de Goede +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_intel.c | 38 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 36 insertions(+), 2 deletions(-) + +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -180,7 +180,7 @@ static const struct kernel_param_ops par + }; + #define param_check_xint param_check_int + +-static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; ++static int power_save = -1; + module_param(power_save, xint, 0644); + MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " + "(in second, 0 = disable)."); +@@ -2042,6 +2042,24 @@ out_free: + return err; + } + ++#ifdef CONFIG_PM ++/* On some boards setting power_save to a non 0 value leads to clicking / ++ * popping sounds when ever we enter/leave powersaving mode. Ideally we would ++ * figure out how to avoid these sounds, but that is not always feasible. ++ * So we keep a list of devices where we disable powersaving as its known ++ * to causes problems on these devices. ++ */ ++static struct snd_pci_quirk power_save_blacklist[] = { ++ /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ ++ SND_PCI_QUIRK(0x1849, 0x0c0c, "Asrock B85M-ITX", 0), ++ /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ ++ SND_PCI_QUIRK(0x1043, 0x8733, "Asus Prime X370-Pro", 0), ++ /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */ ++ SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0), ++ {} ++}; ++#endif /* CONFIG_PM */ ++ + /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ + static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { + [AZX_DRIVER_NVIDIA] = 8, +@@ -2054,6 +2072,7 @@ static int azx_probe_continue(struct azx + struct hdac_bus *bus = azx_bus(chip); + struct pci_dev *pci = chip->pci; + int dev = chip->dev_index; ++ int val; + int err; + + hda->probe_continued = 1; +@@ -2129,7 +2148,22 @@ static int azx_probe_continue(struct azx + + chip->running = 1; + azx_add_card_list(chip); +- snd_hda_set_power_save(&chip->bus, power_save * 1000); ++ ++ val = power_save; ++#ifdef CONFIG_PM ++ if (val == -1) { ++ const struct snd_pci_quirk *q; ++ ++ val = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; ++ q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist); ++ if (q && val) { ++ dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n", ++ q->subvendor, q->subdevice); ++ val = 0; ++ } ++ } ++#endif /* CONFIG_PM */ ++ snd_hda_set_power_save(&chip->bus, val * 1000); + if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo) + pm_runtime_put_autosuspend(&pci->dev); + diff --git a/queue-4.9/alsa-hda-fix-pincfg-at-resume-on-lenovo-t470-dock.patch b/queue-4.9/alsa-hda-fix-pincfg-at-resume-on-lenovo-t470-dock.patch new file mode 100644 index 00000000000..1c6f427fbf7 --- /dev/null +++ b/queue-4.9/alsa-hda-fix-pincfg-at-resume-on-lenovo-t470-dock.patch @@ -0,0 +1,48 @@ +From 71db96ddfa72671bd43cacdcc99ca178d90ba267 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 26 Feb 2018 15:36:38 +0100 +Subject: ALSA: hda - Fix pincfg at resume on Lenovo T470 dock + +From: Takashi Iwai + +commit 71db96ddfa72671bd43cacdcc99ca178d90ba267 upstream. + +We've added a quirk to enable the recent Lenovo dock support, where it +overwrites the pin configs of NID 0x17 and 19, not only updating the +pin config cache. It works right after the boot, but the problem is +that the pin configs are occasionally cleared when the machine goes to +PM. Meanwhile the quirk writes the pin configs only at the pre-probe, +so this won't be applied any longer. + +For addressing that issue, this patch moves the code to overwrite the +pin configs into HDA_FIXUP_ACT_INIT section so that it's always +applied at both probe and resume time. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195161 +Fixes: 61fcf8ece9b6 ("ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform") +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -4480,13 +4480,14 @@ static void alc_fixup_tpt470_dock(struct + + if (action == HDA_FIXUP_ACT_PRE_PROBE) { + spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; ++ snd_hda_apply_pincfgs(codec, pincfgs); ++ } else if (action == HDA_FIXUP_ACT_INIT) { + /* Enable DOCK device */ + snd_hda_codec_write(codec, 0x17, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0); + /* Enable DOCK device */ + snd_hda_codec_write(codec, 0x19, 0, + AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0); +- snd_hda_apply_pincfgs(codec, pincfgs); + } + } + diff --git a/queue-4.9/alsa-usb-audio-add-a-quirck-for-b-w-px-headphones.patch b/queue-4.9/alsa-usb-audio-add-a-quirck-for-b-w-px-headphones.patch new file mode 100644 index 00000000000..0f7e424d9f4 --- /dev/null +++ b/queue-4.9/alsa-usb-audio-add-a-quirck-for-b-w-px-headphones.patch @@ -0,0 +1,75 @@ +From 240a8af929c7c57dcde28682725b29cf8474e8e5 Mon Sep 17 00:00:00 2001 +From: Erik Veijola +Date: Fri, 23 Feb 2018 14:06:52 +0200 +Subject: ALSA: usb-audio: Add a quirck for B&W PX headphones + +From: Erik Veijola + +commit 240a8af929c7c57dcde28682725b29cf8474e8e5 upstream. + +The capture interface doesn't work and the playback interface only +supports 48 kHz sampling rate even though it advertises more rates. + +Signed-off-by: Erik Veijola +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/quirks-table.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 47 insertions(+) + +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -3277,4 +3277,51 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge + } + }, + ++{ ++ /* ++ * Bower's & Wilkins PX headphones only support the 48 kHz sample rate ++ * even though it advertises more. The capture interface doesn't work ++ * even on windows. ++ */ ++ USB_DEVICE(0x19b5, 0x0021), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = (const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 0, ++ .type = QUIRK_AUDIO_STANDARD_MIXER, ++ }, ++ /* Capture */ ++ { ++ .ifnum = 1, ++ .type = QUIRK_IGNORE_INTERFACE, ++ }, ++ /* Playback */ ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 2, ++ .iface = 2, ++ .altsetting = 1, ++ .altset_idx = 1, ++ .attributes = UAC_EP_CS_ATTR_FILL_MAX | ++ UAC_EP_CS_ATTR_SAMPLE_RATE, ++ .endpoint = 0x03, ++ .ep_attr = USB_ENDPOINT_XFER_ISOC, ++ .rates = SNDRV_PCM_RATE_48000, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { ++ 48000 ++ } ++ } ++ }, ++ } ++ } ++}, ++ + #undef USB_DEVICE_VENDOR_SPEC diff --git a/queue-4.9/bluetooth-btusb-use-dmi-matching-for-qca-reset_resume-quirking.patch b/queue-4.9/bluetooth-btusb-use-dmi-matching-for-qca-reset_resume-quirking.patch deleted file mode 100644 index 7937398b500..00000000000 --- a/queue-4.9/bluetooth-btusb-use-dmi-matching-for-qca-reset_resume-quirking.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 1fdb926974695d3dbc05a429bafa266fdd16510e Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Tue, 20 Feb 2018 09:06:18 +0100 -Subject: Bluetooth: btusb: Use DMI matching for QCA reset_resume quirking - -From: Hans de Goede - -commit 1fdb926974695d3dbc05a429bafa266fdd16510e upstream. - -Commit 61f5acea8737 ("Bluetooth: btusb: Restore QCA Rome suspend/resume fix -with a "rewritten" version") applied the USB_QUIRK_RESET_RESUME to all QCA -USB Bluetooth modules. But it turns out that the resume problems are not -caused by the QCA Rome chipset, on most platforms it resumes fine. The -resume problems are actually a platform problem (likely the platform -cutting all power when suspended). - -The USB_QUIRK_RESET_RESUME quirk also disables runtime suspend, so by -matching on usb-ids, we're causing all boards with these chips to use extra -power, to fix resume problems which only happen on some boards. - -This commit fixes this by applying the quirk based on DMI matching instead -of on usb-ids, so that we match the platform and not the chipset. - -Here is the /sys/kernel/debug/usb/devices for the Bluetooth module: - -T: Bus=01 Lev=01 Prnt=01 Port=07 Cnt=04 Dev#= 5 Spd=12 MxCh= 0 -D: Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 -P: Vendor=0cf3 ProdID=e300 Rev= 0.01 -C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA -I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms -E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms -E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms -I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms -E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms -I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms -E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms -I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms -E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms -I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms -E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms -I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms -E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms -I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb -E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms -E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms - -BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836 -Fixes: 61f5acea8737 ("Bluetooth: btusb: Restore QCA Rome suspend/resume..") -Cc: stable@vger.kernel.org -Cc: Brian Norris -Cc: Kai-Heng Feng -Reported-and-tested-by: Kevin Fenzi -Signed-off-by: Hans de Goede -Signed-off-by: Marcel Holtmann -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/bluetooth/btusb.c | 25 +++++++++++++++++++------ - 1 file changed, 19 insertions(+), 6 deletions(-) - ---- a/drivers/bluetooth/btusb.c -+++ b/drivers/bluetooth/btusb.c -@@ -21,6 +21,7 @@ - * - */ - -+#include - #include - #include - #include -@@ -358,6 +359,21 @@ static const struct usb_device_id blackl - { } /* Terminating entry */ - }; - -+/* The Bluetooth USB module build into some devices needs to be reset on resume, -+ * this is a problem with the platform (likely shutting off all power) not with -+ * the module itself. So we use a DMI list to match known broken platforms. -+ */ -+static const struct dmi_system_id btusb_needs_reset_resume_table[] = { -+ { -+ /* Lenovo Yoga 920 (QCA Rome device 0cf3:e300) */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), -+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 920"), -+ }, -+ }, -+ {} -+}; -+ - #define BTUSB_MAX_ISOC_FRAMES 10 - - #define BTUSB_INTR_RUNNING 0 -@@ -2926,12 +2942,6 @@ static int btusb_probe(struct usb_interf - if (id->driver_info & BTUSB_QCA_ROME) { - data->setup_on_usb = btusb_setup_qca; - hdev->set_bdaddr = btusb_set_bdaddr_ath3012; -- -- /* QCA Rome devices lose their updated firmware over suspend, -- * but the USB hub doesn't notice any status change. -- * explicitly request a device reset on resume. -- */ -- interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME; - } - - #ifdef CONFIG_BT_HCIBTUSB_RTL -@@ -3074,6 +3084,9 @@ static void btusb_disconnect(struct usb_ - hci_free_dev(hdev); - } - -+ if (dmi_check_system(btusb_needs_reset_resume_table)) -+ interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME; -+ - #ifdef CONFIG_PM - static int btusb_suspend(struct usb_interface *intf, pm_message_t message) - { diff --git a/queue-4.9/cpufreq-s3c24xx-fix-broken-s3c_cpufreq_init.patch b/queue-4.9/cpufreq-s3c24xx-fix-broken-s3c_cpufreq_init.patch new file mode 100644 index 00000000000..e27250825ec --- /dev/null +++ b/queue-4.9/cpufreq-s3c24xx-fix-broken-s3c_cpufreq_init.patch @@ -0,0 +1,47 @@ +From 0373ca74831b0f93cd4cdbf7ad3aec3c33a479a5 Mon Sep 17 00:00:00 2001 +From: Viresh Kumar +Date: Fri, 23 Feb 2018 09:38:28 +0530 +Subject: cpufreq: s3c24xx: Fix broken s3c_cpufreq_init() + +From: Viresh Kumar + +commit 0373ca74831b0f93cd4cdbf7ad3aec3c33a479a5 upstream. + +commit a307a1e6bc0d "cpufreq: s3c: use cpufreq_generic_init()" +accidentally broke cpufreq on s3c2410 and s3c2412. + +These two platforms don't have a CPU frequency table and used to skip +calling cpufreq_table_validate_and_show() for them. But with the +above commit, we started calling it unconditionally and that will +eventually fail as the frequency table pointer is NULL. + +Fix this by calling cpufreq_table_validate_and_show() conditionally +again. + +Fixes: a307a1e6bc0d "cpufreq: s3c: use cpufreq_generic_init()" +Cc: 3.13+ # v3.13+ +Signed-off-by: Viresh Kumar +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/s3c24xx-cpufreq.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/cpufreq/s3c24xx-cpufreq.c ++++ b/drivers/cpufreq/s3c24xx-cpufreq.c +@@ -351,7 +351,13 @@ struct clk *s3c_cpufreq_clk_get(struct d + static int s3c_cpufreq_init(struct cpufreq_policy *policy) + { + policy->clk = clk_arm; +- return cpufreq_generic_init(policy, ftab, cpu_cur.info->latency); ++ ++ policy->cpuinfo.transition_latency = cpu_cur.info->latency; ++ ++ if (ftab) ++ return cpufreq_table_validate_and_show(policy, ftab); ++ ++ return 0; + } + + static int __init s3c_cpufreq_initclks(void) diff --git a/queue-4.9/dax-fix-vma_is_fsdax-helper.patch b/queue-4.9/dax-fix-vma_is_fsdax-helper.patch new file mode 100644 index 00000000000..f630c3b1011 --- /dev/null +++ b/queue-4.9/dax-fix-vma_is_fsdax-helper.patch @@ -0,0 +1,37 @@ +From 230f5a8969d8345fc9bbe3683f068246cf1be4b8 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Wed, 21 Feb 2018 17:08:01 -0800 +Subject: dax: fix vma_is_fsdax() helper + +From: Dan Williams + +commit 230f5a8969d8345fc9bbe3683f068246cf1be4b8 upstream. + +Gerd reports that ->i_mode may contain other bits besides S_IFCHR. Use +S_ISCHR() instead. Otherwise, get_user_pages_longterm() may fail on +device-dax instances when those are meant to be explicitly allowed. + +Fixes: 2bb6d2837083 ("mm: introduce get_user_pages_longterm") +Cc: +Reported-by: Gerd Rausch +Acked-by: Jane Chu +Reported-by: Haozhong Zhang +Reviewed-by: Jan Kara +Signed-off-by: Dan Williams +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/fs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -3048,7 +3048,7 @@ static inline bool vma_is_fsdax(struct v + if (!vma_is_dax(vma)) + return false; + inode = file_inode(vma->vm_file); +- if (inode->i_mode == S_IFCHR) ++ if (S_ISCHR(inode->i_mode)) + return false; /* device-dax */ + return true; + } diff --git a/queue-4.9/parisc-fix-ordering-of-cache-and-tlb-flushes.patch b/queue-4.9/parisc-fix-ordering-of-cache-and-tlb-flushes.patch new file mode 100644 index 00000000000..5297c3acef8 --- /dev/null +++ b/queue-4.9/parisc-fix-ordering-of-cache-and-tlb-flushes.patch @@ -0,0 +1,214 @@ +From 0adb24e03a124b79130c9499731936b11ce2677d Mon Sep 17 00:00:00 2001 +From: John David Anglin +Date: Tue, 27 Feb 2018 08:16:07 -0500 +Subject: parisc: Fix ordering of cache and TLB flushes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: John David Anglin + +commit 0adb24e03a124b79130c9499731936b11ce2677d upstream. + +The change to flush_kernel_vmap_range() wasn't sufficient to avoid the +SMP stalls.  The problem is some drivers call these routines with +interrupts disabled.  Interrupts need to be enabled for flush_tlb_all() +and flush_cache_all() to work.  This version adds checks to ensure +interrupts are not disabled before calling routines that need IPI +interrupts.  When interrupts are disabled, we now drop into slower code. + +The attached change fixes the ordering of cache and TLB flushes in +several cases.  When we flush the cache using the existing PTE/TLB +entries, we need to flush the TLB after doing the cache flush.  We don't +need to do this when we flush the entire instruction and data caches as +these flushes don't use the existing TLB entries.  The same is true for +tmpalias region flushes. + +The flush_kernel_vmap_range() and invalidate_kernel_vmap_range() +routines have been updated. + +Secondly, we added a new purge_kernel_dcache_range_asm() routine to +pacache.S and use it in invalidate_kernel_vmap_range().  Nominally, +purges are faster than flushes as the cache lines don't have to be +written back to memory. + +Hopefully, this is sufficient to resolve the remaining problems due to +cache speculation.  So far, testing indicates that this is the case.  I +did work up a patch using tmpalias flushes, but there is a performance +hit because we need the physical address for each page, and we also need +to sequence access to the tmpalias flush code.  This increases the +probability of stalls. + +Signed-off-by: John David Anglin  +Cc: stable@vger.kernel.org # 4.9+ +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman + +--- + arch/parisc/include/asm/cacheflush.h | 1 + arch/parisc/kernel/cache.c | 57 +++++++++++++++++++---------------- + arch/parisc/kernel/pacache.S | 22 +++++++++++++ + 3 files changed, 54 insertions(+), 26 deletions(-) + +--- a/arch/parisc/include/asm/cacheflush.h ++++ b/arch/parisc/include/asm/cacheflush.h +@@ -25,6 +25,7 @@ void flush_user_icache_range_asm(unsigne + void flush_kernel_icache_range_asm(unsigned long, unsigned long); + void flush_user_dcache_range_asm(unsigned long, unsigned long); + void flush_kernel_dcache_range_asm(unsigned long, unsigned long); ++void purge_kernel_dcache_range_asm(unsigned long, unsigned long); + void flush_kernel_dcache_page_asm(void *); + void flush_kernel_icache_page(void *); + void flush_user_dcache_range(unsigned long, unsigned long); +--- a/arch/parisc/kernel/cache.c ++++ b/arch/parisc/kernel/cache.c +@@ -464,10 +464,10 @@ EXPORT_SYMBOL(copy_user_page); + int __flush_tlb_range(unsigned long sid, unsigned long start, + unsigned long end) + { +- unsigned long flags, size; ++ unsigned long flags; + +- size = (end - start); +- if (size >= parisc_tlb_flush_threshold) { ++ if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && ++ end - start >= parisc_tlb_flush_threshold) { + flush_tlb_all(); + return 1; + } +@@ -538,13 +538,11 @@ void flush_cache_mm(struct mm_struct *mm + struct vm_area_struct *vma; + pgd_t *pgd; + +- /* Flush the TLB to avoid speculation if coherency is required. */ +- if (parisc_requires_coherency()) +- flush_tlb_all(); +- + /* Flushing the whole cache on each cpu takes forever on + rp3440, etc. So, avoid it if the mm isn't too big. */ +- if (mm_total_size(mm) >= parisc_cache_flush_threshold) { ++ if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && ++ mm_total_size(mm) >= parisc_cache_flush_threshold) { ++ flush_tlb_all(); + flush_cache_all(); + return; + } +@@ -552,9 +550,9 @@ void flush_cache_mm(struct mm_struct *mm + if (mm->context == mfsp(3)) { + for (vma = mm->mmap; vma; vma = vma->vm_next) { + flush_user_dcache_range_asm(vma->vm_start, vma->vm_end); +- if ((vma->vm_flags & VM_EXEC) == 0) +- continue; +- flush_user_icache_range_asm(vma->vm_start, vma->vm_end); ++ if (vma->vm_flags & VM_EXEC) ++ flush_user_icache_range_asm(vma->vm_start, vma->vm_end); ++ flush_tlb_range(vma, vma->vm_start, vma->vm_end); + } + return; + } +@@ -598,14 +596,9 @@ flush_user_icache_range(unsigned long st + void flush_cache_range(struct vm_area_struct *vma, + unsigned long start, unsigned long end) + { +- BUG_ON(!vma->vm_mm->context); +- +- /* Flush the TLB to avoid speculation if coherency is required. */ +- if (parisc_requires_coherency()) ++ if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && ++ end - start >= parisc_cache_flush_threshold) { + flush_tlb_range(vma, start, end); +- +- if ((end - start) >= parisc_cache_flush_threshold +- || vma->vm_mm->context != mfsp(3)) { + flush_cache_all(); + return; + } +@@ -613,6 +606,7 @@ void flush_cache_range(struct vm_area_st + flush_user_dcache_range_asm(start, end); + if (vma->vm_flags & VM_EXEC) + flush_user_icache_range_asm(start, end); ++ flush_tlb_range(vma, start, end); + } + + void +@@ -621,8 +615,7 @@ flush_cache_page(struct vm_area_struct * + BUG_ON(!vma->vm_mm->context); + + if (pfn_valid(pfn)) { +- if (parisc_requires_coherency()) +- flush_tlb_page(vma, vmaddr); ++ flush_tlb_page(vma, vmaddr); + __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); + } + } +@@ -630,21 +623,33 @@ flush_cache_page(struct vm_area_struct * + void flush_kernel_vmap_range(void *vaddr, int size) + { + unsigned long start = (unsigned long)vaddr; ++ unsigned long end = start + size; + +- if ((unsigned long)size > parisc_cache_flush_threshold) ++ if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && ++ (unsigned long)size >= parisc_cache_flush_threshold) { ++ flush_tlb_kernel_range(start, end); + flush_data_cache(); +- else +- flush_kernel_dcache_range_asm(start, start + size); ++ return; ++ } ++ ++ flush_kernel_dcache_range_asm(start, end); ++ flush_tlb_kernel_range(start, end); + } + EXPORT_SYMBOL(flush_kernel_vmap_range); + + void invalidate_kernel_vmap_range(void *vaddr, int size) + { + unsigned long start = (unsigned long)vaddr; ++ unsigned long end = start + size; + +- if ((unsigned long)size > parisc_cache_flush_threshold) ++ if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && ++ (unsigned long)size >= parisc_cache_flush_threshold) { ++ flush_tlb_kernel_range(start, end); + flush_data_cache(); +- else +- flush_kernel_dcache_range_asm(start, start + size); ++ return; ++ } ++ ++ purge_kernel_dcache_range_asm(start, end); ++ flush_tlb_kernel_range(start, end); + } + EXPORT_SYMBOL(invalidate_kernel_vmap_range); +--- a/arch/parisc/kernel/pacache.S ++++ b/arch/parisc/kernel/pacache.S +@@ -1110,6 +1110,28 @@ ENTRY_CFI(flush_kernel_dcache_range_asm) + .procend + ENDPROC_CFI(flush_kernel_dcache_range_asm) + ++ENTRY_CFI(purge_kernel_dcache_range_asm) ++ .proc ++ .callinfo NO_CALLS ++ .entry ++ ++ ldil L%dcache_stride, %r1 ++ ldw R%dcache_stride(%r1), %r23 ++ ldo -1(%r23), %r21 ++ ANDCM %r26, %r21, %r26 ++ ++1: cmpb,COND(<<),n %r26, %r25,1b ++ pdc,m %r23(%r26) ++ ++ sync ++ syncdma ++ bv %r0(%r2) ++ nop ++ .exit ++ ++ .procend ++ENDPROC_CFI(purge_kernel_dcache_range_asm) ++ + ENTRY_CFI(flush_user_icache_range_asm) + .proc + .callinfo NO_CALLS diff --git a/queue-4.9/series b/queue-4.9/series index cd0474213fa..401ce88a8e6 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -1,4 +1,3 @@ -bluetooth-btusb-use-dmi-matching-for-qca-reset_resume-quirking.patch tpm-st33zp24-fix-potential-buffer-overruns-caused-by-bit-glitches-on-the-bus.patch tpm_i2c_infineon-fix-potential-buffer-overruns-caused-by-bit-glitches-on-the-bus.patch tpm_i2c_nuvoton-fix-potential-buffer-overruns-caused-by-bit-glitches-on-the-bus.patch @@ -6,3 +5,12 @@ tpm_tis-fix-potential-buffer-overruns-caused-by-bit-glitches-on-the-bus.patch tpm-constify-transmit-data-pointers.patch tpm_tis_spi-use-dma-safe-memory-for-spi-transfers.patch tpm-dev-common-reject-too-short-writes.patch +alsa-usb-audio-add-a-quirck-for-b-w-px-headphones.patch +alsa-hda-add-a-power_save-blacklist.patch +alsa-hda-fix-pincfg-at-resume-on-lenovo-t470-dock.patch +timers-forward-timer-base-before-migrating-timers.patch +parisc-fix-ordering-of-cache-and-tlb-flushes.patch +cpufreq-s3c24xx-fix-broken-s3c_cpufreq_init.patch +dax-fix-vma_is_fsdax-helper.patch +x86-xen-zero-msr_ia32_spec_ctrl-before-suspend.patch +x86-platform-intel-mid-handle-intel-edison-reboot-correctly.patch diff --git a/queue-4.9/timers-forward-timer-base-before-migrating-timers.patch b/queue-4.9/timers-forward-timer-base-before-migrating-timers.patch new file mode 100644 index 00000000000..59bc8daea14 --- /dev/null +++ b/queue-4.9/timers-forward-timer-base-before-migrating-timers.patch @@ -0,0 +1,84 @@ +From c52232a49e203a65a6e1a670cd5262f59e9364a0 Mon Sep 17 00:00:00 2001 +From: Lingutla Chandrasekhar +Date: Thu, 18 Jan 2018 17:20:22 +0530 +Subject: timers: Forward timer base before migrating timers + +From: Lingutla Chandrasekhar + +commit c52232a49e203a65a6e1a670cd5262f59e9364a0 upstream. + +On CPU hotunplug the enqueued timers of the unplugged CPU are migrated to a +live CPU. This happens from the control thread which initiated the unplug. + +If the CPU on which the control thread runs came out from a longer idle +period then the base clock of that CPU might be stale because the control +thread runs prior to any event which forwards the clock. + +In such a case the timers from the unplugged CPU are queued on the live CPU +based on the stale clock which can cause large delays due to increased +granularity of the outer timer wheels which are far away from base:;clock. + +But there is a worse problem than that. The following sequence of events +illustrates it: + + - CPU0 timer1 is queued expires = 59969 and base->clk = 59131. + + The timer is queued at wheel level 2, with resulting expiry time = 60032 + (due to level granularity). + + - CPU1 enters idle @60007, with next timer expiry @60020. + + - CPU0 is hotplugged at @60009 + + - CPU1 exits idle and runs the control thread which migrates the + timers from CPU0 + + timer1 is now queued in level 0 for immediate handling in the next + softirq because the requested expiry time 59969 is before CPU1 base->clk + 60007 + + - CPU1 runs code which forwards the base clock which succeeds because the + next expiring timer. which was collected at idle entry time is still set + to 60020. + + So it forwards beyond 60007 and therefore misses to expire the migrated + timer1. That timer gets expired when the wheel wraps around again, which + takes between 63 and 630ms depending on the HZ setting. + +Address both problems by invoking forward_timer_base() for the control CPUs +timer base. All other places, which might run into a similar problem +(mod_timer()/add_timer_on()) already invoke forward_timer_base() to avoid +that. + +[ tglx: Massaged comment and changelog ] + +Fixes: a683f390b93f ("timers: Forward the wheel clock whenever possible") +Co-developed-by: Neeraj Upadhyay +Signed-off-by: Neeraj Upadhyay +Signed-off-by: Lingutla Chandrasekhar +Signed-off-by: Thomas Gleixner +Cc: Anna-Maria Gleixner +Cc: linux-arm-msm@vger.kernel.org +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/20180118115022.6368-1-clingutla@codeaurora.org +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/time/timer.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1884,6 +1884,12 @@ int timers_dead_cpu(unsigned int cpu) + spin_lock_irq(&new_base->lock); + spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); + ++ /* ++ * The current CPUs base clock might be stale. Update it ++ * before moving the timers over. ++ */ ++ forward_timer_base(new_base); ++ + BUG_ON(old_base->running_timer); + + for (i = 0; i < WHEEL_SIZE; i++) diff --git a/queue-4.9/x86-platform-intel-mid-handle-intel-edison-reboot-correctly.patch b/queue-4.9/x86-platform-intel-mid-handle-intel-edison-reboot-correctly.patch new file mode 100644 index 00000000000..3fc39fa01c6 --- /dev/null +++ b/queue-4.9/x86-platform-intel-mid-handle-intel-edison-reboot-correctly.patch @@ -0,0 +1,45 @@ +From 028091f82eefd5e84f81cef81a7673016ecbe78b Mon Sep 17 00:00:00 2001 +From: Sebastian Panceac +Date: Wed, 28 Feb 2018 11:40:49 +0200 +Subject: x86/platform/intel-mid: Handle Intel Edison reboot correctly + +From: Sebastian Panceac + +commit 028091f82eefd5e84f81cef81a7673016ecbe78b upstream. + +When the Intel Edison module is powered with 3.3V, the reboot command makes +the module stuck. If the module is powered at a greater voltage, like 4.4V +(as the Edison Mini Breakout board does), reboot works OK. + +The official Intel Edison BSP sends the IPCMSG_COLD_RESET message to the +SCU by default. The IPCMSG_COLD_BOOT which is used by the upstream kernel +is only sent when explicitely selected on the kernel command line. + +Use IPCMSG_COLD_RESET unconditionally which makes reboot work independent +of the power supply voltage. + +[ tglx: Massaged changelog ] + +Fixes: bda7b072de99 ("x86/platform/intel-mid: Implement power off sequence") +Signed-off-by: Sebastian Panceac +Signed-off-by: Thomas Gleixner +Acked-by: Andy Shevchenko +Cc: stable@vger.kernel.org +Link: https://lkml.kernel.org/r/1519810849-15131-1-git-send-email-sebastian@resin.io +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/platform/intel-mid/intel-mid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/platform/intel-mid/intel-mid.c ++++ b/arch/x86/platform/intel-mid/intel-mid.c +@@ -79,7 +79,7 @@ static void intel_mid_power_off(void) + + static void intel_mid_reboot(void) + { +- intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); ++ intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0); + } + + static unsigned long __init intel_mid_calibrate_tsc(void) diff --git a/queue-4.9/x86-xen-zero-msr_ia32_spec_ctrl-before-suspend.patch b/queue-4.9/x86-xen-zero-msr_ia32_spec_ctrl-before-suspend.patch new file mode 100644 index 00000000000..9941ad5fab1 --- /dev/null +++ b/queue-4.9/x86-xen-zero-msr_ia32_spec_ctrl-before-suspend.patch @@ -0,0 +1,78 @@ +From 71c208dd54ab971036d83ff6d9837bae4976e623 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Mon, 26 Feb 2018 15:08:18 +0100 +Subject: x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend + +From: Juergen Gross + +commit 71c208dd54ab971036d83ff6d9837bae4976e623 upstream. + +Older Xen versions (4.5 and before) might have problems migrating pv +guests with MSR_IA32_SPEC_CTRL having a non-zero value. So before +suspending zero that MSR and restore it after being resumed. + +Signed-off-by: Juergen Gross +Signed-off-by: Thomas Gleixner +Reviewed-by: Jan Beulich +Cc: stable@vger.kernel.org +Cc: xen-devel@lists.xenproject.org +Cc: boris.ostrovsky@oracle.com +Link: https://lkml.kernel.org/r/20180226140818.4849-1-jgross@suse.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/xen/suspend.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/arch/x86/xen/suspend.c ++++ b/arch/x86/xen/suspend.c +@@ -1,11 +1,14 @@ + #include + #include ++#include + + #include + #include + #include + #include + ++#include ++#include + #include + #include + #include +@@ -68,6 +71,8 @@ static void xen_pv_post_suspend(int susp + xen_mm_unpin_all(); + } + ++static DEFINE_PER_CPU(u64, spec_ctrl); ++ + void xen_arch_pre_suspend(void) + { + if (xen_pv_domain()) +@@ -84,6 +89,9 @@ void xen_arch_post_suspend(int cancelled + + static void xen_vcpu_notify_restore(void *data) + { ++ if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) ++ wrmsrl(MSR_IA32_SPEC_CTRL, this_cpu_read(spec_ctrl)); ++ + /* Boot processor notified via generic timekeeping_resume() */ + if (smp_processor_id() == 0) + return; +@@ -93,7 +101,15 @@ static void xen_vcpu_notify_restore(void + + static void xen_vcpu_notify_suspend(void *data) + { ++ u64 tmp; ++ + tick_suspend_local(); ++ ++ if (xen_pv_domain() && boot_cpu_has(X86_FEATURE_SPEC_CTRL)) { ++ rdmsrl(MSR_IA32_SPEC_CTRL, tmp); ++ this_cpu_write(spec_ctrl, tmp); ++ wrmsrl(MSR_IA32_SPEC_CTRL, 0); ++ } + } + + void xen_arch_resume(void) -- 2.47.3