History

Merge tag 'v5.7-rc4' into core

Linux 5.7-rc4

Joerg Roedel committed 6 years ago

Commit ec9b40c2 parents 3a0ce12 0e698df162 files · +1289 −604Browse files

Unified · Split

162 files
  1. Documentation/admin-guide/device-mapper/dm-integrity.rst +9 −6
  2. Documentation/devicetree/bindings/dma/socionext,uniphier-xdmac.yaml +3 −4
  3. MAINTAINERS +1 −1
  4. Makefile +1 −1
  5. arch/arm64/kernel/vdso/Makefile +1 −1
  6. arch/riscv/Kconfig +1 −1
  7. arch/riscv/kernel/sbi.c +10 −7
  8. arch/riscv/kernel/stacktrace.c +2 −2
  9. arch/riscv/kernel/vdso/Makefile +3 −3
  10. arch/s390/lib/uaccess.c +4 −0
  11. arch/s390/mm/pgalloc.c +14 −2
  12. arch/x86/hyperv/hv_init.c +10 −2
  13. arch/x86/include/asm/mshyperv.h +2 −0
  14. block/partitions/core.c +1 −1
  15. drivers/acpi/device_pm.c +2 −2
  16. drivers/cpufreq/intel_pstate.c +1 −1
  17. drivers/crypto/caam/caamalg.c +7 −3
  18. drivers/crypto/caam/caamhash.c +6 −2
  19. drivers/crypto/caam/caampkc.c +6 −2
  20. drivers/dma-buf/dma-buf.c +4 −3
  21. drivers/dma/Kconfig +2 −1
  22. drivers/dma/dmaengine.c +26 −34
  23. drivers/dma/dmatest.c +3 −3
  24. drivers/dma/mmp_tdma.c +4 −1
  25. drivers/dma/pch_dma.c +1 −1
  26. drivers/dma/tegra20-apb-dma.c +9 −0
  27. drivers/dma/ti/k3-psil.c +1 −0
  28. drivers/dma/xilinx/xilinx_dma.c +10 −10
  29. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −1
  30. drivers/gpu/drm/amd/amdgpu/navi10_sdma_pkt_open.h +16 −0
  31. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +13 −1
  32. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +29 −9
  33. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +27 −0
  34. drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 −36
  35. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 −0
  36. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 −0
  37. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 −0
  38. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c +1 −0
  39. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +15 −0
  40. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +14 −6
  41. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +12 −2
  42. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 −1
  43. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c +1 −0
  44. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 −0
  45. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h +2 −1
  46. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +4 −0
  47. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +1 −0
  48. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +33 −44
  49. drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +16 −0
  50. drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 −0
  51. drivers/gpu/drm/amd/powerplay/amd_powerplay.c +5 −4
  52. drivers/gpu/drm/drm_dp_mst_topology.c +6 −2
  53. drivers/gpu/drm/drm_edid.c +1 −1
  54. drivers/gpu/drm/i915/gem/i915_gem_tiling.c +18 −2
  55. drivers/gpu/drm/i915/gem/selftests/huge_pages.c +8 −4
  56. drivers/gpu/drm/i915/gt/intel_timeline.c +2 −0
  57. drivers/gpu/drm/i915/i915_irq.c +2 −4
  58. drivers/gpu/drm/i915/i915_vma.c +6 −4
  59. drivers/gpu/drm/qxl/qxl_cmd.c +5 −5
  60. drivers/gpu/drm/qxl/qxl_display.c +3 −3
  61. drivers/gpu/drm/qxl/qxl_draw.c +4 −3
  62. drivers/gpu/drm/qxl/qxl_image.c +2 −1
  63. drivers/gpu/drm/qxl/qxl_ioctl.c +1 −4
  64. drivers/gpu/drm/virtio/virtgpu_kms.c +6 −11
  65. drivers/hv/hv.c +1 −5
  66. drivers/hv/hv_trace.h +2 −2
  67. drivers/hv/vmbus_drv.c +34 −9
  68. drivers/i2c/busses/i2c-amd-mp2-pci.c +1 −1
  69. drivers/i2c/busses/i2c-aspeed.c +4 −1
  70. drivers/i2c/busses/i2c-bcm-iproc.c +3 −0
  71. drivers/i2c/busses/i2c-tegra.c +12 −24
  72. drivers/infiniband/core/cm.c +14 −12
  73. drivers/infiniband/core/rdma_core.c +4 −5
  74. drivers/infiniband/core/uverbs_main.c +4 −0
  75. drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 −1
  76. drivers/infiniband/hw/mlx4/main.c +2 −1
  77. drivers/infiniband/hw/mlx5/qp.c +3 −1
  78. drivers/infiniband/sw/rdmavt/cq.c +2 −2
  79. drivers/infiniband/sw/rdmavt/mmap.c +2 −2
  80. drivers/infiniband/sw/rdmavt/qp.c +2 −2
  81. drivers/infiniband/sw/rdmavt/srq.c +2 −2
  82. drivers/infiniband/sw/siw/siw_qp_tx.c +11 −4
  83. drivers/iommu/Kconfig +2 −2
  84. drivers/iommu/amd_iommu_init.c +1 −1
  85. drivers/iommu/intel-iommu.c +2 −2
  86. drivers/iommu/iommu.c +1 −0
  87. drivers/iommu/qcom_iommu.c +4 −1
  88. drivers/md/dm-mpath.c +4 −2
  89. drivers/md/dm-verity-fec.c +1 −1
  90. drivers/md/dm-writecache.c +37 −15
  91. drivers/mmc/core/mmc_ops.c +1 −1
  92. drivers/mmc/host/cqhci.c +10 −11
  93. drivers/mmc/host/meson-mx-sdio.c +1 −10
  94. drivers/mmc/host/sdhci-msm.c +2 −0
  95. drivers/mmc/host/sdhci-pci-core.c +3 −0
  96. drivers/mmc/host/sdhci-xenon.c +10 −0
  97. drivers/nvme/host/core.c +2 −0
  98. drivers/scsi/qla2xxx/qla_os.c +17 −18
  99. drivers/scsi/scsi_lib.c +1 −0
  100. drivers/target/target_core_iblock.c +1 −1
  101. drivers/tty/hvc/Kconfig +1 −1
  102. drivers/tty/serial/Kconfig +1 −1
  103. drivers/vfio/vfio_iommu_type1.c +5 −5
  104. fs/btrfs/backref.c +1 −1
  105. fs/btrfs/block-group.c +14 −6
  106. fs/btrfs/discard.h +1 −1
  107. fs/btrfs/disk-io.c +32 −4
  108. fs/btrfs/relocation.c +1 −0
  109. fs/btrfs/transaction.c +11 −2
  110. fs/btrfs/tree-log.c +40 −3
  111. fs/io_uring.c +31 −27
  112. fs/ioctl.c +8 −0
  113. fs/iomap/fiemap.c +1 −4
  114. fs/nfs/nfs3acl.c +15 −7
  115. fs/nfs/nfs4proc.c +9 −2
  116. fs/nfs/pnfs.c +5 −6
  117. fs/nfs/super.c +1 −1
  118. fs/ocfs2/dlmfs/dlmfs.c +12 −15
  119. fs/pnode.c +4 −5
  120. fs/super.c +1 −1
  121. include/linux/dma-buf.h +1 −2
  122. include/linux/dmaengine.h +6 −6
  123. include/linux/nfs_xdr.h +2 −0
  124. include/linux/sunrpc/clnt.h +12 −1
  125. include/trace/events/rpcrdma.h +4 −8
  126. include/uapi/drm/amdgpu_drm.h +4 −0
  127. include/uapi/linux/dma-buf.h +6 −0
  128. include/uapi/linux/hyperv.h +2 −2
  129. kernel/power/hibernate.c +7 −0
  130. lib/kunit/test.c +1 −1
  131. net/sunrpc/clnt.c +18 −6
  132. net/sunrpc/xprtrdma/rpc_rdma.c +11 −4
  133. net/sunrpc/xprtrdma/verbs.c +2 −1
  134. security/selinux/hooks.c +45 −25
  135. security/selinux/ss/conditional.c +1 −1
  136. sound/core/oss/pcm_plugin.c +6 −4
  137. sound/isa/opti9xx/miro.c +6 −3
  138. sound/isa/opti9xx/opti92x-ad1848.c +6 −3
  139. sound/pci/hda/hda_intel.c +5 −4
  140. sound/pci/hda/patch_hdmi.c +5 −1
  141. sound/pci/hda/patch_realtek.c +1 −0
  142. sound/usb/line6/podhd.c +5 −17
  143. sound/usb/quirks.c +1 −1
  144. tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc +1 −4
  145. tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc +2 −0
  146. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +2 −0
  147. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 −4
  148. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 −4
  149. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc +1 −1
  150. tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +1 −4
  151. tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc +1 −1
  152. tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc +1 −4
  153. tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +1 −4
  154. tools/testing/selftests/ftrace/test.d/ftrace/func_stack_tracer.tc +2 −0
  155. tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc +1 −4
  156. tools/testing/selftests/ftrace/test.d/functions +6 −0
  157. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1 −1
  158. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +2 −0
  159. tools/testing/selftests/gpio/Makefile +6 −6
  160. tools/testing/selftests/intel_pstate/Makefile +1 −1
  161. tools/testing/selftests/kselftest_deps.sh +272 −0
  162. tools/testing/selftests/memfd/Makefile +12 −2
Documentation/admin-guide/device-mapper/dm-integrity.rst+9−6
@@ -182,12 +182,15 @@ fix_padding · 181 unmodified lines
182182 space-efficient. If this option is not present, large padding is
183183 used - that is for compatibility with older kernels.
184184
185−
186−The journal mode (D/J), buffer_sectors, journal_watermark, commit_time can
187−be changed when reloading the target (load an inactive table and swap the
188−tables with suspend and resume). The other arguments should not be changed
189−when reloading the target because the layout of disk data depend on them
190−and the reloaded target would be non-functional.
185+allow_discards
186+ Allow block discard requests (a.k.a. TRIM) for the integrity device.
187+ Discards are only allowed to devices using internal hash.
188+
189+The journal mode (D/J), buffer_sectors, journal_watermark, commit_time and
190+allow_discards can be changed when reloading the target (load an inactive
191+table and swap the tables with suspend and resume). The other arguments
192+should not be changed when reloading the target because the layout of disk
193+data depend on them and the reloaded target would be non-functional.
191194
192195
193196 The layout of the formatted block device:
Documentation/devicetree/bindings/dma/socionext,uniphier-xdmac.yaml+3−4
@@ -22,9 +22,7 @@ properties: · 21 unmodified lines
2222 const: socionext,uniphier-xdmac
2323
2424 reg:
25− items:
26− - description: XDMAC base register region (offset and length)
27− - description: XDMAC extension register region (offset and length)
25+ maxItems: 1
2826
2927 interrupts:
3028 maxItems: 1
@@ -49,12 +47,13 @@ required: · 18 unmodified lines
4947 - reg
5048 - interrupts
5149 - "#dma-cells"
50+ - dma-channels
5251
5352 examples:
5453 - |
5554 xdmac: dma-controller@5fc10000 {
5655 compatible = "socionext,uniphier-xdmac";
57− reg = <0x5fc10000 0x1000>, <0x5fc20000 0x800>;
56+ reg = <0x5fc10000 0x5300>;
5857 interrupts = <0 188 4>;
5958 #dma-cells = <2>;
6059 dma-channels = <16>;
MAINTAINERS+1−1
@@ -3657,7 +3657,7 @@ L: linux-btrfs@vger.kernel.org · 3656 unmodified lines
36573657 S: Maintained
36583658 W: http://btrfs.wiki.kernel.org/
36593659 Q: http://patchwork.kernel.org/project/linux-btrfs/list/
3660−T: git git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git
3660+T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
36613661 F: Documentation/filesystems/btrfs.rst
36623662 F: fs/btrfs/
36633663 F: include/linux/btrfs*
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 7
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
5+EXTRAVERSION = -rc4
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
arch/arm64/kernel/vdso/Makefile+1−1
@@ -32,7 +32,7 @@ UBSAN_SANITIZE := n · 31 unmodified lines
3232 OBJECT_FILES_NON_STANDARD := y
3333 KCOV_INSTRUMENT := n
3434
35−CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny
35+CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny -fasynchronous-unwind-tables
3636
3737 ifneq ($(c-gettimeofday-y),)
3838 CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
arch/riscv/Kconfig+1−1
@@ -60,7 +60,7 @@ config RISCV · 59 unmodified lines
6060 select ARCH_HAS_GIGANTIC_PAGE
6161 select ARCH_HAS_SET_DIRECT_MAP
6262 select ARCH_HAS_SET_MEMORY
63− select ARCH_HAS_STRICT_KERNEL_RWX
63+ select ARCH_HAS_STRICT_KERNEL_RWX if MMU
6464 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
6565 select SPARSEMEM_STATIC if 32BIT
6666 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
arch/riscv/kernel/sbi.c+10−7
@@ -102,7 +102,7 @@ void sbi_shutdown(void) · 101 unmodified lines
102102 {
103103 sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
104104 }
105−EXPORT_SYMBOL(sbi_set_timer);
105+EXPORT_SYMBOL(sbi_shutdown);
106106
107107 /**
108108 * sbi_clear_ipi() - Clear any pending IPIs for the calling hart.
@@ -113,7 +113,7 @@ void sbi_clear_ipi(void) · 4 unmodified lines
113113 {
114114 sbi_ecall(SBI_EXT_0_1_CLEAR_IPI, 0, 0, 0, 0, 0, 0, 0);
115115 }
116−EXPORT_SYMBOL(sbi_shutdown);
116+EXPORT_SYMBOL(sbi_clear_ipi);
117117
118118 /**
119119 * sbi_set_timer_v01() - Program the timer for next timer event.
@@ -167,6 +167,11 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask, · 47 unmodified lines
167167
168168 return result;
169169 }
170+
171+static void sbi_set_power_off(void)
172+{
173+ pm_power_off = sbi_shutdown;
174+}
170175 #else
171176 static void __sbi_set_timer_v01(uint64_t stime_value)
172177 {
@@ -191,6 +196,8 @@ static int __sbi_rfence_v01(int fid, const unsigned long *hart_mask, · 18 unmodified lines
191196
192197 return 0;
193198 }
199+
200+static void sbi_set_power_off(void) {}
194201 #endif /* CONFIG_RISCV_SBI_V01 */
195202
196203 static void __sbi_set_timer_v02(uint64_t stime_value)
@@ -540,16 +547,12 @@ static inline long sbi_get_firmware_version(void) · 343 unmodified lines
540547 return __sbi_base_ecall(SBI_EXT_BASE_GET_IMP_VERSION);
541548 }
542549
543−static void sbi_power_off(void)
544−{
545− sbi_shutdown();
546−}
547550
548551 int __init sbi_init(void)
549552 {
550553 int ret;
551554
552− pm_power_off = sbi_power_off;
555+ sbi_set_power_off();
553556 ret = sbi_get_spec_version();
554557 if (ret > 0)
555558 sbi_spec_version = ret;
arch/riscv/kernel/stacktrace.c+2−2
@@ -12,6 +12,8 @@ · 11 unmodified lines
1212 #include <linux/stacktrace.h>
1313 #include <linux/ftrace.h>
1414
15+register unsigned long sp_in_global __asm__("sp");
16+
1517 #ifdef CONFIG_FRAME_POINTER
1618
1719 struct stackframe {
@@ -19,8 +21,6 @@ struct stackframe { · 1 unmodified line
1921 unsigned long ra;
2022 };
2123
22−register unsigned long sp_in_global __asm__("sp");
23−
2424 void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
2525 bool (*fn)(unsigned long, void *), void *arg)
2626 {
arch/riscv/kernel/vdso/Makefile+3−3
@@ -33,15 +33,15 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE · 32 unmodified lines
3333 $(call if_changed,vdsold)
3434
3535 # We also create a special relocatable object that should mirror the symbol
36−# table and layout of the linked DSO. With ld -R we can then refer to
37−# these symbols in the kernel code rather than hand-coded addresses.
36+# table and layout of the linked DSO. With ld --just-symbols we can then
37+# refer to these symbols in the kernel code rather than hand-coded addresses.
3838
3939 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
4040 -Wl,--build-id -Wl,--hash-style=both
4141 $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
4242 $(call if_changed,vdsold)
4343
44−LDFLAGS_vdso-syms.o := -r -R
44+LDFLAGS_vdso-syms.o := -r --just-symbols
4545 $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
4646 $(call if_changed,ld)
4747
arch/s390/lib/uaccess.c+4−0
@@ -64,10 +64,13 @@ mm_segment_t enable_sacf_uaccess(void) · 63 unmodified lines
6464 {
6565 mm_segment_t old_fs;
6666 unsigned long asce, cr;
67+ unsigned long flags;
6768
6869 old_fs = current->thread.mm_segment;
6970 if (old_fs & 1)
7071 return old_fs;
72+ /* protect against a concurrent page table upgrade */
73+ local_irq_save(flags);
7174 current->thread.mm_segment |= 1;
7275 asce = S390_lowcore.kernel_asce;
7376 if (likely(old_fs == USER_DS)) {
@@ -83,6 +86,7 @@ mm_segment_t enable_sacf_uaccess(void) · 9 unmodified lines
8386 __ctl_load(asce, 7, 7);
8487 set_cpu_flag(CIF_ASCE_SECONDARY);
8588 }
89+ local_irq_restore(flags);
8690 return old_fs;
8791 }
8892 EXPORT_SYMBOL(enable_sacf_uaccess);
arch/s390/mm/pgalloc.c+14−2
@@ -70,8 +70,20 @@ static void __crst_table_upgrade(void *arg) · 69 unmodified lines
7070 {
7171 struct mm_struct *mm = arg;
7272
73− if (current->active_mm == mm)
74− set_user_asce(mm);
73+ /* we must change all active ASCEs to avoid the creation of new TLBs */
74+ if (current->active_mm == mm) {
75+ S390_lowcore.user_asce = mm->context.asce;
76+ if (current->thread.mm_segment == USER_DS) {
77+ __ctl_load(S390_lowcore.user_asce, 1, 1);
78+ /* Mark user-ASCE present in CR1 */
79+ clear_cpu_flag(CIF_ASCE_PRIMARY);
80+ }
81+ if (current->thread.mm_segment == USER_DS_SACF) {
82+ __ctl_load(S390_lowcore.user_asce, 7, 7);
83+ /* enable_sacf_uaccess does all or nothing */
84+ WARN_ON(!test_cpu_flag(CIF_ASCE_SECONDARY));
85+ }
86+ }
7587 __tlb_flush_local();
7688 }
7789
arch/x86/hyperv/hv_init.c+10−2
@@ -73,7 +73,8 @@ static int hv_cpu_init(unsigned int cpu) · 72 unmodified lines
7373 struct page *pg;
7474
7575 input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg);
76− pg = alloc_page(GFP_KERNEL);
76+ /* hv_cpu_init() can be called with IRQs disabled from hv_resume() */
77+ pg = alloc_page(irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
7778 if (unlikely(!pg))
7879 return -ENOMEM;
7980 *input_arg = page_address(pg);
@@ -254,6 +255,7 @@ static int __init hv_pci_init(void) · 174 unmodified lines
254255 static int hv_suspend(void)
255256 {
256257 union hv_x64_msr_hypercall_contents hypercall_msr;
258+ int ret;
257259
258260 /*
259261 * Reset the hypercall page as it is going to be invalidated
@@ -270,12 +272,17 @@ static int hv_suspend(void) · 10 unmodified lines
270272 hypercall_msr.enable = 0;
271273 wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
272274
273− return 0;
275+ ret = hv_cpu_die(0);
276+ return ret;
274277 }
275278
276279 static void hv_resume(void)
277280 {
278281 union hv_x64_msr_hypercall_contents hypercall_msr;
282+ int ret;
283+
284+ ret = hv_cpu_init(0);
285+ WARN_ON(ret);
279286
280287 /* Re-enable the hypercall page */
281288 rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
@@ -288,6 +295,7 @@ static void hv_resume(void) · 6 unmodified lines
288295 hv_hypercall_pg_saved = NULL;
289296 }
290297
298+/* Note: when the ops are called, only CPU0 is online and IRQs are disabled. */
291299 static struct syscore_ops hv_syscore_ops = {
292300 .suspend = hv_suspend,
293301 .resume = hv_resume,
arch/x86/include/asm/mshyperv.h+2−0
@@ -35,6 +35,8 @@ typedef int (*hyperv_fill_flush_list_func)( · 34 unmodified lines
3535 rdmsrl(HV_X64_MSR_SINT0 + int_num, val)
3636 #define hv_set_synint_state(int_num, val) \
3737 wrmsrl(HV_X64_MSR_SINT0 + int_num, val)
38+#define hv_recommend_using_aeoi() \
39+ (!(ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED))
3840
3941 #define hv_get_crash_ctl(val) \
4042 rdmsrl(HV_X64_MSR_CRASH_CTL, val)
block/partitions/core.c+1−1
@@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev) · 495 unmodified lines
496496
497497 if (!disk_part_scan_enabled(disk))
498498 return 0;
499− if (bdev->bd_part_count || bdev->bd_openers > 1)
499+ if (bdev->bd_part_count)
500500 return -EBUSY;
501501 res = invalidate_partition(disk, 0);
502502 if (res)
drivers/acpi/device_pm.c+2−2
@@ -273,13 +273,13 @@ int acpi_device_set_power(struct acpi_device *device, int state) · 272 unmodified lines
273273 end:
274274 if (result) {
275275 dev_warn(&device->dev, "Failed to change power state to %s\n",
276− acpi_power_state_string(state));
276+ acpi_power_state_string(target_state));
277277 } else {
278278 device->power.state = target_state;
279279 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
280280 "Device [%s] transitioned to %s\n",
281281 device->pnp.bus_id,
282− acpi_power_state_string(state)));
282+ acpi_power_state_string(target_state)));
283283 }
284284
285285 return result;
drivers/cpufreq/intel_pstate.c+1−1
@@ -1059,7 +1059,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, · 1058 unmodified lines
10591059
10601060 update_turbo_state();
10611061 if (global.turbo_disabled) {
1062− pr_warn("Turbo disabled by BIOS or unavailable on processor\n");
1062+ pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n");
10631063 mutex_unlock(&intel_pstate_limits_lock);
10641064 mutex_unlock(&intel_pstate_driver_lock);
10651065 return -EPERM;
drivers/crypto/caam/caamalg.c+7−3
@@ -963,10 +963,12 @@ static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 962 unmodified lines
963963 struct caam_drv_private_jr *jrp = dev_get_drvdata(jrdev);
964964 struct aead_edesc *edesc;
965965 int ecode = 0;
966+ bool has_bklog;
966967
967968 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
968969
969970 edesc = rctx->edesc;
971+ has_bklog = edesc->bklog;
970972
971973 if (err)
972974 ecode = caam_jr_strstatus(jrdev, err);
@@ -979,7 +981,7 @@ static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 6 unmodified lines
979981 * If no backlog flag, the completion of the request is done
980982 * by CAAM, not crypto engine.
981983 */
982− if (!edesc->bklog)
984+ if (!has_bklog)
983985 aead_request_complete(req, ecode);
984986 else
985987 crypto_finalize_aead_request(jrp->engine, req, ecode);
@@ -995,10 +997,12 @@ static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 9 unmodified lines
995997 struct caam_drv_private_jr *jrp = dev_get_drvdata(jrdev);
996998 int ivsize = crypto_skcipher_ivsize(skcipher);
997999 int ecode = 0;
1000+ bool has_bklog;
9981001
9991002 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
10001003
10011004 edesc = rctx->edesc;
1005+ has_bklog = edesc->bklog;
10021006 if (err)
10031007 ecode = caam_jr_strstatus(jrdev, err);
10041008
@@ -1028,7 +1032,7 @@ static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err, · 23 unmodified lines
10281032 * If no backlog flag, the completion of the request is done
10291033 * by CAAM, not crypto engine.
10301034 */
1031− if (!edesc->bklog)
1035+ if (!has_bklog)
10321036 skcipher_request_complete(req, ecode);
10331037 else
10341038 crypto_finalize_skcipher_request(jrp->engine, req, ecode);
@@ -1711,7 +1715,7 @@ static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req, · 676 unmodified lines
17111715
17121716 if (ivsize || mapped_dst_nents > 1)
17131717 sg_to_sec4_set_last(edesc->sec4_sg + dst_sg_idx +
1714− mapped_dst_nents);
1718+ mapped_dst_nents - 1 + !!ivsize);
17151719
17161720 if (sec4_sg_bytes) {
17171721 edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
drivers/crypto/caam/caamhash.c+6−2
@@ -583,10 +583,12 @@ static inline void ahash_done_cpy(struct device *jrdev, u32 *desc, u32 err, · 582 unmodified lines
583583 struct caam_hash_state *state = ahash_request_ctx(req);
584584 struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
585585 int ecode = 0;
586+ bool has_bklog;
586587
587588 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
588589
589590 edesc = state->edesc;
591+ has_bklog = edesc->bklog;
590592
591593 if (err)
592594 ecode = caam_jr_strstatus(jrdev, err);
@@ -603,7 +605,7 @@ static inline void ahash_done_cpy(struct device *jrdev, u32 *desc, u32 err, · 10 unmodified lines
603605 * If no backlog flag, the completion of the request is done
604606 * by CAAM, not crypto engine.
605607 */
606− if (!edesc->bklog)
608+ if (!has_bklog)
607609 req->base.complete(&req->base, ecode);
608610 else
609611 crypto_finalize_hash_request(jrp->engine, req, ecode);
@@ -632,10 +634,12 @@ static inline void ahash_done_switch(struct device *jrdev, u32 *desc, u32 err, · 22 unmodified lines
632634 struct caam_hash_state *state = ahash_request_ctx(req);
633635 int digestsize = crypto_ahash_digestsize(ahash);
634636 int ecode = 0;
637+ bool has_bklog;
635638
636639 dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
637640
638641 edesc = state->edesc;
642+ has_bklog = edesc->bklog;
639643 if (err)
640644 ecode = caam_jr_strstatus(jrdev, err);
641645
@@ -663,7 +667,7 @@ static inline void ahash_done_switch(struct device *jrdev, u32 *desc, u32 err, · 21 unmodified lines
663667 * If no backlog flag, the completion of the request is done
664668 * by CAAM, not crypto engine.
665669 */
666− if (!edesc->bklog)
670+ if (!has_bklog)
667671 req->base.complete(&req->base, ecode);
668672 else
669673 crypto_finalize_hash_request(jrp->engine, req, ecode);
drivers/crypto/caam/caampkc.c+6−2
@@ -121,11 +121,13 @@ static void rsa_pub_done(struct device *dev, u32 *desc, u32 err, void *context) · 120 unmodified lines
121121 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);
122122 struct rsa_edesc *edesc;
123123 int ecode = 0;
124+ bool has_bklog;
124125
125126 if (err)
126127 ecode = caam_jr_strstatus(dev, err);
127128
128129 edesc = req_ctx->edesc;
130+ has_bklog = edesc->bklog;
129131
130132 rsa_pub_unmap(dev, edesc, req);
131133 rsa_io_unmap(dev, edesc, req);
@@ -135,7 +137,7 @@ static void rsa_pub_done(struct device *dev, u32 *desc, u32 err, void *context) · 3 unmodified lines
135137 * If no backlog flag, the completion of the request is done
136138 * by CAAM, not crypto engine.
137139 */
138− if (!edesc->bklog)
140+ if (!has_bklog)
139141 akcipher_request_complete(req, ecode);
140142 else
141143 crypto_finalize_akcipher_request(jrp->engine, req, ecode);
@@ -152,11 +154,13 @@ static void rsa_priv_f_done(struct device *dev, u32 *desc, u32 err, · 10 unmodified lines
152154 struct caam_rsa_req_ctx *req_ctx = akcipher_request_ctx(req);
153155 struct rsa_edesc *edesc;
154156 int ecode = 0;
157+ bool has_bklog;
155158
156159 if (err)
157160 ecode = caam_jr_strstatus(dev, err);
158161
159162 edesc = req_ctx->edesc;
163+ has_bklog = edesc->bklog;
160164
161165 switch (key->priv_form) {
162166 case FORM1:
@@ -176,7 +180,7 @@ static void rsa_priv_f_done(struct device *dev, u32 *desc, u32 err, · 13 unmodified lines
176180 * If no backlog flag, the completion of the request is done
177181 * by CAAM, not crypto engine.
178182 */
179− if (!edesc->bklog)
183+ if (!has_bklog)
180184 akcipher_request_complete(req, ecode);
181185 else
182186 crypto_finalize_akcipher_request(jrp->engine, req, ecode);
drivers/dma-buf/dma-buf.c+4−3
@@ -388,7 +388,8 @@ static long dma_buf_ioctl(struct file *file, · 387 unmodified lines
388388
389389 return ret;
390390
391− case DMA_BUF_SET_NAME:
391+ case DMA_BUF_SET_NAME_A:
392+ case DMA_BUF_SET_NAME_B:
392393 return dma_buf_set_name(dmabuf, (const char __user *)arg);
393394
394395 default:
@@ -655,8 +656,8 @@ EXPORT_SYMBOL_GPL(dma_buf_put); · 260 unmodified lines
655656 * calls attach() of dma_buf_ops to allow device-specific attach functionality
656657 * @dmabuf: [in] buffer to attach device to.
657658 * @dev: [in] device to be attached.
658− * @importer_ops [in] importer operations for the attachment
659− * @importer_priv [in] importer private pointer for the attachment
659+ * @importer_ops: [in] importer operations for the attachment
660+ * @importer_priv: [in] importer private pointer for the attachment
660661 *
661662 * Returns struct dma_buf_attachment pointer for this attachment. Attachments
662663 * must be cleaned up by calling dma_buf_detach().
drivers/dma/Kconfig+2−1
@@ -241,7 +241,8 @@ config FSL_RAID · 240 unmodified lines
241241
242242 config HISI_DMA
243243 tristate "HiSilicon DMA Engine support"
244− depends on ARM64 || (COMPILE_TEST && PCI_MSI)
244+ depends on ARM64 || COMPILE_TEST
245+ depends on PCI_MSI
245246 select DMA_ENGINE
246247 select DMA_VIRTUAL_CHANNELS
247248 help
drivers/dma/dmaengine.c+26−34
@@ -232,10 +232,6 @@ static void chan_dev_release(struct device *dev) · 231 unmodified lines
232232 struct dma_chan_dev *chan_dev;
233233
234234 chan_dev = container_of(dev, typeof(*chan_dev), device);
235− if (atomic_dec_and_test(chan_dev->idr_ref)) {
236− ida_free(&dma_ida, chan_dev->dev_id);
237− kfree(chan_dev->idr_ref);
238− }
239235 kfree(chan_dev);
240236 }
241237
@@ -1043,27 +1039,9 @@ static int get_dma_id(struct dma_device *device) · 801 unmodified lines
10431039 }
10441040
10451041 static int __dma_async_device_channel_register(struct dma_device *device,
1046− struct dma_chan *chan,
1047− int chan_id)
1042+ struct dma_chan *chan)
10481043 {
10491044 int rc = 0;
1050− int chancnt = device->chancnt;
1051− atomic_t *idr_ref;
1052− struct dma_chan *tchan;
1053−
1054− tchan = list_first_entry_or_null(&device->channels,
1055− struct dma_chan, device_node);
1056− if (!tchan)
1057− return -ENODEV;
1058−
1059− if (tchan->dev) {
1060− idr_ref = tchan->dev->idr_ref;
1061− } else {
1062− idr_ref = kmalloc(sizeof(*idr_ref), GFP_KERNEL);
1063− if (!idr_ref)
1064− return -ENOMEM;
1065− atomic_set(idr_ref, 0);
1066− }
10671045
10681046 chan->local = alloc_percpu(typeof(*chan->local));
10691047 if (!chan->local)
@@ -1079,29 +1057,36 @@ static int __dma_async_device_channel_register(struct dma_device *device, · 9 unmodified lines
10791057 * When the chan_id is a negative value, we are dynamically adding
10801058 * the channel. Otherwise we are static enumerating.
10811059 */
1082− chan->chan_id = chan_id < 0 ? chancnt : chan_id;
1060+ mutex_lock(&device->chan_mutex);
1061+ chan->chan_id = ida_alloc(&device->chan_ida, GFP_KERNEL);
1062+ mutex_unlock(&device->chan_mutex);
1063+ if (chan->chan_id < 0) {
1064+ pr_err("%s: unable to alloc ida for chan: %d\n",
1065+ __func__, chan->chan_id);
1066+ goto err_out;
1067+ }
1068+
10831069 chan->dev->device.class = &dma_devclass;
10841070 chan->dev->device.parent = device->dev;
10851071 chan->dev->chan = chan;
1086− chan->dev->idr_ref = idr_ref;
10871072 chan->dev->dev_id = device->dev_id;
1088− atomic_inc(idr_ref);
10891073 dev_set_name(&chan->dev->device, "dma%dchan%d",
10901074 device->dev_id, chan->chan_id);
1091−
10921075 rc = device_register(&chan->dev->device);
10931076 if (rc)
1094− goto err_out;
1077+ goto err_out_ida;
10951078 chan->client_count = 0;
1096− device->chancnt = chan->chan_id + 1;
1079+ device->chancnt++;
10971080
10981081 return 0;
10991082
1083+ err_out_ida:
1084+ mutex_lock(&device->chan_mutex);
1085+ ida_free(&device->chan_ida, chan->chan_id);
1086+ mutex_unlock(&device->chan_mutex);
11001087 err_out:
11011088 free_percpu(chan->local);
11021089 kfree(chan->dev);
1103− if (atomic_dec_return(idr_ref) == 0)
1104− kfree(idr_ref);
11051090 return rc;
11061091 }
11071092
@@ -1110,7 +1095,7 @@ int dma_async_device_channel_register(struct dma_device *device, · 2 unmodified lines
11101095 {
11111096 int rc;
11121097
1113− rc = __dma_async_device_channel_register(device, chan, -1);
1098+ rc = __dma_async_device_channel_register(device, chan);
11141099 if (rc < 0)
11151100 return rc;
11161101
@@ -1130,6 +1115,9 @@ static void __dma_async_device_channel_unregister(struct dma_device *device, · 13 unmodified lines
11301115 device->chancnt--;
11311116 chan->dev->chan = NULL;
11321117 mutex_unlock(&dma_list_mutex);
1118+ mutex_lock(&device->chan_mutex);
1119+ ida_free(&device->chan_ida, chan->chan_id);
1120+ mutex_unlock(&device->chan_mutex);
11331121 device_unregister(&chan->dev->device);
11341122 free_percpu(chan->local);
11351123 }
@@ -1152,7 +1140,7 @@ EXPORT_SYMBOL_GPL(dma_async_device_channel_unregister); · 16 unmodified lines
11521140 */
11531141 int dma_async_device_register(struct dma_device *device)
11541142 {
1155− int rc, i = 0;
1143+ int rc;
11561144 struct dma_chan* chan;
11571145
11581146 if (!device)
@@ -1257,9 +1245,12 @@ int dma_async_device_register(struct dma_device *device) · 98 unmodified lines
12571245 if (rc != 0)
12581246 return rc;
12591247
1248+ mutex_init(&device->chan_mutex);
1249+ ida_init(&device->chan_ida);
1250+
12601251 /* represent channels in sysfs. Probably want devs too */
12611252 list_for_each_entry(chan, &device->channels, device_node) {
1262− rc = __dma_async_device_channel_register(device, chan, i++);
1253+ rc = __dma_async_device_channel_register(device, chan);
12631254 if (rc < 0)
12641255 goto err_out;
12651256 }
@@ -1334,6 +1325,7 @@ void dma_async_device_unregister(struct dma_device *device) · 68 unmodified lines
13341325 */
13351326 dma_cap_set(DMA_PRIVATE, device->cap_mask);
13361327 dma_channel_rebalance();
1328+ ida_free(&dma_ida, device->dev_id);
13371329 dma_device_put(device);
13381330 mutex_unlock(&dma_list_mutex);
13391331 }
drivers/dma/dmatest.c+3−3
@@ -240,7 +240,7 @@ static bool is_threaded_test_run(struct dmatest_info *info) · 239 unmodified lines
240240 struct dmatest_thread *thread;
241241
242242 list_for_each_entry(thread, &dtc->threads, node) {
243− if (!thread->done)
243+ if (!thread->done && !thread->pending)
244244 return true;
245245 }
246246 }
@@ -662,8 +662,8 @@ static int dmatest_func(void *data) · 415 unmodified lines
662662 flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
663663
664664 ktime = ktime_get();
665− while (!kthread_should_stop()
666− && !(params->iterations && total_tests >= params->iterations)) {
665+ while (!(kthread_should_stop() ||
666+ (params->iterations && total_tests >= params->iterations))) {
667667 struct dma_async_tx_descriptor *tx = NULL;
668668 struct dmaengine_unmap_data *um;
669669 dma_addr_t *dsts;
drivers/dma/mmp_tdma.c+4−1
@@ -363,6 +363,8 @@ static void mmp_tdma_free_descriptor(struct mmp_tdma_chan *tdmac) · 362 unmodified lines
363363 gen_pool_free(gpool, (unsigned long)tdmac->desc_arr,
364364 size);
365365 tdmac->desc_arr = NULL;
366+ if (tdmac->status == DMA_ERROR)
367+ tdmac->status = DMA_COMPLETE;
366368
367369 return;
368370 }
@@ -443,7 +445,8 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic( · 74 unmodified lines
443445 if (!desc)
444446 goto err_out;
445447
446− mmp_tdma_config_write(chan, direction, &tdmac->slave_config);
448+ if (mmp_tdma_config_write(chan, direction, &tdmac->slave_config))
449+ goto err_out;
447450
448451 while (buf < buf_len) {
449452 desc = &tdmac->desc_arr[i];
drivers/dma/pch_dma.c+1−1
@@ -865,6 +865,7 @@ static int pch_dma_probe(struct pci_dev *pdev, · 864 unmodified lines
865865 }
866866
867867 pci_set_master(pdev);
868+ pd->dma.dev = &pdev->dev;
868869
869870 err = request_irq(pdev->irq, pd_irq, IRQF_SHARED, DRV_NAME, pd);
870871 if (err) {
@@ -880,7 +881,6 @@ static int pch_dma_probe(struct pci_dev *pdev, · 9 unmodified lines
880881 goto err_free_irq;
881882 }
882883
883− pd->dma.dev = &pdev->dev;
884884
885885 INIT_LIST_HEAD(&pd->dma.channels);
886886
drivers/dma/tegra20-apb-dma.c+9−0
@@ -816,6 +816,13 @@ static bool tegra_dma_eoc_interrupt_deasserted(struct tegra_dma_channel *tdc) · 815 unmodified lines
816816 static void tegra_dma_synchronize(struct dma_chan *dc)
817817 {
818818 struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
819+ int err;
820+
821+ err = pm_runtime_get_sync(tdc->tdma->dev);
822+ if (err < 0) {
823+ dev_err(tdc2dev(tdc), "Failed to synchronize DMA: %d\n", err);
824+ return;
825+ }
819826
820827 /*
821828 * CPU, which handles interrupt, could be busy in
@@ -825,6 +832,8 @@ static void tegra_dma_synchronize(struct dma_chan *dc) · 3 unmodified lines
825832 wait_event(tdc->wq, tegra_dma_eoc_interrupt_deasserted(tdc));
826833
827834 tasklet_kill(&tdc->tasklet);
835+
836+ pm_runtime_put(tdc->tdma->dev);
828837 }
829838
830839 static unsigned int tegra_dma_sg_bytes_xferred(struct tegra_dma_channel *tdc,
drivers/dma/ti/k3-psil.c+1−0
@@ -27,6 +27,7 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id) · 26 unmodified lines
2727 soc_ep_map = &j721e_ep_map;
2828 } else {
2929 pr_err("PSIL: No compatible machine found for map\n");
30+ mutex_unlock(&ep_map_mutex);
3031 return ERR_PTR(-ENOTSUPP);
3132 }
3233 pr_debug("%s: Using map for %s\n", __func__, soc_ep_map->name);
drivers/dma/xilinx/xilinx_dma.c+10−10
@@ -1230,16 +1230,16 @@ static enum dma_status xilinx_dma_tx_status(struct dma_chan *dchan, · 1229 unmodified lines
12301230 return ret;
12311231
12321232 spin_lock_irqsave(&chan->lock, flags);
1233−
1234− desc = list_last_entry(&chan->active_list,
1235− struct xilinx_dma_tx_descriptor, node);
1236− /*
1237− * VDMA and simple mode do not support residue reporting, so the
1238− * residue field will always be 0.
1239− */
1240− if (chan->has_sg && chan->xdev->dma_config->dmatype != XDMA_TYPE_VDMA)
1241− residue = xilinx_dma_get_residue(chan, desc);
1242−
1233+ if (!list_empty(&chan->active_list)) {
1234+ desc = list_last_entry(&chan->active_list,
1235+ struct xilinx_dma_tx_descriptor, node);
1236+ /*
1237+ * VDMA and simple mode do not support residue reporting, so the
1238+ * residue field will always be 0.
1239+ */
1240+ if (chan->has_sg && chan->xdev->dma_config->dmatype != XDMA_TYPE_VDMA)
1241+ residue = xilinx_dma_get_residue(chan, desc);
1242+ }
12431243 spin_unlock_irqrestore(&chan->lock, flags);
12441244
12451245 dma_set_residue(txstate, residue);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−1
@@ -85,9 +85,10 @@ · 84 unmodified lines
8585 * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches
8686 * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
8787 * - 3.36.0 - Allow reading more status registers on si/cik
88+ * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
8889 */
8990 #define KMS_DRIVER_MAJOR 3
90−#define KMS_DRIVER_MINOR 36
91+#define KMS_DRIVER_MINOR 37
9192 #define KMS_DRIVER_PATCHLEVEL 0
9293
9394 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/navi10_sdma_pkt_open.h+16−0
@@ -73,6 +73,22 @@ · 72 unmodified lines
7373 #define SDMA_OP_AQL_COPY 0
7474 #define SDMA_OP_AQL_BARRIER_OR 0
7575
76+#define SDMA_GCR_RANGE_IS_PA (1 << 18)
77+#define SDMA_GCR_SEQ(x) (((x) & 0x3) << 16)
78+#define SDMA_GCR_GL2_WB (1 << 15)
79+#define SDMA_GCR_GL2_INV (1 << 14)
80+#define SDMA_GCR_GL2_DISCARD (1 << 13)
81+#define SDMA_GCR_GL2_RANGE(x) (((x) & 0x3) << 11)
82+#define SDMA_GCR_GL2_US (1 << 10)
83+#define SDMA_GCR_GL1_INV (1 << 9)
84+#define SDMA_GCR_GLV_INV (1 << 8)
85+#define SDMA_GCR_GLK_INV (1 << 7)
86+#define SDMA_GCR_GLK_WB (1 << 6)
87+#define SDMA_GCR_GLM_INV (1 << 5)
88+#define SDMA_GCR_GLM_WB (1 << 4)
89+#define SDMA_GCR_GL1_RANGE(x) (((x) & 0x3) << 2)
90+#define SDMA_GCR_GLI_INV(x) (((x) & 0x3) << 0)
91+
7692 /*define for op field*/
7793 #define SDMA_PKT_HEADER_op_offset 0
7894 #define SDMA_PKT_HEADER_op_mask 0x000000FF
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+13−1
@@ -382,6 +382,18 @@ static void sdma_v5_0_ring_emit_ib(struct amdgpu_ring *ring, · 381 unmodified lines
382382 unsigned vmid = AMDGPU_JOB_GET_VMID(job);
383383 uint64_t csa_mc_addr = amdgpu_sdma_get_csa_mc_addr(ring, vmid);
384384
385+ /* Invalidate L2, because if we don't do it, we might get stale cache
386+ * lines from previous IBs.
387+ */
388+ amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_GCR_REQ));
389+ amdgpu_ring_write(ring, 0);
390+ amdgpu_ring_write(ring, (SDMA_GCR_GL2_INV |
391+ SDMA_GCR_GL2_WB |
392+ SDMA_GCR_GLM_INV |
393+ SDMA_GCR_GLM_WB) << 16);
394+ amdgpu_ring_write(ring, 0xffffff80);
395+ amdgpu_ring_write(ring, 0xffff);
396+
385397 /* An IB packet must end on a 8 DW boundary--the next dword
386398 * must be on a 8-dword boundary. Our IB packet below is 6
387399 * dwords long, thus add x number of NOPs, such that, in
@@ -1595,7 +1607,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · 1207 unmodified lines
15951607 SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
15961608 SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
15971609 10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
1598− .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
1610+ .emit_ib_size = 5 + 7 + 6, /* sdma_v5_0_ring_emit_ib */
15991611 .emit_ib = sdma_v5_0_ring_emit_ib,
16001612 .emit_fence = sdma_v5_0_ring_emit_fence,
16011613 .emit_pipeline_sync = sdma_v5_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+29−9
@@ -3340,7 +3340,8 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev, · 3339 unmodified lines
33403340 const union dc_tiling_info *tiling_info,
33413341 const uint64_t info,
33423342 struct dc_plane_dcc_param *dcc,
3343− struct dc_plane_address *address)
3343+ struct dc_plane_address *address,
3344+ bool force_disable_dcc)
33443345 {
33453346 struct dc *dc = adev->dm.dc;
33463347 struct dc_dcc_surface_param input;
@@ -3352,6 +3353,9 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev, · 5 unmodified lines
33523353 memset(&input, 0, sizeof(input));
33533354 memset(&output, 0, sizeof(output));
33543355
3356+ if (force_disable_dcc)
3357+ return 0;
3358+
33553359 if (!offset)
33563360 return 0;
33573361
@@ -3401,7 +3405,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, · 43 unmodified lines
34013405 union dc_tiling_info *tiling_info,
34023406 struct plane_size *plane_size,
34033407 struct dc_plane_dcc_param *dcc,
3404− struct dc_plane_address *address)
3408+ struct dc_plane_address *address,
3409+ bool force_disable_dcc)
34053410 {
34063411 const struct drm_framebuffer *fb = &afb->base;
34073412 int ret;
@@ -3507,7 +3512,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, · 99 unmodified lines
35073512
35083513 ret = fill_plane_dcc_attributes(adev, afb, format, rotation,
35093514 plane_size, tiling_info,
3510− tiling_flags, dcc, address);
3515+ tiling_flags, dcc, address,
3516+ force_disable_dcc);
35113517 if (ret)
35123518 return ret;
35133519 }
@@ -3599,7 +3605,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, · 85 unmodified lines
35993605 const struct drm_plane_state *plane_state,
36003606 const uint64_t tiling_flags,
36013607 struct dc_plane_info *plane_info,
3602− struct dc_plane_address *address)
3608+ struct dc_plane_address *address,
3609+ bool force_disable_dcc)
36033610 {
36043611 const struct drm_framebuffer *fb = plane_state->fb;
36053612 const struct amdgpu_framebuffer *afb =
@@ -3681,7 +3688,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, · 75 unmodified lines
36813688 plane_info->rotation, tiling_flags,
36823689 &plane_info->tiling_info,
36833690 &plane_info->plane_size,
3684− &plane_info->dcc, address);
3691+ &plane_info->dcc, address,
3692+ force_disable_dcc);
36853693 if (ret)
36863694 return ret;
36873695
@@ -3704,6 +3712,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 16 unmodified lines
37043712 struct dc_plane_info plane_info;
37053713 uint64_t tiling_flags;
37063714 int ret;
3715+ bool force_disable_dcc = false;
37073716
37083717 ret = fill_dc_scaling_info(plane_state, &scaling_info);
37093718 if (ret)
@@ -3718,9 +3727,11 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 8 unmodified lines
37183727 if (ret)
37193728 return ret;
37203729
3730+ force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend;
37213731 ret = fill_dc_plane_info_and_addr(adev, plane_state, tiling_flags,
37223732 &plane_info,
3723− &dc_plane_state->address);
3733+ &dc_plane_state->address,
3734+ force_disable_dcc);
37243735 if (ret)
37253736 return ret;
37263737
@@ -5342,6 +5353,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · 1615 unmodified lines
53425353 uint64_t tiling_flags;
53435354 uint32_t domain;
53445355 int r;
5356+ bool force_disable_dcc = false;
53455357
53465358 dm_plane_state_old = to_dm_plane_state(plane->state);
53475359 dm_plane_state_new = to_dm_plane_state(new_state);
@@ -5400,11 +5412,13 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · 52 unmodified lines
54005412 dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) {
54015413 struct dc_plane_state *plane_state = dm_plane_state_new->dc_state;
54025414
5415+ force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend;
54035416 fill_plane_buffer_attributes(
54045417 adev, afb, plane_state->format, plane_state->rotation,
54055418 tiling_flags, &plane_state->tiling_info,
54065419 &plane_state->plane_size, &plane_state->dcc,
5407− &plane_state->address);
5420+ &plane_state->address,
5421+ force_disable_dcc);
54085422 }
54095423
54105424 return 0;
@@ -6676,7 +6690,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 1265 unmodified lines
66766690 fill_dc_plane_info_and_addr(
66776691 dm->adev, new_plane_state, tiling_flags,
66786692 &bundle->plane_infos[planes_count],
6679− &bundle->flip_addrs[planes_count].address);
6693+ &bundle->flip_addrs[planes_count].address,
6694+ false);
6695+
6696+ DRM_DEBUG_DRIVER("plane: id=%d dcc_en=%d\n",
6697+ new_plane_state->plane->index,
6698+ bundle->plane_infos[planes_count].dcc.enable);
66806699
66816700 bundle->surface_updates[planes_count].plane_info =
66826701 &bundle->plane_infos[planes_count];
@@ -8096,7 +8115,8 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, · 1413 unmodified lines
80968115 ret = fill_dc_plane_info_and_addr(
80978116 dm->adev, new_plane_state, tiling_flags,
80988117 plane_info,
8099− &flip_addr->address);
8118+ &flip_addr->address,
8119+ false);
81008120 if (ret)
81018121 goto cleanup;
81028122
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+27−0
@@ -2908,6 +2908,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd · 2907 unmodified lines
29082908 sizeof(hpd_irq_dpcd_data),
29092909 "Status: ");
29102910
2911+ for (i = 0; i < MAX_PIPES; i++) {
2912+ pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
2913+ if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
2914+ link->dc->hwss.blank_stream(pipe_ctx);
2915+ }
2916+
29112917 for (i = 0; i < MAX_PIPES; i++) {
29122918 pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
29132919 if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
@@ -2927,6 +2933,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd · 13 unmodified lines
29272933 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
29282934 dc_link_reallocate_mst_payload(link);
29292935
2936+ for (i = 0; i < MAX_PIPES; i++) {
2937+ pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
2938+ if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
2939+ link->dc->hwss.unblank_stream(pipe_ctx, &previous_link_settings);
2940+ }
2941+
29302942 status = false;
29312943 if (out_link_loss)
29322944 *out_link_loss = true;
@@ -4227,6 +4239,21 @@ void dp_set_fec_enable(struct dc_link *link, bool enable) · 1294 unmodified lines
42274239 void dpcd_set_source_specific_data(struct dc_link *link)
42284240 {
42294241 const uint32_t post_oui_delay = 30; // 30ms
4242+ uint8_t dspc = 0;
4243+ enum dc_status ret = DC_ERROR_UNEXPECTED;
4244+
4245+ ret = core_link_read_dpcd(link, DP_DOWN_STREAM_PORT_COUNT, &dspc,
4246+ sizeof(dspc));
4247+
4248+ if (ret != DC_OK) {
4249+ DC_LOG_ERROR("Error in DP aux read transaction,"
4250+ " not writing source specific data\n");
4251+ return;
4252+ }
4253+
4254+ /* Return if OUI unsupported */
4255+ if (!(dspc & DP_OUI_SUPPORT))
4256+ return;
42304257
42314258 if (!link->dc->vendor_signature.is_valid) {
42324259 struct dpcd_amd_signature amd_signature;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c+4−36
@@ -231,34 +231,6 @@ struct dc_stream_status *dc_stream_get_status( · 230 unmodified lines
231231 return dc_stream_get_status_from_state(dc->current_state, stream);
232232 }
233233
234−static void delay_cursor_until_vupdate(struct pipe_ctx *pipe_ctx, struct dc *dc)
235−{
236−#if defined(CONFIG_DRM_AMD_DC_DCN)
237− unsigned int vupdate_line;
238− unsigned int lines_to_vupdate, us_to_vupdate, vpos, nvpos;
239− struct dc_stream_state *stream = pipe_ctx->stream;
240− unsigned int us_per_line;
241−
242− if (stream->ctx->asic_id.chip_family == FAMILY_RV &&
243− ASICREV_IS_RAVEN(stream->ctx->asic_id.hw_internal_rev)) {
244−
245− vupdate_line = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx);
246− if (!dc_stream_get_crtc_position(dc, &stream, 1, &vpos, &nvpos))
247− return;
248−
249− if (vpos >= vupdate_line)
250− return;
251−
252− us_per_line = stream->timing.h_total * 10000 / stream->timing.pix_clk_100hz;
253− lines_to_vupdate = vupdate_line - vpos;
254− us_to_vupdate = lines_to_vupdate * us_per_line;
255−
256− /* 70 us is a conservative estimate of cursor update time*/
257− if (us_to_vupdate < 70)
258− udelay(us_to_vupdate);
259− }
260−#endif
261−}
262234
263235 /**
264236 * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor surface address
@@ -298,9 +270,7 @@ bool dc_stream_set_cursor_attributes( · 33 unmodified lines
298270
299271 if (!pipe_to_program) {
300272 pipe_to_program = pipe_ctx;
301−
302− delay_cursor_until_vupdate(pipe_ctx, dc);
303− dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
273+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
304274 }
305275
306276 dc->hwss.set_cursor_attribute(pipe_ctx);
@@ -309,7 +279,7 @@ bool dc_stream_set_cursor_attributes( · 2 unmodified lines
309279 }
310280
311281 if (pipe_to_program)
312− dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
282+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
313283
314284 return true;
315285 }
@@ -349,16 +319,14 @@ bool dc_stream_set_cursor_position( · 33 unmodified lines
349319
350320 if (!pipe_to_program) {
351321 pipe_to_program = pipe_ctx;
352−
353− delay_cursor_until_vupdate(pipe_ctx, dc);
354− dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
322+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
355323 }
356324
357325 dc->hwss.set_cursor_position(pipe_ctx);
358326 }
359327
360328 if (pipe_to_program)
361− dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
329+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
362330
363331 return true;
364332 }
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+1−0
@@ -2757,6 +2757,7 @@ static const struct hw_sequencer_funcs dce110_funcs = { · 2756 unmodified lines
27572757 .disable_plane = dce110_power_down_fe,
27582758 .pipe_control_lock = dce_pipe_control_lock,
27592759 .interdependent_update_lock = NULL,
2760+ .cursor_lock = dce_pipe_control_lock,
27602761 .prepare_bandwidth = dce110_prepare_bandwidth,
27612762 .optimize_bandwidth = dce110_optimize_bandwidth,
27622763 .set_drr = set_drr,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+10−0
@@ -1625,6 +1625,16 @@ void dcn10_pipe_control_lock( · 1624 unmodified lines
16251625 hws->funcs.verify_allow_pstate_change_high(dc);
16261626 }
16271627
1628+void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock)
1629+{
1630+ /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
1631+ if (!pipe || pipe->top_pipe)
1632+ return;
1633+
1634+ dc->res_pool->mpc->funcs->cursor_lock(dc->res_pool->mpc,
1635+ pipe->stream_res.opp->inst, lock);
1636+}
1637+
16281638 static bool wait_for_reset_trigger_to_occur(
16291639 struct dc_context *dc_ctx,
16301640 struct timing_generator *tg)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h+1−0
@@ -49,6 +49,7 @@ void dcn10_pipe_control_lock( · 48 unmodified lines
4949 struct dc *dc,
5050 struct pipe_ctx *pipe,
5151 bool lock);
52+void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock);
5253 void dcn10_blank_pixel_data(
5354 struct dc *dc,
5455 struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c+1−0
@@ -50,6 +50,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { · 49 unmodified lines
5050 .disable_audio_stream = dce110_disable_audio_stream,
5151 .disable_plane = dcn10_disable_plane,
5252 .pipe_control_lock = dcn10_pipe_control_lock,
53+ .cursor_lock = dcn10_cursor_lock,
5354 .interdependent_update_lock = dcn10_lock_all_pipes,
5455 .prepare_bandwidth = dcn10_prepare_bandwidth,
5556 .optimize_bandwidth = dcn10_optimize_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c+15−0
@@ -223,6 +223,9 @@ struct mpcc *mpc1_insert_plane( · 222 unmodified lines
223223 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, dpp_id);
224224 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, tree->opp_id);
225225
226+ /* Configure VUPDATE lock set for this MPCC to map to the OPP */
227+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, tree->opp_id);
228+
226229 /* update mpc tree mux setting */
227230 if (tree->opp_list == insert_above_mpcc) {
228231 /* insert the toppest mpcc */
@@ -318,6 +321,7 @@ void mpc1_remove_mpcc( · 89 unmodified lines
318321 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
319322 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
320323 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
324+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
321325
322326 /* mark this mpcc as not in use */
323327 mpc10->mpcc_in_use_mask &= ~(1 << mpcc_id);
@@ -328,6 +332,7 @@ void mpc1_remove_mpcc( · 4 unmodified lines
328332 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
329333 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
330334 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
335+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
331336 }
332337 }
333338
@@ -361,6 +366,7 @@ void mpc1_mpc_init(struct mpc *mpc) · 27 unmodified lines
361366 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
362367 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
363368 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
369+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
364370
365371 mpc1_init_mpcc(&(mpc->mpcc_array[mpcc_id]), mpcc_id);
366372 }
@@ -381,6 +387,7 @@ void mpc1_mpc_init_single_inst(struct mpc *mpc, unsigned int mpcc_id) · 14 unmodified lines
381387 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
382388 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
383389 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
390+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
384391
385392 mpc1_init_mpcc(&(mpc->mpcc_array[mpcc_id]), mpcc_id);
386393
@@ -453,6 +460,13 @@ void mpc1_read_mpcc_state( · 66 unmodified lines
453460 MPCC_BUSY, &s->busy);
454461 }
455462
463+void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock)
464+{
465+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
466+
467+ REG_SET(CUR[opp_id], 0, CUR_VUPDATE_LOCK_SET, lock ? 1 : 0);
468+}
469+
456470 static const struct mpc_funcs dcn10_mpc_funcs = {
457471 .read_mpcc_state = mpc1_read_mpcc_state,
458472 .insert_plane = mpc1_insert_plane,
@@ -464,6 +478,7 @@ static const struct mpc_funcs dcn10_mpc_funcs = { · 5 unmodified lines
464478 .assert_mpcc_idle_before_connect = mpc1_assert_mpcc_idle_before_connect,
465479 .init_mpcc_list_from_hw = mpc1_init_mpcc_list_from_hw,
466480 .update_blending = mpc1_update_blending,
481+ .cursor_lock = mpc1_cursor_lock,
467482 .set_denorm = NULL,
468483 .set_denorm_clamp = NULL,
469484 .set_output_csc = NULL,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h+14−6
@@ -39,11 +39,12 @@ · 38 unmodified lines
3939 SRII(MPCC_BG_G_Y, MPCC, inst),\
4040 SRII(MPCC_BG_R_CR, MPCC, inst),\
4141 SRII(MPCC_BG_B_CB, MPCC, inst),\
42− SRII(MPCC_BG_B_CB, MPCC, inst),\
43− SRII(MPCC_SM_CONTROL, MPCC, inst)
42+ SRII(MPCC_SM_CONTROL, MPCC, inst),\
43+ SRII(MPCC_UPDATE_LOCK_SEL, MPCC, inst)
4444
4545 #define MPC_OUT_MUX_COMMON_REG_LIST_DCN1_0(inst) \
46− SRII(MUX, MPC_OUT, inst)
46+ SRII(MUX, MPC_OUT, inst),\
47+ VUPDATE_SRII(CUR, VUPDATE_LOCK_SET, inst)
4748
4849 #define MPC_COMMON_REG_VARIABLE_LIST \
4950 uint32_t MPCC_TOP_SEL[MAX_MPCC]; \
@@ -55,7 +56,9 @@ · 5 unmodified lines
5556 uint32_t MPCC_BG_R_CR[MAX_MPCC]; \
5657 uint32_t MPCC_BG_B_CB[MAX_MPCC]; \
5758 uint32_t MPCC_SM_CONTROL[MAX_MPCC]; \
58− uint32_t MUX[MAX_OPP];
59+ uint32_t MUX[MAX_OPP]; \
60+ uint32_t MPCC_UPDATE_LOCK_SEL[MAX_MPCC]; \
61+ uint32_t CUR[MAX_OPP];
5962
6063 #define MPC_COMMON_MASK_SH_LIST_DCN1_0(mask_sh)\
6164 SF(MPCC0_MPCC_TOP_SEL, MPCC_TOP_SEL, mask_sh),\
@@ -78,7 +81,8 @@ · 16 unmodified lines
7881 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FIELD_ALT, mask_sh),\
7982 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_FRAME_POL, mask_sh),\
8083 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_TOP_POL, mask_sh),\
81− SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh)
84+ SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh),\
85+ SF(MPCC0_MPCC_UPDATE_LOCK_SEL, MPCC_UPDATE_LOCK_SEL, mask_sh)
8286
8387 #define MPC_REG_FIELD_LIST(type) \
8488 type MPCC_TOP_SEL;\
@@ -101,7 +105,9 @@ · 16 unmodified lines
101105 type MPCC_SM_FIELD_ALT;\
102106 type MPCC_SM_FORCE_NEXT_FRAME_POL;\
103107 type MPCC_SM_FORCE_NEXT_TOP_POL;\
104− type MPC_OUT_MUX;
108+ type MPC_OUT_MUX;\
109+ type MPCC_UPDATE_LOCK_SEL;\
110+ type CUR_VUPDATE_LOCK_SET;
105111
106112 struct dcn_mpc_registers {
107113 MPC_COMMON_REG_VARIABLE_LIST
@@ -192,4 +198,6 @@ void mpc1_read_mpcc_state( · 84 unmodified lines
192198 int mpcc_inst,
193199 struct mpcc_state *s);
194200
201+void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock);
202+
195203 #endif
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c+12−2
@@ -181,6 +181,14 @@ enum dcn10_clk_src_array_id { · 180 unmodified lines
181181 .reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
182182 mm ## block ## id ## _ ## reg_name
183183
184+#define VUPDATE_SRII(reg_name, block, id)\
185+ .reg_name[id] = BASE(mm ## reg_name ## 0 ## _ ## block ## id ## _BASE_IDX) + \
186+ mm ## reg_name ## 0 ## _ ## block ## id
187+
188+/* set field/register/bitfield name */
189+#define SFRB(field_name, reg_name, bitfield, post_fix)\
190+ .field_name = reg_name ## __ ## bitfield ## post_fix
191+
184192 /* NBIO */
185193 #define NBIO_BASE_INNER(seg) \
186194 NBIF_BASE__INST0_SEG ## seg
@@ -419,11 +427,13 @@ static const struct dcn_mpc_registers mpc_regs = { · 232 unmodified lines
419427 };
420428
421429 static const struct dcn_mpc_shift mpc_shift = {
422− MPC_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT)
430+ MPC_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT),\
431+ SFRB(CUR_VUPDATE_LOCK_SET, CUR0_VUPDATE_LOCK_SET0, CUR0_VUPDATE_LOCK_SET, __SHIFT)
423432 };
424433
425434 static const struct dcn_mpc_mask mpc_mask = {
426− MPC_COMMON_MASK_SH_LIST_DCN1_0(_MASK),
435+ MPC_COMMON_MASK_SH_LIST_DCN1_0(_MASK),\
436+ SFRB(CUR_VUPDATE_LOCK_SET, CUR0_VUPDATE_LOCK_SET0, CUR0_VUPDATE_LOCK_SET, _MASK)
427437 };
428438
429439 #define tg_regs(id)\
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+2−1
@@ -2294,7 +2294,8 @@ void dcn20_fpga_init_hw(struct dc *dc) · 2293 unmodified lines
22942294
22952295 REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, 2);
22962296 REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, 1);
2297− REG_WRITE(REFCLK_CNTL, 0);
2297+ if (REG(REFCLK_CNTL))
2298+ REG_WRITE(REFCLK_CNTL, 0);
22982299 //
22992300
23002301
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c+1−0
@@ -52,6 +52,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { · 51 unmodified lines
5252 .disable_plane = dcn20_disable_plane,
5353 .pipe_control_lock = dcn20_pipe_control_lock,
5454 .interdependent_update_lock = dcn10_lock_all_pipes,
55+ .cursor_lock = dcn10_cursor_lock,
5556 .prepare_bandwidth = dcn20_prepare_bandwidth,
5657 .optimize_bandwidth = dcn20_optimize_bandwidth,
5758 .update_bandwidth = dcn20_update_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c+1−0
@@ -545,6 +545,7 @@ const struct mpc_funcs dcn20_mpc_funcs = { · 544 unmodified lines
545545 .mpc_init = mpc1_mpc_init,
546546 .mpc_init_single_inst = mpc1_mpc_init_single_inst,
547547 .update_blending = mpc2_update_blending,
548+ .cursor_lock = mpc1_cursor_lock,
548549 .get_mpcc_for_dpp = mpc2_get_mpcc_for_dpp,
549550 .wait_for_idle = mpc2_assert_idle_mpcc,
550551 .assert_mpcc_idle_before_connect = mpc2_assert_mpcc_idle_before_connect,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h+2−1
@@ -179,7 +179,8 @@ · 178 unmodified lines
179179 SF(MPC_OUT0_DENORM_CLAMP_G_Y, MPC_OUT_DENORM_CLAMP_MAX_G_Y, mask_sh),\
180180 SF(MPC_OUT0_DENORM_CLAMP_G_Y, MPC_OUT_DENORM_CLAMP_MIN_G_Y, mask_sh),\
181181 SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MAX_B_CB, mask_sh),\
182− SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh)
182+ SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh),\
183+ SF(CUR_VUPDATE_LOCK_SET0, CUR_VUPDATE_LOCK_SET, mask_sh)
183184
184185 /*
185186 * DCN2 MPC_OCSC debug status register:
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+4−0
@@ -508,6 +508,10 @@ enum dcn20_clk_src_array_id { · 507 unmodified lines
508508 .block ## _ ## reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
509509 mm ## block ## id ## _ ## reg_name
510510
511+#define VUPDATE_SRII(reg_name, block, id)\
512+ .reg_name[id] = BASE(mm ## reg_name ## _ ## block ## id ## _BASE_IDX) + \
513+ mm ## reg_name ## _ ## block ## id
514+
511515 /* NBIO */
512516 #define NBIO_BASE_INNER(seg) \
513517 NBIO_BASE__INST0_SEG ## seg
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c+1−0
@@ -53,6 +53,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { · 52 unmodified lines
5353 .disable_plane = dcn20_disable_plane,
5454 .pipe_control_lock = dcn20_pipe_control_lock,
5555 .interdependent_update_lock = dcn10_lock_all_pipes,
56+ .cursor_lock = dcn10_cursor_lock,
5657 .prepare_bandwidth = dcn20_prepare_bandwidth,
5758 .optimize_bandwidth = dcn20_optimize_bandwidth,
5859 .update_bandwidth = dcn20_update_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c+33−44
@@ -284,7 +284,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 283 unmodified lines
284284 .dram_channel_width_bytes = 4,
285285 .fabric_datapath_to_dcn_data_return_bytes = 32,
286286 .dcn_downspread_percent = 0.5,
287− .downspread_percent = 0.5,
287+ .downspread_percent = 0.38,
288288 .dram_page_open_time_ns = 50.0,
289289 .dram_rw_turnaround_time_ns = 17.5,
290290 .dram_return_buffer_per_channel_bytes = 8192,
@@ -340,6 +340,10 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 49 unmodified lines
340340 .block ## _ ## reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
341341 mm ## block ## id ## _ ## reg_name
342342
343+#define VUPDATE_SRII(reg_name, block, id)\
344+ .reg_name[id] = BASE(mm ## reg_name ## _ ## block ## id ## _BASE_IDX) + \
345+ mm ## reg_name ## _ ## block ## id
346+
343347 /* NBIO */
344348 #define NBIO_BASE_INNER(seg) \
345349 NBIF0_BASE__INST0_SEG ## seg
@@ -1374,64 +1378,49 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 1028 unmodified lines
13741378 {
13751379 struct dcn21_resource_pool *pool = TO_DCN21_RES_POOL(dc->res_pool);
13761380 struct clk_limit_table *clk_table = &bw_params->clk_table;
1377− unsigned int i, j, k;
1378− int closest_clk_lvl;
1381+ struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES];
1382+ unsigned int i, j, closest_clk_lvl;
13791383
13801384 // Default clock levels are used for diags, which may lead to overclocking.
1381− if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment) && !IS_DIAG_DC(dc->ctx->dce_environment)) {
1385+ if (!IS_DIAG_DC(dc->ctx->dce_environment)) {
13821386 dcn2_1_ip.max_num_otg = pool->base.res_cap->num_timing_generator;
13831387 dcn2_1_ip.max_num_dpp = pool->base.pipe_count;
13841388 dcn2_1_soc.num_chans = bw_params->num_channels;
13851389
1386− /* Vmin: leave lowest DCN clocks, override with dcfclk, fclk, memclk from fuse */
1387− dcn2_1_soc.clock_limits[0].state = 0;
1388− dcn2_1_soc.clock_limits[0].dcfclk_mhz = clk_table->entries[0].dcfclk_mhz;
1389− dcn2_1_soc.clock_limits[0].fabricclk_mhz = clk_table->entries[0].fclk_mhz;
1390− dcn2_1_soc.clock_limits[0].socclk_mhz = clk_table->entries[0].socclk_mhz;
1391− dcn2_1_soc.clock_limits[0].dram_speed_mts = clk_table->entries[0].memclk_mhz * 2;
1392−
1393− /*
1394− * Other levels: find closest DCN clocks that fit the given clock limit using dcfclk
1395− * as indicator
1396− */
1397−
1398− closest_clk_lvl = -1;
1399− /* index currently being filled */
1400− k = 1;
1401− for (i = 1; i < clk_table->num_entries; i++) {
1402− /* loop backwards, skip duplicate state*/
1403− for (j = dcn2_1_soc.num_states - 1; j >= k; j--) {
1390+ ASSERT(clk_table->num_entries);
1391+ for (i = 0; i < clk_table->num_entries; i++) {
1392+ /* loop backwards*/
1393+ for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) {
14041394 if ((unsigned int) dcn2_1_soc.clock_limits[j].dcfclk_mhz <= clk_table->entries[i].dcfclk_mhz) {
14051395 closest_clk_lvl = j;
14061396 break;
14071397 }
14081398 }
14091399
1410− /* if found a lvl that fits, use the DCN clks from it, if not, go to next clk limit*/
1411− if (closest_clk_lvl != -1) {
1412− dcn2_1_soc.clock_limits[k].state = i;
1413− dcn2_1_soc.clock_limits[k].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
1414− dcn2_1_soc.clock_limits[k].fabricclk_mhz = clk_table->entries[i].fclk_mhz;
1415− dcn2_1_soc.clock_limits[k].socclk_mhz = clk_table->entries[i].socclk_mhz;
1416− dcn2_1_soc.clock_limits[k].dram_speed_mts = clk_table->entries[i].memclk_mhz * 2;
1417−
1418− dcn2_1_soc.clock_limits[k].dispclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
1419− dcn2_1_soc.clock_limits[k].dppclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
1420− dcn2_1_soc.clock_limits[k].dram_bw_per_chan_gbps = dcn2_1_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
1421− dcn2_1_soc.clock_limits[k].dscclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
1422− dcn2_1_soc.clock_limits[k].dtbclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
1423− dcn2_1_soc.clock_limits[k].phyclk_d18_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
1424− dcn2_1_soc.clock_limits[k].phyclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
1425− k++;
1426− }
1400+ clock_limits[i].state = i;
1401+ clock_limits[i].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
1402+ clock_limits[i].fabricclk_mhz = clk_table->entries[i].fclk_mhz;
1403+ clock_limits[i].socclk_mhz = clk_table->entries[i].socclk_mhz;
1404+ clock_limits[i].dram_speed_mts = clk_table->entries[i].memclk_mhz * 2;
1405+
1406+ clock_limits[i].dispclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
1407+ clock_limits[i].dppclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
1408+ clock_limits[i].dram_bw_per_chan_gbps = dcn2_1_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
1409+ clock_limits[i].dscclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
1410+ clock_limits[i].dtbclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
1411+ clock_limits[i].phyclk_d18_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
1412+ clock_limits[i].phyclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
1413+ }
1414+ for (i = 0; i < clk_table->num_entries; i++)
1415+ dcn2_1_soc.clock_limits[i] = clock_limits[i];
1416+ if (clk_table->num_entries) {
1417+ dcn2_1_soc.num_states = clk_table->num_entries;
1418+ /* duplicate last level */
1419+ dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1];
1420+ dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states;
14271421 }
1428− dcn2_1_soc.num_states = k;
14291422 }
14301423
1431− /* duplicate last level */
1432− dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1];
1433− dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states;
1434−
14351424 dml_init_instance(&dc->dml, &dcn2_1_soc, &dcn2_1_ip, DML_PROJECT_DCN21);
14361425 }
14371426
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h+16−0
@@ -210,6 +210,22 @@ struct mpc_funcs { · 209 unmodified lines
210210 struct mpcc_blnd_cfg *blnd_cfg,
211211 int mpcc_id);
212212
213+ /*
214+ * Lock cursor updates for the specified OPP.
215+ * OPP defines the set of MPCC that are locked together for cursor.
216+ *
217+ * Parameters:
218+ * [in] mpc - MPC context.
219+ * [in] opp_id - The OPP to lock cursor updates on
220+ * [in] lock - lock/unlock the OPP
221+ *
222+ * Return: void
223+ */
224+ void (*cursor_lock)(
225+ struct mpc *mpc,
226+ int opp_id,
227+ bool lock);
228+
213229 struct mpcc* (*get_mpcc_for_dpp)(
214230 struct mpc_tree *tree,
215231 int dpp_id);
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h+1−0
@@ -86,6 +86,7 @@ struct hw_sequencer_funcs { · 85 unmodified lines
8686 struct dc_state *context, bool lock);
8787 void (*set_flip_control_gsl)(struct pipe_ctx *pipe_ctx,
8888 bool flip_immediate);
89+ void (*cursor_lock)(struct dc *dc, struct pipe_ctx *pipe, bool lock);
8990
9091 /* Timing Related */
9192 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
drivers/gpu/drm/amd/powerplay/amd_powerplay.c+5−4
@@ -1435,7 +1435,8 @@ static int pp_get_asic_baco_capability(void *handle, bool *cap) · 1434 unmodified lines
14351435 if (!hwmgr)
14361436 return -EINVAL;
14371437
1438− if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_capability)
1438+ if (!(hwmgr->not_vf && amdgpu_dpm) ||
1439+ !hwmgr->hwmgr_func->get_asic_baco_capability)
14391440 return 0;
14401441
14411442 mutex_lock(&hwmgr->smu_lock);
@@ -1452,8 +1453,7 @@ static int pp_get_asic_baco_state(void *handle, int *state) · 10 unmodified lines
14521453 if (!hwmgr)
14531454 return -EINVAL;
14541455
1455− if (!(hwmgr->not_vf && amdgpu_dpm) ||
1456− !hwmgr->hwmgr_func->get_asic_baco_state)
1456+ if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_state)
14571457 return 0;
14581458
14591459 mutex_lock(&hwmgr->smu_lock);
@@ -1470,7 +1470,8 @@ static int pp_set_asic_baco_state(void *handle, int state) · 10 unmodified lines
14701470 if (!hwmgr)
14711471 return -EINVAL;
14721472
1473− if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_state)
1473+ if (!(hwmgr->not_vf && amdgpu_dpm) ||
1474+ !hwmgr->hwmgr_func->set_asic_baco_state)
14741475 return 0;
14751476
14761477 mutex_lock(&hwmgr->smu_lock);
drivers/gpu/drm/drm_dp_mst_topology.c+6−2
@@ -3442,8 +3442,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr, · 3441 unmodified lines
34423442 drm_dp_queue_down_tx(mgr, txmsg);
34433443
34443444 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
3445− if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3446− ret = -EIO;
3445+ if (ret > 0) {
3446+ if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3447+ ret = -EIO;
3448+ else
3449+ ret = size;
3450+ }
34473451
34483452 kfree(txmsg);
34493453 fail_put:
drivers/gpu/drm/drm_edid.c+1−1
@@ -5111,7 +5111,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d · 5110 unmodified lines
51115111 struct drm_display_mode *mode;
51125112 unsigned pixel_clock = (timings->pixel_clock[0] |
51135113 (timings->pixel_clock[1] << 8) |
5114− (timings->pixel_clock[2] << 16));
5114+ (timings->pixel_clock[2] << 16)) + 1;
51155115 unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1;
51165116 unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1;
51175117 unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1;
drivers/gpu/drm/i915/gem/i915_gem_tiling.c+18−2
@@ -182,21 +182,35 @@ i915_gem_object_fence_prepare(struct drm_i915_gem_object *obj, · 181 unmodified lines
182182 int tiling_mode, unsigned int stride)
183183 {
184184 struct i915_ggtt *ggtt = &to_i915(obj->base.dev)->ggtt;
185− struct i915_vma *vma;
185+ struct i915_vma *vma, *vn;
186+ LIST_HEAD(unbind);
186187 int ret = 0;
187188
188189 if (tiling_mode == I915_TILING_NONE)
189190 return 0;
190191
191192 mutex_lock(&ggtt->vm.mutex);
193+
194+ spin_lock(&obj->vma.lock);
192195 for_each_ggtt_vma(vma, obj) {
196+ GEM_BUG_ON(vma->vm != &ggtt->vm);
197+
193198 if (i915_vma_fence_prepare(vma, tiling_mode, stride))
194199 continue;
195200
201+ list_move(&vma->vm_link, &unbind);
202+ }
203+ spin_unlock(&obj->vma.lock);
204+
205+ list_for_each_entry_safe(vma, vn, &unbind, vm_link) {
196206 ret = __i915_vma_unbind(vma);
197− if (ret)
207+ if (ret) {
208+ /* Restore the remaining vma on an error */
209+ list_splice(&unbind, &ggtt->vm.bound_list);
198210 break;
211+ }
199212 }
213+
200214 mutex_unlock(&ggtt->vm.mutex);
201215
202216 return ret;
@@ -268,6 +282,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 65 unmodified lines
268282 }
269283 mutex_unlock(&obj->mm.lock);
270284
285+ spin_lock(&obj->vma.lock);
271286 for_each_ggtt_vma(vma, obj) {
272287 vma->fence_size =
273288 i915_gem_fence_size(i915, vma->size, tiling, stride);
@@ -278,6 +293,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 4 unmodified lines
278293 if (vma->fence)
279294 vma->fence->dirty = true;
280295 }
296+ spin_unlock(&obj->vma.lock);
281297
282298 obj->tiling_and_stride = tiling | stride;
283299 i915_gem_object_unlock(obj);
drivers/gpu/drm/i915/gem/selftests/huge_pages.c+8−4
@@ -1477,8 +1477,10 @@ static int igt_ppgtt_pin_update(void *arg) · 1476 unmodified lines
14771477 unsigned int page_size = BIT(first);
14781478
14791479 obj = i915_gem_object_create_internal(dev_priv, page_size);
1480− if (IS_ERR(obj))
1481− return PTR_ERR(obj);
1480+ if (IS_ERR(obj)) {
1481+ err = PTR_ERR(obj);
1482+ goto out_vm;
1483+ }
14821484
14831485 vma = i915_vma_instance(obj, vm, NULL);
14841486 if (IS_ERR(vma)) {
@@ -1531,8 +1533,10 @@ static int igt_ppgtt_pin_update(void *arg) · 46 unmodified lines
15311533 }
15321534
15331535 obj = i915_gem_object_create_internal(dev_priv, PAGE_SIZE);
1534− if (IS_ERR(obj))
1535− return PTR_ERR(obj);
1536+ if (IS_ERR(obj)) {
1537+ err = PTR_ERR(obj);
1538+ goto out_vm;
1539+ }
15361540
15371541 vma = i915_vma_instance(obj, vm, NULL);
15381542 if (IS_ERR(vma)) {
drivers/gpu/drm/i915/gt/intel_timeline.c+2−0
@@ -521,6 +521,8 @@ int intel_timeline_read_hwsp(struct i915_request *from, · 520 unmodified lines
521521
522522 rcu_read_lock();
523523 cl = rcu_dereference(from->hwsp_cacheline);
524+ if (i915_request_completed(from)) /* confirm cacheline is valid */
525+ goto unlock;
524526 if (unlikely(!i915_active_acquire_if_busy(&cl->active)))
525527 goto unlock; /* seqno wrapped and completed! */
526528 if (unlikely(i915_request_completed(from)))
drivers/gpu/drm/i915/i915_irq.c+2−4
@@ -3358,7 +3358,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 3357 unmodified lines
33583358 {
33593359 struct intel_uncore *uncore = &dev_priv->uncore;
33603360
3361− u32 de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
3361+ u32 de_pipe_masked = gen8_de_pipe_fault_mask(dev_priv) |
3362+ GEN8_PIPE_CDCLK_CRC_DONE;
33623363 u32 de_pipe_enables;
33633364 u32 de_port_masked = GEN8_AUX_CHANNEL_A;
33643365 u32 de_port_enables;
@@ -3369,13 +3370,10 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 4 unmodified lines
33693370 de_misc_masked |= GEN8_DE_MISC_GSE;
33703371
33713372 if (INTEL_GEN(dev_priv) >= 9) {
3372− de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
33733373 de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
33743374 GEN9_AUX_CHANNEL_D;
33753375 if (IS_GEN9_LP(dev_priv))
33763376 de_port_masked |= BXT_DE_PORT_GMBUS;
3377− } else {
3378− de_pipe_masked |= GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
33793377 }
33803378
33813379 if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/i915_vma.c+6−4
@@ -158,16 +158,18 @@ vma_create(struct drm_i915_gem_object *obj, · 157 unmodified lines
158158
159159 GEM_BUG_ON(!IS_ALIGNED(vma->size, I915_GTT_PAGE_SIZE));
160160
161+ spin_lock(&obj->vma.lock);
162+
161163 if (i915_is_ggtt(vm)) {
162164 if (unlikely(overflows_type(vma->size, u32)))
163− goto err_vma;
165+ goto err_unlock;
164166
165167 vma->fence_size = i915_gem_fence_size(vm->i915, vma->size,
166168 i915_gem_object_get_tiling(obj),
167169 i915_gem_object_get_stride(obj));
168170 if (unlikely(vma->fence_size < vma->size || /* overflow */
169171 vma->fence_size > vm->total))
170− goto err_vma;
172+ goto err_unlock;
171173
172174 GEM_BUG_ON(!IS_ALIGNED(vma->fence_size, I915_GTT_MIN_ALIGNMENT));
173175
@@ -179,8 +181,6 @@ vma_create(struct drm_i915_gem_object *obj, · 5 unmodified lines
179181 __set_bit(I915_VMA_GGTT_BIT, __i915_vma_flags(vma));
180182 }
181183
182− spin_lock(&obj->vma.lock);
183−
184184 rb = NULL;
185185 p = &obj->vma.tree.rb_node;
186186 while (*p) {
@@ -225,6 +225,8 @@ vma_create(struct drm_i915_gem_object *obj, · 38 unmodified lines
225225
226226 return vma;
227227
228+err_unlock:
229+ spin_unlock(&obj->vma.lock);
228230 err_vma:
229231 i915_vma_free(vma);
230232 return ERR_PTR(-E2BIG);
drivers/gpu/drm/qxl/qxl_cmd.c+5−5
@@ -480,9 +480,10 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, · 479 unmodified lines
480480 return ret;
481481
482482 ret = qxl_release_reserve_list(release, true);
483− if (ret)
483+ if (ret) {
484+ qxl_release_free(qdev, release);
484485 return ret;
485−
486+ }
486487 cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release);
487488 cmd->type = QXL_SURFACE_CMD_CREATE;
488489 cmd->flags = QXL_SURF_FLAG_KEEP_DATA;
@@ -499,8 +500,8 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, · 10 unmodified lines
499500 /* no need to add a release to the fence for this surface bo,
500501 since it is only released when we ask to destroy the surface
501502 and it would never signal otherwise */
502− qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
503503 qxl_release_fence_buffer_objects(release);
504+ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
504505
505506 surf->hw_surf_alloc = true;
506507 spin_lock(&qdev->surf_id_idr_lock);
@@ -542,9 +543,8 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev, · 35 unmodified lines
542543 cmd->surface_id = id;
543544 qxl_release_unmap(qdev, release, &cmd->release_info);
544545
545− qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
546−
547546 qxl_release_fence_buffer_objects(release);
547+ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
548548
549549 return 0;
550550 }
drivers/gpu/drm/qxl/qxl_display.c+3−3
@@ -510,8 +510,8 @@ static int qxl_primary_apply_cursor(struct drm_plane *plane) · 509 unmodified lines
510510 cmd->u.set.visible = 1;
511511 qxl_release_unmap(qdev, release, &cmd->release_info);
512512
513− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
514513 qxl_release_fence_buffer_objects(release);
514+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
515515
516516 return ret;
517517
@@ -652,8 +652,8 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, · 134 unmodified lines
652652 cmd->u.position.y = plane->state->crtc_y + fb->hot_y;
653653
654654 qxl_release_unmap(qdev, release, &cmd->release_info);
655− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
656655 qxl_release_fence_buffer_objects(release);
656+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
657657
658658 if (old_cursor_bo != NULL)
659659 qxl_bo_unpin(old_cursor_bo);
@@ -700,8 +700,8 @@ static void qxl_cursor_atomic_disable(struct drm_plane *plane, · 40 unmodified lines
700700 cmd->type = QXL_CURSOR_HIDE;
701701 qxl_release_unmap(qdev, release, &cmd->release_info);
702702
703− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
704703 qxl_release_fence_buffer_objects(release);
704+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
705705 }
706706
707707 static void qxl_update_dumb_head(struct qxl_device *qdev,
drivers/gpu/drm/qxl/qxl_draw.c+4−3
@@ -209,9 +209,10 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, · 208 unmodified lines
209209 goto out_release_backoff;
210210
211211 rects = drawable_set_clipping(qdev, num_clips, clips_bo);
212− if (!rects)
212+ if (!rects) {
213+ ret = -EINVAL;
213214 goto out_release_backoff;
214−
215+ }
215216 drawable = (struct qxl_drawable *)qxl_release_map(qdev, release);
216217
217218 drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
@@ -242,8 +243,8 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, · 24 unmodified lines
242243 }
243244 qxl_bo_kunmap(clips_bo);
244245
245− qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
246246 qxl_release_fence_buffer_objects(release);
247+ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
247248
248249 out_release_backoff:
249250 if (ret)
drivers/gpu/drm/qxl/qxl_image.c+2−1
@@ -212,7 +212,8 @@ qxl_image_init_helper(struct qxl_device *qdev, · 211 unmodified lines
212212 break;
213213 default:
214214 DRM_ERROR("unsupported image bit depth\n");
215− return -EINVAL; /* TODO: cleanup */
215+ qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr);
216+ return -EINVAL;
216217 }
217218 image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN;
218219 image->u.bitmap.x = width;
drivers/gpu/drm/qxl/qxl_ioctl.c+1−4
@@ -261,11 +261,8 @@ static int qxl_process_single_command(struct qxl_device *qdev, · 260 unmodified lines
261261 apply_surf_reloc(qdev, &reloc_info[i]);
262262 }
263263
264+ qxl_release_fence_buffer_objects(release);
264265 ret = qxl_push_command_ring_release(qdev, release, cmd->type, true);
265− if (ret)
266− qxl_release_backoff_reserve_list(release);
267− else
268− qxl_release_fence_buffer_objects(release);
269266
270267 out_free_bos:
271268 out_free_release:
drivers/gpu/drm/virtio/virtgpu_kms.c+6−11
@@ -53,14 +53,6 @@ static void virtio_gpu_config_changed_work_func(struct work_struct *work) · 52 unmodified lines
5353 events_clear, &events_clear);
5454 }
5555
56−static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev,
57− uint32_t ctx_id)
58−{
59− virtio_gpu_cmd_context_destroy(vgdev, ctx_id);
60− virtio_gpu_notify(vgdev);
61− ida_free(&vgdev->ctx_id_ida, ctx_id - 1);
62−}
63−
6456 static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq,
6557 void (*work_func)(struct work_struct *work))
6658 {
@@ -275,14 +267,17 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) · 208 unmodified lines
275267 void virtio_gpu_driver_postclose(struct drm_device *dev, struct drm_file *file)
276268 {
277269 struct virtio_gpu_device *vgdev = dev->dev_private;
278− struct virtio_gpu_fpriv *vfpriv;
270+ struct virtio_gpu_fpriv *vfpriv = file->driver_priv;
279271
280272 if (!vgdev->has_virgl_3d)
281273 return;
282274
283− vfpriv = file->driver_priv;
275+ if (vfpriv->context_created) {
276+ virtio_gpu_cmd_context_destroy(vgdev, vfpriv->ctx_id);
277+ virtio_gpu_notify(vgdev);
278+ }
284279
285− virtio_gpu_context_destroy(vgdev, vfpriv->ctx_id);
280+ ida_free(&vgdev->ctx_id_ida, vfpriv->ctx_id - 1);
286281 mutex_destroy(&vfpriv->context_lock);
287282 kfree(vfpriv);
288283 file->driver_priv = NULL;
drivers/hv/hv.c+1−5
@@ -184,11 +184,7 @@ void hv_synic_enable_regs(unsigned int cpu) · 183 unmodified lines
184184
185185 shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR;
186186 shared_sint.masked = false;
187− if (ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED)
188− shared_sint.auto_eoi = false;
189− else
190− shared_sint.auto_eoi = true;
191−
187+ shared_sint.auto_eoi = hv_recommend_using_aeoi();
192188 hv_set_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
193189
194190 /* Enable the global synic bit */
drivers/hv/hv_trace.h+2−2
@@ -286,8 +286,8 @@ TRACE_EVENT(vmbus_send_tl_connect_request, · 285 unmodified lines
286286 __field(int, ret)
287287 ),
288288 TP_fast_assign(
289− memcpy(__entry->guest_id, &msg->guest_endpoint_id.b, 16);
290− memcpy(__entry->host_id, &msg->host_service_id.b, 16);
289+ export_guid(__entry->guest_id, &msg->guest_endpoint_id);
290+ export_guid(__entry->host_id, &msg->host_service_id);
291291 __entry->ret = ret;
292292 ),
293293 TP_printk("sending guest_endpoint_id %pUl, host_service_id %pUl, "
drivers/hv/vmbus_drv.c+34−9
@@ -978,6 +978,9 @@ static int vmbus_resume(struct device *child_device) · 977 unmodified lines
978978
979979 return drv->resume(dev);
980980 }
981+#else
982+#define vmbus_suspend NULL
983+#define vmbus_resume NULL
981984 #endif /* CONFIG_PM_SLEEP */
982985
983986 /*
@@ -997,11 +1000,22 @@ static void vmbus_device_release(struct device *device) · 13 unmodified lines
9971000 }
9981001
9991002 /*
1000− * Note: we must use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS rather than
1001− * SET_SYSTEM_SLEEP_PM_OPS: see the comment before vmbus_bus_pm.
1003+ * Note: we must use the "noirq" ops: see the comment before vmbus_bus_pm.
1004+ *
1005+ * suspend_noirq/resume_noirq are set to NULL to support Suspend-to-Idle: we
1006+ * shouldn't suspend the vmbus devices upon Suspend-to-Idle, otherwise there
1007+ * is no way to wake up a Generation-2 VM.
1008+ *
1009+ * The other 4 ops are for hibernation.
10021010 */
1011+
10031012 static const struct dev_pm_ops vmbus_pm = {
1004− SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(vmbus_suspend, vmbus_resume)
1013+ .suspend_noirq = NULL,
1014+ .resume_noirq = NULL,
1015+ .freeze_noirq = vmbus_suspend,
1016+ .thaw_noirq = vmbus_resume,
1017+ .poweroff_noirq = vmbus_suspend,
1018+ .restore_noirq = vmbus_resume,
10051019 };
10061020
10071021 /* The one and only one */
@@ -2281,6 +2295,9 @@ static int vmbus_bus_resume(struct device *dev) · 1273 unmodified lines
22812295
22822296 return 0;
22832297 }
2298+#else
2299+#define vmbus_bus_suspend NULL
2300+#define vmbus_bus_resume NULL
22842301 #endif /* CONFIG_PM_SLEEP */
22852302
22862303 static const struct acpi_device_id vmbus_acpi_device_ids[] = {
@@ -2291,16 +2308,24 @@ static const struct acpi_device_id vmbus_acpi_device_ids[] = { · 4 unmodified lines
22912308 MODULE_DEVICE_TABLE(acpi, vmbus_acpi_device_ids);
22922309
22932310 /*
2294− * Note: we must use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS rather than
2295− * SET_SYSTEM_SLEEP_PM_OPS, otherwise NIC SR-IOV can not work, because the
2296− * "pci_dev_pm_ops" uses the "noirq" callbacks: in the resume path, the
2297− * pci "noirq" restore callback runs before "non-noirq" callbacks (see
2311+ * Note: we must use the "no_irq" ops, otherwise hibernation can not work with
2312+ * PCI device assignment, because "pci_dev_pm_ops" uses the "noirq" ops: in
2313+ * the resume path, the pci "noirq" restore op runs before "non-noirq" op (see
22982314 * resume_target_kernel() -> dpm_resume_start(), and hibernation_restore() ->
22992315 * dpm_resume_end()). This means vmbus_bus_resume() and the pci-hyperv's
2300− * resume callback must also run via the "noirq" callbacks.
2316+ * resume callback must also run via the "noirq" ops.
2317+ *
2318+ * Set suspend_noirq/resume_noirq to NULL for Suspend-to-Idle: see the comment
2319+ * earlier in this file before vmbus_pm.
23012320 */
2321+
23022322 static const struct dev_pm_ops vmbus_bus_pm = {
2303− SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(vmbus_bus_suspend, vmbus_bus_resume)
2323+ .suspend_noirq = NULL,
2324+ .resume_noirq = NULL,
2325+ .freeze_noirq = vmbus_bus_suspend,
2326+ .thaw_noirq = vmbus_bus_resume,
2327+ .poweroff_noirq = vmbus_bus_suspend,
2328+ .restore_noirq = vmbus_bus_resume
23042329 };
23052330
23062331 static struct acpi_driver vmbus_acpi_driver = {
drivers/i2c/busses/i2c-amd-mp2-pci.c+1−1
@@ -349,12 +349,12 @@ static int amd_mp2_pci_probe(struct pci_dev *pci_dev, · 348 unmodified lines
349349 if (!privdata)
350350 return -ENOMEM;
351351
352+ privdata->pci_dev = pci_dev;
352353 rc = amd_mp2_pci_init(privdata, pci_dev);
353354 if (rc)
354355 return rc;
355356
356357 mutex_init(&privdata->c2p_lock);
357− privdata->pci_dev = pci_dev;
358358
359359 pm_runtime_set_autosuspend_delay(&pci_dev->dev, 1000);
360360 pm_runtime_use_autosuspend(&pci_dev->dev);
drivers/i2c/busses/i2c-aspeed.c+4−1
@@ -603,6 +603,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) · 602 unmodified lines
603603 /* Ack all interrupts except for Rx done */
604604 writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,
605605 bus->base + ASPEED_I2C_INTR_STS_REG);
606+ readl(bus->base + ASPEED_I2C_INTR_STS_REG);
606607 irq_remaining = irq_received;
607608
608609 #if IS_ENABLED(CONFIG_I2C_SLAVE)
@@ -645,9 +646,11 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) · 36 unmodified lines
645646 irq_received, irq_handled);
646647
647648 /* Ack Rx done */
648− if (irq_received & ASPEED_I2CD_INTR_RX_DONE)
649+ if (irq_received & ASPEED_I2CD_INTR_RX_DONE) {
649650 writel(ASPEED_I2CD_INTR_RX_DONE,
650651 bus->base + ASPEED_I2C_INTR_STS_REG);
652+ readl(bus->base + ASPEED_I2C_INTR_STS_REG);
653+ }
651654 spin_unlock(&bus->lock);
652655 return irq_remaining ? IRQ_NONE : IRQ_HANDLED;
653656 }
drivers/i2c/busses/i2c-bcm-iproc.c+3−0
@@ -360,6 +360,9 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, · 359 unmodified lines
360360 value = (u8)((val >> S_RX_DATA_SHIFT) & S_RX_DATA_MASK);
361361 i2c_slave_event(iproc_i2c->slave,
362362 I2C_SLAVE_WRITE_RECEIVED, &value);
363+ if (rx_status == I2C_SLAVE_RX_END)
364+ i2c_slave_event(iproc_i2c->slave,
365+ I2C_SLAVE_STOP, &value);
363366 }
364367 } else if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) {
365368 /* Master read other than start */
drivers/i2c/busses/i2c-tegra.c+12−24
@@ -996,13 +996,14 @@ tegra_i2c_poll_completion_timeout(struct tegra_i2c_dev *i2c_dev, · 995 unmodified lines
996996 do {
997997 u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS);
998998
999− if (status)
999+ if (status) {
10001000 tegra_i2c_isr(i2c_dev->irq, i2c_dev);
10011001
1002− if (completion_done(complete)) {
1003− s64 delta = ktime_ms_delta(ktimeout, ktime);
1002+ if (completion_done(complete)) {
1003+ s64 delta = ktime_ms_delta(ktimeout, ktime);
10041004
1005− return msecs_to_jiffies(delta) ?: 1;
1005+ return msecs_to_jiffies(delta) ?: 1;
1006+ }
10061007 }
10071008
10081009 ktime = ktime_get();
@@ -1029,18 +1030,14 @@ tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev, · 20 unmodified lines
10291030 disable_irq(i2c_dev->irq);
10301031
10311032 /*
1032− * Under some rare circumstances (like running KASAN +
1033− * NFS root) CPU, which handles interrupt, may stuck in
1034− * uninterruptible state for a significant time. In this
1035− * case we will get timeout if I2C transfer is running on
1036− * a sibling CPU, despite of IRQ being raised.
1037− *
1038− * In order to handle this rare condition, the IRQ status
1039− * needs to be checked after timeout.
1033+ * There is a chance that completion may happen after IRQ
1034+ * synchronization, which is done by disable_irq().
10401035 */
1041− if (ret == 0)
1042− ret = tegra_i2c_poll_completion_timeout(i2c_dev,
1043− complete, 0);
1036+ if (ret == 0 && completion_done(complete)) {
1037+ dev_warn(i2c_dev->dev,
1038+ "completion done after timeout\n");
1039+ ret = 1;
1040+ }
10441041 }
10451042
10461043 return ret;
@@ -1219,15 +1216,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, · 172 unmodified lines
12191216 time_left = tegra_i2c_wait_completion_timeout(
12201217 i2c_dev, &i2c_dev->dma_complete, xfer_time);
12211218
1222− /*
1223− * Synchronize DMA first, since dmaengine_terminate_sync()
1224− * performs synchronization after the transfer's termination
1225− * and we want to get a completion if transfer succeeded.
1226− */
1227− dmaengine_synchronize(i2c_dev->msg_read ?
1228− i2c_dev->rx_dma_chan :
1229− i2c_dev->tx_dma_chan);
1230−
12311219 dmaengine_terminate_sync(i2c_dev->msg_read ?
12321220 i2c_dev->rx_dma_chan :
12331221 i2c_dev->tx_dma_chan);
drivers/infiniband/core/cm.c+14−12
@@ -862,7 +862,7 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device, · 861 unmodified lines
862862
863863 ret = xa_alloc_cyclic_irq(&cm.local_id_table, &id, NULL, xa_limit_32b,
864864 &cm.local_id_next, GFP_KERNEL);
865− if (ret)
865+ if (ret < 0)
866866 goto error;
867867 cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand;
868868
@@ -1828,11 +1828,9 @@ static void cm_format_mra(struct cm_mra_msg *mra_msg, · 959 unmodified lines
18281828
18291829 static void cm_format_rej(struct cm_rej_msg *rej_msg,
18301830 struct cm_id_private *cm_id_priv,
1831− enum ib_cm_rej_reason reason,
1832− void *ari,
1833− u8 ari_length,
1834− const void *private_data,
1835− u8 private_data_len)
1831+ enum ib_cm_rej_reason reason, void *ari,
1832+ u8 ari_length, const void *private_data,
1833+ u8 private_data_len, enum ib_cm_state state)
18361834 {
18371835 lockdep_assert_held(&cm_id_priv->lock);
18381836
@@ -1840,7 +1838,7 @@ static void cm_format_rej(struct cm_rej_msg *rej_msg, · 1 unmodified line
18401838 IBA_SET(CM_REJ_REMOTE_COMM_ID, rej_msg,
18411839 be32_to_cpu(cm_id_priv->id.remote_id));
18421840
1843− switch(cm_id_priv->id.state) {
1841+ switch (state) {
18441842 case IB_CM_REQ_RCVD:
18451843 IBA_SET(CM_REJ_LOCAL_COMM_ID, rej_msg, be32_to_cpu(0));
18461844 IBA_SET(CM_REJ_MESSAGE_REJECTED, rej_msg, CM_MSG_RESPONSE_REQ);
@@ -1905,8 +1903,9 @@ static void cm_dup_req_handler(struct cm_work *work, · 58 unmodified lines
19051903 cm_id_priv->private_data_len);
19061904 break;
19071905 case IB_CM_TIMEWAIT:
1908− cm_format_rej((struct cm_rej_msg *) msg->mad, cm_id_priv,
1909− IB_CM_REJ_STALE_CONN, NULL, 0, NULL, 0);
1906+ cm_format_rej((struct cm_rej_msg *)msg->mad, cm_id_priv,
1907+ IB_CM_REJ_STALE_CONN, NULL, 0, NULL, 0,
1908+ IB_CM_TIMEWAIT);
19101909 break;
19111910 default:
19121911 goto unlock;
@@ -2904,6 +2903,7 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 991 unmodified lines
29042903 u8 ari_length, const void *private_data,
29052904 u8 private_data_len)
29062905 {
2906+ enum ib_cm_state state = cm_id_priv->id.state;
29072907 struct ib_mad_send_buf *msg;
29082908 int ret;
29092909
@@ -2913,7 +2913,7 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 3 unmodified lines
29132913 (ari && ari_length > IB_CM_REJ_ARI_LENGTH))
29142914 return -EINVAL;
29152915
2916− switch (cm_id_priv->id.state) {
2916+ switch (state) {
29172917 case IB_CM_REQ_SENT:
29182918 case IB_CM_MRA_REQ_RCVD:
29192919 case IB_CM_REQ_RCVD:
@@ -2925,7 +2925,8 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 5 unmodified lines
29252925 if (ret)
29262926 return ret;
29272927 cm_format_rej((struct cm_rej_msg *)msg->mad, cm_id_priv, reason,
2928− ari, ari_length, private_data, private_data_len);
2928+ ari, ari_length, private_data, private_data_len,
2929+ state);
29292930 break;
29302931 case IB_CM_REP_SENT:
29312932 case IB_CM_MRA_REP_RCVD:
@@ -2934,7 +2935,8 @@ static int cm_send_rej_locked(struct cm_id_private *cm_id_priv, · 2 unmodified lines
29342935 if (ret)
29352936 return ret;
29362937 cm_format_rej((struct cm_rej_msg *)msg->mad, cm_id_priv, reason,
2937− ari, ari_length, private_data, private_data_len);
2938+ ari, ari_length, private_data, private_data_len,
2939+ state);
29382940 break;
29392941 default:
29402942 pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
drivers/infiniband/core/rdma_core.c+4−5
@@ -360,7 +360,7 @@ lookup_get_fd_uobject(const struct uverbs_api_object *obj, · 359 unmodified lines
360360 * uverbs_uobject_fd_release(), and the caller is expected to ensure
361361 * that release is never done while a call to lookup is possible.
362362 */
363− if (f->f_op != fd_type->fops) {
363+ if (f->f_op != fd_type->fops || uobject->ufile != ufile) {
364364 fput(f);
365365 return ERR_PTR(-EBADF);
366366 }
@@ -474,16 +474,15 @@ alloc_begin_fd_uobject(const struct uverbs_api_object *obj, · 107 unmodified lines
474474 filp = anon_inode_getfile(fd_type->name, fd_type->fops, NULL,
475475 fd_type->flags);
476476 if (IS_ERR(filp)) {
477+ uverbs_uobject_put(uobj);
477478 uobj = ERR_CAST(filp);
478− goto err_uobj;
479+ goto err_fd;
479480 }
480481 uobj->object = filp;
481482
482483 uobj->id = new_fd;
483484 return uobj;
484485
485−err_uobj:
486− uverbs_uobject_put(uobj);
487486 err_fd:
488487 put_unused_fd(new_fd);
489488 return uobj;
@@ -679,7 +678,6 @@ void rdma_lookup_put_uobject(struct ib_uobject *uobj, · 189 unmodified lines
679678 enum rdma_lookup_mode mode)
680679 {
681680 assert_uverbs_usecnt(uobj, mode);
682− uobj->uapi_object->type_class->lookup_put(uobj, mode);
683681 /*
684682 * In order to unlock an object, either decrease its usecnt for
685683 * read access or zero it in case of exclusive access. See
@@ -696,6 +694,7 @@ void rdma_lookup_put_uobject(struct ib_uobject *uobj, · 10 unmodified lines
696694 break;
697695 }
698696
697+ uobj->uapi_object->type_class->lookup_put(uobj, mode);
699698 /* Pairs with the kref obtained by type->lookup_get */
700699 uverbs_uobject_put(uobj);
701700 }
drivers/infiniband/core/uverbs_main.c+4−0
@@ -820,6 +820,10 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 819 unmodified lines
820820 ret = mmget_not_zero(mm);
821821 if (!ret) {
822822 list_del_init(&priv->list);
823+ if (priv->entry) {
824+ rdma_user_mmap_entry_put(priv->entry);
825+ priv->entry = NULL;
826+ }
823827 mm = NULL;
824828 continue;
825829 }
drivers/infiniband/hw/i40iw/i40iw_ctrl.c+1−1
@@ -1046,7 +1046,7 @@ i40iw_sc_query_rdma_features(struct i40iw_sc_cqp *cqp, · 1045 unmodified lines
10461046 u64 header;
10471047
10481048 wqe = i40iw_sc_cqp_get_next_send_wqe(cqp, scratch);
1049− if (wqe)
1049+ if (!wqe)
10501050 return I40IW_ERR_RING_FULL;
10511051
10521052 set_64bit_val(wqe, 32, feat_mem->pa);
drivers/infiniband/hw/mlx4/main.c+2−1
@@ -1499,8 +1499,9 @@ static int __mlx4_ib_create_default_rules( · 1498 unmodified lines
14991499 int i;
15001500
15011501 for (i = 0; i < ARRAY_SIZE(pdefault_rules->rules_create_list); i++) {
1502+ union ib_flow_spec ib_spec = {};
15021503 int ret;
1503− union ib_flow_spec ib_spec;
1504+
15041505 switch (pdefault_rules->rules_create_list[i]) {
15051506 case 0:
15061507 /* no rule */
drivers/infiniband/hw/mlx5/qp.c+3−1
@@ -5558,7 +5558,9 @@ static void to_rdma_ah_attr(struct mlx5_ib_dev *ibdev, · 5557 unmodified lines
55585558 rdma_ah_set_path_bits(ah_attr, path->grh_mlid & 0x7f);
55595559 rdma_ah_set_static_rate(ah_attr,
55605560 path->static_rate ? path->static_rate - 5 : 0);
5561− if (path->grh_mlid & (1 << 7)) {
5561+
5562+ if (path->grh_mlid & (1 << 7) ||
5563+ ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
55625564 u32 tc_fl = be32_to_cpu(path->tclass_flowlabel);
55635565
55645566 rdma_ah_set_grh(ah_attr, NULL,
drivers/infiniband/sw/rdmavt/cq.c+2−2
@@ -248,8 +248,8 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · 247 unmodified lines
248248 */
249249 if (udata && udata->outlen >= sizeof(__u64)) {
250250 cq->ip = rvt_create_mmap_info(rdi, sz, udata, u_wc);
251− if (!cq->ip) {
252− err = -ENOMEM;
251+ if (IS_ERR(cq->ip)) {
252+ err = PTR_ERR(cq->ip);
253253 goto bail_wc;
254254 }
255255
drivers/infiniband/sw/rdmavt/mmap.c+2−2
@@ -154,7 +154,7 @@ done: · 153 unmodified lines
154154 * @udata: user data (must be valid!)
155155 * @obj: opaque pointer to a cq, wq etc
156156 *
157− * Return: rvt_mmap struct on success
157+ * Return: rvt_mmap struct on success, ERR_PTR on failure
158158 */
159159 struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size,
160160 struct ib_udata *udata, void *obj)
@@ -166,7 +166,7 @@ struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size, · 5 unmodified lines
166166
167167 ip = kmalloc_node(sizeof(*ip), GFP_KERNEL, rdi->dparms.node);
168168 if (!ip)
169− return ip;
169+ return ERR_PTR(-ENOMEM);
170170
171171 size = PAGE_ALIGN(size);
172172
drivers/infiniband/sw/rdmavt/qp.c+2−2
@@ -1244,8 +1244,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, · 1243 unmodified lines
12441244
12451245 qp->ip = rvt_create_mmap_info(rdi, s, udata,
12461246 qp->r_rq.wq);
1247− if (!qp->ip) {
1248− ret = ERR_PTR(-ENOMEM);
1247+ if (IS_ERR(qp->ip)) {
1248+ ret = ERR_CAST(qp->ip);
12491249 goto bail_qpn;
12501250 }
12511251
drivers/infiniband/sw/rdmavt/srq.c+2−2
@@ -111,8 +111,8 @@ int rvt_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *srq_init_attr, · 110 unmodified lines
111111 u32 s = sizeof(struct rvt_rwq) + srq->rq.size * sz;
112112
113113 srq->ip = rvt_create_mmap_info(dev, s, udata, srq->rq.wq);
114− if (!srq->ip) {
115− ret = -ENOMEM;
114+ if (IS_ERR(srq->ip)) {
115+ ret = PTR_ERR(srq->ip);
116116 goto bail_wq;
117117 }
118118
drivers/infiniband/sw/siw/siw_qp_tx.c+11−4
@@ -920,20 +920,27 @@ static int siw_fastreg_mr(struct ib_pd *pd, struct siw_sqe *sqe) · 919 unmodified lines
920920 {
921921 struct ib_mr *base_mr = (struct ib_mr *)(uintptr_t)sqe->base_mr;
922922 struct siw_device *sdev = to_siw_dev(pd->device);
923− struct siw_mem *mem = siw_mem_id2obj(sdev, sqe->rkey >> 8);
923+ struct siw_mem *mem;
924924 int rv = 0;
925925
926926 siw_dbg_pd(pd, "STag 0x%08x\n", sqe->rkey);
927927
928− if (unlikely(!mem || !base_mr)) {
928+ if (unlikely(!base_mr)) {
929929 pr_warn("siw: fastreg: STag 0x%08x unknown\n", sqe->rkey);
930930 return -EINVAL;
931931 }
932+
932933 if (unlikely(base_mr->rkey >> 8 != sqe->rkey >> 8)) {
933934 pr_warn("siw: fastreg: STag 0x%08x: bad MR\n", sqe->rkey);
934− rv = -EINVAL;
935− goto out;
935+ return -EINVAL;
936936 }
937+
938+ mem = siw_mem_id2obj(sdev, sqe->rkey >> 8);
939+ if (unlikely(!mem)) {
940+ pr_warn("siw: fastreg: STag 0x%08x unknown\n", sqe->rkey);
941+ return -EINVAL;
942+ }
943+
937944 if (unlikely(mem->pd != pd)) {
938945 pr_warn("siw: fastreg: PD mismatch\n");
939946 rv = -EINVAL;
drivers/iommu/Kconfig+2−2
@@ -362,7 +362,7 @@ config IPMMU_VMSA · 361 unmodified lines
362362
363363 config SPAPR_TCE_IOMMU
364364 bool "sPAPR TCE IOMMU Support"
365− depends on PPC_POWERNV || PPC_PSERIES || (PPC && COMPILE_TEST)
365+ depends on PPC_POWERNV || PPC_PSERIES
366366 select IOMMU_API
367367 help
368368 Enables bits of IOMMU API required by VFIO. The iommu_ops
@@ -457,7 +457,7 @@ config S390_AP_IOMMU · 88 unmodified lines
457457
458458 config MTK_IOMMU
459459 bool "MTK IOMMU Support"
460− depends on ARM || ARM64 || COMPILE_TEST
460+ depends on HAS_DMA
461461 depends on ARCH_MEDIATEK || COMPILE_TEST
462462 select ARM_DMA_USE_IOMMU
463463 select IOMMU_API
drivers/iommu/amd_iommu_init.c+1−1
@@ -2936,7 +2936,7 @@ static int __init parse_amd_iommu_intr(char *str) · 2935 unmodified lines
29362936 {
29372937 for (; *str; ++str) {
29382938 if (strncmp(str, "legacy", 6) == 0) {
2939− amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY;
2939+ amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA;
29402940 break;
29412941 }
29422942 if (strncmp(str, "vapic", 5) == 0) {
drivers/iommu/intel-iommu.c+2−2
@@ -371,11 +371,11 @@ int dmar_disabled = 0; · 370 unmodified lines
371371 int dmar_disabled = 1;
372372 #endif /* CONFIG_INTEL_IOMMU_DEFAULT_ON */
373373
374−#ifdef INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
374+#ifdef CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON
375375 int intel_iommu_sm = 1;
376376 #else
377377 int intel_iommu_sm;
378−#endif /* INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON */
378+#endif /* CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON */
379379
380380 int intel_iommu_enabled = 0;
381381 EXPORT_SYMBOL_GPL(intel_iommu_enabled);
drivers/iommu/iommu.c+1−0
@@ -184,6 +184,7 @@ static struct dev_iommu *dev_iommu_get(struct device *dev) · 183 unmodified lines
184184
185185 static void dev_iommu_free(struct device *dev)
186186 {
187+ iommu_fwspec_free(dev);
187188 kfree(dev->iommu);
188189 dev->iommu = NULL;
189190 }
drivers/iommu/qcom_iommu.c+4−1
@@ -814,8 +814,11 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) · 813 unmodified lines
814814 qcom_iommu->dev = dev;
815815
816816 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
817− if (res)
817+ if (res) {
818818 qcom_iommu->local_base = devm_ioremap_resource(dev, res);
819+ if (IS_ERR(qcom_iommu->local_base))
820+ return PTR_ERR(qcom_iommu->local_base);
821+ }
819822
820823 qcom_iommu->iface_clk = devm_clk_get(dev, "iface");
821824 if (IS_ERR(qcom_iommu->iface_clk)) {
drivers/md/dm-mpath.c+4−2
@@ -585,10 +585,12 @@ static struct pgpath *__map_bio(struct multipath *m, struct bio *bio) · 584 unmodified lines
585585
586586 /* Do we need to select a new pgpath? */
587587 pgpath = READ_ONCE(m->current_pgpath);
588− queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags);
589− if (!pgpath || !queue_io)
588+ if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags))
590589 pgpath = choose_pgpath(m, bio->bi_iter.bi_size);
591590
591+ /* MPATHF_QUEUE_IO might have been cleared by choose_pgpath. */
592+ queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags);
593+
592594 if ((pgpath && queue_io) ||
593595 (!pgpath && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))) {
594596 /* Queue for the daemon to resubmit */
drivers/md/dm-verity-fec.c+1−1
@@ -435,7 +435,7 @@ int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io, · 434 unmodified lines
435435 fio->level++;
436436
437437 if (type == DM_VERITY_BLOCK_TYPE_METADATA)
438− block += v->data_blocks;
438+ block = block - v->hash_start + v->data_blocks;
439439
440440 /*
441441 * For RS(M, N), the continuous FEC data is divided into blocks of N
drivers/md/dm-writecache.c+37−15
@@ -931,6 +931,24 @@ static int writecache_alloc_entries(struct dm_writecache *wc) · 930 unmodified lines
931931 return 0;
932932 }
933933
934+static int writecache_read_metadata(struct dm_writecache *wc, sector_t n_sectors)
935+{
936+ struct dm_io_region region;
937+ struct dm_io_request req;
938+
939+ region.bdev = wc->ssd_dev->bdev;
940+ region.sector = wc->start_sector;
941+ region.count = n_sectors;
942+ req.bi_op = REQ_OP_READ;
943+ req.bi_op_flags = REQ_SYNC;
944+ req.mem.type = DM_IO_VMA;
945+ req.mem.ptr.vma = (char *)wc->memory_map;
946+ req.client = wc->dm_io;
947+ req.notify.fn = NULL;
948+
949+ return dm_io(&req, 1, &region, NULL);
950+}
951+
934952 static void writecache_resume(struct dm_target *ti)
935953 {
936954 struct dm_writecache *wc = ti->private;
@@ -941,8 +959,18 @@ static void writecache_resume(struct dm_target *ti) · 4 unmodified lines
941959
942960 wc_lock(wc);
943961
944− if (WC_MODE_PMEM(wc))
962+ if (WC_MODE_PMEM(wc)) {
945963 persistent_memory_invalidate_cache(wc->memory_map, wc->memory_map_size);
964+ } else {
965+ r = writecache_read_metadata(wc, wc->metadata_sectors);
966+ if (r) {
967+ size_t sb_entries_offset;
968+ writecache_error(wc, r, "unable to read metadata: %d", r);
969+ sb_entries_offset = offsetof(struct wc_memory_superblock, entries);
970+ memset((char *)wc->memory_map + sb_entries_offset, -1,
971+ (wc->metadata_sectors << SECTOR_SHIFT) - sb_entries_offset);
972+ }
973+ }
946974
947975 wc->tree = RB_ROOT;
948976 INIT_LIST_HEAD(&wc->lru);
@@ -2102,6 +2130,12 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) · 1153 unmodified lines
21022130 ti->error = "Invalid block size";
21032131 goto bad;
21042132 }
2133+ if (wc->block_size < bdev_logical_block_size(wc->dev->bdev) ||
2134+ wc->block_size < bdev_logical_block_size(wc->ssd_dev->bdev)) {
2135+ r = -EINVAL;
2136+ ti->error = "Block size is smaller than device logical block size";
2137+ goto bad;
2138+ }
21052139 wc->block_size_bits = __ffs(wc->block_size);
21062140
21072141 wc->max_writeback_jobs = MAX_WRITEBACK_JOBS;
@@ -2200,8 +2234,6 @@ invalid_optional: · 92 unmodified lines
22002234 goto bad;
22012235 }
22022236 } else {
2203− struct dm_io_region region;
2204− struct dm_io_request req;
22052237 size_t n_blocks, n_metadata_blocks;
22062238 uint64_t n_bitmap_bits;
22072239
@@ -2258,19 +2290,9 @@ invalid_optional: · 50 unmodified lines
22582290 goto bad;
22592291 }
22602292
2261− region.bdev = wc->ssd_dev->bdev;
2262− region.sector = wc->start_sector;
2263− region.count = wc->metadata_sectors;
2264− req.bi_op = REQ_OP_READ;
2265− req.bi_op_flags = REQ_SYNC;
2266− req.mem.type = DM_IO_VMA;
2267− req.mem.ptr.vma = (char *)wc->memory_map;
2268− req.client = wc->dm_io;
2269− req.notify.fn = NULL;
2270−
2271− r = dm_io(&req, 1, &region, NULL);
2293+ r = writecache_read_metadata(wc, wc->block_size >> SECTOR_SHIFT);
22722294 if (r) {
2273− ti->error = "Unable to read metadata";
2295+ ti->error = "Unable to read first block of metadata";
22742296 goto bad;
22752297 }
22762298 }
drivers/mmc/core/mmc_ops.c+1−1
@@ -878,7 +878,7 @@ static int mmc_send_hpi_cmd(struct mmc_card *card) · 877 unmodified lines
878878 * Issued High Priority Interrupt, and check for card status
879879 * until out-of prg-state.
880880 */
881−int mmc_interrupt_hpi(struct mmc_card *card)
881+static int mmc_interrupt_hpi(struct mmc_card *card)
882882 {
883883 int err;
884884 u32 status;
drivers/mmc/host/cqhci.c+10−11
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/delay.h>
66 #include <linux/highmem.h>
77 #include <linux/io.h>
8+#include <linux/iopoll.h>
89 #include <linux/module.h>
910 #include <linux/dma-mapping.h>
1011 #include <linux/slab.h>
@@ -349,12 +350,16 @@ static int cqhci_enable(struct mmc_host *mmc, struct mmc_card *card) · 338 unmodified lines
349350 /* CQHCI is idle and should halt immediately, so set a small timeout */
350351 #define CQHCI_OFF_TIMEOUT 100
351352
353+static u32 cqhci_read_ctl(struct cqhci_host *cq_host)
354+{
355+ return cqhci_readl(cq_host, CQHCI_CTL);
356+}
357+
352358 static void cqhci_off(struct mmc_host *mmc)
353359 {
354360 struct cqhci_host *cq_host = mmc->cqe_private;
355− ktime_t timeout;
356− bool timed_out;
357361 u32 reg;
362+ int err;
358363
359364 if (!cq_host->enabled || !mmc->cqe_on || cq_host->recovery_halt)
360365 return;
@@ -364,15 +369,9 @@ static void cqhci_off(struct mmc_host *mmc) · 3 unmodified lines
364369
365370 cqhci_writel(cq_host, CQHCI_HALT, CQHCI_CTL);
366371
367− timeout = ktime_add_us(ktime_get(), CQHCI_OFF_TIMEOUT);
368− while (1) {
369− timed_out = ktime_compare(ktime_get(), timeout) > 0;
370− reg = cqhci_readl(cq_host, CQHCI_CTL);
371− if ((reg & CQHCI_HALT) || timed_out)
372− break;
373− }
374−
375− if (timed_out)
372+ err = readx_poll_timeout(cqhci_read_ctl, cq_host, reg,
373+ reg & CQHCI_HALT, 0, CQHCI_OFF_TIMEOUT);
374+ if (err < 0)
376375 pr_err("%s: cqhci: CQE stuck on\n", mmc_hostname(mmc));
377376 else
378377 pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc));
drivers/mmc/host/meson-mx-sdio.c+1−10
@@ -357,14 +357,6 @@ static void meson_mx_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) · 356 unmodified lines
357357 meson_mx_mmc_start_cmd(mmc, mrq->cmd);
358358 }
359359
360−static int meson_mx_mmc_card_busy(struct mmc_host *mmc)
361−{
362− struct meson_mx_mmc_host *host = mmc_priv(mmc);
363− u32 irqc = readl(host->base + MESON_MX_SDIO_IRQC);
364−
365− return !!(irqc & MESON_MX_SDIO_IRQC_FORCE_DATA_DAT_MASK);
366−}
367−
368360 static void meson_mx_mmc_read_response(struct mmc_host *mmc,
369361 struct mmc_command *cmd)
370362 {
@@ -506,7 +498,6 @@ static void meson_mx_mmc_timeout(struct timer_list *t) · 135 unmodified lines
506498 static struct mmc_host_ops meson_mx_mmc_ops = {
507499 .request = meson_mx_mmc_request,
508500 .set_ios = meson_mx_mmc_set_ios,
509− .card_busy = meson_mx_mmc_card_busy,
510501 .get_cd = mmc_gpio_get_cd,
511502 .get_ro = mmc_gpio_get_ro,
512503 };
@@ -570,7 +561,7 @@ static int meson_mx_mmc_add_host(struct meson_mx_mmc_host *host) · 57 unmodified lines
570561 mmc->f_max = clk_round_rate(host->cfg_div_clk,
571562 clk_get_rate(host->parent_clk));
572563
573− mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;
564+ mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23 | MMC_CAP_WAIT_WHILE_BUSY;
574565 mmc->ops = &meson_mx_mmc_ops;
575566
576567 ret = mmc_of_parse(mmc);
drivers/mmc/host/sdhci-msm.c+2−0
@@ -2087,6 +2087,8 @@ static int sdhci_msm_probe(struct platform_device *pdev) · 2086 unmodified lines
20872087 goto clk_disable;
20882088 }
20892089
2090+ msm_host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_NEED_RSP_BUSY;
2091+
20902092 pm_runtime_get_noresume(&pdev->dev);
20912093 pm_runtime_set_active(&pdev->dev);
20922094 pm_runtime_enable(&pdev->dev);
drivers/mmc/host/sdhci-pci-core.c+3−0
@@ -601,6 +601,9 @@ static int intel_select_drive_strength(struct mmc_card *card, · 600 unmodified lines
601601 struct sdhci_pci_slot *slot = sdhci_priv(host);
602602 struct intel_host *intel_host = sdhci_pci_priv(slot);
603603
604+ if (!(mmc_driver_type_mask(intel_host->drv_strength) & card_drv))
605+ return 0;
606+
604607 return intel_host->drv_strength;
605608 }
606609
drivers/mmc/host/sdhci-xenon.c+10−0
@@ -235,6 +235,16 @@ static void xenon_voltage_switch(struct sdhci_host *host) · 234 unmodified lines
235235 {
236236 /* Wait for 5ms after set 1.8V signal enable bit */
237237 usleep_range(5000, 5500);
238+
239+ /*
240+ * For some reason the controller's Host Control2 register reports
241+ * the bit representing 1.8V signaling as 0 when read after it was
242+ * written as 1. Subsequent read reports 1.
243+ *
244+ * Since this may cause some issues, do an empty read of the Host
245+ * Control2 register here to circumvent this.
246+ */
247+ sdhci_readw(host, SDHCI_HOST_CONTROL2);
238248 }
239249
240250 static const struct sdhci_ops sdhci_xenon_ops = {
drivers/nvme/host/core.c+2−0
@@ -3642,6 +3642,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) · 3641 unmodified lines
36423642
36433643 return;
36443644 out_put_disk:
3645+ /* prevent double queue cleanup */
3646+ ns->disk->queue = NULL;
36453647 put_disk(ns->disk);
36463648 out_unlink_ns:
36473649 mutex_lock(&ctrl->subsys->lock);
drivers/scsi/qla2xxx/qla_os.c+17−18
@@ -3732,6 +3732,13 @@ qla2x00_remove_one(struct pci_dev *pdev) · 3731 unmodified lines
37323732 }
37333733 qla2x00_wait_for_hba_ready(base_vha);
37343734
3735+ /*
3736+ * if UNLOADING flag is already set, then continue unload,
3737+ * where it was set first.
3738+ */
3739+ if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags))
3740+ return;
3741+
37353742 if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) ||
37363743 IS_QLA28XX(ha)) {
37373744 if (ha->flags.fw_started)
@@ -3750,15 +3757,6 @@ qla2x00_remove_one(struct pci_dev *pdev) · 12 unmodified lines
37503757
37513758 qla2x00_wait_for_sess_deletion(base_vha);
37523759
3753− /*
3754− * if UNLOAD flag is already set, then continue unload,
3755− * where it was set first.
3756− */
3757− if (test_bit(UNLOADING, &base_vha->dpc_flags))
3758− return;
3759−
3760− set_bit(UNLOADING, &base_vha->dpc_flags);
3761−
37623760 qla_nvme_delete(base_vha);
37633761
37643762 dma_free_coherent(&ha->pdev->dev,
@@ -4864,6 +4862,9 @@ qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) · 1099 unmodified lines
48644862 struct qla_work_evt *e;
48654863 uint8_t bail;
48664864
4865+ if (test_bit(UNLOADING, &vha->dpc_flags))
4866+ return NULL;
4867+
48674868 QLA_VHA_MARK_BUSY(vha, bail);
48684869 if (bail)
48694870 return NULL;
@@ -6628,13 +6629,6 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) · 1758 unmodified lines
66286629 struct pci_dev *pdev = ha->pdev;
66296630 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
66306631
6631− /*
6632− * if UNLOAD flag is already set, then continue unload,
6633− * where it was set first.
6634− */
6635− if (test_bit(UNLOADING, &base_vha->dpc_flags))
6636− return;
6637−
66386632 ql_log(ql_log_warn, base_vha, 0x015b,
66396633 "Disabling adapter.\n");
66406634
@@ -6645,9 +6639,14 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work) · 4 unmodified lines
66456639 return;
66466640 }
66476641
6648− qla2x00_wait_for_sess_deletion(base_vha);
6642+ /*
6643+ * if UNLOADING flag is already set, then continue unload,
6644+ * where it was set first.
6645+ */
6646+ if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags))
6647+ return;
66496648
6650− set_bit(UNLOADING, &base_vha->dpc_flags);
6649+ qla2x00_wait_for_sess_deletion(base_vha);
66516650
66526651 qla2x00_delete_all_vps(ha, base_vha);
66536652
drivers/scsi/scsi_lib.c+1−0
@@ -2284,6 +2284,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) · 2283 unmodified lines
22842284 switch (oldstate) {
22852285 case SDEV_RUNNING:
22862286 case SDEV_CREATED_BLOCK:
2287+ case SDEV_QUIESCE:
22872288 case SDEV_OFFLINE:
22882289 break;
22892290 default:
drivers/target/target_core_iblock.c+1−1
@@ -432,7 +432,7 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd) · 431 unmodified lines
432432 target_to_linux_sector(dev, cmd->t_task_lba),
433433 target_to_linux_sector(dev,
434434 sbc_get_write_same_sectors(cmd)),
435− GFP_KERNEL, false);
435+ GFP_KERNEL, BLKDEV_ZERO_NOUNMAP);
436436 if (ret)
437437 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
438438
drivers/tty/hvc/Kconfig+1−1
@@ -88,7 +88,7 @@ config HVC_DCC · 87 unmodified lines
8888
8989 config HVC_RISCV_SBI
9090 bool "RISC-V SBI console support"
91− depends on RISCV_SBI
91+ depends on RISCV_SBI_V01
9292 select HVC_DRIVER
9393 help
9494 This enables support for console output via RISC-V SBI calls, which
drivers/tty/serial/Kconfig+1−1
@@ -86,7 +86,7 @@ config SERIAL_EARLYCON_ARM_SEMIHOST · 85 unmodified lines
8686
8787 config SERIAL_EARLYCON_RISCV_SBI
8888 bool "Early console using RISC-V SBI"
89− depends on RISCV_SBI
89+ depends on RISCV_SBI_V01
9090 select SERIAL_CORE
9191 select SERIAL_CORE_CONSOLE
9292 select SERIAL_EARLYCON
drivers/vfio/vfio_iommu_type1.c+5−5
@@ -342,8 +342,8 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, · 341 unmodified lines
342342 vma = find_vma_intersection(mm, vaddr, vaddr + 1);
343343
344344 if (vma && vma->vm_flags & VM_PFNMAP) {
345− *pfn = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
346− if (is_invalid_reserved_pfn(*pfn))
345+ if (!follow_pfn(vma, vaddr, pfn) &&
346+ is_invalid_reserved_pfn(*pfn))
347347 ret = 0;
348348 }
349349 done:
@@ -555,7 +555,7 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, · 205 unmodified lines
555555 continue;
556556 }
557557
558− remote_vaddr = dma->vaddr + iova - dma->iova;
558+ remote_vaddr = dma->vaddr + (iova - dma->iova);
559559 ret = vfio_pin_page_external(dma, remote_vaddr, &phys_pfn[i],
560560 do_accounting);
561561 if (ret)
@@ -2345,10 +2345,10 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu, · 1783 unmodified lines
23452345 vaddr = dma->vaddr + offset;
23462346
23472347 if (write)
2348− *copied = __copy_to_user((void __user *)vaddr, data,
2348+ *copied = copy_to_user((void __user *)vaddr, data,
23492349 count) ? 0 : count;
23502350 else
2351− *copied = __copy_from_user(data, (void __user *)vaddr,
2351+ *copied = copy_from_user(data, (void __user *)vaddr,
23522352 count) ? 0 : count;
23532353 if (kthread)
23542354 unuse_mm(mm);
fs/btrfs/backref.c+1−1
@@ -391,7 +391,7 @@ static int is_shared_data_backref(struct preftrees *preftrees, u64 bytenr) · 390 unmodified lines
391391 struct rb_node **p = &preftrees->direct.root.rb_root.rb_node;
392392 struct rb_node *parent = NULL;
393393 struct prelim_ref *ref = NULL;
394− struct prelim_ref target = {0};
394+ struct prelim_ref target = {};
395395 int result;
396396
397397 target.parent = bytenr;
fs/btrfs/block-group.c+14−6
@@ -916,7 +916,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 915 unmodified lines
916916 path = btrfs_alloc_path();
917917 if (!path) {
918918 ret = -ENOMEM;
919− goto out;
919+ goto out_put_group;
920920 }
921921
922922 /*
@@ -954,7 +954,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 31 unmodified lines
954954 ret = btrfs_orphan_add(trans, BTRFS_I(inode));
955955 if (ret) {
956956 btrfs_add_delayed_iput(inode);
957− goto out;
957+ goto out_put_group;
958958 }
959959 clear_nlink(inode);
960960 /* One for the block groups ref */
@@ -977,13 +977,13 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 16 unmodified lines
977977
978978 ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
979979 if (ret < 0)
980− goto out;
980+ goto out_put_group;
981981 if (ret > 0)
982982 btrfs_release_path(path);
983983 if (ret == 0) {
984984 ret = btrfs_del_item(trans, tree_root, path);
985985 if (ret)
986− goto out;
986+ goto out_put_group;
987987 btrfs_release_path(path);
988988 }
989989
@@ -1102,9 +1102,9 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 112 unmodified lines
11021102
11031103 ret = remove_block_group_free_space(trans, block_group);
11041104 if (ret)
1105− goto out;
1105+ goto out_put_group;
11061106
1107− btrfs_put_block_group(block_group);
1107+ /* Once for the block groups rbtree */
11081108 btrfs_put_block_group(block_group);
11091109
11101110 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
@@ -1127,6 +1127,10 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, · 16 unmodified lines
11271127 /* once for the tree */
11281128 free_extent_map(em);
11291129 }
1130+
1131+out_put_group:
1132+ /* Once for the lookup reference */
1133+ btrfs_put_block_group(block_group);
11301134 out:
11311135 if (remove_rsv)
11321136 btrfs_delayed_refs_rsv_release(fs_info, 1);
@@ -1288,11 +1292,15 @@ static bool clean_pinned_extents(struct btrfs_trans_handle *trans, · 155 unmodified lines
12881292 if (ret)
12891293 goto err;
12901294 mutex_unlock(&fs_info->unused_bg_unpin_mutex);
1295+ if (prev_trans)
1296+ btrfs_put_transaction(prev_trans);
12911297
12921298 return true;
12931299
12941300 err:
12951301 mutex_unlock(&fs_info->unused_bg_unpin_mutex);
1302+ if (prev_trans)
1303+ btrfs_put_transaction(prev_trans);
12961304 btrfs_dec_block_group_ro(bg);
12971305 return false;
12981306 }
fs/btrfs/discard.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22
33 #ifndef BTRFS_DISCARD_H
44 #define BTRFS_DISCARD_H
fs/btrfs/disk-io.c+32−4
@@ -2036,9 +2036,6 @@ void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info) · 2035 unmodified lines
20362036 for (i = 0; i < ret; i++)
20372037 btrfs_drop_and_free_fs_root(fs_info, gang[i]);
20382038 }
2039−
2040− if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
2041− btrfs_free_log_root_tree(NULL, fs_info);
20422039 }
20432040
20442041 static void btrfs_init_scrub(struct btrfs_fs_info *fs_info)
@@ -3888,7 +3885,7 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info, · 1843 unmodified lines
38883885 spin_unlock(&fs_info->fs_roots_radix_lock);
38893886
38903887 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
3891− btrfs_free_log(NULL, root);
3888+ ASSERT(root->log_root == NULL);
38923889 if (root->reloc_root) {
38933890 btrfs_put_root(root->reloc_root);
38943891 root->reloc_root = NULL;
@@ -4211,6 +4208,36 @@ static void btrfs_error_commit_super(struct btrfs_fs_info *fs_info) · 316 unmodified lines
42114208 up_write(&fs_info->cleanup_work_sem);
42124209 }
42134210
4211+static void btrfs_drop_all_logs(struct btrfs_fs_info *fs_info)
4212+{
4213+ struct btrfs_root *gang[8];
4214+ u64 root_objectid = 0;
4215+ int ret;
4216+
4217+ spin_lock(&fs_info->fs_roots_radix_lock);
4218+ while ((ret = radix_tree_gang_lookup(&fs_info->fs_roots_radix,
4219+ (void **)gang, root_objectid,
4220+ ARRAY_SIZE(gang))) != 0) {
4221+ int i;
4222+
4223+ for (i = 0; i < ret; i++)
4224+ gang[i] = btrfs_grab_root(gang[i]);
4225+ spin_unlock(&fs_info->fs_roots_radix_lock);
4226+
4227+ for (i = 0; i < ret; i++) {
4228+ if (!gang[i])
4229+ continue;
4230+ root_objectid = gang[i]->root_key.objectid;
4231+ btrfs_free_log(NULL, gang[i]);
4232+ btrfs_put_root(gang[i]);
4233+ }
4234+ root_objectid++;
4235+ spin_lock(&fs_info->fs_roots_radix_lock);
4236+ }
4237+ spin_unlock(&fs_info->fs_roots_radix_lock);
4238+ btrfs_free_log_root_tree(NULL, fs_info);
4239+}
4240+
42144241 static void btrfs_destroy_ordered_extents(struct btrfs_root *root)
42154242 {
42164243 struct btrfs_ordered_extent *ordered;
@@ -4603,6 +4630,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info) · 386 unmodified lines
46034630 btrfs_destroy_delayed_inodes(fs_info);
46044631 btrfs_assert_delayed_root_empty(fs_info);
46054632 btrfs_destroy_all_delalloc_inodes(fs_info);
4633+ btrfs_drop_all_logs(fs_info);
46064634 mutex_unlock(&fs_info->transaction_kthread_mutex);
46074635
46084636 return 0;
fs/btrfs/relocation.c+1−0
@@ -4559,6 +4559,7 @@ int btrfs_recover_relocation(struct btrfs_root *root) · 4558 unmodified lines
45594559 if (IS_ERR(fs_root)) {
45604560 err = PTR_ERR(fs_root);
45614561 list_add_tail(&reloc_root->root_list, &reloc_roots);
4562+ btrfs_end_transaction(trans);
45624563 goto out_unset;
45634564 }
45644565
fs/btrfs/transaction.c+11−2
@@ -662,10 +662,19 @@ again: · 661 unmodified lines
662662 }
663663
664664 got_it:
665− btrfs_record_root_in_trans(h, root);
666−
667665 if (!current->journal_info)
668666 current->journal_info = h;
667+
668+ /*
669+ * btrfs_record_root_in_trans() needs to alloc new extents, and may
670+ * call btrfs_join_transaction() while we're also starting a
671+ * transaction.
672+ *
673+ * Thus it need to be called after current->journal_info initialized,
674+ * or we can deadlock.
675+ */
676+ btrfs_record_root_in_trans(h, root);
677+
669678 return h;
670679
671680 join_fail:
fs/btrfs/tree-log.c+40−3
@@ -4226,6 +4226,9 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 4225 unmodified lines
42264226 const u64 ino = btrfs_ino(inode);
42274227 struct btrfs_path *dst_path = NULL;
42284228 bool dropped_extents = false;
4229+ u64 truncate_offset = i_size;
4230+ struct extent_buffer *leaf;
4231+ int slot;
42294232 int ins_nr = 0;
42304233 int start_slot;
42314234 int ret;
@@ -4240,9 +4243,43 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 8 unmodified lines
42404243 if (ret < 0)
42414244 goto out;
42424245
4246+ /*
4247+ * We must check if there is a prealloc extent that starts before the
4248+ * i_size and crosses the i_size boundary. This is to ensure later we
4249+ * truncate down to the end of that extent and not to the i_size, as
4250+ * otherwise we end up losing part of the prealloc extent after a log
4251+ * replay and with an implicit hole if there is another prealloc extent
4252+ * that starts at an offset beyond i_size.
4253+ */
4254+ ret = btrfs_previous_item(root, path, ino, BTRFS_EXTENT_DATA_KEY);
4255+ if (ret < 0)
4256+ goto out;
4257+
4258+ if (ret == 0) {
4259+ struct btrfs_file_extent_item *ei;
4260+
4261+ leaf = path->nodes[0];
4262+ slot = path->slots[0];
4263+ ei = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
4264+
4265+ if (btrfs_file_extent_type(leaf, ei) ==
4266+ BTRFS_FILE_EXTENT_PREALLOC) {
4267+ u64 extent_end;
4268+
4269+ btrfs_item_key_to_cpu(leaf, &key, slot);
4270+ extent_end = key.offset +
4271+ btrfs_file_extent_num_bytes(leaf, ei);
4272+
4273+ if (extent_end > i_size)
4274+ truncate_offset = extent_end;
4275+ }
4276+ } else {
4277+ ret = 0;
4278+ }
4279+
42434280 while (true) {
4244− struct extent_buffer *leaf = path->nodes[0];
4245− int slot = path->slots[0];
4281+ leaf = path->nodes[0];
4282+ slot = path->slots[0];
42464283
42474284 if (slot >= btrfs_header_nritems(leaf)) {
42484285 if (ins_nr > 0) {
@@ -4280,7 +4317,7 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 31 unmodified lines
42804317 ret = btrfs_truncate_inode_items(trans,
42814318 root->log_root,
42824319 &inode->vfs_inode,
4283− i_size,
4320+ truncate_offset,
42844321 BTRFS_EXTENT_DATA_KEY);
42854322 } while (ret == -EAGAIN);
42864323 if (ret)
fs/io_uring.c+31−27
@@ -524,6 +524,7 @@ enum { · 523 unmodified lines
524524 REQ_F_OVERFLOW_BIT,
525525 REQ_F_POLLED_BIT,
526526 REQ_F_BUFFER_SELECTED_BIT,
527+ REQ_F_NO_FILE_TABLE_BIT,
527528
528529 /* not a real bit, just to check we're not overflowing the space */
529530 __REQ_F_LAST_BIT,
@@ -577,6 +578,8 @@ enum { · 47 unmodified lines
577578 REQ_F_POLLED = BIT(REQ_F_POLLED_BIT),
578579 /* buffer already selected */
579580 REQ_F_BUFFER_SELECTED = BIT(REQ_F_BUFFER_SELECTED_BIT),
581+ /* doesn't need file table for this request */
582+ REQ_F_NO_FILE_TABLE = BIT(REQ_F_NO_FILE_TABLE_BIT),
580583 };
581584
582585 struct async_poll {
@@ -799,6 +802,7 @@ static const struct io_op_def io_op_defs[] = { · 216 unmodified lines
799802 .needs_file = 1,
800803 .fd_non_neg = 1,
801804 .needs_fs = 1,
805+ .file_table = 1,
802806 },
803807 [IORING_OP_READ] = {
804808 .needs_mm = 1,
@@ -1291,7 +1295,7 @@ static struct io_kiocb *io_get_fallback_req(struct io_ring_ctx *ctx) · 486 unmodified lines
12911295 struct io_kiocb *req;
12921296
12931297 req = ctx->fallback_req;
1294− if (!test_and_set_bit_lock(0, (unsigned long *) ctx->fallback_req))
1298+ if (!test_and_set_bit_lock(0, (unsigned long *) &ctx->fallback_req))
12951299 return req;
12961300
12971301 return NULL;
@@ -1378,7 +1382,7 @@ static void __io_free_req(struct io_kiocb *req) · 80 unmodified lines
13781382 if (likely(!io_is_fallback_req(req)))
13791383 kmem_cache_free(req_cachep, req);
13801384 else
1381− clear_bit_unlock(0, (unsigned long *) req->ctx->fallback_req);
1385+ clear_bit_unlock(0, (unsigned long *) &req->ctx->fallback_req);
13821386 }
13831387
13841388 struct req_batch {
@@ -2034,7 +2038,7 @@ static struct file *__io_file_get(struct io_submit_state *state, int fd) · 649 unmodified lines
20342038 * any file. For now, just ensure that anything potentially problematic is done
20352039 * inline.
20362040 */
2037−static bool io_file_supports_async(struct file *file)
2041+static bool io_file_supports_async(struct file *file, int rw)
20382042 {
20392043 umode_t mode = file_inode(file)->i_mode;
20402044
@@ -2043,7 +2047,13 @@ static bool io_file_supports_async(struct file *file) · 2 unmodified lines
20432047 if (S_ISREG(mode) && file->f_op != &io_uring_fops)
20442048 return true;
20452049
2046− return false;
2050+ if (!(file->f_mode & FMODE_NOWAIT))
2051+ return false;
2052+
2053+ if (rw == READ)
2054+ return file->f_op->read_iter != NULL;
2055+
2056+ return file->f_op->write_iter != NULL;
20472057 }
20482058
20492059 static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
@@ -2571,7 +2581,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) · 521 unmodified lines
25712581 * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so
25722582 * we know to async punt it even if it was opened O_NONBLOCK
25732583 */
2574− if (force_nonblock && !io_file_supports_async(req->file))
2584+ if (force_nonblock && !io_file_supports_async(req->file, READ))
25752585 goto copy_iov;
25762586
25772587 iov_count = iov_iter_count(&iter);
@@ -2594,7 +2604,8 @@ copy_iov: · 16 unmodified lines
25942604 if (ret)
25952605 goto out_free;
25962606 /* any defer here is final, must blocking retry */
2597− if (!(req->flags & REQ_F_NOWAIT))
2607+ if (!(req->flags & REQ_F_NOWAIT) &&
2608+ !file_can_poll(req->file))
25982609 req->flags |= REQ_F_MUST_PUNT;
25992610 return -EAGAIN;
26002611 }
@@ -2662,7 +2673,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) · 61 unmodified lines
26622673 * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so
26632674 * we know to async punt it even if it was opened O_NONBLOCK
26642675 */
2665− if (force_nonblock && !io_file_supports_async(req->file))
2676+ if (force_nonblock && !io_file_supports_async(req->file, WRITE))
26662677 goto copy_iov;
26672678
26682679 /* file path doesn't support NOWAIT for non-direct_IO */
@@ -2716,7 +2727,8 @@ copy_iov: · 47 unmodified lines
27162727 if (ret)
27172728 goto out_free;
27182729 /* any defer here is final, must blocking retry */
2719− req->flags |= REQ_F_MUST_PUNT;
2730+ if (!file_can_poll(req->file))
2731+ req->flags |= REQ_F_MUST_PUNT;
27202732 return -EAGAIN;
27212733 }
27222734 }
@@ -2756,15 +2768,6 @@ static int io_splice_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 33 unmodified lines
27562768 return 0;
27572769 }
27582770
2759−static bool io_splice_punt(struct file *file)
2760−{
2761− if (get_pipe_info(file))
2762− return false;
2763− if (!io_file_supports_async(file))
2764− return true;
2765− return !(file->f_flags & O_NONBLOCK);
2766−}
2767−
27682771 static int io_splice(struct io_kiocb *req, bool force_nonblock)
27692772 {
27702773 struct io_splice *sp = &req->splice;
@@ -2774,11 +2777,8 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock) · 3 unmodified lines
27742777 loff_t *poff_in, *poff_out;
27752778 long ret;
27762779
2777− if (force_nonblock) {
2778− if (io_splice_punt(in) || io_splice_punt(out))
2779− return -EAGAIN;
2780− flags |= SPLICE_F_NONBLOCK;
2781− }
2780+ if (force_nonblock)
2781+ return -EAGAIN;
27822782
27832783 poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
27842784 poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
@@ -3355,8 +3355,12 @@ static int io_statx(struct io_kiocb *req, bool force_nonblock) · 570 unmodified lines
33553355 struct kstat stat;
33563356 int ret;
33573357
3358− if (force_nonblock)
3358+ if (force_nonblock) {
3359+ /* only need file table for an actual valid fd */
3360+ if (ctx->dfd == -1 || ctx->dfd == AT_FDCWD)
3361+ req->flags |= REQ_F_NO_FILE_TABLE;
33593362 return -EAGAIN;
3363+ }
33603364
33613365 if (vfs_stat_set_lookup_flags(&lookup_flags, ctx->how.flags))
33623366 return -EINVAL;
@@ -3502,7 +3506,7 @@ static void io_sync_file_range_finish(struct io_wq_work **workptr) · 139 unmodified lines
35023506 if (io_req_cancelled(req))
35033507 return;
35043508 __io_sync_file_range(req);
3505− io_put_req(req); /* put submission ref */
3509+ io_steal_work(req, workptr);
35063510 }
35073511
35083512 static int io_sync_file_range(struct io_kiocb *req, bool force_nonblock)
@@ -5015,7 +5019,7 @@ static int io_req_defer(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 1506 unmodified lines
50155019 int ret;
50165020
50175021 /* Still need defer if there is pending req in defer list. */
5018− if (!req_need_defer(req) && list_empty(&ctx->defer_list))
5022+ if (!req_need_defer(req) && list_empty_careful(&ctx->defer_list))
50195023 return 0;
50205024
50215025 if (!req->io && io_alloc_async_ctx(req))
@@ -5429,7 +5433,7 @@ static int io_grab_files(struct io_kiocb *req) · 407 unmodified lines
54295433 int ret = -EBADF;
54305434 struct io_ring_ctx *ctx = req->ctx;
54315435
5432− if (req->work.files)
5436+ if (req->work.files || (req->flags & REQ_F_NO_FILE_TABLE))
54335437 return 0;
54345438 if (!ctx->ring_file)
54355439 return -EBADF;
@@ -7327,7 +7331,7 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) · 1891 unmodified lines
73277331 * it could cause shutdown to hang.
73287332 */
73297333 while (ctx->sqo_thread && !wq_has_sleeper(&ctx->sqo_wait))
7330− cpu_relax();
7334+ cond_resched();
73317335
73327336 io_kill_timeouts(ctx);
73337337 io_poll_remove_all(ctx);
fs/ioctl.c+8−0
@@ -55,6 +55,7 @@ EXPORT_SYMBOL(vfs_ioctl); · 54 unmodified lines
5555 static int ioctl_fibmap(struct file *filp, int __user *p)
5656 {
5757 struct inode *inode = file_inode(filp);
58+ struct super_block *sb = inode->i_sb;
5859 int error, ur_block;
5960 sector_t block;
6061
@@ -71,6 +72,13 @@ static int ioctl_fibmap(struct file *filp, int __user *p) · 10 unmodified lines
7172 block = ur_block;
7273 error = bmap(inode, &block);
7374
75+ if (block > INT_MAX) {
76+ error = -ERANGE;
77+ pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap result\n",
78+ current->comm, task_pid_nr(current),
79+ sb->s_id, filp);
80+ }
81+
7482 if (error)
7583 ur_block = 0;
7684 else
fs/iomap/fiemap.c+1−4
@@ -117,10 +117,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length, · 116 unmodified lines
117117
118118 if (iomap->type == IOMAP_MAPPED) {
119119 addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits;
120− if (addr > INT_MAX)
121− WARN(1, "would truncate bmap result\n");
122− else
123− *bno = addr;
120+ *bno = addr;
124121 }
125122 return 0;
126123 }
fs/nfs/nfs3acl.c+15−7
@@ -253,37 +253,45 @@ int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, · 252 unmodified lines
253253
254254 int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
255255 {
256− struct posix_acl *alloc = NULL, *dfacl = NULL;
256+ struct posix_acl *orig = acl, *dfacl = NULL, *alloc;
257257 int status;
258258
259259 if (S_ISDIR(inode->i_mode)) {
260260 switch(type) {
261261 case ACL_TYPE_ACCESS:
262− alloc = dfacl = get_acl(inode, ACL_TYPE_DEFAULT);
262+ alloc = get_acl(inode, ACL_TYPE_DEFAULT);
263263 if (IS_ERR(alloc))
264264 goto fail;
265+ dfacl = alloc;
265266 break;
266267
267268 case ACL_TYPE_DEFAULT:
268− dfacl = acl;
269− alloc = acl = get_acl(inode, ACL_TYPE_ACCESS);
269+ alloc = get_acl(inode, ACL_TYPE_ACCESS);
270270 if (IS_ERR(alloc))
271271 goto fail;
272+ dfacl = acl;
273+ acl = alloc;
272274 break;
273275 }
274276 }
275277
276278 if (acl == NULL) {
277− alloc = acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
279+ alloc = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
278280 if (IS_ERR(alloc))
279281 goto fail;
282+ acl = alloc;
280283 }
281284 status = __nfs3_proc_setacls(inode, acl, dfacl);
282− posix_acl_release(alloc);
285+out:
286+ if (acl != orig)
287+ posix_acl_release(acl);
288+ if (dfacl != orig)
289+ posix_acl_release(dfacl);
283290 return status;
284291
285292 fail:
286− return PTR_ERR(alloc);
293+ status = PTR_ERR(alloc);
294+ goto out;
287295 }
288296
289297 const struct xattr_handler *nfs3_xattr_handlers[] = {
fs/nfs/nfs4proc.c+9−2
@@ -7891,6 +7891,7 @@ static void · 7890 unmodified lines
78917891 nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata)
78927892 {
78937893 struct nfs41_bind_conn_to_session_args *args = task->tk_msg.rpc_argp;
7894+ struct nfs41_bind_conn_to_session_res *res = task->tk_msg.rpc_resp;
78947895 struct nfs_client *clp = args->client;
78957896
78967897 switch (task->tk_status) {
@@ -7899,6 +7900,12 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) · 2 unmodified lines
78997900 nfs4_schedule_session_recovery(clp->cl_session,
79007901 task->tk_status);
79017902 }
7903+ if (args->dir == NFS4_CDFC4_FORE_OR_BOTH &&
7904+ res->dir != NFS4_CDFS4_BOTH) {
7905+ rpc_task_close_connection(task);
7906+ if (args->retries++ < MAX_BIND_CONN_TO_SESSION_RETRIES)
7907+ rpc_restart_call(task);
7908+ }
79027909 }
79037910
79047911 static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = {
@@ -7921,6 +7928,7 @@ int nfs4_proc_bind_one_conn_to_session(struct rpc_clnt *clnt, · 16 unmodified lines
79217928 struct nfs41_bind_conn_to_session_args args = {
79227929 .client = clp,
79237930 .dir = NFS4_CDFC4_FORE_OR_BOTH,
7931+ .retries = 0,
79247932 };
79257933 struct nfs41_bind_conn_to_session_res res;
79267934 struct rpc_message msg = {
@@ -9191,8 +9199,7 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout) · 1264 unmodified lines
91919199 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0, 0);
91929200
91939201 task = rpc_run_task(&task_setup_data);
9194− if (IS_ERR(task))
9195− return ERR_CAST(task);
9202+
91969203 status = rpc_wait_for_completion_task(task);
91979204 if (status != 0)
91989205 goto out;
fs/nfs/pnfs.c+5−6
@@ -1332,13 +1332,15 @@ _pnfs_return_layout(struct inode *ino) · 1331 unmodified lines
13321332 !valid_layout) {
13331333 spin_unlock(&ino->i_lock);
13341334 dprintk("NFS: %s no layout segments to return\n", __func__);
1335− goto out_put_layout_hdr;
1335+ goto out_wait_layoutreturn;
13361336 }
13371337
13381338 send = pnfs_prepare_layoutreturn(lo, &stateid, &cred, NULL);
13391339 spin_unlock(&ino->i_lock);
13401340 if (send)
13411341 status = pnfs_send_layoutreturn(lo, &stateid, &cred, IOMODE_ANY, true);
1342+out_wait_layoutreturn:
1343+ wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN, TASK_UNINTERRUPTIBLE);
13421344 out_put_layout_hdr:
13431345 pnfs_free_lseg_list(&tmp_list);
13441346 pnfs_put_layout_hdr(lo);
@@ -1456,18 +1458,15 @@ retry: · 111 unmodified lines
14561458 /* lo ref dropped in pnfs_roc_release() */
14571459 layoutreturn = pnfs_prepare_layoutreturn(lo, &stateid, &lc_cred, &iomode);
14581460 /* If the creds don't match, we can't compound the layoutreturn */
1459− if (!layoutreturn)
1461+ if (!layoutreturn || cred_fscmp(cred, lc_cred) != 0)
14601462 goto out_noroc;
1461− if (cred_fscmp(cred, lc_cred) != 0)
1462− goto out_noroc_put_cred;
14631463
14641464 roc = layoutreturn;
14651465 pnfs_init_layoutreturn_args(args, lo, &stateid, iomode);
14661466 res->lrs_present = 0;
14671467 layoutreturn = false;
1468−
1469−out_noroc_put_cred:
14701468 put_cred(lc_cred);
1469+
14711470 out_noroc:
14721471 spin_unlock(&ino->i_lock);
14731472 rcu_read_unlock();
fs/nfs/super.c+1−1
@@ -185,7 +185,7 @@ static int __nfs_list_for_each_server(struct list_head *head, · 184 unmodified lines
185185
186186 rcu_read_lock();
187187 list_for_each_entry_rcu(server, head, client_link) {
188− if (!nfs_sb_active(server->super))
188+ if (!(server->super && nfs_sb_active(server->super)))
189189 continue;
190190 rcu_read_unlock();
191191 if (last)
fs/ocfs2/dlmfs/dlmfs.c+12−15
@@ -275,7 +275,6 @@ static ssize_t dlmfs_file_write(struct file *filp, · 274 unmodified lines
275275 loff_t *ppos)
276276 {
277277 int bytes_left;
278− ssize_t writelen;
279278 char *lvb_buf;
280279 struct inode *inode = file_inode(filp);
281280
@@ -285,32 +284,30 @@ static ssize_t dlmfs_file_write(struct file *filp, · 3 unmodified lines
285284 if (*ppos >= i_size_read(inode))
286285 return -ENOSPC;
287286
287+ /* don't write past the lvb */
288+ if (count > i_size_read(inode) - *ppos)
289+ count = i_size_read(inode) - *ppos;
290+
288291 if (!count)
289292 return 0;
290293
291294 if (!access_ok(buf, count))
292295 return -EFAULT;
293296
294− /* don't write past the lvb */
295− if ((count + *ppos) > i_size_read(inode))
296− writelen = i_size_read(inode) - *ppos;
297− else
298− writelen = count - *ppos;
299−
300− lvb_buf = kmalloc(writelen, GFP_NOFS);
297+ lvb_buf = kmalloc(count, GFP_NOFS);
301298 if (!lvb_buf)
302299 return -ENOMEM;
303300
304− bytes_left = copy_from_user(lvb_buf, buf, writelen);
305− writelen -= bytes_left;
306− if (writelen)
307− user_dlm_write_lvb(inode, lvb_buf, writelen);
301+ bytes_left = copy_from_user(lvb_buf, buf, count);
302+ count -= bytes_left;
303+ if (count)
304+ user_dlm_write_lvb(inode, lvb_buf, count);
308305
309306 kfree(lvb_buf);
310307
311− *ppos = *ppos + writelen;
312− mlog(0, "wrote %zd bytes\n", writelen);
313− return writelen;
308+ *ppos = *ppos + count;
309+ mlog(0, "wrote %zu bytes\n", count);
310+ return count;
314311 }
315312
316313 static void dlmfs_init_once(void *foo)
fs/pnode.c+4−5
@@ -261,14 +261,13 @@ static int propagate_one(struct mount *m) · 260 unmodified lines
261261 child = copy_tree(last_source, last_source->mnt.mnt_root, type);
262262 if (IS_ERR(child))
263263 return PTR_ERR(child);
264+ read_seqlock_excl(&mount_lock);
264265 mnt_set_mountpoint(m, mp, child);
266+ if (m->mnt_master != dest_master)
267+ SET_MNT_MARK(m->mnt_master);
268+ read_sequnlock_excl(&mount_lock);
265269 last_dest = m;
266270 last_source = child;
267− if (m->mnt_master != dest_master) {
268− read_seqlock_excl(&mount_lock);
269− SET_MNT_MARK(m->mnt_master);
270− read_sequnlock_excl(&mount_lock);
271− }
272271 hlist_add_head(&child->mnt_hash, list);
273272 return count_mounts(m->mnt_ns, child);
274273 }
fs/super.c+1−1
@@ -1302,8 +1302,8 @@ int get_tree_bdev(struct fs_context *fc, · 1301 unmodified lines
13021302 mutex_lock(&bdev->bd_fsfreeze_mutex);
13031303 if (bdev->bd_fsfreeze_count > 0) {
13041304 mutex_unlock(&bdev->bd_fsfreeze_mutex);
1305− blkdev_put(bdev, mode);
13061305 warnf(fc, "%pg: Can't mount, blockdev is frozen", bdev);
1306+ blkdev_put(bdev, mode);
13071307 return -EBUSY;
13081308 }
13091309
include/linux/dma-buf.h+1−2
@@ -329,13 +329,12 @@ struct dma_buf { · 328 unmodified lines
329329
330330 /**
331331 * struct dma_buf_attach_ops - importer operations for an attachment
332− * @move_notify: [optional] notification that the DMA-buf is moving
333332 *
334333 * Attachment operations implemented by the importer.
335334 */
336335 struct dma_buf_attach_ops {
337336 /**
338− * @move_notify
337+ * @move_notify: [optional] notification that the DMA-buf is moving
339338 *
340339 * If this callback is provided the framework can avoid pinning the
341340 * backing store while mappings exists.
include/linux/dmaengine.h+6−6
@@ -83,9 +83,9 @@ enum dma_transfer_direction { · 82 unmodified lines
8383 /**
8484 * Interleaved Transfer Request
8585 * ----------------------------
86− * A chunk is collection of contiguous bytes to be transfered.
86+ * A chunk is collection of contiguous bytes to be transferred.
8787 * The gap(in bytes) between two chunks is called inter-chunk-gap(ICG).
88− * ICGs may or maynot change between chunks.
88+ * ICGs may or may not change between chunks.
8989 * A FRAME is the smallest series of contiguous {chunk,icg} pairs,
9090 * that when repeated an integral number of times, specifies the transfer.
9191 * A transfer template is specification of a Frame, the number of times
@@ -341,13 +341,11 @@ struct dma_chan { · 249 unmodified lines
341341 * @chan: driver channel device
342342 * @device: sysfs device
343343 * @dev_id: parent dma_device dev_id
344− * @idr_ref: reference count to gate release of dma_device dev_id
345344 */
346345 struct dma_chan_dev {
347346 struct dma_chan *chan;
348347 struct device device;
349348 int dev_id;
350− atomic_t *idr_ref;
351349 };
352350
353351 /**
@@ -835,6 +833,8 @@ struct dma_device { · 481 unmodified lines
835833 int dev_id;
836834 struct device *dev;
837835 struct module *owner;
836+ struct ida chan_ida;
837+ struct mutex chan_mutex; /* to protect chan_ida */
838838
839839 u32 src_addr_widths;
840840 u32 dst_addr_widths;
@@ -1069,7 +1069,7 @@ static inline int dmaengine_terminate_all(struct dma_chan *chan) · 228 unmodified lines
10691069 * dmaengine_synchronize() needs to be called before it is safe to free
10701070 * any memory that is accessed by previously submitted descriptors or before
10711071 * freeing any resources accessed from within the completion callback of any
1072− * perviously submitted descriptors.
1072+ * previously submitted descriptors.
10731073 *
10741074 * This function can be called from atomic context as well as from within a
10751075 * complete callback of a descriptor submitted on the same channel.
@@ -1091,7 +1091,7 @@ static inline int dmaengine_terminate_async(struct dma_chan *chan) · 15 unmodified lines
10911091 *
10921092 * Synchronizes to the DMA channel termination to the current context. When this
10931093 * function returns it is guaranteed that all transfers for previously issued
1094− * descriptors have stopped and and it is safe to free the memory assoicated
1094+ * descriptors have stopped and it is safe to free the memory associated
10951095 * with them. Furthermore it is guaranteed that all complete callback functions
10961096 * for a previously submitted descriptor have finished running and it is safe to
10971097 * free resources accessed from within the complete callbacks.
include/linux/nfs_xdr.h+2−0
@@ -1317,11 +1317,13 @@ struct nfs41_impl_id { · 1316 unmodified lines
13171317 struct nfstime4 date;
13181318 };
13191319
1320+#define MAX_BIND_CONN_TO_SESSION_RETRIES 3
13201321 struct nfs41_bind_conn_to_session_args {
13211322 struct nfs_client *client;
13221323 struct nfs4_sessionid sessionid;
13231324 u32 dir;
13241325 bool use_conn_in_rdma_mode;
1326+ int retries;
13251327 };
13261328
13271329 struct nfs41_bind_conn_to_session_res {
include/linux/sunrpc/clnt.h+12−1
@@ -71,7 +71,13 @@ struct rpc_clnt { · 70 unmodified lines
7171 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
7272 struct dentry *cl_debugfs; /* debugfs directory */
7373 #endif
74− struct rpc_xprt_iter cl_xpi;
74+ /* cl_work is only needed after cl_xpi is no longer used,
75+ * and that are of similar size
76+ */
77+ union {
78+ struct rpc_xprt_iter cl_xpi;
79+ struct work_struct cl_work;
80+ };
7581 const struct cred *cl_cred;
7682 };
7783
@@ -236,4 +242,9 @@ static inline int rpc_reply_expected(struct rpc_task *task) · 158 unmodified lines
236242 (task->tk_msg.rpc_proc->p_decode != NULL);
237243 }
238244
245+static inline void rpc_task_close_connection(struct rpc_task *task)
246+{
247+ if (task->tk_xprt)
248+ xprt_force_disconnect(task->tk_xprt);
249+}
239250 #endif /* _LINUX_SUNRPC_CLNT_H */
include/trace/events/rpcrdma.h+4−8
@@ -692,11 +692,10 @@ TRACE_EVENT(xprtrdma_prepsend_failed, · 691 unmodified lines
692692
693693 TRACE_EVENT(xprtrdma_post_send,
694694 TP_PROTO(
695− const struct rpcrdma_req *req,
696− int status
695+ const struct rpcrdma_req *req
697696 ),
698697
699− TP_ARGS(req, status),
698+ TP_ARGS(req),
700699
701700 TP_STRUCT__entry(
702701 __field(const void *, req)
@@ -705,7 +704,6 @@ TRACE_EVENT(xprtrdma_post_send, · 2 unmodified lines
705704 __field(unsigned int, client_id)
706705 __field(int, num_sge)
707706 __field(int, signaled)
708− __field(int, status)
709707 ),
710708
711709 TP_fast_assign(
@@ -718,15 +716,13 @@ TRACE_EVENT(xprtrdma_post_send, · 6 unmodified lines
718716 __entry->sc = req->rl_sendctx;
719717 __entry->num_sge = req->rl_wr.num_sge;
720718 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
721− __entry->status = status;
722719 ),
723720
724− TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %sstatus=%d",
721+ TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %s",
725722 __entry->task_id, __entry->client_id,
726723 __entry->req, __entry->sc, __entry->num_sge,
727724 (__entry->num_sge == 1 ? "" : "s"),
728− (__entry->signaled ? "signaled " : ""),
729− __entry->status
725+ (__entry->signaled ? "signaled" : "")
730726 )
731727 );
732728
include/uapi/drm/amdgpu_drm.h+4−0
@@ -346,6 +346,10 @@ struct drm_amdgpu_gem_userptr { · 345 unmodified lines
346346 #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
347347 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
348348 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
349+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44
350+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1
351+#define AMDGPU_TILING_SCANOUT_SHIFT 63
352+#define AMDGPU_TILING_SCANOUT_MASK 0x1
349353
350354 /* Set/Get helpers for tiling flags. */
351355 #define AMDGPU_TILING_SET(field, value) \
include/uapi/linux/dma-buf.h+6−0
@@ -39,6 +39,12 @@ struct dma_buf_sync { · 38 unmodified lines
3939
4040 #define DMA_BUF_BASE 'b'
4141 #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
42+
43+/* 32/64bitness of this uapi was botched in android, there's no difference
44+ * between them in actual uapi, they're just different numbers.
45+ */
4246 #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
47+#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
48+#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
4349
4450 #endif
include/uapi/linux/hyperv.h+2−2
@@ -119,8 +119,8 @@ enum hv_fcopy_op { · 118 unmodified lines
119119
120120 struct hv_fcopy_hdr {
121121 __u32 operation;
122− uuid_le service_id0; /* currently unused */
123− uuid_le service_id1; /* currently unused */
122+ __u8 service_id0[16]; /* currently unused */
123+ __u8 service_id1[16]; /* currently unused */
124124 } __attribute__((packed));
125125
126126 #define OVER_WRITE 0x1
kernel/power/hibernate.c+7−0
@@ -898,6 +898,13 @@ static int software_resume(void) · 897 unmodified lines
898898 error = freeze_processes();
899899 if (error)
900900 goto Close_Finish;
901+
902+ error = freeze_kernel_threads();
903+ if (error) {
904+ thaw_processes();
905+ goto Close_Finish;
906+ }
907+
901908 error = load_image_and_restore();
902909 thaw_processes();
903910 Finish:
lib/kunit/test.c+1−1
@@ -93,7 +93,7 @@ static void kunit_print_ok_not_ok(void *test_or_suite, · 92 unmodified lines
9393 * representation.
9494 */
9595 if (suite)
96− pr_info("%s %zd - %s",
96+ pr_info("%s %zd - %s\n",
9797 kunit_status_to_string(is_ok),
9898 test_number, description);
9999 else
net/sunrpc/clnt.c+18−6
@@ -880,6 +880,20 @@ EXPORT_SYMBOL_GPL(rpc_shutdown_client); · 879 unmodified lines
880880 /*
881881 * Free an RPC client
882882 */
883+static void rpc_free_client_work(struct work_struct *work)
884+{
885+ struct rpc_clnt *clnt = container_of(work, struct rpc_clnt, cl_work);
886+
887+ /* These might block on processes that might allocate memory,
888+ * so they cannot be called in rpciod, so they are handled separately
889+ * here.
890+ */
891+ rpc_clnt_debugfs_unregister(clnt);
892+ rpc_clnt_remove_pipedir(clnt);
893+
894+ kfree(clnt);
895+ rpciod_down();
896+}
883897 static struct rpc_clnt *
884898 rpc_free_client(struct rpc_clnt *clnt)
885899 {
@@ -890,17 +904,16 @@ rpc_free_client(struct rpc_clnt *clnt) · 4 unmodified lines
890904 rcu_dereference(clnt->cl_xprt)->servername);
891905 if (clnt->cl_parent != clnt)
892906 parent = clnt->cl_parent;
893− rpc_clnt_debugfs_unregister(clnt);
894− rpc_clnt_remove_pipedir(clnt);
895907 rpc_unregister_client(clnt);
896908 rpc_free_iostats(clnt->cl_metrics);
897909 clnt->cl_metrics = NULL;
898910 xprt_put(rcu_dereference_raw(clnt->cl_xprt));
899911 xprt_iter_destroy(&clnt->cl_xpi);
900− rpciod_down();
901912 put_cred(clnt->cl_cred);
902913 rpc_free_clid(clnt);
903− kfree(clnt);
914+
915+ INIT_WORK(&clnt->cl_work, rpc_free_client_work);
916+ schedule_work(&clnt->cl_work);
904917 return parent;
905918 }
906919
@@ -2808,8 +2821,7 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, · 1901 unmodified lines
28082821 task = rpc_call_null_helper(clnt, xprt, NULL,
28092822 RPC_TASK_SOFT|RPC_TASK_SOFTCONN|RPC_TASK_ASYNC|RPC_TASK_NULLCREDS,
28102823 &rpc_cb_add_xprt_call_ops, data);
2811− if (IS_ERR(task))
2812− return PTR_ERR(task);
2824+
28132825 rpc_put_task(task);
28142826 success:
28152827 return 1;
net/sunrpc/xprtrdma/rpc_rdma.c+11−4
@@ -388,7 +388,9 @@ static int rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt, · 387 unmodified lines
388388 } while (nsegs);
389389
390390 done:
391− return xdr_stream_encode_item_absent(xdr);
391+ if (xdr_stream_encode_item_absent(xdr) < 0)
392+ return -EMSGSIZE;
393+ return 0;
392394 }
393395
394396 /* Register and XDR encode the Write list. Supports encoding a list
@@ -454,7 +456,9 @@ static int rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt, · 59 unmodified lines
454456 *segcount = cpu_to_be32(nchunks);
455457
456458 done:
457− return xdr_stream_encode_item_absent(xdr);
459+ if (xdr_stream_encode_item_absent(xdr) < 0)
460+ return -EMSGSIZE;
461+ return 0;
458462 }
459463
460464 /* Register and XDR encode the Reply chunk. Supports encoding an array
@@ -480,8 +484,11 @@ static int rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt, · 19 unmodified lines
480484 int nsegs, nchunks;
481485 __be32 *segcount;
482486
483− if (wtype != rpcrdma_replych)
484− return xdr_stream_encode_item_absent(xdr);
487+ if (wtype != rpcrdma_replych) {
488+ if (xdr_stream_encode_item_absent(xdr) < 0)
489+ return -EMSGSIZE;
490+ return 0;
491+ }
485492
486493 seg = req->rl_segments;
487494 nsegs = rpcrdma_convert_iovs(r_xprt, &rqst->rq_rcv_buf, 0, wtype, seg);
net/sunrpc/xprtrdma/verbs.c+2−1
@@ -289,6 +289,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) · 288 unmodified lines
289289 case RDMA_CM_EVENT_DISCONNECTED:
290290 ep->re_connect_status = -ECONNABORTED;
291291 disconnected:
292+ xprt_force_disconnect(xprt);
292293 return rpcrdma_ep_destroy(ep);
293294 default:
294295 break;
@@ -1355,8 +1356,8 @@ int rpcrdma_post_sends(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) · 1060 unmodified lines
13551356 --ep->re_send_count;
13561357 }
13571358
1359+ trace_xprtrdma_post_send(req);
13581360 rc = frwr_send(r_xprt, req);
1359− trace_xprtrdma_post_send(req, rc);
13601361 if (rc)
13611362 return -ENOTCONN;
13621363 return 0;
security/selinux/hooks.c+45−25
@@ -5842,40 +5842,60 @@ static unsigned int selinux_ipv6_postroute(void *priv, · 5841 unmodified lines
58425842
58435843 static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
58445844 {
5845− int err = 0;
5846− u32 perm;
5845+ int rc = 0;
5846+ unsigned int msg_len;
5847+ unsigned int data_len = skb->len;
5848+ unsigned char *data = skb->data;
58475849 struct nlmsghdr *nlh;
58485850 struct sk_security_struct *sksec = sk->sk_security;
5851+ u16 sclass = sksec->sclass;
5852+ u32 perm;
58495853
5850− if (skb->len < NLMSG_HDRLEN) {
5851− err = -EINVAL;
5852− goto out;
5853− }
5854− nlh = nlmsg_hdr(skb);
5854+ while (data_len >= nlmsg_total_size(0)) {
5855+ nlh = (struct nlmsghdr *)data;
5856+
5857+ /* NOTE: the nlmsg_len field isn't reliably set by some netlink
5858+ * users which means we can't reject skb's with bogus
5859+ * length fields; our solution is to follow what
5860+ * netlink_rcv_skb() does and simply skip processing at
5861+ * messages with length fields that are clearly junk
5862+ */
5863+ if (nlh->nlmsg_len < NLMSG_HDRLEN || nlh->nlmsg_len > data_len)
5864+ return 0;
58555865
5856− err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm);
5857− if (err) {
5858− if (err == -EINVAL) {
5866+ rc = selinux_nlmsg_lookup(sclass, nlh->nlmsg_type, &perm);
5867+ if (rc == 0) {
5868+ rc = sock_has_perm(sk, perm);
5869+ if (rc)
5870+ return rc;
5871+ } else if (rc == -EINVAL) {
5872+ /* -EINVAL is a missing msg/perm mapping */
58595873 pr_warn_ratelimited("SELinux: unrecognized netlink"
5860− " message: protocol=%hu nlmsg_type=%hu sclass=%s"
5861− " pid=%d comm=%s\n",
5862− sk->sk_protocol, nlh->nlmsg_type,
5863− secclass_map[sksec->sclass - 1].name,
5864− task_pid_nr(current), current->comm);
5865− if (!enforcing_enabled(&selinux_state) ||
5866− security_get_allow_unknown(&selinux_state))
5867− err = 0;
5874+ " message: protocol=%hu nlmsg_type=%hu sclass=%s"
5875+ " pid=%d comm=%s\n",
5876+ sk->sk_protocol, nlh->nlmsg_type,
5877+ secclass_map[sclass - 1].name,
5878+ task_pid_nr(current), current->comm);
5879+ if (enforcing_enabled(&selinux_state) &&
5880+ !security_get_allow_unknown(&selinux_state))
5881+ return rc;
5882+ rc = 0;
5883+ } else if (rc == -ENOENT) {
5884+ /* -ENOENT is a missing socket/class mapping, ignore */
5885+ rc = 0;
5886+ } else {
5887+ return rc;
58685888 }
58695889
5870− /* Ignore */
5871− if (err == -ENOENT)
5872− err = 0;
5873− goto out;
5890+ /* move to the next message after applying netlink padding */
5891+ msg_len = NLMSG_ALIGN(nlh->nlmsg_len);
5892+ if (msg_len >= data_len)
5893+ return 0;
5894+ data_len -= msg_len;
5895+ data += msg_len;
58745896 }
58755897
5876− err = sock_has_perm(sk, perm);
5877−out:
5878− return err;
5898+ return rc;
58795899 }
58805900
58815901 static void ipc_init_security(struct ipc_security_struct *isec, u16 sclass)
security/selinux/ss/conditional.c+1−1
@@ -429,7 +429,7 @@ int cond_read_list(struct policydb *p, void *fp) · 428 unmodified lines
429429
430430 p->cond_list = kcalloc(len, sizeof(*p->cond_list), GFP_KERNEL);
431431 if (!p->cond_list)
432− return rc;
432+ return -ENOMEM;
433433
434434 rc = avtab_alloc(&(p->te_cond_avtab), p->te_avtab.nel);
435435 if (rc)
sound/core/oss/pcm_plugin.c+6−4
@@ -205,13 +205,14 @@ static snd_pcm_sframes_t calc_dst_frames(struct snd_pcm_substream *plug, · 204 unmodified lines
205205 plugin = snd_pcm_plug_first(plug);
206206 while (plugin && frames > 0) {
207207 plugin_next = plugin->next;
208+ if (check_size && plugin->buf_frames &&
209+ frames > plugin->buf_frames)
210+ frames = plugin->buf_frames;
208211 if (plugin->dst_frames) {
209212 frames = plugin->dst_frames(plugin, frames);
210213 if (frames < 0)
211214 return frames;
212215 }
213− if (check_size && frames > plugin->buf_frames)
214− frames = plugin->buf_frames;
215216 plugin = plugin_next;
216217 }
217218 return frames;
@@ -225,14 +226,15 @@ static snd_pcm_sframes_t calc_src_frames(struct snd_pcm_substream *plug, · 7 unmodified lines
225226
226227 plugin = snd_pcm_plug_last(plug);
227228 while (plugin && frames > 0) {
228− if (check_size && frames > plugin->buf_frames)
229− frames = plugin->buf_frames;
230229 plugin_prev = plugin->prev;
231230 if (plugin->src_frames) {
232231 frames = plugin->src_frames(plugin, frames);
233232 if (frames < 0)
234233 return frames;
235234 }
235+ if (check_size && plugin->buf_frames &&
236+ frames > plugin->buf_frames)
237+ frames = plugin->buf_frames;
236238 plugin = plugin_prev;
237239 }
238240 return frames;
sound/isa/opti9xx/miro.c+6−3
@@ -867,10 +867,13 @@ static void snd_miro_write(struct snd_miro *chip, unsigned char reg, · 866 unmodified lines
867867 spin_unlock_irqrestore(&chip->lock, flags);
868868 }
869869
870+static inline void snd_miro_write_mask(struct snd_miro *chip,
871+ unsigned char reg, unsigned char value, unsigned char mask)
872+{
873+ unsigned char oldval = snd_miro_read(chip, reg);
870874
871−#define snd_miro_write_mask(chip, reg, value, mask) \
872− snd_miro_write(chip, reg, \
873− (snd_miro_read(chip, reg) & ~(mask)) | ((value) & (mask)))
875+ snd_miro_write(chip, reg, (oldval & ~mask) | (value & mask));
876+}
874877
875878 /*
876879 * Proc Interface
sound/isa/opti9xx/opti92x-ad1848.c+6−3
@@ -317,10 +317,13 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, · 316 unmodified lines
317317 }
318318
319319
320−#define snd_opti9xx_write_mask(chip, reg, value, mask) \
321− snd_opti9xx_write(chip, reg, \
322− (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
320+static inline void snd_opti9xx_write_mask(struct snd_opti9xx *chip,
321+ unsigned char reg, unsigned char value, unsigned char mask)
322+{
323+ unsigned char oldval = snd_opti9xx_read(chip, reg);
323324
325+ snd_opti9xx_write(chip, reg, (oldval & ~mask) | (value & mask));
326+}
324327
325328 static int snd_opti9xx_configure(struct snd_opti9xx *chip,
326329 long port,
sound/pci/hda/hda_intel.c+5−4
@@ -2078,9 +2078,10 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream, · 2077 unmodified lines
20782078 * some HD-audio PCI entries are exposed without any codecs, and such devices
20792079 * should be ignored from the beginning.
20802080 */
2081−static const struct snd_pci_quirk driver_blacklist[] = {
2082− SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0),
2083− SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0),
2081+static const struct pci_device_id driver_blacklist[] = {
2082+ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1043, 0x874f) }, /* ASUS ROG Zenith II / Strix */
2083+ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb59) }, /* MSI TRX40 Creator */
2084+ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb60) }, /* MSI TRX40 */
20842085 {}
20852086 };
20862087
@@ -2100,7 +2101,7 @@ static int azx_probe(struct pci_dev *pci, · 13 unmodified lines
21002101 bool schedule_probe;
21012102 int err;
21022103
2103− if (snd_pci_quirk_lookup(pci, driver_blacklist)) {
2104+ if (pci_match_id(driver_blacklist, pci)) {
21042105 dev_info(&pci->dev, "Skipping the blacklisted device\n");
21052106 return -ENODEV;
21062107 }
sound/pci/hda/patch_hdmi.c+5−1
@@ -1848,8 +1848,10 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) · 1847 unmodified lines
18481848 /* Add sanity check to pass klockwork check.
18491849 * This should never happen.
18501850 */
1851− if (WARN_ON(spdif == NULL))
1851+ if (WARN_ON(spdif == NULL)) {
1852+ mutex_unlock(&codec->spdif_mutex);
18521853 return true;
1854+ }
18531855 non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
18541856 mutex_unlock(&codec->spdif_mutex);
18551857 return non_pcm;
@@ -2198,7 +2200,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) · 342 unmodified lines
21982200
21992201 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
22002202 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
2203+ struct hdmi_eld *pin_eld = &per_pin->sink_eld;
22012204
2205+ pin_eld->eld_valid = false;
22022206 hdmi_present_sense(per_pin, 0);
22032207 }
22042208
sound/pci/hda/patch_realtek.c+1−0
@@ -7420,6 +7420,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 7419 unmodified lines
74207420 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
74217421 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
74227422 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
7423+ SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
74237424 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
74247425 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
74257426 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
sound/usb/line6/podhd.c+5−17
@@ -21,8 +21,7 @@ · 20 unmodified lines
2121 enum {
2222 LINE6_PODHD300,
2323 LINE6_PODHD400,
24− LINE6_PODHD500_0,
25− LINE6_PODHD500_1,
24+ LINE6_PODHD500,
2625 LINE6_PODX3,
2726 LINE6_PODX3LIVE,
2827 LINE6_PODHD500X,
@@ -318,8 +317,7 @@ static const struct usb_device_id podhd_id_table[] = { · 289 unmodified lines
318317 /* TODO: no need to alloc data interfaces when only audio is used */
319318 { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 },
320319 { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 },
321− { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
322− { LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
320+ { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500 },
323321 { LINE6_IF_NUM(0x414A, 0), .driver_info = LINE6_PODX3 },
324322 { LINE6_IF_NUM(0x414B, 0), .driver_info = LINE6_PODX3LIVE },
325323 { LINE6_IF_NUM(0x4159, 0), .driver_info = LINE6_PODHD500X },
@@ -352,23 +350,13 @@ static const struct line6_properties podhd_properties_table[] = { · 26 unmodified lines
352350 .ep_audio_r = 0x82,
353351 .ep_audio_w = 0x01,
354352 },
355− [LINE6_PODHD500_0] = {
353+ [LINE6_PODHD500] = {
356354 .id = "PODHD500",
357355 .name = "POD HD500",
358− .capabilities = LINE6_CAP_PCM
356+ .capabilities = LINE6_CAP_PCM | LINE6_CAP_CONTROL
359357 | LINE6_CAP_HWMON,
360358 .altsetting = 1,
361− .ep_ctrl_r = 0x81,
362− .ep_ctrl_w = 0x01,
363− .ep_audio_r = 0x86,
364− .ep_audio_w = 0x02,
365− },
366− [LINE6_PODHD500_1] = {
367− .id = "PODHD500",
368− .name = "POD HD500",
369− .capabilities = LINE6_CAP_PCM
370− | LINE6_CAP_HWMON,
371− .altsetting = 0,
359+ .ctrl_if = 1,
372360 .ep_ctrl_r = 0x81,
373361 .ep_ctrl_w = 0x01,
374362 .ep_audio_r = 0x86,
sound/usb/quirks.c+1−1
@@ -1687,7 +1687,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, · 1686 unmodified lines
16871687
16881688 case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */
16891689 case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */
1690− case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */
1690+ case USB_ID(0x16d0, 0x06b2): /* NuPrime DAC-10 */
16911691 case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */
16921692 case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */
16931693 case USB_ID(0x16d0, 0x09db): /* NuPrime Audio DAC-9 */
tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc+1−4
@@ -10,10 +10,7 @@ if ! grep -q function_graph available_tracers; then · 9 unmodified lines
1010 exit_unsupported
1111 fi
1212
13−if [ ! -f set_ftrace_filter ]; then
14− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
15− exit_unsupported
16−fi
13+check_filter_file set_ftrace_filter
1714
1815 do_reset() {
1916 if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then
tools/testing/selftests/ftrace/test.d/ftrace/fgraph-filter.tc+2−0
@@ -9,6 +9,8 @@ if ! grep -q function_graph available_tracers; then · 8 unmodified lines
99 exit_unsupported
1010 fi
1111
12+check_filter_file set_ftrace_filter
13+
1214 fail() { # msg
1315 echo $1
1416 exit_fail
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc+2−0
@@ -9,6 +9,8 @@ if ! grep -q function available_tracers; then · 8 unmodified lines
99 exit_unsupported
1010 fi
1111
12+check_filter_file set_ftrace_filter
13+
1214 disable_tracing
1315 clear_trace
1416
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc+1−4
@@ -15,10 +15,7 @@ if [ ! -f set_ftrace_notrace_pid ]; then · 14 unmodified lines
1515 exit_unsupported
1616 fi
1717
18−if [ ! -f set_ftrace_filter ]; then
19− echo "set_ftrace_filter not found? Is function tracer not set?"
20− exit_unsupported
21−fi
18+check_filter_file set_ftrace_filter
2219
2320 do_function_fork=1
2421
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc+1−4
@@ -16,10 +16,7 @@ if [ ! -f set_ftrace_pid ]; then · 15 unmodified lines
1616 exit_unsupported
1717 fi
1818
19−if [ ! -f set_ftrace_filter ]; then
20− echo "set_ftrace_filter not found? Is function tracer not set?"
21− exit_unsupported
22−fi
19+check_filter_file set_ftrace_filter
2320
2421 do_function_fork=1
2522
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # description: ftrace - stacktrace filter command
44 # flags: instance
55
6−[ ! -f set_ftrace_filter ] && exit_unsupported
6+check_filter_file set_ftrace_filter
77
88 echo _do_fork:stacktrace >> set_ftrace_filter
99
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc+1−4
@@ -11,10 +11,7 @@ · 10 unmodified lines
1111 #
1212
1313 # The triggers are set within the set_ftrace_filter file
14−if [ ! -f set_ftrace_filter ]; then
15− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
16− exit_unsupported
17−fi
14+check_filter_file set_ftrace_filter
1815
1916 do_reset() {
2017 reset_ftrace_filter
tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 # SPDX-License-Identifier: GPL-2.0
33 # description: ftrace - function trace on module
44
5−[ ! -f set_ftrace_filter ] && exit_unsupported
5+check_filter_file set_ftrace_filter
66
77 : "mod: allows to filter a non exist function"
88 echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc+1−4
@@ -18,10 +18,7 @@ if ! grep -q function_graph available_tracers; then · 17 unmodified lines
1818 exit_unsupported;
1919 fi
2020
21−if [ ! -f set_ftrace_filter ]; then
22− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
23− exit_unsupported
24−fi
21+check_filter_file set_ftrace_filter
2522
2623 if [ ! -f function_profile_enabled ]; then
2724 echo "function_profile_enabled not found, function profiling enabled?"
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc+1−4
@@ -10,10 +10,7 @@ · 9 unmodified lines
1010 #
1111
1212 # The triggers are set within the set_ftrace_filter file
13−if [ ! -f set_ftrace_filter ]; then
14− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
15− exit_unsupported
16−fi
13+check_filter_file set_ftrace_filter
1714
1815 fail() { # mesg
1916 echo $1
tools/testing/selftests/ftrace/test.d/ftrace/func_stack_tracer.tc+2−0
@@ -8,6 +8,8 @@ if [ ! -f stack_trace ]; then · 7 unmodified lines
88 exit_unsupported
99 fi
1010
11+check_filter_file stack_trace_filter
12+
1113 echo > stack_trace_filter
1214 echo 0 > stack_max_size
1315 echo 1 > /proc/sys/kernel/stack_tracer_enabled
tools/testing/selftests/ftrace/test.d/ftrace/func_traceonoff_triggers.tc+1−4
@@ -11,10 +11,7 @@ · 10 unmodified lines
1111 #
1212
1313 # The triggers are set within the set_ftrace_filter file
14−if [ ! -f set_ftrace_filter ]; then
15− echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
16− exit_unsupported
17−fi
14+check_filter_file set_ftrace_filter
1815
1916 fail() { # mesg
2017 echo $1
tools/testing/selftests/ftrace/test.d/functions+6−0
@@ -1,3 +1,9 @@
1+check_filter_file() { # check filter file introduced by dynamic ftrace
2+ if [ ! -f "$1" ]; then
3+ echo "$1 not found? Is dynamic ftrace not set?"
4+ exit_unsupported
5+ fi
6+}
17
28 clear_trace() { # reset trace output
39 echo > trace
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc+1−1
@@ -38,7 +38,7 @@ for width in 64 32 16 8; do · 37 unmodified lines
3838 echo 0 > events/kprobes/testprobe/enable
3939
4040 : "Confirm the arguments is recorded in given types correctly"
41− ARGS=`grep "testprobe" trace | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
41+ ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
4242 check_types $ARGS $width
4343
4444 : "Clear event for next loop"
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 [ -f kprobe_events ] || exit_unsupported # this is configurable
66 grep "function" available_tracers || exit_unsupported # this is configurable
77
8+check_filter_file set_ftrace_filter
9+
810 # prepare
911 echo nop > current_tracer
1012 echo _do_fork > set_ftrace_filter
tools/testing/selftests/gpio/Makefile+6−6
@@ -1,13 +1,13 @@
11 # SPDX-License-Identifier: GPL-2.0
22
3−MOUNT_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
4−MOUNT_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
5−ifeq ($(MOUNT_LDLIBS),)
6−MOUNT_LDLIBS := -lmount -I/usr/include/libmount
3+VAR_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
4+VAR_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
5+ifeq ($(VAR_LDLIBS),)
6+VAR_LDLIBS := -lmount -I/usr/include/libmount
77 endif
88
9−CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(MOUNT_CFLAGS)
10−LDLIBS += $(MOUNT_LDLIBS)
9+CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(VAR_CFLAGS)
10+LDLIBS += $(VAR_LDLIBS)
1111
1212 TEST_PROGS := gpio-mockup.sh
1313 TEST_FILES := gpio-mockup-sysfs.sh
tools/testing/selftests/intel_pstate/Makefile+1−1
@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0
22 CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
3−LDLIBS := $(LDLIBS) -lm
3+LDLIBS += -lm
44
55 uname_M := $(shell uname -m 2>/dev/null || echo not)
66 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
tools/testing/selftests/kselftest_deps.sh+272−0
@@ -0,0 +1,272 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+# kselftest_deps.sh
4+#
5+# Checks for kselftest build dependencies on the build system.
6+# Copyright (c) 2020 Shuah Khan <skhan@linuxfoundation.org>
7+#
8+#
9+
10+usage()
11+{
12+
13+echo -e "Usage: $0 -[p] <compiler> [test_name]\n"
14+echo -e "\tkselftest_deps.sh [-p] gcc"
15+echo -e "\tkselftest_deps.sh [-p] gcc vm"
16+echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc"
17+echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc vm\n"
18+echo "- Should be run in selftests directory in the kernel repo."
19+echo "- Checks if Kselftests can be built/cross-built on a system."
20+echo "- Parses all test/sub-test Makefile to find library dependencies."
21+echo "- Runs compile test on a trivial C file with LDLIBS specified"
22+echo " in the test Makefiles to identify missing library dependencies."
23+echo "- Prints suggested target list for a system filtering out tests"
24+echo " failed the build dependency check from the TARGETS in Selftests"
25+echo " main Makefile when optional -p is specified."
26+echo "- Prints pass/fail dependency check for each tests/sub-test."
27+echo "- Prints pass/fail targets and libraries."
28+echo "- Default: runs dependency checks on all tests."
29+echo "- Optional test name can be specified to check dependencies for it."
30+exit 1
31+
32+}
33+
34+# Start main()
35+main()
36+{
37+
38+base_dir=`pwd`
39+# Make sure we're in the selftests top-level directory.
40+if [ $(basename "$base_dir") != "selftests" ]; then
41+ echo -e "\tPlease run $0 in"
42+ echo -e "\ttools/testing/selftests directory ..."
43+ exit 1
44+fi
45+
46+print_targets=0
47+
48+while getopts "p" arg; do
49+ case $arg in
50+ p)
51+ print_targets=1
52+ shift;;
53+ esac
54+done
55+
56+if [ $# -eq 0 ]
57+then
58+ usage
59+fi
60+
61+# Compiler
62+CC=$1
63+
64+tmp_file=$(mktemp).c
65+trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT
66+#echo $tmp_file
67+
68+pass=$(mktemp).out
69+trap "rm -f $pass" EXIT
70+#echo $pass
71+
72+fail=$(mktemp).out
73+trap "rm -f $fail" EXIT
74+#echo $fail
75+
76+# Generate tmp source fire for compile test
77+cat << "EOF" > $tmp_file
78+int main()
79+{
80+}
81+EOF
82+
83+# Save results
84+total_cnt=0
85+fail_trgts=()
86+fail_libs=()
87+fail_cnt=0
88+pass_trgts=()
89+pass_libs=()
90+pass_cnt=0
91+
92+# Get all TARGETS from selftests Makefile
93+targets=$(egrep "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2)
94+
95+# Single test case
96+if [ $# -eq 2 ]
97+then
98+ test=$2/Makefile
99+
100+ l1_test $test
101+ l2_test $test
102+ l3_test $test
103+
104+ print_results $1 $2
105+ exit $?
106+fi
107+
108+# Level 1: LDLIBS set static.
109+#
110+# Find all LDLIBS set statically for all executables built by a Makefile
111+# and filter out VAR_LDLIBS to discard the following:
112+# gpio/Makefile:LDLIBS += $(VAR_LDLIBS)
113+# Append space at the end of the list to append more tests.
114+
115+l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
116+ grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
117+
118+# Level 2: LDLIBS set dynamically.
119+#
120+# Level 2
121+# Some tests have multiple valid LDLIBS lines for individual sub-tests
122+# that need dependency checks. Find them and append them to the tests
123+# e.g: vm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
124+# Filter out VAR_LDLIBS to discard the following:
125+# memfd/Makefile:$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
126+# Append space at the end of the list to append more tests.
127+
128+l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
129+ grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
130+
131+# Level 3
132+# gpio, memfd and others use pkg-config to find mount and fuse libs
133+# respectively and save it in VAR_LDLIBS. If pkg-config doesn't find
134+# any, VAR_LDLIBS set to default.
135+# Use the default value and filter out pkg-config for dependency check.
136+# e.g:
137+# gpio/Makefile
138+# VAR_LDLIBS := $(shell pkg-config --libs mount) 2>/dev/null)
139+# memfd/Makefile
140+# VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
141+
142+l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \
143+ grep -v "pkg-config" | awk -F: '{print $1}')
144+
145+#echo $l1_tests
146+#echo $l2_1_tests
147+#echo $l3_tests
148+
149+all_tests
150+print_results $1 $2
151+
152+exit $?
153+}
154+# end main()
155+
156+all_tests()
157+{
158+ for test in $l1_tests; do
159+ l1_test $test
160+ done
161+
162+ for test in $l2_tests; do
163+ l2_test $test
164+ done
165+
166+ for test in $l3_tests; do
167+ l3_test $test
168+ done
169+}
170+
171+# Use same parsing used for l1_tests and pick libraries this time.
172+l1_test()
173+{
174+ test_libs=$(grep --include=Makefile "^LDLIBS" $test | \
175+ grep -v "VAR_LDLIBS" | \
176+ sed -e 's/\:/ /' | \
177+ sed -e 's/+/ /' | cut -d "=" -f 2)
178+
179+ check_libs $test $test_libs
180+}
181+
182+# Use same parsing used for l2__tests and pick libraries this time.
183+l2_test()
184+{
185+ test_libs=$(grep --include=Makefile ": LDLIBS" $test | \
186+ grep -v "VAR_LDLIBS" | \
187+ sed -e 's/\:/ /' | sed -e 's/+/ /' | \
188+ cut -d "=" -f 2)
189+
190+ check_libs $test $test_libs
191+}
192+
193+l3_test()
194+{
195+ test_libs=$(grep --include=Makefile "^VAR_LDLIBS" $test | \
196+ grep -v "pkg-config" | sed -e 's/\:/ /' |
197+ sed -e 's/+/ /' | cut -d "=" -f 2)
198+
199+ check_libs $test $test_libs
200+}
201+
202+check_libs()
203+{
204+
205+if [[ ! -z "${test_libs// }" ]]
206+then
207+
208+ #echo $test_libs
209+
210+ for lib in $test_libs; do
211+
212+ let total_cnt+=1
213+ $CC -o $tmp_file.bin $lib $tmp_file > /dev/null 2>&1
214+ if [ $? -ne 0 ]; then
215+ echo "FAIL: $test dependency check: $lib" >> $fail
216+ let fail_cnt+=1
217+ fail_libs+="$lib "
218+ fail_target=$(echo "$test" | cut -d "/" -f1)
219+ fail_trgts+="$fail_target "
220+ targets=$(echo "$targets" | grep -v "$fail_target")
221+ else
222+ echo "PASS: $test dependency check passed $lib" >> $pass
223+ let pass_cnt+=1
224+ pass_libs+="$lib "
225+ pass_trgts+="$(echo "$test" | cut -d "/" -f1) "
226+ fi
227+
228+ done
229+fi
230+}
231+
232+print_results()
233+{
234+ echo -e "========================================================";
235+ echo -e "Kselftest Dependency Check for [$0 $1 $2] results..."
236+
237+ if [ $print_targets -ne 0 ]
238+ then
239+ echo -e "Suggested Selftest Targets for your configuration:"
240+ echo -e "$targets";
241+ fi
242+
243+ echo -e "========================================================";
244+ echo -e "Checked tests defining LDLIBS dependencies"
245+ echo -e "--------------------------------------------------------";
246+ echo -e "Total tests with Dependencies:"
247+ echo -e "$total_cnt Pass: $pass_cnt Fail: $fail_cnt";
248+
249+ if [ $pass_cnt -ne 0 ]; then
250+ echo -e "--------------------------------------------------------";
251+ cat $pass
252+ echo -e "--------------------------------------------------------";
253+ echo -e "Targets passed build dependency check on system:"
254+ echo -e "$(echo "$pass_trgts" | xargs -n1 | sort -u | xargs)"
255+ fi
256+
257+ if [ $fail_cnt -ne 0 ]; then
258+ echo -e "--------------------------------------------------------";
259+ cat $fail
260+ echo -e "--------------------------------------------------------";
261+ echo -e "Targets failed build dependency check on system:"
262+ echo -e "$(echo "$fail_trgts" | xargs -n1 | sort -u | xargs)"
263+ echo -e "--------------------------------------------------------";
264+ echo -e "Missing libraries system"
265+ echo -e "$(echo "$fail_libs" | xargs -n1 | sort -u | xargs)"
266+ fi
267+
268+ echo -e "--------------------------------------------------------";
269+ echo -e "========================================================";
270+}
271+
272+main "$@"
tools/testing/selftests/memfd/Makefile+12−2
@@ -8,11 +8,21 @@ TEST_GEN_PROGS := memfd_test · 7 unmodified lines
88 TEST_PROGS := run_fuse_test.sh run_hugetlbfs_test.sh
99 TEST_GEN_FILES := fuse_test fuse_mnt
1010
11−fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
11+VAR_CFLAGS := $(shell pkg-config fuse --cflags 2>/dev/null)
12+ifeq ($(VAR_CFLAGS),)
13+VAR_CFLAGS := -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse
14+endif
15+
16+VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
17+ifeq ($(VAR_LDLIBS),)
18+VAR_LDLIBS := -lfuse -pthread
19+endif
20+
21+fuse_mnt.o: CFLAGS += $(VAR_CFLAGS)
1222
1323 include ../lib.mk
1424
15−$(OUTPUT)/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
25+$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
1626
1727 $(OUTPUT)/memfd_test: memfd_test.c common.c
1828 $(OUTPUT)/fuse_test: fuse_test.c common.c