Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKernel Build Daemon <kbuild@suse.de>2018-01-04 07:11:42 +0100
committerKernel Build Daemon <kbuild@suse.de>2018-01-04 07:11:42 +0100
commit853ac0ba9a23db170cd054d4ab9638ec63bcccc0 (patch)
tree3110113b3cc6854900e29a8a881500ebd5c24a28
parent1ec25fff4016f886d5cb3d768d40bb0037a3ddc7 (diff)
parent8d199944856f8391ee926e09d3dfaa6488dc7894 (diff)
Merge branch 'SLE12-SP3' into openSUSE-42.3
-rw-r--r--patches.arch/qcom-0015-x86-efi-Map-RAM-into-the-identity-page-table-for-mix.patch6
-rw-r--r--patches.arch/qcom-0037-x86-efi-Consolidate-region-mapping-logic.patch8
-rw-r--r--patches.arch/qcom-0045-x86-efi-bgrt-Use-efi_mem_reserve-to-avoid-copying-im.patch6
-rw-r--r--patches.drivers/0003-x86-efi-Move-to-generic-__-efi_call_virt.patch34
-rw-r--r--patches.drivers/0007-x86-efi-Enable-runtime-call-flag-checking.patch11
-rw-r--r--patches.drivers/ALSA-hda-Add-HP-ZBook-15u-G3-Conexant-CX20724-GPIO-m147
-rw-r--r--patches.drivers/ALSA-hda-Add-MIC_NO_PRESENCE-fixup-for-2-HP-machines80
-rw-r--r--patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-EliteBook-840-G28
-rw-r--r--patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-ProBook-440-G430
-rw-r--r--patches.drivers/ALSA-hda-Drop-useless-WARN_ON35
-rw-r--r--patches.drivers/ALSA-hda-Fix-click-noises-on-Samsung-Ativ-Book-854
-rw-r--r--patches.drivers/ALSA-hda-Fix-headset-microphone-detection-for-ASUS-N58
-rw-r--r--patches.drivers/ALSA-hda-Fix-mic-regression-by-ASRock-mobo-fixup43
-rw-r--r--patches.drivers/ALSA-hda-Fix-missing-COEF-init-for-ALC225-295-29952
-rw-r--r--patches.drivers/ALSA-hda-Fix-surround-output-pins-for-ASRock-B150M-m55
-rw-r--r--patches.drivers/ALSA-hda-On-board-speaker-fixup-on-ACER-Veriton55
-rw-r--r--patches.drivers/ALSA-hda-Skip-Realtek-SKU-check-for-Lenovo-machines44
-rw-r--r--patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-820-62
-rw-r--r--patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-840-59
-rw-r--r--patches.drivers/ALSA-hda-change-the-location-for-one-mic-on-a-Lenovo31
-rw-r--r--patches.drivers/ALSA-hda-fix-headset-mic-detection-issue-on-a-Dell-m33
-rw-r--r--patches.drivers/ALSA-hda-realtek-ALC891-headset-mode-for-Dell124
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-ALC256-HP-depop-function105
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-default-procedure-for-suspend-a110
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-support-for-ALC122074
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-support-for-Acer-Aspire-E5-475-56
-rw-r--r--patches.drivers/ALSA-hda-realtek-Add-support-for-headset-MIC-for-ALC89
-rw-r--r--patches.drivers/ALSA-hda-realtek-Enable-jack-detection-function-for-59
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-ALC275-no-sound-issue35
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-Dell-AIO-LineOut-issue97
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-headset-and-mic-on-several-Asus101
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-headset-mic-and-speaker-on-Asus69
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-headset-mic-on-several-Asus-lap70
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-pincfg-for-Dell-XPS-13-937059
-rw-r--r--patches.drivers/ALSA-hda-realtek-Fix-speaker-support-for-Asus-AiO-ZN55
-rw-r--r--patches.drivers/ALSA-hda-realtek-New-codec-device-ID-for-ALC122036
-rw-r--r--patches.drivers/ALSA-hda-realtek-New-codec-support-for-ALC25766
-rw-r--r--patches.drivers/ALSA-hda-realtek-New-codec-support-of-ALC122044
-rw-r--r--patches.drivers/ALSA-hda-realtek-New-codecs-support-for-ALC215-ALC2886
-rw-r--r--patches.drivers/ALSA-hda-realtek-No-loopback-on-ALC225-ALC295-codec27
-rw-r--r--patches.drivers/ALSA-hda-realtek-Remove-ALC285-device-ID67
-rw-r--r--patches.drivers/ALSA-hda-realtek-Support-Dell-headset-mode-for-ALC3258
-rw-r--r--patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC234-ALC164
-rw-r--r--patches.drivers/ALSA-hda-realtek-There-is-no-loopback-mixer-in-the-A40
-rw-r--r--patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC225171
-rw-r--r--patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC298153
-rw-r--r--patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two-58
-rw-r--r--patches.drivers/ALSA-hda-realtek-fix-headset-mic-detection-for-MSI-M52
-rw-r--r--patches.drivers/ALSA-pcm-prevent-UAF-in-snd_pcm_info36
-rw-r--r--patches.drivers/ALSA-rawmidi-Avoid-racy-info-ioctl-via-ctl-device65
-rw-r--r--patches.drivers/ALSA-seq-Remove-spurious-WARN_ON-at-timer-check34
-rw-r--r--patches.drivers/ALSA-usb-audio-Add-check-return-value-for-usb_string41
-rw-r--r--patches.drivers/ALSA-usb-audio-Fix-out-of-bound-error94
-rw-r--r--patches.drivers/ALSA-usb-audio-Fix-the-missing-ctl-name-suffix-at-pa74
-rw-r--r--patches.drivers/ASoC-fsl_ssi-AC-97-ops-need-regmap-clock-and-cleanin64
-rw-r--r--patches.drivers/ASoC-twl4030-fix-child-node-lookup48
-rw-r--r--patches.drivers/ASoC-wm_adsp-Fix-validation-of-firmware-and-coeff-le70
-rw-r--r--patches.drivers/mm-x86-get_user_pages-for-dax-mappings.patch13
-rw-r--r--patches.fixes/ipsec-Fix-aborted-xfrm-policy-dump-crash.patch52
-rw-r--r--patches.kabi/revert-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch92
-rw-r--r--patches.kabi/revert-netlink-add-a-start-callback-for-starting-a-n.patch124
-rw-r--r--patches.kernel.org/4.4.104-001-netlink-add-a-start-callback-for-starting-a-n.patch131
-rw-r--r--patches.kernel.org/4.4.104-002-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch107
-rw-r--r--patches.kernel.org/4.4.104-003-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-.patch (renamed from patches.arch/0002-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-frame-n.patch)43
-rw-r--r--patches.kernel.org/4.4.104-004-x86-efi-Hoist-page-table-switching-code-into-.patch (renamed from patches.arch/qcom-0016-x86-efi-Hoist-page-table-switching-code-into-efi_cal.patch)53
-rw-r--r--patches.kernel.org/4.4.104-005-x86-efi-Build-our-own-page-table-structures.patch (renamed from patches.arch/qcom-0017-x86-efi-Build-our-own-page-table-structures.patch)54
-rw-r--r--patches.kernel.org/4.4.104-006-ARM-dts-omap3-logicpd-torpedo-37xx-devkit-Fix.patch40
-rw-r--r--patches.kernel.org/4.4.104-007-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BG.patch (renamed from patches.arch/qcom-0003-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BGRT-data.patch)26
-rw-r--r--patches.kernel.org/4.4.104-008-x86-efi-bgrt-Replace-early_memremap-with-memr.patch103
-rw-r--r--patches.kernel.org/4.4.104-009-mm-thp-Do-not-make-page-table-dirty-unconditi.patch (renamed from patches.fixes/mm-thp-do-not-dirty-huge-pte-on-read-fault.patch)38
-rw-r--r--patches.kernel.org/4.4.104-010-mm-madvise.c-fix-madvise-infinite-loop-under-.patch (renamed from patches.fixes/mm-madvise.c-fix-madvise-infinite-loop-under-special.patch)19
-rw-r--r--patches.kernel.org/4.4.104-011-btrfs-clear-space-cache-inode-generation-alwa.patch64
-rw-r--r--patches.kernel.org/4.4.104-012-KVM-x86-pvclock-Handle-first-time-write-to-pv.patch57
-rw-r--r--patches.kernel.org/4.4.104-013-KVM-x86-Exit-to-user-mode-on-UD-intercept-whe.patch62
-rw-r--r--patches.kernel.org/4.4.104-014-KVM-x86-inject-exceptions-produced-by-x86_dec.patch58
-rw-r--r--patches.kernel.org/4.4.104-015-mmc-core-Do-not-leave-the-block-driver-in-a-s.patch37
-rw-r--r--patches.kernel.org/4.4.104-016-eeprom-at24-check-at24_read-write-arguments.patch47
-rw-r--r--patches.kernel.org/4.4.104-017-bcache-Fix-building-error-on-MIPS.patch83
-rw-r--r--patches.kernel.org/4.4.104-018-Revert-drm-radeon-dont-switch-vt-on-suspend.patch42
-rw-r--r--patches.kernel.org/4.4.104-019-drm-radeon-fix-atombios-on-big-endian.patch147
-rw-r--r--patches.kernel.org/4.4.104-020-drm-panel-simple-Add-missing-panel_simple_unp.patch (renamed from patches.drivers/drm-panel-simple-Add-missing-panel_simple_unprepare-)23
-rw-r--r--patches.kernel.org/4.4.104-021-mtd-nand-Fix-writing-mtdoops-to-nand-flash.patch56
-rw-r--r--patches.kernel.org/4.4.104-022-NFS-revalidate-.-etc-correctly-on-open.patch (renamed from patches.fixes/0002-NFS-revalidate-.-etc-correctly-on-open.patch)23
-rw-r--r--patches.kernel.org/4.4.104-023-drm-i915-Don-t-try-indexed-reads-to-alternate.patch (renamed from patches.drivers/drm-i915-Don-t-try-indexed-reads-to-alternate-slave-)30
-rw-r--r--patches.kernel.org/4.4.104-024-drm-i915-Prevent-zero-length-index-write.patch (renamed from patches.drivers/drm-i915-Prevent-zero-length-index-write)29
-rw-r--r--patches.kernel.org/4.4.104-025-nfsd-Make-init_open_stateid-a-bit-more-whole.patch97
-rw-r--r--patches.kernel.org/4.4.104-026-nfsd-Fix-stateid-races-between-OPEN-and-CLOSE.patch158
-rw-r--r--patches.kernel.org/4.4.104-027-nfsd-Fix-another-OPEN-stateid-race.patch96
-rw-r--r--patches.kernel.org/4.4.104-028-Linux-4.4.104.patch27
-rw-r--r--patches.suse/sched-rt-Do-not-pull-from-current-CPU-if-only-one-CPU-to-pull.patch80
-rw-r--r--series.conf98
91 files changed, 5555 insertions, 236 deletions
diff --git a/patches.arch/qcom-0015-x86-efi-Map-RAM-into-the-identity-page-table-for-mix.patch b/patches.arch/qcom-0015-x86-efi-Map-RAM-into-the-identity-page-table-for-mix.patch
index 758ced09e4..b6578764ae 100644
--- a/patches.arch/qcom-0015-x86-efi-Map-RAM-into-the-identity-page-table-for-mix.patch
+++ b/patches.arch/qcom-0015-x86-efi-Map-RAM-into-the-identity-page-table-for-mix.patch
@@ -36,15 +36,15 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
-@@ -142,6 +142,7 @@ void efi_sync_low_kernel_mappings(void)
+@@ -213,6 +213,7 @@ void efi_sync_low_kernel_mappings(void)
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
- unsigned long text;
+ unsigned long pfn, text;
+ efi_memory_desc_t *md;
struct page *page;
unsigned npages;
pgd_t *pgd;
-@@ -174,6 +175,25 @@ int __init efi_setup_page_tables(unsigne
+@@ -246,6 +247,25 @@ int __init efi_setup_page_tables(unsigne
if (!IS_ENABLED(CONFIG_EFI_MIXED))
return 0;
diff --git a/patches.arch/qcom-0037-x86-efi-Consolidate-region-mapping-logic.patch b/patches.arch/qcom-0037-x86-efi-Consolidate-region-mapping-logic.patch
index ddf2fbaa1a..b811cc7f13 100644
--- a/patches.arch/qcom-0037-x86-efi-Consolidate-region-mapping-logic.patch
+++ b/patches.arch/qcom-0037-x86-efi-Consolidate-region-mapping-logic.patch
@@ -28,7 +28,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
-@@ -763,6 +763,46 @@ static void *efi_map_next_entry(void *en
+@@ -731,6 +731,46 @@ static void *efi_map_next_entry(void *en
return entry;
}
@@ -75,7 +75,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
/*
* Map the efi memory ranges of the runtime services and update new_mmap with
* virtual addresses.
-@@ -780,13 +820,9 @@ static void * __init efi_map_regions(int
+@@ -747,13 +787,9 @@ static void * __init efi_map_regions(int
p = NULL;
while ((p = efi_map_next_entry(p))) {
md = p;
@@ -97,12 +97,12 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
@@ -211,7 +211,6 @@ void efi_sync_low_kernel_mappings(void)
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
- unsigned long text;
+ unsigned long pfn, text;
- efi_memory_desc_t *md;
struct page *page;
unsigned npages;
pgd_t *pgd;
-@@ -244,25 +243,6 @@ int __init efi_setup_page_tables(unsigne
+@@ -245,25 +244,6 @@ int __init efi_setup_page_tables(unsigne
if (!IS_ENABLED(CONFIG_EFI_MIXED))
return 0;
diff --git a/patches.arch/qcom-0045-x86-efi-bgrt-Use-efi_mem_reserve-to-avoid-copying-im.patch b/patches.arch/qcom-0045-x86-efi-bgrt-Use-efi_mem_reserve-to-avoid-copying-im.patch
index 507a0640da..635bb59b96 100644
--- a/patches.arch/qcom-0045-x86-efi-bgrt-Use-efi_mem_reserve-to-avoid-copying-im.patch
+++ b/patches.arch/qcom-0045-x86-efi-bgrt-Use-efi_mem_reserve-to-avoid-copying-im.patch
@@ -36,7 +36,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -79,21 +79,12 @@ void __init efi_bgrt_init(void)
- early_memunmap(image, sizeof(bmp_header));
+ memunmap(image);
bgrt_image_size = bmp_header.size;
- bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@@ -47,7 +47,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
- return;
- }
-
-- image = early_memremap(bgrt_tab->image_address, bmp_header.size);
+- image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
- if (!image) {
pr_err("Ignoring BGRT: failed to map image memory\n");
- kfree(bgrt_image);
@@ -56,6 +56,6 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
}
- memcpy(bgrt_image, image, bgrt_image_size);
-- early_memunmap(image, bmp_header.size);
+- memunmap(image);
+ efi_mem_reserve(bgrt_tab->image_address, bgrt_image_size);
}
diff --git a/patches.drivers/0003-x86-efi-Move-to-generic-__-efi_call_virt.patch b/patches.drivers/0003-x86-efi-Move-to-generic-__-efi_call_virt.patch
index b0899d183d..aa80ce1be5 100644
--- a/patches.drivers/0003-x86-efi-Move-to-generic-__-efi_call_virt.patch
+++ b/patches.drivers/0003-x86-efi-Move-to-generic-__-efi_call_virt.patch
@@ -26,14 +26,12 @@ Link: http://lkml.kernel.org/r/1461614832-17633-35-git-send-email-matt@codebluep
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
---
- arch/x86/include/asm/efi.h | 39 ++++++++++++---------------------------
- 1 file changed, 12 insertions(+), 27 deletions(-)
+ arch/x86/include/asm/efi.h | 41 ++++++++++++-----------------------------
+ 1 file changed, 12 insertions(+), 29 deletions(-)
-diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
-index fc2d1bf..51ca622 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
-@@ -30,28 +30,16 @@
+@@ -31,28 +31,16 @@
extern unsigned long asmlinkage efi_call_phys(void *, ...);
@@ -46,8 +44,7 @@ index fc2d1bf..51ca622 100644
-
-/* Use this macro if your virtual returns a non-void value */
-#define efi_call_virt(f, args...) \
-+#define arch_efi_call_virt(f, args...) \
- ({ \
+-({ \
- efi_status_t __s; \
- kernel_fpu_begin(); \
- __s = ((efi_##f##_t __attribute__((regparm(0)))*) \
@@ -58,7 +55,8 @@ index fc2d1bf..51ca622 100644
-
-/* Use this macro if your virtual call does not return any value */
-#define __efi_call_virt(f, args...) \
--({ \
++#define arch_efi_call_virt(f, args...) \
+ ({ \
- kernel_fpu_begin(); \
((efi_##f##_t __attribute__((regparm(0)))*) \
efi.systab->runtime->f)(args); \
@@ -66,9 +64,9 @@ index fc2d1bf..51ca622 100644
})
#define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size)
-@@ -64,25 +52,22 @@ extern u64 asmlinkage efi_call(void *fp, ...);
-
- #define efi_call_phys(f, args...) efi_call((f), args)
+@@ -76,10 +64,8 @@ struct efi_scratch {
+ u64 phys_stack;
+ } __packed;
-#define efi_call_virt(f, ...) \
+#define arch_efi_call_virt_setup() \
@@ -78,7 +76,13 @@ index fc2d1bf..51ca622 100644
efi_sync_low_kernel_mappings(); \
preempt_disable(); \
__kernel_fpu_begin(); \
+@@ -89,9 +75,13 @@ struct efi_scratch {
+ write_cr3((unsigned long)efi_scratch.efi_pgt); \
+ __flush_tlb_all(); \
+ } \
+- \
- __s = efi_call((void *)efi.systab->runtime->f, __VA_ARGS__); \
+- \
+})
+
+#define arch_efi_call_virt(f, args...) \
@@ -86,6 +90,11 @@ index fc2d1bf..51ca622 100644
+
+#define arch_efi_call_virt_teardown() \
+({ \
+ if (efi_scratch.use_pgd) { \
+ write_cr3(efi_scratch.prev_cr3); \
+ __flush_tlb_all(); \
+@@ -99,15 +89,8 @@ struct efi_scratch {
+ \
__kernel_fpu_end(); \
preempt_enable(); \
- __s; \
@@ -100,6 +109,3 @@ index fc2d1bf..51ca622 100644
extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size,
u32 type, u64 attribute);
---
-1.8.5.6
-
diff --git a/patches.drivers/0007-x86-efi-Enable-runtime-call-flag-checking.patch b/patches.drivers/0007-x86-efi-Enable-runtime-call-flag-checking.patch
index 1452619868..bda86301cf 100644
--- a/patches.drivers/0007-x86-efi-Enable-runtime-call-flag-checking.patch
+++ b/patches.drivers/0007-x86-efi-Enable-runtime-call-flag-checking.patch
@@ -40,11 +40,9 @@ Link: http://lkml.kernel.org/r/1461614832-17633-40-git-send-email-matt@codebluep
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
---
- arch/x86/include/asm/efi.h | 4 +++-
+ arch/x86/include/asm/efi.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
-diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
-index 51ca622..359f13d 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -3,6 +3,7 @@
@@ -52,10 +50,10 @@ index 51ca622..359f13d 100644
#include <asm/fpu/api.h>
#include <asm/pgtable.h>
+#include <asm/processor-flags.h>
+ #include <asm/tlb.h>
/*
- * We map the EFI regions needed for runtime services non-contiguously,
-@@ -25,8 +26,9 @@
+@@ -26,8 +27,9 @@
#define EFI32_LOADER_SIGNATURE "EL32"
#define EFI64_LOADER_SIGNATURE "EL64"
@@ -66,6 +64,3 @@ index 51ca622..359f13d 100644
extern unsigned long asmlinkage efi_call_phys(void *, ...);
---
-1.8.5.6
-
diff --git a/patches.drivers/ALSA-hda-Add-HP-ZBook-15u-G3-Conexant-CX20724-GPIO-m b/patches.drivers/ALSA-hda-Add-HP-ZBook-15u-G3-Conexant-CX20724-GPIO-m
new file mode 100644
index 0000000000..03d0f9b068
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Add-HP-ZBook-15u-G3-Conexant-CX20724-GPIO-m
@@ -0,0 +1,147 @@
+From 5cd5b1bdfb0137d0e814a51ff203d72c76b9f375 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jer=C3=B3nimo=20Borque?= <jeronimo@borque.com.ar>
+Date: Wed, 19 Apr 2017 12:09:50 -0300
+Subject: [PATCH] ALSA: hda - Add HP ZBook 15u G3 Conexant CX20724 GPIO mute leds
+Mime-version: 1.0
+Content-type: text/plain; charset=UTF-8
+Content-transfer-encoding: 8bit
+Git-commit: 5cd5b1bdfb0137d0e814a51ff203d72c76b9f375
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+The HP ZBook 15u G3 has a Conexant CX20724 with mute led on GPIO1 and
+mic mute led on GPIO2.
+Adding CXT_FIXUP_MUTE_LED_GPIO inspired on patch_realtek's one.
+
+Signed-off-by: Jerónimo Borque <jeronimo@borque.com.ar>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 81 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 81 insertions(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -52,6 +52,12 @@ struct conexant_spec {
+ bool dc_enable;
+ unsigned int dc_input_bias; /* offset into olpc_xo_dc_bias */
+ struct nid_path *dc_mode_path;
++
++ int mute_led_polarity;
++ unsigned int gpio_led;
++ unsigned int gpio_mute_led_mask;
++ unsigned int gpio_mic_led_mask;
++
+ };
+
+
+@@ -264,6 +270,7 @@ enum {
+ CXT_FIXUP_HP_DOCK,
+ CXT_FIXUP_HP_SPECTRE,
+ CXT_FIXUP_HP_GATE_MIC,
++ CXT_FIXUP_MUTE_LED_GPIO,
+ };
+
+ /* for hda_fixup_thinkpad_acpi() */
+@@ -646,6 +653,74 @@ static void cxt_fixup_hp_gate_mic_jack(s
+ snd_hda_jack_set_gating_jack(codec, 0x19, 0x16);
+ }
+
++/* update LED status via GPIO */
++static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask,
++ bool enabled)
++{
++ struct conexant_spec *spec = codec->spec;
++ unsigned int oldval = spec->gpio_led;
++
++ if (spec->mute_led_polarity)
++ enabled = !enabled;
++
++ if (enabled)
++ spec->gpio_led &= ~mask;
++ else
++ spec->gpio_led |= mask;
++ if (spec->gpio_led != oldval)
++ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
++ spec->gpio_led);
++}
++
++/* turn on/off mute LED via GPIO per vmaster hook */
++static void cxt_fixup_gpio_mute_hook(void *private_data, int enabled)
++{
++ struct hda_codec *codec = private_data;
++ struct conexant_spec *spec = codec->spec;
++
++ cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
++}
++
++/* turn on/off mic-mute LED via GPIO per capture hook */
++static void cxt_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
++ struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_value *ucontrol)
++{
++ struct conexant_spec *spec = codec->spec;
++
++ if (ucontrol)
++ cxt_update_gpio_led(codec, spec->gpio_mic_led_mask,
++ ucontrol->value.integer.value[0] ||
++ ucontrol->value.integer.value[1]);
++}
++
++
++static void cxt_fixup_mute_led_gpio(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ struct conexant_spec *spec = codec->spec;
++ static const struct hda_verb gpio_init[] = {
++ { 0x01, AC_VERB_SET_GPIO_MASK, 0x03 },
++ { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 },
++ {}
++ };
++ codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led);
++
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
++ spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook;
++ spec->gen.cap_sync_hook = cxt_fixup_gpio_mic_mute_hook;
++ spec->gpio_led = 0;
++ spec->mute_led_polarity = 0;
++ spec->gpio_mute_led_mask = 0x01;
++ spec->gpio_mic_led_mask = 0x02;
++ }
++ snd_hda_add_verbs(codec, gpio_init);
++ if (spec->gpio_led)
++ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
++ spec->gpio_led);
++}
++
++
+ /* ThinkPad X200 & co with cxt5051 */
+ static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
+ { 0x16, 0x042140ff }, /* HP (seq# overridden) */
+@@ -799,6 +874,10 @@ static const struct hda_fixup cxt_fixups
+ .type = HDA_FIXUP_FUNC,
+ .v.func = cxt_fixup_hp_gate_mic_jack,
+ },
++ [CXT_FIXUP_MUTE_LED_GPIO] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = cxt_fixup_mute_led_gpio,
++ },
+ };
+
+ static const struct snd_pci_quirk cxt5045_fixups[] = {
+@@ -851,6 +930,7 @@ static const struct snd_pci_quirk cxt506
+ SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
+ SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
+ SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
++ SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
+ SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
+ SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
+@@ -883,6 +963,7 @@ static const struct hda_model_fixup cxt5
+ { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
+ { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
+ { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
++ { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" },
+ {}
+ };
+
diff --git a/patches.drivers/ALSA-hda-Add-MIC_NO_PRESENCE-fixup-for-2-HP-machines b/patches.drivers/ALSA-hda-Add-MIC_NO_PRESENCE-fixup-for-2-HP-machines
new file mode 100644
index 0000000000..c7142dbe56
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Add-MIC_NO_PRESENCE-fixup-for-2-HP-machines
@@ -0,0 +1,80 @@
+From 322f74ede933b3e2cb78768b6a6fdbfbf478a0c1 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Fri, 22 Dec 2017 11:17:44 +0800
+Subject: [PATCH] ALSA: hda - Add MIC_NO_PRESENCE fixup for 2 HP machines
+Git-commit: 322f74ede933b3e2cb78768b6a6fdbfbf478a0c1
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+There is a headset jack on the front panel, when we plug a headset
+into it, the headset mic can't trigger unsol events, and
+read_pin_sense() can't detect its presence too. So add this fixup
+to fix this issue.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -271,6 +271,8 @@ enum {
+ CXT_FIXUP_HP_SPECTRE,
+ CXT_FIXUP_HP_GATE_MIC,
+ CXT_FIXUP_MUTE_LED_GPIO,
++ CXT_FIXUP_HEADSET_MIC,
++ CXT_FIXUP_HP_MIC_NO_PRESENCE,
+ };
+
+ /* for hda_fixup_thinkpad_acpi() */
+@@ -350,6 +352,18 @@ static void cxt_fixup_headphone_mic(stru
+ }
+ }
+
++static void cxt_fixup_headset_mic(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ struct conexant_spec *spec = codec->spec;
++
++ switch (action) {
++ case HDA_FIXUP_ACT_PRE_PROBE:
++ spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
++ break;
++ }
++}
++
+ /* OPLC XO 1.5 fixup */
+
+ /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors)
+@@ -880,6 +894,19 @@ static const struct hda_fixup cxt_fixups
+ .type = HDA_FIXUP_FUNC,
+ .v.func = cxt_fixup_mute_led_gpio,
+ },
++ [CXT_FIXUP_HEADSET_MIC] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = cxt_fixup_headset_mic,
++ },
++ [CXT_FIXUP_HP_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x1a, 0x02a1113c },
++ { }
++ },
++ .chained = true,
++ .chain_id = CXT_FIXUP_HEADSET_MIC,
++ },
+ };
+
+ static const struct snd_pci_quirk cxt5045_fixups[] = {
+@@ -934,6 +961,8 @@ static const struct snd_pci_quirk cxt506
+ SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
+ SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
+ SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO),
++ SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
+ SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
diff --git a/patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-EliteBook-840-G b/patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-EliteBook-840-G
new file mode 100644
index 0000000000..644d561ab9
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-EliteBook-840-G
@@ -0,0 +1,28 @@
+From c3123d6adb715de12fb366a55c1dedc6aabd94b0 Mon Sep 17 00:00:00 2001
+From: Florin Tudorache <florin_tudorache@live.com>
+Date: Fri, 5 May 2017 19:40:06 +0000
+Subject: [PATCH] ALSA: hda - Add mute led support for HP EliteBook 840 G3
+Git-commit: c3123d6adb715de12fb366a55c1dedc6aabd94b0
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+Signed-off-by: Florin Tudorache <florin_tudorache@live.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -860,7 +860,9 @@ static const struct hda_fixup cxt_fixups
+ { 0x16, 0x21011020 }, /* line-out */
+ { 0x18, 0x2181103f }, /* line-in */
+ { }
+- }
++ },
++ .chained = true,
++ .chain_id = CXT_FIXUP_MUTE_LED_GPIO,
+ },
+ [CXT_FIXUP_HP_SPECTRE] = {
+ .type = HDA_FIXUP_PINS,
diff --git a/patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-ProBook-440-G4 b/patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-ProBook-440-G4
new file mode 100644
index 0000000000..02fe75cb38
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-ProBook-440-G4
@@ -0,0 +1,30 @@
+From ba92b1142879731f80377770f4710e5f0a953aad Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Wed, 26 Jul 2017 00:23:46 +0800
+Subject: [PATCH] ALSA: hda - Add mute led support for HP ProBook 440 G4
+Git-commit: ba92b1142879731f80377770f4710e5f0a953aad
+Patch-mainline: 4.13-rc3
+References: bsc#1031717
+
+Mic mute led does not work on HP ProBook 440 G4.
+We can use CXT_FIXUP_MUTE_LED_GPIO fixup to support it.
+
+Buglink: https://bugs.launchpad.net/bugs/1705586
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Cc: <stable@vger.kernel.org> # v4.12+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -933,6 +933,7 @@ static const struct snd_pci_quirk cxt506
+ SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
+ SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
+ SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
++ SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO),
+ SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
+ SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
diff --git a/patches.drivers/ALSA-hda-Drop-useless-WARN_ON b/patches.drivers/ALSA-hda-Drop-useless-WARN_ON
new file mode 100644
index 0000000000..ad0832c40f
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Drop-useless-WARN_ON
@@ -0,0 +1,35 @@
+From a36c2638380c0a4676647a1f553b70b20d3ebce1 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 22 Dec 2017 10:45:07 +0100
+Subject: [PATCH] ALSA: hda: Drop useless WARN_ON()
+Git-commit: a36c2638380c0a4676647a1f553b70b20d3ebce1
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+Since the commit 97cc2ed27e5a ("ALSA: hda - Fix yet another i915
+pointer leftover in error path") cleared hdac_acomp pointer, the
+WARN_ON() non-NULL check in snd_hdac_i915_register_notifier() may give
+a false-positive warning, as the function gets called no matter
+whether the component is registered or not. For fixing it, let's get
+rid of the spurious WARN_ON().
+
+Fixes: 97cc2ed27e5a ("ALSA: hda - Fix yet another i915 pointer leftover in error path")
+Cc: <stable@vger.kernel.org>
+Reported-by: Kouta Okamoto <kouta.okamoto@toshiba.co.jp>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/hda/hdac_i915.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/hda/hdac_i915.c
++++ b/sound/hda/hdac_i915.c
+@@ -183,7 +183,7 @@ static int hdac_component_master_match(s
+ */
+ int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops)
+ {
+- if (WARN_ON(!hdac_acomp))
++ if (!hdac_acomp)
+ return -ENODEV;
+
+ hdac_acomp->audio_ops = aops;
diff --git a/patches.drivers/ALSA-hda-Fix-click-noises-on-Samsung-Ativ-Book-8 b/patches.drivers/ALSA-hda-Fix-click-noises-on-Samsung-Ativ-Book-8
new file mode 100644
index 0000000000..4a8c7f348b
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-click-noises-on-Samsung-Ativ-Book-8
@@ -0,0 +1,54 @@
+From 823ff161fe51179cc9ad1a3f6c7e4532901e0444 Mon Sep 17 00:00:00 2001
+From: Gabriele Mazzotta <gabriele.mzt@gmail.com>
+Date: Sat, 24 Dec 2016 19:50:01 +0100
+Subject: [PATCH] ALSA: hda - Fix click noises on Samsung Ativ Book 8
+Git-commit: 823ff161fe51179cc9ad1a3f6c7e4532901e0444
+Patch-mainline: 4.11-rc1
+References: bsc#1031717
+
+The Samsung Ativ Book 8 makes a loud click noise on boot, shutdown
+and when the audio card enters or exits power saving states. All
+these noises disappear applying ALC269_FIXUP_NO_SHUTUP.
+
+In addition to that, fix the loud click noise that the laptop
+makes when inserting or removing the headphone jack by automuting
+via amp instead of pinctl.
+
+Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5194,6 +5194,7 @@ enum {
+ ALC292_FIXUP_TPT460,
+ ALC298_FIXUP_SPK_VOLUME,
+ ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
++ ALC269_FIXUP_ATIV_BOOK_8,
+ ALC221_FIXUP_HP_MIC_NO_PRESENCE,
+ };
+
+@@ -5912,6 +5913,12 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
+ },
++ [ALC269_FIXUP_ATIV_BOOK_8] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc_fixup_auto_mute_via_amp,
++ .chained = true,
++ .chain_id = ALC269_FIXUP_NO_SHUTUP
++ },
+ [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -6064,6 +6071,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
+ SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
+ SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
++ SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
+ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
diff --git a/patches.drivers/ALSA-hda-Fix-headset-microphone-detection-for-ASUS-N b/patches.drivers/ALSA-hda-Fix-headset-microphone-detection-for-ASUS-N
new file mode 100644
index 0000000000..f6903d30d7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-headset-microphone-detection-for-ASUS-N
@@ -0,0 +1,58 @@
+From fc7438b1eb12b6c93d7b7a62423779eb5dfc673c Mon Sep 17 00:00:00 2001
+From: Mikhail Paulyshka <me@mixaill.tk>
+Date: Fri, 21 Apr 2017 08:52:42 +0200
+Subject: [PATCH] ALSA: hda - Fix headset microphone detection for ASUS N551 and N751
+Git-commit: fc7438b1eb12b6c93d7b7a62423779eb5dfc673c
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+Headset microphone does not work out of the box on ASUS Nx51
+laptops. This patch fixes it.
+
+Patch tested on Asus N551 laptop. Asus N751 part is not tested, but
+according to [1] this laptop uses the same audiosystem.
+
+1. https://bugzilla.kernel.org/show_bug.cgi?id=117781
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195437
+Signed-off-by: Mikhail Paulyshka <me@mixaill.tk>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7258,6 +7258,7 @@ enum {
+ ALC668_FIXUP_DELL_DISABLE_AAMIX,
+ ALC668_FIXUP_DELL_XPS13,
+ ALC662_FIXUP_ASUS_Nx50,
++ ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
+ ALC668_FIXUP_ASUS_Nx51,
+ ALC891_FIXUP_HEADSET_MODE,
+ ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
+@@ -7509,14 +7510,21 @@ static const struct hda_fixup alc662_fix
+ .chained = true,
+ .chain_id = ALC662_FIXUP_BASS_1A
+ },
++ [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc_fixup_headset_mode_alc668,
++ .chain_id = ALC662_FIXUP_BASS_CHMAP
++ },
+ [ALC668_FIXUP_ASUS_Nx51] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+- {0x1a, 0x90170151}, /* bass speaker */
++ { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
++ { 0x1a, 0x90170151 }, /* bass speaker */
++ { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
+ {}
+ },
+ .chained = true,
+- .chain_id = ALC662_FIXUP_BASS_CHMAP,
++ .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
+ },
+ [ALC891_FIXUP_HEADSET_MODE] = {
+ .type = HDA_FIXUP_FUNC,
diff --git a/patches.drivers/ALSA-hda-Fix-mic-regression-by-ASRock-mobo-fixup b/patches.drivers/ALSA-hda-Fix-mic-regression-by-ASRock-mobo-fixup
new file mode 100644
index 0000000000..acb6448882
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-mic-regression-by-ASRock-mobo-fixup
@@ -0,0 +1,43 @@
+From 9a2541910dc7eaaa6859eea8a0ffda673059a623 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 11 Nov 2016 12:33:20 +0100
+Subject: [PATCH] ALSA: hda - Fix mic regression by ASRock mobo fixup
+Git-commit: 9a2541910dc7eaaa6859eea8a0ffda673059a623
+Patch-mainline: 4.9-rc6
+References: bsc#1031717
+
+The commit [1a3f099101b8: ALSA: hda - Fix surround output pins for
+ASRock B150M mobo] introduced a fixup of pin configs for ASRock
+mobos to fix the surround outputs. However, this overrides the pin
+configs of the mic pins as if they are outputs-only, effectively
+disabling the mic inputs. Of course, it's a regression wrt mic
+functionality.
+
+Actually the pins 0x18 and 0x1a don't need to be changed; we just need
+to disable the bogus pins 0x14 and 0x15. Then the auto-parser will
+pick up mic pins as switchable and assign the surround outputs there.
+
+This patch removes the incorrect pin overrides of NID 0x18 and 0x1a
+from the ASRock fixup.
+
+Fixes: 1a3f099101b8 ('ALSA: hda - Fix surround output pins for ASRock...')
+Reported-and-tested-by: Vitor Antunes <vitor.hda@gmail.com>
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=187431
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7554,8 +7554,6 @@ static const struct hda_fixup alc662_fix
+ .v.pins = (const struct hda_pintbl[]) {
+ { 0x15, 0x40f000f0 }, /* disabled */
+ { 0x16, 0x40f000f0 }, /* disabled */
+- { 0x18, 0x01014011 }, /* LO */
+- { 0x1a, 0x01014012 }, /* LO */
+ { }
+ }
+ },
diff --git a/patches.drivers/ALSA-hda-Fix-missing-COEF-init-for-ALC225-295-299 b/patches.drivers/ALSA-hda-Fix-missing-COEF-init-for-ALC225-295-299
new file mode 100644
index 0000000000..959821a3a7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-missing-COEF-init-for-ALC225-295-299
@@ -0,0 +1,52 @@
+From 44be77c590f381bc629815ac789b8b15ecc4ddcf Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 27 Dec 2017 08:53:59 +0100
+Subject: [PATCH] ALSA: hda - Fix missing COEF init for ALC225/295/299
+Git-commit: 44be77c590f381bc629815ac789b8b15ecc4ddcf
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+There was a long-standing problem on HP Spectre X360 with Kabylake
+where it lacks of the front speaker output in some situations. Also
+there are other products showing the similar behavior. The culprit
+seems to be the missing COEF setup on ALC codecs, ALC225/295/299,
+which are all compatible.
+
+This patch adds the proper COEF setup (to initialize idx 0x67 / bits
+0x3000) for addressing the issue.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195457
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -327,8 +327,12 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0292:
+ alc_update_coef_idx(codec, 0x4, 1<<15, 0);
+ break;
+- case 0x10ec0215:
+ case 0x10ec0225:
++ case 0x10ec0295:
++ case 0x10ec0299:
++ alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
++ /* fallthrough */
++ case 0x10ec0215:
+ case 0x10ec0233:
+ case 0x10ec0236:
+ case 0x10ec0255:
+@@ -338,10 +342,8 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0286:
+ case 0x10ec0288:
+ case 0x10ec0285:
+- case 0x10ec0295:
+ case 0x10ec0298:
+ case 0x10ec0289:
+- case 0x10ec0299:
+ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
+ break;
+ case 0x10ec0293:
diff --git a/patches.drivers/ALSA-hda-Fix-surround-output-pins-for-ASRock-B150M-m b/patches.drivers/ALSA-hda-Fix-surround-output-pins-for-ASRock-B150M-m
new file mode 100644
index 0000000000..532af18145
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Fix-surround-output-pins-for-ASRock-B150M-m
@@ -0,0 +1,55 @@
+From 1a3f099101b85cc93d864eb030d97e7725c72ea7 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 20 Oct 2016 12:14:51 +0200
+Subject: [PATCH] ALSA: hda - Fix surround output pins for ASRock B150M mobo
+Git-commit: 1a3f099101b85cc93d864eb030d97e7725c72ea7
+Patch-mainline: 4.9-rc3
+References: bsc#1031717
+
+ASRock B150M Pro4/D3 mobo with ALC892 codec doesn't seem to provide
+proper pins for the surround outputs, hence we need to specify the
+pincfgs manually with a couple of other corrections.
+
+Reported-and-tested-by: Benjamin Valentin <benpicco@googlemail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7263,6 +7263,7 @@ enum {
+ ALC891_FIXUP_HEADSET_MODE,
+ ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
+ ALC662_FIXUP_ACER_VERITON,
++ ALC892_FIXUP_ASROCK_MOBO,
+ ALC662_FIXUP_USI_FUNC,
+ ALC662_FIXUP_USI_HEADSET_MODE,
+ };
+@@ -7548,6 +7549,16 @@ static const struct hda_fixup alc662_fix
+ { }
+ }
+ },
++ [ALC892_FIXUP_ASROCK_MOBO] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x15, 0x40f000f0 }, /* disabled */
++ { 0x16, 0x40f000f0 }, /* disabled */
++ { 0x18, 0x01014011 }, /* LO */
++ { 0x1a, 0x01014012 }, /* LO */
++ { }
++ }
++ },
+ [ALC662_FIXUP_USI_FUNC] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc662_fixup_usi_headset_mic,
+@@ -7601,6 +7612,7 @@ static const struct snd_pci_quirk alc662
+ SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
+ SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
+ SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
++ SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
+ SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
+ SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
+ SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
diff --git a/patches.drivers/ALSA-hda-On-board-speaker-fixup-on-ACER-Veriton b/patches.drivers/ALSA-hda-On-board-speaker-fixup-on-ACER-Veriton
new file mode 100644
index 0000000000..6cfa33abd3
--- /dev/null
+++ b/patches.drivers/ALSA-hda-On-board-speaker-fixup-on-ACER-Veriton
@@ -0,0 +1,55 @@
+From 9b51fe3efe4c270005e34f55a97e5a84ad68e581 Mon Sep 17 00:00:00 2001
+From: Shrirang Bagul <shrirang.bagul@canonical.com>
+Date: Mon, 1 Aug 2016 13:16:17 +0800
+Subject: [PATCH] ALSA: hda - On-board speaker fixup on ACER Veriton
+Git-commit: 9b51fe3efe4c270005e34f55a97e5a84ad68e581
+Patch-mainline: 4.8-rc1
+References: bsc#1031717
+
+On Acer Veriton machines, codec with subsystem-id 0x1b0a01b8 the port at
+0x15 is configured by default as an Internal Speaker (0x90170120).
+However, no physical is speaker installed on-board. This patch adds a quirk
+which disables the physical connection on this pin.
+
+Buglink: https://bugs.launchpad.net/bugs/1607647
+
+Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7262,6 +7262,7 @@ enum {
+ ALC668_FIXUP_ASUS_Nx51,
+ ALC891_FIXUP_HEADSET_MODE,
+ ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
++ ALC662_FIXUP_ACER_VERITON,
+ ALC662_FIXUP_USI_FUNC,
+ ALC662_FIXUP_USI_HEADSET_MODE,
+ };
+@@ -7540,6 +7541,13 @@ static const struct hda_fixup alc662_fix
+ .chained = true,
+ .chain_id = ALC891_FIXUP_HEADSET_MODE
+ },
++ [ALC662_FIXUP_ACER_VERITON] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x15, 0x50170120 }, /* no internal speaker */
++ { }
++ }
++ },
+ [ALC662_FIXUP_USI_FUNC] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc662_fixup_usi_headset_mic,
+@@ -7594,6 +7602,7 @@ static const struct snd_pci_quirk alc662
+ SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
+ SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
+ SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
++ SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
+ SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
+
+ #if 0
diff --git a/patches.drivers/ALSA-hda-Skip-Realtek-SKU-check-for-Lenovo-machines b/patches.drivers/ALSA-hda-Skip-Realtek-SKU-check-for-Lenovo-machines
new file mode 100644
index 0000000000..580a8baf1d
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Skip-Realtek-SKU-check-for-Lenovo-machines
@@ -0,0 +1,44 @@
+From 09da111aef57c022ac28bb8974f41c1729102d11 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 8 Sep 2016 12:15:02 +0200
+Subject: [PATCH] ALSA: hda - Skip Realtek SKU check for Lenovo machines
+Git-commit: 09da111aef57c022ac28bb8974f41c1729102d11
+Patch-mainline: 4.9-rc1
+References: bsc#1031717
+
+Realtek codec driver expects an implicit rule where either the codec
+SSID or the pincfg NID 0x1d contains the some information encoded in
+some bits. One of the expected information is there is the
+availability of PC beep, and the driver doesn't build up the PC beep
+control if this is *supposed* to be disabled there.
+
+Meanwhile, Lenovo doesn't seem to follow this requirement (yes it's
+non-standard after all), and the BIOS sets just the normal SSID and
+the pincfg values. This resulted in the lack of PC beep on a few
+machines, purely with a lucky or unlucky number. It didn't bother
+most people, but some people still demand the PC beep, as found in bug
+reports.
+
+This patch just adds the fixup chain to Lenovo machines to skip the
+SKU checks. Then the beep control will show up in the mixer, and user
+can still decide to enable / disable it via the standard mixer
+interface.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=156311
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5621,6 +5621,8 @@ static const struct hda_fixup alc269_fix
+ [ALC269_FIXUP_THINKPAD_ACPI] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = hda_fixup_thinkpad_acpi,
++ .chained = true,
++ .chain_id = ALC269_FIXUP_SKU_IGNORE,
+ },
+ [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
+ .type = HDA_FIXUP_FUNC,
diff --git a/patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-820- b/patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-820-
new file mode 100644
index 0000000000..7c20f18fb7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-820-
@@ -0,0 +1,62 @@
+From 04d5466a976b096364a39a63ac264c1b3a5f8fa1 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Thu, 9 Mar 2017 13:29:13 +0100
+Subject: [PATCH] ALSA: hda - add support for docking station for HP 820 G2
+Git-commit: 04d5466a976b096364a39a63ac264c1b3a5f8fa1
+Patch-mainline: 4.11-rc4
+References: bsc#1031717
+
+This tested patch adds missing initialization for Line-In/Out PINs for
+the docking station for HP 820 G2.
+
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5171,6 +5171,7 @@ enum {
+ ALC286_FIXUP_HP_GPIO_LED,
+ ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
+ ALC280_FIXUP_HP_DOCK_PINS,
++ ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
+ ALC280_FIXUP_HP_9480M,
+ ALC288_FIXUP_DELL_HEADSET_MODE,
+ ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
+@@ -5738,6 +5739,16 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC280_FIXUP_HP_GPIO4
+ },
++ [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x1b, 0x21011020 }, /* line-out */
++ { 0x18, 0x2181103f }, /* line-in */
++ { },
++ },
++ .chained = true,
++ .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
++ },
+ [ALC280_FIXUP_HP_9480M] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc280_fixup_hp_9480m,
+@@ -6000,7 +6011,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
+ SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
+ SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
+- SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
++ SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
+ SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
+ SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
+ SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
+@@ -6171,6 +6182,7 @@ static const struct hda_model_fixup alc2
+ {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
+ {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
+ {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
++ {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
+ {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
+ {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
+ {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
diff --git a/patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-840- b/patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-840-
new file mode 100644
index 0000000000..e2333eb22b
--- /dev/null
+++ b/patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-840-
@@ -0,0 +1,59 @@
+From cc3a47a248d7791ef0d2c81a35c46769e55e4c6c Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Thu, 9 Mar 2017 13:30:09 +0100
+Subject: [PATCH] ALSA: hda - add support for docking station for HP 840 G3
+Git-commit: cc3a47a248d7791ef0d2c81a35c46769e55e4c6c
+Patch-mainline: 4.11-rc4
+References: bsc#1031717
+
+This tested patch adds missing initialization for Line-In/Out PINs for
+the docking station for HP 840 G3.
+
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_conexant.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -261,6 +261,7 @@ enum {
+ CXT_FIXUP_HP_530,
+ CXT_FIXUP_CAP_MIX_AMP_5047,
+ CXT_FIXUP_MUTE_LED_EAPD,
++ CXT_FIXUP_HP_DOCK,
+ CXT_FIXUP_HP_SPECTRE,
+ CXT_FIXUP_HP_GATE_MIC,
+ };
+@@ -778,6 +779,14 @@ static const struct hda_fixup cxt_fixups
+ .type = HDA_FIXUP_FUNC,
+ .v.func = cxt_fixup_mute_led_eapd,
+ },
++ [CXT_FIXUP_HP_DOCK] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x16, 0x21011020 }, /* line-out */
++ { 0x18, 0x2181103f }, /* line-in */
++ { }
++ }
++ },
+ [CXT_FIXUP_HP_SPECTRE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -839,6 +848,7 @@ static const struct snd_pci_quirk cxt506
+ SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC),
+ SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC),
++ SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
+ SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
+ SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
+ SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
+@@ -872,6 +882,7 @@ static const struct hda_model_fixup cxt5
+ { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
+ { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
+ { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
++ { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
+ {}
+ };
+
diff --git a/patches.drivers/ALSA-hda-change-the-location-for-one-mic-on-a-Lenovo b/patches.drivers/ALSA-hda-change-the-location-for-one-mic-on-a-Lenovo
new file mode 100644
index 0000000000..16d9d02b30
--- /dev/null
+++ b/patches.drivers/ALSA-hda-change-the-location-for-one-mic-on-a-Lenovo
@@ -0,0 +1,31 @@
+From 8da5bbfc7cbba909f4f32d5e1dda3750baa5d853 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Fri, 22 Dec 2017 11:17:46 +0800
+Subject: [PATCH] ALSA: hda - change the location for one mic on a Lenovo machine
+Git-commit: 8da5bbfc7cbba909f4f32d5e1dda3750baa5d853
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+There are two front mics on this machine, and current driver assign
+the same name Mic to both of them, but pulseaudio can't handle them.
+As a workaround, we change the location for one of them, then the
+driver will assign "Front Mic" and "Mic" for them.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6223,6 +6223,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
++ SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
+ SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+ SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
diff --git a/patches.drivers/ALSA-hda-fix-headset-mic-detection-issue-on-a-Dell-m b/patches.drivers/ALSA-hda-fix-headset-mic-detection-issue-on-a-Dell-m
new file mode 100644
index 0000000000..e974d46321
--- /dev/null
+++ b/patches.drivers/ALSA-hda-fix-headset-mic-detection-issue-on-a-Dell-m
@@ -0,0 +1,33 @@
+From 285d5ddcffafa5d5e68c586f4c9eaa8b24a2897d Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Fri, 22 Dec 2017 11:17:45 +0800
+Subject: [PATCH] ALSA: hda - fix headset mic detection issue on a Dell machine
+Git-commit: 285d5ddcffafa5d5e68c586f4c9eaa8b24a2897d
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+It has the codec alc256, and add its pin definition to pin quirk
+table to let it apply ALC255_FIXUP_DELL1_MIC_NO_PRESENCE.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6446,6 +6446,11 @@ static const struct snd_hda_pin_quirk al
+ {0x1b, 0x01011020},
+ {0x21, 0x02211010}),
+ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
++ {0x12, 0x90a60130},
++ {0x14, 0x90170110},
++ {0x1b, 0x01011020},
++ {0x21, 0x0221101f}),
++ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ {0x12, 0x90a60160},
+ {0x14, 0x90170120},
+ {0x21, 0x02211030}),
diff --git a/patches.drivers/ALSA-hda-realtek-ALC891-headset-mode-for-Dell b/patches.drivers/ALSA-hda-realtek-ALC891-headset-mode-for-Dell
new file mode 100644
index 0000000000..3eac37bafc
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-ALC891-headset-mode-for-Dell
@@ -0,0 +1,124 @@
+From 78f4f7c2341f1cf510152ad494108850fec1ae39 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 7 Jun 2016 11:31:34 +0800
+Subject: [PATCH] ALSA: hda/realtek - ALC891 headset mode for Dell
+Git-commit: 78f4f7c2341f1cf510152ad494108850fec1ae39
+Patch-mainline: 4.8-rc1
+References: bsc#1031717
+
+New headset mode of ALC891 for Dell.
+This patch is supported Dell headset mode for ALC891.
+It is only support I-phone type headset.
+I think this function is only support for DELL.
+This patch is test passed by Ubuntu team.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 38 +++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 37 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3920,6 +3920,9 @@ static void alc_headset_mode_unplugged(s
+ case 0x10ec0299:
+ alc_process_coef_fw(codec, coef0225);
+ break;
++ case 0x10ec0867:
++ alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
++ break;
+ }
+ codec_dbg(codec, "Headset jack set to unplugged mode.\n");
+ }
+@@ -4021,6 +4024,9 @@ static void alc_headset_mode_mic_in(stru
+ alc_process_coef_fw(codec, coef0293);
+ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+ break;
++ case 0x10ec0867:
++ alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
++ /* fallthru */
+ case 0x10ec0221:
+ case 0x10ec0662:
+ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+@@ -4138,6 +4144,9 @@ static void alc_headset_mode_default(str
+ case 0x10ec0668:
+ alc_process_coef_fw(codec, coef0688);
+ break;
++ case 0x10ec0867:
++ alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
++ break;
+ }
+ codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
+ }
+@@ -4253,6 +4262,9 @@ static void alc_headset_mode_ctia(struct
+ else
+ alc_process_coef_fw(codec, coef0225_1);
+ break;
++ case 0x10ec0867:
++ alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
++ break;
+ }
+ codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
+ }
+@@ -4498,6 +4510,9 @@ static void alc_determine_headset_type(s
+ alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
+ alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
+ break;
++ case 0x10ec0867:
++ is_ctia = true;
++ break;
+ }
+
+ codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
+@@ -7004,6 +7019,8 @@ enum {
+ ALC668_FIXUP_DELL_XPS13,
+ ALC662_FIXUP_ASUS_Nx50,
+ ALC668_FIXUP_ASUS_Nx51,
++ ALC891_FIXUP_HEADSET_MODE,
++ ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
+ };
+
+ static const struct hda_fixup alc662_fixups[] = {
+@@ -7259,6 +7276,20 @@ static const struct hda_fixup alc662_fix
+ .chained = true,
+ .chain_id = ALC662_FIXUP_BASS_CHMAP,
+ },
++ [ALC891_FIXUP_HEADSET_MODE] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc_fixup_headset_mode,
++ },
++ [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
++ { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC891_FIXUP_HEADSET_MODE
++ },
+ };
+
+ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
+@@ -7376,6 +7407,11 @@ static const struct hda_model_fixup alc6
+ };
+
+ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
++ SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
++ {0x17, 0x02211010},
++ {0x18, 0x01a19030},
++ {0x1a, 0x01813040},
++ {0x21, 0x01014020}),
+ SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
+ {0x14, 0x01014010},
+ {0x18, 0x01a19020},
+@@ -7569,7 +7605,7 @@ static const struct hda_device_id snd_hd
+ HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
+- HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc882),
++ HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
+ HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
+ HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
+ HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
diff --git a/patches.drivers/ALSA-hda-realtek-Add-ALC256-HP-depop-function b/patches.drivers/ALSA-hda-realtek-Add-ALC256-HP-depop-function
new file mode 100644
index 0000000000..3344d731f3
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-ALC256-HP-depop-function
@@ -0,0 +1,105 @@
+From 4a219ef8f37071ce0993959fe52ffa5034689f42 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 16 Jun 2017 16:54:35 +0800
+Subject: [PATCH] ALSA: hda/realtek - Add ALC256 HP depop function
+Git-commit: 4a219ef8f37071ce0993959fe52ffa5034689f42
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+Add this functions, it could support ALC256 for HP depop functions.
+It also can solve some ALC256 machine plug headset cause power
+off issue.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 70 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 70 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3019,6 +3019,74 @@ static void alc283_shutup(struct hda_cod
+ alc_write_coef_idx(codec, 0x43, 0x9614);
+ }
+
++static void alc256_init(struct hda_codec *codec)
++{
++ struct alc_spec *spec = codec->spec;
++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
++ bool hp_pin_sense;
++
++ if (!hp_pin)
++ return;
++
++ msleep(30);
++
++ hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++
++ if (hp_pin_sense)
++ msleep(2);
++
++ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++ if (hp_pin_sense)
++ msleep(85);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++
++ if (hp_pin_sense)
++ msleep(100);
++
++ alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
++ alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
++}
++
++static void alc256_shutup(struct hda_codec *codec)
++{
++ struct alc_spec *spec = codec->spec;
++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
++ bool hp_pin_sense;
++
++ if (!hp_pin) {
++ alc269_shutup(codec);
++ return;
++ }
++
++ hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++
++ if (hp_pin_sense)
++ msleep(2);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++ if (hp_pin_sense)
++ msleep(85);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++
++ alc_update_coef_idx(codec, 0x46, 0, 3 << 12); /* 3k pull low control for Headset jack. */
++
++ if (hp_pin_sense)
++ msleep(100);
++
++ alc_auto_setup_eapd(codec, false);
++ snd_hda_shutup_pins(codec);
++}
++
+ static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
+ unsigned int val)
+ {
+@@ -6291,6 +6359,8 @@ static int patch_alc269(struct hda_codec
+ case 0x10ec0236:
+ case 0x10ec0256:
+ spec->codec_variant = ALC269_TYPE_ALC256;
++ spec->shutup = alc256_shutup;
++ spec->init_hook = alc256_init;
+ spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
+ alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
+ break;
diff --git a/patches.drivers/ALSA-hda-realtek-Add-default-procedure-for-suspend-a b/patches.drivers/ALSA-hda-realtek-Add-default-procedure-for-suspend-a
new file mode 100644
index 0000000000..895eb6fda7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-default-procedure-for-suspend-a
@@ -0,0 +1,110 @@
+From c2d6af53a43fd8bb528eac8f31ffb666e9c74cf7 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 21 Jun 2017 14:50:54 +0800
+Subject: [PATCH] ALSA: hda/realtek - Add default procedure for suspend and resume state
+Git-commit: c2d6af53a43fd8bb528eac8f31ffb666e9c74cf7
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+Except ALC269.
+This will reduce pop noise from headset or headphone.
+If codec enter to power save state, when plug headset or headphone....
+It has a chance to cut off power by system.
+Our new codec use this procedure will be more stable during suspend
+and resume state.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 65 +++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 64 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3087,6 +3087,67 @@ static void alc256_shutup(struct hda_cod
+ snd_hda_shutup_pins(codec);
+ }
+
++static void alc_default_init(struct hda_codec *codec)
++{
++ struct alc_spec *spec = codec->spec;
++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
++ bool hp_pin_sense;
++
++ if (!hp_pin)
++ return;
++
++ msleep(30);
++
++ hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++
++ if (hp_pin_sense)
++ msleep(2);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++ if (hp_pin_sense)
++ msleep(85);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++
++ if (hp_pin_sense)
++ msleep(100);
++}
++
++static void alc_default_shutup(struct hda_codec *codec)
++{
++ struct alc_spec *spec = codec->spec;
++ hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
++ bool hp_pin_sense;
++
++ if (!hp_pin) {
++ alc269_shutup(codec);
++ return;
++ }
++
++ hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++
++ if (hp_pin_sense)
++ msleep(2);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++ if (hp_pin_sense)
++ msleep(85);
++
++ snd_hda_codec_write(codec, hp_pin, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++
++ if (hp_pin_sense)
++ msleep(100);
++
++ alc_auto_setup_eapd(codec, false);
++ snd_hda_shutup_pins(codec);
++}
++
+ static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
+ unsigned int val)
+ {
+@@ -6279,7 +6340,8 @@ static int patch_alc269(struct hda_codec
+ codec->patch_ops.suspend = alc269_suspend;
+ codec->patch_ops.resume = alc269_resume;
+ #endif
+- spec->shutup = alc269_shutup;
++ spec->shutup = alc_default_shutup;
++ spec->init_hook = alc_default_init;
+
+ snd_hda_pick_fixup(codec, alc269_fixup_models,
+ alc269_fixup_tbl, alc269_fixups);
+@@ -6319,6 +6381,7 @@ static int patch_alc269(struct hda_codec
+ }
+ if (err < 0)
+ goto error;
++ spec->shutup = alc269_shutup;
+ spec->init_hook = alc269_fill_coef;
+ alc269_fill_coef(codec);
+ break;
diff --git a/patches.drivers/ALSA-hda-realtek-Add-support-for-ALC1220 b/patches.drivers/ALSA-hda-realtek-Add-support-for-ALC1220
new file mode 100644
index 0000000000..26d436e03a
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-support-for-ALC1220
@@ -0,0 +1,74 @@
+From 0202f5cd9aab127355f6b1de74058a670424d48a Mon Sep 17 00:00:00 2001
+From: Peisen <pshou@realtek.com>
+Date: Thu, 26 Oct 2017 10:35:36 +0800
+Subject: [PATCH] ALSA: hda/realtek - Add support for ALC1220
+Git-commit: 0202f5cd9aab127355f6b1de74058a670424d48a
+Patch-mainline: 4.15-rc1
+References: bsc#1031717
+
+Add Clevo-P51 mode support for ALC1220.
+ALC1220 Clevo-p51
+Speaker uses I2S output.
+We therefore want to make sure 0x14 (Headphones) and 0x1b (Speakers)
+use to stereo DAC 0x02.
+
+Signed-off-by: Peisen Hou <pshou@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -1807,6 +1807,7 @@ enum {
+ ALC882_FIXUP_NO_PRIMARY_HP,
+ ALC887_FIXUP_ASUS_BASS,
+ ALC887_FIXUP_BASS_CHMAP,
++ ALC1220_FIXUP_CLEVO_P950,
+ };
+
+ static void alc889_fixup_coef(struct hda_codec *codec,
+@@ -1969,6 +1970,23 @@ static void alc882_fixup_no_primary_hp(s
+ static void alc_fixup_bass_chmap(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action);
+
++static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
++ const struct hda_fixup *fix,
++ int action)
++{
++ hda_nid_t conn1[1] = { 0x0c };
++
++ if (action != HDA_FIXUP_ACT_PRE_PROBE)
++ return;
++
++ alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
++ /* We therefore want to make sure 0x14 (front headphone) and
++ * 0x1b (speakers) use the stereo DAC 0x02
++ */
++ snd_hda_override_conn_list(codec, 0x14, 1, conn1);
++ snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
++}
++
+ static const struct hda_fixup alc882_fixups[] = {
+ [ALC882_FIXUP_ABIT_AW9D_MAX] = {
+ .type = HDA_FIXUP_PINS,
+@@ -2205,6 +2223,10 @@ static const struct hda_fixup alc882_fix
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc_fixup_bass_chmap,
+ },
++ [ALC1220_FIXUP_CLEVO_P950] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc1220_fixup_clevo_p950,
++ },
+ };
+
+ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
+@@ -2276,6 +2298,7 @@ static const struct snd_pci_quirk alc882
+ SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
+ SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
+ SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
++ SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
+ SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
+ SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
+ SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
diff --git a/patches.drivers/ALSA-hda-realtek-Add-support-for-Acer-Aspire-E5-475- b/patches.drivers/ALSA-hda-realtek-Add-support-for-Acer-Aspire-E5-475-
new file mode 100644
index 0000000000..2eb57b00ba
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-support-for-Acer-Aspire-E5-475-
@@ -0,0 +1,56 @@
+From 5824ce8de7b1c0a75e5942e4df4652d04f3e263d Mon Sep 17 00:00:00 2001
+From: Chris Chiu <chiu@endlessm.com>
+Date: Tue, 28 Feb 2017 14:17:11 -0600
+Subject: [PATCH] ALSA: hda/realtek - Add support for Acer Aspire E5-475 headset mic
+Git-commit: 5824ce8de7b1c0a75e5942e4df4652d04f3e263d
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+The Acer laptop Aspire E5-475 with ALC255 can't detect the headset
+microphone until we modify a pin definition.
+
+Signed-off-by: Chris Chiu <chiu@endlessm.com>
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5155,6 +5155,7 @@ enum {
+ ALC290_FIXUP_SUBWOOFER_HSJACK,
+ ALC269_FIXUP_THINKPAD_ACPI,
+ ALC269_FIXUP_DMIC_THINKPAD_ACPI,
++ ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
+ ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
+ ALC255_FIXUP_HEADSET_MODE,
+@@ -5617,6 +5618,15 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
+ },
++ [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC255_FIXUP_HEADSET_MODE
++ },
+ [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -6184,6 +6194,10 @@ static const struct hda_model_fixup alc2
+ {0x21, 0x03211020}
+
+ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
++ {0x12, 0x90a601c0},
++ {0x14, 0x90171120},
++ {0x21, 0x02211030}),
+ SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC225_STANDARD_PINS,
+ {0x12, 0xb7a60130},
diff --git a/patches.drivers/ALSA-hda-realtek-Add-support-for-headset-MIC-for-ALC b/patches.drivers/ALSA-hda-realtek-Add-support-for-headset-MIC-for-ALC
new file mode 100644
index 0000000000..40671aeb7f
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Add-support-for-headset-MIC-for-ALC
@@ -0,0 +1,89 @@
+From c6790c8e770c6a7a5414e42438705ec92b03a790 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 25 Nov 2016 16:15:17 +0800
+Subject: [PATCH] ALSA: hda/realtek - Add support for headset MIC for ALC622
+Git-commit: c6790c8e770c6a7a5414e42438705ec92b03a790
+Patch-mainline: 4.10-rc1
+References: bsc#1031717
+
+Add headset MIC support for ALC622 of USI platform.
+It only support headset of iphone type.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 41 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7174,6 +7174,30 @@ static void alc662_fixup_led_gpio1(struc
+ }
+ }
+
++static void alc662_usi_automute_hook(struct hda_codec *codec,
++ struct hda_jack_callback *jack)
++{
++ struct alc_spec *spec = codec->spec;
++ int vref;
++ msleep(200);
++ snd_hda_gen_hp_automute(codec, jack);
++
++ vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
++ msleep(100);
++ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
++ vref);
++}
++
++static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ struct alc_spec *spec = codec->spec;
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
++ spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
++ spec->gen.hp_automute_hook = alc662_usi_automute_hook;
++ }
++}
++
+ static struct coef_fw alc668_coefs[] = {
+ WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
+ WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
+@@ -7237,6 +7261,8 @@ enum {
+ ALC668_FIXUP_ASUS_Nx51,
+ ALC891_FIXUP_HEADSET_MODE,
+ ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
++ ALC662_FIXUP_USI_FUNC,
++ ALC662_FIXUP_USI_HEADSET_MODE,
+ };
+
+ static const struct hda_fixup alc662_fixups[] = {
+@@ -7506,6 +7532,20 @@ static const struct hda_fixup alc662_fix
+ .chained = true,
+ .chain_id = ALC891_FIXUP_HEADSET_MODE
+ },
++ [ALC662_FIXUP_USI_FUNC] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc662_fixup_usi_headset_mic,
++ },
++ [ALC662_FIXUP_USI_HEADSET_MODE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
++ { 0x18, 0x01a1903d },
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC662_FIXUP_USI_FUNC
++ },
+ };
+
+ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
+@@ -7542,6 +7582,7 @@ static const struct snd_pci_quirk alc662
+ SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
+ SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
+ SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
++ SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
+ SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
+ SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
+ SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
diff --git a/patches.drivers/ALSA-hda-realtek-Enable-jack-detection-function-for- b/patches.drivers/ALSA-hda-realtek-Enable-jack-detection-function-for-
new file mode 100644
index 0000000000..e105b6fd03
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Enable-jack-detection-function-for-
@@ -0,0 +1,59 @@
+From b84e843644f211dbddcd65ba80732bdc3acf5380 Mon Sep 17 00:00:00 2001
+From: PeiSen Hou <pshou@realtek.com>
+Date: Fri, 1 Sep 2017 15:11:56 +0800
+Subject: [PATCH] ALSA: hda/realtek - Enable jack detection function for Intel ALC700
+Git-commit: b84e843644f211dbddcd65ba80732bdc3acf5380
+Patch-mainline: 4.14-rc1
+References: bsc#1031717
+
+Intel ALC 700 needs this patch for jack detection function.
+Because ALC700's jack detect function defaults is disable.
+So alc700 needs pathc to enable jack detection function.
+
+Signed-off-by: PeiSen Hou <pshou@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5202,6 +5202,7 @@ enum {
+ ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
+ ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
+ ALC294_FIXUP_LENOVO_MIC_LOCATION,
++ ALC700_FIXUP_INTEL_REFERENCE,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -5991,6 +5992,21 @@ static const struct hda_fixup alc269_fix
+ { }
+ },
+ },
++ [ALC700_FIXUP_INTEL_REFERENCE] = {
++ .type = HDA_FIXUP_VERBS,
++ .v.verbs = (const struct hda_verb[]) {
++ /* Enables internal speaker */
++ {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
++ {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
++ {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
++ {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
++ {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
++ {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
++ {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
++ {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
++ {}
++ }
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6141,6 +6157,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
+ SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
+ SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
++ SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
+ SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
+ SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
+ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-ALC275-no-sound-issue b/patches.drivers/ALSA-hda-realtek-Fix-ALC275-no-sound-issue
new file mode 100644
index 0000000000..10164edade
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-ALC275-no-sound-issue
@@ -0,0 +1,35 @@
+From 3aabf94c2d95fe465d5fa8590113d1c1f7d8333d Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 8 Nov 2017 15:28:33 +0800
+Subject: [PATCH] ALSA: hda/realtek - Fix ALC275 no sound issue
+Git-commit: 3aabf94c2d95fe465d5fa8590113d1c1f7d8333d
+Patch-mainline: 4.15-rc1
+References: bsc#1031717
+
+Sound works after a cold boot but not after a reboot from windows.
+This patch will solve this issue. This is relation with Class-D power control.
+
+[ The bug was reported in Bugzilla below for Sony VAIO SVS13A1C5E
+ -- tiwai]
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197737
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -347,6 +347,9 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0289:
+ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
+ break;
++ case 0x10ec0275:
++ alc_update_coef_idx(codec, 0xe, 0, 1<<0);
++ break;
+ case 0x10ec0293:
+ alc_update_coef_idx(codec, 0xa, 1<<13, 0);
+ break;
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-Dell-AIO-LineOut-issue b/patches.drivers/ALSA-hda-realtek-Fix-Dell-AIO-LineOut-issue
new file mode 100644
index 0000000000..b671b4d562
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-Dell-AIO-LineOut-issue
@@ -0,0 +1,97 @@
+From 9226665159f0367ad08bc7d5dd194aeadb90316f Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Thu, 14 Dec 2017 15:28:58 +0800
+Subject: [PATCH] ALSA: hda/realtek - Fix Dell AIO LineOut issue
+Git-commit: 9226665159f0367ad08bc7d5dd194aeadb90316f
+Patch-mainline: 4.15-rc5
+References: bsc#1031717
+
+Dell AIO had LineOut jack.
+Add LineOut verb into this patch.
+
+[ Additional notes:
+ the ALC274 codec seems requiring the fixed pin / DAC connections for
+ HP / line-out pins for enabling EQ for speakers; i.e. the HP / LO
+ pins expect to be connected with NID 0x03 while keeping the speaker
+ with NID 0x02. However, by adding a new line-out pin, the
+ auto-parser assigns the NID 0x02 for HP/LO pins as primary outputs.
+ As an easy workaround, we provide the preferred_pairs[] to map
+ forcibly for these pins. -- tiwai ]
+
+Fixes: 75ee94b20b46 ("ALSA: hda - fix headset mic problem for Dell machines with alc274")
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 38 ++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 38 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5087,6 +5087,22 @@ static void alc280_fixup_hp_9480m(struct
+ }
+ }
+
++/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
++static void alc274_fixup_bind_dacs(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ struct alc_spec *spec = codec->spec;
++ static hda_nid_t preferred_pairs[] = {
++ 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
++ 0
++ };
++
++ if (action != HDA_FIXUP_ACT_PRE_PROBE)
++ return;
++
++ spec->gen.preferred_dacs = preferred_pairs;
++}
++
+ /* for hda_fixup_thinkpad_acpi() */
+ #include "thinkpad_helper.c"
+
+@@ -5203,6 +5219,8 @@ enum {
+ ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
+ ALC294_FIXUP_LENOVO_MIC_LOCATION,
+ ALC700_FIXUP_INTEL_REFERENCE,
++ ALC274_FIXUP_DELL_BIND_DACS,
++ ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -6009,6 +6027,21 @@ static const struct hda_fixup alc269_fix
+ {}
+ }
+ },
++ [ALC274_FIXUP_DELL_BIND_DACS] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc274_fixup_bind_dacs,
++ .chained = true,
++ .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
++ },
++ [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x1b, 0x0401102f },
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC274_FIXUP_DELL_BIND_DACS
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6476,6 +6509,11 @@ static const struct snd_hda_pin_quirk al
+ {0x14, 0x90170110},
+ {0x1b, 0x90a70130},
+ {0x21, 0x03211020}),
++ SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
++ {0x12, 0xb7a60130},
++ {0x13, 0xb8a61140},
++ {0x16, 0x90170110},
++ {0x21, 0x04211020}),
+ SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
+ {0x12, 0x90a60130},
+ {0x14, 0x90170110},
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-headset-and-mic-on-several-Asus b/patches.drivers/ALSA-hda-realtek-Fix-headset-and-mic-on-several-Asus
new file mode 100644
index 0000000000..bdb45dd6af
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-headset-and-mic-on-several-Asus
@@ -0,0 +1,101 @@
+From c1732ede5e8008324f908861077b50f4ca55701d Mon Sep 17 00:00:00 2001
+From: Chris Chiu <chiu@endlessm.com>
+Date: Tue, 28 Feb 2017 14:17:13 -0600
+Subject: [PATCH] ALSA: hda/realtek - Fix headset and mic on several Asus laptops with ALC256
+Mime-version: 1.0
+Content-type: text/plain; charset=UTF-8
+Content-transfer-encoding: 8bit
+Git-commit: c1732ede5e8008324f908861077b50f4ca55701d
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+Enable jack sensing and fix internal mic and headset mic on
+Asus X555UB and X540SA.
+
+Fix internal mic and headset mic on Asus E402NA and E403NA.
+
+Fix headset mic on Asus X541UV, X541SA and Z550SA.
+
+Unfortunately jack sensing for the headset mic is still not working.
+We believe this is a codec limitation.
+
+Some of these quirks were authored by João Paulo Rechi Vita.
+
+Signed-off-by: Chris Chiu <chiu@endlessm.com>
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5196,6 +5196,8 @@ enum {
+ ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
+ ALC269_FIXUP_ATIV_BOOK_8,
+ ALC221_FIXUP_HP_MIC_NO_PRESENCE,
++ ALC256_FIXUP_ASUS_HEADSET_MODE,
++ ALC256_FIXUP_ASUS_MIC,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -5929,6 +5931,20 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC269_FIXUP_HEADSET_MODE
+ },
++ [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc_fixup_headset_mode,
++ },
++ [ALC256_FIXUP_ASUS_MIC] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x13, 0x90a60160 }, /* use as internal mic */
++ { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6042,9 +6058,14 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
+ SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
+ SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
++ SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
++ SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
++ SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
++ SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
+ SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
+ SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+@@ -6054,6 +6075,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
+@@ -6372,6 +6394,14 @@ static const struct snd_hda_pin_quirk al
+ {0x21, 0x02211020}),
+ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC256_STANDARD_PINS),
++ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
++ {0x14, 0x90170110},
++ {0x1b, 0x90a70130},
++ {0x21, 0x04211020}),
++ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
++ {0x14, 0x90170110},
++ {0x1b, 0x90a70130},
++ {0x21, 0x03211020}),
+ SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
+ {0x12, 0x90a60130},
+ {0x14, 0x90170110},
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-headset-mic-and-speaker-on-Asus b/patches.drivers/ALSA-hda-realtek-Fix-headset-mic-and-speaker-on-Asus
new file mode 100644
index 0000000000..ae5e4fcf03
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-headset-mic-and-speaker-on-Asus
@@ -0,0 +1,69 @@
+From 216d7aebbfbe1d3361e21c3a97d1607e1c1c48cd Mon Sep 17 00:00:00 2001
+From: Chris Chiu <chiu@endlessm.com>
+Date: Tue, 28 Feb 2017 14:17:14 -0600
+Subject: [PATCH] ALSA: hda/realtek - Fix headset mic and speaker on Asus X441SA/X441UV
+Git-commit: 216d7aebbfbe1d3361e21c3a97d1607e1c1c48cd
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+ASUS X441SA and X441UV laptops with ALC3236 (ALC223) codec require
+the known fixup (ALC269_FIXUP_HEADSET_MIC) and a different pin value on
+pin 0x19 to make the headset mic work.
+
+To make the speaker work, it requires an EAPD verb fixup.
+
+Signed-off-by: Chris Chiu <chiu@endlessm.com>
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5198,6 +5198,8 @@ enum {
+ ALC221_FIXUP_HP_MIC_NO_PRESENCE,
+ ALC256_FIXUP_ASUS_HEADSET_MODE,
+ ALC256_FIXUP_ASUS_MIC,
++ ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
++ ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -5945,6 +5947,26 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
+ },
++ [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC269_FIXUP_HEADSET_MIC
++ },
++ [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_VERBS,
++ .v.verbs = (const struct hda_verb[]) {
++ /* Enables internal speaker */
++ {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
++ {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
++ {}
++ },
++ .chained = true,
++ .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6075,6 +6097,8 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-headset-mic-on-several-Asus-lap b/patches.drivers/ALSA-hda-realtek-Fix-headset-mic-on-several-Asus-lap
new file mode 100644
index 0000000000..9e777b4605
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-headset-mic-on-several-Asus-lap
@@ -0,0 +1,70 @@
+From 615966adc4b616dbc2f67ec2c44c25034d458cd9 Mon Sep 17 00:00:00 2001
+From: Chris Chiu <chiu@endlessm.com>
+Date: Tue, 28 Feb 2017 14:17:12 -0600
+Subject: [PATCH] ALSA: hda/realtek - Fix headset mic on several Asus laptops with ALC255
+Git-commit: 615966adc4b616dbc2f67ec2c44c25034d458cd9
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+Add pin quirks to enable use of the headset mic on Asus Z550MA,
+X540LA, X540LJ, X556UR, Z450LA, and X441NC.
+
+Signed-off-by: Chris Chiu <chiu@endlessm.com>
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5156,6 +5156,7 @@ enum {
+ ALC269_FIXUP_THINKPAD_ACPI,
+ ALC269_FIXUP_DMIC_THINKPAD_ACPI,
+ ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
++ ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
+ ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
+ ALC255_FIXUP_HEADSET_MODE,
+@@ -5627,6 +5628,15 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC255_FIXUP_HEADSET_MODE
+ },
++ [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC255_FIXUP_HEADSET_MODE
++ },
+ [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -6023,6 +6033,9 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
+ SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
++ SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
+@@ -6198,6 +6211,14 @@ static const struct snd_hda_pin_quirk al
+ {0x12, 0x90a601c0},
+ {0x14, 0x90171120},
+ {0x21, 0x02211030}),
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
++ {0x14, 0x90170110},
++ {0x1b, 0x90a70130},
++ {0x21, 0x03211020}),
++ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
++ {0x1a, 0x90a70130},
++ {0x1b, 0x90170110},
++ {0x21, 0x03211020}),
+ SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC225_STANDARD_PINS,
+ {0x12, 0xb7a60130},
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-pincfg-for-Dell-XPS-13-9370 b/patches.drivers/ALSA-hda-realtek-Fix-pincfg-for-Dell-XPS-13-9370
new file mode 100644
index 0000000000..1a5ae305d1
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-pincfg-for-Dell-XPS-13-9370
@@ -0,0 +1,59 @@
+From 8df4b0031067758d8b0a3bfde7d35e980d0376d5 Mon Sep 17 00:00:00 2001
+From: "Shih-Yuan Lee (FourDollars)" <sylee@canonical.com>
+Date: Mon, 14 Aug 2017 18:00:47 +0800
+Subject: [PATCH] ALSA: hda/realtek - Fix pincfg for Dell XPS 13 9370
+Git-commit: 8df4b0031067758d8b0a3bfde7d35e980d0376d5
+Patch-mainline: 4.13-rc6
+References: bsc#1031717
+
+The initial pin configs for Dell headset mode of ALC3271 has changed.
+
+/sys/class/sound/hwc0d0/init_pin_configs: (BIOS 0.1.4)
+0x12 0xb7a60130
+0x13 0xb8a61140
+0x14 0x40000000
+0x16 0x411111f0
+0x17 0x90170110
+0x18 0x411111f0
+0x19 0x411111f0
+0x1a 0x411111f0
+0x1b 0x411111f0
+0x1d 0x4087992d
+0x1e 0x411111f0
+0x21 0x04211020
+
+has changed to ...
+
+/sys/class/sound/hwc0d0/init_pin_configs: (BIOS 0.2.0)
+0x12 0xb7a60130
+0x13 0x40000000
+0x14 0x411111f0
+0x16 0x411111f0
+0x17 0x90170110
+0x18 0x411111f0
+0x19 0x411111f0
+0x1a 0x411111f0
+0x1b 0x411111f0
+0x1d 0x4067992d
+0x1e 0x411111f0
+0x21 0x04211020
+
+Fixes: b4576de87243 ("ALSA: hda/realtek - Fix typo of pincfg for Dell quirk")
+Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6613,7 +6613,6 @@ static const struct snd_hda_pin_quirk al
+ SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
+ ALC225_STANDARD_PINS,
+ {0x12, 0xb7a60130},
+- {0x13, 0xb8a60140},
+ {0x17, 0x90170110}),
+ {}
+ };
diff --git a/patches.drivers/ALSA-hda-realtek-Fix-speaker-support-for-Asus-AiO-ZN b/patches.drivers/ALSA-hda-realtek-Fix-speaker-support-for-Asus-AiO-ZN
new file mode 100644
index 0000000000..e732fd1626
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Fix-speaker-support-for-Asus-AiO-ZN
@@ -0,0 +1,55 @@
+From eeed4cd15ae0a8d3f2751adae8b56a3571e8aeca Mon Sep 17 00:00:00 2001
+From: Chris Chiu <chiu@endlessm.com>
+Date: Tue, 28 Feb 2017 14:17:15 -0600
+Subject: [PATCH] ALSA: hda/realtek - Fix speaker support for Asus AiO ZN270IE
+Git-commit: eeed4cd15ae0a8d3f2751adae8b56a3571e8aeca
+Patch-mainline: 4.12-rc1
+References: bsc#1031717
+
+Asus AiO ZN270IE with ALC256 has no audio ouput for internal speaker
+and headphone. It requires GPIO 2 as an amp. This commit enables the
+GPIO and pulls it high.
+
+Signed-off-by: Chris Chiu <chiu@endlessm.com>
+Signed-off-by: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5198,6 +5198,7 @@ enum {
+ ALC221_FIXUP_HP_MIC_NO_PRESENCE,
+ ALC256_FIXUP_ASUS_HEADSET_MODE,
+ ALC256_FIXUP_ASUS_MIC,
++ ALC256_FIXUP_ASUS_AIO_GPIO2,
+ ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
+ ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
+ };
+@@ -5947,6 +5948,16 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
+ },
++ [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
++ .type = HDA_FIXUP_VERBS,
++ .v.verbs = (const struct hda_verb[]) {
++ /* Set up GPIO2 for the speaker amp */
++ { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
++ { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
++ { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
++ {}
++ },
++ },
+ [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -6100,6 +6111,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
++ SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
+ SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
diff --git a/patches.drivers/ALSA-hda-realtek-New-codec-device-ID-for-ALC1220 b/patches.drivers/ALSA-hda-realtek-New-codec-device-ID-for-ALC1220
new file mode 100644
index 0000000000..fa0fec46ae
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-New-codec-device-ID-for-ALC1220
@@ -0,0 +1,36 @@
+From 65553b12e8fd3730b07e486c15dd6574563ddc58 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 11 Jul 2017 15:15:47 +0800
+Subject: [PATCH] ALSA: hda/realtek - New codec device ID for ALC1220
+Git-commit: 65553b12e8fd3730b07e486c15dd6574563ddc58
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+Codec ID is 0x1168.
+It is another ALC1220 codec.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -385,6 +385,7 @@ static void alc_fill_eapd_coef(struct hd
+ break;
+ case 0x10ec0899:
+ case 0x10ec0900:
++ case 0x10ec1168:
+ case 0x10ec1220:
+ alc_update_coef_idx(codec, 0x7, 1<<1, 0);
+ break;
+@@ -7268,6 +7269,7 @@ static const struct hda_device_id snd_hd
+ HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
+ HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
+ HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
++ HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
+ HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
+ {} /* terminator */
+ };
diff --git a/patches.drivers/ALSA-hda-realtek-New-codec-support-for-ALC257 b/patches.drivers/ALSA-hda-realtek-New-codec-support-for-ALC257
new file mode 100644
index 0000000000..098575f0ce
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-New-codec-support-for-ALC257
@@ -0,0 +1,66 @@
+From f429e7e494afaded76e62c6f98211a635aa03098 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 5 Dec 2017 15:38:24 +0800
+Subject: [PATCH] ALSA: hda/realtek - New codec support for ALC257
+Git-commit: f429e7e494afaded76e62c6f98211a635aa03098
+Patch-mainline: 4.15-rc3
+References: bsc#1031717
+
+Add new support for ALC257 codec.
+
+[ It's supposed to be almost equivalent with other ALC25x variants,
+ just adding another type and id -- tiwai ]
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -337,6 +337,7 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0236:
+ case 0x10ec0255:
+ case 0x10ec0256:
++ case 0x10ec0257:
+ case 0x10ec0282:
+ case 0x10ec0283:
+ case 0x10ec0286:
+@@ -2692,6 +2693,7 @@ enum {
+ ALC269_TYPE_ALC298,
+ ALC269_TYPE_ALC255,
+ ALC269_TYPE_ALC256,
++ ALC269_TYPE_ALC257,
+ ALC269_TYPE_ALC215,
+ ALC269_TYPE_ALC225,
+ ALC269_TYPE_ALC294,
+@@ -2725,6 +2727,7 @@ static int alc269_parse_auto_config(stru
+ case ALC269_TYPE_ALC298:
+ case ALC269_TYPE_ALC255:
+ case ALC269_TYPE_ALC256:
++ case ALC269_TYPE_ALC257:
+ case ALC269_TYPE_ALC215:
+ case ALC269_TYPE_ALC225:
+ case ALC269_TYPE_ALC294:
+@@ -6288,6 +6291,10 @@ static int patch_alc269(struct hda_codec
+ spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
+ alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
+ break;
++ case 0x10ec0257:
++ spec->codec_variant = ALC269_TYPE_ALC257;
++ spec->gen.mixer_nid = 0;
++ break;
+ case 0x10ec0215:
+ case 0x10ec0285:
+ case 0x10ec0289:
+@@ -7236,6 +7243,7 @@ static const struct hda_device_id snd_hd
+ HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
++ HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
+ HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
+ HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
diff --git a/patches.drivers/ALSA-hda-realtek-New-codec-support-of-ALC1220 b/patches.drivers/ALSA-hda-realtek-New-codec-support-of-ALC1220
new file mode 100644
index 0000000000..3bfa73bda5
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-New-codec-support-of-ALC1220
@@ -0,0 +1,44 @@
+From a535ad57d0e6b959cd79914a1127caade36a9459 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Mon, 16 Jan 2017 16:59:26 +0800
+Subject: [PATCH] ALSA: hda/realtek - New codec support of ALC1220
+Git-commit: a535ad57d0e6b959cd79914a1127caade36a9459
+Patch-mainline: 4.11-rc1
+References: bsc#1031717
+
+Add support for new codec of ALC1220.
+It's compatible with ALC882 & co.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -385,6 +385,7 @@ static void alc_fill_eapd_coef(struct hd
+ break;
+ case 0x10ec0899:
+ case 0x10ec0900:
++ case 0x10ec1220:
+ alc_update_coef_idx(codec, 0x7, 1<<1, 0);
+ break;
+ }
+@@ -2318,6 +2319,7 @@ static int patch_alc882(struct hda_codec
+ case 0x10ec0882:
+ case 0x10ec0885:
+ case 0x10ec0900:
++ case 0x10ec1220:
+ break;
+ default:
+ /* ALC883 and variants */
+@@ -7266,6 +7268,7 @@ static const struct hda_device_id snd_hd
+ HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
+ HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
+ HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
++ HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
+ {} /* terminator */
+ };
+ MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
diff --git a/patches.drivers/ALSA-hda-realtek-New-codecs-support-for-ALC215-ALC28 b/patches.drivers/ALSA-hda-realtek-New-codecs-support-for-ALC215-ALC28
new file mode 100644
index 0000000000..4aa7f56ec8
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-New-codecs-support-for-ALC215-ALC28
@@ -0,0 +1,86 @@
+From 0a6f0600efc3df0179a33188c30b5026bd9d1c27 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 30 Jun 2017 16:00:48 +0800
+Subject: [PATCH] ALSA: hda/realtek - New codecs support for ALC215/ALC285/ALC289
+Git-commit: 0a6f0600efc3df0179a33188c30b5026bd9d1c27
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+Add new codecs support for ALC215 ALC285 ALC289.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -327,6 +327,7 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0292:
+ alc_update_coef_idx(codec, 0x4, 1<<15, 0);
+ break;
++ case 0x10ec0215:
+ case 0x10ec0225:
+ case 0x10ec0233:
+ case 0x10ec0236:
+@@ -336,8 +337,10 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0283:
+ case 0x10ec0286:
+ case 0x10ec0288:
++ case 0x10ec0285:
+ case 0x10ec0295:
+ case 0x10ec0298:
++ case 0x10ec0289:
+ case 0x10ec0299:
+ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
+ break;
+@@ -2661,6 +2664,7 @@ enum {
+ ALC269_TYPE_ALC298,
+ ALC269_TYPE_ALC255,
+ ALC269_TYPE_ALC256,
++ ALC269_TYPE_ALC215,
+ ALC269_TYPE_ALC225,
+ ALC269_TYPE_ALC294,
+ ALC269_TYPE_ALC700,
+@@ -2693,6 +2697,7 @@ static int alc269_parse_auto_config(stru
+ case ALC269_TYPE_ALC298:
+ case ALC269_TYPE_ALC255:
+ case ALC269_TYPE_ALC256:
++ case ALC269_TYPE_ALC215:
+ case ALC269_TYPE_ALC225:
+ case ALC269_TYPE_ALC294:
+ case ALC269_TYPE_ALC700:
+@@ -6255,6 +6260,12 @@ static int patch_alc269(struct hda_codec
+ spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
+ alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
+ break;
++ case 0x10ec0215:
++ case 0x10ec0285:
++ case 0x10ec0289:
++ spec->codec_variant = ALC269_TYPE_ALC215;
++ spec->gen.mixer_nid = 0;
++ break;
+ case 0x10ec0225:
+ case 0x10ec0295:
+ spec->codec_variant = ALC269_TYPE_ALC225;
+@@ -7187,6 +7198,7 @@ static int patch_alc680(struct hda_codec
+ * patch entries
+ */
+ static const struct hda_device_id snd_hda_id_realtek[] = {
++ HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
+@@ -7210,8 +7222,10 @@ static const struct hda_device_id snd_hd
+ HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
++ HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
++ HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
diff --git a/patches.drivers/ALSA-hda-realtek-No-loopback-on-ALC225-ALC295-codec b/patches.drivers/ALSA-hda-realtek-No-loopback-on-ALC225-ALC295-codec
new file mode 100644
index 0000000000..9332b06a68
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-No-loopback-on-ALC225-ALC295-codec
@@ -0,0 +1,27 @@
+From e674ac9a470547ae6b9714e6bbe4960b60d148c6 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 21 Jul 2017 17:15:07 +0800
+Subject: [PATCH] ALSA: hda/realtek - No loopback on ALC225/ALC295 codec
+Git-commit: e674ac9a470547ae6b9714e6bbe4960b60d148c6
+Patch-mainline: 4.13-rc3
+References: bsc#1031717
+
+ALC225/ALC295 also have no loopback mixer.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6815,6 +6815,7 @@ static int patch_alc269(struct hda_codec
+ case 0x10ec0225:
+ case 0x10ec0295:
+ spec->codec_variant = ALC269_TYPE_ALC225;
++ spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
+ break;
+ case 0x10ec0299:
+ spec->codec_variant = ALC269_TYPE_ALC225;
diff --git a/patches.drivers/ALSA-hda-realtek-Remove-ALC285-device-ID b/patches.drivers/ALSA-hda-realtek-Remove-ALC285-device-ID
new file mode 100644
index 0000000000..8e9c5a0653
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Remove-ALC285-device-ID
@@ -0,0 +1,67 @@
+From 4731d5de4b1ca8d2565782cc3aeac392db07c075 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 30 Jun 2017 15:22:57 +0800
+Subject: [PATCH] ALSA: hda/realtek - Remove ALC285 device ID
+Git-commit: 4731d5de4b1ca8d2565782cc3aeac392db07c075
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+0x0285 Device ID was not used.
+It just assigned for alias of ALC293 as backup.
+So, remove it first.
+Because our new codec will use this device ID.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -341,7 +341,6 @@ static void alc_fill_eapd_coef(struct hd
+ case 0x10ec0299:
+ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
+ break;
+- case 0x10ec0285:
+ case 0x10ec0293:
+ alc_update_coef_idx(codec, 0xa, 1<<13, 0);
+ break;
+@@ -2657,7 +2656,7 @@ enum {
+ ALC269_TYPE_ALC282,
+ ALC269_TYPE_ALC283,
+ ALC269_TYPE_ALC284,
+- ALC269_TYPE_ALC285,
++ ALC269_TYPE_ALC293,
+ ALC269_TYPE_ALC286,
+ ALC269_TYPE_ALC298,
+ ALC269_TYPE_ALC255,
+@@ -2683,7 +2682,7 @@ static int alc269_parse_auto_config(stru
+ case ALC269_TYPE_ALC269VC:
+ case ALC269_TYPE_ALC280:
+ case ALC269_TYPE_ALC284:
+- case ALC269_TYPE_ALC285:
++ case ALC269_TYPE_ALC293:
+ ssids = alc269va_ssids;
+ break;
+ case ALC269_TYPE_ALC269VB:
+@@ -6236,9 +6235,8 @@ static int patch_alc269(struct hda_codec
+ case 0x10ec0292:
+ spec->codec_variant = ALC269_TYPE_ALC284;
+ break;
+- case 0x10ec0285:
+ case 0x10ec0293:
+- spec->codec_variant = ALC269_TYPE_ALC285;
++ spec->codec_variant = ALC269_TYPE_ALC293;
+ break;
+ case 0x10ec0286:
+ case 0x10ec0288:
+@@ -7212,7 +7210,6 @@ static const struct hda_device_id snd_hd
+ HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
+- HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
+ HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
diff --git a/patches.drivers/ALSA-hda-realtek-Support-Dell-headset-mode-for-ALC32 b/patches.drivers/ALSA-hda-realtek-Support-Dell-headset-mode-for-ALC32
new file mode 100644
index 0000000000..9773ffaba7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Support-Dell-headset-mode-for-ALC32
@@ -0,0 +1,58 @@
+From fcc6c877a01f83cbce1cca885ea62df6a10d33c3 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Thu, 29 Jun 2017 15:21:27 +0800
+Subject: [PATCH] ALSA: hda/realtek - Support Dell headset mode for ALC3271
+Git-commit: fcc6c877a01f83cbce1cca885ea62df6a10d33c3
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+Add DELL4_MIC_NO_PRESENCE model.
+Add the pin configuration value of this machine into the pin_quirk
+table to make DELL4_MIC_NO_PRESENCE apply to this machine.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5129,6 +5129,7 @@ enum {
+ ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
+ ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
++ ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
+ ALC269_FIXUP_HEADSET_MODE,
+ ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
+ ALC269_FIXUP_ASPIRE_HEADSET_MIC,
+@@ -5419,6 +5420,16 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
+ },
++ [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
++ { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
++ { }
++ },
++ .chained = true,
++ .chain_id = ALC269_FIXUP_HEADSET_MODE
++ },
+ [ALC269_FIXUP_HEADSET_MODE] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc_fixup_headset_mode,
+@@ -6439,6 +6450,11 @@ static const struct snd_hda_pin_quirk al
+ {0x17, 0x90170110},
+ {0x1a, 0x03011020},
+ {0x21, 0x03211030}),
++ SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
++ ALC225_STANDARD_PINS,
++ {0x12, 0xb7a60130},
++ {0x13, 0xb8a60140},
++ {0x17, 0x90170110}),
+ {}
+ };
+
diff --git a/patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC234-ALC b/patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC234-ALC
new file mode 100644
index 0000000000..b0c6634933
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC234-ALC
@@ -0,0 +1,164 @@
+From 71683c32dee66cdb244a25490823731db1401dce Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 20 Jun 2017 16:33:50 +0800
+Subject: [PATCH] ALSA: hda/realtek - Support headset mode for ALC234/ALC274/ALC294
+Git-commit: 71683c32dee66cdb244a25490823731db1401dce
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+This patch will enable headset mode for ALC234/ALC274/ALC294 platform.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 68 +++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 67 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3863,6 +3863,16 @@ static void alc_headset_mode_unplugged(s
+ UPDATE_COEF(0x4a, 3<<10, 0),
+ {}
+ };
++ static struct coef_fw coef0274[] = {
++ UPDATE_COEF(0x4a, 0x0100, 0),
++ UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
++ UPDATE_COEF(0x6b, 0xf000, 0x5000),
++ UPDATE_COEF(0x4a, 0x0010, 0),
++ UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
++ WRITE_COEF(0x45, 0x5289),
++ UPDATE_COEF(0x4a, 0x0c00, 0),
++ {}
++ };
+
+ switch (codec->core.vendor_id) {
+ case 0x10ec0255:
+@@ -3874,6 +3884,11 @@ static void alc_headset_mode_unplugged(s
+ alc_process_coef_fw(codec, coef0256);
+ alc_process_coef_fw(codec, coef0255);
+ break;
++ case 0x10ec0234:
++ case 0x10ec0274:
++ case 0x10ec0294:
++ alc_process_coef_fw(codec, coef0274);
++ break;
+ case 0x10ec0233:
+ case 0x10ec0283:
+ alc_process_coef_fw(codec, coef0233);
+@@ -3952,7 +3967,12 @@ static void alc_headset_mode_mic_in(stru
+ UPDATE_COEF(0x63, 3<<14, 0),
+ {}
+ };
+-
++ static struct coef_fw coef0274[] = {
++ UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
++ UPDATE_COEF(0x4a, 0x0010, 0),
++ UPDATE_COEF(0x6b, 0xf000, 0),
++ {}
++ };
+
+ switch (codec->core.vendor_id) {
+ case 0x10ec0236:
+@@ -3963,6 +3983,14 @@ static void alc_headset_mode_mic_in(stru
+ alc_process_coef_fw(codec, coef0255);
+ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+ break;
++ case 0x10ec0234:
++ case 0x10ec0274:
++ case 0x10ec0294:
++ alc_write_coef_idx(codec, 0x45, 0x4689);
++ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
++ alc_process_coef_fw(codec, coef0274);
++ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
++ break;
+ case 0x10ec0233:
+ case 0x10ec0283:
+ alc_write_coef_idx(codec, 0x45, 0xc429);
+@@ -4056,6 +4084,13 @@ static void alc_headset_mode_default(str
+ WRITE_COEF(0xb7, 0x802b),
+ {}
+ };
++ static struct coef_fw coef0274[] = {
++ WRITE_COEF(0x45, 0x4289),
++ UPDATE_COEF(0x4a, 0x0010, 0x0010),
++ UPDATE_COEF(0x6b, 0x0f00, 0),
++ UPDATE_COEF(0x49, 0x0300, 0x0300),
++ {}
++ };
+
+ switch (codec->core.vendor_id) {
+ case 0x10ec0225:
+@@ -4068,6 +4103,11 @@ static void alc_headset_mode_default(str
+ case 0x10ec0256:
+ alc_process_coef_fw(codec, coef0255);
+ break;
++ case 0x10ec0234:
++ case 0x10ec0274:
++ case 0x10ec0294:
++ alc_process_coef_fw(codec, coef0274);
++ break;
+ case 0x10ec0233:
+ case 0x10ec0283:
+ alc_process_coef_fw(codec, coef0233);
+@@ -4153,6 +4193,11 @@ static void alc_headset_mode_ctia(struct
+ case 0x10ec0256:
+ alc_process_coef_fw(codec, coef0256);
+ break;
++ case 0x10ec0234:
++ case 0x10ec0274:
++ case 0x10ec0294:
++ alc_write_coef_idx(codec, 0x45, 0xd689);
++ break;
+ case 0x10ec0233:
+ case 0x10ec0283:
+ alc_process_coef_fw(codec, coef0233);
+@@ -4254,6 +4299,11 @@ static void alc_headset_mode_omtp(struct
+ case 0x10ec0256:
+ alc_process_coef_fw(codec, coef0256);
+ break;
++ case 0x10ec0234:
++ case 0x10ec0274:
++ case 0x10ec0294:
++ alc_write_coef_idx(codec, 0x45, 0xe689);
++ break;
+ case 0x10ec0233:
+ case 0x10ec0283:
+ alc_process_coef_fw(codec, coef0233);
+@@ -4327,6 +4377,13 @@ static void alc_determine_headset_type(s
+ UPDATE_COEF(0x49, 1<<8, 1<<8),
+ {}
+ };
++ static struct coef_fw coef0274[] = {
++ UPDATE_COEF(0x4a, 0x0010, 0),
++ UPDATE_COEF(0x4a, 0x8000, 0),
++ WRITE_COEF(0x45, 0xd289),
++ UPDATE_COEF(0x49, 0x0300, 0x0300),
++ {}
++ };
+
+ switch (codec->core.vendor_id) {
+ case 0x10ec0236:
+@@ -4337,6 +4394,14 @@ static void alc_determine_headset_type(s
+ val = alc_read_coef_idx(codec, 0x46);
+ is_ctia = (val & 0x0070) == 0x0070;
+ break;
++ case 0x10ec0234:
++ case 0x10ec0274:
++ case 0x10ec0294:
++ alc_process_coef_fw(codec, coef0274);
++ msleep(80);
++ val = alc_read_coef_idx(codec, 0x46);
++ is_ctia = (val & 0x00f0) == 0x00f0;
++ break;
+ case 0x10ec0233:
+ case 0x10ec0283:
+ alc_write_coef_idx(codec, 0x45, 0xd029);
+@@ -6503,6 +6568,7 @@ static int patch_alc269(struct hda_codec
+ case 0x10ec0274:
+ case 0x10ec0294:
+ spec->codec_variant = ALC269_TYPE_ALC294;
++ alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
+ break;
+ case 0x10ec0700:
+ case 0x10ec0701:
diff --git a/patches.drivers/ALSA-hda-realtek-There-is-no-loopback-mixer-in-the-A b/patches.drivers/ALSA-hda-realtek-There-is-no-loopback-mixer-in-the-A
new file mode 100644
index 0000000000..0c198f7eb9
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-There-is-no-loopback-mixer-in-the-A
@@ -0,0 +1,40 @@
+From 532a7784c376f2332d38c4c1576843c66343713d Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Mon, 26 Jun 2017 12:30:32 +0800
+Subject: [PATCH] ALSA: hda/realtek - There is no loopback mixer in the ALC234/274/294
+Git-commit: 532a7784c376f2332d38c4c1576843c66343713d
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+We have a Lenovo machine with the codec ALC294 on it, without the
+patch, the Node 0x0b is regarded as the loopback mixer, but the Node
+0x0b in this codec is "Vendor Defined Widget" instead of the audio
+mixer, please see the log below:
+
+Node 0x0b [Vendor Defined Widget] wcaps 0xf00000: Mono
+ Control: name="Beep Playback Volume", index=0, device=0
+ ControlAmp: chs=3, dir=In, idx=4, ofs=0
+ Control: name="Beep Playback Switch", index=0, device=0
+ ControlAmp: chs=3, dir=In, idx=4, ofs=0
+
+And I have consulted with Realtek, so far the ALC234/274/294 all don't
+have loopback mixer.
+
+Cc: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6825,6 +6825,7 @@ static int patch_alc269(struct hda_codec
+ case 0x10ec0274:
+ case 0x10ec0294:
+ spec->codec_variant = ALC269_TYPE_ALC294;
++ spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
+ alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
+ break;
+ case 0x10ec0700:
diff --git a/patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC225 b/patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC225
new file mode 100644
index 0000000000..fd3f614769
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC225
@@ -0,0 +1,171 @@
+From 5a36767a41650518f35ea0bae9a2d6e775f1aed1 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Fri, 21 Jul 2017 15:23:53 +0800
+Subject: [PATCH] ALSA: hda/realtek - Update headset mode for ALC225
+Git-commit: 5a36767a41650518f35ea0bae9a2d6e775f1aed1
+Patch-mainline: 4.13-rc3
+References: bsc#1031717
+
+Dell new platform with new hardware layout.
+Old headset mode policy will cause headset mode check type has a
+chance to check fail.
+So, we update new headset mode to match new hardware layout.
+New headset mode policy also could suitable to old hardware layout.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 77 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 52 insertions(+), 25 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3793,6 +3793,17 @@ static void alc269_fixup_hp_line1_mic1_l
+ }
+ }
+
++static struct coef_fw alc225_pre_hsmode[] = {
++ UPDATE_COEF(0x4a, 1<<8, 0),
++ UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
++ UPDATE_COEF(0x63, 3<<14, 3<<14),
++ UPDATE_COEF(0x4a, 3<<4, 2<<4),
++ UPDATE_COEF(0x4a, 3<<10, 3<<10),
++ UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
++ UPDATE_COEF(0x4a, 3<<10, 0),
++ {}
++};
++
+ static void alc_headset_mode_unplugged(struct hda_codec *codec)
+ {
+ static struct coef_fw coef0255[] = {
+@@ -3854,13 +3865,7 @@ static void alc_headset_mode_unplugged(s
+ {}
+ };
+ static struct coef_fw coef0225[] = {
+- UPDATE_COEF(0x4a, 1<<8, 0),
+- UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
+- UPDATE_COEF(0x63, 3<<14, 3<<14),
+- UPDATE_COEF(0x4a, 3<<4, 2<<4),
+- UPDATE_COEF(0x4a, 3<<10, 3<<10),
+- UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
+- UPDATE_COEF(0x4a, 3<<10, 0),
++ UPDATE_COEF(0x63, 3<<14, 0),
+ {}
+ };
+ static struct coef_fw coef0274[] = {
+@@ -4030,6 +4035,7 @@ static void alc_headset_mode_mic_in(stru
+ case 0x10ec0225:
+ case 0x10ec0295:
+ case 0x10ec0299:
++ alc_process_coef_fw(codec, alc225_pre_hsmode);
+ alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
+ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+ alc_process_coef_fw(codec, coef0225);
+@@ -4042,7 +4048,12 @@ static void alc_headset_mode_mic_in(stru
+ static void alc_headset_mode_default(struct hda_codec *codec)
+ {
+ static struct coef_fw coef0225[] = {
+- UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
++ UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
++ UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
++ UPDATE_COEF(0x49, 3<<8, 0<<8),
++ UPDATE_COEF(0x4a, 3<<4, 3<<4),
++ UPDATE_COEF(0x63, 3<<14, 0),
++ UPDATE_COEF(0x67, 0xf000, 0x3000),
+ {}
+ };
+ static struct coef_fw coef0255[] = {
+@@ -4096,6 +4107,7 @@ static void alc_headset_mode_default(str
+ case 0x10ec0225:
+ case 0x10ec0295:
+ case 0x10ec0299:
++ alc_process_coef_fw(codec, alc225_pre_hsmode);
+ alc_process_coef_fw(codec, coef0225);
+ break;
+ case 0x10ec0236:
+@@ -4177,11 +4189,14 @@ static void alc_headset_mode_ctia(struct
+ WRITE_COEF(0xc3, 0x0000),
+ {}
+ };
+- static struct coef_fw coef0225[] = {
++ static struct coef_fw coef0225_1[] = {
+ UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
+- UPDATE_COEF(0x49, 1<<8, 1<<8),
+- UPDATE_COEF(0x4a, 7<<6, 7<<6),
+- UPDATE_COEF(0x4a, 3<<4, 3<<4),
++ UPDATE_COEF(0x63, 3<<14, 2<<14),
++ {}
++ };
++ static struct coef_fw coef0225_2[] = {
++ UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
++ UPDATE_COEF(0x63, 3<<14, 1<<14),
+ {}
+ };
+
+@@ -4232,7 +4247,11 @@ static void alc_headset_mode_ctia(struct
+ case 0x10ec0225:
+ case 0x10ec0295:
+ case 0x10ec0299:
+- alc_process_coef_fw(codec, coef0225);
++ val = alc_read_coef_idx(codec, 0x45);
++ if (val & (1 << 9))
++ alc_process_coef_fw(codec, coef0225_2);
++ else
++ alc_process_coef_fw(codec, coef0225_1);
+ break;
+ }
+ codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
+@@ -4285,9 +4304,7 @@ static void alc_headset_mode_omtp(struct
+ };
+ static struct coef_fw coef0225[] = {
+ UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
+- UPDATE_COEF(0x49, 1<<8, 1<<8),
+- UPDATE_COEF(0x4a, 7<<6, 7<<6),
+- UPDATE_COEF(0x4a, 3<<4, 3<<4),
++ UPDATE_COEF(0x63, 3<<14, 2<<14),
+ {}
+ };
+
+@@ -4372,11 +4389,6 @@ static void alc_determine_headset_type(s
+ WRITE_COEF(0xc3, 0x0c00),
+ {}
+ };
+- static struct coef_fw coef0225[] = {
+- UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
+- UPDATE_COEF(0x49, 1<<8, 1<<8),
+- {}
+- };
+ static struct coef_fw coef0274[] = {
+ UPDATE_COEF(0x4a, 0x0010, 0),
+ UPDATE_COEF(0x4a, 0x8000, 0),
+@@ -4466,10 +4478,25 @@ static void alc_determine_headset_type(s
+ case 0x10ec0225:
+ case 0x10ec0295:
+ case 0x10ec0299:
+- alc_process_coef_fw(codec, coef0225);
+- msleep(800);
+- val = alc_read_coef_idx(codec, 0x46);
+- is_ctia = (val & 0x00f0) == 0x00f0;
++ alc_process_coef_fw(codec, alc225_pre_hsmode);
++ alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
++ val = alc_read_coef_idx(codec, 0x45);
++ if (val & (1 << 9)) {
++ alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
++ alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
++ msleep(800);
++ val = alc_read_coef_idx(codec, 0x46);
++ is_ctia = (val & 0x00f0) == 0x00f0;
++ } else {
++ alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
++ alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
++ msleep(800);
++ val = alc_read_coef_idx(codec, 0x46);
++ is_ctia = (val & 0x00f0) == 0x00f0;
++ }
++ alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
++ alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
++ alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
+ break;
+ }
+
diff --git a/patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC298 b/patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC298
new file mode 100644
index 0000000000..9c9d4f55d7
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC298
@@ -0,0 +1,153 @@
+From 89542936df29d7104537279a6a7e583de6e15b92 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Mon, 17 Jul 2017 15:03:43 +0800
+Subject: [PATCH] ALSA: hda/realtek - Update headset mode for ALC298
+Git-commit: 89542936df29d7104537279a6a7e583de6e15b92
+Patch-mainline: 4.13-rc3
+References: bsc#1031717
+
+Dell new platform with new hardware layout.
+Old headset mode policy will cause headset mode check type has a
+chance to check fail.
+So, we update new headset mode to match new hardware layout.
+New headset mode policy also could suitable to old hardware layout.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 66 ++++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 60 insertions(+), 6 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3828,6 +3828,10 @@ static void alc_headset_mode_unplugged(s
+ UPDATE_COEF(0x67, 0x2000, 0),
+ {}
+ };
++ static struct coef_fw coef0298[] = {
++ UPDATE_COEF(0x19, 0x1300, 0x0300),
++ {}
++ };
+ static struct coef_fw coef0292[] = {
+ WRITE_COEF(0x76, 0x000e),
+ WRITE_COEF(0x6c, 0x2400),
+@@ -3876,7 +3880,10 @@ static void alc_headset_mode_unplugged(s
+ break;
+ case 0x10ec0286:
+ case 0x10ec0288:
++ alc_process_coef_fw(codec, coef0288);
++ break;
+ case 0x10ec0298:
++ alc_process_coef_fw(codec, coef0298);
+ alc_process_coef_fw(codec, coef0288);
+ break;
+ case 0x10ec0292:
+@@ -3914,6 +3921,7 @@ static void alc_headset_mode_mic_in(stru
+ {}
+ };
+ static struct coef_fw coef0288[] = {
++ UPDATE_COEF(0x4f, 0x00c0, 0),
+ UPDATE_COEF(0x50, 0x2000, 0),
+ UPDATE_COEF(0x56, 0x0006, 0),
+ UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
+@@ -3965,7 +3973,6 @@ static void alc_headset_mode_mic_in(stru
+ case 0x10ec0286:
+ case 0x10ec0288:
+ case 0x10ec0298:
+- alc_update_coef_idx(codec, 0x4f, 0x000c, 0);
+ snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
+ alc_process_coef_fw(codec, coef0288);
+ snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
+@@ -4086,6 +4093,8 @@ static void alc_headset_mode_default(str
+ /* Iphone type */
+ static void alc_headset_mode_ctia(struct hda_codec *codec)
+ {
++ int val;
++
+ static struct coef_fw coef0255[] = {
+ WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
+ WRITE_COEF(0x1b, 0x0c2b),
+@@ -4149,8 +4158,17 @@ static void alc_headset_mode_ctia(struct
+ alc_process_coef_fw(codec, coef0233);
+ break;
+ case 0x10ec0298:
+- alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);/* Headset output enable */
+- /* ALC298 jack type setting is the same with ALC286/ALC288 */
++ val = alc_read_coef_idx(codec, 0x50);
++ if (val & (1 << 12)) {
++ alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
++ alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
++ msleep(300);
++ } else {
++ alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
++ alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
++ msleep(300);
++ }
++ break;
+ case 0x10ec0286:
+ case 0x10ec0288:
+ alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
+@@ -4242,7 +4260,9 @@ static void alc_headset_mode_omtp(struct
+ break;
+ case 0x10ec0298:
+ alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
+- /* ALC298 jack type setting is the same with ALC286/ALC288 */
++ alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
++ msleep(300);
++ break;
+ case 0x10ec0286:
+ case 0x10ec0288:
+ alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
+@@ -4282,6 +4302,14 @@ static void alc_determine_headset_type(s
+ UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
+ {}
+ };
++ static struct coef_fw coef0298[] = {
++ UPDATE_COEF(0x50, 0x2000, 0x2000),
++ UPDATE_COEF(0x56, 0x0006, 0x0006),
++ UPDATE_COEF(0x66, 0x0008, 0),
++ UPDATE_COEF(0x67, 0x2000, 0),
++ UPDATE_COEF(0x19, 0x1300, 0x1300),
++ {}
++ };
+ static struct coef_fw coef0293[] = {
+ UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
+ WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
+@@ -4317,8 +4345,34 @@ static void alc_determine_headset_type(s
+ is_ctia = (val & 0x0070) == 0x0070;
+ break;
+ case 0x10ec0298:
+- alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); /* Headset output enable */
+- /* ALC298 check jack type is the same with ALC286/ALC288 */
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++ msleep(100);
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++ msleep(200);
++
++ val = alc_read_coef_idx(codec, 0x50);
++ if (val & (1 << 12)) {
++ alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
++ alc_process_coef_fw(codec, coef0288);
++ msleep(350);
++ val = alc_read_coef_idx(codec, 0x50);
++ is_ctia = (val & 0x0070) == 0x0070;
++ } else {
++ alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
++ alc_process_coef_fw(codec, coef0288);
++ msleep(350);
++ val = alc_read_coef_idx(codec, 0x50);
++ is_ctia = (val & 0x0070) == 0x0070;
++ }
++ alc_process_coef_fw(codec, coef0298);
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
++ msleep(75);
++ snd_hda_codec_write(codec, 0x21, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
++ break;
+ case 0x10ec0286:
+ case 0x10ec0288:
+ alc_process_coef_fw(codec, coef0288);
diff --git a/patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two- b/patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two-
new file mode 100644
index 0000000000..9a8255450e
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two-
@@ -0,0 +1,58 @@
+From f33f79f3d0e5caf04dd889cd7cf636261970f009 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Fri, 7 Jul 2017 12:08:29 +0800
+Subject: [PATCH] ALSA: hda/realtek - change the location for one of two front microphones
+Git-commit: f33f79f3d0e5caf04dd889cd7cf636261970f009
+Patch-mainline: 4.13-rc1
+References: bsc#1031717
+
+On this Lenovo machine, there are two front mics, and both of them are
+assigned the same name "Mic", but pulseaudio can't support two mics
+with the same name, as a workaround, we change the location for one of
+them, then the driver will assign "Front Mic" and "Mic" for them.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5201,6 +5201,7 @@ enum {
+ ALC256_FIXUP_ASUS_AIO_GPIO2,
+ ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
+ ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
++ ALC294_FIXUP_LENOVO_MIC_LOCATION,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -5978,6 +5979,18 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
+ },
++ [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
++ .type = HDA_FIXUP_PINS,
++ .v.pins = (const struct hda_pintbl[]) {
++ /* Change the mic location from front to right, otherwise there are
++ two front mics with the same name, pulseaudio can't handle them.
++ This is just a temporary workaround, after applying this fixup,
++ there will be one "Front Mic" and one "Mic" in this machine.
++ */
++ { 0x1a, 0x04a19040 },
++ { }
++ },
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -6157,6 +6170,7 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
+ SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
++ SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
+ SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+ SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
diff --git a/patches.drivers/ALSA-hda-realtek-fix-headset-mic-detection-for-MSI-M b/patches.drivers/ALSA-hda-realtek-fix-headset-mic-detection-for-MSI-M
new file mode 100644
index 0000000000..fd18e45d68
--- /dev/null
+++ b/patches.drivers/ALSA-hda-realtek-fix-headset-mic-detection-for-MSI-M
@@ -0,0 +1,52 @@
+From abaa2274811d607679e8687b4118c4922a3517ac Mon Sep 17 00:00:00 2001
+From: Anisse Astier <anisse@astier.eu>
+Date: Wed, 24 Aug 2016 09:14:13 +0200
+Subject: [PATCH] ALSA: hda/realtek - fix headset mic detection for MSI MS-B120
+Git-commit: abaa2274811d607679e8687b4118c4922a3517ac
+Patch-mainline: 4.8-rc4
+References: bsc#1031717
+
+MSI Cubi MS-B120 needs the same fixup as the Gigabyte BXBT-2807 for its
+mic to work.
+
+They both use a single 3-way jack for both mic and headset with an
+ALC283 codec, with the same pins used.
+
+Cc: Daniel Drake <drake@endlessm.com>
+Signed-off-by: Anisse Astier <anisse@astier.eu>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5164,7 +5164,7 @@ enum {
+ ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC292_FIXUP_TPT440_DOCK,
+ ALC292_FIXUP_TPT440,
+- ALC283_FIXUP_BXBT2807_MIC,
++ ALC283_FIXUP_HEADSET_MIC,
+ ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
+ ALC282_FIXUP_ASPIRE_V5_PINS,
+ ALC280_FIXUP_HP_GPIO4,
+@@ -5688,7 +5688,7 @@ static const struct hda_fixup alc269_fix
+ .chained = true,
+ .chain_id = ALC292_FIXUP_TPT440_DOCK,
+ },
+- [ALC283_FIXUP_BXBT2807_MIC] = {
++ [ALC283_FIXUP_HEADSET_MIC] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+ { 0x19, 0x04a110f0 },
+@@ -6053,7 +6053,8 @@ static const struct snd_pci_quirk alc269
+ SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
+ SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
+ SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
+- SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
++ SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
++ SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
+ SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
+ SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
diff --git a/patches.drivers/ALSA-pcm-prevent-UAF-in-snd_pcm_info b/patches.drivers/ALSA-pcm-prevent-UAF-in-snd_pcm_info
new file mode 100644
index 0000000000..23a4dbdfae
--- /dev/null
+++ b/patches.drivers/ALSA-pcm-prevent-UAF-in-snd_pcm_info
@@ -0,0 +1,36 @@
+From 362bca57f5d78220f8b5907b875961af9436e229 Mon Sep 17 00:00:00 2001
+From: Robb Glasser <rglasser@google.com>
+Date: Tue, 5 Dec 2017 09:16:55 -0800
+Subject: [PATCH] ALSA: pcm: prevent UAF in snd_pcm_info
+Git-commit: 362bca57f5d78220f8b5907b875961af9436e229
+Patch-mainline: 4.15-rc3
+References: bsc#1031717
+
+When the device descriptor is closed, the `substream->runtime` pointer
+is freed. But another thread may be in the ioctl handler, case
+SNDRV_CTL_IOCTL_PCM_INFO. This case calls snd_pcm_info_user() which
+calls snd_pcm_info() which accesses the now freed `substream->runtime`.
+
+Note: this fixes CVE-2017-0861
+
+Signed-off-by: Robb Glasser <rglasser@google.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/core/pcm.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/core/pcm.c
++++ b/sound/core/pcm.c
+@@ -149,7 +149,9 @@ static int snd_pcm_control_ioctl(struct
+ err = -ENXIO;
+ goto _error;
+ }
++ mutex_lock(&pcm->open_mutex);
+ err = snd_pcm_info_user(substream, info);
++ mutex_unlock(&pcm->open_mutex);
+ _error:
+ mutex_unlock(&register_mutex);
+ return err;
diff --git a/patches.drivers/ALSA-rawmidi-Avoid-racy-info-ioctl-via-ctl-device b/patches.drivers/ALSA-rawmidi-Avoid-racy-info-ioctl-via-ctl-device
new file mode 100644
index 0000000000..a6b9c79f7c
--- /dev/null
+++ b/patches.drivers/ALSA-rawmidi-Avoid-racy-info-ioctl-via-ctl-device
@@ -0,0 +1,65 @@
+From c1cfd9025cc394fd137a01159d74335c5ac978ce Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 14 Dec 2017 16:44:12 +0100
+Subject: [PATCH] ALSA: rawmidi: Avoid racy info ioctl via ctl device
+Git-commit: c1cfd9025cc394fd137a01159d74335c5ac978ce
+Patch-mainline: 4.15-rc5
+References: bsc#1031717
+
+The rawmidi also allows to obtaining the information via ioctl of ctl
+API. It means that user can issue an ioctl to the rawmidi device even
+when it's being removed as long as the control device is present.
+Although the code has some protection via the global register_mutex,
+its range is limited to the search of the corresponding rawmidi
+object, and the mutex is already unlocked at accessing the rawmidi
+object. This may lead to a use-after-free.
+
+For avoiding it, this patch widens the application of register_mutex
+to the whole snd_rawmidi_info_select() function. We have another
+mutex per rawmidi object, but this operation isn't very hot path, so
+it shouldn't matter from the performance POV.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/core/rawmidi.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+--- a/sound/core/rawmidi.c
++++ b/sound/core/rawmidi.c
+@@ -579,15 +579,14 @@ static int snd_rawmidi_info_user(struct
+ return 0;
+ }
+
+-int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
++static int __snd_rawmidi_info_select(struct snd_card *card,
++ struct snd_rawmidi_info *info)
+ {
+ struct snd_rawmidi *rmidi;
+ struct snd_rawmidi_str *pstr;
+ struct snd_rawmidi_substream *substream;
+
+- mutex_lock(&register_mutex);
+ rmidi = snd_rawmidi_search(card, info->device);
+- mutex_unlock(&register_mutex);
+ if (!rmidi)
+ return -ENXIO;
+ if (info->stream < 0 || info->stream > 1)
+@@ -603,6 +602,16 @@ int snd_rawmidi_info_select(struct snd_c
+ }
+ return -ENXIO;
+ }
++
++int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info)
++{
++ int ret;
++
++ mutex_lock(&register_mutex);
++ ret = __snd_rawmidi_info_select(card, info);
++ mutex_unlock(&register_mutex);
++ return ret;
++}
+ EXPORT_SYMBOL(snd_rawmidi_info_select);
+
+ static int snd_rawmidi_info_select_user(struct snd_card *card,
diff --git a/patches.drivers/ALSA-seq-Remove-spurious-WARN_ON-at-timer-check b/patches.drivers/ALSA-seq-Remove-spurious-WARN_ON-at-timer-check
new file mode 100644
index 0000000000..f0531a7215
--- /dev/null
+++ b/patches.drivers/ALSA-seq-Remove-spurious-WARN_ON-at-timer-check
@@ -0,0 +1,34 @@
+From 43a3542870328601be02fcc9d27b09db467336ef Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 30 Nov 2017 10:08:28 +0100
+Subject: [PATCH] ALSA: seq: Remove spurious WARN_ON() at timer check
+Git-commit: 43a3542870328601be02fcc9d27b09db467336ef
+Patch-mainline: 4.15-rc3
+References: bsc#1031717
+
+The use of snd_BUG_ON() in ALSA sequencer timer may lead to a spurious
+WARN_ON() when a slave timer is deployed as its backend and a
+corresponding master timer stops meanwhile. The symptom was triggered
+by syzkaller spontaneously.
+
+Since the NULL timer is valid there, rip off snd_BUG_ON().
+
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/core/seq/seq_timer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/core/seq/seq_timer.c
++++ b/sound/core/seq/seq_timer.c
+@@ -355,7 +355,7 @@ static int initialize_timer(struct snd_s
+ unsigned long freq;
+
+ t = tmr->timeri->timer;
+- if (snd_BUG_ON(!t))
++ if (!t)
+ return -EINVAL;
+
+ freq = tmr->preferred_resolution;
diff --git a/patches.drivers/ALSA-usb-audio-Add-check-return-value-for-usb_string b/patches.drivers/ALSA-usb-audio-Add-check-return-value-for-usb_string
new file mode 100644
index 0000000000..9e31ccbfe5
--- /dev/null
+++ b/patches.drivers/ALSA-usb-audio-Add-check-return-value-for-usb_string
@@ -0,0 +1,41 @@
+From 89b89d121ffcf8d9546633b98ded9d18b8f75891 Mon Sep 17 00:00:00 2001
+From: Jaejoong Kim <climbbb.kim@gmail.com>
+Date: Mon, 4 Dec 2017 15:31:49 +0900
+Subject: [PATCH] ALSA: usb-audio: Add check return value for usb_string()
+Git-commit: 89b89d121ffcf8d9546633b98ded9d18b8f75891
+Patch-mainline: 4.15-rc3
+References: bsc#1031717
+
+snd_usb_copy_string_desc() returns zero if usb_string() fails.
+In case of failure, we need to check the snd_usb_copy_string_desc()'s
+return value and add an exception case
+
+Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/usb/mixer.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -2106,13 +2106,14 @@ static int parse_audio_selector_unit(str
+ if (len)
+ ;
+ else if (nameid)
+- snd_usb_copy_string_desc(state, nameid, kctl->id.name,
++ len = snd_usb_copy_string_desc(state, nameid, kctl->id.name,
+ sizeof(kctl->id.name));
+- else {
++ else
+ len = get_term_name(state, &state->oterm,
+ kctl->id.name, sizeof(kctl->id.name), 0);
+- if (!len)
+- strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
++
++ if (!len) {
++ strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
+
+ if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
+ append_ctl_name(kctl, " Clock Source");
diff --git a/patches.drivers/ALSA-usb-audio-Fix-out-of-bound-error b/patches.drivers/ALSA-usb-audio-Fix-out-of-bound-error
new file mode 100644
index 0000000000..ebe636a1db
--- /dev/null
+++ b/patches.drivers/ALSA-usb-audio-Fix-out-of-bound-error
@@ -0,0 +1,94 @@
+From 251552a2b0d454badc8f486e6d79100970c744b0 Mon Sep 17 00:00:00 2001
+From: Jaejoong Kim <climbbb.kim@gmail.com>
+Date: Mon, 4 Dec 2017 15:31:48 +0900
+Subject: [PATCH] ALSA: usb-audio: Fix out-of-bound error
+Git-commit: 251552a2b0d454badc8f486e6d79100970c744b0
+Patch-mainline: 4.15-rc3
+References: bsc#1031717
+
+The snd_usb_copy_string_desc() retrieves the usb string corresponding to
+the index number through the usb_string(). The problem is that the
+usb_string() returns the length of the string (>= 0) when successful, but
+it can also return a negative value about the error case or status of
+usb_control_msg().
+
+If iClockSource is '0' as shown below, usb_string() will returns -EINVAL.
+This will result in '0' being inserted into buf[-22], and the following
+KASAN out-of-bound error message will be output.
+
+AudioControl Interface Descriptor:
+ bLength 8
+ bDescriptorType 36
+ bDescriptorSubtype 10 (CLOCK_SOURCE)
+ bClockID 1
+ bmAttributes 0x07 Internal programmable Clock (synced to SOF)
+ bmControls 0x07
+ Clock Frequency Control (read/write)
+ Clock Validity Control (read-only)
+ bAssocTerminal 0
+ iClockSource 0
+
+To fix it, check usb_string()'return value and bail out.
+
+==================================================================
+Bug: KASAN: stack-out-of-bounds in parse_audio_unit+0x1327/0x1960 [snd_usb_audio]
+Write of size 1 at addr ffff88007e66735a by task systemd-udevd/18376
+
+Cpu: 0 PID: 18376 Comm: systemd-udevd Not tainted 4.13.0+ #3
+Hardware name: LG Electronics 15N540-RFLGL/White Tip Mountain, BIOS 15N5
+Call Trace:
+dump_stack+0x63/0x8d
+print_address_description+0x70/0x290
+? parse_audio_unit+0x1327/0x1960 [snd_usb_audio]
+kasan_report+0x265/0x350
+__asan_store1+0x4a/0x50
+parse_audio_unit+0x1327/0x1960 [snd_usb_audio]
+? save_stack+0xb5/0xd0
+? save_stack_trace+0x1b/0x20
+? save_stack+0x46/0xd0
+? kasan_kmalloc+0xad/0xe0
+? kmem_cache_alloc_trace+0xff/0x230
+? snd_usb_create_mixer+0xb0/0x4b0 [snd_usb_audio]
+? usb_audio_probe+0x4de/0xf40 [snd_usb_audio]
+? usb_probe_interface+0x1f5/0x440
+? driver_probe_device+0x3ed/0x660
+? build_feature_ctl+0xb10/0xb10 [snd_usb_audio]
+? save_stack_trace+0x1b/0x20
+? init_object+0x69/0xa0
+? snd_usb_find_csint_desc+0xa8/0xf0 [snd_usb_audio]
+snd_usb_mixer_controls+0x1dc/0x370 [snd_usb_audio]
+? build_audio_procunit+0x890/0x890 [snd_usb_audio]
+? snd_usb_create_mixer+0xb0/0x4b0 [snd_usb_audio]
+? kmem_cache_alloc_trace+0xff/0x230
+? usb_ifnum_to_if+0xbd/0xf0
+snd_usb_create_mixer+0x25b/0x4b0 [snd_usb_audio]
+? snd_usb_create_stream+0x255/0x2c0 [snd_usb_audio]
+usb_audio_probe+0x4de/0xf40 [snd_usb_audio]
+? snd_usb_autosuspend.part.7+0x30/0x30 [snd_usb_audio]
+? __pm_runtime_idle+0x90/0x90
+? kernfs_activate+0xa6/0xc0
+? usb_match_one_id_intf+0xdc/0x130
+? __pm_runtime_set_status+0x2d4/0x450
+usb_probe_interface+0x1f5/0x440
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/usb/mixer.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -203,6 +203,10 @@ static int snd_usb_copy_string_desc(stru
+ int index, char *buf, int maxlen)
+ {
+ int len = usb_string(state->chip->dev, index, buf, maxlen - 1);
++
++ if (len < 0)
++ return 0;
++
+ buf[len] = 0;
+ return len;
+ }
diff --git a/patches.drivers/ALSA-usb-audio-Fix-the-missing-ctl-name-suffix-at-pa b/patches.drivers/ALSA-usb-audio-Fix-the-missing-ctl-name-suffix-at-pa
new file mode 100644
index 0000000000..7645ce4c3e
--- /dev/null
+++ b/patches.drivers/ALSA-usb-audio-Fix-the-missing-ctl-name-suffix-at-pa
@@ -0,0 +1,74 @@
+From 5a15f289ee87eaf33f13f08a4909ec99d837ec5f Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 18 Dec 2017 23:36:57 +0100
+Subject: [PATCH] ALSA: usb-audio: Fix the missing ctl name suffix at parsing SU
+Git-commit: 5a15f289ee87eaf33f13f08a4909ec99d837ec5f
+Patch-mainline: 4.15-rc5
+References: bsc#1031717
+
+The commit 89b89d121ffc ("ALSA: usb-audio: Add check return value for
+usb_string()") added the check of the return value from
+snd_usb_copy_string_desc(), which is correct per se, but it introduced
+a regression. In the original code, either the "Clock Source",
+"Playback Source" or "Capture Source" suffix is added after the
+terminal string, while the commit changed it to add the suffix only
+when get_term_name() is failing. It ended up with an incorrect ctl
+name like "PCM" instead of "PCM Capture Source".
+
+Also, even the original code has a similar bug: when the ctl name is
+generated from snd_usb_copy_string_desc() for the given iSelector, it
+also doesn't put the suffix.
+
+This patch addresses these issues: the suffix is added always when no
+static mapping is found. Also the patch tries to put more comments
+and cleans up the if/else block for better readability in order to
+avoid the same pitfall again.
+
+Fixes: 89b89d121ffc ("ALSA: usb-audio: Add check return value for usb_string()")
+Reported-and-tested-by: Mauro Santos <registo.mailling@gmail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/usb/mixer.c | 27 ++++++++++++++++-----------
+ 1 file changed, 16 insertions(+), 11 deletions(-)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -2101,20 +2101,25 @@ static int parse_audio_selector_unit(str
+ kctl->private_value = (unsigned long)namelist;
+ kctl->private_free = usb_mixer_selector_elem_free;
+
+- nameid = uac_selector_unit_iSelector(desc);
++ /* check the static mapping table at first */
+ len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name));
+- if (len)
+- ;
+- else if (nameid)
+- len = snd_usb_copy_string_desc(state, nameid, kctl->id.name,
+- sizeof(kctl->id.name));
+- else
+- len = get_term_name(state, &state->oterm,
+- kctl->id.name, sizeof(kctl->id.name), 0);
+-
+ if (!len) {
+- strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
++ /* no mapping ? */
++ /* if iSelector is given, use it */
++ nameid = uac_selector_unit_iSelector(desc);
++ if (nameid)
++ len = snd_usb_copy_string_desc(state, nameid,
++ kctl->id.name,
++ sizeof(kctl->id.name));
++ /* ... or pick up the terminal name at next */
++ if (!len)
++ len = get_term_name(state, &state->oterm,
++ kctl->id.name, sizeof(kctl->id.name), 0);
++ /* ... or use the fixed string "USB" as the last resort */
++ if (!len)
++ strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
+
++ /* and add the proper suffix */
+ if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
+ append_ctl_name(kctl, " Clock Source");
+ else if ((state->oterm.type & 0xff00) == 0x0100)
diff --git a/patches.drivers/ASoC-fsl_ssi-AC-97-ops-need-regmap-clock-and-cleanin b/patches.drivers/ASoC-fsl_ssi-AC-97-ops-need-regmap-clock-and-cleanin
new file mode 100644
index 0000000000..298256494e
--- /dev/null
+++ b/patches.drivers/ASoC-fsl_ssi-AC-97-ops-need-regmap-clock-and-cleanin
@@ -0,0 +1,64 @@
+From 695b78b548d8a26288f041e907ff17758df9e1d5 Mon Sep 17 00:00:00 2001
+From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
+Date: Mon, 20 Nov 2017 23:14:55 +0100
+Subject: [PATCH] ASoC: fsl_ssi: AC'97 ops need regmap, clock and cleaning up on failure
+Git-commit: 695b78b548d8a26288f041e907ff17758df9e1d5
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+AC'97 ops (register read / write) need SSI regmap and clock, so they have
+to be set after them.
+
+We also need to set these ops back to NULL if we fail the probe.
+
+Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
+Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: stable@vger.kernel.org
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/soc/fsl/fsl_ssi.c | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+--- a/sound/soc/fsl/fsl_ssi.c
++++ b/sound/soc/fsl/fsl_ssi.c
+@@ -1410,12 +1410,6 @@ static int fsl_ssi_probe(struct platform
+ sizeof(fsl_ssi_ac97_dai));
+
+ fsl_ac97_data = ssi_private;
+-
+- ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev);
+- if (ret) {
+- dev_err(&pdev->dev, "could not set AC'97 ops\n");
+- return ret;
+- }
+ } else {
+ /* Initialize this copy of the CPU DAI driver structure */
+ memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template,
+@@ -1475,6 +1469,14 @@ static int fsl_ssi_probe(struct platform
+ return ret;
+ }
+
++ if (fsl_ssi_is_ac97(ssi_private)) {
++ ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev);
++ if (ret) {
++ dev_err(&pdev->dev, "could not set AC'97 ops\n");
++ goto error_ac97_ops;
++ }
++ }
++
+ ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
+ &ssi_private->cpu_dai_drv, 1);
+ if (ret) {
+@@ -1558,6 +1560,10 @@ error_sound_card:
+ fsl_ssi_debugfs_remove(&ssi_private->dbg_stats);
+
+ error_asoc_register:
++ if (fsl_ssi_is_ac97(ssi_private))
++ snd_soc_set_ac97_ops(NULL);
++
++error_ac97_ops:
+ if (ssi_private->soc->imx)
+ fsl_ssi_imx_clean(pdev, ssi_private);
+
diff --git a/patches.drivers/ASoC-twl4030-fix-child-node-lookup b/patches.drivers/ASoC-twl4030-fix-child-node-lookup
new file mode 100644
index 0000000000..d6f8f8f393
--- /dev/null
+++ b/patches.drivers/ASoC-twl4030-fix-child-node-lookup
@@ -0,0 +1,48 @@
+From 15f8c5f2415bfac73f33a14bcd83422bcbfb5298 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Mon, 13 Nov 2017 12:12:56 +0100
+Subject: [PATCH] ASoC: twl4030: fix child-node lookup
+Git-commit: 15f8c5f2415bfac73f33a14bcd83422bcbfb5298
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+Fix child-node lookup during probe, which ended up searching the whole
+device tree depth-first starting at the parent rather than just matching
+on its children.
+
+To make things worse, the parent codec node was also prematurely freed,
+while the child node was leaked.
+
+Fixes: 2d6d649a2e0f ("ASoC: twl4030: Support for DT booted kernel")
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: stable <stable@vger.kernel.org>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/soc/codecs/twl4030.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/twl4030.c
++++ b/sound/soc/codecs/twl4030.c
+@@ -232,7 +232,7 @@ static struct twl4030_codec_data *twl403
+ struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev);
+ struct device_node *twl4030_codec_node = NULL;
+
+- twl4030_codec_node = of_find_node_by_name(codec->dev->parent->of_node,
++ twl4030_codec_node = of_get_child_by_name(codec->dev->parent->of_node,
+ "codec");
+
+ if (!pdata && twl4030_codec_node) {
+@@ -241,9 +241,11 @@ static struct twl4030_codec_data *twl403
+ GFP_KERNEL);
+ if (!pdata) {
+ dev_err(codec->dev, "Can not allocate memory\n");
++ of_node_put(twl4030_codec_node);
+ return NULL;
+ }
+ twl4030_setup_pdata_of(pdata, twl4030_codec_node);
++ of_node_put(twl4030_codec_node);
+ }
+
+ return pdata;
diff --git a/patches.drivers/ASoC-wm_adsp-Fix-validation-of-firmware-and-coeff-le b/patches.drivers/ASoC-wm_adsp-Fix-validation-of-firmware-and-coeff-le
new file mode 100644
index 0000000000..38b0b011c1
--- /dev/null
+++ b/patches.drivers/ASoC-wm_adsp-Fix-validation-of-firmware-and-coeff-le
@@ -0,0 +1,70 @@
+From 50dd2ea8ef67a1617e0c0658bcbec4b9fb03b936 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Date: Fri, 8 Dec 2017 16:15:20 +0000
+Subject: [PATCH] ASoC: wm_adsp: Fix validation of firmware and coeff lengths
+Git-commit: 50dd2ea8ef67a1617e0c0658bcbec4b9fb03b936
+Patch-mainline: 4.15-rc6
+References: bsc#1031717
+
+The checks for whether another region/block header could be present
+are subtracting the size from the current offset. Obviously we should
+instead subtract the offset from the size.
+
+The checks for whether the region/block data fit in the file are
+adding the data size to the current offset and header size, without
+checking for integer overflow. Rearrange these so that overflow is
+impossible.
+
+Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: stable@vger.kernel.org
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/soc/codecs/wm_adsp.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/sound/soc/codecs/wm_adsp.c
++++ b/sound/soc/codecs/wm_adsp.c
+@@ -1160,7 +1160,7 @@ static int wm_adsp_load(struct wm_adsp *
+ le64_to_cpu(footer->timestamp));
+
+ while (pos < firmware->size &&
+- pos - firmware->size > sizeof(*region)) {
++ sizeof(*region) < firmware->size - pos) {
+ region = (void *)&(firmware->data[pos]);
+ region_name = "Unknown";
+ reg = 0;
+@@ -1221,8 +1221,8 @@ static int wm_adsp_load(struct wm_adsp *
+ regions, le32_to_cpu(region->len), offset,
+ region_name);
+
+- if ((pos + le32_to_cpu(region->len) + sizeof(*region)) >
+- firmware->size) {
++ if (le32_to_cpu(region->len) >
++ firmware->size - pos - sizeof(*region)) {
+ adsp_err(dsp,
+ "%s.%d: %s region len %d bytes exceeds file length %zu\n",
+ file, regions, region_name,
+@@ -1662,7 +1662,7 @@ static int wm_adsp_load_coeff(struct wm_
+
+ blocks = 0;
+ while (pos < firmware->size &&
+- pos - firmware->size > sizeof(*blk)) {
++ sizeof(*blk) < firmware->size - pos) {
+ blk = (void*)(&firmware->data[pos]);
+
+ type = le16_to_cpu(blk->type);
+@@ -1742,8 +1742,8 @@ static int wm_adsp_load_coeff(struct wm_
+ }
+
+ if (reg) {
+- if ((pos + le32_to_cpu(blk->len) + sizeof(*blk)) >
+- firmware->size) {
++ if (le32_to_cpu(blk->len) >
++ firmware->size - pos - sizeof(*blk)) {
+ adsp_err(dsp,
+ "%s.%d: %s region len %d bytes exceeds file length %zu\n",
+ file, blocks, region_name,
diff --git a/patches.drivers/mm-x86-get_user_pages-for-dax-mappings.patch b/patches.drivers/mm-x86-get_user_pages-for-dax-mappings.patch
index fdb59f5ebf..345d2756f6 100644
--- a/patches.drivers/mm-x86-get_user_pages-for-dax-mappings.patch
+++ b/patches.drivers/mm-x86-get_user_pages-for-dax-mappings.patch
@@ -26,14 +26,14 @@ Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Jeff Mahoney <jeffm@suse.com>
---
arch/x86/include/asm/pgtable.h | 7 ++++
- arch/x86/mm/gup.c | 57 ++++++++++++++++++++++++++++++++++-
+ arch/x86/mm/gup.c | 57 ++++++++++++++++++++++++++++++++++--
include/linux/huge_mm.h | 10 +++++-
include/linux/mm.h | 48 ++++++++++++++++++++++--------
kernel/memremap.c | 12 +++++++
- mm/gup.c | 30 +++++++++++++++++-
- mm/huge_memory.c | 65 ++++++++++++++++++++++++++++++++++-------
+ mm/gup.c | 30 +++++++++++++++++--
+ mm/huge_memory.c | 64 +++++++++++++++++++++++++++++++++++------
mm/swap.c | 3 +
- 8 files changed, 203 insertions(+), 29 deletions(-)
+ 8 files changed, 203 insertions(+), 28 deletions(-)
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -440,7 +440,7 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
struct vm_area_struct *vma)
-@@ -1336,16 +1389,8 @@ struct page *follow_trans_huge_pmd(struc
+@@ -1336,15 +1389,8 @@ struct page *follow_trans_huge_pmd(struc
page = pmd_page(*pmd);
VM_BUG_ON_PAGE(!PageHead(page), page);
@@ -449,9 +449,8 @@ Acked-by: Jeff Mahoney <jeffm@suse.com>
- _pmd = pmd_mkyoung(*pmd);
- if (flags & FOLL_WRITE)
- _pmd = pmd_mkdirty(_pmd);
--
- if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
-- pmd, _pmd, flags & FOLL_WRITE))
+- pmd, _pmd, flags & FOLL_WRITE))
- update_mmu_cache_pmd(vma, addr, pmd);
- }
+ if (flags & FOLL_TOUCH)
diff --git a/patches.fixes/ipsec-Fix-aborted-xfrm-policy-dump-crash.patch b/patches.fixes/ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
deleted file mode 100644
index cad11b4a20..0000000000
--- a/patches.fixes/ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From: Herbert Xu <herbert@gondor.apana.org.au>
-Date: Thu, 19 Oct 2017 20:51:10 +0800
-Subject: ipsec: Fix aborted xfrm policy dump crash
-Patch-mainline: v4.14-rc7
-Git-commit: 1137b5e2529a8f5ca8ee709288ecba3e68044df2
-References: CVE-2017-16939 bsc#1069702
-
-An independent security researcher, Mohamed Ghannam, has reported
-this vulnerability to Beyond Security's SecuriTeam Secure Disclosure
-program.
-
-The xfrm_dump_policy_done function expects xfrm_dump_policy to
-have been called at least once or it will crash. This can be
-triggered if a dump fails because the target socket's receive
-buffer is full.
-
-This patch fixes it by using the cb->start mechanism to ensure that
-the initialisation is always done regardless of the buffer situation.
-
-Fixes: 12a169e7d8f4 ("ipsec: Put dumpers on the dump list")
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
-Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
-
-SLE12: as cb->start callback wasn't added until 4.5-rc1, different
-approach is taken: preserve the use of cb->args[0] as a flag indicating
-the walk structure has been initialized (which is already used to work
-around the missing start callback) and call xfrm_policy_walk_done() only
-when it is set. (Credit for the idea to Nicolai Stange.)
-
----
- net/xfrm/xfrm_user.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
-index 82891b16563c..524424b462f9 100644
---- a/net/xfrm/xfrm_user.c
-+++ b/net/xfrm/xfrm_user.c
-@@ -1655,7 +1655,9 @@ static int xfrm_dump_policy_done(struct netlink_callback *cb)
- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
- struct net *net = sock_net(cb->skb->sk);
-
-- xfrm_policy_walk_done(walk, net);
-+ /* cb->args[0] is set when walk is initialized */
-+ if (cb->args[0])
-+ xfrm_policy_walk_done(walk, net);
- return 0;
- }
-
---
-2.15.0
-
diff --git a/patches.kabi/revert-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch b/patches.kabi/revert-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
new file mode 100644
index 0000000000..9dc0a8c7ee
--- /dev/null
+++ b/patches.kabi/revert-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
@@ -0,0 +1,92 @@
+From: Jiri Slaby <jslaby@suse.cz>
+Date: Wed, 3 Jan 2018 23:00:57 +0100
+Subject: Revert "ipsec: Fix aborted xfrm policy dump crash"
+Patch-mainline: never, kabi
+References: kabi
+
+This reverts commit b377c453b3631531679cbe594b7d28c5ecd82cea, upstream
+commit 1137b5e2529a8f5ca8ee709288ecba3e68044df2. It depends on commit
+commit 27248d2fa77f028f639f2cbac621447cc94dbbb5, upstream commit
+fc9e50f5a5a4e1fa9ba2756f745a13e693cf6a06, which breaks kABI.
+
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ net/xfrm/xfrm_user.c | 25 ++++++++++---------------
+ 1 file changed, 10 insertions(+), 15 deletions(-)
+
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
+index 76944a4839a5..7a5a64e70b4d 100644
+--- a/net/xfrm/xfrm_user.c
++++ b/net/xfrm/xfrm_user.c
+@@ -1652,34 +1652,32 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
+
+ static int xfrm_dump_policy_done(struct netlink_callback *cb)
+ {
+- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
++ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
+ struct net *net = sock_net(cb->skb->sk);
+
+ xfrm_policy_walk_done(walk, net);
+ return 0;
+ }
+
+-static int xfrm_dump_policy_start(struct netlink_callback *cb)
+-{
+- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
+-
+- BUILD_BUG_ON(sizeof(*walk) > sizeof(cb->args));
+-
+- xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
+- return 0;
+-}
+-
+ static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)
+ {
+ struct net *net = sock_net(skb->sk);
+- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
++ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
+ struct xfrm_dump_info info;
+
++ BUILD_BUG_ON(sizeof(struct xfrm_policy_walk) >
++ sizeof(cb->args) - sizeof(cb->args[0]));
++
+ info.in_skb = cb->skb;
+ info.out_skb = skb;
+ info.nlmsg_seq = cb->nlh->nlmsg_seq;
+ info.nlmsg_flags = NLM_F_MULTI;
+
++ if (!cb->args[0]) {
++ cb->args[0] = 1;
++ xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
++ }
++
+ (void) xfrm_policy_walk(net, walk, dump_one_policy, &info);
+
+ return skb->len;
+@@ -2417,7 +2415,6 @@ static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = {
+
+ static const struct xfrm_link {
+ int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **);
+- int (*start)(struct netlink_callback *);
+ int (*dump)(struct sk_buff *, struct netlink_callback *);
+ int (*done)(struct netlink_callback *);
+ const struct nla_policy *nla_pol;
+@@ -2431,7 +2428,6 @@ static const struct xfrm_link {
+ [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy },
+ [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy },
+ [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy,
+- .start = xfrm_dump_policy_start,
+ .dump = xfrm_dump_policy,
+ .done = xfrm_dump_policy_done },
+ [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi },
+@@ -2483,7 +2479,6 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
+
+ {
+ struct netlink_dump_control c = {
+- .start = link->start,
+ .dump = link->dump,
+ .done = link->done,
+ };
+--
+2.15.1
+
diff --git a/patches.kabi/revert-netlink-add-a-start-callback-for-starting-a-n.patch b/patches.kabi/revert-netlink-add-a-start-callback-for-starting-a-n.patch
new file mode 100644
index 0000000000..e4f9a756c7
--- /dev/null
+++ b/patches.kabi/revert-netlink-add-a-start-callback-for-starting-a-n.patch
@@ -0,0 +1,124 @@
+From: Jiri Slaby <jslaby@suse.cz>
+Date: Wed, 3 Jan 2018 23:02:58 +0100
+Subject: Revert "netlink: add a start callback for starting a netlink dump"
+Patch-mainline: never, kabi
+References: kabi
+
+This reverts commit 27248d2fa77f028f639f2cbac621447cc94dbbb5, upstram
+commit fc9e50f5a5a4e1fa9ba2756f745a13e693cf6a06. It breaks kABI and I
+see no way out.
+
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ include/linux/netlink.h | 2 --
+ include/net/genetlink.h | 2 --
+ net/netlink/af_netlink.c | 4 ----
+ net/netlink/genetlink.c | 16 ----------------
+ 4 files changed, 24 deletions(-)
+
+diff --git a/include/linux/netlink.h b/include/linux/netlink.h
+index 0b41959aab9f..639e9b8b0e4d 100644
+--- a/include/linux/netlink.h
++++ b/include/linux/netlink.h
+@@ -131,7 +131,6 @@ netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
+ struct netlink_callback {
+ struct sk_buff *skb;
+ const struct nlmsghdr *nlh;
+- int (*start)(struct netlink_callback *);
+ int (*dump)(struct sk_buff * skb,
+ struct netlink_callback *cb);
+ int (*done)(struct netlink_callback *cb);
+@@ -154,7 +153,6 @@ struct nlmsghdr *
+ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
+
+ struct netlink_dump_control {
+- int (*start)(struct netlink_callback *);
+ int (*dump)(struct sk_buff *skb, struct netlink_callback *);
+ int (*done)(struct netlink_callback *);
+ void *data;
+diff --git a/include/net/genetlink.h b/include/net/genetlink.h
+index 43c0e771f417..1b6b6dcb018d 100644
+--- a/include/net/genetlink.h
++++ b/include/net/genetlink.h
+@@ -114,7 +114,6 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
+ * @flags: flags
+ * @policy: attribute validation policy
+ * @doit: standard command callback
+- * @start: start callback for dumps
+ * @dumpit: callback for dumpers
+ * @done: completion callback for dumps
+ * @ops_list: operations list
+@@ -123,7 +122,6 @@ struct genl_ops {
+ const struct nla_policy *policy;
+ int (*doit)(struct sk_buff *skb,
+ struct genl_info *info);
+- int (*start)(struct netlink_callback *cb);
+ int (*dumpit)(struct sk_buff *skb,
+ struct netlink_callback *cb);
+ int (*done)(struct netlink_callback *cb);
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
+index a87afc4f3c91..9ecdd61c6463 100644
+--- a/net/netlink/af_netlink.c
++++ b/net/netlink/af_netlink.c
+@@ -2203,7 +2203,6 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+
+ cb = &nlk->cb;
+ memset(cb, 0, sizeof(*cb));
+- cb->start = control->start;
+ cb->dump = control->dump;
+ cb->done = control->done;
+ cb->nlh = nlh;
+@@ -2217,9 +2216,6 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+
+ mutex_unlock(nlk->cb_mutex);
+
+- if (cb->start)
+- cb->start(cb);
+-
+ ret = netlink_dump(sk);
+ sock_put(sk);
+
+diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
+index 8e63662c6fb0..bc0e504f33a6 100644
+--- a/net/netlink/genetlink.c
++++ b/net/netlink/genetlink.c
+@@ -513,20 +513,6 @@ void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
+ }
+ EXPORT_SYMBOL(genlmsg_put);
+
+-static int genl_lock_start(struct netlink_callback *cb)
+-{
+- /* our ops are always const - netlink API doesn't propagate that */
+- const struct genl_ops *ops = cb->data;
+- int rc = 0;
+-
+- if (ops->start) {
+- genl_lock();
+- rc = ops->start(cb);
+- genl_unlock();
+- }
+- return rc;
+-}
+-
+ static int genl_lock_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
+ {
+ /* our ops are always const - netlink API doesn't propagate that */
+@@ -591,7 +577,6 @@ static int genl_family_rcv_msg(struct genl_family *family,
+ .module = family->module,
+ /* we have const, but the netlink API doesn't */
+ .data = (void *)ops,
+- .start = genl_lock_start,
+ .dump = genl_lock_dumpit,
+ .done = genl_lock_done,
+ };
+@@ -603,7 +588,6 @@ static int genl_family_rcv_msg(struct genl_family *family,
+ } else {
+ struct netlink_dump_control c = {
+ .module = family->module,
+- .start = ops->start,
+ .dump = ops->dumpit,
+ .done = ops->done,
+ };
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-001-netlink-add-a-start-callback-for-starting-a-n.patch b/patches.kernel.org/4.4.104-001-netlink-add-a-start-callback-for-starting-a-n.patch
new file mode 100644
index 0000000000..4e0642f50a
--- /dev/null
+++ b/patches.kernel.org/4.4.104-001-netlink-add-a-start-callback-for-starting-a-n.patch
@@ -0,0 +1,131 @@
+From: Tom Herbert <tom@herbertland.com>
+Date: Tue, 15 Dec 2015 15:41:37 -0800
+Subject: [PATCH] netlink: add a start callback for starting a netlink dump
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: fc9e50f5a5a4e1fa9ba2756f745a13e693cf6a06
+
+commit fc9e50f5a5a4e1fa9ba2756f745a13e693cf6a06 upstream.
+
+The start callback allows the caller to set up a context for the
+dump callbacks. Presumably, the context can then be destroyed in
+the done callback.
+
+Signed-off-by: Tom Herbert <tom@herbertland.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ include/linux/netlink.h | 2 ++
+ include/net/genetlink.h | 2 ++
+ net/netlink/af_netlink.c | 4 ++++
+ net/netlink/genetlink.c | 16 ++++++++++++++++
+ 4 files changed, 24 insertions(+)
+
+diff --git a/include/linux/netlink.h b/include/linux/netlink.h
+index 639e9b8b0e4d..0b41959aab9f 100644
+--- a/include/linux/netlink.h
++++ b/include/linux/netlink.h
+@@ -131,6 +131,7 @@ netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
+ struct netlink_callback {
+ struct sk_buff *skb;
+ const struct nlmsghdr *nlh;
++ int (*start)(struct netlink_callback *);
+ int (*dump)(struct sk_buff * skb,
+ struct netlink_callback *cb);
+ int (*done)(struct netlink_callback *cb);
+@@ -153,6 +154,7 @@ struct nlmsghdr *
+ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
+
+ struct netlink_dump_control {
++ int (*start)(struct netlink_callback *);
+ int (*dump)(struct sk_buff *skb, struct netlink_callback *);
+ int (*done)(struct netlink_callback *);
+ void *data;
+diff --git a/include/net/genetlink.h b/include/net/genetlink.h
+index 1b6b6dcb018d..43c0e771f417 100644
+--- a/include/net/genetlink.h
++++ b/include/net/genetlink.h
+@@ -114,6 +114,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
+ * @flags: flags
+ * @policy: attribute validation policy
+ * @doit: standard command callback
++ * @start: start callback for dumps
+ * @dumpit: callback for dumpers
+ * @done: completion callback for dumps
+ * @ops_list: operations list
+@@ -122,6 +123,7 @@ struct genl_ops {
+ const struct nla_policy *policy;
+ int (*doit)(struct sk_buff *skb,
+ struct genl_info *info);
++ int (*start)(struct netlink_callback *cb);
+ int (*dumpit)(struct sk_buff *skb,
+ struct netlink_callback *cb);
+ int (*done)(struct netlink_callback *cb);
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
+index 9ecdd61c6463..a87afc4f3c91 100644
+--- a/net/netlink/af_netlink.c
++++ b/net/netlink/af_netlink.c
+@@ -2203,6 +2203,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+
+ cb = &nlk->cb;
+ memset(cb, 0, sizeof(*cb));
++ cb->start = control->start;
+ cb->dump = control->dump;
+ cb->done = control->done;
+ cb->nlh = nlh;
+@@ -2216,6 +2217,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
+
+ mutex_unlock(nlk->cb_mutex);
+
++ if (cb->start)
++ cb->start(cb);
++
+ ret = netlink_dump(sk);
+ sock_put(sk);
+
+diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
+index bc0e504f33a6..8e63662c6fb0 100644
+--- a/net/netlink/genetlink.c
++++ b/net/netlink/genetlink.c
+@@ -513,6 +513,20 @@ void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
+ }
+ EXPORT_SYMBOL(genlmsg_put);
+
++static int genl_lock_start(struct netlink_callback *cb)
++{
++ /* our ops are always const - netlink API doesn't propagate that */
++ const struct genl_ops *ops = cb->data;
++ int rc = 0;
++
++ if (ops->start) {
++ genl_lock();
++ rc = ops->start(cb);
++ genl_unlock();
++ }
++ return rc;
++}
++
+ static int genl_lock_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
+ {
+ /* our ops are always const - netlink API doesn't propagate that */
+@@ -577,6 +591,7 @@ static int genl_family_rcv_msg(struct genl_family *family,
+ .module = family->module,
+ /* we have const, but the netlink API doesn't */
+ .data = (void *)ops,
++ .start = genl_lock_start,
+ .dump = genl_lock_dumpit,
+ .done = genl_lock_done,
+ };
+@@ -588,6 +603,7 @@ static int genl_family_rcv_msg(struct genl_family *family,
+ } else {
+ struct netlink_dump_control c = {
+ .module = family->module,
++ .start = ops->start,
+ .dump = ops->dumpit,
+ .done = ops->done,
+ };
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-002-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch b/patches.kernel.org/4.4.104-002-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
new file mode 100644
index 0000000000..4ae23f9d3b
--- /dev/null
+++ b/patches.kernel.org/4.4.104-002-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
@@ -0,0 +1,107 @@
+From: Herbert Xu <herbert@gondor.apana.org.au>
+Date: Thu, 19 Oct 2017 20:51:10 +0800
+Subject: [PATCH] ipsec: Fix aborted xfrm policy dump crash
+Patch-mainline: 4.4.104
+References: CVE-2017-16939 bnc#1012382 bsc#1069702
+Git-commit: 1137b5e2529a8f5ca8ee709288ecba3e68044df2
+
+commit 1137b5e2529a8f5ca8ee709288ecba3e68044df2 upstream.
+
+An independent security researcher, Mohamed Ghannam, has reported
+this vulnerability to Beyond Security's SecuriTeam Secure Disclosure
+program.
+
+The xfrm_dump_policy_done function expects xfrm_dump_policy to
+have been called at least once or it will crash. This can be
+triggered if a dump fails because the target socket's receive
+buffer is full.
+
+This patch fixes it by using the cb->start mechanism to ensure that
+the initialisation is always done regardless of the buffer situation.
+
+Fixes: 12a169e7d8f4 ("ipsec: Put dumpers on the dump list")
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ net/xfrm/xfrm_user.c | 25 +++++++++++++++----------
+ 1 file changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
+index 7a5a64e70b4d..76944a4839a5 100644
+--- a/net/xfrm/xfrm_user.c
++++ b/net/xfrm/xfrm_user.c
+@@ -1652,32 +1652,34 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
+
+ static int xfrm_dump_policy_done(struct netlink_callback *cb)
+ {
+- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
++ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
+ struct net *net = sock_net(cb->skb->sk);
+
+ xfrm_policy_walk_done(walk, net);
+ return 0;
+ }
+
++static int xfrm_dump_policy_start(struct netlink_callback *cb)
++{
++ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
++
++ BUILD_BUG_ON(sizeof(*walk) > sizeof(cb->args));
++
++ xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
++ return 0;
++}
++
+ static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)
+ {
+ struct net *net = sock_net(skb->sk);
+- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
++ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
+ struct xfrm_dump_info info;
+
+- BUILD_BUG_ON(sizeof(struct xfrm_policy_walk) >
+- sizeof(cb->args) - sizeof(cb->args[0]));
+-
+ info.in_skb = cb->skb;
+ info.out_skb = skb;
+ info.nlmsg_seq = cb->nlh->nlmsg_seq;
+ info.nlmsg_flags = NLM_F_MULTI;
+
+- if (!cb->args[0]) {
+- cb->args[0] = 1;
+- xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
+- }
+-
+ (void) xfrm_policy_walk(net, walk, dump_one_policy, &info);
+
+ return skb->len;
+@@ -2415,6 +2417,7 @@ static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = {
+
+ static const struct xfrm_link {
+ int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **);
++ int (*start)(struct netlink_callback *);
+ int (*dump)(struct sk_buff *, struct netlink_callback *);
+ int (*done)(struct netlink_callback *);
+ const struct nla_policy *nla_pol;
+@@ -2428,6 +2431,7 @@ static const struct xfrm_link {
+ [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy },
+ [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy },
+ [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy,
++ .start = xfrm_dump_policy_start,
+ .dump = xfrm_dump_policy,
+ .done = xfrm_dump_policy_done },
+ [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi },
+@@ -2479,6 +2483,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
+
+ {
+ struct netlink_dump_control c = {
++ .start = link->start,
+ .dump = link->dump,
+ .done = link->done,
+ };
+--
+2.15.1
+
diff --git a/patches.arch/0002-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-frame-n.patch b/patches.kernel.org/4.4.104-003-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-.patch
index 1eed4b457f..a176a01507 100644
--- a/patches.arch/0002-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-frame-n.patch
+++ b/patches.kernel.org/4.4.104-003-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-.patch
@@ -1,12 +1,11 @@
-From edc3b9129cecd0f0857112136f5b8b1bc1d45918 Mon Sep 17 00:00:00 2001
From: Matt Fleming <matt@codeblueprint.co.uk>
Date: Fri, 27 Nov 2015 21:09:31 +0000
-Subject: [PATCH 2/6] x86/mm/pat: Ensure cpa->pfn only contains page frame
- numbers
-
+Subject: [PATCH] x86/mm/pat: Ensure cpa->pfn only contains page frame numbers
+Patch-mainline: 4.4.104
+References: FATE#320588 bnc#1012382
Git-commit: edc3b9129cecd0f0857112136f5b8b1bc1d45918
-Patch-mainline: v4.6-rc1
-References: fate#320588
+
+commit edc3b9129cecd0f0857112136f5b8b1bc1d45918 upstream.
The x86 pageattr code is confused about the data that is stored
in cpa->pfn, sometimes it's treated as a page frame number,
@@ -40,15 +39,19 @@ Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1448658575-17029-3-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Acked-by: Lee, Chun-Yi <jlee@suse.com>
+Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- arch/x86/mm/pageattr.c | 17 ++++++-----------
- arch/x86/platform/efi/efi_64.c | 16 ++++++++++------
+ arch/x86/mm/pageattr.c | 17 ++++++-----------
+ arch/x86/platform/efi/efi_64.c | 16 ++++++++++------
2 files changed, 16 insertions(+), 17 deletions(-)
+diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
+index b599a780a5a9..a0fe62e3f4a3 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
-@@ -911,15 +911,10 @@ static void populate_pte(struct cpa_data
+@@ -911,15 +911,10 @@ static void populate_pte(struct cpa_data *cpa,
pte = pte_offset_kernel(pmd, start);
while (num_pages-- && start < end) {
@@ -66,7 +69,7 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
pte++;
}
}
-@@ -975,11 +970,11 @@ static int populate_pmd(struct cpa_data
+@@ -975,11 +970,11 @@ static int populate_pmd(struct cpa_data *cpa,
pmd = pmd_offset(pud, start);
@@ -80,7 +83,7 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
cur_pages += PMD_SIZE >> PAGE_SHIFT;
}
-@@ -1048,11 +1043,11 @@ static int populate_pud(struct cpa_data
+@@ -1048,11 +1043,11 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd,
* Map everything starting from the Gb boundary, possibly with 1G pages
*/
while (end - start >= PUD_SIZE) {
@@ -94,9 +97,11 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
cur_pages += PUD_SIZE >> PAGE_SHIFT;
pud++;
}
+diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
+index a0ac0f9c307f..5aa186db59e3 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
-@@ -210,7 +210,7 @@ void efi_sync_low_kernel_mappings(void)
+@@ -143,7 +143,7 @@ void efi_sync_low_kernel_mappings(void)
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
@@ -105,7 +110,7 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
struct page *page;
unsigned npages;
pgd_t *pgd;
-@@ -227,7 +227,8 @@ int __init efi_setup_page_tables(unsigne
+@@ -160,7 +160,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
* and ident-map those pages containing the map before calling
* phys_efi_set_virtual_address_map().
*/
@@ -115,7 +120,7 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
pr_err("Error ident-mapping new memmap (0x%lx)!\n", pa_memmap);
return 1;
}
-@@ -252,8 +253,9 @@ int __init efi_setup_page_tables(unsigne
+@@ -185,8 +186,9 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
npages = (_end - _text) >> PAGE_SHIFT;
text = __pa(_text);
@@ -126,14 +131,13 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
pr_err("Failed to map kernel text 1:1\n");
return 1;
}
-@@ -268,13 +270,15 @@ void __init efi_cleanup_page_tables(unsi
-
+@@ -204,12 +206,14 @@ void __init efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages)
static void __init __map_region(efi_memory_desc_t *md, u64 va)
{
+ pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
- unsigned long pf = 0;
+ unsigned long flags = 0;
+ unsigned long pfn;
- pgd_t *pgd = efi_pgd;
if (!(md->attribute & EFI_MEMORY_WB))
- pf |= _PAGE_PCD;
@@ -145,3 +149,6 @@ Acked-by: Lee, Chun-Yi <jlee@suse.com>
pr_warn("Error mapping PA 0x%llx -> VA 0x%llx!\n",
md->phys_addr, va);
}
+--
+2.15.1
+
diff --git a/patches.arch/qcom-0016-x86-efi-Hoist-page-table-switching-code-into-efi_cal.patch b/patches.kernel.org/4.4.104-004-x86-efi-Hoist-page-table-switching-code-into-.patch
index 86827a81d1..bf77219dde 100644
--- a/patches.arch/qcom-0016-x86-efi-Hoist-page-table-switching-code-into-efi_cal.patch
+++ b/patches.kernel.org/4.4.104-004-x86-efi-Hoist-page-table-switching-code-into-.patch
@@ -1,9 +1,11 @@
From: Matt Fleming <matt@codeblueprint.co.uk>
Date: Fri, 27 Nov 2015 21:09:33 +0000
-Subject: x86/efi: Hoist page table switching code into efi_call_virt()
+Subject: [PATCH] x86/efi: Hoist page table switching code into efi_call_virt()
+Patch-mainline: 4.4.104
+References: FATE#320512 bnc#1012382
Git-commit: c9f2a9a65e4855b74d92cdad688f6ee4a1a323ff
-Patch-mainline: v4.6-rc1
-References: fate#320512
+
+commit c9f2a9a65e4855b74d92cdad688f6ee4a1a323ff upstream.
This change is a prerequisite for pending patches that switch to
a dedicated EFI page table, instead of using 'trampoline_pgd'
@@ -38,24 +40,28 @@ Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1448658575-17029-5-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- arch/x86/include/asm/efi.h | 25 ++++++++++++++++++++
- arch/x86/platform/efi/efi_64.c | 24 +++++++++-----------
- arch/x86/platform/efi/efi_stub_64.S | 43 ------------------------------------
+ arch/x86/include/asm/efi.h | 25 +++++++++++++++++++++
+ arch/x86/platform/efi/efi_64.c | 24 ++++++++++-----------
+ arch/x86/platform/efi/efi_stub_64.S | 43 -------------------------------------
3 files changed, 36 insertions(+), 56 deletions(-)
+diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
+index 0010c78c4998..347eeacb06a8 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
-@@ -4,6 +4,7 @@
+@@ -3,6 +3,7 @@
+
#include <asm/fpu/api.h>
#include <asm/pgtable.h>
- #include <asm/processor-flags.h>
+#include <asm/tlb.h>
/*
* We map the EFI regions needed for runtime services non-contiguously,
-@@ -54,11 +55,29 @@ extern u64 asmlinkage efi_call(void *fp,
+@@ -64,6 +65,17 @@ extern u64 asmlinkage efi_call(void *fp, ...);
#define efi_call_phys(f, args...) efi_call((f), args)
@@ -70,8 +76,10 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+ u64 phys_stack;
+} __packed;
+
- #define arch_efi_call_virt_setup() \
+ #define efi_call_virt(f, ...) \
({ \
+ efi_status_t __s; \
+@@ -71,7 +83,20 @@ extern u64 asmlinkage efi_call(void *fp, ...);
efi_sync_low_kernel_mappings(); \
preempt_disable(); \
__kernel_fpu_begin(); \
@@ -82,13 +90,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+ __flush_tlb_all(); \
+ } \
+ \
- })
-
- #define arch_efi_call_virt(f, args...) \
-@@ -66,6 +85,12 @@ extern u64 asmlinkage efi_call(void *fp,
-
- #define arch_efi_call_virt_teardown() \
- ({ \
+ __s = efi_call((void *)efi.systab->runtime->f, __VA_ARGS__); \
+ \
+ if (efi_scratch.use_pgd) { \
+ write_cr3(efi_scratch.prev_cr3); \
@@ -97,7 +99,9 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+ \
__kernel_fpu_end(); \
preempt_enable(); \
- })
+ __s; \
+diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
+index 5aa186db59e3..be8a32416e12 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -47,16 +47,7 @@
@@ -118,7 +122,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
static void __init early_code_mapping_set_exec(int executable)
{
-@@ -81,8 +72,11 @@ pgd_t * __init efi_call_phys_prolog(void
+@@ -83,8 +74,11 @@ pgd_t * __init efi_call_phys_prolog(void)
int pgd;
int n_pgds;
@@ -132,7 +136,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
early_code_mapping_set_exec(1);
-@@ -94,6 +88,7 @@ pgd_t * __init efi_call_phys_prolog(void
+@@ -96,6 +90,7 @@ pgd_t * __init efi_call_phys_prolog(void)
vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
}
@@ -140,7 +144,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
__flush_tlb_all();
return save_pgd;
-@@ -107,8 +102,11 @@ void __init efi_call_phys_epilog(pgd_t *
+@@ -109,8 +104,11 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
int pgd_idx;
int nr_pgds;
@@ -153,6 +157,8 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
+diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S
+index 86d0f9e08dd9..32020cb8bb08 100644
--- a/arch/x86/platform/efi/efi_stub_64.S
+++ b/arch/x86/platform/efi/efi_stub_64.S
@@ -38,41 +38,6 @@
@@ -214,3 +220,6 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
- .fill 3,8,0
- .byte 0
- .quad 0
+--
+2.15.1
+
diff --git a/patches.arch/qcom-0017-x86-efi-Build-our-own-page-table-structures.patch b/patches.kernel.org/4.4.104-005-x86-efi-Build-our-own-page-table-structures.patch
index 6315324fa4..be9178fa85 100644
--- a/patches.arch/qcom-0017-x86-efi-Build-our-own-page-table-structures.patch
+++ b/patches.kernel.org/4.4.104-005-x86-efi-Build-our-own-page-table-structures.patch
@@ -1,9 +1,11 @@
From: Matt Fleming <matt@codeblueprint.co.uk>
Date: Fri, 27 Nov 2015 21:09:34 +0000
-Subject: x86/efi: Build our own page table structures
+Subject: [PATCH] x86/efi: Build our own page table structures
+Patch-mainline: 4.4.104
+References: FATE#320512 bnc#1012382
Git-commit: 67a9108ed4313b85a9c53406d80dc1ae3f8c3e36
-Patch-mainline: v4.6-rc1
-References: fate#320512
+
+commit 67a9108ed4313b85a9c53406d80dc1ae3f8c3e36 upstream.
With commit e1a58320a38d ("x86/mm: Warn on W^X mappings") all
users booting on 64-bit UEFI machines see the following warning,
@@ -61,17 +63,21 @@ Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1448658575-17029-6-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- arch/x86/include/asm/efi.h | 1
- arch/x86/platform/efi/efi.c | 39 +++++-----------
- arch/x86/platform/efi/efi_32.c | 5 ++
- arch/x86/platform/efi/efi_64.c | 97 ++++++++++++++++++++++++++++++++++-------
+ arch/x86/include/asm/efi.h | 1 +
+ arch/x86/platform/efi/efi.c | 39 ++++++-----------
+ arch/x86/platform/efi/efi_32.c | 5 +++
+ arch/x86/platform/efi/efi_64.c | 97 +++++++++++++++++++++++++++++++++++-------
4 files changed, 102 insertions(+), 40 deletions(-)
+diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
+index 347eeacb06a8..8fd9e637629a 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
-@@ -123,6 +123,7 @@ extern void __init efi_memory_uc(u64 add
+@@ -136,6 +136,7 @@ extern void __init efi_memory_uc(u64 addr, unsigned long size);
extern void __init efi_map_region(efi_memory_desc_t *md);
extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
extern void efi_sync_low_kernel_mappings(void);
@@ -79,9 +85,11 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
extern int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages);
extern void __init efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages);
extern void __init old_map_region(efi_memory_desc_t *md);
+diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
+index ad285404ea7f..3c1f3cd7b2ba 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
-@@ -854,7 +854,7 @@ static void __init kexec_enter_virtual_m
+@@ -869,7 +869,7 @@ static void __init kexec_enter_virtual_mode(void)
* This function will switch the EFI runtime services to virtual mode.
* Essentially, we look through the EFI memmap and map every region that
* has the runtime attribute bit set in its memory descriptor into the
@@ -90,7 +98,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
*
* The old method which used to update that memory descriptor with the
* virtual address obtained from ioremap() is still supported when the
-@@ -864,8 +864,8 @@ static void __init kexec_enter_virtual_m
+@@ -879,8 +879,8 @@ static void __init kexec_enter_virtual_mode(void)
*
* The new method does a pagetable switch in a preemption-safe manner
* so that we're in a different address space when calling a runtime
@@ -101,7 +109,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
*
* Specially for kexec boot, efi runtime maps in previous kernel should
* be passed in via setup_data. In that case runtime ranges will be mapped
-@@ -880,6 +880,12 @@ static void __init __efi_enter_virtual_m
+@@ -895,6 +895,12 @@ static void __init __efi_enter_virtual_mode(void)
efi.systab = NULL;
@@ -114,7 +122,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
efi_merge_regions();
new_memmap = efi_map_regions(&count, &pg_shift);
if (!new_memmap) {
-@@ -939,28 +945,11 @@ static void __init __efi_enter_virtual_m
+@@ -954,28 +960,11 @@ static void __init __efi_enter_virtual_mode(void)
efi_runtime_mkexec();
/*
@@ -148,6 +156,8 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
*
* efi_cleanup_page_tables(__pa(new_memmap), 1 << pg_shift);
*/
+diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
+index ed5b67338294..58d669bc8250 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -38,6 +38,11 @@
@@ -162,6 +172,8 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
void efi_sync_low_kernel_mappings(void) {}
void __init efi_dump_pagetable(void) {}
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
+diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
+index be8a32416e12..18dfaad71c99 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -40,6 +40,7 @@
@@ -172,7 +184,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
/*
* We allocate runtime services regions bottom-up, starting from -4G, i.e.
-@@ -119,22 +120,92 @@ void __init efi_call_phys_epilog(pgd_t *
+@@ -121,22 +122,92 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
early_code_mapping_set_exec(0);
}
@@ -271,7 +283,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
}
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
-@@ -148,8 +219,8 @@ int __init efi_setup_page_tables(unsigne
+@@ -149,8 +220,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
if (efi_enabled(EFI_OLD_MEMMAP))
return 0;
@@ -282,7 +294,7 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
/*
* It can happen that the physical address of new_memmap lands in memory
-@@ -212,15 +283,13 @@ int __init efi_setup_page_tables(unsigne
+@@ -196,16 +267,14 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
void __init efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
@@ -295,12 +307,13 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
static void __init __map_region(efi_memory_desc_t *md, u64 va)
{
- pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
- unsigned long pf = 0;
+ unsigned long flags = 0;
+ unsigned long pfn;
+ pgd_t *pgd = efi_pgd;
if (!(md->attribute & EFI_MEMORY_WB))
- pf |= _PAGE_PCD;
-@@ -328,9 +397,7 @@ void __init efi_runtime_mkexec(void)
+ flags |= _PAGE_PCD;
+@@ -314,9 +383,7 @@ void __init efi_runtime_mkexec(void)
void __init efi_dump_pagetable(void)
{
#ifdef CONFIG_EFI_PGT_DUMP
@@ -311,3 +324,6 @@ Signed-off-by: Matthias Brugger <mbrugger@suse.com>
#endif
}
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-006-ARM-dts-omap3-logicpd-torpedo-37xx-devkit-Fix.patch b/patches.kernel.org/4.4.104-006-ARM-dts-omap3-logicpd-torpedo-37xx-devkit-Fix.patch
new file mode 100644
index 0000000000..afce33ff53
--- /dev/null
+++ b/patches.kernel.org/4.4.104-006-ARM-dts-omap3-logicpd-torpedo-37xx-devkit-Fix.patch
@@ -0,0 +1,40 @@
+From: Adam Ford <aford173@gmail.com>
+Date: Thu, 17 Aug 2017 06:01:28 -0500
+Subject: [PATCH] ARM: dts: omap3: logicpd-torpedo-37xx-devkit: Fix MMC1
+ cd-gpio
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: b7ace5ed8867ca54503727988adec6b20af54eeb
+
+commit b7ace5ed8867ca54503727988adec6b20af54eeb upstream.
+
+Fixes commit 687c27676151 ("ARM: dts: Add minimal support for LogicPD
+Torpedo DM3730 devkit")
+
+This patch corrects an issue where the cd-gpios was improperly setup
+using IRQ_TYPE_LEVEL_LOW instead of GPIO_ACTIVE_LOW.
+
+Signed-off-by: Adam Ford <aford173@gmail.com>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
+index 5b0430041ec6..fec92cd36ae3 100644
+--- a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
++++ b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
+@@ -88,7 +88,7 @@
+ interrupts-extended = <&intc 83 &omap3_pmx_core 0x11a>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc1_pins &mmc1_cd>;
+- cd-gpios = <&gpio4 31 IRQ_TYPE_LEVEL_LOW>; /* gpio127 */
++ cd-gpios = <&gpio4 31 GPIO_ACTIVE_LOW>; /* gpio127 */
+ vmmc-supply = <&vmmc1>;
+ bus-width = <4>;
+ cap-power-off-card;
+--
+2.15.1
+
diff --git a/patches.arch/qcom-0003-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BGRT-data.patch b/patches.kernel.org/4.4.104-007-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BG.patch
index 7687bcacab..97c3b2dfb7 100644
--- a/patches.arch/qcom-0003-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BGRT-data.patch
+++ b/patches.kernel.org/4.4.104-007-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BG.patch
@@ -1,9 +1,11 @@
From: Sai Praneeth <sai.praneeth.prakhya@intel.com>
Date: Wed, 9 Dec 2015 15:41:08 -0800
-Subject: x86/efi-bgrt: Fix kernel panic when mapping BGRT data
+Subject: [PATCH] x86/efi-bgrt: Fix kernel panic when mapping BGRT data
+Patch-mainline: 4.4.104
+References: FATE#320512 bnc#1012382
Git-commit: 50a0cb565246f20d59cdb161778531e4b19d35ac
-Patch-mainline: v4.6-rc1
-References: fate#320512
+
+commit 50a0cb565246f20d59cdb161778531e4b19d35ac upstream.
Starting with this commit 35eb8b81edd4 ("x86/efi: Build our own page
table structures") efi regions have a separate page directory called
@@ -68,17 +70,19 @@ Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
-Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
arch/x86/platform/efi/efi-bgrt.c | 39 ++++++++++++++-------------------------
drivers/firmware/efi/efi.c | 32 --------------------------------
2 files changed, 14 insertions(+), 57 deletions(-)
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
-index 9a52b5c..bf51f4c 100644
+index ea48449b2e63..81c5bcd06b26 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
-@@ -31,8 +31,7 @@ struct bmp_header {
+@@ -28,8 +28,7 @@ struct bmp_header {
void __init efi_bgrt_init(void)
{
acpi_status status;
@@ -88,7 +92,7 @@ index 9a52b5c..bf51f4c 100644
struct bmp_header bmp_header;
if (acpi_disabled)
-@@ -73,20 +72,14 @@ void __init efi_bgrt_init(void)
+@@ -70,20 +69,14 @@ void __init efi_bgrt_init(void)
return;
}
@@ -114,7 +118,7 @@ index 9a52b5c..bf51f4c 100644
bgrt_image_size = bmp_header.size;
bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
-@@ -96,18 +89,14 @@ void __init efi_bgrt_init(void)
+@@ -93,18 +86,14 @@ void __init efi_bgrt_init(void)
return;
}
@@ -142,10 +146,10 @@ index 9a52b5c..bf51f4c 100644
+ early_memunmap(image, bmp_header.size);
}
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
-index 027ca21..e9c458b 100644
+index 3b52677f459a..0cd8f039602e 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
-@@ -324,38 +324,6 @@ u64 __init efi_mem_desc_end(efi_memory_desc_t *md)
+@@ -325,38 +325,6 @@ u64 __init efi_mem_desc_end(efi_memory_desc_t *md)
return end;
}
@@ -185,5 +189,5 @@ index 027ca21..e9c458b 100644
{ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20},
{ACPI_TABLE_GUID, "ACPI", &efi.acpi},
--
-2.10.0
+2.15.1
diff --git a/patches.kernel.org/4.4.104-008-x86-efi-bgrt-Replace-early_memremap-with-memr.patch b/patches.kernel.org/4.4.104-008-x86-efi-bgrt-Replace-early_memremap-with-memr.patch
new file mode 100644
index 0000000000..aa76dedf7d
--- /dev/null
+++ b/patches.kernel.org/4.4.104-008-x86-efi-bgrt-Replace-early_memremap-with-memr.patch
@@ -0,0 +1,103 @@
+From: Matt Fleming <matt@codeblueprint.co.uk>
+Date: Mon, 21 Dec 2015 14:12:52 +0000
+Subject: [PATCH] x86/efi-bgrt: Replace early_memremap() with memremap()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f
+
+commit e2c90dd7e11e3025b46719a79fb4bb1e7a5cef9f upstream.
+
+Môshe reported the following warning triggered on his machine since
+commit 50a0cb565246 ("x86/efi-bgrt: Fix kernel panic when mapping BGRT
+data"),
+
+ [ 0.026936] ------------[ cut here ]------------
+ [ 0.026941] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:137 __early_ioremap+0x102/0x1bb()
+ [ 0.026941] Modules linked in:
+ [ 0.026944] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc1 #2
+ [ 0.026945] Hardware name: Dell Inc. XPS 13 9343/09K8G1, BIOS A05 07/14/2015
+ [ 0.026946] 0000000000000000 900f03d5a116524d ffffffff81c03e60 ffffffff813a3fff
+ [ 0.026948] 0000000000000000 ffffffff81c03e98 ffffffff810a0852 00000000d7b76000
+ [ 0.026949] 0000000000000000 0000000000000001 0000000000000001 000000000000017c
+ [ 0.026951] Call Trace:
+ [ 0.026955] [<ffffffff813a3fff>] dump_stack+0x44/0x55
+ [ 0.026958] [<ffffffff810a0852>] warn_slowpath_common+0x82/0xc0
+ [ 0.026959] [<ffffffff810a099a>] warn_slowpath_null+0x1a/0x20
+ [ 0.026961] [<ffffffff81d8c395>] __early_ioremap+0x102/0x1bb
+ [ 0.026962] [<ffffffff81d8c602>] early_memremap+0x13/0x15
+ [ 0.026964] [<ffffffff81d78361>] efi_bgrt_init+0x162/0x1ad
+ [ 0.026966] [<ffffffff81d778ec>] efi_late_init+0x9/0xb
+ [ 0.026968] [<ffffffff81d58ff5>] start_kernel+0x46f/0x49f
+ [ 0.026970] [<ffffffff81d58120>] ? early_idt_handler_array+0x120/0x120
+ [ 0.026972] [<ffffffff81d58339>] x86_64_start_reservations+0x2a/0x2c
+ [ 0.026974] [<ffffffff81d58485>] x86_64_start_kernel+0x14a/0x16d
+ [ 0.026977] ---[ end trace f9b3812eb8e24c58 ]---
+ [ 0.026978] efi_bgrt: Ignoring BGRT: failed to map image memory
+
+early_memremap() has an upper limit on the size of mapping it can
+handle which is ~200KB. Clearly the BGRT image on Môshe's machine is
+much larger than that.
+
+There's actually no reason to restrict ourselves to using the early_*
+version of memremap() - the ACPI BGRT driver is invoked late enough in
+boot that we can use the standard version, with the benefit that the
+late version allows mappings of arbitrary size.
+
+Reported-by: Môshe van der Sterre <me@moshe.nl>
+Tested-by: Môshe van der Sterre <me@moshe.nl>
+Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: Josh Triplett <josh@joshtriplett.org>
+Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
+Cc: Borislav Petkov <bp@suse.de>
+Link: http://lkml.kernel.org/r/1450707172-12561-1-git-send-email-matt@codeblueprint.co.uk
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/platform/efi/efi-bgrt.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
+index 81c5bcd06b26..64fbc7e33226 100644
+--- a/arch/x86/platform/efi/efi-bgrt.c
++++ b/arch/x86/platform/efi/efi-bgrt.c
+@@ -69,14 +69,14 @@ void __init efi_bgrt_init(void)
+ return;
+ }
+
+- image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
++ image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
+ if (!image) {
+ pr_err("Ignoring BGRT: failed to map image header memory\n");
+ return;
+ }
+
+ memcpy(&bmp_header, image, sizeof(bmp_header));
+- early_memunmap(image, sizeof(bmp_header));
++ memunmap(image);
+ bgrt_image_size = bmp_header.size;
+
+ bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
+@@ -86,7 +86,7 @@ void __init efi_bgrt_init(void)
+ return;
+ }
+
+- image = early_memremap(bgrt_tab->image_address, bmp_header.size);
++ image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
+ if (!image) {
+ pr_err("Ignoring BGRT: failed to map image memory\n");
+ kfree(bgrt_image);
+@@ -95,5 +95,5 @@ void __init efi_bgrt_init(void)
+ }
+
+ memcpy(bgrt_image, image, bgrt_image_size);
+- early_memunmap(image, bmp_header.size);
++ memunmap(image);
+ }
+--
+2.15.1
+
diff --git a/patches.fixes/mm-thp-do-not-dirty-huge-pte-on-read-fault.patch b/patches.kernel.org/4.4.104-009-mm-thp-Do-not-make-page-table-dirty-unconditi.patch
index 43a2065997..539dec4e59 100644
--- a/patches.fixes/mm-thp-do-not-dirty-huge-pte-on-read-fault.patch
+++ b/patches.kernel.org/4.4.104-009-mm-thp-Do-not-make-page-table-dirty-unconditi.patch
@@ -1,11 +1,12 @@
-Date: Fri, 24 Nov 2017 13:22:27 +0300
-From: "Kirill A. Shutemov" <kirill@shutemov.name>
-Subject: mm, thp: do not dirty huge pages on read fault
-Patch-mainline: 4.15-rc2
+From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
+Date: Mon, 27 Nov 2017 06:21:25 +0300
+Subject: [PATCH] mm, thp: Do not make page table dirty unconditionally in
+ touch_p[mu]d()
+Patch-mainline: 4.4.104
+References: CVE-2017-1000405 bnc#1012382 bnc#1069496
Git-commit: a8f97366452ed491d13cf1e44241bc0b5740b1f0
-References: bnc#1069496, CVE-2017-1000405
-mm, thp: Do not make page table dirty unconditionally in touch_p[mu]d()
+commit a8f97366452ed491d13cf1e44241bc0b5740b1f0 upstream.
Currently, we unconditionally make page table dirty in touch_pmd().
It may result in false-positive can_follow_write_pmd().
@@ -19,16 +20,23 @@ Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-Signed-off-by: Michal Hocko <mhocko@suse.com>
-
+[Salvatore Bonaccorso: backport for 3.16:
+ - Adjust context
+ - Drop specific part for PUD-sized transparent hugepages. Support
+ for PUD-sized transparent hugepages was added in v4.11-rc1
+]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- mm/huge_memory.c | 21 ++++++++-------------
- mm/migrate.c | 2 +-
- 2 files changed, 9 insertions(+), 14 deletions(-)
+ mm/huge_memory.c | 14 ++++----------
+ 1 file changed, 4 insertions(+), 10 deletions(-)
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c
+index 6c6f5ccfcda1..8f3769ec8575 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
-@@ -1334,17 +1334,12 @@ struct page *follow_trans_huge_pmd(struc
+@@ -1304,17 +1304,11 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
VM_BUG_ON_PAGE(!PageHead(page), page);
if (flags & FOLL_TOUCH) {
pmd_t _pmd;
@@ -44,10 +52,12 @@ Signed-off-by: Michal Hocko <mhocko@suse.com>
+ _pmd = pmd_mkyoung(*pmd);
+ if (flags & FOLL_WRITE)
+ _pmd = pmd_mkdirty(_pmd);
-+
if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
- pmd, _pmd, 1))
-+ pmd, _pmd, flags & FOLL_WRITE))
++ pmd, _pmd, flags & FOLL_WRITE))
update_mmu_cache_pmd(vma, addr, pmd);
}
if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {
+--
+2.15.1
+
diff --git a/patches.fixes/mm-madvise.c-fix-madvise-infinite-loop-under-special.patch b/patches.kernel.org/4.4.104-010-mm-madvise.c-fix-madvise-infinite-loop-under-.patch
index 75abe730e8..b745e26886 100644
--- a/patches.fixes/mm-madvise.c-fix-madvise-infinite-loop-under-special.patch
+++ b/patches.kernel.org/4.4.104-010-mm-madvise.c-fix-madvise-infinite-loop-under-.patch
@@ -1,11 +1,12 @@
-From 6ea8d958a2c95a1d514015d4e29ba21a8c0a1a91 Mon Sep 17 00:00:00 2001
From: chenjie <chenjie6@huawei.com>
Date: Wed, 29 Nov 2017 16:10:54 -0800
Subject: [PATCH] mm/madvise.c: fix madvise() infinite loop under special
circumstances
+Patch-mainline: 4.4.104
+References: bnc#1012382 bnc#1070964
Git-commit: 6ea8d958a2c95a1d514015d4e29ba21a8c0a1a91
-Patch-mainline: 4.15-rc2
-References: bnc#1070964
+
+commit 6ea8d958a2c95a1d514015d4e29ba21a8c0a1a91 upstream.
MADVISE_WILLNEED has always been a noop for DAX (formerly XIP) mappings.
Unfortunately madvise_willneed() doesn't communicate this information
@@ -37,19 +38,19 @@ Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Carsten Otte <cotte@de.ibm.com>
Cc: Dan Williams <dan.j.williams@intel.com>
-Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
mm/madvise.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/madvise.c b/mm/madvise.c
-index 375cf32087e4..751e97aa2210 100644
+index c889fcbb530e..2a0f9a4504f1 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
-@@ -276,15 +276,14 @@ static long madvise_willneed(struct vm_area_struct *vma,
+@@ -223,15 +223,14 @@ static long madvise_willneed(struct vm_area_struct *vma,
{
struct file *file = vma->vm_file;
@@ -66,7 +67,7 @@ index 375cf32087e4..751e97aa2210 100644
force_shm_swapin_readahead(vma, start, end,
file->f_mapping);
return 0;
-@@ -299,7 +298,6 @@ static long madvise_willneed(struct vm_area_struct *vma,
+@@ -246,7 +245,6 @@ static long madvise_willneed(struct vm_area_struct *vma,
return 0;
}
@@ -75,5 +76,5 @@ index 375cf32087e4..751e97aa2210 100644
if (end > vma->vm_end)
end = vma->vm_end;
--
-1.8.5.6
+2.15.1
diff --git a/patches.kernel.org/4.4.104-011-btrfs-clear-space-cache-inode-generation-alwa.patch b/patches.kernel.org/4.4.104-011-btrfs-clear-space-cache-inode-generation-alwa.patch
new file mode 100644
index 0000000000..670787b0d3
--- /dev/null
+++ b/patches.kernel.org/4.4.104-011-btrfs-clear-space-cache-inode-generation-alwa.patch
@@ -0,0 +1,64 @@
+From: Josef Bacik <jbacik@fb.com>
+Date: Fri, 17 Nov 2017 14:50:46 -0500
+Subject: [PATCH] btrfs: clear space cache inode generation always
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 8e138e0d92c6c9d3d481674fb14e3439b495be37
+
+commit 8e138e0d92c6c9d3d481674fb14e3439b495be37 upstream.
+
+We discovered a box that had double allocations, and suspected the space
+cache may be to blame. While auditing the write out path I noticed that
+if we've already setup the space cache we will just carry on. This
+means that any error we hit after cache_save_setup before we go to
+actually write the cache out we won't reset the inode generation, so
+whatever was already written will be considered correct, except it'll be
+stale. Fix this by _always_ resetting the generation on the block group
+inode, this way we only ever have valid or invalid cache.
+
+With this patch I was no longer able to reproduce cache corruption with
+dm-log-writes and my bpf error injection tool.
+
+Signed-off-by: Josef Bacik <jbacik@fb.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/btrfs/extent-tree.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
+index c36a03fa7678..260f94b019c9 100644
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -3361,13 +3361,6 @@ again:
+ goto again;
+ }
+
+- /* We've already setup this transaction, go ahead and exit */
+- if (block_group->cache_generation == trans->transid &&
+- i_size_read(inode)) {
+- dcs = BTRFS_DC_SETUP;
+- goto out_put;
+- }
+-
+ /*
+ * We want to set the generation to 0, that way if anything goes wrong
+ * from here on out we know not to trust this cache when we load up next
+@@ -3391,6 +3384,13 @@ again:
+ }
+ WARN_ON(ret);
+
++ /* We've already setup this transaction, go ahead and exit */
++ if (block_group->cache_generation == trans->transid &&
++ i_size_read(inode)) {
++ dcs = BTRFS_DC_SETUP;
++ goto out_put;
++ }
++
+ if (i_size_read(inode) > 0) {
+ ret = btrfs_check_trunc_cache_free_space(root,
+ &root->fs_info->global_block_rsv);
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-012-KVM-x86-pvclock-Handle-first-time-write-to-pv.patch b/patches.kernel.org/4.4.104-012-KVM-x86-pvclock-Handle-first-time-write-to-pv.patch
new file mode 100644
index 0000000000..a4d077c56b
--- /dev/null
+++ b/patches.kernel.org/4.4.104-012-KVM-x86-pvclock-Handle-first-time-write-to-pv.patch
@@ -0,0 +1,57 @@
+From: Liran Alon <liran.alon@oracle.com>
+Date: Sun, 5 Nov 2017 16:11:30 +0200
+Subject: [PATCH] KVM: x86: pvclock: Handle first-time write to pvclock-page
+ contains random junk
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 51c4b8bba674cfd2260d173602c4dac08e4c3a99
+
+commit 51c4b8bba674cfd2260d173602c4dac08e4c3a99 upstream.
+
+When guest passes KVM it's pvclock-page GPA via WRMSR to
+MSR_KVM_SYSTEM_TIME / MSR_KVM_SYSTEM_TIME_NEW, KVM don't initialize
+pvclock-page to some start-values. It just requests a clock-update which
+will happen before entering to guest.
+
+The clock-update logic will call kvm_setup_pvclock_page() to update the
+pvclock-page with info. However, kvm_setup_pvclock_page() *wrongly*
+assumes that the version-field is initialized to an even number. This is
+wrong because at first-time write, field could be any-value.
+
+Fix simply makes sure that if first-time version-field is odd, increment
+it once more to make it even and only then start standard logic.
+This follows same logic as done in other pvclock shared-pages (See
+kvm_write_wall_clock() and record_steal_time()).
+
+Signed-off-by: Liran Alon <liran.alon@oracle.com>
+Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
+Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kvm/x86.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
+index 3ffd5900da5b..6a624989b13e 100644
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -1812,6 +1812,9 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
+ */
+ BUILD_BUG_ON(offsetof(struct pvclock_vcpu_time_info, version) != 0);
+
++ if (guest_hv_clock.version & 1)
++ ++guest_hv_clock.version; /* first time write, random junk */
++
+ vcpu->hv_clock.version = guest_hv_clock.version + 1;
+ kvm_write_guest_cached(v->kvm, &vcpu->pv_time,
+ &vcpu->hv_clock,
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-013-KVM-x86-Exit-to-user-mode-on-UD-intercept-whe.patch b/patches.kernel.org/4.4.104-013-KVM-x86-Exit-to-user-mode-on-UD-intercept-whe.patch
new file mode 100644
index 0000000000..4627e101f1
--- /dev/null
+++ b/patches.kernel.org/4.4.104-013-KVM-x86-Exit-to-user-mode-on-UD-intercept-whe.patch
@@ -0,0 +1,62 @@
+From: Liran Alon <liran.alon@oracle.com>
+Date: Sun, 5 Nov 2017 16:56:32 +0200
+Subject: [PATCH] KVM: x86: Exit to user-mode on #UD intercept when emulator
+ requires
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 61cb57c9ed631c95b54f8e9090c89d18b3695b3c
+
+commit 61cb57c9ed631c95b54f8e9090c89d18b3695b3c upstream.
+
+Instruction emulation after trapping a #UD exception can result in an
+MMIO access, for example when emulating a MOVBE on a processor that
+doesn't support the instruction. In this case, the #UD vmexit handler
+must exit to user mode, but there wasn't any code to do so. Add it for
+both VMX and SVM.
+
+Signed-off-by: Liran Alon <liran.alon@oracle.com>
+Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
+Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kvm/svm.c | 2 ++
+ arch/x86/kvm/vmx.c | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
+index 4e1b254c3695..4b1152e57340 100644
+--- a/arch/x86/kvm/svm.c
++++ b/arch/x86/kvm/svm.c
+@@ -1696,6 +1696,8 @@ static int ud_interception(struct vcpu_svm *svm)
+ int er;
+
+ er = emulate_instruction(&svm->vcpu, EMULTYPE_TRAP_UD);
++ if (er == EMULATE_USER_EXIT)
++ return 0;
+ if (er != EMULATE_DONE)
+ kvm_queue_exception(&svm->vcpu, UD_VECTOR);
+ return 1;
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
+index 67ba0d8f87c7..253a8c8207bb 100644
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -5267,6 +5267,8 @@ static int handle_exception(struct kvm_vcpu *vcpu)
+ return 1;
+ }
+ er = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);
++ if (er == EMULATE_USER_EXIT)
++ return 0;
+ if (er != EMULATE_DONE)
+ kvm_queue_exception(vcpu, UD_VECTOR);
+ return 1;
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-014-KVM-x86-inject-exceptions-produced-by-x86_dec.patch b/patches.kernel.org/4.4.104-014-KVM-x86-inject-exceptions-produced-by-x86_dec.patch
new file mode 100644
index 0000000000..acfcf41533
--- /dev/null
+++ b/patches.kernel.org/4.4.104-014-KVM-x86-inject-exceptions-produced-by-x86_dec.patch
@@ -0,0 +1,58 @@
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Fri, 10 Nov 2017 10:49:38 +0100
+Subject: [PATCH] KVM: x86: inject exceptions produced by x86_decode_insn
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 6ea6e84309ca7e0e850b3083e6b09344ee15c290
+
+commit 6ea6e84309ca7e0e850b3083e6b09344ee15c290 upstream.
+
+Sometimes, a processor might execute an instruction while another
+processor is updating the page tables for that instruction's code page,
+but before the TLB shootdown completes. The interesting case happens
+if the page is in the TLB.
+
+In general, the processor will succeed in executing the instruction and
+nothing bad happens. However, what if the instruction is an MMIO access?
+If *that* happens, KVM invokes the emulator, and the emulator gets the
+updated page tables. If the update side had marked the code page as non
+present, the page table walk then will fail and so will x86_decode_insn.
+
+Unfortunately, even though kvm_fetch_guest_virt is correctly returning
+X86EMUL_PROPAGATE_FAULT, x86_decode_insn's caller treats the failure as
+a fatal error if the instruction cannot simply be reexecuted (as is the
+case for MMIO). And this in fact happened sometimes when rebooting
+Windows 2012r2 guests. Just checking ctxt->have_exception and injecting
+the exception if true is enough to fix the case.
+
+Thanks to Eduardo Habkost for helping in the debugging of this issue.
+
+Reported-by: Yanan Fu <yfu@redhat.com>
+Cc: Eduardo Habkost <ehabkost@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kvm/x86.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
+index 6a624989b13e..df81717a92f3 100644
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -5429,6 +5429,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
+ if (reexecute_instruction(vcpu, cr2, write_fault_to_spt,
+ emulation_type))
+ return EMULATE_DONE;
++ if (ctxt->have_exception && inject_emulated_exception(vcpu))
++ return EMULATE_DONE;
+ if (emulation_type & EMULTYPE_SKIP)
+ return EMULATE_FAIL;
+ return handle_emulation_failure(vcpu);
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-015-mmc-core-Do-not-leave-the-block-driver-in-a-s.patch b/patches.kernel.org/4.4.104-015-mmc-core-Do-not-leave-the-block-driver-in-a-s.patch
new file mode 100644
index 0000000000..f7ab61121e
--- /dev/null
+++ b/patches.kernel.org/4.4.104-015-mmc-core-Do-not-leave-the-block-driver-in-a-s.patch
@@ -0,0 +1,37 @@
+From: Adrian Hunter <adrian.hunter@intel.com>
+Date: Tue, 21 Nov 2017 15:42:29 +0200
+Subject: [PATCH] mmc: core: Do not leave the block driver in a suspended state
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: ebe7dd45cf49e3b49cacbaace17f9f878f21fbea
+
+commit ebe7dd45cf49e3b49cacbaace17f9f878f21fbea upstream.
+
+The block driver must be resumed if the mmc bus fails to suspend the card.
+
+Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/mmc/core/bus.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
+index 972ff844cf5a..cf7c7bc1e940 100644
+--- a/drivers/mmc/core/bus.c
++++ b/drivers/mmc/core/bus.c
+@@ -155,6 +155,9 @@ static int mmc_bus_suspend(struct device *dev)
+ return ret;
+
+ ret = host->bus_ops->suspend(host);
++ if (ret)
++ pm_generic_resume(dev);
++
+ return ret;
+ }
+
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-016-eeprom-at24-check-at24_read-write-arguments.patch b/patches.kernel.org/4.4.104-016-eeprom-at24-check-at24_read-write-arguments.patch
new file mode 100644
index 0000000000..af24ae9ac5
--- /dev/null
+++ b/patches.kernel.org/4.4.104-016-eeprom-at24-check-at24_read-write-arguments.patch
@@ -0,0 +1,47 @@
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Fri, 24 Nov 2017 07:47:50 +0100
+Subject: [PATCH] eeprom: at24: check at24_read/write arguments
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: d9bcd462daf34aebb8de9ad7f76de0198bb5a0f0
+
+commit d9bcd462daf34aebb8de9ad7f76de0198bb5a0f0 upstream.
+
+So far we completely rely on the caller to provide valid arguments.
+To be on the safe side perform an own sanity check.
+
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/misc/eeprom/at24.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
+index 5d7c0900fa1b..f112c5bc082a 100644
+--- a/drivers/misc/eeprom/at24.c
++++ b/drivers/misc/eeprom/at24.c
+@@ -257,6 +257,9 @@ static ssize_t at24_read(struct at24_data *at24,
+ if (unlikely(!count))
+ return count;
+
++ if (off + count > at24->chip.byte_len)
++ return -EINVAL;
++
+ /*
+ * Read data from chip, protecting against concurrent updates
+ * from this host, but not from other I2C masters.
+@@ -311,6 +314,9 @@ static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf,
+ unsigned long timeout, write_time;
+ unsigned next_page;
+
++ if (offset + count > at24->chip.byte_len)
++ return -EINVAL;
++
+ /* Get corresponding I2C address and adjust offset */
+ client = at24_translate_offset(at24, &offset);
+
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-017-bcache-Fix-building-error-on-MIPS.patch b/patches.kernel.org/4.4.104-017-bcache-Fix-building-error-on-MIPS.patch
new file mode 100644
index 0000000000..5f6395e6ab
--- /dev/null
+++ b/patches.kernel.org/4.4.104-017-bcache-Fix-building-error-on-MIPS.patch
@@ -0,0 +1,83 @@
+From: Huacai Chen <chenhc@lemote.com>
+Date: Fri, 24 Nov 2017 15:14:25 -0800
+Subject: [PATCH] bcache: Fix building error on MIPS
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: cf33c1ee5254c6a430bc1538232b49c3ea13e613
+
+commit cf33c1ee5254c6a430bc1538232b49c3ea13e613 upstream.
+
+This patch try to fix the building error on MIPS. The reason is MIPS
+has already defined the PTR macro, which conflicts with the PTR macro
+in include/uapi/linux/bcache.h.
+
+[fixed by mlyle: corrected a line-length issue]
+
+Signed-off-by: Huacai Chen <chenhc@lemote.com>
+Reviewed-by: Michael Lyle <mlyle@lyle.org>
+Signed-off-by: Michael Lyle <mlyle@lyle.org>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/md/bcache/alloc.c | 2 +-
+ drivers/md/bcache/extents.c | 2 +-
+ drivers/md/bcache/journal.c | 2 +-
+ include/uapi/linux/bcache.h | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
+index ea47980949ef..4d46f2ce606f 100644
+--- a/drivers/md/bcache/alloc.c
++++ b/drivers/md/bcache/alloc.c
+@@ -479,7 +479,7 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned reserve,
+ if (b == -1)
+ goto err;
+
+- k->ptr[i] = PTR(ca->buckets[b].gen,
++ k->ptr[i] = MAKE_PTR(ca->buckets[b].gen,
+ bucket_to_sector(c, b),
+ ca->sb.nr_this_dev);
+
+diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c
+index 243de0bf15cd..4bf15182c4da 100644
+--- a/drivers/md/bcache/extents.c
++++ b/drivers/md/bcache/extents.c
+@@ -584,7 +584,7 @@ static bool bch_extent_merge(struct btree_keys *bk, struct bkey *l, struct bkey
+ return false;
+
+ for (i = 0; i < KEY_PTRS(l); i++)
+- if (l->ptr[i] + PTR(0, KEY_SIZE(l), 0) != r->ptr[i] ||
++ if (l->ptr[i] + MAKE_PTR(0, KEY_SIZE(l), 0) != r->ptr[i] ||
+ PTR_BUCKET_NR(b->c, l, i) != PTR_BUCKET_NR(b->c, r, i))
+ return false;
+
+diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
+index 29eba7219b01..6ed066a0e7c0 100644
+--- a/drivers/md/bcache/journal.c
++++ b/drivers/md/bcache/journal.c
+@@ -508,7 +508,7 @@ static void journal_reclaim(struct cache_set *c)
+ continue;
+
+ ja->cur_idx = next;
+- k->ptr[n++] = PTR(0,
++ k->ptr[n++] = MAKE_PTR(0,
+ bucket_to_sector(c, ca->sb.d[ja->cur_idx]),
+ ca->sb.nr_this_dev);
+ }
+diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
+index 22b6ad31c706..8562b1cb776b 100644
+--- a/include/uapi/linux/bcache.h
++++ b/include/uapi/linux/bcache.h
+@@ -90,7 +90,7 @@ PTR_FIELD(PTR_GEN, 0, 8)
+
+ #define PTR_CHECK_DEV ((1 << PTR_DEV_BITS) - 1)
+
+-#define PTR(gen, offset, dev) \
++#define MAKE_PTR(gen, offset, dev) \
+ ((((__u64) dev) << 51) | ((__u64) offset) << 8 | gen)
+
+ /* Bkey utility code */
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-018-Revert-drm-radeon-dont-switch-vt-on-suspend.patch b/patches.kernel.org/4.4.104-018-Revert-drm-radeon-dont-switch-vt-on-suspend.patch
new file mode 100644
index 0000000000..d525883e75
--- /dev/null
+++ b/patches.kernel.org/4.4.104-018-Revert-drm-radeon-dont-switch-vt-on-suspend.patch
@@ -0,0 +1,42 @@
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Tue, 14 Nov 2017 17:19:29 -0500
+Subject: [PATCH] Revert "drm/radeon: dont switch vt on suspend"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 18c437caa5b18a235dd65cec224eab54bebcee65
+
+commit 18c437caa5b18a235dd65cec224eab54bebcee65 upstream.
+
+Fixes distorted colors on some cards on resume from suspend.
+
+This reverts commit b9729b17a414f99c61f4db9ac9f9ed987fa0cbfe.
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98832
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99163
+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=107001
+Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/gpu/drm/radeon/radeon_fb.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
+index 26da2f4d7b4f..a2937a693591 100644
+--- a/drivers/gpu/drm/radeon/radeon_fb.c
++++ b/drivers/gpu/drm/radeon/radeon_fb.c
+@@ -226,7 +226,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,
+ }
+
+ info->par = rfbdev;
+- info->skip_vt_switch = true;
+
+ ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
+ if (ret) {
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-019-drm-radeon-fix-atombios-on-big-endian.patch b/patches.kernel.org/4.4.104-019-drm-radeon-fix-atombios-on-big-endian.patch
new file mode 100644
index 0000000000..647f3be125
--- /dev/null
+++ b/patches.kernel.org/4.4.104-019-drm-radeon-fix-atombios-on-big-endian.patch
@@ -0,0 +1,147 @@
+From: Roman Kapl <rka@sysgo.com>
+Date: Mon, 30 Oct 2017 11:56:13 +0100
+Subject: [PATCH] drm/radeon: fix atombios on big endian
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 4f626a4ac8f57ddabf06d03870adab91e463217f
+
+commit 4f626a4ac8f57ddabf06d03870adab91e463217f upstream.
+
+The function for byteswapping the data send to/from atombios was buggy for
+num_bytes not divisible by four. The function must be aware of the fact
+that after byte-swapping the u32 units, valid bytes might end up after the
+num_bytes boundary.
+
+This patch was tested on kernel 3.12 and allowed us to sucesfully use
+DisplayPort on and Radeon SI card. Namely it fixed the link training and
+EDID readout.
+
+The function is patched both in radeon and amd drivers, since the functions
+and the fixes are identical.
+
+Signed-off-by: Roman Kapl <rka@sysgo.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 38 +++++++++++++---------------
+ drivers/gpu/drm/radeon/atombios_dp.c | 38 +++++++++++++---------------
+ 2 files changed, 36 insertions(+), 40 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
+index f4cae5357e40..3e90ddcbb24a 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
+@@ -1575,34 +1575,32 @@ void amdgpu_atombios_scratch_regs_restore(struct amdgpu_device *adev)
+ WREG32(mmBIOS_SCRATCH_0 + i, adev->bios_scratch[i]);
+ }
+
+-/* Atom needs data in little endian format
+- * so swap as appropriate when copying data to
+- * or from atom. Note that atom operates on
+- * dw units.
++/* Atom needs data in little endian format so swap as appropriate when copying
++ * data to or from atom. Note that atom operates on dw units.
++ *
++ * Use to_le=true when sending data to atom and provide at least
++ * ALIGN(num_bytes,4) bytes in the dst buffer.
++ *
++ * Use to_le=false when receiving data from atom and provide ALIGN(num_bytes,4)
++ * byes in the src buffer.
+ */
+ void amdgpu_atombios_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le)
+ {
+ #ifdef __BIG_ENDIAN
+- u8 src_tmp[20], dst_tmp[20]; /* used for byteswapping */
+- u32 *dst32, *src32;
++ u32 src_tmp[5], dst_tmp[5];
+ int i;
++ u8 align_num_bytes = ALIGN(num_bytes, 4);
+
+- memcpy(src_tmp, src, num_bytes);
+- src32 = (u32 *)src_tmp;
+- dst32 = (u32 *)dst_tmp;
+ if (to_le) {
+- for (i = 0; i < ((num_bytes + 3) / 4); i++)
+- dst32[i] = cpu_to_le32(src32[i]);
+- memcpy(dst, dst_tmp, num_bytes);
++ memcpy(src_tmp, src, num_bytes);
++ for (i = 0; i < align_num_bytes / 4; i++)
++ dst_tmp[i] = cpu_to_le32(src_tmp[i]);
++ memcpy(dst, dst_tmp, align_num_bytes);
+ } else {
+- u8 dws = num_bytes & ~3;
+- for (i = 0; i < ((num_bytes + 3) / 4); i++)
+- dst32[i] = le32_to_cpu(src32[i]);
+- memcpy(dst, dst_tmp, dws);
+- if (num_bytes % 4) {
+- for (i = 0; i < (num_bytes % 4); i++)
+- dst[dws+i] = dst_tmp[dws+i];
+- }
++ memcpy(src_tmp, src, align_num_bytes);
++ for (i = 0; i < align_num_bytes / 4; i++)
++ dst_tmp[i] = le32_to_cpu(src_tmp[i]);
++ memcpy(dst, dst_tmp, num_bytes);
+ }
+ #else
+ memcpy(dst, src, num_bytes);
+diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
+index b5760851195c..0c6216a6ee9e 100644
+--- a/drivers/gpu/drm/radeon/atombios_dp.c
++++ b/drivers/gpu/drm/radeon/atombios_dp.c
+@@ -45,34 +45,32 @@ static char *pre_emph_names[] = {
+
+ /***** radeon AUX functions *****/
+
+-/* Atom needs data in little endian format
+- * so swap as appropriate when copying data to
+- * or from atom. Note that atom operates on
+- * dw units.
++/* Atom needs data in little endian format so swap as appropriate when copying
++ * data to or from atom. Note that atom operates on dw units.
++ *
++ * Use to_le=true when sending data to atom and provide at least
++ * ALIGN(num_bytes,4) bytes in the dst buffer.
++ *
++ * Use to_le=false when receiving data from atom and provide ALIGN(num_bytes,4)
++ * byes in the src buffer.
+ */
+ void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le)
+ {
+ #ifdef __BIG_ENDIAN
+- u8 src_tmp[20], dst_tmp[20]; /* used for byteswapping */
+- u32 *dst32, *src32;
++ u32 src_tmp[5], dst_tmp[5];
+ int i;
++ u8 align_num_bytes = ALIGN(num_bytes, 4);
+
+- memcpy(src_tmp, src, num_bytes);
+- src32 = (u32 *)src_tmp;
+- dst32 = (u32 *)dst_tmp;
+ if (to_le) {
+- for (i = 0; i < ((num_bytes + 3) / 4); i++)
+- dst32[i] = cpu_to_le32(src32[i]);
+- memcpy(dst, dst_tmp, num_bytes);
++ memcpy(src_tmp, src, num_bytes);
++ for (i = 0; i < align_num_bytes / 4; i++)
++ dst_tmp[i] = cpu_to_le32(src_tmp[i]);
++ memcpy(dst, dst_tmp, align_num_bytes);
+ } else {
+- u8 dws = num_bytes & ~3;
+- for (i = 0; i < ((num_bytes + 3) / 4); i++)
+- dst32[i] = le32_to_cpu(src32[i]);
+- memcpy(dst, dst_tmp, dws);
+- if (num_bytes % 4) {
+- for (i = 0; i < (num_bytes % 4); i++)
+- dst[dws+i] = dst_tmp[dws+i];
+- }
++ memcpy(src_tmp, src, align_num_bytes);
++ for (i = 0; i < align_num_bytes / 4; i++)
++ dst_tmp[i] = le32_to_cpu(src_tmp[i]);
++ memcpy(dst, dst_tmp, num_bytes);
+ }
+ #else
+ memcpy(dst, src, num_bytes);
+--
+2.15.1
+
diff --git a/patches.drivers/drm-panel-simple-Add-missing-panel_simple_unprepare- b/patches.kernel.org/4.4.104-020-drm-panel-simple-Add-missing-panel_simple_unp.patch
index a72b616d32..44081e74ae 100644
--- a/patches.drivers/drm-panel-simple-Add-missing-panel_simple_unprepare-
+++ b/patches.kernel.org/4.4.104-020-drm-panel-simple-Add-missing-panel_simple_unp.patch
@@ -1,29 +1,31 @@
-From f3621a8eb59a913612c8e6e37d81f16b649f8b6c Mon Sep 17 00:00:00 2001
From: Jonathan Liu <net147@gmail.com>
Date: Mon, 7 Aug 2017 21:55:45 +1000
Subject: [PATCH] drm/panel: simple: Add missing panel_simple_unprepare() calls
+Patch-mainline: 4.4.104
+References: bnc#1012382 bsc#1031717
Git-commit: f3621a8eb59a913612c8e6e37d81f16b649f8b6c
-Patch-mainline: 4.15-rc1
-References: bsc#1031717
+
+commit f3621a8eb59a913612c8e6e37d81f16b649f8b6c upstream.
During panel removal or system shutdown panel_simple_disable() is called
which disables the panel backlight but the panel is still powered due to
missing calls to panel_simple_unprepare().
Fixes: d02fd93e2cd8 ("drm/panel: simple - Disable panel on shutdown")
-Cc: stable@vger.kernel.org # v3.16+
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170807115545.27747-1-net147@gmail.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- drivers/gpu/drm/panel/panel-simple.c | 2 ++
+ drivers/gpu/drm/panel/panel-simple.c | 2 ++
1 file changed, 2 insertions(+)
+diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
+index f97b73ec4713..f418c002d323 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
-@@ -352,6 +352,7 @@ static int panel_simple_remove(struct de
+@@ -352,6 +352,7 @@ static int panel_simple_remove(struct device *dev)
drm_panel_remove(&panel->base);
panel_simple_disable(&panel->base);
@@ -31,7 +33,7 @@ Acked-by: Takashi Iwai <tiwai@suse.de>
if (panel->ddc)
put_device(&panel->ddc->dev);
-@@ -367,6 +368,7 @@ static void panel_simple_shutdown(struct
+@@ -367,6 +368,7 @@ static void panel_simple_shutdown(struct device *dev)
struct panel_simple *panel = dev_get_drvdata(dev);
panel_simple_disable(&panel->base);
@@ -39,3 +41,6 @@ Acked-by: Takashi Iwai <tiwai@suse.de>
}
static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-021-mtd-nand-Fix-writing-mtdoops-to-nand-flash.patch b/patches.kernel.org/4.4.104-021-mtd-nand-Fix-writing-mtdoops-to-nand-flash.patch
new file mode 100644
index 0000000000..b72e024680
--- /dev/null
+++ b/patches.kernel.org/4.4.104-021-mtd-nand-Fix-writing-mtdoops-to-nand-flash.patch
@@ -0,0 +1,56 @@
+From: Brent Taylor <motobud@gmail.com>
+Date: Mon, 30 Oct 2017 22:32:45 -0500
+Subject: [PATCH] mtd: nand: Fix writing mtdoops to nand flash.
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 30863e38ebeb500a31cecee8096fb5002677dd9b
+
+commit 30863e38ebeb500a31cecee8096fb5002677dd9b upstream.
+
+When mtdoops calls mtd_panic_write(), it eventually calls
+panic_nand_write() in nand_base.c. In order to properly wait for the
+nand chip to be ready in panic_nand_wait(), the chip must first be
+selected.
+
+When using the atmel nand flash controller, a panic would occur due to
+a NULL pointer exception.
+
+Fixes: 2af7c6539931 ("mtd: Add panic_write for NAND flashes")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Brent Taylor <motobud@gmail.com>
+Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/mtd/nand/nand_base.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
+index 54ab48827258..7ba109e8cf88 100644
+--- a/drivers/mtd/nand/nand_base.c
++++ b/drivers/mtd/nand/nand_base.c
+@@ -2663,15 +2663,18 @@ static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
+ size_t *retlen, const uint8_t *buf)
+ {
+ struct nand_chip *chip = mtd->priv;
++ int chipnr = (int)(to >> chip->chip_shift);
+ struct mtd_oob_ops ops;
+ int ret;
+
+- /* Wait for the device to get ready */
+- panic_nand_wait(mtd, chip, 400);
+-
+ /* Grab the device */
+ panic_nand_get_device(chip, mtd, FL_WRITING);
+
++ chip->select_chip(mtd, chipnr);
++
++ /* Wait for the device to get ready */
++ panic_nand_wait(mtd, chip, 400);
++
+ memset(&ops, 0, sizeof(ops));
+ ops.len = len;
+ ops.datbuf = (uint8_t *)buf;
+--
+2.15.1
+
diff --git a/patches.fixes/0002-NFS-revalidate-.-etc-correctly-on-open.patch b/patches.kernel.org/4.4.104-022-NFS-revalidate-.-etc-correctly-on-open.patch
index f9d939fa54..0b7943fa5e 100644
--- a/patches.fixes/0002-NFS-revalidate-.-etc-correctly-on-open.patch
+++ b/patches.kernel.org/4.4.104-022-NFS-revalidate-.-etc-correctly-on-open.patch
@@ -1,9 +1,11 @@
From: NeilBrown <neilb@suse.com>
Date: Fri, 25 Aug 2017 17:34:41 +1000
Subject: [PATCH] NFS: revalidate "." etc correctly on "open".
+Patch-mainline: 4.4.104
+References: bnc#1012382 git-fixes
Git-commit: b688741cb06695312f18b730653d6611e1bad28d
-Patch-mainline: v4.15
-References: git-fixes
+
+commit b688741cb06695312f18b730653d6611e1bad28d upstream.
For correct close-to-open semantics, NFS must validate
the change attribute of a directory (or file) on open.
@@ -28,18 +30,20 @@ Without this patch, "echo *" sometimes doesn't produce any traffic.
With the patch it always does.
Fixes: ecf3d1f1aa74 ("vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op")
-Cc: stable@vger.kernel.org (3.9+)
+cc: stable@vger.kernel.org (3.9+)
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-Acked-by: NeilBrown <neilb@suse.com>
-
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- fs/nfs/dir.c | 3 ++-
+ fs/nfs/dir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
+index 348e0a05bd18..44e09483d2cd 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
-@@ -1265,7 +1265,7 @@ static int nfs_weak_revalidate(struct de
+@@ -1260,7 +1260,7 @@ static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags)
return 0;
}
@@ -48,7 +52,7 @@ Acked-by: NeilBrown <neilb@suse.com>
dfprintk(LOOKUPCACHE, "NFS: %s: inode %lu is %s\n",
__func__, inode->i_ino, error ? "invalid" : "valid");
return !error;
-@@ -1425,6 +1425,7 @@ static int nfs4_lookup_revalidate(struct
+@@ -1420,6 +1420,7 @@ static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
const struct dentry_operations nfs4_dentry_operations = {
.d_revalidate = nfs4_lookup_revalidate,
@@ -56,3 +60,6 @@ Acked-by: NeilBrown <neilb@suse.com>
.d_delete = nfs_dentry_delete,
.d_iput = nfs_dentry_iput,
.d_automount = nfs_d_automount,
+--
+2.15.1
+
diff --git a/patches.drivers/drm-i915-Don-t-try-indexed-reads-to-alternate-slave- b/patches.kernel.org/4.4.104-023-drm-i915-Don-t-try-indexed-reads-to-alternate.patch
index f788f0ce1a..9bcd164ff1 100644
--- a/patches.drivers/drm-i915-Don-t-try-indexed-reads-to-alternate-slave-
+++ b/patches.kernel.org/4.4.104-023-drm-i915-Don-t-try-indexed-reads-to-alternate.patch
@@ -1,19 +1,21 @@
-From ae5c631e605a452a5a0e73205a92810c01ed954b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
Date: Thu, 23 Nov 2017 21:41:56 +0200
-Subject: [PATCH] drm/i915: Don't try indexed reads to alternate slave addresses
-Mime-version: 1.0
-Content-type: text/plain; charset=UTF-8
-Content-transfer-encoding: 8bit
+Subject: [PATCH] drm/i915: Don't try indexed reads to alternate slave
+ addresses
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Patch-mainline: 4.4.104
+References: bnc#1012382 bsc#1031717
Git-commit: ae5c631e605a452a5a0e73205a92810c01ed954b
-Patch-mainline: 4.15-rc2
-References: bsc#1031717
+Git-commit: c4deb62d7821672265b87952bcd1c808f3bf3e8f
+
+commit ae5c631e605a452a5a0e73205a92810c01ed954b upstream.
We can only specify the one slave address to indexed reads/writes.
Make sure the messages we check are destined to the same slave
address before deciding to do an indexed transfer.
-Cc: stable@vger.kernel.org
Cc: Daniel Kurtz <djkurtz@chromium.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
@@ -23,14 +25,15 @@ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171123194157.25367-2-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit c4deb62d7821672265b87952bcd1c808f3bf3e8f)
-
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- drivers/gpu/drm/i915/intel_i2c.c | 1 +
+ drivers/gpu/drm/i915/intel_i2c.c | 1 +
1 file changed, 1 insertion(+)
+diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
+index f3bee54c414f..ce625496ce01 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -440,6 +440,7 @@ static bool
@@ -41,3 +44,6 @@ Acked-by: Takashi Iwai <tiwai@suse.de>
!(msgs[i].flags & I2C_M_RD) && msgs[i].len <= 2 &&
(msgs[i + 1].flags & I2C_M_RD));
}
+--
+2.15.1
+
diff --git a/patches.drivers/drm-i915-Prevent-zero-length-index-write b/patches.kernel.org/4.4.104-024-drm-i915-Prevent-zero-length-index-write.patch
index adc7ee5de7..41dd872ac5 100644
--- a/patches.drivers/drm-i915-Prevent-zero-length-index-write
+++ b/patches.kernel.org/4.4.104-024-drm-i915-Prevent-zero-length-index-write.patch
@@ -1,19 +1,20 @@
-From 56350fb8978bbf4aafe08f21234e161dd128b417 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
Date: Thu, 23 Nov 2017 21:41:57 +0200
Subject: [PATCH] drm/i915: Prevent zero length "index" write
-Mime-version: 1.0
-Content-type: text/plain; charset=UTF-8
-Content-transfer-encoding: 8bit
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Patch-mainline: 4.4.104
+References: bnc#1012382 bsc#1031717
Git-commit: 56350fb8978bbf4aafe08f21234e161dd128b417
-Patch-mainline: 4.15-rc2
-References: bsc#1031717
+Git-commit: bb9e0d4bca50f429152e74a459160b41f3d60fb2
+
+commit 56350fb8978bbf4aafe08f21234e161dd128b417 upstream.
The hardware always writes one or two bytes in the index portion of
an indexed transfer. Make sure the message we send as the index
doesn't have a zero length.
-Cc: stable@vger.kernel.org
Cc: Daniel Kurtz <djkurtz@chromium.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
@@ -23,17 +24,18 @@ Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171123194157.25367-3-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit bb9e0d4bca50f429152e74a459160b41f3d60fb2)
-
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- drivers/gpu/drm/i915/intel_i2c.c | 3 ++-
+ drivers/gpu/drm/i915/intel_i2c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
+diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
+index ce625496ce01..cb4313c68f71 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
-@@ -441,7 +441,8 @@ gmbus_is_index_read(struct i2c_msg *msgs
+@@ -441,7 +441,8 @@ gmbus_is_index_read(struct i2c_msg *msgs, int i, int num)
{
return (i + 1 < num &&
msgs[i].addr == msgs[i + 1].addr &&
@@ -43,3 +45,6 @@ Acked-by: Takashi Iwai <tiwai@suse.de>
(msgs[i + 1].flags & I2C_M_RD));
}
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-025-nfsd-Make-init_open_stateid-a-bit-more-whole.patch b/patches.kernel.org/4.4.104-025-nfsd-Make-init_open_stateid-a-bit-more-whole.patch
new file mode 100644
index 0000000000..7e15751166
--- /dev/null
+++ b/patches.kernel.org/4.4.104-025-nfsd-Make-init_open_stateid-a-bit-more-whole.patch
@@ -0,0 +1,97 @@
+From: Oleg Drokin <green@linuxhacker.ru>
+Date: Tue, 14 Jun 2016 23:28:06 -0400
+Subject: [PATCH] nfsd: Make init_open_stateid() a bit more whole
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 8c7245abda877d4689b3371db8ae2a4400d7d9ce
+
+commit 8c7245abda877d4689b3371db8ae2a4400d7d9ce upstream.
+
+Move the state selection logic inside from the caller,
+always making it return correct stp to use.
+
+Signed-off-by: J . Bruce Fields <bfields@fieldses.org>
+Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/nfsd/nfs4state.c | 27 ++++++++++++---------------
+ 1 file changed, 12 insertions(+), 15 deletions(-)
+
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
+index 421935f3d909..76caee97d2cd 100644
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -3420,13 +3420,14 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
+ }
+
+ static struct nfs4_ol_stateid *
+-init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp,
+- struct nfsd4_open *open)
++init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
+ {
+
+ struct nfs4_openowner *oo = open->op_openowner;
+ struct nfs4_ol_stateid *retstp = NULL;
++ struct nfs4_ol_stateid *stp;
+
++ stp = open->op_stp;
+ /* We are moving these outside of the spinlocks to avoid the warnings */
+ mutex_init(&stp->st_mutex);
+ mutex_lock(&stp->st_mutex);
+@@ -3437,6 +3438,8 @@ init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp,
+ retstp = nfsd4_find_existing_open(fp, open);
+ if (retstp)
+ goto out_unlock;
++
++ open->op_stp = NULL;
+ atomic_inc(&stp->st_stid.sc_count);
+ stp->st_stid.sc_type = NFS4_OPEN_STID;
+ INIT_LIST_HEAD(&stp->st_locks);
+@@ -3454,10 +3457,11 @@ out_unlock:
+ spin_unlock(&oo->oo_owner.so_client->cl_lock);
+ if (retstp) {
+ mutex_lock(&retstp->st_mutex);
+- /* Not that we need to, just for neatness */
++ /* To keep mutex tracking happy */
+ mutex_unlock(&stp->st_mutex);
++ stp = retstp;
+ }
+- return retstp;
++ return stp;
+ }
+
+ /*
+@@ -4260,7 +4264,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ struct nfs4_client *cl = open->op_openowner->oo_owner.so_client;
+ struct nfs4_file *fp = NULL;
+ struct nfs4_ol_stateid *stp = NULL;
+- struct nfs4_ol_stateid *swapstp = NULL;
+ struct nfs4_delegation *dp = NULL;
+ __be32 status;
+
+@@ -4297,16 +4300,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ goto out;
+ }
+ } else {
+- stp = open->op_stp;
+- open->op_stp = NULL;
+- /*
+- * init_open_stateid() either returns a locked stateid
+- * it found, or initializes and locks the new one we passed in
+- */
+- swapstp = init_open_stateid(stp, fp, open);
+- if (swapstp) {
+- nfs4_put_stid(&stp->st_stid);
+- stp = swapstp;
++ /* stp is returned locked. */
++ stp = init_open_stateid(fp, open);
++ /* See if we lost the race to some other thread */
++ if (stp->st_access_bmap != 0) {
+ status = nfs4_upgrade_open(rqstp, fp, current_fh,
+ stp, open);
+ if (status) {
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-026-nfsd-Fix-stateid-races-between-OPEN-and-CLOSE.patch b/patches.kernel.org/4.4.104-026-nfsd-Fix-stateid-races-between-OPEN-and-CLOSE.patch
new file mode 100644
index 0000000000..c530caeecf
--- /dev/null
+++ b/patches.kernel.org/4.4.104-026-nfsd-Fix-stateid-races-between-OPEN-and-CLOSE.patch
@@ -0,0 +1,158 @@
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+Date: Fri, 3 Nov 2017 08:00:10 -0400
+Subject: [PATCH] nfsd: Fix stateid races between OPEN and CLOSE
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: 15ca08d3299682dc49bad73251677b2c5017ef08
+
+commit 15ca08d3299682dc49bad73251677b2c5017ef08 upstream.
+
+Open file stateids can linger on the nfs4_file list of stateids even
+after they have been closed. In order to avoid reusing such a
+stateid, and confusing the client, we need to recheck the
+nfs4_stid's type after taking the mutex.
+Otherwise, we risk reusing an old stateid that was already closed,
+which will confuse clients that expect new stateids to conform to
+RFC7530 Sections 9.1.4.2 and 16.2.5 or RFC5661 Sections 8.2.2 and 18.2.4.
+
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/nfsd/nfs4state.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 59 insertions(+), 8 deletions(-)
+
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
+index 76caee97d2cd..3bf086aca5c0 100644
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -3379,7 +3379,9 @@ nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
+ /* ignore lock owners */
+ if (local->st_stateowner->so_is_open_owner == 0)
+ continue;
+- if (local->st_stateowner == &oo->oo_owner) {
++ if (local->st_stateowner != &oo->oo_owner)
++ continue;
++ if (local->st_stid.sc_type == NFS4_OPEN_STID) {
+ ret = local;
+ atomic_inc(&ret->st_stid.sc_count);
+ break;
+@@ -3388,6 +3390,52 @@ nfsd4_find_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
+ return ret;
+ }
+
++static __be32
++nfsd4_verify_open_stid(struct nfs4_stid *s)
++{
++ __be32 ret = nfs_ok;
++
++ switch (s->sc_type) {
++ default:
++ break;
++ case NFS4_CLOSED_STID:
++ case NFS4_CLOSED_DELEG_STID:
++ ret = nfserr_bad_stateid;
++ break;
++ case NFS4_REVOKED_DELEG_STID:
++ ret = nfserr_deleg_revoked;
++ }
++ return ret;
++}
++
++/* Lock the stateid st_mutex, and deal with races with CLOSE */
++static __be32
++nfsd4_lock_ol_stateid(struct nfs4_ol_stateid *stp)
++{
++ __be32 ret;
++
++ mutex_lock(&stp->st_mutex);
++ ret = nfsd4_verify_open_stid(&stp->st_stid);
++ if (ret != nfs_ok)
++ mutex_unlock(&stp->st_mutex);
++ return ret;
++}
++
++static struct nfs4_ol_stateid *
++nfsd4_find_and_lock_existing_open(struct nfs4_file *fp, struct nfsd4_open *open)
++{
++ struct nfs4_ol_stateid *stp;
++ for (;;) {
++ spin_lock(&fp->fi_lock);
++ stp = nfsd4_find_existing_open(fp, open);
++ spin_unlock(&fp->fi_lock);
++ if (!stp || nfsd4_lock_ol_stateid(stp) == nfs_ok)
++ break;
++ nfs4_put_stid(&stp->st_stid);
++ }
++ return stp;
++}
++
+ static struct nfs4_openowner *
+ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
+ struct nfsd4_compound_state *cstate)
+@@ -3432,6 +3480,7 @@ init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
+ mutex_init(&stp->st_mutex);
+ mutex_lock(&stp->st_mutex);
+
++retry:
+ spin_lock(&oo->oo_owner.so_client->cl_lock);
+ spin_lock(&fp->fi_lock);
+
+@@ -3456,7 +3505,11 @@ out_unlock:
+ spin_unlock(&fp->fi_lock);
+ spin_unlock(&oo->oo_owner.so_client->cl_lock);
+ if (retstp) {
+- mutex_lock(&retstp->st_mutex);
++ /* Handle races with CLOSE */
++ if (nfsd4_lock_ol_stateid(retstp) != nfs_ok) {
++ nfs4_put_stid(&retstp->st_stid);
++ goto retry;
++ }
+ /* To keep mutex tracking happy */
+ mutex_unlock(&stp->st_mutex);
+ stp = retstp;
+@@ -4277,9 +4330,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ status = nfs4_check_deleg(cl, open, &dp);
+ if (status)
+ goto out;
+- spin_lock(&fp->fi_lock);
+- stp = nfsd4_find_existing_open(fp, open);
+- spin_unlock(&fp->fi_lock);
++ stp = nfsd4_find_and_lock_existing_open(fp, open);
+ } else {
+ open->op_file = NULL;
+ status = nfserr_bad_stateid;
+@@ -4293,7 +4344,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ */
+ if (stp) {
+ /* Stateid was found, this is an OPEN upgrade */
+- mutex_lock(&stp->st_mutex);
+ status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
+ if (status) {
+ mutex_unlock(&stp->st_mutex);
+@@ -5150,7 +5200,6 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
+ bool unhashed;
+ LIST_HEAD(reaplist);
+
+- s->st_stid.sc_type = NFS4_CLOSED_STID;
+ spin_lock(&clp->cl_lock);
+ unhashed = unhash_open_stateid(s, &reaplist);
+
+@@ -5189,10 +5238,12 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
+ nfsd4_bump_seqid(cstate, status);
+ if (status)
+ goto out;
++
++ stp->st_stid.sc_type = NFS4_CLOSED_STID;
+ nfs4_inc_and_copy_stateid(&close->cl_stateid, &stp->st_stid);
+- mutex_unlock(&stp->st_mutex);
+
+ nfsd4_close_open_stateid(stp);
++ mutex_unlock(&stp->st_mutex);
+
+ /* put reference from nfs4_preprocess_seqid_op */
+ nfs4_put_stid(&stp->st_stid);
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-027-nfsd-Fix-another-OPEN-stateid-race.patch b/patches.kernel.org/4.4.104-027-nfsd-Fix-another-OPEN-stateid-race.patch
new file mode 100644
index 0000000000..153df09acb
--- /dev/null
+++ b/patches.kernel.org/4.4.104-027-nfsd-Fix-another-OPEN-stateid-race.patch
@@ -0,0 +1,96 @@
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+Date: Fri, 3 Nov 2017 08:00:11 -0400
+Subject: [PATCH] nfsd: Fix another OPEN stateid race
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: d8a1a000555ecd1b824ac1ed6df8fe364dfbbbb0
+
+commit d8a1a000555ecd1b824ac1ed6df8fe364dfbbbb0 upstream.
+
+If nfsd4_process_open2() is initialising a new stateid, and yet the
+call to nfs4_get_vfs_file() fails for some reason, then we must
+declare the stateid closed, and unhash it before dropping the mutex.
+
+Right now, we unhash the stateid after dropping the mutex, and without
+changing the stateid type, meaning that another OPEN could theoretically
+look it up and attempt to use it.
+
+Reported-by: Andrew W Elble <aweits@rit.edu>
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/nfsd/nfs4state.c | 28 +++++++++++++---------------
+ 1 file changed, 13 insertions(+), 15 deletions(-)
+
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
+index 3bf086aca5c0..11c67e8b939d 100644
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -4319,6 +4319,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ struct nfs4_ol_stateid *stp = NULL;
+ struct nfs4_delegation *dp = NULL;
+ __be32 status;
++ bool new_stp = false;
+
+ /*
+ * Lookup file; if found, lookup stateid and check open request,
+@@ -4338,11 +4339,19 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ goto out;
+ }
+
++ if (!stp) {
++ stp = init_open_stateid(fp, open);
++ if (!open->op_stp)
++ new_stp = true;
++ }
++
+ /*
+ * OPEN the file, or upgrade an existing OPEN.
+ * If truncate fails, the OPEN fails.
++ *
++ * stp is already locked.
+ */
+- if (stp) {
++ if (!new_stp) {
+ /* Stateid was found, this is an OPEN upgrade */
+ status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
+ if (status) {
+@@ -4350,22 +4359,11 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ goto out;
+ }
+ } else {
+- /* stp is returned locked. */
+- stp = init_open_stateid(fp, open);
+- /* See if we lost the race to some other thread */
+- if (stp->st_access_bmap != 0) {
+- status = nfs4_upgrade_open(rqstp, fp, current_fh,
+- stp, open);
+- if (status) {
+- mutex_unlock(&stp->st_mutex);
+- goto out;
+- }
+- goto upgrade_out;
+- }
+ status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open);
+ if (status) {
+- mutex_unlock(&stp->st_mutex);
++ stp->st_stid.sc_type = NFS4_CLOSED_STID;
+ release_open_stateid(stp);
++ mutex_unlock(&stp->st_mutex);
+ goto out;
+ }
+
+@@ -4374,7 +4372,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
+ if (stp->st_clnt_odstate == open->op_odstate)
+ open->op_odstate = NULL;
+ }
+-upgrade_out:
++
+ nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid);
+ mutex_unlock(&stp->st_mutex);
+
+--
+2.15.1
+
diff --git a/patches.kernel.org/4.4.104-028-Linux-4.4.104.patch b/patches.kernel.org/4.4.104-028-Linux-4.4.104.patch
new file mode 100644
index 0000000000..e25469abc5
--- /dev/null
+++ b/patches.kernel.org/4.4.104-028-Linux-4.4.104.patch
@@ -0,0 +1,27 @@
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Tue, 5 Dec 2017 11:22:52 +0100
+Subject: [PATCH] Linux 4.4.104
+References: bnc#1012382
+Patch-mainline: 4.4.104
+Git-commit: bd379939182247ace70e425ab60b3b1352db601b
+
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index f5a51cd7ca49..55500e023f61 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 4
+ PATCHLEVEL = 4
+-SUBLEVEL = 103
++SUBLEVEL = 104
+ EXTRAVERSION =
+ NAME = Blurry Fish Butt
+
+--
+2.15.1
+
diff --git a/patches.suse/sched-rt-Do-not-pull-from-current-CPU-if-only-one-CPU-to-pull.patch b/patches.suse/sched-rt-Do-not-pull-from-current-CPU-if-only-one-CPU-to-pull.patch
new file mode 100644
index 0000000000..eb680bf95b
--- /dev/null
+++ b/patches.suse/sched-rt-Do-not-pull-from-current-CPU-if-only-one-CPU-to-pull.patch
@@ -0,0 +1,80 @@
+From: Steven Rostedt <rostedt@goodmis.org>
+Date: Sat, 2 Dec 2017 13:04:54 -0500
+Subject: sched/rt: Do not pull from current CPU if only one CPU to pull
+Git-commit: f73c52a5bcd1710994e53fbccc378c42b97a06b6
+Patch-mainline: v4.15-rc4
+References: bnc#1022476
+
+Daniel Wagner reported a crash on the BeagleBone Black SoC.
+
+This is a single CPU architecture, and does not have a functional
+arch_send_call_function_single_ipi() implementation which can crash
+the kernel if that is called.
+
+As it only has one CPU, it shouldn't be called, but if the kernel is
+compiled for SMP, the push/pull RT scheduling logic now calls it for
+irq_work if the one CPU is overloaded, it can use that function to call
+itself and crash the kernel.
+
+Ideally, we should disable the SCHED_FEAT(RT_PUSH_IPI) if the system
+only has a single CPU. But SCHED_FEAT is a constant if sched debugging
+is turned off. Another fix can also be used, and this should also help
+with normal SMP machines. That is, do not initiate the pull code if
+there's only one RT overloaded CPU, and that CPU happens to be the
+current CPU that is scheduling in a lower priority task.
+
+Even on a system with many CPUs, if there's many RT tasks waiting to
+run on a single CPU, and that CPU schedules in another RT task of lower
+priority, it will initiate the PULL logic in case there's a higher
+priority RT task on another CPU that is waiting to run. But if there is
+no other CPU with waiting RT tasks, it will initiate the RT pull logic
+on itself (as it still has RT tasks waiting to run). This is a wasted
+effort.
+
+Not only does this help with SMP code where the current CPU is the only
+one with RT overloaded tasks, it should also solve the issue that
+Daniel encountered, because it will prevent the PULL logic from
+executing, as there's only one CPU on the system, and the check added
+here will cause it to exit the RT pull code.
+
+Reported-by: Daniel Wagner <wagi@monom.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Acked-by: Peter Zijlstra <peterz@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-rt-users <linux-rt-users@vger.kernel.org>
+Cc: stable@vger.kernel.org
+Fixes: 4bdced5c9 ("sched/rt: Simplify the IPI based RT balancing logic")
+Link: http://lkml.kernel.org/r/20171202130454.4cbbfe8d@vmware.local.home
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
+---
+ kernel/sched/rt.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/kernel/sched/rt.c
++++ b/kernel/sched/rt.c
+@@ -2003,8 +2003,9 @@ static void pull_rt_task(struct rq *this
+ bool resched = false;
+ struct task_struct *p;
+ struct rq *src_rq;
++ int rt_overload_count = rt_overloaded(this_rq);
+
+- if (likely(!rt_overloaded(this_rq)))
++ if (likely(!rt_overload_count))
+ return;
+
+ /*
+@@ -2013,6 +2014,11 @@ static void pull_rt_task(struct rq *this
+ */
+ smp_rmb();
+
++ /* If we are the only overloaded CPU do nothing */
++ if (rt_overload_count == 1 &&
++ cpumask_test_cpu(this_rq->cpu, this_rq->rd->rto_mask))
++ return;
++
+ #ifdef HAVE_RT_PUSH_IPI
+ if (sched_feat(RT_PUSH_IPI)) {
+ tell_cpu_to_push(this_rq);
diff --git a/series.conf b/series.conf
index a7787ac31d..4f41ddc28e 100644
--- a/series.conf
+++ b/series.conf
@@ -755,6 +755,34 @@
patches.kernel.org/4.4.103-096-xen-xenbus-driver-must-not-accept-invalid-tra.patch
patches.kernel.org/4.4.103-097-Revert-sctp-do-not-peel-off-an-assoc-from-one.patch
patches.kernel.org/4.4.103-098-Linux-4.4.103.patch
+ patches.kernel.org/4.4.104-001-netlink-add-a-start-callback-for-starting-a-n.patch
+ patches.kernel.org/4.4.104-002-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
+ patches.kernel.org/4.4.104-003-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-.patch
+ patches.kernel.org/4.4.104-004-x86-efi-Hoist-page-table-switching-code-into-.patch
+ patches.kernel.org/4.4.104-005-x86-efi-Build-our-own-page-table-structures.patch
+ patches.kernel.org/4.4.104-006-ARM-dts-omap3-logicpd-torpedo-37xx-devkit-Fix.patch
+ patches.kernel.org/4.4.104-007-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BG.patch
+ patches.kernel.org/4.4.104-008-x86-efi-bgrt-Replace-early_memremap-with-memr.patch
+ patches.kernel.org/4.4.104-009-mm-thp-Do-not-make-page-table-dirty-unconditi.patch
+ patches.kernel.org/4.4.104-010-mm-madvise.c-fix-madvise-infinite-loop-under-.patch
+ patches.kernel.org/4.4.104-011-btrfs-clear-space-cache-inode-generation-alwa.patch
+ patches.kernel.org/4.4.104-012-KVM-x86-pvclock-Handle-first-time-write-to-pv.patch
+ patches.kernel.org/4.4.104-013-KVM-x86-Exit-to-user-mode-on-UD-intercept-whe.patch
+ patches.kernel.org/4.4.104-014-KVM-x86-inject-exceptions-produced-by-x86_dec.patch
+ patches.kernel.org/4.4.104-015-mmc-core-Do-not-leave-the-block-driver-in-a-s.patch
+ patches.kernel.org/4.4.104-016-eeprom-at24-check-at24_read-write-arguments.patch
+ patches.kernel.org/4.4.104-017-bcache-Fix-building-error-on-MIPS.patch
+ patches.kernel.org/4.4.104-018-Revert-drm-radeon-dont-switch-vt-on-suspend.patch
+ patches.kernel.org/4.4.104-019-drm-radeon-fix-atombios-on-big-endian.patch
+ patches.kernel.org/4.4.104-020-drm-panel-simple-Add-missing-panel_simple_unp.patch
+ patches.kernel.org/4.4.104-021-mtd-nand-Fix-writing-mtdoops-to-nand-flash.patch
+ patches.kernel.org/4.4.104-022-NFS-revalidate-.-etc-correctly-on-open.patch
+ patches.kernel.org/4.4.104-023-drm-i915-Don-t-try-indexed-reads-to-alternate.patch
+ patches.kernel.org/4.4.104-024-drm-i915-Prevent-zero-length-index-write.patch
+ patches.kernel.org/4.4.104-025-nfsd-Make-init_open_stateid-a-bit-more-whole.patch
+ patches.kernel.org/4.4.104-026-nfsd-Fix-stateid-races-between-OPEN-and-CLOSE.patch
+ patches.kernel.org/4.4.104-027-nfsd-Fix-another-OPEN-stateid-race.patch
+ patches.kernel.org/4.4.104-028-Linux-4.4.104.patch
########################################################
# Build fixes that apply to the vanilla kernel too.
@@ -804,6 +832,8 @@
patches.kabi/kabi-protect-typedef-rds_rdma_cookie_t.patch
patches.kabi/net-sock-4.4.99-kabi-fix.patch
patches.kabi/kabi-protect-struct-rt_rq+root_domain.patch
+ patches.kabi/revert-ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
+ patches.kabi/revert-netlink-add-a-start-callback-for-starting-a-n.patch
########################################################
#
@@ -1242,6 +1272,7 @@
patches.suse/sched-fair-Use-task_groups-instead-of-leaf_cfs_rq_list-to-walk-all-cfs_rqs.patch
patches.suse/sched-fair-Fix-O-nr_cgroups-in-load-balance-path.patch
patches.suse/sched-core-Allow-__sched_setscheduler-in-interrupts-when-PI-is-not-used.patch
+ patches.suse/sched-rt-Do-not-pull-from-current-CPU-if-only-one-CPU-to-pull.patch
# bsc#1055096 -- the first 4 enable the actual fix
patches.fixes/percpu_ref-remove-unnecessary-rcu-grace-period-for-staggered-atomic-switching-confirmation
@@ -3695,9 +3726,7 @@
patches.fixes/0001-mm-page_owner-avoid-null-pointer-dereference.patch
patches.fixes/mm-page_alloc-fix-potential-false-positive-in-_zone_watermark_ok.patch
- patches.fixes/mm-thp-do-not-dirty-huge-pte-on-read-fault.patch
- patches.fixes/mm-madvise.c-fix-madvise-infinite-loop-under-special.patch
patches.fixes/quota-Check-for-register_shrinker-failure.patch
########################################################
@@ -4378,7 +4407,6 @@
patches.fixes/l2tp-fix-race-in-l2tp_recv_common.patch
patches.fixes/bonding-avoid-defaulting-hard_header_len-to-ETH_HLEN.patch
patches.fixes/af_key-fix-slab-out-of-bounds-in-pfkey_compile_policy.patch
- patches.fixes/ipsec-Fix-aborted-xfrm-policy-dump-crash.patch
patches.fixes/dccp-CVE-2017-8824-use-after-free-in-DCCP-code.patch
patches.fixes/netlink-Add-netns-check-on-taps.patch
@@ -4464,7 +4492,6 @@
patches.fixes/0001-NFS-flush-data-when-locking-a-file-to-ensure-cache-c.patch
patches.fixes/0001-NFS-Don-t-disconnect-open-owner-on-NFS4ERR_BAD_SEQID.patch
patches.fixes/0003-NFSv4-always-set-NFS_LOCK_LOST-when-a-lock-is-lost.patch
- patches.fixes/0002-NFS-revalidate-.-etc-correctly-on-open.patch
########################################################
# cifs patches
@@ -7743,13 +7770,10 @@
patches.kabi/drm-dp-mst-kabi-workaround.patch
patches.drivers/drm-gma500-fix-logic-error
- patches.drivers/drm-panel-simple-Add-missing-panel_simple_unprepare-
patches.drivers/drm-amdkfd-NULL-dereference-involving-create_process
patches.drivers/drm-nouveau-gr-fallback-to-legacy-paths-during-firmw
patches.drivers/0001-drm-radeon-Avoid-double-gpu-reset-by-adding-a-timeou.patch
- patches.drivers/drm-i915-Don-t-try-indexed-reads-to-alternate-slave-
- patches.drivers/drm-i915-Prevent-zero-length-index-write
patches.drivers/drm-omap-Fix-error-handling-path-in-omap_dmm_probe
########################################################
@@ -13832,6 +13856,62 @@
patches.drivers/ALSA-usb-audio-uac1-Invalidate-ctl-on-interrupt
patches.drivers/ALSA-hda-realtek-Add-headset-mic-support-for-Intel-N
+ patches.drivers/ALSA-hda-Drop-useless-WARN_ON
+ patches.drivers/ALSA-hda-realtek-Remove-ALC285-device-ID
+ patches.drivers/ALSA-hda-realtek-New-codecs-support-for-ALC215-ALC28
+ patches.drivers/ALSA-hda-Fix-missing-COEF-init-for-ALC225-295-299
+ patches.drivers/ALSA-hda-realtek-New-codec-support-of-ALC1220
+ patches.drivers/ALSA-hda-realtek-New-codec-device-ID-for-ALC1220
+ patches.drivers/ALSA-hda-realtek-Add-support-for-ALC1220
+ patches.drivers/ALSA-hda-realtek-New-codec-support-for-ALC257
+ patches.drivers/ALSA-hda-realtek-Fix-ALC275-no-sound-issue
+ patches.drivers/ALSA-hda-realtek-Add-ALC256-HP-depop-function
+ patches.drivers/ALSA-hda-realtek-Add-default-procedure-for-suspend-a
+ patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC298
+ patches.drivers/ALSA-hda-realtek-Support-headset-mode-for-ALC234-ALC
+ patches.drivers/ALSA-hda-realtek-Update-headset-mode-for-ALC225
+ patches.drivers/ALSA-hda-realtek-ALC891-headset-mode-for-Dell
+ patches.drivers/ALSA-hda-realtek-Support-Dell-headset-mode-for-ALC32
+ patches.drivers/ALSA-hda-realtek-Add-support-for-Acer-Aspire-E5-475-
+ patches.drivers/ALSA-hda-realtek-Fix-headset-mic-on-several-Asus-lap
+ patches.drivers/ALSA-hda-realtek-fix-headset-mic-detection-for-MSI-M
+ patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-820-
+ patches.drivers/ALSA-hda-Fix-click-noises-on-Samsung-Ativ-Book-8
+ patches.drivers/ALSA-hda-realtek-Fix-headset-and-mic-on-several-Asus
+ patches.drivers/ALSA-hda-realtek-Fix-headset-mic-and-speaker-on-Asus
+ patches.drivers/ALSA-hda-realtek-Fix-speaker-support-for-Asus-AiO-ZN
+ patches.drivers/ALSA-hda-realtek-change-the-location-for-one-of-two-
+ patches.drivers/ALSA-hda-realtek-Enable-jack-detection-function-for-
+ patches.drivers/ALSA-hda-Skip-Realtek-SKU-check-for-Lenovo-machines
+ patches.drivers/ALSA-hda-fix-headset-mic-detection-issue-on-a-Dell-m
+ patches.drivers/ALSA-hda-realtek-Fix-pincfg-for-Dell-XPS-13-9370
+ patches.drivers/ALSA-hda-realtek-Fix-Dell-AIO-LineOut-issue
+ patches.drivers/ALSA-hda-change-the-location-for-one-mic-on-a-Lenovo
+ patches.drivers/ALSA-hda-realtek-No-loopback-on-ALC225-ALC295-codec
+ patches.drivers/ALSA-hda-realtek-There-is-no-loopback-mixer-in-the-A
+ patches.drivers/ALSA-hda-realtek-Add-support-for-headset-MIC-for-ALC
+ patches.drivers/ALSA-hda-Fix-headset-microphone-detection-for-ASUS-N
+ patches.drivers/ALSA-hda-On-board-speaker-fixup-on-ACER-Veriton
+ patches.drivers/ALSA-hda-Fix-surround-output-pins-for-ASRock-B150M-m
+ patches.drivers/ALSA-hda-Fix-mic-regression-by-ASRock-mobo-fixup
+ patches.drivers/ALSA-hda-add-support-for-docking-station-for-HP-840-
+ patches.drivers/ALSA-hda-Add-HP-ZBook-15u-G3-Conexant-CX20724-GPIO-m
+ patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-EliteBook-840-G
+ patches.drivers/ALSA-hda-Add-mute-led-support-for-HP-ProBook-440-G4
+ patches.drivers/ALSA-hda-Add-MIC_NO_PRESENCE-fixup-for-2-HP-machines
+
+ patches.drivers/ALSA-usb-audio-Fix-out-of-bound-error
+ patches.drivers/ALSA-usb-audio-Add-check-return-value-for-usb_string
+ patches.drivers/ALSA-usb-audio-Fix-the-missing-ctl-name-suffix-at-pa
+
+ patches.drivers/ALSA-seq-Remove-spurious-WARN_ON-at-timer-check
+ patches.drivers/ALSA-pcm-prevent-UAF-in-snd_pcm_info
+ patches.drivers/ALSA-rawmidi-Avoid-racy-info-ioctl-via-ctl-device
+
+ patches.drivers/ASoC-wm_adsp-Fix-validation-of-firmware-and-coeff-le
+ patches.drivers/ASoC-fsl_ssi-AC-97-ops-need-regmap-clock-and-cleanin
+ patches.drivers/ASoC-twl4030-fix-child-node-lookup
+
########################################################
# Char / serial
########################################################
@@ -18466,7 +18546,6 @@
# Qualcomm efi patches fate#320512
patches.arch/qcom-0001-arm64-efi-split-off-EFI-init-and-runtime-code-for-re.patch
patches.arch/qcom-0002-arm64-efi-refactor-EFI-init-and-runtime-code-for-reu.patch
- patches.arch/qcom-0003-x86-efi-bgrt-Fix-kernel-panic-when-mapping-BGRT-data.patch
patches.arch/qcom-0004-ARM-wire-up-UEFI-init-and-runtime-support.patch
patches.arch/qcom-0005-ARM-add-UEFI-stub-support.patch
patches.arch/qcom-0006-efi-include-asm-early_ioremap.h-not-asm-efi.h-to-get.patch
@@ -18479,8 +18558,6 @@
patches.arch/qcom-0013-efi-arm64-Check-for-h-w-support-before-booting-a-4-K.patch
patches.arch/qcom-0014-efi-arm-Perform-hardware-compatibility-check.patch
patches.arch/qcom-0015-x86-efi-Map-RAM-into-the-identity-page-table-for-mix.patch
- patches.arch/qcom-0016-x86-efi-Hoist-page-table-switching-code-into-efi_cal.patch
- patches.arch/qcom-0017-x86-efi-Build-our-own-page-table-structures.patch
patches.arch/qcom-0018-x86-efi-Setup-separate-EFI-page-tables-in-kexec-path.patch
patches.arch/qcom-0022-efi-Iterate-over-efi.memmap-in-for_each_efi_memory_d.patch
patches.arch/qcom-0023-efi-Remove-global-memmap-EFI-memory-map.patch
@@ -18520,7 +18597,6 @@
# fate#320588 Support EFI_MEMORY_ATTRIBUTES_TABLE from UEFI 2.6
patches.arch/0001-x86-mm-Page-align-the-_end-symbol-to-avoid-pfn-conve.patch
- patches.arch/0002-x86-mm-pat-Ensure-cpa-pfn-only-contains-page-frame-n.patch
patches.arch/0003-Documentation-x86-Update-EFI-memory-region-descripti.patch
patches.arch/0004-x86-mm-pat-Don-t-implicitly-allow-_PAGE_RW-in-kernel.patch
patches.arch/0005-x86-efi-Map-EFI_MEMORY_-XP-RO-memory-region-bits-to-.patch