Home Home > GIT Browse > stable-xen
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2017-09-22 14:45:10 +0200
committerJan Beulich <jbeulich@suse.com>2017-09-22 14:45:10 +0200
commitc1e13ef0d51d633886d4e588d0560cd05204f6ce (patch)
tree347eeec41896469f058c6a1d1709df7dcc490281
parent2cbf5768089626c15a3ca62f4421d76da40f9a53 (diff)
parent7e9e30a752f3add074e1cc482622210a618de2bb (diff)
Merge commit '7e9e30a752' into stable-xen
-rw-r--r--README15
-rw-r--r--patches.apparmor/apparmor-basic-networking-rules-4.11-rc1.patch142
-rw-r--r--patches.apparmor/apparmor-basic-networking-rules.patch196
-rw-r--r--patches.arch/ppc-pegasos-console-autodetection.patch19
-rw-r--r--patches.arch/ppc-prom-nodisplay.patch79
-rw-r--r--patches.arch/x86_64-unwind-annotations159
-rw-r--r--patches.drivers/001-x86-platform-intel-iosf_mbi-Add-a-mutex-for-P-Unit-a114
-rw-r--r--patches.drivers/002-x86-platform-intel-iosf_mbi-Add-a-PMIC-bus-access-no167
-rw-r--r--patches.drivers/003-i2c-designware-Rename-accessor_flags-to-flags103
-rw-r--r--patches.drivers/004-i2c-designware-baytrail-Pass-dw_i2c_dev-into-helper-94
-rw-r--r--patches.drivers/005-i2c-designware-baytrail-Only-check-iosf_mbi_availabl55
-rw-r--r--patches.drivers/006-i2c-designware-baytrail-Disallow-the-CPU-to-enter-C6164
-rw-r--r--patches.drivers/007-i2c-designware-baytrail-Fix-race-when-resetting-the-45
-rw-r--r--patches.drivers/008-i2c-designware-baytrail-Add-support-for-cherrytrail180
-rw-r--r--patches.drivers/009-i2c-designware-baytrail-Acquire-P-Unit-access-on-bus48
-rw-r--r--patches.drivers/010-i2c-designware-baytrail-Call-pmic_bus_access_notifie45
-rw-r--r--patches.drivers/011-drm-i915-Add-intel_uncore_suspend-resume-functions113
-rw-r--r--patches.drivers/012-drm-i915-Listen-for-PMIC-bus-access-notifications164
-rw-r--r--patches.drivers/013-i2c-designware-increase-timeout-of-semaphore-transfe36
-rw-r--r--patches.drivers/014-i2c-designware-Never-suspend-i2c-busses-used-for-acc148
-rw-r--r--patches.drivers/015-i2c-designware-Disable-pm-for-PMIC-i2c-bus-even-if-t63
-rw-r--r--patches.drivers/016-i2c-designware-Get-selected-speed-mode-sda-hold-time72
-rw-r--r--patches.drivers/017-i2c-designware-baytrail-fix-potential-null-pointer-d45
-rw-r--r--patches.drivers/ALSA-hda-Implement-mic-mute-LED-mode-enum149
-rw-r--r--patches.drivers/ALSA-ice1712-Add-support-for-STAudio-ADCIII107
-rw-r--r--patches.drivers/HID-asus-change-mapping-from-KEY_WLAN-to-KEY_RFKILL41
-rw-r--r--patches.drivers/HID-asus-drop-dependency-on-I2C_HID31
-rw-r--r--patches.drivers/HID-asus-fix-and-generalize-ambiguous-preprocessor-m143
-rw-r--r--patches.drivers/HID-asus-ignore-declared-dummy-usages81
-rw-r--r--patches.drivers/HID-asus-support-Republic-of-Gamers-special-keys126
-rw-r--r--patches.drivers/Input-axp20x-pek-do-not-register-input-device-on-som64
-rw-r--r--patches.drivers/Input-axp20x-pek-use-our-own-device-for-errors61
-rw-r--r--patches.drivers/Input-axp20x_pek-add-axp20x_pek_probe_input_device-h101
-rw-r--r--patches.drivers/Input-soc_button_array-Propagate-error-from-gpiod_co40
-rw-r--r--patches.drivers/Input-soc_button_array-add-support-for-ACPI-6.0-Gene222
-rw-r--r--patches.drivers/Input-soc_button_array-get-rid-of-MAX_NBUTTONS70
-rw-r--r--patches.drivers/Input-soc_button_array-properly-map-usage-0x07-0xe337
-rw-r--r--patches.drivers/Input-soc_button_array-use-NULL-for-GPIO-connection44
-rw-r--r--patches.drivers/dell-laptop-Adds-support-for-keyboard-backlight-timeout193
-rw-r--r--patches.drivers/ppc64-adb53
-rw-r--r--patches.drivers/pstore_disable_efi_backend_by_default.patch14
-rw-r--r--patches.drivers/rt2800-fix-TX_PIN_CFG-setting-for-non-MT7620-chips40
-rw-r--r--patches.drivers/scsi-qla2xxx-Fix-an-integer-overflow-in-sysfs-code.patch66
-rw-r--r--patches.fixes/block-copy-bi_vcnt-in-_bio_clone_fast41
-rw-r--r--patches.fixes/btrfs-qgroups-Retry-after-commit-on-getting-EDQUOT.patch127
-rw-r--r--patches.fixes/drm-amdgpu-revert-update-tile-table-for-oland-hainan.patch454
-rw-r--r--patches.fixes/drm-i915-Fix-S4-resume-breakage36
-rw-r--r--patches.fixes/reiserfs-fix-race-in-prealloc-discard.patch43
-rw-r--r--patches.fixes/scsi-ibmvscsi-module_alias.patch39
-rw-r--r--patches.rpmify/drm-i915-disable-KASAN-for-handlers.patch40
-rw-r--r--patches.rpmify/get_builtin_firmware-gcc-7.patch36
-rw-r--r--patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch186
-rw-r--r--patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch1357
-rw-r--r--patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch36
-rw-r--r--patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch83
-rw-r--r--patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch99
-rw-r--r--patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch113
-rw-r--r--patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch73
-rw-r--r--patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch157
-rw-r--r--patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch79
-rw-r--r--patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch1297
-rw-r--r--patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch617
-rw-r--r--patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch448
-rw-r--r--patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch55
-rw-r--r--patches.suse/binutils2_26.patch2
-rw-r--r--patches.suse/btrfs-8447-serialize-subvolume-mounts-with-potentially-mi.patch73
-rw-r--r--patches.suse/btrfs-btrfs-use-the-new-VFS-super_block_dev.patch37
-rw-r--r--patches.suse/btrfs-fs-super.c-add-new-super-block-devices-super_block_d.patch18
-rw-r--r--patches.suse/iwlwifi-expose-default-fallback-ucode-api23
-rw-r--r--patches.suse/ppc-powerbook-usb-fn-key-default.patch32
-rw-r--r--patches.suse/pstore-backend-autoaction156
-rw-r--r--patches.suse/supported-flag53
-rw-r--r--patches.suse/suse-ppc64-branding25
-rw-r--r--patches.suse/uapi-add-a-compatibility-layer-between-linux-uio-h-and-glibc64
-rw-r--r--patches.suse/vfs-add-super_operations-get_inode_dev155
-rw-r--r--rpm/config.sh2
-rw-r--r--rpm/dtb.spec.in.in3
-rwxr-xr-xrpm/find-provides18
-rw-r--r--rpm/find-requires45
-rwxr-xr-xrpm/kabi.pl46
-rw-r--r--rpm/kernel-binary.spec.in47
-rw-r--r--rpm/kernel-docs.spec.in118
-rw-r--r--rpm/kernel-module-subpackage2
-rw-r--r--rpm/kernel-source.spec.in4
-rwxr-xr-xrpm/mkspec36
-rw-r--r--rpm/package-descriptions32
-rwxr-xr-xscripts/osc_wrapper11
-rwxr-xr-xscripts/stableids2
-rwxr-xr-xscripts/stop-sync2
-rw-r--r--series.conf83
-rw-r--r--supported.conf4
91 files changed, 6093 insertions, 4365 deletions
diff --git a/README b/README
index 34a0315287..00cb1062ab 100644
--- a/README
+++ b/README
@@ -175,6 +175,21 @@ test compiled as follows:
$ make oldconfig
$ make
+When committing a patch series try to make the series easy bisectable,
+i.e. when applying only the first x patches (1 <= x <= n, n being the
+number of patches in the series) the kernel is still buildable and
+functional.
+
+This means especially, that just adding upstream patches unmodified
+to a series and doing a cleanup patch at the end of the series to
+ensure the kernel is buildable and functional is to be avoided. Each
+patch from upstream should be modified as required to fit into the
+kernel it is backported to, both for build time and runtime.
+
+In cases where upstream patches did cause a breakage (either build or
+functional) which was corrected by a later patch and both patches are
+part of the series, try to place the correcting patch as near as
+possible to the patch causing breakage.
Config Option Changes
=====================
diff --git a/patches.apparmor/apparmor-basic-networking-rules-4.11-rc1.patch b/patches.apparmor/apparmor-basic-networking-rules-4.11-rc1.patch
deleted file mode 100644
index 243d1401aa..0000000000
--- a/patches.apparmor/apparmor-basic-networking-rules-4.11-rc1.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-From: Jeff Mahoney <jeffm@suse.com>
-Subject: apparmor: update apparmor-basic-networking-rules for 4.11-rc1
-Patch-mainline: depends on apparmor-basic-networking-rules.patch
-References: FATE#300516
-
-4.11-rc1 changed op from a index into an array of strings to the strings
-themselves.
-
-It also renamed: OP_SOCK_SHUTDOWN to OP_SHUTDOWN and
-common_audit_data.aad to common_audit_data.apparmor_audit_data and removed
-the gfp_t parameter from aa_audit.
-
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
- security/apparmor/include/net.h | 4 ++--
- security/apparmor/lsm.c | 2 +-
- security/apparmor/net.c | 39 ++++++++++++++++++++-------------------
- 3 files changed, 23 insertions(+), 22 deletions(-)
-
---- a/security/apparmor/include/net.h
-+++ b/security/apparmor/include/net.h
-@@ -32,9 +32,9 @@ struct aa_net {
-
- extern struct aa_fs_entry aa_fs_entry_network[];
-
--extern int aa_net_perm(int op, struct aa_profile *profile, u16 family,
-+extern int aa_net_perm(const char *op, struct aa_profile *profile, u16 family,
- int type, int protocol, struct sock *sk);
--extern int aa_revalidate_sk(int op, struct sock *sk);
-+extern int aa_revalidate_sk(const char *op, struct sock *sk);
-
- static inline void aa_free_net_rules(struct aa_net *new)
- {
---- a/security/apparmor/lsm.c
-+++ b/security/apparmor/lsm.c
-@@ -683,7 +683,7 @@ static int apparmor_socket_shutdown(stru
- {
- struct sock *sk = sock->sk;
-
-- return aa_revalidate_sk(OP_SOCK_SHUTDOWN, sk);
-+ return aa_revalidate_sk(OP_SHUTDOWN, sk);
- }
-
- static struct security_hook_list apparmor_hooks[] = {
---- a/security/apparmor/net.c
-+++ b/security/apparmor/net.c
-@@ -37,12 +37,12 @@ static void audit_cb(struct audit_buffer
- audit_log_format(ab, "\"unknown(%d)\"", sa->u.net->family);
- }
- audit_log_format(ab, " sock_type=");
-- if (sock_type_names[sa->aad->net.type]) {
-- audit_log_string(ab, sock_type_names[sa->aad->net.type]);
-+ if (sock_type_names[aad(sa)->net.type]) {
-+ audit_log_string(ab, sock_type_names[aad(sa)->net.type]);
- } else {
-- audit_log_format(ab, "\"unknown(%d)\"", sa->aad->net.type);
-+ audit_log_format(ab, "\"unknown(%d)\"", aad(sa)->net.type);
- }
-- audit_log_format(ab, " protocol=%d", sa->aad->net.protocol);
-+ audit_log_format(ab, " protocol=%d", aad(sa)->net.protocol);
- }
-
- /**
-@@ -57,8 +57,9 @@ static void audit_cb(struct audit_buffer
- *
- * Returns: %0 or sa->error else other errorcode on failure
- */
--static int audit_net(struct aa_profile *profile, int op, u16 family, int type,
-- int protocol, struct sock *sk, int error)
-+static int audit_net(struct aa_profile *profile, const char *op,
-+ u16 family, int type, int protocol,
-+ struct sock *sk, int error)
- {
- int audit_type = AUDIT_APPARMOR_AUTO;
- struct common_audit_data sa;
-@@ -70,25 +71,25 @@ static int audit_net(struct aa_profile *
- sa.type = LSM_AUDIT_DATA_NONE;
- }
- /* todo fill in socket addr info */
-- sa.aad = &aad;
-+ aad(&sa) = &aad;
- sa.u.net = &net;
-- sa.aad->op = op,
-+ aad(&sa)->op = op,
- sa.u.net->family = family;
- sa.u.net->sk = sk;
-- sa.aad->net.type = type;
-- sa.aad->net.protocol = protocol;
-- sa.aad->error = error;
-+ aad(&sa)->net.type = type;
-+ aad(&sa)->net.protocol = protocol;
-+ aad(&sa)->error = error;
-
-- if (likely(!sa.aad->error)) {
-+ if (likely(!aad(&sa)->error)) {
- u16 audit_mask = profile->net.audit[sa.u.net->family];
- if (likely((AUDIT_MODE(profile) != AUDIT_ALL) &&
-- !(1 << sa.aad->net.type & audit_mask)))
-+ !(1 << aad(&sa)->net.type & audit_mask)))
- return 0;
- audit_type = AUDIT_APPARMOR_AUDIT;
- } else {
- u16 quiet_mask = profile->net.quiet[sa.u.net->family];
- u16 kill_mask = 0;
-- u16 denied = (1 << sa.aad->net.type) & ~quiet_mask;
-+ u16 denied = (1 << aad(&sa)->net.type) & ~quiet_mask;
-
- if (denied & kill_mask)
- audit_type = AUDIT_APPARMOR_KILL;
-@@ -96,10 +97,10 @@ static int audit_net(struct aa_profile *
- if ((denied & quiet_mask) &&
- AUDIT_MODE(profile) != AUDIT_NOQUIET &&
- AUDIT_MODE(profile) != AUDIT_ALL)
-- return COMPLAIN_MODE(profile) ? 0 : sa.aad->error;
-+ return COMPLAIN_MODE(profile) ? 0 : aad(&sa)->error;
- }
-
-- return aa_audit(audit_type, profile, GFP_KERNEL, &sa, audit_cb);
-+ return aa_audit(audit_type, profile, &sa, audit_cb);
- }
-
- /**
-@@ -112,8 +113,8 @@ static int audit_net(struct aa_profile *
- *
- * Returns: %0 else error if permission denied
- */
--int aa_net_perm(int op, struct aa_profile *profile, u16 family, int type,
-- int protocol, struct sock *sk)
-+int aa_net_perm(const char *op, struct aa_profile *profile, u16 family,
-+ int type, int protocol, struct sock *sk)
- {
- u16 family_mask;
- int error;
-@@ -142,7 +143,7 @@ int aa_net_perm(int op, struct aa_profil
- *
- * Returns: %0 else error if permission denied
- */
--int aa_revalidate_sk(int op, struct sock *sk)
-+int aa_revalidate_sk(const char *op, struct sock *sk)
- {
- struct aa_profile *profile;
- int error = 0;
diff --git a/patches.apparmor/apparmor-basic-networking-rules.patch b/patches.apparmor/apparmor-basic-networking-rules.patch
index a68bed935a..fc2e7c3252 100644
--- a/patches.apparmor/apparmor-basic-networking-rules.patch
+++ b/patches.apparmor/apparmor-basic-networking-rules.patch
@@ -11,20 +11,20 @@ Base support for network mediation.
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Jeff Mahoney <jeffm@suse.com>
---
- security/apparmor/.gitignore | 1 +
- security/apparmor/Makefile | 42 +++++++++-
- security/apparmor/apparmorfs.c | 1 +
- security/apparmor/include/audit.h | 4 +
- security/apparmor/include/net.h | 44 ++++++++++
- security/apparmor/include/policy.h | 3 +
- security/apparmor/lsm.c | 112 +++++++++++++++++++++++++
- security/apparmor/net.c | 162 +++++++++++++++++++++++++++++++++++++
- security/apparmor/policy.c | 1 +
- security/apparmor/policy_unpack.c | 46 +++++++++++
- 10 files changed, 414 insertions(+), 2 deletions(-)
+ security/apparmor/.gitignore | 1
+ security/apparmor/Makefile | 42 ++++++++
+ security/apparmor/apparmorfs.c | 1
+ security/apparmor/include/audit.h | 4
+ security/apparmor/include/net.h | 44 +++++++++
+ security/apparmor/include/policy.h | 3
+ security/apparmor/lsm.c | 112 +++++++++++++++++++++++
+ security/apparmor/net.c | 175 +++++++++++++++++++++++++++++++++++++
+ security/apparmor/policy.c | 1
+ security/apparmor/policy_unpack.c | 46 +++++++++
+ 10 files changed, 427 insertions(+), 2 deletions(-)
+ create mode 100644 security/apparmor/include/net.h
+ create mode 100644 security/apparmor/net.c
-diff --git a/security/apparmor/.gitignore b/security/apparmor/.gitignore
-index 9cdec70..d5b291e 100644
--- a/security/apparmor/.gitignore
+++ b/security/apparmor/.gitignore
@@ -1,5 +1,6 @@
@@ -34,16 +34,14 @@ index 9cdec70..d5b291e 100644
+net_names.h
capability_names.h
rlim_names.h
-diff --git a/security/apparmor/Makefile b/security/apparmor/Makefile
-index d693df8..5dbb72f 100644
--- a/security/apparmor/Makefile
+++ b/security/apparmor/Makefile
-@@ -4,10 +4,10 @@ obj-$(CONFIG_SECURITY_APPARMOR) += apparmor.o
+@@ -4,10 +4,10 @@ obj-$(CONFIG_SECURITY_APPARMOR) += appar
apparmor-y := apparmorfs.o audit.o capability.o context.o ipc.o lib.o match.o \
path.o domain.o policy.o policy_unpack.o procattr.o lsm.o \
-- resource.o secid.o file.o policy_ns.o
-+ resource.o secid.o file.o policy_ns.o net.o
+- resource.o secid.o file.o policy_ns.o label.o
++ resource.o secid.o file.o policy_ns.o net.o label.o
apparmor-$(CONFIG_SECURITY_APPARMOR_HASH) += crypto.o
-clean-files := capability_names.h rlim_names.h
@@ -51,7 +49,7 @@ index d693df8..5dbb72f 100644
# Build a lower case string table of capability names
-@@ -25,6 +25,38 @@ cmd_make-caps = echo "static const char *const capability_names[] = {" > $@ ;\
+@@ -25,6 +25,38 @@ cmd_make-caps = echo "static const char
-e 's/^\#define[ \t]+CAP_([A-Z0-9_]+)[ \t]+([0-9]+)/\L\1/p' | \
tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
@@ -90,7 +88,7 @@ index d693df8..5dbb72f 100644
# Build a lower case string table of rlimit names.
# Transforms lines from
-@@ -61,6 +93,7 @@ cmd_make-rlim = echo "static const char *const rlim_names[RLIM_NLIMITS] = {" \
+@@ -61,6 +93,7 @@ cmd_make-rlim = echo "static const char
tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@
$(obj)/capability.o : $(obj)/capability_names.h
@@ -98,7 +96,7 @@ index d693df8..5dbb72f 100644
$(obj)/resource.o : $(obj)/rlim_names.h
$(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h \
$(src)/Makefile
-@@ -68,3 +101,8 @@ $(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h \
+@@ -68,3 +101,8 @@ $(obj)/capability_names.h : $(srctree)/i
$(obj)/rlim_names.h : $(srctree)/include/uapi/asm-generic/resource.h \
$(src)/Makefile
$(call cmd,make-rlim)
@@ -107,24 +105,20 @@ index d693df8..5dbb72f 100644
+ $(src)/Makefile
+ $(call cmd,make-af)
+ $(call cmd,make-sock)
-diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
-index 729e595..181d961 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
-@@ -807,6 +807,7 @@ static struct aa_fs_entry aa_fs_entry_features[] = {
- AA_FS_DIR("policy", aa_fs_entry_policy),
- AA_FS_DIR("domain", aa_fs_entry_domain),
- AA_FS_DIR("file", aa_fs_entry_file),
-+ AA_FS_DIR("network", aa_fs_entry_network),
- AA_FS_FILE_U64("capability", VFS_CAP_FLAGS_MASK),
- AA_FS_DIR("rlimit", aa_fs_entry_rlimit),
- AA_FS_DIR("caps", aa_fs_entry_caps),
-diff --git a/security/apparmor/include/audit.h b/security/apparmor/include/audit.h
-index ba3dfd1..5d3c419 100644
+@@ -2173,6 +2173,7 @@ static struct aa_sfs_entry aa_sfs_entry_
+ AA_SFS_DIR("domain", aa_sfs_entry_domain),
+ AA_SFS_DIR("file", aa_sfs_entry_file),
+ AA_SFS_DIR("namespaces", aa_sfs_entry_ns),
++ AA_SFS_DIR("network", aa_sfs_entry_network),
+ AA_SFS_FILE_U64("capability", VFS_CAP_FLAGS_MASK),
+ AA_SFS_DIR("rlimit", aa_sfs_entry_rlimit),
+ AA_SFS_DIR("caps", aa_sfs_entry_caps),
--- a/security/apparmor/include/audit.h
+++ b/security/apparmor/include/audit.h
-@@ -125,6 +125,10 @@ struct apparmor_audit_data {
- u32 denied;
+@@ -120,6 +120,10 @@ struct apparmor_audit_data {
+ const char *target;
kuid_t ouid;
} fs;
+ struct {
@@ -134,9 +128,6 @@ index ba3dfd1..5d3c419 100644
};
struct {
const char *name;
-diff --git a/security/apparmor/include/net.h b/security/apparmor/include/net.h
-new file mode 100644
-index 0000000..cb8a121
--- /dev/null
+++ b/security/apparmor/include/net.h
@@ -0,0 +1,44 @@
@@ -172,11 +163,11 @@ index 0000000..cb8a121
+ u16 quiet[AF_MAX];
+};
+
-+extern struct aa_fs_entry aa_fs_entry_network[];
++extern struct aa_sfs_entry aa_sfs_entry_network[];
+
-+extern int aa_net_perm(int op, struct aa_profile *profile, u16 family,
++extern int aa_net_perm(const char *op, struct aa_label *label, u16 family,
+ int type, int protocol, struct sock *sk);
-+extern int aa_revalidate_sk(int op, struct sock *sk);
++extern int aa_revalidate_sk(const char *op, struct sock *sk);
+
+static inline void aa_free_net_rules(struct aa_net *new)
+{
@@ -184,19 +175,17 @@ index 0000000..cb8a121
+}
+
+#endif /* __AA_NET_H */
-diff --git a/security/apparmor/include/policy.h b/security/apparmor/include/policy.h
-index 52275f0..4fc4dac 100644
--- a/security/apparmor/include/policy.h
+++ b/security/apparmor/include/policy.h
-@@ -27,6 +27,7 @@
+@@ -28,6 +28,7 @@
#include "capability.h"
#include "domain.h"
#include "file.h"
+#include "net.h"
#include "lib.h"
- #include "resource.h"
-
-@@ -176,6 +177,7 @@ struct aa_replacedby {
+ #include "label.h"
+ #include "perms.h"
+@@ -111,6 +112,7 @@ struct aa_data {
* @policy: general match rules governing policy
* @file: The set of rules governing basic file access and domain transitions
* @caps: capabilities for the profile
@@ -204,7 +193,7 @@ index 52275f0..4fc4dac 100644
* @rlimits: rlimits for the profile
*
* @dents: dentries for the profiles file entries in apparmorfs
-@@ -217,6 +219,7 @@ struct aa_profile {
+@@ -148,6 +150,7 @@ struct aa_profile {
struct aa_policydb policy;
struct aa_file_rules file;
struct aa_caps caps;
@@ -212,31 +201,29 @@ index 52275f0..4fc4dac 100644
struct aa_rlimit rlimits;
struct aa_loaddata *rawdata;
-diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
-index 41b8cb1..d96b5f7 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
-@@ -32,6 +32,7 @@
+@@ -33,6 +33,7 @@
#include "include/context.h"
#include "include/file.h"
#include "include/ipc.h"
+#include "include/net.h"
#include "include/path.h"
+ #include "include/label.h"
#include "include/policy.h"
- #include "include/policy_ns.h"
-@@ -584,6 +585,104 @@ static int apparmor_task_setrlimit(struct task_struct *task,
+@@ -656,6 +657,104 @@ static int apparmor_task_setrlimit(struc
return error;
}
+static int apparmor_socket_create(int family, int type, int protocol, int kern)
+{
-+ struct aa_profile *profile;
++ struct aa_label *profile;
+ int error = 0;
+
+ if (kern)
+ return 0;
+
-+ profile = __aa_current_profile();
++ profile = aa_current_raw_label();
+ if (!unconfined(profile))
+ error = aa_net_perm(OP_CREATE, profile, family, type, protocol,
+ NULL);
@@ -323,13 +310,13 @@ index 41b8cb1..d96b5f7 100644
+{
+ struct sock *sk = sock->sk;
+
-+ return aa_revalidate_sk(OP_SOCK_SHUTDOWN, sk);
++ return aa_revalidate_sk(OP_SHUTDOWN, sk);
+}
+
- static struct security_hook_list apparmor_hooks[] = {
+ static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = {
LSM_HOOK_INIT(ptrace_access_check, apparmor_ptrace_access_check),
LSM_HOOK_INIT(ptrace_traceme, apparmor_ptrace_traceme),
-@@ -613,6 +712,19 @@ static struct security_hook_list apparmor_hooks[] = {
+@@ -686,6 +785,19 @@ static struct security_hook_list apparmo
LSM_HOOK_INIT(getprocattr, apparmor_getprocattr),
LSM_HOOK_INIT(setprocattr, apparmor_setprocattr),
@@ -349,12 +336,9 @@ index 41b8cb1..d96b5f7 100644
LSM_HOOK_INIT(cred_alloc_blank, apparmor_cred_alloc_blank),
LSM_HOOK_INIT(cred_free, apparmor_cred_free),
LSM_HOOK_INIT(cred_prepare, apparmor_cred_prepare),
-diff --git a/security/apparmor/net.c b/security/apparmor/net.c
-new file mode 100644
-index 0000000..003dd18
--- /dev/null
+++ b/security/apparmor/net.c
-@@ -0,0 +1,162 @@
+@@ -0,0 +1,175 @@
+/*
+ * AppArmor security module
+ *
@@ -377,8 +361,8 @@ index 0000000..003dd18
+
+#include "net_names.h"
+
-+struct aa_fs_entry aa_fs_entry_network[] = {
-+ AA_FS_FILE_STRING("af_mask", AA_FS_AF_MASK),
++struct aa_sfs_entry aa_sfs_entry_network[] = {
++ AA_SFS_FILE_STRING("af_mask", AA_FS_AF_MASK),
+ { }
+};
+
@@ -394,12 +378,12 @@ index 0000000..003dd18
+ audit_log_format(ab, "\"unknown(%d)\"", sa->u.net->family);
+ }
+ audit_log_format(ab, " sock_type=");
-+ if (sock_type_names[sa->aad->net.type]) {
-+ audit_log_string(ab, sock_type_names[sa->aad->net.type]);
++ if (sock_type_names[aad(sa)->net.type]) {
++ audit_log_string(ab, sock_type_names[aad(sa)->net.type]);
+ } else {
-+ audit_log_format(ab, "\"unknown(%d)\"", sa->aad->net.type);
++ audit_log_format(ab, "\"unknown(%d)\"", aad(sa)->net.type);
+ }
-+ audit_log_format(ab, " protocol=%d", sa->aad->net.protocol);
++ audit_log_format(ab, " protocol=%d", aad(sa)->net.protocol);
+}
+
+/**
@@ -414,8 +398,9 @@ index 0000000..003dd18
+ *
+ * Returns: %0 or sa->error else other errorcode on failure
+ */
-+static int audit_net(struct aa_profile *profile, int op, u16 family, int type,
-+ int protocol, struct sock *sk, int error)
++static int audit_net(struct aa_profile *profile, const char *op,
++ u16 family, int type, int protocol,
++ struct sock *sk, int error)
+{
+ int audit_type = AUDIT_APPARMOR_AUTO;
+ struct common_audit_data sa;
@@ -427,25 +412,25 @@ index 0000000..003dd18
+ sa.type = LSM_AUDIT_DATA_NONE;
+ }
+ /* todo fill in socket addr info */
-+ sa.aad = &aad;
++ aad(&sa) = &aad;
+ sa.u.net = &net;
-+ sa.aad->op = op,
++ aad(&sa)->op = op,
+ sa.u.net->family = family;
+ sa.u.net->sk = sk;
-+ sa.aad->net.type = type;
-+ sa.aad->net.protocol = protocol;
-+ sa.aad->error = error;
++ aad(&sa)->net.type = type;
++ aad(&sa)->net.protocol = protocol;
++ aad(&sa)->error = error;
+
-+ if (likely(!sa.aad->error)) {
++ if (likely(!aad(&sa)->error)) {
+ u16 audit_mask = profile->net.audit[sa.u.net->family];
+ if (likely((AUDIT_MODE(profile) != AUDIT_ALL) &&
-+ !(1 << sa.aad->net.type & audit_mask)))
++ !(1 << aad(&sa)->net.type & audit_mask)))
+ return 0;
+ audit_type = AUDIT_APPARMOR_AUDIT;
+ } else {
+ u16 quiet_mask = profile->net.quiet[sa.u.net->family];
+ u16 kill_mask = 0;
-+ u16 denied = (1 << sa.aad->net.type) & ~quiet_mask;
++ u16 denied = (1 << aad(&sa)->net.type) & ~quiet_mask;
+
+ if (denied & kill_mask)
+ audit_type = AUDIT_APPARMOR_KILL;
@@ -453,27 +438,42 @@ index 0000000..003dd18
+ if ((denied & quiet_mask) &&
+ AUDIT_MODE(profile) != AUDIT_NOQUIET &&
+ AUDIT_MODE(profile) != AUDIT_ALL)
-+ return COMPLAIN_MODE(profile) ? 0 : sa.aad->error;
++ return COMPLAIN_MODE(profile) ? 0 : aad(&sa)->error;
+ }
+
-+ return aa_audit(audit_type, profile, GFP_KERNEL, &sa, audit_cb);
++ return aa_audit(audit_type, profile, &sa, audit_cb);
++}
++
++static int __aa_net_perm(const char *op, struct aa_profile *profile, u16 family,
++ int type, int protocol, struct sock *sk)
++{
++ u16 family_mask;
++ int error;
++
++ if (profile_unconfined(profile))
++ return 0;
++
++ family_mask = profile->net.allow[family];
++
++ error = (family_mask & (1 << type)) ? 0 : -EACCES;
++
++ return audit_net(profile, op, family, type, protocol, sk, error);
+}
+
+/**
+ * aa_net_perm - very course network access check
+ * @op: operation being checked
-+ * @profile: profile being enforced (NOT NULL)
++ * @label: profile being enforced (NOT NULL)
+ * @family: network family
+ * @type: network type
+ * @protocol: network protocol
+ *
+ * Returns: %0 else error if permission denied
+ */
-+int aa_net_perm(int op, struct aa_profile *profile, u16 family, int type,
-+ int protocol, struct sock *sk)
++int aa_net_perm(const char *op, struct aa_label *label, u16 family,
++ int type, int protocol, struct sock *sk)
+{
-+ u16 family_mask;
-+ int error;
++ struct aa_profile *profile;
+
+ if ((family < 0) || (family >= AF_MAX))
+ return -EINVAL;
@@ -485,11 +485,8 @@ index 0000000..003dd18
+ if (family == AF_UNIX || family == AF_NETLINK)
+ return 0;
+
-+ family_mask = profile->net.allow[family];
-+
-+ error = (family_mask & (1 << type)) ? 0 : -EACCES;
-+
-+ return audit_net(profile, op, family, type, protocol, sk, error);
++ return fn_for_each_confined(label, profile,
++ __aa_net_perm(op, profile, family, type, protocol, sk));
+}
+
+/**
@@ -499,9 +496,9 @@ index 0000000..003dd18
+ *
+ * Returns: %0 else error if permission denied
+ */
-+int aa_revalidate_sk(int op, struct sock *sk)
++int aa_revalidate_sk(const char *op, struct sock *sk)
+{
-+ struct aa_profile *profile;
++ struct aa_label *profile;
+ int error = 0;
+
+ /* aa_revalidate_sk should not be called from interrupt context
@@ -510,18 +507,16 @@ index 0000000..003dd18
+ if (in_interrupt())
+ return 0;
+
-+ profile = __aa_current_profile();
++ profile = aa_current_raw_label();
+ if (!unconfined(profile))
+ error = aa_net_perm(op, profile, sk->sk_family, sk->sk_type,
+ sk->sk_protocol, sk);
+
+ return error;
+}
-diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
-index 179e68d..f1a8541 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
-@@ -603,6 +603,7 @@ void aa_free_profile(struct aa_profile *profile)
+@@ -225,6 +225,7 @@ void aa_free_profile(struct aa_profile *
aa_free_file_rules(&profile->file);
aa_free_cap_rules(&profile->caps);
@@ -529,11 +524,9 @@ index 179e68d..f1a8541 100644
aa_free_rlimit_rules(&profile->rlimits);
kzfree(profile->dirname);
-diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
-index 1381206..7dc15ff 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
-@@ -193,6 +193,19 @@ fail:
+@@ -275,6 +275,19 @@ fail:
return 0;
}
@@ -553,7 +546,7 @@ index 1381206..7dc15ff 100644
static bool unpack_u32(struct aa_ext *e, u32 *data, const char *name)
{
if (unpack_nameX(e, AA_U32, name)) {
-@@ -476,6 +489,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e)
+@@ -590,6 +603,7 @@ static struct aa_profile *unpack_profile
int i, error = -EPROTO;
kernel_cap_t tmpcap;
u32 tmp;
@@ -561,7 +554,7 @@ index 1381206..7dc15ff 100644
*ns_name = NULL;
-@@ -576,6 +590,38 @@ static struct aa_profile *unpack_profile(struct aa_ext *e)
+@@ -703,6 +717,38 @@ static struct aa_profile *unpack_profile
if (!unpack_rlimits(e, profile))
goto fail;
@@ -600,4 +593,3 @@ index 1381206..7dc15ff 100644
if (unpack_nameX(e, AA_STRUCT, "policydb")) {
/* generic policy dfa - optional and may be NULL */
profile->policy.dfa = unpack_dfa(e);
-
diff --git a/patches.arch/ppc-pegasos-console-autodetection.patch b/patches.arch/ppc-pegasos-console-autodetection.patch
deleted file mode 100644
index 82da310fae..0000000000
--- a/patches.arch/ppc-pegasos-console-autodetection.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From: olh@suse.de
-Subject: force speed to fix autodetection on pegasos2
-Patch-mainline: never
-
----
- arch/powerpc/platforms/chrp/setup.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/powerpc/platforms/chrp/setup.c
-+++ b/arch/powerpc/platforms/chrp/setup.c
-@@ -293,7 +293,7 @@ static void chrp_init_early(void)
- if (!property)
- goto out_put;
- if (!strcmp(property, "failsafe") || !strcmp(property, "serial"))
-- add_preferred_console("ttyS", 0, NULL);
-+ add_preferred_console("ttyS", 0, "115200");
- out_put:
- of_node_put(node);
- }
diff --git a/patches.arch/ppc-prom-nodisplay.patch b/patches.arch/ppc-prom-nodisplay.patch
deleted file mode 100644
index 2c06a45509..0000000000
--- a/patches.arch/ppc-prom-nodisplay.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From: Olaf Hering <olh@suse.de>
-Subject: new prom=nodisplay option to avoid crash in firmware on B50
-Patch-mainline: not yet
-
-add prom=nodisplay
-avoid crash in firmware on IBM B50 when OF stdout is on serial.
-
- 0 > boot scsi/sd@4:1,yaboot |
-yaboot starting: loaded at 00200000 00222530 (0/0/00c1a078; sp: 00efffd0)
-brokenfirmware did not claim executable memory, fixed it myself
-Config file 'yaboot.cnf' read, 213 bytes
-
-Welcome to yaboot version 10.1.22-r945.SuSE
-booted from '/pci@80000000/scsi@10/sd@4:1,yaboot'
-Enter "help" to get some basic usage information
-boot:
-* linux
-boot: linux 3
-Please wait, loading kernel...
-Allocated 00600000 bytes for executable @ 02000000
- Elf32 kernel loaded...
-Loading ramdisk...
-ramdisk loaded 0030e057 @ 04100000
-OF stdout device is: /pci@80000000/isa@b/serial@i3f8
-command line: root=/dev/system/root xmon=on sysrq=1 quiet panic=12 3
-memory layout at init:
- memory_limit : 00000000 (16 MB aligned)
- alloc_bottom : 0440f000
- alloc_top : 30000000
- alloc_top_hi : 40000000
- rmo_top : 30000000
- ram_top : 40000000
-Looking for displays
-found display : /pci@80000000/display@16, opening ...
-Unexpected Firmware Error:
-DEFAULT CATCH!, code=fff00300 at %SRR0: 00c18ccc %SRR1: 00003030
- ok
- 0 > reset-all
-
-
----
- arch/powerpc/kernel/prom_init.c | 12 +++++++++++-
- 1 file changed, 11 insertions(+), 1 deletion(-)
-
---- a/arch/powerpc/kernel/prom_init.c 2013-04-24 12:10:43.019841829 -0400
-+++ b/arch/powerpc/kernel/prom_init.c 2013-04-24 12:11:13.347868807 -0400
-@@ -161,6 +161,7 @@ static unsigned long __initdata dt_strin
-
- static unsigned long __initdata prom_initrd_start, prom_initrd_end;
-
-+static int __initdata prom_no_display;
- #ifdef CONFIG_PPC64
- static int __initdata prom_iommu_force_on;
- static int __initdata prom_iommu_off;
-@@ -601,6 +602,14 @@ static void __init early_cmdline_parse(v
- #endif /* CONFIG_CMDLINE */
- prom_printf("command line: %s\n", prom_cmd_line);
-
-+ opt = strstr(prom_cmd_line, "prom=");
-+ if (opt) {
-+ opt += 5;
-+ while (*opt && *opt == ' ')
-+ opt++;
-+ if (!strncmp(opt, "nodisplay", 9))
-+ prom_no_display = 1;
-+ }
- #ifdef CONFIG_PPC64
- opt = strstr(prom_cmd_line, "iommu=");
- if (opt) {
-@@ -2964,7 +2973,8 @@ unsigned long __init prom_init(unsigned
- /*
- * Initialize display devices
- */
-- prom_check_displays();
-+ if (prom_no_display == 0)
-+ prom_check_displays();
-
- #if defined(CONFIG_PPC64) && defined(__BIG_ENDIAN__)
- /*
diff --git a/patches.arch/x86_64-unwind-annotations b/patches.arch/x86_64-unwind-annotations
deleted file mode 100644
index accb3ebee8..0000000000
--- a/patches.arch/x86_64-unwind-annotations
+++ /dev/null
@@ -1,159 +0,0 @@
-From: jbeulich@suse.com
-Subject: fix unwind annotations
-Patch-mainline: tbd
-References: bnc#472783, bnc#588458
-
---- a/arch/x86/kernel/entry_64.S
-+++ b/arch/x86/kernel/entry_64.S
-@@ -115,21 +115,21 @@ ENDPROC(native_usergs_sysret64)
- /*
- * empty frame
- */
-- .macro EMPTY_FRAME start=1 offset=0
-- .if \start
-+ .macro EMPTY_FRAME offset=0
- CFI_STARTPROC simple
- CFI_SIGNAL_FRAME
-- CFI_DEF_CFA rsp,8+\offset
-- .else
-- CFI_DEF_CFA_OFFSET 8+\offset
-- .endif
-+ CFI_DEF_CFA rsp,\offset
- .endm
-
- /*
- * initial frame state for interrupts (and exceptions without error code)
- */
- .macro INTR_FRAME start=1 offset=0
-- EMPTY_FRAME \start, 5*8+\offset
-+ .if \start
-+ EMPTY_FRAME 5*8+\offset
-+ .else
-+ CFI_DEF_CFA_OFFSET 5*8+\offset
-+ .endif
- /*CFI_REL_OFFSET ss, 4*8+\offset*/
- CFI_REL_OFFSET rsp, 3*8+\offset
- /*CFI_REL_OFFSET rflags, 2*8+\offset*/
-@@ -148,7 +148,7 @@ ENDPROC(native_usergs_sysret64)
- /*
- * frame that enables passing a complete pt_regs to a C function.
- */
-- .macro DEFAULT_FRAME start=1 offset=0
-+ .macro DEFAULT_FRAME start=1 offset=0 extra=1
- XCPT_FRAME \start, ORIG_RAX+\offset
- CFI_REL_OFFSET rdi, RDI+\offset
- CFI_REL_OFFSET rsi, RSI+\offset
-@@ -159,12 +159,14 @@ ENDPROC(native_usergs_sysret64)
- CFI_REL_OFFSET r9, R9+\offset
- CFI_REL_OFFSET r10, R10+\offset
- CFI_REL_OFFSET r11, R11+\offset
-+ .if \extra
- CFI_REL_OFFSET rbx, RBX+\offset
- CFI_REL_OFFSET rbp, RBP+\offset
- CFI_REL_OFFSET r12, R12+\offset
- CFI_REL_OFFSET r13, R13+\offset
- CFI_REL_OFFSET r14, R14+\offset
- CFI_REL_OFFSET r15, R15+\offset
-+ .endif
- .endm
-
- /*
-@@ -491,7 +493,7 @@ END(system_call)
- .macro FORK_LIKE func
- ENTRY(stub_\func)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8 /* offset 8: return address */
-+ DEFAULT_FRAME 0, 8, 0 /* offset 8: return address */
- SAVE_EXTRA_REGS 8
- jmp sys_\func
- CFI_ENDPROC
-@@ -504,7 +506,7 @@ END(stub_\func)
-
- ENTRY(stub_execve)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8
-+ DEFAULT_FRAME 0, 8, 0
- call sys_execve
- return_from_execve:
- testl %eax, %eax
-@@ -527,7 +529,7 @@ END(stub_execve)
- .align 8
- GLOBAL(stub_execveat)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8
-+ DEFAULT_FRAME 0, 8, 0
- call sys_execveat
- jmp return_from_execve
- CFI_ENDPROC
-@@ -537,7 +539,7 @@ END(stub_execveat)
- .align 8
- GLOBAL(stub_x32_execve)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8
-+ DEFAULT_FRAME 0, 8, 0
- call compat_sys_execve
- jmp return_from_execve
- CFI_ENDPROC
-@@ -545,7 +547,7 @@ END(stub_x32_execve)
- .align 8
- GLOBAL(stub_x32_execveat)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8
-+ DEFAULT_FRAME 0, 8, 0
- call compat_sys_execveat
- jmp return_from_execve
- CFI_ENDPROC
-@@ -575,7 +577,7 @@ END(stub32_execveat)
- */
- ENTRY(stub_rt_sigreturn)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8
-+ DEFAULT_FRAME 0, 8, 0
- /*
- * SAVE_EXTRA_REGS result is not normally needed:
- * sigreturn overwrites all pt_regs->GPREGS.
-@@ -597,7 +599,7 @@ END(stub_rt_sigreturn)
- #ifdef CONFIG_X86_X32_ABI
- ENTRY(stub_x32_rt_sigreturn)
- CFI_STARTPROC
-- DEFAULT_FRAME 0, 8
-+ DEFAULT_FRAME 0, 8, 0
- SAVE_EXTRA_REGS 8
- call sys32_x32_rt_sigreturn
- jmp return_from_stub
---- a/arch/x86/kernel/head_64.S
-+++ b/arch/x86/kernel/head_64.S
-@@ -378,6 +378,25 @@ ENTRY(early_idt_handler)
-
- 11:
- #ifdef CONFIG_EARLY_PRINTK
-+#include <asm/dwarf2.h>
-+ CFI_STARTPROC simple
-+ CFI_SIGNAL_FRAME
-+ CFI_DEF_CFA rsp, 16*8
-+# CFI_REL_OFFSET ss, 15*8
-+ CFI_REL_OFFSET rsp, 14*8
-+# CFI_REL_OFFSET rflags, 13*8
-+# CFI_REL_OFFSET cs, 12*8
-+ CFI_REL_OFFSET rip, 11*8
-+ CFI_REL_OFFSET rax, 8*8
-+ CFI_REL_OFFSET rcx, 7*8
-+ CFI_REL_OFFSET rdx, 6*8
-+ CFI_REL_OFFSET rsi, 5*8
-+ CFI_REL_OFFSET rdi, 4*8
-+ CFI_REL_OFFSET r8, 3*8
-+ CFI_REL_OFFSET r9, 2*8
-+ CFI_REL_OFFSET r10, 1*8
-+ CFI_REL_OFFSET r11, 0*8
-+
- GET_CR2_INTO(%r9) # can clobber any volatile register if pv
- movl 80(%rsp),%r8d # error code
- movl 72(%rsp),%esi # vector number
-@@ -394,6 +413,7 @@ ENTRY(early_idt_handler)
- movq 40(%rsp),%rsi # %rip again
- call __print_symbol
- #endif
-+ CFI_ENDPROC
- #endif /* EARLY_PRINTK */
- 1: hlt
- jmp 1b
diff --git a/patches.drivers/001-x86-platform-intel-iosf_mbi-Add-a-mutex-for-P-Unit-a b/patches.drivers/001-x86-platform-intel-iosf_mbi-Add-a-mutex-for-P-Unit-a
deleted file mode 100644
index cf354414e1..0000000000
--- a/patches.drivers/001-x86-platform-intel-iosf_mbi-Add-a-mutex-for-P-Unit-a
+++ /dev/null
@@ -1,114 +0,0 @@
-From 9260a0409794a59079393e843511414d5f08c14b Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:51 +0100
-Subject: [PATCH] x86/platform/intel/iosf_mbi: Add a mutex for P-Unit access
-Git-commit: 9260a0409794a59079393e843511414d5f08c14b
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-One some systems the P-Unit accesses the PMIC to change various voltages
-through the same bus as other kernel drivers use for e.g. battery
-monitoring.
-
-If a driver sends requests to the P-Unit which require the P-Unit to access
-the PMIC bus while another driver is also accessing the PMIC bus various
-bad things happen.
-
-This commit adds a mutex to protect the P-Unit against simultaneous
-accesses and 2 functions to lock / unlock this mutex.
-
-Note on these systems the i2c-bus driver will request a sempahore from the
-P-Unit for exclusive access to the PMIC bus when i2c drivers are accessing
-it, but this does not appear to be sufficient, we still need to avoid
-making certain P-Unit requests during the access window to avoid problems.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: tagorereddy <tagore.chandan@gmail.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-2-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- arch/x86/include/asm/iosf_mbi.h | 31 +++++++++++++++++++++++++++++++
- arch/x86/platform/intel/iosf_mbi.c | 13 +++++++++++++
- 2 files changed, 44 insertions(+)
-
---- a/arch/x86/include/asm/iosf_mbi.h
-+++ b/arch/x86/include/asm/iosf_mbi.h
-@@ -88,6 +88,33 @@ int iosf_mbi_write(u8 port, u8 opcode, u
- */
- int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
-
-+/**
-+ * iosf_mbi_punit_acquire() - Acquire access to the P-Unit
-+ *
-+ * One some systems the P-Unit accesses the PMIC to change various voltages
-+ * through the same bus as other kernel drivers use for e.g. battery monitoring.
-+ *
-+ * If a driver sends requests to the P-Unit which require the P-Unit to access
-+ * the PMIC bus while another driver is also accessing the PMIC bus various bad
-+ * things happen.
-+ *
-+ * To avoid these problems this function must be called before accessing the
-+ * P-Unit or the PMIC, be it through iosf_mbi* functions or through other means.
-+ *
-+ * Note on these systems the i2c-bus driver will request a sempahore from the
-+ * P-Unit for exclusive access to the PMIC bus when i2c drivers are accessing
-+ * it, but this does not appear to be sufficient, we still need to avoid making
-+ * certain P-Unit requests during the access window to avoid problems.
-+ *
-+ * This function locks a mutex, as such it may sleep.
-+ */
-+void iosf_mbi_punit_acquire(void);
-+
-+/**
-+ * iosf_mbi_punit_release() - Release access to the P-Unit
-+ */
-+void iosf_mbi_punit_release(void);
-+
- #else /* CONFIG_IOSF_MBI is not enabled */
- static inline
- bool iosf_mbi_available(void)
-@@ -115,6 +142,10 @@ int iosf_mbi_modify(u8 port, u8 opcode,
- WARN(1, "IOSF_MBI driver not available");
- return -EPERM;
- }
-+
-+static inline void iosf_mbi_punit_acquire(void) {}
-+static inline void iosf_mbi_punit_release(void) {}
-+
- #endif /* CONFIG_IOSF_MBI */
-
- #endif /* IOSF_MBI_SYMS_H */
---- a/arch/x86/platform/intel/iosf_mbi.c
-+++ b/arch/x86/platform/intel/iosf_mbi.c
-@@ -34,6 +34,7 @@
-
- static struct pci_dev *mbi_pdev;
- static DEFINE_SPINLOCK(iosf_mbi_lock);
-+static DEFINE_MUTEX(iosf_mbi_punit_mutex);
-
- static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)
- {
-@@ -190,6 +191,18 @@ bool iosf_mbi_available(void)
- }
- EXPORT_SYMBOL(iosf_mbi_available);
-
-+void iosf_mbi_punit_acquire(void)
-+{
-+ mutex_lock(&iosf_mbi_punit_mutex);
-+}
-+EXPORT_SYMBOL(iosf_mbi_punit_acquire);
-+
-+void iosf_mbi_punit_release(void)
-+{
-+ mutex_unlock(&iosf_mbi_punit_mutex);
-+}
-+EXPORT_SYMBOL(iosf_mbi_punit_release);
-+
- #ifdef CONFIG_IOSF_MBI_DEBUG
- static u32 dbg_mdr;
- static u32 dbg_mcr;
diff --git a/patches.drivers/002-x86-platform-intel-iosf_mbi-Add-a-PMIC-bus-access-no b/patches.drivers/002-x86-platform-intel-iosf_mbi-Add-a-PMIC-bus-access-no
deleted file mode 100644
index 49c3c66bb8..0000000000
--- a/patches.drivers/002-x86-platform-intel-iosf_mbi-Add-a-PMIC-bus-access-no
+++ /dev/null
@@ -1,167 +0,0 @@
-From 528e649b5c79683202a0ccd22e33a41e35f81a0b Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 24 Feb 2017 10:29:02 +0100
-Subject: [PATCH] x86/platform/intel/iosf_mbi: Add a PMIC bus access notifier
-Git-commit: 528e649b5c79683202a0ccd22e33a41e35f81a0b
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Some drivers may need to acquire P-Unit managed resources from interrupt
-context, where they cannot call iosf_mbi_punit_acquire().
-
-This commit adds a notifier chain which allows a driver to get notified
-(in a process context) before other drivers start accessing the PMIC bus,
-so that the driver can acquire any resources, which it may need during
-the window the other driver is accessing the PMIC, before hand.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: tagorereddy <tagore.chandan@gmail.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- arch/x86/include/asm/iosf_mbi.h | 56 +++++++++++++++++++++++++++++++++++++
- arch/x86/platform/intel/iosf_mbi.c | 36 +++++++++++++++++++++++
- 2 files changed, 92 insertions(+)
-
---- a/arch/x86/include/asm/iosf_mbi.h
-+++ b/arch/x86/include/asm/iosf_mbi.h
-@@ -5,6 +5,8 @@
- #ifndef IOSF_MBI_SYMS_H
- #define IOSF_MBI_SYMS_H
-
-+#include <linux/notifier.h>
-+
- #define MBI_MCR_OFFSET 0xD0
- #define MBI_MDR_OFFSET 0xD4
- #define MBI_MCRX_OFFSET 0xD8
-@@ -47,6 +49,10 @@
- #define QRK_MBI_UNIT_MM 0x05
- #define QRK_MBI_UNIT_SOC 0x31
-
-+/* Action values for the pmic_bus_access_notifier functions */
-+#define MBI_PMIC_BUS_ACCESS_BEGIN 1
-+#define MBI_PMIC_BUS_ACCESS_END 2
-+
- #if IS_ENABLED(CONFIG_IOSF_MBI)
-
- bool iosf_mbi_available(void);
-@@ -115,6 +121,38 @@ void iosf_mbi_punit_acquire(void);
- */
- void iosf_mbi_punit_release(void);
-
-+/**
-+ * iosf_mbi_register_pmic_bus_access_notifier - Register PMIC bus notifier
-+ *
-+ * This function can be used by drivers which may need to acquire P-Unit
-+ * managed resources from interrupt context, where iosf_mbi_punit_acquire()
-+ * can not be used.
-+ *
-+ * This function allows a driver to register a notifier to get notified (in a
-+ * process context) before other drivers start accessing the PMIC bus.
-+ *
-+ * This allows the driver to acquire any resources, which it may need during
-+ * the window the other driver is accessing the PMIC, before hand.
-+ *
-+ * @nb: notifier_block to register
-+ */
-+int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb);
-+
-+/**
-+ * iosf_mbi_register_pmic_bus_access_notifier - Unregister PMIC bus notifier
-+ *
-+ * @nb: notifier_block to unregister
-+ */
-+int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb);
-+
-+/**
-+ * iosf_mbi_call_pmic_bus_access_notifier_chain - Call PMIC bus notifier chain
-+ *
-+ * @val: action to pass into listener's notifier_call function
-+ * @v: data pointer to pass into listener's notifier_call function
-+ */
-+int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v);
-+
- #else /* CONFIG_IOSF_MBI is not enabled */
- static inline
- bool iosf_mbi_available(void)
-@@ -146,6 +184,24 @@ int iosf_mbi_modify(u8 port, u8 opcode,
- static inline void iosf_mbi_punit_acquire(void) {}
- static inline void iosf_mbi_punit_release(void) {}
-
-+static inline
-+int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb)
-+{
-+ return 0;
-+}
-+
-+static inline
-+int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb)
-+{
-+ return 0;
-+}
-+
-+static inline
-+int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v)
-+{
-+ return 0;
-+}
-+
- #endif /* CONFIG_IOSF_MBI */
-
- #endif /* IOSF_MBI_SYMS_H */
---- a/arch/x86/platform/intel/iosf_mbi.c
-+++ b/arch/x86/platform/intel/iosf_mbi.c
-@@ -35,6 +35,7 @@
- static struct pci_dev *mbi_pdev;
- static DEFINE_SPINLOCK(iosf_mbi_lock);
- static DEFINE_MUTEX(iosf_mbi_punit_mutex);
-+static BLOCKING_NOTIFIER_HEAD(iosf_mbi_pmic_bus_access_notifier);
-
- static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)
- {
-@@ -203,6 +204,41 @@ void iosf_mbi_punit_release(void)
- }
- EXPORT_SYMBOL(iosf_mbi_punit_release);
-
-+int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb)
-+{
-+ int ret;
-+
-+ /* Wait for the bus to go inactive before registering */
-+ mutex_lock(&iosf_mbi_punit_mutex);
-+ ret = blocking_notifier_chain_register(
-+ &iosf_mbi_pmic_bus_access_notifier, nb);
-+ mutex_unlock(&iosf_mbi_punit_mutex);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL(iosf_mbi_register_pmic_bus_access_notifier);
-+
-+int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb)
-+{
-+ int ret;
-+
-+ /* Wait for the bus to go inactive before unregistering */
-+ mutex_lock(&iosf_mbi_punit_mutex);
-+ ret = blocking_notifier_chain_unregister(
-+ &iosf_mbi_pmic_bus_access_notifier, nb);
-+ mutex_unlock(&iosf_mbi_punit_mutex);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL(iosf_mbi_unregister_pmic_bus_access_notifier);
-+
-+int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v)
-+{
-+ return blocking_notifier_call_chain(
-+ &iosf_mbi_pmic_bus_access_notifier, val, v);
-+}
-+EXPORT_SYMBOL(iosf_mbi_call_pmic_bus_access_notifier_chain);
-+
- #ifdef CONFIG_IOSF_MBI_DEBUG
- static u32 dbg_mdr;
- static u32 dbg_mcr;
diff --git a/patches.drivers/003-i2c-designware-Rename-accessor_flags-to-flags b/patches.drivers/003-i2c-designware-Rename-accessor_flags-to-flags
deleted file mode 100644
index f42540e491..0000000000
--- a/patches.drivers/003-i2c-designware-Rename-accessor_flags-to-flags
+++ /dev/null
@@ -1,103 +0,0 @@
-From 86524e54025f4ffb0a2e4966ad244424a080329f Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:53 +0100
-Subject: [PATCH] i2c: designware: Rename accessor_flags to flags
-Git-commit: 86524e54025f4ffb0a2e4966ad244424a080329f
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Rename accessor_flags to flags, so that we can use the field for
-other flags too. This is a preparation patch for adding cherrytrail
-support to the punit semaphore code.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Tested-by: Takashi Iwai <tiwai@suse.de>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-4-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-core.c | 14 +++++++-------
- drivers/i2c/busses/i2c-designware-core.h | 2 +-
- drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
- 3 files changed, 9 insertions(+), 9 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-core.c
-+++ b/drivers/i2c/busses/i2c-designware-core.c
-@@ -177,13 +177,13 @@ static u32 dw_readl(struct dw_i2c_dev *d
- {
- u32 value;
-
-- if (dev->accessor_flags & ACCESS_16BIT)
-+ if (dev->flags & ACCESS_16BIT)
- value = readw_relaxed(dev->base + offset) |
- (readw_relaxed(dev->base + offset + 2) << 16);
- else
- value = readl_relaxed(dev->base + offset);
-
-- if (dev->accessor_flags & ACCESS_SWAP)
-+ if (dev->flags & ACCESS_SWAP)
- return swab32(value);
- else
- return value;
-@@ -191,10 +191,10 @@ static u32 dw_readl(struct dw_i2c_dev *d
-
- static void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset)
- {
-- if (dev->accessor_flags & ACCESS_SWAP)
-+ if (dev->flags & ACCESS_SWAP)
- b = swab32(b);
-
-- if (dev->accessor_flags & ACCESS_16BIT) {
-+ if (dev->flags & ACCESS_16BIT) {
- writew_relaxed((u16)b, dev->base + offset);
- writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
- } else {
-@@ -339,10 +339,10 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
- reg = dw_readl(dev, DW_IC_COMP_TYPE);
- if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
- /* Configure register endianess access */
-- dev->accessor_flags |= ACCESS_SWAP;
-+ dev->flags |= ACCESS_SWAP;
- } else if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) {
- /* Configure register access mode 16bit */
-- dev->accessor_flags |= ACCESS_16BIT;
-+ dev->flags |= ACCESS_16BIT;
- } else if (reg != DW_IC_COMP_TYPE_VALUE) {
- dev_err(dev->dev, "Unknown Synopsys component type: "
- "0x%08x\n", reg);
-@@ -924,7 +924,7 @@ static irqreturn_t i2c_dw_isr(int this_i
- tx_aborted:
- if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err)
- complete(&dev->cmd_complete);
-- else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) {
-+ else if (unlikely(dev->flags & ACCESS_INTR_MASK)) {
- /* workaround to trigger pending interrupt */
- stat = dw_readl(dev, DW_IC_INTR_MASK);
- i2c_dw_disable_int(dev);
---- a/drivers/i2c/busses/i2c-designware-core.h
-+++ b/drivers/i2c/busses/i2c-designware-core.h
-@@ -104,7 +104,7 @@ struct dw_i2c_dev {
- unsigned int status;
- u32 abort_source;
- int irq;
-- u32 accessor_flags;
-+ u32 flags;
- struct i2c_adapter adapter;
- u32 functionality;
- u32 master_cfg;
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -113,7 +113,7 @@ static int dw_i2c_acpi_configure(struct
-
- id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
- if (id && id->driver_data)
-- dev->accessor_flags |= (u32)id->driver_data;
-+ dev->flags |= (u32)id->driver_data;
-
- return 0;
- }
diff --git a/patches.drivers/004-i2c-designware-baytrail-Pass-dw_i2c_dev-into-helper- b/patches.drivers/004-i2c-designware-baytrail-Pass-dw_i2c_dev-into-helper-
deleted file mode 100644
index a203c50c99..0000000000
--- a/patches.drivers/004-i2c-designware-baytrail-Pass-dw_i2c_dev-into-helper-
+++ /dev/null
@@ -1,94 +0,0 @@
-From 62aee937535fcb7c5c23aafe5dfccd977bfe658e Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:54 +0100
-Subject: [PATCH] i2c: designware-baytrail: Pass dw_i2c_dev into helper functions
-Git-commit: 62aee937535fcb7c5c23aafe5dfccd977bfe658e
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Pass dw_i2c_dev into the helper functions, this is a preparation patch
-for the punit semaphore fixes done in the other patches in this set.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Takashi Iwai <tiwai@suse.de>
-Tested-by: Takashi Iwai <tiwai@suse.de>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-5-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 16 ++++++++--------
- 1 file changed, 8 insertions(+), 8 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -28,14 +28,14 @@
-
- static unsigned long acquired;
-
--static int get_sem(struct device *dev, u32 *sem)
-+static int get_sem(struct dw_i2c_dev *dev, u32 *sem)
- {
- u32 data;
- int ret;
-
- ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data);
- if (ret) {
-- dev_err(dev, "iosf failed to read punit semaphore\n");
-+ dev_err(dev->dev, "iosf failed to read punit semaphore\n");
- return ret;
- }
-
-@@ -44,18 +44,18 @@ static int get_sem(struct device *dev, u
- return 0;
- }
-
--static void reset_semaphore(struct device *dev)
-+static void reset_semaphore(struct dw_i2c_dev *dev)
- {
- u32 data;
-
- if (iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data)) {
-- dev_err(dev, "iosf failed to reset punit semaphore during read\n");
-+ dev_err(dev->dev, "iosf failed to reset punit semaphore during read\n");
- return;
- }
-
- data &= ~PUNIT_SEMAPHORE_BIT;
- if (iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, data))
-- dev_err(dev, "iosf failed to reset punit semaphore during write\n");
-+ dev_err(dev->dev, "iosf failed to reset punit semaphore during write\n");
- }
-
- static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
-@@ -83,7 +83,7 @@ static int baytrail_i2c_acquire(struct d
- start = jiffies;
- end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT);
- do {
-- ret = get_sem(dev->dev, &sem);
-+ ret = get_sem(dev, &sem);
- if (!ret && sem) {
- acquired = jiffies;
- dev_dbg(dev->dev, "punit semaphore acquired after %ums\n",
-@@ -95,7 +95,7 @@ static int baytrail_i2c_acquire(struct d
- } while (time_before(jiffies, end));
-
- dev_err(dev->dev, "punit semaphore timed out, resetting\n");
-- reset_semaphore(dev->dev);
-+ reset_semaphore(dev);
-
- ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &sem);
- if (ret)
-@@ -116,7 +116,7 @@ static void baytrail_i2c_release(struct
- if (!dev->acquire_lock)
- return;
-
-- reset_semaphore(dev->dev);
-+ reset_semaphore(dev);
- dev_dbg(dev->dev, "punit semaphore held for %ums\n",
- jiffies_to_msecs(jiffies - acquired));
- }
diff --git a/patches.drivers/005-i2c-designware-baytrail-Only-check-iosf_mbi_availabl b/patches.drivers/005-i2c-designware-baytrail-Only-check-iosf_mbi_availabl
deleted file mode 100644
index 7e58e31567..0000000000
--- a/patches.drivers/005-i2c-designware-baytrail-Only-check-iosf_mbi_availabl
+++ /dev/null
@@ -1,55 +0,0 @@
-From e234ed2f06fad95680710976bcddae91d7fb7af9 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:55 +0100
-Subject: [PATCH] i2c: designware-baytrail: Only check iosf_mbi_available() for shared hosts
-Git-commit: e234ed2f06fad95680710976bcddae91d7fb7af9
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-If (!shared_host) simply return 0, this avoids delaying the probe if
-iosf_mbi_available() returns false when an i2c bus is not using the
-punit semaphore.
-
-Also move the if (!iosf_mbi_available()) check to above the
-dev_info, so that we do not repeat the dev_info on every probe
-until iosf_mbi_available() returns true.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Tested-by: Takashi Iwai <tiwai@suse.de>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-6-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -138,15 +138,16 @@ int i2c_dw_eval_lock_support(struct dw_i
- if (ACPI_FAILURE(status))
- return 0;
-
-- if (shared_host) {
-- dev_info(dev->dev, "I2C bus managed by PUNIT\n");
-- dev->acquire_lock = baytrail_i2c_acquire;
-- dev->release_lock = baytrail_i2c_release;
-- dev->pm_runtime_disabled = true;
-- }
-+ if (!shared_host)
-+ return 0;
-
- if (!iosf_mbi_available())
- return -EPROBE_DEFER;
-
-+ dev_info(dev->dev, "I2C bus managed by PUNIT\n");
-+ dev->acquire_lock = baytrail_i2c_acquire;
-+ dev->release_lock = baytrail_i2c_release;
-+ dev->pm_runtime_disabled = true;
-+
- return 0;
- }
diff --git a/patches.drivers/006-i2c-designware-baytrail-Disallow-the-CPU-to-enter-C6 b/patches.drivers/006-i2c-designware-baytrail-Disallow-the-CPU-to-enter-C6
deleted file mode 100644
index 8b064374e8..0000000000
--- a/patches.drivers/006-i2c-designware-baytrail-Disallow-the-CPU-to-enter-C6
+++ /dev/null
@@ -1,164 +0,0 @@
-From 086cb4afef45262806ee5bf26c34244e5867712c Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:56 +0100
-Subject: [PATCH] i2c: designware-baytrail: Disallow the CPU to enter C6 or C7 while holding the punit semaphore
-Git-commit: 086cb4afef45262806ee5bf26c34244e5867712c
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-On my cherrytrail tablet with axp288 pmic, just doing a bunch of repeated
-reads from the pmic, e.g. "i2cdump -y 14 0x34" would lookup the tablet in
-1 - 3 runs guaranteed.
-
-This seems to be causes by the cpu trying to enter C6 or C7 while we hold
-the punit bus semaphore, at which point everything just hangs.
-
-Avoid this by disallowing the CPU to enter C6 or C7 before acquiring the
-punit bus semaphore.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=109051
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: Takashi Iwai <tiwai@suse.de>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-7-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 24 ++++++++++++++++++++++--
- drivers/i2c/busses/i2c-designware-core.h | 9 +++++++--
- drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++-
- 3 files changed, 32 insertions(+), 5 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -16,6 +16,7 @@
- #include <linux/acpi.h>
- #include <linux/i2c.h>
- #include <linux/interrupt.h>
-+#include <linux/pm_qos.h>
-
- #include <asm/iosf_mbi.h>
-
-@@ -56,6 +57,8 @@ static void reset_semaphore(struct dw_i2
- data &= ~PUNIT_SEMAPHORE_BIT;
- if (iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, data))
- dev_err(dev->dev, "iosf failed to reset punit semaphore during write\n");
-+
-+ pm_qos_update_request(&dev->pm_qos, PM_QOS_DEFAULT_VALUE);
- }
-
- static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
-@@ -72,11 +75,18 @@ static int baytrail_i2c_acquire(struct d
- if (!dev->release_lock)
- return 0;
-
-+ /*
-+ * Disallow the CPU to enter C6 or C7 state, entering these states
-+ * requires the punit to talk to the pmic and if this happens while
-+ * we're holding the semaphore, the SoC hangs.
-+ */
-+ pm_qos_update_request(&dev->pm_qos, 0);
-+
- /* host driver writes to side band semaphore register */
- ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, sem);
- if (ret) {
- dev_err(dev->dev, "iosf punit semaphore request failed\n");
-- return ret;
-+ goto out;
- }
-
- /* host driver waits for bit 0 to be set in semaphore register */
-@@ -95,6 +105,7 @@ static int baytrail_i2c_acquire(struct d
- } while (time_before(jiffies, end));
-
- dev_err(dev->dev, "punit semaphore timed out, resetting\n");
-+out:
- reset_semaphore(dev);
-
- ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &sem);
-@@ -121,7 +132,7 @@ static void baytrail_i2c_release(struct
- jiffies_to_msecs(jiffies - acquired));
- }
-
--int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev)
-+int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)
- {
- acpi_status status;
- unsigned long long shared_host = 0;
-@@ -149,5 +160,14 @@ int i2c_dw_eval_lock_support(struct dw_i
- dev->release_lock = baytrail_i2c_release;
- dev->pm_runtime_disabled = true;
-
-+ pm_qos_add_request(&dev->pm_qos, PM_QOS_CPU_DMA_LATENCY,
-+ PM_QOS_DEFAULT_VALUE);
-+
- return 0;
- }
-+
-+void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev)
-+{
-+ if (dev->acquire_lock)
-+ pm_qos_remove_request(&dev->pm_qos);
-+}
---- a/drivers/i2c/busses/i2c-designware-core.h
-+++ b/drivers/i2c/busses/i2c-designware-core.h
-@@ -23,6 +23,7 @@
- */
-
- #include <linux/i2c.h>
-+#include <linux/pm_qos.h>
-
- #define DW_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \
- I2C_FUNC_SMBUS_BYTE | \
-@@ -75,6 +76,7 @@
- * @fp_lcnt: fast plus LCNT value
- * @hs_hcnt: high speed HCNT value
- * @hs_lcnt: high speed LCNT value
-+ * @pm_qos: pm_qos_request used while holding a hardware lock on the bus
- * @acquire_lock: function to acquire a hardware lock on the bus
- * @release_lock: function to release a hardware lock on the bus
- * @pm_runtime_disabled: true if pm runtime is disabled
-@@ -123,6 +125,7 @@ struct dw_i2c_dev {
- u16 fp_lcnt;
- u16 hs_hcnt;
- u16 hs_lcnt;
-+ struct pm_qos_request pm_qos;
- int (*acquire_lock)(struct dw_i2c_dev *dev);
- void (*release_lock)(struct dw_i2c_dev *dev);
- bool pm_runtime_disabled;
-@@ -139,7 +142,9 @@ extern u32 i2c_dw_read_comp_param(struct
- extern int i2c_dw_probe(struct dw_i2c_dev *dev);
-
- #if IS_ENABLED(CONFIG_I2C_DESIGNWARE_BAYTRAIL)
--extern int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev);
-+extern int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev);
-+extern void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev);
- #else
--static inline int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev) { return 0; }
-+static inline int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev) { return 0; }
-+static inline void i2c_dw_remove_lock_support(struct dw_i2c_dev *dev) {}
- #endif
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -248,7 +248,7 @@ static int dw_i2c_plat_probe(struct plat
- goto exit_reset;
- }
-
-- r = i2c_dw_eval_lock_support(dev);
-+ r = i2c_dw_probe_lock_support(dev);
- if (r)
- goto exit_reset;
-
-@@ -327,6 +327,8 @@ static int dw_i2c_plat_remove(struct pla
- if (!IS_ERR_OR_NULL(dev->rst))
- reset_control_assert(dev->rst);
-
-+ i2c_dw_remove_lock_support(dev);
-+
- return 0;
- }
-
diff --git a/patches.drivers/007-i2c-designware-baytrail-Fix-race-when-resetting-the- b/patches.drivers/007-i2c-designware-baytrail-Fix-race-when-resetting-the-
deleted file mode 100644
index 96970aeef3..0000000000
--- a/patches.drivers/007-i2c-designware-baytrail-Fix-race-when-resetting-the-
+++ /dev/null
@@ -1,45 +0,0 @@
-From 519e23a7f51e853dbe5dc4abb193c0c0db303b3a Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:57 +0100
-Subject: [PATCH] i2c: designware-baytrail: Fix race when resetting the semaphore
-Git-commit: 519e23a7f51e853dbe5dc4abb193c0c0db303b3a
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Use iosf_mbi_modify instead of iosf_mbi_read + iosf_mbi_write so that
-we keep the iosf_mbi_lock locked during the read-modify-write done to
-reset the semaphore.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-8-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 11 ++---------
- 1 file changed, 2 insertions(+), 9 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -47,15 +47,8 @@ static int get_sem(struct dw_i2c_dev *de
-
- static void reset_semaphore(struct dw_i2c_dev *dev)
- {
-- u32 data;
--
-- if (iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data)) {
-- dev_err(dev->dev, "iosf failed to reset punit semaphore during read\n");
-- return;
-- }
--
-- data &= ~PUNIT_SEMAPHORE_BIT;
-- if (iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, data))
-+ if (iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE,
-+ 0, PUNIT_SEMAPHORE_BIT))
- dev_err(dev->dev, "iosf failed to reset punit semaphore during write\n");
-
- pm_qos_update_request(&dev->pm_qos, PM_QOS_DEFAULT_VALUE);
diff --git a/patches.drivers/008-i2c-designware-baytrail-Add-support-for-cherrytrail b/patches.drivers/008-i2c-designware-baytrail-Add-support-for-cherrytrail
deleted file mode 100644
index 5a23c1e2d1..0000000000
--- a/patches.drivers/008-i2c-designware-baytrail-Add-support-for-cherrytrail
+++ /dev/null
@@ -1,180 +0,0 @@
-From fd476fa22a1f432658b799b023f351f291f2db8b Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:58 +0100
-Subject: [PATCH] i2c: designware-baytrail: Add support for cherrytrail
-Git-commit: fd476fa22a1f432658b799b023f351f291f2db8b
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-The cherrytrail punit has the pmic i2c bus access semaphore at a
-different register address.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Takashi Iwai <tiwai@suse.de>
-Tested-by: Takashi Iwai <tiwai@suse.de>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-9-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 19 +++++++++++++++----
- drivers/i2c/busses/i2c-designware-core.h | 2 ++
- drivers/i2c/busses/i2c-designware-pcidrv.c | 26 +++++++++++++++++++-------
- drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
- 4 files changed, 37 insertions(+), 12 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -24,17 +24,27 @@
-
- #define SEMAPHORE_TIMEOUT 100
- #define PUNIT_SEMAPHORE 0x7
-+#define PUNIT_SEMAPHORE_CHT 0x10e
- #define PUNIT_SEMAPHORE_BIT BIT(0)
- #define PUNIT_SEMAPHORE_ACQUIRE BIT(1)
-
- static unsigned long acquired;
-
-+static u32 get_sem_addr(struct dw_i2c_dev *dev)
-+{
-+ if (dev->flags & MODEL_CHERRYTRAIL)
-+ return PUNIT_SEMAPHORE_CHT;
-+ else
-+ return PUNIT_SEMAPHORE;
-+}
-+
- static int get_sem(struct dw_i2c_dev *dev, u32 *sem)
- {
-+ u32 addr = get_sem_addr(dev);
- u32 data;
- int ret;
-
-- ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &data);
-+ ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, addr, &data);
- if (ret) {
- dev_err(dev->dev, "iosf failed to read punit semaphore\n");
- return ret;
-@@ -47,7 +57,7 @@ static int get_sem(struct dw_i2c_dev *de
-
- static void reset_semaphore(struct dw_i2c_dev *dev)
- {
-- if (iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE,
-+ if (iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, get_sem_addr(dev),
- 0, PUNIT_SEMAPHORE_BIT))
- dev_err(dev->dev, "iosf failed to reset punit semaphore during write\n");
-
-@@ -56,6 +66,7 @@ static void reset_semaphore(struct dw_i2
-
- static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
- {
-+ u32 addr = get_sem_addr(dev);
- u32 sem = PUNIT_SEMAPHORE_ACQUIRE;
- int ret;
- unsigned long start, end;
-@@ -76,7 +87,7 @@ static int baytrail_i2c_acquire(struct d
- pm_qos_update_request(&dev->pm_qos, 0);
-
- /* host driver writes to side band semaphore register */
-- ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, PUNIT_SEMAPHORE, sem);
-+ ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, addr, sem);
- if (ret) {
- dev_err(dev->dev, "iosf punit semaphore request failed\n");
- goto out;
-@@ -101,7 +112,7 @@ static int baytrail_i2c_acquire(struct d
- out:
- reset_semaphore(dev);
-
-- ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, PUNIT_SEMAPHORE, &sem);
-+ ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, addr, &sem);
- if (ret)
- dev_err(dev->dev, "iosf failed to read punit semaphore\n");
- else
---- a/drivers/i2c/busses/i2c-designware-core.h
-+++ b/drivers/i2c/busses/i2c-designware-core.h
-@@ -135,6 +135,8 @@ struct dw_i2c_dev {
- #define ACCESS_16BIT 0x00000002
- #define ACCESS_INTR_MASK 0x00000004
-
-+#define MODEL_CHERRYTRAIL 0x00000100
-+
- extern int i2c_dw_init(struct dw_i2c_dev *dev);
- extern void i2c_dw_disable(struct dw_i2c_dev *dev);
- extern void i2c_dw_disable_int(struct dw_i2c_dev *dev);
---- a/drivers/i2c/busses/i2c-designware-pcidrv.c
-+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
-@@ -45,6 +45,7 @@ enum dw_pci_ctl_id_t {
- medfield,
- merrifield,
- baytrail,
-+ cherrytrail,
- haswell,
- };
-
-@@ -63,6 +64,7 @@ struct dw_pci_controller {
- u32 rx_fifo_depth;
- u32 clk_khz;
- u32 functionality;
-+ u32 flags;
- struct dw_scl_sda_cfg *scl_sda_cfg;
- int (*setup)(struct pci_dev *pdev, struct dw_pci_controller *c);
- };
-@@ -170,6 +172,15 @@ static struct dw_pci_controller dw_pci_c
- .functionality = I2C_FUNC_10BIT_ADDR,
- .scl_sda_cfg = &hsw_config,
- },
-+ [cherrytrail] = {
-+ .bus_num = -1,
-+ .bus_cfg = INTEL_MID_STD_CFG | DW_IC_CON_SPEED_FAST,
-+ .tx_fifo_depth = 32,
-+ .rx_fifo_depth = 32,
-+ .functionality = I2C_FUNC_10BIT_ADDR,
-+ .flags = MODEL_CHERRYTRAIL,
-+ .scl_sda_cfg = &byt_config,
-+ },
- };
-
- #ifdef CONFIG_PM
-@@ -237,6 +248,7 @@ static int i2c_dw_pci_probe(struct pci_d
- dev->base = pcim_iomap_table(pdev)[0];
- dev->dev = &pdev->dev;
- dev->irq = pdev->irq;
-+ dev->flags |= controller->flags;
-
- if (controller->setup) {
- r = controller->setup(pdev, controller);
-@@ -317,13 +329,13 @@ static const struct pci_device_id i2_des
- { PCI_VDEVICE(INTEL, 0x9c61), haswell },
- { PCI_VDEVICE(INTEL, 0x9c62), haswell },
- /* Braswell / Cherrytrail */
-- { PCI_VDEVICE(INTEL, 0x22C1), baytrail },
-- { PCI_VDEVICE(INTEL, 0x22C2), baytrail },
-- { PCI_VDEVICE(INTEL, 0x22C3), baytrail },
-- { PCI_VDEVICE(INTEL, 0x22C4), baytrail },
-- { PCI_VDEVICE(INTEL, 0x22C5), baytrail },
-- { PCI_VDEVICE(INTEL, 0x22C6), baytrail },
-- { PCI_VDEVICE(INTEL, 0x22C7), baytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C1), cherrytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C2), cherrytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C3), cherrytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C4), cherrytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C5), cherrytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C6), cherrytrail },
-+ { PCI_VDEVICE(INTEL, 0x22C7), cherrytrail },
- { 0,}
- };
- MODULE_DEVICE_TABLE(pci, i2_designware_pci_ids);
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -124,7 +124,7 @@ static const struct acpi_device_id dw_i2
- { "INT3432", 0 },
- { "INT3433", 0 },
- { "80860F41", 0 },
-- { "808622C1", 0 },
-+ { "808622C1", MODEL_CHERRYTRAIL },
- { "AMD0010", ACCESS_INTR_MASK },
- { "AMDI0010", ACCESS_INTR_MASK },
- { "AMDI0510", 0 },
diff --git a/patches.drivers/009-i2c-designware-baytrail-Acquire-P-Unit-access-on-bus b/patches.drivers/009-i2c-designware-baytrail-Acquire-P-Unit-access-on-bus
deleted file mode 100644
index dd41a63b30..0000000000
--- a/patches.drivers/009-i2c-designware-baytrail-Acquire-P-Unit-access-on-bus
+++ /dev/null
@@ -1,48 +0,0 @@
-From 5b2cacceb7a877f5eea60ffc7bb6ccd62c4d51cc Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:27:59 +0100
-Subject: [PATCH] i2c: designware-baytrail: Acquire P-Unit access on bus acquire
-Git-commit: 5b2cacceb7a877f5eea60ffc7bb6ccd62c4d51cc
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Acquire P-Unit access to stop others from accessing the P-Unit while the
-PMIC i2c bus is in use. This is necessary because accessing the P-Unit
-from the kernel may result in the P-Unit trying to access the PMIC i2c
-bus, which results in a hang when it happens while we own the PMIC i2c
-bus semaphore.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: tagorereddy <tagore.chandan@gmail.com>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-10-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -62,6 +62,8 @@ static void reset_semaphore(struct dw_i2
- dev_err(dev->dev, "iosf failed to reset punit semaphore during write\n");
-
- pm_qos_update_request(&dev->pm_qos, PM_QOS_DEFAULT_VALUE);
-+
-+ iosf_mbi_punit_release();
- }
-
- static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
-@@ -79,6 +81,8 @@ static int baytrail_i2c_acquire(struct d
- if (!dev->release_lock)
- return 0;
-
-+ iosf_mbi_punit_acquire();
-+
- /*
- * Disallow the CPU to enter C6 or C7 state, entering these states
- * requires the punit to talk to the pmic and if this happens while
diff --git a/patches.drivers/010-i2c-designware-baytrail-Call-pmic_bus_access_notifie b/patches.drivers/010-i2c-designware-baytrail-Call-pmic_bus_access_notifie
deleted file mode 100644
index 2356fa9f14..0000000000
--- a/patches.drivers/010-i2c-designware-baytrail-Call-pmic_bus_access_notifie
+++ /dev/null
@@ -1,45 +0,0 @@
-From d93a6ed370667be38c465c675229d3229fc8681e Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:28:00 +0100
-Subject: [PATCH] i2c: designware-baytrail: Call pmic_bus_access_notifier_chain
-Git-commit: d93a6ed370667be38c465c675229d3229fc8681e
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Call the iosf_mbi pmic_bus_access_notifier_chain on bus acquire / release.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: tagorereddy <tagore.chandan@gmail.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-11-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -63,6 +63,8 @@ static void reset_semaphore(struct dw_i2
-
- pm_qos_update_request(&dev->pm_qos, PM_QOS_DEFAULT_VALUE);
-
-+ iosf_mbi_call_pmic_bus_access_notifier_chain(MBI_PMIC_BUS_ACCESS_END,
-+ NULL);
- iosf_mbi_punit_release();
- }
-
-@@ -82,6 +84,8 @@ static int baytrail_i2c_acquire(struct d
- return 0;
-
- iosf_mbi_punit_acquire();
-+ iosf_mbi_call_pmic_bus_access_notifier_chain(MBI_PMIC_BUS_ACCESS_BEGIN,
-+ NULL);
-
- /*
- * Disallow the CPU to enter C6 or C7 state, entering these states
diff --git a/patches.drivers/011-drm-i915-Add-intel_uncore_suspend-resume-functions b/patches.drivers/011-drm-i915-Add-intel_uncore_suspend-resume-functions
deleted file mode 100644
index 85bfac11bd..0000000000
--- a/patches.drivers/011-drm-i915-Add-intel_uncore_suspend-resume-functions
+++ /dev/null
@@ -1,113 +0,0 @@
-From 68f60946c1b6d1504af8994f4a419769217e4f23 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:28:01 +0100
-Subject: [PATCH] drm/i915: Add intel_uncore_suspend / resume functions
-Mime-version: 1.0
-Content-type: text/plain; charset=UTF-8
-Content-transfer-encoding: 8bit
-Git-commit: 68f60946c1b6d1504af8994f4a419769217e4f23
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Rename intel_uncore_early_sanitize to intel_uncore_resume, dropping the
-(always true) restore_forcewake argument and add a new intel_uncore_resume
-function to replace the intel_uncore_forcewake_reset(dev_priv, false)
-calls done from the suspend / runtime_suspend functions and make
-intel_uncore_forcewake_reset private.
-
-This is a preparation patch for adding PMIC bus access notifier support.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: tagorereddy <tagore.chandan@gmail.com>
-Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Link: http://patchwork.freedesktop.org/patch/msgid/20170210102802.20898-12-hdegoede@redhat.com
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/gpu/drm/i915/i915_drv.c | 6 +++---
- drivers/gpu/drm/i915/i915_drv.h | 6 ++----
- drivers/gpu/drm/i915/intel_uncore.c | 14 +++++++++-----
- 3 files changed, 14 insertions(+), 12 deletions(-)
-
---- a/drivers/gpu/drm/i915/i915_drv.c
-+++ b/drivers/gpu/drm/i915/i915_drv.c
-@@ -1452,7 +1452,7 @@ static int i915_drm_suspend(struct drm_d
- opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
- intel_opregion_notify_adapter(dev_priv, opregion_target_state);
-
-- intel_uncore_forcewake_reset(dev_priv, false);
-+ intel_uncore_suspend(dev_priv);
- intel_opregion_unregister(dev_priv);
-
- intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
-@@ -1697,7 +1697,7 @@ static int i915_drm_resume_early(struct
- DRM_ERROR("Resume prepare failed: %d, continuing anyway\n",
- ret);
-
-- intel_uncore_early_sanitize(dev_priv, true);
-+ intel_uncore_resume_early(dev_priv);
-
- if (IS_GEN9_LP(dev_priv)) {
- if (!dev_priv->suspended_to_idle)
-@@ -2345,7 +2345,7 @@ static int intel_runtime_suspend(struct
- return ret;
- }
-
-- intel_uncore_forcewake_reset(dev_priv, false);
-+ intel_uncore_suspend(dev_priv);
-
- enable_rpm_wakeref_asserts(dev_priv);
- WARN_ON_ONCE(atomic_read(&dev_priv->pm.wakeref_count));
---- a/drivers/gpu/drm/i915/i915_drv.h
-+++ b/drivers/gpu/drm/i915/i915_drv.h
-@@ -2990,14 +2990,12 @@ int intel_irq_install(struct drm_i915_pr
- void intel_irq_uninstall(struct drm_i915_private *dev_priv);
-
- extern void intel_uncore_sanitize(struct drm_i915_private *dev_priv);
--extern void intel_uncore_early_sanitize(struct drm_i915_private *dev_priv,
-- bool restore_forcewake);
- extern void intel_uncore_init(struct drm_i915_private *dev_priv);
- extern bool intel_uncore_unclaimed_mmio(struct drm_i915_private *dev_priv);
- extern bool intel_uncore_arm_unclaimed_mmio_detection(struct drm_i915_private *dev_priv);
- extern void intel_uncore_fini(struct drm_i915_private *dev_priv);
--extern void intel_uncore_forcewake_reset(struct drm_i915_private *dev_priv,
-- bool restore);
-+extern void intel_uncore_suspend(struct drm_i915_private *dev_priv);
-+extern void intel_uncore_resume_early(struct drm_i915_private *dev_priv);
- const char *intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id);
- void intel_uncore_forcewake_get(struct drm_i915_private *dev_priv,
- enum forcewake_domains domains);
---- a/drivers/gpu/drm/i915/intel_uncore.c
-+++ b/drivers/gpu/drm/i915/intel_uncore.c
-@@ -252,8 +252,8 @@ intel_uncore_fw_release_timer(struct hrt
- return HRTIMER_NORESTART;
- }
-
--void intel_uncore_forcewake_reset(struct drm_i915_private *dev_priv,
-- bool restore)
-+static void intel_uncore_forcewake_reset(struct drm_i915_private *dev_priv,
-+ bool restore)
- {
- unsigned long irqflags;
- struct intel_uncore_forcewake_domain *domain;
-@@ -429,10 +429,14 @@ static void __intel_uncore_early_sanitiz
- intel_uncore_forcewake_reset(dev_priv, restore_forcewake);
- }
-
--void intel_uncore_early_sanitize(struct drm_i915_private *dev_priv,
-- bool restore_forcewake)
-+void intel_uncore_suspend(struct drm_i915_private *dev_priv)
- {
-- __intel_uncore_early_sanitize(dev_priv, restore_forcewake);
-+ intel_uncore_forcewake_reset(dev_priv, false);
-+}
-+
-+void intel_uncore_resume_early(struct drm_i915_private *dev_priv)
-+{
-+ __intel_uncore_early_sanitize(dev_priv, true);
- i915_check_and_clear_faults(dev_priv);
- }
-
diff --git a/patches.drivers/012-drm-i915-Listen-for-PMIC-bus-access-notifications b/patches.drivers/012-drm-i915-Listen-for-PMIC-bus-access-notifications
deleted file mode 100644
index 101b5a043a..0000000000
--- a/patches.drivers/012-drm-i915-Listen-for-PMIC-bus-access-notifications
+++ /dev/null
@@ -1,164 +0,0 @@
-From 264ec1a8221c60f9ccf13f58ac597da21235132d Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 10 Feb 2017 11:28:02 +0100
-Subject: [PATCH] drm/i915: Listen for PMIC bus access notifications
-Mime-version: 1.0
-Content-type: text/plain; charset=UTF-8
-Content-transfer-encoding: 8bit
-Git-commit: 264ec1a8221c60f9ccf13f58ac597da21235132d
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Listen for PMIC bus access notifications and get FORCEWAKE_ALL while
-the bus is accessed to avoid needing to do any forcewakes, which need
-PMIC bus access, while the PMIC bus is busy:
-
-This fixes errors like these showing up in dmesg, usually followed
-by a gfx or system freeze:
-
-[drm:fw_domains_get [i915]] *ERROR* render: timed out waiting for forcewake ack request.
-[drm:fw_domains_get [i915]] *MEDIA* render: timed out waiting for forcewake ack request.
-i2c_designware 808622C1:06: punit semaphore timed out, resetting
-i2c_designware 808622C1:06: PUNIT SEM: 2
-i2c_designware 808622C1:06: couldn't acquire bus ownership
-
-Downside of this approach is that it causes wakeups whenever the PMIC
-bus is accessed. Unfortunately we cannot simply wait for the PMIC bus
-to go idle when we hit a race, as forcewakes may be done from interrupt
-handlers where we cannot sleep to wait for the i2c PMIC bus access to
-finish.
-
-Note that the notifications and thus the wakeups will only happen on
-baytrail / cherrytrail devices using PMICs with a shared i2c bus for
-P-Unit and host PMIC access (i2c busses with a _SEM method in their
-APCI node), e.g. an axp288 PMIC.
-
-I plan to write some patches for drivers accessing the PMIC bus to
-limit their bus accesses to a bare minimum (e.g. cache registers, do not
-update battery level more often then 4 times a minute), to limit the
-amount of wakeups.
-
-Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=155241
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Tested-by: tagorereddy <tagore.chandan@gmail.com>
-Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-[danvet: Wiggle in conflicts.]
-Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/gpu/drm/i915/Kconfig | 1
- drivers/gpu/drm/i915/i915_drv.h | 1
- drivers/gpu/drm/i915/intel_uncore.c | 39 ++++++++++++++++++++++++++++++++++++
- 3 files changed, 41 insertions(+)
-
---- a/drivers/gpu/drm/i915/Kconfig
-+++ b/drivers/gpu/drm/i915/Kconfig
-@@ -19,6 +19,7 @@ config DRM_I915
- select INPUT if ACPI
- select ACPI_VIDEO if ACPI
- select ACPI_BUTTON if ACPI
-+ select IOSF_MBI
- help
- Choose this option if you have a system that has "Intel Graphics
- Media Accelerator" or "HD Graphics" integrated graphics,
---- a/drivers/gpu/drm/i915/i915_drv.h
-+++ b/drivers/gpu/drm/i915/i915_drv.h
-@@ -723,6 +723,7 @@ struct intel_uncore {
- const struct intel_forcewake_range *fw_domains_table;
- unsigned int fw_domains_table_entries;
-
-+ struct notifier_block pmic_bus_access_nb;
- struct intel_uncore_funcs funcs;
-
- unsigned fifo_count;
---- a/drivers/gpu/drm/i915/intel_uncore.c
-+++ b/drivers/gpu/drm/i915/intel_uncore.c
-@@ -25,6 +25,7 @@
- #include "intel_drv.h"
- #include "i915_vgpu.h"
-
-+#include <asm/iosf_mbi.h>
- #include <linux/pm_runtime.h>
-
- #define FORCEWAKE_ACK_TIMEOUT_MS 50
-@@ -431,12 +432,16 @@ static void __intel_uncore_early_sanitiz
-
- void intel_uncore_suspend(struct drm_i915_private *dev_priv)
- {
-+ iosf_mbi_unregister_pmic_bus_access_notifier(
-+ &dev_priv->uncore.pmic_bus_access_nb);
- intel_uncore_forcewake_reset(dev_priv, false);
- }
-
- void intel_uncore_resume_early(struct drm_i915_private *dev_priv)
- {
- __intel_uncore_early_sanitize(dev_priv, true);
-+ iosf_mbi_register_pmic_bus_access_notifier(
-+ &dev_priv->uncore.pmic_bus_access_nb);
- i915_check_and_clear_faults(dev_priv);
- }
-
-@@ -1389,6 +1394,32 @@ static void intel_uncore_fw_domains_init
- dev_priv->uncore.fw_domains_table_entries = ARRAY_SIZE((d)); \
- }
-
-+static int i915_pmic_bus_access_notifier(struct notifier_block *nb,
-+ unsigned long action, void *data)
-+{
-+ struct drm_i915_private *dev_priv = container_of(nb,
-+ struct drm_i915_private, uncore.pmic_bus_access_nb);
-+
-+ switch (action) {
-+ case MBI_PMIC_BUS_ACCESS_BEGIN:
-+ /*
-+ * forcewake all now to make sure that we don't need to do a
-+ * forcewake later which on systems where this notifier gets
-+ * called requires the punit to access to the shared pmic i2c
-+ * bus, which will be busy after this notification, leading to:
-+ * "render: timed out waiting for forcewake ack request."
-+ * errors.
-+ */
-+ intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
-+ break;
-+ case MBI_PMIC_BUS_ACCESS_END:
-+ intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
-+ break;
-+ }
-+
-+ return NOTIFY_OK;
-+}
-+
- void intel_uncore_init(struct drm_i915_private *dev_priv)
- {
- i915_check_vgpu(dev_priv);
-@@ -1398,6 +1429,8 @@ void intel_uncore_init(struct drm_i915_p
- __intel_uncore_early_sanitize(dev_priv, false);
-
- dev_priv->uncore.unclaimed_mmio_check = 1;
-+ dev_priv->uncore.pmic_bus_access_nb.notifier_call =
-+ i915_pmic_bus_access_notifier;
-
- switch (INTEL_INFO(dev_priv)->gen) {
- default:
-@@ -1457,6 +1490,9 @@ void intel_uncore_init(struct drm_i915_p
- ASSIGN_READ_MMIO_VFUNCS(vgpu);
- }
-
-+ iosf_mbi_register_pmic_bus_access_notifier(
-+ &dev_priv->uncore.pmic_bus_access_nb);
-+
- i915_check_and_clear_faults(dev_priv);
- }
- #undef ASSIGN_WRITE_MMIO_VFUNCS
-@@ -1464,6 +1500,9 @@ void intel_uncore_init(struct drm_i915_p
-
- void intel_uncore_fini(struct drm_i915_private *dev_priv)
- {
-+ iosf_mbi_unregister_pmic_bus_access_notifier(
-+ &dev_priv->uncore.pmic_bus_access_nb);
-+
- /* Paranoia: make sure we have disabled everything before we exit. */
- intel_uncore_sanitize(dev_priv);
- intel_uncore_forcewake_reset(dev_priv, false);
diff --git a/patches.drivers/013-i2c-designware-increase-timeout-of-semaphore-transfe b/patches.drivers/013-i2c-designware-increase-timeout-of-semaphore-transfe
deleted file mode 100644
index b68a76d35b..0000000000
--- a/patches.drivers/013-i2c-designware-increase-timeout-of-semaphore-transfe
+++ /dev/null
@@ -1,36 +0,0 @@
-From 78c43af2c1d79653e2e6fb9a05c8f3def7c87940 Mon Sep 17 00:00:00 2001
-From: Oliver Neukum <oneukum@suse.com>
-Date: Mon, 20 Mar 2017 14:37:30 +0100
-Subject: [PATCH] i2c-designware: increase timeout of semaphore transfer
-Git-commit: 78c43af2c1d79653e2e6fb9a05c8f3def7c87940
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Our testing shows the semaphore failing to be transferred on CherryTrail
-in about 0.5% of all cases. The existing timeout needs to be lengthened
-to accommodate the worst cases.
-
-V2: Rebased on https://cgit.freedesktop.org/drm-intel/commit/?h=topic/designware-baytrail
-
-Signed-off-by: Oliver Neukum <oneukum@suse.com>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -22,7 +22,7 @@
-
- #include "i2c-designware-core.h"
-
--#define SEMAPHORE_TIMEOUT 100
-+#define SEMAPHORE_TIMEOUT 500
- #define PUNIT_SEMAPHORE 0x7
- #define PUNIT_SEMAPHORE_CHT 0x10e
- #define PUNIT_SEMAPHORE_BIT BIT(0)
diff --git a/patches.drivers/014-i2c-designware-Never-suspend-i2c-busses-used-for-acc b/patches.drivers/014-i2c-designware-Never-suspend-i2c-busses-used-for-acc
deleted file mode 100644
index ddbe18442d..0000000000
--- a/patches.drivers/014-i2c-designware-Never-suspend-i2c-busses-used-for-acc
+++ /dev/null
@@ -1,148 +0,0 @@
-From 41c80b8a63bccf9de96698b4eb0916e223fb6e72 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Mon, 13 Mar 2017 23:25:09 +0100
-Subject: [PATCH] i2c: designware: Never suspend i2c-busses used for accessing the system PMIC
-Git-commit: 41c80b8a63bccf9de96698b4eb0916e223fb6e72
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Currently we are already setting a pm_runtime_disabled flag and disabling
-runtime-pm for i2c-busses used for accessing the system PMIC on x86.
-But this is not enough, there are ACPI opregions which may want to access
-the PMIC during late-suspend and early-resume, so we need to completely
-disable pm to be safe.
-
-This commit renames the flag from pm_runtime_disabled to pm_disabled and
-adds the following new behavior if the flag is set:
-
-1) Call dev_pm_syscore_device(dev, true) which disables normal suspend /
- resume and remove the pm_runtime_disabled check from dw_i2c_plat_resume
- since that will now never get called. This fixes suspend_late handlers
- which use ACPI PMIC opregions causing errors like these:
-
- PM: Suspending system (freeze)
- PM: suspend of devices complete after 1127.751 msecs
- i2c_designware 808622C1:06: timeout waiting for bus ready
- ACPI Exception: AE_ERROR, Returned by Handler for [UserDefinedRegion]
- acpi 80860F14:02: Failed to change power state to D3hot
- PM: late suspend of devices failed
-
-2) Set IRQF_NO_SUSPEND irq flag. This fixes resume_early handlers which
- handlers which use ACPI PMIC opregions causing errors like these:
-
- PM: resume from suspend-to-idle
- i2c_designware 808622C1:06: controller timed out
- ACPI Exception: AE_ERROR, Returned by Handler for [UserDefinedRegion]
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 2 +-
- drivers/i2c/busses/i2c-designware-core.c | 11 +++++++++--
- drivers/i2c/busses/i2c-designware-core.h | 4 ++--
- drivers/i2c/busses/i2c-designware-platdrv.c | 10 ++++------
- 4 files changed, 16 insertions(+), 11 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -170,7 +170,7 @@ int i2c_dw_probe_lock_support(struct dw_
- dev_info(dev->dev, "I2C bus managed by PUNIT\n");
- dev->acquire_lock = baytrail_i2c_acquire;
- dev->release_lock = baytrail_i2c_release;
-- dev->pm_runtime_disabled = true;
-+ dev->pm_disabled = true;
-
- pm_qos_add_request(&dev->pm_qos, PM_QOS_CPU_DMA_LATENCY,
- PM_QOS_DEFAULT_VALUE);
---- a/drivers/i2c/busses/i2c-designware-core.c
-+++ b/drivers/i2c/busses/i2c-designware-core.c
-@@ -960,6 +960,7 @@ EXPORT_SYMBOL_GPL(i2c_dw_read_comp_param
- int i2c_dw_probe(struct dw_i2c_dev *dev)
- {
- struct i2c_adapter *adap = &dev->adapter;
-+ unsigned long irq_flags;
- int r;
-
- init_completion(&dev->cmd_complete);
-@@ -975,9 +976,15 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
- adap->dev.parent = dev->dev;
- i2c_set_adapdata(adap, dev);
-
-+ if (dev->pm_disabled) {
-+ dev_pm_syscore_device(dev->dev, true);
-+ irq_flags = IRQF_NO_SUSPEND;
-+ } else {
-+ irq_flags = IRQF_SHARED | IRQF_COND_SUSPEND;
-+ }
-+
- i2c_dw_disable_int(dev);
-- r = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr,
-- IRQF_SHARED | IRQF_COND_SUSPEND,
-+ r = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr, irq_flags,
- dev_name(dev->dev), dev);
- if (r) {
- dev_err(dev->dev, "failure requesting irq %i: %d\n",
---- a/drivers/i2c/busses/i2c-designware-core.h
-+++ b/drivers/i2c/busses/i2c-designware-core.h
-@@ -79,7 +79,7 @@
- * @pm_qos: pm_qos_request used while holding a hardware lock on the bus
- * @acquire_lock: function to acquire a hardware lock on the bus
- * @release_lock: function to release a hardware lock on the bus
-- * @pm_runtime_disabled: true if pm runtime is disabled
-+ * @pm_disabled: true if power-management should be disabled for this i2c-bus
- *
- * HCNT and LCNT parameters can be used if the platform knows more accurate
- * values than the one computed based only on the input clock frequency.
-@@ -128,7 +128,7 @@ struct dw_i2c_dev {
- struct pm_qos_request pm_qos;
- int (*acquire_lock)(struct dw_i2c_dev *dev);
- void (*release_lock)(struct dw_i2c_dev *dev);
-- bool pm_runtime_disabled;
-+ bool pm_disabled;
- };
-
- #define ACCESS_SWAP 0x00000001
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -286,7 +286,7 @@ static int dw_i2c_plat_probe(struct plat
- ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
- adap->dev.of_node = pdev->dev.of_node;
-
-- if (dev->pm_runtime_disabled) {
-+ if (dev->pm_disabled) {
- pm_runtime_forbid(&pdev->dev);
- } else {
- pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
-@@ -302,7 +302,7 @@ static int dw_i2c_plat_probe(struct plat
- return r;
-
- exit_probe:
-- if (!dev->pm_runtime_disabled)
-+ if (!dev->pm_disabled)
- pm_runtime_disable(&pdev->dev);
- exit_reset:
- if (!IS_ERR_OR_NULL(dev->rst))
-@@ -322,7 +322,7 @@ static int dw_i2c_plat_remove(struct pla
-
- pm_runtime_dont_use_autosuspend(&pdev->dev);
- pm_runtime_put_sync(&pdev->dev);
-- if (!dev->pm_runtime_disabled)
-+ if (!dev->pm_disabled)
- pm_runtime_disable(&pdev->dev);
- if (!IS_ERR_OR_NULL(dev->rst))
- reset_control_assert(dev->rst);
-@@ -374,9 +374,7 @@ static int dw_i2c_plat_resume(struct dev
- struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
-
- i2c_dw_plat_prepare_clk(i_dev, true);
--
-- if (!i_dev->pm_runtime_disabled)
-- i2c_dw_init(i_dev);
-+ i2c_dw_init(i_dev);
-
- return 0;
- }
diff --git a/patches.drivers/015-i2c-designware-Disable-pm-for-PMIC-i2c-bus-even-if-t b/patches.drivers/015-i2c-designware-Disable-pm-for-PMIC-i2c-bus-even-if-t
deleted file mode 100644
index 1d53637c35..0000000000
--- a/patches.drivers/015-i2c-designware-Disable-pm-for-PMIC-i2c-bus-even-if-t
+++ /dev/null
@@ -1,63 +0,0 @@
-From a3d411fb38c0472ce96aea58062db87cc9357780 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Mon, 13 Mar 2017 23:25:10 +0100
-Subject: [PATCH] i2c: designware: Disable pm for PMIC i2c-bus even if there is no _SEM method
-Git-commit: a3d411fb38c0472ce96aea58062db87cc9357780
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Cherrytrail devices use the dw i2c-bus with uid 7 to access their PMIC.
-Even if the i2c-bus to the PMIC is not shared with the SoC's P-Unit
-and i2c-designware-baytrail.c thus does not set the pm_disabled flag,
-we still need to disable pm so that ACPI PMIC opregions can access the
-PMIC during late-suspend and early-resume.
-
-This fixes errors like these blocking suspend:
-
- i2c_designware 808622C1:06: timeout waiting for bus ready
- ACPI Exception: AE_ERROR, Returned by Handler for [UserDefinedRegion]
- acpi 80860F14:02: Failed to change power state to D3hot
- PM: late suspend of devices failed
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-platdrv.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -95,7 +95,10 @@ static void dw_i2c_acpi_params(struct pl
- static int dw_i2c_acpi_configure(struct platform_device *pdev)
- {
- struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
-+ acpi_handle handle = ACPI_HANDLE(&pdev->dev);
- const struct acpi_device_id *id;
-+ struct acpi_device *adev;
-+ const char *uid;
-
- dev->adapter.nr = -1;
- dev->tx_fifo_depth = 32;
-@@ -115,6 +118,18 @@ static int dw_i2c_acpi_configure(struct
- if (id && id->driver_data)
- dev->flags |= (u32)id->driver_data;
-
-+ if (acpi_bus_get_device(handle, &adev))
-+ return -ENODEV;
-+
-+ /*
-+ * Cherrytrail I2C7 gets used for the PMIC which gets accessed
-+ * through ACPI opregions during late suspend / early resume
-+ * disable pm for it.
-+ */
-+ uid = adev->pnp.unique_id;
-+ if ((dev->flags & MODEL_CHERRYTRAIL) && !strcmp(uid, "7"))
-+ dev->pm_disabled = true;
-+
- return 0;
- }
-
diff --git a/patches.drivers/016-i2c-designware-Get-selected-speed-mode-sda-hold-time b/patches.drivers/016-i2c-designware-Get-selected-speed-mode-sda-hold-time
deleted file mode 100644
index 682952e140..0000000000
--- a/patches.drivers/016-i2c-designware-Get-selected-speed-mode-sda-hold-time
+++ /dev/null
@@ -1,72 +0,0 @@
-From bd698d24b1b5790d0a22d44a0705dabd47235ad4 Mon Sep 17 00:00:00 2001
-From: "chin.yew.tan@intel.com" <chin.yew.tan@intel.com>
-Date: Tue, 28 Mar 2017 16:48:02 +0800
-Subject: [PATCH] i2c: designware: Get selected speed mode sda-hold-time via ACPI
-Git-commit: bd698d24b1b5790d0a22d44a0705dabd47235ad4
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-Sda-hold-time is an important parameter for tuning i2c to meet the
-electrical specification especially for high speed. I2C with incorrect
-sda-hold-time may cause lost arbitration error. Instead of loading all
-speed mode settings, only selected speed mode settings are loaded.
-
-Signed-off-by: Tan Chin Yew <chin.yew.tan@intel.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-platdrv.c | 31 +++++++++++++++++++---------
- 1 file changed, 22 insertions(+), 9 deletions(-)
-
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -85,8 +85,7 @@ static void dw_i2c_acpi_params(struct pl
-
- *hcnt = (u16)objs[0].integer.value;
- *lcnt = (u16)objs[1].integer.value;
-- if (sda_hold)
-- *sda_hold = (u32)objs[2].integer.value;
-+ *sda_hold = (u32)objs[2].integer.value;
- }
-
- kfree(buf.pointer);
-@@ -105,14 +104,28 @@ static int dw_i2c_acpi_configure(struct
- dev->rx_fifo_depth = 32;
-
- /*
-- * Try to get SDA hold time and *CNT values from an ACPI method if
-- * it exists for both supported speed modes.
-+ * Try to get SDA hold time and *CNT values from an ACPI method for
-+ * selected speed modes.
- */
-- dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, NULL);
-- dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt,
-- &dev->sda_hold_time);
-- dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt, NULL);
-- dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt, NULL);
-+ switch (dev->clk_freq) {
-+ case 100000:
-+ dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt,
-+ &dev->sda_hold_time);
-+ break;
-+ case 1000000:
-+ dw_i2c_acpi_params(pdev, "FPCN", &dev->fp_hcnt, &dev->fp_lcnt,
-+ &dev->sda_hold_time);
-+ break;
-+ case 3400000:
-+ dw_i2c_acpi_params(pdev, "HSCN", &dev->hs_hcnt, &dev->hs_lcnt,
-+ &dev->sda_hold_time);
-+ break;
-+ case 400000:
-+ default:
-+ dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt,
-+ &dev->sda_hold_time);
-+ break;
-+ }
-
- id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
- if (id && id->driver_data)
diff --git a/patches.drivers/017-i2c-designware-baytrail-fix-potential-null-pointer-d b/patches.drivers/017-i2c-designware-baytrail-fix-potential-null-pointer-d
deleted file mode 100644
index 0f36dc06c5..0000000000
--- a/patches.drivers/017-i2c-designware-baytrail-fix-potential-null-pointer-d
+++ /dev/null
@@ -1,45 +0,0 @@
-From c7f82ea8605627b3088f166d9f4a5ca7857e8383 Mon Sep 17 00:00:00 2001
-From: Colin Ian King <colin.king@canonical.com>
-Date: Mon, 20 Mar 2017 11:51:23 +0000
-Subject: [PATCH] i2c: designware-baytrail: fix potential null pointer dereference on dev
-Git-commit: c7f82ea8605627b3088f166d9f4a5ca7857e8383
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1026458,bsc#1011913
-
-The assignment to addr requires a call to get_sem_addr that dereferences
-dev, however, this dereference occurs before a null pointer check on dev.
-Move this assignment after the null check on dev to avoid a potential null
-pointer dereference.
-
-Detected by CoverityScan, CID#1419700 ("Dereference before null check")
-
-Fixes: fd476fa22a1f432 ("i2c: designware-baytrail: Add support for cherrytrail")
-Signed-off-by: Colin Ian King <colin.king@canonical.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/i2c/busses/i2c-designware-baytrail.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
---- a/drivers/i2c/busses/i2c-designware-baytrail.c
-+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
-@@ -70,7 +70,7 @@ static void reset_semaphore(struct dw_i2
-
- static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
- {
-- u32 addr = get_sem_addr(dev);
-+ u32 addr;
- u32 sem = PUNIT_SEMAPHORE_ACQUIRE;
- int ret;
- unsigned long start, end;
-@@ -94,6 +94,8 @@ static int baytrail_i2c_acquire(struct d
- */
- pm_qos_update_request(&dev->pm_qos, 0);
-
-+ addr = get_sem_addr(dev);
-+
- /* host driver writes to side band semaphore register */
- ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, addr, sem);
- if (ret) {
diff --git a/patches.drivers/ALSA-hda-Implement-mic-mute-LED-mode-enum b/patches.drivers/ALSA-hda-Implement-mic-mute-LED-mode-enum
new file mode 100644
index 0000000000..e2b999e454
--- /dev/null
+++ b/patches.drivers/ALSA-hda-Implement-mic-mute-LED-mode-enum
@@ -0,0 +1,149 @@
+From 62a939477173fabfe9f52114fab878a00b87f9a3 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 22 Aug 2017 16:52:10 +0200
+Subject: [PATCH] ALSA: hda - Implement mic-mute LED mode enum
+References: bsc#1055013
+Git-commit: 62a939477173fabfe9f52114fab878a00b87f9a3
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
+Patch-mainline: Queued in subsystem maintainer repository
+
+Dell laptops have another LED for mic-mute in addition to the master
+mute. The former is tied with the capture switch (in a reverse way)
+while the latter is tied with the master playback switch. We already
+have an enum control to change the behavior for the master mute LED in
+different ways, e.g. keeping always off or turning off at mute. But,
+the mic-mute LED has no such management but its behavior is
+hard-coded.
+
+This patch implements an enum control to change the mic-mute LED
+behavior like what we have for the master mute LED. The ctl provides
+four modes: keep-on, keep-off, follow-capture and follow-mute. The
+default mode is the last one, follow-mute, which follows the capture
+mute, i.e. LED turning on when the capture is off, and turning off
+when the capture is active.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/dell_wmi_helper.c | 87 +++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 81 insertions(+), 6 deletions(-)
+
+--- a/sound/pci/hda/dell_wmi_helper.c
++++ b/sound/pci/hda/dell_wmi_helper.c
+@@ -5,12 +5,47 @@
+ #if IS_ENABLED(CONFIG_DELL_LAPTOP)
+ #include <linux/dell-led.h>
+
++enum {
++ MICMUTE_LED_ON,
++ MICMUTE_LED_OFF,
++ MICMUTE_LED_FOLLOW_CAPTURE,
++ MICMUTE_LED_FOLLOW_MUTE,
++};
++
++static int dell_led_mode = MICMUTE_LED_FOLLOW_MUTE;
++static int dell_capture;
+ static int dell_led_value;
+ static int (*dell_micmute_led_set_func)(int);
+ static void (*dell_old_cap_hook)(struct hda_codec *,
+ struct snd_kcontrol *,
+ struct snd_ctl_elem_value *);
+
++static void call_micmute_led_update(void)
++{
++ int val;
++
++ switch (dell_led_mode) {
++ case MICMUTE_LED_ON:
++ val = 1;
++ break;
++ case MICMUTE_LED_OFF:
++ val = 0;
++ break;
++ case MICMUTE_LED_FOLLOW_CAPTURE:
++ val = dell_capture;
++ break;
++ case MICMUTE_LED_FOLLOW_MUTE:
++ default:
++ val = !dell_capture;
++ break;
++ }
++
++ if (val == dell_led_value)
++ return;
++ dell_led_value = val;
++ dell_micmute_led_set_func(dell_led_value);
++}
++
+ static void update_dell_wmi_micmute_led(struct hda_codec *codec,
+ struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+@@ -22,15 +57,54 @@ static void update_dell_wmi_micmute_led(
+ return;
+ if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) {
+ /* TODO: How do I verify if it's a mono or stereo here? */
+- int val = (ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]) ? 0 : 1;
+- if (val == dell_led_value)
+- return;
+- dell_led_value = val;
+- if (dell_micmute_led_set_func)
+- dell_micmute_led_set_func(dell_led_value);
++ dell_capture = (ucontrol->value.integer.value[0] ||
++ ucontrol->value.integer.value[1]);
++ call_micmute_led_update();
+ }
+ }
+
++static int dell_mic_mute_led_mode_info(struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_info *uinfo)
++{
++ static const char * const texts[] = {
++ "On", "Off", "Follow Capture", "Follow Mute",
++ };
++
++ return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
++}
++
++static int dell_mic_mute_led_mode_get(struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_value *ucontrol)
++{
++ ucontrol->value.enumerated.item[0] = dell_led_mode;
++ return 0;
++}
++
++static int dell_mic_mute_led_mode_put(struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_value *ucontrol)
++{
++ unsigned int mode;
++
++ mode = ucontrol->value.enumerated.item[0];
++ if (mode > MICMUTE_LED_FOLLOW_MUTE)
++ mode = MICMUTE_LED_FOLLOW_MUTE;
++ if (mode == dell_led_mode)
++ return 0;
++ dell_led_mode = mode;
++ call_micmute_led_update();
++ return 1;
++}
++
++static const struct snd_kcontrol_new dell_mic_mute_mode_ctls[] = {
++ {
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++ .name = "Mic Mute-LED Mode",
++ .info = dell_mic_mute_led_mode_info,
++ .get = dell_mic_mute_led_mode_get,
++ .put = dell_mic_mute_led_mode_put,
++ },
++ {}
++};
+
+ static void alc_fixup_dell_wmi(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+@@ -55,6 +129,7 @@ static void alc_fixup_dell_wmi(struct hd
+ dell_old_cap_hook = spec->gen.cap_sync_hook;
+ spec->gen.cap_sync_hook = update_dell_wmi_micmute_led;
+ removefunc = false;
++ add_mixer(spec, dell_mic_mute_mode_ctls);
+ }
+ }
+
diff --git a/patches.drivers/ALSA-ice1712-Add-support-for-STAudio-ADCIII b/patches.drivers/ALSA-ice1712-Add-support-for-STAudio-ADCIII
new file mode 100644
index 0000000000..4e5cfcf9b7
--- /dev/null
+++ b/patches.drivers/ALSA-ice1712-Add-support-for-STAudio-ADCIII
@@ -0,0 +1,107 @@
+From e8a91ae18bdc0bcedd2a07e42e66ca09dc2105d2 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 21 Aug 2017 16:13:27 +0200
+Subject: [PATCH] ALSA: ice1712: Add support for STAudio ADCIII
+References: bsc#1048934
+Git-commit: e8a91ae18bdc0bcedd2a07e42e66ca09dc2105d2
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
+Patch-mainline: Queued in subsystem maintainer repository
+
+STAudio ADCIII has the same SSID as Hoontech STDSP24, but requires a
+slightly different configuration. This patch allows user to choose
+this model via model=staudio option to set the proper configuration
+for the board.
+
+Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1048934
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/ice1712/hoontech.c | 39 ++++++++++++++++++++++++++++++++++-----
+ sound/pci/ice1712/hoontech.h | 1 +
+ 2 files changed, 35 insertions(+), 5 deletions(-)
+
+--- a/sound/pci/ice1712/hoontech.c
++++ b/sound/pci/ice1712/hoontech.c
+@@ -166,7 +166,7 @@ static void snd_ice1712_stdsp24_midi2(st
+ mutex_unlock(&ice->gpio_mutex);
+ }
+
+-static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice)
++static int hoontech_init(struct snd_ice1712 *ice, bool staudio)
+ {
+ struct hoontech_spec *spec;
+ int box, chn;
+@@ -203,7 +203,10 @@ static int snd_ice1712_hoontech_init(str
+ ICE1712_STDSP24_3_INSEL(spec->boxbits, 0);
+
+ /* let's go - activate only functions in first box */
+- spec->config = 0;
++ if (staudio)
++ spec->config = ICE1712_STDSP24_MUTE;
++ else
++ spec->config = 0;
+ /* ICE1712_STDSP24_MUTE |
+ ICE1712_STDSP24_INSEL |
+ ICE1712_STDSP24_DAREAR; */
+@@ -226,9 +229,16 @@ static int snd_ice1712_hoontech_init(str
+ ICE1712_STDSP24_BOX_CHN4 |
+ ICE1712_STDSP24_BOX_MIDI1 |
+ ICE1712_STDSP24_BOX_MIDI2;
+- spec->boxconfig[1] =
+- spec->boxconfig[2] =
+- spec->boxconfig[3] = 0;
++ if (staudio) {
++ spec->boxconfig[1] =
++ spec->boxconfig[2] =
++ spec->boxconfig[3] = spec->boxconfig[0];
++ } else {
++ spec->boxconfig[1] =
++ spec->boxconfig[2] =
++ spec->boxconfig[3] = 0;
++ }
++
+ snd_ice1712_stdsp24_darear(ice,
+ (spec->config & ICE1712_STDSP24_DAREAR) ? 1 : 0);
+ snd_ice1712_stdsp24_mute(ice,
+@@ -248,6 +258,16 @@ static int snd_ice1712_hoontech_init(str
+ return 0;
+ }
+
++static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice)
++{
++ return hoontech_init(ice, false);
++}
++
++static int snd_ice1712_staudio_init(struct snd_ice1712 *ice)
++{
++ return hoontech_init(ice, true);
++}
++
+ /*
+ * AK4524 access
+ */
+@@ -351,5 +371,14 @@ struct snd_ice1712_card_info snd_ice1712
+ .model = "ez8",
+ .chip_init = snd_ice1712_ez8_init,
+ },
++ {
++ /* STAudio ADCIII has the same SSID as Hoontech StA DSP24,
++ * thus identified only via the explicit model option
++ */
++ .subvendor = ICE1712_SUBDEVICE_STAUDIO_ADCIII, /* a dummy id */
++ .name = "STAudio ADCIII",
++ .model = "staudio",
++ .chip_init = snd_ice1712_staudio_init,
++ },
+ { } /* terminator */
+ };
+--- a/sound/pci/ice1712/hoontech.h
++++ b/sound/pci/ice1712/hoontech.h
+@@ -34,6 +34,7 @@
+ #define ICE1712_SUBDEVICE_STDSP24_VALUE 0x00010010 /* A dummy id for Hoontech SoundTrack Audio DSP 24 Value */
+ #define ICE1712_SUBDEVICE_STDSP24_MEDIA7_1 0x16141217 /* Hoontech ST Audio DSP24 Media 7.1 */
+ #define ICE1712_SUBDEVICE_EVENT_EZ8 0x00010001 /* A dummy id for EZ8 */
++#define ICE1712_SUBDEVICE_STAUDIO_ADCIII 0x00010002 /* A dummy id for STAudio ADCIII */
+
+ extern struct snd_ice1712_card_info snd_ice1712_hoontech_cards[];
+
diff --git a/patches.drivers/HID-asus-change-mapping-from-KEY_WLAN-to-KEY_RFKILL b/patches.drivers/HID-asus-change-mapping-from-KEY_WLAN-to-KEY_RFKILL
deleted file mode 100644
index 92aa03a89a..0000000000
--- a/patches.drivers/HID-asus-change-mapping-from-KEY_WLAN-to-KEY_RFKILL
+++ /dev/null
@@ -1,41 +0,0 @@
-From 802b24b475e459e985681d6e0815ae6cb52e5560 Mon Sep 17 00:00:00 2001
-From: Matjaz Hegedic <matjaz.hegedic@gmail.com>
-Date: Thu, 9 Mar 2017 00:31:15 +0100
-Subject: [PATCH] HID: asus: change mapping from KEY_WLAN to KEY_RFKILL
-Git-commit: 802b24b475e459e985681d6e0815ae6cb52e5560
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1026458
-
-The input mapping code incorrectly maps the Airplane Mode button to
-KEY_WLAN, which stands for WiFi toggle, but doesn't affect Bluetooth
-(and other active radios) which is expected behavior for Airplane
-Mode.
-
-The fix replaces KEY_WLAN with the more appropriate KEY_RFKILL.
-
-The declared usage code 0x88 corresponds to Airplane Mode button on
-all keyboards handled by hid-asus (I2C netbook keyboards and USB
-RoG series keyboards), so the fix doesn't introduce any
-inconsistencies across different models.
-
-Signed-off-by: Matjaz Hegedic <matjaz.hegedic@gmail.com>
-Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/hid/hid-asus.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/hid/hid-asus.c
-+++ b/drivers/hid/hid-asus.c
-@@ -226,7 +226,7 @@ static int asus_input_mapping(struct hid
- case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF); break;
- case 0x6c: asus_map_key_clear(KEY_SLEEP); break;
- case 0x82: asus_map_key_clear(KEY_CAMERA); break;
-- case 0x88: asus_map_key_clear(KEY_WLAN); break;
-+ case 0x88: asus_map_key_clear(KEY_RFKILL); break;
- case 0xb5: asus_map_key_clear(KEY_CALC); break;
- case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break;
- case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break;
diff --git a/patches.drivers/HID-asus-drop-dependency-on-I2C_HID b/patches.drivers/HID-asus-drop-dependency-on-I2C_HID
deleted file mode 100644
index f12430d259..0000000000
--- a/patches.drivers/HID-asus-drop-dependency-on-I2C_HID
+++ /dev/null
@@ -1,31 +0,0 @@
-From 7877474905460e084bdfa65a82b9280767cfbfd6 Mon Sep 17 00:00:00 2001
-From: Daniel Drake <drake@endlessm.com>
-Date: Wed, 1 Mar 2017 15:48:50 -0600
-Subject: [PATCH] HID: asus: drop dependency on I2C_HID
-Git-commit: 7877474905460e084bdfa65a82b9280767cfbfd6
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1026458
-
-There is nothing transport-specific in this driver, and we will now be
-adding support for some Asus USB devices too.
-
-Signed-off-by: Daniel Drake <drake@endlessm.com>
-Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/hid/Kconfig | 1 -
- 1 file changed, 1 deletion(-)
-
---- a/drivers/hid/Kconfig
-+++ b/drivers/hid/Kconfig
-@@ -136,7 +136,6 @@ config HID_APPLEIR
-
- config HID_ASUS
- tristate "Asus"
-- depends on I2C_HID
- ---help---
- Support for Asus notebook built-in keyboard and touchpad via i2c.
-
diff --git a/patches.drivers/HID-asus-fix-and-generalize-ambiguous-preprocessor-m b/patches.drivers/HID-asus-fix-and-generalize-ambiguous-preprocessor-m
deleted file mode 100644
index bc632b64e9..0000000000
--- a/patches.drivers/HID-asus-fix-and-generalize-ambiguous-preprocessor-m
+++ /dev/null
@@ -1,143 +0,0 @@
-From a93913e1496d6103ec0b76d8397fc04ece55f570 Mon Sep 17 00:00:00 2001
-From: Matjaz Hegedic <matjaz.hegedic@gmail.com>
-Date: Thu, 9 Mar 2017 00:31:13 +0100
-Subject: [PATCH] HID: asus: fix and generalize ambiguous preprocessor macros
-Git-commit: a93913e1496d6103ec0b76d8397fc04ece55f570
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1026458
-
-Before commits a1cbda7a65a7a ("HID: asus: drop dependency
-on I2C_HID") and 64a403c6555fd ("HID: asus: support Republic
-Of Gamers special keys") hid-asus only pertained to a single
-I2C keyboard model found in ASUS X205TA, F205TA, & X200HA. The
-aforementioned commits expanded this support to other ASUS
-laptop keyboard models.
-
-In order to clarify that existing keyboard and touchpad quirks
-only apply to the I2C devices, and not ASUS keyboards in
-general, I2C HID IDs and their corresponding quirk sets have
-been renamed. In addition, the latter commit introduced
-special key handling, which also applies to the I2C keyboard,
-not just Republic of Gamers series. Therefore, the
-rog_map_key_clear() macro is renamed to asus_map_key_clear()
-for the sake of generality.
-
-Signed-off-by: Matjaz Hegedic <matjaz.hegedic@gmail.com>
-Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/hid/hid-asus.c | 38 +++++++++++++++++++-------------------
- drivers/hid/hid-core.c | 4 ++--
- drivers/hid/hid-ids.h | 4 ++--
- 3 files changed, 23 insertions(+), 23 deletions(-)
-
---- a/drivers/hid/hid-asus.c
-+++ b/drivers/hid/hid-asus.c
-@@ -64,9 +64,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard an
- #define QUIRK_SKIP_INPUT_MAPPING BIT(2)
- #define QUIRK_IS_MULTITOUCH BIT(3)
-
--#define KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
-+#define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
- QUIRK_NO_INIT_REPORTS)
--#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
-+#define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
- QUIRK_SKIP_INPUT_MAPPING | \
- QUIRK_IS_MULTITOUCH)
-
-@@ -199,7 +199,7 @@ static int asus_input_configured(struct
- return 0;
- }
-
--#define rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
-+#define asus_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
- max, EV_KEY, (c))
- static int asus_input_mapping(struct hid_device *hdev,
- struct hid_input *hi, struct hid_field *field,
-@@ -215,31 +215,31 @@ static int asus_input_mapping(struct hid
- return -1;
- }
-
-- /* ASUS Republic of Gamers laptop keyboard hotkeys */
-+ /* ASUS-specific keyboard hotkeys */
- if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
- set_bit(EV_REP, hi->input->evbit);
- switch (usage->hid & HID_USAGE) {
-- case 0x10: rog_map_key_clear(KEY_BRIGHTNESSDOWN); break;
-- case 0x20: rog_map_key_clear(KEY_BRIGHTNESSUP); break;
-- case 0x35: rog_map_key_clear(KEY_DISPLAY_OFF); break;
-- case 0x6c: rog_map_key_clear(KEY_SLEEP); break;
-- case 0x82: rog_map_key_clear(KEY_CAMERA); break;
-- case 0x88: rog_map_key_clear(KEY_WLAN); break;
-- case 0xb5: rog_map_key_clear(KEY_CALC); break;
-- case 0xc4: rog_map_key_clear(KEY_KBDILLUMUP); break;
-- case 0xc5: rog_map_key_clear(KEY_KBDILLUMDOWN); break;
-+ case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break;
-+ case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break;
-+ case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF); break;
-+ case 0x6c: asus_map_key_clear(KEY_SLEEP); break;
-+ case 0x82: asus_map_key_clear(KEY_CAMERA); break;
-+ case 0x88: asus_map_key_clear(KEY_WLAN); break;
-+ case 0xb5: asus_map_key_clear(KEY_CALC); break;
-+ case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break;
-+ case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break;
-
- /* ASUS touchpad toggle */
-- case 0x6b: rog_map_key_clear(KEY_F21); break;
-+ case 0x6b: asus_map_key_clear(KEY_F21); break;
-
- /* ROG key */
-- case 0x38: rog_map_key_clear(KEY_PROG1); break;
-+ case 0x38: asus_map_key_clear(KEY_PROG1); break;
-
- /* Fn+C ASUS Splendid */
-- case 0xba: rog_map_key_clear(KEY_PROG2); break;
-+ case 0xba: asus_map_key_clear(KEY_PROG2); break;
-
- /* Fn+Space Power4Gear Hybrid */
-- case 0x5c: rog_map_key_clear(KEY_PROG3); break;
-+ case 0x5c: asus_map_key_clear(KEY_PROG3); break;
-
- default:
- return 0;
-@@ -354,9 +354,9 @@ static __u8 *asus_report_fixup(struct hi
-
- static const struct hid_device_id asus_devices[] = {
- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
-- USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
-+ USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS},
- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
-- USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
-+ USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), I2C_TOUCHPAD_QUIRKS },
- { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
- USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
- { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
---- a/drivers/hid/hid-core.c
-+++ b/drivers/hid/hid-core.c
-@@ -1851,8 +1851,8 @@ static const struct hid_device_id hid_ha
- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
-- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) },
-- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD) },
-+ { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) },
-+ { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) },
- { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
- { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
- { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
---- a/drivers/hid/hid-ids.h
-+++ b/drivers/hid/hid-ids.h
-@@ -173,8 +173,8 @@
- #define USB_VENDOR_ID_ASUSTEK 0x0b05
- #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
- #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
--#define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585
--#define USB_DEVICE_ID_ASUSTEK_TOUCHPAD 0x0101
-+#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
-+#define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
- #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
- #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
-
diff --git a/patches.drivers/HID-asus-ignore-declared-dummy-usages b/patches.drivers/HID-asus-ignore-declared-dummy-usages
deleted file mode 100644
index 1d026abcfa..0000000000
--- a/patches.drivers/HID-asus-ignore-declared-dummy-usages
+++ /dev/null
@@ -1,81 +0,0 @@
-From 0485b1ec280cb9b2b6ed6e44e999294b4c698182 Mon Sep 17 00:00:00 2001
-From: Matjaz Hegedic <matjaz.hegedic@gmail.com>
-Date: Thu, 9 Mar 2017 00:31:14 +0100
-Subject: [PATCH] HID: asus: ignore declared dummy usages
-Git-commit: 0485b1ec280cb9b2b6ed6e44e999294b4c698182
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1026458
-
-Keyboards handled by hid-asus declare special key functions
-using a vendor-specific page, however, alongside legitimate
-key functions, dummy usages with seemingly arbitrary values
-are also declared and can lead to keyboards being detected
-as pointer devices by some software (such as X.org).
-
-In addition, for the I2C keyboard volume controls are
-separately declared in a Consumer Usage page, with the same
-dummy usage problem.
-
-The fix in 1989dada7ce0 ("HID: input: ignore System Control
-application usages if not System Controls") does not mitigate
-the problem described above, therefore dummy usages need to
-be ignored in the driver itself.
-
-This fix properly ignores dummy usages and introduces a quirk
-for custom handling of the Consumer Usages on the I2C keyboard.
-
-Signed-off-by: Matjaz Hegedic <matjaz.hegedic@gmail.com>
-Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/hid/hid-asus.c | 23 +++++++++++++++++++++--
- 1 file changed, 21 insertions(+), 2 deletions(-)
-
---- a/drivers/hid/hid-asus.c
-+++ b/drivers/hid/hid-asus.c
-@@ -63,9 +63,11 @@ MODULE_DESCRIPTION("Asus HID Keyboard an
- #define QUIRK_NO_INIT_REPORTS BIT(1)
- #define QUIRK_SKIP_INPUT_MAPPING BIT(2)
- #define QUIRK_IS_MULTITOUCH BIT(3)
-+#define QUIRK_NO_CONSUMER_USAGES BIT(4)
-
- #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
-- QUIRK_NO_INIT_REPORTS)
-+ QUIRK_NO_INIT_REPORTS | \
-+ QUIRK_NO_CONSUMER_USAGES)
- #define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
- QUIRK_SKIP_INPUT_MAPPING | \
- QUIRK_IS_MULTITOUCH)
-@@ -242,11 +244,28 @@ static int asus_input_mapping(struct hid
- case 0x5c: asus_map_key_clear(KEY_PROG3); break;
-
- default:
-- return 0;
-+ /* ASUS lazily declares 256 usages, ignore the rest,
-+ * as some make the keyboard appear as a pointer device. */
-+ return -1;
- }
- return 1;
- }
-
-+ if (drvdata->quirks & QUIRK_NO_CONSUMER_USAGES &&
-+ (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
-+ switch (usage->hid & HID_USAGE) {
-+ case 0xe2: /* Mute */
-+ case 0xe9: /* Volume up */
-+ case 0xea: /* Volume down */
-+ return 0;
-+ default:
-+ /* Ignore dummy Consumer usages which make the
-+ * keyboard incorrectly appear as a pointer device.
-+ */
-+ return -1;
-+ }
-+ }
-+
- return 0;
- }
-
diff --git a/patches.drivers/HID-asus-support-Republic-of-Gamers-special-keys b/patches.drivers/HID-asus-support-Republic-of-Gamers-special-keys
deleted file mode 100644
index a729f3a808..0000000000
--- a/patches.drivers/HID-asus-support-Republic-of-Gamers-special-keys
+++ /dev/null
@@ -1,126 +0,0 @@
-From 1caccc2565a83b79dd6e4af15bea35995487a379 Mon Sep 17 00:00:00 2001
-From: Chris Chiu <chiu@endlessm.com>
-Date: Wed, 1 Mar 2017 15:48:51 -0600
-Subject: [PATCH] HID: asus: support Republic of Gamers special keys
-Git-commit: 1caccc2565a83b79dd6e4af15bea35995487a379
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1026458
-
-Add support for the special keys found on the internal keyboard of the
-Asus Republic of Gamers (ROG) laptop models GL553VD, GL553VE, GL753VD
-and GL753VE.
-
-Signed-off-by: Chris Chiu <chiu@endlessm.com>
-Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/hid/Kconfig | 5 ++++-
- drivers/hid/hid-asus.c | 38 ++++++++++++++++++++++++++++++++++++++
- drivers/hid/hid-core.c | 2 ++
- drivers/hid/hid-ids.h | 2 ++
- 4 files changed, 46 insertions(+), 1 deletion(-)
-
---- a/drivers/hid/Kconfig
-+++ b/drivers/hid/Kconfig
-@@ -137,11 +137,14 @@ config HID_APPLEIR
- config HID_ASUS
- tristate "Asus"
- ---help---
-- Support for Asus notebook built-in keyboard and touchpad via i2c.
-+ Support for Asus notebook built-in keyboard and touchpad via i2c, and
-+ the Asus Republic of Gamers laptop keyboard special keys.
-
- Supported devices:
- - EeeBook X205TA
- - VivoBook E200HA
-+ - GL553V series
-+ - GL753V series
-
- config HID_AUREAL
- tristate "Aureal"
---- a/drivers/hid/hid-asus.c
-+++ b/drivers/hid/hid-asus.c
-@@ -199,6 +199,8 @@ static int asus_input_configured(struct
- return 0;
- }
-
-+#define rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
-+ max, EV_KEY, (c))
- static int asus_input_mapping(struct hid_device *hdev,
- struct hid_input *hi, struct hid_field *field,
- struct hid_usage *usage, unsigned long **bit,
-@@ -213,6 +215,38 @@ static int asus_input_mapping(struct hid
- return -1;
- }
-
-+ /* ASUS Republic of Gamers laptop keyboard hotkeys */
-+ if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
-+ set_bit(EV_REP, hi->input->evbit);
-+ switch (usage->hid & HID_USAGE) {
-+ case 0x10: rog_map_key_clear(KEY_BRIGHTNESSDOWN); break;
-+ case 0x20: rog_map_key_clear(KEY_BRIGHTNESSUP); break;
-+ case 0x35: rog_map_key_clear(KEY_DISPLAY_OFF); break;
-+ case 0x6c: rog_map_key_clear(KEY_SLEEP); break;
-+ case 0x82: rog_map_key_clear(KEY_CAMERA); break;
-+ case 0x88: rog_map_key_clear(KEY_WLAN); break;
-+ case 0xb5: rog_map_key_clear(KEY_CALC); break;
-+ case 0xc4: rog_map_key_clear(KEY_KBDILLUMUP); break;
-+ case 0xc5: rog_map_key_clear(KEY_KBDILLUMDOWN); break;
-+
-+ /* ASUS touchpad toggle */
-+ case 0x6b: rog_map_key_clear(KEY_F21); break;
-+
-+ /* ROG key */
-+ case 0x38: rog_map_key_clear(KEY_PROG1); break;
-+
-+ /* Fn+C ASUS Splendid */
-+ case 0xba: rog_map_key_clear(KEY_PROG2); break;
-+
-+ /* Fn+Space Power4Gear Hybrid */
-+ case 0x5c: rog_map_key_clear(KEY_PROG3); break;
-+
-+ default:
-+ return 0;
-+ }
-+ return 1;
-+ }
-+
- return 0;
- }
-
-@@ -323,6 +357,10 @@ static const struct hid_device_id asus_d
- USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
- USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
-+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
-+ USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
-+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
-+ USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
- { }
- };
- MODULE_DEVICE_TABLE(hid, asus_devices);
---- a/drivers/hid/hid-core.c
-+++ b/drivers/hid/hid-core.c
-@@ -1853,6 +1853,8 @@ static const struct hid_device_id hid_ha
- { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) },
- { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD) },
-+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
-+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
- { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
- { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
- { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
---- a/drivers/hid/hid-ids.h
-+++ b/drivers/hid/hid-ids.h
-@@ -175,6 +175,8 @@
- #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
- #define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585
- #define USB_DEVICE_ID_ASUSTEK_TOUCHPAD 0x0101
-+#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
-+#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
-
- #define USB_VENDOR_ID_ATEN 0x0557
- #define USB_DEVICE_ID_ATEN_UC100KM 0x2004
diff --git a/patches.drivers/Input-axp20x-pek-do-not-register-input-device-on-som b/patches.drivers/Input-axp20x-pek-do-not-register-input-device-on-som
deleted file mode 100644
index 1cc958d3c3..0000000000
--- a/patches.drivers/Input-axp20x-pek-do-not-register-input-device-on-som
+++ /dev/null
@@ -1,64 +0,0 @@
-From 9b13a4ca8d2c44ca659d8df65f15c48c2e9b9316 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Thu, 9 Mar 2017 09:55:49 -0800
-Subject: [PATCH] Input: axp20x-pek - do not register input device on some systems
-Git-commit: 9b13a4ca8d2c44ca659d8df65f15c48c2e9b9316
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1035040,boo#1019337
-
-On some systems (Intel tablets with axp288 pmic) the powerbutton is
-also connected to a gpio pin of the SoC, advertised through the
-"INTCFD9" / "PNP0C40" acpi device. This leads to double reporting
-of powerbutton events, which is undesirable, so one driver needs
-to not report input events in this case.
-
-Since the soc_button_array driver for the "PNP0C40" acpi device
-also handles wake from suspend on these tablets and since the
-axp20x-pel driver requires relative expensive i2c accrsses,
-it is best for the axp20x-pek driver to not register an input device
-in this case.
-
-Note that this commit leaves the axp20x-driver bound to the
-device, rather then returning -ENODEV, this is done so that the
-sysfs attributes it offers are kept around.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/axp20x-pek.c | 15 ++++++++++++---
- 1 file changed, 12 insertions(+), 3 deletions(-)
-
---- a/drivers/input/misc/axp20x-pek.c
-+++ b/drivers/input/misc/axp20x-pek.c
-@@ -13,6 +13,7 @@
- * GNU General Public License for more details.
- */
-
-+#include <linux/acpi.h>
- #include <linux/errno.h>
- #include <linux/irq.h>
- #include <linux/init.h>
-@@ -267,9 +268,17 @@ static int axp20x_pek_probe(struct platf
-
- axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
-
-- error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
-- if (error)
-- return error;
-+ /*
-+ * Do not register the input device if there is an "INTCFD9"
-+ * gpio button ACPI device, that handles the power button too,
-+ * and otherwise we end up reporting all presses twice.
-+ */
-+ if (!acpi_dev_found("INTCFD9") ||
-+ !IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY)) {
-+ error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
-+ if (error)
-+ return error;
-+ }
-
- error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
- if (error) {
diff --git a/patches.drivers/Input-axp20x-pek-use-our-own-device-for-errors b/patches.drivers/Input-axp20x-pek-use-our-own-device-for-errors
deleted file mode 100644
index 63cce4b1d5..0000000000
--- a/patches.drivers/Input-axp20x-pek-use-our-own-device-for-errors
+++ /dev/null
@@ -1,61 +0,0 @@
-From 73915f369e6957c0d7ddca9f7435cc6f76d5320a Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Thu, 9 Mar 2017 09:47:01 -0800
-Subject: [PATCH] Input: axp20x-pek - use our own device for errors
-Git-commit: 73915f369e6957c0d7ddca9f7435cc6f76d5320a
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1035040,boo#1019337
-
-Before this commit axp20x-pek was mixing 2 style error reporting calls:
-dev_err(&pdev->dev, ...);
-dev_err(axp20x->dev, ...);
-
-But the second is our parent device, not our own device, so switch to
-using &pdev->dev everywhere.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/axp20x-pek.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
---- a/drivers/input/misc/axp20x-pek.c
-+++ b/drivers/input/misc/axp20x-pek.c
-@@ -239,7 +239,7 @@ static int axp20x_pek_probe(struct platf
- axp20x_pek_irq, 0,
- "axp20x-pek-dbr", idev);
- if (error < 0) {
-- dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
-+ dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n",
- axp20x_pek->irq_dbr, error);
- return error;
- }
-@@ -248,14 +248,14 @@ static int axp20x_pek_probe(struct platf
- axp20x_pek_irq, 0,
- "axp20x-pek-dbf", idev);
- if (error < 0) {
-- dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
-+ dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n",
- axp20x_pek->irq_dbf, error);
- return error;
- }
-
- error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
- if (error) {
-- dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n",
-+ dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
- error);
- return error;
- }
-@@ -271,7 +271,7 @@ static int axp20x_pek_probe(struct platf
-
- error = input_register_device(idev);
- if (error) {
-- dev_err(axp20x->dev, "Can't register input device: %d\n",
-+ dev_err(&pdev->dev, "Can't register input device: %d\n",
- error);
- return error;
- }
diff --git a/patches.drivers/Input-axp20x_pek-add-axp20x_pek_probe_input_device-h b/patches.drivers/Input-axp20x_pek-add-axp20x_pek_probe_input_device-h
deleted file mode 100644
index 5c4c4ce1a0..0000000000
--- a/patches.drivers/Input-axp20x_pek-add-axp20x_pek_probe_input_device-h
+++ /dev/null
@@ -1,101 +0,0 @@
-From f2bd5a9ec5edc307e5f84dc9df14253898e19678 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Thu, 9 Mar 2017 09:47:24 -0800
-Subject: [PATCH] Input: axp20x_pek - add axp20x_pek_probe_input_device helper
-Git-commit: f2bd5a9ec5edc307e5f84dc9df14253898e19678
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: bsc#1035040,boo#1019337
-
-Move all input device related initialization into a new
-axp20x_pek_probe_input_device helper function.
-
-This introduces one functional change, the input device is now
-registered before the sysfs attr get registered. This is not a problem
-as the sysfs attr are to configure some long press settings (forced
-poweroff) in the hardware and do not interact with the input_device.
-
-This is a preparation patch for not always registering the input dev.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/axp20x-pek.c | 47 ++++++++++++++++++++++++----------------
- 1 file changed, 29 insertions(+), 18 deletions(-)
-
---- a/drivers/input/misc/axp20x-pek.c
-+++ b/drivers/input/misc/axp20x-pek.c
-@@ -188,21 +188,13 @@ static void axp20x_remove_sysfs_group(vo
- sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
- }
-
--static int axp20x_pek_probe(struct platform_device *pdev)
-+static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
-+ struct platform_device *pdev)
- {
-- struct axp20x_pek *axp20x_pek;
-- struct axp20x_dev *axp20x;
-+ struct axp20x_dev *axp20x = axp20x_pek->axp20x;
- struct input_dev *idev;
- int error;
-
-- axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
-- GFP_KERNEL);
-- if (!axp20x_pek)
-- return -ENOMEM;
--
-- axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
-- axp20x = axp20x_pek->axp20x;
--
- axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
- if (axp20x_pek->irq_dbr < 0) {
- dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
-@@ -253,6 +245,32 @@ static int axp20x_pek_probe(struct platf
- return error;
- }
-
-+ error = input_register_device(idev);
-+ if (error) {
-+ dev_err(&pdev->dev, "Can't register input device: %d\n",
-+ error);
-+ return error;
-+ }
-+
-+ return 0;
-+}
-+
-+static int axp20x_pek_probe(struct platform_device *pdev)
-+{
-+ struct axp20x_pek *axp20x_pek;
-+ int error;
-+
-+ axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
-+ GFP_KERNEL);
-+ if (!axp20x_pek)
-+ return -ENOMEM;
-+
-+ axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
-+
-+ error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
-+ if (error)
-+ return error;
-+
- error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
- if (error) {
- dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
-@@ -268,13 +286,6 @@ static int axp20x_pek_probe(struct platf
- error);
- return error;
- }
--
-- error = input_register_device(idev);
-- if (error) {
-- dev_err(&pdev->dev, "Can't register input device: %d\n",
-- error);
-- return error;
-- }
-
- platform_set_drvdata(pdev, axp20x_pek);
-
diff --git a/patches.drivers/Input-soc_button_array-Propagate-error-from-gpiod_co b/patches.drivers/Input-soc_button_array-Propagate-error-from-gpiod_co
deleted file mode 100644
index 1128c7cc78..0000000000
--- a/patches.drivers/Input-soc_button_array-Propagate-error-from-gpiod_co
+++ /dev/null
@@ -1,40 +0,0 @@
-From c5097538c86a60c655f7fac33dfd565d22909dae Mon Sep 17 00:00:00 2001
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Date: Mon, 20 Feb 2017 18:15:49 +0200
-Subject: [PATCH] Input: soc_button_array - Propagate error from gpiod_count()
-Git-commit: c5097538c86a60c655f7fac33dfd565d22909dae
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1019337,boo#1034642
-
-Since gpiod_count() does not return 0 anymore, we don't need to shadow
-its error code and would safely propagate to the user.
-
-While here, replace second parameter by NULL in order to prevent side
-effects on _DSD enabled firmware.
-
-Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/soc_button_array.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
---- a/drivers/input/misc/soc_button_array.c
-+++ b/drivers/input/misc/soc_button_array.c
-@@ -169,9 +169,10 @@ static int soc_button_probe(struct platf
-
- button_info = (struct soc_button_info *)id->driver_data;
-
-- if (gpiod_count(dev, NULL) <= 0) {
-+ error = gpiod_count(dev, NULL);
-+ if (error < 0) {
- dev_dbg(dev, "no GPIO attached, ignoring...\n");
-- return -ENODEV;
-+ return error;
- }
-
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
diff --git a/patches.drivers/Input-soc_button_array-add-support-for-ACPI-6.0-Gene b/patches.drivers/Input-soc_button_array-add-support-for-ACPI-6.0-Gene
deleted file mode 100644
index f8e58673d8..0000000000
--- a/patches.drivers/Input-soc_button_array-add-support-for-ACPI-6.0-Gene
+++ /dev/null
@@ -1,222 +0,0 @@
-From 4c3362f44980aba8e1e69cd6970effbd9f17dc69 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 17 Mar 2017 14:03:54 -0700
-Subject: [PATCH] Input: soc_button_array - add support for ACPI 6.0 Generic Button Device
-Git-commit: 4c3362f44980aba8e1e69cd6970effbd9f17dc69
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1019337,boo#1034642
-
-Windows 10 tablets with gpio buttons will typically use the ACPI 6.0
-Generic Button Device with a HID of ACPI0011 for these buttons.
-
-The ACPI description for these in the ACPI0011 devices _DSD object uses
-something resembling HID descriptors, except that instead of indicating
-a bit index into a HID input report, the index indicates the _CRS index
-for the GPIO.
-
-The use of 1 interrupt per button, some of which need to be wakeup
-sources, instead of using input reports makes it impossible to use the
-HID subsystem for this.
-
-This really is just another gpio-keys input device with the platform
-data described in ACPI, so this commit adds parsing for this new way
-to describe gpio-keys to the soc_button_array driver.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/soc_button_array.c | 159 +++++++++++++++++++++++++++++++++-
- 1 file changed, 158 insertions(+), 1 deletion(-)
-
---- a/drivers/input/misc/soc_button_array.c
-+++ b/drivers/input/misc/soc_button_array.c
-@@ -138,6 +138,153 @@ err_free_mem:
- return ERR_PTR(error);
- }
-
-+static int soc_button_get_acpi_object_int(const union acpi_object *obj)
-+{
-+ if (obj->type != ACPI_TYPE_INTEGER)
-+ return -1;
-+
-+ return obj->integer.value;
-+}
-+
-+/* Parse a single ACPI0011 _DSD button descriptor */
-+static int soc_button_parse_btn_desc(struct device *dev,
-+ const union acpi_object *desc,
-+ int collection_uid,
-+ struct soc_button_info *info)
-+{
-+ int upage, usage;
-+
-+ if (desc->type != ACPI_TYPE_PACKAGE ||
-+ desc->package.count != 5 ||
-+ /* First byte should be 1 (control) */
-+ soc_button_get_acpi_object_int(&desc->package.elements[0]) != 1 ||
-+ /* Third byte should be collection uid */
-+ soc_button_get_acpi_object_int(&desc->package.elements[2]) !=
-+ collection_uid) {
-+ dev_err(dev, "Invalid ACPI Button Descriptor\n");
-+ return -ENODEV;
-+ }
-+
-+ info->event_type = EV_KEY;
-+ info->acpi_index =
-+ soc_button_get_acpi_object_int(&desc->package.elements[1]);
-+ upage = soc_button_get_acpi_object_int(&desc->package.elements[3]);
-+ usage = soc_button_get_acpi_object_int(&desc->package.elements[4]);
-+
-+ /*
-+ * The UUID: fa6bd625-9ce8-470d-a2c7-b3ca36c4282e descriptors use HID
-+ * usage page and usage codes, but otherwise the device is not HID
-+ * compliant: it uses one irq per button instead of generating HID
-+ * input reports and some buttons should generate wakeups where as
-+ * others should not, so we cannot use the HID subsystem.
-+ *
-+ * Luckily all devices only use a few usage page + usage combinations,
-+ * so we can simply check for the known combinations here.
-+ */
-+ if (upage == 0x01 && usage == 0x81) {
-+ info->name = "power";
-+ info->event_code = KEY_POWER;
-+ info->wakeup = true;
-+ } else if (upage == 0x07 && usage == 0xe3) {
-+ info->name = "home";
-+ info->event_code = KEY_HOMEPAGE;
-+ info->wakeup = true;
-+ } else if (upage == 0x0c && usage == 0xe9) {
-+ info->name = "volume_up";
-+ info->event_code = KEY_VOLUMEUP;
-+ info->autorepeat = true;
-+ } else if (upage == 0x0c && usage == 0xea) {
-+ info->name = "volume_down";
-+ info->event_code = KEY_VOLUMEDOWN;
-+ info->autorepeat = true;
-+ } else {
-+ dev_warn(dev, "Unknown button index %d upage %02x usage %02x, ignoring\n",
-+ info->acpi_index, upage, usage);
-+ info->name = "unknown";
-+ info->event_code = KEY_RESERVED;
-+ }
-+
-+ return 0;
-+}
-+
-+/* ACPI0011 _DSD btns descriptors UUID: fa6bd625-9ce8-470d-a2c7-b3ca36c4282e */
-+static const u8 btns_desc_uuid[16] = {
-+ 0x25, 0xd6, 0x6b, 0xfa, 0xe8, 0x9c, 0x0d, 0x47,
-+ 0xa2, 0xc7, 0xb3, 0xca, 0x36, 0xc4, 0x28, 0x2e
-+};
-+
-+/* Parse ACPI0011 _DSD button descriptors */
-+static struct soc_button_info *soc_button_get_button_info(struct device *dev)
-+{
-+ struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
-+ const union acpi_object *desc, *el0, *uuid, *btns_desc = NULL;
-+ struct soc_button_info *button_info;
-+ acpi_status status;
-+ int i, btn, collection_uid = -1;
-+
-+ status = acpi_evaluate_object_typed(ACPI_HANDLE(dev), "_DSD", NULL,
-+ &buf, ACPI_TYPE_PACKAGE);
-+ if (ACPI_FAILURE(status)) {
-+ dev_err(dev, "ACPI _DSD object not found\n");
-+ return ERR_PTR(-ENODEV);
-+ }
-+
-+ /* Look for the Button Descriptors UUID */
-+ desc = buf.pointer;
-+ for (i = 0; (i + 1) < desc->package.count; i += 2) {
-+ uuid = &desc->package.elements[i];
-+
-+ if (uuid->type != ACPI_TYPE_BUFFER ||
-+ uuid->buffer.length != 16 ||
-+ desc->package.elements[i + 1].type != ACPI_TYPE_PACKAGE) {
-+ break;
-+ }
-+
-+ if (memcmp(uuid->buffer.pointer, btns_desc_uuid, 16) == 0) {
-+ btns_desc = &desc->package.elements[i + 1];
-+ break;
-+ }
-+ }
-+
-+ if (!btns_desc) {
-+ dev_err(dev, "ACPI Button Descriptors not found\n");
-+ return ERR_PTR(-ENODEV);
-+ }
-+
-+ /* The first package describes the collection */
-+ el0 = &btns_desc->package.elements[0];
-+ if (el0->type == ACPI_TYPE_PACKAGE &&
-+ el0->package.count == 5 &&
-+ /* First byte should be 0 (collection) */
-+ soc_button_get_acpi_object_int(&el0->package.elements[0]) == 0 &&
-+ /* Third byte should be 0 (top level collection) */
-+ soc_button_get_acpi_object_int(&el0->package.elements[2]) == 0) {
-+ collection_uid = soc_button_get_acpi_object_int(
-+ &el0->package.elements[1]);
-+ }
-+ if (collection_uid == -1) {
-+ dev_err(dev, "Invalid Button Collection Descriptor\n");
-+ return ERR_PTR(-ENODEV);
-+ }
-+
-+ /* There are package.count - 1 buttons + 1 terminating empty entry */
-+ button_info = devm_kcalloc(dev, btns_desc->package.count,
-+ sizeof(*button_info), GFP_KERNEL);
-+ if (!button_info)
-+ return ERR_PTR(-ENOMEM);
-+
-+ /* Parse the button descriptors */
-+ for (i = 1, btn = 0; i < btns_desc->package.count; i++, btn++) {
-+ if (soc_button_parse_btn_desc(dev,
-+ &btns_desc->package.elements[i],
-+ collection_uid,
-+ &button_info[btn]))
-+ return ERR_PTR(-ENODEV);
-+ }
-+
-+ return button_info;
-+}
-+
- static int soc_button_remove(struct platform_device *pdev)
- {
- struct soc_button_data *priv = platform_get_drvdata(pdev);
-@@ -165,7 +312,13 @@ static int soc_button_probe(struct platf
- if (!id)
- return -ENODEV;
-
-- button_info = (struct soc_button_info *)id->driver_data;
-+ if (!id->driver_data) {
-+ button_info = soc_button_get_button_info(dev);
-+ if (IS_ERR(button_info))
-+ return PTR_ERR(button_info);
-+ } else {
-+ button_info = (struct soc_button_info *)id->driver_data;
-+ }
-
- error = gpiod_count(dev, NULL);
- if (error < 0) {
-@@ -196,6 +349,9 @@ static int soc_button_probe(struct platf
- if (!priv->children[0] && !priv->children[1])
- return -ENODEV;
-
-+ if (!id->driver_data)
-+ devm_kfree(dev, button_info);
-+
- return 0;
- }
-
-@@ -215,6 +371,7 @@ static struct soc_button_info soc_button
-
- static const struct acpi_device_id soc_button_acpi_match[] = {
- { "PNP0C40", (unsigned long)soc_button_PNP0C40 },
-+ { "ACPI0011", 0 },
- { }
- };
-
diff --git a/patches.drivers/Input-soc_button_array-get-rid-of-MAX_NBUTTONS b/patches.drivers/Input-soc_button_array-get-rid-of-MAX_NBUTTONS
deleted file mode 100644
index 677595b98a..0000000000
--- a/patches.drivers/Input-soc_button_array-get-rid-of-MAX_NBUTTONS
+++ /dev/null
@@ -1,70 +0,0 @@
-From 7283b47d5d4d8e6528a08dc6c7ac6ff7cfed66d9 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Fri, 17 Mar 2017 14:03:28 -0700
-Subject: [PATCH] Input: soc_button_array - get rid of MAX_NBUTTONS
-Git-commit: 7283b47d5d4d8e6528a08dc6c7ac6ff7cfed66d9
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1019337,boo#1034642
-
-Count how much gpio_keys we actually need, this is a preparation patch
-for adding support for the new Win10 / ACPI-6.0 "Generic Buttons Device"
-support.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/soc_button_array.c | 19 +++++++++++--------
- 1 file changed, 11 insertions(+), 8 deletions(-)
-
---- a/drivers/input/misc/soc_button_array.c
-+++ b/drivers/input/misc/soc_button_array.c
-@@ -20,13 +20,6 @@
- #include <linux/gpio.h>
- #include <linux/platform_device.h>
-
--/*
-- * Definition of buttons on the tablet. The ACPI index of each button
-- * is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC
-- * Platforms"
-- */
--#define MAX_NBUTTONS 5
--
- struct soc_button_info {
- const char *name;
- int acpi_index;
-@@ -79,14 +72,19 @@ soc_button_device_create(struct platform
- int gpio;
- int error;
-
-+ for (info = button_info; info->name; info++)
-+ if (info->autorepeat == autorepeat)
-+ n_buttons++;
-+
- gpio_keys_pdata = devm_kzalloc(&pdev->dev,
- sizeof(*gpio_keys_pdata) +
-- sizeof(*gpio_keys) * MAX_NBUTTONS,
-+ sizeof(*gpio_keys) * n_buttons,
- GFP_KERNEL);
- if (!gpio_keys_pdata)
- return ERR_PTR(-ENOMEM);
-
- gpio_keys = (void *)(gpio_keys_pdata + 1);
-+ n_buttons = 0;
-
- for (info = button_info; info->name; info++) {
- if (info->autorepeat != autorepeat)
-@@ -201,6 +199,11 @@ static int soc_button_probe(struct platf
- return 0;
- }
-
-+/*
-+ * Definition of buttons on the tablet. The ACPI index of each button
-+ * is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC
-+ * Platforms"
-+ */
- static struct soc_button_info soc_button_PNP0C40[] = {
- { "power", 0, EV_KEY, KEY_POWER, false, true },
- { "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
diff --git a/patches.drivers/Input-soc_button_array-properly-map-usage-0x07-0xe3 b/patches.drivers/Input-soc_button_array-properly-map-usage-0x07-0xe3
deleted file mode 100644
index 2200342b58..0000000000
--- a/patches.drivers/Input-soc_button_array-properly-map-usage-0x07-0xe3
+++ /dev/null
@@ -1,37 +0,0 @@
-From dd224085d73ab04d14fe78a5fd9970fa808a60fb Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Mon, 10 Apr 2017 20:34:19 -0700
-Subject: [PATCH] Input: soc_button_array - properly map usage 0x07/0xe3 to KEY_LEFTMETA
-Git-commit: dd224085d73ab04d14fe78a5fd9970fa808a60fb
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1019337,boo#1034642
-
-When submitting the support for the ACPI0011 windows tablet keys device I
-mapped the "windows" logo homekey to KEY_HOMEPAGE. But this is inconsistent
-with how it is done on windows tablets using the old PNP0C40 ACPI device
-and it does not match the HUT spec, which says that usage-page 7 usage 0xe3
-is "Keyboard Left GUI".
-
-This commit maps usage-page 7 usage 0xe3 to KEY_LEFTMETA fixing this.
-
-Fixes: 4c3362f44980 ("Input: soc_button_array - add support for ACPI 6.0...")
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/soc_button_array.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/input/misc/soc_button_array.c
-+++ b/drivers/input/misc/soc_button_array.c
-@@ -187,7 +187,7 @@ static int soc_button_parse_btn_desc(str
- info->wakeup = true;
- } else if (upage == 0x07 && usage == 0xe3) {
- info->name = "home";
-- info->event_code = KEY_HOMEPAGE;
-+ info->event_code = KEY_LEFTMETA;
- info->wakeup = true;
- } else if (upage == 0x0c && usage == 0xe9) {
- info->name = "volume_up";
diff --git a/patches.drivers/Input-soc_button_array-use-NULL-for-GPIO-connection b/patches.drivers/Input-soc_button_array-use-NULL-for-GPIO-connection
deleted file mode 100644
index 0b70259223..0000000000
--- a/patches.drivers/Input-soc_button_array-use-NULL-for-GPIO-connection
+++ /dev/null
@@ -1,44 +0,0 @@
-From a01cd17000a4eb35060666f181f1d46832b59030 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Thu, 9 Mar 2017 09:58:30 -0800
-Subject: [PATCH] Input: soc_button_array - use NULL for GPIO connection ID
-Git-commit: a01cd17000a4eb35060666f181f1d46832b59030
-Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
-Patch-mainline: Queued in subsystem maintainer repo
-References: boo#1019337,boo#1034642
-
-The gpiolib-acpi code is becoming more strict and connection-IDs
-may only be used with devices which have a _DSD with matching IDs
-in there. Since the soc_button_array ACPI binding is pure index
-based pass in NULL as connection-ID to avoid the more strict cheks
-resulting in gpiod_count and gpiod_get_index not returning any gpios.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/input/misc/soc_button_array.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/input/misc/soc_button_array.c
-+++ b/drivers/input/misc/soc_button_array.c
-@@ -55,7 +55,7 @@ static int soc_button_lookup_gpio(struct
- struct gpio_desc *desc;
- int gpio;
-
-- desc = gpiod_get_index(dev, KBUILD_MODNAME, acpi_index, GPIOD_ASIS);
-+ desc = gpiod_get_index(dev, NULL, acpi_index, GPIOD_ASIS);
- if (IS_ERR(desc))
- return PTR_ERR(desc);
-
-@@ -169,7 +169,7 @@ static int soc_button_probe(struct platf
-
- button_info = (struct soc_button_info *)id->driver_data;
-
-- if (gpiod_count(dev, KBUILD_MODNAME) <= 0) {
-+ if (gpiod_count(dev, NULL) <= 0) {
- dev_dbg(dev, "no GPIO attached, ignoring...\n");
- return -ENODEV;
- }
diff --git a/patches.drivers/dell-laptop-Adds-support-for-keyboard-backlight-timeout b/patches.drivers/dell-laptop-Adds-support-for-keyboard-backlight-timeout
deleted file mode 100644
index 88bf06a1af..0000000000
--- a/patches.drivers/dell-laptop-Adds-support-for-keyboard-backlight-timeout
+++ /dev/null
@@ -1,193 +0,0 @@
-From bcf7d8a30e2888f78a19778a16d3dd8c10b4b0ad Mon Sep 17 00:00:00 2001
-From: Pali Rohár <pali.rohar@gmail.com>
-Date: Sun, 23 Apr 2017 21:40:47 +0200
-Subject: [PATCH] platform/x86: dell-laptop: Add keyboard backlight timeout AC
- settings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=utf8
-Content-Transfer-Encoding: 8bit
-Git-commit: bcf7d8a30e2888f78a19778a16d3dd8c10b4b0ad
-Patch-mainline: Queued in subsystem maintainer repository
-Git-repo: git://git.infradead.org/linux-platform-drivers-x86.git
-References: bsc#1013561
-
-When changing keyboard backlight state on new Dell laptops, firmware
-expects a new timeout AC value filled in Set New State SMBIOS call.
-
-Without it any change of keyboard backlight state on new Dell laptops
-fails. And user can see following error message in dmesg:
-
- dell_laptop: Setting old previous keyboard state failed
- leds dell::kbd_backlight: Setting an LED's brightness failed (-6)
-
-This patch adds support for retrieving current timeout AC values and also
-updating them. Current timeout value in sysfs is displayed based on current
-AC status, like current display brightness value.
-
-Detection if Dell laptop supports or not new timeout AC settings is done by
-checking existence of Keyboard Backlight with AC SMBIOS token (0x0451).
-
-Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
-Acked-by: Mario Limonciello <mario.limonciello@dell.com>
-Tested-by: Arcadiy Ivanov <arcadiy@ivanov.biz>
-[andy: fixed merge conflict with defined constants]
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Acked-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/platform/x86/dell-laptop.c | 59 +++++++++++++++++++++++++++++++++----
- 1 file changed, 53 insertions(+), 6 deletions(-)
-
---- a/drivers/platform/x86/dell-laptop.c
-+++ b/drivers/platform/x86/dell-laptop.c
-@@ -42,6 +42,7 @@
- #define KBD_LED_AUTO_50_TOKEN 0x02EB
- #define KBD_LED_AUTO_75_TOKEN 0x02EC
- #define KBD_LED_AUTO_100_TOKEN 0x02F6
-+#define KBD_LED_AC_TOKEN 0x0451
-
- struct quirk_entry {
- u8 touchpad_led;
-@@ -1024,7 +1025,7 @@ static void touchpad_led_exit(void)
- * bit 2 Pointing stick
- * bit 3 Any mouse
- * bits 4-7 Reserved for future use
-- * cbRES2, byte3 Current Timeout
-+ * cbRES2, byte3 Current Timeout on battery
- * bits 7:6 Timeout units indicator:
- * 00b Seconds
- * 01b Minutes
-@@ -1036,6 +1037,15 @@ static void touchpad_led_exit(void)
- * cbRES3, byte0 Current setting of ALS value that turns the light on or off.
- * cbRES3, byte1 Current ALS reading
- * cbRES3, byte2 Current keyboard light level.
-+ * cbRES3, byte3 Current timeout on AC Power
-+ * bits 7:6 Timeout units indicator:
-+ * 00b Seconds
-+ * 01b Minutes
-+ * 10b Hours
-+ * 11b Days
-+ * Bits 5:0 Timeout value (0-63) in sec/min/hr/day
-+ * NOTE: A value of 0 means always on (no timeout) if any bits of RES3 byte2
-+ * are set upon return from the upon return from the [Get Feature information] call.
- *
- * cbArg1 0x2 = Set New State
- * cbRES1 Standard return codes (0, -1, -2)
-@@ -1058,7 +1068,7 @@ static void touchpad_led_exit(void)
- * bit 2 Pointing stick
- * bit 3 Any mouse
- * bits 4-7 Reserved for future use
-- * cbArg2, byte3 Desired Timeout
-+ * cbArg2, byte3 Desired Timeout on battery
- * bits 7:6 Timeout units indicator:
- * 00b Seconds
- * 01b Minutes
-@@ -1067,6 +1077,13 @@ static void touchpad_led_exit(void)
- * bits 5:0 Timeout value (0-63) in sec/min/hr/day
- * cbArg3, byte0 Desired setting of ALS value that turns the light on or off.
- * cbArg3, byte2 Desired keyboard light level.
-+ * cbArg3, byte3 Desired Timeout on AC power
-+ * bits 7:6 Timeout units indicator:
-+ * 00b Seconds
-+ * 01b Minutes
-+ * 10b Hours
-+ * 11b Days
-+ * bits 5:0 Timeout value (0-63) in sec/min/hr/day
- */
-
-
-@@ -1112,6 +1129,8 @@ struct kbd_state {
- u8 triggers;
- u8 timeout_value;
- u8 timeout_unit;
-+ u8 timeout_value_ac;
-+ u8 timeout_unit_ac;
- u8 als_setting;
- u8 als_value;
- u8 level;
-@@ -1131,6 +1150,7 @@ static u16 kbd_token_bits;
- static struct kbd_info kbd_info;
- static bool kbd_als_supported;
- static bool kbd_triggers_supported;
-+static bool kbd_timeout_ac_supported;
-
- static u8 kbd_mode_levels[16];
- static int kbd_mode_levels_count;
-@@ -1269,6 +1289,8 @@ static int kbd_get_state(struct kbd_stat
- state->als_setting = buffer->output[2] & 0xFF;
- state->als_value = (buffer->output[2] >> 8) & 0xFF;
- state->level = (buffer->output[2] >> 16) & 0xFF;
-+ state->timeout_value_ac = (buffer->output[2] >> 24) & 0x3F;
-+ state->timeout_unit_ac = (buffer->output[2] >> 30) & 0x3;
-
- out:
- dell_smbios_release_buffer();
-@@ -1288,6 +1310,8 @@ static int kbd_set_state(struct kbd_stat
- buffer->input[1] |= (state->timeout_unit & 0x3) << 30;
- buffer->input[2] = state->als_setting & 0xFF;
- buffer->input[2] |= (state->level & 0xFF) << 16;
-+ buffer->input[2] |= (state->timeout_value_ac & 0x3F) << 24;
-+ buffer->input[2] |= (state->timeout_unit_ac & 0x3) << 30;
- dell_smbios_send_request(4, 11);
- ret = buffer->output[0];
- dell_smbios_release_buffer();
-@@ -1394,6 +1418,13 @@ static inline int kbd_init_info(void)
- if (ret)
- return ret;
-
-+ /* NOTE: Old models without KBD_LED_AC_TOKEN token supports only one
-+ * timeout value which is shared for both battery and AC power
-+ * settings. So do not try to set AC values on old models.
-+ */
-+ if (dell_smbios_find_token(KBD_LED_AC_TOKEN))
-+ kbd_timeout_ac_supported = true;
-+
- kbd_get_state(&state);
-
- /* NOTE: timeout value is stored in 6 bits so max value is 63 */
-@@ -1573,8 +1604,14 @@ static ssize_t kbd_led_timeout_store(str
- return ret;
-
- new_state = state;
-- new_state.timeout_value = value;
-- new_state.timeout_unit = unit;
-+
-+ if (kbd_timeout_ac_supported && power_supply_is_system_supplied() > 0) {
-+ new_state.timeout_value_ac = value;
-+ new_state.timeout_unit_ac = unit;
-+ } else {
-+ new_state.timeout_value = value;
-+ new_state.timeout_unit = unit;
-+ }
-
- ret = kbd_set_state_safe(&new_state, &state);
- if (ret)
-@@ -1587,16 +1624,26 @@ static ssize_t kbd_led_timeout_show(stru
- struct device_attribute *attr, char *buf)
- {
- struct kbd_state state;
-+ int value;
- int ret;
- int len;
-+ u8 unit;
-
- ret = kbd_get_state(&state);
- if (ret)
- return ret;
-
-- len = sprintf(buf, "%d", state.timeout_value);
-+ if (kbd_timeout_ac_supported && power_supply_is_system_supplied() > 0) {
-+ value = state.timeout_value_ac;
-+ unit = state.timeout_unit_ac;
-+ } else {
-+ value = state.timeout_value;
-+ unit = state.timeout_unit;
-+ }
-+
-+ len = sprintf(buf, "%d", value);
-
-- switch (state.timeout_unit) {
-+ switch (unit) {
- case KBD_TIMEOUT_SECONDS:
- return len + sprintf(buf+len, "s\n");
- case KBD_TIMEOUT_MINUTES:
diff --git a/patches.drivers/ppc64-adb b/patches.drivers/ppc64-adb
deleted file mode 100644
index fe87d3127b..0000000000
--- a/patches.drivers/ppc64-adb
+++ /dev/null
@@ -1,53 +0,0 @@
-From: Olaf Hering <olh@suse.de>
-Subject: enable mouse button emulation also for G5
-Patch-mainline: never
-
-fix compile errors
-
- drivers/macintosh/Kconfig | 2 +-
- drivers/macintosh/adb.c | 4 ++++
- drivers/macintosh/adbhid.c | 6 +++++-
- 3 files changed, 10 insertions(+), 2 deletions(-)
-
---- a/drivers/macintosh/Kconfig
-+++ b/drivers/macintosh/Kconfig
-@@ -13,7 +13,7 @@ if MACINTOSH_DRIVERS
-
- config ADB
- bool "Apple Desktop Bus (ADB) support"
-- depends on MAC || (PPC_PMAC && PPC32)
-+ depends on MAC || PPC_PMAC
- help
- Apple Desktop Bus (ADB) support is for support of devices which
- are connected to an ADB port. ADB devices tend to have 4 pins.
---- a/drivers/macintosh/adb.c
-+++ b/drivers/macintosh/adb.c
-@@ -298,6 +298,10 @@ static int __init adb_init(void)
- if (!machine_is(chrp) && !machine_is(powermac))
- return 0;
- #endif
-+#ifdef CONFIG_PPC64
-+ if (!machine_is(powermac))
-+ return 0;
-+#endif
- #ifdef CONFIG_MAC
- if (!MACH_IS_MAC)
- return 0;
---- a/drivers/macintosh/adbhid.c
-+++ b/drivers/macintosh/adbhid.c
-@@ -1264,10 +1264,14 @@ init_ms_a3(int id)
-
- static int __init adbhid_init(void)
- {
--#ifndef CONFIG_MAC
-+#ifdef CONFIG_PPC32
- if (!machine_is(chrp) && !machine_is(powermac))
- return 0;
- #endif
-+#ifdef CONFIG_PPC64
-+ if (!machine_is(powermac))
-+ return 0;
-+#endif
-
- led_request.complete = 1;
-
diff --git a/patches.drivers/pstore_disable_efi_backend_by_default.patch b/patches.drivers/pstore_disable_efi_backend_by_default.patch
index 00e0d5b072..aa5c9ccedb 100644
--- a/patches.drivers/pstore_disable_efi_backend_by_default.patch
+++ b/patches.drivers/pstore_disable_efi_backend_by_default.patch
@@ -10,10 +10,15 @@ While the memory area can be used by other efi based instances, pstore
would heavily write data to it, increasing the risk of damage a lot.
Signed-off-by: Thomas Renninger <trenn@suse.de>
+---
+ fs/pstore/platform.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
+index d468eec9b8a6..ff500e39a95d 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
-@@ -442,6 +442,13 @@
+@@ -669,6 +669,13 @@ int pstore_register(struct pstore_info *psi)
{
struct module *owner = psi->owner;
@@ -24,6 +29,9 @@ Signed-off-by: Thomas Renninger <trenn@suse.de>
+ return -EINVAL;
+ }
+
- if (backend && strcmp(backend, psi->name))
+ if (backend && strcmp(backend, psi->name)) {
+ pr_warn("ignoring unexpected backend '%s'\n", psi->name);
return -EPERM;
-
+--
+2.13.0
+
diff --git a/patches.drivers/rt2800-fix-TX_PIN_CFG-setting-for-non-MT7620-chips b/patches.drivers/rt2800-fix-TX_PIN_CFG-setting-for-non-MT7620-chips
new file mode 100644
index 0000000000..9dabedab4e
--- /dev/null
+++ b/patches.drivers/rt2800-fix-TX_PIN_CFG-setting-for-non-MT7620-chips
@@ -0,0 +1,40 @@
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+Date: Fri, 25 Aug 2017 17:04:15 +0200
+Subject: [PATCH] rt2800: fix TX_PIN_CFG setting for non MT7620 chips
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
+Patch-mainline: Queued in subsystem maintainer repository
+Git-commit: 83ec489193894e52bd395eec470f4f7c4286d4a5
+References: bsc#1055826
+
+Since commit 41977e86c984 ("rt2x00: add support for MT7620") we do not
+initialize TX_PIN_CFG setting. This cause breakage at least on some
+RT3573 devices. To fix the problem patch restores previous behaviour
+for non MT7620 chips.
+
+Fixes: 41977e86c984 ("rt2x00: add support for MT7620")
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1480829
+Reported-and-tested-by: Jussi Eloranta <jussi.eloranta@csun.edu>
+Cc: Daniel Golle <daniel@makrotopia.org>
+Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
+Acked-by: Daniel Golle <daniel@makrotopia.org>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+@@ -3702,7 +3702,10 @@ static void rt2800_config_channel(struct
+ if (rt2x00_rt(rt2x00dev, RT3572))
+ rt2800_rfcsr_write(rt2x00dev, 8, 0);
+
+- tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG);
++ if (rt2x00_rt(rt2x00dev, RT6352))
++ tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG);
++ else
++ tx_pin = 0;
+
+ switch (rt2x00dev->default_ant.tx_chain_num) {
+ case 3:
diff --git a/patches.drivers/scsi-qla2xxx-Fix-an-integer-overflow-in-sysfs-code.patch b/patches.drivers/scsi-qla2xxx-Fix-an-integer-overflow-in-sysfs-code.patch
new file mode 100644
index 0000000000..8ad35bc90c
--- /dev/null
+++ b/patches.drivers/scsi-qla2xxx-Fix-an-integer-overflow-in-sysfs-code.patch
@@ -0,0 +1,66 @@
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Wed, 30 Aug 2017 16:30:35 +0300
+Subject: scsi: qla2xxx: Fix an integer overflow in sysfs code
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
+Git-commit: e6f77540c067b48dee10f1e33678415bfcc89017
+References: bsc#1056588, CVE-2017-14051
+
+The value of "size" comes from the user. When we add "start + size" it
+could lead to an integer overflow bug.
+
+It means we vmalloc() a lot more memory than we had intended. I believe
+that on 64 bit systems vmalloc() can succeed even if we ask it to
+allocate huge 4GB buffers. So we would get memory corruption and likely
+a crash when we call ha->isp_ops->write_optrom() and ->read_optrom().
+
+Only root can trigger this bug.
+
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=194061
+
+Cc: <stable@vger.kernel.org>
+Fixes: b7cc176c9eb3 ("[SCSI] qla2xxx: Allow region-based flash-part accesses.")
+Reported-by: shqking <shqking@gmail.com>
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/scsi/qla2xxx/qla_attr.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
+index 08a1feb3a195..8c6ff1682fb1 100644
+--- a/drivers/scsi/qla2xxx/qla_attr.c
++++ b/drivers/scsi/qla2xxx/qla_attr.c
+@@ -318,6 +318,8 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
+ return -EINVAL;
+ if (start > ha->optrom_size)
+ return -EINVAL;
++ if (size > ha->optrom_size - start)
++ size = ha->optrom_size - start;
+
+ mutex_lock(&ha->optrom_mutex);
+ switch (val) {
+@@ -343,8 +345,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
+ }
+
+ ha->optrom_region_start = start;
+- ha->optrom_region_size = start + size > ha->optrom_size ?
+- ha->optrom_size - start : size;
++ ha->optrom_region_size = start + size;
+
+ ha->optrom_state = QLA_SREADING;
+ ha->optrom_buffer = vmalloc(ha->optrom_region_size);
+@@ -417,8 +418,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
+ }
+
+ ha->optrom_region_start = start;
+- ha->optrom_region_size = start + size > ha->optrom_size ?
+- ha->optrom_size - start : size;
++ ha->optrom_region_size = start + size;
+
+ ha->optrom_state = QLA_SWRITING;
+ ha->optrom_buffer = vmalloc(ha->optrom_region_size);
+--
+2.12.3
+
diff --git a/patches.fixes/block-copy-bi_vcnt-in-_bio_clone_fast b/patches.fixes/block-copy-bi_vcnt-in-_bio_clone_fast
deleted file mode 100644
index b78c4ea8ea..0000000000
--- a/patches.fixes/block-copy-bi_vcnt-in-_bio_clone_fast
+++ /dev/null
@@ -1,41 +0,0 @@
-From: Jeff Mahoney <jeffm@suse.com>
-Subject: block: copy bi_vcnt in __bio_clone_fast
-References: boo#888259
-Patch-mainline: Submitted to LKML, 8 Oct 2014
-
-Commit 05f1dd53152173 (block: add queue flag for disabling SG merging) uses
-bi_vcnt to assign bio->bi_phys_segments if sg merging is disabled. When
-using device mapper on top of a blk-mq device (virtio_blk in my test),
-we'd end up overflowing the scatterlist in __blk_bios_map_sg.
-
-__bio_clone_fast copies bi_iter and bi_io_vec but not bi_vcnt, so
-blk_recount_segments would report bi_phys_segments as 0. Since
-rq->nr_phys_segments is 0 as well, the checks to ensure that we don't
-exceed the queue's segment end up allowing more bios (and segments) to
-attach the a request until the we finally map it. That also means we'd
-pass the BUG_ON at the beginning of virtio_queue_rq, ultimately causing
-memory corruption and a crash.
-
-If we copy bi_vcnt in __bio_clone_fast, the bios and requests properly
-report the number of segments and everything works as expected.
-
-Originally reported at http://bugzilla.opensuse.org/show_bug.cgi?id=888259
-
-Reported-by: Stephen Kulow <coolo@suse.com>
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
-
- block/bio.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/block/bio.c
-+++ b/block/bio.c
-@@ -564,6 +564,7 @@ void __bio_clone_fast(struct bio *bio, s
- bio->bi_opf = bio_src->bi_opf;
- bio->bi_iter = bio_src->bi_iter;
- bio->bi_io_vec = bio_src->bi_io_vec;
-+ bio->bi_vcnt = bio_src->bi_vcnt;
-
- bio_clone_blkcg_association(bio, bio_src);
- }
-
diff --git a/patches.fixes/btrfs-qgroups-Retry-after-commit-on-getting-EDQUOT.patch b/patches.fixes/btrfs-qgroups-Retry-after-commit-on-getting-EDQUOT.patch
deleted file mode 100644
index 1ec63fb0a0..0000000000
--- a/patches.fixes/btrfs-qgroups-Retry-after-commit-on-getting-EDQUOT.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From a950e8b3aebb16d547f1bfcd076eb894f7c1cb05 Mon Sep 17 00:00:00 2001
-From: Goldwyn Rodrigues <rgoldwyn@suse.com>
-Date: Mon, 27 Mar 2017 12:29:57 -0500
-Subject: [PATCH] btrfs: qgroups: Retry after commit on getting EDQUOT
-Patch-mainline: Submitted, https://patchwork.kernel.org/patch/9647211/
-References: bsc#1019614
-
-
-We are facing the same problem with EDQUOT which was experienced with
-ENOSPC. Not sure if we require a full ticketing system such as ENOSPC, but
-here is a quick fix, which may be too big a hammer.
-
-Quotas are reserved during the start of an operation, incrementing
-qg->reserved. However, it is written to disk in a commit_transaction
-which could take as long as commit_interval. In the meantime there
-could be deletions which are not accounted for because deletions are
-accounted for only while committed (free_refroot). So, when we get
-a EDQUOT flush the data to disk and try again.
-
-This fixes fstests btrfs/139.
-
-Here is a sample script which shows this issue.
-
-DEVICE=/dev/vdb
-MOUNTPOINT=/mnt
-TESTVOL=$MOUNTPOINT/tmp
-QUOTA=5
-PROG=btrfs
-DD_BS="4k"
-DD_COUNT="256"
-RUN_TIMES=5000
-
-mkfs.btrfs -f $DEVICE
-mount -o commit=240 $DEVICE $MOUNTPOINT
-$PROG subvolume create $TESTVOL
-$PROG quota enable $TESTVOL
-$PROG qgroup limit ${QUOTA}G $TESTVOL
-
-typeset -i DD_RUN_GOOD
-typeset -i QUOTA
-
-function _check_cmd() {
- if [[ ${?} > 0 ]]; then
- echo -n "$(date) E: Running previous command"
- echo ${*}
- echo "Without sync"
- $PROG qgroup show -pcreFf ${TESTVOL}
- echo "With sync"
- $PROG qgroup show -pcreFf --sync ${TESTVOL}
- exit 1
- fi
-}
-
-while true; do
- DD_RUN_GOOD=$RUN_TIMES
-
- while (( ${DD_RUN_GOOD} != 0 )); do
- dd if=/dev/zero of=${TESTVOL}/quotatest${DD_RUN_GOOD} bs=${DD_BS} count=${DD_COUNT}
- _check_cmd "dd if=/dev/zero of=${TESTVOL}/quotatest${DD_RUN_GOOD} bs=${DD_BS} count=${DD_COUNT}"
- DD_RUN_GOOD=(${DD_RUN_GOOD}-1)
- done
-
- $PROG qgroup show -pcref $TESTVOL
- echo "----------- Cleanup ---------- "
- rm $TESTVOL/quotatest*
-
-done
-
-Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
-Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
----
- fs/btrfs/qgroup.c | 24 +++++++++++++++++++++++-
- 1 file changed, 23 insertions(+), 1 deletion(-)
-
-diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
-index a59801d..284366a 100644
---- a/fs/btrfs/qgroup.c
-+++ b/fs/btrfs/qgroup.c
-@@ -2367,6 +2367,7 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce)
- struct btrfs_fs_info *fs_info = root->fs_info;
- u64 ref_root = root->root_key.objectid;
- int ret = 0;
-+ int retried = 0;
- struct ulist_node *unode;
- struct ulist_iterator uiter;
-
-@@ -2375,7 +2376,7 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce)
-
- if (num_bytes == 0)
- return 0;
--
-+retry:
- spin_lock(&fs_info->qgroup_lock);
- quota_root = fs_info->quota_root;
- if (!quota_root)
-@@ -2402,6 +2403,27 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce)
- qg = unode_aux_to_qgroup(unode);
-
- if (enforce && !qgroup_check_limits(qg, num_bytes)) {
-+ /*
-+ * Commit the tree and retry, since we may have
-+ * deletions which would free up space.
-+ */
-+ if (!retried && qg->reserved > 0) {
-+ struct btrfs_trans_handle *trans;
-+
-+ spin_unlock(&fs_info->qgroup_lock);
-+ ret = btrfs_start_delalloc_inodes(root, 0);
-+ if (ret)
-+ return ret;
-+ btrfs_wait_ordered_extents(root, -1, 0, (u64)-1);
-+ trans = btrfs_join_transaction(root);
-+ if (IS_ERR(trans))
-+ return PTR_ERR(trans);
-+ ret = btrfs_commit_transaction(trans);
-+ if (ret)
-+ return ret;
-+ retried++;
-+ goto retry;
-+ }
- ret = -EDQUOT;
- goto out;
- }
---
-2.10.2
-
diff --git a/patches.fixes/drm-amdgpu-revert-update-tile-table-for-oland-hainan.patch b/patches.fixes/drm-amdgpu-revert-update-tile-table-for-oland-hainan.patch
new file mode 100644
index 0000000000..95bb6a1b76
--- /dev/null
+++ b/patches.fixes/drm-amdgpu-revert-update-tile-table-for-oland-hainan.patch
@@ -0,0 +1,454 @@
+From: Jean Delvare <jdelvare@suse.de>
+Subject: Revert "drm/amdgpu: update tile table for oland/hainan"
+References: boo#1027378, boo#1039806
+Patch-mainline: Not yet, will send later today
+
+Revert commit f8d9422ef80c ("drm/amdgpu: update tile table for
+oland/hainan") as it is causing ugly visual artefacts on at least
+Oland. This is only an optimization so we can live without it.
+
+This fixes kernel bug #194761:
+amdgpu driver breaks on Oland (SI)
+https://bugzilla.kernel.org/show_bug.cgi?id=194761
+
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+Fixes: f8d9422ef80c ("drm/amdgpu: update tile table for oland/hainan")
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: Flora Cui <Flora.Cui@amd.com>
+Cc: Junwei Zhang <Jerry.Zhang@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 330 ++++++++++++++--------------------
+ 1 file changed, 139 insertions(+), 191 deletions(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+@@ -708,290 +708,238 @@ static void gfx_v6_0_tiling_mode_table_i
+ for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) {
+ switch (reg_offset) {
+ case 0:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 1:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 2:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 3:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_128B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK) |
+- TILE_SPLIT(split_equal_to_row_size));
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 4:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2));
++ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
++ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 5:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(split_equal_to_row_size) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK));
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 6:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(split_equal_to_row_size) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK));
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 7:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DEPTH_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(split_equal_to_row_size) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 8:
+- gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED));
++ gb_tile_moden = (ARRAY_MODE(ARRAY_LINEAR_ALIGNED) |
++ MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
++ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 9:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2));
++ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
++ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 10:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 11:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 12:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_DISPLAY_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 13:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2));
++ gb_tile_moden = (ARRAY_MODE(ARRAY_1D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_64B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
++ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 14:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 15:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 16:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 17:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK) |
+- TILE_SPLIT(split_equal_to_row_size));
+- break;
+- case 18:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_1D_TILED_THICK) |
+- PIPE_CONFIG(ADDR_SURF_P2));
+- break;
+- case 19:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_XTHICK) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P4_8x16) |
++ TILE_SPLIT(split_equal_to_row_size) |
+ NUM_BANKS(ADDR_SURF_16_BANK) |
+- TILE_SPLIT(split_equal_to_row_size));
+- break;
+- case 20:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THICK) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2) |
+- NUM_BANKS(ADDR_SURF_16_BANK) |
+- TILE_SPLIT(split_equal_to_row_size));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 21:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 22:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_2) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK));
++ NUM_BANKS(ADDR_SURF_16_BANK) |
++ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
++ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_4) |
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_4));
+ break;
+ case 23:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_256B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 24:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_512B) |
++ NUM_BANKS(ADDR_SURF_16_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_8_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_2));
+ break;
+ case 25:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
++ gb_tile_moden = (ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
++ MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
++ PIPE_CONFIG(ADDR_SURF_P8_32x32_8x16) |
+ TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
+- break;
+- case 26:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
+- break;
+- case 27:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
+- break;
+- case 28:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
+- break;
+- case 29:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_1KB) |
+- BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+- BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_2) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
+- break;
+- case 30:
+- gb_tile_moden = (MICRO_TILE_MODE(ADDR_SURF_THIN_MICRO_TILING) |
+- ARRAY_MODE(ARRAY_2D_TILED_THIN1) |
+- PIPE_CONFIG(ADDR_SURF_P2) |
+- TILE_SPLIT(ADDR_SURF_TILE_SPLIT_2KB) |
++ NUM_BANKS(ADDR_SURF_8_BANK) |
+ BANK_WIDTH(ADDR_SURF_BANK_WIDTH_1) |
+ BANK_HEIGHT(ADDR_SURF_BANK_HEIGHT_1) |
+- MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1) |
+- NUM_BANKS(ADDR_SURF_4_BANK));
++ MACRO_TILE_ASPECT(ADDR_SURF_MACRO_ASPECT_1));
+ break;
+ default:
+- continue;
++ gb_tile_moden = 0;
++ break;
+ }
+ adev->gfx.config.tile_mode_array[reg_offset] = gb_tile_moden;
+ WREG32(mmGB_TILE_MODE0 + reg_offset, gb_tile_moden);
diff --git a/patches.fixes/drm-i915-Fix-S4-resume-breakage b/patches.fixes/drm-i915-Fix-S4-resume-breakage
deleted file mode 100644
index e74f780ffe..0000000000
--- a/patches.fixes/drm-i915-Fix-S4-resume-breakage
+++ /dev/null
@@ -1,36 +0,0 @@
-From: Takashi Iwai <tiwai@suse.de>
-Subject: drm/i915: Fix S4 resume breakage
-Patch-mainline: Submitted, suggested on ML
-References: bsc#984629,bsc#984632,bsc#993472
-
-We've seen S4 resume breakage on many Intel machines with SP2 kernel,
-where typically the machine gets a memory corruption or kernel Oops /
-panic. This problem was seen even on the upstream kernel, and through
-the bisection, it was pointed to be a side-effect of the commit:
- 4c436d55b279bbc6b02aac02e7dc683fc09f884e
- drm/i915: Enable Resource Streamer state save/restore on MI_SET_CONTEXT
-
-This patch fixes the regression by forcibly calling the GPU reset
-at prerequiste of PM S4 restore, as was suggested by the i915
-upstream dev.
-
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-
----
- drivers/gpu/drm/i915/i915_drv.c | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/drivers/gpu/drm/i915/i915_drv.c
-+++ b/drivers/gpu/drm/i915/i915_drv.c
-@@ -1946,6 +1946,11 @@ static int i915_pm_thaw(struct device *d
- /* restore: called after loading the hibernation image. */
- static int i915_pm_restore_early(struct device *kdev)
- {
-+ struct pci_dev *pdev = to_pci_dev(kdev);
-+ struct drm_device *dev = pci_get_drvdata(pdev);
-+
-+ /* for avoiding the memory corruption at S4 resume (bsc#984624) */
-+ intel_gpu_reset(to_i915(dev), ALL_ENGINES);
- return i915_pm_resume_early(kdev);
- }
-
diff --git a/patches.fixes/reiserfs-fix-race-in-prealloc-discard.patch b/patches.fixes/reiserfs-fix-race-in-prealloc-discard.patch
deleted file mode 100644
index 27f1a60be8..0000000000
--- a/patches.fixes/reiserfs-fix-race-in-prealloc-discard.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Jeff Mahoney <jeffm@suse.com>
-Subject: reiserfs: fix race in prealloc discard
-References: bsc#987576
-Patch-mainline: Submitted, reiserfs-devel 13 Jan 2017
-
-The main loop in __discard_prealloc is protected by the reiserfs write lock
-which is dropped across schedules like the BKL it replaced. The problem is
-that it checks the value, calls a routine that schedules, and then adjusts
-the state. As a result, two threads that are calling
-reiserfs_prealloc_discard at the same time can race when one calls
-reiserfs_free_prealloc_block, the lock is dropped, and the other calls
-reiserfs_free_prealloc_block with the same block number. In the right
-circumstances, it can cause the prealloc count to go negative.
-
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
-
- bitmap.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
---- a/fs/reiserfs/bitmap.c
-+++ b/fs/reiserfs/bitmap.c
-@@ -479,9 +479,17 @@ static void __discard_prealloc(struct re
- "inode has negative prealloc blocks count.");
- #endif
- while (ei->i_prealloc_count > 0) {
-- reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
-- ei->i_prealloc_block++;
-+ b_blocknr_t block_to_free;
-+
-+ /*
-+ * reiserfs_free_prealloc_block can drop the write lock,
-+ * which could allow another caller to free the same block.
-+ * We can protect against it by modifying the prealloc
-+ * state before calling it.
-+ */
-+ block_to_free = ei->i_prealloc_block++;
- ei->i_prealloc_count--;
-+ reiserfs_free_prealloc_block(th, inode, block_to_free);
- dirty = 1;
- }
- if (dirty)
-
diff --git a/patches.fixes/scsi-ibmvscsi-module_alias.patch b/patches.fixes/scsi-ibmvscsi-module_alias.patch
deleted file mode 100644
index 241602273c..0000000000
--- a/patches.fixes/scsi-ibmvscsi-module_alias.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Subject: map scsi proc_name to module name
-From: olh@suse.de
-References: 459933 - LTC50724
-Patch-mainline: not yet, old patch (olaf?)
-
----
- drivers/scsi/ibmvscsi/ibmvscsi.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
---- a/drivers/scsi/ibmvscsi/ibmvscsi.c
-+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
-@@ -108,6 +108,9 @@ static struct scsi_transport_template *i
-
- #define IBMVSCSI_VERSION "1.5.9"
-
-+#define IBMVSCSI_PROC_NAME "ibmvscsi"
-+/* The driver is named ibmvscsic, map ibmvscsi to module name */
-+MODULE_ALIAS(IBMVSCSI_PROC_NAME);
- MODULE_DESCRIPTION("IBM Virtual SCSI");
- MODULE_AUTHOR("Dave Boutcher");
- MODULE_LICENSE("GPL");
-@@ -1802,7 +1805,7 @@ static struct device_attribute *ibmvscsi
- static struct scsi_host_template driver_template = {
- .module = THIS_MODULE,
- .name = "IBM POWER Virtual SCSI Adapter " IBMVSCSI_VERSION,
-- .proc_name = "ibmvscsi",
-+ .proc_name = IBMVSCSI_PROC_NAME,
- .queuecommand = ibmvscsi_queuecommand,
- .eh_timed_out = srp_timed_out,
- .eh_abort_handler = ibmvscsi_eh_abort_handler,
-@@ -2069,7 +2072,7 @@ static struct vio_driver ibmvscsi_driver
- .probe = ibmvscsi_probe,
- .remove = ibmvscsi_remove,
- .get_desired_dma = ibmvscsi_get_desired_dma,
-- .name = "ibmvscsi",
-+ .name = IBMVSCSI_PROC_NAME,
- .pm = &ibmvscsi_pm_ops,
- };
-
diff --git a/patches.rpmify/drm-i915-disable-KASAN-for-handlers.patch b/patches.rpmify/drm-i915-disable-KASAN-for-handlers.patch
deleted file mode 100644
index 9d6deb1964..0000000000
--- a/patches.rpmify/drm-i915-disable-KASAN-for-handlers.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From: Jiri Slaby <jslaby@suse.cz>
-Date: Thu, 30 Mar 2017 10:52:48 +0200
-Subject: drm/i915: disable KASAN for handlers
-Patch-mainline: submitted, https://lkml.kernel.org/r/<20170330094627.29460-1-jslaby@suse.cz>
-References: bnc#1025903
-
-Handlers are currently the only blocker to compile the kernel with gcc 7
-and KASAN+use-after-scope enabled:
-drivers/gpu/drm/i915/gvt/handlers.c:2200:1: error: the frame size of 43760 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
-drivers/gpu/drm/i915/gvt/handlers.c:2402:1: error: the frame size of 9400 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
-drivers/gpu/drm/i915/gvt/handlers.c:2628:1: error: the frame size of 11256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
-
-It is due to many expansions of MMIO_* macros in init_generic_mmio_info.
-INTEL_GVT_MMIO_OFFSET generates for each such line a __reg and an
-offset. There are too many for KASAN to keep up.
-
-So disable KASAN for this file.
-
-Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-Cc: Martin Liska <mliska@suse.cz>
-Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
-Cc: Zhi Wang <zhi.a.wang@intel.com>
-Cc: Daniel Vetter <daniel.vetter@intel.com>
-Cc: Jani Nikula <jani.nikula@linux.intel.com>
-Cc: David Airlie <airlied@linux.ie>
-Cc: intel-gvt-dev@lists.freedesktop.org
-Cc: intel-gfx@lists.freedesktop.org
-Cc: dri-devel@lists.freedesktop.org
----
- drivers/gpu/drm/i915/gvt/Makefile | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/drivers/gpu/drm/i915/gvt/Makefile
-+++ b/drivers/gpu/drm/i915/gvt/Makefile
-@@ -6,3 +6,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handle
- ccflags-y += -I$(src) -I$(src)/$(GVT_DIR) -Wall
- i915-y += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
- obj-$(CONFIG_DRM_I915_GVT_KVMGT) += $(GVT_DIR)/kvmgt.o
-+
-+KASAN_SANITIZE_handlers.o := n
diff --git a/patches.rpmify/get_builtin_firmware-gcc-7.patch b/patches.rpmify/get_builtin_firmware-gcc-7.patch
deleted file mode 100644
index 890e1bb6d5..0000000000
--- a/patches.rpmify/get_builtin_firmware-gcc-7.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From: Jiri Slaby <jslaby@suse.cz>
-Date: Fri, 14 Oct 2016 07:37:32 +0200
-Subject: fix get_builtin_firmware compilation with gcc 7
-Patch-mainline: not yet, under discussion "firmware: declare __{start,end}_builtin_fw as pointers"
-References: bnc#1004626
-
-gcc 7 miscompiles the kernel since the kernel relies on undefined
-behaviour. Fix this for get_builtin_firmware, so that the kernel boots
-at least. The other VMLINUX_SYMBOLs have to be fixed too.
-
-Signed-off-by: Jiri Slaby <jslaby@suse.cz>
----
- arch/x86/kernel/cpu/microcode/core.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
-index 5ce5155f0695..83f2bf7ff46d 100644
---- a/arch/x86/kernel/cpu/microcode/core.c
-+++ b/arch/x86/kernel/cpu/microcode/core.c
-@@ -97,9 +97,11 @@ extern struct builtin_fw __end_builtin_fw[];
- bool get_builtin_firmware(struct cpio_data *cd, const char *name)
- {
- #ifdef CONFIG_FW_LOADER
-- struct builtin_fw *b_fw;
-+ struct builtin_fw *b_fw = __start_builtin_fw;
-
-- for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
-+ OPTIMIZER_HIDE_VAR(b_fw);
-+
-+ for (; b_fw != __end_builtin_fw; b_fw++) {
- if (!strcmp(name, b_fw->name)) {
- cd->size = b_fw->size;
- cd->data = b_fw->data;
---
-2.10.1
-
diff --git a/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch b/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
new file mode 100644
index 0000000000..e1ef7db15c
--- /dev/null
+++ b/patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
@@ -0,0 +1,186 @@
+From: Andy Lutomirski <luto@kernel.org>
+Date: Tue, 11 Jul 2017 10:33:38 -0500
+Subject: x86/entry/64: Refactor IRQ stacks and make them NMI-safe
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 1d3e53e8624a3ec85f4041ca6d973da7c1575938
+References: bnc#1018348
+
+This will allow IRQ stacks to nest inside NMIs or similar entries
+that can happen during IRQ stack setup or teardown.
+
+The new macros won't work correctly if they're invoked with IRQs on.
+Add a check under CONFIG_DEBUG_ENTRY to detect that.
+
+Signed-off-by: Andy Lutomirski <luto@kernel.org>
+[ Use %r10 instead of %r11 in xen_do_hypervisor_callback to make objtool
+ and ORC unwinder's lives a little easier. ]
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/b0b2ff5fb97d2da2e1d7e1f380190c92545c8bb5.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/Kconfig.debug | 2 -
+ arch/x86/entry/entry_64.S | 85 ++++++++++++++++++++++++++++++-------------
+ arch/x86/kernel/process_64.c | 3 +
+ 3 files changed, 64 insertions(+), 26 deletions(-)
+
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -305,8 +305,6 @@ config DEBUG_ENTRY
+ Some of these sanity checks may slow down kernel entries and
+ exits or otherwise impact performance.
+
+- This is currently used to help test NMI code.
+-
+ If unsure, say N.
+
+ config DEBUG_NMI_SELFTEST
+--- a/arch/x86/entry/entry_64.S
++++ b/arch/x86/entry/entry_64.S
+@@ -447,6 +447,59 @@ ENTRY(irq_entries_start)
+ .endr
+ END(irq_entries_start)
+
++.macro DEBUG_ENTRY_ASSERT_IRQS_OFF
++#ifdef CONFIG_DEBUG_ENTRY
++ pushfq
++ testl $X86_EFLAGS_IF, (%rsp)
++ jz .Lokay_\@
++ ud2
++.Lokay_\@:
++ addq $8, %rsp
++#endif
++.endm
++
++/*
++ * Enters the IRQ stack if we're not already using it. NMI-safe. Clobbers
++ * flags and puts old RSP into old_rsp, and leaves all other GPRs alone.
++ * Requires kernel GSBASE.
++ *
++ * The invariant is that, if irq_count != -1, then the IRQ stack is in use.
++ */
++.macro ENTER_IRQ_STACK old_rsp
++ DEBUG_ENTRY_ASSERT_IRQS_OFF
++ movq %rsp, \old_rsp
++ incl PER_CPU_VAR(irq_count)
++
++ /*
++ * Right now, if we just incremented irq_count to zero, we've
++ * claimed the IRQ stack but we haven't switched to it yet.
++ *
++ * If anything is added that can interrupt us here without using IST,
++ * it must be *extremely* careful to limit its stack usage. This
++ * could include kprobes and a hypothetical future IST-less #DB
++ * handler.
++ */
++
++ cmovzq PER_CPU_VAR(irq_stack_ptr), %rsp
++ pushq \old_rsp
++.endm
++
++/*
++ * Undoes ENTER_IRQ_STACK.
++ */
++.macro LEAVE_IRQ_STACK
++ DEBUG_ENTRY_ASSERT_IRQS_OFF
++ /* We need to be off the IRQ stack before decrementing irq_count. */
++ popq %rsp
++
++ /*
++ * As in ENTER_IRQ_STACK, irq_count == 0, we are still claiming
++ * the irq stack but we're not on it.
++ */
++
++ decl PER_CPU_VAR(irq_count)
++.endm
++
+ /*
+ * Interrupt entry/exit.
+ *
+@@ -485,17 +538,7 @@ END(irq_entries_start)
+ CALL_enter_from_user_mode
+
+ 1:
+- /*
+- * Save previous stack pointer, optionally switch to interrupt stack.
+- * irq_count is used to check if a CPU is already on an interrupt stack
+- * or not. While this is essentially redundant with preempt_count it is
+- * a little cheaper to use a separate counter in the PDA (short of
+- * moving irq_enter into assembly, which would be too much work)
+- */
+- movq %rsp, %rdi
+- incl PER_CPU_VAR(irq_count)
+- cmovzq PER_CPU_VAR(irq_stack_ptr), %rsp
+- pushq %rdi
++ ENTER_IRQ_STACK old_rsp=%rdi
+ /* We entered an interrupt context - irqs are off: */
+ TRACE_IRQS_OFF
+
+@@ -515,10 +558,8 @@ common_interrupt:
+ ret_from_intr:
+ DISABLE_INTERRUPTS(CLBR_ANY)
+ TRACE_IRQS_OFF
+- decl PER_CPU_VAR(irq_count)
+
+- /* Restore saved previous stack */
+- popq %rsp
++ LEAVE_IRQ_STACK
+
+ testb $3, CS(%rsp)
+ jz retint_kernel
+@@ -891,12 +932,10 @@ bad_gs:
+ ENTRY(do_softirq_own_stack)
+ pushq %rbp
+ mov %rsp, %rbp
+- incl PER_CPU_VAR(irq_count)
+- cmove PER_CPU_VAR(irq_stack_ptr), %rsp
+- push %rbp /* frame pointer backlink */
++ ENTER_IRQ_STACK old_rsp=%r11
+ call __do_softirq
++ LEAVE_IRQ_STACK
+ leaveq
+- decl PER_CPU_VAR(irq_count)
+ ret
+ END(do_softirq_own_stack)
+
+@@ -923,13 +962,11 @@ ENTRY(xen_do_hypervisor_callback) /* do
+ * see the correct pointer to the pt_regs
+ */
+ movq %rdi, %rsp /* we don't return, adjust the stack frame */
+-11: incl PER_CPU_VAR(irq_count)
+- movq %rsp, %rbp
+- cmovzq PER_CPU_VAR(irq_stack_ptr), %rsp
+- pushq %rbp /* frame pointer backlink */
++
++ ENTER_IRQ_STACK old_rsp=%r10
+ call xen_evtchn_do_upcall
+- popq %rsp
+- decl PER_CPU_VAR(irq_count)
++ LEAVE_IRQ_STACK
++
+ #ifndef CONFIG_PREEMPT
+ call xen_maybe_preempt_hcall
+ #endif
+--- a/arch/x86/kernel/process_64.c
++++ b/arch/x86/kernel/process_64.c
+@@ -279,6 +279,9 @@ __switch_to(struct task_struct *prev_p,
+ struct tss_struct *tss = &per_cpu(cpu_tss, cpu);
+ unsigned prev_fsindex, prev_gsindex;
+
++ WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ENTRY) &&
++ this_cpu_read(irq_count) != -1);
++
+ switch_fpu_prepare(prev_fpu, cpu);
+
+ /* We must save %fs and %gs before load_TLS() because
diff --git a/patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch b/patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch
new file mode 100644
index 0000000000..33166d42be
--- /dev/null
+++ b/patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch
@@ -0,0 +1,1357 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 24 Jul 2017 18:36:57 -0500
+Subject: x86/unwind: Add the ORC unwinder
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: ee9f8fce99640811b2b8e79d0d1dbe8bab69ba67
+References: bnc#1018348
+
+Add the new ORC unwinder which is enabled by CONFIG_ORC_UNWINDER=y.
+It plugs into the existing x86 unwinder framework.
+
+It relies on objtool to generate the needed .orc_unwind and
+.orc_unwind_ip sections.
+
+For more details on why ORC is used instead of DWARF, see
+Documentation/x86/orc-unwinder.txt - but the short version is
+that it's a simplified, fundamentally more robust debugninfo
+data structure, which also allows up to two orders of magnitude
+faster lookups than the DWARF unwinder - which matters to
+profiling workloads like perf.
+
+Thanks to Andy Lutomirski for the performance improvement ideas:
+splitting the ORC unwind table into two parallel arrays and creating a
+fast lookup table to search a subset of the unwind table.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/0a6cbfb40f8da99b7a45a1a8302dc6aef16ec812.1500938583.git.jpoimboe@redhat.com
+[ Extended the changelog. ]
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ Documentation/x86/orc-unwinder.txt | 179 +++++++++++
+ arch/um/include/asm/unwind.h | 8
+ arch/x86/Kconfig | 1
+ arch/x86/Kconfig.debug | 25 +
+ arch/x86/include/asm/module.h | 9
+ arch/x86/include/asm/orc_lookup.h | 46 ++
+ arch/x86/include/asm/orc_types.h | 2
+ arch/x86/include/asm/unwind.h | 76 ++--
+ arch/x86/kernel/Makefile | 8
+ arch/x86/kernel/module.c | 11
+ arch/x86/kernel/setup.c | 3
+ arch/x86/kernel/unwind_frame.c | 39 +-
+ arch/x86/kernel/unwind_guess.c | 5
+ arch/x86/kernel/unwind_orc.c | 582 +++++++++++++++++++++++++++++++++++++
+ arch/x86/kernel/vmlinux.lds.S | 3
+ include/asm-generic/vmlinux.lds.h | 27 +
+ lib/Kconfig.debug | 3
+ scripts/Makefile.build | 14
+ 18 files changed, 977 insertions(+), 64 deletions(-)
+ create mode 100644 Documentation/x86/orc-unwinder.txt
+ create mode 100644 arch/um/include/asm/unwind.h
+ create mode 100644 arch/x86/include/asm/orc_lookup.h
+ create mode 100644 arch/x86/kernel/unwind_orc.c
+
+--- /dev/null
++++ b/Documentation/x86/orc-unwinder.txt
+@@ -0,0 +1,179 @@
++ORC unwinder
++============
++
++Overview
++--------
++
++The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is
++similar in concept to a DWARF unwinder. The difference is that the
++format of the ORC data is much simpler than DWARF, which in turn allows
++the ORC unwinder to be much simpler and faster.
++
++The ORC data consists of unwind tables which are generated by objtool.
++They contain out-of-band data which is used by the in-kernel ORC
++unwinder. Objtool generates the ORC data by first doing compile-time
++stack metadata validation (CONFIG_STACK_VALIDATION). After analyzing
++all the code paths of a .o file, it determines information about the
++stack state at each instruction address in the file and outputs that
++information to the .orc_unwind and .orc_unwind_ip sections.
++
++The per-object ORC sections are combined at link time and are sorted and
++post-processed at boot time. The unwinder uses the resulting data to
++correlate instruction addresses with their stack states at run time.
++
++
++ORC vs frame pointers
++---------------------
++
++With frame pointers enabled, GCC adds instrumentation code to every
++function in the kernel. The kernel's .text size increases by about
++3.2%, resulting in a broad kernel-wide slowdown. Measurements by Mel
++Gorman [1] have shown a slowdown of 5-10% for some workloads.
++
++In contrast, the ORC unwinder has no effect on text size or runtime
++performance, because the debuginfo is out of band. So if you disable
++frame pointers and enable the ORC unwinder, you get a nice performance
++improvement across the board, and still have reliable stack traces.
++
++Ingo Molnar says:
++
++ "Note that it's not just a performance improvement, but also an
++ instruction cache locality improvement: 3.2% .text savings almost
++ directly transform into a similarly sized reduction in cache
++ footprint. That can transform to even higher speedups for workloads
++ whose cache locality is borderline."
++
++Another benefit of ORC compared to frame pointers is that it can
++reliably unwind across interrupts and exceptions. Frame pointer based
++unwinds can sometimes skip the caller of the interrupted function, if it
++was a leaf function or if the interrupt hit before the frame pointer was
++saved.
++
++The main disadvantage of the ORC unwinder compared to frame pointers is
++that it needs more memory to store the ORC unwind tables: roughly 2-4MB
++depending on the kernel config.
++
++
++ORC vs DWARF
++------------
++
++ORC debuginfo's advantage over DWARF itself is that it's much simpler.
++It gets rid of the complex DWARF CFI state machine and also gets rid of
++the tracking of unnecessary registers. This allows the unwinder to be
++much simpler, meaning fewer bugs, which is especially important for
++mission critical oops code.
++
++The simpler debuginfo format also enables the unwinder to be much faster
++than DWARF, which is important for perf and lockdep. In a basic
++performance test by Jiri Slaby [2], the ORC unwinder was about 20x
++faster than an out-of-tree DWARF unwinder. (Note: That measurement was
++taken before some performance tweaks were added, which doubled
++performance, so the speedup over DWARF may be closer to 40x.)
++
++The ORC data format does have a few downsides compared to DWARF. ORC
++unwind tables take up ~50% more RAM (+1.3MB on an x86 defconfig kernel)
++than DWARF-based eh_frame tables.
++
++Another potential downside is that, as GCC evolves, it's conceivable
++that the ORC data may end up being *too* simple to describe the state of
++the stack for certain optimizations. But IMO this is unlikely because
++GCC saves the frame pointer for any unusual stack adjustments it does,
++so I suspect we'll really only ever need to keep track of the stack
++pointer and the frame pointer between call frames. But even if we do
++end up having to track all the registers DWARF tracks, at least we will
++still be able to control the format, e.g. no complex state machines.
++
++
++ORC unwind table generation
++---------------------------
++
++The ORC data is generated by objtool. With the existing compile-time
++stack metadata validation feature, objtool already follows all code
++paths, and so it already has all the information it needs to be able to
++generate ORC data from scratch. So it's an easy step to go from stack
++validation to ORC data generation.
++
++It should be possible to instead generate the ORC data with a simple
++tool which converts DWARF to ORC data. However, such a solution would
++be incomplete due to the kernel's extensive use of asm, inline asm, and
++special sections like exception tables.
++
++That could be rectified by manually annotating those special code paths
++using GNU assembler .cfi annotations in .S files, and homegrown
++annotations for inline asm in .c files. But asm annotations were tried
++in the past and were found to be unmaintainable. They were often
++incorrect/incomplete and made the code harder to read and keep updated.
++And based on looking at glibc code, annotating inline asm in .c files
++might be even worse.
++
++Objtool still needs a few annotations, but only in code which does
++unusual things to the stack like entry code. And even then, far fewer
++annotations are needed than what DWARF would need, so they're much more
++maintainable than DWARF CFI annotations.
++
++So the advantages of using objtool to generate ORC data are that it
++gives more accurate debuginfo, with very few annotations. It also
++insulates the kernel from toolchain bugs which can be very painful to
++deal with in the kernel since we often have to workaround issues in
++older versions of the toolchain for years.
++
++The downside is that the unwinder now becomes dependent on objtool's
++ability to reverse engineer GCC code flow. If GCC optimizations become
++too complicated for objtool to follow, the ORC data generation might
++stop working or become incomplete. (It's worth noting that livepatch
++already has such a dependency on objtool's ability to follow GCC code
++flow.)
++
++If newer versions of GCC come up with some optimizations which break
++objtool, we may need to revisit the current implementation. Some
++possible solutions would be asking GCC to make the optimizations more
++palatable, or having objtool use DWARF as an additional input, or
++creating a GCC plugin to assist objtool with its analysis. But for now,
++objtool follows GCC code quite well.
++
++
++Unwinder implementation details
++-------------------------------
++
++Objtool generates the ORC data by integrating with the compile-time
++stack metadata validation feature, which is described in detail in
++tools/objtool/Documentation/stack-validation.txt. After analyzing all
++the code paths of a .o file, it creates an array of orc_entry structs,
++and a parallel array of instruction addresses associated with those
++structs, and writes them to the .orc_unwind and .orc_unwind_ip sections
++respectively.
++
++The ORC data is split into the two arrays for performance reasons, to
++make the searchable part of the data (.orc_unwind_ip) more compact. The
++arrays are sorted in parallel at boot time.
++
++Performance is further improved by the use of a fast lookup table which
++is created at runtime. The fast lookup table associates a given address
++with a range of indices for the .orc_unwind table, so that only a small
++subset of the table needs to be searched.
++
++
++Etymology
++---------
++
++Orcs, fearsome creatures of medieval folklore, are the Dwarves' natural
++enemies. Similarly, the ORC unwinder was created in opposition to the
++complexity and slowness of DWARF.
++
++"Although Orcs rarely consider multiple solutions to a problem, they do
++excel at getting things done because they are creatures of action, not
++thought." [3] Similarly, unlike the esoteric DWARF unwinder, the
++veracious ORC unwinder wastes no time or siloconic effort decoding
++variable-length zero-extended unsigned-integer byte-coded
++state-machine-based debug information entries.
++
++Similar to how Orcs frequently unravel the well-intentioned plans of
++their adversaries, the ORC unwinder frequently unravels stacks with
++brutal, unyielding efficiency.
++
++ORC stands for Oops Rewind Capability.
++
++
++[1] https://lkml.kernel.org/r/20170602104048.jkkzssljsompjdwy@suse.de
++[2] https://lkml.kernel.org/r/d2ca5435-6386-29b8-db87-7f227c2b713a@suse.cz
++[3] http://dustin.wikidot.com/half-orcs-and-orcs
+--- /dev/null
++++ b/arch/um/include/asm/unwind.h
+@@ -0,0 +1,8 @@
++#ifndef _ASM_UML_UNWIND_H
++#define _ASM_UML_UNWIND_H
++
++static inline void
++unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
++ void *orc, size_t orc_size) {}
++
++#endif /* _ASM_UML_UNWIND_H */
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -157,6 +157,7 @@ config X86
+ select HAVE_MEMBLOCK
+ select HAVE_MEMBLOCK_NODE_MAP
+ select HAVE_MIXED_BREAKPOINTS_REGS
++ select HAVE_MOD_ARCH_SPECIFIC
+ select HAVE_NMI
+ select HAVE_OPROFILE
+ select HAVE_OPTPROBES
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -356,4 +356,29 @@ config PUNIT_ATOM_DEBUG
+ The current power state can be read from
+ /sys/kernel/debug/punit_atom/dev_power_state
+
++config ORC_UNWINDER
++ bool "ORC unwinder"
++ depends on X86_64
++ select STACK_VALIDATION
++ ---help---
++ This option enables the ORC (Oops Rewind Capability) unwinder for
++ unwinding kernel stack traces. It uses a custom data format which is
++ a simplified version of the DWARF Call Frame Information standard.
++
++ This unwinder is more accurate across interrupt entry frames than the
++ frame pointer unwinder. It can also enable a 5-10% performance
++ improvement across the entire kernel if CONFIG_FRAME_POINTER is
++ disabled.
++
++ Enabling this option will increase the kernel's runtime memory usage
++ by roughly 2-4MB, depending on your kernel config.
++
++config FRAME_POINTER_UNWINDER
++ def_bool y
++ depends on !ORC_UNWINDER && FRAME_POINTER
++
++config GUESS_UNWINDER
++ def_bool y
++ depends on !ORC_UNWINDER && !FRAME_POINTER
++
+ endmenu
+--- a/arch/x86/include/asm/module.h
++++ b/arch/x86/include/asm/module.h
+@@ -2,6 +2,15 @@
+ #define _ASM_X86_MODULE_H
+
+ #include <asm-generic/module.h>
++#include <asm/orc_types.h>
++
++struct mod_arch_specific {
++#ifdef CONFIG_ORC_UNWINDER
++ unsigned int num_orcs;
++ int *orc_unwind_ip;
++ struct orc_entry *orc_unwind;
++#endif
++};
+
+ #ifdef CONFIG_X86_64
+ /* X86_64 does not define MODULE_PROC_FAMILY */
+--- /dev/null
++++ b/arch/x86/include/asm/orc_lookup.h
+@@ -0,0 +1,46 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#ifndef _ORC_LOOKUP_H
++#define _ORC_LOOKUP_H
++
++/*
++ * This is a lookup table for speeding up access to the .orc_unwind table.
++ * Given an input address offset, the corresponding lookup table entry
++ * specifies a subset of the .orc_unwind table to search.
++ *
++ * Each block represents the end of the previous range and the start of the
++ * next range. An extra block is added to give the last range an end.
++ *
++ * The block size should be a power of 2 to avoid a costly 'div' instruction.
++ *
++ * A block size of 256 was chosen because it roughly doubles unwinder
++ * performance while only adding ~5% to the ORC data footprint.
++ */
++#define LOOKUP_BLOCK_ORDER 8
++#define LOOKUP_BLOCK_SIZE (1 << LOOKUP_BLOCK_ORDER)
++
++#ifndef LINKER_SCRIPT
++
++extern unsigned int orc_lookup[];
++extern unsigned int orc_lookup_end[];
++
++#define LOOKUP_START_IP (unsigned long)_stext
++#define LOOKUP_STOP_IP (unsigned long)_etext
++
++#endif /* LINKER_SCRIPT */
++
++#endif /* _ORC_LOOKUP_H */
+--- a/arch/x86/include/asm/orc_types.h
++++ b/arch/x86/include/asm/orc_types.h
+@@ -88,7 +88,7 @@ struct orc_entry {
+ unsigned sp_reg:4;
+ unsigned bp_reg:4;
+ unsigned type:2;
+-};
++} __packed;
+
+ /*
+ * This struct is used by asm and inline asm code to manually annotate the
+--- a/arch/x86/include/asm/unwind.h
++++ b/arch/x86/include/asm/unwind.h
+@@ -12,11 +12,14 @@ struct unwind_state {
+ struct task_struct *task;
+ int graph_idx;
+ bool error;
+-#ifdef CONFIG_FRAME_POINTER
++#if defined(CONFIG_ORC_UNWINDER)
++ bool signal, full_regs;
++ unsigned long sp, bp, ip;
++ struct pt_regs *regs;
++#elif defined(CONFIG_FRAME_POINTER)
+ bool got_irq;
+- unsigned long *bp, *orig_sp;
++ unsigned long *bp, *orig_sp, ip;
+ struct pt_regs *regs;
+- unsigned long ip;
+ #else
+ unsigned long *sp;
+ #endif
+@@ -24,41 +27,30 @@ struct unwind_state {
+
+ void __unwind_start(struct unwind_state *state, struct task_struct *task,
+ struct pt_regs *regs, unsigned long *first_frame);
+-
+ bool unwind_next_frame(struct unwind_state *state);
+-
+ unsigned long unwind_get_return_address(struct unwind_state *state);
++unsigned long *unwind_get_return_address_ptr(struct unwind_state *state);
+
+ static inline bool unwind_done(struct unwind_state *state)
+ {
+ return state->stack_info.type == STACK_TYPE_UNKNOWN;
+ }
+
+-static inline
+-void unwind_start(struct unwind_state *state, struct task_struct *task,
+- struct pt_regs *regs, unsigned long *first_frame)
+-{
+- first_frame = first_frame ? : get_stack_pointer(task, regs);
+-
+- __unwind_start(state, task, regs, first_frame);
+-}
+-
+ static inline bool unwind_error(struct unwind_state *state)
+ {
+ return state->error;
+ }
+
+-#ifdef CONFIG_FRAME_POINTER
+-
+ static inline
+-unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
++void unwind_start(struct unwind_state *state, struct task_struct *task,
++ struct pt_regs *regs, unsigned long *first_frame)
+ {
+- if (unwind_done(state))
+- return NULL;
++ first_frame = first_frame ? : get_stack_pointer(task, regs);
+
+- return state->regs ? &state->regs->ip : state->bp + 1;
++ __unwind_start(state, task, regs, first_frame);
+ }
+
++#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER)
+ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
+ {
+ if (unwind_done(state))
+@@ -66,20 +58,46 @@ static inline struct pt_regs *unwind_get
+
+ return state->regs;
+ }
+-
+-#else /* !CONFIG_FRAME_POINTER */
+-
+-static inline
+-unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
++#else
++static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
+ {
+ return NULL;
+ }
++#endif
+
+-static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
++#ifdef CONFIG_ORC_UNWINDER
++void unwind_init(void);
++void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
++ void *orc, size_t orc_size);
++#else
++static inline void unwind_init(void) {}
++static inline
++void unwind_module_init(struct module *mod, void *orc_ip, size_t orc_ip_size,
++ void *orc, size_t orc_size) {}
++#endif
++
++/*
++ * This disables KASAN checking when reading a value from another task's stack,
++ * since the other task could be running on another CPU and could have poisoned
++ * the stack in the meantime.
++ */
++#define READ_ONCE_TASK_STACK(task, x) \
++({ \
++ unsigned long val; \
++ if (task == current) \
++ val = READ_ONCE(x); \
++ else \
++ val = READ_ONCE_NOCHECK(x); \
++ val; \
++})
++
++static inline bool task_on_another_cpu(struct task_struct *task)
+ {
+- return NULL;
++#ifdef CONFIG_SMP
++ return task != current && task->on_cpu;
++#else
++ return false;
++#endif
+ }
+
+-#endif /* CONFIG_FRAME_POINTER */
+-
+ #endif /* _ASM_X86_UNWIND_H */
+--- a/arch/x86/kernel/Makefile
++++ b/arch/x86/kernel/Makefile
+@@ -126,11 +126,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.
+ obj-$(CONFIG_TRACING) += tracepoint.o
+ obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o
+
+-ifdef CONFIG_FRAME_POINTER
+-obj-y += unwind_frame.o
+-else
+-obj-y += unwind_guess.o
+-endif
++obj-$(CONFIG_ORC_UNWINDER) += unwind_orc.o
++obj-$(CONFIG_FRAME_POINTER_UNWINDER) += unwind_frame.o
++obj-$(CONFIG_GUESS_UNWINDER) += unwind_guess.o
+
+ ###
+ # 64 bit specific files
+--- a/arch/x86/kernel/module.c
++++ b/arch/x86/kernel/module.c
+@@ -35,6 +35,7 @@
+ #include <asm/page.h>
+ #include <asm/pgtable.h>
+ #include <asm/setup.h>
++#include <asm/unwind.h>
+
+ #if 0
+ #define DEBUGP(fmt, ...) \
+@@ -213,7 +214,7 @@ int module_finalize(const Elf_Ehdr *hdr,
+ struct module *me)
+ {
+ const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
+- *para = NULL;
++ *para = NULL, *orc = NULL, *orc_ip = NULL;
+ char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
+
+ for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
+@@ -225,6 +226,10 @@ int module_finalize(const Elf_Ehdr *hdr,
+ locks = s;
+ if (!strcmp(".parainstructions", secstrings + s->sh_name))
+ para = s;
++ if (!strcmp(".orc_unwind", secstrings + s->sh_name))
++ orc = s;
++ if (!strcmp(".orc_unwind_ip", secstrings + s->sh_name))
++ orc_ip = s;
+ }
+
+ if (alt) {
+@@ -248,6 +253,10 @@ int module_finalize(const Elf_Ehdr *hdr,
+ /* make jump label nops */
+ jump_label_apply_nops(me);
+
++ if (orc && orc_ip)
++ unwind_module_init(me, (void *)orc_ip->sh_addr, orc_ip->sh_size,
++ (void *)orc->sh_addr, orc->sh_size);
++
+ return 0;
+ }
+
+--- a/arch/x86/kernel/setup.c
++++ b/arch/x86/kernel/setup.c
+@@ -115,6 +115,7 @@
+ #include <asm/microcode.h>
+ #include <asm/mmu_context.h>
+ #include <asm/kaslr.h>
++#include <asm/unwind.h>
+
+ /*
+ * max_low_pfn_mapped: highest direct mapped pfn under 4GB
+@@ -1310,6 +1311,8 @@ void __init setup_arch(char **cmdline_p)
+ if (efi_enabled(EFI_BOOT))
+ efi_apply_memmap_quirks();
+ #endif
++
++ unwind_init();
+ }
+
+ #ifdef CONFIG_X86_32
+--- a/arch/x86/kernel/unwind_frame.c
++++ b/arch/x86/kernel/unwind_frame.c
+@@ -10,20 +10,22 @@
+
+ #define FRAME_HEADER_SIZE (sizeof(long) * 2)
+
+-/*
+- * This disables KASAN checking when reading a value from another task's stack,
+- * since the other task could be running on another CPU and could have poisoned
+- * the stack in the meantime.
+- */
+-#define READ_ONCE_TASK_STACK(task, x) \
+-({ \
+- unsigned long val; \
+- if (task == current) \
+- val = READ_ONCE(x); \
+- else \
+- val = READ_ONCE_NOCHECK(x); \
+- val; \
+-})
++unsigned long unwind_get_return_address(struct unwind_state *state)
++{
++ if (unwind_done(state))
++ return 0;
++
++ return __kernel_text_address(state->ip) ? state->ip : 0;
++}
++EXPORT_SYMBOL_GPL(unwind_get_return_address);
++
++unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
++{
++ if (unwind_done(state))
++ return NULL;
++
++ return state->regs ? &state->regs->ip : state->bp + 1;
++}
+
+ static void unwind_dump(struct unwind_state *state)
+ {
+@@ -66,15 +68,6 @@ static void unwind_dump(struct unwind_st
+ }
+ }
+
+-unsigned long unwind_get_return_address(struct unwind_state *state)
+-{
+- if (unwind_done(state))
+- return 0;
+-
+- return __kernel_text_address(state->ip) ? state->ip : 0;
+-}
+-EXPORT_SYMBOL_GPL(unwind_get_return_address);
+-
+ static size_t regs_size(struct pt_regs *regs)
+ {
+ /* x86_32 regs from kernel mode are two words shorter: */
+--- a/arch/x86/kernel/unwind_guess.c
++++ b/arch/x86/kernel/unwind_guess.c
+@@ -19,6 +19,11 @@ unsigned long unwind_get_return_address(
+ }
+ EXPORT_SYMBOL_GPL(unwind_get_return_address);
+
++unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
++{
++ return NULL;
++}
++
+ bool unwind_next_frame(struct unwind_state *state)
+ {
+ struct stack_info *info = &state->stack_info;
+--- /dev/null
++++ b/arch/x86/kernel/unwind_orc.c
+@@ -0,0 +1,582 @@
++#include <linux/module.h>
++#include <linux/sort.h>
++#include <asm/ptrace.h>
++#include <asm/stacktrace.h>
++#include <asm/unwind.h>
++#include <asm/orc_types.h>
++#include <asm/orc_lookup.h>
++#include <asm/sections.h>
++
++#define orc_warn(fmt, ...) \
++ printk_deferred_once(KERN_WARNING pr_fmt("WARNING: " fmt), ##__VA_ARGS__)
++
++extern int __start_orc_unwind_ip[];
++extern int __stop_orc_unwind_ip[];
++extern struct orc_entry __start_orc_unwind[];
++extern struct orc_entry __stop_orc_unwind[];
++
++static DEFINE_MUTEX(sort_mutex);
++int *cur_orc_ip_table = __start_orc_unwind_ip;
++struct orc_entry *cur_orc_table = __start_orc_unwind;
++
++unsigned int lookup_num_blocks;
++bool orc_init;
++
++static inline unsigned long orc_ip(const int *ip)
++{
++ return (unsigned long)ip + *ip;
++}
++
++static struct orc_entry *__orc_find(int *ip_table, struct orc_entry *u_table,
++ unsigned int num_entries, unsigned long ip)
++{
++ int *first = ip_table;
++ int *last = ip_table + num_entries - 1;
++ int *mid = first, *found = first;
++
++ if (!num_entries)
++ return NULL;
++
++ /*
++ * Do a binary range search to find the rightmost duplicate of a given
++ * starting address. Some entries are section terminators which are
++ * "weak" entries for ensuring there are no gaps. They should be
++ * ignored when they conflict with a real entry.
++ */
++ while (first <= last) {
++ mid = first + ((last - first) / 2);
++
++ if (orc_ip(mid) <= ip) {
++ found = mid;
++ first = mid + 1;
++ } else
++ last = mid - 1;
++ }
++
++ return u_table + (found - ip_table);
++}
++
++#ifdef CONFIG_MODULES
++static struct orc_entry *orc_module_find(unsigned long ip)
++{
++ struct module *mod;
++
++ mod = __module_address(ip);
++ if (!mod || !mod->arch.orc_unwind || !mod->arch.orc_unwind_ip)
++ return NULL;
++ return __orc_find(mod->arch.orc_unwind_ip, mod->arch.orc_unwind,
++ mod->arch.num_orcs, ip);
++}
++#else
++static struct orc_entry *orc_module_find(unsigned long ip)
++{
++ return NULL;
++}
++#endif
++
++static struct orc_entry *orc_find(unsigned long ip)
++{
++ if (!orc_init)
++ return NULL;
++
++ /* For non-init vmlinux addresses, use the fast lookup table: */
++ if (ip >= LOOKUP_START_IP && ip < LOOKUP_STOP_IP) {
++ unsigned int idx, start, stop;
++
++ idx = (ip - LOOKUP_START_IP) / LOOKUP_BLOCK_SIZE;
++
++ if (unlikely((idx >= lookup_num_blocks-1))) {
++ orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%lx\n",
++ idx, lookup_num_blocks, ip);
++ return NULL;
++ }
++
++ start = orc_lookup[idx];
++ stop = orc_lookup[idx + 1] + 1;
++
++ if (unlikely((__start_orc_unwind + start >= __stop_orc_unwind) ||
++ (__start_orc_unwind + stop > __stop_orc_unwind))) {
++ orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%lx\n",
++ idx, lookup_num_blocks, start, stop, ip);
++ return NULL;
++ }
++
++ return __orc_find(__start_orc_unwind_ip + start,
++ __start_orc_unwind + start, stop - start, ip);
++ }
++
++ /* vmlinux .init slow lookup: */
++ if (ip >= (unsigned long)_sinittext && ip < (unsigned long)_einittext)
++ return __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
++ __stop_orc_unwind_ip - __start_orc_unwind_ip, ip);
++
++ /* Module lookup: */
++ return orc_module_find(ip);
++}
++
++static void orc_sort_swap(void *_a, void *_b, int size)
++{
++ struct orc_entry *orc_a, *orc_b;
++ struct orc_entry orc_tmp;
++ int *a = _a, *b = _b, tmp;
++ int delta = _b - _a;
++
++ /* Swap the .orc_unwind_ip entries: */
++ tmp = *a;
++ *a = *b + delta;
++ *b = tmp - delta;
++
++ /* Swap the corresponding .orc_unwind entries: */
++ orc_a = cur_orc_table + (a - cur_orc_ip_table);
++ orc_b = cur_orc_table + (b - cur_orc_ip_table);
++ orc_tmp = *orc_a;
++ *orc_a = *orc_b;
++ *orc_b = orc_tmp;
++}
++
++static int orc_sort_cmp(const void *_a, const void *_b)
++{
++ struct orc_entry *orc_a;
++ const int *a = _a, *b = _b;
++ unsigned long a_val = orc_ip(a);
++ unsigned long b_val = orc_ip(b);
++
++ if (a_val > b_val)
++ return 1;
++ if (a_val < b_val)
++ return -1;
++
++ /*
++ * The "weak" section terminator entries need to always be on the left
++ * to ensure the lookup code skips them in favor of real entries.
++ * These terminator entries exist to handle any gaps created by
++ * whitelisted .o files which didn't get objtool generation.
++ */
++ orc_a = cur_orc_table + (a - cur_orc_ip_table);
++ return orc_a->sp_reg == ORC_REG_UNDEFINED ? -1 : 1;
++}
++
++#ifdef CONFIG_MODULES
++void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
++ void *_orc, size_t orc_size)
++{
++ int *orc_ip = _orc_ip;
++ struct orc_entry *orc = _orc;
++ unsigned int num_entries = orc_ip_size / sizeof(int);
++
++ WARN_ON_ONCE(orc_ip_size % sizeof(int) != 0 ||
++ orc_size % sizeof(*orc) != 0 ||
++ num_entries != orc_size / sizeof(*orc));
++
++ /*
++ * The 'cur_orc_*' globals allow the orc_sort_swap() callback to
++ * associate an .orc_unwind_ip table entry with its corresponding
++ * .orc_unwind entry so they can both be swapped.
++ */
++ mutex_lock(&sort_mutex);
++ cur_orc_ip_table = orc_ip;
++ cur_orc_table = orc;
++ sort(orc_ip, num_entries, sizeof(int), orc_sort_cmp, orc_sort_swap);
++ mutex_unlock(&sort_mutex);
++
++ mod->arch.orc_unwind_ip = orc_ip;
++ mod->arch.orc_unwind = orc;
++ mod->arch.num_orcs = num_entries;
++}
++#endif
++
++void __init unwind_init(void)
++{
++ size_t orc_ip_size = (void *)__stop_orc_unwind_ip - (void *)__start_orc_unwind_ip;
++ size_t orc_size = (void *)__stop_orc_unwind - (void *)__start_orc_unwind;
++ size_t num_entries = orc_ip_size / sizeof(int);
++ struct orc_entry *orc;
++ int i;
++
++ if (!num_entries || orc_ip_size % sizeof(int) != 0 ||
++ orc_size % sizeof(struct orc_entry) != 0 ||
++ num_entries != orc_size / sizeof(struct orc_entry)) {
++ orc_warn("WARNING: Bad or missing .orc_unwind table. Disabling unwinder.\n");
++ return;
++ }
++
++ /* Sort the .orc_unwind and .orc_unwind_ip tables: */
++ sort(__start_orc_unwind_ip, num_entries, sizeof(int), orc_sort_cmp,
++ orc_sort_swap);
++
++ /* Initialize the fast lookup table: */
++ lookup_num_blocks = orc_lookup_end - orc_lookup;
++ for (i = 0; i < lookup_num_blocks-1; i++) {
++ orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
++ num_entries,
++ LOOKUP_START_IP + (LOOKUP_BLOCK_SIZE * i));
++ if (!orc) {
++ orc_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
++ return;
++ }
++
++ orc_lookup[i] = orc - __start_orc_unwind;
++ }
++
++ /* Initialize the ending block: */
++ orc = __orc_find(__start_orc_unwind_ip, __start_orc_unwind, num_entries,
++ LOOKUP_STOP_IP);
++ if (!orc) {
++ orc_warn("WARNING: Corrupt .orc_unwind table. Disabling unwinder.\n");
++ return;
++ }
++ orc_lookup[lookup_num_blocks-1] = orc - __start_orc_unwind;
++
++ orc_init = true;
++}
++
++unsigned long unwind_get_return_address(struct unwind_state *state)
++{
++ if (unwind_done(state))
++ return 0;
++
++ return __kernel_text_address(state->ip) ? state->ip : 0;
++}
++EXPORT_SYMBOL_GPL(unwind_get_return_address);
++
++unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
++{
++ if (unwind_done(state))
++ return NULL;
++
++ if (state->regs)
++ return &state->regs->ip;
++
++ if (state->sp)
++ return (unsigned long *)state->sp - 1;
++
++ return NULL;
++}
++
++static bool stack_access_ok(struct unwind_state *state, unsigned long addr,
++ size_t len)
++{
++ struct stack_info *info = &state->stack_info;
++
++ /*
++ * If the address isn't on the current stack, switch to the next one.
++ *
++ * We may have to traverse multiple stacks to deal with the possibility
++ * that info->next_sp could point to an empty stack and the address
++ * could be on a subsequent stack.
++ */
++ while (!on_stack(info, (void *)addr, len))
++ if (get_stack_info(info->next_sp, state->task, info,
++ &state->stack_mask))
++ return false;
++
++ return true;
++}
++
++static bool deref_stack_reg(struct unwind_state *state, unsigned long addr,
++ unsigned long *val)
++{
++ if (!stack_access_ok(state, addr, sizeof(long)))
++ return false;
++
++ *val = READ_ONCE_TASK_STACK(state->task, *(unsigned long *)addr);
++ return true;
++}
++
++#define REGS_SIZE (sizeof(struct pt_regs))
++#define SP_OFFSET (offsetof(struct pt_regs, sp))
++#define IRET_REGS_SIZE (REGS_SIZE - offsetof(struct pt_regs, ip))
++#define IRET_SP_OFFSET (SP_OFFSET - offsetof(struct pt_regs, ip))
++
++static bool deref_stack_regs(struct unwind_state *state, unsigned long addr,
++ unsigned long *ip, unsigned long *sp, bool full)
++{
++ size_t regs_size = full ? REGS_SIZE : IRET_REGS_SIZE;
++ size_t sp_offset = full ? SP_OFFSET : IRET_SP_OFFSET;
++ struct pt_regs *regs = (struct pt_regs *)(addr + regs_size - REGS_SIZE);
++
++ if (IS_ENABLED(CONFIG_X86_64)) {
++ if (!stack_access_ok(state, addr, regs_size))
++ return false;
++
++ *ip = regs->ip;
++ *sp = regs->sp;
++
++ return true;
++ }
++
++ if (!stack_access_ok(state, addr, sp_offset))
++ return false;
++
++ *ip = regs->ip;
++
++ if (user_mode(regs)) {
++ if (!stack_access_ok(state, addr + sp_offset,
++ REGS_SIZE - SP_OFFSET))
++ return false;
++
++ *sp = regs->sp;
++ } else
++ *sp = (unsigned long)&regs->sp;
++
++ return true;
++}
++
++bool unwind_next_frame(struct unwind_state *state)
++{
++ unsigned long ip_p, sp, orig_ip, prev_sp = state->sp;
++ enum stack_type prev_type = state->stack_info.type;
++ struct orc_entry *orc;
++ struct pt_regs *ptregs;
++ bool indirect = false;
++
++ if (unwind_done(state))
++ return false;
++
++ /* Don't let modules unload while we're reading their ORC data. */
++ preempt_disable();
++
++ /* Have we reached the end? */
++ if (state->regs && user_mode(state->regs))
++ goto done;
++
++ /*
++ * Find the orc_entry associated with the text address.
++ *
++ * Decrement call return addresses by one so they work for sibling
++ * calls and calls to noreturn functions.
++ */
++ orc = orc_find(state->signal ? state->ip : state->ip - 1);
++ if (!orc || orc->sp_reg == ORC_REG_UNDEFINED)
++ goto done;
++ orig_ip = state->ip;
++
++ /* Find the previous frame's stack: */
++ switch (orc->sp_reg) {
++ case ORC_REG_SP:
++ sp = state->sp + orc->sp_offset;
++ break;
++
++ case ORC_REG_BP:
++ sp = state->bp + orc->sp_offset;
++ break;
++
++ case ORC_REG_SP_INDIRECT:
++ sp = state->sp + orc->sp_offset;
++ indirect = true;
++ break;
++
++ case ORC_REG_BP_INDIRECT:
++ sp = state->bp + orc->sp_offset;
++ indirect = true;
++ break;
++
++ case ORC_REG_R10:
++ if (!state->regs || !state->full_regs) {
++ orc_warn("missing regs for base reg R10 at ip %p\n",
++ (void *)state->ip);
++ goto done;
++ }
++ sp = state->regs->r10;
++ break;
++
++ case ORC_REG_R13:
++ if (!state->regs || !state->full_regs) {
++ orc_warn("missing regs for base reg R13 at ip %p\n",
++ (void *)state->ip);
++ goto done;
++ }
++ sp = state->regs->r13;
++ break;
++
++ case ORC_REG_DI:
++ if (!state->regs || !state->full_regs) {
++ orc_warn("missing regs for base reg DI at ip %p\n",
++ (void *)state->ip);
++ goto done;
++ }
++ sp = state->regs->di;
++ break;
++
++ case ORC_REG_DX:
++ if (!state->regs || !state->full_regs) {
++ orc_warn("missing regs for base reg DX at ip %p\n",
++ (void *)state->ip);
++ goto done;
++ }
++ sp = state->regs->dx;
++ break;
++
++ default:
++ orc_warn("unknown SP base reg %d for ip %p\n",
++ orc->sp_reg, (void *)state->ip);
++ goto done;
++ }
++
++ if (indirect) {
++ if (!deref_stack_reg(state, sp, &sp))
++ goto done;
++ }
++
++ /* Find IP, SP and possibly regs: */
++ switch (orc->type) {
++ case ORC_TYPE_CALL:
++ ip_p = sp - sizeof(long);
++
++ if (!deref_stack_reg(state, ip_p, &state->ip))
++ goto done;
++
++ state->ip = ftrace_graph_ret_addr(state->task, &state->graph_idx,
++ state->ip, (void *)ip_p);
++
++ state->sp = sp;
++ state->regs = NULL;
++ state->signal = false;
++ break;
++
++ case ORC_TYPE_REGS:
++ if (!deref_stack_regs(state, sp, &state->ip, &state->sp, true)) {
++ orc_warn("can't dereference registers at %p for ip %p\n",
++ (void *)sp, (void *)orig_ip);
++ goto done;
++ }
++
++ state->regs = (struct pt_regs *)sp;
++ state->full_regs = true;
++ state->signal = true;
++ break;
++
++ case ORC_TYPE_REGS_IRET:
++ if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) {
++ orc_warn("can't dereference iret registers at %p for ip %p\n",
++ (void *)sp, (void *)orig_ip);
++ goto done;
++ }
++
++ ptregs = container_of((void *)sp, struct pt_regs, ip);
++ if ((unsigned long)ptregs >= prev_sp &&
++ on_stack(&state->stack_info, ptregs, REGS_SIZE)) {
++ state->regs = ptregs;
++ state->full_regs = false;
++ } else
++ state->regs = NULL;
++
++ state->signal = true;
++ break;
++
++ default:
++ orc_warn("unknown .orc_unwind entry type %d\n", orc->type);
++ break;
++ }
++
++ /* Find BP: */
++ switch (orc->bp_reg) {
++ case ORC_REG_UNDEFINED:
++ if (state->regs && state->full_regs)
++ state->bp = state->regs->bp;
++ break;
++
++ case ORC_REG_PREV_SP:
++ if (!deref_stack_reg(state, sp + orc->bp_offset, &state->bp))
++ goto done;
++ break;
++
++ case ORC_REG_BP:
++ if (!deref_stack_reg(state, state->bp + orc->bp_offset, &state->bp))
++ goto done;
++ break;
++
++ default:
++ orc_warn("unknown BP base reg %d for ip %p\n",
++ orc->bp_reg, (void *)orig_ip);
++ goto done;
++ }
++
++ /* Prevent a recursive loop due to bad ORC data: */
++ if (state->stack_info.type == prev_type &&
++ on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) &&
++ state->sp <= prev_sp) {
++ orc_warn("stack going in the wrong direction? ip=%p\n",
++ (void *)orig_ip);
++ goto done;
++ }
++
++ preempt_enable();
++ return true;
++
++done:
++ preempt_enable();
++ state->stack_info.type = STACK_TYPE_UNKNOWN;
++ return false;
++}
++EXPORT_SYMBOL_GPL(unwind_next_frame);
++
++void __unwind_start(struct unwind_state *state, struct task_struct *task,
++ struct pt_regs *regs, unsigned long *first_frame)
++{
++ memset(state, 0, sizeof(*state));
++ state->task = task;
++
++ /*
++ * Refuse to unwind the stack of a task while it's executing on another
++ * CPU. This check is racy, but that's ok: the unwinder has other
++ * checks to prevent it from going off the rails.
++ */
++ if (task_on_another_cpu(task))
++ goto done;
++
++ if (regs) {
++ if (user_mode(regs))
++ goto done;
++
++ state->ip = regs->ip;
++ state->sp = kernel_stack_pointer(regs);
++ state->bp = regs->bp;
++ state->regs = regs;
++ state->full_regs = true;
++ state->signal = true;
++
++ } else if (task == current) {
++ asm volatile("lea (%%rip), %0\n\t"
++ "mov %%rsp, %1\n\t"
++ "mov %%rbp, %2\n\t"
++ : "=r" (state->ip), "=r" (state->sp),
++ "=r" (state->bp));
++
++ } else {
++ struct inactive_task_frame *frame = (void *)task->thread.sp;
++
++ state->sp = task->thread.sp;
++ state->bp = READ_ONCE_NOCHECK(frame->bp);
++ state->ip = READ_ONCE_NOCHECK(frame->ret_addr);
++ }
++
++ if (get_stack_info((unsigned long *)state->sp, state->task,
++ &state->stack_info, &state->stack_mask))
++ return;
++
++ /*
++ * The caller can provide the address of the first frame directly
++ * (first_frame) or indirectly (regs->sp) to indicate which stack frame
++ * to start unwinding at. Skip ahead until we reach it.
++ */
++
++ /* When starting from regs, skip the regs frame: */
++ if (regs) {
++ unwind_next_frame(state);
++ return;
++ }
++
++ /* Otherwise, skip ahead to the user-specified starting frame: */
++ while (!unwind_done(state) &&
++ (!on_stack(&state->stack_info, first_frame, sizeof(long)) ||
++ state->sp <= (unsigned long)first_frame))
++ unwind_next_frame(state);
++
++ return;
++
++done:
++ state->stack_info.type = STACK_TYPE_UNKNOWN;
++ return;
++}
++EXPORT_SYMBOL_GPL(__unwind_start);
+--- a/arch/x86/kernel/vmlinux.lds.S
++++ b/arch/x86/kernel/vmlinux.lds.S
+@@ -24,6 +24,7 @@
+ #include <asm/asm-offsets.h>
+ #include <asm/thread_info.h>
+ #include <asm/page_types.h>
++#include <asm/orc_lookup.h>
+ #include <asm/cache.h>
+ #include <asm/boot.h>
+
+@@ -148,6 +149,8 @@ SECTIONS
+
+ BUG_TABLE
+
++ ORC_UNWIND_TABLE
++
+ . = ALIGN(PAGE_SIZE);
+ __vvar_page = .;
+
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -680,6 +680,31 @@
+ #define BUG_TABLE
+ #endif
+
++#ifdef CONFIG_ORC_UNWINDER
++#define ORC_UNWIND_TABLE \
++ . = ALIGN(4); \
++ .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
++ VMLINUX_SYMBOL(__start_orc_unwind_ip) = .; \
++ KEEP(*(.orc_unwind_ip)) \
++ VMLINUX_SYMBOL(__stop_orc_unwind_ip) = .; \
++ } \
++ . = ALIGN(6); \
++ .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \
++ VMLINUX_SYMBOL(__start_orc_unwind) = .; \
++ KEEP(*(.orc_unwind)) \
++ VMLINUX_SYMBOL(__stop_orc_unwind) = .; \
++ } \
++ . = ALIGN(4); \
++ .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \
++ VMLINUX_SYMBOL(orc_lookup) = .; \
++ . += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \
++ LOOKUP_BLOCK_SIZE) + 1) * 4; \
++ VMLINUX_SYMBOL(orc_lookup_end) = .; \
++ }
++#else
++#define ORC_UNWIND_TABLE
++#endif
++
+ #ifdef CONFIG_PM_TRACE
+ #define TRACEDATA \
+ . = ALIGN(4); \
+@@ -866,7 +891,7 @@
+ DATA_DATA \
+ CONSTRUCTORS \
+ } \
+- BUG_TABLE
++ BUG_TABLE \
+
+ #define INIT_TEXT_SECTION(inittext_align) \
+ . = ALIGN(inittext_align); \
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -384,6 +384,9 @@ config STACK_VALIDATION
+ pointers (if CONFIG_FRAME_POINTER is enabled). This helps ensure
+ that runtime stack traces are more reliable.
+
++ This is also a prerequisite for generation of ORC unwind data, which
++ is needed for CONFIG_ORC_UNWINDER.
++
+ For more information, see
+ tools/objtool/Documentation/stack-validation.txt.
+
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -259,7 +259,8 @@ ifneq ($(SKIP_STACK_VALIDATION),1)
+
+ __objtool_obj := $(objtree)/tools/objtool/objtool
+
+-objtool_args = check
++objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check)
++
+ ifndef CONFIG_FRAME_POINTER
+ objtool_args += --no-fp
+ endif
+@@ -277,6 +278,11 @@ objtool_obj = $(if $(patsubst y%,, \
+ endif # SKIP_STACK_VALIDATION
+ endif # CONFIG_STACK_VALIDATION
+
++# Rebuild all objects when objtool changes, or is enabled/disabled.
++objtool_dep = $(objtool_obj) \
++ $(wildcard include/config/orc/unwinder.h \
++ include/config/stack/validation.h)
++
+ define rule_cc_o_c
+ $(call echo-cmd,checksrc) $(cmd_checksrc) \
+ $(call cmd_and_fixdep,cc_o_c) \
+@@ -299,13 +305,13 @@ cmd_undef_syms = echo
+ endif
+
+ # Built-in and composite module parts
+-$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_obj) FORCE
++$(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
+ $(call cmd,force_checksrc)
+ $(call if_changed_rule,cc_o_c)
+
+ # Single-part modules are special since we need to mark them in $(MODVERDIR)
+
+-$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_obj) FORCE
++$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
+ $(call cmd,force_checksrc)
+ $(call if_changed_rule,cc_o_c)
+ @{ echo $(@:.o=.ko); echo $@; \
+@@ -400,7 +406,7 @@ cmd_modversions_S = \
+ endif
+ endif
+
+-$(obj)/%.o: $(src)/%.S $(objtool_obj) FORCE
++$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
+ $(call if_changed_rule,as_o_S)
+
+ targets += $(real-objs-y) $(real-objs-m) $(lib-y)
diff --git a/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch b/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
index 51ba06f653..1827b52ba3 100644
--- a/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
+++ b/patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
@@ -9,16 +9,17 @@ It may be useful.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
Makefile | 5 +++++
+ arch/x86/Kconfig | 2 +-
arch/x86/Makefile | 2 ++
arch/x86/entry/calling.h | 13 +++++++++++++
arch/x86/kernel/vmlinux.lds.S | 2 ++
arch/x86/tools/relocs.c | 1 +
- lib/Kconfig.debug | 16 ++++++++++++++--
- 6 files changed, 37 insertions(+), 2 deletions(-)
+ lib/Kconfig.debug | 12 ++++++++++++
+ 7 files changed, 36 insertions(+), 1 deletion(-)
--- a/Makefile
+++ b/Makefile
-@@ -732,6 +732,11 @@ endif
+@@ -747,6 +747,11 @@ endif
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
@@ -30,9 +31,20 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
ifdef CONFIG_DEBUG_INFO
ifdef CONFIG_DEBUG_INFO_SPLIT
KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g)
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -167,7 +167,7 @@ config X86
+ select HAVE_PERF_REGS
+ select HAVE_PERF_USER_STACK_DUMP
+ select HAVE_REGS_AND_STACK_ACCESS_API
+- select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
++ select HAVE_RELIABLE_STACKTRACE if X86_64 && (FRAME_POINTER_UNWINDER || ORC_UNWINDER) && STACK_VALIDATION
+ select HAVE_STACK_VALIDATION if X86_64
+ select HAVE_SYSCALL_TRACEPOINTS
+ select HAVE_UNSTABLE_SCHED_CLOCK
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
-@@ -177,7 +177,9 @@ KBUILD_CFLAGS += -pipe
+@@ -230,7 +230,9 @@ KBUILD_CFLAGS += -pipe
# Workaround for a gcc prelease that unfortunately was shipped in a suse release
KBUILD_CFLAGS += -Wno-sign-compare
#
@@ -44,7 +56,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
KBUILD_AFLAGS += $(mflags-y)
--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
-@@ -48,6 +48,19 @@ For 32-bit we have the following convent
+@@ -49,6 +49,19 @@ For 32-bit we have the following convent
*/
@@ -66,7 +78,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
-@@ -344,7 +344,9 @@ SECTIONS
+@@ -348,7 +348,9 @@ SECTIONS
/* Sections to be discarded */
DISCARDS
/DISCARD/ : {
@@ -105,22 +117,18 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
config BOOT_PRINTK_DELAY
bool "Delay each boot printk message by N milliseconds"
depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY
-@@ -1679,7 +1689,8 @@ config FAULT_INJECTION_STACKTRACE_FILTER
- depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
+@@ -1544,6 +1554,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER
depends on !X86_64
select STACKTRACE
-- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE
-+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !X86 && !ARM_UNWIND && !ARC && !SCORE
+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE && !X86
+ select UNWIND_INFO if X86 && !FRAME_POINTER
help
Provide stacktrace filter for fault-injection capabilities
-@@ -1688,7 +1699,8 @@ config LATENCYTOP
- depends on DEBUG_KERNEL
+@@ -1553,6 +1564,7 @@ config LATENCYTOP
depends on STACKTRACE_SUPPORT
depends on PROC_FS
-- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC
-+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !X86 && !ARM_UNWIND && !ARC
+ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !X86
+ select UNWIND_INFO if X86 && !FRAME_POINTER
select KALLSYMS
select KALLSYMS_ALL
diff --git a/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch b/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
new file mode 100644
index 0000000000..d5d800ddd1
--- /dev/null
+++ b/patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
@@ -0,0 +1,83 @@
+From: Andy Lutomirski <luto@kernel.org>
+Date: Tue, 11 Jul 2017 10:33:39 -0500
+Subject: x86/entry/64: Initialize the top of the IRQ stack before switching
+ stacks
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 2995590964da93e1fd9a91550f9c9d9fab28f160
+References: bnc#1018348
+
+The OOPS unwinder wants the word at the top of the IRQ stack to
+point back to the previous stack at all times when the IRQ stack
+is in use. There's currently a one-instruction window in ENTER_IRQ_STACK
+during which this isn't the case. Fix it by writing the old RSP to the
+top of the IRQ stack before jumping.
+
+This currently writes the pointer to the stack twice, which is a bit
+ugly. We could get rid of this by replacing irq_stack_ptr with
+irq_stack_ptr_minus_eight (better name welcome). OTOH, there may be
+all kinds of odd microarchitectural considerations in play that
+affect performance by a few cycles here.
+
+Reported-by: Mike Galbraith <efault@gmx.de>
+Reported-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Signed-off-by: Andy Lutomirski <luto@kernel.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/aae7e79e49914808440ad5310ace138ced2179ca.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/entry/entry_64.S | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/entry/entry_64.S
++++ b/arch/x86/entry/entry_64.S
+@@ -469,6 +469,7 @@ END(irq_entries_start)
+ DEBUG_ENTRY_ASSERT_IRQS_OFF
+ movq %rsp, \old_rsp
+ incl PER_CPU_VAR(irq_count)
++ jnz .Lirq_stack_push_old_rsp_\@
+
+ /*
+ * Right now, if we just incremented irq_count to zero, we've
+@@ -478,9 +479,30 @@ END(irq_entries_start)
+ * it must be *extremely* careful to limit its stack usage. This
+ * could include kprobes and a hypothetical future IST-less #DB
+ * handler.
++ *
++ * The OOPS unwinder relies on the word at the top of the IRQ
++ * stack linking back to the previous RSP for the entire time we're
++ * on the IRQ stack. For this to work reliably, we need to write
++ * it before we actually move ourselves to the IRQ stack.
++ */
++
++ movq \old_rsp, PER_CPU_VAR(irq_stack_union + IRQ_STACK_SIZE - 8)
++ movq PER_CPU_VAR(irq_stack_ptr), %rsp
++
++#ifdef CONFIG_DEBUG_ENTRY
++ /*
++ * If the first movq above becomes wrong due to IRQ stack layout
++ * changes, the only way we'll notice is if we try to unwind right
++ * here. Assert that we set up the stack right to catch this type
++ * of bug quickly.
+ */
++ cmpq -8(%rsp), \old_rsp
++ je .Lirq_stack_okay\@
++ ud2
++ .Lirq_stack_okay\@:
++#endif
+
+- cmovzq PER_CPU_VAR(irq_stack_ptr), %rsp
++.Lirq_stack_push_old_rsp_\@:
+ pushq \old_rsp
+ .endm
+
diff --git a/patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch b/patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch
new file mode 100644
index 0000000000..0875041a26
--- /dev/null
+++ b/patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch
@@ -0,0 +1,99 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Mon, 24 Jul 2017 18:36:58 -0500
+Subject: x86/kconfig: Make it easier to switch to the new ORC unwinder
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: a34a766ff96d9e88572e35a45066279e40a85d84
+References: bnc#1018348
+
+A couple of Kconfig changes which make it much easier to switch to the
+new CONFIG_ORC_UNWINDER:
+
+1) Remove x86 dependencies on CONFIG_FRAME_POINTER for lockdep,
+ latencytop, and fault injection. x86 has a 'guess' unwinder which
+ just scans the stack for kernel text addresses. It's not 100%
+ accurate but in many cases it's good enough. This allows those users
+ who don't want the text overhead of the frame pointer or ORC
+ unwinders to still use these features. More importantly, this also
+ makes it much more straightforward to disable frame pointers.
+
+2) Make CONFIG_ORC_UNWINDER depend on !CONFIG_FRAME_POINTER. While it
+ would be possible to have both enabled, it doesn't really make sense
+ to do so. So enforce a sane configuration to prevent the user from
+ making a dumb mistake.
+
+With these changes, when you disable CONFIG_FRAME_POINTER, "make
+oldconfig" will ask if you want to enable CONFIG_ORC_UNWINDER.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/9985fb91ce5005fe33ea5cc2a20f14bd33c61d03.1500938583.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/Kconfig.debug | 7 +++----
+ lib/Kconfig.debug | 6 +++---
+ 2 files changed, 6 insertions(+), 7 deletions(-)
+
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -358,7 +358,7 @@ config PUNIT_ATOM_DEBUG
+
+ config ORC_UNWINDER
+ bool "ORC unwinder"
+- depends on X86_64
++ depends on X86_64 && !FRAME_POINTER
+ select STACK_VALIDATION
+ ---help---
+ This option enables the ORC (Oops Rewind Capability) unwinder for
+@@ -366,9 +366,8 @@ config ORC_UNWINDER
+ a simplified version of the DWARF Call Frame Information standard.
+
+ This unwinder is more accurate across interrupt entry frames than the
+- frame pointer unwinder. It can also enable a 5-10% performance
+- improvement across the entire kernel if CONFIG_FRAME_POINTER is
+- disabled.
++ frame pointer unwinder. It also enables a 5-10% performance
++ improvement across the entire kernel compared to frame pointers.
+
+ Enabling this option will increase the kernel's runtime memory usage
+ by roughly 2-4MB, depending on your kernel config.
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -1124,7 +1124,7 @@ config LOCKDEP
+ bool
+ depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
+ select STACKTRACE
+- select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE
++ select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390 && !MICROBLAZE && !ARC && !SCORE && !X86
+ select KALLSYMS
+ select KALLSYMS_ALL
+
+@@ -1543,7 +1543,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER
+ depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
+ depends on !X86_64
+ select STACKTRACE
+- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE
++ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !SCORE && !X86
+ help
+ Provide stacktrace filter for fault-injection capabilities
+
+@@ -1552,7 +1552,7 @@ config LATENCYTOP
+ depends on DEBUG_KERNEL
+ depends on STACKTRACE_SUPPORT
+ depends on PROC_FS
+- select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC
++ select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND && !ARC && !X86
+ select KALLSYMS
+ select KALLSYMS_ALL
+ select STACKTRACE
diff --git a/patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch b/patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
index ef26fd9037..b7cff92f5c 100644
--- a/patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
+++ b/patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
@@ -52,31 +52,33 @@ TODO:
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
- arch/x86/Kconfig | 2
- arch/x86/entry/entry_32.S | 21
- arch/x86/entry/entry_64.S | 18
- arch/x86/include/asm/dwarf.h | 138 ++
- arch/x86/include/asm/unwind.h | 32
- arch/x86/kernel/Makefile | 4
- arch/x86/kernel/dumpstack.c | 3
- arch/x86/kernel/unwind_dwarf.c | 101 ++
- include/asm-generic/vmlinux.lds.h | 22
- include/linux/dwarf.h | 61 +
- include/linux/module.h | 4
- init/main.c | 3
- kernel/Makefile | 1
- kernel/dwarf.c | 1801 ++++++++++++++++++++++++++++++++++++++
- kernel/module.c | 32
- lib/Kconfig.debug | 11
+ arch/x86/Kconfig | 2 +-
+ arch/x86/entry/entry_32.S | 21 +
+ arch/x86/entry/entry_64.S | 18 +
+ arch/x86/include/asm/dwarf.h | 138 +++
+ arch/x86/include/asm/unwind.h | 32 +-
+ arch/x86/kernel/Makefile | 4 +
+ arch/x86/kernel/dumpstack.c | 3 +-
+ arch/x86/kernel/unwind_dwarf.c | 101 +++
+ include/asm-generic/vmlinux.lds.h | 22 +
+ include/linux/dwarf.h | 61 ++
+ include/linux/module.h | 4 +
+ init/main.c | 3 +
+ kernel/Makefile | 1 +
+ kernel/dwarf.c | 1801 +++++++++++++++++++++++++++++++++++++
+ kernel/module.c | 32 +-
+ lib/Kconfig.debug | 11 +
16 files changed, 2249 insertions(+), 5 deletions(-)
create mode 100644 arch/x86/include/asm/dwarf.h
create mode 100644 arch/x86/kernel/unwind_dwarf.c
create mode 100644 include/linux/dwarf.h
create mode 100644 kernel/dwarf.c
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
+index cd18994a9555..b37fa89c5f19 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
-@@ -687,7 +687,7 @@ config X86_32_IRIS
+@@ -689,7 +689,7 @@ config X86_32_IRIS
config SCHED_OMIT_FRAME_POINTER
def_bool y
prompt "Single-depth WCHAN output"
@@ -85,9 +87,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---help---
Calculate simpler /proc/<PID>/wchan values. If this option
is disabled then wchan values will recurse back to the
+diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
+index 50bc26949e9e..70c09def2800 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
-@@ -294,6 +294,27 @@ ENTRY(ret_from_fork)
+@@ -291,6 +291,27 @@ ENTRY(ret_from_fork)
jmp 2b
END(ret_from_fork)
@@ -115,9 +119,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/*
* Return to user mode is not as complex as all this looks,
* but we want the default path for a system call return to
+diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
+index 607d72c4a485..e395fc1365f6 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
-@@ -905,6 +905,24 @@ ENTRY(do_softirq_own_stack)
+@@ -902,6 +902,24 @@ ENTRY(do_softirq_own_stack)
ret
END(do_softirq_own_stack)
@@ -142,6 +148,9 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#ifdef CONFIG_XEN
idtentry xen_hypervisor_callback xen_do_hypervisor_callback has_error_code=0
+diff --git a/arch/x86/include/asm/dwarf.h b/arch/x86/include/asm/dwarf.h
+new file mode 100644
+index 000000000000..de030905ceb6
--- /dev/null
+++ b/arch/x86/include/asm/dwarf.h
@@ -0,0 +1,138 @@
@@ -283,12 +292,14 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+#endif /* CONFIG_DWARF_UNWIND */
+
+#endif /* _ASM_X86_DWARF_H */
+diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h
+index e6676495b125..cbd630efaf32 100644
--- a/arch/x86/include/asm/unwind.h
+++ b/arch/x86/include/asm/unwind.h
-@@ -11,7 +11,14 @@ struct unwind_state {
- unsigned long stack_mask;
+@@ -12,7 +12,14 @@ struct unwind_state {
struct task_struct *task;
int graph_idx;
+ bool error;
-#ifdef CONFIG_FRAME_POINTER
+#ifdef CONFIG_DWARF_UNWIND
+ union {
@@ -298,11 +309,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ unsigned long dw_sp;
+ unsigned call_frame:1;
+#elif defined(CONFIG_FRAME_POINTER)
+ bool got_irq;
unsigned long *bp, *orig_sp;
struct pt_regs *regs;
- #else
-@@ -40,7 +47,28 @@ void unwind_start(struct unwind_state *s
- __unwind_start(state, task, regs, first_frame);
+@@ -48,7 +55,28 @@ static inline bool unwind_error(struct unwind_state *state)
+ return state->error;
}
-#ifdef CONFIG_FRAME_POINTER
@@ -331,9 +342,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
static inline
unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
+diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
+index 4b994232cb57..604cbcbba9a5 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
-@@ -123,11 +123,15 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.
+@@ -124,11 +124,15 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
obj-$(CONFIG_TRACING) += tracepoint.o
obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o
@@ -349,9 +362,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
###
# 64 bit specific files
+diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
+index dbce3cca94cb..963c6b60887f 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
-@@ -123,7 +123,8 @@ void show_trace_log_lvl(struct task_stru
+@@ -123,7 +123,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
continue;
}
@@ -361,6 +376,9 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
reliable = 1;
/*
+diff --git a/arch/x86/kernel/unwind_dwarf.c b/arch/x86/kernel/unwind_dwarf.c
+new file mode 100644
+index 000000000000..7842a65ab60d
--- /dev/null
+++ b/arch/x86/kernel/unwind_dwarf.c
@@ -0,0 +1,101 @@
@@ -465,9 +483,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ }
+}
+EXPORT_SYMBOL_GPL(__unwind_start);
+diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
+index 314a0b9219c6..349034b41e60 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
-@@ -407,6 +407,8 @@
+@@ -406,6 +406,8 @@
MEM_KEEP(exit.rodata) \
} \
\
@@ -500,6 +520,9 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+#else
+#define EH_FRAME
+#endif
+diff --git a/include/linux/dwarf.h b/include/linux/dwarf.h
+new file mode 100644
+index 000000000000..2ec3ea4872f1
--- /dev/null
+++ b/include/linux/dwarf.h
@@ -0,0 +1,61 @@
@@ -564,9 +587,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+#endif /* CONFIG_DWARF_UNWIND */
+
+#endif /* _LINUX_DWARF_H */
+diff --git a/include/linux/module.h b/include/linux/module.h
+index 8a0a141cf51b..58e0476173cc 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
-@@ -257,6 +257,7 @@ extern const typeof(name) __mod_##type##
+@@ -257,6 +257,7 @@ extern const typeof(name) __mod_##type##__##name##_device_table \
* files require multiple MODULE_FIRMWARE() specifiers */
#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
@@ -584,6 +609,8 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* Arch-specific module values */
struct mod_arch_specific arch;
+diff --git a/init/main.c b/init/main.c
+index f866510472d7..b9da0aca5738 100644
--- a/init/main.c
+++ b/init/main.c
@@ -22,6 +22,7 @@
@@ -594,7 +621,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/initrd.h>
-@@ -490,6 +491,7 @@ asmlinkage __visible void __init start_k
+@@ -490,6 +491,7 @@ asmlinkage __visible void __init start_kernel(void)
char *command_line;
char *after_dashes;
@@ -602,7 +629,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
set_task_stack_end_magic(&init_task);
smp_setup_processor_id();
debug_objects_early_init();
-@@ -514,6 +516,7 @@ asmlinkage __visible void __init start_k
+@@ -514,6 +516,7 @@ asmlinkage __visible void __init start_kernel(void)
setup_arch(&command_line);
mm_init_cpumask(&init_mm);
setup_command_line(command_line);
@@ -610,6 +637,8 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
setup_nr_cpu_ids();
setup_per_cpu_areas();
boot_cpu_state_init();
+diff --git a/kernel/Makefile b/kernel/Makefile
+index 72aa080f91f0..8fae6c1f5dd7 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_UID16) += uid16.o
@@ -618,8 +647,11 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
obj-$(CONFIG_KALLSYMS) += kallsyms.o
+obj-$(CONFIG_DWARF_UNWIND) += dwarf.o
obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
+ obj-$(CONFIG_CRASH_CORE) += crash_core.o
obj-$(CONFIG_KEXEC_CORE) += kexec_core.o
- obj-$(CONFIG_KEXEC) += kexec.o
+diff --git a/kernel/dwarf.c b/kernel/dwarf.c
+new file mode 100644
+index 000000000000..f83ac856ab1f
--- /dev/null
+++ b/kernel/dwarf.c
@@ -0,0 +1,1801 @@
@@ -2424,6 +2456,8 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+ return dw_fp_fallback(frame);
+}
+EXPORT_SYMBOL_GPL(dwarf_unwind);
+diff --git a/kernel/module.c b/kernel/module.c
+index 65fdb4e8293a..dfd1f3a0b166 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -38,6 +38,7 @@
@@ -2434,7 +2468,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/vermagic.h>
-@@ -327,7 +328,7 @@ struct load_info {
+@@ -330,7 +331,7 @@ struct load_info {
unsigned long mod_kallsyms_init_off;
#endif
struct {
@@ -2443,7 +2477,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
} index;
};
-@@ -750,6 +751,27 @@ bool is_module_percpu_address(unsigned l
+@@ -769,6 +770,27 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
#endif /* CONFIG_SMP */
@@ -2471,7 +2505,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#define MODINFO_ATTR(field) \
static void setup_modinfo_##field(struct module *mod, const char *s) \
{ \
-@@ -2192,6 +2214,8 @@ static void free_module(struct module *m
+@@ -2213,6 +2235,8 @@ static void free_module(struct module *mod)
/* Remove dynamic debug info */
ddebug_remove_module(mod->name);
@@ -2480,7 +2514,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* Arch-specific cleanup. */
module_arch_cleanup(mod);
-@@ -3029,6 +3053,8 @@ static struct module *setup_load_info(st
+@@ -3050,6 +3074,8 @@ static struct module *setup_load_info(struct load_info *info, int flags)
info->index.pcpu = find_pcpusec(info);
@@ -2489,7 +2523,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* Check module struct version now, before we try to use module. */
if (!check_modstruct_version(info->sechdrs, info->index.vers, mod))
return ERR_PTR(-ENOEXEC);
-@@ -3518,6 +3544,7 @@ static noinline int do_init_module(struc
+@@ -3539,6 +3565,7 @@ static noinline int do_init_module(struct module *mod)
/* Drop initial reference. */
module_put(mod);
trim_init_extable(mod);
@@ -2497,7 +2531,7 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
#ifdef CONFIG_KALLSYMS
/* Switch to core kallsyms now init is done: kallsyms may be walking! */
rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms);
-@@ -3793,6 +3820,9 @@ static int load_module(struct load_info
+@@ -3814,6 +3841,9 @@ static int load_module(struct load_info *info, const char __user *uargs,
goto sysfs_cleanup;
}
@@ -2507,6 +2541,8 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
/* Get rid of temporary copy. */
free_copy(info);
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
+index 34c7787f1c17..03297955ece0 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -55,6 +55,17 @@ config UNWIND_INFO
@@ -2527,3 +2563,6 @@ Signed-off-by: Jiri Slaby <jslaby@suse.cz>
config BOOT_PRINTK_DELAY
bool "Delay each boot printk message by N milliseconds"
depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY
+--
+2.13.0
+
diff --git a/patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch b/patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch
new file mode 100644
index 0000000000..259a98c043
--- /dev/null
+++ b/patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch
@@ -0,0 +1,73 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 11 Jul 2017 10:33:40 -0500
+Subject: x86/dumpstack: Fix occasionally missing registers
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: b0529becebde629ff6abf2afdca6def6824f4fa9
+References: bnc#1018348
+
+If two consecutive stack frames have pt_regs, the oops dump code fails
+to print the second frame's registers. Fix that.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Fixes: 3b3fa11bc700 ("x86/dumpstack: Print any pt_regs found on the stack")
+Link: http://lkml.kernel.org/r/269c5c00c7d45c699f3dcea42a3a594c6cf7a9a3.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kernel/dumpstack.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/kernel/dumpstack.c
++++ b/arch/x86/kernel/dumpstack.c
+@@ -94,6 +94,9 @@ void show_trace_log_lvl(struct task_stru
+ if (stack_name)
+ printk("%s <%s>\n", log_lvl, stack_name);
+
++ if (regs && on_stack(&stack_info, regs, sizeof(*regs)))
++ __show_regs(regs, 0);
++
+ /*
+ * Scan the stack, printing any text addresses we find. At the
+ * same time, follow proper stack frames with the unwinder.
+@@ -118,10 +121,8 @@ void show_trace_log_lvl(struct task_stru
+ * Don't print regs->ip again if it was already printed
+ * by __show_regs() below.
+ */
+- if (regs && stack == &regs->ip) {
+- unwind_next_frame(&state);
+- continue;
+- }
++ if (regs && stack == &regs->ip)
++ goto next;
+
+ if (stack == ret_addr_p)
+ reliable = 1;
+@@ -144,6 +145,7 @@ void show_trace_log_lvl(struct task_stru
+ if (!reliable)
+ continue;
+
++next:
+ /*
+ * Get the next frame from the unwinder. No need to
+ * check for an error: if anything goes wrong, the rest
+@@ -153,7 +155,7 @@ void show_trace_log_lvl(struct task_stru
+
+ /* if the frame has entry regs, print them */
+ regs = unwind_get_entry_regs(&state);
+- if (regs)
++ if (regs && on_stack(&stack_info, regs, sizeof(*regs)))
+ __show_regs(regs, 0);
+ }
+
diff --git a/patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch b/patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch
new file mode 100644
index 0000000000..828a7db061
--- /dev/null
+++ b/patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch
@@ -0,0 +1,157 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 25 Jul 2017 08:54:24 -0500
+Subject: x86/kconfig: Consolidate unwinders into multiple choice selection
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 81d387190039c14edac8de2b3ec789beb899afd9
+References: bnc#1018348
+
+There are three mutually exclusive unwinders. Make that more obvious by
+combining them into a multiple-choice selection:
+
+ CONFIG_FRAME_POINTER_UNWINDER
+ CONFIG_ORC_UNWINDER
+ CONFIG_GUESS_UNWINDER (if CONFIG_EXPERT=y)
+
+Frame pointers are still the default (for now).
+
+The old CONFIG_FRAME_POINTER option is still used in some
+arch-independent places, so keep it around, but make it
+invisible to the user on x86 - it's now selected by
+CONFIG_FRAME_POINTER_UNWINDER=y.
+
+Suggested-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/20170725135424.zukjmgpz3plf5pmt@treble
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/Kconfig | 3 --
+ arch/x86/Kconfig.debug | 47 +++++++++++++++++++++++++++++++++++-------
+ arch/x86/configs/tiny.config | 2 +
+ arch/x86/include/asm/unwind.h | 4 +--
+ 4 files changed, 45 insertions(+), 11 deletions(-)
+
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -73,7 +73,6 @@ config X86
+ select ARCH_USE_QUEUED_RWLOCKS
+ select ARCH_USE_QUEUED_SPINLOCKS
+ select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
+- select ARCH_WANT_FRAME_POINTERS
+ select ARCH_WANTS_DYNAMIC_TASK_STRUCT
+ select ARCH_WANTS_THP_SWAP if X86_64
+ select BUILDTIME_EXTABLE_SORT
+@@ -168,7 +167,7 @@ config X86
+ select HAVE_PERF_REGS
+ select HAVE_PERF_USER_STACK_DUMP
+ select HAVE_REGS_AND_STACK_ACCESS_API
+- select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER && STACK_VALIDATION
++ select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION
+ select HAVE_STACK_VALIDATION if X86_64
+ select HAVE_SYSCALL_TRACEPOINTS
+ select HAVE_UNSTABLE_SCHED_CLOCK
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -356,9 +356,32 @@ config PUNIT_ATOM_DEBUG
+ The current power state can be read from
+ /sys/kernel/debug/punit_atom/dev_power_state
+
++choice
++ prompt "Choose kernel unwinder"
++ default FRAME_POINTER_UNWINDER
++ ---help---
++ This determines which method will be used for unwinding kernel stack
++ traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack,
++ livepatch, lockdep, and more.
++
++config FRAME_POINTER_UNWINDER
++ bool "Frame pointer unwinder"
++ select FRAME_POINTER
++ ---help---
++ This option enables the frame pointer unwinder for unwinding kernel
++ stack traces.
++
++ The unwinder itself is fast and it uses less RAM than the ORC
++ unwinder, but the kernel text size will grow by ~3% and the kernel's
++ overall performance will degrade by roughly 5-10%.
++
++ This option is recommended if you want to use the livepatch
++ consistency model, as this is currently the only way to get a
++ reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
++
+ config ORC_UNWINDER
+ bool "ORC unwinder"
+- depends on X86_64 && !FRAME_POINTER
++ depends on X86_64
+ select STACK_VALIDATION
+ ---help---
+ This option enables the ORC (Oops Rewind Capability) unwinder for
+@@ -372,12 +395,22 @@ config ORC_UNWINDER
+ Enabling this option will increase the kernel's runtime memory usage
+ by roughly 2-4MB, depending on your kernel config.
+
+-config FRAME_POINTER_UNWINDER
+- def_bool y
+- depends on !ORC_UNWINDER && FRAME_POINTER
+-
+ config GUESS_UNWINDER
+- def_bool y
+- depends on !ORC_UNWINDER && !FRAME_POINTER
++ bool "Guess unwinder"
++ depends on EXPERT
++ ---help---
++ This option enables the "guess" unwinder for unwinding kernel stack
++ traces. It scans the stack and reports every kernel text address it
++ finds. Some of the addresses it reports may be incorrect.
++
++ While this option often produces false positives, it can still be
++ useful in many cases. Unlike the other unwinders, it has no runtime
++ overhead.
++
++endchoice
++
++config FRAME_POINTER
++ depends on !ORC_UNWINDER && !GUESS_UNWINDER
++ bool
+
+ endmenu
+--- a/arch/x86/configs/tiny.config
++++ b/arch/x86/configs/tiny.config
+@@ -1,3 +1,5 @@
+ CONFIG_NOHIGHMEM=y
+ # CONFIG_HIGHMEM4G is not set
+ # CONFIG_HIGHMEM64G is not set
++CONFIG_GUESS_UNWINDER=y
++# CONFIG_FRAME_POINTER_UNWINDER is not set
+--- a/arch/x86/include/asm/unwind.h
++++ b/arch/x86/include/asm/unwind.h
+@@ -16,7 +16,7 @@ struct unwind_state {
+ bool signal, full_regs;
+ unsigned long sp, bp, ip;
+ struct pt_regs *regs;
+-#elif defined(CONFIG_FRAME_POINTER)
++#elif defined(CONFIG_FRAME_POINTER_UNWINDER)
+ bool got_irq;
+ unsigned long *bp, *orig_sp, ip;
+ struct pt_regs *regs;
+@@ -50,7 +50,7 @@ void unwind_start(struct unwind_state *s
+ __unwind_start(state, task, regs, first_frame);
+ }
+
+-#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER)
++#if defined(CONFIG_ORC_UNWINDER) || defined(CONFIG_FRAME_POINTER_UNWINDER)
+ static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
+ {
+ if (unwind_done(state))
diff --git a/patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch b/patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch
new file mode 100644
index 0000000000..ce24584ba7
--- /dev/null
+++ b/patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch
@@ -0,0 +1,79 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 11 Jul 2017 10:33:41 -0500
+Subject: x86/dumpstack: Fix interrupt and exception stack boundary checks
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 5a3cf86978a1ac433407704ec280919751aa2699
+References: bnc#1018348
+
+On x86_64, the double fault exception stack is located immediately after
+the interrupt stack in memory. This causes confusion in the unwinder
+when it tries to unwind through an empty interrupt stack, where the
+stack pointer points to the address bordering the two stacks. The
+unwinder incorrectly thinks it's running on the double fault stack.
+
+Fix this kind of stack border confusion by never considering the
+beginning address of an exception or interrupt stack to be part of the
+stack.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Fixes: 5fe599e02e41 ("x86/dumpstack: Add support for unwinding empty IRQ stacks")
+Link: http://lkml.kernel.org/r/bcc142160a5104de5c354c21c394c93a0173943f.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kernel/dumpstack_32.c | 4 ++--
+ arch/x86/kernel/dumpstack_64.c | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/kernel/dumpstack_32.c
++++ b/arch/x86/kernel/dumpstack_32.c
+@@ -37,7 +37,7 @@ static bool in_hardirq_stack(unsigned lo
+ * This is a software stack, so 'end' can be a valid stack pointer.
+ * It just means the stack is empty.
+ */
+- if (stack < begin || stack > end)
++ if (stack <= begin || stack > end)
+ return false;
+
+ info->type = STACK_TYPE_IRQ;
+@@ -62,7 +62,7 @@ static bool in_softirq_stack(unsigned lo
+ * This is a software stack, so 'end' can be a valid stack pointer.
+ * It just means the stack is empty.
+ */
+- if (stack < begin || stack > end)
++ if (stack <= begin || stack > end)
+ return false;
+
+ info->type = STACK_TYPE_SOFTIRQ;
+--- a/arch/x86/kernel/dumpstack_64.c
++++ b/arch/x86/kernel/dumpstack_64.c
+@@ -55,7 +55,7 @@ static bool in_exception_stack(unsigned
+ begin = end - (exception_stack_sizes[k] / sizeof(long));
+ regs = (struct pt_regs *)end - 1;
+
+- if (stack < begin || stack >= end)
++ if (stack <= begin || stack >= end)
+ continue;
+
+ info->type = STACK_TYPE_EXCEPTION + k;
+@@ -78,7 +78,7 @@ static bool in_irq_stack(unsigned long *
+ * This is a software stack, so 'end' can be a valid stack pointer.
+ * It just means the stack is empty.
+ */
+- if (stack < begin || stack > end)
++ if (stack <= begin || stack > end)
+ return false;
+
+ info->type = STACK_TYPE_IRQ;
diff --git a/patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch b/patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch
new file mode 100644
index 0000000000..2e0b842e44
--- /dev/null
+++ b/patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch
@@ -0,0 +1,1297 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 11 Jul 2017 10:33:42 -0500
+Subject: objtool: Add ORC unwind table generation
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 627fce14809ba5610b0cb476cd0186d3fcedecfc
+References: bnc#1018348
+
+Now that objtool knows the states of all registers on the stack for each
+instruction, it's straightforward to generate debuginfo for an unwinder
+to use.
+
+Instead of generating DWARF, generate a new format called ORC, which is
+more suitable for an in-kernel unwinder. See
+Documentation/x86/orc-unwinder.txt for a more detailed description of
+this new debuginfo format and why it's preferable to DWARF.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/c9b9f01ba6c5ed2bdc9bb0957b78167fdbf9632e.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ tools/objtool/Build | 3
+ tools/objtool/Documentation/stack-validation.txt | 56 +-----
+ tools/objtool/builtin-check.c | 2
+ tools/objtool/builtin-orc.c | 70 +++++++
+ tools/objtool/builtin.h | 1
+ tools/objtool/check.c | 58 +++++-
+ tools/objtool/check.h | 15 +
+ tools/objtool/elf.c | 212 +++++++++++++++++++++-
+ tools/objtool/elf.h | 15 +
+ tools/objtool/objtool.c | 3
+ tools/objtool/orc.h | 30 +++
+ tools/objtool/orc_dump.c | 212 ++++++++++++++++++++++
+ tools/objtool/orc_gen.c | 214 +++++++++++++++++++++++
+ tools/objtool/orc_types.h | 85 +++++++++
+ 14 files changed, 916 insertions(+), 60 deletions(-)
+ create mode 100644 tools/objtool/builtin-orc.c
+ create mode 100644 tools/objtool/orc.h
+ create mode 100644 tools/objtool/orc_dump.c
+ create mode 100644 tools/objtool/orc_gen.c
+ create mode 100644 tools/objtool/orc_types.h
+
+--- a/tools/objtool/Build
++++ b/tools/objtool/Build
+@@ -1,6 +1,9 @@
+ objtool-y += arch/$(SRCARCH)/
+ objtool-y += builtin-check.o
++objtool-y += builtin-orc.o
+ objtool-y += check.o
++objtool-y += orc_gen.o
++objtool-y += orc_dump.o
+ objtool-y += elf.o
+ objtool-y += special.o
+ objtool-y += objtool.o
+--- a/tools/objtool/Documentation/stack-validation.txt
++++ b/tools/objtool/Documentation/stack-validation.txt
+@@ -11,9 +11,6 @@ analyzes every .o file and ensures the v
+ It enforces a set of rules on asm code and C inline assembly code so
+ that stack traces can be reliable.
+
+-Currently it only checks frame pointer usage, but there are plans to add
+-CFI validation for C files and CFI generation for asm files.
+-
+ For each function, it recursively follows all possible code paths and
+ validates the correct frame pointer state at each instruction.
+
+@@ -23,6 +20,10 @@ alternative execution paths to a given i
+ instructions). Similarly, it knows how to follow switch statements, for
+ which gcc sometimes uses jump tables.
+
++(Objtool also has an 'orc generate' subcommand which generates debuginfo
++for the ORC unwinder. See Documentation/x86/orc-unwinder.txt in the
++kernel tree for more details.)
++
+
+ Why do we need stack metadata validation?
+ -----------------------------------------
+@@ -93,37 +94,14 @@ a) More reliable stack traces for frame
+ or at the very end of the function after the stack frame has been
+ destroyed. This is an inherent limitation of frame pointers.
+
+-b) 100% reliable stack traces for DWARF enabled kernels
++b) ORC (Oops Rewind Capability) unwind table generation
+
+- (NOTE: This is not yet implemented)
++ An alternative to frame pointers and DWARF, ORC unwind data can be
++ used to walk the stack. Unlike frame pointers, ORC data is out of
++ band. So it doesn't affect runtime performance and it can be
++ reliable even when interrupts or exceptions are involved.
+
+- As an alternative to frame pointers, DWARF Call Frame Information
+- (CFI) metadata can be used to walk the stack. Unlike frame pointers,
+- CFI metadata is out of band. So it doesn't affect runtime
+- performance and it can be reliable even when interrupts or exceptions
+- are involved.
+-
+- For C code, gcc automatically generates DWARF CFI metadata. But for
+- asm code, generating CFI is a tedious manual approach which requires
+- manually placed .cfi assembler macros to be scattered throughout the
+- code. It's clumsy and very easy to get wrong, and it makes the real
+- code harder to read.
+-
+- Stacktool will improve this situation in several ways. For code
+- which already has CFI annotations, it will validate them. For code
+- which doesn't have CFI annotations, it will generate them. So an
+- architecture can opt to strip out all the manual .cfi annotations
+- from their asm code and have objtool generate them instead.
+-
+- We might also add a runtime stack validation debug option where we
+- periodically walk the stack from schedule() and/or an NMI to ensure
+- that the stack metadata is sane and that we reach the bottom of the
+- stack.
+-
+- So the benefit of objtool here will be that external tooling should
+- always show perfect stack traces. And the same will be true for
+- kernel warning/oops traces if the architecture has a runtime DWARF
+- unwinder.
++ For more details, see Documentation/x86/orc-unwinder.txt.
+
+ c) Higher live patching compatibility rate
+
+@@ -211,7 +189,7 @@ they mean, and suggestions for how to fi
+ function, add proper frame pointer logic using the FRAME_BEGIN and
+ FRAME_END macros. Otherwise, if it's not a callable function, remove
+ its ELF function annotation by changing ENDPROC to END, and instead
+- use the manual CFI hint macros in asm/undwarf.h.
++ use the manual unwind hint macros in asm/unwind_hints.h.
+
+ If it's a GCC-compiled .c file, the error may be because the function
+ uses an inline asm() statement which has a "call" instruction. An
+@@ -231,8 +209,8 @@ they mean, and suggestions for how to fi
+ If the error is for an asm file, and the instruction is inside (or
+ reachable from) a callable function, the function should be annotated
+ with the ENTRY/ENDPROC macros (ENDPROC is the important one).
+- Otherwise, the code should probably be annotated with the CFI hint
+- macros in asm/undwarf.h so objtool and the unwinder can know the
++ Otherwise, the code should probably be annotated with the unwind hint
++ macros in asm/unwind_hints.h so objtool and the unwinder can know the
+ stack state associated with the code.
+
+ If you're 100% sure the code won't affect stack traces, or if you're
+@@ -258,7 +236,7 @@ they mean, and suggestions for how to fi
+ instructions aren't allowed in a callable function, and are most
+ likely part of the kernel entry code. They should usually not have
+ the callable function annotation (ENDPROC) and should always be
+- annotated with the CFI hint macros in asm/undwarf.h.
++ annotated with the unwind hint macros in asm/unwind_hints.h.
+
+
+ 6. file.o: warning: objtool: func()+0x26: sibling call from callable instruction with modified stack frame
+@@ -272,7 +250,7 @@ they mean, and suggestions for how to fi
+
+ If the instruction is not actually in a callable function (e.g.
+ kernel entry code), change ENDPROC to END and annotate manually with
+- the CFI hint macros in asm/undwarf.h.
++ the unwind hint macros in asm/unwind_hints.h.
+
+
+ 7. file: warning: objtool: func()+0x5c: stack state mismatch
+@@ -288,8 +266,8 @@ they mean, and suggestions for how to fi
+
+ Another possibility is that the code has some asm or inline asm which
+ does some unusual things to the stack or the frame pointer. In such
+- cases it's probably appropriate to use the CFI hint macros in
+- asm/undwarf.h.
++ cases it's probably appropriate to use the unwind hint macros in
++ asm/unwind_hints.h.
+
+
+ 8. file.o: warning: objtool: funcA() falls through to next function funcB()
+--- a/tools/objtool/builtin-check.c
++++ b/tools/objtool/builtin-check.c
+@@ -52,5 +52,5 @@ int cmd_check(int argc, const char **arg
+
+ objname = argv[0];
+
+- return check(objname, nofp);
++ return check(objname, nofp, false);
+ }
+--- /dev/null
++++ b/tools/objtool/builtin-orc.c
+@@ -0,0 +1,70 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++/*
++ * objtool orc:
++ *
++ * This command analyzes a .o file and adds .orc_unwind and .orc_unwind_ip
++ * sections to it, which is used by the in-kernel ORC unwinder.
++ *
++ * This command is a superset of "objtool check".
++ */
++
++#include <string.h>
++#include <subcmd/parse-options.h>
++#include "builtin.h"
++#include "check.h"
++
++
++static const char *orc_usage[] = {
++ "objtool orc generate [<options>] file.o",
++ "objtool orc dump file.o",
++ NULL,
++};
++
++extern const struct option check_options[];
++extern bool nofp;
++
++int cmd_orc(int argc, const char **argv)
++{
++ const char *objname;
++
++ argc--; argv++;
++ if (!strncmp(argv[0], "gen", 3)) {
++ argc = parse_options(argc, argv, check_options, orc_usage, 0);
++ if (argc != 1)
++ usage_with_options(orc_usage, check_options);
++
++ objname = argv[0];
++
++ return check(objname, nofp, true);
++
++ }
++
++ if (!strcmp(argv[0], "dump")) {
++ if (argc != 2)
++ usage_with_options(orc_usage, check_options);
++
++ objname = argv[1];
++
++ return orc_dump(objname);
++ }
++
++ usage_with_options(orc_usage, check_options);
++
++ return 0;
++}
+--- a/tools/objtool/builtin.h
++++ b/tools/objtool/builtin.h
+@@ -18,5 +18,6 @@
+ #define _BUILTIN_H
+
+ extern int cmd_check(int argc, const char **argv);
++extern int cmd_orc(int argc, const char **argv);
+
+ #endif /* _BUILTIN_H */
+--- a/tools/objtool/check.c
++++ b/tools/objtool/check.c
+@@ -36,8 +36,8 @@ const char *objname;
+ static bool nofp;
+ struct cfi_state initial_func_cfi;
+
+-static struct instruction *find_insn(struct objtool_file *file,
+- struct section *sec, unsigned long offset)
++struct instruction *find_insn(struct objtool_file *file,
++ struct section *sec, unsigned long offset)
+ {
+ struct instruction *insn;
+
+@@ -259,6 +259,11 @@ static int decode_instructions(struct ob
+ if (!(sec->sh.sh_flags & SHF_EXECINSTR))
+ continue;
+
++ if (strcmp(sec->name, ".altinstr_replacement") &&
++ strcmp(sec->name, ".altinstr_aux") &&
++ strncmp(sec->name, ".discard.", 9))
++ sec->text = true;
++
+ for (offset = 0; offset < sec->len; offset += insn->len) {
+ insn = malloc(sizeof(*insn));
+ if (!insn) {
+@@ -947,6 +952,30 @@ static bool has_valid_stack_frame(struct
+ return false;
+ }
+
++static int update_insn_state_regs(struct instruction *insn, struct insn_state *state)
++{
++ struct cfi_reg *cfa = &state->cfa;
++ struct stack_op *op = &insn->stack_op;
++
++ if (cfa->base != CFI_SP)
++ return 0;
++
++ /* push */
++ if (op->dest.type == OP_DEST_PUSH)
++ cfa->offset += 8;
++
++ /* pop */
++ if (op->src.type == OP_SRC_POP)
++ cfa->offset -= 8;
++
++ /* add immediate to sp */
++ if (op->dest.type == OP_DEST_REG && op->src.type == OP_SRC_ADD &&
++ op->dest.reg == CFI_SP && op->src.reg == CFI_SP)
++ cfa->offset -= op->src.offset;
++
++ return 0;
++}
++
+ static void save_reg(struct insn_state *state, unsigned char reg, int base,
+ int offset)
+ {
+@@ -1032,6 +1061,9 @@ static int update_insn_state(struct inst
+ return 0;
+ }
+
++ if (state->type == ORC_TYPE_REGS || state->type == ORC_TYPE_REGS_IRET)
++ return update_insn_state_regs(insn, state);
++
+ switch (op->dest.type) {
+
+ case OP_DEST_REG:
+@@ -1323,6 +1355,10 @@ static bool insn_state_match(struct inst
+ break;
+ }
+
++ } else if (state1->type != state2->type) {
++ WARN_FUNC("stack state mismatch: type1=%d type2=%d",
++ insn->sec, insn->offset, state1->type, state2->type);
++
+ } else if (state1->drap != state2->drap ||
+ (state1->drap && state1->drap_reg != state2->drap_reg)) {
+ WARN_FUNC("stack state mismatch: drap1=%d(%d) drap2=%d(%d)",
+@@ -1613,7 +1649,7 @@ static void cleanup(struct objtool_file
+ elf_close(file->elf);
+ }
+
+-int check(const char *_objname, bool _nofp)
++int check(const char *_objname, bool _nofp, bool orc)
+ {
+ struct objtool_file file;
+ int ret, warnings = 0;
+@@ -1621,7 +1657,7 @@ int check(const char *_objname, bool _no
+ objname = _objname;
+ nofp = _nofp;
+
+- file.elf = elf_open(objname);
++ file.elf = elf_open(objname, orc ? O_RDWR : O_RDONLY);
+ if (!file.elf)
+ return 1;
+
+@@ -1654,6 +1690,20 @@ int check(const char *_objname, bool _no
+ warnings += ret;
+ }
+
++ if (orc) {
++ ret = create_orc(&file);
++ if (ret < 0)
++ goto out;
++
++ ret = create_orc_sections(&file);
++ if (ret < 0)
++ goto out;
++
++ ret = elf_write(file.elf);
++ if (ret < 0)
++ goto out;
++ }
++
+ out:
+ cleanup(&file);
+
+--- a/tools/objtool/check.h
++++ b/tools/objtool/check.h
+@@ -22,12 +22,14 @@
+ #include "elf.h"
+ #include "cfi.h"
+ #include "arch.h"
++#include "orc.h"
+ #include <linux/hashtable.h>
+
+ struct insn_state {
+ struct cfi_reg cfa;
+ struct cfi_reg regs[CFI_NUM_REGS];
+ int stack_size;
++ unsigned char type;
+ bool bp_scratch;
+ bool drap;
+ int drap_reg;
+@@ -48,6 +50,7 @@ struct instruction {
+ struct symbol *func;
+ struct stack_op stack_op;
+ struct insn_state state;
++ struct orc_entry orc;
+ };
+
+ struct objtool_file {
+@@ -58,9 +61,19 @@ struct objtool_file {
+ bool ignore_unreachables, c_file;
+ };
+
+-int check(const char *objname, bool nofp);
++int check(const char *objname, bool nofp, bool orc);
++
++struct instruction *find_insn(struct objtool_file *file,
++ struct section *sec, unsigned long offset);
+
+ #define for_each_insn(file, insn) \
+ list_for_each_entry(insn, &file->insn_list, list)
+
++#define sec_for_each_insn(file, sec, insn) \
++ for (insn = find_insn(file, sec, 0); \
++ insn && &insn->list != &file->insn_list && \
++ insn->sec == sec; \
++ insn = list_next_entry(insn, list))
++
++
+ #endif /* _CHECK_H */
+--- a/tools/objtool/elf.c
++++ b/tools/objtool/elf.c
+@@ -30,16 +30,6 @@
+ #include "elf.h"
+ #include "warn.h"
+
+-/*
+- * Fallback for systems without this "read, mmaping if possible" cmd.
+- */
+-#ifndef ELF_C_READ_MMAP
+-#define ELF_C_READ_MMAP ELF_C_READ
+-#endif
+-
+-#define WARN_ELF(format, ...) \
+- WARN(format ": %s", ##__VA_ARGS__, elf_errmsg(-1))
+-
+ struct section *find_section_by_name(struct elf *elf, const char *name)
+ {
+ struct section *sec;
+@@ -349,9 +339,10 @@ static int read_relas(struct elf *elf)
+ return 0;
+ }
+
+-struct elf *elf_open(const char *name)
++struct elf *elf_open(const char *name, int flags)
+ {
+ struct elf *elf;
++ Elf_Cmd cmd;
+
+ elf_version(EV_CURRENT);
+
+@@ -364,13 +355,20 @@ struct elf *elf_open(const char *name)
+
+ INIT_LIST_HEAD(&elf->sections);
+
+- elf->fd = open(name, O_RDONLY);
++ elf->fd = open(name, flags);
+ if (elf->fd == -1) {
+ perror("open");
+ goto err;
+ }
+
+- elf->elf = elf_begin(elf->fd, ELF_C_READ_MMAP, NULL);
++ if ((flags & O_ACCMODE) == O_RDONLY)
++ cmd = ELF_C_READ_MMAP;
++ else if ((flags & O_ACCMODE) == O_RDWR)
++ cmd = ELF_C_RDWR;
++ else /* O_WRONLY */
++ cmd = ELF_C_WRITE;
++
++ elf->elf = elf_begin(elf->fd, cmd, NULL);
+ if (!elf->elf) {
+ WARN_ELF("elf_begin");
+ goto err;
+@@ -397,6 +395,194 @@ err:
+ return NULL;
+ }
+
++struct section *elf_create_section(struct elf *elf, const char *name,
++ size_t entsize, int nr)
++{
++ struct section *sec, *shstrtab;
++ size_t size = entsize * nr;
++ struct Elf_Scn *s;
++ Elf_Data *data;
++
++ sec = malloc(sizeof(*sec));
++ if (!sec) {
++ perror("malloc");
++ return NULL;
++ }
++ memset(sec, 0, sizeof(*sec));
++
++ INIT_LIST_HEAD(&sec->symbol_list);
++ INIT_LIST_HEAD(&sec->rela_list);
++ hash_init(sec->rela_hash);
++ hash_init(sec->symbol_hash);
++
++ list_add_tail(&sec->list, &elf->sections);
++
++ s = elf_newscn(elf->elf);
++ if (!s) {
++ WARN_ELF("elf_newscn");
++ return NULL;
++ }
++
++ sec->name = strdup(name);
++ if (!sec->name) {
++ perror("strdup");
++ return NULL;
++ }
++
++ sec->idx = elf_ndxscn(s);
++ sec->len = size;
++ sec->changed = true;
++
++ sec->data = elf_newdata(s);
++ if (!sec->data) {
++ WARN_ELF("elf_newdata");
++ return NULL;
++ }
++
++ sec->data->d_size = size;
++ sec->data->d_align = 1;
++
++ if (size) {
++ sec->data->d_buf = malloc(size);
++ if (!sec->data->d_buf) {
++ perror("malloc");
++ return NULL;
++ }
++ memset(sec->data->d_buf, 0, size);
++ }
++
++ if (!gelf_getshdr(s, &sec->sh)) {
++ WARN_ELF("gelf_getshdr");
++ return NULL;
++ }
++
++ sec->sh.sh_size = size;
++ sec->sh.sh_entsize = entsize;
++ sec->sh.sh_type = SHT_PROGBITS;
++ sec->sh.sh_addralign = 1;
++ sec->sh.sh_flags = SHF_ALLOC;
++
++
++ /* Add section name to .shstrtab */
++ shstrtab = find_section_by_name(elf, ".shstrtab");
++ if (!shstrtab) {
++ WARN("can't find .shstrtab section");
++ return NULL;
++ }
++
++ s = elf_getscn(elf->elf, shstrtab->idx);
++ if (!s) {
++ WARN_ELF("elf_getscn");
++ return NULL;
++ }
++
++ data = elf_newdata(s);
++ if (!data) {
++ WARN_ELF("elf_newdata");
++ return NULL;
++ }
++
++ data->d_buf = sec->name;
++ data->d_size = strlen(name) + 1;
++ data->d_align = 1;
++
++ sec->sh.sh_name = shstrtab->len;
++
++ shstrtab->len += strlen(name) + 1;
++ shstrtab->changed = true;
++
++ return sec;
++}
++
++struct section *elf_create_rela_section(struct elf *elf, struct section *base)
++{
++ char *relaname;
++ struct section *sec;
++
++ relaname = malloc(strlen(base->name) + strlen(".rela") + 1);
++ if (!relaname) {
++ perror("malloc");
++ return NULL;
++ }
++ strcpy(relaname, ".rela");
++ strcat(relaname, base->name);
++
++ sec = elf_create_section(elf, relaname, sizeof(GElf_Rela), 0);
++ if (!sec)
++ return NULL;
++
++ base->rela = sec;
++ sec->base = base;
++
++ sec->sh.sh_type = SHT_RELA;
++ sec->sh.sh_addralign = 8;
++ sec->sh.sh_link = find_section_by_name(elf, ".symtab")->idx;
++ sec->sh.sh_info = base->idx;
++ sec->sh.sh_flags = SHF_INFO_LINK;
++
++ return sec;
++}
++
++int elf_rebuild_rela_section(struct section *sec)
++{
++ struct rela *rela;
++ int nr, idx = 0, size;
++ GElf_Rela *relas;
++
++ nr = 0;
++ list_for_each_entry(rela, &sec->rela_list, list)
++ nr++;
++
++ size = nr * sizeof(*relas);
++ relas = malloc(size);
++ if (!relas) {
++ perror("malloc");
++ return -1;
++ }
++
++ sec->data->d_buf = relas;
++ sec->data->d_size = size;
++
++ sec->sh.sh_size = size;
++
++ idx = 0;
++ list_for_each_entry(rela, &sec->rela_list, list) {
++ relas[idx].r_offset = rela->offset;
++ relas[idx].r_addend = rela->addend;
++ relas[idx].r_info = GELF_R_INFO(rela->sym->idx, rela->type);
++ idx++;
++ }
++
++ return 0;
++}
++
++int elf_write(struct elf *elf)
++{
++ struct section *sec;
++ Elf_Scn *s;
++
++ list_for_each_entry(sec, &elf->sections, list) {
++ if (sec->changed) {
++ s = elf_getscn(elf->elf, sec->idx);
++ if (!s) {
++ WARN_ELF("elf_getscn");
++ return -1;
++ }
++ if (!gelf_update_shdr (s, &sec->sh)) {
++ WARN_ELF("gelf_update_shdr");
++ return -1;
++ }
++ }
++ }
++
++ if (elf_update(elf->elf, ELF_C_WRITE) < 0) {
++ WARN_ELF("elf_update");
++ return -1;
++ }
++
++ return 0;
++}
++
+ void elf_close(struct elf *elf)
+ {
+ struct section *sec, *tmpsec;
+--- a/tools/objtool/elf.h
++++ b/tools/objtool/elf.h
+@@ -28,6 +28,13 @@
+ # define elf_getshdrstrndx elf_getshstrndx
+ #endif
+
++/*
++ * Fallback for systems without this "read, mmaping if possible" cmd.
++ */
++#ifndef ELF_C_READ_MMAP
++#define ELF_C_READ_MMAP ELF_C_READ
++#endif
++
+ struct section {
+ struct list_head list;
+ GElf_Shdr sh;
+@@ -41,6 +48,7 @@ struct section {
+ char *name;
+ int idx;
+ unsigned int len;
++ bool changed, text;
+ };
+
+ struct symbol {
+@@ -75,7 +83,7 @@ struct elf {
+ };
+
+
+-struct elf *elf_open(const char *name);
++struct elf *elf_open(const char *name, int flags);
+ struct section *find_section_by_name(struct elf *elf, const char *name);
+ struct symbol *find_symbol_by_offset(struct section *sec, unsigned long offset);
+ struct symbol *find_symbol_containing(struct section *sec, unsigned long offset);
+@@ -83,6 +91,11 @@ struct rela *find_rela_by_dest(struct se
+ struct rela *find_rela_by_dest_range(struct section *sec, unsigned long offset,
+ unsigned int len);
+ struct symbol *find_containing_func(struct section *sec, unsigned long offset);
++struct section *elf_create_section(struct elf *elf, const char *name, size_t
++ entsize, int nr);
++struct section *elf_create_rela_section(struct elf *elf, struct section *base);
++int elf_rebuild_rela_section(struct section *sec);
++int elf_write(struct elf *elf);
+ void elf_close(struct elf *elf);
+
+ #define for_each_sec(file, sec) \
+--- a/tools/objtool/objtool.c
++++ b/tools/objtool/objtool.c
+@@ -42,10 +42,11 @@ struct cmd_struct {
+ };
+
+ static const char objtool_usage_string[] =
+- "objtool [OPTIONS] COMMAND [ARGS]";
++ "objtool COMMAND [ARGS]";
+
+ static struct cmd_struct objtool_cmds[] = {
+ {"check", cmd_check, "Perform stack metadata validation on an object file" },
++ {"orc", cmd_orc, "Generate in-place ORC unwind tables for an object file" },
+ };
+
+ bool help;
+--- /dev/null
++++ b/tools/objtool/orc.h
+@@ -0,0 +1,30 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef _ORC_H
++#define _ORC_H
++
++#include "orc_types.h"
++
++struct objtool_file;
++
++int create_orc(struct objtool_file *file);
++int create_orc_sections(struct objtool_file *file);
++
++int orc_dump(const char *objname);
++
++#endif /* _ORC_H */
+--- /dev/null
++++ b/tools/objtool/orc_dump.c
+@@ -0,0 +1,212 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <unistd.h>
++#include "orc.h"
++#include "warn.h"
++
++static const char *reg_name(unsigned int reg)
++{
++ switch (reg) {
++ case ORC_REG_PREV_SP:
++ return "prevsp";
++ case ORC_REG_DX:
++ return "dx";
++ case ORC_REG_DI:
++ return "di";
++ case ORC_REG_BP:
++ return "bp";
++ case ORC_REG_SP:
++ return "sp";
++ case ORC_REG_R10:
++ return "r10";
++ case ORC_REG_R13:
++ return "r13";
++ case ORC_REG_BP_INDIRECT:
++ return "bp(ind)";
++ case ORC_REG_SP_INDIRECT:
++ return "sp(ind)";
++ default:
++ return "?";
++ }
++}
++
++static const char *orc_type_name(unsigned int type)
++{
++ switch (type) {
++ case ORC_TYPE_CALL:
++ return "call";
++ case ORC_TYPE_REGS:
++ return "regs";
++ case ORC_TYPE_REGS_IRET:
++ return "iret";
++ default:
++ return "?";
++ }
++}
++
++static void print_reg(unsigned int reg, int offset)
++{
++ if (reg == ORC_REG_BP_INDIRECT)
++ printf("(bp%+d)", offset);
++ else if (reg == ORC_REG_SP_INDIRECT)
++ printf("(sp%+d)", offset);
++ else if (reg == ORC_REG_UNDEFINED)
++ printf("(und)");
++ else
++ printf("%s%+d", reg_name(reg), offset);
++}
++
++int orc_dump(const char *_objname)
++{
++ int fd, nr_entries, i, *orc_ip = NULL, orc_size = 0;
++ struct orc_entry *orc = NULL;
++ char *name;
++ unsigned long nr_sections, orc_ip_addr = 0;
++ size_t shstrtab_idx;
++ Elf *elf;
++ Elf_Scn *scn;
++ GElf_Shdr sh;
++ GElf_Rela rela;
++ GElf_Sym sym;
++ Elf_Data *data, *symtab = NULL, *rela_orc_ip = NULL;
++
++
++ objname = _objname;
++
++ elf_version(EV_CURRENT);
++
++ fd = open(objname, O_RDONLY);
++ if (fd == -1) {
++ perror("open");
++ return -1;
++ }
++
++ elf = elf_begin(fd, ELF_C_READ_MMAP, NULL);
++ if (!elf) {
++ WARN_ELF("elf_begin");
++ return -1;
++ }
++
++ if (elf_getshdrnum(elf, &nr_sections)) {
++ WARN_ELF("elf_getshdrnum");
++ return -1;
++ }
++
++ if (elf_getshdrstrndx(elf, &shstrtab_idx)) {
++ WARN_ELF("elf_getshdrstrndx");
++ return -1;
++ }
++
++ for (i = 0; i < nr_sections; i++) {
++ scn = elf_getscn(elf, i);
++ if (!scn) {
++ WARN_ELF("elf_getscn");
++ return -1;
++ }
++
++ if (!gelf_getshdr(scn, &sh)) {
++ WARN_ELF("gelf_getshdr");
++ return -1;
++ }
++
++ name = elf_strptr(elf, shstrtab_idx, sh.sh_name);
++ if (!name) {
++ WARN_ELF("elf_strptr");
++ return -1;
++ }
++
++ data = elf_getdata(scn, NULL);
++ if (!data) {
++ WARN_ELF("elf_getdata");
++ return -1;
++ }
++
++ if (!strcmp(name, ".symtab")) {
++ symtab = data;
++ } else if (!strcmp(name, ".orc_unwind")) {
++ orc = data->d_buf;
++ orc_size = sh.sh_size;
++ } else if (!strcmp(name, ".orc_unwind_ip")) {
++ orc_ip = data->d_buf;
++ orc_ip_addr = sh.sh_addr;
++ } else if (!strcmp(name, ".rela.orc_unwind_ip")) {
++ rela_orc_ip = data;
++ }
++ }
++
++ if (!symtab || !orc || !orc_ip)
++ return 0;
++
++ if (orc_size % sizeof(*orc) != 0) {
++ WARN("bad .orc_unwind section size");
++ return -1;
++ }
++
++ nr_entries = orc_size / sizeof(*orc);
++ for (i = 0; i < nr_entries; i++) {
++ if (rela_orc_ip) {
++ if (!gelf_getrela(rela_orc_ip, i, &rela)) {
++ WARN_ELF("gelf_getrela");
++ return -1;
++ }
++
++ if (!gelf_getsym(symtab, GELF_R_SYM(rela.r_info), &sym)) {
++ WARN_ELF("gelf_getsym");
++ return -1;
++ }
++
++ scn = elf_getscn(elf, sym.st_shndx);
++ if (!scn) {
++ WARN_ELF("elf_getscn");
++ return -1;
++ }
++
++ if (!gelf_getshdr(scn, &sh)) {
++ WARN_ELF("gelf_getshdr");
++ return -1;
++ }
++
++ name = elf_strptr(elf, shstrtab_idx, sh.sh_name);
++ if (!name || !*name) {
++ WARN_ELF("elf_strptr");
++ return -1;
++ }
++
++ printf("%s+%lx:", name, rela.r_addend);
++
++ } else {
++ printf("%lx:", orc_ip_addr + (i * sizeof(int)) + orc_ip[i]);
++ }
++
++
++ printf(" sp:");
++
++ print_reg(orc[i].sp_reg, orc[i].sp_offset);
++
++ printf(" bp:");
++
++ print_reg(orc[i].bp_reg, orc[i].bp_offset);
++
++ printf(" type:%s\n", orc_type_name(orc[i].type));
++ }
++
++ elf_end(elf);
++ close(fd);
++
++ return 0;
++}
+--- /dev/null
++++ b/tools/objtool/orc_gen.c
+@@ -0,0 +1,214 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <stdlib.h>
++#include <string.h>
++
++#include "orc.h"
++#include "check.h"
++#include "warn.h"
++
++int create_orc(struct objtool_file *file)
++{
++ struct instruction *insn;
++
++ for_each_insn(file, insn) {
++ struct orc_entry *orc = &insn->orc;
++ struct cfi_reg *cfa = &insn->state.cfa;
++ struct cfi_reg *bp = &insn->state.regs[CFI_BP];
++
++ if (cfa->base == CFI_UNDEFINED) {
++ orc->sp_reg = ORC_REG_UNDEFINED;
++ continue;
++ }
++
++ switch (cfa->base) {
++ case CFI_SP:
++ orc->sp_reg = ORC_REG_SP;
++ break;
++ case CFI_SP_INDIRECT:
++ orc->sp_reg = ORC_REG_SP_INDIRECT;
++ break;
++ case CFI_BP:
++ orc->sp_reg = ORC_REG_BP;
++ break;
++ case CFI_BP_INDIRECT:
++ orc->sp_reg = ORC_REG_BP_INDIRECT;
++ break;
++ case CFI_R10:
++ orc->sp_reg = ORC_REG_R10;
++ break;
++ case CFI_R13:
++ orc->sp_reg = ORC_REG_R13;
++ break;
++ case CFI_DI:
++ orc->sp_reg = ORC_REG_DI;
++ break;
++ case CFI_DX:
++ orc->sp_reg = ORC_REG_DX;
++ break;
++ default:
++ WARN_FUNC("unknown CFA base reg %d",
++ insn->sec, insn->offset, cfa->base);
++ return -1;
++ }
++
++ switch(bp->base) {
++ case CFI_UNDEFINED:
++ orc->bp_reg = ORC_REG_UNDEFINED;
++ break;
++ case CFI_CFA:
++ orc->bp_reg = ORC_REG_PREV_SP;
++ break;
++ case CFI_BP:
++ orc->bp_reg = ORC_REG_BP;
++ break;
++ default:
++ WARN_FUNC("unknown BP base reg %d",
++ insn->sec, insn->offset, bp->base);
++ return -1;
++ }
++
++ orc->sp_offset = cfa->offset;
++ orc->bp_offset = bp->offset;
++ orc->type = insn->state.type;
++ }
++
++ return 0;
++}
++
++static int create_orc_entry(struct section *u_sec, struct section *ip_relasec,
++ unsigned int idx, struct section *insn_sec,
++ unsigned long insn_off, struct orc_entry *o)
++{
++ struct orc_entry *orc;
++ struct rela *rela;
++
++ /* populate ORC data */
++ orc = (struct orc_entry *)u_sec->data->d_buf + idx;
++ memcpy(orc, o, sizeof(*orc));
++
++ /* populate rela for ip */
++ rela = malloc(sizeof(*rela));
++ if (!rela) {
++ perror("malloc");
++ return -1;
++ }
++ memset(rela, 0, sizeof(*rela));
++
++ rela->sym = insn_sec->sym;
++ rela->addend = insn_off;
++ rela->type = R_X86_64_PC32;
++ rela->offset = idx * sizeof(int);
++
++ list_add_tail(&rela->list, &ip_relasec->rela_list);
++ hash_add(ip_relasec->rela_hash, &rela->hash, rela->offset);
++
++ return 0;
++}
++
++int create_orc_sections(struct objtool_file *file)
++{
++ struct instruction *insn, *prev_insn;
++ struct section *sec, *u_sec, *ip_relasec;
++ unsigned int idx;
++
++ struct orc_entry empty = {
++ .sp_reg = ORC_REG_UNDEFINED,
++ .bp_reg = ORC_REG_UNDEFINED,
++ .type = ORC_TYPE_CALL,
++ };
++
++ sec = find_section_by_name(file->elf, ".orc_unwind");
++ if (sec) {
++ WARN("file already has .orc_unwind section, skipping");
++ return -1;
++ }
++
++ /* count the number of needed orcs */
++ idx = 0;
++ for_each_sec(file, sec) {
++ if (!sec->text)
++ continue;
++
++ prev_insn = NULL;
++ sec_for_each_insn(file, sec, insn) {
++ if (!prev_insn ||
++ memcmp(&insn->orc, &prev_insn->orc,
++ sizeof(struct orc_entry))) {
++ idx++;
++ }
++ prev_insn = insn;
++ }
++
++ /* section terminator */
++ if (prev_insn)
++ idx++;
++ }
++ if (!idx)
++ return -1;
++
++
++ /* create .orc_unwind_ip and .rela.orc_unwind_ip sections */
++ sec = elf_create_section(file->elf, ".orc_unwind_ip", sizeof(int), idx);
++
++ ip_relasec = elf_create_rela_section(file->elf, sec);
++ if (!ip_relasec)
++ return -1;
++
++ /* create .orc_unwind section */
++ u_sec = elf_create_section(file->elf, ".orc_unwind",
++ sizeof(struct orc_entry), idx);
++
++ /* populate sections */
++ idx = 0;
++ for_each_sec(file, sec) {
++ if (!sec->text)
++ continue;
++
++ prev_insn = NULL;
++ sec_for_each_insn(file, sec, insn) {
++ if (!prev_insn || memcmp(&insn->orc, &prev_insn->orc,
++ sizeof(struct orc_entry))) {
++
++ if (create_orc_entry(u_sec, ip_relasec, idx,
++ insn->sec, insn->offset,
++ &insn->orc))
++ return -1;
++
++ idx++;
++ }
++ prev_insn = insn;
++ }
++
++ /* section terminator */
++ if (prev_insn) {
++ if (create_orc_entry(u_sec, ip_relasec, idx,
++ prev_insn->sec,
++ prev_insn->offset + prev_insn->len,
++ &empty))
++ return -1;
++
++ idx++;
++ }
++ }
++
++ if (elf_rebuild_rela_section(ip_relasec))
++ return -1;
++
++ return 0;
++}
+--- /dev/null
++++ b/tools/objtool/orc_types.h
+@@ -0,0 +1,85 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef _ORC_TYPES_H
++#define _ORC_TYPES_H
++
++#include <linux/types.h>
++#include <linux/compiler.h>
++
++/*
++ * The ORC_REG_* registers are base registers which are used to find other
++ * registers on the stack.
++ *
++ * ORC_REG_PREV_SP, also known as DWARF Call Frame Address (CFA), is the
++ * address of the previous frame: the caller's SP before it called the current
++ * function.
++ *
++ * ORC_REG_UNDEFINED means the corresponding register's value didn't change in
++ * the current frame.
++ *
++ * The most commonly used base registers are SP and BP -- which the previous SP
++ * is usually based on -- and PREV_SP and UNDEFINED -- which the previous BP is
++ * usually based on.
++ *
++ * The rest of the base registers are needed for special cases like entry code
++ * and GCC realigned stacks.
++ */
++#define ORC_REG_UNDEFINED 0
++#define ORC_REG_PREV_SP 1
++#define ORC_REG_DX 2
++#define ORC_REG_DI 3
++#define ORC_REG_BP 4
++#define ORC_REG_SP 5
++#define ORC_REG_R10 6
++#define ORC_REG_R13 7
++#define ORC_REG_BP_INDIRECT 8
++#define ORC_REG_SP_INDIRECT 9
++#define ORC_REG_MAX 15
++
++/*
++ * ORC_TYPE_CALL: Indicates that sp_reg+sp_offset resolves to PREV_SP (the
++ * caller's SP right before it made the call). Used for all callable
++ * functions, i.e. all C code and all callable asm functions.
++ *
++ * ORC_TYPE_REGS: Used in entry code to indicate that sp_reg+sp_offset points
++ * to a fully populated pt_regs from a syscall, interrupt, or exception.
++ *
++ * ORC_TYPE_REGS_IRET: Used in entry code to indicate that sp_reg+sp_offset
++ * points to the iret return frame.
++ */
++#define ORC_TYPE_CALL 0
++#define ORC_TYPE_REGS 1
++#define ORC_TYPE_REGS_IRET 2
++
++/*
++ * This struct is more or less a vastly simplified version of the DWARF Call
++ * Frame Information standard. It contains only the necessary parts of DWARF
++ * CFI, simplified for ease of access by the in-kernel unwinder. It tells the
++ * unwinder how to find the previous SP and BP (and sometimes entry regs) on
++ * the stack for a given code address. Each instance of the struct corresponds
++ * to one or more code locations.
++ */
++struct orc_entry {
++ s16 sp_offset;
++ s16 bp_offset;
++ unsigned sp_reg:4;
++ unsigned bp_reg:4;
++ unsigned type:2;
++} __packed;
++
++#endif /* _ORC_TYPES_H */
diff --git a/patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch b/patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch
new file mode 100644
index 0000000000..83a12a88b3
--- /dev/null
+++ b/patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch
@@ -0,0 +1,617 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 11 Jul 2017 10:33:43 -0500
+Subject: objtool, x86: Add facility for asm code to provide unwind hints
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 39358a033b2e4432052265c1fa0f36f572d8cfb5
+References: bnc#1018348
+
+Some asm (and inline asm) code does special things to the stack which
+objtool can't understand. (Nor can GCC or GNU assembler, for that
+matter.) In such cases we need a facility for the code to provide
+annotations, so the unwinder can unwind through it.
+
+This provides such a facility, in the form of unwind hints. They're
+similar to the GNU assembler .cfi* directives, but they give more
+information, and are needed in far fewer places, because objtool can
+fill in the blanks by following branches and adjusting the stack pointer
+for pushes and pops.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/0f5f3c9104fca559ff4088bece1d14ae3bca52d5.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/include/asm/orc_types.h | 107 ++++++++++++++++++++
+ arch/x86/include/asm/unwind_hints.h | 103 +++++++++++++++++++
+ tools/objtool/Makefile | 3
+ tools/objtool/check.c | 191 +++++++++++++++++++++++++++++++++---
+ tools/objtool/check.h | 4
+ tools/objtool/orc_types.h | 22 ++++
+ 6 files changed, 417 insertions(+), 13 deletions(-)
+ create mode 100644 arch/x86/include/asm/orc_types.h
+ create mode 100644 arch/x86/include/asm/unwind_hints.h
+
+--- /dev/null
++++ b/arch/x86/include/asm/orc_types.h
+@@ -0,0 +1,107 @@
++/*
++ * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef _ORC_TYPES_H
++#define _ORC_TYPES_H
++
++#include <linux/types.h>
++#include <linux/compiler.h>
++
++/*
++ * The ORC_REG_* registers are base registers which are used to find other
++ * registers on the stack.
++ *
++ * ORC_REG_PREV_SP, also known as DWARF Call Frame Address (CFA), is the
++ * address of the previous frame: the caller's SP before it called the current
++ * function.
++ *
++ * ORC_REG_UNDEFINED means the corresponding register's value didn't change in
++ * the current frame.
++ *
++ * The most commonly used base registers are SP and BP -- which the previous SP
++ * is usually based on -- and PREV_SP and UNDEFINED -- which the previous BP is
++ * usually based on.
++ *
++ * The rest of the base registers are needed for special cases like entry code
++ * and GCC realigned stacks.
++ */
++#define ORC_REG_UNDEFINED 0
++#define ORC_REG_PREV_SP 1
++#define ORC_REG_DX 2
++#define ORC_REG_DI 3
++#define ORC_REG_BP 4
++#define ORC_REG_SP 5
++#define ORC_REG_R10 6
++#define ORC_REG_R13 7
++#define ORC_REG_BP_INDIRECT 8
++#define ORC_REG_SP_INDIRECT 9
++#define ORC_REG_MAX 15
++
++/*
++ * ORC_TYPE_CALL: Indicates that sp_reg+sp_offset resolves to PREV_SP (the
++ * caller's SP right before it made the call). Used for all callable
++ * functions, i.e. all C code and all callable asm functions.
++ *
++ * ORC_TYPE_REGS: Used in entry code to indicate that sp_reg+sp_offset points
++ * to a fully populated pt_regs from a syscall, interrupt, or exception.
++ *
++ * ORC_TYPE_REGS_IRET: Used in entry code to indicate that sp_reg+sp_offset
++ * points to the iret return frame.
++ *
++ * The UNWIND_HINT macros are used only for the unwind_hint struct. They
++ * aren't used in struct orc_entry due to size and complexity constraints.
++ * Objtool converts them to real types when it converts the hints to orc
++ * entries.
++ */
++#define ORC_TYPE_CALL 0
++#define ORC_TYPE_REGS 1
++#define ORC_TYPE_REGS_IRET 2
++#define UNWIND_HINT_TYPE_SAVE 3
++#define UNWIND_HINT_TYPE_RESTORE 4
++
++#ifndef __ASSEMBLY__
++/*
++ * This struct is more or less a vastly simplified version of the DWARF Call
++ * Frame Information standard. It contains only the necessary parts of DWARF
++ * CFI, simplified for ease of access by the in-kernel unwinder. It tells the
++ * unwinder how to find the previous SP and BP (and sometimes entry regs) on
++ * the stack for a given code address. Each instance of the struct corresponds
++ * to one or more code locations.
++ */
++struct orc_entry {
++ s16 sp_offset;
++ s16 bp_offset;
++ unsigned sp_reg:4;
++ unsigned bp_reg:4;
++ unsigned type:2;
++};
++
++/*
++ * This struct is used by asm and inline asm code to manually annotate the
++ * location of registers on the stack for the ORC unwinder.
++ *
++ * Type can be either ORC_TYPE_* or UNWIND_HINT_TYPE_*.
++ */
++struct unwind_hint {
++ u32 ip;
++ s16 sp_offset;
++ u8 sp_reg;
++ u8 type;
++};
++#endif /* __ASSEMBLY__ */
++
++#endif /* _ORC_TYPES_H */
+--- /dev/null
++++ b/arch/x86/include/asm/unwind_hints.h
+@@ -0,0 +1,103 @@
++#ifndef _ASM_X86_UNWIND_HINTS_H
++#define _ASM_X86_UNWIND_HINTS_H
++
++#include "orc_types.h"
++
++#ifdef __ASSEMBLY__
++
++/*
++ * In asm, there are two kinds of code: normal C-type callable functions and
++ * the rest. The normal callable functions can be called by other code, and
++ * don't do anything unusual with the stack. Such normal callable functions
++ * are annotated with the ENTRY/ENDPROC macros. Most asm code falls in this
++ * category. In this case, no special debugging annotations are needed because
++ * objtool can automatically generate the ORC data for the ORC unwinder to read
++ * at runtime.
++ *
++ * Anything which doesn't fall into the above category, such as syscall and
++ * interrupt handlers, tends to not be called directly by other functions, and
++ * often does unusual non-C-function-type things with the stack pointer. Such
++ * code needs to be annotated such that objtool can understand it. The
++ * following CFI hint macros are for this type of code.
++ *
++ * These macros provide hints to objtool about the state of the stack at each
++ * instruction. Objtool starts from the hints and follows the code flow,
++ * making automatic CFI adjustments when it sees pushes and pops, filling out
++ * the debuginfo as necessary. It will also warn if it sees any
++ * inconsistencies.
++ */
++.macro UNWIND_HINT sp_reg=ORC_REG_SP sp_offset=0 type=ORC_TYPE_CALL
++#ifdef CONFIG_STACK_VALIDATION
++.Lunwind_hint_ip_\@:
++ .pushsection .discard.unwind_hints
++ /* struct unwind_hint */
++ .long .Lunwind_hint_ip_\@ - .
++ .short \sp_offset
++ .byte \sp_reg
++ .byte \type
++ .popsection
++#endif
++.endm
++
++.macro UNWIND_HINT_EMPTY
++ UNWIND_HINT sp_reg=ORC_REG_UNDEFINED
++.endm
++
++.macro UNWIND_HINT_REGS base=%rsp offset=0 indirect=0 extra=1 iret=0
++ .if \base == %rsp && \indirect
++ .set sp_reg, ORC_REG_SP_INDIRECT
++ .elseif \base == %rsp
++ .set sp_reg, ORC_REG_SP
++ .elseif \base == %rbp
++ .set sp_reg, ORC_REG_BP
++ .elseif \base == %rdi
++ .set sp_reg, ORC_REG_DI
++ .elseif \base == %rdx
++ .set sp_reg, ORC_REG_DX
++ .elseif \base == %r10
++ .set sp_reg, ORC_REG_R10
++ .else
++ .error "UNWIND_HINT_REGS: bad base register"
++ .endif
++
++ .set sp_offset, \offset
++
++ .if \iret
++ .set type, ORC_TYPE_REGS_IRET
++ .elseif \extra == 0
++ .set type, ORC_TYPE_REGS_IRET
++ .set sp_offset, \offset + (16*8)
++ .else
++ .set type, ORC_TYPE_REGS
++ .endif
++
++ UNWIND_HINT sp_reg=sp_reg sp_offset=sp_offset type=type
++.endm
++
++.macro UNWIND_HINT_IRET_REGS base=%rsp offset=0
++ UNWIND_HINT_REGS base=\base offset=\offset iret=1
++.endm
++
++.macro UNWIND_HINT_FUNC sp_offset=8
++ UNWIND_HINT sp_offset=\sp_offset
++.endm
++
++#else /* !__ASSEMBLY__ */
++
++#define UNWIND_HINT(sp_reg, sp_offset, type) \
++ "987: \n\t" \
++ ".pushsection .discard.unwind_hints\n\t" \
++ /* struct unwind_hint */ \
++ ".long 987b - .\n\t" \
++ ".short " __stringify(sp_offset) "\n\t" \
++ ".byte " __stringify(sp_reg) "\n\t" \
++ ".byte " __stringify(type) "\n\t" \
++ ".popsection\n\t"
++
++#define UNWIND_HINT_SAVE UNWIND_HINT(0, 0, UNWIND_HINT_TYPE_SAVE)
++
++#define UNWIND_HINT_RESTORE UNWIND_HINT(0, 0, UNWIND_HINT_TYPE_RESTORE)
++
++#endif /* __ASSEMBLY__ */
++
++#endif /* _ASM_X86_UNWIND_HINTS_H */
+--- a/tools/objtool/Makefile
++++ b/tools/objtool/Makefile
+@@ -52,6 +52,9 @@ $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
+ diff -I'^#include' arch/x86/insn/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
+ diff -I'^#include' arch/x86/insn/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
+ || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
++ @(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
++ diff ../../arch/x86/include/asm/orc_types.h orc_types.h >/dev/null) \
++ || echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
+ $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
+
+
+--- a/tools/objtool/check.c
++++ b/tools/objtool/check.c
+@@ -100,7 +100,6 @@ static bool gcov_enabled(struct objtool_
+ static bool ignore_func(struct objtool_file *file, struct symbol *func)
+ {
+ struct rela *rela;
+- struct instruction *insn;
+
+ /* check for STACK_FRAME_NON_STANDARD */
+ if (file->whitelist && file->whitelist->rela)
+@@ -113,11 +112,6 @@ static bool ignore_func(struct objtool_f
+ return true;
+ }
+
+- /* check if it has a context switching instruction */
+- func_for_each_insn(file, func, insn)
+- if (insn->type == INSN_CONTEXT_SWITCH)
+- return true;
+-
+ return false;
+ }
+
+@@ -879,6 +873,99 @@ static int add_switch_table_alts(struct
+ return 0;
+ }
+
++static int read_unwind_hints(struct objtool_file *file)
++{
++ struct section *sec, *relasec;
++ struct rela *rela;
++ struct unwind_hint *hint;
++ struct instruction *insn;
++ struct cfi_reg *cfa;
++ int i;
++
++ sec = find_section_by_name(file->elf, ".discard.unwind_hints");
++ if (!sec)
++ return 0;
++
++ relasec = sec->rela;
++ if (!relasec) {
++ WARN("missing .rela.discard.unwind_hints section");
++ return -1;
++ }
++
++ if (sec->len % sizeof(struct unwind_hint)) {
++ WARN("struct unwind_hint size mismatch");
++ return -1;
++ }
++
++ file->hints = true;
++
++ for (i = 0; i < sec->len / sizeof(struct unwind_hint); i++) {
++ hint = (struct unwind_hint *)sec->data->d_buf + i;
++
++ rela = find_rela_by_dest(sec, i * sizeof(*hint));
++ if (!rela) {
++ WARN("can't find rela for unwind_hints[%d]", i);
++ return -1;
++ }
++
++ insn = find_insn(file, rela->sym->sec, rela->addend);
++ if (!insn) {
++ WARN("can't find insn for unwind_hints[%d]", i);
++ return -1;
++ }
++
++ cfa = &insn->state.cfa;
++
++ if (hint->type == UNWIND_HINT_TYPE_SAVE) {
++ insn->save = true;
++ continue;
++
++ } else if (hint->type == UNWIND_HINT_TYPE_RESTORE) {
++ insn->restore = true;
++ insn->hint = true;
++ continue;
++ }
++
++ insn->hint = true;
++
++ switch (hint->sp_reg) {
++ case ORC_REG_UNDEFINED:
++ cfa->base = CFI_UNDEFINED;
++ break;
++ case ORC_REG_SP:
++ cfa->base = CFI_SP;
++ break;
++ case ORC_REG_BP:
++ cfa->base = CFI_BP;
++ break;
++ case ORC_REG_SP_INDIRECT:
++ cfa->base = CFI_SP_INDIRECT;
++ break;
++ case ORC_REG_R10:
++ cfa->base = CFI_R10;
++ break;
++ case ORC_REG_R13:
++ cfa->base = CFI_R13;
++ break;
++ case ORC_REG_DI:
++ cfa->base = CFI_DI;
++ break;
++ case ORC_REG_DX:
++ cfa->base = CFI_DX;
++ break;
++ default:
++ WARN_FUNC("unsupported unwind_hint sp base reg %d",
++ insn->sec, insn->offset, hint->sp_reg);
++ return -1;
++ }
++
++ cfa->offset = hint->sp_offset;
++ insn->state.type = hint->type;
++ }
++
++ return 0;
++}
++
+ static int decode_sections(struct objtool_file *file)
+ {
+ int ret;
+@@ -909,6 +996,10 @@ static int decode_sections(struct objtoo
+ if (ret)
+ return ret;
+
++ ret = read_unwind_hints(file);
++ if (ret)
++ return ret;
++
+ return 0;
+ }
+
+@@ -1382,7 +1473,7 @@ static int validate_branch(struct objtoo
+ struct insn_state state)
+ {
+ struct alternative *alt;
+- struct instruction *insn;
++ struct instruction *insn, *next_insn;
+ struct section *sec;
+ struct symbol *func = NULL;
+ int ret;
+@@ -1397,6 +1488,8 @@ static int validate_branch(struct objtoo
+ }
+
+ while (1) {
++ next_insn = next_insn_same_sec(file, insn);
++
+ if (file->c_file && insn->func) {
+ if (func && func != insn->func) {
+ WARN("%s() falls through to next function %s()",
+@@ -1414,13 +1507,54 @@ static int validate_branch(struct objtoo
+ }
+
+ if (insn->visited) {
+- if (!!insn_state_match(insn, &state))
++ if (!insn->hint && !insn_state_match(insn, &state))
+ return 1;
+
+ return 0;
+ }
+
+- insn->state = state;
++ if (insn->hint) {
++ if (insn->restore) {
++ struct instruction *save_insn, *i;
++
++ i = insn;
++ save_insn = NULL;
++ func_for_each_insn_continue_reverse(file, func, i) {
++ if (i->save) {
++ save_insn = i;
++ break;
++ }
++ }
++
++ if (!save_insn) {
++ WARN_FUNC("no corresponding CFI save for CFI restore",
++ sec, insn->offset);
++ return 1;
++ }
++
++ if (!save_insn->visited) {
++ /*
++ * Oops, no state to copy yet.
++ * Hopefully we can reach this
++ * instruction from another branch
++ * after the save insn has been
++ * visited.
++ */
++ if (insn == first)
++ return 0;
++
++ WARN_FUNC("objtool isn't smart enough to handle this CFI save/restore combo",
++ sec, insn->offset);
++ return 1;
++ }
++
++ insn->state = save_insn->state;
++ }
++
++ state = insn->state;
++
++ } else
++ insn->state = state;
+
+ insn->visited = true;
+
+@@ -1497,6 +1631,14 @@ static int validate_branch(struct objtoo
+
+ return 0;
+
++ case INSN_CONTEXT_SWITCH:
++ if (func && (!next_insn || !next_insn->hint)) {
++ WARN_FUNC("unsupported instruction in callable function",
++ sec, insn->offset);
++ return 1;
++ }
++ return 0;
++
+ case INSN_STACK:
+ if (update_insn_state(insn, &state))
+ return -1;
+@@ -1510,7 +1652,7 @@ static int validate_branch(struct objtoo
+ if (insn->dead_end)
+ return 0;
+
+- insn = next_insn_same_sec(file, insn);
++ insn = next_insn;
+ if (!insn) {
+ WARN("%s: unexpected end of section", sec->name);
+ return 1;
+@@ -1520,6 +1662,27 @@ static int validate_branch(struct objtoo
+ return 0;
+ }
+
++static int validate_unwind_hints(struct objtool_file *file)
++{
++ struct instruction *insn;
++ int ret, warnings = 0;
++ struct insn_state state;
++
++ if (!file->hints)
++ return 0;
++
++ clear_insn_state(&state);
++
++ for_each_insn(file, insn) {
++ if (insn->hint && !insn->visited) {
++ ret = validate_branch(file, insn, state);
++ warnings += ret;
++ }
++ }
++
++ return warnings;
++}
++
+ static bool is_kasan_insn(struct instruction *insn)
+ {
+ return (insn->type == INSN_CALL &&
+@@ -1665,8 +1828,9 @@ int check(const char *_objname, bool _no
+ hash_init(file.insn_hash);
+ file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard");
+ file.rodata = find_section_by_name(file.elf, ".rodata");
+- file.ignore_unreachables = false;
+ file.c_file = find_section_by_name(file.elf, ".comment");
++ file.ignore_unreachables = false;
++ file.hints = false;
+
+ arch_initial_func_cfi_state(&initial_func_cfi);
+
+@@ -1682,6 +1846,11 @@ int check(const char *_objname, bool _no
+ if (ret < 0)
+ goto out;
+ warnings += ret;
++
++ ret = validate_unwind_hints(&file);
++ if (ret < 0)
++ goto out;
++ warnings += ret;
+
+ if (!warnings) {
+ ret = validate_reachable_instructions(&file);
+--- a/tools/objtool/check.h
++++ b/tools/objtool/check.h
+@@ -43,7 +43,7 @@ struct instruction {
+ unsigned int len;
+ unsigned char type;
+ unsigned long immediate;
+- bool alt_group, visited, dead_end, ignore;
++ bool alt_group, visited, dead_end, ignore, hint, save, restore;
+ struct symbol *call_dest;
+ struct instruction *jump_dest;
+ struct list_head alts;
+@@ -58,7 +58,7 @@ struct objtool_file {
+ struct list_head insn_list;
+ DECLARE_HASHTABLE(insn_hash, 16);
+ struct section *rodata, *whitelist;
+- bool ignore_unreachables, c_file;
++ bool ignore_unreachables, c_file, hints;
+ };
+
+ int check(const char *objname, bool nofp, bool orc);
+--- a/tools/objtool/orc_types.h
++++ b/tools/objtool/orc_types.h
+@@ -61,11 +61,19 @@
+ *
+ * ORC_TYPE_REGS_IRET: Used in entry code to indicate that sp_reg+sp_offset
+ * points to the iret return frame.
++ *
++ * The UNWIND_HINT macros are used only for the unwind_hint struct. They
++ * aren't used in struct orc_entry due to size and complexity constraints.
++ * Objtool converts them to real types when it converts the hints to orc
++ * entries.
+ */
+ #define ORC_TYPE_CALL 0
+ #define ORC_TYPE_REGS 1
+ #define ORC_TYPE_REGS_IRET 2
++#define UNWIND_HINT_TYPE_SAVE 3
++#define UNWIND_HINT_TYPE_RESTORE 4
+
++#ifndef __ASSEMBLY__
+ /*
+ * This struct is more or less a vastly simplified version of the DWARF Call
+ * Frame Information standard. It contains only the necessary parts of DWARF
+@@ -82,4 +90,18 @@ struct orc_entry {
+ unsigned type:2;
+ } __packed;
+
++/*
++ * This struct is used by asm and inline asm code to manually annotate the
++ * location of registers on the stack for the ORC unwinder.
++ *
++ * Type can be either ORC_TYPE_* or UNWIND_HINT_TYPE_*.
++ */
++struct unwind_hint {
++ u32 ip;
++ s16 sp_offset;
++ u8 sp_reg;
++ u8 type;
++};
++#endif /* __ASSEMBLY__ */
++
+ #endif /* _ORC_TYPES_H */
diff --git a/patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch b/patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch
new file mode 100644
index 0000000000..404c7b0e5b
--- /dev/null
+++ b/patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch
@@ -0,0 +1,448 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 11 Jul 2017 10:33:44 -0500
+Subject: x86/entry/64: Add unwind hint annotations
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 8c1f75587a18ca032da8f6376d1ed882d7095289
+References: bnc#1018348
+
+Add unwind hint annotations to entry_64.S. This will enable the ORC
+unwinder to unwind through any location in the entry code including
+syscalls, interrupts, and exceptions.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/b9f6d478aadf68ba57c739dcfac34ec0dc021c4c.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/entry/Makefile | 1
+ arch/x86/entry/calling.h | 5 +++
+ arch/x86/entry/entry_64.S | 71 +++++++++++++++++++++++++++++++++++++++-------
+ 3 files changed, 66 insertions(+), 11 deletions(-)
+
+--- a/arch/x86/entry/Makefile
++++ b/arch/x86/entry/Makefile
+@@ -2,7 +2,6 @@
+ # Makefile for the x86 low level entry code
+ #
+
+-OBJECT_FILES_NON_STANDARD_entry_$(BITS).o := y
+ OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y
+
+ CFLAGS_syscall_64.o += $(call cc-option,-Wno-override-init,)
+--- a/arch/x86/entry/calling.h
++++ b/arch/x86/entry/calling.h
+@@ -1,4 +1,5 @@
+ #include <linux/jump_label.h>
++#include <asm/unwind_hints.h>
+
+ /*
+
+@@ -125,6 +126,7 @@ For 32-bit we have the following convent
+ movq %rdx, 12*8+\offset(%rsp)
+ movq %rsi, 13*8+\offset(%rsp)
+ movq %rdi, 14*8+\offset(%rsp)
++ UNWIND_HINT_REGS offset=\offset extra=0
+ .endm
+ .macro SAVE_C_REGS offset=0
+ SAVE_C_REGS_HELPER \offset, 1, 1, 1, 1
+@@ -149,6 +151,7 @@ For 32-bit we have the following convent
+ movq %r12, 3*8+\offset(%rsp)
+ movq %rbp, 4*8+\offset(%rsp)
+ movq %rbx, 5*8+\offset(%rsp)
++ UNWIND_HINT_REGS offset=\offset
+ .endm
+
+ .macro RESTORE_EXTRA_REGS offset=0
+@@ -158,6 +161,7 @@ For 32-bit we have the following convent
+ movq 3*8+\offset(%rsp), %r12
+ movq 4*8+\offset(%rsp), %rbp
+ movq 5*8+\offset(%rsp), %rbx
++ UNWIND_HINT_REGS offset=\offset extra=0
+ .endm
+
+ .macro RESTORE_C_REGS_HELPER rstor_rax=1, rstor_rcx=1, rstor_r11=1, rstor_r8910=1, rstor_rdx=1
+@@ -180,6 +184,7 @@ For 32-bit we have the following convent
+ .endif
+ movq 13*8(%rsp), %rsi
+ movq 14*8(%rsp), %rdi
++ UNWIND_HINT_IRET_REGS offset=16*8
+ .endm
+ .macro RESTORE_C_REGS
+ RESTORE_C_REGS_HELPER 1,1,1,1,1
+--- a/arch/x86/entry/entry_64.S
++++ b/arch/x86/entry/entry_64.S
+@@ -36,6 +36,7 @@
+ #include <asm/smap.h>
+ #include <asm/pgtable_types.h>
+ #include <asm/export.h>
++#include <asm/frame.h>
+ #include <linux/err.h>
+
+ .code64
+@@ -43,9 +44,10 @@
+
+ #ifdef CONFIG_PARAVIRT
+ ENTRY(native_usergs_sysret64)
++ UNWIND_HINT_EMPTY
+ swapgs
+ sysretq
+-ENDPROC(native_usergs_sysret64)
++END(native_usergs_sysret64)
+ #endif /* CONFIG_PARAVIRT */
+
+ .macro TRACE_IRQS_IRETQ
+@@ -134,6 +136,7 @@ ENDPROC(native_usergs_sysret64)
+ */
+
+ ENTRY(entry_SYSCALL_64)
++ UNWIND_HINT_EMPTY
+ /*
+ * Interrupts are off on entry.
+ * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON,
+@@ -169,6 +172,7 @@ GLOBAL(entry_SYSCALL_64_after_swapgs)
+ pushq %r10 /* pt_regs->r10 */
+ pushq %r11 /* pt_regs->r11 */
+ sub $(6*8), %rsp /* pt_regs->bp, bx, r12-15 not saved */
++ UNWIND_HINT_REGS extra=0
+
+ /*
+ * If we need to do entry work or if we guess we'll need to do
+@@ -223,6 +227,7 @@ entry_SYSCALL_64_fastpath:
+ movq EFLAGS(%rsp), %r11
+ RESTORE_C_REGS_EXCEPT_RCX_R11
+ movq RSP(%rsp), %rsp
++ UNWIND_HINT_EMPTY
+ USERGS_SYSRET64
+
+ 1:
+@@ -316,6 +321,7 @@ syscall_return_via_sysret:
+ /* rcx and r11 are already restored (see code above) */
+ RESTORE_C_REGS_EXCEPT_RCX_R11
+ movq RSP(%rsp), %rsp
++ UNWIND_HINT_EMPTY
+ USERGS_SYSRET64
+
+ opportunistic_sysret_failed:
+@@ -343,6 +349,7 @@ ENTRY(stub_ptregs_64)
+ DISABLE_INTERRUPTS(CLBR_ANY)
+ TRACE_IRQS_OFF
+ popq %rax
++ UNWIND_HINT_REGS extra=0
+ jmp entry_SYSCALL64_slow_path
+
+ 1:
+@@ -351,6 +358,7 @@ END(stub_ptregs_64)
+
+ .macro ptregs_stub func
+ ENTRY(ptregs_\func)
++ UNWIND_HINT_FUNC
+ leaq \func(%rip), %rax
+ jmp stub_ptregs_64
+ END(ptregs_\func)
+@@ -367,6 +375,7 @@ END(ptregs_\func)
+ * %rsi: next task
+ */
+ ENTRY(__switch_to_asm)
++ UNWIND_HINT_FUNC
+ /*
+ * Save callee-saved registers
+ * This must match the order in inactive_task_frame
+@@ -406,6 +415,7 @@ END(__switch_to_asm)
+ * r12: kernel thread arg
+ */
+ ENTRY(ret_from_fork)
++ UNWIND_HINT_EMPTY
+ movq %rax, %rdi
+ call schedule_tail /* rdi: 'prev' task parameter */
+
+@@ -413,6 +423,7 @@ ENTRY(ret_from_fork)
+ jnz 1f /* kernel threads are uncommon */
+
+ 2:
++ UNWIND_HINT_REGS
+ movq %rsp, %rdi
+ call syscall_return_slowpath /* returns with IRQs disabled */
+ TRACE_IRQS_ON /* user mode is traced as IRQS on */
+@@ -440,10 +451,11 @@ END(ret_from_fork)
+ ENTRY(irq_entries_start)
+ vector=FIRST_EXTERNAL_VECTOR
+ .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
++ UNWIND_HINT_IRET_REGS
+ pushq $(~vector+0x80) /* Note: always in signed byte range */
+- vector=vector+1
+ jmp common_interrupt
+ .align 8
++ vector=vector+1
+ .endr
+ END(irq_entries_start)
+
+@@ -465,9 +477,14 @@ END(irq_entries_start)
+ *
+ * The invariant is that, if irq_count != -1, then the IRQ stack is in use.
+ */
+-.macro ENTER_IRQ_STACK old_rsp
++.macro ENTER_IRQ_STACK regs=1 old_rsp
+ DEBUG_ENTRY_ASSERT_IRQS_OFF
+ movq %rsp, \old_rsp
++
++ .if \regs
++ UNWIND_HINT_REGS base=\old_rsp
++ .endif
++
+ incl PER_CPU_VAR(irq_count)
+ jnz .Lirq_stack_push_old_rsp_\@
+
+@@ -504,16 +521,24 @@ END(irq_entries_start)
+
+ .Lirq_stack_push_old_rsp_\@:
+ pushq \old_rsp
++
++ .if \regs
++ UNWIND_HINT_REGS indirect=1
++ .endif
+ .endm
+
+ /*
+ * Undoes ENTER_IRQ_STACK.
+ */
+-.macro LEAVE_IRQ_STACK
++.macro LEAVE_IRQ_STACK regs=1
+ DEBUG_ENTRY_ASSERT_IRQS_OFF
+ /* We need to be off the IRQ stack before decrementing irq_count. */
+ popq %rsp
+
++ .if \regs
++ UNWIND_HINT_REGS
++ .endif
++
+ /*
+ * As in ENTER_IRQ_STACK, irq_count == 0, we are still claiming
+ * the irq stack but we're not on it.
+@@ -624,6 +649,7 @@ restore_c_regs_and_iret:
+ INTERRUPT_RETURN
+
+ ENTRY(native_iret)
++ UNWIND_HINT_IRET_REGS
+ /*
+ * Are we returning to a stack segment from the LDT? Note: in
+ * 64-bit mode SS:RSP on the exception stack is always valid.
+@@ -696,6 +722,7 @@ native_irq_return_ldt:
+ orq PER_CPU_VAR(espfix_stack), %rax
+ SWAPGS
+ movq %rax, %rsp
++ UNWIND_HINT_IRET_REGS offset=8
+
+ /*
+ * At this point, we cannot write to the stack any more, but we can
+@@ -717,6 +744,7 @@ END(common_interrupt)
+ */
+ .macro apicinterrupt3 num sym do_sym
+ ENTRY(\sym)
++ UNWIND_HINT_IRET_REGS
+ ASM_CLAC
+ pushq $~(\num)
+ .Lcommon_\sym:
+@@ -802,6 +830,8 @@ apicinterrupt IRQ_WORK_VECTOR irq_work
+
+ .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1
+ ENTRY(\sym)
++ UNWIND_HINT_IRET_REGS offset=8
++
+ /* Sanity check */
+ .if \shift_ist != -1 && \paranoid == 0
+ .error "using shift_ist requires paranoid=1"
+@@ -825,6 +855,7 @@ ENTRY(\sym)
+ .else
+ call error_entry
+ .endif
++ UNWIND_HINT_REGS
+ /* returned flag: ebx=0: need swapgs on exit, ebx=1: don't need it */
+
+ .if \paranoid
+@@ -922,6 +953,7 @@ idtentry simd_coprocessor_error do_simd
+ * edi: new selector
+ */
+ ENTRY(native_load_gs_index)
++ FRAME_BEGIN
+ pushfq
+ DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
+ SWAPGS
+@@ -930,8 +962,9 @@ ENTRY(native_load_gs_index)
+ 2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
+ SWAPGS
+ popfq
++ FRAME_END
+ ret
+-END(native_load_gs_index)
++ENDPROC(native_load_gs_index)
+ EXPORT_SYMBOL(native_load_gs_index)
+
+ _ASM_EXTABLE(.Lgs_change, bad_gs)
+@@ -954,12 +987,12 @@ bad_gs:
+ ENTRY(do_softirq_own_stack)
+ pushq %rbp
+ mov %rsp, %rbp
+- ENTER_IRQ_STACK old_rsp=%r11
++ ENTER_IRQ_STACK regs=0 old_rsp=%r11
+ call __do_softirq
+- LEAVE_IRQ_STACK
++ LEAVE_IRQ_STACK regs=0
+ leaveq
+ ret
+-END(do_softirq_own_stack)
++ENDPROC(do_softirq_own_stack)
+
+ #ifdef CONFIG_XEN
+ idtentry xen_hypervisor_callback xen_do_hypervisor_callback has_error_code=0
+@@ -983,7 +1016,9 @@ ENTRY(xen_do_hypervisor_callback) /* do
+ * Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will
+ * see the correct pointer to the pt_regs
+ */
++ UNWIND_HINT_FUNC
+ movq %rdi, %rsp /* we don't return, adjust the stack frame */
++ UNWIND_HINT_REGS
+
+ ENTER_IRQ_STACK old_rsp=%r10
+ call xen_evtchn_do_upcall
+@@ -1009,6 +1044,7 @@ END(xen_do_hypervisor_callback)
+ * with its current contents: any discrepancy means we in category 1.
+ */
+ ENTRY(xen_failsafe_callback)
++ UNWIND_HINT_EMPTY
+ movl %ds, %ecx
+ cmpw %cx, 0x10(%rsp)
+ jne 1f
+@@ -1028,11 +1064,13 @@ ENTRY(xen_failsafe_callback)
+ pushq $0 /* RIP */
+ pushq %r11
+ pushq %rcx
++ UNWIND_HINT_IRET_REGS offset=8
+ jmp general_protection
+ 1: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */
+ movq (%rsp), %rcx
+ movq 8(%rsp), %r11
+ addq $0x30, %rsp
++ UNWIND_HINT_IRET_REGS
+ pushq $-1 /* orig_ax = -1 => not a system call */
+ ALLOC_PT_GPREGS_ON_STACK
+ SAVE_C_REGS
+@@ -1078,6 +1116,7 @@ idtentry machine_check has_error_cod
+ * Return: ebx=0: need swapgs on exit, ebx=1: otherwise
+ */
+ ENTRY(paranoid_entry)
++ UNWIND_HINT_FUNC
+ cld
+ SAVE_C_REGS 8
+ SAVE_EXTRA_REGS 8
+@@ -1105,6 +1144,7 @@ END(paranoid_entry)
+ * On entry, ebx is "no swapgs" flag (1: don't need swapgs, 0: need it)
+ */
+ ENTRY(paranoid_exit)
++ UNWIND_HINT_REGS
+ DISABLE_INTERRUPTS(CLBR_ANY)
+ TRACE_IRQS_OFF_DEBUG
+ testl %ebx, %ebx /* swapgs needed? */
+@@ -1126,6 +1166,7 @@ END(paranoid_exit)
+ * Return: EBX=0: came from user mode; EBX=1: otherwise
+ */
+ ENTRY(error_entry)
++ UNWIND_HINT_FUNC
+ cld
+ SAVE_C_REGS 8
+ SAVE_EXTRA_REGS 8
+@@ -1210,6 +1251,7 @@ END(error_entry)
+ * 0: user gsbase is loaded, we need SWAPGS and standard preparation for return to usermode
+ */
+ ENTRY(error_exit)
++ UNWIND_HINT_REGS
+ DISABLE_INTERRUPTS(CLBR_ANY)
+ TRACE_IRQS_OFF
+ testl %ebx, %ebx
+@@ -1219,6 +1261,7 @@ END(error_exit)
+
+ /* Runs on exception stack */
+ ENTRY(nmi)
++ UNWIND_HINT_IRET_REGS
+ /*
+ * Fix up the exception frame if we're on Xen.
+ * PARAVIRT_ADJUST_EXCEPTION_FRAME is guaranteed to push at most
+@@ -1290,11 +1333,13 @@ ENTRY(nmi)
+ cld
+ movq %rsp, %rdx
+ movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
++ UNWIND_HINT_IRET_REGS base=%rdx offset=8
+ pushq 5*8(%rdx) /* pt_regs->ss */
+ pushq 4*8(%rdx) /* pt_regs->rsp */
+ pushq 3*8(%rdx) /* pt_regs->flags */
+ pushq 2*8(%rdx) /* pt_regs->cs */
+ pushq 1*8(%rdx) /* pt_regs->rip */
++ UNWIND_HINT_IRET_REGS
+ pushq $-1 /* pt_regs->orig_ax */
+ pushq %rdi /* pt_regs->di */
+ pushq %rsi /* pt_regs->si */
+@@ -1311,6 +1356,7 @@ ENTRY(nmi)
+ pushq %r13 /* pt_regs->r13 */
+ pushq %r14 /* pt_regs->r14 */
+ pushq %r15 /* pt_regs->r15 */
++ UNWIND_HINT_REGS
+ ENCODE_FRAME_POINTER
+
+ /*
+@@ -1465,6 +1511,7 @@ first_nmi:
+ .rept 5
+ pushq 11*8(%rsp)
+ .endr
++ UNWIND_HINT_IRET_REGS
+
+ /* Everything up to here is safe from nested NMIs */
+
+@@ -1480,6 +1527,7 @@ first_nmi:
+ pushq $__KERNEL_CS /* CS */
+ pushq $1f /* RIP */
+ INTERRUPT_RETURN /* continues at repeat_nmi below */
++ UNWIND_HINT_IRET_REGS
+ 1:
+ #endif
+
+@@ -1529,6 +1577,7 @@ end_repeat_nmi:
+ * exceptions might do.
+ */
+ call paranoid_entry
++ UNWIND_HINT_REGS
+
+ /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
+ movq %rsp, %rdi
+@@ -1566,17 +1615,19 @@ nmi_restore:
+ END(nmi)
+
+ ENTRY(ignore_sysret)
++ UNWIND_HINT_EMPTY
+ mov $-ENOSYS, %eax
+ sysret
+ END(ignore_sysret)
+
+ ENTRY(rewind_stack_do_exit)
++ UNWIND_HINT_FUNC
+ /* Prevent any naive code from trying to unwind to our caller. */
+ xorl %ebp, %ebp
+
+ movq PER_CPU_VAR(cpu_current_top_of_stack), %rax
+- leaq -TOP_OF_KERNEL_STACK_PADDING-PTREGS_SIZE(%rax), %rsp
++ leaq -PTREGS_SIZE(%rax), %rsp
++ UNWIND_HINT_FUNC sp_offset=PTREGS_SIZE
+
+ call do_exit
+-1: jmp 1b
+ END(rewind_stack_do_exit)
diff --git a/patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch b/patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch
new file mode 100644
index 0000000000..31d8f3659c
--- /dev/null
+++ b/patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch
@@ -0,0 +1,55 @@
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Tue, 11 Jul 2017 10:33:45 -0500
+Subject: x86/asm: Add unwind hint annotations to sync_core()
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
+Git-commit: 76846bf3cb09e98881cb4908385a0e899716b01f
+References: bnc#1018348
+
+This enables objtool to grok the iret in the middle of a C function.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Jiri Slaby <jslaby@suse.cz>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Mike Galbraith <efault@gmx.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: live-patching@vger.kernel.org
+Link: http://lkml.kernel.org/r/b057be26193c11d2ed3337b2107bc7adcba42c99.1499786555.git.jpoimboe@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/include/asm/processor.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/arch/x86/include/asm/processor.h
++++ b/arch/x86/include/asm/processor.h
+@@ -22,6 +22,7 @@ struct vm86;
+ #include <asm/nops.h>
+ #include <asm/special_insns.h>
+ #include <asm/fpu/types.h>
++#include <asm/unwind_hints.h>
+
+ #include <linux/personality.h>
+ #include <linux/cache.h>
+@@ -684,6 +685,7 @@ static inline void sync_core(void)
+ unsigned int tmp;
+
+ asm volatile (
++ UNWIND_HINT_SAVE
+ "mov %%ss, %0\n\t"
+ "pushq %q0\n\t"
+ "pushq %%rsp\n\t"
+@@ -693,6 +695,7 @@ static inline void sync_core(void)
+ "pushq %q0\n\t"
+ "pushq $1f\n\t"
+ "iretq\n\t"
++ UNWIND_HINT_RESTORE
+ "1:"
+ : "=&r" (tmp), "+r" (__sp) : : "cc", "memory");
+ #endif
diff --git a/patches.suse/binutils2_26.patch b/patches.suse/binutils2_26.patch
index 0334f796d4..72f2e2d5af 100644
--- a/patches.suse/binutils2_26.patch
+++ b/patches.suse/binutils2_26.patch
@@ -21,9 +21,9 @@ Signed-off-by: Takashi Iwai <tiwai@suse.de>
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -30,6 +30,7 @@ KBUILD_CFLAGS += $(cflags-y)
- KBUILD_CFLAGS += -mno-mmx -mno-sse
KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
+ KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
+KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no,)
KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
diff --git a/patches.suse/btrfs-8447-serialize-subvolume-mounts-with-potentially-mi.patch b/patches.suse/btrfs-8447-serialize-subvolume-mounts-with-potentially-mi.patch
new file mode 100644
index 0000000000..408449ab29
--- /dev/null
+++ b/patches.suse/btrfs-8447-serialize-subvolume-mounts-with-potentially-mi.patch
@@ -0,0 +1,73 @@
+From 771f2f4192e479781e367cbba7ccd3b8bda5dd55 Mon Sep 17 00:00:00 2001
+From: David Sterba <dsterba@suse.com>
+Date: Thu, 2 Jun 2016 13:50:44 +0200
+References: bsc#951844 bsc#1024015
+Patch-mainline: never, ugly
+Subject: [PATCH] btrfs: serialize subvolume mounts with potentially
+ mismatching rw flags
+
+Racing subvolume mounts with mixed ro/rw flags can fail if the mount and
+remount are not done atomically.
+
+Signed-off-by: David Sterba <dsterba@suse.com>
+---
+ fs/btrfs/super.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+--- a/fs/btrfs/super.c
++++ b/fs/btrfs/super.c
+@@ -1284,6 +1284,7 @@ static struct dentry *mount_subvol(const
+ struct vfsmount *mnt = NULL;
+ char *newargs;
+ int ret;
++ static DEFINE_MUTEX(subvol_lock);
+
+ newargs = setup_root_args(data);
+ if (!newargs) {
+@@ -1291,6 +1292,24 @@ static struct dentry *mount_subvol(const
+ goto out;
+ }
+
++ /*
++ * Protect against racing mounts of subvolumes with different RO/RW
++ * flags. The first vfs_kern_mount could fail with -EBUSY if the rw
++ * flags do not match with the first and the currently mounted
++ * subvolume.
++ *
++ * To resolve that, we adjust the rw flags and do remount. If another
++ * mounts goes through the same path and hits the window between the
++ * adjusted vfs_kern_mount and btrfs_remount, it will fail because of
++ * the ro/rw mismatch in btrfs_mount.
++ *
++ * If the mounts do not race and are serialized externally, everything
++ * works fine. The function-local mutex enforces the serialization but
++ * is otherwise only an ugly workaround due to lack of better
++ * solutions.
++ */
++ mutex_lock(&subvol_lock);
++
+ mnt = vfs_kern_mount(&btrfs_fs_type, flags, device_name, newargs);
+ if (PTR_ERR_OR_ZERO(mnt) == -EBUSY) {
+ if (flags & MS_RDONLY) {
+@@ -1302,6 +1321,7 @@ static struct dentry *mount_subvol(const
+ if (IS_ERR(mnt)) {
+ root = ERR_CAST(mnt);
+ mnt = NULL;
++ mutex_unlock(&subvol_lock);
+ goto out;
+ }
+
+@@ -1310,10 +1330,13 @@ static struct dentry *mount_subvol(const
+ up_write(&mnt->mnt_sb->s_umount);
+ if (ret < 0) {
+ root = ERR_PTR(ret);
++ mutex_unlock(&subvol_lock);
+ goto out;
+ }
+ }
+ }
++ mutex_unlock(&subvol_lock);
++
+ if (IS_ERR(mnt)) {
+ root = ERR_CAST(mnt);
+ mnt = NULL;
diff --git a/patches.suse/btrfs-btrfs-use-the-new-VFS-super_block_dev.patch b/patches.suse/btrfs-btrfs-use-the-new-VFS-super_block_dev.patch
index 61425cf846..31f658aee7 100644
--- a/patches.suse/btrfs-btrfs-use-the-new-VFS-super_block_dev.patch
+++ b/patches.suse/btrfs-btrfs-use-the-new-VFS-super_block_dev.patch
@@ -12,15 +12,17 @@ Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
fdmanana: fix for running qgroup sanity tests
---
- fs/btrfs/ctree.h | 7 ++-----
- fs/btrfs/disk-io.c | 7 +++----
- fs/btrfs/inode.c | 2 +-
- fs/btrfs/super.c | 2 +-
+ fs/btrfs/ctree.h | 7 ++-----
+ fs/btrfs/disk-io.c | 7 +++----
+ fs/btrfs/inode.c | 2 +-
+ fs/btrfs/super.c | 2 +-
4 files changed, 7 insertions(+), 11 deletions(-)
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
+index 643c70d2b2e6..fef9af9038f8 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
-@@ -1205,11 +1205,8 @@ struct btrfs_root {
+@@ -1230,11 +1230,8 @@ struct btrfs_root {
* protected by inode_lock
*/
struct radix_tree_root delayed_nodes_tree;
@@ -33,10 +35,12 @@ fdmanana: fix for running qgroup sanity tests
+ struct super_block_dev sbdev;
spinlock_t root_item_lock;
- atomic_t refs;
+ refcount_t refs;
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
+index 8685d67185d0..eb5caf88f4a3 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
-@@ -1360,9 +1360,9 @@ static void __setup_root(struct btrfs_ro
+@@ -1358,9 +1358,9 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
else
root->defrag_trans_start = 0;
root->root_key.objectid = objectid;
@@ -47,7 +51,7 @@ fdmanana: fix for running qgroup sanity tests
}
static struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info,
-@@ -1655,7 +1655,7 @@ int btrfs_init_fs_root(struct btrfs_root
+@@ -1653,7 +1653,7 @@ int btrfs_init_fs_root(struct btrfs_root *root)
spin_lock_init(&root->ino_cache_lock);
init_waitqueue_head(&root->ino_cache_wait);
@@ -56,7 +60,7 @@ fdmanana: fix for running qgroup sanity tests
if (ret)
goto fail;
-@@ -3831,8 +3831,7 @@ static void free_fs_root(struct btrfs_ro
+@@ -3808,8 +3808,7 @@ static void free_fs_root(struct btrfs_root *root)
WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree));
btrfs_free_block_rsv(root->fs_info, root->orphan_block_rsv);
root->orphan_block_rsv = NULL;
@@ -66,20 +70,24 @@ fdmanana: fix for running qgroup sanity tests
if (root->subv_writers)
btrfs_free_subvolume_writers(root->subv_writers);
free_extent_buffer(root->node);
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
+index 17cbe9306faf..a514cd7a5f3d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
-@@ -9490,7 +9490,7 @@ static int btrfs_getattr(struct vfsmount
- u32 blocksize = inode->i_sb->s_blocksize;
+@@ -9566,7 +9566,7 @@ static int btrfs_getattr(const struct path *path, struct kstat *stat,
+ STATX_ATTR_NODUMP);
generic_fillattr(inode, stat);
- stat->dev = BTRFS_I(inode)->root->anon_dev;
+ stat->dev = BTRFS_I(inode)->root->sbdev.anon_dev;
spin_lock(&BTRFS_I(inode)->lock);
- delalloc_bytes = BTRFS_I(inode)->delalloc_bytes;
+ delalloc_bytes = BTRFS_I(inode)->new_delalloc_bytes;
+diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
+index a369e57e06d2..52000b892c0a 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
-@@ -2295,7 +2295,7 @@ static int btrfs_show_devname(struct seq
+@@ -2303,7 +2303,7 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root)
static dev_t btrfs_get_inode_dev(const struct inode *inode)
{
@@ -88,3 +96,6 @@ fdmanana: fix for running qgroup sanity tests
}
static const struct super_operations btrfs_super_ops = {
+--
+2.13.0
+
diff --git a/patches.suse/btrfs-fs-super.c-add-new-super-block-devices-super_block_d.patch b/patches.suse/btrfs-fs-super.c-add-new-super-block-devices-super_block_d.patch
index 8e62b82476..8c7d8fe3db 100644
--- a/patches.suse/btrfs-fs-super.c-add-new-super-block-devices-super_block_d.patch
+++ b/patches.suse/btrfs-fs-super.c-add-new-super-block-devices-super_block_d.patch
@@ -22,9 +22,9 @@ Update: 16 Feb 2017 jeffm
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
- fs/super.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++--
- include/linux/fs.h | 20 +++++++++++++++++
- 2 files changed, 77 insertions(+), 2 deletions(-)
+ fs/super.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ include/linux/fs.h | 20 ++++++++++++++++++
+ 2 files changed, 76 insertions(+), 1 deletion(-)
--- a/fs/super.c
+++ b/fs/super.c
@@ -95,8 +95,8 @@ Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
+ WARN_ON(!list_empty(&s->s_sbdevs));
put_user_ns(s->s_user_ns);
kfree(s->s_subtype);
- kfree(s->s_options);
-@@ -215,6 +269,7 @@ static struct super_block *alloc_super(s
+ call_rcu(&s->rcu, destroy_super_rcu);
+@@ -214,6 +268,7 @@ static struct super_block *alloc_super(s
spin_lock_init(&s->s_inode_list_lock);
INIT_LIST_HEAD(&s->s_inodes_wb);
spin_lock_init(&s->s_inode_wblist_lock);
@@ -104,7 +104,7 @@ Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
if (list_lru_init_memcg(&s->s_dentry_lru))
goto fail;
-@@ -770,7 +825,7 @@ rescan:
+@@ -780,7 +835,7 @@ rescan:
list_for_each_entry(sb, &super_blocks, s_list) {
if (hlist_unhashed(&sb->s_instances))
continue;
@@ -115,7 +115,7 @@ Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
down_read(&sb->s_umount);
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -1284,6 +1284,14 @@ struct sb_writers {
+@@ -1305,6 +1305,14 @@ struct sb_writers {
struct percpu_rw_semaphore rw_sem[SB_FREEZE_LEVELS];
};
@@ -130,7 +130,7 @@ Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
struct super_block {
struct list_head s_list; /* Keep this first */
dev_t s_dev; /* search index; _not_ kdev_t */
-@@ -1310,6 +1318,7 @@ struct super_block {
+@@ -1331,6 +1339,7 @@ struct super_block {
const struct fscrypt_operations *s_cop;
struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
@@ -138,7 +138,7 @@ Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
struct list_head s_mounts; /* list of mounts; _not_ for fs use */
struct block_device *s_bdev;
struct backing_dev_info *s_bdi;
-@@ -2043,6 +2052,17 @@ void deactivate_locked_super(struct supe
+@@ -2088,6 +2097,17 @@ void deactivate_locked_super(struct supe
int set_anon_super(struct super_block *s, void *data);
int get_anon_bdev(dev_t *);
void free_anon_bdev(dev_t);
diff --git a/patches.suse/iwlwifi-expose-default-fallback-ucode-api b/patches.suse/iwlwifi-expose-default-fallback-ucode-api
index e36ffb9af9..d473e4246f 100644
--- a/patches.suse/iwlwifi-expose-default-fallback-ucode-api
+++ b/patches.suse/iwlwifi-expose-default-fallback-ucode-api
@@ -12,14 +12,13 @@ So far, the upstream doesn't take any action to it, so we need to paper
over it temporarily by manually adding the MODULE_FIRMWARE() entries.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-
---
- drivers/net/wireless/intel/iwlwifi/iwl-7000.c | 9 +++++++++
- drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 4 ++++
+ drivers/net/wireless/intel/iwlwifi/cfg/7000.c | 9 +++++++++
+ drivers/net/wireless/intel/iwlwifi/cfg/8000.c | 4 ++++
2 files changed, 13 insertions(+)
---- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
-+++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
+--- a/drivers/net/wireless/intel/iwlwifi/cfg/7000.c
++++ b/drivers/net/wireless/intel/iwlwifi/cfg/7000.c
@@ -72,9 +72,13 @@
/* Highest firmware API version supported */
@@ -27,9 +26,9 @@ Signed-off-by: Takashi Iwai <tiwai@suse.de>
+#define IWL7260_UCODE_API_DEFAULT_FALLBACK 17
#define IWL7265_UCODE_API_MAX 17
+#define IWL7265_UCODE_API_DEFAULT_FALLBACK 17
- #define IWL7265D_UCODE_API_MAX 28
+ #define IWL7265D_UCODE_API_MAX 29
+#define IWL7265D_UCODE_API_DEFAULT_FALLBACK 27
- #define IWL3168_UCODE_API_MAX 28
+ #define IWL3168_UCODE_API_MAX 29
+#define IWL3168_UCODE_API_DEFAULT_FALLBACK 27
/* Lowest firmware API version supported */
@@ -43,18 +42,18 @@ Signed-off-by: Takashi Iwai <tiwai@suse.de>
+MODULE_FIRMWARE(IWL3168_MODULE_FIRMWARE(IWL3168_UCODE_API_DEFAULT_FALLBACK));
+MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_DEFAULT_FALLBACK));
+MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_DEFAULT_FALLBACK));
---- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
-+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+--- a/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
++++ b/drivers/net/wireless/intel/iwlwifi/cfg/8000.c
@@ -71,7 +71,9 @@
/* Highest firmware API version supported */
- #define IWL8000_UCODE_API_MAX 28
+ #define IWL8000_UCODE_API_MAX 33
+#define IWL8000_UCODE_API_DEFAULT_FALLBACK 27
- #define IWL8265_UCODE_API_MAX 28
+ #define IWL8265_UCODE_API_MAX 33
+#define IWL8265_UCODE_API_DEFAULT_FALLBACK 27
/* Lowest firmware API version supported */
- #define IWL8000_UCODE_API_MIN 17
+ #define IWL8000_UCODE_API_MIN 22
@@ -278,3 +280,5 @@ const struct iwl_cfg iwl4165_2ac_sdio_cf
MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_MAX));
diff --git a/patches.suse/ppc-powerbook-usb-fn-key-default.patch b/patches.suse/ppc-powerbook-usb-fn-key-default.patch
deleted file mode 100644
index f6c9901080..0000000000
--- a/patches.suse/ppc-powerbook-usb-fn-key-default.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Subject: Default value of usbhid.pb_fnmode module parameter
-From: olh@suse.de
-References: 220266
-Patch-mainline: not yet
-
- The kernel default value for usbhid.pb_fnmode is 1, which means that pressing
- the Fn keys (F1..F10) without the fn key triggers the special functions
- decrease/increase brightness, mute, decrease/increase volume, etc., which is
- the default under MacOS.
-
- At least under 10.2 Beta2, only the volume related special functions work at
- all. In addition, Ctrl-Alt-Fx is used to switch between consoles. with
- pb_fnmode==1, the fn key needs to be pressed in addition.
-
- Therefore, pb_fnmode==2 (F1..F10 by default trigger Fn rather than the special
- functions) makes more sense under Linux.
-
-
- drivers/hid/hid-apple.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/hid/hid-apple.c
-+++ b/drivers/hid/hid-apple.c
-@@ -36,7 +36,7 @@
-
- #define APPLE_FLAG_FKEY 0x01
-
--static unsigned int fnmode = 1;
-+static unsigned int fnmode = 2;
- module_param(fnmode, uint, 0644);
- MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, "
- "[1] = fkeyslast, 2 = fkeysfirst)");
diff --git a/patches.suse/pstore-backend-autoaction b/patches.suse/pstore-backend-autoaction
index 47612d3b99..b44c151794 100644
--- a/patches.suse/pstore-backend-autoaction
+++ b/patches.suse/pstore-backend-autoaction
@@ -9,14 +9,47 @@ This can happen automatically, without user land interaction.
Signed-off-by: Torsten Duwe <duwe@suse.de>
---
- fs/pstore/inode.c | 2 +-
- fs/pstore/internal.h | 9 ++++++++-
- fs/pstore/platform.c | 37 ++++++++++++++++++++++++++++++-------
- 3 files changed, 39 insertions(+), 9 deletions(-)
+ fs/pstore/inode.c | 6 +++---
+ fs/pstore/internal.h | 11 +++++++++--
+ fs/pstore/platform.c | 33 +++++++++++++++++++++++++++------
+ 3 files changed, 39 insertions(+), 11 deletions(-)
---- a/fs/pstore/internal.h.orig
+diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
+index 792a4e5f9226..af1dcc11120e 100644
+--- a/fs/pstore/inode.c
++++ b/fs/pstore/inode.c
+@@ -429,7 +429,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
+ * when we are re-scanning the backing store looking to add new
+ * error records.
+ */
+-void pstore_get_records(int quiet)
++void pstore_get_records(unsigned flags)
+ {
+ struct pstore_info *psi = psinfo;
+ struct dentry *root;
+@@ -440,7 +440,7 @@ void pstore_get_records(int quiet)
+ root = pstore_sb->s_root;
+
+ inode_lock(d_inode(root));
+- pstore_get_backend_records(psi, root, quiet);
++ pstore_get_backend_records(psi, root, flags);
+ inode_unlock(d_inode(root));
+ }
+
+@@ -472,7 +472,7 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
+ if (!sb->s_root)
+ return -ENOMEM;
+
+- pstore_get_records(0);
++ pstore_get_records(PGR_VERBOSE|PGR_POPULATE);
+
+ return 0;
+ }
+diff --git a/fs/pstore/internal.h b/fs/pstore/internal.h
+index c416e653dc4f..032bf39c6aab 100644
+--- a/fs/pstore/internal.h
+++ b/fs/pstore/internal.h
-@@ -48,7 +48,14 @@ static inline void pstore_register_ftrac
+@@ -24,9 +24,16 @@ static inline void pstore_unregister_pmsg(void) {}
extern struct pstore_info *psinfo;
extern void pstore_set_kmsg_bytes(int);
@@ -29,23 +62,17 @@ Signed-off-by: Torsten Duwe <duwe@suse.de>
+#define PGR_SYSLOG 4
+#define PGR_CLEAR 8
+
- extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
- int count, char *data, bool compressed,
- size_t size, struct timespec time,
---- a/fs/pstore/inode.c.orig
-+++ b/fs/pstore/inode.c
-@@ -406,7 +406,7 @@ static int pstore_fill_super(struct supe
- if (!sb->s_root)
- return -ENOMEM;
-
-- pstore_get_records(0);
-+ pstore_get_records(PGR_VERBOSE|PGR_POPULATE);
-
- return 0;
- }
---- a/fs/pstore/platform.c.orig
+ extern void pstore_get_backend_records(struct pstore_info *psi,
+- struct dentry *root, int quiet);
++ struct dentry *root, unsigned flags);
+ extern int pstore_mkfile(struct dentry *root,
+ struct pstore_record *record);
+ extern bool pstore_is_mounted(void);
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
+index ff500e39a95d..b6c7a6332353 100644
+--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
-@@ -65,6 +65,10 @@ static DEFINE_SPINLOCK(pstore_lock);
+@@ -75,6 +75,10 @@ static DEFINE_SPINLOCK(pstore_lock);
struct pstore_info *psinfo;
static char *backend;
@@ -56,16 +83,16 @@ Signed-off-by: Torsten Duwe <duwe@suse.de>
/* Compression parameters */
#ifdef CONFIG_PSTORE_ZLIB_COMPRESS
-@@ -77,6 +81,8 @@ static size_t big_oops_buf_sz;
+@@ -100,6 +104,8 @@ static size_t big_oops_buf_sz;
/* How much of the console log to snapshot */
- static unsigned long kmsg_bytes = 10240;
+ unsigned long kmsg_bytes = PSTORE_DEFAULT_KMSG_BYTES;
+module_param(kmsg_bytes, ulong, 0644);
+MODULE_PARM_DESC(kmsg_bytes, "maximum size to save of a crash dump");
void pstore_set_kmsg_bytes(int bytes)
{
-@@ -448,7 +454,11 @@ int pstore_register(struct pstore_info *
+@@ -717,7 +723,11 @@ int pstore_register(struct pstore_info *psi)
allocate_buf_for_compression();
if (pstore_is_mounted())
@@ -78,59 +105,51 @@ Signed-off-by: Torsten Duwe <duwe@suse.de>
if (psi->flags & PSTORE_FLAGS_DMESG)
pstore_register_kmsg();
-@@ -473,7 +483,7 @@ EXPORT_SYMBOL_GPL(pstore_register);
- * when we are re-scanning the backing store looking to add new
+@@ -823,7 +833,7 @@ static void decompress_record(struct pstore_record *record)
* error records.
*/
--void pstore_get_records(int quiet)
-+void pstore_get_records(unsigned flags)
+ void pstore_get_backend_records(struct pstore_info *psi,
+- struct dentry *root, int quiet)
++ struct dentry *root, unsigned flags)
{
- struct pstore_info *psi = psinfo;
- char *buf = NULL;
-@@ -482,7 +492,7 @@ void pstore_get_records(int quiet)
- int count;
- enum pstore_type_id type;
- struct timespec time;
-- int failed = 0, rc;
-+ int failed = 0, rc = 0;
- bool compressed;
- int unzipped_len = -1;
- ssize_t ecc_notice_size = 0;
-@@ -511,16 +521,29 @@ void pstore_get_records(int quiet)
- compressed = true;
- }
- }
-- rc = pstore_mkfile(type, psi->name, id, count, buf,
-- compressed, size + ecc_notice_size,
-- time, psi);
-+
+ int failed = 0;
+
+@@ -841,7 +851,7 @@ void pstore_get_backend_records(struct pstore_info *psi,
+ */
+ for (;;) {
+ struct pstore_record *record;
+- int rc;
++ int rc = 0;
+
+ record = kzalloc(sizeof(*record), GFP_KERNEL);
+ if (!record) {
+@@ -857,12 +867,23 @@ void pstore_get_backend_records(struct pstore_info *psi,
+ break;
+
+ decompress_record(record);
+- rc = pstore_mkfile(root, record);
+ if (flags & PGR_POPULATE)
-+ rc = pstore_mkfile(type, psi->name, id, count, buf,
-+ compressed, size + ecc_notice_size,
-+ time, psi);
-+
-+ if (type == PSTORE_TYPE_DMESG) {
++ rc = pstore_mkfile(root, record);
++ if (record->type == PSTORE_TYPE_DMESG) {
+ if (flags & PGR_SYSLOG) {
+ pr_notice("---------- pstore: ----------\n");
-+ pr_notice("%.*s\n", (int)size, buf);
++ pr_notice("%.*s\n", (int)record->size,
++ record->buf);
+ pr_notice("-----------------------------\n");
+ }
+ if (flags & PGR_CLEAR && psi->erase)
-+ psi->erase(type, id, size, time, psi);
++ psi->erase(record);
+ }
-+
- if (unzipped_len < 0) {
- /* Free buffer other than big oops */
- kfree(buf);
- buf = NULL;
- } else
- unzipped_len = -1;
-- if (rc && (rc != -EEXIST || !quiet))
-+ if (rc && (rc != -EEXIST || (flags & PGR_VERBOSE)))
- failed++;
+ if (rc) {
+ /* pstore_mkfile() did not take record, so free it. */
+ kfree(record->buf);
+ kfree(record);
+- if (rc != -EEXIST || !quiet)
++ if (rc != -EEXIST || (flags & PGR_VERBOSE))
+ failed++;
+ }
}
- if (psi->close)
-@@ -534,7 +557,7 @@ out:
+@@ -878,7 +899,7 @@ void pstore_get_backend_records(struct pstore_info *psi,
static void pstore_dowork(struct work_struct *work)
{
@@ -139,3 +158,6 @@ Signed-off-by: Torsten Duwe <duwe@suse.de>
}
static void pstore_timefunc(unsigned long dummy)
+--
+2.13.0
+
diff --git a/patches.suse/supported-flag b/patches.suse/supported-flag
index 29f1d87797..0b2aa3e1e7 100644
--- a/patches.suse/supported-flag
+++ b/patches.suse/supported-flag
@@ -12,9 +12,7 @@ Changes:
- 2.6.25 claimed -S and bumped the flags up a bit, modpost now uses -N
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
-
---
-
Documentation/admin-guide/kernel-parameters.txt | 8 ++
Documentation/sysctl/kernel.txt | 12 +++
Makefile | 5 +
@@ -22,16 +20,16 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
include/linux/module.h | 3
init/Kconfig | 17 ++++
kernel/ksysfs.c | 27 +++++++
- kernel/module.c | 83 ++++++++++++++++++++++++
+ kernel/module.c | 82 ++++++++++++++++++++++++
kernel/panic.c | 6 +
kernel/sysctl.c | 9 ++
scripts/Makefile.modpost | 6 +
- scripts/mod/modpost.c | 79 ++++++++++++++++++++++
- 12 files changed, 265 insertions(+), 2 deletions(-)
+ scripts/mod/modpost.c | 79 ++++++++++++++++++++++-
+ 12 files changed, 264 insertions(+), 2 deletions(-)
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
-@@ -4071,6 +4071,14 @@
+@@ -4191,6 +4191,14 @@
unknown_nmi_panic
[X86] Cause panic on unknown NMI.
@@ -69,7 +67,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
--- a/Makefile
+++ b/Makefile
-@@ -411,6 +411,11 @@ KBUILD_AFLAGS_MODULE := -DMODULE
+@@ -409,6 +409,11 @@ KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
@@ -83,7 +81,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
-@@ -455,6 +455,9 @@ extern int panic_on_unrecovered_nmi;
+@@ -458,6 +458,9 @@ extern int panic_on_unrecovered_nmi;
extern int panic_on_io_nmi;
extern int panic_on_warn;
extern int sysctl_panic_on_rcu_stall;
@@ -93,7 +91,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
extern int sysctl_panic_on_stackoverflow;
extern bool crash_kexec_post_notifiers;
-@@ -515,6 +518,15 @@ extern enum system_states {
+@@ -522,6 +525,15 @@ extern enum system_states {
#define TAINT_LIVEPATCH 15
#define TAINT_FLAGS_COUNT 16
@@ -111,8 +109,8 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
char c_false; /* character printed when not tainted */
--- a/include/linux/module.h
+++ b/include/linux/module.h
-@@ -495,6 +495,9 @@ struct module *__module_address(unsigned
- bool is_module_address(unsigned long addr);
+@@ -496,6 +496,9 @@ bool is_module_address(unsigned long add
+ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr);
bool is_module_percpu_address(unsigned long addr);
bool is_module_text_address(unsigned long addr);
+#ifdef CONFIG_SUSE_KERNEL_SUPPORTED
@@ -149,7 +147,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
option env="ARCH"
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
-@@ -206,6 +206,30 @@ static struct bin_attribute notes_attr _
+@@ -210,6 +210,30 @@ static struct bin_attribute notes_attr _
struct kobject *kernel_kobj;
EXPORT_SYMBOL_GPL(kernel_kobj);
@@ -180,7 +178,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
static struct attribute * kernel_attrs[] = {
&fscaps_attr.attr,
&uevent_seqnum_attr.attr,
-@@ -225,6 +249,9 @@ static struct attribute * kernel_attrs[]
+@@ -231,6 +255,9 @@ static struct attribute * kernel_attrs[]
&rcu_expedited_attr.attr,
&rcu_normal_attr.attr,
#endif
@@ -192,7 +190,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
--- a/kernel/module.c
+++ b/kernel/module.c
-@@ -87,6 +87,22 @@
+@@ -88,6 +88,22 @@
/* If this is set, the section belongs in the init part of the module */
#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
@@ -215,7 +213,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
/*
* Mutex protects:
* 1) List of modules (also safely readable with preempt_disable),
-@@ -1150,6 +1166,12 @@ static size_t module_flags_taint(struct
+@@ -1170,6 +1186,12 @@ static size_t module_flags_taint(struct
buf[l++] = taint_flags[i].c_true;
}
@@ -228,7 +226,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
return l;
}
-@@ -1222,6 +1244,33 @@ static ssize_t show_taint(struct module_
+@@ -1239,6 +1261,33 @@ static ssize_t show_taint(struct module_
static struct module_attribute modinfo_taint =
__ATTR(taint, 0444, show_taint, NULL);
@@ -262,7 +260,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
static struct module_attribute *modinfo_attrs[] = {
&module_uevent,
&modinfo_version,
-@@ -1230,6 +1279,9 @@ static struct module_attribute *modinfo_
+@@ -1247,6 +1296,9 @@ static struct module_attribute *modinfo_
&modinfo_coresize,
&modinfo_initsize,
&modinfo_taint,
@@ -272,7 +270,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
#ifdef CONFIG_MODULE_UNLOAD
&modinfo_refcnt,
#endif
-@@ -1785,9 +1837,37 @@ static int mod_sysfs_setup(struct module
+@@ -1808,9 +1860,36 @@ static int mod_sysfs_setup(struct module
add_sect_attrs(mod, info);
add_notes_attrs(mod, info);
@@ -305,12 +303,11 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
+ remove_notes_attrs(mod);
+ remove_sect_attrs(mod);
+ del_usage_links(mod);
-+ module_remove_modinfo_attrs(mod);
+#endif
+ out_unreg_modinfo_attrs:
+ module_remove_modinfo_attrs(mod);
out_unreg_param:
- module_param_sysfs_remove(mod);
- out_unreg_holders:
-@@ -4293,6 +4373,9 @@ void print_modules(void)
+@@ -4332,6 +4411,9 @@ void print_modules(void)
if (last_unloaded_module[0])
pr_cont(" [last unloaded: %s]", last_unloaded_module);
pr_cont("\n");
@@ -344,7 +341,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
*/
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
-@@ -769,6 +769,15 @@ static struct ctl_table kern_table[] = {
+@@ -790,6 +790,15 @@ static struct ctl_table kern_table[] = {
.extra1 = &pid_max_min,
.extra2 = &pid_max_max,
},
@@ -428,7 +425,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
static void read_symbols(char *modname)
{
const char *symname;
-@@ -2159,6 +2203,15 @@ static void add_staging_flag(struct buff
+@@ -2160,6 +2204,15 @@ static void add_staging_flag(struct buff
*/
#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
@@ -444,7 +441,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
/**
* Record CRCs for unresolved symbols
**/
-@@ -2306,6 +2359,15 @@ static void write_if_changed(struct buff
+@@ -2307,6 +2360,15 @@ static void write_if_changed(struct buff
fclose(file);
}
@@ -460,7 +457,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
/* parse Module.symvers file. line format:
* 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something]
**/
-@@ -2402,12 +2464,15 @@ int main(int argc, char **argv)
+@@ -2403,12 +2465,15 @@ int main(int argc, char **argv)
struct buffer buf = { };
char *kernel_read = NULL, *module_read = NULL;
char *dump_write = NULL, *files_source = NULL;
@@ -477,7 +474,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
switch (opt) {
case 'i':
kernel_read = optarg;
-@@ -2451,11 +2516,20 @@ int main(int argc, char **argv)
+@@ -2452,11 +2517,20 @@ int main(int argc, char **argv)
case 'E':
sec_mismatch_fatal = 1;
break;
@@ -498,7 +495,7 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
if (kernel_read)
read_dump(kernel_read, 1);
if (module_read)
-@@ -2492,6 +2566,9 @@ int main(int argc, char **argv)
+@@ -2493,6 +2567,9 @@ int main(int argc, char **argv)
add_header(&buf, mod);
add_intree_flag(&buf, !external_module);
add_staging_flag(&buf, mod->name);
diff --git a/patches.suse/suse-ppc64-branding b/patches.suse/suse-ppc64-branding
deleted file mode 100644
index 695224a65f..0000000000
--- a/patches.suse/suse-ppc64-branding
+++ /dev/null
@@ -1,25 +0,0 @@
-From: <olh@suse.de>
-Subject: display the product in the frontpanel LCD
-Patch-mainline: never
-
-display the product in the frontpanel LCD
-also the uname -r output instead of uname -v.
-
- arch/powerpc/platforms/pseries/setup.c | 6 +-----
- 1 file changed, 1 insertion(+), 5 deletions(-)
-
---- a/arch/powerpc/platforms/pseries/setup.c
-+++ b/arch/powerpc/platforms/pseries/setup.c
-@@ -510,11 +510,7 @@ static void __init pSeries_setup_arch(vo
- static int __init pSeries_init_panel(void)
- {
- /* Manually leave the kernel version on the panel. */
--#ifdef __BIG_ENDIAN__
-- ppc_md.progress("Linux ppc64\n", 0);
--#else
-- ppc_md.progress("Linux ppc64le\n", 0);
--#endif
-+ ppc_md.progress("SUSE Linux\n", 0);
- ppc_md.progress(init_utsname()->version, 0);
-
- return 0;
diff --git a/patches.suse/uapi-add-a-compatibility-layer-between-linux-uio-h-and-glibc b/patches.suse/uapi-add-a-compatibility-layer-between-linux-uio-h-and-glibc
new file mode 100644
index 0000000000..53e1c0eb95
--- /dev/null
+++ b/patches.suse/uapi-add-a-compatibility-layer-between-linux-uio-h-and-glibc
@@ -0,0 +1,64 @@
+From: Dmitry V. Levin <ldv@altlinux.org>
+Date: Feb. 22, 2017, 2:29 a.m.
+Subject: uapi: add a compatibility layer between linux/uio.h and glibc
+References: bsc#1053501
+Patch-mainline: Not yet, submitted 2/22/2017 to lkml
+
+Do not define struct iovec in linux/uio.h when <sys/uio.h> or <fcntl.h>
+is already included and provides these definitions.
+
+This fixes the following compilation error when <sys/uio.h> or <fcntl.h>
+is included before <linux/uio.h>:
+
+/usr/include/linux/uio.h:16:8: error: redefinition of 'struct iovec'
+
+Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
+Acked-by: Lee Duncan <lduncan@suse.com>
+---
+
+Acked-by: Lee Duncan <lduncan@suse.com>
+---
+ include/uapi/linux/libc-compat.h | 10 ++++++++++
+ include/uapi/linux/uio.h | 3 +++
+ 2 files changed, 13 insertions(+)
+
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -205,6 +205,16 @@
+ #define __UAPI_DEF_IPX_CONFIG_DATA 1
+ #define __UAPI_DEF_IPX_ROUTE_DEF 1
+
++/* Coordinate with glibc bits/uio.h header. */
++#if defined(_SYS_UIO_H) || defined(_FCNTL_H)
++#define __UAPI_DEF_IOVEC 0
++#else
++#define __UAPI_DEF_IOVEC 1
++#endif
++
++/* Definitions for uio.h */
++#define __UAPI_DEF_IOVEC 1
++
+ /* Definitions for xattr.h */
+ #define __UAPI_DEF_XATTR 1
+
+--- a/include/uapi/linux/uio.h
++++ b/include/uapi/linux/uio.h
+@@ -9,15 +9,18 @@
+ #ifndef _UAPI__LINUX_UIO_H
+ #define _UAPI__LINUX_UIO_H
+
++#include <linux/libc-compat.h>
+ #include <linux/compiler.h>
+ #include <linux/types.h>
+
+
++#if __UAPI_DEF_IOVEC
+ struct iovec
+ {
+ void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
+ __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
+ };
++#endif /* __UAPI_DEF_IOVEC */
+
+ /*
+ * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
diff --git a/patches.suse/vfs-add-super_operations-get_inode_dev b/patches.suse/vfs-add-super_operations-get_inode_dev
index dc88d9c5bb..652e91fd87 100644
--- a/patches.suse/vfs-add-super_operations-get_inode_dev
+++ b/patches.suse/vfs-add-super_operations-get_inode_dev
@@ -17,34 +17,36 @@ will not distinguish between subvolumes within a single btrfs filesystem.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- arch/arc/kernel/troubleshoot.c | 2 +-
- drivers/staging/lustre/lustre/llite/dir.c | 2 +-
- drivers/staging/lustre/lustre/llite/file.c | 2 +-
- fs/locks.c | 4 ++--
- fs/nfsd/nfs3xdr.c | 2 +-
- fs/nfsd/vfs.c | 6 +++---
- fs/notify/fdinfo.c | 4 ++--
- fs/proc/nommu.c | 2 +-
- fs/proc/task_mmu.c | 2 +-
- fs/proc/task_nommu.c | 2 +-
- fs/stat.c | 2 +-
- include/linux/fs.h | 9 +++++++++
- include/trace/events/filelock.h | 8 ++++----
- include/trace/events/filemap.h | 2 +-
- include/trace/events/writeback.h | 2 +-
- kernel/audit.c | 2 +-
- kernel/audit_fsnotify.c | 2 +-
- kernel/audit_watch.c | 6 +++---
- kernel/auditsc.c | 4 ++--
- kernel/events/core.c | 2 +-
- mm/memory-failure.c | 2 +-
- net/unix/diag.c | 2 +-
- security/tomoyo/condition.c | 2 +-
+ arch/arc/kernel/troubleshoot.c | 2 +-
+ drivers/staging/lustre/lustre/llite/dir.c | 2 +-
+ drivers/staging/lustre/lustre/llite/file.c | 2 +-
+ fs/locks.c | 4 ++--
+ fs/nfsd/nfs3xdr.c | 2 +-
+ fs/nfsd/vfs.c | 6 +++---
+ fs/notify/fdinfo.c | 4 ++--
+ fs/proc/nommu.c | 2 +-
+ fs/proc/task_mmu.c | 2 +-
+ fs/proc/task_nommu.c | 2 +-
+ fs/stat.c | 2 +-
+ include/linux/fs.h | 9 +++++++++
+ include/trace/events/filelock.h | 8 ++++----
+ include/trace/events/filemap.h | 2 +-
+ include/trace/events/writeback.h | 2 +-
+ kernel/audit.c | 2 +-
+ kernel/audit_fsnotify.c | 2 +-
+ kernel/audit_watch.c | 6 +++---
+ kernel/auditsc.c | 4 ++--
+ kernel/events/core.c | 2 +-
+ mm/memory-failure.c | 2 +-
+ net/unix/diag.c | 2 +-
+ security/tomoyo/condition.c | 2 +-
23 files changed, 41 insertions(+), 32 deletions(-)
+diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
+index f9caf79186d4..d2cdc6dd7205 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
-@@ -101,7 +101,7 @@ static void show_faulting_vma(unsigned l
+@@ -104,7 +104,7 @@ static void show_faulting_vma(unsigned long address, char *buf)
if (file) {
nm = file_path(file, buf, PAGE_SIZE - 1);
inode = file_inode(vma->vm_file);
@@ -53,9 +55,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ino = inode->i_ino;
}
pr_info(" @off 0x%lx in [%s]\n"
+diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
+index 13b35922a4ca..6a7f9e69855a 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
-@@ -1511,7 +1511,7 @@ skip_lmm:
+@@ -1362,7 +1362,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct lov_user_mds_data __user *lmdp;
lstat_t st = { 0 };
@@ -64,9 +68,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
st.st_mode = body->mbo_mode;
st.st_nlink = body->mbo_nlink;
st.st_uid = body->mbo_uid;
+diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
+index 67c4b9cc6e75..8c9fc8a75995 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
-@@ -3057,7 +3057,7 @@ int ll_getattr(struct vfsmount *mnt, str
+@@ -2964,7 +2964,7 @@ int ll_getattr(const struct path *path, struct kstat *stat,
OBD_FAIL_TIMEOUT(OBD_FAIL_GETATTR_DELAY, 30);
@@ -75,9 +81,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (ll_need_32bit_api(sbi))
stat->ino = cl_fid_build_ino(&lli->lli_fid, 1);
else
+diff --git a/fs/locks.c b/fs/locks.c
+index af2031a1fcff..e71c2fdf80df 100644
--- a/fs/locks.c
+++ b/fs/locks.c
-@@ -2629,8 +2629,8 @@ static void lock_get_status(struct seq_f
+@@ -2682,8 +2682,8 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
if (inode) {
/* userspace relies on this representation of dev_t */
seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
@@ -88,9 +96,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
} else {
seq_printf(f, "%d <none>:0 ", fl_pid);
}
+diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
+index 12feac6ee2fd..5f59b0bb6984 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
-@@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, st
+@@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
default:
case FSIDSOURCE_DEV:
p = xdr_encode_hyper(p, (u64)huge_encode_dev
@@ -99,9 +109,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
break;
case FSIDSOURCE_FSID:
p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
+diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
+index 2be32955d7f2..c3c8b4573edb 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
-@@ -739,7 +739,7 @@ struct raparms *
+@@ -785,7 +785,7 @@ struct raparms *
nfsd_init_raparms(struct file *file)
{
struct inode *inode = file_inode(file);
@@ -110,7 +122,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ino_t ino = inode->i_ino;
struct raparms *ra, **rap, **frap = NULL;
int depth = 0;
-@@ -907,7 +907,7 @@ static int wait_for_concurrent_writes(st
+@@ -953,7 +953,7 @@ static int wait_for_concurrent_writes(struct file *file)
int err = 0;
if (atomic_read(&inode->i_writecount) > 1
@@ -119,7 +131,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
dprintk("nfsd: write defer %d\n", task_pid_nr(current));
msleep(10);
dprintk("nfsd: write resume %d\n", task_pid_nr(current));
-@@ -918,7 +918,7 @@ static int wait_for_concurrent_writes(st
+@@ -964,7 +964,7 @@ static int wait_for_concurrent_writes(struct file *file)
err = vfs_fsync(file, 0);
}
last_ino = inode->i_ino;
@@ -128,9 +140,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
return err;
}
+diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
+index dd63aa9a6f9a..82737e4ae0ae 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
-@@ -91,7 +91,7 @@ static void inotify_fdinfo(struct seq_fi
+@@ -90,7 +90,7 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
*/
u32 mask = mark->mask & IN_ALL_EVENTS;
seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
@@ -139,7 +153,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
mask, mark->ignored_mask);
show_mark_fhandle(m, inode);
seq_putc(m, '\n');
-@@ -124,7 +124,7 @@ static void fanotify_fdinfo(struct seq_f
+@@ -120,7 +120,7 @@ static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
if (!inode)
return;
seq_printf(m, "fanotify ino:%lx sdev:%x mflags:%x mask:%x ignored_mask:%x ",
@@ -148,9 +162,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
mflags, mark->mask, mark->ignored_mask);
show_mark_fhandle(m, inode);
seq_putc(m, '\n');
+diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
+index 75634379f82e..8ec396f8b78a 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
-@@ -46,7 +46,7 @@ static int nommu_region_show(struct seq_
+@@ -46,7 +46,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
if (file) {
struct inode *inode = file_inode(region->vm_file);
@@ -159,9 +175,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ino = inode->i_ino;
}
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
+index f0c8b33d99b1..a0c818ea1879 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
-@@ -299,7 +299,7 @@ show_map_vma(struct seq_file *m, struct
+@@ -293,7 +293,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
if (file) {
struct inode *inode = file_inode(vma->vm_file);
@@ -170,9 +188,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ino = inode->i_ino;
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
}
+diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
+index 23266694db11..df61aa8938a3 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
-@@ -164,7 +164,7 @@ static int nommu_vma_show(struct seq_fil
+@@ -158,7 +158,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
if (file) {
struct inode *inode = file_inode(vma->vm_file);
@@ -181,9 +201,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ino = inode->i_ino;
pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
}
+diff --git a/fs/stat.c b/fs/stat.c
+index f494b182c7c7..01955747772f 100644
--- a/fs/stat.c
+++ b/fs/stat.c
-@@ -20,7 +20,7 @@
+@@ -31,7 +31,7 @@
*/
void generic_fillattr(struct inode *inode, struct kstat *stat)
{
@@ -192,9 +214,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
stat->ino = inode->i_ino;
stat->mode = inode->i_mode;
stat->nlink = inode->i_nlink;
+diff --git a/include/linux/fs.h b/include/linux/fs.h
+index 803e5a9b2654..d0c2cc74d323 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -1806,6 +1806,7 @@ struct super_operations {
+@@ -1803,6 +1803,7 @@ struct super_operations {
struct shrink_control *);
long (*free_cached_objects)(struct super_block *,
struct shrink_control *);
@@ -202,7 +226,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
};
/*
-@@ -3192,4 +3193,12 @@ static inline bool dir_relax_shared(stru
+@@ -3224,4 +3225,12 @@ static inline bool dir_relax_shared(struct inode *inode)
extern bool path_noexec(const struct path *path);
extern void inode_nohighmem(struct inode *inode);
@@ -215,6 +239,8 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+}
+
#endif /* _LINUX_FS_H */
+diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
+index 63a7680347cb..87412ff5a08c 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -47,7 +47,7 @@ TRACE_EVENT(locks_get_lock_context,
@@ -253,9 +279,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
__entry->i_ino = inode->i_ino;
__entry->wcount = atomic_read(&inode->i_writecount);
__entry->dcount = d_count(fl->fl_file->f_path.dentry);
+diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h
+index 42febb6bc1d5..a839a70faa28 100644
--- a/include/trace/events/filemap.h
+++ b/include/trace/events/filemap.h
-@@ -29,7 +29,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_c
+@@ -29,7 +29,7 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
__entry->i_ino = page->mapping->host->i_ino;
__entry->index = page->index;
if (page->mapping->host->i_sb)
@@ -264,9 +292,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
else
__entry->s_dev = page->mapping->host->i_rdev;
),
+diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
+index 7bd8783a590f..75520d963340 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
-@@ -710,7 +710,7 @@ DECLARE_EVENT_CLASS(writeback_inode_temp
+@@ -710,7 +710,7 @@ DECLARE_EVENT_CLASS(writeback_inode_template,
),
TP_fast_assign(
@@ -275,9 +305,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
__entry->ino = inode->i_ino;
__entry->state = inode->i_state;
__entry->mode = inode->i_mode;
+diff --git a/kernel/audit.c b/kernel/audit.c
+index 4b7d49868ce1..c9987f7c1987 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
-@@ -1736,7 +1736,7 @@ void audit_copy_inode(struct audit_names
+@@ -2044,7 +2044,7 @@ void audit_copy_inode(struct audit_names *name, const struct dentry *dentry,
struct inode *inode)
{
name->ino = inode->i_ino;
@@ -286,9 +318,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
name->mode = inode->i_mode;
name->uid = inode->i_uid;
name->gid = inode->i_gid;
+diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c
+index 52f368b6561e..4d4d4eea102e 100644
--- a/kernel/audit_fsnotify.c
+++ b/kernel/audit_fsnotify.c
-@@ -76,7 +76,7 @@ int audit_mark_compare(struct audit_fsno
+@@ -76,7 +76,7 @@ int audit_mark_compare(struct audit_fsnotify_mark *mark, unsigned long ino, dev_
static void audit_update_mark(struct audit_fsnotify_mark *audit_mark,
const struct inode *inode)
{
@@ -297,9 +331,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
audit_mark->ino = inode ? inode->i_ino : AUDIT_INO_UNSET;
}
+diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
+index 62d686d96581..7332b57709ba 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
-@@ -368,7 +368,7 @@ static int audit_get_nd(struct audit_wat
+@@ -368,7 +368,7 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent)
inode_unlock(d_backing_inode(parent->dentry));
if (d_is_positive(d)) {
/* update watch filter fields */
@@ -308,8 +344,8 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
watch->ino = d_backing_inode(d)->i_ino;
}
dput(d);
-@@ -496,7 +496,7 @@ static int audit_watch_handle_event(stru
- };
+@@ -497,7 +497,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
+ }
if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
- audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0);
@@ -317,7 +353,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
else if (mask & (FS_DELETE|FS_MOVED_FROM))
audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1);
else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
-@@ -549,7 +549,7 @@ int audit_exe_compare(struct task_struct
+@@ -551,7 +551,7 @@ int audit_exe_compare(struct task_struct *tsk, struct audit_fsnotify_mark *mark)
if (!exe_file)
return 0;
ino = file_inode(exe_file)->i_ino;
@@ -326,9 +362,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
fput(exe_file);
return audit_mark_compare(mark, ino, dev);
}
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c
+index bb724baa7ac9..52462c9432c2 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
-@@ -1783,7 +1783,7 @@ void __audit_inode(struct filename *name
+@@ -1794,7 +1794,7 @@ void __audit_inode(struct filename *name, const struct dentry *dentry,
if (n->ino) {
/* valid inode number, use that for the comparison */
if (n->ino != inode->i_ino ||
@@ -337,7 +375,7 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
continue;
} else if (n->name) {
/* inode number has not been set, check the name */
-@@ -1869,7 +1869,7 @@ void __audit_inode_child(struct inode *p
+@@ -1880,7 +1880,7 @@ void __audit_inode_child(struct inode *parent,
n->type != AUDIT_TYPE_UNKNOWN))
continue;
@@ -346,9 +384,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
!audit_compare_dname_path(dname,
n->name->name, n->name_len)) {
if (n->type == AUDIT_TYPE_UNKNOWN)
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index 6e75a5c9412d..ab870aadd6ec 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
-@@ -6532,7 +6532,7 @@ static void perf_event_mmap_event(struct
+@@ -6865,7 +6865,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
goto cpy_name;
}
inode = file_inode(vma->vm_file);
@@ -357,9 +397,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
ino = inode->i_ino;
gen = inode->i_generation;
maj = MAJOR(dev);
+diff --git a/mm/memory-failure.c b/mm/memory-failure.c
+index 2527dfeddb00..62a338c4e641 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
-@@ -98,7 +98,7 @@ static int hwpoison_filter_dev(struct pa
+@@ -99,7 +99,7 @@ static int hwpoison_filter_dev(struct page *p)
if (mapping == NULL || mapping->host == NULL)
return -EINVAL;
@@ -368,9 +410,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
if (hwpoison_filter_dev_major != ~0U &&
hwpoison_filter_dev_major != MAJOR(dev))
return -EINVAL;
+diff --git a/net/unix/diag.c b/net/unix/diag.c
+index 4d9679701a6d..ff37599922c7 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
-@@ -26,7 +26,7 @@ static int sk_diag_dump_vfs(struct sock
+@@ -26,7 +26,7 @@ static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb)
if (dentry) {
struct unix_diag_vfs uv = {
.udiag_vfs_ino = d_backing_inode(dentry)->i_ino,
@@ -379,9 +423,11 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
};
return nla_put(nlskb, UNIX_DIAG_VFS, sizeof(uv), &uv);
+diff --git a/security/tomoyo/condition.c b/security/tomoyo/condition.c
+index 6c4528d4b48f..9f16cb5529ad 100644
--- a/security/tomoyo/condition.c
+++ b/security/tomoyo/condition.c
-@@ -721,7 +721,7 @@ void tomoyo_get_attributes(struct tomoyo
+@@ -721,7 +721,7 @@ void tomoyo_get_attributes(struct tomoyo_obj_info *obj)
stat->gid = inode->i_gid;
stat->ino = inode->i_ino;
stat->mode = inode->i_mode;
@@ -390,3 +436,6 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
stat->rdev = inode->i_rdev;
obj->stat_valid[i] = true;
}
+--
+2.13.0
+
diff --git a/rpm/config.sh b/rpm/config.sh
index 345a0043bb..be6847b548 100644
--- a/rpm/config.sh
+++ b/rpm/config.sh
@@ -1,5 +1,5 @@
# The version of the main tarball to use
-SRCVERSION=4.11
+SRCVERSION=4.13
# variant of the kernel-source package, either empty or "-rt"
VARIANT=-xen
# buildservice projects to build the kernel against
diff --git a/rpm/dtb.spec.in.in b/rpm/dtb.spec.in.in
index 03c2681770..0ea9b4639d 100644
--- a/rpm/dtb.spec.in.in
+++ b/rpm/dtb.spec.in.in
@@ -65,6 +65,7 @@ cd linux-%srcversion
%build
source=linux-%srcversion
cp $source/COPYING .
+SRCDIR=`pwd`/$source
mkdir pp
PPDIR=`pwd`/pp
export DTC_FLAGS="-R 4 -p 0x1000"
@@ -76,7 +77,7 @@ cd $source/$DTS_folder
for dts in $ALL_SUPPORTED_DTB; do
target=${dts%*.dts}
mkdir -p $PPDIR/$(dirname $target)
- cpp -x assembler-with-cpp -undef -D__DTS__ -nostdinc -I. -I./include/ -P $target.dts -o $PPDIR/$target.dts
+ cpp -x assembler-with-cpp -undef -D__DTS__ -nostdinc -I. -I$SRCDIR/include/ -I$SRCDIR/scripts/dtc/include-prefixes/ -P $target.dts -o $PPDIR/$target.dts
dtc $DTC_FLAGS -I dts -O dtb -i ./$(dirname $target) -o $PPDIR/$target.dtb $PPDIR/$target.dts
done
diff --git a/rpm/find-provides b/rpm/find-provides
deleted file mode 100755
index 6716ed7d82..0000000000
--- a/rpm/find-provides
+++ /dev/null
@@ -1,18 +0,0 @@
-#! /bin/bash
-
-trap 'rm -f "$filelist"' EXIT
-filelist=$(mktemp -t ${0##*/}.XXXXXXXXXX)
-grep -v '/kernel/drivers/staging/.*\.ko$' >"$filelist"
-shopt -s nullglob
-
-# pretend that /boot/vmlinux-* is in the -base package and not in -devel
-if grep -q '/boot/System\.map\>' "$filelist"; then
- prefix=$(sed -rn 's:(.*)/boot/System\.map\>.*:\1:p; T; q' "$filelist")
- for f in "$prefix"/boot/vmlinux*; do
- echo "$f" >>"$filelist"
- done
-else
- perl -ni -e 'next if /\/boot\/vmlinux/ && !/\.debug$/; print' "$filelist"
-fi
-
-/usr/lib/rpm/find-provides "$@" <"$filelist"
diff --git a/rpm/find-requires b/rpm/find-requires
deleted file mode 100644
index a656f2b4d0..0000000000
--- a/rpm/find-requires
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-#
-# Generate dependencies for KMPs defined in supported.conf. We look at each
-# modules 'depends' field in modinfo and use the $name-kmp-modules lists
-# in builddir to map dependencies to package names. We do it this way instead
-# of relying on the ksym() dependencies, because KMPs built from the kernel
-# spec file are not shared among kernel versions.
-
-package_name=$1
-version_release=$2
-builddir=$3
-
-trap 'rm -f "$filelist"' EXIT
-filelist=$(mktemp -t ${0##*/}.XXXXXXXXXX)
-cat >"$filelist"
-
-# is this module part of any KMP?
-in_kmp()
-{
- local mod=${1//[-_]/[-_]} res
-
- for f in "$builddir"/*-kmp-modules; do
- if grep -q "/$mod\$" "$f"; then
- res=${f##*/}
- echo "${res%-modules}"
- fi
- done
-}
-
-grep '\.ko$' "$filelist" | while read f; do
- mod=${f##*/}
- kmp=$(in_kmp "$mod")
- if test -z "$kmp"; then
- continue
- fi
- for dep in $(IFS=,; set -- $(/sbin/modinfo -F depends "$f"); echo $*); do
- kmp2=$(in_kmp "$dep.ko")
- if test -n "$kmp2" -a "$kmp2" != "$kmp"; then
- # Needs another KMP
- echo "$kmp2-${package_name#kernel-} = $version_release"
- fi
- done
-done
-
-/usr/lib/rpm/find-requires "$package_name" <"$filelist"
diff --git a/rpm/kabi.pl b/rpm/kabi.pl
index 20ced4c165..bce16b1a65 100755
--- a/rpm/kabi.pl
+++ b/rpm/kabi.pl
@@ -60,7 +60,7 @@ sub load_symvers {
$errors++;
next;
}
- my $new = { crc => $l[0], mod => $l[2] };
+ my $new = { crc => $l[0], mod => $l[2], type => $l[3] };
$res{$l[1]} = $new;
}
if (!%res) {
@@ -71,9 +71,35 @@ sub load_symvers {
return %res;
}
+# Each bit represents a restriction of the export and adding a restriction
+# fails the check
+my $type_GPL = 0x1;
+my $type_NOW = 0x2;
+my $type_UNUSED = 0x4;
+my %types = (
+ EXPORT_SYMBOL => 0x0,
+ EXPORT_SYMBOL_GPL => $type_GPL | $type_NOW,
+ EXPORT_SYMBOL_GPL_FUTURE => $type_GPL,
+ EXPORT_UNUSED_SYMBOL => $type_UNUSED,
+ EXPORT_UNUSED_SYMBOL_GPL => $type_UNUSED | $type_GPL | $type_NOW
+);
+
+sub type_compatible {
+ my ($old, $new) = @_;
+
+ for my $type ($old, $new) {
+ if (!exists($types{$type})) {
+ print STDERR "error: unrecognized export type $type.\n";
+ exit 1;
+ }
+ }
+ # if $new has a bit set that $old does not -> fail
+ return !(~$types{$old} & $types{$new});
+}
+
my $kabi_errors = 0;
sub kabi_change {
- my ($sym, $mod, $oldcrc, $newcrc) = @_;
+ my ($sym, $mod, $message) = @_;
my $fail = 1;
for my $rule (@rules) {
@@ -84,12 +110,7 @@ sub kabi_change {
}
}
return unless $fail or $opt_verbose;
- print STDERR "KABI: symbol $sym($mod) ";
- if ($newcrc) {
- print STDERR "changed crc from $oldcrc to $newcrc"
- } else {
- print STDERR "lost";
- }
+ print STDERR "KABI: symbol $sym($mod) $message";
if ($fail) {
$kabi_errors++;
print STDERR "\n";
@@ -118,10 +139,13 @@ my %new = load_symvers($ARGV[1]);
for my $sym (sort keys(%old)) {
if (!$new{$sym}) {
- kabi_change($sym, $old{$sym}->{mod}, $old{$sym}->{crc}, 0);
+ kabi_change($sym, $old{$sym}->{mod}, "lost");
} elsif ($old{$sym}->{crc} ne $new{$sym}->{crc}) {
- kabi_change($sym, $new{$sym}->{mod}, $old{$sym}->{crc},
- $new{$sym}->{crc});
+ kabi_change($sym, $old{$sym}->{mod}, "changed crc from " .
+ "$old{$sym}->{crc} to $new{$sym}->{crc}");
+ } elsif (!type_compatible($old{$sym}->{type}, $new{$sym}->{type})) {
+ kabi_change($sym, $old{$sym}->{mod}, "changed type from " .
+ "$old{$sym}->{type} to $new{$sym}->{type}");
}
}
if ($kabi_errors) {
diff --git a/rpm/kernel-binary.spec.in b/rpm/kernel-binary.spec.in
index 0b5bdd19e6..afd8c04f97 100644
--- a/rpm/kernel-binary.spec.in
+++ b/rpm/kernel-binary.spec.in
@@ -69,8 +69,12 @@ Url: http://www.kernel.org/
BuildRequires: bc
BuildRequires: coreutils
BuildRequires: fdupes
+# Cannot test %%CONFIG_GCC_PLUGINS here because the buildservice parser
+# does not expand %%(...)
+%if "%build_flavor" == "syzkaller"
# Needed by scripts/gcc-plugin.sh
BuildRequires: gcc-c++ gcc-devel
+%endif
%if 0%{?suse_version} > 1310
BuildRequires: hmaccalc
%endif
@@ -99,6 +103,7 @@ Obsoletes: %name-base < 3.1
Requires(pre): coreutils awk
# For /usr/lib/module-init-tools/weak-modules2
Requires(post): suse-module-tools
+Recommends: kernel-firmware
# For depmod (modutils is a dependency provided by both module-init-tools and
# kmod-compat)
Requires(post): modutils
@@ -144,6 +149,8 @@ Obsoletes: microcode_ctl
# 1) allow install on older dist versions, and
# 2) decrease build times (bsc#962356)
%define _binary_payload w9.bzdio
+# Do not recompute the build-id of vmlinux in find-debuginfo.sh (bsc#964063)
+%define _no_recompute_build_ids 1
# dead network if installed on SLES10, otherwise it will work (mostly)
Conflicts: sysfsutils < 2.0
Conflicts: apparmor-profiles <= 2.1
@@ -221,8 +228,6 @@ Provides: compat-ath9k = 3.0
%obsolete_kmp rt3592 2.4.1.1_3
%obsolete_kmp rt5390 2.4.0.4_3
%obsolete_kmp ath3k 1.0_3
-Obsoletes: ath3k-firmware <= 1.0
-Provides: ath3k-firmware = 1.0
%obsolete_kmp compat-wireless 3.12
%obsolete_kmp rts5229 1.08
%obsolete_kmp rts_pstor 1.11
@@ -232,13 +237,6 @@ Provides: ath3k-firmware = 1.0
# TW 4.8
%obsolete_kmp ftsteutates 20160601
-# Provide the exported symbols as "ksym(symbol) = hash"
-%define _use_internal_dependency_generator 0
-%define __find_provides %_sourcedir/find-provides %name
-
-# Generate dependencies for KMPs defined in supported.conf
-%define __find_requires %_sourcedir/find-requires %name %version-%release %my_builddir
-
# Will modules not listed in supported.conf abort the kernel build (0/1)?
%define supported_modules_check 0
@@ -346,12 +344,21 @@ fi
--disable CONFIG_DEBUG_INFO
%endif
-MAKE_ARGS="$MAKE_ARGS %{?_smp_mflags} -C .. O=$PWD"
+makeoutputsync=
+if make --output-sync --help >/dev/null 2>&1 ; then
+ makeoutputsync=--output-sync
+else
+ echo make does not support --output-sync flag. Build messages may be mangled. 1>&2
+fi
+MAKE_ARGS="$MAKE_ARGS $makeoutputsync %{?_smp_mflags}"
+echo export MAKE_ARGS=\""$MAKE_ARGS"\" >> .kernel-binary.spec.buildenv
+
+KERN_DIRS="-C .. O=$PWD"
if test -e %_sourcedir/TOLERATE-UNKNOWN-NEW-CONFIG-OPTIONS; then
- yes '' | make oldconfig $MAKE_ARGS
+ yes '' | make oldconfig $MAKE_ARGS $KERN_DIRS
else
cp .config .config.orig
- make silentoldconfig $MAKE_ARGS < /dev/null
+ make silentoldconfig $MAKE_ARGS $KERN_DIRS < /dev/null
%_sourcedir/check-for-config-changes .config.orig .config
rm .config.orig
fi
@@ -392,8 +399,6 @@ for f in %_sourcedir/*.crt; do
cat "$f" >>certs/signing_key.pem
done
-MAKE_ARGS="$MAKE_ARGS %{?_smp_mflags}"
-
%if %CONFIG_KMSG_IDS == "y"
chmod +x ../scripts/kmsg-doc
MAKE_ARGS="$MAKE_ARGS D=2"
@@ -705,11 +710,12 @@ if [ %CONFIG_MODULES = y ]; then
fi
fi
- # arch/powerpc/lib/crtsavres.o is required for building external
- # modules on powerpc
- if [ -f %kernel_build_dir/arch/powerpc/lib/crtsavres.o ]; then
- echo arch/powerpc/lib/crtsavres.o >> %my_builddir/obj-files
- fi
+ # These files are required for building external modules
+ for FILE in arch/powerpc/lib/crtsavres.o arch/arm64/kernel/ftrace-mod.o; do
+ if [ -f %kernel_build_dir/$FILE ]; then
+ echo $FILE >> %my_builddir/obj-files
+ fi
+ done
tar -cf - -T %my_builddir/obj-files | \
tar -xf - -C %rpm_install_dir/%cpu_arch_flavor
@@ -727,6 +733,8 @@ if [ %CONFIG_MODULES = y ]; then
$(echo %srcversion | sed -r 's/^([0-9]+)\.([0-9]+).*/\1 \2/')
fi
+rm -rf %{buildroot}/lib/firmware
+
add_dirs_to_filelist() {
sed -rn '
# print file name
@@ -995,6 +1003,7 @@ Provides: multiversion(kernel)
# tell weak-modules2 to ignore this package
Provides: kmp_in_kernel
Requires(post): suse-module-tools >= 12.4
+@KMP_DEPS@
%description -n @KMP_NAME@-%build_flavor
@KMP_DESCRIPTION@
diff --git a/rpm/kernel-docs.spec.in b/rpm/kernel-docs.spec.in
index e6371197ba..468516580d 100644
--- a/rpm/kernel-docs.spec.in
+++ b/rpm/kernel-docs.spec.in
@@ -21,13 +21,8 @@
%include %_sourcedir/kernel-spec-macros
-%define use_fop 1
-
-%if %{?is_opensuse}
-%define use_sphinx 1
-%else
-%define use_sphinx 0
-%endif
+%define build_html 1
+%define build_pdf 0
# copy the whole tree to generate some images (sigh...)
%define local_copy 1
@@ -39,7 +34,7 @@
%endif
Name: kernel-docs@VARIANT@
-Summary: Kernel Documentation (man pages)
+Summary: Kernel Documentation
License: GPL-2.0
Group: Documentation/Man
Version: @RPMVERSION@
@@ -49,24 +44,25 @@ Release: <RELEASE>.g@COMMIT@
Release: @RELEASE@
%endif
BuildRequires: kernel-source%variant
-%if %use_sphinx
+%if %build_pdf || %build_html
+# ReST handling
BuildRequires: graphviz
-BuildRequires: python-Sphinx
-# rst2pdf is broken with Sphinx 1.3.x, so disabled for now
-# BuildRequires: python-rst2pdf
+BuildRequires: graphviz-gd
+BuildRequires: graphviz-gnome
+BuildRequires: ImageMagick
+BuildRequires: python3-Sphinx
+BuildRequires: texlive-anyfontsize
+%if %build_pdf
+BuildRequires: python3-Sphinx-latex
+BuildRequires: texlive-adjustbox
+BuildRequires: texlive-dejavu
+BuildRequires: texlive-dejavu-fonts
+BuildRequires: texlive-glyphlist
+BuildRequires: texlive-makeindex
+BuildRequires: texlive-varwidth
+BuildRequires: texlive-xetex
+BuildRequires: texlive-zapfding
%endif
-BuildRequires: xmlto
-%if %use_fop
-BuildRequires: fop
-%else
-BuildRequires: docbook-toys
-BuildRequires: docbook-utils
-BuildRequires: texlive-courier
-BuildRequires: texlive-dvips
-BuildRequires: texlive-ec
-BuildRequires: texlive-helvetic
-BuildRequires: texlive-jadetex
-BuildRequires: texlive-times
%endif
Url: http://www.kernel.org/
Provides: %name = %version-%source_rel
@@ -75,10 +71,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: kernel-spec-macros
%description
-These are the man pages (section 9) built from the current kernel sources.
+A few basic documents from the current kernel sources.
%source_timestamp
+%if %build_pdf
%package pdf
Summary: Kernel Documentation (PDF)
Group: Documentation/Other
@@ -87,7 +84,9 @@ Group: Documentation/Other
These are PDF documents built from the current kernel sources.
%source_timestamp
+%endif
+%if %build_html
%package html
Summary: Kernel Documentation (HTML)
Group: Documentation/HTML
@@ -96,17 +95,9 @@ Group: Documentation/HTML
These are HTML documents built from the current kernel sources.
%source_timestamp
+%endif
%prep
-%if !%use_fop
-cp -av /etc/texmf/web2c/texmf.cnf .
-cat << EOF >> texmf.cnf
-main_memory.pdfjadetex = 5000000
-hash_extra.pdfjadetex = 140000
-max_strings.pdfjadetex = 240000
-save_size.pdfjadetex = 20000
-EOF
-%endif
%setup -T -c
%if %local_copy
# FIXME: need to copy locally to generate some images...
@@ -114,61 +105,29 @@ cp -a /usr/src/linux%variant/* .
%endif
%build
-%if !%use_fop
-# use texmf.cnf from local source
-export TEXMFCNF=$RPM_BUILD_DIR
-%endif
export LANG=en_US
-mkdir -p man
-make %{?make_arg} O=$PWD/man mandocs %{?jobs:-j%jobs}
+%if %build_html
mkdir -p html
make %{?make_arg} O=$PWD/html htmldocs
+%endif
+%if %build_pdf
mkdir -p pdf
-make \
-%if %use_fop
- XMLTOFLAGS="-m %linux_src/Documentation/DocBook/stylesheet.xsl --skip-validation --with-fop" \
+make %{?make_arg} O=$PWD/pdf pdfdocs
%endif
- %{?make_arg} O=$PWD/pdf pdfdocs
%install
-install -d $RPM_BUILD_ROOT/%{_mandir}/man9
-# filter out obscure device drivers - they clutter up the rpm and don't add any real value
-find man/Documentation/DocBook/ -name '*.9.gz' |
-grep -E -v 'man/(sis[69]|rio|fsl|struct_rio|RIO|mpc85|set_rx_mode|mdio_(read|write)|mii_ioctl|mca_|z8530|nand|sppp|piix|(read|write)_zs)' |
-while read i ; do
- cp $i $RPM_BUILD_ROOT/%{_mandir}/man9
-done
-if [ -d man/Documentation/kdb ] ; then
- for i in man/Documentation/kdb/*.m* ; do
- k=`basename $i`
- k=${k/man/9}
- k=${k/mm/9}
- cp $i $RPM_BUILD_ROOT/%{_mandir}/man9/$k
- done
-fi
-
-ln -s %{_mandir}/man9/request_threaded_irq.9.gz $RPM_BUILD_ROOT%{_mandir}/man9/request_irq.9.gz
+%if %build_html
+install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/rst
+cp -a html/Documentation/output/* $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/rst || true
+%endif
+%if %build_pdf
install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf
-cp -a pdf/Documentation/DocBook/*.pdf $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf || true
-%if %use_sphinx
-# copy PDF files generated by sphinx (once when it really works...)
-for i in pdf/Documentation/output/*.pdf; do
- test -s $i && cp -a $i $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf
+for i in pdf/Documentation/output/latex/*.pdf; do
+ cp -a $i $RPM_BUILD_ROOT%{_datadir}/doc/kernel/pdf
done
%endif
-install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/DocBook
-cp -a html/Documentation/DocBook/* $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/DocBook || true
-rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/DocBook/*.xml
-rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/DocBook/*.db
-rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/DocBook/*.{gif,png}
-rm -f $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/DocBook/*/*.proc
-install -d $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/rst
-%if %use_sphinx
-cp -a html/Documentation/output/* $RPM_BUILD_ROOT%{_datadir}/doc/kernel/html/rst || true
-%endif
-
%if !%local_copy
cp -a %linux_src/{COPYING,CREDITS,MAINTAINERS,README} .
%endif
@@ -176,18 +135,21 @@ cp -a %linux_src/{COPYING,CREDITS,MAINTAINERS,README} .
%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README
-%{_mandir}/man9/*
+%if %build_pdf
%files pdf
%defattr(-,root,root)
%dir %{_datadir}/doc/kernel
%docdir %{_datadir}/doc/kernel/pdf
%{_datadir}/doc/kernel/pdf
+%endif
+%if %build_html
%files html
%defattr(-,root,root)
%dir %{_datadir}/doc/kernel
%docdir %{_datadir}/doc/kernel/html
%{_datadir}/doc/kernel/html
+%endif
%changelog
diff --git a/rpm/kernel-module-subpackage b/rpm/kernel-module-subpackage
index 9be379add2..1f0e900719 100644
--- a/rpm/kernel-module-subpackage
+++ b/rpm/kernel-module-subpackage
@@ -22,10 +22,10 @@ END { print tags["summary"]
)
Provides: %{-n*}-kmp = %_this_kmp_version
Provides: %{-n*}-kmp = %{-v*}
-Provides: multiversion(kernel)
Requires: coreutils grep
%{-c:Requires: %{-n*}-ueficert}
Enhances: kernel-%1
+Supplements: packageand(kernel-%1:%{-n*})
%if "%1" == "default"
Obsoletes: %{-n*}-kmp-trace
%ifarch %ix86
diff --git a/rpm/kernel-source.spec.in b/rpm/kernel-source.spec.in
index be87e0e4e7..a383fd5993 100644
--- a/rpm/kernel-source.spec.in
+++ b/rpm/kernel-source.spec.in
@@ -66,8 +66,6 @@ Source37: README.SUSE
Source38: README.KSYMS
Source39: config-options.changes.txt
Source40: source-timestamp
-Source44: find-provides
-Source45: find-requires
Source46: split-modules
Source47: modversions
Source48: macros.kernel-source
@@ -102,12 +100,10 @@ Source103: patches.drivers.tar.bz2
Source104: patches.fixes.tar.bz2
Source105: patches.rpmify.tar.bz2
Source106: patches.suse.tar.bz2
-Source107: patches.xen.tar.bz2
Source108: patches.addon.tar.bz2
Source109: patches.kernel.org.tar.bz2
Source110: patches.apparmor.tar.bz2
Source111: patches.rt.tar.bz2
-Source112: patches.trace.tar.bz2
Source113: patches.kabi.tar.bz2
Source120: kabi.tar.bz2
Source121: sysctl.tar.bz2
diff --git a/rpm/mkspec b/rpm/mkspec
index 73f90e2e75..5a2673deb0 100755
--- a/rpm/mkspec
+++ b/rpm/mkspec
@@ -34,7 +34,7 @@ if (!defined ($rpmrelease)) {
$rpmrelease = $vars{'RELEASE'} || 0;
}
-# package name -> [summary, description]
+# package name -> [summary, description, extra kmp deps]
my %binary_descriptions = parse_descriptions();
# arch -> flavor -> [obsoleted packages]
@@ -96,20 +96,23 @@ my %macros = (
my $kmp_definitions = "";
my @kmp_definitions;
for my $kmp (@kmps) {
- my ($summary, $description);
+ my ($summary, $description, $deps);
if (!exists($binary_descriptions{$kmp})) {
print STDERR "warning: no description for $kmp found\n";
($summary = $kmp) =~ s/-kmp$//;
$summary .= " kernel modules";
$description = "$summary.";
+ $deps = "";
} else {
$summary = $binary_descriptions{$kmp}->[0];
$description = $binary_descriptions{$kmp}->[1];
+ $deps = $binary_descriptions{$kmp}->[2];
}
push(@kmp_definitions, expand_template("kmp",
KMP_NAME => $kmp,
KMP_SUMMARY => $summary,
- KMP_DESCRIPTION => $description));
+ KMP_DESCRIPTION => $description,
+ KMP_DEPS => $deps));
}
$kmp_definitions = join("\n", @kmp_definitions);
@@ -301,13 +304,15 @@ sub parse_descriptions {
if ($current) {
chomp $current->[1];
}
- $current = ["", ""];
+ $current = ["", "", ""];
$res{$package} = $current;
$state = 0;
next;
}
if (/^$/) {
- if ($state == 2) {
+ if ($state == 0) {
+ $state++;
+ } elsif ($state == 2) {
$blank .= $_;
}
next;
@@ -315,12 +320,27 @@ sub parse_descriptions {
# non-blank line and not === package ===
if ($state == 0) {
chomp;
- $current->[0] = $_;
- $state = 1;
+ if (s/^Requires: *//) {
+ # foo-kmp is a shorthand for another kmp
+ # from the same specfile
+ s/-kmp/-kmp-%build_flavor = %version-%release/g;
+ s/^/Requires: /;
+ if ($current->[2]) {
+ $current->[2] .= "\n";
+ }
+ $current->[2] .= $_;
+ } else {
+ # The Summary: keyword is optional
+ s/^Summary: *//;
+ if ($current->[0]) {
+ print STDERR "warning: multi-line summary\n";
+ }
+ $current->[0] = $_;
+ }
} elsif ($state == 1) {
$current->[1] = $_;
$blank = "";
- $state = 2;
+ $state++;
} else {
$current->[1] .= $blank;
$blank = "";
diff --git a/rpm/package-descriptions b/rpm/package-descriptions
index 793cea5330..482b6e0ab0 100644
--- a/rpm/package-descriptions
+++ b/rpm/package-descriptions
@@ -1,13 +1,15 @@
# Descriptions of the binary kernel packages. The format is
#
# === <package name> ===
-# Summary (single line)
+# Summary: Package summary (single line)
+# Requires: additional dependencies for KMPs (single line)
+# ...
#
# Long description (multiple
# lines)
#
# Descriptions of the -base and -extra subpackages are derived from the
-# main descriptions.
+# main descriptions. The "Summary:" keyword can be omitted
=== kernel-debug ===
A Debug Version of the Kernel
@@ -98,3 +100,29 @@ The Linux kernel for booting the zfcpdump process on IBM System Z.
This kernel should only be used by the s390-tools package. This kernel
should not be installed as a regular booting kernel.
+=== cluster-md-kmp ===
+Summary: Clustering support for MD devices
+Requires: dlm-kmp
+
+Clustering support for MD devices. This enables locking and
+synchronization across multiple systems on the cluster, so all
+nodes in the cluster can access the MD devices simultaneously.
+
+=== dlm-kmp ===
+DLM kernel modules
+
+DLM stands for Distributed Lock Manager, a means to synchronize access to
+shared resources over the cluster.
+
+=== gfs2-kmp ===
+Summary: GFS2 kernel modules
+Requires: dlm-kmp
+
+GFS2 is Global Filesystem, a shared device filesystem.
+
+=== ocfs2-kmp ===
+Summary: OCFS2 kernel modules
+Requires: dlm-kmp
+
+OCFS2 is the Oracle Cluster Filesystem, a filesystem for shared devices
+accessible simultaneously from multiple nodes of a cluster.
diff --git a/scripts/osc_wrapper b/scripts/osc_wrapper
index 391210d27c..20aac4969b 100755
--- a/scripts/osc_wrapper
+++ b/scripts/osc_wrapper
@@ -89,7 +89,7 @@ get_branch()
local res version sp
# First, try the local branch name
- res=$(sed -ne 's|^ref: refs/heads/||p' "$topdir/.git/HEAD" 2>/dev/null)
+ res=$(sed -ne 'y|/|:|; s|^ref: refs:heads:||p' "$topdir/.git/HEAD" 2>/dev/null)
if test -n "$res"; then
if project_exists "$kotd_namespace:$res"; then
echo "$res"
@@ -341,6 +341,15 @@ command=
spec=
topdir=$(dirname "$0")/..
+# change 'osc_wrapper --ibs upload' to 'osc_wrapper upload --ibs'
+case "$1" in
+--ibs| --obs)
+ api=$1
+ cmd=$2
+ shift 2
+ set -- "$cmd" "$api" "$@"
+esac
+
case "$1" in
build | upload)
command=$1
diff --git a/scripts/stableids b/scripts/stableids
index 0cef6a5e86..2ae2bebe8b 100755
--- a/scripts/stableids
+++ b/scripts/stableids
@@ -86,7 +86,7 @@ close GIT;
print "Written $idsfile on $machine\n";
-open GIT, "git diff $range|" ||
+open GIT, "git diff --no-renames $range|" ||
die "git diff cannot be run";
open OUT, "|ssh -C $machine 'cat >$patchfile'" ||
die "ssh didn't start";
diff --git a/scripts/stop-sync b/scripts/stop-sync
index 5f091b41c7..fdeeff0ffc 100755
--- a/scripts/stop-sync
+++ b/scripts/stop-sync
@@ -9,7 +9,7 @@ if test -z "$REPLY"; then
exit 1
fi
-(set -x; curl -d "reason=$REPLY" http://kerncvs.nue.suse.com/stop-sync.cgi)
+(set -x; curl -d "reason=$REPLY" http://kerncvs.suse.de/stop-sync.cgi)
res=$?
if test $res -ne 0; then
echo "The curl command failed. Please check your vpn config before panicking."
diff --git a/series.conf b/series.conf
index efa1c7862a..8a3254de0e 100644
--- a/series.conf
+++ b/series.conf
@@ -51,8 +51,6 @@
########################################################
patches.rpmify/firmware-path
patches.rpmify/cloneconfig.diff
- patches.rpmify/get_builtin_firmware-gcc-7.patch
- patches.rpmify/drm-i915-disable-KASAN-for-handlers.patch
########################################################
# kbuild/module infrastructure fixes
@@ -125,11 +123,6 @@
########################################################
# powerpc/generic
########################################################
- patches.arch/ppc-pegasos-console-autodetection.patch
- patches.suse/ppc-powerbook-usb-fn-key-default.patch
- patches.drivers/ppc64-adb
- patches.suse/suse-ppc64-branding
- patches.arch/ppc-prom-nodisplay.patch
########################################################
# powerpc/little endian
@@ -208,7 +201,7 @@
patches.suse/suse-hv-storvsc-sg_tablesize.patch
########################################################
- # Networking, IPv6
+ # Networking Core
########################################################
########################################################
@@ -243,17 +236,18 @@
# btrfs
########################################################
- patches.fixes/btrfs-qgroups-Retry-after-commit-on-getting-EDQUOT.patch
+ # Not upstream yet
+ patches.suse/uapi-add-a-compatibility-layer-between-linux-uio-h-and-glibc
# SUSE-specific
patches.suse/btrfs-provide-super_operations-get_inode_dev
patches.suse/btrfs-fs-super.c-add-new-super-block-devices-super_block_d.patch
patches.suse/btrfs-btrfs-use-the-new-VFS-super_block_dev.patch
+ patches.suse/btrfs-8447-serialize-subvolume-mounts-with-potentially-mi.patch
########################################################
# Reiserfs Patches
########################################################
- patches.fixes/reiserfs-fix-race-in-prealloc-discard.patch
########################################################
# dlm
@@ -276,7 +270,7 @@
########################################################
patches.drivers/pstore_disable_efi_backend_by_default.patch
- patches.suse/pstore-backend-autoaction
++duwe patches.suse/pstore-backend-autoaction
########################################################
# Overlayfs
@@ -297,7 +291,6 @@
########################################################
# Block layer fixes
- patches.fixes/block-copy-bi_vcnt-in-_bio_clone_fast
patches.suse/scsi-netlink-ml
patches.fixes/scsi-retry-alua-transition-in-progress
@@ -313,12 +306,13 @@
# bnc#362850
patches.fixes/sd_liberal_28_sense_invalid.diff
- patches.fixes/scsi-ibmvscsi-module_alias.patch
+ # CVE-2017-14051
+ patches.drivers/scsi-qla2xxx-Fix-an-integer-overflow-in-sysfs-code.patch
########################################################
# DRM/Video
########################################################
- patches.fixes/drm-i915-Fix-S4-resume-breakage
++jdelvare patches.fixes/drm-amdgpu-revert-update-tile-table-for-oland-hainan.patch
########################################################
# video4linux
@@ -331,6 +325,7 @@
########################################################
# Wireless Networking
########################################################
+ patches.drivers/rt2800-fix-TX_PIN_CFG-setting-for-non-MT7620-chips
patches.suse/b43-missing-firmware-info.patch
patches.suse/iwlwifi-expose-default-fallback-ucode-api
@@ -358,48 +353,18 @@
########################################################
# I2C
########################################################
- patches.drivers/001-x86-platform-intel-iosf_mbi-Add-a-mutex-for-P-Unit-a
- patches.drivers/002-x86-platform-intel-iosf_mbi-Add-a-PMIC-bus-access-no
- patches.drivers/003-i2c-designware-Rename-accessor_flags-to-flags
- patches.drivers/004-i2c-designware-baytrail-Pass-dw_i2c_dev-into-helper-
- patches.drivers/005-i2c-designware-baytrail-Only-check-iosf_mbi_availabl
- patches.drivers/006-i2c-designware-baytrail-Disallow-the-CPU-to-enter-C6
- patches.drivers/007-i2c-designware-baytrail-Fix-race-when-resetting-the-
- patches.drivers/008-i2c-designware-baytrail-Add-support-for-cherrytrail
- patches.drivers/009-i2c-designware-baytrail-Acquire-P-Unit-access-on-bus
- patches.drivers/010-i2c-designware-baytrail-Call-pmic_bus_access_notifie
- patches.drivers/011-drm-i915-Add-intel_uncore_suspend-resume-functions
- patches.drivers/012-drm-i915-Listen-for-PMIC-bus-access-notifications
- patches.drivers/013-i2c-designware-increase-timeout-of-semaphore-transfe
- patches.drivers/014-i2c-designware-Never-suspend-i2c-busses-used-for-acc
- patches.drivers/015-i2c-designware-Disable-pm-for-PMIC-i2c-bus-even-if-t
- patches.drivers/016-i2c-designware-Get-selected-speed-mode-sda-hold-time
- patches.drivers/017-i2c-designware-baytrail-fix-potential-null-pointer-d
########################################################
# Input & Console
########################################################
# patches.suse/SUSE-bootsplash
# patches.suse/SUSE-bootsplash-mgadrmfb-workaround
- patches.drivers/HID-asus-drop-dependency-on-I2C_HID
- patches.drivers/HID-asus-support-Republic-of-Gamers-special-keys
- patches.drivers/HID-asus-fix-and-generalize-ambiguous-preprocessor-m
- patches.drivers/HID-asus-ignore-declared-dummy-usages
- patches.drivers/HID-asus-change-mapping-from-KEY_WLAN-to-KEY_RFKILL
-
- patches.drivers/Input-axp20x-pek-use-our-own-device-for-errors
- patches.drivers/Input-axp20x_pek-add-axp20x_pek_probe_input_device-h
- patches.drivers/Input-axp20x-pek-do-not-register-input-device-on-som
-
- patches.drivers/Input-soc_button_array-use-NULL-for-GPIO-connection
- patches.drivers/Input-soc_button_array-Propagate-error-from-gpiod_co
- patches.drivers/Input-soc_button_array-get-rid-of-MAX_NBUTTONS
- patches.drivers/Input-soc_button_array-add-support-for-ACPI-6.0-Gene
- patches.drivers/Input-soc_button_array-properly-map-usage-0x07-0xe3
##########################################################
# Sound
##########################################################
+ patches.drivers/ALSA-hda-Implement-mic-mute-LED-mode-enum
+ patches.drivers/ALSA-ice1712-Add-support-for-STAudio-ADCIII
########################################################
# Char / serial
@@ -411,7 +376,6 @@
# Needs updating WRT d27769ec (block: add GENHD_FL_NO_PART_SCAN)
+hare patches.suse/no-partition-scan
- patches.drivers/dell-laptop-Adds-support-for-keyboard-backlight-timeout
########################################################
# Other drivers we have added to the tree
@@ -450,7 +414,6 @@
##########################################################
patches.apparmor/apparmor-basic-networking-rules.patch
- patches.apparmor/apparmor-basic-networking-rules-4.11-rc1.patch
patches.apparmor/apparmor-fix-quieting-of-audit-messages-for-network-mediation.patch
########################################################
@@ -465,11 +428,27 @@
# Other patches for debugging
########################################################
patches.suse/crasher.patch
- patches.suse/0001-linkage-new-macros-for-assembler-symbols.patch
+
+ # pending
+ patches.suse/0001-x86-entry-64-Refactor-IRQ-stacks-and-make-them-NMI-s.patch
+ patches.suse/0002-x86-entry-64-Initialize-the-top-of-the-IRQ-stack-bef.patch
+
+ patches.suse/0003-x86-dumpstack-Fix-occasionally-missing-registers.patch
+ patches.suse/0004-x86-dumpstack-Fix-interrupt-and-exception-stack-boun.patch
+ patches.suse/0005-objtool-Add-ORC-unwind-table-generation.patch
+ patches.suse/0006-objtool-x86-Add-facility-for-asm-code-to-provide-unw.patch
+ patches.suse/0007-x86-entry-64-Add-unwind-hint-annotations.patch
+ patches.suse/0008-x86-asm-Add-unwind-hint-annotations-to-sync_core.patch
+
+
+ patches.suse/0001-x86-unwind-Add-the-ORC-unwinder.patch
+ patches.suse/0002-x86-kconfig-Make-it-easier-to-switch-to-the-new-ORC-.patch
+ patches.suse/0003-x86-kconfig-Consolidate-unwinders-into-multiple-choi.patch
+
++dwarf patches.suse/0001-linkage-new-macros-for-assembler-symbols.patch
patches.suse/0002-dwarf-do-not-throw-away-unwind-info.patch
- patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
- patches.suse/stack-unwind-disable-kasan.patch
-+needs_updating patches.arch/x86_64-unwind-annotations
++dwarf patches.suse/0003-DWARF-EH-frame-based-stack-unwinding.patch
++dwarf patches.suse/stack-unwind-disable-kasan.patch
########################################################
# Kdump
diff --git a/supported.conf b/supported.conf
index 7663383c0e..f4f1656793 100644
--- a/supported.conf
+++ b/supported.conf
@@ -1907,7 +1907,7 @@
fs/binfmt_misc
fs/btrfs/btrfs
fs/cachefiles/cachefiles # CacheFiles caching backend
-+external fs/cifs/cifs # VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows; supported by IBM
+ fs/cifs/cifs # VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
- fs/coda/coda
fs/configfs/configfs
fs/cramfs/cramfs
@@ -2011,7 +2011,7 @@
fs/quota_v1 # Old quota format support
fs/quota_v2 # Quota format v2 support
fs/quota_tree
- fs/reiserfs/reiserfs # ReiserFS journaled filesystem
+- fs/reiserfs/reiserfs # ReiserFS journaled filesystem
fs/romfs/romfs
fs/squashfs/squashfs
fs/sysv/sysv