Skip to contentSkip to conversation

Linux 4.14.27

DISCUSSION Greg KH 1 participant 2 messages Mar 15, 2018 Stable branch

lore
Share & tools
lore

Greg KH

author maintainer
#0 lore raw

I'm announcing the release of the 4.14.27 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.14.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h

------------

 Documentation/devicetree/bindings/power/mti,mips-cpc.txt |    8 
 Documentation/sphinx/kerneldoc.py                        |    3 
 MAINTAINERS                                              |    1 
 Makefile                                                 |  259 +++----
 arch/arm/mach-omap2/omap-secure.c                        |    2 
 arch/arm64/mm/mmu.c                                      |    8 
 arch/mips/ath25/board.c                                  |    2 
 arch/mips/cavium-octeon/octeon-irq.c                     |    2 
 arch/mips/kernel/mips-cpc.c                              |   13 
 arch/mips/kernel/smp-bmips.c                             |    8 
 arch/s390/kvm/kvm-s390.c                                 |    1 
 arch/x86/Kconfig                                         |    1 
 arch/x86/Makefile                                        |    7 
 arch/x86/entry/calling.h                                 |   27 
 arch/x86/entry/entry_32.S                                |    3 
 arch/x86/entry/entry_64.S                                |   21 
 arch/x86/entry/entry_64_compat.S                         |   54 -
 arch/x86/include/asm/apm.h                               |    6 
 arch/x86/include/asm/asm-prototypes.h                    |    3 
 arch/x86/include/asm/cpufeatures.h                       |    1 
 arch/x86/include/asm/efi.h                               |   17 
 arch/x86/include/asm/mmu_context.h                       |    1 
 arch/x86/include/asm/nospec-branch.h                     |  138 +++-
 arch/x86/include/asm/paravirt.h                          |   17 
 arch/x86/include/asm/paravirt_types.h                    |    5 
 arch/x86/include/asm/refcount.h                          |    4 
 arch/x86/include/asm/rmwcc.h                             |   16 
 arch/x86/include/asm/sections.h                          |    1 
 arch/x86/include/uapi/asm/mce.h                          |    1 
 arch/x86/kernel/cpu/bugs.c                               |   12 
 arch/x86/kernel/cpu/intel.c                              |    7 
 arch/x86/kernel/cpu/mcheck/mce.c                         |   26 
 arch/x86/kernel/head_64.S                                |    2 
 arch/x86/kernel/kprobes/core.c                           |   10 
 arch/x86/kernel/vmlinux.lds.S                            |    2 
 arch/x86/lib/Makefile                                    |    1 
 arch/x86/lib/retpoline.S                                 |   56 -
 arch/x86/mm/fault.c                                      |    4 
 arch/x86/mm/mem_encrypt_boot.S                           |    2 
 arch/x86/realmode/rm/trampoline_64.S                     |    2 
 drivers/block/loop.c                                     |    2 
 drivers/char/tpm/tpm-interface.c                         |    6 
 drivers/char/tpm/tpm_tis.c                               |  108 ---
 drivers/char/tpm/tpm_tis_core.c                          |  121 +++
 drivers/char/tpm/tpm_tis_core.h                          |   16 
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c                 |    3 
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c           |   58 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c                  |   13 
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c                    |   30 
 drivers/gpu/drm/amd/amdgpu/si.c                          |   22 
 drivers/gpu/drm/amd/amdgpu/si_dpm.c                      |   50 -
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c         |   18 
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c       |   11 
 drivers/gpu/drm/drm_framebuffer.c                        |    4 
 drivers/gpu/drm/drm_probe_helper.c                       |   20 
 drivers/gpu/drm/i915/i915_drv.c                          |    2 
 drivers/gpu/drm/i915/i915_gem_execbuffer.c               |    4 
 drivers/gpu/drm/i915/i915_perf.c                         |   38 -
 drivers/gpu/drm/i915/intel_display.c                     |    2 
 drivers/gpu/drm/i915/intel_hdmi.c                        |   14 
 drivers/gpu/drm/i915/intel_runtime_pm.c                  |    1 
 drivers/gpu/drm/nouveau/nouveau_connector.c              |   18 
 drivers/gpu/drm/nouveau/nv50_display.c                   |    1 
 drivers/gpu/drm/radeon/cik.c                             |   31 
 drivers/gpu/drm/radeon/radeon_connectors.c               |   74 +-
 drivers/gpu/drm/radeon/radeon_device.c                   |    4 
 drivers/gpu/drm/radeon/radeon_pm.c                       |    6 
 drivers/infiniband/core/device.c                         |    6 
 drivers/infiniband/core/rdma_core.c                      |   12 
 drivers/infiniband/core/ucma.c                           |    6 
 drivers/infiniband/hw/mlx5/cq.c                          |    7 
 drivers/infiniband/hw/mlx5/mr.c                          |    2 
 drivers/input/keyboard/matrix_keypad.c                   |    4 
 drivers/md/bcache/super.c                                |   27 
 drivers/md/dm-bufio.c                                    |   16 
 drivers/pci/dwc/pcie-designware-host.c                   |    2 
 drivers/regulator/stm32-vrefbuf.c                        |    2 
 drivers/scsi/hosts.c                                     |    3 
 drivers/scsi/qla2xxx/qla_def.h                           |   49 -
 drivers/scsi/qla2xxx/qla_gs.c                            |   72 +-
 drivers/scsi/qla2xxx/qla_init.c                          |   64 +
 drivers/scsi/qla2xxx/qla_iocb.c                          |   13 
 drivers/scsi/qla2xxx/qla_isr.c                           |    7 
 drivers/scsi/qla2xxx/qla_mbx.c                           |    3 
 drivers/scsi/qla2xxx/qla_mid.c                           |   42 -
 drivers/scsi/qla2xxx/qla_os.c                            |   51 -
 drivers/scsi/qla2xxx/qla_target.c                        |   26 
 drivers/scsi/scsi_error.c                                |    5 
 drivers/scsi/scsi_lib.c                                  |    2 
 drivers/virtio/virtio_ring.c                             |    2 
 drivers/watchdog/hpwdt.c                                 |  507 ---------------
 fs/nfs/direct.c                                          |    2 
 fs/nfs/pnfs.c                                            |   13 
 fs/nfs/write.c                                           |   83 +-
 include/drm/drm_crtc_helper.h                            |    1 
 include/drm/drm_drv.h                                    |    1 
 include/linux/compiler-clang.h                           |    5 
 include/linux/compiler-gcc.h                             |    4 
 include/linux/init.h                                     |    8 
 include/linux/nospec.h                                   |   23 
 include/linux/tpm.h                                      |    1 
 include/linux/workqueue.h                                |    1 
 include/scsi/scsi_cmnd.h                                 |    3 
 include/scsi/scsi_host.h                                 |    2 
 kernel/workqueue.c                                       |   16 
 lib/bug.c                                                |    2 
 mm/memblock.c                                            |   10 
 net/bridge/netfilter/ebt_among.c                         |   21 
 net/bridge/netfilter/ebtables.c                          |   13 
 net/ipv4/netfilter/arp_tables.c                          |    4 
 net/ipv4/netfilter/ip_tables.c                           |    7 
 net/ipv4/netfilter/ipt_CLUSTERIP.c                       |   12 
 net/ipv6/netfilter.c                                     |    9 
 net/ipv6/netfilter/ip6_tables.c                          |    4 
 net/ipv6/netfilter/nf_nat_l3proto_ipv6.c                 |    4 
 net/netfilter/nf_nat_proto_common.c                      |    7 
 net/netfilter/xt_IDLETIMER.c                             |    9 
 net/netfilter/xt_LED.c                                   |   12 
 net/netfilter/xt_hashlimit.c                             |    2 
 net/smc/af_smc.c                                         |    4 
 scripts/Makefile.build                                   |    8 
 scripts/Makefile.lib                                     |    8 
 sound/core/seq/seq_clientmgr.c                           |   21 
 sound/core/seq/seq_fifo.c                                |    2 
 sound/core/seq/seq_memory.c                              |   14 
 sound/core/seq/seq_memory.h                              |    3 
 sound/pci/hda/patch_conexant.c                           |    2 
 sound/pci/hda/patch_realtek.c                            |   45 +
 sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c      |    2 
 tools/objtool/builtin-check.c                            |    6 
 tools/objtool/builtin-orc.c                              |    6 
 tools/objtool/builtin.h                                  |    5 
 tools/objtool/check.c                                    |   93 ++
 tools/objtool/check.h                                    |    3 
 tools/perf/util/trigger.h                                |    9 
 135 files changed, 1478 insertions(+), 1393 deletions(-)

Adrian Hunter (1):
perf tools: Fix trigger class trigger_on()

Alex Deucher (6):
drm/amd/powerplay/smu7: allow mclk switching with no displays drm/amd/powerplay/vega10: allow mclk switching with no displays Revert "drm/radeon/pm: autoswitch power state when in balanced mode" drm/amdgpu: used cached pcie gen info for SI (v2) drm/radeon: fix KV harvesting
drm/amdgpu: fix KV harvesting

Ard Biesheuvel (1):
arm64: mm: fix thinko in non-global page table attribute check

Arnd Bergmann (4):
watchdog: hpwdt: fix unused variable warning
ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds
tpm: remove unused variables
dm bufio: avoid false-positive Wmaybe-uninitialized warning

Azhar Shaikh (2):
tpm_tis: Move ilb_base_addr to tpm_tis_data
tpm: Keep CLKRUN enabled throughout the duration of transmit_cmd()

Bart Van Assche (1):
scsi: core: Avoid that ATA error handling can trigger a kernel hang or oops

Ben Crocker (1):
drm/radeon: insist on 32-bit DMA for Cedar on PPC64/PPC64LE

Benjamin Berg (1):
ALSA: hda/realtek: Limit mic boost on T480

Chintan Patel (1):
ASoC: Intel: Skylake: Fix jack name format substitution

Chris Fries (1):
kbuild: Set KBUILD_CFLAGS before incl. arch Makefile

Chris Wilson (1):
drm/i915: Clear the in-use marker on execbuf failure

Colin Ian King (2):
MIPS: ath25: Check for kzalloc allocation failure
MIPS: OCTEON: irq: Check for null return on kzalloc allocation

Cong Wang (1):
netfilter: ipt_CLUSTERIP: fix a race condition of proc file creation

Dan Williams (2):
nospec: Kill array_index_nospec_mask_check()
nospec: Include <asm/barrier.h> dependency

Daniel Vacek (1):
mm/memblock.c: hardcode the end_pfn being -1

Daniele Ceraolo Spurio (1):
drm/i915: Fix rsvd2 mask when out-fence is returned

David Hildenbrand (1):
KVM: s390: fix memory overwrites when not using SCA entries

David Woodhouse (3):
Revert "x86/retpoline: Simplify vmexit_fill_RSB()" x86/speculation: Use IBRS if available before calling into firmware x86/retpoline: Support retpoline builds with Clang

Davide Caratti (1):
net/smc: fix NULL pointer dereference on sock_create_kern() error path

Dennis Wassenberg (3):
ALSA: hda/realtek - Make dock sound work on ThinkPad L570
ALSA: hda: add dock and led support for HP EliteBook 820 G3
ALSA: hda: add dock and led support for HP ProBook 640 G2

Dominik Brodowski (2):
x86/entry: Reduce the code footprint of the 'idtentry' macro x86/entry/64: Use 'xorl' for faster register clearing

Eric Dumazet (3):
netfilter: xt_hashlimit: fix lock imbalance
netfilter: IDLETIMER: be syzkaller friendly
netfilter: use skb_to_full_sk in ip6_route_me_harder

Eric Huang (1):
drm/amd/powerplay: fix power over limit on Fiji

Fabrice Gasnier (1):
regulator: stm32-vrefbuf: fix check on ready flag

Florian Westphal (4):
netfilter: add back stackpointer size checks
netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
netfilter: bridge: ebt_among: add missing match size checks
netfilter: ipv6: fix use-after-free Write in nf_nat_ipv6_manip_pkt

Francis Deslauriers (1):
x86/kprobes: Fix kernel crash when probing .entry_trampoline code

Giridhar Malavali (2):
scsi: qla2xxx: Defer processing of GS IOCB calls
scsi: qla2xxx: Remove aborting ELS IOCB call issued as part of timeout.

Greg Kroah-Hartman (1):

      Linux 4.14.27

Hui Wang (1):
ALSA: hda - Fix a wrong FIXUP for alc289 on Dell machines

Ilia Mirkin (1):
drm/nouveau: prefer XBGR2101010 for addfb ioctl

Ingo Molnar (1):
x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP

James Hogan (1):
kbuild: Handle builtin dtb file names containing hyphens

James Zhu (2):
drm/amdgpu:Correct max uvd handles drm/amdgpu:Always save uvd vcpu_bo in VM Mode

Jan Beulich (3):
x86/asm: Improve how GEN_*_SUFFIXED_RMWcc() specify clobbers x86/LDT: Avoid warning in 32-bit builds with older gcc x86-64/realmode: Add instruction suffix

Jann Horn (1):
x86/mm: Remove stale comment about KMEMCHECK

Jason Gunthorpe (1):
IB/uverbs: Improve lockdep_check

Javier Martinez Canillas (2):
tpm: delete the TPM_TIS_CLK_ENABLE flag
tpm: only attempt to disable the LPC CLKRUN if is already enabled

Jerry Hoemann (3):
watchdog: hpwdt: SMBIOS check
watchdog: hpwdt: Check source of NMI
watchdog: hpwdt: Remove legacy NMI sourcing.

Josh Poimboeuf (2):
objtool: Fix another switch table detection issue
objtool: Fix 32-bit build

Justin Chen (1):
MIPS: BMIPS: Do not mask IPIs during suspend

Kailang Yang (2):
ALSA: hda/realtek - Add support headset mode for DELL WYSE
ALSA: hda/realtek - Add headset mode support for Dell laptop

Kees Cook (1):
lib/bug.c: exclude non-BUG/WARN exceptions from report_bug()

Koen Vandeputte (1):
PCI: dwc: Fix enumeration end when reaching root subordinate

Konrad Rzeszutek Wilk (1):
x86/spectre_v2: Don't check microcode versions when running under hypervisors

Leon Romanovsky (3):
RDMA/ucma: Limit possible option size RDMA/ucma: Check that user doesn't overflow QP state RDMA/mlx5: Fix integer overflow while resizing CQ

Lionel Landwerlin (1):
drm/i915/perf: fix perf stream opening lock

Lukas Wunner (5):
workqueue: Allow retrieval of current task's work struct
drm: Allow determining if current task is output poll worker drm/nouveau: Fix deadlock on runtime suspend drm/radeon: Fix deadlock on runtime suspend drm/amdgpu: Fix deadlock on runtime suspend

Maarten Lankhorst (2):
drm/i915: Update watermark state correctly in sanitize_watermarks drm/i915: Always call to intel_display_set_init_power() in resume_early.

Masahiro Yamada (3):
kbuild: move "_all" target out of $(KBUILD_SRC) conditional
kbuild: re-order the code to not parse unnecessary variables
kbuild: move cc-option and cc-disable-warning after incl. arch Makefile

Matthew Wilcox (1):
Documentation/sphinx: Fix Directive import error

Michael Lyle (1):
bcache: don't attach backing with duplicate UUID

Paolo Abeni (2):
netfilter: x_tables: fix missing timer initialization in xt_LED
netfilter: nat: cope with negative port range

Parav Pandit (1):
IB/core: Fix missing RDMA cgroups release in case of failure to register device

Paul Burton (2):
dt-bindings: Document mti,mips-cpc binding
MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base()

Peter Zijlstra (8):
x86/speculation, objtool: Annotate indirect calls/jumps for objtool x86/paravirt, objtool: Annotate indirect calls
x86/boot, objtool: Annotate indirect jump in secondary_startup_64() x86/mm/sme, objtool: Annotate indirect call in sme_encrypt_execute()
objtool: Use existing global variables for options
objtool: Add retpoline validation
objtool: Add module specific retpoline rules
objtool, retpolines: Integrate objtool with retpoline support more closely

Quinn Tran (15):
scsi: qla2xxx: Fix system crash for Notify ack timeout handling
scsi: qla2xxx: Fix gpnid error processing
scsi: qla2xxx: Move session delete to driver work queue
scsi: qla2xxx: Skip IRQ affinity for Target QPairs
scsi: qla2xxx: Fix re-login for Nport Handle in use
scsi: qla2xxx: Retry switch command on time out
scsi: qla2xxx: Serialize GPNID for multiple RSCN
scsi: qla2xxx: Fix login state machine stuck at GPDB
scsi: qla2xxx: Fix Relogin being triggered too fast
scsi: qla2xxx: Fix PRLI state check
scsi: qla2xxx: Fix abort command deadlock due to spinlock
scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport
scsi: qla2xxx: Fix scan state field for fcport
scsi: qla2xxx: Clear loop id after delete
scsi: qla2xxx: Fix system crash in qlt_plogi_ack_unref

Rex Zhu (1):
drm/amdgpu: Notify sbios device ready before send request

Ross Zwisler (1):
loop: Fix lost writes caused by missing flag

Sawan Chandak (1):
scsi: qla2xxx: Fix NPIV host cleanup in target mode

Sergey Gorenko (1):
IB/mlx5: Fix incorrect size of klms in the memory region

Seunghun Han (1):
x86/MCE: Serialize sysfs changes

Stefan Brüns (1):
drm/i915: Try EDID bitbanging on HDMI after failed read

Takashi Iwai (3):
ALSA: hda/realtek - Fix dock line-out volume on Dell Precision 7520
ALSA: seq: Don't allow resizing pool in use
ALSA: seq: More protection for concurrent write and ioctl races

Tang Junhui (1):
bcache: fix crashes in duplicate cache device register

Tiwei Bie (1):
virtio_ring: fix num_free handling in error case

Tony Luck (1):
x86/MCE: Save microcode revision in machine check records

Trond Myklebust (3):
NFS: Fix an incorrect type in struct nfs_direct_req
pNFS: Prevent the layout header refcount going to zero in pnfs_roc()
NFS: Fix unstable write completion

Ville Syrjälä (1):
drm/i915: Disable DC states around GMBUS on GLK

Vinod Koul (1):
ASoC: Intel: kbl: fix jack name

Zhang Bo (1):
Input: matrix_keypad - fix race when disabling interrupts

[email protected] (4):
scsi: qla2xxx: Fix memory leak in dual/target mode
scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
scsi: qla2xxx: Fix NULL pointer crash due to probe failure
scsi: qla2xxx: Fix recursion while sending terminate exchange

author maintainer
#1 lore raw
Documentation/devicetree/bindings/power/mti,mips-cpc.txt new file +8 -0
new file mode 100644
index 000000000000..c6b82511ae8a
@@ -0,0 +1,8 @@
+Binding for MIPS Cluster Power Controller (CPC).
+
+This binding allows a system to specify where the CPC registers are
+located.
+
+Required properties:
+compatible : Should be "mti,mips-cpc".
+regs: Should describe the address & size of the CPC register region.
Documentation/sphinx/kerneldoc.py +1 -2
index 39aa9e8697cc..fbedcc39460b 100644
@@ -36,8 +36,7 @@ import glob
 
 from docutils import nodes, statemachine
 from docutils.statemachine import ViewList
-from docutils.parsers.rst import directives
-from sphinx.util.compat import Directive
+from docutils.parsers.rst import directives, Directive
 from sphinx.ext.autodoc import AutodocReporter
 
 __version__  = '1.0'
MAINTAINERS +1 -0
index 76ea063d8083..546beb6b0176 100644
@@ -9001,6 +9001,7 @@ MIPS GENERIC PLATFORM
 M:	Paul Burton <[email protected]>
 L:	[email protected]
 S:	Supported
+F:	Documentation/devicetree/bindings/power/mti,mips-cpc.txt
 F:	arch/mips/generic/
 F:	arch/mips/tools/generic-board-config.sh
 
Makefile +135 -124

336 lines not on this page · raw message

arch/arm/mach-omap2/omap-secure.c +2 -0
index 9ff92050053c..fa7f308c9027 100644
@@ -73,6 +73,7 @@ phys_addr_t omap_secure_ram_mempool_base(void)
 	return omap_secure_memblock_base;
 }
 
+#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
 u32 omap3_save_secure_ram(void __iomem *addr, int size)
 {
 	u32 ret;
@@ -91,6 +92,7 @@ u32 omap3_save_secure_ram(void __iomem *addr, int size)
 
 	return ret;
 }
+#endif
 
 /**
  * rx51_secure_dispatcher: Routine to dispatch secure PPA API calls
arch/arm64/mm/mmu.c +4 -4
index fa20124c19d5..01bc0688d47d 100644
@@ -107,7 +107,7 @@ static bool pgattr_change_is_safe(u64 old, u64 new)
 	 * The following mapping attributes may be updated in live
 	 * kernel mappings without the need for break-before-make.
 	 */
-	static const pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE;
+	static const pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE | PTE_NG;
 
 	/* creating or taking down mappings is always safe */
 	if (old == 0 || new == 0)
@@ -117,9 +117,9 @@ static bool pgattr_change_is_safe(u64 old, u64 new)
 	if ((old | new) & PTE_CONT)
 		return false;
 
-	/* Transitioning from Global to Non-Global is safe */
-	if (((old ^ new) == PTE_NG) && (new & PTE_NG))
-		return true;
+	/* Transitioning from Non-Global to Global is unsafe */
+	if (old & ~new & PTE_NG)
+		return false;
 
 	return ((old ^ new) & ~mask) == 0;
 }
arch/mips/ath25/board.c +2 -0
index 9ab48ff80c1c..6d11ae581ea7 100644
@@ -135,6 +135,8 @@ int __init ath25_find_config(phys_addr_t base, unsigned long size)
 	}
 
 	board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL);
+	if (!board_data)
+		goto error;
 	ath25_board.config = (struct ath25_boarddata *)board_data;
 	memcpy_fromio(board_data, bcfg, 0x100);
 	if (broken_boarddata) {
arch/mips/cavium-octeon/octeon-irq.c +2 -0
index 5b3a3f6a9ad3..d99f5242169e 100644
@@ -2277,6 +2277,8 @@ static int __init octeon_irq_init_cib(struct device_node *ciu_node,
 	}
 
 	host_data = kzalloc(sizeof(*host_data), GFP_KERNEL);
+	if (!host_data)
+		return -ENOMEM;
 	raw_spin_lock_init(&host_data->lock);
 
 	addr = of_get_address(ciu_node, 0, NULL, NULL);
arch/mips/kernel/mips-cpc.c +13 -0
index 19c88d770054..fcf9af492d60 100644
@@ -10,6 +10,8 @@
 
 #include <linux/errno.h>
 #include <linux/percpu.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/spinlock.h>
 
 #include <asm/mips-cps.h>
@@ -22,6 +24,17 @@ static DEFINE_PER_CPU_ALIGNED(unsigned long, cpc_core_lock_flags);
 
 phys_addr_t __weak mips_cpc_default_phys_base(void)
 {
+	struct device_node *cpc_node;
+	struct resource res;
+	int err;
+
+	cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
+	if (cpc_node) {
+		err = of_address_to_resource(cpc_node, 0, &res);
+		if (!err)
+			return res.start;
+	}
+
 	return 0;
 }
 
arch/mips/kernel/smp-bmips.c +4 -4
index 87dcac2447c8..382d12eb88f0 100644
@@ -168,11 +168,11 @@ static void bmips_prepare_cpus(unsigned int max_cpus)
 		return;
 	}
 
-	if (request_irq(IPI0_IRQ, bmips_ipi_interrupt, IRQF_PERCPU,
-			"smp_ipi0", NULL))
+	if (request_irq(IPI0_IRQ, bmips_ipi_interrupt,
+			IRQF_PERCPU | IRQF_NO_SUSPEND, "smp_ipi0", NULL))
 		panic("Can't request IPI0 interrupt");
-	if (request_irq(IPI1_IRQ, bmips_ipi_interrupt, IRQF_PERCPU,
-			"smp_ipi1", NULL))
+	if (request_irq(IPI1_IRQ, bmips_ipi_interrupt,
+			IRQF_PERCPU | IRQF_NO_SUSPEND, "smp_ipi1", NULL))
 		panic("Can't request IPI1 interrupt");
 }
 
arch/s390/kvm/kvm-s390.c +1 -0
index f4f12ecd0cec..0fa3a788dd20 100644
@@ -2119,6 +2119,7 @@ static void sca_add_vcpu(struct kvm_vcpu *vcpu)
 		/* we still need the basic sca for the ipte control */
 		vcpu->arch.sie_block->scaoh = (__u32)(((__u64)sca) >> 32);
 		vcpu->arch.sie_block->scaol = (__u32)(__u64)sca;
+		return;
 	}
 	read_lock(&vcpu->kvm->arch.sca_lock);
 	if (vcpu->kvm->arch.use_esca) {
arch/x86/Kconfig +1 -0
index 559b37bf5a2e..7483cd514c32 100644
@@ -431,6 +431,7 @@ config GOLDFISH
 config RETPOLINE
 	bool "Avoid speculative indirect branches in kernel"
 	default y
+	select STACK_VALIDATION if HAVE_STACK_VALIDATION
 	help
 	  Compile kernel with the retpoline compiler options to guard against
 	  kernel-to-user data leaks by avoiding speculative indirect
arch/x86/Makefile +3 -4
index fad55160dcb9..498c1b812300 100644
@@ -232,10 +232,9 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 
 # Avoid indirect branches in kernel to deal with Spectre
 ifdef CONFIG_RETPOLINE
-    RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
-    ifneq ($(RETPOLINE_CFLAGS),)
-        KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
-    endif
+ifneq ($(RETPOLINE_CFLAGS),)
+  KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
+endif
 endif
 
 archscripts: scripts_basic
arch/x86/entry/calling.h +18 -9
index dce7092ab24a..5d10b7a85cad 100644
@@ -97,7 +97,7 @@ For 32-bit we have the following conventions - kernel is built with
 
 #define SIZEOF_PTREGS	21*8
 
-.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax
+.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0
 	/*
 	 * Push registers and sanitize registers of values that a
 	 * speculation attack might otherwise want to exploit. The
@@ -105,32 +105,41 @@ For 32-bit we have the following conventions - kernel is built with
 	 * could be put to use in a speculative execution gadget.
 	 * Interleave XOR with PUSH for better uop scheduling:
 	 */
+	.if \save_ret
+	pushq	%rsi		/* pt_regs->si */
+	movq	8(%rsp), %rsi	/* temporarily store the return address in %rsi */
+	movq	%rdi, 8(%rsp)	/* pt_regs->di (overwriting original return address) */
+	.else
 	pushq   %rdi		/* pt_regs->di */
 	pushq   %rsi		/* pt_regs->si */
+	.endif
 	pushq	\rdx		/* pt_regs->dx */
 	pushq   %rcx		/* pt_regs->cx */
 	pushq   \rax		/* pt_regs->ax */
 	pushq   %r8		/* pt_regs->r8 */
-	xorq    %r8, %r8	/* nospec   r8 */
+	xorl	%r8d, %r8d	/* nospec   r8 */
 	pushq   %r9		/* pt_regs->r9 */
-	xorq    %r9, %r9	/* nospec   r9 */
+	xorl	%r9d, %r9d	/* nospec   r9 */
 	pushq   %r10		/* pt_regs->r10 */
-	xorq    %r10, %r10	/* nospec   r10 */
+	xorl	%r10d, %r10d	/* nospec   r10 */
 	pushq   %r11		/* pt_regs->r11 */
-	xorq    %r11, %r11	/* nospec   r11*/
+	xorl	%r11d, %r11d	/* nospec   r11*/
 	pushq	%rbx		/* pt_regs->rbx */
 	xorl    %ebx, %ebx	/* nospec   rbx*/
 	pushq	%rbp		/* pt_regs->rbp */
 	xorl    %ebp, %ebp	/* nospec   rbp*/
 	pushq	%r12		/* pt_regs->r12 */
-	xorq    %r12, %r12	/* nospec   r12*/
+	xorl	%r12d, %r12d	/* nospec   r12*/
 	pushq	%r13		/* pt_regs->r13 */
-	xorq    %r13, %r13	/* nospec   r13*/
+	xorl	%r13d, %r13d	/* nospec   r13*/
 	pushq	%r14		/* pt_regs->r14 */
-	xorq    %r14, %r14	/* nospec   r14*/
+	xorl	%r14d, %r14d	/* nospec   r14*/
 	pushq	%r15		/* pt_regs->r15 */
-	xorq    %r15, %r15	/* nospec   r15*/
+	xorl	%r15d, %r15d	/* nospec   r15*/
 	UNWIND_HINT_REGS
+	.if \save_ret
+	pushq	%rsi		/* return address on top of stack */
+	.endif
 .endm
 
 .macro POP_REGS pop_rdi=1 skip_r11rcx=0
arch/x86/entry/entry_32.S +1 -2
index 2a35b1e0fb90..60c4c342316c 100644
@@ -252,8 +252,7 @@ ENTRY(__switch_to_asm)
 	 * exist, overwrite the RSB with entries which capture
 	 * speculative execution to prevent attack.
 	 */
-	/* Clobbers %ebx */
-	FILL_RETURN_BUFFER RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW
+	FILL_RETURN_BUFFER %ebx, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW
 #endif
 
 	/* restore callee-saved registers */
arch/x86/entry/entry_64.S +9 -12
index 68a2d76e4f8f..6f3cc15e0c73 100644
@@ -360,8 +360,7 @@ ENTRY(__switch_to_asm)
 	 * exist, overwrite the RSB with entries which capture
 	 * speculative execution to prevent attack.
 	 */
-	/* Clobbers %rbx */
-	FILL_RETURN_BUFFER RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW
+	FILL_RETURN_BUFFER %r12, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW
 #endif
 
 	/* restore callee-saved registers */
@@ -867,12 +866,8 @@ ENTRY(\sym)
 	pushq	$-1				/* ORIG_RAX: no syscall to restart */
 	.endif
 
-	/* Save all registers in pt_regs */
-	PUSH_AND_CLEAR_REGS
-	ENCODE_FRAME_POINTER
-
 	.if \paranoid < 2
-	testb	$3, CS(%rsp)			/* If coming from userspace, switch stacks */
+	testb	$3, CS-ORIG_RAX(%rsp)		/* If coming from userspace, switch stacks */
 	jnz	.Lfrom_usermode_switch_stack_\@
 	.endif
 
@@ -1117,13 +1112,15 @@ idtentry machine_check		do_mce			has_error_code=0	paranoid=1
 #endif
 
 /*
- * Switch gs if needed.
+ * Save all registers in pt_regs, and switch gs if needed.
  * Use slow, but surefire "are we in kernel?" check.
  * Return: ebx=0: need swapgs on exit, ebx=1: otherwise
  */
 ENTRY(paranoid_entry)
 	UNWIND_HINT_FUNC
 	cld
+	PUSH_AND_CLEAR_REGS save_ret=1
+	ENCODE_FRAME_POINTER 8
 	movl	$1, %ebx
 	movl	$MSR_GS_BASE, %ecx
 	rdmsr
@@ -1168,12 +1165,14 @@ ENTRY(paranoid_exit)
 END(paranoid_exit)
 
 /*
- * Switch gs if needed.
+ * Save all registers in pt_regs, and switch GS if needed.
  * Return: EBX=0: came from user mode; EBX=1: otherwise
  */
 ENTRY(error_entry)
-	UNWIND_HINT_REGS offset=8
+	UNWIND_HINT_FUNC
 	cld
+	PUSH_AND_CLEAR_REGS save_ret=1
+	ENCODE_FRAME_POINTER 8
 	testb	$3, CS+8(%rsp)
 	jz	.Lerror_kernelspace
 
@@ -1564,8 +1563,6 @@ end_repeat_nmi:
 	 * frame to point back to repeat_nmi.
 	 */
 	pushq	$-1				/* ORIG_RAX: no syscall to restart */
-	PUSH_AND_CLEAR_REGS
-	ENCODE_FRAME_POINTER
 
 	/*
 	 * Use paranoid_entry to handle SWAPGS, but no need to use paranoid_exit
arch/x86/entry/entry_64_compat.S +27 -27

111 lines not on this page · raw message

arch/x86/include/asm/apm.h +6 -0
index 4d4015ddcf26..c356098b6fb9 100644
@@ -7,6 +7,8 @@
 #ifndef _ASM_X86_MACH_DEFAULT_APM_H
 #define _ASM_X86_MACH_DEFAULT_APM_H
 
+#include <asm/nospec-branch.h>
+
 #ifdef APM_ZERO_SEGS
 #	define APM_DO_ZERO_SEGS \
 		"pushl %%ds\n\t" \
@@ -32,6 +34,7 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
 	 * N.B. We do NOT need a cld after the BIOS call
 	 * because we always save and restore the flags.
 	 */
+	firmware_restrict_branch_speculation_start();
 	__asm__ __volatile__(APM_DO_ZERO_SEGS
 		"pushl %%edi\n\t"
 		"pushl %%ebp\n\t"
@@ -44,6 +47,7 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
 		  "=S" (*esi)
 		: "a" (func), "b" (ebx_in), "c" (ecx_in)
 		: "memory", "cc");
+	firmware_restrict_branch_speculation_end();
 }
 
 static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
@@ -56,6 +60,7 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
 	 * N.B. We do NOT need a cld after the BIOS call
 	 * because we always save and restore the flags.
 	 */
+	firmware_restrict_branch_speculation_start();
 	__asm__ __volatile__(APM_DO_ZERO_SEGS
 		"pushl %%edi\n\t"
 		"pushl %%ebp\n\t"
@@ -68,6 +73,7 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
 		  "=S" (si)
 		: "a" (func), "b" (ebx_in), "c" (ecx_in)
 		: "memory", "cc");
+	firmware_restrict_branch_speculation_end();
 	return error;
 }
 
arch/x86/include/asm/asm-prototypes.h +0 -3
index 4d111616524b..1908214b9125 100644
@@ -38,7 +38,4 @@ INDIRECT_THUNK(dx)
 INDIRECT_THUNK(si)
 INDIRECT_THUNK(di)
 INDIRECT_THUNK(bp)
-asmlinkage void __fill_rsb(void);
-asmlinkage void __clear_rsb(void);
-
 #endif /* CONFIG_RETPOLINE */
arch/x86/include/asm/cpufeatures.h +1 -0
index 73b5fff159a4..66c14347c502 100644
@@ -211,6 +211,7 @@
 #define X86_FEATURE_RSB_CTXSW		( 7*32+19) /* "" Fill RSB on context switches */
 
 #define X86_FEATURE_USE_IBPB		( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */
+#define X86_FEATURE_USE_IBRS_FW		( 7*32+22) /* "" Use IBRS during runtime firmware calls */
 
 /* Virtualization flags: Linux defined, word 8 */
 #define X86_FEATURE_TPR_SHADOW		( 8*32+ 0) /* Intel TPR Shadow */
arch/x86/include/asm/efi.h +15 -2
index 85f6ccb80b91..a399c1ebf6f0 100644
@@ -6,6 +6,7 @@
 #include <asm/pgtable.h>
 #include <asm/processor-flags.h>
 #include <asm/tlb.h>
+#include <asm/nospec-branch.h>
 
 /*
  * We map the EFI regions needed for runtime services non-contiguously,
@@ -36,8 +37,18 @@
 
 extern asmlinkage unsigned long efi_call_phys(void *, ...);
 
-#define arch_efi_call_virt_setup()	kernel_fpu_begin()
-#define arch_efi_call_virt_teardown()	kernel_fpu_end()
+#define arch_efi_call_virt_setup()					\
+({									\
+	kernel_fpu_begin();						\
+	firmware_restrict_branch_speculation_start();			\
+})
+
+#define arch_efi_call_virt_teardown()					\
+({									\
+	firmware_restrict_branch_speculation_end();			\
+	kernel_fpu_end();						\
+})
+
 
 /*
  * Wrap all the virtual calls in a way that forces the parameters on the stack.
@@ -73,6 +84,7 @@ struct efi_scratch {
 	efi_sync_low_kernel_mappings();					\
 	preempt_disable();						\
 	__kernel_fpu_begin();						\
+	firmware_restrict_branch_speculation_start();			\
 									\
 	if (efi_scratch.use_pgd) {					\
 		efi_scratch.prev_cr3 = __read_cr3();			\
@@ -91,6 +103,7 @@ struct efi_scratch {
 		__flush_tlb_all();					\
 	}								\
 									\
+	firmware_restrict_branch_speculation_end();			\
 	__kernel_fpu_end();						\
 	preempt_enable();						\
 })
arch/x86/include/asm/mmu_context.h +1 -0
index c931b88982a0..1de72ce514cd 100644
@@ -74,6 +74,7 @@ static inline void *ldt_slot_va(int slot)
 	return (void *)(LDT_BASE_ADDR + LDT_SLOT_STRIDE * slot);
 #else
 	BUG();
+	return (void *)fix_to_virt(FIX_HOLE);
 #endif
 }
 
arch/x86/include/asm/nospec-branch.h +118 -20

195 lines not on this page · raw message

arch/x86/include/asm/paravirt.h +13 -4
index 554841fab717..c83a2f418cea 100644
@@ -7,6 +7,7 @@
 #ifdef CONFIG_PARAVIRT
 #include <asm/pgtable_types.h>
 #include <asm/asm.h>
+#include <asm/nospec-branch.h>
 
 #include <asm/paravirt_types.h>
 
@@ -879,23 +880,27 @@ extern void default_banner(void);
 
 #define INTERRUPT_RETURN						\
 	PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE,	\
-		  jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret))
+		  ANNOTATE_RETPOLINE_SAFE;					\
+		  jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);)
 
 #define DISABLE_INTERRUPTS(clobbers)					\
 	PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \
 		  PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE);		\
+		  ANNOTATE_RETPOLINE_SAFE;					\
 		  call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable);	\
 		  PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
 
 #define ENABLE_INTERRUPTS(clobbers)					\
 	PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers,	\
 		  PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE);		\
+		  ANNOTATE_RETPOLINE_SAFE;					\
 		  call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable);	\
 		  PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
 
 #ifdef CONFIG_X86_32
 #define GET_CR0_INTO_EAX				\
 	push %ecx; push %edx;				\
+	ANNOTATE_RETPOLINE_SAFE;				\
 	call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0);	\
 	pop %edx; pop %ecx
 #else	/* !CONFIG_X86_32 */
@@ -917,21 +922,25 @@ extern void default_banner(void);
  */
 #define SWAPGS								\
 	PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE,	\
-		  call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs)		\
+		  ANNOTATE_RETPOLINE_SAFE;					\
+		  call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs);		\
 		 )
 
 #define GET_CR2_INTO_RAX				\
-	call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2)
+	ANNOTATE_RETPOLINE_SAFE;				\
+	call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2);
 
 #define USERGS_SYSRET64							\
 	PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64),	\
 		  CLBR_NONE,						\
-		  jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64))
+		  ANNOTATE_RETPOLINE_SAFE;					\
+		  jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);)
 
 #ifdef CONFIG_DEBUG_ENTRY
 #define SAVE_FLAGS(clobbers)                                        \
 	PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \
 		  PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE);        \
+		  ANNOTATE_RETPOLINE_SAFE;				    \
 		  call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl);    \
 		  PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
 #endif
arch/x86/include/asm/paravirt_types.h +4 -1
index f624f1f10316..180bc0bff0fb 100644
@@ -43,6 +43,7 @@
 #include <asm/desc_defs.h>
 #include <asm/kmap_types.h>
 #include <asm/pgtable_types.h>
+#include <asm/nospec-branch.h>
 
 struct page;
 struct thread_struct;
@@ -392,7 +393,9 @@ int paravirt_disable_iospace(void);
  * offset into the paravirt_patch_template structure, and can therefore be
  * freely converted back into a structure offset.
  */
-#define PARAVIRT_CALL	"call *%c[paravirt_opptr];"
+#define PARAVIRT_CALL					\
+	ANNOTATE_RETPOLINE_SAFE				\
+	"call *%c[paravirt_opptr];"
 
 /*
  * These macros are intended to wrap calls through one of the paravirt
arch/x86/include/asm/refcount.h +2 -2
index 4e44250e7d0d..d65171120e90 100644
@@ -67,13 +67,13 @@ static __always_inline __must_check
 bool refcount_sub_and_test(unsigned int i, refcount_t *r)
 {
 	GEN_BINARY_SUFFIXED_RMWcc(LOCK_PREFIX "subl", REFCOUNT_CHECK_LT_ZERO,
-				  r->refs.counter, "er", i, "%0", e);
+				  r->refs.counter, "er", i, "%0", e, "cx");
 }
 
 static __always_inline __must_check bool refcount_dec_and_test(refcount_t *r)
 {
 	GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", REFCOUNT_CHECK_LT_ZERO,
-				 r->refs.counter, "%0", e);
+				 r->refs.counter, "%0", e, "cx");
 }
 
 static __always_inline __must_check
arch/x86/include/asm/rmwcc.h +8 -8
index f91c365e57c3..4914a3e7c803 100644
@@ -2,8 +2,7 @@
 #ifndef _ASM_X86_RMWcc
 #define _ASM_X86_RMWcc
 
-#define __CLOBBERS_MEM		"memory"
-#define __CLOBBERS_MEM_CC_CX	"memory", "cc", "cx"
+#define __CLOBBERS_MEM(clb...)	"memory", ## clb
 
 #if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CC_HAVE_ASM_GOTO)
 
@@ -40,18 +39,19 @@ do {									\
 #endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */
 
 #define GEN_UNARY_RMWcc(op, var, arg0, cc)				\
-	__GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM)
+	__GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM())
 
-#define GEN_UNARY_SUFFIXED_RMWcc(op, suffix, var, arg0, cc)		\
+#define GEN_UNARY_SUFFIXED_RMWcc(op, suffix, var, arg0, cc, clobbers...)\
 	__GEN_RMWcc(op " " arg0 "\n\t" suffix, var, cc,			\
-		    __CLOBBERS_MEM_CC_CX)
+		    __CLOBBERS_MEM(clobbers))
 
 #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc)			\
 	__GEN_RMWcc(op __BINARY_RMWcc_ARG arg0, var, cc,		\
-		    __CLOBBERS_MEM, vcon (val))
+		    __CLOBBERS_MEM(), vcon (val))
 
-#define GEN_BINARY_SUFFIXED_RMWcc(op, suffix, var, vcon, val, arg0, cc)	\
+#define GEN_BINARY_SUFFIXED_RMWcc(op, suffix, var, vcon, val, arg0, cc,	\
+				  clobbers...)				\
 	__GEN_RMWcc(op __BINARY_RMWcc_ARG arg0 "\n\t" suffix, var, cc,	\
-		    __CLOBBERS_MEM_CC_CX, vcon (val))
+		    __CLOBBERS_MEM(clobbers), vcon (val))
 
 #endif /* _ASM_X86_RMWcc */
arch/x86/include/asm/sections.h +1 -0
index d6baf23782bc..5c019d23d06b 100644
@@ -10,6 +10,7 @@ extern struct exception_table_entry __stop___ex_table[];
 
 #if defined(CONFIG_X86_64)
 extern char __end_rodata_hpage_align[];
+extern char __entry_trampoline_start[], __entry_trampoline_end[];
 #endif
 
 #endif	/* _ASM_X86_SECTIONS_H */
arch/x86/include/uapi/asm/mce.h +1 -0
index 91723461dc1f..435db58a7bad 100644
@@ -30,6 +30,7 @@ struct mce {
 	__u64 synd;	/* MCA_SYND MSR: only valid on SMCA systems */
 	__u64 ipid;	/* MCA_IPID MSR: only valid on SMCA systems */
 	__u64 ppin;	/* Protected Processor Inventory Number */
+	__u32 microcode;/* Microcode revision */
 };
 
 #define MCE_GET_RECORD_LEN   _IOR('M', 1, int)
arch/x86/kernel/cpu/bugs.c +11 -1
index d71c8b54b696..bfca937bdcc3 100644
@@ -300,6 +300,15 @@ static void __init spectre_v2_select_mitigation(void)
 		setup_force_cpu_cap(X86_FEATURE_USE_IBPB);
 		pr_info("Spectre v2 mitigation: Enabling Indirect Branch Prediction Barrier\n");
 	}
+
+	/*
+	 * Retpoline means the kernel is safe because it has no indirect
+	 * branches. But firmware isn't, so use IBRS to protect that.
+	 */
+	if (boot_cpu_has(X86_FEATURE_IBRS)) {
+		setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
+		pr_info("Enabling Restricted Speculation for firmware calls\n");
+	}
 }
 
 #undef pr_fmt
@@ -326,8 +335,9 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
 	if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
 		return sprintf(buf, "Not affected\n");
 
-	return sprintf(buf, "%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
+	return sprintf(buf, "%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
 		       boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : "",
+		       boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", IBRS_FW" : "",
 		       spectre_v2_module_string());
 }
 #endif
arch/x86/kernel/cpu/intel.c +7 -0
index d19e903214b4..4aa9fd379390 100644
@@ -144,6 +144,13 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
 {
 	int i;
 
+	/*
+	 * We know that the hypervisor lie to us on the microcode version so
+	 * we may as well hope that it is running the correct version.
+	 */
+	if (cpu_has(c, X86_FEATURE_HYPERVISOR))
+		return false;
+
 	for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) {
 		if (c->x86_model == spectre_bad_microcodes[i].model &&
 		    c->x86_stepping == spectre_bad_microcodes[i].stepping)
arch/x86/kernel/cpu/mcheck/mce.c +24 -2
index 73237aa271ea..e13d652fc30a 100644
@@ -57,6 +57,9 @@
 
 static DEFINE_MUTEX(mce_log_mutex);
 
+/* sysfs synchronization */
+static DEFINE_MUTEX(mce_sysfs_mutex);
+
 #define CREATE_TRACE_POINTS
 #include <trace/events/mce.h>
 
@@ -131,6 +134,8 @@ void mce_setup(struct mce *m)
 
 	if (this_cpu_has(X86_FEATURE_INTEL_PPIN))
 		rdmsrl(MSR_PPIN, m->ppin);
+
+	m->microcode = boot_cpu_data.microcode;
 }
 
 DEFINE_PER_CPU(struct mce, injectm);
@@ -263,7 +268,7 @@ static void __print_mce(struct mce *m)
 	 */
 	pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x microcode %x\n",
 		m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid,
-		cpu_data(m->extcpu).microcode);
+		m->microcode);
 }
 
 static void print_mce(struct mce *m)
@@ -2081,6 +2086,7 @@ static ssize_t set_ignore_ce(struct device *s,
 	if (kstrtou64(buf, 0, &new) < 0)
 		return -EINVAL;
 
+	mutex_lock(&mce_sysfs_mutex);
 	if (mca_cfg.ignore_ce ^ !!new) {
 		if (new) {
 			/* disable ce features */
@@ -2093,6 +2099,8 @@ static ssize_t set_ignore_ce(struct device *s,
 			on_each_cpu(mce_enable_ce, (void *)1, 1);
 		}
 	}
+	mutex_unlock(&mce_sysfs_mutex);
+
 	return size;
 }
 
@@ -2105,6 +2113,7 @@ static ssize_t set_cmci_disabled(struct device *s,
 	if (kstrtou64(buf, 0, &new) < 0)
 		return -EINVAL;
 
+	mutex_lock(&mce_sysfs_mutex);
 	if (mca_cfg.cmci_disabled ^ !!new) {
 		if (new) {
 			/* disable cmci */
@@ -2116,6 +2125,8 @@ static ssize_t set_cmci_disabled(struct device *s,
 			on_each_cpu(mce_enable_ce, NULL, 1);
 		}
 	}
+	mutex_unlock(&mce_sysfs_mutex);
+
 	return size;
 }
 
@@ -2123,8 +2134,19 @@ static ssize_t store_int_with_restart(struct device *s,
 				      struct device_attribute *attr,
 				      const char *buf, size_t size)
 {
-	ssize_t ret = device_store_int(s, attr, buf, size);
+	unsigned long old_check_interval = check_interval;
+	ssize_t ret = device_store_ulong(s, attr, buf, size);
+
+	if (check_interval == old_check_interval)
+		return ret;
+
+	if (check_interval < 1)
+		check_interval = 1;
+
+	mutex_lock(&mce_sysfs_mutex);
 	mce_restart();
+	mutex_unlock(&mce_sysfs_mutex);
+
 	return ret;
 }
 
arch/x86/kernel/head_64.S +2 -0
index 04a625f0fcda..0f545b3cf926 100644
@@ -23,6 +23,7 @@
 #include <asm/nops.h>
 #include "../entry/calling.h"
 #include <asm/export.h>
+#include <asm/nospec-branch.h>
 
 #ifdef CONFIG_PARAVIRT
 #include <asm/asm-offsets.h>
@@ -134,6 +135,7 @@ ENTRY(secondary_startup_64)
 
 	/* Ensure I am executing from virtual addresses */
 	movq	$1f, %rax
+	ANNOTATE_RETPOLINE_SAFE
 	jmp	*%rax
 1:
 	UNWIND_HINT_EMPTY
arch/x86/kernel/kprobes/core.c +9 -1
index 0742491cbb73..ce06ec9c2323 100644
@@ -1149,10 +1149,18 @@ NOKPROBE_SYMBOL(longjmp_break_handler);
 
 bool arch_within_kprobe_blacklist(unsigned long addr)
 {
+	bool is_in_entry_trampoline_section = false;
+
+#ifdef CONFIG_X86_64
+	is_in_entry_trampoline_section =
+		(addr >= (unsigned long)__entry_trampoline_start &&
+		 addr < (unsigned long)__entry_trampoline_end);
+#endif
 	return  (addr >= (unsigned long)__kprobes_text_start &&
 		 addr < (unsigned long)__kprobes_text_end) ||
 		(addr >= (unsigned long)__entry_text_start &&
-		 addr < (unsigned long)__entry_text_end);
+		 addr < (unsigned long)__entry_text_end) ||
+		is_in_entry_trampoline_section;
 }
 
 int __init arch_init_kprobes(void)
arch/x86/kernel/vmlinux.lds.S +2 -0
index 9b138a06c1a4..b854ebf5851b 100644
@@ -118,9 +118,11 @@ SECTIONS
 
 #ifdef CONFIG_X86_64
 		. = ALIGN(PAGE_SIZE);
+		VMLINUX_SYMBOL(__entry_trampoline_start) = .;
 		_entry_trampoline = .;
 		*(.entry_trampoline)
 		. = ALIGN(PAGE_SIZE);
+		VMLINUX_SYMBOL(__entry_trampoline_end) = .;
 		ASSERT(. - _entry_trampoline == PAGE_SIZE, "entry trampoline is too big");
 #endif
 
arch/x86/lib/Makefile +0 -1
index d0a3170e6804..d435c89875c1 100644
@@ -27,7 +27,6 @@ lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
 lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o
 lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
 lib-$(CONFIG_RETPOLINE) += retpoline.o
-OBJECT_FILES_NON_STANDARD_retpoline.o :=y
 
 obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
 
arch/x86/lib/retpoline.S +0 -56

65 lines not on this page · raw message

arch/x86/mm/fault.c +0 -4
index 9150fe2c9b26..4c155ee0f89e 100644
@@ -1252,10 +1252,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
 	tsk = current;
 	mm = tsk->mm;
 
-	/*
-	 * Detect and handle instructions that would cause a page fault for
-	 * both a tracked kernel page and a userspace page.
-	 */
 	prefetchw(&mm->mmap_sem);
 
 	if (unlikely(kmmio_fault(regs, address)))
arch/x86/mm/mem_encrypt_boot.S +2 -0
index 01f682cf77a8..40a6085063d6 100644
@@ -15,6 +15,7 @@
 #include <asm/page.h>
 #include <asm/processor-flags.h>
 #include <asm/msr-index.h>
+#include <asm/nospec-branch.h>
 
 	.text
 	.code64
@@ -59,6 +60,7 @@ ENTRY(sme_encrypt_execute)
 	movq	%rax, %r8		/* Workarea encryption routine */
 	addq	$PAGE_SIZE, %r8		/* Workarea intermediate copy buffer */
 
+	ANNOTATE_RETPOLINE_SAFE
 	call	*%rax			/* Call the encryption routine */
 
 	pop	%r12
arch/x86/realmode/rm/trampoline_64.S +1 -1
index de53bd15df5a..24bb7598774e 100644
@@ -102,7 +102,7 @@ ENTRY(startup_32)
 	 * don't we'll eventually crash trying to execute encrypted
 	 * instructions.
 	 */
-	bt	$TH_FLAGS_SME_ACTIVE_BIT, pa_tr_flags
+	btl	$TH_FLAGS_SME_ACTIVE_BIT, pa_tr_flags
 	jnc	.Ldone
 	movl	$MSR_K8_SYSCFG, %ecx
 	rdmsr
drivers/block/loop.c +1 -1
index a2a0dce5114e..19858a146f30 100644
@@ -266,7 +266,7 @@ static int lo_write_bvec(struct file *file, struct bio_vec *bvec, loff_t *ppos)
 	struct iov_iter i;
 	ssize_t bw;
 
-	iov_iter_bvec(&i, ITER_BVEC, bvec, 1, bvec->bv_len);
+	iov_iter_bvec(&i, ITER_BVEC | WRITE, bvec, 1, bvec->bv_len);
 
 	file_start_write(file);
 	bw = vfs_iter_write(file, &i, ppos, 0);
drivers/char/tpm/tpm-interface.c +6 -0
index 3cec403a80b3..5294442505cb 100644
@@ -413,6 +413,9 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 	if (chip->dev.parent)
 		pm_runtime_get_sync(chip->dev.parent);
 
+	if (chip->ops->clk_enable != NULL)
+		chip->ops->clk_enable(chip, true);
+
 	/* Store the decision as chip->locality will be changed. */
 	need_locality = chip->locality == -1;
 
@@ -489,6 +492,9 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 		chip->locality = -1;
 	}
 out_no_locality:
+	if (chip->ops->clk_enable != NULL)
+		chip->ops->clk_enable(chip, false);
+
 	if (chip->dev.parent)
 		pm_runtime_put_sync(chip->dev.parent);
 
drivers/char/tpm/tpm_tis.c +0 -108

173 lines not on this page · raw message

drivers/char/tpm/tpm_tis_core.c +115 -6

203 lines not on this page · raw message

drivers/char/tpm/tpm_tis_core.h +16 -0
index 6bbac319ff3b..d5c6a2e952b3 100644
@@ -79,6 +79,11 @@ enum tis_defaults {
 #define	TPM_DID_VID(l)			(0x0F00 | ((l) << 12))
 #define	TPM_RID(l)			(0x0F04 | ((l) << 12))
 
+#define LPC_CNTRL_OFFSET		0x84
+#define LPC_CLKRUN_EN			(1 << 2)
+#define INTEL_LEGACY_BLK_BASE_ADDR	0xFED08000
+#define ILB_REMAP_SIZE			0x100
+
 enum tpm_tis_flags {
 	TPM_TIS_ITPM_WORKAROUND		= BIT(0),
 };
@@ -89,6 +94,8 @@ struct tpm_tis_data {
 	int irq;
 	bool irq_tested;
 	unsigned int flags;
+	void __iomem *ilb_base_addr;
+	u16 clkrun_enabled;
 	wait_queue_head_t int_queue;
 	wait_queue_head_t read_queue;
 	const struct tpm_tis_phy_ops *phy_ops;
@@ -144,6 +151,15 @@ static inline int tpm_tis_write32(struct tpm_tis_data *data, u32 addr,
 	return data->phy_ops->write32(data, addr, value);
 }
 
+static inline bool is_bsw(void)
+{
+#ifdef CONFIG_X86
+	return ((boot_cpu_data.x86_model == INTEL_FAM6_ATOM_AIRMONT) ? 1 : 0);
+#else
+	return false;
+#endif
+}
+
 void tpm_tis_remove(struct tpm_chip *chip);
 int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		      const struct tpm_tis_phy_ops *phy_ops,
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
index 57afad79f55d..8fa850a070e0 100644
@@ -540,6 +540,9 @@ int amdgpu_acpi_pcie_performance_request(struct amdgpu_device *adev,
 	size_t size;
 	u32 retry = 3;
 
+	if (amdgpu_acpi_pcie_notify_device_ready(adev))
+		return -EINVAL;
+
 	/* Get the device handle */
 	handle = ACPI_HANDLE(&adev->pdev->dev);
 	if (!handle)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +38 -20

106 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +8 -5
index e19928dae8e3..17deca0f6255 100644
@@ -293,12 +293,15 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 	if (adev->uvd.vcpu_bo == NULL)
 		return 0;
 
-	for (i = 0; i < adev->uvd.max_handles; ++i)
-		if (atomic_read(&adev->uvd.handles[i]))
-			break;
+	/* only valid for physical mode */
+	if (adev->asic_type < CHIP_POLARIS10) {
+		for (i = 0; i < adev->uvd.max_handles; ++i)
+			if (atomic_read(&adev->uvd.handles[i]))
+				break;
 
-	if (i == AMDGPU_MAX_UVD_HANDLES)
-		return 0;
+		if (i == adev->uvd.max_handles)
+			return 0;
+	}
 
 	cancel_delayed_work_sync(&adev->uvd.idle_work);
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -28
index 00868764a0dd..6f76b2646465 100644
@@ -4387,34 +4387,8 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
 	case CHIP_KAVERI:
 		adev->gfx.config.max_shader_engines = 1;
 		adev->gfx.config.max_tile_pipes = 4;
-		if ((adev->pdev->device == 0x1304) ||
-		    (adev->pdev->device == 0x1305) ||
-		    (adev->pdev->device == 0x130C) ||
-		    (adev->pdev->device == 0x130F) ||
-		    (adev->pdev->device == 0x1310) ||
-		    (adev->pdev->device == 0x1311) ||
-		    (adev->pdev->device == 0x131C)) {
-			adev->gfx.config.max_cu_per_sh = 8;
-			adev->gfx.config.max_backends_per_se = 2;
-		} else if ((adev->pdev->device == 0x1309) ||
-			   (adev->pdev->device == 0x130A) ||
-			   (adev->pdev->device == 0x130D) ||
-			   (adev->pdev->device == 0x1313) ||
-			   (adev->pdev->device == 0x131D)) {
-			adev->gfx.config.max_cu_per_sh = 6;
-			adev->gfx.config.max_backends_per_se = 2;
-		} else if ((adev->pdev->device == 0x1306) ||
-			   (adev->pdev->device == 0x1307) ||
-			   (adev->pdev->device == 0x130B) ||
-			   (adev->pdev->device == 0x130E) ||
-			   (adev->pdev->device == 0x1315) ||
-			   (adev->pdev->device == 0x131B)) {
-			adev->gfx.config.max_cu_per_sh = 4;
-			adev->gfx.config.max_backends_per_se = 1;
-		} else {
-			adev->gfx.config.max_cu_per_sh = 3;
-			adev->gfx.config.max_backends_per_se = 1;
-		}
+		adev->gfx.config.max_cu_per_sh = 8;
+		adev->gfx.config.max_backends_per_se = 2;
 		adev->gfx.config.max_sh_per_se = 1;
 		adev->gfx.config.max_texture_channel_caches = 4;
 		adev->gfx.config.max_gprs = 256;
drivers/gpu/drm/amd/amdgpu/si.c +10 -12
index 8284d5dbfc30..4c178feeb4bd 100644
@@ -31,6 +31,7 @@
 #include "amdgpu_uvd.h"
 #include "amdgpu_vce.h"
 #include "atom.h"
+#include "amd_pcie.h"
 #include "amdgpu_powerplay.h"
 #include "sid.h"
 #include "si_ih.h"
@@ -1461,8 +1462,8 @@ static void si_pcie_gen3_enable(struct amdgpu_device *adev)
 {
 	struct pci_dev *root = adev->pdev->bus->self;
 	int bridge_pos, gpu_pos;
-	u32 speed_cntl, mask, current_data_rate;
-	int ret, i;
+	u32 speed_cntl, current_data_rate;
+	int i;
 	u16 tmp16;
 
 	if (pci_is_root_bus(adev->pdev->bus))
@@ -1474,23 +1475,20 @@ static void si_pcie_gen3_enable(struct amdgpu_device *adev)
 	if (adev->flags & AMD_IS_APU)
 		return;
 
-	ret = drm_pcie_get_speed_cap_mask(adev->ddev, &mask);
-	if (ret != 0)
-		return;
-
-	if (!(mask & (DRM_PCIE_SPEED_50 | DRM_PCIE_SPEED_80)))
+	if (!(adev->pm.pcie_gen_mask & (CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 |
+					CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)))
 		return;
 
 	speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL);
 	current_data_rate = (speed_cntl & LC_CURRENT_DATA_RATE_MASK) >>
 		LC_CURRENT_DATA_RATE_SHIFT;
-	if (mask & DRM_PCIE_SPEED_80) {
+	if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) {
 		if (current_data_rate == 2) {
 			DRM_INFO("PCIE gen 3 link speeds already enabled\n");
 			return;
 		}
 		DRM_INFO("enabling PCIE gen 3 link speeds, disable with amdgpu.pcie_gen2=0\n");
-	} else if (mask & DRM_PCIE_SPEED_50) {
+	} else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2) {
 		if (current_data_rate == 1) {
 			DRM_INFO("PCIE gen 2 link speeds already enabled\n");
 			return;
@@ -1506,7 +1504,7 @@ static void si_pcie_gen3_enable(struct amdgpu_device *adev)
 	if (!gpu_pos)
 		return;
 
-	if (mask & DRM_PCIE_SPEED_80) {
+	if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) {
 		if (current_data_rate != 2) {
 			u16 bridge_cfg, gpu_cfg;
 			u16 bridge_cfg2, gpu_cfg2;
@@ -1589,9 +1587,9 @@ static void si_pcie_gen3_enable(struct amdgpu_device *adev)
 
 	pci_read_config_word(adev->pdev, gpu_pos + PCI_EXP_LNKCTL2, &tmp16);
 	tmp16 &= ~0xf;
-	if (mask & DRM_PCIE_SPEED_80)
+	if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
 		tmp16 |= 3;
-	else if (mask & DRM_PCIE_SPEED_50)
+	else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)
 		tmp16 |= 2;
 	else
 		tmp16 |= 1;
drivers/gpu/drm/amd/amdgpu/si_dpm.c +13 -37

86 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +7 -11
index b526f49be65d..336fdd8c7db0 100644
@@ -2788,10 +2788,13 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 				    PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
 
 
-	disable_mclk_switching = ((1 < info.display_count) ||
-				  disable_mclk_switching_for_frame_lock ||
-				  smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
-				  (mode_info.refresh_rate > 120));
+	if (info.display_count == 0)
+		disable_mclk_switching = false;
+	else
+		disable_mclk_switching = ((1 < info.display_count) ||
+					  disable_mclk_switching_for_frame_lock ||
+					  smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
+					  (mode_info.refresh_rate > 120));
 
 	sclk = smu7_ps->performance_levels[0].engine_clock;
 	mclk = smu7_ps->performance_levels[0].memory_clock;
@@ -4576,13 +4579,6 @@ static int smu7_set_power_profile_state(struct pp_hwmgr *hwmgr,
 	int tmp_result, result = 0;
 	uint32_t sclk_mask = 0, mclk_mask = 0;
 
-	if (hwmgr->chip_id == CHIP_FIJI) {
-		if (request->type == AMD_PP_GFX_PROFILE)
-			smu7_enable_power_containment(hwmgr);
-		else if (request->type == AMD_PP_COMPUTE_PROFILE)
-			smu7_disable_power_containment(hwmgr);
-	}
-
 	if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_AUTO)
 		return -EINVAL;
 
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +7 -4
index f8f02e70b8bc..ca232a9e2334 100644
@@ -3243,10 +3243,13 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 	force_mclk_high = phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_ForceMclkHigh);
 
-	disable_mclk_switching = (info.display_count > 1) ||
-				    disable_mclk_switching_for_frame_lock ||
-				    disable_mclk_switching_for_vr ||
-				    force_mclk_high;
+	if (info.display_count == 0)
+		disable_mclk_switching = false;
+	else
+		disable_mclk_switching = (info.display_count > 1) ||
+			disable_mclk_switching_for_frame_lock ||
+			disable_mclk_switching_for_vr ||
+			force_mclk_high;
 
 	sclk = vega10_ps->performance_levels[0].gfx_clock;
 	mclk = vega10_ps->performance_levels[0].mem_clock;
drivers/gpu/drm/drm_framebuffer.c +4 -0
index af279844d7ce..dd4727489b84 100644
@@ -118,6 +118,10 @@ int drm_mode_addfb(struct drm_device *dev,
 	r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
 	r.handles[0] = or->handle;
 
+	if (r.pixel_format == DRM_FORMAT_XRGB2101010 &&
+	    dev->driver->driver_features & DRIVER_PREFER_XBGR_30BPP)
+		r.pixel_format = DRM_FORMAT_XBGR2101010;
+
 	ret = drm_mode_addfb2(dev, &r, file_priv);
 	if (ret)
 		return ret;
drivers/gpu/drm/drm_probe_helper.c +20 -0
index 904966cde32b..d29fd8443fed 100644
@@ -671,6 +671,26 @@ static void output_poll_execute(struct work_struct *work)
 		schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD);
 }
 
+/**
+ * drm_kms_helper_is_poll_worker - is %current task an output poll worker?
+ *
+ * Determine if %current task is an output poll worker.  This can be used
+ * to select distinct code paths for output polling versus other contexts.
+ *
+ * One use case is to avoid a deadlock between the output poll worker and
+ * the autosuspend worker wherein the latter waits for polling to finish
+ * upon calling drm_kms_helper_poll_disable(), while the former waits for
+ * runtime suspend to finish upon calling pm_runtime_get_sync() in a
+ * connector ->detect hook.
+ */
+bool drm_kms_helper_is_poll_worker(void)
+{
+	struct work_struct *work = current_work();
+
+	return work && work->func == output_poll_execute;
+}
+EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
+
 /**
  * drm_kms_helper_poll_disable - disable output polling
  * @dev: drm_device
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 5c5cb2ceee49..562220ec9d41 100644
@@ -1806,6 +1806,8 @@ static int i915_drm_resume_early(struct drm_device *dev)
 	if (IS_GEN9_LP(dev_priv) ||
 	    !(dev_priv->suspended_to_idle && dev_priv->csr.dmc_payload))
 		intel_power_domains_init_hw(dev_priv, true);
+	else
+		intel_display_set_init_power(dev_priv, true);
 
 	i915_gem_sanitize(dev_priv);
 
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3 -1
index 83876a1c8d98..de8ca5f1dd2e 100644
@@ -499,6 +499,8 @@ eb_add_vma(struct i915_execbuffer *eb, unsigned int i, struct i915_vma *vma)
 		list_add_tail(&vma->exec_link, &eb->unbound);
 		if (drm_mm_node_allocated(&vma->node))
 			err = i915_vma_unbind(vma);
+		if (unlikely(err))
+			vma->exec_flags = NULL;
 	}
 	return err;
 }
@@ -2408,7 +2410,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 	if (out_fence) {
 		if (err == 0) {
 			fd_install(out_fence_fd, out_fence->file);
-			args->rsvd2 &= GENMASK_ULL(0, 31); /* keep in-fence */
+			args->rsvd2 &= GENMASK_ULL(31, 0); /* keep in-fence */
 			args->rsvd2 |= (u64)out_fence_fd << 32;
 			out_fence_fd = -1;
 		} else {
drivers/gpu/drm/i915/i915_perf.c +12 -26
index 370b9d248fed..3e49317f3ec3 100644
@@ -1300,9 +1300,8 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
 	 */
 	mutex_lock(&dev_priv->drm.struct_mutex);
 	dev_priv->perf.oa.exclusive_stream = NULL;
-	mutex_unlock(&dev_priv->drm.struct_mutex);
-
 	dev_priv->perf.oa.ops.disable_metric_set(dev_priv);
+	mutex_unlock(&dev_priv->drm.struct_mutex);
 
 	free_oa_buffer(dev_priv);
 
@@ -1754,22 +1753,13 @@ static int gen8_switch_to_updated_kernel_context(struct drm_i915_private *dev_pr
  * Note: it's only the RCS/Render context that has any OA state.
  */
 static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
-				       const struct i915_oa_config *oa_config,
-				       bool interruptible)
+				       const struct i915_oa_config *oa_config)
 {
 	struct i915_gem_context *ctx;
 	int ret;
 	unsigned int wait_flags = I915_WAIT_LOCKED;
 
-	if (interruptible) {
-		ret = i915_mutex_lock_interruptible(&dev_priv->drm);
-		if (ret)
-			return ret;
-
-		wait_flags |= I915_WAIT_INTERRUPTIBLE;
-	} else {
-		mutex_lock(&dev_priv->drm.struct_mutex);
-	}
+	lockdep_assert_held(&dev_priv->drm.struct_mutex);
 
 	/* Switch away from any user context. */
 	ret = gen8_switch_to_updated_kernel_context(dev_priv, oa_config);
@@ -1817,8 +1807,6 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
 	}
 
  out:
-	mutex_unlock(&dev_priv->drm.struct_mutex);
-
 	return ret;
 }
 
@@ -1862,7 +1850,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
 	 * to make sure all slices/subslices are ON before writing to NOA
 	 * registers.
 	 */
-	ret = gen8_configure_all_contexts(dev_priv, oa_config, true);
+	ret = gen8_configure_all_contexts(dev_priv, oa_config);
 	if (ret)
 		return ret;
 
@@ -1877,7 +1865,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
 static void gen8_disable_metric_set(struct drm_i915_private *dev_priv)
 {
 	/* Reset all contexts' slices/subslices configurations. */
-	gen8_configure_all_contexts(dev_priv, NULL, false);
+	gen8_configure_all_contexts(dev_priv, NULL);
 
 	I915_WRITE(GDT_CHICKEN_BITS, (I915_READ(GDT_CHICKEN_BITS) &
 				      ~GT_NOA_ENABLE));
@@ -2127,6 +2115,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 	if (ret)
 		goto err_oa_buf_alloc;
 
+	ret = i915_mutex_lock_interruptible(&dev_priv->drm);
+	if (ret)
+		goto err_lock;
+
 	ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv,
 						      stream->oa_config);
 	if (ret)
@@ -2134,23 +2126,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 
 	stream->ops = &i915_oa_stream_ops;
 
-	/* Lock device for exclusive_stream access late because
-	 * enable_metric_set() might lock as well on gen8+.
-	 */
-	ret = i915_mutex_lock_interruptible(&dev_priv->drm);
-	if (ret)
-		goto err_lock;
-
 	dev_priv->perf.oa.exclusive_stream = stream;
 
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 
 	return 0;
 
-err_lock:
+err_enable:
 	dev_priv->perf.oa.ops.disable_metric_set(dev_priv);
+	mutex_unlock(&dev_priv->drm.struct_mutex);
 
-err_enable:
+err_lock:
 	free_oa_buffer(dev_priv);
 
 err_oa_buf_alloc:
drivers/gpu/drm/i915/intel_display.c +2 -0
index 059db50109bc..cf648c526e12 100644
@@ -14498,6 +14498,8 @@ static void sanitize_watermarks(struct drm_device *dev)
 
 		cs->wm.need_postvbl_update = true;
 		dev_priv->display.optimize_watermarks(intel_state, cs);
+
+		to_intel_crtc_state(crtc->state)->wm = cs->wm;
 	}
 
 put_state:
drivers/gpu/drm/i915/intel_hdmi.c +11 -3
index 3fed1d3ecded..1b292d5f1a68 100644
@@ -1563,12 +1563,20 @@ intel_hdmi_set_edid(struct drm_connector *connector)
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct edid *edid;
 	bool connected = false;
+	struct i2c_adapter *i2c;
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	edid = drm_get_edid(connector,
-			    intel_gmbus_get_adapter(dev_priv,
-			    intel_hdmi->ddc_bus));
+	i2c = intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+
+	edid = drm_get_edid(connector, i2c);
+
+	if (!edid && !intel_gmbus_is_forced_bit(i2c)) {
+		DRM_DEBUG_KMS("HDMI GMBUS EDID read failed, retry using GPIO bit-banging\n");
+		intel_gmbus_force_bit(i2c, true);
+		edid = drm_get_edid(connector, i2c);
+		intel_gmbus_force_bit(i2c, false);
+	}
 
 	intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
 
drivers/gpu/drm/i915/intel_runtime_pm.c +1 -0
index 51cb5293bf43..bcccacba1ec6 100644
@@ -1844,6 +1844,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
 	CNL_DISPLAY_POWERWELL_2_POWER_DOMAINS |		\
 	BIT_ULL(POWER_DOMAIN_MODESET) |			\
 	BIT_ULL(POWER_DOMAIN_AUX_A) |			\
+	BIT_ULL(POWER_DOMAIN_GMBUS) |			\
 	BIT_ULL(POWER_DOMAIN_INIT))
 
 static const struct i915_power_well_ops i9xx_always_on_power_well_ops = {
drivers/gpu/drm/nouveau/nouveau_connector.c +13 -5
index 70d8e0d69ad5..c902a851eb51 100644
@@ -570,9 +570,15 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
 		nv_connector->edid = NULL;
 	}
 
-	ret = pm_runtime_get_sync(connector->dev->dev);
-	if (ret < 0 && ret != -EACCES)
-		return conn_status;
+	/* Outputs are only polled while runtime active, so acquiring a
+	 * runtime PM ref here is unnecessary (and would deadlock upon
+	 * runtime suspend because it waits for polling to finish).
+	 */
+	if (!drm_kms_helper_is_poll_worker()) {
+		ret = pm_runtime_get_sync(connector->dev->dev);
+		if (ret < 0 && ret != -EACCES)
+			return conn_status;
+	}
 
 	nv_encoder = nouveau_connector_ddc_detect(connector);
 	if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) {
@@ -647,8 +653,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
 
  out:
 
-	pm_runtime_mark_last_busy(connector->dev->dev);
-	pm_runtime_put_autosuspend(connector->dev->dev);
+	if (!drm_kms_helper_is_poll_worker()) {
+		pm_runtime_mark_last_busy(connector->dev->dev);
+		pm_runtime_put_autosuspend(connector->dev->dev);
+	}
 
 	return conn_status;
 }
drivers/gpu/drm/nouveau/nv50_display.c +1 -0
index fb47d46050ec..6e196bc01118 100644
@@ -4426,6 +4426,7 @@ nv50_display_create(struct drm_device *dev)
 	nouveau_display(dev)->fini = nv50_display_fini;
 	disp->disp = &nouveau_display(dev)->disp;
 	dev->mode_config.funcs = &nv50_disp_func;
+	dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
 	if (nouveau_atomic)
 		dev->driver->driver_features |= DRIVER_ATOMIC;
 
drivers/gpu/drm/radeon/cik.c +2 -29
index 3cb6c55b268d..ce8b353b5753 100644
@@ -3229,35 +3229,8 @@ static void cik_gpu_init(struct radeon_device *rdev)
 	case CHIP_KAVERI:
 		rdev->config.cik.max_shader_engines = 1;
 		rdev->config.cik.max_tile_pipes = 4;
-		if ((rdev->pdev->device == 0x1304) ||
-		    (rdev->pdev->device == 0x1305) ||
-		    (rdev->pdev->device == 0x130C) ||
-		    (rdev->pdev->device == 0x130F) ||
-		    (rdev->pdev->device == 0x1310) ||
-		    (rdev->pdev->device == 0x1311) ||
-		    (rdev->pdev->device == 0x131C)) {
-			rdev->config.cik.max_cu_per_sh = 8;
-			rdev->config.cik.max_backends_per_se = 2;
-		} else if ((rdev->pdev->device == 0x1309) ||
-			   (rdev->pdev->device == 0x130A) ||
-			   (rdev->pdev->device == 0x130D) ||
-			   (rdev->pdev->device == 0x1313) ||
-			   (rdev->pdev->device == 0x131D)) {
-			rdev->config.cik.max_cu_per_sh = 6;
-			rdev->config.cik.max_backends_per_se = 2;
-		} else if ((rdev->pdev->device == 0x1306) ||
-			   (rdev->pdev->device == 0x1307) ||
-			   (rdev->pdev->device == 0x130B) ||
-			   (rdev->pdev->device == 0x130E) ||
-			   (rdev->pdev->device == 0x1315) ||
-			   (rdev->pdev->device == 0x1318) ||
-			   (rdev->pdev->device == 0x131B)) {
-			rdev->config.cik.max_cu_per_sh = 4;
-			rdev->config.cik.max_backends_per_se = 1;
-		} else {
-			rdev->config.cik.max_cu_per_sh = 3;
-			rdev->config.cik.max_backends_per_se = 1;
-		}
+		rdev->config.cik.max_cu_per_sh = 8;
+		rdev->config.cik.max_backends_per_se = 2;
 		rdev->config.cik.max_sh_per_se = 1;
 		rdev->config.cik.max_texture_channel_caches = 4;
 		rdev->config.cik.max_gprs = 256;
drivers/gpu/drm/radeon/radeon_connectors.c +49 -25

134 lines not on this page · raw message

drivers/gpu/drm/radeon/radeon_device.c +4 -0
index ffc10cadcf34..32b577c776b9 100644
@@ -1397,6 +1397,10 @@ int radeon_device_init(struct radeon_device *rdev,
 	if ((rdev->flags & RADEON_IS_PCI) &&
 	    (rdev->family <= CHIP_RS740))
 		rdev->need_dma32 = true;
+#ifdef CONFIG_PPC64
+	if (rdev->family == CHIP_CEDAR)
+		rdev->need_dma32 = true;
+#endif
 
 	dma_bits = rdev->need_dma32 ? 32 : 40;
 	r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits));
drivers/gpu/drm/radeon/radeon_pm.c +1 -5
index 326ad068c15a..4b6542538ff9 100644
@@ -47,7 +47,6 @@ static bool radeon_pm_in_vbl(struct radeon_device *rdev);
 static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
 static void radeon_pm_update_profile(struct radeon_device *rdev);
 static void radeon_pm_set_clocks(struct radeon_device *rdev);
-static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev);
 
 int radeon_pm_get_type_index(struct radeon_device *rdev,
 			     enum radeon_pm_state_type ps_type,
@@ -80,8 +79,6 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev)
 				radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power);
 		}
 		mutex_unlock(&rdev->pm.mutex);
-		/* allow new DPM state to be picked */
-		radeon_pm_compute_clocks_dpm(rdev);
 	} else if (rdev->pm.pm_method == PM_METHOD_PROFILE) {
 		if (rdev->pm.profile == PM_PROFILE_AUTO) {
 			mutex_lock(&rdev->pm.mutex);
@@ -885,8 +882,7 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
 		dpm_state = POWER_STATE_TYPE_INTERNAL_3DPERF;
 	/* balanced states don't exist at the moment */
 	if (dpm_state == POWER_STATE_TYPE_BALANCED)
-		dpm_state = rdev->pm.dpm.ac_power ?
-			POWER_STATE_TYPE_PERFORMANCE : POWER_STATE_TYPE_BATTERY;
+		dpm_state = POWER_STATE_TYPE_PERFORMANCE;
 
 restart_search:
 	/* Pick the best power state based on current conditions */
drivers/infiniband/core/device.c +4 -2
index d7d042a20ab4..4dff06ab771e 100644
@@ -534,14 +534,14 @@ int ib_register_device(struct ib_device *device,
 	ret = device->query_device(device, &device->attrs, &uhw);
 	if (ret) {
 		pr_warn("Couldn't query the device attributes\n");
-		goto cache_cleanup;
+		goto cg_cleanup;
 	}
 
 	ret = ib_device_register_sysfs(device, port_callback);
 	if (ret) {
 		pr_warn("Couldn't register device %s with driver model\n",
 			device->name);
-		goto cache_cleanup;
+		goto cg_cleanup;
 	}
 
 	device->reg_state = IB_DEV_REGISTERED;
@@ -557,6 +557,8 @@ int ib_register_device(struct ib_device *device,
 	mutex_unlock(&device_mutex);
 	return 0;
 
+cg_cleanup:
+	ib_device_unregister_rdmacg(device);
 cache_cleanup:
 	ib_cache_cleanup_one(device);
 	ib_cache_release_one(device);
drivers/infiniband/core/rdma_core.c +6 -6
index 4e1f76730855..9cb801d1fe54 100644
@@ -407,13 +407,13 @@ static int __must_check remove_commit_fd_uobject(struct ib_uobject *uobj,
 	return ret;
 }
 
-static void lockdep_check(struct ib_uobject *uobj, bool exclusive)
+static void assert_uverbs_usecnt(struct ib_uobject *uobj, bool exclusive)
 {
 #ifdef CONFIG_LOCKDEP
 	if (exclusive)
-		WARN_ON(atomic_read(&uobj->usecnt) > 0);
+		WARN_ON(atomic_read(&uobj->usecnt) != -1);
 	else
-		WARN_ON(atomic_read(&uobj->usecnt) == -1);
+		WARN_ON(atomic_read(&uobj->usecnt) <= 0);
 #endif
 }
 
@@ -452,7 +452,7 @@ int __must_check rdma_remove_commit_uobject(struct ib_uobject *uobj)
 		WARN(true, "ib_uverbs: Cleanup is running while removing an uobject\n");
 		return 0;
 	}
-	lockdep_check(uobj, true);
+	assert_uverbs_usecnt(uobj, true);
 	ret = _rdma_remove_commit_uobject(uobj, RDMA_REMOVE_DESTROY);
 
 	up_read(&ucontext->cleanup_rwsem);
@@ -482,7 +482,7 @@ int rdma_explicit_destroy(struct ib_uobject *uobject)
 		WARN(true, "ib_uverbs: Cleanup is running while removing an uobject\n");
 		return 0;
 	}
-	lockdep_check(uobject, true);
+	assert_uverbs_usecnt(uobject, true);
 	ret = uobject->type->type_class->remove_commit(uobject,
 						       RDMA_REMOVE_DESTROY);
 	if (ret)
@@ -569,7 +569,7 @@ static void lookup_put_fd_uobject(struct ib_uobject *uobj, bool exclusive)
 
 void rdma_lookup_put_uobject(struct ib_uobject *uobj, bool exclusive)
 {
-	lockdep_check(uobj, exclusive);
+	assert_uverbs_usecnt(uobj, exclusive);
 	uobj->type->type_class->lookup_put(uobj, exclusive);
 	/*
 	 * In order to unlock an object, either decrease its usecnt for
drivers/infiniband/core/ucma.c +6 -0
index eb85b546e223..c8b3a45e9edc 100644
@@ -1148,6 +1148,9 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,
 	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
 		return -EFAULT;
 
+	if (cmd.qp_state > IB_QPS_ERR)
+		return -EINVAL;
+
 	ctx = ucma_get_ctx(file, cmd.id);
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
@@ -1293,6 +1296,9 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf,
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
 
+	if (unlikely(cmd.optval > KMALLOC_MAX_SIZE))
+		return -EINVAL;
+
 	optval = memdup_user((void __user *) (unsigned long) cmd.optval,
 			     cmd.optlen);
 	if (IS_ERR(optval)) {
drivers/infiniband/hw/mlx5/cq.c +6 -1
index 2aa53f427685..faedc080a5e6 100644
@@ -1154,7 +1154,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq,
 	if (ucmd.reserved0 || ucmd.reserved1)
 		return -EINVAL;
 
-	umem = ib_umem_get(context, ucmd.buf_addr, entries * ucmd.cqe_size,
+	/* check multiplication overflow */
+	if (ucmd.cqe_size && SIZE_MAX / ucmd.cqe_size <= entries - 1)
+		return -EINVAL;
+
+	umem = ib_umem_get(context, ucmd.buf_addr,
+			   (size_t)ucmd.cqe_size * entries,
 			   IB_ACCESS_LOCAL_WRITE, 1);
 	if (IS_ERR(umem)) {
 		err = PTR_ERR(umem);
drivers/infiniband/hw/mlx5/mr.c +1 -1
index 231b043e2806..000937fe53ec 100644
@@ -1813,7 +1813,6 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr,
 
 	mr->ibmr.iova = sg_dma_address(sg) + sg_offset;
 	mr->ibmr.length = 0;
-	mr->ndescs = sg_nents;
 
 	for_each_sg(sgl, sg, sg_nents, i) {
 		if (unlikely(i >= mr->max_descs))
@@ -1825,6 +1824,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr,
 
 		sg_offset = 0;
 	}
+	mr->ndescs = i;
 
 	if (sg_offset_p)
 		*sg_offset_p = sg_offset;
drivers/input/keyboard/matrix_keypad.c +3 -1
index 1f316d66e6f7..41614c185918 100644
@@ -218,8 +218,10 @@ static void matrix_keypad_stop(struct input_dev *dev)
 {
 	struct matrix_keypad *keypad = input_get_drvdata(dev);
 
+	spin_lock_irq(&keypad->lock);
 	keypad->stopped = true;
-	mb();
+	spin_unlock_irq(&keypad->lock);
+
 	flush_work(&keypad->work.work);
 	/*
 	 * matrix_keypad_scan() will leave IRQs enabled;
drivers/md/bcache/super.c +21 -6
index 25bf003fb198..9417170f180a 100644
@@ -938,6 +938,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
 	uint32_t rtime = cpu_to_le32(get_seconds());
 	struct uuid_entry *u;
 	char buf[BDEVNAME_SIZE];
+	struct cached_dev *exist_dc, *t;
 
 	bdevname(dc->bdev, buf);
 
@@ -961,6 +962,16 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
 		return -EINVAL;
 	}
 
+	/* Check whether already attached */
+	list_for_each_entry_safe(exist_dc, t, &c->cached_devs, list) {
+		if (!memcmp(dc->sb.uuid, exist_dc->sb.uuid, 16)) {
+			pr_err("Tried to attach %s but duplicate UUID already attached",
+				buf);
+
+			return -EINVAL;
+		}
+	}
+
 	u = uuid_find(c, dc->sb.uuid);
 
 	if (u &&
@@ -1181,7 +1192,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
 
 	return;
 err:
-	pr_notice("error opening %s: %s", bdevname(bdev, name), err);
+	pr_notice("error %s: %s", bdevname(bdev, name), err);
 	bcache_device_stop(&dc->disk);
 }
 
@@ -1849,6 +1860,8 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,
 	const char *err = NULL; /* must be set for any error case */
 	int ret = 0;
 
+	bdevname(bdev, name);
+
 	memcpy(&ca->sb, sb, sizeof(struct cache_sb));
 	ca->bdev = bdev;
 	ca->bdev->bd_holder = ca;
@@ -1857,11 +1870,12 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,
 	ca->sb_bio.bi_io_vec[0].bv_page = sb_page;
 	get_page(sb_page);
 
-	if (blk_queue_discard(bdev_get_queue(ca->bdev)))
+	if (blk_queue_discard(bdev_get_queue(bdev)))
 		ca->discard = CACHE_DISCARD(&ca->sb);
 
 	ret = cache_alloc(ca);
 	if (ret != 0) {
+		blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
 		if (ret == -ENOMEM)
 			err = "cache_alloc(): -ENOMEM";
 		else
@@ -1884,14 +1898,14 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,
 		goto out;
 	}
 
-	pr_info("registered cache device %s", bdevname(bdev, name));
+	pr_info("registered cache device %s", name);
 
 out:
 	kobject_put(&ca->kobj);
 
 err:
 	if (err)
-		pr_notice("error opening %s: %s", bdevname(bdev, name), err);
+		pr_notice("error %s: %s", name, err);
 
 	return ret;
 }
@@ -1980,6 +1994,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 	if (err)
 		goto err_close;
 
+	err = "failed to register device";
 	if (SB_IS_BDEV(sb)) {
 		struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
 		if (!dc)
@@ -1994,7 +2009,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 			goto err_close;
 
 		if (register_cache(sb, sb_page, bdev, ca) != 0)
-			goto err_close;
+			goto err;
 	}
 out:
 	if (sb_page)
@@ -2007,7 +2022,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 err_close:
 	blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
 err:
-	pr_info("error opening %s: %s", path, err);
+	pr_info("error %s: %s", path, err);
 	ret = -EINVAL;
 	goto out;
 }
drivers/md/dm-bufio.c +6 -10
index 6d416fdc25cb..1e17e6421da3 100644
@@ -386,9 +386,6 @@ static void __cache_size_refresh(void)
 static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 			       enum data_mode *data_mode)
 {
-	unsigned noio_flag;
-	void *ptr;
-
 	if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) {
 		*data_mode = DATA_MODE_SLAB;
 		return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask);
@@ -412,16 +409,15 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 	 * all allocations done by this process (including pagetables) are done
 	 * as if GFP_NOIO was specified.
 	 */
+	if (gfp_mask & __GFP_NORETRY) {
+		unsigned noio_flag = memalloc_noio_save();
+		void *ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
 
-	if (gfp_mask & __GFP_NORETRY)
-		noio_flag = memalloc_noio_save();
-
-	ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
-
-	if (gfp_mask & __GFP_NORETRY)
 		memalloc_noio_restore(noio_flag);
+		return ptr;
+	}
 
-	return ptr;
+	return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
 }
 
 /*
drivers/pci/dwc/pcie-designware-host.c +1 -1
index 81e2157a7cfb..bc3e2d8d0cce 100644
@@ -607,7 +607,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
 	/* setup bus numbers */
 	val = dw_pcie_readl_dbi(pci, PCI_PRIMARY_BUS);
 	val &= 0xff000000;
-	val |= 0x00010100;
+	val |= 0x00ff0100;
 	dw_pcie_writel_dbi(pci, PCI_PRIMARY_BUS, val);
 
 	/* setup command register */
drivers/regulator/stm32-vrefbuf.c +1 -1
index 72c8b3e1022b..e0a9c445ed67 100644
@@ -51,7 +51,7 @@ static int stm32_vrefbuf_enable(struct regulator_dev *rdev)
 	 * arbitrary timeout.
 	 */
 	ret = readl_poll_timeout(priv->base + STM32_VREFBUF_CSR, val,
-				 !(val & STM32_VRR), 650, 10000);
+				 val & STM32_VRR, 650, 10000);
 	if (ret) {
 		dev_err(&rdev->dev, "stm32 vrefbuf timed out!\n");
 		val = readl_relaxed(priv->base + STM32_VREFBUF_CSR);
drivers/scsi/hosts.c +0 -3
index 57bf43e34863..dd9464920456 100644
@@ -328,8 +328,6 @@ static void scsi_host_dev_release(struct device *dev)
 	if (shost->work_q)
 		destroy_workqueue(shost->work_q);
 
-	destroy_rcu_head(&shost->rcu);
-
 	if (shost->shost_state == SHOST_CREATED) {
 		/*
 		 * Free the shost_dev device name here if scsi_host_alloc()
@@ -404,7 +402,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	INIT_LIST_HEAD(&shost->starved_list);
 	init_waitqueue_head(&shost->host_wait);
 	mutex_init(&shost->scan_mutex);
-	init_rcu_head(&shost->rcu);
 
 	index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL);
 	if (index < 0)
drivers/scsi/qla2xxx/qla_def.h +27 -22

77 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_gs.c +63 -9

72 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_init.c +54 -10

64 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_iocb.c +0 -13
index 2f94159186d7..63bea6a65d51 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_isr.c +1 -6
index 9d9668aac6f6..d95b879c2bca 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_mbx.c +1 -2
index 99502fa90810..2d909e12e23a 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/qla2xxx/qla_mid.c +25 -17

42 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_os.c +32 -19

51 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_target.c +15 -11
index f05cfc83c9c8..040a76011ffa 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi_error.c +3 -2
index fa504ba83ade..cf70f0bb8375 100644

Lines of this file are not shown. View the raw message.

drivers/scsi/scsi_lib.c +2 -0
index 0d3696e9dddd..359386730523 100644

Lines of this file are not shown. View the raw message.

drivers/virtio/virtio_ring.c +0 -2
index eb30f3e09a47..71458f493cf8 100644

Lines of this file are not shown. View the raw message.

drivers/watchdog/hpwdt.c +17 -490

507 lines not on this page · raw message

fs/nfs/direct.c +1 -1
index 8c10b0562e75..621c517b325c 100644

Lines of this file are not shown. View the raw message.

fs/nfs/pnfs.c +10 -3
index 5f2f852ef506..7b34534210ce 100644

Lines of this file are not shown. View the raw message.

fs/nfs/write.c +43 -40

83 lines not on this page · raw message

include/drm/drm_crtc_helper.h +1 -0
index 76e237bd989b..6914633037a5 100644

Lines of this file are not shown. View the raw message.

include/drm/drm_drv.h +1 -0
index 71bbaaec836d..305304965b89 100644

Lines of this file are not shown. View the raw message.

include/linux/compiler-clang.h +5 -0
index 3b609edffa8f..be3aef6839f6 100644

Lines of this file are not shown. View the raw message.

include/linux/compiler-gcc.h +4 -0
index bf09213895f7..a1ffbf25873f 100644

Lines of this file are not shown. View the raw message.

include/linux/init.h +4 -4
index 943139a563e3..07cab8a053af 100644

Lines of this file are not shown. View the raw message.

include/linux/nospec.h +2 -21
index 132e3f5a2e0d..e791ebc65c9c 100644

Lines of this file are not shown. View the raw message.

include/linux/tpm.h +1 -0
index 5a090f5ab335..881312d85574 100644

Lines of this file are not shown. View the raw message.

include/linux/workqueue.h +1 -0
index 0eae11fc7a23..1c527abb1ae5 100644

Lines of this file are not shown. View the raw message.

include/scsi/scsi_cmnd.h +3 -0
index 7fb57e905526..7bc752fc98de 100644

Lines of this file are not shown. View the raw message.

include/scsi/scsi_host.h +0 -2
index 1a1df0d21ee3..a8b7bf879ced 100644

Lines of this file are not shown. View the raw message.

kernel/workqueue.c +16 -0
index 8365a52a74c5..d0c6b50792c8 100644

Lines of this file are not shown. View the raw message.

lib/bug.c +2 -0
index 1e094408c893..d2c9a099561a 100644

Lines of this file are not shown. View the raw message.

mm/memblock.c +5 -5
index 91205780e6b1..6dd303717a4d 100644

Lines of this file are not shown. View the raw message.

net/bridge/netfilter/ebt_among.c +19 -2
index 279527f8b1fe..59baaecd3e54 100644

Lines of this file are not shown. View the raw message.

net/bridge/netfilter/ebtables.c +12 -1
index 3b3dcf719e07..16eb99458df4 100644

Lines of this file are not shown. View the raw message.

net/ipv4/netfilter/arp_tables.c +4 -0
index 9e2770fd00be..aa4c3b7f7da4 100644

Lines of this file are not shown. View the raw message.

net/ipv4/netfilter/ip_tables.c +6 -1
index 39286e543ee6..cadb82a906b8 100644

Lines of this file are not shown. View the raw message.

net/ipv4/netfilter/ipt_CLUSTERIP.c +6 -6
index 24a8c2e63e3d..c07e9db95ccc 100644

Lines of this file are not shown. View the raw message.

net/ipv6/netfilter.c +5 -4
index 39970e212ad5..9bf260459f83 100644

Lines of this file are not shown. View the raw message.

net/ipv6/netfilter/ip6_tables.c +4 -0
index 01bd3ee5ebc6..a0a31972fc75 100644

Lines of this file are not shown. View the raw message.

net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +4 -0
index 46d6dba50698..c5053dbfc391 100644

Lines of this file are not shown. View the raw message.

net/netfilter/nf_nat_proto_common.c +5 -2
index fbce552a796e..7d7466dbf663 100644

Lines of this file are not shown. View the raw message.

net/netfilter/xt_IDLETIMER.c +6 -3
index daf45da448fa..bb5d6a058fb7 100644

Lines of this file are not shown. View the raw message.

net/netfilter/xt_LED.c +6 -6
index 3ba31c194cce..0858fe17e14a 100644

Lines of this file are not shown. View the raw message.

net/netfilter/xt_hashlimit.c +1 -1
index 5da8746f7b88..b8a3e740ffd4 100644

Lines of this file are not shown. View the raw message.

net/smc/af_smc.c +3 -1
index 745f145d4c4d..a6d604fd9695 100644

Lines of this file are not shown. View the raw message.

scripts/Makefile.build +8 -0
index 6bed45dc2cb1..7143da06d702 100644

Lines of this file are not shown. View the raw message.

scripts/Makefile.lib +4 -4
index 0b46136a91a8..aac94d962ed6 100644

Lines of this file are not shown. View the raw message.

sound/core/seq/seq_clientmgr.c +14 -7
index dea11d1babf5..1f3aa466ac9b 100644

Lines of this file are not shown. View the raw message.

sound/core/seq/seq_fifo.c +1 -1
index a8c2822e0198..72c0302a55d2 100644

Lines of this file are not shown. View the raw message.

sound/core/seq/seq_memory.c +10 -4
index f763682584a8..ab1112e90f88 100644

Lines of this file are not shown. View the raw message.

sound/core/seq/seq_memory.h +2 -1
index 32f959c17786..3abe306c394a 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/patch_conexant.c +2 -0
index 37e1cf8218ff..5b4dbcec6de8 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/patch_realtek.c +44 -1

45 lines not on this page · raw message

sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +2 -0
index 88ff54220007..69ab55956492 100644

Lines of this file are not shown. View the raw message.

tools/objtool/builtin-check.c +4 -2
index 57254f5b2779..694abc628e9b 100644

Lines of this file are not shown. View the raw message.

tools/objtool/builtin-orc.c +1 -5
index 91e8e19ff5e0..77ea2b97117d 100644

Lines of this file are not shown. View the raw message.

tools/objtool/builtin.h +5 -0
index dd526067fed5..28ff40e19a14 100644

Lines of this file are not shown. View the raw message.

tools/objtool/check.c +88 -5

93 lines not on this page · raw message

tools/objtool/check.h +2 -1
index 23a1d065cae1..c6b68fcb926f 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/trigger.h +5 -4
index 370138e7e35c..88223bc7c82b 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.