2db8df8
 Kconfig                                            |   2 +
ea07b7a
 Kconfig.redhat                                     |  17 +++
5ab16d2
 Makefile                                           |  12 +-
2db8df8
 arch/arm/Kconfig                                   |   4 +-
2db8df8
 arch/arm64/Kconfig                                 |   3 +-
2db8df8
 arch/s390/include/asm/ipl.h                        |   1 +
2db8df8
 arch/s390/kernel/ipl.c                             |   5 +
2db8df8
 arch/s390/kernel/setup.c                           |   4 +
ea07b7a
 arch/x86/kernel/setup.c                            |  22 ++--
ea07b7a
 crypto/rng.c                                       |  73 +++++++++++-
ea07b7a
 drivers/acpi/apei/hest.c                           |   8 ++
ea07b7a
 drivers/acpi/irq.c                                 |  17 ++-
ea07b7a
 drivers/acpi/scan.c                                |   9 ++
ea07b7a
 drivers/ata/libahci.c                              |  18 +++
ea07b7a
 drivers/char/ipmi/ipmi_dmi.c                       |  15 +++
ea07b7a
 drivers/char/ipmi/ipmi_msghandler.c                |  16 ++-
ea07b7a
 drivers/char/random.c                              | 115 +++++++++++++++++++
2db8df8
 drivers/firmware/efi/Makefile                      |   1 +
ea07b7a
 drivers/firmware/efi/efi.c                         | 124 +++++++++++++++------
ea07b7a
 drivers/firmware/efi/secureboot.c                  |  38 +++++++
ea07b7a
 drivers/hid/hid-rmi.c                              |  64 -----------
ea07b7a
 drivers/hwtracing/coresight/coresight-etm4x-core.c |  19 ++++
ea07b7a
 drivers/input/rmi4/rmi_driver.c                    | 124 ++++++++++++---------
ea07b7a
 drivers/iommu/iommu.c                              |  22 ++++
ea07b7a
 drivers/nvme/host/core.c                           |  22 +++-
ea07b7a
 drivers/nvme/host/multipath.c                      |  19 ++--
a1e0664
 drivers/nvme/host/nvme.h                           |   4 +
ea07b7a
 drivers/pci/msi/msi.c                              |  12 +-
ea07b7a
 drivers/pci/quirks.c                               |  24 ++++
ea07b7a
 drivers/usb/core/hub.c                             |   7 ++
ea07b7a
 include/linux/efi.h                                |  22 ++--
2db8df8
 include/linux/lsm_hook_defs.h                      |   2 +
2db8df8
 include/linux/lsm_hooks.h                          |   6 +
6eb15e4
 include/linux/mmzone.h                             |   4 +-
2db8df8
 include/linux/module.h                             |   1 +
ea07b7a
 include/linux/random.h                             |   7 ++
2db8df8
 include/linux/rmi.h                                |   1 +
2db8df8
 include/linux/security.h                           |   5 +
4bc3c54
 init/Kconfig                                       |   2 +-
2db8df8
 kernel/module.c                                    |   2 +
2db8df8
 kernel/module_signing.c                            |   9 +-
ea07b7a
 scripts/mod/modpost.c                              |   8 ++
2db8df8
 scripts/tags.sh                                    |   2 +
2db8df8
 security/integrity/platform_certs/load_uefi.c      |   6 +-
ea07b7a
 security/lockdown/Kconfig                          |  13 +++
2db8df8
 security/lockdown/lockdown.c                       |   1 +
2db8df8
 security/security.c                                |   6 +
6eb15e4
 47 files changed, 719 insertions(+), 199 deletions(-)
ea07b7a
f7a55ba
diff --git a/Kconfig b/Kconfig
f7a55ba
index 745bc773f567..f57ff40109d7 100644
f7a55ba
--- a/Kconfig
f7a55ba
+++ b/Kconfig
f7a55ba
@@ -30,3 +30,5 @@ source "lib/Kconfig"
f7a55ba
 source "lib/Kconfig.debug"
00b08d5
f7a55ba
 source "Documentation/Kconfig"
f7a55ba
+
f7a55ba
+source "Kconfig.redhat"
f7a55ba
diff --git a/Kconfig.redhat b/Kconfig.redhat
f7a55ba
new file mode 100644
ea07b7a
index 000000000000..733a26bd887a
f7a55ba
--- /dev/null
f7a55ba
+++ b/Kconfig.redhat
f7a55ba
@@ -0,0 +1,17 @@
f7a55ba
+# SPDX-License-Identifier: GPL-2.0-only
f7a55ba
+#
f7a55ba
+# Red Hat specific options
f7a55ba
+#
f7a55ba
+
f7a55ba
+menu "Red Hat options"
f7a55ba
+
ea07b7a
+config RH_DISABLE_DEPRECATED
f7a55ba
+	bool "Remove support for deprecated features"
f7a55ba
+	help
f7a55ba
+	  Red Hat may choose to deprecate certain features in its kernels.
f7a55ba
+	  Enable this option to remove support for hardware that is no
f7a55ba
+	  longer supported.
f7a55ba
+
f7a55ba
+	  Unless you want a restricted kernel, say N here.
f7a55ba
+
f7a55ba
+endmenu
f7a55ba
diff --git a/Makefile b/Makefile
ea07b7a
index 7214f075e1f0..6ecb3acb605c 100644
f7a55ba
--- a/Makefile
f7a55ba
+++ b/Makefile
f7a55ba
@@ -18,6 +18,10 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
f7a55ba
 PHONY := __all
f7a55ba
 __all:
00b08d5
f7a55ba
+# Set RHEL variables
f7a55ba
+# Use this spot to avoid future merge conflicts
f7a55ba
+include Makefile.rhelver
f7a55ba
+
f7a55ba
 # We are using a recursive build, so we need to do a little thinking
f7a55ba
 # to get the ordering right.
f7a55ba
 #
8ec17e1
@@ -1235,7 +1239,13 @@ define filechk_version.h
7fe2672
 	((c) > 255 ? 255 : (c)))';                                       \
7fe2672
 	echo \#define LINUX_VERSION_MAJOR $(VERSION);                    \
7fe2672
 	echo \#define LINUX_VERSION_PATCHLEVEL $(PATCHLEVEL);            \
7fe2672
-	echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL)
51aea15
+	echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL);                \
f7a55ba
+	echo '#define RHEL_MAJOR $(RHEL_MAJOR)'; \
f7a55ba
+	echo '#define RHEL_MINOR $(RHEL_MINOR)'; \
f7a55ba
+	echo '#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))'; \
f7a55ba
+	echo '#define RHEL_RELEASE_CODE \
f7a55ba
+		$(shell expr $(RHEL_MAJOR) \* 256 + $(RHEL_MINOR))'; \
f7a55ba
+	echo '#define RHEL_RELEASE "$(RHEL_RELEASE)"'
f7a55ba
 endef
00b08d5
7fe2672
 $(version_h): PATCHLEVEL := $(if $(PATCHLEVEL), $(PATCHLEVEL), 0)
f7a55ba
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
f760a27
index 4c97cb40eebb..caf06cef3d2e 100644
f7a55ba
--- a/arch/arm/Kconfig
f7a55ba
+++ b/arch/arm/Kconfig
f760a27
@@ -1479,9 +1479,9 @@ config HIGHMEM
f7a55ba
 	  If unsure, say n.
00b08d5
f7a55ba
 config HIGHPTE
f7a55ba
-	bool "Allocate 2nd-level pagetables from highmem" if EXPERT
f7a55ba
+	bool "Allocate 2nd-level pagetables from highmem"
f7a55ba
 	depends on HIGHMEM
f7a55ba
-	default y
f7a55ba
+	default n
f7a55ba
 	help
f7a55ba
 	  The VM uses one page of physical memory for each page table.
f7a55ba
 	  For systems with a lot of processes, this can use a lot of
f7a55ba
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
24dda0d
index c842878f8133..72949bfbe1af 100644
f7a55ba
--- a/arch/arm64/Kconfig
f7a55ba
+++ b/arch/arm64/Kconfig
d093b9f
@@ -1109,7 +1109,7 @@ endchoice
00b08d5
f7a55ba
 config ARM64_FORCE_52BIT
f7a55ba
 	bool "Force 52-bit virtual addresses for userspace"
f7a55ba
-	depends on ARM64_VA_BITS_52 && EXPERT
f7a55ba
+	depends on ARM64_VA_BITS_52
f7a55ba
 	help
f7a55ba
 	  For systems with 52-bit userspace VAs enabled, the kernel will attempt
f7a55ba
 	  to maintain compatibility with older software by providing 48-bit VAs
24dda0d
@@ -1348,6 +1348,7 @@ config XEN
f7a55ba
 config FORCE_MAX_ZONEORDER
f7a55ba
 	int
613e26b
 	default "14" if ARM64_64K_PAGES
9e5bb46
+	default "13" if (ARCH_THUNDER && !ARM64_64K_PAGES)
613e26b
 	default "12" if ARM64_16K_PAGES
f7a55ba
 	default "11"
f7a55ba
 	help
f7a55ba
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
4c511b9
index 3f8ee257f9aa..3ab92feb6241 100644
f7a55ba
--- a/arch/s390/include/asm/ipl.h
f7a55ba
+++ b/arch/s390/include/asm/ipl.h
4c511b9
@@ -128,6 +128,7 @@ int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
f7a55ba
 			     unsigned char flags, unsigned short cert);
f7a55ba
 int ipl_report_add_certificate(struct ipl_report *report, void *key,
f7a55ba
 			       unsigned long addr, unsigned long len);
f7a55ba
+bool ipl_get_secureboot(void);
00b08d5
f7a55ba
 /*
f7a55ba
  * DIAG 308 support
f7a55ba
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
2b9339a
index 5ad1dde23dc5..b6192d58eed3 100644
f7a55ba
--- a/arch/s390/kernel/ipl.c
f7a55ba
+++ b/arch/s390/kernel/ipl.c
2b9339a
@@ -2216,3 +2216,8 @@ int ipl_report_free(struct ipl_report *report)
f7a55ba
 }
00b08d5
f7a55ba
 #endif
f7a55ba
+
f7a55ba
+bool ipl_get_secureboot(void)
f7a55ba
+{
f7a55ba
+	return !!ipl_secure_flag;
f7a55ba
+}
f7a55ba
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
595bb02
index 05327be3a982..c473e5ca67f1 100644
f7a55ba
--- a/arch/s390/kernel/setup.c
f7a55ba
+++ b/arch/s390/kernel/setup.c
f7a55ba
@@ -49,6 +49,7 @@
f7a55ba
 #include <linux/memory.h>
f7a55ba
 #include <linux/compat.h>
f7a55ba
 #include <linux/start_kernel.h>
f7a55ba
+#include <linux/security.h>
1469491
 #include <linux/hugetlb.h>
843ad10
 #include <linux/kmemleak.h>
00b08d5
595bb02
@@ -965,6 +966,9 @@ void __init setup_arch(char **cmdline_p)
00b08d5
f7a55ba
 	log_component_list();
00b08d5
f7a55ba
+	if (ipl_get_secureboot())
f7a55ba
+		security_lock_kernel_down("Secure IPL mode", LOCKDOWN_INTEGRITY_MAX);
f7a55ba
+
f7a55ba
 	/* Have one command line that is parsed and saved in /proc/cmdline */
f7a55ba
 	/* boot_command_line has been already set up in early.c */
f7a55ba
 	*cmdline_p = boot_command_line;
f7a55ba
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
ea07b7a
index 90d7e1788c91..262198c48162 100644
f7a55ba
--- a/arch/x86/kernel/setup.c
f7a55ba
+++ b/arch/x86/kernel/setup.c
982fdc5
@@ -20,6 +20,7 @@
7fe2672
 #include <linux/root_dev.h>
f7a55ba
 #include <linux/hugetlb.h>
f7a55ba
 #include <linux/tboot.h>
f7a55ba
+#include <linux/security.h>
f7a55ba
 #include <linux/usb/xhci-dbgp.h>
bcd1246
 #include <linux/static_call.h>
6eef319
 #include <linux/swiotlb.h>
ea07b7a
@@ -950,6 +951,13 @@ void __init setup_arch(char **cmdline_p)
f7a55ba
 	if (efi_enabled(EFI_BOOT))
f7a55ba
 		efi_init();
00b08d5
f7a55ba
+	efi_set_secure_boot(boot_params.secure_boot);
f7a55ba
+
f7a55ba
+#ifdef CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT
f7a55ba
+	if (efi_enabled(EFI_SECURE_BOOT))
f7a55ba
+		security_lock_kernel_down("EFI Secure Boot mode", LOCKDOWN_INTEGRITY_MAX);
f7a55ba
+#endif
f7a55ba
+
f7a55ba
 	dmi_setup();
00b08d5
f7a55ba
 	/*
ea07b7a
@@ -1119,19 +1127,7 @@ void __init setup_arch(char **cmdline_p)
f7a55ba
 	/* Allocate bigger log buffer */
f7a55ba
 	setup_log_buf(1);
00b08d5
f7a55ba
-	if (efi_enabled(EFI_BOOT)) {
f7a55ba
-		switch (boot_params.secure_boot) {
f7a55ba
-		case efi_secureboot_mode_disabled:
f7a55ba
-			pr_info("Secure boot disabled\n");
f7a55ba
-			break;
f7a55ba
-		case efi_secureboot_mode_enabled:
f7a55ba
-			pr_info("Secure boot enabled\n");
f7a55ba
-			break;
f7a55ba
-		default:
f7a55ba
-			pr_info("Secure boot could not be determined\n");
f7a55ba
-			break;
f7a55ba
-		}
f7a55ba
-	}
f7a55ba
+	efi_set_secure_boot(boot_params.secure_boot);
00b08d5
f7a55ba
 	reserve_initrd();
00b08d5
6d4d829
diff --git a/crypto/rng.c b/crypto/rng.c
6d4d829
index fea082b25fe4..50a9d040bed1 100644
6d4d829
--- a/crypto/rng.c
6d4d829
+++ b/crypto/rng.c
6d4d829
@@ -11,14 +11,17 @@
6d4d829
 #include <linux/atomic.h>
6d4d829
 #include <crypto/internal/rng.h>
6d4d829
 #include <linux/err.h>
6d4d829
+#include <linux/fips.h>
6d4d829
+#include <linux/kernel.h>
6d4d829
 #include <linux/module.h>
6d4d829
 #include <linux/mutex.h>
6d4d829
 #include <linux/random.h>
6d4d829
 #include <linux/seq_file.h>
6d4d829
+#include <linux/sched.h>
6d4d829
+#include <linux/sched/signal.h>
6d4d829
 #include <linux/slab.h>
6d4d829
 #include <linux/string.h>
6d4d829
 #include <linux/cryptouser.h>
6d4d829
-#include <linux/compiler.h>
6d4d829
 #include <net/netlink.h>
6d4d829
6d4d829
 #include "internal.h"
6d4d829
@@ -224,5 +227,73 @@ void crypto_unregister_rngs(struct rng_alg *algs, int count)
6d4d829
 }
6d4d829
 EXPORT_SYMBOL_GPL(crypto_unregister_rngs);
6d4d829
6d4d829
+static ssize_t crypto_devrandom_read(void __user *buf, size_t buflen)
6d4d829
+{
6d4d829
+	u8 tmp[256];
6d4d829
+	ssize_t ret;
6d4d829
+
6d4d829
+	if (!buflen)
6d4d829
+		return 0;
6d4d829
+
6d4d829
+	ret = crypto_get_default_rng();
6d4d829
+	if (ret)
6d4d829
+		return ret;
6d4d829
+
6d4d829
+	for (;;) {
6d4d829
+		int err;
6d4d829
+		int i;
6d4d829
+
6d4d829
+		i = min_t(int, buflen, sizeof(tmp));
6d4d829
+		err = crypto_rng_get_bytes(crypto_default_rng, tmp, i);
6d4d829
+		if (err) {
6d4d829
+			ret = err;
6d4d829
+			break;
6d4d829
+		}
6d4d829
+
6d4d829
+		if (copy_to_user(buf, tmp, i)) {
6d4d829
+			ret = -EFAULT;
6d4d829
+			break;
6d4d829
+		}
6d4d829
+
6d4d829
+		buflen -= i;
6d4d829
+		buf += i;
6d4d829
+		ret += i;
6d4d829
+
6d4d829
+		if (!buflen)
6d4d829
+			break;
6d4d829
+
6d4d829
+		if (need_resched()) {
6d4d829
+			if (signal_pending(current))
6d4d829
+				break;
6d4d829
+			schedule();
6d4d829
+		}
6d4d829
+	}
6d4d829
+
6d4d829
+	crypto_put_default_rng();
6d4d829
+	memzero_explicit(tmp, sizeof(tmp));
6d4d829
+
6d4d829
+	return ret;
6d4d829
+}
6d4d829
+
6d4d829
+static const struct random_extrng crypto_devrandom_rng = {
6d4d829
+	.extrng_read = crypto_devrandom_read,
6d4d829
+	.owner = THIS_MODULE,
6d4d829
+};
6d4d829
+
6d4d829
+static int __init crypto_rng_init(void)
6d4d829
+{
6d4d829
+	if (fips_enabled)
6d4d829
+		random_register_extrng(&crypto_devrandom_rng);
6d4d829
+	return 0;
6d4d829
+}
6d4d829
+
6d4d829
+static void __exit crypto_rng_exit(void)
6d4d829
+{
6d4d829
+	random_unregister_extrng();
6d4d829
+}
6d4d829
+
6d4d829
+late_initcall(crypto_rng_init);
6d4d829
+module_exit(crypto_rng_exit);
6d4d829
+
6d4d829
 MODULE_LICENSE("GPL");
6d4d829
 MODULE_DESCRIPTION("Random Number Generator");
f7a55ba
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
3b059cf
index 0edc1ed47673..782e2f399af2 100644
f7a55ba
--- a/drivers/acpi/apei/hest.c
f7a55ba
+++ b/drivers/acpi/apei/hest.c
3b059cf
@@ -96,6 +96,14 @@ static int apei_hest_parse(apei_hest_func_t func, void *data)
f7a55ba
 	if (hest_disable || !hest_tab)
f7a55ba
 		return -EINVAL;
00b08d5
f7a55ba
+#ifdef CONFIG_ARM64
f7a55ba
+	/* Ignore broken firmware */
f7a55ba
+	if (!strncmp(hest_tab->header.oem_id, "HPE   ", 6) &&
f7a55ba
+	    !strncmp(hest_tab->header.oem_table_id, "ProLiant", 8) &&
f7a55ba
+	    MIDR_IMPLEMENTOR(read_cpuid_id()) == ARM_CPU_IMP_APM)
f7a55ba
+		return -EINVAL;
f7a55ba
+#endif
f7a55ba
+
f7a55ba
 	hest_hdr = (struct acpi_hest_header *)(hest_tab + 1);
f7a55ba
 	for (i = 0; i < hest_tab->error_source_count; i++) {
f7a55ba
 		len = hest_esrc_len(hest_hdr);
f7a55ba
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
1cac231
index c68e694fca26..146cba5ae5bc 100644
f7a55ba
--- a/drivers/acpi/irq.c
f7a55ba
+++ b/drivers/acpi/irq.c
1cac231
@@ -130,6 +130,7 @@ struct acpi_irq_parse_one_ctx {
f7a55ba
 	unsigned int index;
f7a55ba
 	unsigned long *res_flags;
f7a55ba
 	struct irq_fwspec *fwspec;
f7a55ba
+	bool skip_producer_check;
f7a55ba
 };
00b08d5
f7a55ba
 /**
1cac231
@@ -201,7 +202,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
f7a55ba
 		return AE_CTRL_TERMINATE;
f7a55ba
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
f7a55ba
 		eirq = &ares->data.extended_irq;
f7a55ba
-		if (eirq->producer_consumer == ACPI_PRODUCER)
f7a55ba
+		if (!ctx->skip_producer_check &&
f7a55ba
+		    eirq->producer_consumer == ACPI_PRODUCER)
f7a55ba
 			return AE_OK;
f7a55ba
 		if (ctx->index >= eirq->interrupt_count) {
f7a55ba
 			ctx->index -= eirq->interrupt_count;
1cac231
@@ -236,8 +238,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
f7a55ba
 static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
f7a55ba
 			      struct irq_fwspec *fwspec, unsigned long *flags)
f7a55ba
 {
f7a55ba
-	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
f7a55ba
+	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
00b08d5
f7a55ba
+	/*
f7a55ba
+	 * Firmware on arm64-based HPE m400 platform incorrectly marks
f7a55ba
+	 * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
f7a55ba
+	 * Don't do the producer/consumer check for that device.
f7a55ba
+	 */
f7a55ba
+	if (IS_ENABLED(CONFIG_ARM64)) {
f7a55ba
+		struct acpi_device *adev = acpi_bus_get_acpi_device(handle);
f7a55ba
+
f7a55ba
+		if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
f7a55ba
+			ctx.skip_producer_check = true;
f7a55ba
+	}
f7a55ba
 	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx;;
f7a55ba
 	return ctx.rc;
f7a55ba
 }
f7a55ba
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
ea07b7a
index 8b2e5ef15559..ac0291ef0838 100644
f7a55ba
--- a/drivers/acpi/scan.c
f7a55ba
+++ b/drivers/acpi/scan.c
8ec17e1
@@ -1769,6 +1769,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
5245d1d
 	if (!acpi_match_device_ids(device, ignore_serial_bus_ids))
f7a55ba
 		return false;
00b08d5
f7a55ba
+	/*
f7a55ba
+	 * Firmware on some arm64 X-Gene platforms will make the UART
f7a55ba
+	 * device appear as both a UART and a slave of that UART. Just
f7a55ba
+	 * bail out here for X-Gene UARTs.
f7a55ba
+	 */
f7a55ba
+	if (IS_ENABLED(CONFIG_ARM64) &&
f7a55ba
+	    !strcmp(acpi_device_hid(device), "APMC0D08"))
f7a55ba
+		return false;
f7a55ba
+
f7a55ba
 	INIT_LIST_HEAD(&resource_list);
f7a55ba
 	acpi_dev_get_resources(device, &resource_list,
f7a55ba
 			       acpi_check_serial_bus_slave,
f7a55ba
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
dcddcf3
index 0ed484e04fd6..a2e486bd14ef 100644
f7a55ba
--- a/drivers/ata/libahci.c
f7a55ba
+++ b/drivers/ata/libahci.c
c008d74
@@ -690,6 +690,24 @@ int ahci_stop_engine(struct ata_port *ap)
f7a55ba
 	tmp &= ~PORT_CMD_START;
f7a55ba
 	writel(tmp, port_mmio + PORT_CMD);
00b08d5
f7a55ba
+#ifdef CONFIG_ARM64
f7a55ba
+	/* Rev Ax of Cavium CN99XX needs a hack for port stop */
f7a55ba
+	if (dev_is_pci(ap->host->dev) &&
f7a55ba
+	    to_pci_dev(ap->host->dev)->vendor == 0x14e4 &&
f7a55ba
+	    to_pci_dev(ap->host->dev)->device == 0x9027 &&
f7a55ba
+	    midr_is_cpu_model_range(read_cpuid_id(),
f7a55ba
+			MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN),
f7a55ba
+			MIDR_CPU_VAR_REV(0, 0),
f7a55ba
+			MIDR_CPU_VAR_REV(0, MIDR_REVISION_MASK))) {
f7a55ba
+		tmp = readl(hpriv->mmio + 0x8000);
f7a55ba
+		udelay(100);
f7a55ba
+		writel(tmp | (1 << 26), hpriv->mmio + 0x8000);
f7a55ba
+		udelay(100);
f7a55ba
+		writel(tmp & ~(1 << 26), hpriv->mmio + 0x8000);
f7a55ba
+		dev_warn(ap->host->dev, "CN99XX SATA reset workaround applied\n");
f7a55ba
+	}
f7a55ba
+#endif
f7a55ba
+
f7a55ba
 	/* wait for engine to stop. This could be as long as 500 msec */
f7a55ba
 	tmp = ata_wait_register(ap, port_mmio + PORT_CMD,
f7a55ba
 				PORT_CMD_LIST_ON, PORT_CMD_LIST_ON, 1, 500);
f7a55ba
diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c
f7a55ba
index bbf7029e224b..cf7faa970dd6 100644
f7a55ba
--- a/drivers/char/ipmi/ipmi_dmi.c
f7a55ba
+++ b/drivers/char/ipmi/ipmi_dmi.c
f7a55ba
@@ -215,6 +215,21 @@ static int __init scan_for_dmi_ipmi(void)
f7a55ba
 {
f7a55ba
 	const struct dmi_device *dev = NULL;
00b08d5
f7a55ba
+#ifdef CONFIG_ARM64
f7a55ba
+	/* RHEL-only
f7a55ba
+	 * If this is ARM-based HPE m400, return now, because that platform
f7a55ba
+	 * reports the host-side ipmi address as intel port-io space, which
f7a55ba
+	 * does not exist in the ARM architecture.
f7a55ba
+	 */
f7a55ba
+	const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
f7a55ba
+
f7a55ba
+	if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
f7a55ba
+		pr_debug("%s does not support host ipmi\n", dmistr);
f7a55ba
+		return 0;
f7a55ba
+	}
f7a55ba
+	/* END RHEL-only */
f7a55ba
+#endif
f7a55ba
+
f7a55ba
 	while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev)))
f7a55ba
 		dmi_decode_ipmi((const struct dmi_header *) dev->device_data);
00b08d5
f7a55ba
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
d8b7392
index c59265146e9c..caa8458edde2 100644
f7a55ba
--- a/drivers/char/ipmi/ipmi_msghandler.c
f7a55ba
+++ b/drivers/char/ipmi/ipmi_msghandler.c
f8ba902
@@ -35,6 +35,7 @@
f7a55ba
 #include <linux/uuid.h>
f7a55ba
 #include <linux/nospec.h>
f7a55ba
 #include <linux/vmalloc.h>
f7a55ba
+#include <linux/dmi.h>
6eef319
 #include <linux/delay.h>
00b08d5
f7a55ba
 #define IPMI_DRIVER_VERSION "39.2"
d8b7392
@@ -5422,8 +5423,21 @@ static int __init ipmi_init_msghandler_mod(void)
f7a55ba
 {
f7a55ba
 	int rv;
00b08d5
f7a55ba
-	pr_info("version " IPMI_DRIVER_VERSION "\n");
f7a55ba
+#ifdef CONFIG_ARM64
f7a55ba
+	/* RHEL-only
f7a55ba
+	 * If this is ARM-based HPE m400, return now, because that platform
f7a55ba
+	 * reports the host-side ipmi address as intel port-io space, which
f7a55ba
+	 * does not exist in the ARM architecture.
f7a55ba
+	 */
f7a55ba
+	const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
00b08d5
f7a55ba
+	if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
f7a55ba
+		pr_debug("%s does not support host ipmi\n", dmistr);
f7a55ba
+		return -ENOSYS;
f7a55ba
+	}
f7a55ba
+	/* END RHEL-only */
f7a55ba
+#endif
f7a55ba
+	pr_info("version " IPMI_DRIVER_VERSION "\n");
f7a55ba
 	mutex_lock(&ipmi_interfaces_mutex);
f7a55ba
 	rv = ipmi_register_driver();
f7a55ba
 	mutex_unlock(&ipmi_interfaces_mutex);
6d4d829
diff --git a/drivers/char/random.c b/drivers/char/random.c
41fdcbd
index 3404a91edf29..184dbb94710c 100644
6d4d829
--- a/drivers/char/random.c
6d4d829
+++ b/drivers/char/random.c
46931d9
@@ -344,6 +344,7 @@
6d4d829
 #include <linux/syscalls.h>
6d4d829
 #include <linux/completion.h>
6d4d829
 #include <linux/uuid.h>
6d4d829
+#include <linux/rcupdate.h>
6d4d829
 #include <crypto/chacha.h>
5245d1d
 #include <crypto/blake2s.h>
6d4d829
51c8114
@@ -358,6 +359,11 @@
6d4d829
6d4d829
 /* #define ADD_INTERRUPT_BENCH */
6d4d829
6d4d829
+/*
6d4d829
+ * Hook for external RNG.
6d4d829
+ */
6d4d829
+static const struct random_extrng __rcu *extrng;
6d4d829
+
6d4d829
 /*
46931d9
  * If the entropy count falls under this number of bits, then we
46931d9
  * should wake up processes which are selecting or polling on write
51c8114
@@ -486,6 +492,9 @@ static int ratelimit_disable __read_mostly;
6d4d829
 module_param_named(ratelimit_disable, ratelimit_disable, int, 0644);
6d4d829
 MODULE_PARM_DESC(ratelimit_disable, "Disable random ratelimit suppression");
6d4d829
6d4d829
+static const struct file_operations extrng_random_fops;
6d4d829
+static const struct file_operations extrng_urandom_fops;
6d4d829
+
6d4d829
 /**********************************************************************
6d4d829
  *
6d4d829
  * OS independent entropy store.   Here are the functions which handle
51c8114
@@ -1775,6 +1784,13 @@ static __poll_t random_poll(struct file *file, poll_table *wait)
6d4d829
 	return mask;
6d4d829
 }
6d4d829
6d4d829
+static __poll_t
6d4d829
+extrng_poll(struct file *file, poll_table * wait)
6d4d829
+{
6d4d829
+	/* extrng pool is always full, always read, no writes */
6d4d829
+	return EPOLLIN | EPOLLRDNORM;
6d4d829
+}
6d4d829
+
46931d9
 static int write_pool(const char __user *buffer, size_t count)
6d4d829
 {
46931d9
 	size_t bytes;
41fdcbd
@@ -1879,7 +1895,58 @@ static int random_fasync(int fd, struct file *filp, int on)
6d4d829
 	return fasync_helper(fd, filp, on, &fasync);
6d4d829
 }
6d4d829
6d4d829
+static int random_open(struct inode *inode, struct file *filp)
6d4d829
+{
6d4d829
+	const struct random_extrng *rng;
6d4d829
+
6d4d829
+	rcu_read_lock();
6d4d829
+	rng = rcu_dereference(extrng);
6d4d829
+	if (rng && !try_module_get(rng->owner))
6d4d829
+		rng = NULL;
6d4d829
+	rcu_read_unlock();
6d4d829
+
6d4d829
+	if (!rng)
6d4d829
+		return 0;
6d4d829
+
6d4d829
+	filp->f_op = &extrng_random_fops;
6d4d829
+	filp->private_data = rng->owner;
6d4d829
+
6d4d829
+	return 0;
6d4d829
+}
6d4d829
+
6d4d829
+static int urandom_open(struct inode *inode, struct file *filp)
6d4d829
+{
6d4d829
+	const struct random_extrng *rng;
6d4d829
+
6d4d829
+	rcu_read_lock();
6d4d829
+	rng = rcu_dereference(extrng);
6d4d829
+	if (rng && !try_module_get(rng->owner))
6d4d829
+		rng = NULL;
6d4d829
+	rcu_read_unlock();
6d4d829
+
6d4d829
+	if (!rng)
6d4d829
+		return 0;
6d4d829
+
6d4d829
+	filp->f_op = &extrng_urandom_fops;
6d4d829
+	filp->private_data = rng->owner;
6d4d829
+
6d4d829
+	return 0;
6d4d829
+}
6d4d829
+
6d4d829
+static int extrng_release(struct inode *inode, struct file *filp)
6d4d829
+{
6d4d829
+	module_put(filp->private_data);
6d4d829
+	return 0;
6d4d829
+}
6d4d829
+
6d4d829
+static ssize_t
6d4d829
+extrng_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
6d4d829
+{
6d4d829
+	return rcu_dereference_raw(extrng)->extrng_read(buf, nbytes);
6d4d829
+}
6d4d829
+
6d4d829
 const struct file_operations random_fops = {
6d4d829
+	.open  = random_open,
46931d9
 	.read = random_read,
6d4d829
 	.write = random_write,
46931d9
 	.poll = random_poll,
41fdcbd
@@ -1890,6 +1957,7 @@ const struct file_operations random_fops = {
6d4d829
 };
6d4d829
6d4d829
 const struct file_operations urandom_fops = {
6d4d829
+	.open  = urandom_open,
46931d9
 	.read = urandom_read,
6d4d829
 	.write = random_write,
6d4d829
 	.unlocked_ioctl = random_ioctl,
41fdcbd
@@ -1898,9 +1966,31 @@ const struct file_operations urandom_fops = {
6d4d829
 	.llseek = noop_llseek,
6d4d829
 };
6d4d829
6d4d829
+static const struct file_operations extrng_random_fops = {
6d4d829
+	.open  = random_open,
6d4d829
+	.read  = extrng_read,
6d4d829
+	.write = random_write,
6d4d829
+	.poll  = extrng_poll,
6d4d829
+	.unlocked_ioctl = random_ioctl,
6d4d829
+	.fasync = random_fasync,
6d4d829
+	.llseek = noop_llseek,
6d4d829
+	.release = extrng_release,
6d4d829
+};
6d4d829
+
6d4d829
+static const struct file_operations extrng_urandom_fops = {
6d4d829
+	.open  = urandom_open,
6d4d829
+	.read  = extrng_read,
6d4d829
+	.write = random_write,
6d4d829
+	.unlocked_ioctl = random_ioctl,
6d4d829
+	.fasync = random_fasync,
6d4d829
+	.llseek = noop_llseek,
6d4d829
+	.release = extrng_release,
6d4d829
+};
6d4d829
+
46931d9
 SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, unsigned int,
46931d9
 		flags)
6d4d829
 {
6d4d829
+	const struct random_extrng *rng;
6d4d829
 	int ret;
6d4d829
46931d9
 	if (flags & ~(GRND_NONBLOCK | GRND_RANDOM | GRND_INSECURE))
41fdcbd
@@ -1916,6 +2006,18 @@ SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, unsigned int,
6d4d829
 	if (count > INT_MAX)
6d4d829
 		count = INT_MAX;
6d4d829
6d4d829
+	rcu_read_lock();
6d4d829
+	rng = rcu_dereference(extrng);
6d4d829
+	if (rng && !try_module_get(rng->owner))
6d4d829
+		rng = NULL;
6d4d829
+	rcu_read_unlock();
6d4d829
+
6d4d829
+	if (rng) {
6d4d829
+		ret = rng->extrng_read(buf, count);
6d4d829
+		module_put(rng->owner);
6d4d829
+		return ret;
6d4d829
+	}
6d4d829
+
6d4d829
 	if (!(flags & GRND_INSECURE) && !crng_ready()) {
6d4d829
 		if (flags & GRND_NONBLOCK)
6d4d829
 			return -EAGAIN;
41fdcbd
@@ -2235,3 +2337,16 @@ void add_bootloader_randomness(const void *buf, unsigned int size)
6d4d829
 		add_device_randomness(buf, size);
6d4d829
 }
6d4d829
 EXPORT_SYMBOL_GPL(add_bootloader_randomness);
6d4d829
+
6d4d829
+void random_register_extrng(const struct random_extrng *rng)
6d4d829
+{
6d4d829
+	rcu_assign_pointer(extrng, rng);
6d4d829
+}
6d4d829
+EXPORT_SYMBOL_GPL(random_register_extrng);
6d4d829
+
6d4d829
+void random_unregister_extrng(void)
6d4d829
+{
6d4d829
+	RCU_INIT_POINTER(extrng, NULL);
6d4d829
+	synchronize_rcu();
6d4d829
+}
6d4d829
+EXPORT_SYMBOL_GPL(random_unregister_extrng);
f7a55ba
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
982fdc5
index c02ff25dd477..d860f8eb9a81 100644
f7a55ba
--- a/drivers/firmware/efi/Makefile
f7a55ba
+++ b/drivers/firmware/efi/Makefile
a260e87
@@ -28,6 +28,7 @@ obj-$(CONFIG_EFI_FAKE_MEMMAP)		+= fake_map.o
f7a55ba
 obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)	+= efibc.o
f7a55ba
 obj-$(CONFIG_EFI_TEST)			+= test/
f7a55ba
 obj-$(CONFIG_EFI_DEV_PATH_PARSER)	+= dev-path-parser.o
f7a55ba
+obj-$(CONFIG_EFI)			+= secureboot.o
f7a55ba
 obj-$(CONFIG_APPLE_PROPERTIES)		+= apple-properties.o
f7a55ba
 obj-$(CONFIG_EFI_RCI2_TABLE)		+= rci2-table.o
f7a55ba
 obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE)	+= embedded-firmware.o
f7a55ba
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
ea07b7a
index 5502e176d51b..93b61ca552d6 100644
f7a55ba
--- a/drivers/firmware/efi/efi.c
f7a55ba
+++ b/drivers/firmware/efi/efi.c
f7a55ba
@@ -31,6 +31,7 @@
f7a55ba
 #include <linux/ucs2_string.h>
f7a55ba
 #include <linux/memblock.h>
f7a55ba
 #include <linux/security.h>
f7a55ba
+#include <linux/bsearch.h>
00b08d5
f7a55ba
 #include <asm/early_ioremap.h>
00b08d5
f760a27
@@ -851,40 +852,101 @@ int efi_mem_type(unsigned long phys_addr)
f7a55ba
 }
f7a55ba
 #endif
00b08d5
f7a55ba
+struct efi_error_code {
f7a55ba
+	efi_status_t status;
f7a55ba
+	int errno;
f7a55ba
+	const char *description;
f7a55ba
+};
f7a55ba
+
f7a55ba
+static const struct efi_error_code efi_error_codes[] = {
f7a55ba
+	{ EFI_SUCCESS, 0, "Success"},
f7a55ba
+#if 0
f7a55ba
+	{ EFI_LOAD_ERROR, -EPICK_AN_ERRNO, "Load Error"},
f7a55ba
+#endif
f7a55ba
+	{ EFI_INVALID_PARAMETER, -EINVAL, "Invalid Parameter"},
f7a55ba
+	{ EFI_UNSUPPORTED, -ENOSYS, "Unsupported"},
f7a55ba
+	{ EFI_BAD_BUFFER_SIZE, -ENOSPC, "Bad Buffer Size"},
f7a55ba
+	{ EFI_BUFFER_TOO_SMALL, -ENOSPC, "Buffer Too Small"},
f7a55ba
+	{ EFI_NOT_READY, -EAGAIN, "Not Ready"},
f7a55ba
+	{ EFI_DEVICE_ERROR, -EIO, "Device Error"},
f7a55ba
+	{ EFI_WRITE_PROTECTED, -EROFS, "Write Protected"},
f7a55ba
+	{ EFI_OUT_OF_RESOURCES, -ENOMEM, "Out of Resources"},
f7a55ba
+#if 0
f7a55ba
+	{ EFI_VOLUME_CORRUPTED, -EPICK_AN_ERRNO, "Volume Corrupt"},
f7a55ba
+	{ EFI_VOLUME_FULL, -EPICK_AN_ERRNO, "Volume Full"},
f7a55ba
+	{ EFI_NO_MEDIA, -EPICK_AN_ERRNO, "No Media"},
f7a55ba
+	{ EFI_MEDIA_CHANGED, -EPICK_AN_ERRNO, "Media changed"},
f7a55ba
+#endif
f7a55ba
+	{ EFI_NOT_FOUND, -ENOENT, "Not Found"},
f7a55ba
+#if 0
f7a55ba
+	{ EFI_ACCESS_DENIED, -EPICK_AN_ERRNO, "Access Denied"},
f7a55ba
+	{ EFI_NO_RESPONSE, -EPICK_AN_ERRNO, "No Response"},
f7a55ba
+	{ EFI_NO_MAPPING, -EPICK_AN_ERRNO, "No mapping"},
f7a55ba
+	{ EFI_TIMEOUT, -EPICK_AN_ERRNO, "Time out"},
f7a55ba
+	{ EFI_NOT_STARTED, -EPICK_AN_ERRNO, "Not started"},
f7a55ba
+	{ EFI_ALREADY_STARTED, -EPICK_AN_ERRNO, "Already started"},
f7a55ba
+#endif
f7a55ba
+	{ EFI_ABORTED, -EINTR, "Aborted"},
f7a55ba
+#if 0
f7a55ba
+	{ EFI_ICMP_ERROR, -EPICK_AN_ERRNO, "ICMP Error"},
f7a55ba
+	{ EFI_TFTP_ERROR, -EPICK_AN_ERRNO, "TFTP Error"},
f7a55ba
+	{ EFI_PROTOCOL_ERROR, -EPICK_AN_ERRNO, "Protocol Error"},
f7a55ba
+	{ EFI_INCOMPATIBLE_VERSION, -EPICK_AN_ERRNO, "Incompatible Version"},
f7a55ba
+#endif
f7a55ba
+	{ EFI_SECURITY_VIOLATION, -EACCES, "Security Policy Violation"},
f7a55ba
+#if 0
f7a55ba
+	{ EFI_CRC_ERROR, -EPICK_AN_ERRNO, "CRC Error"},
f7a55ba
+	{ EFI_END_OF_MEDIA, -EPICK_AN_ERRNO, "End of Media"},
f7a55ba
+	{ EFI_END_OF_FILE, -EPICK_AN_ERRNO, "End of File"},
f7a55ba
+	{ EFI_INVALID_LANGUAGE, -EPICK_AN_ERRNO, "Invalid Languages"},
f7a55ba
+	{ EFI_COMPROMISED_DATA, -EPICK_AN_ERRNO, "Compromised Data"},
f7a55ba
+
f7a55ba
+	// warnings
f7a55ba
+	{ EFI_WARN_UNKOWN_GLYPH, -EPICK_AN_ERRNO, "Warning Unknown Glyph"},
f7a55ba
+	{ EFI_WARN_DELETE_FAILURE, -EPICK_AN_ERRNO, "Warning Delete Failure"},
f7a55ba
+	{ EFI_WARN_WRITE_FAILURE, -EPICK_AN_ERRNO, "Warning Write Failure"},
f7a55ba
+	{ EFI_WARN_BUFFER_TOO_SMALL, -EPICK_AN_ERRNO, "Warning Buffer Too Small"},
f7a55ba
+#endif
f7a55ba
+};
f7a55ba
+
f7a55ba
+static int
f7a55ba
+efi_status_cmp_bsearch(const void *key, const void *item)
f7a55ba
+{
f7a55ba
+	u64 status = (u64)(uintptr_t)key;
f7a55ba
+	struct efi_error_code *code = (struct efi_error_code *)item;
f7a55ba
+
f7a55ba
+	if (status < code->status)
f7a55ba
+		return -1;
f7a55ba
+	if (status > code->status)
f7a55ba
+		return 1;
f7a55ba
+	return 0;
f7a55ba
+}
f7a55ba
+
f7a55ba
 int efi_status_to_err(efi_status_t status)
f7a55ba
 {
f7a55ba
-	int err;
f7a55ba
-
f7a55ba
-	switch (status) {
f7a55ba
-	case EFI_SUCCESS:
f7a55ba
-		err = 0;
f7a55ba
-		break;
f7a55ba
-	case EFI_INVALID_PARAMETER:
f7a55ba
-		err = -EINVAL;
f7a55ba
-		break;
f7a55ba
-	case EFI_OUT_OF_RESOURCES:
f7a55ba
-		err = -ENOSPC;
f7a55ba
-		break;
f7a55ba
-	case EFI_DEVICE_ERROR:
f7a55ba
-		err = -EIO;
f7a55ba
-		break;
f7a55ba
-	case EFI_WRITE_PROTECTED:
f7a55ba
-		err = -EROFS;
f7a55ba
-		break;
f7a55ba
-	case EFI_SECURITY_VIOLATION:
f7a55ba
-		err = -EACCES;
f7a55ba
-		break;
f7a55ba
-	case EFI_NOT_FOUND:
f7a55ba
-		err = -ENOENT;
f7a55ba
-		break;
f7a55ba
-	case EFI_ABORTED:
f7a55ba
-		err = -EINTR;
f7a55ba
-		break;
f7a55ba
-	default:
f7a55ba
-		err = -EINVAL;
f7a55ba
-	}
f7a55ba
+	struct efi_error_code *found;
f7a55ba
+	size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
00b08d5
f7a55ba
-	return err;
f7a55ba
+	found = bsearch((void *)(uintptr_t)status, efi_error_codes,
f7a55ba
+			sizeof(struct efi_error_code), num,
f7a55ba
+			efi_status_cmp_bsearch);
f7a55ba
+	if (!found)
f7a55ba
+		return -EINVAL;
f7a55ba
+	return found->errno;
f7a55ba
+}
f7a55ba
+
f7a55ba
+const char *
f7a55ba
+efi_status_to_str(efi_status_t status)
f7a55ba
+{
f7a55ba
+	struct efi_error_code *found;
f7a55ba
+	size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
f7a55ba
+
f7a55ba
+	found = bsearch((void *)(uintptr_t)status, efi_error_codes,
f7a55ba
+			sizeof(struct efi_error_code), num,
f7a55ba
+			efi_status_cmp_bsearch);
f7a55ba
+	if (!found)
f7a55ba
+		return "Unknown error code";
f7a55ba
+	return found->description;
f7a55ba
 }
00b08d5
f7a55ba
 static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
f7a55ba
diff --git a/drivers/firmware/efi/secureboot.c b/drivers/firmware/efi/secureboot.c
f7a55ba
new file mode 100644
f7a55ba
index 000000000000..de0a3714a5d4
f7a55ba
--- /dev/null
f7a55ba
+++ b/drivers/firmware/efi/secureboot.c
f7a55ba
@@ -0,0 +1,38 @@
f7a55ba
+/* Core kernel secure boot support.
f7a55ba
+ *
f7a55ba
+ * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
f7a55ba
+ * Written by David Howells (dhowells@redhat.com)
f7a55ba
+ *
f7a55ba
+ * This program is free software; you can redistribute it and/or
f7a55ba
+ * modify it under the terms of the GNU General Public Licence
f7a55ba
+ * as published by the Free Software Foundation; either version
f7a55ba
+ * 2 of the Licence, or (at your option) any later version.
f7a55ba
+ */
f7a55ba
+
f7a55ba
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
f7a55ba
+
f7a55ba
+#include <linux/efi.h>
f7a55ba
+#include <linux/kernel.h>
f7a55ba
+#include <linux/printk.h>
f7a55ba
+
f7a55ba
+/*
f7a55ba
+ * Decide what to do when UEFI secure boot mode is enabled.
f7a55ba
+ */
f7a55ba
+void __init efi_set_secure_boot(enum efi_secureboot_mode mode)
f7a55ba
+{
f7a55ba
+	if (efi_enabled(EFI_BOOT)) {
f7a55ba
+		switch (mode) {
f7a55ba
+		case efi_secureboot_mode_disabled:
f7a55ba
+			pr_info("Secure boot disabled\n");
f7a55ba
+			break;
f7a55ba
+		case efi_secureboot_mode_enabled:
f7a55ba
+			set_bit(EFI_SECURE_BOOT, &efi.flags);
f7a55ba
+			pr_info("Secure boot enabled\n");
f7a55ba
+			break;
f7a55ba
+		default:
f7a55ba
+			pr_warn("Secure boot could not be determined (mode %u)\n",
f7a55ba
+				   mode);
f7a55ba
+			break;
f7a55ba
+		}
f7a55ba
+	}
f7a55ba
+}
f7a55ba
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
a70311f
index 311eee599ce9..2460c6bd46f8 100644
f7a55ba
--- a/drivers/hid/hid-rmi.c
f7a55ba
+++ b/drivers/hid/hid-rmi.c
f7a55ba
@@ -322,19 +322,12 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
f7a55ba
 {
f7a55ba
 	struct rmi_data *hdata = hid_get_drvdata(hdev);
f7a55ba
 	struct rmi_device *rmi_dev = hdata->xport.rmi_dev;
f7a55ba
-	unsigned long flags;
00b08d5
f7a55ba
 	if (!(test_bit(RMI_STARTED, &hdata->flags)))
f7a55ba
 		return 0;
00b08d5
f7a55ba
-	local_irq_save(flags);
f7a55ba
-
f7a55ba
 	rmi_set_attn_data(rmi_dev, data[1], &data[2], size - 2);
00b08d5
f7a55ba
-	generic_handle_irq(hdata->rmi_irq);
f7a55ba
-
f7a55ba
-	local_irq_restore(flags);
f7a55ba
-
f7a55ba
 	return 1;
f7a55ba
 }
00b08d5
f7a55ba
@@ -591,56 +584,6 @@ static const struct rmi_transport_ops hid_rmi_ops = {
f7a55ba
 	.reset		= rmi_hid_reset,
f7a55ba
 };
00b08d5
f7a55ba
-static void rmi_irq_teardown(void *data)
f7a55ba
-{
f7a55ba
-	struct rmi_data *hdata = data;
f7a55ba
-	struct irq_domain *domain = hdata->domain;
f7a55ba
-
f7a55ba
-	if (!domain)
f7a55ba
-		return;
f7a55ba
-
f7a55ba
-	irq_dispose_mapping(irq_find_mapping(domain, 0));
f7a55ba
-
f7a55ba
-	irq_domain_remove(domain);
f7a55ba
-	hdata->domain = NULL;
f7a55ba
-	hdata->rmi_irq = 0;
f7a55ba
-}
f7a55ba
-
f7a55ba
-static int rmi_irq_map(struct irq_domain *h, unsigned int virq,
f7a55ba
-		       irq_hw_number_t hw_irq_num)
f7a55ba
-{
f7a55ba
-	irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_simple_irq);
f7a55ba
-
f7a55ba
-	return 0;
f7a55ba
-}
f7a55ba
-
f7a55ba
-static const struct irq_domain_ops rmi_irq_ops = {
f7a55ba
-	.map = rmi_irq_map,
f7a55ba
-};
f7a55ba
-
f7a55ba
-static int rmi_setup_irq_domain(struct hid_device *hdev)
f7a55ba
-{
f7a55ba
-	struct rmi_data *hdata = hid_get_drvdata(hdev);
f7a55ba
-	int ret;
f7a55ba
-
f7a55ba
-	hdata->domain = irq_domain_create_linear(hdev->dev.fwnode, 1,
f7a55ba
-						 &rmi_irq_ops, hdata);
f7a55ba
-	if (!hdata->domain)
f7a55ba
-		return -ENOMEM;
f7a55ba
-
f7a55ba
-	ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
f7a55ba
-	if (ret)
f7a55ba
-		return ret;
f7a55ba
-
f7a55ba
-	hdata->rmi_irq = irq_create_mapping(hdata->domain, 0);
f7a55ba
-	if (hdata->rmi_irq <= 0) {
f7a55ba
-		hid_err(hdev, "Can't allocate an IRQ\n");
f7a55ba
-		return hdata->rmi_irq < 0 ? hdata->rmi_irq : -ENXIO;
f7a55ba
-	}
f7a55ba
-
f7a55ba
-	return 0;
f7a55ba
-}
f7a55ba
-
f7a55ba
 static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
f7a55ba
 {
f7a55ba
 	struct rmi_data *data = NULL;
f7a55ba
@@ -713,18 +656,11 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
00b08d5
f7a55ba
 	mutex_init(&data->page_mutex);
00b08d5
f7a55ba
-	ret = rmi_setup_irq_domain(hdev);
f7a55ba
-	if (ret) {
f7a55ba
-		hid_err(hdev, "failed to allocate IRQ domain\n");
f7a55ba
-		return ret;
f7a55ba
-	}
f7a55ba
-
f7a55ba
 	if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)
a70311f
 		rmi_hid_pdata.gpio_data.disable = true;
00b08d5
f7a55ba
 	data->xport.dev = hdev->dev.parent;
f7a55ba
 	data->xport.pdata = rmi_hid_pdata;
f7a55ba
-	data->xport.pdata.irq = data->rmi_irq;
f7a55ba
 	data->xport.proto_name = "hid";
f7a55ba
 	data->xport.ops = &hid_rmi_ops;
00b08d5
2db8df8
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
2e962df
index bf18128cf5de..e973c7816de8 100644
2db8df8
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
2db8df8
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
2db8df8
@@ -9,6 +9,7 @@
2db8df8
 #include <linux/init.h>
2db8df8
 #include <linux/types.h>
2db8df8
 #include <linux/device.h>
2db8df8
+#include <linux/dmi.h>
2db8df8
 #include <linux/io.h>
2db8df8
 #include <linux/err.h>
2db8df8
 #include <linux/fs.h>
2e962df
@@ -2165,6 +2166,16 @@ static const struct amba_id etm4_ids[] = {
2db8df8
 	{},
2db8df8
 };
2db8df8
2db8df8
+static const struct dmi_system_id broken_coresight[] = {
2db8df8
+	{
2db8df8
+		.matches = {
2db8df8
+			DMI_MATCH(DMI_SYS_VENDOR, "HPE"),
2db8df8
+			DMI_MATCH(DMI_PRODUCT_NAME, "Apollo 70"),
2db8df8
+		},
2db8df8
+	},
2db8df8
+	{ }	/* terminating entry */
2db8df8
+};
2db8df8
+
2db8df8
 MODULE_DEVICE_TABLE(amba, etm4_ids);
2db8df8
2db8df8
 static struct amba_driver etm4x_amba_driver = {
2e962df
@@ -2198,6 +2209,11 @@ static int __init etm4x_init(void)
2db8df8
 {
2db8df8
 	int ret;
2db8df8
2db8df8
+	if (dmi_check_system(broken_coresight)) {
2db8df8
+		pr_info("ETM4 disabled due to firmware bug\n");
2db8df8
+		return 0;
2db8df8
+	}
2db8df8
+
2db8df8
 	ret = etm4_pm_setup();
2db8df8
2db8df8
 	/* etm4_pm_setup() does its own cleanup - exit on error */
2e962df
@@ -2224,6 +2240,9 @@ static int __init etm4x_init(void)
2db8df8
2db8df8
 static void __exit etm4x_exit(void)
2db8df8
 {
2db8df8
+	if (dmi_check_system(broken_coresight))
2db8df8
+		return;
2db8df8
+
2db8df8
 	amba_driver_unregister(&etm4x_amba_driver);
2db8df8
 	platform_driver_unregister(&etm4_platform_driver);
2db8df8
 	etm4_pm_clear();
f7a55ba
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
f7a55ba
index 258d5fe3d395..f7298e3dc8f3 100644
f7a55ba
--- a/drivers/input/rmi4/rmi_driver.c
f7a55ba
+++ b/drivers/input/rmi4/rmi_driver.c
f7a55ba
@@ -182,34 +182,47 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
f7a55ba
 	attn_data.data = fifo_data;
00b08d5
f7a55ba
 	kfifo_put(&drvdata->attn_fifo, attn_data);
f7a55ba
+
f7a55ba
+	schedule_work(&drvdata->attn_work);
f7a55ba
 }
f7a55ba
 EXPORT_SYMBOL_GPL(rmi_set_attn_data);
00b08d5
f7a55ba
-static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
f7a55ba
+static void attn_callback(struct work_struct *work)
f7a55ba
 {
f7a55ba
-	struct rmi_device *rmi_dev = dev_id;
f7a55ba
-	struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
f7a55ba
+	struct rmi_driver_data *drvdata = container_of(work,
f7a55ba
+							struct rmi_driver_data,
f7a55ba
+							attn_work);
f7a55ba
 	struct rmi4_attn_data attn_data = {0};
f7a55ba
 	int ret, count;
00b08d5
f7a55ba
 	count = kfifo_get(&drvdata->attn_fifo, &attn_data);
f7a55ba
-	if (count) {
f7a55ba
-		*(drvdata->irq_status) = attn_data.irq_status;
f7a55ba
-		drvdata->attn_data = attn_data;
f7a55ba
-	}
f7a55ba
+	if (!count)
f7a55ba
+		return;
00b08d5
f7a55ba
-	ret = rmi_process_interrupt_requests(rmi_dev);
f7a55ba
+	*(drvdata->irq_status) = attn_data.irq_status;
f7a55ba
+	drvdata->attn_data = attn_data;
f7a55ba
+
f7a55ba
+	ret = rmi_process_interrupt_requests(drvdata->rmi_dev);
f7a55ba
 	if (ret)
f7a55ba
-		rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
f7a55ba
+		rmi_dbg(RMI_DEBUG_CORE, &drvdata->rmi_dev->dev,
f7a55ba
 			"Failed to process interrupt request: %d\n", ret);
00b08d5
f7a55ba
-	if (count) {
f7a55ba
-		kfree(attn_data.data);
f7a55ba
-		drvdata->attn_data.data = NULL;
f7a55ba
-	}
f7a55ba
+	kfree(attn_data.data);
f7a55ba
+	drvdata->attn_data.data = NULL;
00b08d5
f7a55ba
 	if (!kfifo_is_empty(&drvdata->attn_fifo))
f7a55ba
-		return rmi_irq_fn(irq, dev_id);
f7a55ba
+		schedule_work(&drvdata->attn_work);
f7a55ba
+}
f7a55ba
+
f7a55ba
+static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
f7a55ba
+{
f7a55ba
+	struct rmi_device *rmi_dev = dev_id;
f7a55ba
+	int ret;
f7a55ba
+
f7a55ba
+	ret = rmi_process_interrupt_requests(rmi_dev);
f7a55ba
+	if (ret)
f7a55ba
+		rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
f7a55ba
+			"Failed to process interrupt request: %d\n", ret);
00b08d5
f7a55ba
 	return IRQ_HANDLED;
f7a55ba
 }
f7a55ba
@@ -217,7 +230,6 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
f7a55ba
 static int rmi_irq_init(struct rmi_device *rmi_dev)
f7a55ba
 {
f7a55ba
 	struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev);
f7a55ba
-	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
f7a55ba
 	int irq_flags = irq_get_trigger_type(pdata->irq);
f7a55ba
 	int ret;
00b08d5
f7a55ba
@@ -235,8 +247,6 @@ static int rmi_irq_init(struct rmi_device *rmi_dev)
f7a55ba
 		return ret;
f7a55ba
 	}
00b08d5
f7a55ba
-	data->enabled = true;
f7a55ba
-
f7a55ba
 	return 0;
f7a55ba
 }
00b08d5
f7a55ba
@@ -886,23 +896,27 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)
f7a55ba
 	if (data->enabled)
f7a55ba
 		goto out;
00b08d5
f7a55ba
-	enable_irq(irq);
f7a55ba
-	data->enabled = true;
f7a55ba
-	if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
f7a55ba
-		retval = disable_irq_wake(irq);
f7a55ba
-		if (retval)
f7a55ba
-			dev_warn(&rmi_dev->dev,
f7a55ba
-				 "Failed to disable irq for wake: %d\n",
f7a55ba
-				 retval);
f7a55ba
-	}
f7a55ba
+	if (irq) {
f7a55ba
+		enable_irq(irq);
f7a55ba
+		data->enabled = true;
f7a55ba
+		if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
f7a55ba
+			retval = disable_irq_wake(irq);
f7a55ba
+			if (retval)
f7a55ba
+				dev_warn(&rmi_dev->dev,
f7a55ba
+					 "Failed to disable irq for wake: %d\n",
f7a55ba
+					 retval);
f7a55ba
+		}
00b08d5
f7a55ba
-	/*
f7a55ba
-	 * Call rmi_process_interrupt_requests() after enabling irq,
f7a55ba
-	 * otherwise we may lose interrupt on edge-triggered systems.
f7a55ba
-	 */
f7a55ba
-	irq_flags = irq_get_trigger_type(pdata->irq);
f7a55ba
-	if (irq_flags & IRQ_TYPE_EDGE_BOTH)
f7a55ba
-		rmi_process_interrupt_requests(rmi_dev);
f7a55ba
+		/*
f7a55ba
+		 * Call rmi_process_interrupt_requests() after enabling irq,
f7a55ba
+		 * otherwise we may lose interrupt on edge-triggered systems.
f7a55ba
+		 */
f7a55ba
+		irq_flags = irq_get_trigger_type(pdata->irq);
f7a55ba
+		if (irq_flags & IRQ_TYPE_EDGE_BOTH)
f7a55ba
+			rmi_process_interrupt_requests(rmi_dev);
f7a55ba
+	} else {
f7a55ba
+		data->enabled = true;
f7a55ba
+	}
00b08d5
f7a55ba
 out:
f7a55ba
 	mutex_unlock(&data->enabled_mutex);
f7a55ba
@@ -922,20 +936,22 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake)
f7a55ba
 		goto out;
00b08d5
f7a55ba
 	data->enabled = false;
f7a55ba
-	disable_irq(irq);
f7a55ba
-	if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
f7a55ba
-		retval = enable_irq_wake(irq);
f7a55ba
-		if (retval)
f7a55ba
-			dev_warn(&rmi_dev->dev,
f7a55ba
-				 "Failed to enable irq for wake: %d\n",
f7a55ba
-				 retval);
f7a55ba
-	}
f7a55ba
-
f7a55ba
-	/* make sure the fifo is clean */
f7a55ba
-	while (!kfifo_is_empty(&data->attn_fifo)) {
f7a55ba
-		count = kfifo_get(&data->attn_fifo, &attn_data);
f7a55ba
-		if (count)
f7a55ba
-			kfree(attn_data.data);
f7a55ba
+	if (irq) {
f7a55ba
+		disable_irq(irq);
f7a55ba
+		if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
f7a55ba
+			retval = enable_irq_wake(irq);
f7a55ba
+			if (retval)
f7a55ba
+				dev_warn(&rmi_dev->dev,
f7a55ba
+					 "Failed to enable irq for wake: %d\n",
f7a55ba
+					 retval);
f7a55ba
+		}
f7a55ba
+	} else {
f7a55ba
+		/* make sure the fifo is clean */
f7a55ba
+		while (!kfifo_is_empty(&data->attn_fifo)) {
f7a55ba
+			count = kfifo_get(&data->attn_fifo, &attn_data);
f7a55ba
+			if (count)
f7a55ba
+				kfree(attn_data.data);
f7a55ba
+		}
f7a55ba
 	}
00b08d5
f7a55ba
 out:
f7a55ba
@@ -981,6 +997,8 @@ static int rmi_driver_remove(struct device *dev)
f7a55ba
 	irq_domain_remove(data->irqdomain);
f7a55ba
 	data->irqdomain = NULL;
00b08d5
f7a55ba
+	cancel_work_sync(&data->attn_work);
f7a55ba
+
f7a55ba
 	rmi_f34_remove_sysfs(rmi_dev);
f7a55ba
 	rmi_free_function_list(rmi_dev);
00b08d5
f7a55ba
@@ -1219,9 +1237,15 @@ static int rmi_driver_probe(struct device *dev)
f7a55ba
 		}
f7a55ba
 	}
00b08d5
f7a55ba
-	retval = rmi_irq_init(rmi_dev);
f7a55ba
-	if (retval < 0)
f7a55ba
-		goto err_destroy_functions;
f7a55ba
+	if (pdata->irq) {
f7a55ba
+		retval = rmi_irq_init(rmi_dev);
f7a55ba
+		if (retval < 0)
f7a55ba
+			goto err_destroy_functions;
f7a55ba
+	}
f7a55ba
+
f7a55ba
+	data->enabled = true;
f7a55ba
+
f7a55ba
+	INIT_WORK(&data->attn_work, attn_callback);
00b08d5
f7a55ba
 	if (data->f01_container->dev.driver) {
f7a55ba
 		/* Driver already bound, so enable ATTN now. */
f7a55ba
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
41fdcbd
index 107dcf5938d6..225a9797e39d 100644
f7a55ba
--- a/drivers/iommu/iommu.c
f7a55ba
+++ b/drivers/iommu/iommu.c
f7a55ba
@@ -7,6 +7,7 @@
f7a55ba
 #define pr_fmt(fmt)    "iommu: " fmt
00b08d5
f7a55ba
 #include <linux/device.h>
f7a55ba
+#include <linux/dmi.h>
c287bb2
 #include <linux/dma-iommu.h>
f7a55ba
 #include <linux/kernel.h>
c287bb2
 #include <linux/bits.h>
41fdcbd
@@ -3124,6 +3125,27 @@ u32 iommu_sva_get_pasid(struct iommu_sva *handle)
f7a55ba
 }
f7a55ba
 EXPORT_SYMBOL_GPL(iommu_sva_get_pasid);
08b72ac
f7a55ba
+#ifdef CONFIG_ARM64
f7a55ba
+static int __init iommu_quirks(void)
f7a55ba
+{
f7a55ba
+	const char *vendor, *name;
f7a55ba
+
f7a55ba
+	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
f7a55ba
+	name = dmi_get_system_info(DMI_PRODUCT_NAME);
f7a55ba
+
f7a55ba
+	if (vendor &&
f7a55ba
+	    (strncmp(vendor, "GIGABYTE", 8) == 0 && name &&
f7a55ba
+	     (strncmp(name, "R120", 4) == 0 ||
f7a55ba
+	      strncmp(name, "R270", 4) == 0))) {
f7a55ba
+		pr_warn("Gigabyte %s detected, force iommu passthrough mode", name);
f7a55ba
+		iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
f7a55ba
+	}
f7a55ba
+
f7a55ba
+	return 0;
f7a55ba
+}
f7a55ba
+arch_initcall(iommu_quirks);
f7a55ba
+#endif
08b72ac
+
08b72ac
 /*
08b72ac
  * Changes the default domain of an iommu group that has *only* one device
08b72ac
  *
a1e0664
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
6d8c016
index fd4720d37cc0..c31bc05ec139 100644
a1e0664
--- a/drivers/nvme/host/core.c
a1e0664
+++ b/drivers/nvme/host/core.c
24b5cdf
@@ -244,6 +244,9 @@ static void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl)
a1e0664
a1e0664
 static blk_status_t nvme_error_status(u16 status)
a1e0664
 {
a1e0664
+	if (unlikely(status & NVME_SC_DNR))
a1e0664
+		return BLK_STS_TARGET;
a1e0664
+
a1e0664
 	switch (status & 0x7ff) {
a1e0664
 	case NVME_SC_SUCCESS:
a1e0664
 		return BLK_STS_OK;
24b5cdf
@@ -303,6 +306,7 @@ enum nvme_disposition {
a1e0664
 	COMPLETE,
a1e0664
 	RETRY,
a1e0664
 	FAILOVER,
a1e0664
+	FAILUP,
a1e0664
 };
a1e0664
a1e0664
 static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
24b5cdf
@@ -310,15 +314,16 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
a1e0664
 	if (likely(nvme_req(req)->status == 0))
a1e0664
 		return COMPLETE;
a1e0664
a1e0664
-	if (blk_noretry_request(req) ||
a1e0664
+	if ((req->cmd_flags & (REQ_FAILFAST_DEV | REQ_FAILFAST_DRIVER)) ||
a1e0664
 	    (nvme_req(req)->status & NVME_SC_DNR) ||
a1e0664
 	    nvme_req(req)->retries >= nvme_max_retries)
a1e0664
 		return COMPLETE;
a1e0664
a1e0664
-	if (req->cmd_flags & REQ_NVME_MPATH) {
a1e0664
+	if (req->cmd_flags & (REQ_NVME_MPATH | REQ_FAILFAST_TRANSPORT)) {
a1e0664
 		if (nvme_is_path_error(nvme_req(req)->status) ||
a1e0664
 		    blk_queue_dying(req->q))
a1e0664
-			return FAILOVER;
a1e0664
+			return (req->cmd_flags & REQ_NVME_MPATH) ?
a1e0664
+				FAILOVER : FAILUP;
a1e0664
 	} else {
a1e0664
 		if (blk_queue_dying(req->q))
a1e0664
 			return COMPLETE;
24b5cdf
@@ -344,6 +349,14 @@ static inline void nvme_end_req(struct request *req)
a1e0664
 	blk_mq_end_request(req, status);
a1e0664
 }
a1e0664
a1e0664
+static inline void nvme_failup_req(struct request *req)
a1e0664
+{
a1e0664
+	nvme_update_ana(req);
a1e0664
+
a1e0664
+	nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR;
a1e0664
+	nvme_end_req(req);
a1e0664
+}
a1e0664
+
a1e0664
 void nvme_complete_rq(struct request *req)
a1e0664
 {
a1e0664
 	trace_nvme_complete_rq(req);
24b5cdf
@@ -362,6 +375,9 @@ void nvme_complete_rq(struct request *req)
a1e0664
 	case FAILOVER:
a1e0664
 		nvme_failover_req(req);
a1e0664
 		return;
a1e0664
+	case FAILUP:
a1e0664
+		nvme_failup_req(req);
a1e0664
+		return;
a1e0664
 	}
a1e0664
 }
a1e0664
 EXPORT_SYMBOL_GPL(nvme_complete_rq);
a1e0664
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
b515c78
index ff775235534c..94de4ecefe56 100644
a1e0664
--- a/drivers/nvme/host/multipath.c
a1e0664
+++ b/drivers/nvme/host/multipath.c
8ec17e1
@@ -101,14 +101,10 @@ bool nvme_mpath_set_disk_name(struct nvme_ns *ns, char *disk_name, int *flags)
a1e0664
 	return true;
a1e0664
 }
a1e0664
a1e0664
-void nvme_failover_req(struct request *req)
a1e0664
+void nvme_update_ana(struct request *req)
a1e0664
 {
a1e0664
 	struct nvme_ns *ns = req->q->queuedata;
a1e0664
 	u16 status = nvme_req(req)->status & 0x7ff;
a1e0664
-	unsigned long flags;
1cac231
-	struct bio *bio;
a1e0664
-
a1e0664
-	nvme_mpath_clear_current_path(ns);
a1e0664
a1e0664
 	/*
a1e0664
 	 * If we got back an ANA error, we know the controller is alive but not
8ec17e1
@@ -119,6 +115,16 @@ void nvme_failover_req(struct request *req)
a1e0664
 		set_bit(NVME_NS_ANA_PENDING, &ns->flags);
a1e0664
 		queue_work(nvme_wq, &ns->ctrl->ana_work);
a1e0664
 	}
a1e0664
+}
a1e0664
+
a1e0664
+void nvme_failover_req(struct request *req)
a1e0664
+{
a1e0664
+	struct nvme_ns *ns = req->q->queuedata;
a1e0664
+	unsigned long flags;
1cac231
+	struct bio *bio;
a1e0664
+
a1e0664
+	nvme_mpath_clear_current_path(ns);
a1e0664
+	nvme_update_ana(req);
a1e0664
a1e0664
 	spin_lock_irqsave(&ns->head->requeue_lock, flags);
24b5cdf
 	for (bio = req->bio; bio; bio = bio->bi_next) {
8ec17e1
@@ -869,8 +875,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
1dfb87c
 	int error = 0;
1dfb87c
1dfb87c
 	/* check if multipath is enabled and we have the capability */
1dfb87c
-	if (!multipath || !ctrl->subsys ||
1dfb87c
-	    !(ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA))
1dfb87c
+	if (!ctrl->subsys || !(ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA))
1dfb87c
 		return 0;
1dfb87c
951ac1d
 	if (!ctrl->max_namespaces ||
a1e0664
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
8ec17e1
index a162f6c6da6e..0606205d5dcc 100644
a1e0664
--- a/drivers/nvme/host/nvme.h
a1e0664
+++ b/drivers/nvme/host/nvme.h
8ec17e1
@@ -770,6 +770,7 @@ void nvme_mpath_start_freeze(struct nvme_subsystem *subsys);
8ec17e1
 void nvme_mpath_default_iopolicy(struct nvme_subsystem *subsys);
a1e0664
 bool nvme_mpath_set_disk_name(struct nvme_ns *ns, char *disk_name, int *flags);
a1e0664
 void nvme_failover_req(struct request *req);
a1e0664
+void nvme_update_ana(struct request *req);
a1e0664
 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
a1e0664
 int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
a1e0664
 void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id);
8ec17e1
@@ -808,6 +809,9 @@ static inline bool nvme_mpath_set_disk_name(struct nvme_ns *ns, char *disk_name,
a1e0664
 static inline void nvme_failover_req(struct request *req)
a1e0664
 {
a1e0664
 }
a1e0664
+static inline void nvme_update_ana(struct request *req)
a1e0664
+{
a1e0664
+}
a1e0664
 static inline void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
a1e0664
 {
a1e0664
 }
ea07b7a
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
ea07b7a
index 9037a7827eca..e5900638483b 100644
ea07b7a
--- a/drivers/pci/msi/msi.c
ea07b7a
+++ b/drivers/pci/msi/msi.c
ea07b7a
@@ -635,6 +635,9 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
ea07b7a
 		goto out_disable;
ea07b7a
 	}
00b08d5
ea07b7a
+	/* Ensure that all table entries are masked. */
ea07b7a
+	msix_mask_all(base, tsize);
f7a55ba
+
ea07b7a
 	dev->msix_base = base;
ea07b7a
ea07b7a
 	ret = msix_setup_interrupts(dev, base, entries, nvec, affd);
ea07b7a
@@ -644,15 +647,6 @@ static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
ea07b7a
 	/* Disable INTX */
ea07b7a
 	pci_intx_for_msi(dev, 0);
ea07b7a
ea07b7a
-	/*
ea07b7a
-	 * Ensure that all table entries are masked to prevent
ea07b7a
-	 * stale entries from firing in a crash kernel.
ea07b7a
-	 *
ea07b7a
-	 * Done late to deal with a broken Marvell NVME device
ea07b7a
-	 * which takes the MSI-X mask bits into account even
ea07b7a
-	 * when MSI-X is disabled, which prevents MSI delivery.
ea07b7a
-	 */
ea07b7a
-	msix_mask_all(base, tsize);
ea07b7a
 	pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
ea07b7a
ea07b7a
 	pcibios_free_irq(dev);
f7a55ba
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
6d8c016
index 65f7f6b0576c..27398de38c0c 100644
f7a55ba
--- a/drivers/pci/quirks.c
f7a55ba
+++ b/drivers/pci/quirks.c
2e962df
@@ -4272,6 +4272,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9000,
f7a55ba
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9084,
f7a55ba
 				quirk_bridge_cavm_thrx2_pcie_root);
00b08d5
f7a55ba
+/*
f7a55ba
+ * PCI BAR 5 is not setup correctly for the on-board AHCI controller
f7a55ba
+ * on Broadcom's Vulcan processor. Added a quirk to fix BAR 5 by
f7a55ba
+ * using BAR 4's resources which are populated correctly and NOT
f7a55ba
+ * actually used by the AHCI controller.
f7a55ba
+ */
f7a55ba
+static void quirk_fix_vulcan_ahci_bars(struct pci_dev *dev)
f7a55ba
+{
f7a55ba
+	struct resource *r =  &dev->resource[4];
f7a55ba
+
f7a55ba
+	if (!(r->flags & IORESOURCE_MEM) || (r->start == 0))
f7a55ba
+		return;
f7a55ba
+
f7a55ba
+	/* Set BAR5 resource to BAR4 */
f7a55ba
+	dev->resource[5] = *r;
f7a55ba
+
f7a55ba
+	/* Update BAR5 in pci config space */
f7a55ba
+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_5, r->start);
f7a55ba
+
f7a55ba
+	/* Clear BAR4's resource */
f7a55ba
+	memset(r, 0, sizeof(*r));
f7a55ba
+}
f7a55ba
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9027, quirk_fix_vulcan_ahci_bars);
f7a55ba
+
f7a55ba
 /*
f7a55ba
  * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero)
f7a55ba
  * class code.  Fix it.
f7a55ba
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
8ec17e1
index 47a1c8bddf86..e309d992e2ad 100644
f7a55ba
--- a/drivers/usb/core/hub.c
f7a55ba
+++ b/drivers/usb/core/hub.c
8ec17e1
@@ -5683,6 +5683,13 @@ static void hub_event(struct work_struct *work)
f7a55ba
 			(u16) hub->change_bits[0],
f7a55ba
 			(u16) hub->event_bits[0]);
00b08d5
f7a55ba
+	/* Don't disconnect USB-SATA on TrimSlice */
f7a55ba
+	if (strcmp(dev_name(hdev->bus->controller), "tegra-ehci.0") == 0) {
f7a55ba
+		if ((hdev->state == 7) && (hub->change_bits[0] == 0) &&
f7a55ba
+				(hub->event_bits[0] == 0x2))
f7a55ba
+			hub->event_bits[0] = 0;
f7a55ba
+	}
f7a55ba
+
f7a55ba
 	/* Lock the device, then check to see if we were
f7a55ba
 	 * disconnected while waiting for the lock to succeed. */
f7a55ba
 	usb_lock_device(hdev);
f7a55ba
diff --git a/include/linux/efi.h b/include/linux/efi.h
dcddcf3
index ccd4d3f91c98..e64643e3e364 100644
f7a55ba
--- a/include/linux/efi.h
f7a55ba
+++ b/include/linux/efi.h
f7a55ba
@@ -43,6 +43,8 @@
f7a55ba
 #define EFI_ABORTED		(21 | (1UL << (BITS_PER_LONG-1)))
f7a55ba
 #define EFI_SECURITY_VIOLATION	(26 | (1UL << (BITS_PER_LONG-1)))
00b08d5
f7a55ba
+#define EFI_IS_ERROR(x)		((x) & (1UL << (BITS_PER_LONG-1)))
f7a55ba
+
f7a55ba
 typedef unsigned long efi_status_t;
f7a55ba
 typedef u8 efi_bool_t;
f7a55ba
 typedef u16 efi_char16_t;		/* UNICODE character */
dcddcf3
@@ -829,6 +831,14 @@ extern int __init efi_setup_pcdp_console(char *);
f7a55ba
 #define EFI_MEM_ATTR		10	/* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
f7a55ba
 #define EFI_MEM_NO_SOFT_RESERVE	11	/* Is the kernel configured to ignore soft reservations? */
f7a55ba
 #define EFI_PRESERVE_BS_REGIONS	12	/* Are EFI boot-services memory segments available? */
f7a55ba
+#define EFI_SECURE_BOOT		13	/* Are we in Secure Boot mode? */
f7a55ba
+
f7a55ba
+enum efi_secureboot_mode {
f7a55ba
+	efi_secureboot_mode_unset,
f7a55ba
+	efi_secureboot_mode_unknown,
f7a55ba
+	efi_secureboot_mode_disabled,
f7a55ba
+	efi_secureboot_mode_enabled,
f7a55ba
+};
00b08d5
f7a55ba
 #ifdef CONFIG_EFI
f7a55ba
 /*
dcddcf3
@@ -840,6 +850,8 @@ static inline bool efi_enabled(int feature)
f7a55ba
 }
f7a55ba
 extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
00b08d5
f7a55ba
+extern void __init efi_set_secure_boot(enum efi_secureboot_mode mode);
f7a55ba
+
f7a55ba
 bool __pure __efi_soft_reserve_enabled(void);
00b08d5
f7a55ba
 static inline bool __pure efi_soft_reserve_enabled(void)
dcddcf3
@@ -860,6 +872,8 @@ static inline bool efi_enabled(int feature)
a260e87
 static inline void
a260e87
 efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
00b08d5
f7a55ba
+static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {}
f7a55ba
+
f7a55ba
 static inline bool efi_soft_reserve_enabled(void)
f7a55ba
 {
f7a55ba
 	return false;
dcddcf3
@@ -872,6 +886,7 @@ static inline bool efi_rt_services_supported(unsigned int mask)
f7a55ba
 #endif
00b08d5
f7a55ba
 extern int efi_status_to_err(efi_status_t status);
f7a55ba
+extern const char *efi_status_to_str(efi_status_t status);
00b08d5
f7a55ba
 /*
f7a55ba
  * Variable Attributes
dcddcf3
@@ -1124,13 +1139,6 @@ static inline bool efi_runtime_disabled(void) { return true; }
e846787
 extern void efi_call_virt_check_flags(unsigned long flags, const char *call);
e846787
 extern unsigned long efi_call_virt_save_flags(void);
e846787
e846787
-enum efi_secureboot_mode {
e846787
-	efi_secureboot_mode_unset,
e846787
-	efi_secureboot_mode_unknown,
e846787
-	efi_secureboot_mode_disabled,
e846787
-	efi_secureboot_mode_enabled,
e846787
-};
e846787
-
e846787
 static inline
e846787
 enum efi_secureboot_mode efi_get_secureboot_mode(efi_get_variable_t *get_var)
e846787
 {
f7a55ba
diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
f760a27
index 819ec92dc2a8..b49986bfbeca 100644
f7a55ba
--- a/include/linux/lsm_hook_defs.h
f7a55ba
+++ b/include/linux/lsm_hook_defs.h
fa320ac
@@ -392,6 +392,8 @@ LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
f7a55ba
 #endif /* CONFIG_BPF_SYSCALL */
00b08d5
f7a55ba
 LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
f7a55ba
+LSM_HOOK(int, 0, lock_kernel_down, const char *where, enum lockdown_reason level)
f7a55ba
+
00b08d5
f7a55ba
 #ifdef CONFIG_PERF_EVENTS
f7a55ba
 LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
f7a55ba
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
fa320ac
index 3bf5c658bc44..4701bc5ce2f5 100644
f7a55ba
--- a/include/linux/lsm_hooks.h
f7a55ba
+++ b/include/linux/lsm_hooks.h
fa320ac
@@ -1544,6 +1544,12 @@
f7a55ba
  *
f7a55ba
  *     @what: kernel feature being accessed
f7a55ba
  *
f7a55ba
+ * @lock_kernel_down
f7a55ba
+ * 	Put the kernel into lock-down mode.
f7a55ba
+ *
f7a55ba
+ * 	@where: Where the lock-down is originating from (e.g. command line option)
f7a55ba
+ * 	@level: The lock-down level (can only increase)
f7a55ba
+ *
f7a55ba
  * Security hooks for perf events
f7a55ba
  *
f7a55ba
  * @perf_event_open:
6eb15e4
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
6eb15e4
index aed44e9b5d89..08517376c765 100644
6eb15e4
--- a/include/linux/mmzone.h
6eb15e4
+++ b/include/linux/mmzone.h
6eb15e4
@@ -1390,11 +1390,9 @@ static inline unsigned long *section_to_usemap(struct mem_section *ms)
6eb15e4
 static inline struct mem_section *__nr_to_section(unsigned long nr)
6eb15e4
 {
6eb15e4
 #ifdef CONFIG_SPARSEMEM_EXTREME
6eb15e4
-	if (!mem_section)
6eb15e4
+	if (!*mem_section || !mem_section[SECTION_NR_TO_ROOT(nr)])
6eb15e4
 		return NULL;
6eb15e4
 #endif
6eb15e4
-	if (!mem_section[SECTION_NR_TO_ROOT(nr)])
6eb15e4
-		return NULL;
6eb15e4
 	return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
6eb15e4
 }
6eb15e4
 extern size_t mem_section_usage_size(void);
f7a55ba
diff --git a/include/linux/module.h b/include/linux/module.h
2e962df
index 1e135fd5c076..6ec4d001c1e2 100644
f7a55ba
--- a/include/linux/module.h
f7a55ba
+++ b/include/linux/module.h
2e962df
@@ -381,6 +381,7 @@ struct module {
f7a55ba
 	struct module_attribute *modinfo_attrs;
f7a55ba
 	const char *version;
f7a55ba
 	const char *srcversion;
f7a55ba
+	const char *rhelversion;
f7a55ba
 	struct kobject *holders_dir;
00b08d5
f7a55ba
 	/* Exported symbols */
6d4d829
diff --git a/include/linux/random.h b/include/linux/random.h
5245d1d
index c45b2693e51f..4edfdb3e44a9 100644
6d4d829
--- a/include/linux/random.h
6d4d829
+++ b/include/linux/random.h
6d4d829
@@ -14,6 +14,11 @@
6d4d829
6d4d829
 #include <uapi/linux/random.h>
6d4d829
6d4d829
+struct random_extrng {
6d4d829
+	ssize_t (*extrng_read)(void __user *buf, size_t buflen);
6d4d829
+	struct module *owner;
6d4d829
+};
6d4d829
+
6d4d829
 struct random_ready_callback {
6d4d829
 	struct list_head list;
6d4d829
 	void (*func)(struct random_ready_callback *rdy);
6d4d829
@@ -44,6 +49,8 @@ extern bool rng_is_initialized(void);
6d4d829
 extern int add_random_ready_callback(struct random_ready_callback *rdy);
6d4d829
 extern void del_random_ready_callback(struct random_ready_callback *rdy);
6d4d829
 extern int __must_check get_random_bytes_arch(void *buf, int nbytes);
6d4d829
+void random_register_extrng(const struct random_extrng *rng);
6d4d829
+void random_unregister_extrng(void);
6d4d829
6d4d829
 #ifndef MODULE
6d4d829
 extern const struct file_operations random_fops, urandom_fops;
f7a55ba
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
a70311f
index ab7eea01ab42..fff7c5f737fc 100644
f7a55ba
--- a/include/linux/rmi.h
f7a55ba
+++ b/include/linux/rmi.h
a70311f
@@ -364,6 +364,7 @@ struct rmi_driver_data {
00b08d5
f7a55ba
 	struct rmi4_attn_data attn_data;
f7a55ba
 	DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16);
f7a55ba
+	struct work_struct attn_work;
f7a55ba
 };
00b08d5
f7a55ba
 int rmi_register_transport_device(struct rmi_transport_dev *xport);
f7a55ba
diff --git a/include/linux/security.h b/include/linux/security.h
fa320ac
index 6d72772182c8..fe3b072665fb 100644
f7a55ba
--- a/include/linux/security.h
f7a55ba
+++ b/include/linux/security.h
fa320ac
@@ -471,6 +471,7 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
f7a55ba
 int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
f7a55ba
 int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
f7a55ba
 int security_locked_down(enum lockdown_reason what);
f7a55ba
+int security_lock_kernel_down(const char *where, enum lockdown_reason level);
f7a55ba
 #else /* CONFIG_SECURITY */
00b08d5
f7a55ba
 static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data)
fa320ac
@@ -1347,6 +1348,10 @@ static inline int security_locked_down(enum lockdown_reason what)
f7a55ba
 {
f7a55ba
 	return 0;
f7a55ba
 }
f7a55ba
+static inline int security_lock_kernel_down(const char *where, enum lockdown_reason level)
f7a55ba
+{
f7a55ba
+	return 0;
f7a55ba
+}
f7a55ba
 #endif	/* CONFIG_SECURITY */
00b08d5
f7a55ba
 #if defined(CONFIG_SECURITY) && defined(CONFIG_WATCH_QUEUE)
4bc3c54
diff --git a/init/Kconfig b/init/Kconfig
46931d9
index e9119bf54b1f..e3b57b4898fe 100644
4bc3c54
--- a/init/Kconfig
4bc3c54
+++ b/init/Kconfig
46931d9
@@ -1645,7 +1645,7 @@ config AIO
4bc3c54
 	  this option saves about 7k.
4bc3c54
4bc3c54
 config IO_URING
4bc3c54
-	bool "Enable IO uring support" if EXPERT
4bc3c54
+	bool "Enable IO uring support"
4bc3c54
 	select IO_WQ
4bc3c54
 	default y
4bc3c54
 	help
f7a55ba
diff --git a/kernel/module.c b/kernel/module.c
68ba353
index 46a5c2ed1928..92c2306651ce 100644
f7a55ba
--- a/kernel/module.c
f7a55ba
+++ b/kernel/module.c
37444a6
@@ -743,6 +743,7 @@ static struct module_attribute modinfo_##field = {                    \
00b08d5
f7a55ba
 MODINFO_ATTR(version);
f7a55ba
 MODINFO_ATTR(srcversion);
f7a55ba
+MODINFO_ATTR(rhelversion);
00b08d5
f7a55ba
 static char last_unloaded_module[MODULE_NAME_LEN+1];
00b08d5
2e962df
@@ -1205,6 +1206,7 @@ static struct module_attribute *modinfo_attrs[] = {
f7a55ba
 	&module_uevent,
f7a55ba
 	&modinfo_version,
f7a55ba
 	&modinfo_srcversion,
f7a55ba
+	&modinfo_rhelversion,
f7a55ba
 	&modinfo_initstate,
f7a55ba
 	&modinfo_coresize,
f7a55ba
 	&modinfo_initsize,
f7a55ba
diff --git a/kernel/module_signing.c b/kernel/module_signing.c
5c4ec8b
index 8723ae70ea1f..fb2d773498c2 100644
f7a55ba
--- a/kernel/module_signing.c
f7a55ba
+++ b/kernel/module_signing.c
f7a55ba
@@ -38,8 +38,15 @@ int mod_verify_sig(const void *mod, struct load_info *info)
f7a55ba
 	modlen -= sig_len + sizeof(ms);
f7a55ba
 	info->len = modlen;
00b08d5
f7a55ba
-	return verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
f7a55ba
+	ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
f7a55ba
 				      VERIFY_USE_SECONDARY_KEYRING,
f7a55ba
 				      VERIFYING_MODULE_SIGNATURE,
f7a55ba
 				      NULL, NULL);
f7a55ba
+	if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) {
f7a55ba
+		ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
f7a55ba
+				VERIFY_USE_PLATFORM_KEYRING,
f7a55ba
+				VERIFYING_MODULE_SIGNATURE,
f7a55ba
+				NULL, NULL);
f7a55ba
+	}
f7a55ba
+	return ret;
f7a55ba
 }
f7a55ba
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
46931d9
index 6bfa33217914..92d936f34b27 100644
f7a55ba
--- a/scripts/mod/modpost.c
f7a55ba
+++ b/scripts/mod/modpost.c
c287bb2
@@ -21,6 +21,7 @@
f7a55ba
 #include <errno.h>
f7a55ba
 #include "modpost.h"
f7a55ba
 #include "../../include/linux/license.h"
f7a55ba
+#include "../../include/generated/uapi/linux/version.h"
00b08d5
f7a55ba
 /* Are we using CONFIG_MODVERSIONS? */
f7a55ba
 static int modversions = 0;
46931d9
@@ -2366,6 +2367,12 @@ static void write_buf(struct buffer *b, const char *fname)
f7a55ba
 	}
f7a55ba
 }
00b08d5
f7a55ba
+static void add_rhelversion(struct buffer *b, struct module *mod)
f7a55ba
+{
f7a55ba
+	buf_printf(b, "MODULE_INFO(rhelversion, \"%d.%d\");\n", RHEL_MAJOR,
f7a55ba
+		   RHEL_MINOR);
f7a55ba
+}
f7a55ba
+
f7a55ba
 static void write_if_changed(struct buffer *b, const char *fname)
f7a55ba
 {
f7a55ba
 	char *tmp;
46931d9
@@ -2595,6 +2602,7 @@ int main(int argc, char **argv)
f7a55ba
 		add_depends(&buf, mod);
f7a55ba
 		add_moddevtable(&buf, mod);
f7a55ba
 		add_srcversion(&buf, mod);
f7a55ba
+		add_rhelversion(&buf, mod);
00b08d5
f7a55ba
 		sprintf(fname, "%s.mod.c", mod->name);
f7a55ba
 		write_if_changed(&buf, fname);
f7a55ba
diff --git a/scripts/tags.sh b/scripts/tags.sh
2e962df
index 16d475b3e203..4e333f14b84e 100755
f7a55ba
--- a/scripts/tags.sh
f7a55ba
+++ b/scripts/tags.sh
f7a55ba
@@ -16,6 +16,8 @@ fi
f7a55ba
 ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
f7a55ba
 # tags and cscope files should also ignore MODVERSION *.mod.c files
f7a55ba
 ignore="$ignore ( -name *.mod.c ) -prune -o"
f7a55ba
+# RHEL tags and cscope should also ignore redhat/rpm
f7a55ba
+ignore="$ignore ( -path redhat/rpm ) -prune -o"
00b08d5
f7a55ba
 # Use make KBUILD_ABS_SRCTREE=1 {tags|cscope}
f7a55ba
 # to force full paths for a non-O= build
f7a55ba
diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
fa320ac
index 08b6d12f99b4..61b596236d53 100644
f7a55ba
--- a/security/integrity/platform_certs/load_uefi.c
f7a55ba
+++ b/security/integrity/platform_certs/load_uefi.c
fa320ac
@@ -47,7 +47,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
f7a55ba
 		return NULL;
00b08d5
f7a55ba
 	if (*status != EFI_BUFFER_TOO_SMALL) {
f7a55ba
-		pr_err("Couldn't get size: 0x%lx\n", *status);
f7a55ba
+		pr_err("Couldn't get size: %s (0x%lx)\n",
f7a55ba
+		       efi_status_to_str(*status), *status);
f7a55ba
 		return NULL;
f7a55ba
 	}
00b08d5
fa320ac
@@ -58,7 +59,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
f7a55ba
 	*status = efi.get_variable(name, guid, NULL, &lsize, db);
f7a55ba
 	if (*status != EFI_SUCCESS) {
f7a55ba
 		kfree(db);
f7a55ba
-		pr_err("Error reading db var: 0x%lx\n", *status);
f7a55ba
+		pr_err("Error reading db var: %s (0x%lx)\n",
f7a55ba
+		       efi_status_to_str(*status), *status);
f7a55ba
 		return NULL;
f7a55ba
 	}
00b08d5
f7a55ba
diff --git a/security/lockdown/Kconfig b/security/lockdown/Kconfig
f7a55ba
index e84ddf484010..d0501353a4b9 100644
f7a55ba
--- a/security/lockdown/Kconfig
f7a55ba
+++ b/security/lockdown/Kconfig
f7a55ba
@@ -16,6 +16,19 @@ config SECURITY_LOCKDOWN_LSM_EARLY
f7a55ba
 	  subsystem is fully initialised. If enabled, lockdown will
f7a55ba
 	  unconditionally be called before any other LSMs.
00b08d5
f7a55ba
+config LOCK_DOWN_IN_EFI_SECURE_BOOT
f7a55ba
+	bool "Lock down the kernel in EFI Secure Boot mode"
f7a55ba
+	default n
f7a55ba
+	depends on EFI && SECURITY_LOCKDOWN_LSM_EARLY
f7a55ba
+	help
f7a55ba
+	  UEFI Secure Boot provides a mechanism for ensuring that the firmware
f7a55ba
+	  will only load signed bootloaders and kernels.  Secure boot mode may
f7a55ba
+	  be determined from EFI variables provided by the system firmware if
f7a55ba
+	  not indicated by the boot parameters.
f7a55ba
+
f7a55ba
+	  Enabling this option results in kernel lockdown being triggered if
f7a55ba
+	  EFI Secure Boot is set.
f7a55ba
+
f7a55ba
 choice
f7a55ba
 	prompt "Kernel default lockdown mode"
f7a55ba
 	default LOCK_DOWN_KERNEL_FORCE_NONE
f7a55ba
diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c
f7a55ba
index 87cbdc64d272..18555cf18da7 100644
f7a55ba
--- a/security/lockdown/lockdown.c
f7a55ba
+++ b/security/lockdown/lockdown.c
f7a55ba
@@ -73,6 +73,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what)
00b08d5
f7a55ba
 static struct security_hook_list lockdown_hooks[] __lsm_ro_after_init = {
f7a55ba
 	LSM_HOOK_INIT(locked_down, lockdown_is_locked_down),
f7a55ba
+	LSM_HOOK_INIT(lock_kernel_down, lock_kernel_down),
f7a55ba
 };
00b08d5
f7a55ba
 static int __init lockdown_lsm_init(void)
f7a55ba
diff --git a/security/security.c b/security/security.c
f760a27
index 22261d79f333..20336365f864 100644
f7a55ba
--- a/security/security.c
f7a55ba
+++ b/security/security.c
f760a27
@@ -2603,6 +2603,12 @@ int security_locked_down(enum lockdown_reason what)
f7a55ba
 }
f7a55ba
 EXPORT_SYMBOL(security_locked_down);
00b08d5
f7a55ba
+int security_lock_kernel_down(const char *where, enum lockdown_reason level)
f7a55ba
+{
f7a55ba
+	return call_int_hook(lock_kernel_down, 0, where, level);
f7a55ba
+}
f7a55ba
+EXPORT_SYMBOL(security_lock_kernel_down);
f7a55ba
+
f7a55ba
 #ifdef CONFIG_PERF_EVENTS
f7a55ba
 int security_perf_event_open(struct perf_event_attr *attr, int type)
f7a55ba
 {