486b3a3
 Makefile                                           |  20 ++-
424b8ca
 arch/s390/include/asm/ipl.h                        |   1 +
424b8ca
 arch/s390/kernel/ipl.c                             |   5 +
424b8ca
 arch/s390/kernel/setup.c                           |   4 +
486b3a3
 arch/x86/kernel/setup.c                            |  22 ++-
4c5a57b
 drivers/acpi/apei/hest.c                           |   8 +
4c5a57b
 drivers/acpi/irq.c                                 |  17 +-
486b3a3
 drivers/acpi/scan.c                                |   9 ++
486b3a3
 drivers/ata/libahci.c                              |  18 +++
486b3a3
 drivers/char/ipmi/ipmi_dmi.c                       |  15 ++
4c5a57b
 drivers/char/ipmi/ipmi_msghandler.c                |  16 +-
424b8ca
 drivers/firmware/efi/Makefile                      |   1 +
486b3a3
 drivers/firmware/efi/efi.c                         | 124 +++++++++++----
486b3a3
 drivers/firmware/efi/secureboot.c                  |  38 +++++
486b3a3
 drivers/firmware/sysfb.c                           |  18 ++-
486b3a3
 drivers/hid/hid-rmi.c                              |  66 --------
486b3a3
 drivers/hwtracing/coresight/coresight-etm4x-core.c |  19 +++
486b3a3
 drivers/input/rmi4/rmi_driver.c                    | 124 +++++++++------
486b3a3
 drivers/iommu/iommu.c                              |  22 +++
486b3a3
 drivers/pci/quirks.c                               |  24 +++
486b3a3
 drivers/scsi/sd.c                                  |  10 ++
4c5a57b
 drivers/usb/core/hub.c                             |   7 +
31008f9
 fs/xfs/xfs_iomap.c                                 |   4 +-
486b3a3
 include/linux/efi.h                                |  22 ++-
424b8ca
 include/linux/lsm_hook_defs.h                      |   2 +
4c5a57b
 include/linux/module.h                             |   1 +
486b3a3
 include/linux/rh_kabi.h                            | 172 +++++++++++++++++++++
424b8ca
 include/linux/rmi.h                                |   1 +
424b8ca
 include/linux/security.h                           |   5 +
4c5a57b
 kernel/module/main.c                               |   2 +
424b8ca
 kernel/module/signing.c                            |   9 +-
4c5a57b
 scripts/mod/modpost.c                              |   8 +
424b8ca
 scripts/tags.sh                                    |   2 +
424b8ca
 security/integrity/platform_certs/load_uefi.c      |   6 +-
486b3a3
 security/lockdown/Kconfig                          |  13 ++
424b8ca
 security/lockdown/lockdown.c                       |   1 +
486b3a3
 security/security.c                                |  12 ++
486b3a3
 tools/power/cpupower/Makefile                      |   2 +-
e1a1919
 38 files changed, 672 insertions(+), 178 deletions(-)
424b8ca
424b8ca
diff --git a/Makefile b/Makefile
171896e
index ffa43a6d0424..0d5ae4952215 100644
424b8ca
--- a/Makefile
424b8ca
+++ b/Makefile
424b8ca
@@ -22,6 +22,18 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
424b8ca
 PHONY := __all
424b8ca
 __all:
4031693
 
424b8ca
+# Set RHEL variables
424b8ca
+# Note that this ifdef'ery is required to handle when building with
424b8ca
+# the O= mechanism (relocate the object file results) due to upstream
424b8ca
+# commit 67d7c302 which broke our RHEL include file
424b8ca
+ifneq ($(realpath source),)
424b8ca
+include $(realpath source)/Makefile.rhelver
424b8ca
+else
424b8ca
+ifneq ($(realpath Makefile.rhelver),)
424b8ca
+include Makefile.rhelver
424b8ca
+endif
424b8ca
+endif
424b8ca
+
424b8ca
 # We are using a recursive build, so we need to do a little thinking
424b8ca
 # to get the ordering right.
424b8ca
 #
a833007
@@ -1247,7 +1259,13 @@ define filechk_version.h
4c5a57b
 	((c) > 255 ? 255 : (c)))';                                       \
4c5a57b
 	echo \#define LINUX_VERSION_MAJOR $(VERSION);                    \
4c5a57b
 	echo \#define LINUX_VERSION_PATCHLEVEL $(PATCHLEVEL);            \
4c5a57b
-	echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL)
4c5a57b
+	echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL);                \
4c5a57b
+	echo '#define RHEL_MAJOR $(RHEL_MAJOR)'; \
4c5a57b
+	echo '#define RHEL_MINOR $(RHEL_MINOR)'; \
4c5a57b
+	echo '#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))'; \
4c5a57b
+	echo '#define RHEL_RELEASE_CODE \
4c5a57b
+		$(shell expr $(RHEL_MAJOR) \* 256 + $(RHEL_MINOR))'; \
4c5a57b
+	echo '#define RHEL_RELEASE "$(RHEL_RELEASE)"'
4c5a57b
 endef
4c5a57b
 
4c5a57b
 $(version_h): PATCHLEVEL := $(or $(PATCHLEVEL), 0)
424b8ca
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h
424b8ca
index b0d00032479d..afb9544fb007 100644
424b8ca
--- a/arch/s390/include/asm/ipl.h
424b8ca
+++ b/arch/s390/include/asm/ipl.h
424b8ca
@@ -139,6 +139,7 @@ int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
424b8ca
 			     unsigned char flags, unsigned short cert);
424b8ca
 int ipl_report_add_certificate(struct ipl_report *report, void *key,
424b8ca
 			       unsigned long addr, unsigned long len);
424b8ca
+bool ipl_get_secureboot(void);
4031693
 
424b8ca
 /*
424b8ca
  * DIAG 308 support
424b8ca
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
486b3a3
index ba75f6bee774..7d37ce1772f1 100644
424b8ca
--- a/arch/s390/kernel/ipl.c
424b8ca
+++ b/arch/s390/kernel/ipl.c
25b2848
@@ -2520,3 +2520,8 @@ int ipl_report_free(struct ipl_report *report)
424b8ca
 }
4031693
 
424b8ca
 #endif
424b8ca
+
424b8ca
+bool ipl_get_secureboot(void)
424b8ca
+{
424b8ca
+	return !!ipl_secure_flag;
424b8ca
+}
424b8ca
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
a833007
index d1f3b56e7afc..eaefd0d7cfff 100644
424b8ca
--- a/arch/s390/kernel/setup.c
424b8ca
+++ b/arch/s390/kernel/setup.c
424b8ca
@@ -49,6 +49,7 @@
424b8ca
 #include <linux/memory.h>
424b8ca
 #include <linux/compat.h>
424b8ca
 #include <linux/start_kernel.h>
424b8ca
+#include <linux/security.h>
424b8ca
 #include <linux/hugetlb.h>
424b8ca
 #include <linux/kmemleak.h>
4031693
 
a833007
@@ -891,6 +892,9 @@ void __init setup_arch(char **cmdline_p)
4031693
 
424b8ca
 	log_component_list();
4031693
 
424b8ca
+	if (ipl_get_secureboot())
424b8ca
+		security_lock_kernel_down("Secure IPL mode", LOCKDOWN_INTEGRITY_MAX);
424b8ca
+
424b8ca
 	/* Have one command line that is parsed and saved in /proc/cmdline */
424b8ca
 	/* boot_command_line has been already set up in early.c */
424b8ca
 	*cmdline_p = boot_command_line;
424b8ca
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
9b5ea06
index 3998109195da..cedcd208de44 100644
424b8ca
--- a/arch/x86/kernel/setup.c
424b8ca
+++ b/arch/x86/kernel/setup.c
d5ee364
@@ -20,6 +20,7 @@
424b8ca
 #include <linux/root_dev.h>
424b8ca
 #include <linux/hugetlb.h>
424b8ca
 #include <linux/tboot.h>
424b8ca
+#include <linux/security.h>
424b8ca
 #include <linux/usb/xhci-dbgp.h>
424b8ca
 #include <linux/static_call.h>
424b8ca
 #include <linux/swiotlb.h>
9b5ea06
@@ -901,6 +902,13 @@ void __init setup_arch(char **cmdline_p)
424b8ca
 	if (efi_enabled(EFI_BOOT))
424b8ca
 		efi_init();
4031693
 
424b8ca
+	efi_set_secure_boot(boot_params.secure_boot);
424b8ca
+
424b8ca
+#ifdef CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT
424b8ca
+	if (efi_enabled(EFI_SECURE_BOOT))
424b8ca
+		security_lock_kernel_down("EFI Secure Boot mode", LOCKDOWN_INTEGRITY_MAX);
424b8ca
+#endif
424b8ca
+
2f781ad
 	reserve_ibft_region();
d5ee364
 	x86_init.resources.dmi_setup();
4031693
 
9b5ea06
@@ -1065,19 +1073,7 @@ void __init setup_arch(char **cmdline_p)
424b8ca
 	/* Allocate bigger log buffer */
424b8ca
 	setup_log_buf(1);
4031693
 
424b8ca
-	if (efi_enabled(EFI_BOOT)) {
424b8ca
-		switch (boot_params.secure_boot) {
424b8ca
-		case efi_secureboot_mode_disabled:
424b8ca
-			pr_info("Secure boot disabled\n");
424b8ca
-			break;
424b8ca
-		case efi_secureboot_mode_enabled:
424b8ca
-			pr_info("Secure boot enabled\n");
424b8ca
-			break;
424b8ca
-		default:
424b8ca
-			pr_info("Secure boot could not be determined\n");
424b8ca
-			break;
424b8ca
-		}
424b8ca
-	}
424b8ca
+	efi_set_secure_boot(boot_params.secure_boot);
4031693
 
424b8ca
 	reserve_initrd();
4031693
 
424b8ca
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
424b8ca
index 6aef1ee5e1bd..8f146b1b4972 100644
424b8ca
--- a/drivers/acpi/apei/hest.c
424b8ca
+++ b/drivers/acpi/apei/hest.c
424b8ca
@@ -96,6 +96,14 @@ static int apei_hest_parse(apei_hest_func_t func, void *data)
424b8ca
 	if (hest_disable || !hest_tab)
424b8ca
 		return -EINVAL;
4031693
 
424b8ca
+#ifdef CONFIG_ARM64
424b8ca
+	/* Ignore broken firmware */
424b8ca
+	if (!strncmp(hest_tab->header.oem_id, "HPE   ", 6) &&
424b8ca
+	    !strncmp(hest_tab->header.oem_table_id, "ProLiant", 8) &&
424b8ca
+	    MIDR_IMPLEMENTOR(read_cpuid_id()) == ARM_CPU_IMP_APM)
424b8ca
+		return -EINVAL;
424b8ca
+#endif
424b8ca
+
424b8ca
 	hest_hdr = (struct acpi_hest_header *)(hest_tab + 1);
424b8ca
 	for (i = 0; i < hest_tab->error_source_count; i++) {
424b8ca
 		len = hest_esrc_len(hest_hdr);
424b8ca
diff --git a/drivers/acpi/irq.c b/drivers/acpi/irq.c
489c97b
index 1687483ff319..390b67f19181 100644
424b8ca
--- a/drivers/acpi/irq.c
424b8ca
+++ b/drivers/acpi/irq.c
489c97b
@@ -143,6 +143,7 @@ struct acpi_irq_parse_one_ctx {
424b8ca
 	unsigned int index;
424b8ca
 	unsigned long *res_flags;
424b8ca
 	struct irq_fwspec *fwspec;
424b8ca
+	bool skip_producer_check;
424b8ca
 };
4031693
 
424b8ca
 /**
489c97b
@@ -216,7 +217,8 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
424b8ca
 		return AE_CTRL_TERMINATE;
424b8ca
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
424b8ca
 		eirq = &ares->data.extended_irq;
424b8ca
-		if (eirq->producer_consumer == ACPI_PRODUCER)
424b8ca
+		if (!ctx->skip_producer_check &&
424b8ca
+		    eirq->producer_consumer == ACPI_PRODUCER)
424b8ca
 			return AE_OK;
424b8ca
 		if (ctx->index >= eirq->interrupt_count) {
424b8ca
 			ctx->index -= eirq->interrupt_count;
489c97b
@@ -252,8 +254,19 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
424b8ca
 static int acpi_irq_parse_one(acpi_handle handle, unsigned int index,
424b8ca
 			      struct irq_fwspec *fwspec, unsigned long *flags)
424b8ca
 {
424b8ca
-	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec };
424b8ca
+	struct acpi_irq_parse_one_ctx ctx = { -EINVAL, index, flags, fwspec, false };
4031693
 
424b8ca
+	/*
424b8ca
+	 * Firmware on arm64-based HPE m400 platform incorrectly marks
424b8ca
+	 * its UART interrupt as ACPI_PRODUCER rather than ACPI_CONSUMER.
424b8ca
+	 * Don't do the producer/consumer check for that device.
424b8ca
+	 */
424b8ca
+	if (IS_ENABLED(CONFIG_ARM64)) {
424b8ca
+		struct acpi_device *adev = acpi_get_acpi_dev(handle);
424b8ca
+
424b8ca
+		if (adev && !strcmp(acpi_device_hid(adev), "APMC0D08"))
424b8ca
+			ctx.skip_producer_check = true;
424b8ca
+	}
424b8ca
 	acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_irq_parse_one_cb, &ctx;;
424b8ca
 	return ctx.rc;
424b8ca
 }
424b8ca
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
e1a1919
index eb4ca85d16ff..be8278b39b22 100644
424b8ca
--- a/drivers/acpi/scan.c
424b8ca
+++ b/drivers/acpi/scan.c
a833007
@@ -1757,6 +1757,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
424b8ca
 	if (!acpi_match_device_ids(device, ignore_serial_bus_ids))
424b8ca
 		return false;
4031693
 
424b8ca
+	/*
424b8ca
+	 * Firmware on some arm64 X-Gene platforms will make the UART
424b8ca
+	 * device appear as both a UART and a slave of that UART. Just
424b8ca
+	 * bail out here for X-Gene UARTs.
424b8ca
+	 */
424b8ca
+	if (IS_ENABLED(CONFIG_ARM64) &&
424b8ca
+	    !strcmp(acpi_device_hid(device), "APMC0D08"))
424b8ca
+		return false;
424b8ca
+
424b8ca
 	INIT_LIST_HEAD(&resource_list);
424b8ca
 	acpi_dev_get_resources(device, &resource_list,
424b8ca
 			       acpi_check_serial_bus_slave,
424b8ca
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
486b3a3
index 1a63200ea437..a911e976a596 100644
424b8ca
--- a/drivers/ata/libahci.c
424b8ca
+++ b/drivers/ata/libahci.c
424b8ca
@@ -729,6 +729,24 @@ int ahci_stop_engine(struct ata_port *ap)
424b8ca
 	tmp &= ~PORT_CMD_START;
424b8ca
 	writel(tmp, port_mmio + PORT_CMD);
4031693
 
424b8ca
+#ifdef CONFIG_ARM64
424b8ca
+	/* Rev Ax of Cavium CN99XX needs a hack for port stop */
424b8ca
+	if (dev_is_pci(ap->host->dev) &&
424b8ca
+	    to_pci_dev(ap->host->dev)->vendor == 0x14e4 &&
424b8ca
+	    to_pci_dev(ap->host->dev)->device == 0x9027 &&
424b8ca
+	    midr_is_cpu_model_range(read_cpuid_id(),
424b8ca
+			MIDR_CPU_MODEL(ARM_CPU_IMP_BRCM, BRCM_CPU_PART_VULCAN),
424b8ca
+			MIDR_CPU_VAR_REV(0, 0),
424b8ca
+			MIDR_CPU_VAR_REV(0, MIDR_REVISION_MASK))) {
424b8ca
+		tmp = readl(hpriv->mmio + 0x8000);
424b8ca
+		udelay(100);
424b8ca
+		writel(tmp | (1 << 26), hpriv->mmio + 0x8000);
424b8ca
+		udelay(100);
424b8ca
+		writel(tmp & ~(1 << 26), hpriv->mmio + 0x8000);
424b8ca
+		dev_warn(ap->host->dev, "CN99XX SATA reset workaround applied\n");
424b8ca
+	}
424b8ca
+#endif
424b8ca
+
424b8ca
 	/* wait for engine to stop. This could be as long as 500 msec */
424b8ca
 	tmp = ata_wait_register(ap, port_mmio + PORT_CMD,
424b8ca
 				PORT_CMD_LIST_ON, PORT_CMD_LIST_ON, 1, 500);
424b8ca
diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c
424b8ca
index bbf7029e224b..cf7faa970dd6 100644
424b8ca
--- a/drivers/char/ipmi/ipmi_dmi.c
424b8ca
+++ b/drivers/char/ipmi/ipmi_dmi.c
424b8ca
@@ -215,6 +215,21 @@ static int __init scan_for_dmi_ipmi(void)
424b8ca
 {
424b8ca
 	const struct dmi_device *dev = NULL;
4031693
 
424b8ca
+#ifdef CONFIG_ARM64
424b8ca
+	/* RHEL-only
424b8ca
+	 * If this is ARM-based HPE m400, return now, because that platform
424b8ca
+	 * reports the host-side ipmi address as intel port-io space, which
424b8ca
+	 * does not exist in the ARM architecture.
424b8ca
+	 */
424b8ca
+	const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
424b8ca
+
424b8ca
+	if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
424b8ca
+		pr_debug("%s does not support host ipmi\n", dmistr);
424b8ca
+		return 0;
424b8ca
+	}
424b8ca
+	/* END RHEL-only */
424b8ca
+#endif
424b8ca
+
424b8ca
 	while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev)))
424b8ca
 		dmi_decode_ipmi((const struct dmi_header *) dev->device_data);
4031693
 
424b8ca
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
a833007
index b0eedc4595b3..a9024c1dd68a 100644
424b8ca
--- a/drivers/char/ipmi/ipmi_msghandler.c
424b8ca
+++ b/drivers/char/ipmi/ipmi_msghandler.c
424b8ca
@@ -35,6 +35,7 @@
424b8ca
 #include <linux/uuid.h>
424b8ca
 #include <linux/nospec.h>
424b8ca
 #include <linux/vmalloc.h>
424b8ca
+#include <linux/dmi.h>
424b8ca
 #include <linux/delay.h>
4031693
 
424b8ca
 #define IPMI_DRIVER_VERSION "39.2"
486b3a3
@@ -5511,8 +5512,21 @@ static int __init ipmi_init_msghandler_mod(void)
424b8ca
 {
424b8ca
 	int rv;
4031693
 
424b8ca
-	pr_info("version " IPMI_DRIVER_VERSION "\n");
424b8ca
+#ifdef CONFIG_ARM64
424b8ca
+	/* RHEL-only
424b8ca
+	 * If this is ARM-based HPE m400, return now, because that platform
424b8ca
+	 * reports the host-side ipmi address as intel port-io space, which
424b8ca
+	 * does not exist in the ARM architecture.
424b8ca
+	 */
424b8ca
+	const char *dmistr = dmi_get_system_info(DMI_PRODUCT_NAME);
4031693
 
424b8ca
+	if (dmistr && (strcmp("ProLiant m400 Server", dmistr) == 0)) {
424b8ca
+		pr_debug("%s does not support host ipmi\n", dmistr);
424b8ca
+		return -ENOSYS;
424b8ca
+	}
424b8ca
+	/* END RHEL-only */
424b8ca
+#endif
424b8ca
+	pr_info("version " IPMI_DRIVER_VERSION "\n");
424b8ca
 	mutex_lock(&ipmi_interfaces_mutex);
424b8ca
 	rv = ipmi_register_driver();
424b8ca
 	mutex_unlock(&ipmi_interfaces_mutex);
424b8ca
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
a833007
index a2d0009560d0..4f3486e6a84b 100644
424b8ca
--- a/drivers/firmware/efi/Makefile
424b8ca
+++ b/drivers/firmware/efi/Makefile
424b8ca
@@ -25,6 +25,7 @@ subdir-$(CONFIG_EFI_STUB)		+= libstub
424b8ca
 obj-$(CONFIG_EFI_BOOTLOADER_CONTROL)	+= efibc.o
424b8ca
 obj-$(CONFIG_EFI_TEST)			+= test/
424b8ca
 obj-$(CONFIG_EFI_DEV_PATH_PARSER)	+= dev-path-parser.o
424b8ca
+obj-$(CONFIG_EFI)			+= secureboot.o
424b8ca
 obj-$(CONFIG_APPLE_PROPERTIES)		+= apple-properties.o
424b8ca
 obj-$(CONFIG_EFI_RCI2_TABLE)		+= rci2-table.o
424b8ca
 obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE)	+= embedded-firmware.o
424b8ca
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
a833007
index 1ea14e86a741..ae3518be391e 100644
424b8ca
--- a/drivers/firmware/efi/efi.c
424b8ca
+++ b/drivers/firmware/efi/efi.c
a833007
@@ -33,6 +33,7 @@
424b8ca
 #include <linux/memblock.h>
424b8ca
 #include <linux/security.h>
a833007
 #include <linux/notifier.h>
424b8ca
+#include <linux/bsearch.h>
4031693
 
424b8ca
 #include <asm/early_ioremap.h>
4031693
 
a833007
@@ -992,40 +993,101 @@ int efi_mem_type(unsigned long phys_addr)
486b3a3
 	return -EINVAL;
424b8ca
 }
4031693
 
424b8ca
+struct efi_error_code {
424b8ca
+	efi_status_t status;
424b8ca
+	int errno;
424b8ca
+	const char *description;
424b8ca
+};
424b8ca
+
424b8ca
+static const struct efi_error_code efi_error_codes[] = {
424b8ca
+	{ EFI_SUCCESS, 0, "Success"},
424b8ca
+#if 0
424b8ca
+	{ EFI_LOAD_ERROR, -EPICK_AN_ERRNO, "Load Error"},
424b8ca
+#endif
424b8ca
+	{ EFI_INVALID_PARAMETER, -EINVAL, "Invalid Parameter"},
424b8ca
+	{ EFI_UNSUPPORTED, -ENOSYS, "Unsupported"},
424b8ca
+	{ EFI_BAD_BUFFER_SIZE, -ENOSPC, "Bad Buffer Size"},
424b8ca
+	{ EFI_BUFFER_TOO_SMALL, -ENOSPC, "Buffer Too Small"},
424b8ca
+	{ EFI_NOT_READY, -EAGAIN, "Not Ready"},
424b8ca
+	{ EFI_DEVICE_ERROR, -EIO, "Device Error"},
424b8ca
+	{ EFI_WRITE_PROTECTED, -EROFS, "Write Protected"},
424b8ca
+	{ EFI_OUT_OF_RESOURCES, -ENOMEM, "Out of Resources"},
424b8ca
+#if 0
424b8ca
+	{ EFI_VOLUME_CORRUPTED, -EPICK_AN_ERRNO, "Volume Corrupt"},
424b8ca
+	{ EFI_VOLUME_FULL, -EPICK_AN_ERRNO, "Volume Full"},
424b8ca
+	{ EFI_NO_MEDIA, -EPICK_AN_ERRNO, "No Media"},
424b8ca
+	{ EFI_MEDIA_CHANGED, -EPICK_AN_ERRNO, "Media changed"},
424b8ca
+#endif
424b8ca
+	{ EFI_NOT_FOUND, -ENOENT, "Not Found"},
424b8ca
+#if 0
424b8ca
+	{ EFI_ACCESS_DENIED, -EPICK_AN_ERRNO, "Access Denied"},
424b8ca
+	{ EFI_NO_RESPONSE, -EPICK_AN_ERRNO, "No Response"},
424b8ca
+	{ EFI_NO_MAPPING, -EPICK_AN_ERRNO, "No mapping"},
424b8ca
+	{ EFI_TIMEOUT, -EPICK_AN_ERRNO, "Time out"},
424b8ca
+	{ EFI_NOT_STARTED, -EPICK_AN_ERRNO, "Not started"},
424b8ca
+	{ EFI_ALREADY_STARTED, -EPICK_AN_ERRNO, "Already started"},
424b8ca
+#endif
424b8ca
+	{ EFI_ABORTED, -EINTR, "Aborted"},
424b8ca
+#if 0
424b8ca
+	{ EFI_ICMP_ERROR, -EPICK_AN_ERRNO, "ICMP Error"},
424b8ca
+	{ EFI_TFTP_ERROR, -EPICK_AN_ERRNO, "TFTP Error"},
424b8ca
+	{ EFI_PROTOCOL_ERROR, -EPICK_AN_ERRNO, "Protocol Error"},
424b8ca
+	{ EFI_INCOMPATIBLE_VERSION, -EPICK_AN_ERRNO, "Incompatible Version"},
424b8ca
+#endif
424b8ca
+	{ EFI_SECURITY_VIOLATION, -EACCES, "Security Policy Violation"},
424b8ca
+#if 0
424b8ca
+	{ EFI_CRC_ERROR, -EPICK_AN_ERRNO, "CRC Error"},
424b8ca
+	{ EFI_END_OF_MEDIA, -EPICK_AN_ERRNO, "End of Media"},
424b8ca
+	{ EFI_END_OF_FILE, -EPICK_AN_ERRNO, "End of File"},
424b8ca
+	{ EFI_INVALID_LANGUAGE, -EPICK_AN_ERRNO, "Invalid Languages"},
424b8ca
+	{ EFI_COMPROMISED_DATA, -EPICK_AN_ERRNO, "Compromised Data"},
424b8ca
+
424b8ca
+	// warnings
424b8ca
+	{ EFI_WARN_UNKOWN_GLYPH, -EPICK_AN_ERRNO, "Warning Unknown Glyph"},
424b8ca
+	{ EFI_WARN_DELETE_FAILURE, -EPICK_AN_ERRNO, "Warning Delete Failure"},
424b8ca
+	{ EFI_WARN_WRITE_FAILURE, -EPICK_AN_ERRNO, "Warning Write Failure"},
424b8ca
+	{ EFI_WARN_BUFFER_TOO_SMALL, -EPICK_AN_ERRNO, "Warning Buffer Too Small"},
424b8ca
+#endif
424b8ca
+};
424b8ca
+
424b8ca
+static int
424b8ca
+efi_status_cmp_bsearch(const void *key, const void *item)
424b8ca
+{
424b8ca
+	u64 status = (u64)(uintptr_t)key;
424b8ca
+	struct efi_error_code *code = (struct efi_error_code *)item;
424b8ca
+
424b8ca
+	if (status < code->status)
424b8ca
+		return -1;
424b8ca
+	if (status > code->status)
424b8ca
+		return 1;
424b8ca
+	return 0;
424b8ca
+}
424b8ca
+
424b8ca
 int efi_status_to_err(efi_status_t status)
424b8ca
 {
424b8ca
-	int err;
424b8ca
-
424b8ca
-	switch (status) {
424b8ca
-	case EFI_SUCCESS:
424b8ca
-		err = 0;
424b8ca
-		break;
424b8ca
-	case EFI_INVALID_PARAMETER:
424b8ca
-		err = -EINVAL;
424b8ca
-		break;
424b8ca
-	case EFI_OUT_OF_RESOURCES:
424b8ca
-		err = -ENOSPC;
424b8ca
-		break;
424b8ca
-	case EFI_DEVICE_ERROR:
424b8ca
-		err = -EIO;
424b8ca
-		break;
424b8ca
-	case EFI_WRITE_PROTECTED:
424b8ca
-		err = -EROFS;
424b8ca
-		break;
424b8ca
-	case EFI_SECURITY_VIOLATION:
424b8ca
-		err = -EACCES;
424b8ca
-		break;
424b8ca
-	case EFI_NOT_FOUND:
424b8ca
-		err = -ENOENT;
424b8ca
-		break;
424b8ca
-	case EFI_ABORTED:
424b8ca
-		err = -EINTR;
424b8ca
-		break;
424b8ca
-	default:
424b8ca
-		err = -EINVAL;
424b8ca
-	}
424b8ca
+	struct efi_error_code *found;
424b8ca
+	size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
4031693
 
424b8ca
-	return err;
424b8ca
+	found = bsearch((void *)(uintptr_t)status, efi_error_codes,
424b8ca
+			sizeof(struct efi_error_code), num,
424b8ca
+			efi_status_cmp_bsearch);
424b8ca
+	if (!found)
424b8ca
+		return -EINVAL;
424b8ca
+	return found->errno;
424b8ca
+}
424b8ca
+
424b8ca
+const char *
424b8ca
+efi_status_to_str(efi_status_t status)
424b8ca
+{
424b8ca
+	struct efi_error_code *found;
424b8ca
+	size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
424b8ca
+
424b8ca
+	found = bsearch((void *)(uintptr_t)status, efi_error_codes,
424b8ca
+			sizeof(struct efi_error_code), num,
424b8ca
+			efi_status_cmp_bsearch);
424b8ca
+	if (!found)
424b8ca
+		return "Unknown error code";
424b8ca
+	return found->description;
424b8ca
 }
424b8ca
 EXPORT_SYMBOL_GPL(efi_status_to_err);
4031693
 
424b8ca
diff --git a/drivers/firmware/efi/secureboot.c b/drivers/firmware/efi/secureboot.c
424b8ca
new file mode 100644
424b8ca
index 000000000000..de0a3714a5d4
424b8ca
--- /dev/null
424b8ca
+++ b/drivers/firmware/efi/secureboot.c
424b8ca
@@ -0,0 +1,38 @@
424b8ca
+/* Core kernel secure boot support.
424b8ca
+ *
424b8ca
+ * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
424b8ca
+ * Written by David Howells (dhowells@redhat.com)
424b8ca
+ *
424b8ca
+ * This program is free software; you can redistribute it and/or
424b8ca
+ * modify it under the terms of the GNU General Public Licence
424b8ca
+ * as published by the Free Software Foundation; either version
424b8ca
+ * 2 of the Licence, or (at your option) any later version.
424b8ca
+ */
424b8ca
+
424b8ca
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
424b8ca
+
424b8ca
+#include <linux/efi.h>
424b8ca
+#include <linux/kernel.h>
424b8ca
+#include <linux/printk.h>
424b8ca
+
424b8ca
+/*
424b8ca
+ * Decide what to do when UEFI secure boot mode is enabled.
424b8ca
+ */
424b8ca
+void __init efi_set_secure_boot(enum efi_secureboot_mode mode)
424b8ca
+{
424b8ca
+	if (efi_enabled(EFI_BOOT)) {
424b8ca
+		switch (mode) {
424b8ca
+		case efi_secureboot_mode_disabled:
424b8ca
+			pr_info("Secure boot disabled\n");
424b8ca
+			break;
424b8ca
+		case efi_secureboot_mode_enabled:
424b8ca
+			set_bit(EFI_SECURE_BOOT, &efi.flags);
424b8ca
+			pr_info("Secure boot enabled\n");
424b8ca
+			break;
424b8ca
+		default:
424b8ca
+			pr_warn("Secure boot could not be determined (mode %u)\n",
424b8ca
+				   mode);
424b8ca
+			break;
424b8ca
+		}
424b8ca
+	}
424b8ca
+}
02afc25
diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
2105a0e
index 3c197db42c9d..16e4a2e90fae 100644
02afc25
--- a/drivers/firmware/sysfb.c
02afc25
+++ b/drivers/firmware/sysfb.c
02afc25
@@ -34,6 +34,22 @@
02afc25
 #include <linux/screen_info.h>
02afc25
 #include <linux/sysfb.h>
4031693
 
02afc25
+static int skip_simpledrm;
02afc25
+
02afc25
+static int __init simpledrm_disable(char *opt)
02afc25
+{
02afc25
+	if (!opt)
02afc25
+                return -EINVAL;
02afc25
+
02afc25
+	get_option(&opt, &skip_simpledrm);
02afc25
+
02afc25
+	if (skip_simpledrm)
02afc25
+		pr_info("The simpledrm driver will not be probed\n");
02afc25
+
02afc25
+	return 0;
02afc25
+}
02afc25
+early_param("nvidia-drm.modeset", simpledrm_disable);
02afc25
+
02afc25
 static struct platform_device *pd;
02afc25
 static DEFINE_MUTEX(disable_lock);
02afc25
 static bool disabled;
02afc25
@@ -85,7 +101,7 @@ static __init int sysfb_init(void)
4031693
 
02afc25
 	/* try to create a simple-framebuffer device */
02afc25
 	compatible = sysfb_parse_mode(si, &mode);
02afc25
-	if (compatible) {
02afc25
+	if (compatible && !skip_simpledrm) {
02afc25
 		pd = sysfb_create_simplefb(si, &mode);
02afc25
 		if (!IS_ERR(pd))
02afc25
 			goto unlock_mutex;
424b8ca
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
486b3a3
index d4af17fdba46..154f0403cbf4 100644
424b8ca
--- a/drivers/hid/hid-rmi.c
424b8ca
+++ b/drivers/hid/hid-rmi.c
424b8ca
@@ -321,21 +321,12 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
424b8ca
 {
424b8ca
 	struct rmi_data *hdata = hid_get_drvdata(hdev);
424b8ca
 	struct rmi_device *rmi_dev = hdata->xport.rmi_dev;
424b8ca
-	unsigned long flags;
4031693
 
424b8ca
 	if (!(test_bit(RMI_STARTED, &hdata->flags)))
424b8ca
 		return 0;
4031693
 
424b8ca
-	pm_wakeup_event(hdev->dev.parent, 0);
424b8ca
-
424b8ca
-	local_irq_save(flags);
424b8ca
-
424b8ca
 	rmi_set_attn_data(rmi_dev, data[1], &data[2], size - 2);
4031693
 
424b8ca
-	generic_handle_irq(hdata->rmi_irq);
424b8ca
-
424b8ca
-	local_irq_restore(flags);
424b8ca
-
424b8ca
 	return 1;
424b8ca
 }
4031693
 
486b3a3
@@ -589,56 +580,6 @@ static const struct rmi_transport_ops hid_rmi_ops = {
424b8ca
 	.reset		= rmi_hid_reset,
424b8ca
 };
4031693
 
424b8ca
-static void rmi_irq_teardown(void *data)
424b8ca
-{
424b8ca
-	struct rmi_data *hdata = data;
424b8ca
-	struct irq_domain *domain = hdata->domain;
424b8ca
-
424b8ca
-	if (!domain)
424b8ca
-		return;
424b8ca
-
424b8ca
-	irq_dispose_mapping(irq_find_mapping(domain, 0));
424b8ca
-
424b8ca
-	irq_domain_remove(domain);
424b8ca
-	hdata->domain = NULL;
424b8ca
-	hdata->rmi_irq = 0;
424b8ca
-}
424b8ca
-
424b8ca
-static int rmi_irq_map(struct irq_domain *h, unsigned int virq,
424b8ca
-		       irq_hw_number_t hw_irq_num)
424b8ca
-{
424b8ca
-	irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_simple_irq);
424b8ca
-
424b8ca
-	return 0;
424b8ca
-}
424b8ca
-
424b8ca
-static const struct irq_domain_ops rmi_irq_ops = {
424b8ca
-	.map = rmi_irq_map,
424b8ca
-};
424b8ca
-
424b8ca
-static int rmi_setup_irq_domain(struct hid_device *hdev)
424b8ca
-{
424b8ca
-	struct rmi_data *hdata = hid_get_drvdata(hdev);
424b8ca
-	int ret;
424b8ca
-
424b8ca
-	hdata->domain = irq_domain_create_linear(hdev->dev.fwnode, 1,
424b8ca
-						 &rmi_irq_ops, hdata);
424b8ca
-	if (!hdata->domain)
424b8ca
-		return -ENOMEM;
424b8ca
-
424b8ca
-	ret = devm_add_action_or_reset(&hdev->dev, &rmi_irq_teardown, hdata);
424b8ca
-	if (ret)
424b8ca
-		return ret;
424b8ca
-
424b8ca
-	hdata->rmi_irq = irq_create_mapping(hdata->domain, 0);
424b8ca
-	if (hdata->rmi_irq <= 0) {
424b8ca
-		hid_err(hdev, "Can't allocate an IRQ\n");
424b8ca
-		return hdata->rmi_irq < 0 ? hdata->rmi_irq : -ENXIO;
424b8ca
-	}
424b8ca
-
424b8ca
-	return 0;
424b8ca
-}
424b8ca
-
424b8ca
 static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
424b8ca
 {
424b8ca
 	struct rmi_data *data = NULL;
486b3a3
@@ -711,18 +652,11 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
4031693
 
424b8ca
 	mutex_init(&data->page_mutex);
4031693
 
424b8ca
-	ret = rmi_setup_irq_domain(hdev);
424b8ca
-	if (ret) {
424b8ca
-		hid_err(hdev, "failed to allocate IRQ domain\n");
424b8ca
-		return ret;
424b8ca
-	}
424b8ca
-
424b8ca
 	if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)
424b8ca
 		rmi_hid_pdata.gpio_data.disable = true;
4031693
 
424b8ca
 	data->xport.dev = hdev->dev.parent;
424b8ca
 	data->xport.pdata = rmi_hid_pdata;
424b8ca
-	data->xport.pdata.irq = data->rmi_irq;
424b8ca
 	data->xport.proto_name = "hid";
424b8ca
 	data->xport.ops = &hid_rmi_ops;
4031693
 
424b8ca
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
a833007
index 2e2cabc5f50a..8b44d990f978 100644
424b8ca
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
424b8ca
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
4c5a57b
@@ -10,6 +10,7 @@
424b8ca
 #include <linux/init.h>
424b8ca
 #include <linux/types.h>
424b8ca
 #include <linux/device.h>
424b8ca
+#include <linux/dmi.h>
424b8ca
 #include <linux/io.h>
424b8ca
 #include <linux/err.h>
424b8ca
 #include <linux/fs.h>
a833007
@@ -2343,6 +2344,16 @@ static const struct amba_id etm4_ids[] = {
424b8ca
 	{},
424b8ca
 };
4031693
 
424b8ca
+static const struct dmi_system_id broken_coresight[] = {
424b8ca
+	{
424b8ca
+		.matches = {
424b8ca
+			DMI_MATCH(DMI_SYS_VENDOR, "HPE"),
424b8ca
+			DMI_MATCH(DMI_PRODUCT_NAME, "Apollo 70"),
424b8ca
+		},
424b8ca
+	},
424b8ca
+	{ }	/* terminating entry */
424b8ca
+};
424b8ca
+
424b8ca
 MODULE_DEVICE_TABLE(amba, etm4_ids);
4031693
 
424b8ca
 static struct amba_driver etm4x_amba_driver = {
a833007
@@ -2412,6 +2423,11 @@ static int __init etm4x_init(void)
424b8ca
 {
424b8ca
 	int ret;
4031693
 
424b8ca
+	if (dmi_check_system(broken_coresight)) {
424b8ca
+		pr_info("ETM4 disabled due to firmware bug\n");
424b8ca
+		return 0;
424b8ca
+	}
424b8ca
+
424b8ca
 	ret = etm4_pm_setup();
4031693
 
424b8ca
 	/* etm4_pm_setup() does its own cleanup - exit on error */
a833007
@@ -2438,6 +2454,9 @@ static int __init etm4x_init(void)
4031693
 
424b8ca
 static void __exit etm4x_exit(void)
424b8ca
 {
424b8ca
+	if (dmi_check_system(broken_coresight))
424b8ca
+		return;
424b8ca
+
424b8ca
 	amba_driver_unregister(&etm4x_amba_driver);
424b8ca
 	platform_driver_unregister(&etm4_platform_driver);
424b8ca
 	etm4_pm_clear();
424b8ca
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
6c4d695
index ef9ea295f9e0..0103334e8f32 100644
424b8ca
--- a/drivers/input/rmi4/rmi_driver.c
424b8ca
+++ b/drivers/input/rmi4/rmi_driver.c
424b8ca
@@ -182,34 +182,47 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
424b8ca
 	attn_data.data = fifo_data;
4031693
 
424b8ca
 	kfifo_put(&drvdata->attn_fifo, attn_data);
424b8ca
+
424b8ca
+	schedule_work(&drvdata->attn_work);
424b8ca
 }
424b8ca
 EXPORT_SYMBOL_GPL(rmi_set_attn_data);
4031693
 
424b8ca
-static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
424b8ca
+static void attn_callback(struct work_struct *work)
424b8ca
 {
424b8ca
-	struct rmi_device *rmi_dev = dev_id;
424b8ca
-	struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
424b8ca
+	struct rmi_driver_data *drvdata = container_of(work,
424b8ca
+							struct rmi_driver_data,
424b8ca
+							attn_work);
424b8ca
 	struct rmi4_attn_data attn_data = {0};
424b8ca
 	int ret, count;
4031693
 
424b8ca
 	count = kfifo_get(&drvdata->attn_fifo, &attn_data);
424b8ca
-	if (count) {
424b8ca
-		*(drvdata->irq_status) = attn_data.irq_status;
424b8ca
-		drvdata->attn_data = attn_data;
424b8ca
-	}
424b8ca
+	if (!count)
424b8ca
+		return;
4031693
 
424b8ca
-	ret = rmi_process_interrupt_requests(rmi_dev);
424b8ca
+	*(drvdata->irq_status) = attn_data.irq_status;
424b8ca
+	drvdata->attn_data = attn_data;
424b8ca
+
424b8ca
+	ret = rmi_process_interrupt_requests(drvdata->rmi_dev);
424b8ca
 	if (ret)
424b8ca
-		rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
424b8ca
+		rmi_dbg(RMI_DEBUG_CORE, &drvdata->rmi_dev->dev,
424b8ca
 			"Failed to process interrupt request: %d\n", ret);
4031693
 
424b8ca
-	if (count) {
424b8ca
-		kfree(attn_data.data);
424b8ca
-		drvdata->attn_data.data = NULL;
424b8ca
-	}
424b8ca
+	kfree(attn_data.data);
424b8ca
+	drvdata->attn_data.data = NULL;
4031693
 
424b8ca
 	if (!kfifo_is_empty(&drvdata->attn_fifo))
424b8ca
-		return rmi_irq_fn(irq, dev_id);
424b8ca
+		schedule_work(&drvdata->attn_work);
424b8ca
+}
424b8ca
+
424b8ca
+static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
424b8ca
+{
424b8ca
+	struct rmi_device *rmi_dev = dev_id;
424b8ca
+	int ret;
424b8ca
+
424b8ca
+	ret = rmi_process_interrupt_requests(rmi_dev);
424b8ca
+	if (ret)
424b8ca
+		rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
424b8ca
+			"Failed to process interrupt request: %d\n", ret);
4031693
 
424b8ca
 	return IRQ_HANDLED;
424b8ca
 }
424b8ca
@@ -217,7 +230,6 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
424b8ca
 static int rmi_irq_init(struct rmi_device *rmi_dev)
424b8ca
 {
424b8ca
 	struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev);
424b8ca
-	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
424b8ca
 	int irq_flags = irq_get_trigger_type(pdata->irq);
424b8ca
 	int ret;
4031693
 
424b8ca
@@ -235,8 +247,6 @@ static int rmi_irq_init(struct rmi_device *rmi_dev)
424b8ca
 		return ret;
424b8ca
 	}
4031693
 
424b8ca
-	data->enabled = true;
424b8ca
-
424b8ca
 	return 0;
424b8ca
 }
4031693
 
424b8ca
@@ -886,23 +896,27 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)
424b8ca
 	if (data->enabled)
424b8ca
 		goto out;
4031693
 
424b8ca
-	enable_irq(irq);
424b8ca
-	data->enabled = true;
424b8ca
-	if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
424b8ca
-		retval = disable_irq_wake(irq);
424b8ca
-		if (retval)
424b8ca
-			dev_warn(&rmi_dev->dev,
424b8ca
-				 "Failed to disable irq for wake: %d\n",
424b8ca
-				 retval);
424b8ca
-	}
424b8ca
+	if (irq) {
424b8ca
+		enable_irq(irq);
424b8ca
+		data->enabled = true;
424b8ca
+		if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
424b8ca
+			retval = disable_irq_wake(irq);
424b8ca
+			if (retval)
424b8ca
+				dev_warn(&rmi_dev->dev,
424b8ca
+					 "Failed to disable irq for wake: %d\n",
424b8ca
+					 retval);
424b8ca
+		}
4031693
 
424b8ca
-	/*
424b8ca
-	 * Call rmi_process_interrupt_requests() after enabling irq,
424b8ca
-	 * otherwise we may lose interrupt on edge-triggered systems.
424b8ca
-	 */
424b8ca
-	irq_flags = irq_get_trigger_type(pdata->irq);
424b8ca
-	if (irq_flags & IRQ_TYPE_EDGE_BOTH)
424b8ca
-		rmi_process_interrupt_requests(rmi_dev);
424b8ca
+		/*
424b8ca
+		 * Call rmi_process_interrupt_requests() after enabling irq,
424b8ca
+		 * otherwise we may lose interrupt on edge-triggered systems.
424b8ca
+		 */
424b8ca
+		irq_flags = irq_get_trigger_type(pdata->irq);
424b8ca
+		if (irq_flags & IRQ_TYPE_EDGE_BOTH)
424b8ca
+			rmi_process_interrupt_requests(rmi_dev);
424b8ca
+	} else {
424b8ca
+		data->enabled = true;
424b8ca
+	}
4031693
 
424b8ca
 out:
424b8ca
 	mutex_unlock(&data->enabled_mutex);
424b8ca
@@ -922,20 +936,22 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake)
424b8ca
 		goto out;
4031693
 
424b8ca
 	data->enabled = false;
424b8ca
-	disable_irq(irq);
424b8ca
-	if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
424b8ca
-		retval = enable_irq_wake(irq);
424b8ca
-		if (retval)
424b8ca
-			dev_warn(&rmi_dev->dev,
424b8ca
-				 "Failed to enable irq for wake: %d\n",
424b8ca
-				 retval);
424b8ca
-	}
424b8ca
-
424b8ca
-	/* make sure the fifo is clean */
424b8ca
-	while (!kfifo_is_empty(&data->attn_fifo)) {
424b8ca
-		count = kfifo_get(&data->attn_fifo, &attn_data);
424b8ca
-		if (count)
424b8ca
-			kfree(attn_data.data);
424b8ca
+	if (irq) {
424b8ca
+		disable_irq(irq);
424b8ca
+		if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
424b8ca
+			retval = enable_irq_wake(irq);
424b8ca
+			if (retval)
424b8ca
+				dev_warn(&rmi_dev->dev,
424b8ca
+					 "Failed to enable irq for wake: %d\n",
424b8ca
+					 retval);
424b8ca
+		}
424b8ca
+	} else {
424b8ca
+		/* make sure the fifo is clean */
424b8ca
+		while (!kfifo_is_empty(&data->attn_fifo)) {
424b8ca
+			count = kfifo_get(&data->attn_fifo, &attn_data);
424b8ca
+			if (count)
424b8ca
+				kfree(attn_data.data);
424b8ca
+		}
424b8ca
 	}
4031693
 
424b8ca
 out:
a833007
@@ -978,6 +994,8 @@ static int rmi_driver_remove(struct device *dev)
a833007
 
a833007
 	rmi_disable_irq(rmi_dev, false);
4031693
 
424b8ca
+	cancel_work_sync(&data->attn_work);
424b8ca
+
424b8ca
 	rmi_f34_remove_sysfs(rmi_dev);
424b8ca
 	rmi_free_function_list(rmi_dev);
4031693
 
6c4d695
@@ -1223,9 +1241,15 @@ static int rmi_driver_probe(struct device *dev)
424b8ca
 		}
424b8ca
 	}
4031693
 
424b8ca
-	retval = rmi_irq_init(rmi_dev);
424b8ca
-	if (retval < 0)
424b8ca
-		goto err_destroy_functions;
424b8ca
+	if (pdata->irq) {
424b8ca
+		retval = rmi_irq_init(rmi_dev);
424b8ca
+		if (retval < 0)
424b8ca
+			goto err_destroy_functions;
424b8ca
+	}
424b8ca
+
424b8ca
+	data->enabled = true;
424b8ca
+
424b8ca
+	INIT_WORK(&data->attn_work, attn_callback);
4031693
 
424b8ca
 	if (data->f01_container->dev.driver) {
424b8ca
 		/* Driver already bound, so enable ATTN now. */
424b8ca
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
9b5ea06
index ad33161f2374..a4bca95d8322 100644
424b8ca
--- a/drivers/iommu/iommu.c
424b8ca
+++ b/drivers/iommu/iommu.c
424b8ca
@@ -8,6 +8,7 @@
4031693
 
424b8ca
 #include <linux/amba/bus.h>
424b8ca
 #include <linux/device.h>
424b8ca
+#include <linux/dmi.h>
424b8ca
 #include <linux/kernel.h>
424b8ca
 #include <linux/bits.h>
424b8ca
 #include <linux/bug.h>
a833007
@@ -3106,6 +3107,27 @@ int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
424b8ca
 }
424b8ca
 EXPORT_SYMBOL_GPL(iommu_dev_disable_feature);
4031693
 
424b8ca
+#ifdef CONFIG_ARM64
424b8ca
+static int __init iommu_quirks(void)
424b8ca
+{
424b8ca
+	const char *vendor, *name;
424b8ca
+
424b8ca
+	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
424b8ca
+	name = dmi_get_system_info(DMI_PRODUCT_NAME);
424b8ca
+
424b8ca
+	if (vendor &&
424b8ca
+	    (strncmp(vendor, "GIGABYTE", 8) == 0 && name &&
424b8ca
+	     (strncmp(name, "R120", 4) == 0 ||
424b8ca
+	      strncmp(name, "R270", 4) == 0))) {
424b8ca
+		pr_warn("Gigabyte %s detected, force iommu passthrough mode", name);
424b8ca
+		iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
424b8ca
+	}
424b8ca
+
424b8ca
+	return 0;
424b8ca
+}
424b8ca
+arch_initcall(iommu_quirks);
424b8ca
+#endif
424b8ca
+
2f781ad
 /**
2f781ad
  * iommu_setup_default_domain - Set the default_domain for the group
2f781ad
  * @group: Group to change
424b8ca
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
a833007
index eff7f5df08e2..b58145ce7775 100644
424b8ca
--- a/drivers/pci/quirks.c
424b8ca
+++ b/drivers/pci/quirks.c
a833007
@@ -4433,6 +4433,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9000,
424b8ca
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9084,
424b8ca
 				quirk_bridge_cavm_thrx2_pcie_root);
4031693
 
424b8ca
+/*
424b8ca
+ * PCI BAR 5 is not setup correctly for the on-board AHCI controller
424b8ca
+ * on Broadcom's Vulcan processor. Added a quirk to fix BAR 5 by
424b8ca
+ * using BAR 4's resources which are populated correctly and NOT
424b8ca
+ * actually used by the AHCI controller.
424b8ca
+ */
424b8ca
+static void quirk_fix_vulcan_ahci_bars(struct pci_dev *dev)
424b8ca
+{
424b8ca
+	struct resource *r =  &dev->resource[4];
424b8ca
+
424b8ca
+	if (!(r->flags & IORESOURCE_MEM) || (r->start == 0))
424b8ca
+		return;
424b8ca
+
424b8ca
+	/* Set BAR5 resource to BAR4 */
424b8ca
+	dev->resource[5] = *r;
424b8ca
+
424b8ca
+	/* Update BAR5 in pci config space */
424b8ca
+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_5, r->start);
424b8ca
+
424b8ca
+	/* Clear BAR4's resource */
424b8ca
+	memset(r, 0, sizeof(*r));
424b8ca
+}
424b8ca
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_BROADCOM, 0x9027, quirk_fix_vulcan_ahci_bars);
424b8ca
+
424b8ca
 /*
424b8ca
  * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero)
424b8ca
  * class code.  Fix it.
2f781ad
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
9b5ea06
index 35200a7a7355..738378291882 100644
2f781ad
--- a/drivers/scsi/sd.c
2f781ad
+++ b/drivers/scsi/sd.c
4c5a57b
@@ -118,6 +118,14 @@ static const char *sd_cache_types[] = {
2f781ad
 	"write back, no read (daft)"
2f781ad
 };
4031693
 
2f781ad
+static const char *sd_probe_types[] = { "async", "sync" };
2f781ad
+
2f781ad
+static char sd_probe_type[6] = "async";
2f781ad
+module_param_string(probe, sd_probe_type, sizeof(sd_probe_type),
2f781ad
+		    S_IRUGO|S_IWUSR);
2f781ad
+MODULE_PARM_DESC(probe, "async or sync. Setting to 'sync' disables asynchronous "
2f781ad
+		 "device number assignments (sda, sdb, ...).");
2f781ad
+
2f781ad
 static void sd_set_flush_flag(struct scsi_disk *sdkp)
2f781ad
 {
2f781ad
 	bool wc = false, fua = false;
a833007
@@ -4084,6 +4092,8 @@ static int __init init_sd(void)
2f781ad
 		goto err_out_class;
2f781ad
 	}
4031693
 
2f781ad
+	if (!strcmp(sd_probe_type, "sync"))
2f781ad
+		sd_template.gendrv.probe_type = PROBE_FORCE_SYNCHRONOUS;
2f781ad
 	err = scsi_register_driver(&sd_template.gendrv);
2f781ad
 	if (err)
2f781ad
 		goto err_out_driver;
424b8ca
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
a833007
index 64e54163f05e..aaaa9bca0ee5 100644
424b8ca
--- a/drivers/usb/core/hub.c
424b8ca
+++ b/drivers/usb/core/hub.c
a833007
@@ -5815,6 +5815,13 @@ static void hub_event(struct work_struct *work)
424b8ca
 			(u16) hub->change_bits[0],
424b8ca
 			(u16) hub->event_bits[0]);
4031693
 
424b8ca
+	/* Don't disconnect USB-SATA on TrimSlice */
424b8ca
+	if (strcmp(dev_name(hdev->bus->controller), "tegra-ehci.0") == 0) {
424b8ca
+		if ((hdev->state == 7) && (hub->change_bits[0] == 0) &&
424b8ca
+				(hub->event_bits[0] == 0x2))
424b8ca
+			hub->event_bits[0] = 0;
424b8ca
+	}
424b8ca
+
424b8ca
 	/* Lock the device, then check to see if we were
424b8ca
 	 * disconnected while waiting for the lock to succeed. */
424b8ca
 	usb_lock_device(hdev);
31008f9
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
31008f9
index 18c8f168b153..055cdec2e9ad 100644
31008f9
--- a/fs/xfs/xfs_iomap.c
31008f9
+++ b/fs/xfs/xfs_iomap.c
31008f9
@@ -1323,7 +1323,7 @@ xfs_seek_iomap_begin(
31008f9
 	if (cow_fsb != NULLFILEOFF && cow_fsb <= offset_fsb) {
31008f9
 		if (data_fsb < cow_fsb + cmap.br_blockcount)
31008f9
 			end_fsb = min(end_fsb, data_fsb);
31008f9
-		xfs_trim_extent(&cmap, offset_fsb, end_fsb);
31008f9
+		xfs_trim_extent(&cmap, offset_fsb, end_fsb - offset_fsb);
31008f9
 		seq = xfs_iomap_inode_sequence(ip, IOMAP_F_SHARED);
31008f9
 		error = xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
31008f9
 				IOMAP_F_SHARED, seq);
31008f9
@@ -1348,7 +1348,7 @@ xfs_seek_iomap_begin(
31008f9
 	imap.br_state = XFS_EXT_NORM;
31008f9
 done:
31008f9
 	seq = xfs_iomap_inode_sequence(ip, 0);
31008f9
-	xfs_trim_extent(&imap, offset_fsb, end_fsb);
31008f9
+	xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb);
31008f9
 	error = xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0, seq);
31008f9
 out_unlock:
31008f9
 	xfs_iunlock(ip, lockmode);
424b8ca
diff --git a/include/linux/efi.h b/include/linux/efi.h
a833007
index c74f47711f0b..e7bbf3b7a938 100644
424b8ca
--- a/include/linux/efi.h
424b8ca
+++ b/include/linux/efi.h
a833007
@@ -45,6 +45,8 @@ struct screen_info;
424b8ca
 #define EFI_ABORTED		(21 | (1UL << (BITS_PER_LONG-1)))
424b8ca
 #define EFI_SECURITY_VIOLATION	(26 | (1UL << (BITS_PER_LONG-1)))
4031693
 
424b8ca
+#define EFI_IS_ERROR(x)		((x) & (1UL << (BITS_PER_LONG-1)))
424b8ca
+
424b8ca
 typedef unsigned long efi_status_t;
424b8ca
 typedef u8 efi_bool_t;
424b8ca
 typedef u16 efi_char16_t;		/* UNICODE character */
a833007
@@ -865,6 +867,14 @@ static inline int efi_range_is_wc(unsigned long start, unsigned long len)
424b8ca
 #define EFI_MEM_ATTR		10	/* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
424b8ca
 #define EFI_MEM_NO_SOFT_RESERVE	11	/* Is the kernel configured to ignore soft reservations? */
424b8ca
 #define EFI_PRESERVE_BS_REGIONS	12	/* Are EFI boot-services memory segments available? */
424b8ca
+#define EFI_SECURE_BOOT		13	/* Are we in Secure Boot mode? */
424b8ca
+
424b8ca
+enum efi_secureboot_mode {
424b8ca
+	efi_secureboot_mode_unset,
424b8ca
+	efi_secureboot_mode_unknown,
424b8ca
+	efi_secureboot_mode_disabled,
424b8ca
+	efi_secureboot_mode_enabled,
424b8ca
+};
4031693
 
424b8ca
 #ifdef CONFIG_EFI
424b8ca
 /*
a833007
@@ -876,6 +886,8 @@ static inline bool efi_enabled(int feature)
424b8ca
 }
424b8ca
 extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
4031693
 
424b8ca
+extern void __init efi_set_secure_boot(enum efi_secureboot_mode mode);
424b8ca
+
424b8ca
 bool __pure __efi_soft_reserve_enabled(void);
4031693
 
424b8ca
 static inline bool __pure efi_soft_reserve_enabled(void)
a833007
@@ -897,6 +909,8 @@ static inline bool efi_enabled(int feature)
424b8ca
 static inline void
424b8ca
 efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
4031693
 
424b8ca
+static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {}
424b8ca
+
424b8ca
 static inline bool efi_soft_reserve_enabled(void)
424b8ca
 {
424b8ca
 	return false;
a833007
@@ -911,6 +925,7 @@ static inline void efi_find_mirror(void) {}
424b8ca
 #endif
4031693
 
424b8ca
 extern int efi_status_to_err(efi_status_t status);
424b8ca
+extern const char *efi_status_to_str(efi_status_t status);
4031693
 
424b8ca
 /*
424b8ca
  * Variable Attributes
a833007
@@ -1127,13 +1142,6 @@ static inline bool efi_runtime_disabled(void) { return true; }
4c5a57b
 extern void efi_call_virt_check_flags(unsigned long flags, const void *caller);
424b8ca
 extern unsigned long efi_call_virt_save_flags(void);
4031693
 
424b8ca
-enum efi_secureboot_mode {
424b8ca
-	efi_secureboot_mode_unset,
424b8ca
-	efi_secureboot_mode_unknown,
424b8ca
-	efi_secureboot_mode_disabled,
424b8ca
-	efi_secureboot_mode_enabled,
424b8ca
-};
424b8ca
-
424b8ca
 static inline
424b8ca
 enum efi_secureboot_mode efi_get_secureboot_mode(efi_get_variable_t *get_var)
424b8ca
 {
424b8ca
diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
a833007
index f9b5baf1b5f4..60df2a4b2815 100644
424b8ca
--- a/include/linux/lsm_hook_defs.h
424b8ca
+++ b/include/linux/lsm_hook_defs.h
a833007
@@ -411,6 +411,8 @@ LSM_HOOK(void, LSM_RET_VOID, bpf_prog_free_security, struct bpf_prog_aux *aux)
424b8ca
 #endif /* CONFIG_BPF_SYSCALL */
4031693
 
424b8ca
 LSM_HOOK(int, 0, locked_down, enum lockdown_reason what)
424b8ca
+LSM_HOOK(int, 0, lock_kernel_down, const char *where, enum lockdown_reason level)
424b8ca
+
4031693
 
424b8ca
 #ifdef CONFIG_PERF_EVENTS
424b8ca
 LSM_HOOK(int, 0, perf_event_open, struct perf_event_attr *attr, int type)
4c5a57b
diff --git a/include/linux/module.h b/include/linux/module.h
a833007
index 96bc462872c0..3ce91ff5db5a 100644
4c5a57b
--- a/include/linux/module.h
4c5a57b
+++ b/include/linux/module.h
4c5a57b
@@ -418,6 +418,7 @@ struct module {
4c5a57b
 	struct module_attribute *modinfo_attrs;
4c5a57b
 	const char *version;
4c5a57b
 	const char *srcversion;
4c5a57b
+	const char *rhelversion;
4c5a57b
 	struct kobject *holders_dir;
4c5a57b
 
4c5a57b
 	/* Exported symbols */
4c5a57b
diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h
4c5a57b
new file mode 100644
4c5a57b
index 000000000000..e0d3353802bb
4c5a57b
--- /dev/null
4c5a57b
+++ b/include/linux/rh_kabi.h
4c5a57b
@@ -0,0 +1,172 @@
4c5a57b
+/*
4c5a57b
+ * rh_kabi.h - Red Hat kABI abstraction header
4c5a57b
+ *
4c5a57b
+ * Copyright (c) 2014 Don Zickus
4c5a57b
+ * Copyright (c) 2015-2017 Jiri Benc
4c5a57b
+ * Copyright (c) 2015 Sabrina Dubroca, Hannes Frederic Sowa
4c5a57b
+ * Copyright (c) 2016-2018 Prarit Bhargava
4c5a57b
+ * Copyright (c) 2017 Paolo Abeni, Larry Woodman
4c5a57b
+ *
4c5a57b
+ * This file is released under the GPLv2.
4c5a57b
+ * See the file COPYING for more details.
4c5a57b
+ *
4c5a57b
+ * These kabi macros hide the changes from the kabi checker and from the
4c5a57b
+ * process that computes the exported symbols' checksums.
4c5a57b
+ * They have 2 variants: one (defined under __GENKSYMS__) used when
4c5a57b
+ * generating the checksums, and the other used when building the kernel's
4c5a57b
+ * binaries.
4c5a57b
+ *
4c5a57b
+ * The use of these macros does not guarantee that the usage and modification
4c5a57b
+ * of code is correct.  As with all Red Hat only changes, an engineer must
4c5a57b
+ * explain why the use of the macro is valid in the patch containing the
4c5a57b
+ * changes.
4c5a57b
+ *
4c5a57b
+ */
4c5a57b
+
4c5a57b
+#ifndef _LINUX_RH_KABI_H
4c5a57b
+#define _LINUX_RH_KABI_H
4c5a57b
+
4c5a57b
+#include <linux/compiler.h>
4c5a57b
+#include <linux/stringify.h>
4c5a57b
+
4c5a57b
+/*
4c5a57b
+ * RH_KABI_CONST
4c5a57b
+ *   Adds a new const modifier to a function parameter preserving the old
4c5a57b
+ *   checksum.
4c5a57b
+ *
4c5a57b
+ * RH_KABI_DEPRECATE
4c5a57b
+ *   Mark the element as deprecated and make it unusable by modules while
4c5a57b
+ *   preserving kABI checksums.
4c5a57b
+ *
4c5a57b
+ * RH_KABI_DEPRECATE_FN
4c5a57b
+ *   Mark the function pointer as deprecated and make it unusable by modules
4c5a57b
+ *   while preserving kABI checksums.
4c5a57b
+ *
4c5a57b
+ * RH_KABI_EXTEND
4c5a57b
+ *   Simple macro for adding a new element to a struct.
4c5a57b
+ *
4c5a57b
+ *   Warning: only use if a hole exists for _all_ arches.  Use pahole to verify.
4c5a57b
+ *
4c5a57b
+ * RH_KABI_FILL_HOLE
4c5a57b
+ *   Simple macro for filling a hole in a struct.
4c5a57b
+ *
4c5a57b
+ * RH_KABI_RENAME
4c5a57b
+ *   Simple macro for renaming an element without changing its type.  This
4c5a57b
+ *   macro can be used in bitfields, for example.
4c5a57b
+ *
4c5a57b
+ *   NOTE: does not include the final ';'
4c5a57b
+ *
4c5a57b
+ * RH_KABI_REPLACE
4c5a57b
+ *   Simple replacement of _orig with a union of _orig and _new.
4c5a57b
+ *
4c5a57b
+ *   The RH_KABI_REPLACE* macros attempt to add the ability to use the '_new'
4c5a57b
+ *   element while preserving size alignment with the '_orig' element.
4c5a57b
+ *
4c5a57b
+ *   The #ifdef __GENKSYMS__ preserves the kABI agreement, while the anonymous
4c5a57b
+ *   union structure preserves the size alignment (assuming the '_new' element
4c5a57b
+ *   is not bigger than the '_orig' element).
4c5a57b
+ *
4c5a57b
+ * RH_KABI_REPLACE_UNSAFE
4c5a57b
+ *   Unsafe version of RH_KABI_REPLACE.  Only use for typedefs.
4c5a57b
+ *
4c5a57b
+ * RH_KABI_FORCE_CHANGE
4c5a57b
+ *   Force change of the symbol checksum.  The argument of the macro is a
4c5a57b
+ *   version for cases we need to do this more than once.
4c5a57b
+ *
4c5a57b
+ *   This macro does the opposite: it changes the symbol checksum without
4c5a57b
+ *   actually changing anything about the exported symbol.  It is useful for
4c5a57b
+ *   symbols that are not whitelisted, we're changing them in an
4c5a57b
+ *   incompatible way and want to prevent 3rd party modules to silently
4c5a57b
+ *   corrupt memory.  Instead, by changing the symbol checksum, such modules
4c5a57b
+ *   won't be loaded by the kernel.  This macro should only be used as a
4c5a57b
+ *   last resort when all other KABI workarounds have failed.
4c5a57b
+ *
4c5a57b
+ * NOTE
4c5a57b
+ *   Don't use ';' after these macros as it messes up the kABI checker by
4c5a57b
+ *   changing what the resulting token string looks like.  Instead let this
4c5a57b
+ *   macro add the ';' so it can be properly hidden from the kABI checker
4c5a57b
+ *   (mainly for RH_KABI_EXTEND, but applied to all macros for uniformity).
4c5a57b
+ *
4c5a57b
+ */
4c5a57b
+#ifdef __GENKSYMS__
4c5a57b
+
4c5a57b
+# define RH_KABI_CONST
4c5a57b
+# define RH_KABI_EXTEND(_new)
4c5a57b
+# define RH_KABI_FILL_HOLE(_new)
4c5a57b
+# define RH_KABI_FORCE_CHANGE(ver)		__attribute__((rh_kabi_change ## ver))
4c5a57b
+# define RH_KABI_RENAME(_orig, _new)		_orig
4c5a57b
+
4c5a57b
+# define _RH_KABI_DEPRECATE(_type, _orig)	_type _orig
4c5a57b
+# define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...)	_type (*_orig)(_args)
4c5a57b
+# define _RH_KABI_REPLACE(_orig, _new)		_orig
4c5a57b
+# define _RH_KABI_REPLACE_UNSAFE(_orig, _new)	_orig
4c5a57b
+
4c5a57b
+#else
4c5a57b
+
4c5a57b
+# define RH_KABI_ALIGN_WARNING ".  Disable CONFIG_RH_KABI_SIZE_ALIGN_CHECKS if debugging."
4c5a57b
+
4c5a57b
+# define RH_KABI_CONST				const
4c5a57b
+# define RH_KABI_EXTEND(_new)			_new;
4c5a57b
+# define RH_KABI_FILL_HOLE(_new)		_new;
4c5a57b
+# define RH_KABI_FORCE_CHANGE(ver)
4c5a57b
+# define RH_KABI_RENAME(_orig, _new)		_new
4c5a57b
+
4c5a57b
+
4c5a57b
+#if IS_BUILTIN(CONFIG_RH_KABI_SIZE_ALIGN_CHECKS)
4c5a57b
+# define __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new)			\
4c5a57b
+	union {								\
4c5a57b
+		_Static_assert(sizeof(struct{_new;}) <= sizeof(struct{_orig;}), \
4c5a57b
+			       __FILE__ ":" __stringify(__LINE__) ": "  __stringify(_new) " is larger than " __stringify(_orig) RH_KABI_ALIGN_WARNING); \
4c5a57b
+		_Static_assert(__alignof__(struct{_new;}) <= __alignof__(struct{_orig;}), \
4c5a57b
+			       __FILE__ ":" __stringify(__LINE__) ": "  __stringify(_orig) " is not aligned the same as " __stringify(_new) RH_KABI_ALIGN_WARNING); \
4c5a57b
+	}
4c5a57b
+#else
4c5a57b
+# define __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new)
4c5a57b
+#endif
4c5a57b
+
4c5a57b
+# define _RH_KABI_DEPRECATE(_type, _orig)	_type rh_reserved_##_orig
4c5a57b
+# define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...)  \
4c5a57b
+	_type (* rh_reserved_##_orig)(_args)
4c5a57b
+# define _RH_KABI_REPLACE(_orig, _new)			  \
4c5a57b
+	union {						  \
4c5a57b
+		_new;					  \
4c5a57b
+		struct {				  \
4c5a57b
+			_orig;				  \
4c5a57b
+		} __UNIQUE_ID(rh_kabi_hide);		  \
4c5a57b
+		__RH_KABI_CHECK_SIZE_ALIGN(_orig, _new);  \
4c5a57b
+	}
4c5a57b
+# define _RH_KABI_REPLACE_UNSAFE(_orig, _new)	_new
4c5a57b
+
4c5a57b
+#endif /* __GENKSYMS__ */
4c5a57b
+
4c5a57b
+/* semicolon added wrappers for the RH_KABI_REPLACE macros */
4c5a57b
+# define RH_KABI_DEPRECATE(_type, _orig)	_RH_KABI_DEPRECATE(_type, _orig);
4c5a57b
+# define RH_KABI_DEPRECATE_FN(_type, _orig, _args...)  \
4c5a57b
+	_RH_KABI_DEPRECATE_FN(_type, _orig, _args);
4c5a57b
+# define RH_KABI_REPLACE(_orig, _new)		_RH_KABI_REPLACE(_orig, _new);
4c5a57b
+# define RH_KABI_REPLACE_UNSAFE(_orig, _new)	_RH_KABI_REPLACE_UNSAFE(_orig, _new);
4c5a57b
+/*
4c5a57b
+ * Macro for breaking up a random element into two smaller chunks using an
4c5a57b
+ * anonymous struct inside an anonymous union.
4c5a57b
+ */
4c5a57b
+# define RH_KABI_REPLACE2(orig, _new1, _new2)	RH_KABI_REPLACE(orig, struct{ _new1; _new2;})
4c5a57b
+
4c5a57b
+# define RH_KABI_RESERVE(n)		_RH_KABI_RESERVE(n);
4c5a57b
+/*
4c5a57b
+ * Simple wrappers to replace standard Red Hat reserved elements.
4c5a57b
+ */
4c5a57b
+# define RH_KABI_USE(n, _new)		RH_KABI_REPLACE(_RH_KABI_RESERVE(n), _new)
4c5a57b
+/*
4c5a57b
+ * Macros for breaking up a reserved element into two smaller chunks using
4c5a57b
+ * an anonymous struct inside an anonymous union.
4c5a57b
+ */
4c5a57b
+# define RH_KABI_USE2(n, _new1, _new2)	RH_KABI_REPLACE(_RH_KABI_RESERVE(n), struct{ _new1; _new2; })
4c5a57b
+
4c5a57b
+/*
4c5a57b
+ * We tried to standardize on Red Hat reserved names.  These wrappers
4c5a57b
+ * leverage those common names making it easier to read and find in the
4c5a57b
+ * code.
4c5a57b
+ */
4c5a57b
+# define _RH_KABI_RESERVE(n)		unsigned long rh_reserved##n
4c5a57b
+
4c5a57b
+#endif /* _LINUX_RH_KABI_H */
424b8ca
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
424b8ca
index ab7eea01ab42..fff7c5f737fc 100644
424b8ca
--- a/include/linux/rmi.h
424b8ca
+++ b/include/linux/rmi.h
424b8ca
@@ -364,6 +364,7 @@ struct rmi_driver_data {
4031693
 
424b8ca
 	struct rmi4_attn_data attn_data;
424b8ca
 	DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16);
424b8ca
+	struct work_struct attn_work;
424b8ca
 };
4031693
 
424b8ca
 int rmi_register_transport_device(struct rmi_transport_dev *xport);
424b8ca
diff --git a/include/linux/security.h b/include/linux/security.h
a833007
index 3180d823e023..110bca09a1c3 100644
424b8ca
--- a/include/linux/security.h
424b8ca
+++ b/include/linux/security.h
a833007
@@ -494,6 +494,7 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
424b8ca
 int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
424b8ca
 int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
424b8ca
 int security_locked_down(enum lockdown_reason what);
424b8ca
+int security_lock_kernel_down(const char *where, enum lockdown_reason level);
a833007
 int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, u32 *uctx_len,
a833007
 		      void *val, size_t val_len, u64 id, u64 flags);
424b8ca
 #else /* CONFIG_SECURITY */
a833007
@@ -1433,6 +1434,10 @@ static inline int security_locked_down(enum lockdown_reason what)
424b8ca
 {
424b8ca
 	return 0;
424b8ca
 }
424b8ca
+static inline int security_lock_kernel_down(const char *where, enum lockdown_reason level)
424b8ca
+{
424b8ca
+	return 0;
424b8ca
+}
a833007
 static inline int lsm_fill_user_ctx(struct lsm_ctx __user *uctx,
a833007
 				    u32 *uctx_len, void *val, size_t val_len,
a833007
 				    u64 id, u64 flags)
4c5a57b
diff --git a/kernel/module/main.c b/kernel/module/main.c
a833007
index b0b99348e1a8..c35cc48d782c 100644
4c5a57b
--- a/kernel/module/main.c
4c5a57b
+++ b/kernel/module/main.c
4c5a57b
@@ -528,6 +528,7 @@ static struct module_attribute modinfo_##field = {                    \
4c5a57b
 
4c5a57b
 MODINFO_ATTR(version);
4c5a57b
 MODINFO_ATTR(srcversion);
4c5a57b
+MODINFO_ATTR(rhelversion);
4c5a57b
 
4c5a57b
 static struct {
4c5a57b
 	char name[MODULE_NAME_LEN + 1];
4c5a57b
@@ -980,6 +981,7 @@ struct module_attribute *modinfo_attrs[] = {
4c5a57b
 	&module_uevent,
4c5a57b
 	&modinfo_version,
4c5a57b
 	&modinfo_srcversion,
4c5a57b
+	&modinfo_rhelversion,
4c5a57b
 	&modinfo_initstate,
4c5a57b
 	&modinfo_coresize,
4c5a57b
 #ifdef CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC
424b8ca
diff --git a/kernel/module/signing.c b/kernel/module/signing.c
424b8ca
index a2ff4242e623..f0d2be1ee4f1 100644
424b8ca
--- a/kernel/module/signing.c
424b8ca
+++ b/kernel/module/signing.c
424b8ca
@@ -61,10 +61,17 @@ int mod_verify_sig(const void *mod, struct load_info *info)
424b8ca
 	modlen -= sig_len + sizeof(ms);
424b8ca
 	info->len = modlen;
4031693
 
424b8ca
-	return verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
424b8ca
+	ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
424b8ca
 				      VERIFY_USE_SECONDARY_KEYRING,
424b8ca
 				      VERIFYING_MODULE_SIGNATURE,
424b8ca
 				      NULL, NULL);
424b8ca
+	if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) {
424b8ca
+		ret = verify_pkcs7_signature(mod, modlen, mod + modlen, sig_len,
424b8ca
+				VERIFY_USE_PLATFORM_KEYRING,
424b8ca
+				VERIFYING_MODULE_SIGNATURE,
424b8ca
+				NULL, NULL);
424b8ca
+	}
424b8ca
+	return ret;
424b8ca
 }
4031693
 
424b8ca
 int module_sig_check(struct load_info *info, int flags)
4c5a57b
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
6c4d695
index ce686ebf5591..0d28efddb253 100644
4c5a57b
--- a/scripts/mod/modpost.c
4c5a57b
+++ b/scripts/mod/modpost.c
486b3a3
@@ -22,6 +22,7 @@
486b3a3
 #include <errno.h>
4c5a57b
 #include "modpost.h"
4c5a57b
 #include "../../include/linux/license.h"
4c5a57b
+#include "../../include/generated/uapi/linux/version.h"
4c5a57b
 
4c5a57b
 static bool module_enabled;
4c5a57b
 /* Are we using CONFIG_MODVERSIONS? */
6c4d695
@@ -1997,6 +1998,12 @@ static void write_buf(struct buffer *b, const char *fname)
4c5a57b
 	}
4c5a57b
 }
4c5a57b
 
4c5a57b
+static void add_rhelversion(struct buffer *b, struct module *mod)
4c5a57b
+{
4c5a57b
+	buf_printf(b, "MODULE_INFO(rhelversion, \"%d.%d\");\n", RHEL_MAJOR,
4c5a57b
+		   RHEL_MINOR);
4c5a57b
+}
4c5a57b
+
4c5a57b
 static void write_if_changed(struct buffer *b, const char *fname)
4c5a57b
 {
4c5a57b
 	char *tmp;
6c4d695
@@ -2057,6 +2064,7 @@ static void write_mod_c_file(struct module *mod)
4c5a57b
 	add_depends(&buf, mod);
4c5a57b
 	add_moddevtable(&buf, mod);
4c5a57b
 	add_srcversion(&buf, mod);
4c5a57b
+	add_rhelversion(&buf, mod);
4c5a57b
 
4c5a57b
 	ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name);
4c5a57b
 	if (ret >= sizeof(fname)) {
424b8ca
diff --git a/scripts/tags.sh b/scripts/tags.sh
a833007
index 191e0461d6d5..e6f418b3e948 100755
424b8ca
--- a/scripts/tags.sh
424b8ca
+++ b/scripts/tags.sh
424b8ca
@@ -16,6 +16,8 @@ fi
424b8ca
 ignore="$(echo "$RCS_FIND_IGNORE" | sed 's|\\||g' )"
424b8ca
 # tags and cscope files should also ignore MODVERSION *.mod.c files
424b8ca
 ignore="$ignore ( -name *.mod.c ) -prune -o"
424b8ca
+# RHEL tags and cscope should also ignore redhat/rpm
424b8ca
+ignore="$ignore ( -path redhat/rpm ) -prune -o"
4031693
 
424b8ca
 # ignore arbitrary directories
424b8ca
 if [ -n "${IGNORE_DIRS}" ]; then
424b8ca
diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c
424b8ca
index d1fdd113450a..182e8090cfe8 100644
424b8ca
--- a/security/integrity/platform_certs/load_uefi.c
424b8ca
+++ b/security/integrity/platform_certs/load_uefi.c
424b8ca
@@ -74,7 +74,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
424b8ca
 		return NULL;
4031693
 
424b8ca
 	if (*status != EFI_BUFFER_TOO_SMALL) {
424b8ca
-		pr_err("Couldn't get size: 0x%lx\n", *status);
424b8ca
+		pr_err("Couldn't get size: %s (0x%lx)\n",
424b8ca
+		       efi_status_to_str(*status), *status);
424b8ca
 		return NULL;
424b8ca
 	}
4031693
 
424b8ca
@@ -85,7 +86,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
424b8ca
 	*status = efi.get_variable(name, guid, NULL, &lsize, db);
424b8ca
 	if (*status != EFI_SUCCESS) {
424b8ca
 		kfree(db);
424b8ca
-		pr_err("Error reading db var: 0x%lx\n", *status);
424b8ca
+		pr_err("Error reading db var: %s (0x%lx)\n",
424b8ca
+		       efi_status_to_str(*status), *status);
424b8ca
 		return NULL;
424b8ca
 	}
4031693
 
424b8ca
diff --git a/security/lockdown/Kconfig b/security/lockdown/Kconfig
424b8ca
index e84ddf484010..d0501353a4b9 100644
424b8ca
--- a/security/lockdown/Kconfig
424b8ca
+++ b/security/lockdown/Kconfig
424b8ca
@@ -16,6 +16,19 @@ config SECURITY_LOCKDOWN_LSM_EARLY
424b8ca
 	  subsystem is fully initialised. If enabled, lockdown will
424b8ca
 	  unconditionally be called before any other LSMs.
4031693
 
424b8ca
+config LOCK_DOWN_IN_EFI_SECURE_BOOT
424b8ca
+	bool "Lock down the kernel in EFI Secure Boot mode"
424b8ca
+	default n
424b8ca
+	depends on EFI && SECURITY_LOCKDOWN_LSM_EARLY
424b8ca
+	help
424b8ca
+	  UEFI Secure Boot provides a mechanism for ensuring that the firmware
424b8ca
+	  will only load signed bootloaders and kernels.  Secure boot mode may
424b8ca
+	  be determined from EFI variables provided by the system firmware if
424b8ca
+	  not indicated by the boot parameters.
424b8ca
+
424b8ca
+	  Enabling this option results in kernel lockdown being triggered if
424b8ca
+	  EFI Secure Boot is set.
424b8ca
+
424b8ca
 choice
424b8ca
 	prompt "Kernel default lockdown mode"
424b8ca
 	default LOCK_DOWN_KERNEL_FORCE_NONE
424b8ca
diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c
a833007
index cd84d8ea1dfb..e4c70a0312bc 100644
424b8ca
--- a/security/lockdown/lockdown.c
424b8ca
+++ b/security/lockdown/lockdown.c
a833007
@@ -74,6 +74,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what)
4031693
 
0534408
 static struct security_hook_list lockdown_hooks[] __ro_after_init = {
424b8ca
 	LSM_HOOK_INIT(locked_down, lockdown_is_locked_down),
424b8ca
+	LSM_HOOK_INIT(lock_kernel_down, lock_kernel_down),
424b8ca
 };
4031693
 
a833007
 const struct lsm_id lockdown_lsmid = {
424b8ca
diff --git a/security/security.c b/security/security.c
a833007
index a344b8fa5530..51b5bea3b0c7 100644
424b8ca
--- a/security/security.c
424b8ca
+++ b/security/security.c
a833007
@@ -5517,6 +5517,18 @@ int security_locked_down(enum lockdown_reason what)
424b8ca
 }
424b8ca
 EXPORT_SYMBOL(security_locked_down);
4031693
 
0534408
+/**
0534408
+ * security_lock_kernel_down() - Put the kernel into lock-down mode.
0534408
+ *
0534408
+ * @where: Where the lock-down is originating from (e.g. command line option)
0534408
+ * @level: The lock-down level (can only increase)
0534408
+ */
424b8ca
+int security_lock_kernel_down(const char *where, enum lockdown_reason level)
424b8ca
+{
424b8ca
+	return call_int_hook(lock_kernel_down, 0, where, level);
424b8ca
+}
424b8ca
+EXPORT_SYMBOL(security_lock_kernel_down);
424b8ca
+
424b8ca
 #ifdef CONFIG_PERF_EVENTS
0534408
 /**
0534408
  * security_perf_event_open() - Check if a perf event open is allowed
486b3a3
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
486b3a3
index b53753dee02f..90701fc65aa2 100644
486b3a3
--- a/tools/power/cpupower/Makefile
486b3a3
+++ b/tools/power/cpupower/Makefile
486b3a3
@@ -53,7 +53,7 @@ DESTDIR ?=
486b3a3
 
486b3a3
 VERSION:=			$(shell ./utils/version-gen.sh)
486b3a3
 LIB_MAJ=			0.0.1
486b3a3
-LIB_MIN=			1
486b3a3
+LIB_MIN=			0
486b3a3
 
486b3a3
 PACKAGE =			cpupower
486b3a3
 PACKAGE_BUGREPORT =		linux-pm@vger.kernel.org