Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Conflicting commits, all resolutions pretty trivial:

drivers/bus/mhi/pci_generic.c
5c2c85315948 ("bus: mhi: pci-generic: configurable network interface MRU")
56f6f4c4eb2a ("bus: mhi: pci_generic: Apply no-op for wake using sideband wake boolean")

drivers/nfc/s3fwrn5/firmware.c
a0302ff5906a ("nfc: s3fwrn5: remove unnecessary label")
46573e3ab08f ("nfc: s3fwrn5: fix undefined parameter values in dev_err()")
801e541c79bb ("nfc: s3fwrn5: fix undefined parameter values in dev_err()")

MAINTAINERS
7d901a1e878a ("net: phy: add Maxlinear GPY115/21x/24x driver")
8a7b46fa7902 ("MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+4470 -2569
+17 -7
Documentation/arm64/tagged-address-abi.rst
··· 45 45 46 46 1. User addresses not accessed by the kernel but used for address space 47 47 management (e.g. ``mprotect()``, ``madvise()``). The use of valid 48 - tagged pointers in this context is allowed with the exception of 49 - ``brk()``, ``mmap()`` and the ``new_address`` argument to 50 - ``mremap()`` as these have the potential to alias with existing 51 - user addresses. 48 + tagged pointers in this context is allowed with these exceptions: 52 49 53 - NOTE: This behaviour changed in v5.6 and so some earlier kernels may 54 - incorrectly accept valid tagged pointers for the ``brk()``, 55 - ``mmap()`` and ``mremap()`` system calls. 50 + - ``brk()``, ``mmap()`` and the ``new_address`` argument to 51 + ``mremap()`` as these have the potential to alias with existing 52 + user addresses. 53 + 54 + NOTE: This behaviour changed in v5.6 and so some earlier kernels may 55 + incorrectly accept valid tagged pointers for the ``brk()``, 56 + ``mmap()`` and ``mremap()`` system calls. 57 + 58 + - The ``range.start``, ``start`` and ``dst`` arguments to the 59 + ``UFFDIO_*`` ``ioctl()``s used on a file descriptor obtained from 60 + ``userfaultfd()``, as fault addresses subsequently obtained by reading 61 + the file descriptor will be untagged, which may otherwise confuse 62 + tag-unaware programs. 63 + 64 + NOTE: This behaviour changed in v5.14 and so some earlier kernels may 65 + incorrectly accept valid tagged pointers for this system call. 56 66 57 67 2. User addresses accessed by the kernel (e.g. ``write()``). This ABI 58 68 relaxation is disabled by default and the application thread needs to
+1 -1
Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
··· 114 114 115 115 ports: 116 116 $ref: /schemas/graph.yaml#/properties/ports 117 - properties: 117 + patternProperties: 118 118 port(@[0-9a-f]+)?: 119 119 $ref: audio-graph-port.yaml# 120 120 unevaluatedProperties: false
+1 -1
Documentation/trace/histogram.rst
··· 191 191 with the event, in nanoseconds. May be 192 192 modified by .usecs to have timestamps 193 193 interpreted as microseconds. 194 - cpu int the cpu on which the event occurred. 194 + common_cpu int the cpu on which the event occurred. 195 195 ====================== ==== ======================================= 196 196 197 197 Extended error information
+15 -15
Documentation/virt/kvm/api.rst
··· 855 855 use PPIs designated for specific cpus. The irq field is interpreted 856 856 like this:: 857 857 858 -  bits: | 31 ... 28 | 27 ... 24 | 23 ... 16 | 15 ... 0 | 858 + bits: | 31 ... 28 | 27 ... 24 | 23 ... 16 | 15 ... 0 | 859 859 field: | vcpu2_index | irq_type | vcpu_index | irq_id | 860 860 861 861 The irq_type field has the following values: ··· 2149 2149 Errors: 2150 2150 2151 2151 ====== ============================================================ 2152 -  ENOENT   no such register 2153 -  EINVAL   invalid register ID, or no such register or used with VMs in 2152 + ENOENT no such register 2153 + EINVAL invalid register ID, or no such register or used with VMs in 2154 2154 protected virtualization mode on s390 2155 -  EPERM    (arm64) register access not allowed before vcpu finalization 2155 + EPERM (arm64) register access not allowed before vcpu finalization 2156 2156 ====== ============================================================ 2157 2157 2158 2158 (These error codes are indicative only: do not rely on a specific error ··· 2590 2590 Errors include: 2591 2591 2592 2592 ======== ============================================================ 2593 -  ENOENT   no such register 2594 -  EINVAL   invalid register ID, or no such register or used with VMs in 2593 + ENOENT no such register 2594 + EINVAL invalid register ID, or no such register or used with VMs in 2595 2595 protected virtualization mode on s390 2596 -  EPERM    (arm64) register access not allowed before vcpu finalization 2596 + EPERM (arm64) register access not allowed before vcpu finalization 2597 2597 ======== ============================================================ 2598 2598 2599 2599 (These error codes are indicative only: do not rely on a specific error ··· 3112 3112 Errors: 3113 3113 3114 3114 ====== ================================================================= 3115 -  EINVAL    the target is unknown, or the combination of features is invalid. 3116 -  ENOENT    a features bit specified is unknown. 3115 + EINVAL the target is unknown, or the combination of features is invalid. 3116 + ENOENT a features bit specified is unknown. 3117 3117 ====== ================================================================= 3118 3118 3119 3119 This tells KVM what type of CPU to present to the guest, and what 3120 - optional features it should have.  This will cause a reset of the cpu 3121 - registers to their initial values.  If this is not called, KVM_RUN will 3120 + optional features it should have. This will cause a reset of the cpu 3121 + registers to their initial values. If this is not called, KVM_RUN will 3122 3122 return ENOEXEC for that vcpu. 3123 3123 3124 3124 The initial values are defined as: ··· 3239 3239 Errors: 3240 3240 3241 3241 ===== ============================================================== 3242 -  E2BIG     the reg index list is too big to fit in the array specified by 3243 -             the user (the number required will be written into n). 3242 + E2BIG the reg index list is too big to fit in the array specified by 3243 + the user (the number required will be written into n). 3244 3244 ===== ============================================================== 3245 3245 3246 3246 :: ··· 3288 3288 ARM/arm64 divides the id field into two parts, a device id and an 3289 3289 address type id specific to the individual device:: 3290 3290 3291 -  bits: | 63 ... 32 | 31 ... 16 | 15 ... 0 | 3291 + bits: | 63 ... 32 | 31 ... 16 | 15 ... 0 | 3292 3292 field: | 0x00000000 | device id | addr type id | 3293 3293 3294 3294 ARM/arm64 currently only require this when using the in-kernel GIC ··· 7049 7049 trap and emulate MSRs that are outside of the scope of KVM as well as 7050 7050 limit the attack surface on KVM's MSR emulation code. 7051 7051 7052 - 8.28 KVM_CAP_ENFORCE_PV_CPUID 7052 + 8.28 KVM_CAP_ENFORCE_PV_FEATURE_CPUID 7053 7053 ----------------------------- 7054 7054 7055 7055 Architectures: x86
+21 -5
MAINTAINERS
··· 445 445 F: include/uapi/linux/wmi.h 446 446 447 447 ACRN HYPERVISOR SERVICE MODULE 448 - M: Shuo Liu <shuo.a.liu@intel.com> 448 + M: Fei Li <fei1.li@intel.com> 449 449 L: acrn-dev@lists.projectacrn.org (subscribers-only) 450 450 S: Supported 451 451 W: https://projectacrn.org ··· 7859 7859 F: drivers/input/touchscreen/goodix.c 7860 7860 7861 7861 GOOGLE ETHERNET DRIVERS 7862 - M: Catherine Sullivan <csully@google.com> 7863 - R: Sagi Shahar <sagis@google.com> 7864 - R: Jon Olson <jonolson@google.com> 7862 + M: Jeroen de Borst <jeroendb@google.com> 7863 + R: Catherine Sullivan <csully@google.com> 7864 + R: David Awogbemila <awogbemila@google.com> 7865 7865 L: netdev@vger.kernel.org 7866 7866 S: Supported 7867 7867 F: Documentation/networking/device_drivers/ethernet/google/gve.rst ··· 11346 11346 L: netdev@vger.kernel.org 11347 11347 S: Supported 11348 11348 F: drivers/net/phy/mxl-gpy.c 11349 + 11350 + MCAB MICROCHIP CAN BUS ANALYZER TOOL DRIVER 11351 + R: Yasushi SHOJI <yashi@spacecubics.com> 11352 + L: linux-can@vger.kernel.org 11353 + S: Maintained 11354 + F: drivers/net/can/usb/mcba_usb.c 11349 11355 11350 11356 MCAN MMIO DEVICE DRIVER 11351 11357 M: Chandrasekar Ramakrishnan <rcsekar@samsung.com> ··· 15494 15488 L: amd-gfx@lists.freedesktop.org 15495 15489 S: Supported 15496 15490 T: git https://gitlab.freedesktop.org/agd5f/linux.git 15491 + B: https://gitlab.freedesktop.org/drm/amd/-/issues 15492 + C: irc://irc.oftc.net/radeon 15497 15493 F: drivers/gpu/drm/amd/ 15498 15494 F: drivers/gpu/drm/radeon/ 15499 15495 F: include/uapi/drm/amdgpu_drm.h ··· 19151 19143 L: linux-usb@vger.kernel.org 19152 19144 S: Maintained 19153 19145 F: Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml 19154 - F: drivers/phy/hisilicon/phy-kirin970-usb3.c 19146 + F: drivers/phy/hisilicon/phy-hi3670-usb3.c 19155 19147 19156 19148 USB ISP116X DRIVER 19157 19149 M: Olav Kongas <ok@artecdesign.ee> ··· 19828 19820 L: netdev@vger.kernel.org 19829 19821 S: Supported 19830 19822 F: drivers/ptp/ptp_vmw.c 19823 + 19824 + VMWARE VMCI DRIVER 19825 + M: Jorgen Hansen <jhansen@vmware.com> 19826 + M: Vishnu Dasa <vdasa@vmware.com> 19827 + L: linux-kernel@vger.kernel.org 19828 + L: pv-drivers@vmware.com (private) 19829 + S: Maintained 19830 + F: drivers/misc/vmw_vmci/ 19831 19831 19832 19832 VMWARE VMMOUSE SUBDRIVER 19833 19833 M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 14 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc2 5 + EXTRAVERSION = -rc3 6 6 NAME = Opossums on Parade 7 7 8 8 # *DOCUMENTATION*
+1 -2
arch/alpha/Kconfig
··· 14 14 select PCI_SYSCALL if PCI 15 15 select HAVE_AOUT 16 16 select HAVE_ASM_MODVERSIONS 17 - select HAVE_IDE 18 17 select HAVE_PCSPKR_PLATFORM 19 18 select HAVE_PERF_EVENTS 20 19 select NEED_DMA_MAP_STATE ··· 531 532 will run faster if you say N here. 532 533 533 534 See also the SMP-HOWTO available at 534 - <http://www.tldp.org/docs.html#howto>. 535 + <https://www.tldp.org/docs.html#howto>. 535 536 536 537 If you don't know what to do here, say N. 537 538
+1 -1
arch/alpha/boot/bootp.c
··· 23 23 #include "ksize.h" 24 24 25 25 extern unsigned long switch_to_osf_pal(unsigned long nr, 26 - struct pcb_struct * pcb_va, struct pcb_struct * pcb_pa, 26 + struct pcb_struct *pcb_va, struct pcb_struct *pcb_pa, 27 27 unsigned long *vptb); 28 28 29 29 extern void move_stack(unsigned long new_stack);
+1 -1
arch/alpha/boot/bootpz.c
··· 200 200 START_ADDR KSEG address of the entry point of kernel code. 201 201 202 202 ZERO_PGE KSEG address of page full of zeroes, but 203 - upon entry to kerne cvan be expected 203 + upon entry to kernel, it can be expected 204 204 to hold the parameter list and possible 205 205 INTRD information. 206 206
+1 -1
arch/alpha/boot/misc.c
··· 30 30 __attribute__ ((format (printf, 1, 2))); 31 31 32 32 /* 33 - * gzip delarations 33 + * gzip declarations 34 34 */ 35 35 #define OF(args) args 36 36 #define STATIC static
+1
arch/alpha/configs/defconfig
··· 70 70 CONFIG_ALPHA_LEGACY_START_ADDRESS=y 71 71 CONFIG_MATHEMU=y 72 72 CONFIG_CRYPTO_HMAC=y 73 + CONFIG_DEVTMPFS=y
-11
arch/alpha/include/asm/compiler.h
··· 4 4 5 5 #include <uapi/asm/compiler.h> 6 6 7 - /* Some idiots over in <linux/compiler.h> thought inline should imply 8 - always_inline. This breaks stuff. We'll include this file whenever 9 - we run into such problems. */ 10 - 11 - #include <linux/compiler.h> 12 - #undef inline 13 - #undef __inline__ 14 - #undef __inline 15 - #undef __always_inline 16 - #define __always_inline inline __attribute__((always_inline)) 17 - 18 7 #endif /* __ALPHA_COMPILER_H */
+6
arch/alpha/include/asm/syscall.h
··· 9 9 return AUDIT_ARCH_ALPHA; 10 10 } 11 11 12 + static inline long syscall_get_return_value(struct task_struct *task, 13 + struct pt_regs *regs) 14 + { 15 + return regs->r0; 16 + } 17 + 12 18 #endif /* _ASM_ALPHA_SYSCALL_H */
+2 -2
arch/alpha/kernel/osf_sys.c
··· 834 834 return -EFAULT; 835 835 state = &current_thread_info()->ieee_state; 836 836 837 - /* Update softare trap enable bits. */ 837 + /* Update software trap enable bits. */ 838 838 *state = (*state & ~IEEE_SW_MASK) | (swcr & IEEE_SW_MASK); 839 839 840 840 /* Update the real fpcr. */ ··· 854 854 state = &current_thread_info()->ieee_state; 855 855 exc &= IEEE_STATUS_MASK; 856 856 857 - /* Update softare trap enable bits. */ 857 + /* Update software trap enable bits. */ 858 858 swcr = (*state & IEEE_SW_MASK) | exc; 859 859 *state |= exc; 860 860
+1 -1
arch/alpha/kernel/perf_event.c
··· 574 574 * Check that CPU performance counters are supported. 575 575 * - currently support EV67 and later CPUs. 576 576 * - actually some later revisions of the EV6 have the same PMC model as the 577 - * EV67 but we don't do suffiently deep CPU detection to detect them. 577 + * EV67 but we don't do sufficiently deep CPU detection to detect them. 578 578 * Bad luck to the very few people who might have one, I guess. 579 579 */ 580 580 static int supported_cpu(void)
+1 -1
arch/alpha/kernel/process.c
··· 256 256 childstack->r26 = (unsigned long) ret_from_kernel_thread; 257 257 childstack->r9 = usp; /* function */ 258 258 childstack->r10 = kthread_arg; 259 - childregs->hae = alpha_mv.hae_cache, 259 + childregs->hae = alpha_mv.hae_cache; 260 260 childti->pcb.usp = 0; 261 261 return 0; 262 262 }
+7 -6
arch/alpha/kernel/setup.c
··· 319 319 i, cluster->usage, cluster->start_pfn, 320 320 cluster->start_pfn + cluster->numpages); 321 321 322 - /* Bit 0 is console/PALcode reserved. Bit 1 is 323 - non-volatile memory -- we might want to mark 324 - this for later. */ 325 - if (cluster->usage & 3) 326 - continue; 327 - 328 322 end = cluster->start_pfn + cluster->numpages; 329 323 if (end > max_low_pfn) 330 324 max_low_pfn = end; 331 325 332 326 memblock_add(PFN_PHYS(cluster->start_pfn), 333 327 cluster->numpages << PAGE_SHIFT); 328 + 329 + /* Bit 0 is console/PALcode reserved. Bit 1 is 330 + non-volatile memory -- we might want to mark 331 + this for later. */ 332 + if (cluster->usage & 3) 333 + memblock_reserve(PFN_PHYS(cluster->start_pfn), 334 + cluster->numpages << PAGE_SHIFT); 334 335 } 335 336 336 337 /*
+1 -1
arch/alpha/kernel/smp.c
··· 582 582 smp_send_stop(void) 583 583 { 584 584 cpumask_t to_whom; 585 - cpumask_copy(&to_whom, cpu_possible_mask); 585 + cpumask_copy(&to_whom, cpu_online_mask); 586 586 cpumask_clear_cpu(smp_processor_id(), &to_whom); 587 587 #ifdef DEBUG_IPI_MSG 588 588 if (hard_smp_processor_id() != boot_cpu_id)
+1 -1
arch/alpha/kernel/sys_nautilus.c
··· 212 212 213 213 /* Use default IO. */ 214 214 pci_add_resource(&bridge->windows, &ioport_resource); 215 - /* Irongate PCI memory aperture, calculate requred size before 215 + /* Irongate PCI memory aperture, calculate required size before 216 216 setting it up. */ 217 217 pci_add_resource(&bridge->windows, &irongate_mem); 218 218
+1 -1
arch/alpha/kernel/traps.c
··· 730 730 long error; 731 731 732 732 /* Check the UAC bits to decide what the user wants us to do 733 - with the unaliged access. */ 733 + with the unaligned access. */ 734 734 735 735 if (!(current_thread_info()->status & TS_UAC_NOPRINT)) { 736 736 if (__ratelimit(&ratelimit)) {
+6 -2
arch/alpha/math-emu/math.c
··· 65 65 long do_alpha_fp_emul_imprecise(struct pt_regs *, unsigned long); 66 66 long do_alpha_fp_emul(unsigned long); 67 67 68 - int init_module(void) 68 + static int alpha_fp_emul_init_module(void) 69 69 { 70 70 save_emul_imprecise = alpha_fp_emul_imprecise; 71 71 save_emul = alpha_fp_emul; ··· 73 73 alpha_fp_emul = do_alpha_fp_emul; 74 74 return 0; 75 75 } 76 + module_init(alpha_fp_emul_init_module); 76 77 77 - void cleanup_module(void) 78 + static void alpha_fp_emul_cleanup_module(void) 78 79 { 79 80 alpha_fp_emul_imprecise = save_emul_imprecise; 80 81 alpha_fp_emul = save_emul; 81 82 } 83 + module_exit(alpha_fp_emul_cleanup_module); 82 84 83 85 #undef alpha_fp_emul_imprecise 84 86 #define alpha_fp_emul_imprecise do_alpha_fp_emul_imprecise ··· 403 401 egress: 404 402 return si_code; 405 403 } 404 + 405 + EXPORT_SYMBOL(__udiv_qrnnd);
-6
arch/arm/Kconfig
··· 95 95 select HAVE_FUNCTION_TRACER if !XIP_KERNEL 96 96 select HAVE_GCC_PLUGINS 97 97 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7) 98 - select HAVE_IDE if PCI || ISA || PCMCIA 99 98 select HAVE_IRQ_TIME_ACCOUNTING 100 99 select HAVE_KERNEL_GZIP 101 100 select HAVE_KERNEL_LZ4 ··· 360 361 bool "FootBridge" 361 362 select CPU_SA110 362 363 select FOOTBRIDGE 363 - select HAVE_IDE 364 364 select NEED_MACH_IO_H if !MMU 365 365 select NEED_MACH_MEMORY_H 366 366 help ··· 428 430 select GENERIC_IRQ_MULTI_HANDLER 429 431 select GPIO_PXA 430 432 select GPIOLIB 431 - select HAVE_IDE 432 433 select IRQ_DOMAIN 433 434 select PLAT_PXA 434 435 select SPARSE_IRQ ··· 443 446 select ARM_HAS_SG_CHAIN 444 447 select CPU_SA110 445 448 select FIQ 446 - select HAVE_IDE 447 449 select HAVE_PATA_PLATFORM 448 450 select ISA_DMA_API 449 451 select LEGACY_TIMER_TICK ··· 465 469 select CPU_SA1100 466 470 select GENERIC_IRQ_MULTI_HANDLER 467 471 select GPIOLIB 468 - select HAVE_IDE 469 472 select IRQ_DOMAIN 470 473 select ISA 471 474 select NEED_MACH_MEMORY_H ··· 500 505 select GENERIC_IRQ_CHIP 501 506 select GENERIC_IRQ_MULTI_HANDLER 502 507 select GPIOLIB 503 - select HAVE_IDE 504 508 select HAVE_LEGACY_CLK 505 509 select IRQ_DOMAIN 506 510 select NEED_MACH_IO_H if PCCARD
-1
arch/arm/mach-davinci/Kconfig
··· 9 9 select PM_GENERIC_DOMAINS_OF if PM && OF 10 10 select REGMAP_MMIO 11 11 select RESET_CONTROLLER 12 - select HAVE_IDE 13 12 select PINCTRL_SINGLE 14 13 15 14 if ARCH_DAVINCI
+1
arch/arm/mach-rpc/riscpc.c
··· 49 49 fallthrough; /* ??? */ 50 50 case 256: 51 51 vram_size += PAGE_SIZE * 256; 52 + break; 52 53 default: 53 54 break; 54 55 }
+3
arch/arm/net/bpf_jit_32.c
··· 1602 1602 rn = arm_bpf_get_reg32(src_lo, tmp2[1], ctx); 1603 1603 emit_ldx_r(dst, rn, off, ctx, BPF_SIZE(code)); 1604 1604 break; 1605 + /* speculation barrier */ 1606 + case BPF_ST | BPF_NOSPEC: 1607 + break; 1605 1608 /* ST: *(size *)(dst + off) = imm */ 1606 1609 case BPF_ST | BPF_MEM | BPF_W: 1607 1610 case BPF_ST | BPF_MEM | BPF_H:
+2 -2
arch/arm64/boot/dts/freescale/imx8mp.dtsi
··· 579 579 }; 580 580 581 581 flexcan1: can@308c0000 { 582 - compatible = "fsl,imx8mp-flexcan", "fsl,imx6q-flexcan"; 582 + compatible = "fsl,imx8mp-flexcan"; 583 583 reg = <0x308c0000 0x10000>; 584 584 interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>; 585 585 clocks = <&clk IMX8MP_CLK_IPG_ROOT>, ··· 594 594 }; 595 595 596 596 flexcan2: can@308d0000 { 597 - compatible = "fsl,imx8mp-flexcan", "fsl,imx6q-flexcan"; 597 + compatible = "fsl,imx8mp-flexcan"; 598 598 reg = <0x308d0000 0x10000>; 599 599 interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>; 600 600 clocks = <&clk IMX8MP_CLK_IPG_ROOT>,
+2 -2
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
··· 1063 1063 status = "okay"; 1064 1064 extcon = <&usb2_id>; 1065 1065 1066 - usb@7600000 { 1066 + dwc3@7600000 { 1067 1067 extcon = <&usb2_id>; 1068 1068 dr_mode = "otg"; 1069 1069 maximum-speed = "high-speed"; ··· 1074 1074 status = "okay"; 1075 1075 extcon = <&usb3_id>; 1076 1076 1077 - usb@6a00000 { 1077 + dwc3@6a00000 { 1078 1078 extcon = <&usb3_id>; 1079 1079 dr_mode = "otg"; 1080 1080 };
+2 -2
arch/arm64/boot/dts/qcom/ipq8074.dtsi
··· 443 443 resets = <&gcc GCC_USB0_BCR>; 444 444 status = "disabled"; 445 445 446 - dwc_0: usb@8a00000 { 446 + dwc_0: dwc3@8a00000 { 447 447 compatible = "snps,dwc3"; 448 448 reg = <0x8a00000 0xcd00>; 449 449 interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; ··· 484 484 resets = <&gcc GCC_USB1_BCR>; 485 485 status = "disabled"; 486 486 487 - dwc_1: usb@8c00000 { 487 + dwc_1: dwc3@8c00000 { 488 488 compatible = "snps,dwc3"; 489 489 reg = <0x8c00000 0xcd00>; 490 490 interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
+2 -2
arch/arm64/boot/dts/qcom/msm8996.dtsi
··· 2566 2566 power-domains = <&gcc USB30_GDSC>; 2567 2567 status = "disabled"; 2568 2568 2569 - usb@6a00000 { 2569 + dwc3@6a00000 { 2570 2570 compatible = "snps,dwc3"; 2571 2571 reg = <0x06a00000 0xcc00>; 2572 2572 interrupts = <0 131 IRQ_TYPE_LEVEL_HIGH>; ··· 2873 2873 qcom,select-utmi-as-pipe-clk; 2874 2874 status = "disabled"; 2875 2875 2876 - usb@7600000 { 2876 + dwc3@7600000 { 2877 2877 compatible = "snps,dwc3"; 2878 2878 reg = <0x07600000 0xcc00>; 2879 2879 interrupts = <0 138 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/msm8998.dtsi
··· 1964 1964 1965 1965 resets = <&gcc GCC_USB_30_BCR>; 1966 1966 1967 - usb3_dwc3: usb@a800000 { 1967 + usb3_dwc3: dwc3@a800000 { 1968 1968 compatible = "snps,dwc3"; 1969 1969 reg = <0x0a800000 0xcd00>; 1970 1970 interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
··· 337 337 &usb3 { 338 338 status = "okay"; 339 339 340 - usb@7580000 { 340 + dwc3@7580000 { 341 341 dr_mode = "host"; 342 342 }; 343 343 };
+2 -2
arch/arm64/boot/dts/qcom/qcs404.dtsi
··· 544 544 assigned-clock-rates = <19200000>, <200000000>; 545 545 status = "disabled"; 546 546 547 - usb@7580000 { 547 + dwc3@7580000 { 548 548 compatible = "snps,dwc3"; 549 549 reg = <0x07580000 0xcd00>; 550 550 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; ··· 573 573 assigned-clock-rates = <19200000>, <133333333>; 574 574 status = "disabled"; 575 575 576 - usb@78c0000 { 576 + dwc3@78c0000 { 577 577 compatible = "snps,dwc3"; 578 578 reg = <0x078c0000 0xcc00>; 579 579 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/sc7180.dtsi
··· 2761 2761 <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3 0>; 2762 2762 interconnect-names = "usb-ddr", "apps-usb"; 2763 2763 2764 - usb_1_dwc3: usb@a600000 { 2764 + usb_1_dwc3: dwc3@a600000 { 2765 2765 compatible = "snps,dwc3"; 2766 2766 reg = <0 0x0a600000 0 0xe000>; 2767 2767 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+2 -2
arch/arm64/boot/dts/qcom/sdm845.dtsi
··· 3781 3781 <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_0 0>; 3782 3782 interconnect-names = "usb-ddr", "apps-usb"; 3783 3783 3784 - usb_1_dwc3: usb@a600000 { 3784 + usb_1_dwc3: dwc3@a600000 { 3785 3785 compatible = "snps,dwc3"; 3786 3786 reg = <0 0x0a600000 0 0xcd00>; 3787 3787 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>; ··· 3829 3829 <&gladiator_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_USB3_1 0>; 3830 3830 interconnect-names = "usb-ddr", "apps-usb"; 3831 3831 3832 - usb_2_dwc3: usb@a800000 { 3832 + usb_2_dwc3: dwc3@a800000 { 3833 3833 compatible = "snps,dwc3"; 3834 3834 reg = <0 0x0a800000 0 0xcd00>; 3835 3835 interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/boot/dts/qcom/sm8150.dtsi
··· 2344 2344 2345 2345 resets = <&gcc GCC_USB30_PRIM_BCR>; 2346 2346 2347 - usb_1_dwc3: usb@a600000 { 2347 + usb_1_dwc3: dwc3@a600000 { 2348 2348 compatible = "snps,dwc3"; 2349 2349 reg = <0 0x0a600000 0 0xcd00>; 2350 2350 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm64/kvm/mmu.c
··· 947 947 vma_shift = get_vma_page_shift(vma, hva); 948 948 } 949 949 950 - shared = (vma->vm_flags & VM_PFNMAP); 950 + shared = (vma->vm_flags & VM_SHARED); 951 951 952 952 switch (vma_shift) { 953 953 #ifndef __PAGETABLE_PMD_FOLDED
+13
arch/arm64/net/bpf_jit_comp.c
··· 823 823 return ret; 824 824 break; 825 825 826 + /* speculation barrier */ 827 + case BPF_ST | BPF_NOSPEC: 828 + /* 829 + * Nothing required here. 830 + * 831 + * In case of arm64, we rely on the firmware mitigation of 832 + * Speculative Store Bypass as controlled via the ssbd kernel 833 + * parameter. Whenever the mitigation is enabled, it works 834 + * for all of the kernel code with no need to provide any 835 + * additional instructions. 836 + */ 837 + break; 838 + 826 839 /* ST: *(size *)(dst + off) = imm */ 827 840 case BPF_ST | BPF_MEM | BPF_W: 828 841 case BPF_ST | BPF_MEM | BPF_H:
-1
arch/h8300/Kconfig.cpu
··· 44 44 bool "H8MAX" 45 45 select H83069 46 46 select RAMKERNEL 47 - select HAVE_IDE 48 47 help 49 48 H8MAX Evaluation Board Support 50 49 More Information. (Japanese Only)
-1
arch/ia64/Kconfig
··· 25 25 select HAVE_ASM_MODVERSIONS 26 26 select HAVE_UNSTABLE_SCHED_CLOCK 27 27 select HAVE_EXIT_THREAD 28 - select HAVE_IDE 29 28 select HAVE_KPROBES 30 29 select HAVE_KRETPROBES 31 30 select HAVE_FTRACE_MCOUNT_RECORD
-1
arch/m68k/Kconfig
··· 23 23 select HAVE_DEBUG_BUGVERBOSE 24 24 select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_HAS_NO_UNALIGNED 25 25 select HAVE_FUTEX_CMPXCHG if MMU && FUTEX 26 - select HAVE_IDE 27 26 select HAVE_MOD_ARCH_SPECIFIC 28 27 select HAVE_UID16 29 28 select MMU_GATHER_NO_RANGE if MMU
+1
arch/m68k/Kconfig.machine
··· 33 33 depends on MMU 34 34 select MMU_MOTOROLA if MMU 35 35 select HAVE_ARCH_NVRAM_OPS 36 + select HAVE_PATA_PLATFORM 36 37 select LEGACY_TIMER_TICK 37 38 help 38 39 This option enables support for the Apple Macintosh series of
+1 -1
arch/m68k/coldfire/m525x.c
··· 26 26 DEFINE_CLK(sys, "sys.0", MCF_BUSCLK); 27 27 28 28 static struct clk_lookup m525x_clk_lookup[] = { 29 - CLKDEV_INIT(NULL, "pll.0", &pll), 29 + CLKDEV_INIT(NULL, "pll.0", &clk_pll), 30 30 CLKDEV_INIT(NULL, "sys.0", &clk_sys), 31 31 CLKDEV_INIT("mcftmr.0", NULL, &clk_sys), 32 32 CLKDEV_INIT("mcftmr.1", NULL, &clk_sys),
-1
arch/mips/Kconfig
··· 71 71 select HAVE_FUNCTION_TRACER 72 72 select HAVE_GCC_PLUGINS 73 73 select HAVE_GENERIC_VDSO 74 - select HAVE_IDE 75 74 select HAVE_IOREMAP_PROT 76 75 select HAVE_IRQ_EXIT_ON_IRQ_STACK 77 76 select HAVE_IRQ_TIME_ACCOUNTING
+3
arch/mips/net/ebpf_jit.c
··· 1355 1355 } 1356 1356 break; 1357 1357 1358 + case BPF_ST | BPF_NOSPEC: /* speculation barrier */ 1359 + break; 1360 + 1358 1361 case BPF_ST | BPF_B | BPF_MEM: 1359 1362 case BPF_ST | BPF_H | BPF_MEM: 1360 1363 case BPF_ST | BPF_W | BPF_MEM:
+1 -1
arch/nds32/mm/mmap.c
··· 59 59 60 60 vma = find_vma(mm, addr); 61 61 if (TASK_SIZE - len >= addr && 62 - (!vma || addr + len <= vma->vm_start)) 62 + (!vma || addr + len <= vm_start_gap(vma))) 63 63 return addr; 64 64 } 65 65
-1
arch/parisc/Kconfig
··· 3 3 def_bool y 4 4 select ARCH_32BIT_OFF_T if !64BIT 5 5 select ARCH_MIGHT_HAVE_PC_PARPORT 6 - select HAVE_IDE 7 6 select HAVE_FUNCTION_TRACER 8 7 select HAVE_FUNCTION_GRAPH_TRACER 9 8 select HAVE_SYSCALL_TRACEPOINTS
-1
arch/powerpc/Kconfig
··· 220 220 select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP 221 221 select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH 222 222 select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx) 223 - select HAVE_IDE 224 223 select HAVE_IOREMAP_PROT 225 224 select HAVE_IRQ_EXIT_ON_IRQ_STACK 226 225 select HAVE_IRQ_TIME_ACCOUNTING
+2
arch/powerpc/kvm/book3s_hv.c
··· 2697 2697 HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX; 2698 2698 if (cpu_has_feature(CPU_FTR_HVMODE)) { 2699 2699 vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); 2700 + #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 2700 2701 if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) 2701 2702 vcpu->arch.hfscr |= HFSCR_TM; 2703 + #endif 2702 2704 } 2703 2705 if (cpu_has_feature(CPU_FTR_TM_COMP)) 2704 2706 vcpu->arch.hfscr |= HFSCR_TM;
+20
arch/powerpc/kvm/book3s_hv_nested.c
··· 302 302 if (vcpu->kvm->arch.l1_ptcr == 0) 303 303 return H_NOT_AVAILABLE; 304 304 305 + if (MSR_TM_TRANSACTIONAL(vcpu->arch.shregs.msr)) 306 + return H_BAD_MODE; 307 + 305 308 /* copy parameters in */ 306 309 hv_ptr = kvmppc_get_gpr(vcpu, 4); 307 310 regs_ptr = kvmppc_get_gpr(vcpu, 5); ··· 324 321 byteswap_pt_regs(&l2_regs); 325 322 if (l2_hv.vcpu_token >= NR_CPUS) 326 323 return H_PARAMETER; 324 + 325 + /* 326 + * L1 must have set up a suspended state to enter the L2 in a 327 + * transactional state, and only in that case. These have to be 328 + * filtered out here to prevent causing a TM Bad Thing in the 329 + * host HRFID. We could synthesize a TM Bad Thing back to the L1 330 + * here but there doesn't seem like much point. 331 + */ 332 + if (MSR_TM_SUSPENDED(vcpu->arch.shregs.msr)) { 333 + if (!MSR_TM_ACTIVE(l2_regs.msr)) 334 + return H_BAD_MODE; 335 + } else { 336 + if (l2_regs.msr & MSR_TS_MASK) 337 + return H_BAD_MODE; 338 + if (WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_TS_MASK)) 339 + return H_BAD_MODE; 340 + } 327 341 328 342 /* translate lpid */ 329 343 l2 = kvmhv_get_nested(vcpu->kvm, l2_hv.lpid, true);
+22 -3
arch/powerpc/kvm/book3s_hv_p9_entry.c
··· 317 317 */ 318 318 mtspr(SPRN_HDEC, hdec); 319 319 320 + #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 321 + tm_return_to_guest: 322 + #endif 320 323 mtspr(SPRN_DAR, vcpu->arch.shregs.dar); 321 324 mtspr(SPRN_DSISR, vcpu->arch.shregs.dsisr); 322 325 mtspr(SPRN_SRR0, vcpu->arch.shregs.srr0); ··· 418 415 * is in real suspend mode and is trying to transition to 419 416 * transactional mode. 420 417 */ 421 - if (local_paca->kvm_hstate.fake_suspend && 418 + if (!local_paca->kvm_hstate.fake_suspend && 422 419 (vcpu->arch.shregs.msr & MSR_TS_S)) { 423 420 if (kvmhv_p9_tm_emulation_early(vcpu)) { 424 - /* Prevent it being handled again. */ 425 - trap = 0; 421 + /* 422 + * Go straight back into the guest with the 423 + * new NIP/MSR as set by TM emulation. 424 + */ 425 + mtspr(SPRN_HSRR0, vcpu->arch.regs.nip); 426 + mtspr(SPRN_HSRR1, vcpu->arch.shregs.msr); 427 + 428 + /* 429 + * tm_return_to_guest re-loads SRR0/1, DAR, 430 + * DSISR after RI is cleared, in case they had 431 + * been clobbered by a MCE. 432 + */ 433 + __mtmsrd(0, 1); /* clear RI */ 434 + goto tm_return_to_guest; 426 435 } 427 436 } 428 437 #endif ··· 514 499 * If we are in real mode, only switch MMU on after the MMU is 515 500 * switched to host, to avoid the P9_RADIX_PREFETCH_BUG. 516 501 */ 502 + if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) && 503 + vcpu->arch.shregs.msr & MSR_TS_MASK) 504 + msr |= MSR_TS_S; 505 + 517 506 __mtmsrd(msr, 0); 518 507 519 508 end_timing(vcpu);
+22 -3
arch/powerpc/kvm/book3s_rtas.c
··· 242 242 * value so we can restore it on the way out. 243 243 */ 244 244 orig_rets = args.rets; 245 + if (be32_to_cpu(args.nargs) >= ARRAY_SIZE(args.args)) { 246 + /* 247 + * Don't overflow our args array: ensure there is room for 248 + * at least rets[0] (even if the call specifies 0 nret). 249 + * 250 + * Each handler must then check for the correct nargs and nret 251 + * values, but they may always return failure in rets[0]. 252 + */ 253 + rc = -EINVAL; 254 + goto fail; 255 + } 245 256 args.rets = &args.args[be32_to_cpu(args.nargs)]; 246 257 247 258 mutex_lock(&vcpu->kvm->arch.rtas_token_lock); ··· 280 269 fail: 281 270 /* 282 271 * We only get here if the guest has called RTAS with a bogus 283 - * args pointer. That means we can't get to the args, and so we 284 - * can't fail the RTAS call. So fail right out to userspace, 285 - * which should kill the guest. 272 + * args pointer or nargs/nret values that would overflow the 273 + * array. That means we can't get to the args, and so we can't 274 + * fail the RTAS call. So fail right out to userspace, which 275 + * should kill the guest. 276 + * 277 + * SLOF should actually pass the hcall return value from the 278 + * rtas handler call in r3, so enter_rtas could be modified to 279 + * return a failure indication in r3 and we could return such 280 + * errors to the guest rather than failing to host userspace. 281 + * However old guests that don't test for failure could then 282 + * continue silently after errors, so for now we won't do this. 286 283 */ 287 284 return rc; 288 285 }
+2 -2
arch/powerpc/kvm/powerpc.c
··· 2048 2048 { 2049 2049 struct kvm_enable_cap cap; 2050 2050 r = -EFAULT; 2051 - vcpu_load(vcpu); 2052 2051 if (copy_from_user(&cap, argp, sizeof(cap))) 2053 2052 goto out; 2053 + vcpu_load(vcpu); 2054 2054 r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); 2055 2055 vcpu_put(vcpu); 2056 2056 break; ··· 2074 2074 case KVM_DIRTY_TLB: { 2075 2075 struct kvm_dirty_tlb dirty; 2076 2076 r = -EFAULT; 2077 - vcpu_load(vcpu); 2078 2077 if (copy_from_user(&dirty, argp, sizeof(dirty))) 2079 2078 goto out; 2079 + vcpu_load(vcpu); 2080 2080 r = kvm_vcpu_ioctl_dirty_tlb(vcpu, &dirty); 2081 2081 vcpu_put(vcpu); 2082 2082 break;
+6
arch/powerpc/net/bpf_jit_comp32.c
··· 738 738 break; 739 739 740 740 /* 741 + * BPF_ST NOSPEC (speculation barrier) 742 + */ 743 + case BPF_ST | BPF_NOSPEC: 744 + break; 745 + 746 + /* 741 747 * BPF_ST(X) 742 748 */ 743 749 case BPF_STX | BPF_MEM | BPF_B: /* *(u8 *)(dst + off) = src */
+6
arch/powerpc/net/bpf_jit_comp64.c
··· 628 628 break; 629 629 630 630 /* 631 + * BPF_ST NOSPEC (speculation barrier) 632 + */ 633 + case BPF_ST | BPF_NOSPEC: 634 + break; 635 + 636 + /* 631 637 * BPF_ST(X) 632 638 */ 633 639 case BPF_STX | BPF_MEM | BPF_B: /* *(u8 *)(dst + off) = src */
+1
arch/powerpc/platforms/pasemi/idle.c
··· 42 42 switch (regs->msr & SRR1_WAKEMASK) { 43 43 case SRR1_WAKEDEC: 44 44 set_dec(1); 45 + break; 45 46 case SRR1_WAKEEE: 46 47 /* 47 48 * Handle these when interrupts get re-enabled and we take
+2 -2
arch/riscv/include/asm/efi.h
··· 27 27 28 28 #define ARCH_EFI_IRQ_FLAGS_MASK (SR_IE | SR_SPIE) 29 29 30 - /* Load initrd at enough distance from DRAM start */ 30 + /* Load initrd anywhere in system RAM */ 31 31 static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr) 32 32 { 33 - return image_addr + SZ_256M; 33 + return ULONG_MAX; 34 34 } 35 35 36 36 #define alloc_screen_info(x...) (&screen_info)
+5 -1
arch/riscv/kernel/stacktrace.c
··· 132 132 { 133 133 unsigned long pc = 0; 134 134 135 - if (likely(task && task != current && !task_is_running(task))) 135 + if (likely(task && task != current && !task_is_running(task))) { 136 + if (!try_get_task_stack(task)) 137 + return 0; 136 138 walk_stackframe(task, NULL, save_wchan, &pc); 139 + put_task_stack(task); 140 + } 137 141 return pc; 138 142 } 139 143
+13 -14
arch/riscv/lib/uaccess.S
··· 30 30 * t0 - end of uncopied dst 31 31 */ 32 32 add t0, a0, a2 33 - bgtu a0, t0, 5f 34 33 35 34 /* 36 35 * Use byte copy only if too small. 36 + * SZREG holds 4 for RV32 and 8 for RV64 37 37 */ 38 - li a3, 8*SZREG /* size must be larger than size in word_copy */ 38 + li a3, 9*SZREG /* size must be larger than size in word_copy */ 39 39 bltu a2, a3, .Lbyte_copy_tail 40 40 41 41 /* 42 - * Copy first bytes until dst is align to word boundary. 42 + * Copy first bytes until dst is aligned to word boundary. 43 43 * a0 - start of dst 44 44 * t1 - start of aligned dst 45 45 */ 46 46 addi t1, a0, SZREG-1 47 47 andi t1, t1, ~(SZREG-1) 48 48 /* dst is already aligned, skip */ 49 - beq a0, t1, .Lskip_first_bytes 49 + beq a0, t1, .Lskip_align_dst 50 50 1: 51 51 /* a5 - one byte for copying data */ 52 52 fixup lb a5, 0(a1), 10f ··· 55 55 addi a0, a0, 1 /* dst */ 56 56 bltu a0, t1, 1b /* t1 - start of aligned dst */ 57 57 58 - .Lskip_first_bytes: 58 + .Lskip_align_dst: 59 59 /* 60 60 * Now dst is aligned. 61 61 * Use shift-copy if src is misaligned. ··· 72 72 * 73 73 * a0 - start of aligned dst 74 74 * a1 - start of aligned src 75 - * a3 - a1 & mask:(SZREG-1) 76 75 * t0 - end of aligned dst 77 76 */ 78 - addi t0, t0, -(8*SZREG-1) /* not to over run */ 77 + addi t0, t0, -(8*SZREG) /* not to over run */ 79 78 2: 80 79 fixup REG_L a4, 0(a1), 10f 81 80 fixup REG_L a5, SZREG(a1), 10f ··· 96 97 addi a1, a1, 8*SZREG 97 98 bltu a0, t0, 2b 98 99 99 - addi t0, t0, 8*SZREG-1 /* revert to original value */ 100 + addi t0, t0, 8*SZREG /* revert to original value */ 100 101 j .Lbyte_copy_tail 101 102 102 103 .Lshift_copy: ··· 106 107 * For misaligned copy we still perform aligned word copy, but 107 108 * we need to use the value fetched from the previous iteration and 108 109 * do some shifts. 109 - * This is safe because reading less than a word size. 110 + * This is safe because reading is less than a word size. 110 111 * 111 112 * a0 - start of aligned dst 112 113 * a1 - start of src ··· 116 117 */ 117 118 /* calculating aligned word boundary for dst */ 118 119 andi t1, t0, ~(SZREG-1) 119 - /* Converting unaligned src to aligned arc */ 120 + /* Converting unaligned src to aligned src */ 120 121 andi a1, a1, ~(SZREG-1) 121 122 122 123 /* ··· 124 125 * t3 - prev shift 125 126 * t4 - current shift 126 127 */ 127 - slli t3, a3, LGREG 128 + slli t3, a3, 3 /* converting bytes in a3 to bits */ 128 129 li a5, SZREG*8 129 130 sub t4, a5, t3 130 131 131 - /* Load the first word to combine with seceond word */ 132 + /* Load the first word to combine with second word */ 132 133 fixup REG_L a5, 0(a1), 10f 133 134 134 135 3: ··· 160 161 * a1 - start of remaining src 161 162 * t0 - end of remaining dst 162 163 */ 163 - bgeu a0, t0, 5f 164 + bgeu a0, t0, .Lout_copy_user /* check if end of copy */ 164 165 4: 165 166 fixup lb a5, 0(a1), 10f 166 167 addi a1, a1, 1 /* src */ ··· 168 169 addi a0, a0, 1 /* dst */ 169 170 bltu a0, t0, 4b /* t0 - end of dst */ 170 171 171 - 5: 172 + .Lout_copy_user: 172 173 /* Disable access to user memory */ 173 174 csrc CSR_STATUS, t6 174 175 li a0, 0
+28 -4
arch/riscv/mm/init.c
··· 127 127 } 128 128 129 129 /* 130 - * The default maximal physical memory size is -PAGE_OFFSET, 131 - * limit the memory size via mem. 130 + * The default maximal physical memory size is -PAGE_OFFSET for 32-bit kernel, 131 + * whereas for 64-bit kernel, the end of the virtual address space is occupied 132 + * by the modules/BPF/kernel mappings which reduces the available size of the 133 + * linear mapping. 134 + * Limit the memory size via mem. 132 135 */ 136 + #ifdef CONFIG_64BIT 137 + static phys_addr_t memory_limit = -PAGE_OFFSET - SZ_4G; 138 + #else 133 139 static phys_addr_t memory_limit = -PAGE_OFFSET; 140 + #endif 134 141 135 142 static int __init early_mem(char *p) 136 143 { ··· 159 152 { 160 153 phys_addr_t vmlinux_end = __pa_symbol(&_end); 161 154 phys_addr_t vmlinux_start = __pa_symbol(&_start); 162 - phys_addr_t max_mapped_addr = __pa(~(ulong)0); 155 + phys_addr_t __maybe_unused max_mapped_addr; 163 156 phys_addr_t dram_end; 164 157 165 158 #ifdef CONFIG_XIP_KERNEL ··· 182 175 memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); 183 176 184 177 dram_end = memblock_end_of_DRAM(); 178 + 179 + #ifndef CONFIG_64BIT 185 180 /* 186 181 * memblock allocator is not aware of the fact that last 4K bytes of 187 182 * the addressable memory can not be mapped because of IS_ERR_VALUE 188 183 * macro. Make sure that last 4k bytes are not usable by memblock 189 - * if end of dram is equal to maximum addressable memory. 184 + * if end of dram is equal to maximum addressable memory. For 64-bit 185 + * kernel, this problem can't happen here as the end of the virtual 186 + * address space is occupied by the kernel mapping then this check must 187 + * be done in create_kernel_page_table. 190 188 */ 189 + max_mapped_addr = __pa(~(ulong)0); 191 190 if (max_mapped_addr == (dram_end - 1)) 192 191 memblock_set_current_limit(max_mapped_addr - 4096); 192 + #endif 193 193 194 194 min_low_pfn = PFN_UP(memblock_start_of_DRAM()); 195 195 max_low_pfn = max_pfn = PFN_DOWN(dram_end); ··· 584 570 BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0); 585 571 BUG_ON((kernel_map.phys_addr % map_size) != 0); 586 572 573 + #ifdef CONFIG_64BIT 574 + /* 575 + * The last 4K bytes of the addressable memory can not be mapped because 576 + * of IS_ERR_VALUE macro. 577 + */ 578 + BUG_ON((kernel_map.virt_addr + kernel_map.size) > ADDRESS_SPACE_END - SZ_4K); 579 + #endif 580 + 587 581 pt_ops.alloc_pte = alloc_pte_early; 588 582 pt_ops.get_pte_virt = get_pte_virt_early; 589 583 #ifndef __PAGETABLE_PMD_FOLDED ··· 731 709 if (start <= __pa(PAGE_OFFSET) && 732 710 __pa(PAGE_OFFSET) < end) 733 711 start = __pa(PAGE_OFFSET); 712 + if (end >= __pa(PAGE_OFFSET) + memory_limit) 713 + end = __pa(PAGE_OFFSET) + memory_limit; 734 714 735 715 map_size = best_map_size(start, end - start); 736 716 for (pa = start; pa < end; pa += map_size) {
+4
arch/riscv/net/bpf_jit_comp32.c
··· 1251 1251 return -1; 1252 1252 break; 1253 1253 1254 + /* speculation barrier */ 1255 + case BPF_ST | BPF_NOSPEC: 1256 + break; 1257 + 1254 1258 case BPF_ST | BPF_MEM | BPF_B: 1255 1259 case BPF_ST | BPF_MEM | BPF_H: 1256 1260 case BPF_ST | BPF_MEM | BPF_W:
+4
arch/riscv/net/bpf_jit_comp64.c
··· 939 939 emit_ld(rd, 0, RV_REG_T1, ctx); 940 940 break; 941 941 942 + /* speculation barrier */ 943 + case BPF_ST | BPF_NOSPEC: 944 + break; 945 + 942 946 /* ST: *(size *)(dst + off) = imm */ 943 947 case BPF_ST | BPF_MEM | BPF_B: 944 948 emit_imm(RV_REG_T1, imm, ctx);
+9 -9
arch/s390/include/asm/kvm_host.h
··· 445 445 u64 instruction_sigp_init_cpu_reset; 446 446 u64 instruction_sigp_cpu_reset; 447 447 u64 instruction_sigp_unknown; 448 - u64 diagnose_10; 449 - u64 diagnose_44; 450 - u64 diagnose_9c; 451 - u64 diagnose_9c_ignored; 452 - u64 diagnose_9c_forward; 453 - u64 diagnose_258; 454 - u64 diagnose_308; 455 - u64 diagnose_500; 456 - u64 diagnose_other; 448 + u64 instruction_diagnose_10; 449 + u64 instruction_diagnose_44; 450 + u64 instruction_diagnose_9c; 451 + u64 diag_9c_ignored; 452 + u64 diag_9c_forward; 453 + u64 instruction_diagnose_258; 454 + u64 instruction_diagnose_308; 455 + u64 instruction_diagnose_500; 456 + u64 instruction_diagnose_other; 457 457 u64 pfault_sync; 458 458 }; 459 459
+9 -9
arch/s390/kvm/diag.c
··· 24 24 25 25 start = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4]; 26 26 end = vcpu->run->s.regs.gprs[vcpu->arch.sie_block->ipa & 0xf] + PAGE_SIZE; 27 - vcpu->stat.diagnose_10++; 27 + vcpu->stat.instruction_diagnose_10++; 28 28 29 29 if (start & ~PAGE_MASK || end & ~PAGE_MASK || start >= end 30 30 || start < 2 * PAGE_SIZE) ··· 74 74 75 75 VCPU_EVENT(vcpu, 3, "diag page reference parameter block at 0x%llx", 76 76 vcpu->run->s.regs.gprs[rx]); 77 - vcpu->stat.diagnose_258++; 77 + vcpu->stat.instruction_diagnose_258++; 78 78 if (vcpu->run->s.regs.gprs[rx] & 7) 79 79 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 80 80 rc = read_guest(vcpu, vcpu->run->s.regs.gprs[rx], rx, &parm, sizeof(parm)); ··· 145 145 static int __diag_time_slice_end(struct kvm_vcpu *vcpu) 146 146 { 147 147 VCPU_EVENT(vcpu, 5, "%s", "diag time slice end"); 148 - vcpu->stat.diagnose_44++; 148 + vcpu->stat.instruction_diagnose_44++; 149 149 kvm_vcpu_on_spin(vcpu, true); 150 150 return 0; 151 151 } ··· 169 169 int tid; 170 170 171 171 tid = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4]; 172 - vcpu->stat.diagnose_9c++; 172 + vcpu->stat.instruction_diagnose_9c++; 173 173 174 174 /* yield to self */ 175 175 if (tid == vcpu->vcpu_id) ··· 192 192 VCPU_EVENT(vcpu, 5, 193 193 "diag time slice end directed to %d: yield forwarded", 194 194 tid); 195 - vcpu->stat.diagnose_9c_forward++; 195 + vcpu->stat.diag_9c_forward++; 196 196 return 0; 197 197 } 198 198 ··· 203 203 return 0; 204 204 no_yield: 205 205 VCPU_EVENT(vcpu, 5, "diag time slice end directed to %d: ignored", tid); 206 - vcpu->stat.diagnose_9c_ignored++; 206 + vcpu->stat.diag_9c_ignored++; 207 207 return 0; 208 208 } 209 209 ··· 213 213 unsigned long subcode = vcpu->run->s.regs.gprs[reg] & 0xffff; 214 214 215 215 VCPU_EVENT(vcpu, 3, "diag ipl functions, subcode %lx", subcode); 216 - vcpu->stat.diagnose_308++; 216 + vcpu->stat.instruction_diagnose_308++; 217 217 switch (subcode) { 218 218 case 3: 219 219 vcpu->run->s390_reset_flags = KVM_S390_RESET_CLEAR; ··· 245 245 { 246 246 int ret; 247 247 248 - vcpu->stat.diagnose_500++; 248 + vcpu->stat.instruction_diagnose_500++; 249 249 /* No virtio-ccw notification? Get out quickly. */ 250 250 if (!vcpu->kvm->arch.css_support || 251 251 (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY)) ··· 299 299 case 0x500: 300 300 return __diag_virtio_hypercall(vcpu); 301 301 default: 302 - vcpu->stat.diagnose_other++; 302 + vcpu->stat.instruction_diagnose_other++; 303 303 return -EOPNOTSUPP; 304 304 } 305 305 }
+9 -9
arch/s390/kvm/kvm-s390.c
··· 163 163 STATS_DESC_COUNTER(VCPU, instruction_sigp_init_cpu_reset), 164 164 STATS_DESC_COUNTER(VCPU, instruction_sigp_cpu_reset), 165 165 STATS_DESC_COUNTER(VCPU, instruction_sigp_unknown), 166 - STATS_DESC_COUNTER(VCPU, diagnose_10), 167 - STATS_DESC_COUNTER(VCPU, diagnose_44), 168 - STATS_DESC_COUNTER(VCPU, diagnose_9c), 169 - STATS_DESC_COUNTER(VCPU, diagnose_9c_ignored), 170 - STATS_DESC_COUNTER(VCPU, diagnose_9c_forward), 171 - STATS_DESC_COUNTER(VCPU, diagnose_258), 172 - STATS_DESC_COUNTER(VCPU, diagnose_308), 173 - STATS_DESC_COUNTER(VCPU, diagnose_500), 174 - STATS_DESC_COUNTER(VCPU, diagnose_other), 166 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_10), 167 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_44), 168 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_9c), 169 + STATS_DESC_COUNTER(VCPU, diag_9c_ignored), 170 + STATS_DESC_COUNTER(VCPU, diag_9c_forward), 171 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_258), 172 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_308), 173 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_500), 174 + STATS_DESC_COUNTER(VCPU, instruction_diagnose_other), 175 175 STATS_DESC_COUNTER(VCPU, pfault_sync) 176 176 }; 177 177 static_assert(ARRAY_SIZE(kvm_vcpu_stats_desc) ==
+5
arch/s390/net/bpf_jit_comp.c
··· 1154 1154 } 1155 1155 break; 1156 1156 /* 1157 + * BPF_NOSPEC (speculation barrier) 1158 + */ 1159 + case BPF_ST | BPF_NOSPEC: 1160 + break; 1161 + /* 1157 1162 * BPF_ST(X) 1158 1163 */ 1159 1164 case BPF_STX | BPF_MEM | BPF_B: /* *(u8 *)(dst + off) = src_reg */
-1
arch/sh/Kconfig
··· 39 39 select HAVE_FUTEX_CMPXCHG if FUTEX 40 40 select HAVE_FTRACE_MCOUNT_RECORD 41 41 select HAVE_HW_BREAKPOINT 42 - select HAVE_IDE if HAS_IOPORT_MAP 43 42 select HAVE_IOREMAP_PROT if MMU && !X2TLB 44 43 select HAVE_KERNEL_BZIP2 45 44 select HAVE_KERNEL_GZIP
-1
arch/sparc/Kconfig
··· 19 19 select OF 20 20 select OF_PROMTREE 21 21 select HAVE_ASM_MODVERSIONS 22 - select HAVE_IDE 23 22 select HAVE_ARCH_KGDB if !SMP || SPARC64 24 23 select HAVE_ARCH_TRACEHOOK 25 24 select HAVE_ARCH_SECCOMP if SPARC64
+3
arch/sparc/net/bpf_jit_comp_64.c
··· 1287 1287 return 1; 1288 1288 break; 1289 1289 } 1290 + /* speculation barrier */ 1291 + case BPF_ST | BPF_NOSPEC: 1292 + break; 1290 1293 /* ST: *(size *)(dst + off) = imm */ 1291 1294 case BPF_ST | BPF_MEM | BPF_W: 1292 1295 case BPF_ST | BPF_MEM | BPF_H:
-1
arch/x86/Kconfig
··· 202 202 select HAVE_FUNCTION_TRACER 203 203 select HAVE_GCC_PLUGINS 204 204 select HAVE_HW_BREAKPOINT 205 - select HAVE_IDE 206 205 select HAVE_IOREMAP_PROT 207 206 select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 208 207 select HAVE_IRQ_TIME_ACCOUNTING
+4 -3
arch/x86/kernel/jump_label.c
··· 79 79 return (struct jump_label_patch){.code = code, .size = size}; 80 80 } 81 81 82 - static inline void __jump_label_transform(struct jump_entry *entry, 83 - enum jump_label_type type, 84 - int init) 82 + static __always_inline void 83 + __jump_label_transform(struct jump_entry *entry, 84 + enum jump_label_type type, 85 + int init) 85 86 { 86 87 const struct jump_label_patch jlp = __jump_label_patch(entry, type); 87 88
+1 -1
arch/x86/kvm/ioapic.c
··· 96 96 static void rtc_irq_eoi_tracking_reset(struct kvm_ioapic *ioapic) 97 97 { 98 98 ioapic->rtc_status.pending_eoi = 0; 99 - bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID); 99 + bitmap_zero(ioapic->rtc_status.dest_map.map, KVM_MAX_VCPU_ID + 1); 100 100 } 101 101 102 102 static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic);
+2 -2
arch/x86/kvm/ioapic.h
··· 43 43 44 44 struct dest_map { 45 45 /* vcpu bitmap where IRQ has been sent */ 46 - DECLARE_BITMAP(map, KVM_MAX_VCPU_ID); 46 + DECLARE_BITMAP(map, KVM_MAX_VCPU_ID + 1); 47 47 48 48 /* 49 49 * Vector sent to a given vcpu, only valid when 50 50 * the vcpu's bit in map is set 51 51 */ 52 - u8 vectors[KVM_MAX_VCPU_ID]; 52 + u8 vectors[KVM_MAX_VCPU_ID + 1]; 53 53 }; 54 54 55 55
+1 -1
arch/x86/kvm/svm/avic.c
··· 646 646 void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) 647 647 { 648 648 struct vcpu_svm *svm = to_svm(vcpu); 649 - struct vmcb *vmcb = svm->vmcb; 649 + struct vmcb *vmcb = svm->vmcb01.ptr; 650 650 bool activated = kvm_vcpu_apicv_active(vcpu); 651 651 652 652 if (!enable_apicv)
+5 -5
arch/x86/kvm/svm/nested.c
··· 515 515 * Also covers avic_vapic_bar, avic_backing_page, avic_logical_id, 516 516 * avic_physical_id. 517 517 */ 518 - WARN_ON(svm->vmcb01.ptr->control.int_ctl & AVIC_ENABLE_MASK); 518 + WARN_ON(kvm_apicv_activated(svm->vcpu.kvm)); 519 519 520 520 /* Copied from vmcb01. msrpm_base can be overwritten later. */ 521 521 svm->vmcb->control.nested_ctl = svm->vmcb01.ptr->control.nested_ctl; ··· 702 702 } 703 703 704 704 /* Copy state save area fields which are handled by VMRUN */ 705 - void svm_copy_vmrun_state(struct vmcb_save_area *from_save, 706 - struct vmcb_save_area *to_save) 705 + void svm_copy_vmrun_state(struct vmcb_save_area *to_save, 706 + struct vmcb_save_area *from_save) 707 707 { 708 708 to_save->es = from_save->es; 709 709 to_save->cs = from_save->cs; ··· 722 722 to_save->cpl = 0; 723 723 } 724 724 725 - void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb) 725 + void svm_copy_vmloadsave_state(struct vmcb *to_vmcb, struct vmcb *from_vmcb) 726 726 { 727 727 to_vmcb->save.fs = from_vmcb->save.fs; 728 728 to_vmcb->save.gs = from_vmcb->save.gs; ··· 1385 1385 1386 1386 svm->nested.vmcb12_gpa = kvm_state->hdr.svm.vmcb_pa; 1387 1387 1388 - svm_copy_vmrun_state(save, &svm->vmcb01.ptr->save); 1388 + svm_copy_vmrun_state(&svm->vmcb01.ptr->save, save); 1389 1389 nested_load_control_from_vmcb12(svm, ctl); 1390 1390 1391 1391 svm_switch_vmcb(svm, &svm->nested.vmcb02);
+15 -11
arch/x86/kvm/svm/svm.c
··· 1406 1406 goto error_free_vmsa_page; 1407 1407 } 1408 1408 1409 - svm_vcpu_init_msrpm(vcpu, svm->msrpm); 1410 - 1411 1409 svm->vmcb01.ptr = page_address(vmcb01_page); 1412 1410 svm->vmcb01.pa = __sme_set(page_to_pfn(vmcb01_page) << PAGE_SHIFT); 1413 1411 ··· 1416 1418 1417 1419 svm_switch_vmcb(svm, &svm->vmcb01); 1418 1420 init_vmcb(vcpu); 1421 + 1422 + svm_vcpu_init_msrpm(vcpu, svm->msrpm); 1419 1423 1420 1424 svm_init_osvw(vcpu); 1421 1425 vcpu->arch.microcode_version = 0x01000065; ··· 1568 1568 { 1569 1569 struct vmcb_control_area *control; 1570 1570 1571 - /* The following fields are ignored when AVIC is enabled */ 1572 - WARN_ON(kvm_vcpu_apicv_active(&svm->vcpu)); 1571 + /* 1572 + * The following fields are ignored when AVIC is enabled 1573 + */ 1574 + WARN_ON(kvm_apicv_activated(svm->vcpu.kvm)); 1575 + 1573 1576 svm_set_intercept(svm, INTERCEPT_VINTR); 1574 1577 1575 1578 /* ··· 2150 2147 ret = kvm_skip_emulated_instruction(vcpu); 2151 2148 2152 2149 if (vmload) { 2153 - nested_svm_vmloadsave(vmcb12, svm->vmcb); 2150 + svm_copy_vmloadsave_state(svm->vmcb, vmcb12); 2154 2151 svm->sysenter_eip_hi = 0; 2155 2152 svm->sysenter_esp_hi = 0; 2156 - } else 2157 - nested_svm_vmloadsave(svm->vmcb, vmcb12); 2153 + } else { 2154 + svm_copy_vmloadsave_state(vmcb12, svm->vmcb); 2155 + } 2158 2156 2159 2157 kvm_vcpu_unmap(vcpu, &map, true); 2160 2158 ··· 4348 4344 4349 4345 BUILD_BUG_ON(offsetof(struct vmcb, save) != 0x400); 4350 4346 4351 - svm_copy_vmrun_state(&svm->vmcb01.ptr->save, 4352 - map_save.hva + 0x400); 4347 + svm_copy_vmrun_state(map_save.hva + 0x400, 4348 + &svm->vmcb01.ptr->save); 4353 4349 4354 4350 kvm_vcpu_unmap(vcpu, &map_save, true); 4355 4351 } ··· 4397 4393 &map_save) == -EINVAL) 4398 4394 return 1; 4399 4395 4400 - svm_copy_vmrun_state(map_save.hva + 0x400, 4401 - &svm->vmcb01.ptr->save); 4396 + svm_copy_vmrun_state(&svm->vmcb01.ptr->save, 4397 + map_save.hva + 0x400); 4402 4398 4403 4399 kvm_vcpu_unmap(vcpu, &map_save, true); 4404 4400 }
+3 -3
arch/x86/kvm/svm/svm.h
··· 464 464 void svm_free_nested(struct vcpu_svm *svm); 465 465 int svm_allocate_nested(struct vcpu_svm *svm); 466 466 int nested_svm_vmrun(struct kvm_vcpu *vcpu); 467 - void svm_copy_vmrun_state(struct vmcb_save_area *from_save, 468 - struct vmcb_save_area *to_save); 469 - void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb); 467 + void svm_copy_vmrun_state(struct vmcb_save_area *to_save, 468 + struct vmcb_save_area *from_save); 469 + void svm_copy_vmloadsave_state(struct vmcb *to_vmcb, struct vmcb *from_vmcb); 470 470 int nested_svm_vmexit(struct vcpu_svm *svm); 471 471 472 472 static inline int nested_svm_simple_vmexit(struct vcpu_svm *svm, u32 exit_code)
+1 -1
arch/x86/kvm/svm/svm_onhyperv.h
··· 89 89 * as we mark it dirty unconditionally towards end of vcpu 90 90 * init phase. 91 91 */ 92 - if (vmcb && vmcb_is_clean(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS) && 92 + if (vmcb_is_clean(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS) && 93 93 hve->hv_enlightenments_control.msr_bitmap) 94 94 vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS); 95 95 }
+2 -2
arch/x86/kvm/x86.c
··· 3407 3407 return 1; 3408 3408 break; 3409 3409 case MSR_KVM_ASYNC_PF_ACK: 3410 - if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF)) 3410 + if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF_INT)) 3411 3411 return 1; 3412 3412 if (data & 0x1) { 3413 3413 vcpu->arch.apf.pageready_pending = false; ··· 3746 3746 msr_info->data = vcpu->arch.apf.msr_int_val; 3747 3747 break; 3748 3748 case MSR_KVM_ASYNC_PF_ACK: 3749 - if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF)) 3749 + if (!guest_pv_has(vcpu, KVM_FEATURE_ASYNC_PF_INT)) 3750 3750 return 1; 3751 3751 3752 3752 msr_info->data = 0;
+7
arch/x86/net/bpf_jit_comp.c
··· 1219 1219 } 1220 1220 break; 1221 1221 1222 + /* speculation barrier */ 1223 + case BPF_ST | BPF_NOSPEC: 1224 + if (boot_cpu_has(X86_FEATURE_XMM2)) 1225 + /* Emit 'lfence' */ 1226 + EMIT3(0x0F, 0xAE, 0xE8); 1227 + break; 1228 + 1222 1229 /* ST: *(u8*)(dst_reg + off) = imm */ 1223 1230 case BPF_ST | BPF_MEM | BPF_B: 1224 1231 if (is_ereg(dst_reg))
+6
arch/x86/net/bpf_jit_comp32.c
··· 1886 1886 i++; 1887 1887 break; 1888 1888 } 1889 + /* speculation barrier */ 1890 + case BPF_ST | BPF_NOSPEC: 1891 + if (boot_cpu_has(X86_FEATURE_XMM2)) 1892 + /* Emit 'lfence' */ 1893 + EMIT3(0x0F, 0xAE, 0xE8); 1894 + break; 1889 1895 /* ST: *(u8*)(dst_reg + off) = imm */ 1890 1896 case BPF_ST | BPF_MEM | BPF_H: 1891 1897 case BPF_ST | BPF_MEM | BPF_B:
-1
arch/xtensa/Kconfig
··· 327 327 328 328 config XTENSA_PLATFORM_XT2000 329 329 bool "XT2000" 330 - select HAVE_IDE 331 330 help 332 331 XT2000 is the name of Tensilica's feature-rich emulation platform. 333 332 This hardware is capable of running a full Linux distribution.
+6 -5
block/blk-iocost.c
··· 1440 1440 return -1; 1441 1441 1442 1442 iocg_commit_bio(ctx->iocg, wait->bio, wait->abs_cost, cost); 1443 + wait->committed = true; 1443 1444 1444 1445 /* 1445 1446 * autoremove_wake_function() removes the wait entry only when it 1446 - * actually changed the task state. We want the wait always 1447 - * removed. Remove explicitly and use default_wake_function(). 1447 + * actually changed the task state. We want the wait always removed. 1448 + * Remove explicitly and use default_wake_function(). Note that the 1449 + * order of operations is important as finish_wait() tests whether 1450 + * @wq_entry is removed without grabbing the lock. 1448 1451 */ 1449 - list_del_init(&wq_entry->entry); 1450 - wait->committed = true; 1451 - 1452 1452 default_wake_function(wq_entry, mode, flags, key); 1453 + list_del_init_careful(&wq_entry->entry); 1453 1454 return 0; 1454 1455 } 1455 1456
+4 -13
block/blk-mq-sched.c
··· 515 515 percpu_ref_put(&q->q_usage_counter); 516 516 } 517 517 518 - static void blk_mq_sched_free_tags(struct blk_mq_tag_set *set, 519 - struct blk_mq_hw_ctx *hctx, 520 - unsigned int hctx_idx) 521 - { 522 - if (hctx->sched_tags) { 523 - blk_mq_free_rqs(set, hctx->sched_tags, hctx_idx); 524 - blk_mq_free_rq_map(hctx->sched_tags, set->flags); 525 - hctx->sched_tags = NULL; 526 - } 527 - } 528 - 529 518 static int blk_mq_sched_alloc_tags(struct request_queue *q, 530 519 struct blk_mq_hw_ctx *hctx, 531 520 unsigned int hctx_idx) ··· 528 539 return -ENOMEM; 529 540 530 541 ret = blk_mq_alloc_rqs(set, hctx->sched_tags, hctx_idx, q->nr_requests); 531 - if (ret) 532 - blk_mq_sched_free_tags(set, hctx, hctx_idx); 542 + if (ret) { 543 + blk_mq_free_rq_map(hctx->sched_tags, set->flags); 544 + hctx->sched_tags = NULL; 545 + } 533 546 534 547 return ret; 535 548 }
+1 -2
block/genhd.c
··· 1079 1079 disk_release_events(disk); 1080 1080 kfree(disk->random); 1081 1081 xa_destroy(&disk->part_tbl); 1082 - bdput(disk->part0); 1083 1082 if (test_bit(GD_QUEUE_REF, &disk->state) && disk->queue) 1084 1083 blk_put_queue(disk->queue); 1085 - kfree(disk); 1084 + bdput(disk->part0); /* frees the disk */ 1086 1085 } 1087 1086 struct class block_class = { 1088 1087 .name = "block",
+1 -1
drivers/acpi/Kconfig
··· 370 370 config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD 371 371 bool "Override ACPI tables from built-in initrd" 372 372 depends on ACPI_TABLE_UPGRADE 373 - depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION="" 373 + depends on INITRAMFS_SOURCE!="" && INITRAMFS_COMPRESSION_NONE 374 374 help 375 375 This option provides functionality to override arbitrary ACPI tables 376 376 from built-in uncompressed initrd.
+43 -8
drivers/acpi/dptf/dptf_pch_fivr.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/platform_device.h> 11 11 12 + struct pch_fivr_resp { 13 + u64 status; 14 + u64 result; 15 + }; 16 + 17 + static int pch_fivr_read(acpi_handle handle, char *method, struct pch_fivr_resp *fivr_resp) 18 + { 19 + struct acpi_buffer resp = { sizeof(struct pch_fivr_resp), fivr_resp}; 20 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 21 + struct acpi_buffer format = { sizeof("NN"), "NN" }; 22 + union acpi_object *obj; 23 + acpi_status status; 24 + int ret = -EFAULT; 25 + 26 + status = acpi_evaluate_object(handle, method, NULL, &buffer); 27 + if (ACPI_FAILURE(status)) 28 + return ret; 29 + 30 + obj = buffer.pointer; 31 + if (!obj || obj->type != ACPI_TYPE_PACKAGE) 32 + goto release_buffer; 33 + 34 + status = acpi_extract_package(obj, &format, &resp); 35 + if (ACPI_FAILURE(status)) 36 + goto release_buffer; 37 + 38 + if (fivr_resp->status) 39 + goto release_buffer; 40 + 41 + ret = 0; 42 + 43 + release_buffer: 44 + kfree(buffer.pointer); 45 + return ret; 46 + } 47 + 12 48 /* 13 49 * Presentation of attributes which are defined for INT1045 14 50 * They are: ··· 59 23 char *buf)\ 60 24 {\ 61 25 struct acpi_device *acpi_dev = dev_get_drvdata(dev);\ 62 - unsigned long long val;\ 63 - acpi_status status;\ 26 + struct pch_fivr_resp fivr_resp;\ 27 + int status;\ 64 28 \ 65 - status = acpi_evaluate_integer(acpi_dev->handle, #method,\ 66 - NULL, &val);\ 67 - if (ACPI_SUCCESS(status))\ 68 - return sprintf(buf, "%d\n", (int)val);\ 69 - else\ 70 - return -EINVAL;\ 29 + status = pch_fivr_read(acpi_dev->handle, #method, &fivr_resp);\ 30 + if (status)\ 31 + return status;\ 32 + \ 33 + return sprintf(buf, "%llu\n", fivr_resp.result);\ 71 34 } 72 35 73 36 #define PCH_FIVR_STORE(name, method) \
+1 -8
drivers/acpi/resource.c
··· 423 423 } 424 424 } 425 425 426 - static bool irq_is_legacy(struct acpi_resource_irq *irq) 427 - { 428 - return irq->triggering == ACPI_EDGE_SENSITIVE && 429 - irq->polarity == ACPI_ACTIVE_HIGH && 430 - irq->shareable == ACPI_EXCLUSIVE; 431 - } 432 - 433 426 /** 434 427 * acpi_dev_resource_interrupt - Extract ACPI interrupt resource information. 435 428 * @ares: Input ACPI resource object. ··· 461 468 } 462 469 acpi_dev_get_irqresource(res, irq->interrupts[index], 463 470 irq->triggering, irq->polarity, 464 - irq->shareable, irq_is_legacy(irq)); 471 + irq->shareable, true); 465 472 break; 466 473 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: 467 474 ext_irq = &ares->data.extended_irq;
+3 -4
drivers/acpi/utils.c
··· 860 860 * Return the next match of ACPI device if another matching device was present 861 861 * at the moment of invocation, or NULL otherwise. 862 862 * 863 - * FIXME: The function does not tolerate the sudden disappearance of @adev, e.g. 864 - * in the case of a hotplug event. That said, the caller should ensure that 865 - * this will never happen. 866 - * 867 863 * The caller is responsible for invoking acpi_dev_put() on the returned device. 864 + * On the other hand the function invokes acpi_dev_put() on the given @adev 865 + * assuming that its reference counter had been increased beforehand. 868 866 * 869 867 * See additional information in acpi_dev_present() as well. 870 868 */ ··· 878 880 match.hrv = hrv; 879 881 880 882 dev = bus_find_device(&acpi_bus_type, start, &match, acpi_dev_match_cb); 883 + acpi_dev_put(adev); 881 884 return dev ? to_acpi_device(dev) : NULL; 882 885 } 883 886 EXPORT_SYMBOL(acpi_dev_get_next_match_dev);
+8 -2
drivers/acpi/x86/s2idle.c
··· 378 378 * AMDI0006: 379 379 * - should use rev_id 0x0 380 380 * - function mask = 0x3: Should use Microsoft method 381 + * AMDI0007: 382 + * - Should use rev_id 0x2 383 + * - Should only use AMD method 381 384 */ 382 385 const char *hid = acpi_device_hid(adev); 383 - rev_id = 0; 386 + rev_id = strcmp(hid, "AMDI0007") ? 0 : 2; 384 387 lps0_dsm_func_mask = validate_dsm(adev->handle, 385 388 ACPI_LPS0_DSM_UUID_AMD, rev_id, &lps0_dsm_guid); 386 389 lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle, 387 - ACPI_LPS0_DSM_UUID_MICROSOFT, rev_id, 390 + ACPI_LPS0_DSM_UUID_MICROSOFT, 0, 388 391 &lps0_dsm_guid_microsoft); 389 392 if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") || 390 393 !strcmp(hid, "AMDI0005"))) { 391 394 lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1; 392 395 acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n", 393 396 ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask); 397 + } else if (lps0_dsm_func_mask_microsoft > 0 && !strcmp(hid, "AMDI0007")) { 398 + lps0_dsm_func_mask_microsoft = -EINVAL; 399 + acpi_handle_debug(adev->handle, "_DSM Using AMD method\n"); 394 400 } 395 401 } else { 396 402 rev_id = 1;
+27 -8
drivers/ata/libata-sff.c
··· 637 637 } 638 638 EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); 639 639 640 + static void ata_pio_xfer(struct ata_queued_cmd *qc, struct page *page, 641 + unsigned int offset, size_t xfer_size) 642 + { 643 + bool do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 644 + unsigned char *buf; 645 + 646 + buf = kmap_atomic(page); 647 + qc->ap->ops->sff_data_xfer(qc, buf + offset, xfer_size, do_write); 648 + kunmap_atomic(buf); 649 + 650 + if (!do_write && !PageSlab(page)) 651 + flush_dcache_page(page); 652 + } 653 + 640 654 /** 641 655 * ata_pio_sector - Transfer a sector of data. 642 656 * @qc: Command on going ··· 662 648 */ 663 649 static void ata_pio_sector(struct ata_queued_cmd *qc) 664 650 { 665 - int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 666 651 struct ata_port *ap = qc->ap; 667 652 struct page *page; 668 653 unsigned int offset; 669 - unsigned char *buf; 670 654 671 655 if (!qc->cursg) { 672 656 qc->curbytes = qc->nbytes; ··· 682 670 683 671 DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); 684 672 685 - /* do the actual data transfer */ 686 - buf = kmap_atomic(page); 687 - ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, do_write); 688 - kunmap_atomic(buf); 673 + /* 674 + * Split the transfer when it splits a page boundary. Note that the 675 + * split still has to be dword aligned like all ATA data transfers. 676 + */ 677 + WARN_ON_ONCE(offset % 4); 678 + if (offset + qc->sect_size > PAGE_SIZE) { 679 + unsigned int split_len = PAGE_SIZE - offset; 689 680 690 - if (!do_write && !PageSlab(page)) 691 - flush_dcache_page(page); 681 + ata_pio_xfer(qc, page, offset, split_len); 682 + ata_pio_xfer(qc, nth_page(page, 1), 0, 683 + qc->sect_size - split_len); 684 + } else { 685 + ata_pio_xfer(qc, page, offset, qc->sect_size); 686 + } 692 687 693 688 qc->curbytes += qc->sect_size; 694 689 qc->cursg_ofs += qc->sect_size;
+7 -1
drivers/base/auxiliary.c
··· 231 231 int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, 232 232 struct module *owner, const char *modname) 233 233 { 234 + int ret; 235 + 234 236 if (WARN_ON(!auxdrv->probe) || WARN_ON(!auxdrv->id_table)) 235 237 return -EINVAL; 236 238 ··· 248 246 auxdrv->driver.bus = &auxiliary_bus_type; 249 247 auxdrv->driver.mod_name = modname; 250 248 251 - return driver_register(&auxdrv->driver); 249 + ret = driver_register(&auxdrv->driver); 250 + if (ret) 251 + kfree(auxdrv->driver.name); 252 + 253 + return ret; 252 254 } 253 255 EXPORT_SYMBOL_GPL(__auxiliary_driver_register); 254 256
+4 -2
drivers/base/core.c
··· 574 574 return; 575 575 } 576 576 577 - snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); 578 - sysfs_remove_link(&con->kobj, buf); 577 + if (device_is_registered(con)) { 578 + snprintf(buf, len, "supplier:%s:%s", dev_bus_name(sup), dev_name(sup)); 579 + sysfs_remove_link(&con->kobj, buf); 580 + } 579 581 snprintf(buf, len, "consumer:%s:%s", dev_bus_name(con), dev_name(con)); 580 582 sysfs_remove_link(&sup->kobj, buf); 581 583 kfree(buf);
+97 -31
drivers/block/loop.c
··· 88 88 89 89 static DEFINE_IDR(loop_index_idr); 90 90 static DEFINE_MUTEX(loop_ctl_mutex); 91 + static DEFINE_MUTEX(loop_validate_mutex); 92 + 93 + /** 94 + * loop_global_lock_killable() - take locks for safe loop_validate_file() test 95 + * 96 + * @lo: struct loop_device 97 + * @global: true if @lo is about to bind another "struct loop_device", false otherwise 98 + * 99 + * Returns 0 on success, -EINTR otherwise. 100 + * 101 + * Since loop_validate_file() traverses on other "struct loop_device" if 102 + * is_loop_device() is true, we need a global lock for serializing concurrent 103 + * loop_configure()/loop_change_fd()/__loop_clr_fd() calls. 104 + */ 105 + static int loop_global_lock_killable(struct loop_device *lo, bool global) 106 + { 107 + int err; 108 + 109 + if (global) { 110 + err = mutex_lock_killable(&loop_validate_mutex); 111 + if (err) 112 + return err; 113 + } 114 + err = mutex_lock_killable(&lo->lo_mutex); 115 + if (err && global) 116 + mutex_unlock(&loop_validate_mutex); 117 + return err; 118 + } 119 + 120 + /** 121 + * loop_global_unlock() - release locks taken by loop_global_lock_killable() 122 + * 123 + * @lo: struct loop_device 124 + * @global: true if @lo was about to bind another "struct loop_device", false otherwise 125 + */ 126 + static void loop_global_unlock(struct loop_device *lo, bool global) 127 + { 128 + mutex_unlock(&lo->lo_mutex); 129 + if (global) 130 + mutex_unlock(&loop_validate_mutex); 131 + } 91 132 92 133 static int max_part; 93 134 static int part_shift; ··· 713 672 while (is_loop_device(f)) { 714 673 struct loop_device *l; 715 674 675 + lockdep_assert_held(&loop_validate_mutex); 716 676 if (f->f_mapping->host->i_rdev == bdev->bd_dev) 717 677 return -EBADF; 718 678 719 679 l = I_BDEV(f->f_mapping->host)->bd_disk->private_data; 720 - if (l->lo_state != Lo_bound) { 680 + if (l->lo_state != Lo_bound) 721 681 return -EINVAL; 722 - } 682 + /* Order wrt setting lo->lo_backing_file in loop_configure(). */ 683 + rmb(); 723 684 f = l->lo_backing_file; 724 685 } 725 686 if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode)) ··· 740 697 static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, 741 698 unsigned int arg) 742 699 { 743 - struct file *file = NULL, *old_file; 744 - int error; 745 - bool partscan; 700 + struct file *file = fget(arg); 701 + struct file *old_file; 702 + int error; 703 + bool partscan; 704 + bool is_loop; 746 705 747 - error = mutex_lock_killable(&lo->lo_mutex); 706 + if (!file) 707 + return -EBADF; 708 + is_loop = is_loop_device(file); 709 + error = loop_global_lock_killable(lo, is_loop); 748 710 if (error) 749 - return error; 711 + goto out_putf; 750 712 error = -ENXIO; 751 713 if (lo->lo_state != Lo_bound) 752 714 goto out_err; ··· 759 711 /* the loop device has to be read-only */ 760 712 error = -EINVAL; 761 713 if (!(lo->lo_flags & LO_FLAGS_READ_ONLY)) 762 - goto out_err; 763 - 764 - error = -EBADF; 765 - file = fget(arg); 766 - if (!file) 767 714 goto out_err; 768 715 769 716 error = loop_validate_file(file, bdev); ··· 783 740 loop_update_dio(lo); 784 741 blk_mq_unfreeze_queue(lo->lo_queue); 785 742 partscan = lo->lo_flags & LO_FLAGS_PARTSCAN; 786 - mutex_unlock(&lo->lo_mutex); 743 + loop_global_unlock(lo, is_loop); 744 + 745 + /* 746 + * Flush loop_validate_file() before fput(), for l->lo_backing_file 747 + * might be pointing at old_file which might be the last reference. 748 + */ 749 + if (!is_loop) { 750 + mutex_lock(&loop_validate_mutex); 751 + mutex_unlock(&loop_validate_mutex); 752 + } 787 753 /* 788 754 * We must drop file reference outside of lo_mutex as dropping 789 755 * the file ref can take open_mutex which creates circular locking ··· 804 752 return 0; 805 753 806 754 out_err: 807 - mutex_unlock(&lo->lo_mutex); 808 - if (file) 809 - fput(file); 755 + loop_global_unlock(lo, is_loop); 756 + out_putf: 757 + fput(file); 810 758 return error; 811 759 } 812 760 ··· 1188 1136 struct block_device *bdev, 1189 1137 const struct loop_config *config) 1190 1138 { 1191 - struct file *file; 1192 - struct inode *inode; 1139 + struct file *file = fget(config->fd); 1140 + struct inode *inode; 1193 1141 struct address_space *mapping; 1194 - int error; 1195 - loff_t size; 1196 - bool partscan; 1197 - unsigned short bsize; 1142 + int error; 1143 + loff_t size; 1144 + bool partscan; 1145 + unsigned short bsize; 1146 + bool is_loop; 1147 + 1148 + if (!file) 1149 + return -EBADF; 1150 + is_loop = is_loop_device(file); 1198 1151 1199 1152 /* This is safe, since we have a reference from open(). */ 1200 1153 __module_get(THIS_MODULE); 1201 - 1202 - error = -EBADF; 1203 - file = fget(config->fd); 1204 - if (!file) 1205 - goto out; 1206 1154 1207 1155 /* 1208 1156 * If we don't hold exclusive handle for the device, upgrade to it ··· 1214 1162 goto out_putf; 1215 1163 } 1216 1164 1217 - error = mutex_lock_killable(&lo->lo_mutex); 1165 + error = loop_global_lock_killable(lo, is_loop); 1218 1166 if (error) 1219 1167 goto out_bdev; 1220 1168 ··· 1294 1242 size = get_loop_size(lo, file); 1295 1243 loop_set_size(lo, size); 1296 1244 1245 + /* Order wrt reading lo_state in loop_validate_file(). */ 1246 + wmb(); 1247 + 1297 1248 lo->lo_state = Lo_bound; 1298 1249 if (part_shift) 1299 1250 lo->lo_flags |= LO_FLAGS_PARTSCAN; ··· 1308 1253 * put /dev/loopXX inode. Later in __loop_clr_fd() we bdput(bdev). 1309 1254 */ 1310 1255 bdgrab(bdev); 1311 - mutex_unlock(&lo->lo_mutex); 1256 + loop_global_unlock(lo, is_loop); 1312 1257 if (partscan) 1313 1258 loop_reread_partitions(lo); 1314 1259 if (!(mode & FMODE_EXCL)) ··· 1316 1261 return 0; 1317 1262 1318 1263 out_unlock: 1319 - mutex_unlock(&lo->lo_mutex); 1264 + loop_global_unlock(lo, is_loop); 1320 1265 out_bdev: 1321 1266 if (!(mode & FMODE_EXCL)) 1322 1267 bd_abort_claiming(bdev, loop_configure); 1323 1268 out_putf: 1324 1269 fput(file); 1325 - out: 1326 1270 /* This is safe: open() is still holding a reference. */ 1327 1271 module_put(THIS_MODULE); 1328 1272 return error; ··· 1336 1282 bool partscan = false; 1337 1283 int lo_number; 1338 1284 struct loop_worker *pos, *worker; 1285 + 1286 + /* 1287 + * Flush loop_configure() and loop_change_fd(). It is acceptable for 1288 + * loop_validate_file() to succeed, for actual clear operation has not 1289 + * started yet. 1290 + */ 1291 + mutex_lock(&loop_validate_mutex); 1292 + mutex_unlock(&loop_validate_mutex); 1293 + /* 1294 + * loop_validate_file() now fails because l->lo_state != Lo_bound 1295 + * became visible. 1296 + */ 1339 1297 1340 1298 mutex_lock(&lo->lo_mutex); 1341 1299 if (WARN_ON_ONCE(lo->lo_state != Lo_rundown)) {
+13 -20
drivers/block/rbd.c
··· 4100 4100 4101 4101 static bool rbd_quiesce_lock(struct rbd_device *rbd_dev) 4102 4102 { 4103 - bool need_wait; 4104 - 4105 4103 dout("%s rbd_dev %p\n", __func__, rbd_dev); 4106 4104 lockdep_assert_held_write(&rbd_dev->lock_rwsem); 4107 4105 ··· 4111 4113 */ 4112 4114 rbd_dev->lock_state = RBD_LOCK_STATE_RELEASING; 4113 4115 rbd_assert(!completion_done(&rbd_dev->releasing_wait)); 4114 - need_wait = !list_empty(&rbd_dev->running_list); 4115 - downgrade_write(&rbd_dev->lock_rwsem); 4116 - if (need_wait) 4117 - wait_for_completion(&rbd_dev->releasing_wait); 4118 - up_read(&rbd_dev->lock_rwsem); 4116 + if (list_empty(&rbd_dev->running_list)) 4117 + return true; 4118 + 4119 + up_write(&rbd_dev->lock_rwsem); 4120 + wait_for_completion(&rbd_dev->releasing_wait); 4119 4121 4120 4122 down_write(&rbd_dev->lock_rwsem); 4121 4123 if (rbd_dev->lock_state != RBD_LOCK_STATE_RELEASING) ··· 4201 4203 if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { 4202 4204 down_write(&rbd_dev->lock_rwsem); 4203 4205 if (rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { 4204 - /* 4205 - * we already know that the remote client is 4206 - * the owner 4207 - */ 4208 - up_write(&rbd_dev->lock_rwsem); 4209 - return; 4206 + dout("%s rbd_dev %p cid %llu-%llu == owner_cid\n", 4207 + __func__, rbd_dev, cid.gid, cid.handle); 4208 + } else { 4209 + rbd_set_owner_cid(rbd_dev, &cid); 4210 4210 } 4211 - 4212 - rbd_set_owner_cid(rbd_dev, &cid); 4213 4211 downgrade_write(&rbd_dev->lock_rwsem); 4214 4212 } else { 4215 4213 down_read(&rbd_dev->lock_rwsem); ··· 4230 4236 if (!rbd_cid_equal(&cid, &rbd_empty_cid)) { 4231 4237 down_write(&rbd_dev->lock_rwsem); 4232 4238 if (!rbd_cid_equal(&cid, &rbd_dev->owner_cid)) { 4233 - dout("%s rbd_dev %p unexpected owner, cid %llu-%llu != owner_cid %llu-%llu\n", 4239 + dout("%s rbd_dev %p cid %llu-%llu != owner_cid %llu-%llu\n", 4234 4240 __func__, rbd_dev, cid.gid, cid.handle, 4235 4241 rbd_dev->owner_cid.gid, rbd_dev->owner_cid.handle); 4236 - up_write(&rbd_dev->lock_rwsem); 4237 - return; 4242 + } else { 4243 + rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); 4238 4244 } 4239 - 4240 - rbd_set_owner_cid(rbd_dev, &rbd_empty_cid); 4241 4245 downgrade_write(&rbd_dev->lock_rwsem); 4242 4246 } else { 4243 4247 down_read(&rbd_dev->lock_rwsem); ··· 4943 4951 disk->minors = RBD_MINORS_PER_MAJOR; 4944 4952 } 4945 4953 disk->fops = &rbd_bd_ops; 4954 + disk->private_data = rbd_dev; 4946 4955 4947 4956 blk_queue_flag_set(QUEUE_FLAG_NONROT, q); 4948 4957 /* QUEUE_FLAG_ADD_RANDOM is off by default for blk-mq */
+12 -5
drivers/bus/mhi/core/main.c
··· 773 773 cmd_pkt = mhi_to_virtual(mhi_ring, ptr); 774 774 775 775 chan = MHI_TRE_GET_CMD_CHID(cmd_pkt); 776 - mhi_chan = &mhi_cntrl->mhi_chan[chan]; 777 - write_lock_bh(&mhi_chan->lock); 778 - mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre); 779 - complete(&mhi_chan->completion); 780 - write_unlock_bh(&mhi_chan->lock); 776 + 777 + if (chan < mhi_cntrl->max_chan && 778 + mhi_cntrl->mhi_chan[chan].configured) { 779 + mhi_chan = &mhi_cntrl->mhi_chan[chan]; 780 + write_lock_bh(&mhi_chan->lock); 781 + mhi_chan->ccs = MHI_TRE_GET_EV_CODE(tre); 782 + complete(&mhi_chan->completion); 783 + write_unlock_bh(&mhi_chan->lock); 784 + } else { 785 + dev_err(&mhi_cntrl->mhi_dev->dev, 786 + "Completion packet for invalid channel ID: %d\n", chan); 787 + } 781 788 782 789 mhi_del_ring_element(mhi_cntrl, mhi_ring); 783 790 }
+36 -9
drivers/bus/mhi/pci_generic.c
··· 33 33 * @bar_num: PCI base address register to use for MHI MMIO register space 34 34 * @dma_data_width: DMA transfer word size (32 or 64 bits) 35 35 * @mru_default: default MRU size for MBIM network packets 36 + * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead 37 + * of inband wake support (such as sdx24) 36 38 */ 37 39 struct mhi_pci_dev_info { 38 40 const struct mhi_controller_config *config; ··· 44 42 unsigned int bar_num; 45 43 unsigned int dma_data_width; 46 44 unsigned int mru_default; 45 + bool sideband_wake; 47 46 }; 48 47 49 48 #define MHI_CHANNEL_CONFIG_UL(ch_num, ch_name, el_count, ev_ring) \ ··· 75 72 .lpm_notify = false, \ 76 73 .offload_channel = false, \ 77 74 .doorbell_mode_switch = false, \ 75 + } 76 + 77 + #define MHI_CHANNEL_CONFIG_DL_AUTOQUEUE(ch_num, ch_name, el_count, ev_ring) \ 78 + { \ 79 + .num = ch_num, \ 80 + .name = ch_name, \ 81 + .num_elements = el_count, \ 82 + .event_ring = ev_ring, \ 83 + .dir = DMA_FROM_DEVICE, \ 84 + .ee_mask = BIT(MHI_EE_AMSS), \ 85 + .pollcfg = 0, \ 86 + .doorbell = MHI_DB_BRST_DISABLE, \ 87 + .lpm_notify = false, \ 88 + .offload_channel = false, \ 89 + .doorbell_mode_switch = false, \ 90 + .auto_queue = true, \ 78 91 } 79 92 80 93 #define MHI_EVENT_CONFIG_CTRL(ev_ring, el_count) \ ··· 231 212 MHI_CHANNEL_CONFIG_UL(14, "QMI", 4, 0), 232 213 MHI_CHANNEL_CONFIG_DL(15, "QMI", 4, 0), 233 214 MHI_CHANNEL_CONFIG_UL(20, "IPCR", 8, 0), 234 - MHI_CHANNEL_CONFIG_DL(21, "IPCR", 8, 0), 215 + MHI_CHANNEL_CONFIG_DL_AUTOQUEUE(21, "IPCR", 8, 0), 235 216 MHI_CHANNEL_CONFIG_UL_FP(34, "FIREHOSE", 32, 0), 236 217 MHI_CHANNEL_CONFIG_DL_FP(35, "FIREHOSE", 32, 0), 237 218 MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0", 128, 2), ··· 263 244 .edl = "qcom/sdx65m/edl.mbn", 264 245 .config = &modem_qcom_v1_mhiv_config, 265 246 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 266 - .dma_data_width = 32 247 + .dma_data_width = 32, 248 + .sideband_wake = false, 267 249 }; 268 250 269 251 static const struct mhi_pci_dev_info mhi_qcom_sdx55_info = { ··· 274 254 .config = &modem_qcom_v1_mhiv_config, 275 255 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 276 256 .dma_data_width = 32, 277 - .mru_default = 32768 257 + .mru_default = 32768, 258 + .sideband_wake = false, 278 259 }; 279 260 280 261 static const struct mhi_pci_dev_info mhi_qcom_sdx24_info = { ··· 283 262 .edl = "qcom/prog_firehose_sdx24.mbn", 284 263 .config = &modem_qcom_v1_mhiv_config, 285 264 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 286 - .dma_data_width = 32 265 + .dma_data_width = 32, 266 + .sideband_wake = true, 287 267 }; 288 268 289 269 static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = { ··· 326 304 .edl = "qcom/prog_firehose_sdx24.mbn", 327 305 .config = &modem_quectel_em1xx_config, 328 306 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 329 - .dma_data_width = 32 307 + .dma_data_width = 32, 308 + .sideband_wake = true, 330 309 }; 331 310 332 311 static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = { ··· 365 342 .edl = "qcom/sdx55m/edl.mbn", 366 343 .config = &modem_foxconn_sdx55_config, 367 344 .bar_num = MHI_PCI_DEFAULT_BAR_NUM, 368 - .dma_data_width = 32 345 + .dma_data_width = 32, 346 + .sideband_wake = false, 369 347 }; 370 348 371 349 static const struct pci_device_id mhi_pci_id_table[] = { ··· 667 643 mhi_cntrl->status_cb = mhi_pci_status_cb; 668 644 mhi_cntrl->runtime_get = mhi_pci_runtime_get; 669 645 mhi_cntrl->runtime_put = mhi_pci_runtime_put; 670 - mhi_cntrl->wake_get = mhi_pci_wake_get_nop; 671 - mhi_cntrl->wake_put = mhi_pci_wake_put_nop; 672 - mhi_cntrl->wake_toggle = mhi_pci_wake_toggle_nop; 673 646 mhi_cntrl->mru = info->mru_default; 647 + 648 + if (info->sideband_wake) { 649 + mhi_cntrl->wake_get = mhi_pci_wake_get_nop; 650 + mhi_cntrl->wake_put = mhi_pci_wake_put_nop; 651 + mhi_cntrl->wake_toggle = mhi_pci_wake_toggle_nop; 652 + } 674 653 675 654 err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_data_width)); 676 655 if (err)
-1
drivers/firmware/efi/dev-path-parser.c
··· 34 34 break; 35 35 if (!adev->pnp.unique_id && node->acpi.uid == 0) 36 36 break; 37 - acpi_dev_put(adev); 38 37 } 39 38 if (!adev) 40 39 return -ENODEV;
+12 -1
drivers/firmware/efi/efi.c
··· 896 896 static int efi_mem_reserve_iomem(phys_addr_t addr, u64 size) 897 897 { 898 898 struct resource *res, *parent; 899 + int ret; 899 900 900 901 res = kzalloc(sizeof(struct resource), GFP_ATOMIC); 901 902 if (!res) ··· 909 908 910 909 /* we expect a conflict with a 'System RAM' region */ 911 910 parent = request_resource_conflict(&iomem_resource, res); 912 - return parent ? request_resource(parent, res) : 0; 911 + ret = parent ? request_resource(parent, res) : 0; 912 + 913 + /* 914 + * Given that efi_mem_reserve_iomem() can be called at any 915 + * time, only call memblock_reserve() if the architecture 916 + * keeps the infrastructure around. 917 + */ 918 + if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK) && !ret) 919 + memblock_reserve(addr, size); 920 + 921 + return ret; 913 922 } 914 923 915 924 int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
+2 -2
drivers/firmware/efi/libstub/efi-stub-helper.c
··· 630 630 * @image: EFI loaded image protocol 631 631 * @load_addr: pointer to loaded initrd 632 632 * @load_size: size of loaded initrd 633 - * @soft_limit: preferred size of allocated memory for loading the initrd 634 - * @hard_limit: minimum size of allocated memory 633 + * @soft_limit: preferred address for loading the initrd 634 + * @hard_limit: upper limit address for loading the initrd 635 635 * 636 636 * Return: status code 637 637 */
+4 -1
drivers/firmware/efi/mokvar-table.c
··· 180 180 pr_err("EFI MOKvar config table is not valid\n"); 181 181 return; 182 182 } 183 - efi_mem_reserve(efi.mokvar_table, map_size_needed); 183 + 184 + if (md.type == EFI_BOOT_SERVICES_DATA) 185 + efi_mem_reserve(efi.mokvar_table, map_size_needed); 186 + 184 187 efi_mokvar_table_size = map_size_needed; 185 188 } 186 189
+5 -3
drivers/firmware/efi/tpm.c
··· 62 62 tbl_size = sizeof(*log_tbl) + log_tbl->size; 63 63 memblock_reserve(efi.tpm_log, tbl_size); 64 64 65 - if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR || 66 - log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { 67 - pr_warn(FW_BUG "TPM Final Events table missing or invalid\n"); 65 + if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR) { 66 + pr_info("TPM Final Events table not present\n"); 67 + goto out; 68 + } else if (log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) { 69 + pr_warn(FW_BUG "TPM Final Events table invalid\n"); 68 70 goto out; 69 71 } 70 72
+7
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 619 619 u32 max_level; 620 620 }; 621 621 622 + #define codec_info_build(type, width, height, level) \ 623 + .codec_type = type,\ 624 + .max_width = width,\ 625 + .max_height = height,\ 626 + .max_pixels_per_frame = height * width,\ 627 + .max_level = level, 628 + 622 629 struct amdgpu_video_codecs { 623 630 const u32 codec_count; 624 631 const struct amdgpu_video_codec_info *codec_array;
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
··· 26 26 #include <linux/slab.h> 27 27 #include <linux/power_supply.h> 28 28 #include <linux/pm_runtime.h> 29 + #include <linux/suspend.h> 29 30 #include <acpi/video.h> 30 31 #include <acpi/actbl.h> 31 32 ··· 1043 1042 #if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE) 1044 1043 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) { 1045 1044 if (adev->flags & AMD_IS_APU) 1046 - return true; 1045 + return pm_suspend_target_state == PM_SUSPEND_TO_IDLE; 1047 1046 } 1048 1047 #endif 1049 1048 return false;
+2 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 3504 3504 r = amdgpu_device_get_job_timeout_settings(adev); 3505 3505 if (r) { 3506 3506 dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n"); 3507 - goto failed_unmap; 3507 + return r; 3508 3508 } 3509 3509 3510 3510 /* early init functions */ 3511 3511 r = amdgpu_device_ip_early_init(adev); 3512 3512 if (r) 3513 - goto failed_unmap; 3513 + return r; 3514 3514 3515 3515 /* doorbell bar mapping and doorbell index init*/ 3516 3516 amdgpu_device_doorbell_init(adev); ··· 3735 3735 3736 3736 failed: 3737 3737 amdgpu_vf_error_trans_all(adev); 3738 - 3739 - failed_unmap: 3740 - iounmap(adev->rmmio); 3741 - adev->rmmio = NULL; 3742 3738 3743 3739 return r; 3744 3740 }
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 1190 1190 /* Van Gogh */ 1191 1191 {0x1002, 0x163F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VANGOGH|AMD_IS_APU}, 1192 1192 1193 + /* Yellow Carp */ 1194 + {0x1002, 0x164D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_YELLOW_CARP|AMD_IS_APU}, 1195 + {0x1002, 0x1681, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_YELLOW_CARP|AMD_IS_APU}, 1196 + 1193 1197 /* Navy_Flounder */ 1194 1198 {0x1002, 0x73C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVY_FLOUNDER}, 1195 1199 {0x1002, 0x73C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVY_FLOUNDER},
+9
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 255 255 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) 256 256 return -EPERM; 257 257 258 + /* Workaround for Thunk bug creating PROT_NONE,MAP_PRIVATE mappings 259 + * for debugger access to invisible VRAM. Should have used MAP_SHARED 260 + * instead. Clearing VM_MAYWRITE prevents the mapping from ever 261 + * becoming writable and makes is_cow_mapping(vm_flags) false. 262 + */ 263 + if (is_cow_mapping(vma->vm_flags) && 264 + !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) 265 + vma->vm_flags &= ~VM_MAYWRITE; 266 + 258 267 return drm_gem_ttm_mmap(obj, vma); 259 268 } 260 269
+3
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
··· 3300 3300 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000), 3301 3301 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000), 3302 3302 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000), 3303 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020), 3303 3304 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000), 3304 3305 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffbfffff, 0x00a00000) 3305 3306 }; ··· 3380 3379 SOC15_REG_GOLDEN_VALUE(GC, 0, mmPA_SC_ENHANCE_2, 0xffffffbf, 0x00000020), 3381 3380 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSPI_CONFIG_CNTL_1_Vangogh, 0xffffffff, 0x00070103), 3382 3381 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQG_CONFIG, 0x000017ff, 0x00001000), 3382 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020), 3383 3383 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000), 3384 3384 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00400000), 3385 3385 SOC15_REG_GOLDEN_VALUE(GC, 0, mmVGT_GS_MAX_WAVE_ID, 0x00000fff, 0x000000ff), ··· 3447 3445 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000), 3448 3446 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000), 3449 3447 SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000), 3448 + SOC15_REG_GOLDEN_VALUE(GC, 0, mmSX_DEBUG_1, 0x00010000, 0x00010020), 3450 3449 SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0x01030000, 0x01030000), 3451 3450 SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x03a00000, 0x00a00000), 3452 3451 SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x00000020, 0x00000020)
+50 -198
drivers/gpu/drm/amd/amdgpu/nv.c
··· 64 64 #include "smuio_v11_0.h" 65 65 #include "smuio_v11_0_6.h" 66 66 67 - #define codec_info_build(type, width, height, level) \ 68 - .codec_type = type,\ 69 - .max_width = width,\ 70 - .max_height = height,\ 71 - .max_pixels_per_frame = height * width,\ 72 - .max_level = level, 73 - 74 67 static const struct amd_ip_funcs nv_common_ip_funcs; 75 68 76 69 /* Navi */ 77 70 static const struct amdgpu_video_codec_info nv_video_codecs_encode_array[] = 78 71 { 79 - { 80 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 81 - .max_width = 4096, 82 - .max_height = 2304, 83 - .max_pixels_per_frame = 4096 * 2304, 84 - .max_level = 0, 85 - }, 86 - { 87 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 88 - .max_width = 4096, 89 - .max_height = 2304, 90 - .max_pixels_per_frame = 4096 * 2304, 91 - .max_level = 0, 92 - }, 72 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)}, 73 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)}, 93 74 }; 94 75 95 76 static const struct amdgpu_video_codecs nv_video_codecs_encode = ··· 82 101 /* Navi1x */ 83 102 static const struct amdgpu_video_codec_info nv_video_codecs_decode_array[] = 84 103 { 85 - { 86 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 87 - .max_width = 4096, 88 - .max_height = 4096, 89 - .max_pixels_per_frame = 4096 * 4096, 90 - .max_level = 3, 91 - }, 92 - { 93 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 94 - .max_width = 4096, 95 - .max_height = 4096, 96 - .max_pixels_per_frame = 4096 * 4096, 97 - .max_level = 5, 98 - }, 99 - { 100 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 101 - .max_width = 4096, 102 - .max_height = 4096, 103 - .max_pixels_per_frame = 4096 * 4096, 104 - .max_level = 52, 105 - }, 106 - { 107 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 108 - .max_width = 4096, 109 - .max_height = 4096, 110 - .max_pixels_per_frame = 4096 * 4096, 111 - .max_level = 4, 112 - }, 113 - { 114 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 115 - .max_width = 8192, 116 - .max_height = 4352, 117 - .max_pixels_per_frame = 8192 * 4352, 118 - .max_level = 186, 119 - }, 120 - { 121 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 122 - .max_width = 4096, 123 - .max_height = 4096, 124 - .max_pixels_per_frame = 4096 * 4096, 125 - .max_level = 0, 126 - }, 127 - { 128 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 129 - .max_width = 8192, 130 - .max_height = 4352, 131 - .max_pixels_per_frame = 8192 * 4352, 132 - .max_level = 0, 133 - }, 104 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 105 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 106 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 107 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 108 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 109 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 110 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 134 111 }; 135 112 136 113 static const struct amdgpu_video_codecs nv_video_codecs_decode = ··· 100 161 /* Sienna Cichlid */ 101 162 static const struct amdgpu_video_codec_info sc_video_codecs_decode_array[] = 102 163 { 103 - { 104 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 105 - .max_width = 4096, 106 - .max_height = 4096, 107 - .max_pixels_per_frame = 4096 * 4096, 108 - .max_level = 3, 109 - }, 110 - { 111 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 112 - .max_width = 4096, 113 - .max_height = 4096, 114 - .max_pixels_per_frame = 4096 * 4096, 115 - .max_level = 5, 116 - }, 117 - { 118 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 119 - .max_width = 4096, 120 - .max_height = 4096, 121 - .max_pixels_per_frame = 4096 * 4096, 122 - .max_level = 52, 123 - }, 124 - { 125 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 126 - .max_width = 4096, 127 - .max_height = 4096, 128 - .max_pixels_per_frame = 4096 * 4096, 129 - .max_level = 4, 130 - }, 131 - { 132 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 133 - .max_width = 8192, 134 - .max_height = 4352, 135 - .max_pixels_per_frame = 8192 * 4352, 136 - .max_level = 186, 137 - }, 138 - { 139 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 140 - .max_width = 4096, 141 - .max_height = 4096, 142 - .max_pixels_per_frame = 4096 * 4096, 143 - .max_level = 0, 144 - }, 145 - { 146 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 147 - .max_width = 8192, 148 - .max_height = 4352, 149 - .max_pixels_per_frame = 8192 * 4352, 150 - .max_level = 0, 151 - }, 152 - { 153 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 154 - .max_width = 8192, 155 - .max_height = 4352, 156 - .max_pixels_per_frame = 8192 * 4352, 157 - .max_level = 0, 158 - }, 164 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 165 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 166 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 167 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 168 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 169 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 170 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 171 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, 159 172 }; 160 173 161 174 static const struct amdgpu_video_codecs sc_video_codecs_decode = ··· 119 228 /* SRIOV Sienna Cichlid, not const since data is controlled by host */ 120 229 static struct amdgpu_video_codec_info sriov_sc_video_codecs_encode_array[] = 121 230 { 122 - { 123 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 124 - .max_width = 4096, 125 - .max_height = 2304, 126 - .max_pixels_per_frame = 4096 * 2304, 127 - .max_level = 0, 128 - }, 129 - { 130 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 131 - .max_width = 4096, 132 - .max_height = 2304, 133 - .max_pixels_per_frame = 4096 * 2304, 134 - .max_level = 0, 135 - }, 231 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)}, 232 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)}, 136 233 }; 137 234 138 235 static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array[] = 139 236 { 140 - { 141 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 142 - .max_width = 4096, 143 - .max_height = 4096, 144 - .max_pixels_per_frame = 4096 * 4096, 145 - .max_level = 3, 146 - }, 147 - { 148 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 149 - .max_width = 4096, 150 - .max_height = 4096, 151 - .max_pixels_per_frame = 4096 * 4096, 152 - .max_level = 5, 153 - }, 154 - { 155 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 156 - .max_width = 4096, 157 - .max_height = 4096, 158 - .max_pixels_per_frame = 4096 * 4096, 159 - .max_level = 52, 160 - }, 161 - { 162 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 163 - .max_width = 4096, 164 - .max_height = 4096, 165 - .max_pixels_per_frame = 4096 * 4096, 166 - .max_level = 4, 167 - }, 168 - { 169 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 170 - .max_width = 8192, 171 - .max_height = 4352, 172 - .max_pixels_per_frame = 8192 * 4352, 173 - .max_level = 186, 174 - }, 175 - { 176 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 177 - .max_width = 4096, 178 - .max_height = 4096, 179 - .max_pixels_per_frame = 4096 * 4096, 180 - .max_level = 0, 181 - }, 182 - { 183 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 184 - .max_width = 8192, 185 - .max_height = 4352, 186 - .max_pixels_per_frame = 8192 * 4352, 187 - .max_level = 0, 188 - }, 189 - { 190 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 191 - .max_width = 8192, 192 - .max_height = 4352, 193 - .max_pixels_per_frame = 8192 * 4352, 194 - .max_level = 0, 195 - }, 237 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 238 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 239 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 240 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 241 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 242 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 243 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 244 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)}, 196 245 }; 197 246 198 247 static struct amdgpu_video_codecs sriov_sc_video_codecs_encode = ··· 164 333 .codec_array = NULL, 165 334 }; 166 335 336 + /* Yellow Carp*/ 337 + static const struct amdgpu_video_codec_info yc_video_codecs_decode_array[] = { 338 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 339 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 340 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 341 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 342 + }; 343 + 344 + static const struct amdgpu_video_codecs yc_video_codecs_decode = { 345 + .codec_count = ARRAY_SIZE(yc_video_codecs_decode_array), 346 + .codec_array = yc_video_codecs_decode_array, 347 + }; 348 + 167 349 static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode, 168 350 const struct amdgpu_video_codecs **codecs) 169 351 { ··· 197 353 case CHIP_NAVY_FLOUNDER: 198 354 case CHIP_DIMGREY_CAVEFISH: 199 355 case CHIP_VANGOGH: 200 - case CHIP_YELLOW_CARP: 201 356 if (encode) 202 357 *codecs = &nv_video_codecs_encode; 203 358 else 204 359 *codecs = &sc_video_codecs_decode; 360 + return 0; 361 + case CHIP_YELLOW_CARP: 362 + if (encode) 363 + *codecs = &nv_video_codecs_encode; 364 + else 365 + *codecs = &yc_video_codecs_decode; 205 366 return 0; 206 367 case CHIP_BEIGE_GOBY: 207 368 if (encode) ··· 1236 1387 AMD_PG_SUPPORT_VCN | 1237 1388 AMD_PG_SUPPORT_VCN_DPG | 1238 1389 AMD_PG_SUPPORT_JPEG; 1239 - adev->external_rev_id = adev->rev_id + 0x01; 1390 + if (adev->pdev->device == 0x1681) 1391 + adev->external_rev_id = adev->rev_id + 0x19; 1392 + else 1393 + adev->external_rev_id = adev->rev_id + 0x01; 1240 1394 break; 1241 1395 default: 1242 1396 /* FIXME: not supported yet */
+3 -4
drivers/gpu/drm/amd/amdgpu/psp_v12_0.c
··· 67 67 68 68 err = psp_init_asd_microcode(psp, chip_name); 69 69 if (err) 70 - goto out; 70 + return err; 71 71 72 72 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name); 73 73 err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev); ··· 80 80 } else { 81 81 err = amdgpu_ucode_validate(adev->psp.ta_fw); 82 82 if (err) 83 - goto out2; 83 + goto out; 84 84 85 85 ta_hdr = (const struct ta_firmware_header_v1_0 *) 86 86 adev->psp.ta_fw->data; ··· 105 105 106 106 return 0; 107 107 108 - out2: 108 + out: 109 109 release_firmware(adev->psp.ta_fw); 110 110 adev->psp.ta_fw = NULL; 111 - out: 112 111 if (err) { 113 112 dev_err(adev->dev, 114 113 "psp v12.0: Failed to load firmware \"%s\"\n",
+22 -154
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 88 88 /* Vega, Raven, Arcturus */ 89 89 static const struct amdgpu_video_codec_info vega_video_codecs_encode_array[] = 90 90 { 91 - { 92 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 93 - .max_width = 4096, 94 - .max_height = 2304, 95 - .max_pixels_per_frame = 4096 * 2304, 96 - .max_level = 0, 97 - }, 98 - { 99 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 100 - .max_width = 4096, 101 - .max_height = 2304, 102 - .max_pixels_per_frame = 4096 * 2304, 103 - .max_level = 0, 104 - }, 91 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)}, 92 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)}, 105 93 }; 106 94 107 95 static const struct amdgpu_video_codecs vega_video_codecs_encode = ··· 101 113 /* Vega */ 102 114 static const struct amdgpu_video_codec_info vega_video_codecs_decode_array[] = 103 115 { 104 - { 105 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 106 - .max_width = 4096, 107 - .max_height = 4096, 108 - .max_pixels_per_frame = 4096 * 4096, 109 - .max_level = 3, 110 - }, 111 - { 112 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 113 - .max_width = 4096, 114 - .max_height = 4096, 115 - .max_pixels_per_frame = 4096 * 4096, 116 - .max_level = 5, 117 - }, 118 - { 119 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 120 - .max_width = 4096, 121 - .max_height = 4096, 122 - .max_pixels_per_frame = 4096 * 4096, 123 - .max_level = 52, 124 - }, 125 - { 126 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 127 - .max_width = 4096, 128 - .max_height = 4096, 129 - .max_pixels_per_frame = 4096 * 4096, 130 - .max_level = 4, 131 - }, 132 - { 133 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 134 - .max_width = 4096, 135 - .max_height = 4096, 136 - .max_pixels_per_frame = 4096 * 4096, 137 - .max_level = 186, 138 - }, 139 - { 140 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 141 - .max_width = 4096, 142 - .max_height = 4096, 143 - .max_pixels_per_frame = 4096 * 4096, 144 - .max_level = 0, 145 - }, 116 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 117 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 118 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 119 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 120 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 186)}, 121 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 146 122 }; 147 123 148 124 static const struct amdgpu_video_codecs vega_video_codecs_decode = ··· 118 166 /* Raven */ 119 167 static const struct amdgpu_video_codec_info rv_video_codecs_decode_array[] = 120 168 { 121 - { 122 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 123 - .max_width = 4096, 124 - .max_height = 4096, 125 - .max_pixels_per_frame = 4096 * 4096, 126 - .max_level = 3, 127 - }, 128 - { 129 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 130 - .max_width = 4096, 131 - .max_height = 4096, 132 - .max_pixels_per_frame = 4096 * 4096, 133 - .max_level = 5, 134 - }, 135 - { 136 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 137 - .max_width = 4096, 138 - .max_height = 4096, 139 - .max_pixels_per_frame = 4096 * 4096, 140 - .max_level = 52, 141 - }, 142 - { 143 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 144 - .max_width = 4096, 145 - .max_height = 4096, 146 - .max_pixels_per_frame = 4096 * 4096, 147 - .max_level = 4, 148 - }, 149 - { 150 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 151 - .max_width = 4096, 152 - .max_height = 4096, 153 - .max_pixels_per_frame = 4096 * 4096, 154 - .max_level = 186, 155 - }, 156 - { 157 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 158 - .max_width = 4096, 159 - .max_height = 4096, 160 - .max_pixels_per_frame = 4096 * 4096, 161 - .max_level = 0, 162 - }, 163 - { 164 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 165 - .max_width = 4096, 166 - .max_height = 4096, 167 - .max_pixels_per_frame = 4096 * 4096, 168 - .max_level = 0, 169 - }, 169 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 170 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 171 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 172 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 173 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 4096, 186)}, 174 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 175 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 4096, 4096, 0)}, 170 176 }; 171 177 172 178 static const struct amdgpu_video_codecs rv_video_codecs_decode = ··· 136 226 /* Renoir, Arcturus */ 137 227 static const struct amdgpu_video_codec_info rn_video_codecs_decode_array[] = 138 228 { 139 - { 140 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 141 - .max_width = 4096, 142 - .max_height = 4096, 143 - .max_pixels_per_frame = 4096 * 4096, 144 - .max_level = 3, 145 - }, 146 - { 147 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 148 - .max_width = 4096, 149 - .max_height = 4096, 150 - .max_pixels_per_frame = 4096 * 4096, 151 - .max_level = 5, 152 - }, 153 - { 154 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 155 - .max_width = 4096, 156 - .max_height = 4096, 157 - .max_pixels_per_frame = 4096 * 4096, 158 - .max_level = 52, 159 - }, 160 - { 161 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 162 - .max_width = 4096, 163 - .max_height = 4096, 164 - .max_pixels_per_frame = 4096 * 4096, 165 - .max_level = 4, 166 - }, 167 - { 168 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 169 - .max_width = 8192, 170 - .max_height = 4352, 171 - .max_pixels_per_frame = 4096 * 4096, 172 - .max_level = 186, 173 - }, 174 - { 175 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 176 - .max_width = 4096, 177 - .max_height = 4096, 178 - .max_pixels_per_frame = 4096 * 4096, 179 - .max_level = 0, 180 - }, 181 - { 182 - .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 183 - .max_width = 8192, 184 - .max_height = 4352, 185 - .max_pixels_per_frame = 4096 * 4096, 186 - .max_level = 0, 187 - }, 229 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2, 4096, 4906, 3)}, 230 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4, 4096, 4906, 5)}, 231 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 4906, 52)}, 232 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1, 4096, 4906, 4)}, 233 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 8192, 4352, 186)}, 234 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 4096, 4096, 0)}, 235 + {codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9, 8192, 4352, 0)}, 188 236 }; 189 237 190 238 static const struct amdgpu_video_codecs rn_video_codecs_decode =
+2 -2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 2429 2429 max_cll = conn_base->hdr_sink_metadata.hdmi_type1.max_cll; 2430 2430 min_cll = conn_base->hdr_sink_metadata.hdmi_type1.min_cll; 2431 2431 2432 - if (caps->ext_caps->bits.oled == 1 || 2432 + if (caps->ext_caps->bits.oled == 1 /*|| 2433 2433 caps->ext_caps->bits.sdr_aux_backlight_control == 1 || 2434 - caps->ext_caps->bits.hdr_aux_backlight_control == 1) 2434 + caps->ext_caps->bits.hdr_aux_backlight_control == 1*/) 2435 2435 caps->aux_support = true; 2436 2436 2437 2437 if (amdgpu_backlight == 0)
+1 -1
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c
··· 197 197 198 198 REG_UPDATE(DENTIST_DISPCLK_CNTL, 199 199 DENTIST_DISPCLK_WDIVIDER, dispclk_wdivider); 200 - // REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 5, 100); 200 + REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 50, 1000); 201 201 REG_UPDATE(DENTIST_DISPCLK_CNTL, 202 202 DENTIST_DPPCLK_WDIVIDER, dppclk_wdivider); 203 203 REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_CHG_DONE, 1, 5, 100);
+4
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c
··· 190 190 &clk_mgr_base->bw_params->clk_table.entries[0].dtbclk_mhz, 191 191 &num_levels); 192 192 193 + /* SOCCLK */ 194 + dcn3_init_single_clock(clk_mgr, PPCLK_SOCCLK, 195 + &clk_mgr_base->bw_params->clk_table.entries[0].socclk_mhz, 196 + &num_levels); 193 197 // DPREFCLK ??? 194 198 195 199 /* DISPCLK */
+50 -9
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
··· 48 48 49 49 #include "dc_dmub_srv.h" 50 50 51 + #include "yellow_carp_offset.h" 52 + 53 + #define regCLK1_CLK_PLL_REQ 0x0237 54 + #define regCLK1_CLK_PLL_REQ_BASE_IDX 0 55 + 56 + #define CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 57 + #define CLK1_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc 58 + #define CLK1_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 59 + #define CLK1_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL 60 + #define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L 61 + #define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L 62 + 63 + #define REG(reg_name) \ 64 + (CLK_BASE.instance[0].segment[reg ## reg_name ## _BASE_IDX] + reg ## reg_name) 65 + 51 66 #define TO_CLK_MGR_DCN31(clk_mgr)\ 52 67 container_of(clk_mgr, struct clk_mgr_dcn31, base) 53 68 ··· 139 124 * also if safe to lower is false, we just go in the higher state 140 125 */ 141 126 if (safe_to_lower) { 142 - if (new_clocks->z9_support == DCN_Z9_SUPPORT_ALLOW && 143 - new_clocks->z9_support != clk_mgr_base->clks.z9_support) { 127 + if (new_clocks->zstate_support == DCN_ZSTATE_SUPPORT_ALLOW && 128 + new_clocks->zstate_support != clk_mgr_base->clks.zstate_support) { 144 129 dcn31_smu_set_Z9_support(clk_mgr, true); 145 - clk_mgr_base->clks.z9_support = new_clocks->z9_support; 130 + clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; 146 131 } 147 132 148 133 if (clk_mgr_base->clks.dtbclk_en && !new_clocks->dtbclk_en) { ··· 163 148 } 164 149 } 165 150 } else { 166 - if (new_clocks->z9_support == DCN_Z9_SUPPORT_DISALLOW && 167 - new_clocks->z9_support != clk_mgr_base->clks.z9_support) { 151 + if (new_clocks->zstate_support == DCN_ZSTATE_SUPPORT_DISALLOW && 152 + new_clocks->zstate_support != clk_mgr_base->clks.zstate_support) { 168 153 dcn31_smu_set_Z9_support(clk_mgr, false); 169 - clk_mgr_base->clks.z9_support = new_clocks->z9_support; 154 + clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; 170 155 } 171 156 172 157 if (!clk_mgr_base->clks.dtbclk_en && new_clocks->dtbclk_en) { ··· 244 229 245 230 static int get_vco_frequency_from_reg(struct clk_mgr_internal *clk_mgr) 246 231 { 247 - return 0; 232 + /* get FbMult value */ 233 + struct fixed31_32 pll_req; 234 + unsigned int fbmult_frac_val = 0; 235 + unsigned int fbmult_int_val = 0; 236 + 237 + /* 238 + * Register value of fbmult is in 8.16 format, we are converting to 31.32 239 + * to leverage the fix point operations available in driver 240 + */ 241 + 242 + REG_GET(CLK1_CLK_PLL_REQ, FbMult_frac, &fbmult_frac_val); /* 16 bit fractional part*/ 243 + REG_GET(CLK1_CLK_PLL_REQ, FbMult_int, &fbmult_int_val); /* 8 bit integer part */ 244 + 245 + pll_req = dc_fixpt_from_int(fbmult_int_val); 246 + 247 + /* 248 + * since fractional part is only 16 bit in register definition but is 32 bit 249 + * in our fix point definiton, need to shift left by 16 to obtain correct value 250 + */ 251 + pll_req.value |= fbmult_frac_val << 16; 252 + 253 + /* multiply by REFCLK period */ 254 + pll_req = dc_fixpt_mul_int(pll_req, clk_mgr->dfs_ref_freq_khz); 255 + 256 + /* integer part is now VCO frequency in kHz */ 257 + return dc_fixpt_floor(pll_req); 248 258 } 249 259 250 260 static void dcn31_enable_pme_wa(struct clk_mgr *clk_mgr_base) ··· 286 246 clk_mgr->clks.p_state_change_support = true; 287 247 clk_mgr->clks.prev_p_state_change_support = true; 288 248 clk_mgr->clks.pwr_state = DCN_PWR_STATE_UNKNOWN; 289 - clk_mgr->clks.z9_support = DCN_Z9_SUPPORT_UNKNOWN; 249 + clk_mgr->clks.zstate_support = DCN_ZSTATE_SUPPORT_UNKNOWN; 290 250 } 291 251 292 252 static bool dcn31_are_clock_states_equal(struct dc_clocks *a, ··· 300 260 return false; 301 261 else if (a->dcfclk_deep_sleep_khz != b->dcfclk_deep_sleep_khz) 302 262 return false; 303 - else if (a->z9_support != b->z9_support) 263 + else if (a->zstate_support != b->zstate_support) 304 264 return false; 305 265 else if (a->dtbclk_en != b->dtbclk_en) 306 266 return false; ··· 632 592 clk_mgr->base.dprefclk_ss_percentage = 0; 633 593 clk_mgr->base.dprefclk_ss_divider = 1000; 634 594 clk_mgr->base.ss_on_dprefclk = false; 595 + clk_mgr->base.dfs_ref_freq_khz = 48000; 635 596 636 597 clk_mgr->smu_wm_set.wm_set = (struct dcn31_watermarks *)dm_helpers_allocate_gpu_mem( 637 598 clk_mgr->base.base.ctx,
-54
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.h
··· 27 27 #define __DCN31_CLK_MGR_H__ 28 28 #include "clk_mgr_internal.h" 29 29 30 - //CLK1_CLK_PLL_REQ 31 - #ifndef CLK11_CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 32 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 33 - #define CLK11_CLK1_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc 34 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 35 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL 36 - #define CLK11_CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L 37 - #define CLK11_CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L 38 - //CLK1_CLK0_DFS_CNTL 39 - #define CLK11_CLK1_CLK0_DFS_CNTL__CLK0_DIVIDER__SHIFT 0x0 40 - #define CLK11_CLK1_CLK0_DFS_CNTL__CLK0_DIVIDER_MASK 0x0000007FL 41 - /*DPREF clock related*/ 42 - #define CLK0_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 43 - #define CLK0_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 44 - #define CLK1_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 45 - #define CLK1_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 46 - #define CLK2_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 47 - #define CLK2_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 48 - #define CLK3_CLK3_DFS_CNTL__CLK3_DIVIDER__SHIFT 0x0 49 - #define CLK3_CLK3_DFS_CNTL__CLK3_DIVIDER_MASK 0x0000007FL 50 - 51 - //CLK3_0_CLK3_CLK_PLL_REQ 52 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 53 - #define CLK3_0_CLK3_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc 54 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 55 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL 56 - #define CLK3_0_CLK3_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L 57 - #define CLK3_0_CLK3_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L 58 - 59 - #define mmCLK0_CLK3_DFS_CNTL 0x16C60 60 - #define mmCLK00_CLK0_CLK3_DFS_CNTL 0x16C60 61 - #define mmCLK01_CLK0_CLK3_DFS_CNTL 0x16E60 62 - #define mmCLK02_CLK0_CLK3_DFS_CNTL 0x17060 63 - #define mmCLK03_CLK0_CLK3_DFS_CNTL 0x17260 64 - 65 - #define mmCLK0_CLK_PLL_REQ 0x16C10 66 - #define mmCLK00_CLK0_CLK_PLL_REQ 0x16C10 67 - #define mmCLK01_CLK0_CLK_PLL_REQ 0x16E10 68 - #define mmCLK02_CLK0_CLK_PLL_REQ 0x17010 69 - #define mmCLK03_CLK0_CLK_PLL_REQ 0x17210 70 - 71 - #define mmCLK1_CLK_PLL_REQ 0x1B00D 72 - #define mmCLK10_CLK1_CLK_PLL_REQ 0x1B00D 73 - #define mmCLK11_CLK1_CLK_PLL_REQ 0x1B20D 74 - #define mmCLK12_CLK1_CLK_PLL_REQ 0x1B40D 75 - #define mmCLK13_CLK1_CLK_PLL_REQ 0x1B60D 76 - 77 - #define mmCLK2_CLK_PLL_REQ 0x17E0D 78 - 79 - /*AMCLK*/ 80 - #define mmCLK11_CLK1_CLK0_DFS_CNTL 0x1B23F 81 - #define mmCLK11_CLK1_CLK_PLL_REQ 0x1B20D 82 - #endif 83 - 84 30 struct dcn31_watermarks; 85 31 86 32 struct dcn31_smu_watermark_set {
+1 -1
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1062 1062 * so use only 30 bpp on DCE_VERSION_11_0. Testing with DCE 11.2 and 8.3 1063 1063 * did not show such problems, so this seems to be the exception. 1064 1064 */ 1065 - if (plane_state->ctx->dce_version != DCE_VERSION_11_0) 1065 + if (plane_state->ctx->dce_version > DCE_VERSION_11_0) 1066 1066 pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_36BPP; 1067 1067 else 1068 1068 pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_30BPP;
+5 -5
drivers/gpu/drm/amd/display/dc/dc.h
··· 354 354 }; 355 355 356 356 #if defined(CONFIG_DRM_AMD_DC_DCN) 357 - enum dcn_z9_support_state { 358 - DCN_Z9_SUPPORT_UNKNOWN, 359 - DCN_Z9_SUPPORT_ALLOW, 360 - DCN_Z9_SUPPORT_DISALLOW, 357 + enum dcn_zstate_support_state { 358 + DCN_ZSTATE_SUPPORT_UNKNOWN, 359 + DCN_ZSTATE_SUPPORT_ALLOW, 360 + DCN_ZSTATE_SUPPORT_DISALLOW, 361 361 }; 362 362 #endif 363 363 /* ··· 378 378 int dramclk_khz; 379 379 bool p_state_change_support; 380 380 #if defined(CONFIG_DRM_AMD_DC_DCN) 381 - enum dcn_z9_support_state z9_support; 381 + enum dcn_zstate_support_state zstate_support; 382 382 bool dtbclk_en; 383 383 #endif 384 384 enum dcn_pwr_state pwr_state;
+3 -1
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h
··· 636 636 uint32_t ODM_MEM_PWR_CTRL3; 637 637 uint32_t DMU_MEM_PWR_CNTL; 638 638 uint32_t MMHUBBUB_MEM_PWR_CNTL; 639 + uint32_t DCHUBBUB_ARB_HOSTVM_CNTL; 639 640 }; 640 641 /* set field name */ 641 642 #define HWS_SF(blk_name, reg_name, field_name, post_fix)\ ··· 1111 1110 type DOMAIN_POWER_FORCEON;\ 1112 1111 type DOMAIN_POWER_GATE;\ 1113 1112 type DOMAIN_PGFSM_PWR_STATUS;\ 1114 - type HPO_HDMISTREAMCLK_G_GATE_DIS; 1113 + type HPO_HDMISTREAMCLK_G_GATE_DIS;\ 1114 + type DISABLE_HOSTVM_FORCE_ALLOW_PSTATE; 1115 1115 1116 1116 struct dce_hwseq_shift { 1117 1117 HWSEQ_REG_FIELD_LIST(uint8_t)
+6 -1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c
··· 217 217 const struct line_buffer_params *lb_params, 218 218 enum lb_memory_config mem_size_config) 219 219 { 220 + uint32_t max_partitions = 63; /* Currently hardcoded on all ASICs before DCN 3.2 */ 221 + 220 222 /* LB */ 221 223 if (dpp->base.caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT) { 222 224 /* DSCL caps: pixel data processed in fixed format */ ··· 241 239 LB_DATA_FORMAT__ALPHA_EN, lb_params->alpha_en); /* Alpha enable */ 242 240 } 243 241 242 + if (dpp->base.caps->max_lb_partitions == 31) 243 + max_partitions = 31; 244 + 244 245 REG_SET_2(LB_MEMORY_CTRL, 0, 245 246 MEMORY_CONFIG, mem_size_config, 246 - LB_MAX_PARTITIONS, 63); 247 + LB_MAX_PARTITIONS, max_partitions); 247 248 } 248 249 249 250 static const uint16_t *dpp1_dscl_get_filter_coeffs_64p(int taps, struct fixed31_32 ratio)
+36 -14
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
··· 2093 2093 - timing->v_border_bottom; 2094 2094 pipes[pipe_cnt].pipe.dest.htotal = timing->h_total; 2095 2095 pipes[pipe_cnt].pipe.dest.vtotal = v_total; 2096 - pipes[pipe_cnt].pipe.dest.hactive = timing->h_addressable; 2097 - pipes[pipe_cnt].pipe.dest.vactive = timing->v_addressable; 2096 + pipes[pipe_cnt].pipe.dest.hactive = 2097 + timing->h_addressable + timing->h_border_left + timing->h_border_right; 2098 + pipes[pipe_cnt].pipe.dest.vactive = 2099 + timing->v_addressable + timing->v_border_top + timing->v_border_bottom; 2098 2100 pipes[pipe_cnt].pipe.dest.interlaced = timing->flags.INTERLACE; 2099 2101 pipes[pipe_cnt].pipe.dest.pixel_rate_mhz = timing->pix_clk_100hz/10000.0; 2100 2102 if (timing->timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING) ··· 3081 3079 return false; 3082 3080 } 3083 3081 3082 + static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, struct dc_state *context) 3083 + { 3084 + int plane_count; 3085 + int i; 3086 + 3087 + plane_count = 0; 3088 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 3089 + if (context->res_ctx.pipe_ctx[i].plane_state) 3090 + plane_count++; 3091 + } 3092 + 3093 + /* 3094 + * Zstate is allowed in following scenarios: 3095 + * 1. Single eDP with PSR enabled 3096 + * 2. 0 planes (No memory requests) 3097 + * 3. Single eDP without PSR but > 5ms stutter period 3098 + */ 3099 + if (plane_count == 0) 3100 + return DCN_ZSTATE_SUPPORT_ALLOW; 3101 + else if (context->stream_count == 1 && context->streams[0]->signal == SIGNAL_TYPE_EDP) { 3102 + struct dc_link *link = context->streams[0]->sink->link; 3103 + 3104 + if ((link->link_index == 0 && link->psr_settings.psr_feature_enabled) 3105 + || context->bw_ctx.dml.vba.StutterPeriod > 5000.0) 3106 + return DCN_ZSTATE_SUPPORT_ALLOW; 3107 + else 3108 + return DCN_ZSTATE_SUPPORT_DISALLOW; 3109 + } else 3110 + return DCN_ZSTATE_SUPPORT_DISALLOW; 3111 + } 3112 + 3084 3113 void dcn20_calculate_dlg_params( 3085 3114 struct dc *dc, struct dc_state *context, 3086 3115 display_e2e_pipe_params_st *pipes, ··· 3119 3086 int vlevel) 3120 3087 { 3121 3088 int i, pipe_idx; 3122 - int plane_count; 3123 3089 3124 3090 /* Writeback MCIF_WB arbitration parameters */ 3125 3091 dc->res_pool->funcs->set_mcif_arb_params(dc, context, pipes, pipe_cnt); ··· 3134 3102 != dm_dram_clock_change_unsupported; 3135 3103 context->bw_ctx.bw.dcn.clk.dppclk_khz = 0; 3136 3104 3137 - context->bw_ctx.bw.dcn.clk.z9_support = (context->bw_ctx.dml.vba.StutterPeriod > 5000.0) ? 3138 - DCN_Z9_SUPPORT_ALLOW : DCN_Z9_SUPPORT_DISALLOW; 3139 - 3140 - plane_count = 0; 3141 - for (i = 0; i < dc->res_pool->pipe_count; i++) { 3142 - if (context->res_ctx.pipe_ctx[i].plane_state) 3143 - plane_count++; 3144 - } 3145 - 3146 - if (plane_count == 0) 3147 - context->bw_ctx.bw.dcn.clk.z9_support = DCN_Z9_SUPPORT_ALLOW; 3105 + context->bw_ctx.bw.dcn.clk.zstate_support = decide_zstate_support(dc, context); 3148 3106 3149 3107 context->bw_ctx.bw.dcn.clk.dtbclk_en = is_dtbclk_required(dc, context); 3150 3108
+1
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
··· 109 109 .max_page_table_levels = 4, 110 110 .pte_chunk_size_kbytes = 2, 111 111 .meta_chunk_size_kbytes = 2, 112 + .min_meta_chunk_size_bytes = 256, 112 113 .writeback_chunk_size_kbytes = 2, 113 114 .line_buffer_size_bits = 789504, 114 115 .is_line_buffer_bpp_fixed = 0,
-16
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.c
··· 383 383 int min_taps_y, min_taps_c; 384 384 enum lb_memory_config lb_config; 385 385 386 - /* Some ASICs does not support FP16 scaling, so we reject modes require this*/ 387 - if (scl_data->viewport.width != scl_data->h_active && 388 - scl_data->viewport.height != scl_data->v_active && 389 - dpp->caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT && 390 - scl_data->format == PIXEL_FORMAT_FP16) 391 - return false; 392 - 393 386 if (scl_data->viewport.width > scl_data->h_active && 394 387 dpp->ctx->dc->debug.max_downscale_src_width != 0 && 395 388 scl_data->viewport.width > dpp->ctx->dc->debug.max_downscale_src_width) ··· 1432 1439 dpp->tf_regs = tf_regs; 1433 1440 dpp->tf_shift = tf_shift; 1434 1441 dpp->tf_mask = tf_mask; 1435 - 1436 - dpp->lb_pixel_depth_supported = 1437 - LB_PIXEL_DEPTH_18BPP | 1438 - LB_PIXEL_DEPTH_24BPP | 1439 - LB_PIXEL_DEPTH_30BPP | 1440 - LB_PIXEL_DEPTH_36BPP; 1441 - 1442 - dpp->lb_bits_per_entry = LB_BITS_PER_ENTRY; 1443 - dpp->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x1404*/ 1444 1442 1445 1443 return true; 1446 1444 }
+1 -2
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp.h
··· 154 154 SRI(COLOR_KEYER_BLUE, CNVC_CFG, id), \ 155 155 SRI(CURSOR_CONTROL, CURSOR0_, id),\ 156 156 SRI(OBUF_MEM_PWR_CTRL, DSCL, id),\ 157 + SRI(DSCL_MEM_PWR_STATUS, DSCL, id), \ 157 158 SRI(DSCL_MEM_PWR_CTRL, DSCL, id) 158 159 159 160 #define DPP_REG_LIST_DCN30(id)\ ··· 164 163 SRI(CM_SHAPER_LUT_DATA, CM, id),\ 165 164 SRI(CM_MEM_PWR_CTRL2, CM, id), \ 166 165 SRI(CM_MEM_PWR_STATUS2, CM, id), \ 167 - SRI(DSCL_MEM_PWR_STATUS, DSCL, id), \ 168 - SRI(DSCL_MEM_PWR_CTRL, DSCL, id), \ 169 166 SRI(CM_BLNDGAM_RAMA_START_SLOPE_CNTL_B, CM, id),\ 170 167 SRI(CM_BLNDGAM_RAMA_START_SLOPE_CNTL_G, CM, id),\ 171 168 SRI(CM_BLNDGAM_RAMA_START_SLOPE_CNTL_R, CM, id),\
+10 -3
drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c
··· 1398 1398 dcn3_02_soc.clock_limits[i].dispclk_mhz = max_dispclk_mhz; 1399 1399 dcn3_02_soc.clock_limits[i].dppclk_mhz = max_dppclk_mhz; 1400 1400 dcn3_02_soc.clock_limits[i].phyclk_mhz = max_phyclk_mhz; 1401 - dcn3_02_soc.clock_limits[i].dtbclk_mhz = dcn3_02_soc.clock_limits[0].dtbclk_mhz; 1401 + /* Populate from bw_params for DTBCLK, SOCCLK */ 1402 + if (!bw_params->clk_table.entries[i].dtbclk_mhz && i > 0) 1403 + dcn3_02_soc.clock_limits[i].dtbclk_mhz = dcn3_02_soc.clock_limits[i-1].dtbclk_mhz; 1404 + else 1405 + dcn3_02_soc.clock_limits[i].dtbclk_mhz = bw_params->clk_table.entries[i].dtbclk_mhz; 1406 + if (!bw_params->clk_table.entries[i].socclk_mhz && i > 0) 1407 + dcn3_02_soc.clock_limits[i].socclk_mhz = dcn3_02_soc.clock_limits[i-1].socclk_mhz; 1408 + else 1409 + dcn3_02_soc.clock_limits[i].socclk_mhz = bw_params->clk_table.entries[i].socclk_mhz; 1402 1410 /* These clocks cannot come from bw_params, always fill from dcn3_02_soc[1] */ 1403 - /* FCLK, PHYCLK_D18, SOCCLK, DSCCLK */ 1411 + /* FCLK, PHYCLK_D18, DSCCLK */ 1404 1412 dcn3_02_soc.clock_limits[i].phyclk_d18_mhz = dcn3_02_soc.clock_limits[0].phyclk_d18_mhz; 1405 - dcn3_02_soc.clock_limits[i].socclk_mhz = dcn3_02_soc.clock_limits[0].socclk_mhz; 1406 1413 dcn3_02_soc.clock_limits[i].dscclk_mhz = dcn3_02_soc.clock_limits[0].dscclk_mhz; 1407 1414 } 1408 1415 /* re-init DML with updated bb */
+10 -3
drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c
··· 1326 1326 dcn3_03_soc.clock_limits[i].dispclk_mhz = max_dispclk_mhz; 1327 1327 dcn3_03_soc.clock_limits[i].dppclk_mhz = max_dppclk_mhz; 1328 1328 dcn3_03_soc.clock_limits[i].phyclk_mhz = max_phyclk_mhz; 1329 - dcn3_03_soc.clock_limits[i].dtbclk_mhz = dcn3_03_soc.clock_limits[0].dtbclk_mhz; 1329 + /* Populate from bw_params for DTBCLK, SOCCLK */ 1330 + if (!bw_params->clk_table.entries[i].dtbclk_mhz && i > 0) 1331 + dcn3_03_soc.clock_limits[i].dtbclk_mhz = dcn3_03_soc.clock_limits[i-1].dtbclk_mhz; 1332 + else 1333 + dcn3_03_soc.clock_limits[i].dtbclk_mhz = bw_params->clk_table.entries[i].dtbclk_mhz; 1334 + if (!bw_params->clk_table.entries[i].socclk_mhz && i > 0) 1335 + dcn3_03_soc.clock_limits[i].socclk_mhz = dcn3_03_soc.clock_limits[i-1].socclk_mhz; 1336 + else 1337 + dcn3_03_soc.clock_limits[i].socclk_mhz = bw_params->clk_table.entries[i].socclk_mhz; 1330 1338 /* These clocks cannot come from bw_params, always fill from dcn3_03_soc[1] */ 1331 - /* FCLK, PHYCLK_D18, SOCCLK, DSCCLK */ 1339 + /* FCLK, PHYCLK_D18, DSCCLK */ 1332 1340 dcn3_03_soc.clock_limits[i].phyclk_d18_mhz = dcn3_03_soc.clock_limits[0].phyclk_d18_mhz; 1333 - dcn3_03_soc.clock_limits[i].socclk_mhz = dcn3_03_soc.clock_limits[0].socclk_mhz; 1334 1341 dcn3_03_soc.clock_limits[i].dscclk_mhz = dcn3_03_soc.clock_limits[0].dscclk_mhz; 1335 1342 } 1336 1343 /* re-init DML with updated bb */
+18
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c
··· 47 47 #include "dce/dmub_outbox.h" 48 48 #include "dc_link_dp.h" 49 49 #include "inc/link_dpcd.h" 50 + #include "dcn10/dcn10_hw_sequencer.h" 50 51 51 52 #define DC_LOGGER_INIT(logger) 52 53 ··· 594 593 return true; 595 594 } 596 595 return false; 596 + } 597 + 598 + static void apply_riommu_invalidation_wa(struct dc *dc) 599 + { 600 + struct dce_hwseq *hws = dc->hwseq; 601 + 602 + if (!hws->wa.early_riommu_invalidation) 603 + return; 604 + 605 + REG_UPDATE(DCHUBBUB_ARB_HOSTVM_CNTL, DISABLE_HOSTVM_FORCE_ALLOW_PSTATE, 0); 606 + } 607 + 608 + void dcn31_init_pipes(struct dc *dc, struct dc_state *context) 609 + { 610 + dcn10_init_pipes(dc, context); 611 + apply_riommu_invalidation_wa(dc); 612 + 597 613 }
+1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.h
··· 52 52 struct dc_state *context); 53 53 bool dcn31_is_abm_supported(struct dc *dc, 54 54 struct dc_state *context, struct dc_stream_state *stream); 55 + void dcn31_init_pipes(struct dc *dc, struct dc_state *context); 55 56 56 57 #endif /* __DC_HWSS_DCN31_H__ */
+1 -2
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c
··· 93 93 .set_flip_control_gsl = dcn20_set_flip_control_gsl, 94 94 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, 95 95 .calc_vupdate_position = dcn10_calc_vupdate_position, 96 - .apply_idle_power_optimizations = dcn30_apply_idle_power_optimizations, 97 96 .set_backlight_level = dcn21_set_backlight_level, 98 97 .set_abm_immediate_disable = dcn21_set_abm_immediate_disable, 99 98 .set_pipe = dcn21_set_pipe, ··· 103 104 }; 104 105 105 106 static const struct hwseq_private_funcs dcn31_private_funcs = { 106 - .init_pipes = dcn10_init_pipes, 107 + .init_pipes = dcn31_init_pipes, 107 108 .update_plane_addr = dcn20_update_plane_addr, 108 109 .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, 109 110 .update_mpcc = dcn20_update_mpcc,
+4
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
··· 220 220 .sr_exit_z8_time_us = 402.0, 221 221 .sr_enter_plus_exit_z8_time_us = 520.0, 222 222 .writeback_latency_us = 12.0, 223 + .dram_channel_width_bytes = 4, 223 224 .round_trip_ping_latency_dcfclk_cycles = 106, 224 225 .urgent_latency_pixel_data_only_us = 4.0, 225 226 .urgent_latency_pixel_mixed_with_vm_data_us = 4.0, ··· 742 741 743 742 #define HWSEQ_DCN31_REG_LIST()\ 744 743 SR(DCHUBBUB_GLOBAL_TIMER_CNTL), \ 744 + SR(DCHUBBUB_ARB_HOSTVM_CNTL), \ 745 745 SR(DIO_MEM_PWR_CTRL), \ 746 746 SR(ODM_MEM_PWR_CTRL3), \ 747 747 SR(DMU_MEM_PWR_CNTL), \ ··· 803 801 #define HWSEQ_DCN31_MASK_SH_LIST(mask_sh)\ 804 802 HWSEQ_DCN_MASK_SH_LIST(mask_sh), \ 805 803 HWS_SF(, DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, mask_sh), \ 804 + HWS_SF(, DCHUBBUB_ARB_HOSTVM_CNTL, DISABLE_HOSTVM_FORCE_ALLOW_PSTATE, mask_sh), \ 806 805 HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN_POWER_FORCEON, mask_sh), \ 807 806 HWS_SF(, DOMAIN0_PG_CONFIG, DOMAIN_POWER_GATE, mask_sh), \ 808 807 HWS_SF(, DOMAIN1_PG_CONFIG, DOMAIN_POWER_FORCEON, mask_sh), \ ··· 1302 1299 hws->regs = &hwseq_reg; 1303 1300 hws->shifts = &hwseq_shift; 1304 1301 hws->masks = &hwseq_mask; 1302 + hws->wa.early_riommu_invalidation = true; 1305 1303 } 1306 1304 return hws; 1307 1305 }
+4 -1
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
··· 841 841 else 842 842 *DestinationLinesForPrefetch = dst_y_prefetch_equ; 843 843 844 + // Limit to prevent overflow in DST_Y_PREFETCH register 845 + *DestinationLinesForPrefetch = dml_min(*DestinationLinesForPrefetch, 63.75); 846 + 844 847 dml_print("DML: VStartup: %d\n", VStartup); 845 848 dml_print("DML: TCalc: %f\n", TCalc); 846 849 dml_print("DML: TWait: %f\n", TWait); ··· 4892 4889 } 4893 4890 } while ((locals->PrefetchSupported[i][j] != true || locals->VRatioInPrefetchSupported[i][j] != true) 4894 4891 && (mode_lib->vba.NextMaxVStartup != mode_lib->vba.MaxMaxVStartup[0][0] 4895 - || mode_lib->vba.NextPrefetchMode < mode_lib->vba.MaxPrefetchMode)); 4892 + || mode_lib->vba.NextPrefetchMode <= mode_lib->vba.MaxPrefetchMode)); 4896 4893 4897 4894 if (locals->PrefetchSupported[i][j] == true && locals->VRatioInPrefetchSupported[i][j] == true) { 4898 4895 mode_lib->vba.BandwidthAvailableForImmediateFlip = locals->ReturnBWPerState[i][0];
+3
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
··· 289 289 /* DSCL processing pixel data in fixed or float format */ 290 290 enum dscl_data_processing_format dscl_data_proc_format; 291 291 292 + /* max LB partitions */ 293 + unsigned int max_lb_partitions; 294 + 292 295 /* Calculates the number of partitions in the line buffer. 293 296 * The implementation of this function is overloaded for 294 297 * different versions of DSCL LB.
+1
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h
··· 41 41 bool DEGVIDCN10_254; 42 42 bool DEGVIDCN21; 43 43 bool disallow_self_refresh_during_multi_plane_transition; 44 + bool early_riommu_invalidation; 44 45 }; 45 46 46 47 struct hwseq_wa_state {
+2 -1
drivers/gpu/drm/amd/pm/inc/aldebaran_ppsmc.h
··· 101 101 #define PPSMC_MSG_SetSystemVirtualSTBtoDramAddrLow 0x41 102 102 103 103 #define PPSMC_MSG_GfxDriverResetRecovery 0x42 104 - #define PPSMC_Message_Count 0x43 104 + #define PPSMC_MSG_BoardPowerCalibration 0x43 105 + #define PPSMC_Message_Count 0x44 105 106 106 107 //PPSMC Reset Types 107 108 #define PPSMC_RESET_TYPE_WARM_RESET 0x00
+2 -1
drivers/gpu/drm/amd/pm/inc/smu_types.h
··· 225 225 __SMU_DUMMY_MAP(DisableDeterminism), \ 226 226 __SMU_DUMMY_MAP(SetUclkDpmMode), \ 227 227 __SMU_DUMMY_MAP(LightSBR), \ 228 - __SMU_DUMMY_MAP(GfxDriverResetRecovery), 228 + __SMU_DUMMY_MAP(GfxDriverResetRecovery), \ 229 + __SMU_DUMMY_MAP(BoardPowerCalibration), 229 230 230 231 #undef __SMU_DUMMY_MAP 231 232 #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
+1 -1
drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
··· 34 34 #define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0xE 35 35 #define SMU11_DRIVER_IF_VERSION_VANGOGH 0x03 36 36 #define SMU11_DRIVER_IF_VERSION_Dimgrey_Cavefish 0xF 37 - #define SMU11_DRIVER_IF_VERSION_Beige_Goby 0x9 37 + #define SMU11_DRIVER_IF_VERSION_Beige_Goby 0xD 38 38 39 39 /* MP Apertures */ 40 40 #define MP0_Public 0x03800000
+36 -10
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
··· 134 134 MSG_MAP(DisableDeterminism, PPSMC_MSG_DisableDeterminism, 0), 135 135 MSG_MAP(SetUclkDpmMode, PPSMC_MSG_SetUclkDpmMode, 0), 136 136 MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0), 137 + MSG_MAP(BoardPowerCalibration, PPSMC_MSG_BoardPowerCalibration, 0), 137 138 }; 138 139 139 140 static const struct cmn2asic_mapping aldebaran_clk_map[SMU_CLK_COUNT] = { ··· 441 440 return ret; 442 441 } 443 442 443 + static bool aldebaran_is_primary(struct smu_context *smu) 444 + { 445 + struct amdgpu_device *adev = smu->adev; 446 + 447 + if (adev->smuio.funcs && adev->smuio.funcs->get_die_id) 448 + return adev->smuio.funcs->get_die_id(adev) == 0; 449 + 450 + return true; 451 + } 452 + 453 + static int aldebaran_run_board_btc(struct smu_context *smu) 454 + { 455 + u32 smu_version; 456 + int ret; 457 + 458 + if (!aldebaran_is_primary(smu)) 459 + return 0; 460 + 461 + ret = smu_cmn_get_smc_version(smu, NULL, &smu_version); 462 + if (ret) { 463 + dev_err(smu->adev->dev, "Failed to get smu version!\n"); 464 + return ret; 465 + } 466 + if (smu_version <= 0x00441d00) 467 + return 0; 468 + 469 + ret = smu_cmn_send_smc_msg(smu, SMU_MSG_BoardPowerCalibration, NULL); 470 + if (ret) 471 + dev_err(smu->adev->dev, "Board power calibration failed!\n"); 472 + 473 + return ret; 474 + } 475 + 444 476 static int aldebaran_run_btc(struct smu_context *smu) 445 477 { 446 478 int ret; ··· 481 447 ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL); 482 448 if (ret) 483 449 dev_err(smu->adev->dev, "RunDcBtc failed!\n"); 450 + else 451 + ret = aldebaran_run_board_btc(smu); 484 452 485 453 return ret; 486 454 } ··· 558 522 int32_t frequency2) 559 523 { 560 524 return (abs(frequency1 - frequency2) <= EPSILON); 561 - } 562 - 563 - static bool aldebaran_is_primary(struct smu_context *smu) 564 - { 565 - struct amdgpu_device *adev = smu->adev; 566 - 567 - if (adev->smuio.funcs && adev->smuio.funcs->get_die_id) 568 - return adev->smuio.funcs->get_die_id(adev) == 0; 569 - 570 - return true; 571 525 } 572 526 573 527 static int aldebaran_get_smu_metrics_data(struct smu_context *smu,
+3
drivers/gpu/drm/drm_ioctl.c
··· 834 834 if (drm_dev_is_unplugged(dev)) 835 835 return -ENODEV; 836 836 837 + if (DRM_IOCTL_TYPE(cmd) != DRM_IOCTL_BASE) 838 + return -ENOTTY; 839 + 837 840 is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END; 838 841 839 842 if (is_driver_ioctl) {
+2 -1
drivers/gpu/drm/i915/display/intel_bios.c
··· 2166 2166 init_vbt_missing_defaults(struct drm_i915_private *i915) 2167 2167 { 2168 2168 enum port port; 2169 - int ports = PORT_A | PORT_B | PORT_C | PORT_D | PORT_E | PORT_F; 2169 + int ports = BIT(PORT_A) | BIT(PORT_B) | BIT(PORT_C) | 2170 + BIT(PORT_D) | BIT(PORT_E) | BIT(PORT_F); 2170 2171 2171 2172 if (!HAS_DDI(i915) && !IS_CHERRYVIEW(i915)) 2172 2173 return;
+7 -1
drivers/gpu/drm/i915/display/intel_display.c
··· 11361 11361 intel_ddi_init(dev_priv, PORT_B); 11362 11362 intel_ddi_init(dev_priv, PORT_C); 11363 11363 vlv_dsi_init(dev_priv); 11364 - } else if (DISPLAY_VER(dev_priv) >= 9) { 11364 + } else if (DISPLAY_VER(dev_priv) == 10) { 11365 11365 intel_ddi_init(dev_priv, PORT_A); 11366 11366 intel_ddi_init(dev_priv, PORT_B); 11367 11367 intel_ddi_init(dev_priv, PORT_C); 11368 11368 intel_ddi_init(dev_priv, PORT_D); 11369 11369 intel_ddi_init(dev_priv, PORT_E); 11370 11370 intel_ddi_init(dev_priv, PORT_F); 11371 + } else if (DISPLAY_VER(dev_priv) >= 9) { 11372 + intel_ddi_init(dev_priv, PORT_A); 11373 + intel_ddi_init(dev_priv, PORT_B); 11374 + intel_ddi_init(dev_priv, PORT_C); 11375 + intel_ddi_init(dev_priv, PORT_D); 11376 + intel_ddi_init(dev_priv, PORT_E); 11371 11377 } else if (HAS_DDI(dev_priv)) { 11372 11378 u32 found; 11373 11379
+13 -214
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 25 25 #include "i915_gem_clflush.h" 26 26 #include "i915_gem_context.h" 27 27 #include "i915_gem_ioctls.h" 28 - #include "i915_sw_fence_work.h" 29 28 #include "i915_trace.h" 30 29 #include "i915_user_extensions.h" 31 - #include "i915_memcpy.h" 32 30 33 31 struct eb_vma { 34 32 struct i915_vma *vma; ··· 1454 1456 int err; 1455 1457 struct intel_engine_cs *engine = eb->engine; 1456 1458 1459 + /* If we need to copy for the cmdparser, we will stall anyway */ 1460 + if (eb_use_cmdparser(eb)) 1461 + return ERR_PTR(-EWOULDBLOCK); 1462 + 1457 1463 if (!reloc_can_use_engine(engine)) { 1458 1464 engine = engine->gt->engine_class[COPY_ENGINE_CLASS][0]; 1459 1465 if (!engine) ··· 2374 2372 return vma; 2375 2373 } 2376 2374 2377 - struct eb_parse_work { 2378 - struct dma_fence_work base; 2379 - struct intel_engine_cs *engine; 2380 - struct i915_vma *batch; 2381 - struct i915_vma *shadow; 2382 - struct i915_vma *trampoline; 2383 - unsigned long batch_offset; 2384 - unsigned long batch_length; 2385 - unsigned long *jump_whitelist; 2386 - const void *batch_map; 2387 - void *shadow_map; 2388 - }; 2389 - 2390 - static int __eb_parse(struct dma_fence_work *work) 2391 - { 2392 - struct eb_parse_work *pw = container_of(work, typeof(*pw), base); 2393 - int ret; 2394 - bool cookie; 2395 - 2396 - cookie = dma_fence_begin_signalling(); 2397 - ret = intel_engine_cmd_parser(pw->engine, 2398 - pw->batch, 2399 - pw->batch_offset, 2400 - pw->batch_length, 2401 - pw->shadow, 2402 - pw->jump_whitelist, 2403 - pw->shadow_map, 2404 - pw->batch_map); 2405 - dma_fence_end_signalling(cookie); 2406 - 2407 - return ret; 2408 - } 2409 - 2410 - static void __eb_parse_release(struct dma_fence_work *work) 2411 - { 2412 - struct eb_parse_work *pw = container_of(work, typeof(*pw), base); 2413 - 2414 - if (!IS_ERR_OR_NULL(pw->jump_whitelist)) 2415 - kfree(pw->jump_whitelist); 2416 - 2417 - if (pw->batch_map) 2418 - i915_gem_object_unpin_map(pw->batch->obj); 2419 - else 2420 - i915_gem_object_unpin_pages(pw->batch->obj); 2421 - 2422 - i915_gem_object_unpin_map(pw->shadow->obj); 2423 - 2424 - if (pw->trampoline) 2425 - i915_active_release(&pw->trampoline->active); 2426 - i915_active_release(&pw->shadow->active); 2427 - i915_active_release(&pw->batch->active); 2428 - } 2429 - 2430 - static const struct dma_fence_work_ops eb_parse_ops = { 2431 - .name = "eb_parse", 2432 - .work = __eb_parse, 2433 - .release = __eb_parse_release, 2434 - }; 2435 - 2436 - static inline int 2437 - __parser_mark_active(struct i915_vma *vma, 2438 - struct intel_timeline *tl, 2439 - struct dma_fence *fence) 2440 - { 2441 - struct intel_gt_buffer_pool_node *node = vma->private; 2442 - 2443 - return i915_active_ref(&node->active, tl->fence_context, fence); 2444 - } 2445 - 2446 - static int 2447 - parser_mark_active(struct eb_parse_work *pw, struct intel_timeline *tl) 2448 - { 2449 - int err; 2450 - 2451 - mutex_lock(&tl->mutex); 2452 - 2453 - err = __parser_mark_active(pw->shadow, tl, &pw->base.dma); 2454 - if (err) 2455 - goto unlock; 2456 - 2457 - if (pw->trampoline) { 2458 - err = __parser_mark_active(pw->trampoline, tl, &pw->base.dma); 2459 - if (err) 2460 - goto unlock; 2461 - } 2462 - 2463 - unlock: 2464 - mutex_unlock(&tl->mutex); 2465 - return err; 2466 - } 2467 - 2468 - static int eb_parse_pipeline(struct i915_execbuffer *eb, 2469 - struct i915_vma *shadow, 2470 - struct i915_vma *trampoline) 2471 - { 2472 - struct eb_parse_work *pw; 2473 - struct drm_i915_gem_object *batch = eb->batch->vma->obj; 2474 - bool needs_clflush; 2475 - int err; 2476 - 2477 - GEM_BUG_ON(overflows_type(eb->batch_start_offset, pw->batch_offset)); 2478 - GEM_BUG_ON(overflows_type(eb->batch_len, pw->batch_length)); 2479 - 2480 - pw = kzalloc(sizeof(*pw), GFP_KERNEL); 2481 - if (!pw) 2482 - return -ENOMEM; 2483 - 2484 - err = i915_active_acquire(&eb->batch->vma->active); 2485 - if (err) 2486 - goto err_free; 2487 - 2488 - err = i915_active_acquire(&shadow->active); 2489 - if (err) 2490 - goto err_batch; 2491 - 2492 - if (trampoline) { 2493 - err = i915_active_acquire(&trampoline->active); 2494 - if (err) 2495 - goto err_shadow; 2496 - } 2497 - 2498 - pw->shadow_map = i915_gem_object_pin_map(shadow->obj, I915_MAP_WB); 2499 - if (IS_ERR(pw->shadow_map)) { 2500 - err = PTR_ERR(pw->shadow_map); 2501 - goto err_trampoline; 2502 - } 2503 - 2504 - needs_clflush = 2505 - !(batch->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ); 2506 - 2507 - pw->batch_map = ERR_PTR(-ENODEV); 2508 - if (needs_clflush && i915_has_memcpy_from_wc()) 2509 - pw->batch_map = i915_gem_object_pin_map(batch, I915_MAP_WC); 2510 - 2511 - if (IS_ERR(pw->batch_map)) { 2512 - err = i915_gem_object_pin_pages(batch); 2513 - if (err) 2514 - goto err_unmap_shadow; 2515 - pw->batch_map = NULL; 2516 - } 2517 - 2518 - pw->jump_whitelist = 2519 - intel_engine_cmd_parser_alloc_jump_whitelist(eb->batch_len, 2520 - trampoline); 2521 - if (IS_ERR(pw->jump_whitelist)) { 2522 - err = PTR_ERR(pw->jump_whitelist); 2523 - goto err_unmap_batch; 2524 - } 2525 - 2526 - dma_fence_work_init(&pw->base, &eb_parse_ops); 2527 - 2528 - pw->engine = eb->engine; 2529 - pw->batch = eb->batch->vma; 2530 - pw->batch_offset = eb->batch_start_offset; 2531 - pw->batch_length = eb->batch_len; 2532 - pw->shadow = shadow; 2533 - pw->trampoline = trampoline; 2534 - 2535 - /* Mark active refs early for this worker, in case we get interrupted */ 2536 - err = parser_mark_active(pw, eb->context->timeline); 2537 - if (err) 2538 - goto err_commit; 2539 - 2540 - err = dma_resv_reserve_shared(pw->batch->resv, 1); 2541 - if (err) 2542 - goto err_commit; 2543 - 2544 - err = dma_resv_reserve_shared(shadow->resv, 1); 2545 - if (err) 2546 - goto err_commit; 2547 - 2548 - /* Wait for all writes (and relocs) into the batch to complete */ 2549 - err = i915_sw_fence_await_reservation(&pw->base.chain, 2550 - pw->batch->resv, NULL, false, 2551 - 0, I915_FENCE_GFP); 2552 - if (err < 0) 2553 - goto err_commit; 2554 - 2555 - /* Keep the batch alive and unwritten as we parse */ 2556 - dma_resv_add_shared_fence(pw->batch->resv, &pw->base.dma); 2557 - 2558 - /* Force execution to wait for completion of the parser */ 2559 - dma_resv_add_excl_fence(shadow->resv, &pw->base.dma); 2560 - 2561 - dma_fence_work_commit_imm(&pw->base); 2562 - return 0; 2563 - 2564 - err_commit: 2565 - i915_sw_fence_set_error_once(&pw->base.chain, err); 2566 - dma_fence_work_commit_imm(&pw->base); 2567 - return err; 2568 - 2569 - err_unmap_batch: 2570 - if (pw->batch_map) 2571 - i915_gem_object_unpin_map(batch); 2572 - else 2573 - i915_gem_object_unpin_pages(batch); 2574 - err_unmap_shadow: 2575 - i915_gem_object_unpin_map(shadow->obj); 2576 - err_trampoline: 2577 - if (trampoline) 2578 - i915_active_release(&trampoline->active); 2579 - err_shadow: 2580 - i915_active_release(&shadow->active); 2581 - err_batch: 2582 - i915_active_release(&eb->batch->vma->active); 2583 - err_free: 2584 - kfree(pw); 2585 - return err; 2586 - } 2587 - 2588 2375 static struct i915_vma *eb_dispatch_secure(struct i915_execbuffer *eb, struct i915_vma *vma) 2589 2376 { 2590 2377 /* ··· 2463 2672 goto err_trampoline; 2464 2673 } 2465 2674 2466 - err = eb_parse_pipeline(eb, shadow, trampoline); 2675 + err = dma_resv_reserve_shared(shadow->resv, 1); 2676 + if (err) 2677 + goto err_trampoline; 2678 + 2679 + err = intel_engine_cmd_parser(eb->engine, 2680 + eb->batch->vma, 2681 + eb->batch_start_offset, 2682 + eb->batch_len, 2683 + shadow, trampoline); 2467 2684 if (err) 2468 2685 goto err_unpin_batch; 2469 2686
+4
drivers/gpu/drm/i915/gem/selftests/i915_gem_execbuffer.c
··· 125 125 intel_gt_pm_get(&eb.i915->gt); 126 126 127 127 for_each_uabi_engine(eb.engine, eb.i915) { 128 + if (intel_engine_requires_cmd_parser(eb.engine) || 129 + intel_engine_using_cmd_parser(eb.engine)) 130 + continue; 131 + 128 132 reloc_cache_init(&eb.reloc_cache, eb.i915); 129 133 memset(map, POISON_INUSE, 4096); 130 134
+15
drivers/gpu/drm/i915/gvt/handlers.c
··· 1977 1977 if (drm_WARN_ON(&i915->drm, !engine)) 1978 1978 return -EINVAL; 1979 1979 1980 + /* 1981 + * Due to d3_entered is used to indicate skipping PPGTT invalidation on 1982 + * vGPU reset, it's set on D0->D3 on PCI config write, and cleared after 1983 + * vGPU reset if in resuming. 1984 + * In S0ix exit, the device power state also transite from D3 to D0 as 1985 + * S3 resume, but no vGPU reset (triggered by QEMU devic model). After 1986 + * S0ix exit, all engines continue to work. However the d3_entered 1987 + * remains set which will break next vGPU reset logic (miss the expected 1988 + * PPGTT invalidation). 1989 + * Engines can only work in D0. Thus the 1st elsp write gives GVT a 1990 + * chance to clear d3_entered. 1991 + */ 1992 + if (vgpu->d3_entered) 1993 + vgpu->d3_entered = false; 1994 + 1980 1995 execlist = &vgpu->submission.execlist[engine->id]; 1981 1996 1982 1997 execlist->elsp_dwords.data[3 - execlist->elsp_dwords.index] = data;
+71 -59
drivers/gpu/drm/i915/i915_cmd_parser.c
··· 1145 1145 static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, 1146 1146 struct drm_i915_gem_object *src_obj, 1147 1147 unsigned long offset, unsigned long length, 1148 - void *dst, const void *src) 1148 + bool *needs_clflush_after) 1149 1149 { 1150 - bool needs_clflush = 1151 - !(src_obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ); 1150 + unsigned int src_needs_clflush; 1151 + unsigned int dst_needs_clflush; 1152 + void *dst, *src; 1153 + int ret; 1152 1154 1153 - if (src) { 1154 - GEM_BUG_ON(!needs_clflush); 1155 - i915_unaligned_memcpy_from_wc(dst, src + offset, length); 1156 - } else { 1157 - struct scatterlist *sg; 1155 + ret = i915_gem_object_prepare_write(dst_obj, &dst_needs_clflush); 1156 + if (ret) 1157 + return ERR_PTR(ret); 1158 + 1159 + dst = i915_gem_object_pin_map(dst_obj, I915_MAP_WB); 1160 + i915_gem_object_finish_access(dst_obj); 1161 + if (IS_ERR(dst)) 1162 + return dst; 1163 + 1164 + ret = i915_gem_object_prepare_read(src_obj, &src_needs_clflush); 1165 + if (ret) { 1166 + i915_gem_object_unpin_map(dst_obj); 1167 + return ERR_PTR(ret); 1168 + } 1169 + 1170 + src = ERR_PTR(-ENODEV); 1171 + if (src_needs_clflush && i915_has_memcpy_from_wc()) { 1172 + src = i915_gem_object_pin_map(src_obj, I915_MAP_WC); 1173 + if (!IS_ERR(src)) { 1174 + i915_unaligned_memcpy_from_wc(dst, 1175 + src + offset, 1176 + length); 1177 + i915_gem_object_unpin_map(src_obj); 1178 + } 1179 + } 1180 + if (IS_ERR(src)) { 1181 + unsigned long x, n, remain; 1158 1182 void *ptr; 1159 - unsigned int x, sg_ofs; 1160 - unsigned long remain; 1161 1183 1162 1184 /* 1163 1185 * We can avoid clflushing partial cachelines before the write ··· 1190 1168 * validate up to the end of the batch. 1191 1169 */ 1192 1170 remain = length; 1193 - if (!(dst_obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ)) 1171 + if (dst_needs_clflush & CLFLUSH_BEFORE) 1194 1172 remain = round_up(remain, 1195 1173 boot_cpu_data.x86_clflush_size); 1196 1174 1197 1175 ptr = dst; 1198 1176 x = offset_in_page(offset); 1199 - sg = i915_gem_object_get_sg(src_obj, offset >> PAGE_SHIFT, &sg_ofs, false); 1177 + for (n = offset >> PAGE_SHIFT; remain; n++) { 1178 + int len = min(remain, PAGE_SIZE - x); 1200 1179 1201 - while (remain) { 1202 - unsigned long sg_max = sg->length >> PAGE_SHIFT; 1180 + src = kmap_atomic(i915_gem_object_get_page(src_obj, n)); 1181 + if (src_needs_clflush) 1182 + drm_clflush_virt_range(src + x, len); 1183 + memcpy(ptr, src + x, len); 1184 + kunmap_atomic(src); 1203 1185 1204 - for (; remain && sg_ofs < sg_max; sg_ofs++) { 1205 - unsigned long len = min(remain, PAGE_SIZE - x); 1206 - void *map; 1207 - 1208 - map = kmap_atomic(nth_page(sg_page(sg), sg_ofs)); 1209 - if (needs_clflush) 1210 - drm_clflush_virt_range(map + x, len); 1211 - memcpy(ptr, map + x, len); 1212 - kunmap_atomic(map); 1213 - 1214 - ptr += len; 1215 - remain -= len; 1216 - x = 0; 1217 - } 1218 - 1219 - sg_ofs = 0; 1220 - sg = sg_next(sg); 1186 + ptr += len; 1187 + remain -= len; 1188 + x = 0; 1221 1189 } 1222 1190 } 1191 + 1192 + i915_gem_object_finish_access(src_obj); 1223 1193 1224 1194 memset32(dst + length, 0, (dst_obj->base.size - length) / sizeof(u32)); 1225 1195 1226 1196 /* dst_obj is returned with vmap pinned */ 1197 + *needs_clflush_after = dst_needs_clflush & CLFLUSH_AFTER; 1198 + 1227 1199 return dst; 1228 1200 } 1229 1201 ··· 1376 1360 if (target_cmd_index == offset) 1377 1361 return 0; 1378 1362 1363 + if (IS_ERR(jump_whitelist)) 1364 + return PTR_ERR(jump_whitelist); 1365 + 1379 1366 if (!test_bit(target_cmd_index, jump_whitelist)) { 1380 1367 DRM_DEBUG("CMD: BB_START to 0x%llx not a previously executed cmd\n", 1381 1368 jump_target); ··· 1388 1369 return 0; 1389 1370 } 1390 1371 1391 - /** 1392 - * intel_engine_cmd_parser_alloc_jump_whitelist() - preallocate jump whitelist for intel_engine_cmd_parser() 1393 - * @batch_length: length of the commands in batch_obj 1394 - * @trampoline: Whether jump trampolines are used. 1395 - * 1396 - * Preallocates a jump whitelist for parsing the cmd buffer in intel_engine_cmd_parser(). 1397 - * This has to be preallocated, because the command parser runs in signaling context, 1398 - * and may not allocate any memory. 1399 - * 1400 - * Return: NULL or pointer to a jump whitelist, or ERR_PTR() on failure. Use 1401 - * IS_ERR() to check for errors. Must bre freed() with kfree(). 1402 - * 1403 - * NULL is a valid value, meaning no allocation was required. 1404 - */ 1405 - unsigned long *intel_engine_cmd_parser_alloc_jump_whitelist(u32 batch_length, 1406 - bool trampoline) 1372 + static unsigned long *alloc_whitelist(u32 batch_length) 1407 1373 { 1408 1374 unsigned long *jmp; 1409 - 1410 - if (trampoline) 1411 - return NULL; 1412 1375 1413 1376 /* 1414 1377 * We expect batch_length to be less than 256KiB for known users, ··· 1416 1415 * @batch_offset: byte offset in the batch at which execution starts 1417 1416 * @batch_length: length of the commands in batch_obj 1418 1417 * @shadow: validated copy of the batch buffer in question 1419 - * @jump_whitelist: buffer preallocated with intel_engine_cmd_parser_alloc_jump_whitelist() 1420 - * @shadow_map: mapping to @shadow vma 1421 - * @batch_map: mapping to @batch vma 1418 + * @trampoline: true if we need to trampoline into privileged execution 1422 1419 * 1423 1420 * Parses the specified batch buffer looking for privilege violations as 1424 1421 * described in the overview. ··· 1424 1425 * Return: non-zero if the parser finds violations or otherwise fails; -EACCES 1425 1426 * if the batch appears legal but should use hardware parsing 1426 1427 */ 1428 + 1427 1429 int intel_engine_cmd_parser(struct intel_engine_cs *engine, 1428 1430 struct i915_vma *batch, 1429 1431 unsigned long batch_offset, 1430 1432 unsigned long batch_length, 1431 1433 struct i915_vma *shadow, 1432 - unsigned long *jump_whitelist, 1433 - void *shadow_map, 1434 - const void *batch_map) 1434 + bool trampoline) 1435 1435 { 1436 1436 u32 *cmd, *batch_end, offset = 0; 1437 1437 struct drm_i915_cmd_descriptor default_desc = noop_desc; 1438 1438 const struct drm_i915_cmd_descriptor *desc = &default_desc; 1439 + bool needs_clflush_after = false; 1440 + unsigned long *jump_whitelist; 1439 1441 u64 batch_addr, shadow_addr; 1440 1442 int ret = 0; 1441 - bool trampoline = !jump_whitelist; 1442 1443 1443 1444 GEM_BUG_ON(!IS_ALIGNED(batch_offset, sizeof(*cmd))); 1444 1445 GEM_BUG_ON(!IS_ALIGNED(batch_length, sizeof(*cmd))); ··· 1446 1447 batch->size)); 1447 1448 GEM_BUG_ON(!batch_length); 1448 1449 1449 - cmd = copy_batch(shadow->obj, batch->obj, batch_offset, batch_length, 1450 - shadow_map, batch_map); 1450 + cmd = copy_batch(shadow->obj, batch->obj, 1451 + batch_offset, batch_length, 1452 + &needs_clflush_after); 1453 + if (IS_ERR(cmd)) { 1454 + DRM_DEBUG("CMD: Failed to copy batch\n"); 1455 + return PTR_ERR(cmd); 1456 + } 1457 + 1458 + jump_whitelist = NULL; 1459 + if (!trampoline) 1460 + /* Defer failure until attempted use */ 1461 + jump_whitelist = alloc_whitelist(batch_length); 1451 1462 1452 1463 shadow_addr = gen8_canonical_addr(shadow->node.start); 1453 1464 batch_addr = gen8_canonical_addr(batch->node.start + batch_offset); ··· 1558 1549 1559 1550 i915_gem_object_flush_map(shadow->obj); 1560 1551 1552 + if (!IS_ERR_OR_NULL(jump_whitelist)) 1553 + kfree(jump_whitelist); 1554 + i915_gem_object_unpin_map(shadow->obj); 1561 1555 return ret; 1562 1556 } 1563 1557
+1 -6
drivers/gpu/drm/i915/i915_drv.h
··· 1906 1906 int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv); 1907 1907 int intel_engine_init_cmd_parser(struct intel_engine_cs *engine); 1908 1908 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine); 1909 - unsigned long *intel_engine_cmd_parser_alloc_jump_whitelist(u32 batch_length, 1910 - bool trampoline); 1911 - 1912 1909 int intel_engine_cmd_parser(struct intel_engine_cs *engine, 1913 1910 struct i915_vma *batch, 1914 1911 unsigned long batch_offset, 1915 1912 unsigned long batch_length, 1916 1913 struct i915_vma *shadow, 1917 - unsigned long *jump_whitelist, 1918 - void *shadow_map, 1919 - const void *batch_map); 1914 + bool trampoline); 1920 1915 #define I915_CMD_PARSER_TRAMPOLINE_SIZE 8 1921 1916 1922 1917 /* intel_device_info.c */
+2 -6
drivers/gpu/drm/i915/i915_request.c
··· 1426 1426 1427 1427 do { 1428 1428 fence = *child++; 1429 - if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { 1430 - i915_sw_fence_set_error_once(&rq->submit, fence->error); 1429 + if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 1431 1430 continue; 1432 - } 1433 1431 1434 1432 if (fence->context == rq->fence.context) 1435 1433 continue; ··· 1525 1527 1526 1528 do { 1527 1529 fence = *child++; 1528 - if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { 1529 - i915_sw_fence_set_error_once(&rq->submit, fence->error); 1530 + if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 1530 1531 continue; 1531 - } 1532 1532 1533 1533 /* 1534 1534 * Requests on the same timeline are explicitly ordered, along
+5 -4
drivers/gpu/drm/i915/intel_device_info.c
··· 325 325 info->pipe_mask &= ~BIT(PIPE_C); 326 326 info->cpu_transcoder_mask &= ~BIT(TRANSCODER_C); 327 327 } 328 - } else if (HAS_DISPLAY(dev_priv) && GRAPHICS_VER(dev_priv) >= 9) { 328 + } else if (HAS_DISPLAY(dev_priv) && DISPLAY_VER(dev_priv) >= 9) { 329 329 u32 dfsm = intel_de_read(dev_priv, SKL_DFSM); 330 330 331 331 if (dfsm & SKL_DFSM_PIPE_A_DISABLE) { ··· 340 340 info->pipe_mask &= ~BIT(PIPE_C); 341 341 info->cpu_transcoder_mask &= ~BIT(TRANSCODER_C); 342 342 } 343 - if (GRAPHICS_VER(dev_priv) >= 12 && 343 + 344 + if (DISPLAY_VER(dev_priv) >= 12 && 344 345 (dfsm & TGL_DFSM_PIPE_D_DISABLE)) { 345 346 info->pipe_mask &= ~BIT(PIPE_D); 346 347 info->cpu_transcoder_mask &= ~BIT(TRANSCODER_D); ··· 353 352 if (dfsm & SKL_DFSM_DISPLAY_PM_DISABLE) 354 353 info->display.has_fbc = 0; 355 354 356 - if (GRAPHICS_VER(dev_priv) >= 11 && (dfsm & ICL_DFSM_DMC_DISABLE)) 355 + if (DISPLAY_VER(dev_priv) >= 11 && (dfsm & ICL_DFSM_DMC_DISABLE)) 357 356 info->display.has_dmc = 0; 358 357 359 - if (GRAPHICS_VER(dev_priv) >= 10 && 358 + if (DISPLAY_VER(dev_priv) >= 10 && 360 359 (dfsm & CNL_DFSM_DISPLAY_DSC_DISABLE)) 361 360 info->display.has_dsc = 0; 362 361 }
+1 -1
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
··· 296 296 static const struct dpu_mdp_cfg sm8250_mdp[] = { 297 297 { 298 298 .name = "top_0", .id = MDP_TOP, 299 - .base = 0x0, .len = 0x45C, 299 + .base = 0x0, .len = 0x494, 300 300 .features = 0, 301 301 .highest_bank_bit = 0x3, /* TODO: 2 for LP_DDR4 */ 302 302 .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
+1
drivers/gpu/drm/msm/dp/dp_catalog.c
··· 771 771 dp_write_link(catalog, REG_DP_HSYNC_VSYNC_WIDTH_POLARITY, 772 772 dp_catalog->width_blanking); 773 773 dp_write_link(catalog, REG_DP_ACTIVE_HOR_VER, dp_catalog->dp_active); 774 + dp_write_p0(catalog, MMSS_DP_INTF_CONFIG, 0); 774 775 return 0; 775 776 } 776 777
+1 -1
drivers/gpu/drm/msm/dp/dp_ctrl.c
··· 1526 1526 * running. Add the global reset just before disabling the 1527 1527 * link clocks and core clocks. 1528 1528 */ 1529 - ret = dp_ctrl_off(&ctrl->dp_ctrl); 1529 + ret = dp_ctrl_off_link_stream(&ctrl->dp_ctrl); 1530 1530 if (ret) { 1531 1531 DRM_ERROR("failed to disable DP controller\n"); 1532 1532 return ret;
+5
drivers/gpu/drm/msm/dp/dp_display.c
··· 219 219 goto end; 220 220 } 221 221 222 + dp->aux->drm_dev = drm; 222 223 rc = dp_aux_register(dp->aux); 223 224 if (rc) { 224 225 DRM_ERROR("DRM DP AUX register failed\n"); ··· 1311 1310 dp->dp_display.is_connected = true; 1312 1311 else 1313 1312 dp->dp_display.is_connected = false; 1313 + 1314 + dp_display_handle_plugged_change(g_dp_display, 1315 + dp->dp_display.is_connected); 1316 + 1314 1317 1315 1318 mutex_unlock(&dp->event_mutex); 1316 1319
+10 -1
drivers/gpu/drm/msm/msm_iommu.c
··· 142 142 .tlb_add_page = msm_iommu_tlb_add_page, 143 143 }; 144 144 145 + static int msm_fault_handler(struct iommu_domain *domain, struct device *dev, 146 + unsigned long iova, int flags, void *arg); 147 + 145 148 struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent) 146 149 { 147 150 struct adreno_smmu_priv *adreno_smmu = dev_get_drvdata(parent->dev); ··· 159 156 ttbr1_cfg = adreno_smmu->get_ttbr1_cfg(adreno_smmu->cookie); 160 157 if (!ttbr1_cfg) 161 158 return ERR_PTR(-ENODEV); 159 + 160 + /* 161 + * Defer setting the fault handler until we have a valid adreno_smmu 162 + * to avoid accidentially installing a GPU specific fault handler for 163 + * the display's iommu 164 + */ 165 + iommu_set_fault_handler(iommu->domain, msm_fault_handler, iommu); 162 166 163 167 pagetable = kzalloc(sizeof(*pagetable), GFP_KERNEL); 164 168 if (!pagetable) ··· 310 300 311 301 iommu->domain = domain; 312 302 msm_mmu_init(&iommu->base, dev, &funcs, MSM_MMU_IOMMU); 313 - iommu_set_fault_handler(domain, msm_fault_handler, iommu); 314 303 315 304 atomic_set(&iommu->pagetables, 0); 316 305
+6
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 149 149 */ 150 150 if (bo->base.dev) 151 151 drm_gem_object_release(&bo->base); 152 + else 153 + dma_resv_fini(&bo->base._resv); 152 154 153 155 kfree(nvbo); 154 156 } ··· 331 329 tile_flags); 332 330 if (IS_ERR(nvbo)) 333 331 return PTR_ERR(nvbo); 332 + 333 + nvbo->bo.base.size = size; 334 + dma_resv_init(&nvbo->bo.base._resv); 335 + drm_vma_node_reset(&nvbo->bo.base.vma_node); 334 336 335 337 ret = nouveau_bo_init(nvbo, size, align, domain, sg, robj); 336 338 if (ret)
-1
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
··· 447 447 drm_panel_remove(&ts->base); 448 448 449 449 mipi_dsi_device_unregister(ts->dsi); 450 - kfree(ts->dsi); 451 450 452 451 return 0; 453 452 }
+1 -1
drivers/gpu/drm/panel/panel-simple.c
··· 4166 4166 static const struct panel_desc yes_optoelectronics_ytc700tlag_05_201c = { 4167 4167 .modes = &yes_optoelectronics_ytc700tlag_05_201c_mode, 4168 4168 .num_modes = 1, 4169 - .bpc = 6, 4169 + .bpc = 8, 4170 4170 .size = { 4171 4171 .width = 154, 4172 4172 .height = 90,
+3
drivers/gpu/drm/ttm/ttm_bo.c
··· 102 102 return; 103 103 } 104 104 105 + if (!mem) 106 + return; 107 + 105 108 man = ttm_manager_type(bdev, mem->mem_type); 106 109 list_move_tail(&bo->lru, &man->lru[bo->priority]); 107 110
+3
drivers/gpu/drm/ttm/ttm_bo_util.c
··· 63 63 void ttm_mem_io_free(struct ttm_device *bdev, 64 64 struct ttm_resource *mem) 65 65 { 66 + if (!mem) 67 + return; 68 + 66 69 if (!mem->bus.offset && !mem->bus.addr) 67 70 return; 68 71
+14
drivers/gpu/drm/ttm/ttm_device.c
··· 44 44 struct ttm_global ttm_glob; 45 45 EXPORT_SYMBOL(ttm_glob); 46 46 47 + struct dentry *ttm_debugfs_root; 48 + 47 49 static void ttm_global_release(void) 48 50 { 49 51 struct ttm_global *glob = &ttm_glob; ··· 55 53 goto out; 56 54 57 55 ttm_pool_mgr_fini(); 56 + debugfs_remove(ttm_debugfs_root); 58 57 59 58 __free_page(glob->dummy_read_page); 60 59 memset(glob, 0, sizeof(*glob)); ··· 75 72 goto out; 76 73 77 74 si_meminfo(&si); 75 + 76 + ttm_debugfs_root = debugfs_create_dir("ttm", NULL); 77 + if (IS_ERR(ttm_debugfs_root)) { 78 + ret = PTR_ERR(ttm_debugfs_root); 79 + ttm_debugfs_root = NULL; 80 + goto out; 81 + } 78 82 79 83 /* Limit the number of pages in the pool to about 50% of the total 80 84 * system memory. ··· 110 100 debugfs_create_atomic_t("buffer_objects", 0444, ttm_debugfs_root, 111 101 &glob->bo_count); 112 102 out: 103 + if (ret && ttm_debugfs_root) 104 + debugfs_remove(ttm_debugfs_root); 105 + if (ret) 106 + --ttm_glob_use_count; 113 107 mutex_unlock(&ttm_global_mutex); 114 108 return ret; 115 109 }
-16
drivers/gpu/drm/ttm/ttm_module.c
··· 72 72 return tmp; 73 73 } 74 74 75 - struct dentry *ttm_debugfs_root; 76 - 77 - static int __init ttm_init(void) 78 - { 79 - ttm_debugfs_root = debugfs_create_dir("ttm", NULL); 80 - return 0; 81 - } 82 - 83 - static void __exit ttm_exit(void) 84 - { 85 - debugfs_remove(ttm_debugfs_root); 86 - } 87 - 88 - module_init(ttm_init); 89 - module_exit(ttm_exit); 90 - 91 75 MODULE_AUTHOR("Thomas Hellstrom, Jerome Glisse"); 92 76 MODULE_DESCRIPTION("TTM memory manager subsystem (for DRM device)"); 93 77 MODULE_LICENSE("GPL and additional rights");
+33 -16
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 1857 1857 vc4_hdmi_cec_update_clk_div(vc4_hdmi); 1858 1858 1859 1859 if (vc4_hdmi->variant->external_irq_controller) { 1860 - ret = devm_request_threaded_irq(&pdev->dev, 1861 - platform_get_irq_byname(pdev, "cec-rx"), 1862 - vc4_cec_irq_handler_rx_bare, 1863 - vc4_cec_irq_handler_rx_thread, 0, 1864 - "vc4 hdmi cec rx", vc4_hdmi); 1860 + ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-rx"), 1861 + vc4_cec_irq_handler_rx_bare, 1862 + vc4_cec_irq_handler_rx_thread, 0, 1863 + "vc4 hdmi cec rx", vc4_hdmi); 1865 1864 if (ret) 1866 1865 goto err_delete_cec_adap; 1867 1866 1868 - ret = devm_request_threaded_irq(&pdev->dev, 1869 - platform_get_irq_byname(pdev, "cec-tx"), 1870 - vc4_cec_irq_handler_tx_bare, 1871 - vc4_cec_irq_handler_tx_thread, 0, 1872 - "vc4 hdmi cec tx", vc4_hdmi); 1867 + ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-tx"), 1868 + vc4_cec_irq_handler_tx_bare, 1869 + vc4_cec_irq_handler_tx_thread, 0, 1870 + "vc4 hdmi cec tx", vc4_hdmi); 1873 1871 if (ret) 1874 - goto err_delete_cec_adap; 1872 + goto err_remove_cec_rx_handler; 1875 1873 } else { 1876 1874 HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, 0xffffffff); 1877 1875 1878 - ret = devm_request_threaded_irq(&pdev->dev, platform_get_irq(pdev, 0), 1879 - vc4_cec_irq_handler, 1880 - vc4_cec_irq_handler_thread, 0, 1881 - "vc4 hdmi cec", vc4_hdmi); 1876 + ret = request_threaded_irq(platform_get_irq(pdev, 0), 1877 + vc4_cec_irq_handler, 1878 + vc4_cec_irq_handler_thread, 0, 1879 + "vc4 hdmi cec", vc4_hdmi); 1882 1880 if (ret) 1883 1881 goto err_delete_cec_adap; 1884 1882 } 1885 1883 1886 1884 ret = cec_register_adapter(vc4_hdmi->cec_adap, &pdev->dev); 1887 1885 if (ret < 0) 1888 - goto err_delete_cec_adap; 1886 + goto err_remove_handlers; 1889 1887 1890 1888 return 0; 1889 + 1890 + err_remove_handlers: 1891 + if (vc4_hdmi->variant->external_irq_controller) 1892 + free_irq(platform_get_irq_byname(pdev, "cec-tx"), vc4_hdmi); 1893 + else 1894 + free_irq(platform_get_irq(pdev, 0), vc4_hdmi); 1895 + 1896 + err_remove_cec_rx_handler: 1897 + if (vc4_hdmi->variant->external_irq_controller) 1898 + free_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_hdmi); 1891 1899 1892 1900 err_delete_cec_adap: 1893 1901 cec_delete_adapter(vc4_hdmi->cec_adap); ··· 1905 1897 1906 1898 static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi) 1907 1899 { 1900 + struct platform_device *pdev = vc4_hdmi->pdev; 1901 + 1902 + if (vc4_hdmi->variant->external_irq_controller) { 1903 + free_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_hdmi); 1904 + free_irq(platform_get_irq_byname(pdev, "cec-tx"), vc4_hdmi); 1905 + } else { 1906 + free_irq(platform_get_irq(pdev, 0), vc4_hdmi); 1907 + } 1908 + 1908 1909 cec_unregister_adapter(vc4_hdmi->cec_adap); 1909 1910 } 1910 1911 #else
+1 -1
drivers/hid/Kconfig
··· 576 576 depends on HID_LOGITECH 577 577 select POWER_SUPPLY 578 578 help 579 - Support for Logitech devices relyingon the HID++ Logitech specification 579 + Support for Logitech devices relying on the HID++ Logitech specification 580 580 581 581 Say Y if you want support for Logitech devices relying on the HID++ 582 582 specification. Such devices are the various Logitech Touchpads (T650,
+1 -1
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
··· 58 58 cmd_base.cmd_v2.sensor_id = sensor_idx; 59 59 cmd_base.cmd_v2.length = 16; 60 60 61 - writeq(0x0, privdata->mmio + AMD_C2P_MSG2); 61 + writeq(0x0, privdata->mmio + AMD_C2P_MSG1); 62 62 writel(cmd_base.ul, privdata->mmio + AMD_C2P_MSG0); 63 63 } 64 64
+2
drivers/hid/hid-apple.c
··· 501 501 APPLE_RDESC_JIS }, 502 502 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI), 503 503 .driver_data = APPLE_HAS_FN }, 504 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI), 505 + .driver_data = APPLE_HAS_FN }, 504 506 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO), 505 507 .driver_data = APPLE_HAS_FN }, 506 508 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO),
-3
drivers/hid/hid-asus.c
··· 485 485 { 486 486 struct asus_kbd_leds *led = container_of(led_cdev, struct asus_kbd_leds, 487 487 cdev); 488 - if (led->brightness == brightness) 489 - return; 490 - 491 488 led->brightness = brightness; 492 489 schedule_work(&led->work); 493 490 }
+9 -18
drivers/hid/hid-ft260.c
··· 742 742 int ret; 743 743 744 744 ret = ft260_get_system_config(hdev, &cfg); 745 - if (ret) 745 + if (ret < 0) 746 746 return ret; 747 747 748 748 ft260_dbg("interface: 0x%02x\n", interface); ··· 754 754 switch (cfg.chip_mode) { 755 755 case FT260_MODE_ALL: 756 756 case FT260_MODE_BOTH: 757 - if (interface == 1) { 757 + if (interface == 1) 758 758 hid_info(hdev, "uart interface is not supported\n"); 759 - return 0; 760 - } 761 - ret = 1; 759 + else 760 + ret = 1; 762 761 break; 763 762 case FT260_MODE_UART: 764 - if (interface == 0) { 765 - hid_info(hdev, "uart is unsupported on interface 0\n"); 766 - ret = 0; 767 - } 763 + hid_info(hdev, "uart interface is not supported\n"); 768 764 break; 769 765 case FT260_MODE_I2C: 770 - if (interface == 1) { 771 - hid_info(hdev, "i2c is unsupported on interface 1\n"); 772 - ret = 0; 773 - } 766 + ret = 1; 774 767 break; 775 768 } 776 769 return ret; ··· 778 785 if (ret < 0) 779 786 return ret; 780 787 781 - return scnprintf(buf, PAGE_SIZE, "%hi\n", *field); 788 + return scnprintf(buf, PAGE_SIZE, "%d\n", *field); 782 789 } 783 790 784 791 static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, ··· 790 797 if (ret < 0) 791 798 return ret; 792 799 793 - return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field)); 800 + return scnprintf(buf, PAGE_SIZE, "%d\n", le16_to_cpu(*field)); 794 801 } 795 802 796 803 #define FT260_ATTR_SHOW(name, reptype, id, type, func) \ ··· 997 1004 998 1005 static void ft260_remove(struct hid_device *hdev) 999 1006 { 1000 - int ret; 1001 1007 struct ft260_device *dev = hid_get_drvdata(hdev); 1002 1008 1003 - ret = ft260_is_interface_enabled(hdev); 1004 - if (ret <= 0) 1009 + if (!dev) 1005 1010 return; 1006 1011 1007 1012 sysfs_remove_group(&hdev->dev.kobj, &ft260_attr_group);
+14 -1
drivers/hid/intel-ish-hid/ishtp-hid-client.c
··· 784 784 } 785 785 } 786 786 787 + static void hid_ishtp_cl_resume_handler(struct work_struct *work) 788 + { 789 + struct ishtp_cl_data *client_data = container_of(work, struct ishtp_cl_data, resume_work); 790 + struct ishtp_cl *hid_ishtp_cl = client_data->hid_ishtp_cl; 791 + 792 + if (ishtp_wait_resume(ishtp_get_ishtp_device(hid_ishtp_cl))) { 793 + client_data->suspended = false; 794 + wake_up_interruptible(&client_data->ishtp_resume_wait); 795 + } 796 + } 797 + 787 798 ishtp_print_log ishtp_hid_print_trace; 788 799 789 800 /** ··· 833 822 init_waitqueue_head(&client_data->ishtp_resume_wait); 834 823 835 824 INIT_WORK(&client_data->work, hid_ishtp_cl_reset_handler); 825 + INIT_WORK(&client_data->resume_work, hid_ishtp_cl_resume_handler); 826 + 836 827 837 828 ishtp_hid_print_trace = ishtp_trace_callback(cl_device); 838 829 ··· 934 921 935 922 hid_ishtp_trace(client_data, "%s hid_ishtp_cl %p\n", __func__, 936 923 hid_ishtp_cl); 937 - client_data->suspended = false; 924 + schedule_work(&client_data->resume_work); 938 925 return 0; 939 926 } 940 927
+1
drivers/hid/intel-ish-hid/ishtp-hid.h
··· 135 135 int multi_packet_cnt; 136 136 137 137 struct work_struct work; 138 + struct work_struct resume_work; 138 139 struct ishtp_cl_device *cl_device; 139 140 }; 140 141
+22 -7
drivers/hid/intel-ish-hid/ishtp/bus.c
··· 314 314 if (!device) 315 315 return 0; 316 316 317 - /* 318 - * When ISH needs hard reset, it is done asynchrnously, hence bus 319 - * resume will be called before full ISH resume 320 - */ 321 - if (device->ishtp_dev->resume_flag) 322 - return 0; 323 - 324 317 driver = to_ishtp_cl_driver(dev->driver); 325 318 if (driver && driver->driver.pm) { 326 319 if (driver->driver.pm->resume) ··· 841 848 return &device->dev; 842 849 } 843 850 EXPORT_SYMBOL(ishtp_device); 851 + 852 + /** 853 + * ishtp_wait_resume() - Wait for IPC resume 854 + * 855 + * Wait for IPC resume 856 + * 857 + * Return: resume complete or not 858 + */ 859 + bool ishtp_wait_resume(struct ishtp_device *dev) 860 + { 861 + /* 50ms to get resume response */ 862 + #define WAIT_FOR_RESUME_ACK_MS 50 863 + 864 + /* Waiting to get resume response */ 865 + if (dev->resume_flag) 866 + wait_event_interruptible_timeout(dev->resume_wait, 867 + !dev->resume_flag, 868 + msecs_to_jiffies(WAIT_FOR_RESUME_ACK_MS)); 869 + 870 + return (!dev->resume_flag); 871 + } 872 + EXPORT_SYMBOL_GPL(ishtp_wait_resume); 844 873 845 874 /** 846 875 * ishtp_get_pci_device() - Return PCI device dev pointer
+1 -1
drivers/hid/usbhid/Kconfig
··· 38 38 help 39 39 Say Y here if you want to support HID devices (from the USB 40 40 specification standpoint) that aren't strictly user interface 41 - devices, like monitor controls and Uninterruptable Power Supplies. 41 + devices, like monitor controls and Uninterruptible Power Supplies. 42 42 43 43 This module supports these devices separately using a separate 44 44 event interface on /dev/usb/hiddevX (char 180:96 to 180:111).
+4 -1
drivers/hid/wacom_wac.c
··· 2548 2548 int slot; 2549 2549 2550 2550 slot = input_mt_get_slot_by_key(input, hid_data->id); 2551 + if (slot < 0) 2552 + return; 2553 + 2551 2554 input_mt_slot(input, slot); 2552 2555 input_mt_report_slot_state(input, MT_TOOL_FINGER, prox); 2553 2556 } ··· 3834 3831 wacom_wac->shared->touch->product == 0xF6) { 3835 3832 input_dev->evbit[0] |= BIT_MASK(EV_SW); 3836 3833 __set_bit(SW_MUTE_DEVICE, input_dev->swbit); 3837 - wacom_wac->shared->has_mute_touch_switch = true; 3834 + wacom_wac->has_mute_touch_switch = true; 3838 3835 } 3839 3836 fallthrough; 3840 3837
+2 -2
drivers/i2c/busses/i2c-mpc.c
··· 635 635 636 636 status = readb(i2c->base + MPC_I2C_SR); 637 637 if (status & CSR_MIF) { 638 - /* Read again to allow register to stabilise */ 639 - status = readb(i2c->base + MPC_I2C_SR); 638 + /* Wait up to 100us for transfer to properly complete */ 639 + readb_poll_timeout(i2c->base + MPC_I2C_SR, status, !(status & CSR_MCF), 0, 100); 640 640 writeb(0, i2c->base + MPC_I2C_SR); 641 641 mpc_i2c_do_intr(i2c, status); 642 642 return IRQ_HANDLED;
+3 -1
drivers/infiniband/hw/bnxt_re/main.c
··· 120 120 if (!chip_ctx) 121 121 return -ENOMEM; 122 122 chip_ctx->chip_num = bp->chip_num; 123 + chip_ctx->hw_stats_size = bp->hw_ring_stats_size; 123 124 124 125 rdev->chip_ctx = chip_ctx; 125 126 /* rest members to follow eventually */ ··· 551 550 dma_addr_t dma_map, 552 551 u32 *fw_stats_ctx_id) 553 552 { 553 + struct bnxt_qplib_chip_ctx *chip_ctx = rdev->chip_ctx; 554 554 struct hwrm_stat_ctx_alloc_output resp = {0}; 555 555 struct hwrm_stat_ctx_alloc_input req = {0}; 556 556 struct bnxt_en_dev *en_dev = rdev->en_dev; ··· 568 566 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); 569 567 req.update_period_ms = cpu_to_le32(1000); 570 568 req.stats_dma_addr = cpu_to_le64(dma_map); 571 - req.stats_dma_length = cpu_to_le16(sizeof(struct ctx_hw_stats_ext)); 569 + req.stats_dma_length = cpu_to_le16(chip_ctx->hw_stats_size); 572 570 req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE; 573 571 bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, 574 572 sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
+4 -6
drivers/infiniband/hw/bnxt_re/qplib_res.c
··· 56 56 static void bnxt_qplib_free_stats_ctx(struct pci_dev *pdev, 57 57 struct bnxt_qplib_stats *stats); 58 58 static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev, 59 + struct bnxt_qplib_chip_ctx *cctx, 59 60 struct bnxt_qplib_stats *stats); 60 61 61 62 /* PBL */ ··· 560 559 goto fail; 561 560 stats_alloc: 562 561 /* Stats */ 563 - rc = bnxt_qplib_alloc_stats_ctx(res->pdev, &ctx->stats); 562 + rc = bnxt_qplib_alloc_stats_ctx(res->pdev, res->cctx, &ctx->stats); 564 563 if (rc) 565 564 goto fail; 566 565 ··· 890 889 } 891 890 892 891 static int bnxt_qplib_alloc_stats_ctx(struct pci_dev *pdev, 892 + struct bnxt_qplib_chip_ctx *cctx, 893 893 struct bnxt_qplib_stats *stats) 894 894 { 895 895 memset(stats, 0, sizeof(*stats)); 896 896 stats->fw_id = -1; 897 - /* 128 byte aligned context memory is required only for 57500. 898 - * However making this unconditional, it does not harm previous 899 - * generation. 900 - */ 901 - stats->size = ALIGN(sizeof(struct ctx_hw_stats), 128); 897 + stats->size = cctx->hw_stats_size; 902 898 stats->dma = dma_alloc_coherent(&pdev->dev, stats->size, 903 899 &stats->dma_map, GFP_KERNEL); 904 900 if (!stats->dma) {
+1
drivers/infiniband/hw/bnxt_re/qplib_res.h
··· 54 54 u16 chip_num; 55 55 u8 chip_rev; 56 56 u8 chip_metal; 57 + u16 hw_stats_size; 57 58 struct bnxt_qplib_drv_modes modes; 58 59 }; 59 60
+5 -8
drivers/infiniband/hw/irdma/ctrl.c
··· 2845 2845 * parses fpm commit info and copy base value 2846 2846 * of hmc objects in hmc_info 2847 2847 */ 2848 - static enum irdma_status_code 2848 + static void 2849 2849 irdma_sc_parse_fpm_commit_buf(struct irdma_sc_dev *dev, __le64 *buf, 2850 2850 struct irdma_hmc_obj_info *info, u32 *sd) 2851 2851 { ··· 2915 2915 else 2916 2916 *sd = (u32)(size >> 21); 2917 2917 2918 - return 0; 2919 2918 } 2920 2919 2921 2920 /** ··· 4186 4187 * @dev: sc device struct 4187 4188 * @count: allocate count 4188 4189 */ 4189 - enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count) 4190 + void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count) 4190 4191 { 4191 4192 writel(count, dev->hw_regs[IRDMA_AEQALLOC]); 4192 - 4193 - return 0; 4194 4193 } 4195 4194 4196 4195 /** ··· 4431 4434 ret_code = irdma_sc_commit_fpm_val(dev->cqp, 0, hmc_info->hmc_fn_id, 4432 4435 &commit_fpm_mem, true, wait_type); 4433 4436 if (!ret_code) 4434 - ret_code = irdma_sc_parse_fpm_commit_buf(dev, dev->fpm_commit_buf, 4435 - hmc_info->hmc_obj, 4436 - &hmc_info->sd_table.sd_cnt); 4437 + irdma_sc_parse_fpm_commit_buf(dev, dev->fpm_commit_buf, 4438 + hmc_info->hmc_obj, 4439 + &hmc_info->sd_table.sd_cnt); 4437 4440 print_hex_dump_debug("HMC: COMMIT FPM BUFFER", DUMP_PREFIX_OFFSET, 16, 4438 4441 8, commit_fpm_mem.va, IRDMA_COMMIT_FPM_BUF_SIZE, 4439 4442 false);
+2 -9
drivers/infiniband/hw/irdma/hw.c
··· 1920 1920 * irdma_set_hw_rsrc - set hw memory resources. 1921 1921 * @rf: RDMA PCI function 1922 1922 */ 1923 - static u32 irdma_set_hw_rsrc(struct irdma_pci_f *rf) 1923 + static void irdma_set_hw_rsrc(struct irdma_pci_f *rf) 1924 1924 { 1925 1925 rf->allocated_qps = (void *)(rf->mem_rsrc + 1926 1926 (sizeof(struct irdma_arp_entry) * rf->arp_table_size)); ··· 1937 1937 spin_lock_init(&rf->arp_lock); 1938 1938 spin_lock_init(&rf->qptable_lock); 1939 1939 spin_lock_init(&rf->qh_list_lock); 1940 - 1941 - return 0; 1942 1940 } 1943 1941 1944 1942 /** ··· 1998 2000 1999 2001 rf->arp_table = (struct irdma_arp_entry *)rf->mem_rsrc; 2000 2002 2001 - ret = irdma_set_hw_rsrc(rf); 2002 - if (ret) 2003 - goto set_hw_rsrc_fail; 2003 + irdma_set_hw_rsrc(rf); 2004 2004 2005 2005 set_bit(0, rf->allocated_mrs); 2006 2006 set_bit(0, rf->allocated_qps); ··· 2021 2025 2022 2026 return 0; 2023 2027 2024 - set_hw_rsrc_fail: 2025 - kfree(rf->mem_rsrc); 2026 - rf->mem_rsrc = NULL; 2027 2028 mem_rsrc_kzalloc_fail: 2028 2029 kfree(rf->allocated_ws_nodes); 2029 2030 rf->allocated_ws_nodes = NULL;
+6 -3
drivers/infiniband/hw/irdma/main.c
··· 215 215 pr_debug("INIT: Gen2 PF[%d] device remove success\n", PCI_FUNC(pf->pdev->devfn)); 216 216 } 217 217 218 - static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf) 218 + static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf, 219 + struct ice_vsi *vsi) 219 220 { 220 221 struct irdma_pci_f *rf = iwdev->rf; 221 - struct ice_vsi *vsi = ice_get_main_vsi(pf); 222 222 223 223 rf->cdev = pf; 224 224 rf->gen_ops.register_qset = irdma_lan_register_qset; ··· 253 253 struct iidc_auxiliary_dev, 254 254 adev); 255 255 struct ice_pf *pf = iidc_adev->pf; 256 + struct ice_vsi *vsi = ice_get_main_vsi(pf); 256 257 struct iidc_qos_params qos_info = {}; 257 258 struct irdma_device *iwdev; 258 259 struct irdma_pci_f *rf; 259 260 struct irdma_l2params l2params = {}; 260 261 int err; 261 262 263 + if (!vsi) 264 + return -EIO; 262 265 iwdev = ib_alloc_device(irdma_device, ibdev); 263 266 if (!iwdev) 264 267 return -ENOMEM; ··· 271 268 return -ENOMEM; 272 269 } 273 270 274 - irdma_fill_device_info(iwdev, pf); 271 + irdma_fill_device_info(iwdev, pf, vsi); 275 272 rf = iwdev->rf; 276 273 277 274 if (irdma_ctrl_init_hw(rf)) {
+1 -2
drivers/infiniband/hw/irdma/type.h
··· 1222 1222 struct irdma_aeq_init_info *info); 1223 1223 enum irdma_status_code irdma_sc_get_next_aeqe(struct irdma_sc_aeq *aeq, 1224 1224 struct irdma_aeqe_info *info); 1225 - enum irdma_status_code irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, 1226 - u32 count); 1225 + void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count); 1227 1226 1228 1227 void irdma_sc_pd_init(struct irdma_sc_dev *dev, struct irdma_sc_pd *pd, u32 pd_id, 1229 1228 int abi_ver);
+1 -4
drivers/infiniband/hw/irdma/uk.c
··· 931 931 enum irdma_status_code irdma_uk_post_receive(struct irdma_qp_uk *qp, 932 932 struct irdma_post_rq_info *info) 933 933 { 934 - u32 total_size = 0, wqe_idx, i, byte_off; 934 + u32 wqe_idx, i, byte_off; 935 935 u32 addl_frag_cnt; 936 936 __le64 *wqe; 937 937 u64 hdr; 938 938 939 939 if (qp->max_rq_frag_cnt < info->num_sges) 940 940 return IRDMA_ERR_INVALID_FRAG_COUNT; 941 - 942 - for (i = 0; i < info->num_sges; i++) 943 - total_size += info->sg_list[i].len; 944 941 945 942 wqe = irdma_qp_get_next_recv_wqe(qp, &wqe_idx); 946 943 if (!wqe)
+2 -4
drivers/infiniband/hw/irdma/verbs.c
··· 557 557 * @iwqp: qp ptr 558 558 * @init_info: initialize info to return 559 559 */ 560 - static int irdma_setup_virt_qp(struct irdma_device *iwdev, 560 + static void irdma_setup_virt_qp(struct irdma_device *iwdev, 561 561 struct irdma_qp *iwqp, 562 562 struct irdma_qp_init_info *init_info) 563 563 { ··· 574 574 init_info->sq_pa = qpmr->sq_pbl.addr; 575 575 init_info->rq_pa = qpmr->rq_pbl.addr; 576 576 } 577 - 578 - return 0; 579 577 } 580 578 581 579 /** ··· 912 914 } 913 915 } 914 916 init_info.qp_uk_init_info.abi_ver = iwpd->sc_pd.abi_ver; 915 - err_code = irdma_setup_virt_qp(iwdev, iwqp, &init_info); 917 + irdma_setup_virt_qp(iwdev, iwqp, &init_info); 916 918 } else { 917 919 init_info.qp_uk_init_info.abi_ver = IRDMA_ABI_VER; 918 920 err_code = irdma_setup_kmode_qp(iwdev, iwqp, &init_info, init_attr);
+17 -10
drivers/infiniband/sw/rxe/rxe_mr.c
··· 113 113 int num_buf; 114 114 void *vaddr; 115 115 int err; 116 + int i; 116 117 117 118 umem = ib_umem_get(pd->ibpd.device, start, length, access); 118 119 if (IS_ERR(umem)) { 119 - pr_warn("err %d from rxe_umem_get\n", 120 - (int)PTR_ERR(umem)); 120 + pr_warn("%s: Unable to pin memory region err = %d\n", 121 + __func__, (int)PTR_ERR(umem)); 121 122 err = PTR_ERR(umem); 122 - goto err1; 123 + goto err_out; 123 124 } 124 125 125 126 mr->umem = umem; ··· 130 129 131 130 err = rxe_mr_alloc(mr, num_buf); 132 131 if (err) { 133 - pr_warn("err %d from rxe_mr_alloc\n", err); 134 - ib_umem_release(umem); 135 - goto err1; 132 + pr_warn("%s: Unable to allocate memory for map\n", 133 + __func__); 134 + goto err_release_umem; 136 135 } 137 136 138 137 mr->page_shift = PAGE_SHIFT; ··· 152 151 153 152 vaddr = page_address(sg_page_iter_page(&sg_iter)); 154 153 if (!vaddr) { 155 - pr_warn("null vaddr\n"); 156 - ib_umem_release(umem); 154 + pr_warn("%s: Unable to get virtual address\n", 155 + __func__); 157 156 err = -ENOMEM; 158 - goto err1; 157 + goto err_cleanup_map; 159 158 } 160 159 161 160 buf->addr = (uintptr_t)vaddr; ··· 178 177 179 178 return 0; 180 179 181 - err1: 180 + err_cleanup_map: 181 + for (i = 0; i < mr->num_map; i++) 182 + kfree(mr->map[i]); 183 + kfree(mr->map); 184 + err_release_umem: 185 + ib_umem_release(umem); 186 + err_out: 182 187 return err; 183 188 } 184 189
+2 -4
drivers/media/pci/intel/ipu3/cio2-bridge.c
··· 173 173 int ret; 174 174 175 175 for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) { 176 - if (!adev->status.enabled) { 177 - acpi_dev_put(adev); 176 + if (!adev->status.enabled) 178 177 continue; 179 - } 180 178 181 179 if (bridge->n_sensors >= CIO2_NUM_PORTS) { 182 180 acpi_dev_put(adev); ··· 183 185 } 184 186 185 187 sensor = &bridge->sensors[bridge->n_sensors]; 186 - sensor->adev = adev; 187 188 strscpy(sensor->name, cfg->hid, sizeof(sensor->name)); 188 189 189 190 ret = cio2_bridge_read_acpi_buffer(adev, "SSDB", ··· 212 215 goto err_free_swnodes; 213 216 } 214 217 218 + sensor->adev = acpi_dev_get(adev); 215 219 adev->fwnode.secondary = fwnode; 216 220 217 221 dev_info(&cio2->dev, "Found supported sensor %s\n",
+1 -1
drivers/media/pci/ngene/ngene-core.c
··· 385 385 386 386 com.cmd.hdr.Opcode = CMD_CONFIGURE_FREE_BUFFER; 387 387 com.cmd.hdr.Length = 6; 388 - memcpy(&com.cmd.ConfigureBuffers.config, config, 6); 388 + memcpy(&com.cmd.ConfigureFreeBuffers.config, config, 6); 389 389 com.in_len = 6; 390 390 com.out_len = 0; 391 391
+8 -6
drivers/media/pci/ngene/ngene.h
··· 407 407 408 408 struct FW_CONFIGURE_FREE_BUFFERS { 409 409 struct FW_HEADER hdr; 410 - u8 UVI1_BufferLength; 411 - u8 UVI2_BufferLength; 412 - u8 TVO_BufferLength; 413 - u8 AUD1_BufferLength; 414 - u8 AUD2_BufferLength; 415 - u8 TVA_BufferLength; 410 + struct { 411 + u8 UVI1_BufferLength; 412 + u8 UVI2_BufferLength; 413 + u8 TVO_BufferLength; 414 + u8 AUD1_BufferLength; 415 + u8 AUD2_BufferLength; 416 + u8 TVA_BufferLength; 417 + } __packed config; 416 418 } __attribute__ ((__packed__)); 417 419 418 420 struct FW_CONFIGURE_UART {
+7 -10
drivers/misc/eeprom/at24.c
··· 714 714 } 715 715 716 716 /* 717 - * If the 'label' property is not present for the AT24 EEPROM, 718 - * then nvmem_config.id is initialised to NVMEM_DEVID_AUTO, 719 - * and this will append the 'devid' to the name of the NVMEM 720 - * device. This is purely legacy and the AT24 driver has always 721 - * defaulted to this. However, if the 'label' property is 722 - * present then this means that the name is specified by the 723 - * firmware and this name should be used verbatim and so it is 724 - * not necessary to append the 'devid'. 717 + * We initialize nvmem_config.id to NVMEM_DEVID_AUTO even if the 718 + * label property is set as some platform can have multiple eeproms 719 + * with same label and we can not register each of those with same 720 + * label. Failing to register those eeproms trigger cascade failure 721 + * on such platform. 725 722 */ 723 + nvmem_config.id = NVMEM_DEVID_AUTO; 724 + 726 725 if (device_property_present(dev, "label")) { 727 - nvmem_config.id = NVMEM_DEVID_NONE; 728 726 err = device_property_read_string(dev, "label", 729 727 &nvmem_config.name); 730 728 if (err) 731 729 return err; 732 730 } else { 733 - nvmem_config.id = NVMEM_DEVID_AUTO; 734 731 nvmem_config.name = dev_name(dev); 735 732 } 736 733
+1 -1
drivers/net/can/spi/hi311x.c
··· 218 218 return ret; 219 219 } 220 220 221 - static u8 hi3110_cmd(struct spi_device *spi, u8 command) 221 + static int hi3110_cmd(struct spi_device *spi, u8 command) 222 222 { 223 223 struct hi3110_priv *priv = spi_get_drvdata(spi); 224 224
+1
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
··· 2304 2304 err, priv->regs_status.intf); 2305 2305 mcp251xfd_dump(priv); 2306 2306 mcp251xfd_chip_interrupts_disable(priv); 2307 + mcp251xfd_timestamp_stop(priv); 2307 2308 2308 2309 return handled; 2309 2310 }
+13 -1
drivers/net/can/usb/ems_usb.c
··· 255 255 unsigned int free_slots; /* remember number of available slots */ 256 256 257 257 struct ems_cpc_msg active_params; /* active controller parameters */ 258 + void *rxbuf[MAX_RX_URBS]; 259 + dma_addr_t rxbuf_dma[MAX_RX_URBS]; 258 260 }; 259 261 260 262 static void ems_usb_read_interrupt_callback(struct urb *urb) ··· 589 587 for (i = 0; i < MAX_RX_URBS; i++) { 590 588 struct urb *urb = NULL; 591 589 u8 *buf = NULL; 590 + dma_addr_t buf_dma; 592 591 593 592 /* create a URB, and a buffer for it */ 594 593 urb = usb_alloc_urb(0, GFP_KERNEL); ··· 599 596 } 600 597 601 598 buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, 602 - &urb->transfer_dma); 599 + &buf_dma); 603 600 if (!buf) { 604 601 netdev_err(netdev, "No memory left for USB buffer\n"); 605 602 usb_free_urb(urb); 606 603 err = -ENOMEM; 607 604 break; 608 605 } 606 + 607 + urb->transfer_dma = buf_dma; 609 608 610 609 usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2), 611 610 buf, RX_BUFFER_SIZE, ··· 623 618 usb_free_urb(urb); 624 619 break; 625 620 } 621 + 622 + dev->rxbuf[i] = buf; 623 + dev->rxbuf_dma[i] = buf_dma; 626 624 627 625 /* Drop reference, USB core will take care of freeing it */ 628 626 usb_free_urb(urb); ··· 691 683 usb_unlink_urb(dev->intr_urb); 692 684 693 685 usb_kill_anchored_urbs(&dev->rx_submitted); 686 + 687 + for (i = 0; i < MAX_RX_URBS; ++i) 688 + usb_free_coherent(dev->udev, RX_BUFFER_SIZE, 689 + dev->rxbuf[i], dev->rxbuf_dma[i]); 694 690 695 691 usb_kill_anchored_urbs(&dev->tx_submitted); 696 692 atomic_set(&dev->active_tx_urbs, 0);
+15 -1
drivers/net/can/usb/esd_usb2.c
··· 195 195 int net_count; 196 196 u32 version; 197 197 int rxinitdone; 198 + void *rxbuf[MAX_RX_URBS]; 199 + dma_addr_t rxbuf_dma[MAX_RX_URBS]; 198 200 }; 199 201 200 202 struct esd_usb2_net_priv { ··· 547 545 for (i = 0; i < MAX_RX_URBS; i++) { 548 546 struct urb *urb = NULL; 549 547 u8 *buf = NULL; 548 + dma_addr_t buf_dma; 550 549 551 550 /* create a URB, and a buffer for it */ 552 551 urb = usb_alloc_urb(0, GFP_KERNEL); ··· 557 554 } 558 555 559 556 buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, 560 - &urb->transfer_dma); 557 + &buf_dma); 561 558 if (!buf) { 562 559 dev_warn(dev->udev->dev.parent, 563 560 "No memory left for USB buffer\n"); 564 561 err = -ENOMEM; 565 562 goto freeurb; 566 563 } 564 + 565 + urb->transfer_dma = buf_dma; 567 566 568 567 usb_fill_bulk_urb(urb, dev->udev, 569 568 usb_rcvbulkpipe(dev->udev, 1), ··· 579 574 usb_unanchor_urb(urb); 580 575 usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, 581 576 urb->transfer_dma); 577 + goto freeurb; 582 578 } 579 + 580 + dev->rxbuf[i] = buf; 581 + dev->rxbuf_dma[i] = buf_dma; 583 582 584 583 freeurb: 585 584 /* Drop reference, USB core will take care of freeing it */ ··· 672 663 int i, j; 673 664 674 665 usb_kill_anchored_urbs(&dev->rx_submitted); 666 + 667 + for (i = 0; i < MAX_RX_URBS; ++i) 668 + usb_free_coherent(dev->udev, RX_BUFFER_SIZE, 669 + dev->rxbuf[i], dev->rxbuf_dma[i]); 670 + 675 671 for (i = 0; i < dev->net_count; i++) { 676 672 priv = dev->nets[i]; 677 673 if (priv) {
+2
drivers/net/can/usb/mcba_usb.c
··· 653 653 break; 654 654 } 655 655 656 + urb->transfer_dma = buf_dma; 657 + 656 658 usb_fill_bulk_urb(urb, priv->udev, 657 659 usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_IN), 658 660 buf, MCBA_USB_RX_BUFF_SIZE,
+6 -4
drivers/net/can/usb/peak_usb/pcan_usb.c
··· 123 123 #define PCAN_USB_BERR_MASK (PCAN_USB_ERR_RXERR | PCAN_USB_ERR_TXERR) 124 124 125 125 /* identify bus event packets with rx/tx error counters */ 126 - #define PCAN_USB_ERR_CNT 0x80 126 + #define PCAN_USB_ERR_CNT_DEC 0x00 /* counters are decreasing */ 127 + #define PCAN_USB_ERR_CNT_INC 0x80 /* counters are increasing */ 127 128 128 129 /* private to PCAN-USB adapter */ 129 130 struct pcan_usb { ··· 536 535 537 536 /* acccording to the content of the packet */ 538 537 switch (ir) { 539 - case PCAN_USB_ERR_CNT: 538 + case PCAN_USB_ERR_CNT_DEC: 539 + case PCAN_USB_ERR_CNT_INC: 540 540 541 541 /* save rx/tx error counters from in the device context */ 542 - pdev->bec.rxerr = mc->ptr[0]; 543 - pdev->bec.txerr = mc->ptr[1]; 542 + pdev->bec.rxerr = mc->ptr[1]; 543 + pdev->bec.txerr = mc->ptr[2]; 544 544 break; 545 545 546 546 default:
+13 -2
drivers/net/can/usb/usb_8dev.c
··· 137 137 u8 *cmd_msg_buffer; 138 138 139 139 struct mutex usb_8dev_cmd_lock; 140 - 140 + void *rxbuf[MAX_RX_URBS]; 141 + dma_addr_t rxbuf_dma[MAX_RX_URBS]; 141 142 }; 142 143 143 144 /* tx frame */ ··· 734 733 for (i = 0; i < MAX_RX_URBS; i++) { 735 734 struct urb *urb = NULL; 736 735 u8 *buf; 736 + dma_addr_t buf_dma; 737 737 738 738 /* create a URB, and a buffer for it */ 739 739 urb = usb_alloc_urb(0, GFP_KERNEL); ··· 744 742 } 745 743 746 744 buf = usb_alloc_coherent(priv->udev, RX_BUFFER_SIZE, GFP_KERNEL, 747 - &urb->transfer_dma); 745 + &buf_dma); 748 746 if (!buf) { 749 747 netdev_err(netdev, "No memory left for USB buffer\n"); 750 748 usb_free_urb(urb); 751 749 err = -ENOMEM; 752 750 break; 753 751 } 752 + 753 + urb->transfer_dma = buf_dma; 754 754 755 755 usb_fill_bulk_urb(urb, priv->udev, 756 756 usb_rcvbulkpipe(priv->udev, ··· 770 766 usb_free_urb(urb); 771 767 break; 772 768 } 769 + 770 + priv->rxbuf[i] = buf; 771 + priv->rxbuf_dma[i] = buf_dma; 773 772 774 773 /* Drop reference, USB core will take care of freeing it */ 775 774 usb_free_urb(urb); ··· 842 835 int i; 843 836 844 837 usb_kill_anchored_urbs(&priv->rx_submitted); 838 + 839 + for (i = 0; i < MAX_RX_URBS; ++i) 840 + usb_free_coherent(priv->udev, RX_BUFFER_SIZE, 841 + priv->rxbuf[i], priv->rxbuf_dma[i]); 845 842 846 843 usb_kill_anchored_urbs(&priv->tx_submitted); 847 844 atomic_set(&priv->active_tx_urbs, 0);
+1 -1
drivers/net/dsa/mv88e6xxx/chip.c
··· 2176 2176 int i, err; 2177 2177 2178 2178 if (!vid) 2179 - return -EOPNOTSUPP; 2179 + return 0; 2180 2180 2181 2181 err = mv88e6xxx_vtu_get(chip, vid, &vlan); 2182 2182 if (err)
+2 -3
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 12168 12168 /* Make sure fw_reset_state is 0 before clearing the flag */ 12169 12169 smp_mb__before_atomic(); 12170 12170 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); 12171 - bnxt_ulp_start(bp, rc); 12172 - if (!rc) 12173 - bnxt_reenable_sriov(bp); 12171 + bnxt_ulp_start(bp, 0); 12172 + bnxt_reenable_sriov(bp); 12174 12173 bnxt_vf_reps_alloc(bp); 12175 12174 bnxt_vf_reps_open(bp); 12176 12175 bnxt_ptp_reapply_pps(bp);
+7
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
··· 560 560 561 561 bnxt_ptp_get_current_time(bp); 562 562 ptp->next_period = now + HZ; 563 + if (time_after_eq(now, ptp->next_overflow_check)) { 564 + spin_lock_bh(&ptp->ptp_lock); 565 + timecounter_read(&ptp->tc); 566 + spin_unlock_bh(&ptp->ptp_lock); 567 + ptp->next_overflow_check = now + BNXT_PHC_OVERFLOW_PERIOD; 568 + } 563 569 return HZ; 564 570 } 565 571 ··· 719 713 ptp->cc.shift = 0; 720 714 ptp->cc.mult = 1; 721 715 716 + ptp->next_overflow_check = jiffies + BNXT_PHC_OVERFLOW_PERIOD; 722 717 timecounter_init(&ptp->tc, &ptp->cc, ktime_to_ns(ktime_get_real())); 723 718 724 719 ptp->ptp_info = bnxt_ptp_caps;
+4
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h
··· 83 83 u64 current_time; 84 84 u64 old_time; 85 85 unsigned long next_period; 86 + unsigned long next_overflow_check; 87 + /* 48-bit PHC overflows in 78 hours. Check overflow every 19 hours. */ 88 + #define BNXT_PHC_OVERFLOW_PERIOD (19 * 3600 * HZ) 89 + 86 90 u16 tx_seqid; 87 91 struct bnxt *bp; 88 92 atomic_t tx_avail;
+2 -5
drivers/net/ethernet/dec/tulip/winbond-840.c
··· 357 357 int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0; 358 358 void __iomem *ioaddr; 359 359 360 - i = pci_enable_device(pdev); 360 + i = pcim_enable_device(pdev); 361 361 if (i) return i; 362 362 363 363 pci_set_master(pdev); ··· 379 379 380 380 ioaddr = pci_iomap(pdev, TULIP_BAR, netdev_res_size); 381 381 if (!ioaddr) 382 - goto err_out_free_res; 382 + goto err_out_netdev; 383 383 384 384 for (i = 0; i < 3; i++) 385 385 ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(eeprom_read(ioaddr, i)); ··· 458 458 459 459 err_out_cleardev: 460 460 pci_iounmap(pdev, ioaddr); 461 - err_out_free_res: 462 - pci_release_regions(pdev); 463 461 err_out_netdev: 464 462 free_netdev (dev); 465 463 return -ENODEV; ··· 1524 1526 if (dev) { 1525 1527 struct netdev_private *np = netdev_priv(dev); 1526 1528 unregister_netdev(dev); 1527 - pci_release_regions(pdev); 1528 1529 pci_iounmap(pdev, np->base_addr); 1529 1530 free_netdev(dev); 1530 1531 }
+29 -7
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c
··· 5 5 #include "hclge_main.h" 6 6 #include "hnae3.h" 7 7 8 + static int hclge_ptp_get_cycle(struct hclge_dev *hdev) 9 + { 10 + struct hclge_ptp *ptp = hdev->ptp; 11 + 12 + ptp->cycle.quo = readl(hdev->ptp->io_base + HCLGE_PTP_CYCLE_QUO_REG) & 13 + HCLGE_PTP_CYCLE_QUO_MASK; 14 + ptp->cycle.numer = readl(hdev->ptp->io_base + HCLGE_PTP_CYCLE_NUM_REG); 15 + ptp->cycle.den = readl(hdev->ptp->io_base + HCLGE_PTP_CYCLE_DEN_REG); 16 + 17 + if (ptp->cycle.den == 0) { 18 + dev_err(&hdev->pdev->dev, "invalid ptp cycle denominator!\n"); 19 + return -EINVAL; 20 + } 21 + 22 + return 0; 23 + } 24 + 8 25 static int hclge_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) 9 26 { 10 27 struct hclge_dev *hdev = hclge_ptp_get_hdev(ptp); 28 + struct hclge_ptp_cycle *cycle = &hdev->ptp->cycle; 11 29 u64 adj_val, adj_base, diff; 12 30 unsigned long flags; 13 31 bool is_neg = false; ··· 36 18 is_neg = true; 37 19 } 38 20 39 - adj_base = HCLGE_PTP_CYCLE_ADJ_BASE * HCLGE_PTP_CYCLE_ADJ_UNIT; 21 + adj_base = (u64)cycle->quo * (u64)cycle->den + (u64)cycle->numer; 40 22 adj_val = adj_base * ppb; 41 23 diff = div_u64(adj_val, 1000000000ULL); 42 24 ··· 47 29 48 30 /* This clock cycle is defined by three part: quotient, numerator 49 31 * and denominator. For example, 2.5ns, the quotient is 2, 50 - * denominator is fixed to HCLGE_PTP_CYCLE_ADJ_UNIT, and numerator 51 - * is 0.5 * HCLGE_PTP_CYCLE_ADJ_UNIT. 32 + * denominator is fixed to ptp->cycle.den, and numerator 33 + * is 0.5 * ptp->cycle.den. 52 34 */ 53 - quo = div_u64_rem(adj_val, HCLGE_PTP_CYCLE_ADJ_UNIT, &numerator); 35 + quo = div_u64_rem(adj_val, cycle->den, &numerator); 54 36 55 37 spin_lock_irqsave(&hdev->ptp->lock, flags); 56 - writel(quo, hdev->ptp->io_base + HCLGE_PTP_CYCLE_QUO_REG); 38 + writel(quo & HCLGE_PTP_CYCLE_QUO_MASK, 39 + hdev->ptp->io_base + HCLGE_PTP_CYCLE_QUO_REG); 57 40 writel(numerator, hdev->ptp->io_base + HCLGE_PTP_CYCLE_NUM_REG); 58 - writel(HCLGE_PTP_CYCLE_ADJ_UNIT, 59 - hdev->ptp->io_base + HCLGE_PTP_CYCLE_DEN_REG); 41 + writel(cycle->den, hdev->ptp->io_base + HCLGE_PTP_CYCLE_DEN_REG); 60 42 writel(HCLGE_PTP_CYCLE_ADJ_EN, 61 43 hdev->ptp->io_base + HCLGE_PTP_CYCLE_CFG_REG); 62 44 spin_unlock_irqrestore(&hdev->ptp->lock, flags); ··· 491 473 492 474 if (!hdev->ptp) { 493 475 ret = hclge_ptp_create_clock(hdev); 476 + if (ret) 477 + return ret; 478 + 479 + ret = hclge_ptp_get_cycle(hdev); 494 480 if (ret) 495 481 return ret; 496 482 }
+8 -2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h
··· 29 29 #define HCLGE_PTP_TIME_ADJ_REG 0x60 30 30 #define HCLGE_PTP_TIME_ADJ_EN BIT(0) 31 31 #define HCLGE_PTP_CYCLE_QUO_REG 0x64 32 + #define HCLGE_PTP_CYCLE_QUO_MASK GENMASK(7, 0) 32 33 #define HCLGE_PTP_CYCLE_DEN_REG 0x68 33 34 #define HCLGE_PTP_CYCLE_NUM_REG 0x6C 34 35 #define HCLGE_PTP_CYCLE_CFG_REG 0x70 ··· 38 37 #define HCLGE_PTP_CUR_TIME_SEC_L_REG 0x78 39 38 #define HCLGE_PTP_CUR_TIME_NSEC_REG 0x7C 40 39 41 - #define HCLGE_PTP_CYCLE_ADJ_BASE 2 42 40 #define HCLGE_PTP_CYCLE_ADJ_MAX 500000000 43 - #define HCLGE_PTP_CYCLE_ADJ_UNIT 100000000 44 41 #define HCLGE_PTP_SEC_H_OFFSET 32u 45 42 #define HCLGE_PTP_SEC_L_MASK GENMASK(31, 0) 46 43 47 44 #define HCLGE_PTP_FLAG_EN 0 48 45 #define HCLGE_PTP_FLAG_TX_EN 1 49 46 #define HCLGE_PTP_FLAG_RX_EN 2 47 + 48 + struct hclge_ptp_cycle { 49 + u32 quo; 50 + u32 numer; 51 + u32 den; 52 + }; 50 53 51 54 struct hclge_ptp { 52 55 struct hclge_dev *hdev; ··· 63 58 spinlock_t lock; /* protects ptp registers */ 64 59 u32 ptp_cfg; 65 60 u32 last_tx_seqid; 61 + struct hclge_ptp_cycle cycle; 66 62 unsigned long tx_start; 67 63 unsigned long tx_cnt; 68 64 unsigned long tx_skipped;
+5 -1
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 980 980 default: 981 981 /* if we got here and link is up something bad is afoot */ 982 982 netdev_info(netdev, 983 - "WARNING: Link is up but PHY type 0x%x is not recognized.\n", 983 + "WARNING: Link is up but PHY type 0x%x is not recognized, or incorrect cable is in use\n", 984 984 hw_link_info->phy_type); 985 985 } 986 986 ··· 5294 5294 dev_warn(&pf->pdev->dev, 5295 5295 "Device configuration forbids SW from starting the LLDP agent.\n"); 5296 5296 return -EINVAL; 5297 + case I40E_AQ_RC_EAGAIN: 5298 + dev_warn(&pf->pdev->dev, 5299 + "Stop FW LLDP agent command is still being processed, please try again in a second.\n"); 5300 + return -EBUSY; 5297 5301 default: 5298 5302 dev_warn(&pf->pdev->dev, 5299 5303 "Starting FW LLDP agent failed: error: %s, %s\n",
+37 -24
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 4457 4457 } 4458 4458 4459 4459 /** 4460 - * i40e_vsi_control_tx - Start or stop a VSI's rings 4460 + * i40e_vsi_enable_tx - Start a VSI's rings 4461 4461 * @vsi: the VSI being configured 4462 - * @enable: start or stop the rings 4463 4462 **/ 4464 - static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) 4463 + static int i40e_vsi_enable_tx(struct i40e_vsi *vsi) 4465 4464 { 4466 4465 struct i40e_pf *pf = vsi->back; 4467 4466 int i, pf_q, ret = 0; ··· 4469 4470 for (i = 0; i < vsi->num_queue_pairs; i++, pf_q++) { 4470 4471 ret = i40e_control_wait_tx_q(vsi->seid, pf, 4471 4472 pf_q, 4472 - false /*is xdp*/, enable); 4473 + false /*is xdp*/, true); 4473 4474 if (ret) 4474 4475 break; 4475 4476 ··· 4478 4479 4479 4480 ret = i40e_control_wait_tx_q(vsi->seid, pf, 4480 4481 pf_q + vsi->alloc_queue_pairs, 4481 - true /*is xdp*/, enable); 4482 + true /*is xdp*/, true); 4482 4483 if (ret) 4483 4484 break; 4484 4485 } ··· 4576 4577 } 4577 4578 4578 4579 /** 4579 - * i40e_vsi_control_rx - Start or stop a VSI's rings 4580 + * i40e_vsi_enable_rx - Start a VSI's rings 4580 4581 * @vsi: the VSI being configured 4581 - * @enable: start or stop the rings 4582 4582 **/ 4583 - static int i40e_vsi_control_rx(struct i40e_vsi *vsi, bool enable) 4583 + static int i40e_vsi_enable_rx(struct i40e_vsi *vsi) 4584 4584 { 4585 4585 struct i40e_pf *pf = vsi->back; 4586 4586 int i, pf_q, ret = 0; 4587 4587 4588 4588 pf_q = vsi->base_queue; 4589 4589 for (i = 0; i < vsi->num_queue_pairs; i++, pf_q++) { 4590 - ret = i40e_control_wait_rx_q(pf, pf_q, enable); 4590 + ret = i40e_control_wait_rx_q(pf, pf_q, true); 4591 4591 if (ret) { 4592 4592 dev_info(&pf->pdev->dev, 4593 - "VSI seid %d Rx ring %d %sable timeout\n", 4594 - vsi->seid, pf_q, (enable ? "en" : "dis")); 4593 + "VSI seid %d Rx ring %d enable timeout\n", 4594 + vsi->seid, pf_q); 4595 4595 break; 4596 4596 } 4597 4597 } 4598 - 4599 - /* Due to HW errata, on Rx disable only, the register can indicate done 4600 - * before it really is. Needs 50ms to be sure 4601 - */ 4602 - if (!enable) 4603 - mdelay(50); 4604 4598 4605 4599 return ret; 4606 4600 } ··· 4607 4615 int ret = 0; 4608 4616 4609 4617 /* do rx first for enable and last for disable */ 4610 - ret = i40e_vsi_control_rx(vsi, true); 4618 + ret = i40e_vsi_enable_rx(vsi); 4611 4619 if (ret) 4612 4620 return ret; 4613 - ret = i40e_vsi_control_tx(vsi, true); 4621 + ret = i40e_vsi_enable_tx(vsi); 4614 4622 4615 4623 return ret; 4616 4624 } 4625 + 4626 + #define I40E_DISABLE_TX_GAP_MSEC 50 4617 4627 4618 4628 /** 4619 4629 * i40e_vsi_stop_rings - Stop a VSI's rings ··· 4623 4629 **/ 4624 4630 void i40e_vsi_stop_rings(struct i40e_vsi *vsi) 4625 4631 { 4632 + struct i40e_pf *pf = vsi->back; 4633 + int pf_q, err, q_end; 4634 + 4626 4635 /* When port TX is suspended, don't wait */ 4627 4636 if (test_bit(__I40E_PORT_SUSPENDED, vsi->back->state)) 4628 4637 return i40e_vsi_stop_rings_no_wait(vsi); 4629 4638 4630 - /* do rx first for enable and last for disable 4631 - * Ignore return value, we need to shutdown whatever we can 4632 - */ 4633 - i40e_vsi_control_tx(vsi, false); 4634 - i40e_vsi_control_rx(vsi, false); 4639 + q_end = vsi->base_queue + vsi->num_queue_pairs; 4640 + for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) 4641 + i40e_pre_tx_queue_cfg(&pf->hw, (u32)pf_q, false); 4642 + 4643 + for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) { 4644 + err = i40e_control_wait_rx_q(pf, pf_q, false); 4645 + if (err) 4646 + dev_info(&pf->pdev->dev, 4647 + "VSI seid %d Rx ring %d dissable timeout\n", 4648 + vsi->seid, pf_q); 4649 + } 4650 + 4651 + msleep(I40E_DISABLE_TX_GAP_MSEC); 4652 + pf_q = vsi->base_queue; 4653 + for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) 4654 + wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); 4655 + 4656 + i40e_vsi_wait_queues_disabled(vsi); 4635 4657 } 4636 4658 4637 4659 /** ··· 7293 7283 } 7294 7284 if (vsi->num_queue_pairs < 7295 7285 (mqprio_qopt->qopt.offset[i] + mqprio_qopt->qopt.count[i])) { 7286 + dev_err(&vsi->back->pdev->dev, 7287 + "Failed to create traffic channel, insufficient number of queues.\n"); 7296 7288 return -EINVAL; 7297 7289 } 7298 7290 if (sum_max_rate > i40e_get_link_speed(vsi)) { ··· 13276 13264 .ndo_poll_controller = i40e_netpoll, 13277 13265 #endif 13278 13266 .ndo_setup_tc = __i40e_setup_tc, 13267 + .ndo_select_queue = i40e_lan_select_queue, 13279 13268 .ndo_set_features = i40e_set_features, 13280 13269 .ndo_set_vf_mac = i40e_ndo_set_vf_mac, 13281 13270 .ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan,
+50
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 3631 3631 return -1; 3632 3632 } 3633 3633 3634 + static u16 i40e_swdcb_skb_tx_hash(struct net_device *dev, 3635 + const struct sk_buff *skb, 3636 + u16 num_tx_queues) 3637 + { 3638 + u32 jhash_initval_salt = 0xd631614b; 3639 + u32 hash; 3640 + 3641 + if (skb->sk && skb->sk->sk_hash) 3642 + hash = skb->sk->sk_hash; 3643 + else 3644 + hash = (__force u16)skb->protocol ^ skb->hash; 3645 + 3646 + hash = jhash_1word(hash, jhash_initval_salt); 3647 + 3648 + return (u16)(((u64)hash * num_tx_queues) >> 32); 3649 + } 3650 + 3651 + u16 i40e_lan_select_queue(struct net_device *netdev, 3652 + struct sk_buff *skb, 3653 + struct net_device __always_unused *sb_dev) 3654 + { 3655 + struct i40e_netdev_priv *np = netdev_priv(netdev); 3656 + struct i40e_vsi *vsi = np->vsi; 3657 + struct i40e_hw *hw; 3658 + u16 qoffset; 3659 + u16 qcount; 3660 + u8 tclass; 3661 + u16 hash; 3662 + u8 prio; 3663 + 3664 + /* is DCB enabled at all? */ 3665 + if (vsi->tc_config.numtc == 1) 3666 + return i40e_swdcb_skb_tx_hash(netdev, skb, 3667 + netdev->real_num_tx_queues); 3668 + 3669 + prio = skb->priority; 3670 + hw = &vsi->back->hw; 3671 + tclass = hw->local_dcbx_config.etscfg.prioritytable[prio]; 3672 + /* sanity check */ 3673 + if (unlikely(!(vsi->tc_config.enabled_tc & BIT(tclass)))) 3674 + tclass = 0; 3675 + 3676 + /* select a queue assigned for the given TC */ 3677 + qcount = vsi->tc_config.tc_info[tclass].qcount; 3678 + hash = i40e_swdcb_skb_tx_hash(netdev, skb, qcount); 3679 + 3680 + qoffset = vsi->tc_config.tc_info[tclass].qoffset; 3681 + return qoffset + hash; 3682 + } 3683 + 3634 3684 /** 3635 3685 * i40e_xmit_xdp_ring - transmits an XDP buffer to an XDP Tx ring 3636 3686 * @xdpf: data to transmit
+2
drivers/net/ethernet/intel/i40e/i40e_txrx.h
··· 451 451 452 452 bool i40e_alloc_rx_buffers(struct i40e_ring *rxr, u16 cleaned_count); 453 453 netdev_tx_t i40e_lan_xmit_frame(struct sk_buff *skb, struct net_device *netdev); 454 + u16 i40e_lan_select_queue(struct net_device *netdev, struct sk_buff *skb, 455 + struct net_device *sb_dev); 454 456 void i40e_clean_tx_ring(struct i40e_ring *tx_ring); 455 457 void i40e_clean_rx_ring(struct i40e_ring *rx_ring); 456 458 int i40e_setup_tx_descriptors(struct i40e_ring *tx_ring);
+1 -1
drivers/net/ethernet/marvell/octeontx2/af/cgx.c
··· 1504 1504 1505 1505 /* Add reference */ 1506 1506 cgx->lmac_idmap[lmac->lmac_id] = lmac; 1507 - cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, true); 1508 1507 set_bit(lmac->lmac_id, &cgx->lmac_bmap); 1508 + cgx->mac_ops->mac_pause_frm_config(cgx, lmac->lmac_id, true); 1509 1509 } 1510 1510 1511 1511 return cgx_lmac_verify_fwi_version(cgx);
+3
drivers/net/ethernet/marvell/octeontx2/af/npc.h
··· 151 151 * Software assigns pkind for each incoming port such as CGX 152 152 * Ethernet interfaces, LBK interfaces, etc. 153 153 */ 154 + #define NPC_UNRESERVED_PKIND_COUNT NPC_RX_VLAN_EXDSA_PKIND 155 + 154 156 enum npc_pkind_type { 157 + NPC_RX_LBK_PKIND = 0ULL, 155 158 NPC_RX_VLAN_EXDSA_PKIND = 56ULL, 156 159 NPC_RX_CHLEN24B_PKIND = 57ULL, 157 160 NPC_RX_CPT_HDR_PKIND,
+4 -2
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
··· 391 391 392 392 /* Get numVFs attached to this PF and first HWVF */ 393 393 cfg = rvu_read64(rvu, BLKADDR_RVUM, RVU_PRIV_PFX_CFG(pf)); 394 - *numvfs = (cfg >> 12) & 0xFF; 395 - *hwvf = cfg & 0xFFF; 394 + if (numvfs) 395 + *numvfs = (cfg >> 12) & 0xFF; 396 + if (hwvf) 397 + *hwvf = cfg & 0xFFF; 396 398 } 397 399 398 400 static int rvu_get_hwvf(struct rvu *rvu, int pcifunc)
+14 -3
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
··· 196 196 { 197 197 int err; 198 198 199 - /*Sync all in flight RX packets to LLC/DRAM */ 199 + /* Sync all in flight RX packets to LLC/DRAM */ 200 200 rvu_write64(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0)); 201 201 err = rvu_poll_reg(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0), true); 202 202 if (err) 203 - dev_err(rvu->dev, "NIX RX software sync failed\n"); 203 + dev_err(rvu->dev, "SYNC1: NIX RX software sync failed\n"); 204 + 205 + /* SW_SYNC ensures all existing transactions are finished and pkts 206 + * are written to LLC/DRAM, queues should be teared down after 207 + * successful SW_SYNC. Due to a HW errata, in some rare scenarios 208 + * an existing transaction might end after SW_SYNC operation. To 209 + * ensure operation is fully done, do the SW_SYNC twice. 210 + */ 211 + rvu_write64(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0)); 212 + err = rvu_poll_reg(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0), true); 213 + if (err) 214 + dev_err(rvu->dev, "SYNC2: NIX RX software sync failed\n"); 204 215 } 205 216 206 217 static bool is_valid_txschq(struct rvu *rvu, int blkaddr, ··· 309 298 rvu_nix_chan_lbk(rvu, lbkid, vf + 1); 310 299 pfvf->rx_chan_cnt = 1; 311 300 pfvf->tx_chan_cnt = 1; 301 + rvu_npc_set_pkind(rvu, NPC_RX_LBK_PKIND, pfvf); 312 302 rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf, 313 303 pfvf->rx_chan_base, 314 304 pfvf->rx_chan_cnt); ··· 3854 3842 vlan = &nix_hw->txvlan; 3855 3843 kfree(vlan->rsrc.bmap); 3856 3844 mutex_destroy(&vlan->rsrc_lock); 3857 - devm_kfree(rvu->dev, vlan->entry2pfvf_map); 3858 3845 3859 3846 mcast = &nix_hw->mcast; 3860 3847 qmem_free(rvu->dev, mcast->mce_ctx);
+7 -4
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
··· 1721 1721 { 1722 1722 struct rvu_hwinfo *hw = rvu->hw; 1723 1723 int num_pkinds, num_kpus, idx; 1724 - struct npc_pkind *pkind; 1725 1724 1726 1725 /* Disable all KPUs and their entries */ 1727 1726 for (idx = 0; idx < hw->npc_kpus; idx++) { ··· 1738 1739 * Check HW max count to avoid configuring junk or 1739 1740 * writing to unsupported CSR addresses. 1740 1741 */ 1741 - pkind = &hw->pkind; 1742 1742 num_pkinds = rvu->kpu.pkinds; 1743 - num_pkinds = min_t(int, pkind->rsrc.max, num_pkinds); 1743 + num_pkinds = min_t(int, hw->npc_pkinds, num_pkinds); 1744 1744 1745 1745 for (idx = 0; idx < num_pkinds; idx++) 1746 1746 npc_config_kpuaction(rvu, blkaddr, &rvu->kpu.ikpu[idx], 0, idx, true); ··· 1889 1891 if (npc_const1 & BIT_ULL(63)) 1890 1892 npc_const2 = rvu_read64(rvu, blkaddr, NPC_AF_CONST2); 1891 1893 1892 - pkind->rsrc.max = (npc_const1 >> 12) & 0xFFULL; 1894 + pkind->rsrc.max = NPC_UNRESERVED_PKIND_COUNT; 1895 + hw->npc_pkinds = (npc_const1 >> 12) & 0xFFULL; 1893 1896 hw->npc_kpu_entries = npc_const1 & 0xFFFULL; 1894 1897 hw->npc_kpus = (npc_const >> 8) & 0x1FULL; 1895 1898 hw->npc_intfs = npc_const & 0xFULL; ··· 2001 2002 err = rvu_alloc_bitmap(&pkind->rsrc); 2002 2003 if (err) 2003 2004 return err; 2005 + /* Reserve PKIND#0 for LBKs. Power reset value of LBK_CH_PKIND is '0', 2006 + * no need to configure PKIND for all LBKs separately. 2007 + */ 2008 + rvu_alloc_rsrc(&pkind->rsrc); 2004 2009 2005 2010 /* Allocate mem for pkind to PF and channel mapping info */ 2006 2011 pkind->pfchan_map = devm_kcalloc(rvu->dev, pkind->rsrc.max,
+6 -5
drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c
··· 71 71 struct rvu_switch *rswitch = &rvu->rswitch; 72 72 u16 start = rswitch->start_entry; 73 73 struct rvu_hwinfo *hw = rvu->hw; 74 - int pf, vf, numvfs, hwvf; 75 74 u16 pcifunc, entry = 0; 75 + int pf, vf, numvfs; 76 76 int err; 77 77 78 78 for (pf = 1; pf < hw->total_pfs; pf++) { ··· 110 110 111 111 rswitch->entry2pcifunc[entry++] = pcifunc; 112 112 113 - rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvf); 114 - for (vf = 0; vf < numvfs; vf++, hwvf++) { 113 + rvu_get_pf_numvfs(rvu, pf, &numvfs, NULL); 114 + for (vf = 0; vf < numvfs; vf++) { 115 115 pcifunc = pf << 10 | ((vf + 1) & 0x3FF); 116 116 rvu_get_nix_blkaddr(rvu, pcifunc); 117 117 ··· 198 198 struct npc_mcam_free_entry_req free_req = { 0 }; 199 199 struct rvu_switch *rswitch = &rvu->rswitch; 200 200 struct rvu_hwinfo *hw = rvu->hw; 201 - int pf, vf, numvfs, hwvf; 201 + int pf, vf, numvfs; 202 202 struct msg_rsp rsp; 203 203 u16 pcifunc; 204 204 int err; ··· 217 217 "Reverting RX rule for PF%d failed(%d)\n", 218 218 pf, err); 219 219 220 - for (vf = 0; vf < numvfs; vf++, hwvf++) { 220 + rvu_get_pf_numvfs(rvu, pf, &numvfs, NULL); 221 + for (vf = 0; vf < numvfs; vf++) { 221 222 pcifunc = pf << 10 | ((vf + 1) & 0x3FF); 222 223 err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF); 223 224 if (err)
+8 -6
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
··· 924 924 aq->cq.drop = RQ_DROP_LVL_CQ(pfvf->hw.rq_skid, cq->cqe_cnt); 925 925 aq->cq.drop_ena = 1; 926 926 927 - /* Enable receive CQ backpressure */ 928 - aq->cq.bp_ena = 1; 929 - aq->cq.bpid = pfvf->bpid[0]; 927 + if (!is_otx2_lbkvf(pfvf->pdev)) { 928 + /* Enable receive CQ backpressure */ 929 + aq->cq.bp_ena = 1; 930 + aq->cq.bpid = pfvf->bpid[0]; 930 931 931 - /* Set backpressure level is same as cq pass level */ 932 - aq->cq.bp = RQ_PASS_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt); 932 + /* Set backpressure level is same as cq pass level */ 933 + aq->cq.bp = RQ_PASS_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt); 934 + } 933 935 } 934 936 935 937 /* Fill AQ info */ ··· 1188 1186 aq->aura.fc_hyst_bits = 0; /* Store count on all updates */ 1189 1187 1190 1188 /* Enable backpressure for RQ aura */ 1191 - if (aura_id < pfvf->hw.rqpool_cnt) { 1189 + if (aura_id < pfvf->hw.rqpool_cnt && !is_otx2_lbkvf(pfvf->pdev)) { 1192 1190 aq->aura.bp_ena = 0; 1193 1191 aq->aura.nix0_bpid = pfvf->bpid[0]; 1194 1192 /* Set backpressure level for RQ's Aura */
+3 -4
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
··· 298 298 err = otx2_set_real_num_queues(dev, channel->tx_count, 299 299 channel->rx_count); 300 300 if (err) 301 - goto fail; 301 + return err; 302 302 303 303 pfvf->hw.rx_queues = channel->rx_count; 304 304 pfvf->hw.tx_queues = channel->tx_count; 305 305 pfvf->qset.cq_cnt = pfvf->hw.tx_queues + pfvf->hw.rx_queues; 306 306 307 - fail: 308 307 if (if_up) 309 - dev->netdev_ops->ndo_open(dev); 308 + err = dev->netdev_ops->ndo_open(dev); 310 309 311 310 netdev_info(dev, "Setting num Tx rings to %d, Rx rings to %d success\n", 312 311 pfvf->hw.tx_queues, pfvf->hw.rx_queues); ··· 409 410 qs->rqe_cnt = rx_count; 410 411 411 412 if (if_up) 412 - netdev->netdev_ops->ndo_open(netdev); 413 + return netdev->netdev_ops->ndo_open(netdev); 413 414 414 415 return 0; 415 416 }
+5
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
··· 1662 1662 err_tx_stop_queues: 1663 1663 netif_tx_stop_all_queues(netdev); 1664 1664 netif_carrier_off(netdev); 1665 + pf->flags |= OTX2_FLAG_INTF_DOWN; 1665 1666 err_free_cints: 1666 1667 otx2_free_cints(pf, qidx); 1667 1668 vec = pci_irq_vector(pf->pdev, ··· 1689 1688 struct otx2_qset *qset = &pf->qset; 1690 1689 struct otx2_rss_info *rss; 1691 1690 int qidx, vec, wrk; 1691 + 1692 + /* If the DOWN flag is set resources are already freed */ 1693 + if (pf->flags & OTX2_FLAG_INTF_DOWN) 1694 + return 0; 1692 1695 1693 1696 netif_carrier_off(netdev); 1694 1697 netif_tx_stop_all_queues(netdev);
+1
drivers/net/ethernet/mellanox/mlx4/main.c
··· 3535 3535 3536 3536 if (!SRIOV_VALID_STATE(dev->flags)) { 3537 3537 mlx4_err(dev, "Invalid SRIOV state\n"); 3538 + err = -EINVAL; 3538 3539 goto err_close; 3539 3540 } 3540 3541 }
+1 -4
drivers/net/ethernet/mellanox/mlx5/core/dev.c
··· 500 500 return 1; 501 501 } 502 502 503 - /* This function is called with two flows: 504 - * 1. During initialization of mlx5_core_dev and we don't need to lock it. 505 - * 2. During LAG configure stage and caller holds &mlx5_intf_mutex. 506 - */ 503 + /* Must be called with intf_mutex held */ 507 504 struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev) 508 505 { 509 506 struct auxiliary_device *adev;
+10 -1
drivers/net/ethernet/mellanox/mlx5/core/en/params.c
··· 483 483 param->cq_period_mode = params->rx_cq_moderation.cq_period_mode; 484 484 } 485 485 486 + static u8 rq_end_pad_mode(struct mlx5_core_dev *mdev, struct mlx5e_params *params) 487 + { 488 + bool ro = pcie_relaxed_ordering_enabled(mdev->pdev) && 489 + MLX5_CAP_GEN(mdev, relaxed_ordering_write); 490 + 491 + return ro && params->lro_en ? 492 + MLX5_WQ_END_PAD_MODE_NONE : MLX5_WQ_END_PAD_MODE_ALIGN; 493 + } 494 + 486 495 int mlx5e_build_rq_param(struct mlx5_core_dev *mdev, 487 496 struct mlx5e_params *params, 488 497 struct mlx5e_xsk_param *xsk, ··· 529 520 } 530 521 531 522 MLX5_SET(wq, wq, wq_type, params->rq_wq_type); 532 - MLX5_SET(wq, wq, end_padding_mode, MLX5_WQ_END_PAD_MODE_ALIGN); 523 + MLX5_SET(wq, wq, end_padding_mode, rq_end_pad_mode(mdev, params)); 533 524 MLX5_SET(wq, wq, log_wq_stride, 534 525 mlx5e_get_rqwq_log_stride(params->rq_wq_type, ndsegs)); 535 526 MLX5_SET(wq, wq, pd, mdev->mlx5e_res.hw_objs.pdn);
+5 -2
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
··· 482 482 params->log_sq_size = orig->log_sq_size; 483 483 mlx5e_ptp_build_sq_param(c->mdev, params, &cparams->txq_sq_param); 484 484 } 485 - if (test_bit(MLX5E_PTP_STATE_RX, c->state)) 485 + /* RQ */ 486 + if (test_bit(MLX5E_PTP_STATE_RX, c->state)) { 487 + params->vlan_strip_disable = orig->vlan_strip_disable; 486 488 mlx5e_ptp_build_rq_param(c->mdev, c->netdev, c->priv->q_counter, cparams); 489 + } 487 490 } 488 491 489 492 static int mlx5e_init_ptp_rq(struct mlx5e_ptp *c, struct mlx5e_params *params, ··· 497 494 int err; 498 495 499 496 rq->wq_type = params->rq_wq_type; 500 - rq->pdev = mdev->device; 497 + rq->pdev = c->pdev; 501 498 rq->netdev = priv->netdev; 502 499 rq->priv = priv; 503 500 rq->clock = &mdev->clock;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c
··· 37 37 struct mlx5e_priv *priv = t->priv; 38 38 39 39 rq->wq_type = params->rq_wq_type; 40 - rq->pdev = mdev->device; 40 + rq->pdev = t->pdev; 41 41 rq->netdev = priv->netdev; 42 42 rq->priv = priv; 43 43 rq->clock = &mdev->clock;
+26 -12
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 3223 3223 3224 3224 static int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd) 3225 3225 { 3226 - int err = 0; 3226 + int err; 3227 3227 int i; 3228 3228 3229 3229 for (i = 0; i < chs->num; i++) { ··· 3231 3231 if (err) 3232 3232 return err; 3233 3233 } 3234 + if (chs->ptp && test_bit(MLX5E_PTP_STATE_RX, chs->ptp->state)) 3235 + return mlx5e_modify_rq_vsd(&chs->ptp->rq, vsd); 3234 3236 3235 3237 return 0; 3236 3238 } ··· 3670 3668 return 0; 3671 3669 } 3672 3670 3671 + static netdev_features_t mlx5e_fix_uplink_rep_features(struct net_device *netdev, 3672 + netdev_features_t features) 3673 + { 3674 + features &= ~NETIF_F_HW_TLS_RX; 3675 + if (netdev->features & NETIF_F_HW_TLS_RX) 3676 + netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n"); 3677 + 3678 + features &= ~NETIF_F_HW_TLS_TX; 3679 + if (netdev->features & NETIF_F_HW_TLS_TX) 3680 + netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n"); 3681 + 3682 + features &= ~NETIF_F_NTUPLE; 3683 + if (netdev->features & NETIF_F_NTUPLE) 3684 + netdev_warn(netdev, "Disabling ntuple, not supported in switchdev mode\n"); 3685 + 3686 + return features; 3687 + } 3688 + 3673 3689 static netdev_features_t mlx5e_fix_features(struct net_device *netdev, 3674 3690 netdev_features_t features) 3675 3691 { ··· 3719 3699 netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n"); 3720 3700 } 3721 3701 3722 - if (mlx5e_is_uplink_rep(priv)) { 3723 - features &= ~NETIF_F_HW_TLS_RX; 3724 - if (netdev->features & NETIF_F_HW_TLS_RX) 3725 - netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n"); 3726 - 3727 - features &= ~NETIF_F_HW_TLS_TX; 3728 - if (netdev->features & NETIF_F_HW_TLS_TX) 3729 - netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n"); 3730 - } 3702 + if (mlx5e_is_uplink_rep(priv)) 3703 + features = mlx5e_fix_uplink_rep_features(netdev, features); 3731 3704 3732 3705 mutex_unlock(&priv->state_lock); 3733 3706 ··· 4714 4701 if (MLX5_CAP_ETH(mdev, scatter_fcs)) 4715 4702 netdev->hw_features |= NETIF_F_RXFCS; 4716 4703 4704 + if (mlx5_qos_is_supported(mdev)) 4705 + netdev->hw_features |= NETIF_F_HW_TC; 4706 + 4717 4707 netdev->features = netdev->hw_features; 4718 4708 4719 4709 /* Defaults */ ··· 4737 4721 netdev->hw_features |= NETIF_F_NTUPLE; 4738 4722 #endif 4739 4723 } 4740 - if (mlx5_qos_is_supported(mdev)) 4741 - netdev->features |= NETIF_F_HW_TC; 4742 4724 4743 4725 netdev->features |= NETIF_F_HIGHDMA; 4744 4726 netdev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
+31 -2
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 452 452 static 453 453 struct mlx5_core_dev *mlx5e_hairpin_get_mdev(struct net *net, int ifindex) 454 454 { 455 + struct mlx5_core_dev *mdev; 455 456 struct net_device *netdev; 456 457 struct mlx5e_priv *priv; 457 458 458 - netdev = __dev_get_by_index(net, ifindex); 459 + netdev = dev_get_by_index(net, ifindex); 460 + if (!netdev) 461 + return ERR_PTR(-ENODEV); 462 + 459 463 priv = netdev_priv(netdev); 460 - return priv->mdev; 464 + mdev = priv->mdev; 465 + dev_put(netdev); 466 + 467 + /* Mirred tc action holds a refcount on the ifindex net_device (see 468 + * net/sched/act_mirred.c:tcf_mirred_get_dev). So, it's okay to continue using mdev 469 + * after dev_put(netdev), while we're in the context of adding a tc flow. 470 + * 471 + * The mdev pointer corresponds to the peer/out net_device of a hairpin. It is then 472 + * stored in a hairpin object, which exists until all flows, that refer to it, get 473 + * removed. 474 + * 475 + * On the other hand, after a hairpin object has been created, the peer net_device may 476 + * be removed/unbound while there are still some hairpin flows that are using it. This 477 + * case is handled by mlx5e_tc_hairpin_update_dead_peer, which is hooked to 478 + * NETDEV_UNREGISTER event of the peer net_device. 479 + */ 480 + return mdev; 461 481 } 462 482 463 483 static int mlx5e_hairpin_create_transport(struct mlx5e_hairpin *hp) ··· 660 640 661 641 func_mdev = priv->mdev; 662 642 peer_mdev = mlx5e_hairpin_get_mdev(dev_net(priv->netdev), peer_ifindex); 643 + if (IS_ERR(peer_mdev)) { 644 + err = PTR_ERR(peer_mdev); 645 + goto create_pair_err; 646 + } 663 647 664 648 pair = mlx5_core_hairpin_create(func_mdev, peer_mdev, params); 665 649 if (IS_ERR(pair)) { ··· 802 778 int err; 803 779 804 780 peer_mdev = mlx5e_hairpin_get_mdev(dev_net(priv->netdev), peer_ifindex); 781 + if (IS_ERR(peer_mdev)) { 782 + NL_SET_ERR_MSG_MOD(extack, "invalid ifindex of mirred device"); 783 + return PTR_ERR(peer_mdev); 784 + } 785 + 805 786 if (!MLX5_CAP_GEN(priv->mdev, hairpin) || !MLX5_CAP_GEN(peer_mdev, hairpin)) { 806 787 NL_SET_ERR_MSG_MOD(extack, "hairpin is not supported"); 807 788 return -EOPNOTSUPP;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 636 636 }; 637 637 638 638 struct mlx5_vport_tbl_attr { 639 - u16 chain; 639 + u32 chain; 640 640 u16 prio; 641 641 u16 vport; 642 642 const struct esw_vport_tbl_namespace *vport_ns;
+7 -3
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 382 382 { 383 383 dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 384 384 dest[dest_idx].vport.num = esw_attr->dests[attr_idx].rep->vport; 385 - dest[dest_idx].vport.vhca_id = 386 - MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id); 387 - if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) 385 + if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) { 386 + dest[dest_idx].vport.vhca_id = 387 + MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id); 388 388 dest[dest_idx].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID; 389 + } 389 390 if (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP) { 390 391 if (pkt_reformat) { 391 392 flow_act->action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; ··· 2368 2367 2369 2368 switch (event) { 2370 2369 case ESW_OFFLOADS_DEVCOM_PAIR: 2370 + if (mlx5_get_next_phys_dev(esw->dev) != peer_esw->dev) 2371 + break; 2372 + 2371 2373 if (mlx5_eswitch_vport_match_metadata_enabled(esw) != 2372 2374 mlx5_eswitch_vport_match_metadata_enabled(peer_esw)) 2373 2375 break;
+6 -4
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 1024 1024 static int connect_flow_table(struct mlx5_core_dev *dev, struct mlx5_flow_table *ft, 1025 1025 struct fs_prio *prio) 1026 1026 { 1027 - struct mlx5_flow_table *next_ft; 1027 + struct mlx5_flow_table *next_ft, *first_ft; 1028 1028 int err = 0; 1029 1029 1030 1030 /* Connect_prev_fts and update_root_ft_create are mutually exclusive */ 1031 1031 1032 - if (list_empty(&prio->node.children)) { 1032 + first_ft = list_first_entry_or_null(&prio->node.children, 1033 + struct mlx5_flow_table, node.list); 1034 + if (!first_ft || first_ft->level > ft->level) { 1033 1035 err = connect_prev_fts(dev, ft, prio); 1034 1036 if (err) 1035 1037 return err; 1036 1038 1037 - next_ft = find_next_chained_ft(prio); 1039 + next_ft = first_ft ? first_ft : find_next_chained_ft(prio); 1038 1040 err = connect_fwd_rules(dev, ft, next_ft); 1039 1041 if (err) 1040 1042 return err; ··· 2122 2120 node.list) == ft)) 2123 2121 return 0; 2124 2122 2125 - next_ft = find_next_chained_ft(prio); 2123 + next_ft = find_next_ft(ft); 2126 2124 err = connect_fwd_rules(dev, next_ft, ft); 2127 2125 if (err) 2128 2126 return err;
+10 -2
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 626 626 } 627 627 fw_reporter_ctx.err_synd = health->synd; 628 628 fw_reporter_ctx.miss_counter = health->miss_counter; 629 - devlink_health_report(health->fw_fatal_reporter, 630 - "FW fatal error reported", &fw_reporter_ctx); 629 + if (devlink_health_report(health->fw_fatal_reporter, 630 + "FW fatal error reported", &fw_reporter_ctx) == -ECANCELED) { 631 + /* If recovery wasn't performed, due to grace period, 632 + * unload the driver. This ensures that the driver 633 + * closes all its resources and it is not subjected to 634 + * requests from the kernel. 635 + */ 636 + mlx5_core_err(dev, "Driver is in error state. Unloading\n"); 637 + mlx5_unload_one(dev); 638 + } 631 639 } 632 640 633 641 static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = {
+107 -112
drivers/net/ethernet/pensando/ionic/ionic_lif.c
··· 30 30 */ 31 31 }; 32 32 33 - static void ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode); 33 + static void ionic_lif_rx_mode(struct ionic_lif *lif); 34 34 static int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr); 35 35 static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr); 36 36 static void ionic_link_status_check(struct ionic_lif *lif); ··· 54 54 cur_moder = net_dim_get_rx_moderation(dim->mode, dim->profile_ix); 55 55 qcq = container_of(dim, struct ionic_qcq, dim); 56 56 new_coal = ionic_coal_usec_to_hw(qcq->q.lif->ionic, cur_moder.usec); 57 - qcq->intr.dim_coal_hw = new_coal ? new_coal : 1; 57 + new_coal = new_coal ? new_coal : 1; 58 + 59 + if (qcq->intr.dim_coal_hw != new_coal) { 60 + unsigned int qi = qcq->cq.bound_q->index; 61 + struct ionic_lif *lif = qcq->q.lif; 62 + 63 + qcq->intr.dim_coal_hw = new_coal; 64 + 65 + ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, 66 + lif->rxqcqs[qi]->intr.index, 67 + qcq->intr.dim_coal_hw); 68 + } 69 + 58 70 dim->state = DIM_START_MEASURE; 59 71 } 60 72 ··· 90 78 91 79 switch (w->type) { 92 80 case IONIC_DW_TYPE_RX_MODE: 93 - ionic_lif_rx_mode(lif, w->rx_mode); 81 + ionic_lif_rx_mode(lif); 94 82 break; 95 83 case IONIC_DW_TYPE_RX_ADDR_ADD: 96 84 ionic_lif_addr_add(lif, w->addr); ··· 1314 1302 return 0; 1315 1303 } 1316 1304 1317 - static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add, 1318 - bool can_sleep) 1305 + static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add) 1319 1306 { 1320 - struct ionic_deferred_work *work; 1321 1307 unsigned int nmfilters; 1322 1308 unsigned int nufilters; 1323 1309 ··· 1341 1331 lif->nucast--; 1342 1332 } 1343 1333 1344 - if (!can_sleep) { 1345 - work = kzalloc(sizeof(*work), GFP_ATOMIC); 1346 - if (!work) 1347 - return -ENOMEM; 1348 - work->type = add ? IONIC_DW_TYPE_RX_ADDR_ADD : 1349 - IONIC_DW_TYPE_RX_ADDR_DEL; 1350 - memcpy(work->addr, addr, ETH_ALEN); 1351 - netdev_dbg(lif->netdev, "deferred: rx_filter %s %pM\n", 1352 - add ? "add" : "del", addr); 1353 - ionic_lif_deferred_enqueue(&lif->deferred, work); 1354 - } else { 1355 - netdev_dbg(lif->netdev, "rx_filter %s %pM\n", 1356 - add ? "add" : "del", addr); 1357 - if (add) 1358 - return ionic_lif_addr_add(lif, addr); 1359 - else 1360 - return ionic_lif_addr_del(lif, addr); 1361 - } 1334 + netdev_dbg(lif->netdev, "rx_filter %s %pM\n", 1335 + add ? "add" : "del", addr); 1336 + if (add) 1337 + return ionic_lif_addr_add(lif, addr); 1338 + else 1339 + return ionic_lif_addr_del(lif, addr); 1362 1340 1363 1341 return 0; 1364 1342 } 1365 1343 1366 1344 static int ionic_addr_add(struct net_device *netdev, const u8 *addr) 1367 1345 { 1368 - return ionic_lif_addr(netdev_priv(netdev), addr, ADD_ADDR, CAN_SLEEP); 1369 - } 1370 - 1371 - static int ionic_ndo_addr_add(struct net_device *netdev, const u8 *addr) 1372 - { 1373 - return ionic_lif_addr(netdev_priv(netdev), addr, ADD_ADDR, CAN_NOT_SLEEP); 1346 + return ionic_lif_addr(netdev_priv(netdev), addr, ADD_ADDR); 1374 1347 } 1375 1348 1376 1349 static int ionic_addr_del(struct net_device *netdev, const u8 *addr) 1377 1350 { 1378 - return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR, CAN_SLEEP); 1351 + return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR); 1379 1352 } 1380 1353 1381 - static int ionic_ndo_addr_del(struct net_device *netdev, const u8 *addr) 1354 + static void ionic_lif_rx_mode(struct ionic_lif *lif) 1382 1355 { 1383 - return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR, CAN_NOT_SLEEP); 1384 - } 1385 - 1386 - static void ionic_lif_rx_mode(struct ionic_lif *lif, unsigned int rx_mode) 1387 - { 1388 - struct ionic_admin_ctx ctx = { 1389 - .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), 1390 - .cmd.rx_mode_set = { 1391 - .opcode = IONIC_CMD_RX_MODE_SET, 1392 - .lif_index = cpu_to_le16(lif->index), 1393 - .rx_mode = cpu_to_le16(rx_mode), 1394 - }, 1395 - }; 1356 + struct net_device *netdev = lif->netdev; 1357 + unsigned int nfilters; 1358 + unsigned int nd_flags; 1396 1359 char buf[128]; 1397 - int err; 1360 + u16 rx_mode; 1398 1361 int i; 1399 1362 #define REMAIN(__x) (sizeof(buf) - (__x)) 1363 + 1364 + mutex_lock(&lif->config_lock); 1365 + 1366 + /* grab the flags once for local use */ 1367 + nd_flags = netdev->flags; 1368 + 1369 + rx_mode = IONIC_RX_MODE_F_UNICAST; 1370 + rx_mode |= (nd_flags & IFF_MULTICAST) ? IONIC_RX_MODE_F_MULTICAST : 0; 1371 + rx_mode |= (nd_flags & IFF_BROADCAST) ? IONIC_RX_MODE_F_BROADCAST : 0; 1372 + rx_mode |= (nd_flags & IFF_PROMISC) ? IONIC_RX_MODE_F_PROMISC : 0; 1373 + rx_mode |= (nd_flags & IFF_ALLMULTI) ? IONIC_RX_MODE_F_ALLMULTI : 0; 1374 + 1375 + /* sync unicast addresses 1376 + * next check to see if we're in an overflow state 1377 + * if so, we track that we overflowed and enable NIC PROMISC 1378 + * else if the overflow is set and not needed 1379 + * we remove our overflow flag and check the netdev flags 1380 + * to see if we can disable NIC PROMISC 1381 + */ 1382 + __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); 1383 + nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); 1384 + if (netdev_uc_count(netdev) + 1 > nfilters) { 1385 + rx_mode |= IONIC_RX_MODE_F_PROMISC; 1386 + lif->uc_overflow = true; 1387 + } else if (lif->uc_overflow) { 1388 + lif->uc_overflow = false; 1389 + if (!(nd_flags & IFF_PROMISC)) 1390 + rx_mode &= ~IONIC_RX_MODE_F_PROMISC; 1391 + } 1392 + 1393 + /* same for multicast */ 1394 + __dev_mc_sync(netdev, ionic_addr_add, ionic_addr_del); 1395 + nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); 1396 + if (netdev_mc_count(netdev) > nfilters) { 1397 + rx_mode |= IONIC_RX_MODE_F_ALLMULTI; 1398 + lif->mc_overflow = true; 1399 + } else if (lif->mc_overflow) { 1400 + lif->mc_overflow = false; 1401 + if (!(nd_flags & IFF_ALLMULTI)) 1402 + rx_mode &= ~IONIC_RX_MODE_F_ALLMULTI; 1403 + } 1400 1404 1401 1405 i = scnprintf(buf, sizeof(buf), "rx_mode 0x%04x -> 0x%04x:", 1402 1406 lif->rx_mode, rx_mode); ··· 1424 1400 i += scnprintf(&buf[i], REMAIN(i), " RX_MODE_F_PROMISC"); 1425 1401 if (rx_mode & IONIC_RX_MODE_F_ALLMULTI) 1426 1402 i += scnprintf(&buf[i], REMAIN(i), " RX_MODE_F_ALLMULTI"); 1427 - netdev_dbg(lif->netdev, "lif%d %s\n", lif->index, buf); 1403 + if (rx_mode & IONIC_RX_MODE_F_RDMA_SNIFFER) 1404 + i += scnprintf(&buf[i], REMAIN(i), " RX_MODE_F_RDMA_SNIFFER"); 1405 + netdev_dbg(netdev, "lif%d %s\n", lif->index, buf); 1428 1406 1429 - err = ionic_adminq_post_wait(lif, &ctx); 1430 - if (err) 1431 - netdev_warn(lif->netdev, "set rx_mode 0x%04x failed: %d\n", 1432 - rx_mode, err); 1433 - else 1434 - lif->rx_mode = rx_mode; 1407 + if (lif->rx_mode != rx_mode) { 1408 + struct ionic_admin_ctx ctx = { 1409 + .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), 1410 + .cmd.rx_mode_set = { 1411 + .opcode = IONIC_CMD_RX_MODE_SET, 1412 + .lif_index = cpu_to_le16(lif->index), 1413 + }, 1414 + }; 1415 + int err; 1416 + 1417 + ctx.cmd.rx_mode_set.rx_mode = cpu_to_le16(rx_mode); 1418 + err = ionic_adminq_post_wait(lif, &ctx); 1419 + if (err) 1420 + netdev_warn(netdev, "set rx_mode 0x%04x failed: %d\n", 1421 + rx_mode, err); 1422 + else 1423 + lif->rx_mode = rx_mode; 1424 + } 1425 + 1426 + mutex_unlock(&lif->config_lock); 1435 1427 } 1436 1428 1437 1429 static void ionic_set_rx_mode(struct net_device *netdev, bool can_sleep) 1438 1430 { 1439 1431 struct ionic_lif *lif = netdev_priv(netdev); 1440 1432 struct ionic_deferred_work *work; 1441 - unsigned int nfilters; 1442 - unsigned int rx_mode; 1443 1433 1444 - rx_mode = IONIC_RX_MODE_F_UNICAST; 1445 - rx_mode |= (netdev->flags & IFF_MULTICAST) ? IONIC_RX_MODE_F_MULTICAST : 0; 1446 - rx_mode |= (netdev->flags & IFF_BROADCAST) ? IONIC_RX_MODE_F_BROADCAST : 0; 1447 - rx_mode |= (netdev->flags & IFF_PROMISC) ? IONIC_RX_MODE_F_PROMISC : 0; 1448 - rx_mode |= (netdev->flags & IFF_ALLMULTI) ? IONIC_RX_MODE_F_ALLMULTI : 0; 1449 - 1450 - /* sync unicast addresses 1451 - * next check to see if we're in an overflow state 1452 - * if so, we track that we overflowed and enable NIC PROMISC 1453 - * else if the overflow is set and not needed 1454 - * we remove our overflow flag and check the netdev flags 1455 - * to see if we can disable NIC PROMISC 1456 - */ 1457 - if (can_sleep) 1458 - __dev_uc_sync(netdev, ionic_addr_add, ionic_addr_del); 1459 - else 1460 - __dev_uc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); 1461 - nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); 1462 - if (netdev_uc_count(netdev) + 1 > nfilters) { 1463 - rx_mode |= IONIC_RX_MODE_F_PROMISC; 1464 - lif->uc_overflow = true; 1465 - } else if (lif->uc_overflow) { 1466 - lif->uc_overflow = false; 1467 - if (!(netdev->flags & IFF_PROMISC)) 1468 - rx_mode &= ~IONIC_RX_MODE_F_PROMISC; 1469 - } 1470 - 1471 - /* same for multicast */ 1472 - if (can_sleep) 1473 - __dev_mc_sync(netdev, ionic_addr_add, ionic_addr_del); 1474 - else 1475 - __dev_mc_sync(netdev, ionic_ndo_addr_add, ionic_ndo_addr_del); 1476 - nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters); 1477 - if (netdev_mc_count(netdev) > nfilters) { 1478 - rx_mode |= IONIC_RX_MODE_F_ALLMULTI; 1479 - lif->mc_overflow = true; 1480 - } else if (lif->mc_overflow) { 1481 - lif->mc_overflow = false; 1482 - if (!(netdev->flags & IFF_ALLMULTI)) 1483 - rx_mode &= ~IONIC_RX_MODE_F_ALLMULTI; 1484 - } 1485 - 1486 - if (lif->rx_mode != rx_mode) { 1487 - if (!can_sleep) { 1488 - work = kzalloc(sizeof(*work), GFP_ATOMIC); 1489 - if (!work) { 1490 - netdev_err(lif->netdev, "rxmode change dropped\n"); 1491 - return; 1492 - } 1493 - work->type = IONIC_DW_TYPE_RX_MODE; 1494 - work->rx_mode = rx_mode; 1495 - netdev_dbg(lif->netdev, "deferred: rx_mode\n"); 1496 - ionic_lif_deferred_enqueue(&lif->deferred, work); 1497 - } else { 1498 - ionic_lif_rx_mode(lif, rx_mode); 1434 + if (!can_sleep) { 1435 + work = kzalloc(sizeof(*work), GFP_ATOMIC); 1436 + if (!work) { 1437 + netdev_err(lif->netdev, "rxmode change dropped\n"); 1438 + return; 1499 1439 } 1440 + work->type = IONIC_DW_TYPE_RX_MODE; 1441 + netdev_dbg(lif->netdev, "deferred: rx_mode\n"); 1442 + ionic_lif_deferred_enqueue(&lif->deferred, work); 1443 + } else { 1444 + ionic_lif_rx_mode(lif); 1500 1445 } 1501 1446 } 1502 1447 ··· 3067 3074 ionic_lif_qcq_deinit(lif, lif->notifyqcq); 3068 3075 ionic_lif_qcq_deinit(lif, lif->adminqcq); 3069 3076 3077 + mutex_destroy(&lif->config_lock); 3070 3078 mutex_destroy(&lif->queue_lock); 3071 3079 ionic_lif_reset(lif); 3072 3080 } ··· 3195 3201 */ 3196 3202 if (!ether_addr_equal(ctx.comp.lif_getattr.mac, 3197 3203 netdev->dev_addr)) 3198 - ionic_lif_addr(lif, netdev->dev_addr, ADD_ADDR, CAN_SLEEP); 3204 + ionic_lif_addr(lif, netdev->dev_addr, ADD_ADDR); 3199 3205 } else { 3200 3206 /* Update the netdev mac with the device's mac */ 3201 3207 memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len); ··· 3212 3218 3213 3219 netdev_dbg(lif->netdev, "adding station MAC addr %pM\n", 3214 3220 netdev->dev_addr); 3215 - ionic_lif_addr(lif, netdev->dev_addr, ADD_ADDR, CAN_SLEEP); 3221 + ionic_lif_addr(lif, netdev->dev_addr, ADD_ADDR); 3216 3222 3217 3223 return 0; 3218 3224 } ··· 3235 3241 3236 3242 lif->hw_index = le16_to_cpu(comp.hw_index); 3237 3243 mutex_init(&lif->queue_lock); 3244 + mutex_init(&lif->config_lock); 3238 3245 3239 3246 /* now that we have the hw_index we can figure out our doorbell page */ 3240 3247 lif->dbid_count = le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif);
+4 -7
drivers/net/ethernet/pensando/ionic/ionic_lif.h
··· 108 108 struct list_head list; 109 109 enum ionic_deferred_work_type type; 110 110 union { 111 - unsigned int rx_mode; 112 111 u8 addr[ETH_ALEN]; 113 112 u8 fw_status; 114 113 }; ··· 178 179 unsigned int index; 179 180 unsigned int hw_index; 180 181 struct mutex queue_lock; /* lock for queue structures */ 182 + struct mutex config_lock; /* lock for config actions */ 181 183 spinlock_t adminq_lock; /* lock for AdminQ operations */ 182 184 struct ionic_qcq *adminqcq; 183 185 struct ionic_qcq *notifyqcq; ··· 199 199 unsigned int nrxq_descs; 200 200 u32 rx_copybreak; 201 201 u64 rxq_features; 202 - unsigned int rx_mode; 202 + u16 rx_mode; 203 203 u64 hw_features; 204 204 bool registered; 205 205 bool mc_overflow; ··· 302 302 int ionic_lif_size(struct ionic *ionic); 303 303 304 304 #if IS_ENABLED(CONFIG_PTP_1588_CLOCK) 305 - int ionic_lif_hwstamp_replay(struct ionic_lif *lif); 305 + void ionic_lif_hwstamp_replay(struct ionic_lif *lif); 306 306 int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr); 307 307 int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr); 308 308 ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter); ··· 311 311 void ionic_lif_alloc_phc(struct ionic_lif *lif); 312 312 void ionic_lif_free_phc(struct ionic_lif *lif); 313 313 #else 314 - static inline int ionic_lif_hwstamp_replay(struct ionic_lif *lif) 315 - { 316 - return -EOPNOTSUPP; 317 - } 314 + static inline void ionic_lif_hwstamp_replay(struct ionic_lif *lif) {} 318 315 319 316 static inline int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr) 320 317 {
+7 -3
drivers/net/ethernet/pensando/ionic/ionic_phc.c
··· 188 188 struct hwtstamp_config config; 189 189 int err; 190 190 191 + if (!lif->phc || !lif->phc->ptp) 192 + return -EOPNOTSUPP; 193 + 191 194 if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) 192 195 return -EFAULT; 193 196 ··· 206 203 return 0; 207 204 } 208 205 209 - int ionic_lif_hwstamp_replay(struct ionic_lif *lif) 206 + void ionic_lif_hwstamp_replay(struct ionic_lif *lif) 210 207 { 211 208 int err; 209 + 210 + if (!lif->phc || !lif->phc->ptp) 211 + return; 212 212 213 213 err = ionic_lif_hwstamp_set_ts_config(lif, NULL); 214 214 if (err) 215 215 netdev_info(lif->netdev, "hwstamp replay failed: %d\n", err); 216 - 217 - return err; 218 216 } 219 217 220 218 int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr)
+25 -16
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 269 269 } 270 270 } 271 271 272 - if (likely(netdev->features & NETIF_F_RXCSUM)) { 273 - if (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { 274 - skb->ip_summed = CHECKSUM_COMPLETE; 275 - skb->csum = (__force __wsum)le16_to_cpu(comp->csum); 276 - stats->csum_complete++; 277 - } 272 + if (likely(netdev->features & NETIF_F_RXCSUM) && 273 + (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC)) { 274 + skb->ip_summed = CHECKSUM_COMPLETE; 275 + skb->csum = (__force __wsum)le16_to_cpu(comp->csum); 276 + stats->csum_complete++; 278 277 } else { 279 278 stats->csum_none++; 280 279 } ··· 445 446 q->tail_idx = 0; 446 447 } 447 448 448 - static void ionic_dim_update(struct ionic_qcq *qcq) 449 + static void ionic_dim_update(struct ionic_qcq *qcq, int napi_mode) 449 450 { 450 451 struct dim_sample dim_sample; 451 452 struct ionic_lif *lif; 452 453 unsigned int qi; 454 + u64 pkts, bytes; 453 455 454 456 if (!qcq->intr.dim_coal_hw) 455 457 return; ··· 458 458 lif = qcq->q.lif; 459 459 qi = qcq->cq.bound_q->index; 460 460 461 - ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, 462 - lif->rxqcqs[qi]->intr.index, 463 - qcq->intr.dim_coal_hw); 461 + switch (napi_mode) { 462 + case IONIC_LIF_F_TX_DIM_INTR: 463 + pkts = lif->txqstats[qi].pkts; 464 + bytes = lif->txqstats[qi].bytes; 465 + break; 466 + case IONIC_LIF_F_RX_DIM_INTR: 467 + pkts = lif->rxqstats[qi].pkts; 468 + bytes = lif->rxqstats[qi].bytes; 469 + break; 470 + default: 471 + pkts = lif->txqstats[qi].pkts + lif->rxqstats[qi].pkts; 472 + bytes = lif->txqstats[qi].bytes + lif->rxqstats[qi].bytes; 473 + break; 474 + } 464 475 465 476 dim_update_sample(qcq->cq.bound_intr->rearm_count, 466 - lif->txqstats[qi].pkts, 467 - lif->txqstats[qi].bytes, 468 - &dim_sample); 477 + pkts, bytes, &dim_sample); 469 478 470 479 net_dim(&qcq->dim, dim_sample); 471 480 } ··· 495 486 ionic_tx_service, NULL, NULL); 496 487 497 488 if (work_done < budget && napi_complete_done(napi, work_done)) { 498 - ionic_dim_update(qcq); 489 + ionic_dim_update(qcq, IONIC_LIF_F_TX_DIM_INTR); 499 490 flags |= IONIC_INTR_CRED_UNMASK; 500 491 cq->bound_intr->rearm_count++; 501 492 } ··· 534 525 ionic_rx_fill(cq->bound_q); 535 526 536 527 if (work_done < budget && napi_complete_done(napi, work_done)) { 537 - ionic_dim_update(qcq); 528 + ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR); 538 529 flags |= IONIC_INTR_CRED_UNMASK; 539 530 cq->bound_intr->rearm_count++; 540 531 } ··· 580 571 ionic_rx_fill(rxcq->bound_q); 581 572 582 573 if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { 583 - ionic_dim_update(qcq); 574 + ionic_dim_update(qcq, 0); 584 575 flags |= IONIC_INTR_CRED_UNMASK; 585 576 rxcq->bound_intr->rearm_count++; 586 577 }
+2 -2
drivers/net/ethernet/qlogic/qede/qede_filter.c
··· 831 831 int qede_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) 832 832 { 833 833 struct qede_dev *edev = netdev_priv(dev); 834 - struct qede_vlan *vlan = NULL; 834 + struct qede_vlan *vlan; 835 835 int rc = 0; 836 836 837 837 DP_VERBOSE(edev, NETIF_MSG_IFDOWN, "Removing vlan 0x%04x\n", vid); ··· 842 842 if (vlan->vid == vid) 843 843 break; 844 844 845 - if (!vlan || (vlan->vid != vid)) { 845 + if (list_entry_is_head(vlan, &edev->vlan_list, list)) { 846 846 DP_VERBOSE(edev, (NETIF_MSG_IFUP | NETIF_MSG_IFDOWN), 847 847 "Vlan isn't configured\n"); 848 848 goto out;
+3 -3
drivers/net/ethernet/qlogic/qla3xxx.c
··· 154 154 "driver lock acquired\n"); 155 155 return 1; 156 156 } 157 - ssleep(1); 157 + mdelay(1000); 158 158 } while (++i < 10); 159 159 160 160 netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); ··· 3274 3274 if ((value & ISP_CONTROL_SR) == 0) 3275 3275 break; 3276 3276 3277 - ssleep(1); 3277 + mdelay(1000); 3278 3278 } while ((--max_wait_time)); 3279 3279 3280 3280 /* ··· 3310 3310 ispControlStatus); 3311 3311 if ((value & ISP_CONTROL_FSR) == 0) 3312 3312 break; 3313 - ssleep(1); 3313 + mdelay(1000); 3314 3314 } while ((--max_wait_time)); 3315 3315 } 3316 3316 if (max_wait_time == 0)
+2 -5
drivers/net/ethernet/sis/sis900.c
··· 443 443 #endif 444 444 445 445 /* setup various bits in PCI command register */ 446 - ret = pci_enable_device(pci_dev); 446 + ret = pcim_enable_device(pci_dev); 447 447 if(ret) return ret; 448 448 449 449 i = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); ··· 469 469 ioaddr = pci_iomap(pci_dev, 0, 0); 470 470 if (!ioaddr) { 471 471 ret = -ENOMEM; 472 - goto err_out_cleardev; 472 + goto err_out; 473 473 } 474 474 475 475 sis_priv = netdev_priv(net_dev); ··· 581 581 sis_priv->tx_ring_dma); 582 582 err_out_unmap: 583 583 pci_iounmap(pci_dev, ioaddr); 584 - err_out_cleardev: 585 - pci_release_regions(pci_dev); 586 584 err_out: 587 585 free_netdev(net_dev); 588 586 return ret; ··· 2497 2499 sis_priv->tx_ring_dma); 2498 2500 pci_iounmap(pci_dev, sis_priv->ioaddr); 2499 2501 free_netdev(net_dev); 2500 - pci_release_regions(pci_dev); 2501 2502 } 2502 2503 2503 2504 static int __maybe_unused sis900_suspend(struct device *dev)
+2
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
··· 1249 1249 .config_l3_filter = dwmac4_config_l3_filter, 1250 1250 .config_l4_filter = dwmac4_config_l4_filter, 1251 1251 .est_configure = dwmac5_est_configure, 1252 + .est_irq_status = dwmac5_est_irq_status, 1252 1253 .fpe_configure = dwmac5_fpe_configure, 1253 1254 .fpe_send_mpacket = dwmac5_fpe_send_mpacket, 1254 1255 .fpe_irq_status = dwmac5_fpe_irq_status, ··· 1301 1300 .config_l3_filter = dwmac4_config_l3_filter, 1302 1301 .config_l4_filter = dwmac4_config_l4_filter, 1303 1302 .est_configure = dwmac5_est_configure, 1303 + .est_irq_status = dwmac5_est_irq_status, 1304 1304 .fpe_configure = dwmac5_fpe_configure, 1305 1305 .fpe_send_mpacket = dwmac5_fpe_send_mpacket, 1306 1306 .fpe_irq_status = dwmac5_fpe_irq_status,
+2 -1
drivers/net/ethernet/sun/niu.c
··· 8191 8191 err = niu_pci_vpd_scan_props(np, here, end); 8192 8192 if (err < 0) 8193 8193 return err; 8194 + /* ret == 1 is not an error */ 8194 8195 if (err == 1) 8195 - return -EINVAL; 8196 + return 0; 8196 8197 } 8197 8198 return 0; 8198 8199 }
+1 -1
drivers/net/phy/broadcom.c
··· 288 288 if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) { 289 289 if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E || 290 290 BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 || 291 - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) 291 + BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811) 292 292 val |= BCM54XX_SHD_SCR3_RXCTXC_DIS; 293 293 else 294 294 val |= BCM54XX_SHD_SCR3_TRDDAPD;
+32 -20
drivers/net/wireless/virt_wifi.c
··· 136 136 /* Assigned at module init. Guaranteed locally-administered and unicast. */ 137 137 static u8 fake_router_bssid[ETH_ALEN] __ro_after_init = {}; 138 138 139 + static void virt_wifi_inform_bss(struct wiphy *wiphy) 140 + { 141 + u64 tsf = div_u64(ktime_get_boottime_ns(), 1000); 142 + struct cfg80211_bss *informed_bss; 143 + static const struct { 144 + u8 tag; 145 + u8 len; 146 + u8 ssid[8]; 147 + } __packed ssid = { 148 + .tag = WLAN_EID_SSID, 149 + .len = 8, 150 + .ssid = "VirtWifi", 151 + }; 152 + 153 + informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz, 154 + CFG80211_BSS_FTYPE_PRESP, 155 + fake_router_bssid, tsf, 156 + WLAN_CAPABILITY_ESS, 0, 157 + (void *)&ssid, sizeof(ssid), 158 + DBM_TO_MBM(-50), GFP_KERNEL); 159 + cfg80211_put_bss(wiphy, informed_bss); 160 + } 161 + 139 162 /* Called with the rtnl lock held. */ 140 163 static int virt_wifi_scan(struct wiphy *wiphy, 141 164 struct cfg80211_scan_request *request) ··· 179 156 /* Acquires and releases the rdev BSS lock. */ 180 157 static void virt_wifi_scan_result(struct work_struct *work) 181 158 { 182 - struct { 183 - u8 tag; 184 - u8 len; 185 - u8 ssid[8]; 186 - } __packed ssid = { 187 - .tag = WLAN_EID_SSID, .len = 8, .ssid = "VirtWifi", 188 - }; 189 - struct cfg80211_bss *informed_bss; 190 159 struct virt_wifi_wiphy_priv *priv = 191 160 container_of(work, struct virt_wifi_wiphy_priv, 192 161 scan_result.work); 193 162 struct wiphy *wiphy = priv_to_wiphy(priv); 194 163 struct cfg80211_scan_info scan_info = { .aborted = false }; 195 - u64 tsf = div_u64(ktime_get_boottime_ns(), 1000); 196 164 197 - informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz, 198 - CFG80211_BSS_FTYPE_PRESP, 199 - fake_router_bssid, tsf, 200 - WLAN_CAPABILITY_ESS, 0, 201 - (void *)&ssid, sizeof(ssid), 202 - DBM_TO_MBM(-50), GFP_KERNEL); 203 - cfg80211_put_bss(wiphy, informed_bss); 165 + virt_wifi_inform_bss(wiphy); 204 166 205 167 /* Schedules work which acquires and releases the rtnl lock. */ 206 168 cfg80211_scan_done(priv->scan_request, &scan_info); ··· 233 225 if (!could_schedule) 234 226 return -EBUSY; 235 227 236 - if (sme->bssid) 228 + if (sme->bssid) { 237 229 ether_addr_copy(priv->connect_requested_bss, sme->bssid); 238 - else 230 + } else { 231 + virt_wifi_inform_bss(wiphy); 239 232 eth_zero_addr(priv->connect_requested_bss); 233 + } 240 234 241 235 wiphy_debug(wiphy, "connect\n"); 242 236 ··· 251 241 struct virt_wifi_netdev_priv *priv = 252 242 container_of(work, struct virt_wifi_netdev_priv, connect.work); 253 243 u8 *requested_bss = priv->connect_requested_bss; 254 - bool has_addr = !is_zero_ether_addr(requested_bss); 255 244 bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid); 256 245 u16 status = WLAN_STATUS_SUCCESS; 257 246 258 - if (!priv->is_up || (has_addr && !right_addr)) 247 + if (is_zero_ether_addr(requested_bss)) 248 + requested_bss = NULL; 249 + 250 + if (!priv->is_up || (requested_bss && !right_addr)) 259 251 status = WLAN_STATUS_UNSPECIFIED_FAILURE; 260 252 else 261 253 priv->is_connected = true;
+1 -2
drivers/nfc/nfcsim.c
··· 192 192 193 193 if (!IS_ERR(skb)) 194 194 dev_kfree_skb(skb); 195 - 196 - skb = ERR_PTR(-ENODEV); 195 + return; 197 196 } 198 197 199 198 dev->cb(dev->nfc_digital_dev, dev->arg, skb);
+1 -1
drivers/nfc/s3fwrn5/firmware.c
··· 422 422 tfm = crypto_alloc_shash("sha1", 0, 0); 423 423 if (IS_ERR(tfm)) { 424 424 dev_err(&fw_info->ndev->nfc_dev->dev, 425 - "Cannot allocate shash (code=%d)\n", ret); 425 + "Cannot allocate shash (code=%pe)\n", tfm); 426 426 return PTR_ERR(tfm); 427 427 } 428 428
+15 -4
drivers/nvme/host/core.c
··· 900 900 cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); 901 901 cmnd->write_zeroes.length = 902 902 cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1); 903 - cmnd->write_zeroes.control = 0; 903 + if (nvme_ns_has_pi(ns)) 904 + cmnd->write_zeroes.control = cpu_to_le16(NVME_RW_PRINFO_PRACT); 905 + else 906 + cmnd->write_zeroes.control = 0; 904 907 return BLK_STS_OK; 905 908 } 906 909 ··· 3810 3807 3811 3808 static void nvme_ns_remove(struct nvme_ns *ns) 3812 3809 { 3810 + bool last_path = false; 3811 + 3813 3812 if (test_and_set_bit(NVME_NS_REMOVING, &ns->flags)) 3814 3813 return; 3815 3814 ··· 3820 3815 3821 3816 mutex_lock(&ns->ctrl->subsys->lock); 3822 3817 list_del_rcu(&ns->siblings); 3823 - if (list_empty(&ns->head->list)) 3824 - list_del_init(&ns->head->entry); 3825 3818 mutex_unlock(&ns->ctrl->subsys->lock); 3826 3819 3827 3820 synchronize_rcu(); /* guarantee not available in head->list */ ··· 3839 3836 list_del_init(&ns->list); 3840 3837 up_write(&ns->ctrl->namespaces_rwsem); 3841 3838 3842 - nvme_mpath_check_last_path(ns); 3839 + /* Synchronize with nvme_init_ns_head() */ 3840 + mutex_lock(&ns->head->subsys->lock); 3841 + if (list_empty(&ns->head->list)) { 3842 + list_del_init(&ns->head->entry); 3843 + last_path = true; 3844 + } 3845 + mutex_unlock(&ns->head->subsys->lock); 3846 + if (last_path) 3847 + nvme_mpath_shutdown_disk(ns->head); 3843 3848 nvme_put_ns(ns); 3844 3849 } 3845 3850
+8 -1
drivers/nvme/host/multipath.c
··· 760 760 #endif 761 761 } 762 762 763 - void nvme_mpath_remove_disk(struct nvme_ns_head *head) 763 + void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) 764 764 { 765 765 if (!head->disk) 766 766 return; 767 + kblockd_schedule_work(&head->requeue_work); 767 768 if (head->disk->flags & GENHD_FL_UP) { 768 769 nvme_cdev_del(&head->cdev, &head->cdev_device); 769 770 del_gendisk(head->disk); 770 771 } 772 + } 773 + 774 + void nvme_mpath_remove_disk(struct nvme_ns_head *head) 775 + { 776 + if (!head->disk) 777 + return; 771 778 blk_set_queue_dying(head->disk->queue); 772 779 /* make sure all pending bios are cleaned up */ 773 780 kblockd_schedule_work(&head->requeue_work);
+2 -9
drivers/nvme/host/nvme.h
··· 716 716 void nvme_mpath_stop(struct nvme_ctrl *ctrl); 717 717 bool nvme_mpath_clear_current_path(struct nvme_ns *ns); 718 718 void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl); 719 - 720 - static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) 721 - { 722 - struct nvme_ns_head *head = ns->head; 723 - 724 - if (head->disk && list_empty(&head->list)) 725 - kblockd_schedule_work(&head->requeue_work); 726 - } 719 + void nvme_mpath_shutdown_disk(struct nvme_ns_head *head); 727 720 728 721 static inline void nvme_trace_bio_complete(struct request *req) 729 722 { ··· 765 772 static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) 766 773 { 767 774 } 768 - static inline void nvme_mpath_check_last_path(struct nvme_ns *ns) 775 + static inline void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) 769 776 { 770 777 } 771 778 static inline void nvme_trace_bio_complete(struct request *req)
+3 -1
drivers/nvme/host/pci.c
··· 2631 2631 bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); 2632 2632 int result; 2633 2633 2634 - if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { 2634 + if (dev->ctrl.state != NVME_CTRL_RESETTING) { 2635 + dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n", 2636 + dev->ctrl.state); 2635 2637 result = -ENODEV; 2636 2638 goto out; 2637 2639 }
+3 -3
drivers/nvme/host/trace.h
··· 56 56 __field(u8, fctype) 57 57 __field(u16, cid) 58 58 __field(u32, nsid) 59 - __field(u64, metadata) 59 + __field(bool, metadata) 60 60 __array(u8, cdw10, 24) 61 61 ), 62 62 TP_fast_assign( ··· 66 66 __entry->flags = cmd->common.flags; 67 67 __entry->cid = cmd->common.command_id; 68 68 __entry->nsid = le32_to_cpu(cmd->common.nsid); 69 - __entry->metadata = le64_to_cpu(cmd->common.metadata); 69 + __entry->metadata = !!blk_integrity_rq(req); 70 70 __entry->fctype = cmd->fabrics.fctype; 71 71 __assign_disk_name(__entry->disk, req->rq_disk); 72 72 memcpy(__entry->cdw10, &cmd->common.cdw10, 73 73 sizeof(__entry->cdw10)); 74 74 ), 75 - TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%llx, cmd=(%s %s)", 75 + TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)", 76 76 __entry->ctrl_id, __print_disk_name(__entry->disk), 77 77 __entry->qid, __entry->cid, __entry->nsid, 78 78 __entry->flags, __entry->metadata,
+225 -24
drivers/platform/x86/amd-pmc.c
··· 46 46 #define AMD_PMC_RESULT_CMD_UNKNOWN 0xFE 47 47 #define AMD_PMC_RESULT_FAILED 0xFF 48 48 49 + /* FCH SSC Registers */ 50 + #define FCH_S0I3_ENTRY_TIME_L_OFFSET 0x30 51 + #define FCH_S0I3_ENTRY_TIME_H_OFFSET 0x34 52 + #define FCH_S0I3_EXIT_TIME_L_OFFSET 0x38 53 + #define FCH_S0I3_EXIT_TIME_H_OFFSET 0x3C 54 + #define FCH_SSC_MAPPING_SIZE 0x800 55 + #define FCH_BASE_PHY_ADDR_LOW 0xFED81100 56 + #define FCH_BASE_PHY_ADDR_HIGH 0x00000000 57 + 58 + /* SMU Message Definations */ 59 + #define SMU_MSG_GETSMUVERSION 0x02 60 + #define SMU_MSG_LOG_GETDRAM_ADDR_HI 0x04 61 + #define SMU_MSG_LOG_GETDRAM_ADDR_LO 0x05 62 + #define SMU_MSG_LOG_START 0x06 63 + #define SMU_MSG_LOG_RESET 0x07 64 + #define SMU_MSG_LOG_DUMP_DATA 0x08 65 + #define SMU_MSG_GET_SUP_CONSTRAINTS 0x09 49 66 /* List of supported CPU ids */ 50 67 #define AMD_CPU_ID_RV 0x15D0 51 68 #define AMD_CPU_ID_RN 0x1630 52 69 #define AMD_CPU_ID_PCO AMD_CPU_ID_RV 53 70 #define AMD_CPU_ID_CZN AMD_CPU_ID_RN 71 + #define AMD_CPU_ID_YC 0x14B5 54 72 55 - #define AMD_SMU_FW_VERSION 0x0 56 73 #define PMC_MSG_DELAY_MIN_US 100 57 74 #define RESPONSE_REGISTER_LOOP_MAX 200 58 75 76 + #define SOC_SUBSYSTEM_IP_MAX 12 77 + #define DELAY_MIN_US 2000 78 + #define DELAY_MAX_US 3000 59 79 enum amd_pmc_def { 60 80 MSG_TEST = 0x01, 61 81 MSG_OS_HINT_PCO, 62 82 MSG_OS_HINT_RN, 63 83 }; 64 84 85 + struct amd_pmc_bit_map { 86 + const char *name; 87 + u32 bit_mask; 88 + }; 89 + 90 + static const struct amd_pmc_bit_map soc15_ip_blk[] = { 91 + {"DISPLAY", BIT(0)}, 92 + {"CPU", BIT(1)}, 93 + {"GFX", BIT(2)}, 94 + {"VDD", BIT(3)}, 95 + {"ACP", BIT(4)}, 96 + {"VCN", BIT(5)}, 97 + {"ISP", BIT(6)}, 98 + {"NBIO", BIT(7)}, 99 + {"DF", BIT(8)}, 100 + {"USB0", BIT(9)}, 101 + {"USB1", BIT(10)}, 102 + {"LAPIC", BIT(11)}, 103 + {} 104 + }; 105 + 65 106 struct amd_pmc_dev { 66 107 void __iomem *regbase; 67 - void __iomem *smu_base; 108 + void __iomem *smu_virt_addr; 109 + void __iomem *fch_virt_addr; 68 110 u32 base_addr; 69 111 u32 cpu_id; 112 + u32 active_ips; 70 113 struct device *dev; 114 + struct mutex lock; /* generic mutex lock */ 71 115 #if IS_ENABLED(CONFIG_DEBUG_FS) 72 116 struct dentry *dbgfs_dir; 73 117 #endif /* CONFIG_DEBUG_FS */ 74 118 }; 75 119 76 120 static struct amd_pmc_dev pmc; 121 + static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, bool set, u32 *data, u8 msg, bool ret); 77 122 78 123 static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset) 79 124 { ··· 130 85 iowrite32(val, dev->regbase + reg_offset); 131 86 } 132 87 88 + struct smu_metrics { 89 + u32 table_version; 90 + u32 hint_count; 91 + u32 s0i3_cyclecount; 92 + u32 timein_s0i2; 93 + u64 timeentering_s0i3_lastcapture; 94 + u64 timeentering_s0i3_totaltime; 95 + u64 timeto_resume_to_os_lastcapture; 96 + u64 timeto_resume_to_os_totaltime; 97 + u64 timein_s0i3_lastcapture; 98 + u64 timein_s0i3_totaltime; 99 + u64 timein_swdrips_lastcapture; 100 + u64 timein_swdrips_totaltime; 101 + u64 timecondition_notmet_lastcapture[SOC_SUBSYSTEM_IP_MAX]; 102 + u64 timecondition_notmet_totaltime[SOC_SUBSYSTEM_IP_MAX]; 103 + } __packed; 104 + 133 105 #ifdef CONFIG_DEBUG_FS 134 106 static int smu_fw_info_show(struct seq_file *s, void *unused) 135 107 { 136 108 struct amd_pmc_dev *dev = s->private; 137 - u32 value; 109 + struct smu_metrics table; 110 + int idx; 138 111 139 - value = ioread32(dev->smu_base + AMD_SMU_FW_VERSION); 140 - seq_printf(s, "SMU FW Info: %x\n", value); 112 + if (dev->cpu_id == AMD_CPU_ID_PCO) 113 + return -EINVAL; 114 + 115 + memcpy_fromio(&table, dev->smu_virt_addr, sizeof(struct smu_metrics)); 116 + 117 + seq_puts(s, "\n=== SMU Statistics ===\n"); 118 + seq_printf(s, "Table Version: %d\n", table.table_version); 119 + seq_printf(s, "Hint Count: %d\n", table.hint_count); 120 + seq_printf(s, "S0i3 Cycle Count: %d\n", table.s0i3_cyclecount); 121 + seq_printf(s, "Time (in us) to S0i3: %lld\n", table.timeentering_s0i3_lastcapture); 122 + seq_printf(s, "Time (in us) in S0i3: %lld\n", table.timein_s0i3_lastcapture); 123 + 124 + seq_puts(s, "\n=== Active time (in us) ===\n"); 125 + for (idx = 0 ; idx < SOC_SUBSYSTEM_IP_MAX ; idx++) { 126 + if (soc15_ip_blk[idx].bit_mask & dev->active_ips) 127 + seq_printf(s, "%-8s : %lld\n", soc15_ip_blk[idx].name, 128 + table.timecondition_notmet_lastcapture[idx]); 129 + } 130 + 141 131 return 0; 142 132 } 143 133 DEFINE_SHOW_ATTRIBUTE(smu_fw_info); 134 + 135 + static int s0ix_stats_show(struct seq_file *s, void *unused) 136 + { 137 + struct amd_pmc_dev *dev = s->private; 138 + u64 entry_time, exit_time, residency; 139 + 140 + entry_time = ioread32(dev->fch_virt_addr + FCH_S0I3_ENTRY_TIME_H_OFFSET); 141 + entry_time = entry_time << 32 | ioread32(dev->fch_virt_addr + FCH_S0I3_ENTRY_TIME_L_OFFSET); 142 + 143 + exit_time = ioread32(dev->fch_virt_addr + FCH_S0I3_EXIT_TIME_H_OFFSET); 144 + exit_time = exit_time << 32 | ioread32(dev->fch_virt_addr + FCH_S0I3_EXIT_TIME_L_OFFSET); 145 + 146 + /* It's in 48MHz. We need to convert it */ 147 + residency = exit_time - entry_time; 148 + do_div(residency, 48); 149 + 150 + seq_puts(s, "=== S0ix statistics ===\n"); 151 + seq_printf(s, "S0ix Entry Time: %lld\n", entry_time); 152 + seq_printf(s, "S0ix Exit Time: %lld\n", exit_time); 153 + seq_printf(s, "Residency Time: %lld\n", residency); 154 + 155 + return 0; 156 + } 157 + DEFINE_SHOW_ATTRIBUTE(s0ix_stats); 144 158 145 159 static void amd_pmc_dbgfs_unregister(struct amd_pmc_dev *dev) 146 160 { ··· 211 107 dev->dbgfs_dir = debugfs_create_dir("amd_pmc", NULL); 212 108 debugfs_create_file("smu_fw_info", 0644, dev->dbgfs_dir, dev, 213 109 &smu_fw_info_fops); 110 + debugfs_create_file("s0ix_stats", 0644, dev->dbgfs_dir, dev, 111 + &s0ix_stats_fops); 214 112 } 215 113 #else 216 114 static inline void amd_pmc_dbgfs_register(struct amd_pmc_dev *dev) ··· 223 117 { 224 118 } 225 119 #endif /* CONFIG_DEBUG_FS */ 120 + 121 + static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) 122 + { 123 + u32 phys_addr_low, phys_addr_hi; 124 + u64 smu_phys_addr; 125 + 126 + if (dev->cpu_id == AMD_CPU_ID_PCO) 127 + return -EINVAL; 128 + 129 + /* Get Active devices list from SMU */ 130 + amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); 131 + 132 + /* Get dram address */ 133 + amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); 134 + amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); 135 + smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); 136 + 137 + dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, sizeof(struct smu_metrics)); 138 + if (!dev->smu_virt_addr) 139 + return -ENOMEM; 140 + 141 + /* Start the logging */ 142 + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); 143 + 144 + return 0; 145 + } 226 146 227 147 static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) 228 148 { ··· 264 132 dev_dbg(dev->dev, "AMD_PMC_REGISTER_MESSAGE:%x\n", value); 265 133 } 266 134 267 - static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, bool set) 135 + static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, bool set, u32 *data, u8 msg, bool ret) 268 136 { 269 137 int rc; 270 - u8 msg; 271 138 u32 val; 272 139 140 + mutex_lock(&dev->lock); 273 141 /* Wait until we get a valid response */ 274 142 rc = readx_poll_timeout(ioread32, dev->regbase + AMD_PMC_REGISTER_RESPONSE, 275 - val, val > 0, PMC_MSG_DELAY_MIN_US, 143 + val, val != 0, PMC_MSG_DELAY_MIN_US, 276 144 PMC_MSG_DELAY_MIN_US * RESPONSE_REGISTER_LOOP_MAX); 277 145 if (rc) { 278 146 dev_err(dev->dev, "failed to talk to SMU\n"); 279 - return rc; 147 + goto out_unlock; 280 148 } 281 149 282 150 /* Write zero to response register */ ··· 286 154 amd_pmc_reg_write(dev, AMD_PMC_REGISTER_ARGUMENT, set); 287 155 288 156 /* Write message ID to message ID register */ 289 - msg = (dev->cpu_id == AMD_CPU_ID_RN) ? MSG_OS_HINT_RN : MSG_OS_HINT_PCO; 290 157 amd_pmc_reg_write(dev, AMD_PMC_REGISTER_MESSAGE, msg); 291 - return 0; 158 + 159 + /* Wait until we get a valid response */ 160 + rc = readx_poll_timeout(ioread32, dev->regbase + AMD_PMC_REGISTER_RESPONSE, 161 + val, val != 0, PMC_MSG_DELAY_MIN_US, 162 + PMC_MSG_DELAY_MIN_US * RESPONSE_REGISTER_LOOP_MAX); 163 + if (rc) { 164 + dev_err(dev->dev, "SMU response timed out\n"); 165 + goto out_unlock; 166 + } 167 + 168 + switch (val) { 169 + case AMD_PMC_RESULT_OK: 170 + if (ret) { 171 + /* PMFW may take longer time to return back the data */ 172 + usleep_range(DELAY_MIN_US, 10 * DELAY_MAX_US); 173 + *data = amd_pmc_reg_read(dev, AMD_PMC_REGISTER_ARGUMENT); 174 + } 175 + break; 176 + case AMD_PMC_RESULT_CMD_REJECT_BUSY: 177 + dev_err(dev->dev, "SMU not ready. err: 0x%x\n", val); 178 + rc = -EBUSY; 179 + goto out_unlock; 180 + case AMD_PMC_RESULT_CMD_UNKNOWN: 181 + dev_err(dev->dev, "SMU cmd unknown. err: 0x%x\n", val); 182 + rc = -EINVAL; 183 + goto out_unlock; 184 + case AMD_PMC_RESULT_CMD_REJECT_PREREQ: 185 + case AMD_PMC_RESULT_FAILED: 186 + default: 187 + dev_err(dev->dev, "SMU cmd failed. err: 0x%x\n", val); 188 + rc = -EIO; 189 + goto out_unlock; 190 + } 191 + 192 + out_unlock: 193 + mutex_unlock(&dev->lock); 194 + amd_pmc_dump_registers(dev); 195 + return rc; 196 + } 197 + 198 + static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev) 199 + { 200 + switch (dev->cpu_id) { 201 + case AMD_CPU_ID_PCO: 202 + return MSG_OS_HINT_PCO; 203 + case AMD_CPU_ID_RN: 204 + case AMD_CPU_ID_YC: 205 + return MSG_OS_HINT_RN; 206 + } 207 + return -EINVAL; 292 208 } 293 209 294 210 static int __maybe_unused amd_pmc_suspend(struct device *dev) 295 211 { 296 212 struct amd_pmc_dev *pdev = dev_get_drvdata(dev); 297 213 int rc; 214 + u8 msg; 298 215 299 - rc = amd_pmc_send_cmd(pdev, 1); 216 + /* Reset and Start SMU logging - to monitor the s0i3 stats */ 217 + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_RESET, 0); 218 + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_START, 0); 219 + 220 + msg = amd_pmc_get_os_hint(pdev); 221 + rc = amd_pmc_send_cmd(pdev, 1, NULL, msg, 0); 300 222 if (rc) 301 223 dev_err(pdev->dev, "suspend failed\n"); 302 224 303 - amd_pmc_dump_registers(pdev); 304 - return 0; 225 + return rc; 305 226 } 306 227 307 228 static int __maybe_unused amd_pmc_resume(struct device *dev) 308 229 { 309 230 struct amd_pmc_dev *pdev = dev_get_drvdata(dev); 310 231 int rc; 232 + u8 msg; 311 233 312 - rc = amd_pmc_send_cmd(pdev, 0); 234 + /* Let SMU know that we are looking for stats */ 235 + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_DUMP_DATA, 0); 236 + 237 + msg = amd_pmc_get_os_hint(pdev); 238 + rc = amd_pmc_send_cmd(pdev, 0, NULL, msg, 0); 313 239 if (rc) 314 240 dev_err(pdev->dev, "resume failed\n"); 315 241 316 - amd_pmc_dump_registers(pdev); 317 242 return 0; 318 243 } 319 244 ··· 379 190 }; 380 191 381 192 static const struct pci_device_id pmc_pci_ids[] = { 193 + { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_YC) }, 382 194 { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_CZN) }, 383 195 { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_RN) }, 384 196 { PCI_DEVICE(PCI_VENDOR_ID_AMD, AMD_CPU_ID_PCO) }, ··· 391 201 { 392 202 struct amd_pmc_dev *dev = &pmc; 393 203 struct pci_dev *rdev; 394 - u32 base_addr_lo; 395 - u32 base_addr_hi; 396 - u64 base_addr; 204 + u32 base_addr_lo, base_addr_hi; 205 + u64 base_addr, fch_phys_addr; 397 206 int err; 398 207 u32 val; 399 208 ··· 437 248 pci_dev_put(rdev); 438 249 base_addr = ((u64)base_addr_hi << 32 | base_addr_lo); 439 250 440 - dev->smu_base = devm_ioremap(dev->dev, base_addr, AMD_PMC_MAPPING_SIZE); 441 - if (!dev->smu_base) 442 - return -ENOMEM; 443 - 444 251 dev->regbase = devm_ioremap(dev->dev, base_addr + AMD_PMC_BASE_ADDR_OFFSET, 445 252 AMD_PMC_MAPPING_SIZE); 446 253 if (!dev->regbase) 447 254 return -ENOMEM; 448 255 449 - amd_pmc_dump_registers(dev); 256 + mutex_init(&dev->lock); 257 + 258 + /* Use FCH registers to get the S0ix stats */ 259 + base_addr_lo = FCH_BASE_PHY_ADDR_LOW; 260 + base_addr_hi = FCH_BASE_PHY_ADDR_HIGH; 261 + fch_phys_addr = ((u64)base_addr_hi << 32 | base_addr_lo); 262 + dev->fch_virt_addr = devm_ioremap(dev->dev, fch_phys_addr, FCH_SSC_MAPPING_SIZE); 263 + if (!dev->fch_virt_addr) 264 + return -ENOMEM; 265 + 266 + /* Use SMU to get the s0i3 debug stats */ 267 + err = amd_pmc_setup_smu_logging(dev); 268 + if (err) 269 + dev_err(dev->dev, "SMU debugging info not supported on this platform\n"); 450 270 451 271 platform_set_drvdata(pdev, dev); 452 272 amd_pmc_dbgfs_register(dev); ··· 467 269 struct amd_pmc_dev *dev = platform_get_drvdata(pdev); 468 270 469 271 amd_pmc_dbgfs_unregister(dev); 272 + mutex_destroy(&dev->lock); 470 273 return 0; 471 274 } 472 275 473 276 static const struct acpi_device_id amd_pmc_acpi_ids[] = { 474 277 {"AMDI0005", 0}, 278 + {"AMDI0006", 0}, 279 + {"AMDI0007", 0}, 475 280 {"AMD0004", 0}, 476 281 { } 477 282 };
+1
drivers/platform/x86/gigabyte-wmi.c
··· 141 141 142 142 static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { 143 143 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"), 144 + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE V2"), 144 145 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 GAMING X V2"), 145 146 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M AORUS PRO-P"), 146 147 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M DS3H"),
+1
drivers/platform/x86/intel-hid.c
··· 25 25 {"INT33D5", 0}, 26 26 {"INTC1051", 0}, 27 27 {"INTC1054", 0}, 28 + {"INTC1070", 0}, 28 29 {"", 0}, 29 30 }; 30 31 MODULE_DEVICE_TABLE(acpi, intel_hid_ids);
+36 -9
drivers/platform/x86/think-lmi.c
··· 571 571 else 572 572 ret = tlmi_save_bios_settings(""); 573 573 574 + if (!ret && !tlmi_priv.pending_changes) { 575 + tlmi_priv.pending_changes = true; 576 + /* let userland know it may need to check reboot pending again */ 577 + kobject_uevent(&tlmi_priv.class_dev->kobj, KOBJ_CHANGE); 578 + } 574 579 out: 575 580 kfree(auth_str); 576 581 kfree(set_str); ··· 652 647 .sysfs_ops = &tlmi_kobj_sysfs_ops, 653 648 }; 654 649 650 + static ssize_t pending_reboot_show(struct kobject *kobj, struct kobj_attribute *attr, 651 + char *buf) 652 + { 653 + return sprintf(buf, "%d\n", tlmi_priv.pending_changes); 654 + } 655 + 656 + static struct kobj_attribute pending_reboot = __ATTR_RO(pending_reboot); 657 + 655 658 /* ---- Initialisation --------------------------------------------------------- */ 656 659 static void tlmi_release_attr(void) 657 660 { ··· 672 659 kobject_put(&tlmi_priv.setting[i]->kobj); 673 660 } 674 661 } 662 + sysfs_remove_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr); 675 663 kset_unregister(tlmi_priv.attribute_kset); 676 664 677 665 /* Authentication structures */ ··· 723 709 724 710 /* Build attribute */ 725 711 tlmi_priv.setting[i]->kobj.kset = tlmi_priv.attribute_kset; 726 - ret = kobject_init_and_add(&tlmi_priv.setting[i]->kobj, &tlmi_attr_setting_ktype, 727 - NULL, "%s", tlmi_priv.setting[i]->display_name); 712 + ret = kobject_add(&tlmi_priv.setting[i]->kobj, NULL, 713 + "%s", tlmi_priv.setting[i]->display_name); 728 714 if (ret) 729 715 goto fail_create_attr; 730 716 ··· 732 718 if (ret) 733 719 goto fail_create_attr; 734 720 } 721 + 722 + ret = sysfs_create_file(&tlmi_priv.attribute_kset->kobj, &pending_reboot.attr); 723 + if (ret) 724 + goto fail_create_attr; 735 725 736 726 /* Create authentication entries */ 737 727 tlmi_priv.authentication_kset = kset_create_and_add("authentication", NULL, ··· 745 727 goto fail_create_attr; 746 728 } 747 729 tlmi_priv.pwd_admin->kobj.kset = tlmi_priv.authentication_kset; 748 - ret = kobject_init_and_add(&tlmi_priv.pwd_admin->kobj, &tlmi_pwd_setting_ktype, 749 - NULL, "%s", "Admin"); 730 + ret = kobject_add(&tlmi_priv.pwd_admin->kobj, NULL, "%s", "Admin"); 750 731 if (ret) 751 732 goto fail_create_attr; 752 733 ··· 754 737 goto fail_create_attr; 755 738 756 739 tlmi_priv.pwd_power->kobj.kset = tlmi_priv.authentication_kset; 757 - ret = kobject_init_and_add(&tlmi_priv.pwd_power->kobj, &tlmi_pwd_setting_ktype, 758 - NULL, "%s", "System"); 740 + ret = kobject_add(&tlmi_priv.pwd_power->kobj, NULL, "%s", "System"); 759 741 if (ret) 760 742 goto fail_create_attr; 761 743 ··· 834 818 pr_info("Error retrieving possible values for %d : %s\n", 835 819 i, setting->display_name); 836 820 } 821 + kobject_init(&setting->kobj, &tlmi_attr_setting_ktype); 837 822 tlmi_priv.setting[i] = setting; 838 823 tlmi_priv.settings_count++; 839 824 kfree(item); ··· 861 844 if (pwdcfg.password_state & TLMI_PAP_PWD) 862 845 tlmi_priv.pwd_admin->valid = true; 863 846 847 + kobject_init(&tlmi_priv.pwd_admin->kobj, &tlmi_pwd_setting_ktype); 848 + 864 849 tlmi_priv.pwd_power = kzalloc(sizeof(struct tlmi_pwd_setting), GFP_KERNEL); 865 850 if (!tlmi_priv.pwd_power) { 866 851 ret = -ENOMEM; 867 - goto fail_clear_attr; 852 + goto fail_free_pwd_admin; 868 853 } 869 854 strscpy(tlmi_priv.pwd_power->kbdlang, "us", TLMI_LANG_MAXLEN); 870 855 tlmi_priv.pwd_power->encoding = TLMI_ENCODING_ASCII; ··· 878 859 if (pwdcfg.password_state & TLMI_POP_PWD) 879 860 tlmi_priv.pwd_power->valid = true; 880 861 862 + kobject_init(&tlmi_priv.pwd_power->kobj, &tlmi_pwd_setting_ktype); 863 + 881 864 return 0; 882 865 866 + fail_free_pwd_admin: 867 + kfree(tlmi_priv.pwd_admin); 883 868 fail_clear_attr: 884 - for (i = 0; i < TLMI_SETTINGS_COUNT; ++i) 885 - kfree(tlmi_priv.setting[i]); 869 + for (i = 0; i < TLMI_SETTINGS_COUNT; ++i) { 870 + if (tlmi_priv.setting[i]) { 871 + kfree(tlmi_priv.setting[i]->possible_values); 872 + kfree(tlmi_priv.setting[i]); 873 + } 874 + } 886 875 return ret; 887 876 } 888 877
+1
drivers/platform/x86/think-lmi.h
··· 60 60 bool can_get_bios_selections; 61 61 bool can_set_bios_password; 62 62 bool can_get_password_settings; 63 + bool pending_changes; 63 64 64 65 struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT]; 65 66 struct device *class_dev;
+1 -1
drivers/platform/x86/wireless-hotkey.c
··· 78 78 79 79 err = wireless_input_setup(); 80 80 if (err) 81 - pr_err("Failed to setup hp wireless hotkeys\n"); 81 + pr_err("Failed to setup wireless hotkeys\n"); 82 82 83 83 return err; 84 84 }
+1
drivers/scsi/arm/acornscsi.c
··· 2642 2642 //#endif 2643 2643 clear_bit(SCpnt->device->id * 8 + 2644 2644 (u8)(SCpnt->device->lun & 0x7), host->busyluns); 2645 + fallthrough; 2645 2646 2646 2647 /* 2647 2648 * We found the command, and cleared it out. Either
+1
drivers/scsi/arm/fas216.c
··· 1375 1375 case IS_COMPLETE: 1376 1376 break; 1377 1377 } 1378 + break; 1378 1379 1379 1380 default: 1380 1381 break;
+16 -16
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 2983 2983 } 2984 2984 2985 2985 /** 2986 - * _base_free_irq - free irq 2986 + * mpt3sas_base_free_irq - free irq 2987 2987 * @ioc: per adapter object 2988 2988 * 2989 2989 * Freeing respective reply_queue from the list. 2990 2990 */ 2991 - static void 2992 - _base_free_irq(struct MPT3SAS_ADAPTER *ioc) 2991 + void 2992 + mpt3sas_base_free_irq(struct MPT3SAS_ADAPTER *ioc) 2993 2993 { 2994 2994 struct adapter_reply_queue *reply_q, *next; 2995 2995 ··· 3191 3191 } 3192 3192 3193 3193 /** 3194 - * _base_disable_msix - disables msix 3194 + * mpt3sas_base_disable_msix - disables msix 3195 3195 * @ioc: per adapter object 3196 3196 * 3197 3197 */ 3198 - static void 3199 - _base_disable_msix(struct MPT3SAS_ADAPTER *ioc) 3198 + void 3199 + mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc) 3200 3200 { 3201 3201 if (!ioc->msix_enable) 3202 3202 return; ··· 3304 3304 for (i = 0; i < ioc->reply_queue_count; i++) { 3305 3305 r = _base_request_irq(ioc, i); 3306 3306 if (r) { 3307 - _base_free_irq(ioc); 3308 - _base_disable_msix(ioc); 3307 + mpt3sas_base_free_irq(ioc); 3308 + mpt3sas_base_disable_msix(ioc); 3309 3309 goto try_ioapic; 3310 3310 } 3311 3311 } ··· 3342 3342 3343 3343 dexitprintk(ioc, ioc_info(ioc, "%s\n", __func__)); 3344 3344 3345 - _base_free_irq(ioc); 3346 - _base_disable_msix(ioc); 3345 + mpt3sas_base_free_irq(ioc); 3346 + mpt3sas_base_disable_msix(ioc); 3347 3347 3348 3348 kfree(ioc->replyPostRegisterIndex); 3349 3349 ioc->replyPostRegisterIndex = NULL; ··· 7613 7613 } 7614 7614 7615 7615 /** 7616 - * _base_make_ioc_ready - put controller in READY state 7616 + * mpt3sas_base_make_ioc_ready - put controller in READY state 7617 7617 * @ioc: per adapter object 7618 7618 * @type: FORCE_BIG_HAMMER or SOFT_RESET 7619 7619 * 7620 7620 * Return: 0 for success, non-zero for failure. 7621 7621 */ 7622 - static int 7623 - _base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) 7622 + int 7623 + mpt3sas_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type) 7624 7624 { 7625 7625 u32 ioc_state; 7626 7626 int rc; ··· 7897 7897 if (ioc->chip_phys && ioc->chip) { 7898 7898 mpt3sas_base_mask_interrupts(ioc); 7899 7899 ioc->shost_recovery = 1; 7900 - _base_make_ioc_ready(ioc, SOFT_RESET); 7900 + mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 7901 7901 ioc->shost_recovery = 0; 7902 7902 } 7903 7903 ··· 8017 8017 ioc->build_sg_mpi = &_base_build_sg; 8018 8018 ioc->build_zero_len_sge_mpi = &_base_build_zero_len_sge; 8019 8019 8020 - r = _base_make_ioc_ready(ioc, SOFT_RESET); 8020 + r = mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 8021 8021 if (r) 8022 8022 goto out_free_resources; 8023 8023 ··· 8471 8471 _base_pre_reset_handler(ioc); 8472 8472 mpt3sas_wait_for_commands_to_complete(ioc); 8473 8473 mpt3sas_base_mask_interrupts(ioc); 8474 - r = _base_make_ioc_ready(ioc, type); 8474 + r = mpt3sas_base_make_ioc_ready(ioc, type); 8475 8475 if (r) 8476 8476 goto out; 8477 8477 _base_clear_outstanding_commands(ioc);
+4
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 1730 1730 status, mpi_request, sz); } while (0) 1731 1731 1732 1732 int mpt3sas_wait_for_ioc(struct MPT3SAS_ADAPTER *ioc, int wait_count); 1733 + int 1734 + mpt3sas_base_make_ioc_ready(struct MPT3SAS_ADAPTER *ioc, enum reset_type type); 1735 + void mpt3sas_base_free_irq(struct MPT3SAS_ADAPTER *ioc); 1736 + void mpt3sas_base_disable_msix(struct MPT3SAS_ADAPTER *ioc); 1733 1737 1734 1738 /* scsih shared API */ 1735 1739 struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc,
+6 -1
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 11295 11295 11296 11296 _scsih_ir_shutdown(ioc); 11297 11297 _scsih_nvme_shutdown(ioc); 11298 - mpt3sas_base_detach(ioc); 11298 + mpt3sas_base_mask_interrupts(ioc); 11299 + ioc->shost_recovery = 1; 11300 + mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 11301 + ioc->shost_recovery = 0; 11302 + mpt3sas_base_free_irq(ioc); 11303 + mpt3sas_base_disable_msix(ioc); 11299 11304 } 11300 11305 11301 11306
+34 -56
drivers/scsi/scsi_transport_iscsi.c
··· 439 439 struct device *dev = container_of(kobj, struct device, kobj); 440 440 struct iscsi_iface *iface = iscsi_dev_to_iface(dev); 441 441 struct iscsi_transport *t = iface->transport; 442 - int param; 443 - int param_type; 442 + int param = -1; 444 443 445 444 if (attr == &dev_attr_iface_enabled.attr) 446 445 param = ISCSI_NET_PARAM_IFACE_ENABLE; 447 - else if (attr == &dev_attr_iface_vlan_id.attr) 448 - param = ISCSI_NET_PARAM_VLAN_ID; 449 - else if (attr == &dev_attr_iface_vlan_priority.attr) 450 - param = ISCSI_NET_PARAM_VLAN_PRIORITY; 451 - else if (attr == &dev_attr_iface_vlan_enabled.attr) 452 - param = ISCSI_NET_PARAM_VLAN_ENABLED; 453 - else if (attr == &dev_attr_iface_mtu.attr) 454 - param = ISCSI_NET_PARAM_MTU; 455 - else if (attr == &dev_attr_iface_port.attr) 456 - param = ISCSI_NET_PARAM_PORT; 457 - else if (attr == &dev_attr_iface_ipaddress_state.attr) 458 - param = ISCSI_NET_PARAM_IPADDR_STATE; 459 - else if (attr == &dev_attr_iface_delayed_ack_en.attr) 460 - param = ISCSI_NET_PARAM_DELAYED_ACK_EN; 461 - else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) 462 - param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; 463 - else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) 464 - param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; 465 - else if (attr == &dev_attr_iface_tcp_wsf.attr) 466 - param = ISCSI_NET_PARAM_TCP_WSF; 467 - else if (attr == &dev_attr_iface_tcp_timer_scale.attr) 468 - param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; 469 - else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) 470 - param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; 471 - else if (attr == &dev_attr_iface_cache_id.attr) 472 - param = ISCSI_NET_PARAM_CACHE_ID; 473 - else if (attr == &dev_attr_iface_redirect_en.attr) 474 - param = ISCSI_NET_PARAM_REDIRECT_EN; 475 446 else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) 476 447 param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; 477 448 else if (attr == &dev_attr_iface_header_digest.attr) ··· 479 508 param = ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN; 480 509 else if (attr == &dev_attr_iface_initiator_name.attr) 481 510 param = ISCSI_IFACE_PARAM_INITIATOR_NAME; 511 + 512 + if (param != -1) 513 + return t->attr_is_visible(ISCSI_IFACE_PARAM, param); 514 + 515 + if (attr == &dev_attr_iface_vlan_id.attr) 516 + param = ISCSI_NET_PARAM_VLAN_ID; 517 + else if (attr == &dev_attr_iface_vlan_priority.attr) 518 + param = ISCSI_NET_PARAM_VLAN_PRIORITY; 519 + else if (attr == &dev_attr_iface_vlan_enabled.attr) 520 + param = ISCSI_NET_PARAM_VLAN_ENABLED; 521 + else if (attr == &dev_attr_iface_mtu.attr) 522 + param = ISCSI_NET_PARAM_MTU; 523 + else if (attr == &dev_attr_iface_port.attr) 524 + param = ISCSI_NET_PARAM_PORT; 525 + else if (attr == &dev_attr_iface_ipaddress_state.attr) 526 + param = ISCSI_NET_PARAM_IPADDR_STATE; 527 + else if (attr == &dev_attr_iface_delayed_ack_en.attr) 528 + param = ISCSI_NET_PARAM_DELAYED_ACK_EN; 529 + else if (attr == &dev_attr_iface_tcp_nagle_disable.attr) 530 + param = ISCSI_NET_PARAM_TCP_NAGLE_DISABLE; 531 + else if (attr == &dev_attr_iface_tcp_wsf_disable.attr) 532 + param = ISCSI_NET_PARAM_TCP_WSF_DISABLE; 533 + else if (attr == &dev_attr_iface_tcp_wsf.attr) 534 + param = ISCSI_NET_PARAM_TCP_WSF; 535 + else if (attr == &dev_attr_iface_tcp_timer_scale.attr) 536 + param = ISCSI_NET_PARAM_TCP_TIMER_SCALE; 537 + else if (attr == &dev_attr_iface_tcp_timestamp_en.attr) 538 + param = ISCSI_NET_PARAM_TCP_TIMESTAMP_EN; 539 + else if (attr == &dev_attr_iface_cache_id.attr) 540 + param = ISCSI_NET_PARAM_CACHE_ID; 541 + else if (attr == &dev_attr_iface_redirect_en.attr) 542 + param = ISCSI_NET_PARAM_REDIRECT_EN; 482 543 else if (iface->iface_type == ISCSI_IFACE_TYPE_IPV4) { 483 544 if (attr == &dev_attr_ipv4_iface_ipaddress.attr) 484 545 param = ISCSI_NET_PARAM_IPV4_ADDR; ··· 601 598 return 0; 602 599 } 603 600 604 - switch (param) { 605 - case ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO: 606 - case ISCSI_IFACE_PARAM_HDRDGST_EN: 607 - case ISCSI_IFACE_PARAM_DATADGST_EN: 608 - case ISCSI_IFACE_PARAM_IMM_DATA_EN: 609 - case ISCSI_IFACE_PARAM_INITIAL_R2T_EN: 610 - case ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN: 611 - case ISCSI_IFACE_PARAM_PDU_INORDER_EN: 612 - case ISCSI_IFACE_PARAM_ERL: 613 - case ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH: 614 - case ISCSI_IFACE_PARAM_FIRST_BURST: 615 - case ISCSI_IFACE_PARAM_MAX_R2T: 616 - case ISCSI_IFACE_PARAM_MAX_BURST: 617 - case ISCSI_IFACE_PARAM_CHAP_AUTH_EN: 618 - case ISCSI_IFACE_PARAM_BIDI_CHAP_EN: 619 - case ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL: 620 - case ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN: 621 - case ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN: 622 - case ISCSI_IFACE_PARAM_INITIATOR_NAME: 623 - param_type = ISCSI_IFACE_PARAM; 624 - break; 625 - default: 626 - param_type = ISCSI_NET_PARAM; 627 - } 628 - 629 - return t->attr_is_visible(param_type, param); 601 + return t->attr_is_visible(ISCSI_NET_PARAM, param); 630 602 } 631 603 632 604 static struct attribute *iscsi_iface_attrs[] = {
+17 -18
drivers/target/target_core_sbc.c
··· 25 25 #include "target_core_alua.h" 26 26 27 27 static sense_reason_t 28 - sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char *, u32, bool); 28 + sbc_check_prot(struct se_device *, struct se_cmd *, unsigned char, u32, bool); 29 29 static sense_reason_t sbc_execute_unmap(struct se_cmd *cmd); 30 30 31 31 static sense_reason_t ··· 279 279 } 280 280 281 281 static sense_reason_t 282 - sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops) 282 + sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops) 283 283 { 284 284 struct se_device *dev = cmd->se_dev; 285 285 sector_t end_lba = dev->transport->get_blocks(dev) + 1; 286 286 unsigned int sectors = sbc_get_write_same_sectors(cmd); 287 287 sense_reason_t ret; 288 288 289 - if ((flags[0] & 0x04) || (flags[0] & 0x02)) { 289 + if ((flags & 0x04) || (flags & 0x02)) { 290 290 pr_err("WRITE_SAME PBDATA and LBDATA" 291 291 " bits not supported for Block Discard" 292 292 " Emulation\n"); ··· 308 308 } 309 309 310 310 /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ 311 - if (flags[0] & 0x10) { 311 + if (flags & 0x10) { 312 312 pr_warn("WRITE SAME with ANCHOR not supported\n"); 313 313 return TCM_INVALID_CDB_FIELD; 314 314 } ··· 316 316 * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting 317 317 * translated into block discard requests within backend code. 318 318 */ 319 - if (flags[0] & 0x08) { 319 + if (flags & 0x08) { 320 320 if (!ops->execute_unmap) 321 321 return TCM_UNSUPPORTED_SCSI_OPCODE; 322 322 ··· 331 331 if (!ops->execute_write_same) 332 332 return TCM_UNSUPPORTED_SCSI_OPCODE; 333 333 334 - ret = sbc_check_prot(dev, cmd, &cmd->t_task_cdb[0], sectors, true); 334 + ret = sbc_check_prot(dev, cmd, flags >> 5, sectors, true); 335 335 if (ret) 336 336 return ret; 337 337 ··· 717 717 } 718 718 719 719 static sense_reason_t 720 - sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb, 720 + sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char protect, 721 721 u32 sectors, bool is_write) 722 722 { 723 - u8 protect = cdb[1] >> 5; 724 723 int sp_ops = cmd->se_sess->sup_prot_ops; 725 724 int pi_prot_type = dev->dev_attrib.pi_prot_type; 726 725 bool fabric_prot = false; ··· 767 768 fallthrough; 768 769 default: 769 770 pr_err("Unable to determine pi_prot_type for CDB: 0x%02x " 770 - "PROTECT: 0x%02x\n", cdb[0], protect); 771 + "PROTECT: 0x%02x\n", cmd->t_task_cdb[0], protect); 771 772 return TCM_INVALID_CDB_FIELD; 772 773 } 773 774 ··· 842 843 if (sbc_check_dpofua(dev, cmd, cdb)) 843 844 return TCM_INVALID_CDB_FIELD; 844 845 845 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false); 846 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); 846 847 if (ret) 847 848 return ret; 848 849 ··· 856 857 if (sbc_check_dpofua(dev, cmd, cdb)) 857 858 return TCM_INVALID_CDB_FIELD; 858 859 859 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false); 860 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); 860 861 if (ret) 861 862 return ret; 862 863 ··· 870 871 if (sbc_check_dpofua(dev, cmd, cdb)) 871 872 return TCM_INVALID_CDB_FIELD; 872 873 873 - ret = sbc_check_prot(dev, cmd, cdb, sectors, false); 874 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, false); 874 875 if (ret) 875 876 return ret; 876 877 ··· 891 892 if (sbc_check_dpofua(dev, cmd, cdb)) 892 893 return TCM_INVALID_CDB_FIELD; 893 894 894 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true); 895 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); 895 896 if (ret) 896 897 return ret; 897 898 ··· 905 906 if (sbc_check_dpofua(dev, cmd, cdb)) 906 907 return TCM_INVALID_CDB_FIELD; 907 908 908 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true); 909 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); 909 910 if (ret) 910 911 return ret; 911 912 ··· 920 921 if (sbc_check_dpofua(dev, cmd, cdb)) 921 922 return TCM_INVALID_CDB_FIELD; 922 923 923 - ret = sbc_check_prot(dev, cmd, cdb, sectors, true); 924 + ret = sbc_check_prot(dev, cmd, cdb[1] >> 5, sectors, true); 924 925 if (ret) 925 926 return ret; 926 927 ··· 979 980 size = sbc_get_size(cmd, 1); 980 981 cmd->t_task_lba = get_unaligned_be64(&cdb[12]); 981 982 982 - ret = sbc_setup_write_same(cmd, &cdb[10], ops); 983 + ret = sbc_setup_write_same(cmd, cdb[10], ops); 983 984 if (ret) 984 985 return ret; 985 986 break; ··· 1078 1079 size = sbc_get_size(cmd, 1); 1079 1080 cmd->t_task_lba = get_unaligned_be64(&cdb[2]); 1080 1081 1081 - ret = sbc_setup_write_same(cmd, &cdb[1], ops); 1082 + ret = sbc_setup_write_same(cmd, cdb[1], ops); 1082 1083 if (ret) 1083 1084 return ret; 1084 1085 break; ··· 1096 1097 * Follow sbcr26 with WRITE_SAME (10) and check for the existence 1097 1098 * of byte 1 bit 3 UNMAP instead of original reserved field 1098 1099 */ 1099 - ret = sbc_setup_write_same(cmd, &cdb[1], ops); 1100 + ret = sbc_setup_write_same(cmd, cdb[1], ops); 1100 1101 if (ret) 1101 1102 return ret; 1102 1103 break;
+1 -1
drivers/target/target_core_transport.c
··· 886 886 INIT_WORK(&cmd->work, success ? target_complete_ok_work : 887 887 target_complete_failure_work); 888 888 889 - if (wwn->cmd_compl_affinity == SE_COMPL_AFFINITY_CPUID) 889 + if (!wwn || wwn->cmd_compl_affinity == SE_COMPL_AFFINITY_CPUID) 890 890 cpu = cmd->cpuid; 891 891 else 892 892 cpu = wwn->cmd_compl_affinity;
+3 -3
drivers/usb/class/cdc-wdm.c
··· 824 824 }; 825 825 826 826 /* --- WWAN framework integration --- */ 827 - #ifdef CONFIG_WWAN 827 + #ifdef CONFIG_WWAN_CORE 828 828 static int wdm_wwan_port_start(struct wwan_port *port) 829 829 { 830 830 struct wdm_device *desc = wwan_port_get_drvdata(port); ··· 963 963 /* inbuf has been copied, it is safe to check for outstanding data */ 964 964 schedule_work(&desc->service_outs_intr); 965 965 } 966 - #else /* CONFIG_WWAN */ 966 + #else /* CONFIG_WWAN_CORE */ 967 967 static void wdm_wwan_init(struct wdm_device *desc) {} 968 968 static void wdm_wwan_deinit(struct wdm_device *desc) {} 969 969 static void wdm_wwan_rx(struct wdm_device *desc, int length) {} 970 - #endif /* CONFIG_WWAN */ 970 + #endif /* CONFIG_WWAN_CORE */ 971 971 972 972 /* --- error handling --- */ 973 973 static void wdm_rxwork(struct work_struct *work)
+1 -1
drivers/usb/core/devio.c
··· 1133 1133 "wIndex=%04x wLength=%04x\n", 1134 1134 ctrl->bRequestType, ctrl->bRequest, ctrl->wValue, 1135 1135 ctrl->wIndex, ctrl->wLength); 1136 - if (ctrl->bRequestType & 0x80) { 1136 + if ((ctrl->bRequestType & USB_DIR_IN) && ctrl->wLength) { 1137 1137 pipe = usb_rcvctrlpipe(dev, 0); 1138 1138 snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, NULL, 0); 1139 1139
+84 -36
drivers/usb/core/hub.c
··· 48 48 49 49 #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ 50 50 #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ 51 + #define USB_PING_RESPONSE_TIME 400 /* ns */ 51 52 52 53 /* Protect struct usb_device->state and ->children members 53 54 * Note: Both are also protected by ->dev.sem, except that ->state can ··· 183 182 } 184 183 185 184 /* 186 - * Set the Maximum Exit Latency (MEL) for the host to initiate a transition from 187 - * either U1 or U2. 185 + * Set the Maximum Exit Latency (MEL) for the host to wakup up the path from 186 + * U1/U2, send a PING to the device and receive a PING_RESPONSE. 187 + * See USB 3.1 section C.1.5.2 188 188 */ 189 189 static void usb_set_lpm_mel(struct usb_device *udev, 190 190 struct usb3_lpm_parameters *udev_lpm_params, ··· 195 193 unsigned int hub_exit_latency) 196 194 { 197 195 unsigned int total_mel; 198 - unsigned int device_mel; 199 - unsigned int hub_mel; 200 196 201 197 /* 202 - * Calculate the time it takes to transition all links from the roothub 203 - * to the parent hub into U0. The parent hub must then decode the 204 - * packet (hub header decode latency) to figure out which port it was 205 - * bound for. 206 - * 207 - * The Hub Header decode latency is expressed in 0.1us intervals (0x1 208 - * means 0.1us). Multiply that by 100 to get nanoseconds. 198 + * tMEL1. time to transition path from host to device into U0. 199 + * MEL for parent already contains the delay up to parent, so only add 200 + * the exit latency for the last link (pick the slower exit latency), 201 + * and the hub header decode latency. See USB 3.1 section C 2.2.1 202 + * Store MEL in nanoseconds 209 203 */ 210 204 total_mel = hub_lpm_params->mel + 211 - (hub->descriptor->u.ss.bHubHdrDecLat * 100); 205 + max(udev_exit_latency, hub_exit_latency) * 1000 + 206 + hub->descriptor->u.ss.bHubHdrDecLat * 100; 212 207 213 208 /* 214 - * How long will it take to transition the downstream hub's port into 215 - * U0? The greater of either the hub exit latency or the device exit 216 - * latency. 217 - * 218 - * The BOS U1/U2 exit latencies are expressed in 1us intervals. 219 - * Multiply that by 1000 to get nanoseconds. 209 + * tMEL2. Time to submit PING packet. Sum of tTPTransmissionDelay for 210 + * each link + wHubDelay for each hub. Add only for last link. 211 + * tMEL4, the time for PING_RESPONSE to traverse upstream is similar. 212 + * Multiply by 2 to include it as well. 220 213 */ 221 - device_mel = udev_exit_latency * 1000; 222 - hub_mel = hub_exit_latency * 1000; 223 - if (device_mel > hub_mel) 224 - total_mel += device_mel; 225 - else 226 - total_mel += hub_mel; 214 + total_mel += (__le16_to_cpu(hub->descriptor->u.ss.wHubDelay) + 215 + USB_TP_TRANSMISSION_DELAY) * 2; 216 + 217 + /* 218 + * tMEL3, tPingResponse. Time taken by device to generate PING_RESPONSE 219 + * after receiving PING. Also add 2100ns as stated in USB 3.1 C 1.5.2.4 220 + * to cover the delay if the PING_RESPONSE is queued behind a Max Packet 221 + * Size DP. 222 + * Note these delays should be added only once for the entire path, so 223 + * add them to the MEL of the device connected to the roothub. 224 + */ 225 + if (!hub->hdev->parent) 226 + total_mel += USB_PING_RESPONSE_TIME + 2100; 227 227 228 228 udev_lpm_params->mel = total_mel; 229 229 } ··· 4117 4113 } 4118 4114 4119 4115 /* 4116 + * Don't allow device intiated U1/U2 if the system exit latency + one bus 4117 + * interval is greater than the minimum service interval of any active 4118 + * periodic endpoint. See USB 3.2 section 9.4.9 4119 + */ 4120 + static bool usb_device_may_initiate_lpm(struct usb_device *udev, 4121 + enum usb3_link_state state) 4122 + { 4123 + unsigned int sel; /* us */ 4124 + int i, j; 4125 + 4126 + if (state == USB3_LPM_U1) 4127 + sel = DIV_ROUND_UP(udev->u1_params.sel, 1000); 4128 + else if (state == USB3_LPM_U2) 4129 + sel = DIV_ROUND_UP(udev->u2_params.sel, 1000); 4130 + else 4131 + return false; 4132 + 4133 + for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 4134 + struct usb_interface *intf; 4135 + struct usb_endpoint_descriptor *desc; 4136 + unsigned int interval; 4137 + 4138 + intf = udev->actconfig->interface[i]; 4139 + if (!intf) 4140 + continue; 4141 + 4142 + for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++) { 4143 + desc = &intf->cur_altsetting->endpoint[j].desc; 4144 + 4145 + if (usb_endpoint_xfer_int(desc) || 4146 + usb_endpoint_xfer_isoc(desc)) { 4147 + interval = (1 << (desc->bInterval - 1)) * 125; 4148 + if (sel + 125 > interval) 4149 + return false; 4150 + } 4151 + } 4152 + } 4153 + return true; 4154 + } 4155 + 4156 + /* 4120 4157 * Enable the hub-initiated U1/U2 idle timeouts, and enable device-initiated 4121 4158 * U1/U2 entry. 4122 4159 * ··· 4229 4184 * U1/U2_ENABLE 4230 4185 */ 4231 4186 if (udev->actconfig && 4232 - usb_set_device_initiated_lpm(udev, state, true) == 0) { 4233 - if (state == USB3_LPM_U1) 4234 - udev->usb3_lpm_u1_enabled = 1; 4235 - else if (state == USB3_LPM_U2) 4236 - udev->usb3_lpm_u2_enabled = 1; 4237 - } else { 4238 - /* Don't request U1/U2 entry if the device 4239 - * cannot transition to U1/U2. 4240 - */ 4241 - usb_set_lpm_timeout(udev, state, 0); 4242 - hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); 4187 + usb_device_may_initiate_lpm(udev, state)) { 4188 + if (usb_set_device_initiated_lpm(udev, state, true)) { 4189 + /* 4190 + * Request to enable device initiated U1/U2 failed, 4191 + * better to turn off lpm in this case. 4192 + */ 4193 + usb_set_lpm_timeout(udev, state, 0); 4194 + hcd->driver->disable_usb3_lpm_timeout(hcd, udev, state); 4195 + return; 4196 + } 4243 4197 } 4244 - } 4245 4198 4199 + if (state == USB3_LPM_U1) 4200 + udev->usb3_lpm_u1_enabled = 1; 4201 + else if (state == USB3_LPM_U2) 4202 + udev->usb3_lpm_u2_enabled = 1; 4203 + } 4246 4204 /* 4247 4205 * Disable the hub-initiated U1/U2 idle timeouts, and disable device-initiated 4248 4206 * U1/U2 entry.
-4
drivers/usb/core/quirks.c
··· 501 501 /* DJI CineSSD */ 502 502 { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, 503 503 504 - /* Fibocom L850-GL LTE Modem */ 505 - { USB_DEVICE(0x2cb7, 0x0007), .driver_info = 506 - USB_QUIRK_IGNORE_REMOTE_WAKEUP }, 507 - 508 504 /* INTEL VALUE SSD */ 509 505 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, 510 506
+4
drivers/usb/dwc2/core.h
··· 383 383 * 0 - No (default) 384 384 * 1 - Partial power down 385 385 * 2 - Hibernation 386 + * @no_clock_gating: Specifies whether to avoid clock gating feature. 387 + * 0 - No (use clock gating) 388 + * 1 - Yes (avoid it) 386 389 * @lpm: Enable LPM support. 387 390 * 0 - No 388 391 * 1 - Yes ··· 483 480 #define DWC2_POWER_DOWN_PARAM_NONE 0 484 481 #define DWC2_POWER_DOWN_PARAM_PARTIAL 1 485 482 #define DWC2_POWER_DOWN_PARAM_HIBERNATION 2 483 + bool no_clock_gating; 486 484 487 485 bool lpm; 488 486 bool lpm_clock_gating;
+2 -1
drivers/usb/dwc2/core_intr.c
··· 556 556 * If neither hibernation nor partial power down are supported, 557 557 * clock gating is used to save power. 558 558 */ 559 - dwc2_gadget_enter_clock_gating(hsotg); 559 + if (!hsotg->params.no_clock_gating) 560 + dwc2_gadget_enter_clock_gating(hsotg); 560 561 } 561 562 562 563 /*
+27 -4
drivers/usb/dwc2/gadget.c
··· 2749 2749 return; 2750 2750 } 2751 2751 2752 - /* Zlp for all endpoints, for ep0 only in DATA IN stage */ 2752 + /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */ 2753 2753 if (hs_ep->send_zlp) { 2754 - dwc2_hsotg_program_zlp(hsotg, hs_ep); 2755 2754 hs_ep->send_zlp = 0; 2756 - /* transfer will be completed on next complete interrupt */ 2757 - return; 2755 + if (!using_desc_dma(hsotg)) { 2756 + dwc2_hsotg_program_zlp(hsotg, hs_ep); 2757 + /* transfer will be completed on next complete interrupt */ 2758 + return; 2759 + } 2758 2760 } 2759 2761 2760 2762 if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) { ··· 3902 3900 __func__); 3903 3901 } 3904 3902 } else { 3903 + /* Mask GINTSTS_GOUTNAKEFF interrupt */ 3904 + dwc2_hsotg_disable_gsint(hsotg, GINTSTS_GOUTNAKEFF); 3905 + 3905 3906 if (!(dwc2_readl(hsotg, GINTSTS) & GINTSTS_GOUTNAKEFF)) 3906 3907 dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK); 3908 + 3909 + if (!using_dma(hsotg)) { 3910 + /* Wait for GINTSTS_RXFLVL interrupt */ 3911 + if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, 3912 + GINTSTS_RXFLVL, 100)) { 3913 + dev_warn(hsotg->dev, "%s: timeout GINTSTS.RXFLVL\n", 3914 + __func__); 3915 + } else { 3916 + /* 3917 + * Pop GLOBAL OUT NAK status packet from RxFIFO 3918 + * to assert GOUTNAKEFF interrupt 3919 + */ 3920 + dwc2_readl(hsotg, GRXSTSP); 3921 + } 3922 + } 3907 3923 3908 3924 /* Wait for global nak to take effect */ 3909 3925 if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, ··· 4368 4348 epctl = dwc2_readl(hs, epreg); 4369 4349 4370 4350 if (value) { 4351 + /* Unmask GOUTNAKEFF interrupt */ 4352 + dwc2_hsotg_en_gsint(hs, GINTSTS_GOUTNAKEFF); 4353 + 4371 4354 if (!(dwc2_readl(hs, GINTSTS) & GINTSTS_GOUTNAKEFF)) 4372 4355 dwc2_set_bit(hs, DCTL, DCTL_SGOUTNAK); 4373 4356 // STALL bit will be set in GOUTNAKEFF interrupt handler
+4 -2
drivers/usb/dwc2/hcd.c
··· 3338 3338 * If not hibernation nor partial power down are supported, 3339 3339 * clock gating is used to save power. 3340 3340 */ 3341 - dwc2_host_enter_clock_gating(hsotg); 3341 + if (!hsotg->params.no_clock_gating) 3342 + dwc2_host_enter_clock_gating(hsotg); 3342 3343 break; 3343 3344 } 3344 3345 ··· 4403 4402 * If not hibernation nor partial power down are supported, 4404 4403 * clock gating is used to save power. 4405 4404 */ 4406 - dwc2_host_enter_clock_gating(hsotg); 4405 + if (!hsotg->params.no_clock_gating) 4406 + dwc2_host_enter_clock_gating(hsotg); 4407 4407 4408 4408 /* After entering suspend, hardware is not accessible */ 4409 4409 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+1
drivers/usb/dwc2/params.c
··· 76 76 struct dwc2_core_params *p = &hsotg->params; 77 77 78 78 p->power_down = DWC2_POWER_DOWN_PARAM_NONE; 79 + p->no_clock_gating = true; 79 80 p->phy_utmi_width = 8; 80 81 } 81 82
+1
drivers/usb/dwc3/core.h
··· 1279 1279 unsigned dis_metastability_quirk:1; 1280 1280 1281 1281 unsigned dis_split_quirk:1; 1282 + unsigned async_callbacks:1; 1282 1283 1283 1284 u16 imod_interval; 1284 1285 };
+6 -4
drivers/usb/dwc3/ep0.c
··· 597 597 598 598 static int dwc3_ep0_delegate_req(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) 599 599 { 600 - int ret; 600 + int ret = -EINVAL; 601 601 602 - spin_unlock(&dwc->lock); 603 - ret = dwc->gadget_driver->setup(dwc->gadget, ctrl); 604 - spin_lock(&dwc->lock); 602 + if (dwc->async_callbacks) { 603 + spin_unlock(&dwc->lock); 604 + ret = dwc->gadget_driver->setup(dwc->gadget, ctrl); 605 + spin_lock(&dwc->lock); 606 + } 605 607 return ret; 606 608 } 607 609
+16 -5
drivers/usb/dwc3/gadget.c
··· 2585 2585 return ret; 2586 2586 } 2587 2587 2588 + static void dwc3_gadget_async_callbacks(struct usb_gadget *g, bool enable) 2589 + { 2590 + struct dwc3 *dwc = gadget_to_dwc(g); 2591 + unsigned long flags; 2592 + 2593 + spin_lock_irqsave(&dwc->lock, flags); 2594 + dwc->async_callbacks = enable; 2595 + spin_unlock_irqrestore(&dwc->lock, flags); 2596 + } 2597 + 2588 2598 static const struct usb_gadget_ops dwc3_gadget_ops = { 2589 2599 .get_frame = dwc3_gadget_get_frame, 2590 2600 .wakeup = dwc3_gadget_wakeup, ··· 2606 2596 .udc_set_ssp_rate = dwc3_gadget_set_ssp_rate, 2607 2597 .get_config_params = dwc3_gadget_config_params, 2608 2598 .vbus_draw = dwc3_gadget_vbus_draw, 2599 + .udc_async_callbacks = dwc3_gadget_async_callbacks, 2609 2600 }; 2610 2601 2611 2602 /* -------------------------------------------------------------------------- */ ··· 3242 3231 3243 3232 static void dwc3_disconnect_gadget(struct dwc3 *dwc) 3244 3233 { 3245 - if (dwc->gadget_driver && dwc->gadget_driver->disconnect) { 3234 + if (dwc->async_callbacks && dwc->gadget_driver->disconnect) { 3246 3235 spin_unlock(&dwc->lock); 3247 3236 dwc->gadget_driver->disconnect(dwc->gadget); 3248 3237 spin_lock(&dwc->lock); ··· 3251 3240 3252 3241 static void dwc3_suspend_gadget(struct dwc3 *dwc) 3253 3242 { 3254 - if (dwc->gadget_driver && dwc->gadget_driver->suspend) { 3243 + if (dwc->async_callbacks && dwc->gadget_driver->suspend) { 3255 3244 spin_unlock(&dwc->lock); 3256 3245 dwc->gadget_driver->suspend(dwc->gadget); 3257 3246 spin_lock(&dwc->lock); ··· 3260 3249 3261 3250 static void dwc3_resume_gadget(struct dwc3 *dwc) 3262 3251 { 3263 - if (dwc->gadget_driver && dwc->gadget_driver->resume) { 3252 + if (dwc->async_callbacks && dwc->gadget_driver->resume) { 3264 3253 spin_unlock(&dwc->lock); 3265 3254 dwc->gadget_driver->resume(dwc->gadget); 3266 3255 spin_lock(&dwc->lock); ··· 3272 3261 if (!dwc->gadget_driver) 3273 3262 return; 3274 3263 3275 - if (dwc->gadget->speed != USB_SPEED_UNKNOWN) { 3264 + if (dwc->async_callbacks && dwc->gadget->speed != USB_SPEED_UNKNOWN) { 3276 3265 spin_unlock(&dwc->lock); 3277 3266 usb_gadget_udc_reset(dwc->gadget, dwc->gadget_driver); 3278 3267 spin_lock(&dwc->lock); ··· 3596 3585 * implemented. 3597 3586 */ 3598 3587 3599 - if (dwc->gadget_driver && dwc->gadget_driver->resume) { 3588 + if (dwc->async_callbacks && dwc->gadget_driver->resume) { 3600 3589 spin_unlock(&dwc->lock); 3601 3590 dwc->gadget_driver->resume(dwc->gadget); 3602 3591 spin_lock(&dwc->lock);
+1 -1
drivers/usb/gadget/function/u_serial.c
··· 1198 1198 struct gs_port *port; 1199 1199 1200 1200 mutex_lock(&ports[port_num].lock); 1201 - if (WARN_ON(!ports[port_num].port)) { 1201 + if (!ports[port_num].port) { 1202 1202 mutex_unlock(&ports[port_num].lock); 1203 1203 return; 1204 1204 }
+1
drivers/usb/gadget/udc/tegra-xudc.c
··· 3853 3853 return 0; 3854 3854 3855 3855 free_eps: 3856 + pm_runtime_disable(&pdev->dev); 3856 3857 tegra_xudc_free_eps(xudc); 3857 3858 free_event_ring: 3858 3859 tegra_xudc_free_event_ring(xudc);
+14 -4
drivers/usb/host/ehci-hcd.c
··· 703 703 static irqreturn_t ehci_irq (struct usb_hcd *hcd) 704 704 { 705 705 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 706 - u32 status, masked_status, pcd_status = 0, cmd; 706 + u32 status, current_status, masked_status, pcd_status = 0; 707 + u32 cmd; 707 708 int bh; 708 709 709 710 spin_lock(&ehci->lock); 710 711 711 - status = ehci_readl(ehci, &ehci->regs->status); 712 + status = 0; 713 + current_status = ehci_readl(ehci, &ehci->regs->status); 714 + restart: 712 715 713 716 /* e.g. cardbus physical eject */ 714 - if (status == ~(u32) 0) { 717 + if (current_status == ~(u32) 0) { 715 718 ehci_dbg (ehci, "device removed\n"); 716 719 goto dead; 717 720 } 721 + status |= current_status; 718 722 719 723 /* 720 724 * We don't use STS_FLR, but some controllers don't like it to 721 725 * remain on, so mask it out along with the other status bits. 722 726 */ 723 - masked_status = status & (INTR_MASK | STS_FLR); 727 + masked_status = current_status & (INTR_MASK | STS_FLR); 724 728 725 729 /* Shared IRQ? */ 726 730 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { ··· 734 730 735 731 /* clear (just) interrupts */ 736 732 ehci_writel(ehci, masked_status, &ehci->regs->status); 733 + 734 + /* For edge interrupts, don't race with an interrupt bit being raised */ 735 + current_status = ehci_readl(ehci, &ehci->regs->status); 736 + if (current_status & INTR_MASK) 737 + goto restart; 738 + 737 739 cmd = ehci_readl(ehci, &ehci->regs->command); 738 740 bh = 0; 739 741
+14 -30
drivers/usb/host/max3421-hcd.c
··· 153 153 */ 154 154 struct urb *curr_urb; 155 155 enum scheduling_pass sched_pass; 156 - struct usb_device *loaded_dev; /* dev that's loaded into the chip */ 157 - int loaded_epnum; /* epnum whose toggles are loaded */ 158 156 int urb_done; /* > 0 -> no errors, < 0: errno */ 159 157 size_t curr_len; 160 158 u8 hien; ··· 490 492 * Caller must NOT hold HCD spinlock. 491 493 */ 492 494 static void 493 - max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum, 494 - int force_toggles) 495 + max3421_set_address(struct usb_hcd *hcd, struct usb_device *dev, int epnum) 495 496 { 496 - struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); 497 - int old_epnum, same_ep, rcvtog, sndtog; 498 - struct usb_device *old_dev; 497 + int rcvtog, sndtog; 499 498 u8 hctl; 500 499 501 - old_dev = max3421_hcd->loaded_dev; 502 - old_epnum = max3421_hcd->loaded_epnum; 503 - 504 - same_ep = (dev == old_dev && epnum == old_epnum); 505 - if (same_ep && !force_toggles) 506 - return; 507 - 508 - if (old_dev && !same_ep) { 509 - /* save the old end-points toggles: */ 510 - u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); 511 - 512 - rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; 513 - sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; 514 - 515 - /* no locking: HCD (i.e., we) own toggles, don't we? */ 516 - usb_settoggle(old_dev, old_epnum, 0, rcvtog); 517 - usb_settoggle(old_dev, old_epnum, 1, sndtog); 518 - } 519 500 /* setup new endpoint's toggle bits: */ 520 501 rcvtog = usb_gettoggle(dev, epnum, 0); 521 502 sndtog = usb_gettoggle(dev, epnum, 1); 522 503 hctl = (BIT(rcvtog + MAX3421_HCTL_RCVTOG0_BIT) | 523 504 BIT(sndtog + MAX3421_HCTL_SNDTOG0_BIT)); 524 505 525 - max3421_hcd->loaded_epnum = epnum; 526 506 spi_wr8(hcd, MAX3421_REG_HCTL, hctl); 527 507 528 508 /* ··· 508 532 * address-assignment so it's best to just always load the 509 533 * address whenever the end-point changed/was forced. 510 534 */ 511 - max3421_hcd->loaded_dev = dev; 512 535 spi_wr8(hcd, MAX3421_REG_PERADDR, dev->devnum); 513 536 } 514 537 ··· 642 667 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); 643 668 struct urb *urb, *curr_urb = NULL; 644 669 struct max3421_ep *max3421_ep; 645 - int epnum, force_toggles = 0; 670 + int epnum; 646 671 struct usb_host_endpoint *ep; 647 672 struct list_head *pos; 648 673 unsigned long flags; ··· 752 777 usb_settoggle(urb->dev, epnum, 0, 1); 753 778 usb_settoggle(urb->dev, epnum, 1, 1); 754 779 max3421_ep->pkt_state = PKT_STATE_SETUP; 755 - force_toggles = 1; 756 780 } else 757 781 max3421_ep->pkt_state = PKT_STATE_TRANSFER; 758 782 } ··· 759 785 spin_unlock_irqrestore(&max3421_hcd->lock, flags); 760 786 761 787 max3421_ep->last_active = max3421_hcd->frame_number; 762 - max3421_set_address(hcd, urb->dev, epnum, force_toggles); 788 + max3421_set_address(hcd, urb->dev, epnum); 763 789 max3421_set_speed(hcd, urb->dev); 764 790 max3421_next_transfer(hcd, 0); 765 791 return 1; ··· 1353 1379 status = 0; 1354 1380 urb = max3421_hcd->curr_urb; 1355 1381 if (urb) { 1382 + /* save the old end-points toggles: */ 1383 + u8 hrsl = spi_rd8(hcd, MAX3421_REG_HRSL); 1384 + int rcvtog = (hrsl >> MAX3421_HRSL_RCVTOGRD_BIT) & 1; 1385 + int sndtog = (hrsl >> MAX3421_HRSL_SNDTOGRD_BIT) & 1; 1386 + int epnum = usb_endpoint_num(&urb->ep->desc); 1387 + 1388 + /* no locking: HCD (i.e., we) own toggles, don't we? */ 1389 + usb_settoggle(urb->dev, epnum, 0, rcvtog); 1390 + usb_settoggle(urb->dev, epnum, 1, sndtog); 1391 + 1356 1392 max3421_hcd->curr_urb = NULL; 1357 1393 spin_lock_irqsave(&max3421_hcd->lock, flags); 1358 1394 usb_hcd_unlink_urb_from_ep(hcd, urb);
+2 -1
drivers/usb/host/xhci-hub.c
··· 1638 1638 * Inform the usbcore about resume-in-progress by returning 1639 1639 * a non-zero value even if there are no status changes. 1640 1640 */ 1641 + spin_lock_irqsave(&xhci->lock, flags); 1642 + 1641 1643 status = bus_state->resuming_ports; 1642 1644 1643 1645 mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC; 1644 1646 1645 - spin_lock_irqsave(&xhci->lock, flags); 1646 1647 /* For each port, did anything change? If so, set that bit in buf. */ 1647 1648 for (i = 0; i < max_ports; i++) { 1648 1649 temp = readl(ports[i]->addr);
+8 -8
drivers/usb/host/xhci-pci-renesas.c
··· 207 207 return 0; 208 208 209 209 case RENESAS_ROM_STATUS_NO_RESULT: /* No result yet */ 210 - dev_dbg(&pdev->dev, "Unknown ROM status ...\n"); 211 - break; 210 + return 0; 212 211 213 212 case RENESAS_ROM_STATUS_ERROR: /* Error State */ 214 213 default: /* All other states are marked as "Reserved states" */ ··· 224 225 u8 fw_state; 225 226 int err; 226 227 227 - /* 228 - * Only if device has ROM and loaded FW we can skip loading and 229 - * return success. Otherwise (even unknown state), attempt to load FW. 230 - */ 231 - if (renesas_check_rom(pdev) && !renesas_check_rom_state(pdev)) 232 - return 0; 228 + /* Check if device has ROM and loaded, if so skip everything */ 229 + err = renesas_check_rom(pdev); 230 + if (err) { /* we have rom */ 231 + err = renesas_check_rom_state(pdev); 232 + if (!err) 233 + return err; 234 + } 233 235 234 236 /* 235 237 * Test if the device is actually needing the firmware. As most
+7
drivers/usb/host/xhci-pci.c
··· 636 636 { /* end: all zeroes */ } 637 637 }; 638 638 MODULE_DEVICE_TABLE(pci, pci_ids); 639 + 640 + /* 641 + * Without CONFIG_USB_XHCI_PCI_RENESAS renesas_xhci_check_request_fw() won't 642 + * load firmware, so don't encumber the xhci-pci driver with it. 643 + */ 644 + #if IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS) 639 645 MODULE_FIRMWARE("renesas_usb_fw.mem"); 646 + #endif 640 647 641 648 /* pci driver glue; this is a "new style" PCI driver module */ 642 649 static struct pci_driver xhci_pci_driver = {
+8 -2
drivers/usb/phy/phy.c
··· 86 86 87 87 list_for_each_entry(usb_phy, &phy_list, head) { 88 88 if (usb_phy->dev == dev) 89 - break; 89 + return usb_phy; 90 90 } 91 91 92 - return usb_phy; 92 + return NULL; 93 93 } 94 94 95 95 static void usb_phy_set_default_current(struct usb_phy *usb_phy) ··· 150 150 struct usb_phy *usb_phy; 151 151 char uchger_state[50] = { 0 }; 152 152 char uchger_type[50] = { 0 }; 153 + unsigned long flags; 153 154 155 + spin_lock_irqsave(&phy_lock, flags); 154 156 usb_phy = __device_to_usb_phy(dev); 157 + spin_unlock_irqrestore(&phy_lock, flags); 158 + 159 + if (!usb_phy) 160 + return -ENODEV; 155 161 156 162 snprintf(uchger_state, ARRAY_SIZE(uchger_state), 157 163 "USB_CHARGER_STATE=%s", usb_chger_state[usb_phy->chg_state]);
+7
drivers/usb/renesas_usbhs/fifo.c
··· 101 101 #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) 102 102 #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) 103 103 static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); 104 + static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable); 105 + static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable); 104 106 struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) 105 107 { 106 108 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); ··· 125 123 if (chan) { 126 124 dmaengine_terminate_all(chan); 127 125 usbhsf_dma_unmap(pkt); 126 + } else { 127 + if (usbhs_pipe_is_dir_in(pipe)) 128 + usbhsf_rx_irq_ctrl(pipe, 0); 129 + else 130 + usbhsf_tx_irq_ctrl(pipe, 0); 128 131 } 129 132 130 133 usbhs_pipe_clear_without_sequence(pipe, 0, 0);
+3 -2
drivers/usb/serial/cp210x.c
··· 155 155 { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ 156 156 { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */ 157 157 { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ 158 + { USB_DEVICE(0x10C4, 0x8A5B) }, /* CEL EM3588 ZigBee USB Stick */ 158 159 { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ 159 160 { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ 160 161 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ ··· 203 202 { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */ 204 203 { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */ 205 204 { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */ 206 - { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */ 207 - { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */ 205 + { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 M.2 Key E serial interface */ 206 + { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 Display serial interface */ 208 207 { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */ 209 208 { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ 210 209 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
+3
drivers/usb/serial/option.c
··· 238 238 #define QUECTEL_PRODUCT_UC15 0x9090 239 239 /* These u-blox products use Qualcomm's vendor ID */ 240 240 #define UBLOX_PRODUCT_R410M 0x90b2 241 + #define UBLOX_PRODUCT_R6XX 0x90fa 241 242 /* These Yuga products use Qualcomm's vendor ID */ 242 243 #define YUGA_PRODUCT_CLM920_NC5 0x9625 243 244 ··· 1102 1101 /* u-blox products using Qualcomm vendor ID */ 1103 1102 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), 1104 1103 .driver_info = RSVD(1) | RSVD(3) }, 1104 + { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R6XX), 1105 + .driver_info = RSVD(3) }, 1105 1106 /* Quectel products using Quectel vendor ID */ 1106 1107 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), 1107 1108 .driver_info = NUMEP2 },
+7
drivers/usb/storage/unusual_uas.h
··· 45 45 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 46 46 US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), 47 47 48 + /* Reported-by: Julian Sikorski <belegdol@gmail.com> */ 49 + UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, 50 + "LaCie", 51 + "Rugged USB3-FW", 52 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 53 + US_FL_IGNORE_UAS), 54 + 48 55 /* 49 56 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI 50 57 * commands in UAS mode. Observed with the 1.28 firmware; are there others?
+16 -4
drivers/usb/typec/stusb160x.c
··· 686 686 return -ENODEV; 687 687 688 688 /* 689 + * This fwnode has a "compatible" property, but is never populated as a 690 + * struct device. Instead we simply parse it to read the properties. 691 + * This it breaks fw_devlink=on. To maintain backward compatibility 692 + * with existing DT files, we work around this by deleting any 693 + * fwnode_links to/from this fwnode. 694 + */ 695 + fw_devlink_purge_absent_suppliers(fwnode); 696 + 697 + /* 689 698 * When both VDD and VSYS power supplies are present, the low power 690 699 * supply VSYS is selected when VSYS voltage is above 3.1 V. 691 700 * Otherwise VDD is selected. ··· 748 739 typec_set_pwr_opmode(chip->port, chip->pwr_opmode); 749 740 750 741 if (client->irq) { 751 - ret = stusb160x_irq_init(chip, client->irq); 752 - if (ret) 753 - goto port_unregister; 754 - 755 742 chip->role_sw = fwnode_usb_role_switch_get(fwnode); 756 743 if (IS_ERR(chip->role_sw)) { 757 744 ret = PTR_ERR(chip->role_sw); ··· 757 752 ret); 758 753 goto port_unregister; 759 754 } 755 + 756 + ret = stusb160x_irq_init(chip, client->irq); 757 + if (ret) 758 + goto role_sw_put; 760 759 } else { 761 760 /* 762 761 * If Source or Dual power role, need to enable VDD supply ··· 784 775 785 776 return 0; 786 777 778 + role_sw_put: 779 + if (chip->role_sw) 780 + usb_role_switch_put(chip->role_sw); 787 781 port_unregister: 788 782 typec_unregister_port(chip->port); 789 783 all_reg_disable:
+9
drivers/usb/typec/tipd/core.c
··· 629 629 if (!fwnode) 630 630 return -ENODEV; 631 631 632 + /* 633 + * This fwnode has a "compatible" property, but is never populated as a 634 + * struct device. Instead we simply parse it to read the properties. 635 + * This breaks fw_devlink=on. To maintain backward compatibility 636 + * with existing DT files, we work around this by deleting any 637 + * fwnode_links to/from this fwnode. 638 + */ 639 + fw_devlink_purge_absent_suppliers(fwnode); 640 + 632 641 tps->role_sw = fwnode_usb_role_switch_get(fwnode); 633 642 if (IS_ERR(tps->role_sw)) { 634 643 ret = PTR_ERR(tps->role_sw);
-15
fs/Kconfig.binfmt
··· 168 168 with v4 shared libraries freely available from Compaq. If you're 169 169 going to use shared libraries from Tru64 version 5.0 or later, say N. 170 170 171 - config BINFMT_EM86 172 - tristate "Kernel support for Linux/Intel ELF binaries" 173 - depends on ALPHA 174 - help 175 - Say Y here if you want to be able to execute Linux/Intel ELF 176 - binaries just like native Alpha binaries on your Alpha machine. For 177 - this to work, you need to have the emulator /usr/bin/em86 in place. 178 - 179 - You can get the same functionality by saying N here and saying Y to 180 - "Kernel support for MISC binaries". 181 - 182 - You may answer M to compile the emulation support as a module and 183 - later load the module when you want to use a Linux/Intel binary. The 184 - module will be called binfmt_em86. If unsure, say Y. 185 - 186 171 config BINFMT_MISC 187 172 tristate "Kernel support for MISC binaries" 188 173 help
-1
fs/Makefile
··· 39 39 obj-$(CONFIG_FS_VERITY) += verity/ 40 40 obj-$(CONFIG_FILE_LOCKING) += locks.o 41 41 obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o 42 - obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o 43 42 obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o 44 43 obj-$(CONFIG_BINFMT_SCRIPT) += binfmt_script.o 45 44 obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
-110
fs/binfmt_em86.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * linux/fs/binfmt_em86.c 4 - * 5 - * Based on linux/fs/binfmt_script.c 6 - * Copyright (C) 1996 Martin von Löwis 7 - * original #!-checking implemented by tytso. 8 - * 9 - * em86 changes Copyright (C) 1997 Jim Paradis 10 - */ 11 - 12 - #include <linux/module.h> 13 - #include <linux/string.h> 14 - #include <linux/stat.h> 15 - #include <linux/binfmts.h> 16 - #include <linux/elf.h> 17 - #include <linux/init.h> 18 - #include <linux/fs.h> 19 - #include <linux/file.h> 20 - #include <linux/errno.h> 21 - 22 - 23 - #define EM86_INTERP "/usr/bin/em86" 24 - #define EM86_I_NAME "em86" 25 - 26 - static int load_em86(struct linux_binprm *bprm) 27 - { 28 - const char *i_name, *i_arg; 29 - char *interp; 30 - struct file * file; 31 - int retval; 32 - struct elfhdr elf_ex; 33 - 34 - /* Make sure this is a Linux/Intel ELF executable... */ 35 - elf_ex = *((struct elfhdr *)bprm->buf); 36 - 37 - if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0) 38 - return -ENOEXEC; 39 - 40 - /* First of all, some simple consistency checks */ 41 - if ((elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN) || 42 - (!((elf_ex.e_machine == EM_386) || (elf_ex.e_machine == EM_486))) || 43 - !bprm->file->f_op->mmap) { 44 - return -ENOEXEC; 45 - } 46 - 47 - /* Need to be able to load the file after exec */ 48 - if (bprm->interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE) 49 - return -ENOENT; 50 - 51 - /* Unlike in the script case, we don't have to do any hairy 52 - * parsing to find our interpreter... it's hardcoded! 53 - */ 54 - interp = EM86_INTERP; 55 - i_name = EM86_I_NAME; 56 - i_arg = NULL; /* We reserve the right to add an arg later */ 57 - 58 - /* 59 - * Splice in (1) the interpreter's name for argv[0] 60 - * (2) (optional) argument to interpreter 61 - * (3) filename of emulated file (replace argv[0]) 62 - * 63 - * This is done in reverse order, because of how the 64 - * user environment and arguments are stored. 65 - */ 66 - remove_arg_zero(bprm); 67 - retval = copy_string_kernel(bprm->filename, bprm); 68 - if (retval < 0) return retval; 69 - bprm->argc++; 70 - if (i_arg) { 71 - retval = copy_string_kernel(i_arg, bprm); 72 - if (retval < 0) return retval; 73 - bprm->argc++; 74 - } 75 - retval = copy_string_kernel(i_name, bprm); 76 - if (retval < 0) return retval; 77 - bprm->argc++; 78 - 79 - /* 80 - * OK, now restart the process with the interpreter's inode. 81 - * Note that we use open_exec() as the name is now in kernel 82 - * space, and we don't need to copy it. 83 - */ 84 - file = open_exec(interp); 85 - if (IS_ERR(file)) 86 - return PTR_ERR(file); 87 - 88 - bprm->interpreter = file; 89 - return 0; 90 - } 91 - 92 - static struct linux_binfmt em86_format = { 93 - .module = THIS_MODULE, 94 - .load_binary = load_em86, 95 - }; 96 - 97 - static int __init init_em86_binfmt(void) 98 - { 99 - register_binfmt(&em86_format); 100 - return 0; 101 - } 102 - 103 - static void __exit exit_em86_binfmt(void) 104 - { 105 - unregister_binfmt(&em86_format); 106 - } 107 - 108 - core_initcall(init_em86_binfmt); 109 - module_exit(exit_em86_binfmt); 110 - MODULE_LICENSE("GPL");
+2
fs/block_dev.c
··· 812 812 free_percpu(bdev->bd_stats); 813 813 kfree(bdev->bd_meta_info); 814 814 815 + if (!bdev_is_partition(bdev)) 816 + kfree(bdev->bd_disk); 815 817 kmem_cache_free(bdev_cachep, BDEV_I(inode)); 816 818 } 817 819
+3 -3
fs/btrfs/backref.c
··· 1488 1488 int btrfs_find_all_roots(struct btrfs_trans_handle *trans, 1489 1489 struct btrfs_fs_info *fs_info, u64 bytenr, 1490 1490 u64 time_seq, struct ulist **roots, 1491 - bool ignore_offset) 1491 + bool ignore_offset, bool skip_commit_root_sem) 1492 1492 { 1493 1493 int ret; 1494 1494 1495 - if (!trans) 1495 + if (!trans && !skip_commit_root_sem) 1496 1496 down_read(&fs_info->commit_root_sem); 1497 1497 ret = btrfs_find_all_roots_safe(trans, fs_info, bytenr, 1498 1498 time_seq, roots, ignore_offset); 1499 - if (!trans) 1499 + if (!trans && !skip_commit_root_sem) 1500 1500 up_read(&fs_info->commit_root_sem); 1501 1501 return ret; 1502 1502 }
+2 -1
fs/btrfs/backref.h
··· 47 47 const u64 *extent_item_pos, bool ignore_offset); 48 48 int btrfs_find_all_roots(struct btrfs_trans_handle *trans, 49 49 struct btrfs_fs_info *fs_info, u64 bytenr, 50 - u64 time_seq, struct ulist **roots, bool ignore_offset); 50 + u64 time_seq, struct ulist **roots, bool ignore_offset, 51 + bool skip_commit_root_sem); 51 52 char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, 52 53 u32 name_len, unsigned long name_off, 53 54 struct extent_buffer *eb_in, u64 parent,
+1 -1
fs/btrfs/compression.c
··· 352 352 btrfs_record_physical_zoned(inode, cb->start, bio); 353 353 btrfs_writepage_endio_finish_ordered(BTRFS_I(inode), NULL, 354 354 cb->start, cb->start + cb->len - 1, 355 - bio->bi_status == BLK_STS_OK); 355 + !cb->errors); 356 356 357 357 end_compressed_writeback(inode, cb); 358 358 /* note, our inode could be gone now */
+2 -2
fs/btrfs/delayed-ref.c
··· 974 974 kmem_cache_free(btrfs_delayed_tree_ref_cachep, ref); 975 975 976 976 if (qrecord_inserted) 977 - btrfs_qgroup_trace_extent_post(fs_info, record); 977 + btrfs_qgroup_trace_extent_post(trans, record); 978 978 979 979 return 0; 980 980 } ··· 1069 1069 1070 1070 1071 1071 if (qrecord_inserted) 1072 - return btrfs_qgroup_trace_extent_post(fs_info, record); 1072 + return btrfs_qgroup_trace_extent_post(trans, record); 1073 1073 return 0; 1074 1074 } 1075 1075
+1 -1
fs/btrfs/disk-io.c
··· 209 209 static void csum_tree_block(struct extent_buffer *buf, u8 *result) 210 210 { 211 211 struct btrfs_fs_info *fs_info = buf->fs_info; 212 - const int num_pages = fs_info->nodesize >> PAGE_SHIFT; 212 + const int num_pages = num_extent_pages(buf); 213 213 const int first_page_part = min_t(u32, PAGE_SIZE, fs_info->nodesize); 214 214 SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); 215 215 char *kaddr;
+3
fs/btrfs/extent-tree.c
··· 6019 6019 mutex_lock(&fs_info->fs_devices->device_list_mutex); 6020 6020 devices = &fs_info->fs_devices->devices; 6021 6021 list_for_each_entry(device, devices, dev_list) { 6022 + if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) 6023 + continue; 6024 + 6022 6025 ret = btrfs_trim_free_extents(device, &group_trimmed); 6023 6026 if (ret) { 6024 6027 dev_failed++;
+1 -1
fs/btrfs/inode.c
··· 2992 2992 goto out; 2993 2993 } 2994 2994 2995 - if (ordered_extent->disk) 2995 + if (ordered_extent->bdev) 2996 2996 btrfs_rewrite_logical_zoned(ordered_extent); 2997 2997 2998 2998 btrfs_free_io_failure_record(inode, start, end);
-2
fs/btrfs/ordered-data.c
··· 190 190 entry->truncated_len = (u64)-1; 191 191 entry->qgroup_rsv = ret; 192 192 entry->physical = (u64)-1; 193 - entry->disk = NULL; 194 - entry->partno = (u8)-1; 195 193 196 194 ASSERT(type == BTRFS_ORDERED_REGULAR || 197 195 type == BTRFS_ORDERED_NOCOW ||
+1 -2
fs/btrfs/ordered-data.h
··· 145 145 * command in a workqueue context 146 146 */ 147 147 u64 physical; 148 - struct gendisk *disk; 149 - u8 partno; 148 + struct block_device *bdev; 150 149 }; 151 150 152 151 /*
+30 -8
fs/btrfs/qgroup.c
··· 1704 1704 return 0; 1705 1705 } 1706 1706 1707 - int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info, 1707 + int btrfs_qgroup_trace_extent_post(struct btrfs_trans_handle *trans, 1708 1708 struct btrfs_qgroup_extent_record *qrecord) 1709 1709 { 1710 1710 struct ulist *old_root; 1711 1711 u64 bytenr = qrecord->bytenr; 1712 1712 int ret; 1713 1713 1714 - ret = btrfs_find_all_roots(NULL, fs_info, bytenr, 0, &old_root, false); 1714 + /* 1715 + * We are always called in a context where we are already holding a 1716 + * transaction handle. Often we are called when adding a data delayed 1717 + * reference from btrfs_truncate_inode_items() (truncating or unlinking), 1718 + * in which case we will be holding a write lock on extent buffer from a 1719 + * subvolume tree. In this case we can't allow btrfs_find_all_roots() to 1720 + * acquire fs_info->commit_root_sem, because that is a higher level lock 1721 + * that must be acquired before locking any extent buffers. 1722 + * 1723 + * So we want btrfs_find_all_roots() to not acquire the commit_root_sem 1724 + * but we can't pass it a non-NULL transaction handle, because otherwise 1725 + * it would not use commit roots and would lock extent buffers, causing 1726 + * a deadlock if it ends up trying to read lock the same extent buffer 1727 + * that was previously write locked at btrfs_truncate_inode_items(). 1728 + * 1729 + * So pass a NULL transaction handle to btrfs_find_all_roots() and 1730 + * explicitly tell it to not acquire the commit_root_sem - if we are 1731 + * holding a transaction handle we don't need its protection. 1732 + */ 1733 + ASSERT(trans != NULL); 1734 + 1735 + ret = btrfs_find_all_roots(NULL, trans->fs_info, bytenr, 0, &old_root, 1736 + false, true); 1715 1737 if (ret < 0) { 1716 - fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 1717 - btrfs_warn(fs_info, 1738 + trans->fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; 1739 + btrfs_warn(trans->fs_info, 1718 1740 "error accounting new delayed refs extent (err code: %d), quota inconsistent", 1719 1741 ret); 1720 1742 return 0; ··· 1780 1758 kfree(record); 1781 1759 return 0; 1782 1760 } 1783 - return btrfs_qgroup_trace_extent_post(fs_info, record); 1761 + return btrfs_qgroup_trace_extent_post(trans, record); 1784 1762 } 1785 1763 1786 1764 int btrfs_qgroup_trace_leaf_items(struct btrfs_trans_handle *trans, ··· 2651 2629 /* Search commit root to find old_roots */ 2652 2630 ret = btrfs_find_all_roots(NULL, fs_info, 2653 2631 record->bytenr, 0, 2654 - &record->old_roots, false); 2632 + &record->old_roots, false, false); 2655 2633 if (ret < 0) 2656 2634 goto cleanup; 2657 2635 } ··· 2667 2645 * current root. It's safe inside commit_transaction(). 2668 2646 */ 2669 2647 ret = btrfs_find_all_roots(trans, fs_info, 2670 - record->bytenr, BTRFS_SEQ_LAST, &new_roots, false); 2648 + record->bytenr, BTRFS_SEQ_LAST, &new_roots, false, false); 2671 2649 if (ret < 0) 2672 2650 goto cleanup; 2673 2651 if (qgroup_to_skip) { ··· 3201 3179 num_bytes = found.offset; 3202 3180 3203 3181 ret = btrfs_find_all_roots(NULL, fs_info, found.objectid, 0, 3204 - &roots, false); 3182 + &roots, false, false); 3205 3183 if (ret < 0) 3206 3184 goto out; 3207 3185 /* For rescan, just pass old_roots as NULL */
+1 -1
fs/btrfs/qgroup.h
··· 298 298 * using current root, then we can move all expensive backref walk out of 299 299 * transaction committing, but not now as qgroup accounting will be wrong again. 300 300 */ 301 - int btrfs_qgroup_trace_extent_post(struct btrfs_fs_info *fs_info, 301 + int btrfs_qgroup_trace_extent_post(struct btrfs_trans_handle *trans, 302 302 struct btrfs_qgroup_extent_record *qrecord); 303 303 304 304 /*
+10 -10
fs/btrfs/tests/qgroup-tests.c
··· 224 224 * quota. 225 225 */ 226 226 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 227 - false); 227 + false, false); 228 228 if (ret) { 229 229 ulist_free(old_roots); 230 230 test_err("couldn't find old roots: %d", ret); ··· 237 237 return ret; 238 238 239 239 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 240 - false); 240 + false, false); 241 241 if (ret) { 242 242 ulist_free(old_roots); 243 243 ulist_free(new_roots); ··· 261 261 new_roots = NULL; 262 262 263 263 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 264 - false); 264 + false, false); 265 265 if (ret) { 266 266 ulist_free(old_roots); 267 267 test_err("couldn't find old roots: %d", ret); ··· 273 273 return -EINVAL; 274 274 275 275 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 276 - false); 276 + false, false); 277 277 if (ret) { 278 278 ulist_free(old_roots); 279 279 ulist_free(new_roots); ··· 325 325 } 326 326 327 327 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 328 - false); 328 + false, false); 329 329 if (ret) { 330 330 ulist_free(old_roots); 331 331 test_err("couldn't find old roots: %d", ret); ··· 338 338 return ret; 339 339 340 340 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 341 - false); 341 + false, false); 342 342 if (ret) { 343 343 ulist_free(old_roots); 344 344 ulist_free(new_roots); ··· 360 360 } 361 361 362 362 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 363 - false); 363 + false, false); 364 364 if (ret) { 365 365 ulist_free(old_roots); 366 366 test_err("couldn't find old roots: %d", ret); ··· 373 373 return ret; 374 374 375 375 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 376 - false); 376 + false, false); 377 377 if (ret) { 378 378 ulist_free(old_roots); 379 379 ulist_free(new_roots); ··· 401 401 } 402 402 403 403 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots, 404 - false); 404 + false, false); 405 405 if (ret) { 406 406 ulist_free(old_roots); 407 407 test_err("couldn't find old roots: %d", ret); ··· 414 414 return ret; 415 415 416 416 ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, 417 - false); 417 + false, false); 418 418 if (ret) { 419 419 ulist_free(old_roots); 420 420 ulist_free(new_roots);
+24 -11
fs/btrfs/tree-log.c
··· 5526 5526 spin_lock(&inode->lock); 5527 5527 inode->logged_trans = trans->transid; 5528 5528 /* 5529 - * Don't update last_log_commit if we logged that an inode exists 5530 - * after it was loaded to memory (full_sync bit set). 5531 - * This is to prevent data loss when we do a write to the inode, 5532 - * then the inode gets evicted after all delalloc was flushed, 5533 - * then we log it exists (due to a rename for example) and then 5534 - * fsync it. This last fsync would do nothing (not logging the 5535 - * extents previously written). 5529 + * Don't update last_log_commit if we logged that an inode exists. 5530 + * We do this for two reasons: 5531 + * 5532 + * 1) We might have had buffered writes to this inode that were 5533 + * flushed and had their ordered extents completed in this 5534 + * transaction, but we did not previously log the inode with 5535 + * LOG_INODE_ALL. Later the inode was evicted and after that 5536 + * it was loaded again and this LOG_INODE_EXISTS log operation 5537 + * happened. We must make sure that if an explicit fsync against 5538 + * the inode is performed later, it logs the new extents, an 5539 + * updated inode item, etc, and syncs the log. The same logic 5540 + * applies to direct IO writes instead of buffered writes. 5541 + * 5542 + * 2) When we log the inode with LOG_INODE_EXISTS, its inode item 5543 + * is logged with an i_size of 0 or whatever value was logged 5544 + * before. If later the i_size of the inode is increased by a 5545 + * truncate operation, the log is synced through an fsync of 5546 + * some other inode and then finally an explicit fsync against 5547 + * this inode is made, we must make sure this fsync logs the 5548 + * inode with the new i_size, the hole between old i_size and 5549 + * the new i_size, and syncs the log. 5536 5550 */ 5537 - if (inode_only != LOG_INODE_EXISTS || 5538 - !test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags)) 5551 + if (inode_only != LOG_INODE_EXISTS) 5539 5552 inode->last_log_commit = inode->last_sub_trans; 5540 5553 spin_unlock(&inode->lock); 5541 5554 } ··· 6503 6490 * if this inode hasn't been logged and directory we're renaming it 6504 6491 * from hasn't been logged, we don't need to log it 6505 6492 */ 6506 - if (inode->logged_trans < trans->transid && 6507 - (!old_dir || old_dir->logged_trans < trans->transid)) 6493 + if (!inode_logged(trans, inode) && 6494 + (!old_dir || !inode_logged(trans, old_dir))) 6508 6495 return; 6509 6496 6510 6497 /*
+1
fs/btrfs/volumes.c
··· 1078 1078 if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state)) { 1079 1079 list_del_init(&device->dev_alloc_list); 1080 1080 clear_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state); 1081 + fs_devices->rw_devices--; 1081 1082 } 1082 1083 list_del_init(&device->dev_list); 1083 1084 fs_devices->num_devices--;
+4 -8
fs/btrfs/zoned.c
··· 1349 1349 return; 1350 1350 1351 1351 ordered->physical = physical; 1352 - ordered->disk = bio->bi_bdev->bd_disk; 1353 - ordered->partno = bio->bi_bdev->bd_partno; 1352 + ordered->bdev = bio->bi_bdev; 1354 1353 1355 1354 btrfs_put_ordered_extent(ordered); 1356 1355 } ··· 1361 1362 struct extent_map_tree *em_tree; 1362 1363 struct extent_map *em; 1363 1364 struct btrfs_ordered_sum *sum; 1364 - struct block_device *bdev; 1365 1365 u64 orig_logical = ordered->disk_bytenr; 1366 1366 u64 *logical = NULL; 1367 1367 int nr, stripe_len; 1368 1368 1369 1369 /* Zoned devices should not have partitions. So, we can assume it is 0 */ 1370 - ASSERT(ordered->partno == 0); 1371 - bdev = bdgrab(ordered->disk->part0); 1372 - if (WARN_ON(!bdev)) 1370 + ASSERT(!bdev_is_partition(ordered->bdev)); 1371 + if (WARN_ON(!ordered->bdev)) 1373 1372 return; 1374 1373 1375 - if (WARN_ON(btrfs_rmap_block(fs_info, orig_logical, bdev, 1374 + if (WARN_ON(btrfs_rmap_block(fs_info, orig_logical, ordered->bdev, 1376 1375 ordered->physical, &logical, &nr, 1377 1376 &stripe_len))) 1378 1377 goto out; ··· 1399 1402 1400 1403 out: 1401 1404 kfree(logical); 1402 - bdput(bdev); 1403 1405 } 1404 1406 1405 1407 bool btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
+1 -1
fs/ceph/mds_client.c
··· 4456 4456 break; 4457 4457 case CEPH_MDS_SESSION_CLOSING: 4458 4458 /* Should never reach this when we're unmounting */ 4459 - WARN_ON_ONCE(true); 4459 + WARN_ON_ONCE(s->s_ttl); 4460 4460 fallthrough; 4461 4461 case CEPH_MDS_SESSION_NEW: 4462 4462 case CEPH_MDS_SESSION_RESTARTING:
+7 -3
fs/cifs/cifssmb.c
··· 873 873 InformationLevel) - 4; 874 874 offset = param_offset + params; 875 875 876 - /* Setup pointer to Request Data (inode type) */ 877 - pRqD = (struct unlink_psx_rq *)(((char *)&pSMB->hdr.Protocol) + offset); 876 + /* Setup pointer to Request Data (inode type). 877 + * Note that SMB offsets are from the beginning of SMB which is 4 bytes 878 + * in, after RFC1001 field 879 + */ 880 + pRqD = (struct unlink_psx_rq *)((char *)(pSMB) + offset + 4); 878 881 pRqD->type = cpu_to_le16(type); 879 882 pSMB->ParameterOffset = cpu_to_le16(param_offset); 880 883 pSMB->DataOffset = cpu_to_le16(offset); ··· 1084 1081 param_offset = offsetof(struct smb_com_transaction2_spi_req, 1085 1082 InformationLevel) - 4; 1086 1083 offset = param_offset + params; 1087 - pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset); 1084 + /* SMB offsets are from the beginning of SMB which is 4 bytes in, after RFC1001 field */ 1085 + pdata = (OPEN_PSX_REQ *)((char *)(pSMB) + offset + 4); 1088 1086 pdata->Level = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC); 1089 1087 pdata->Permissions = cpu_to_le64(mode); 1090 1088 pdata->PosixOpenFlags = cpu_to_le32(posix_flags);
+2 -2
fs/cifs/connect.c
··· 220 220 #ifdef CONFIG_CIFS_DFS_UPCALL 221 221 struct super_block *sb = NULL; 222 222 struct cifs_sb_info *cifs_sb = NULL; 223 - struct dfs_cache_tgt_list tgt_list = {0}; 223 + struct dfs_cache_tgt_list tgt_list = DFS_CACHE_TGT_LIST_INIT(tgt_list); 224 224 struct dfs_cache_tgt_iterator *tgt_it = NULL; 225 225 #endif 226 226 ··· 3130 3130 { 3131 3131 int rc; 3132 3132 char *npath = NULL; 3133 - struct dfs_cache_tgt_list tgt_list = {0}; 3133 + struct dfs_cache_tgt_list tgt_list = DFS_CACHE_TGT_LIST_INIT(tgt_list); 3134 3134 struct dfs_cache_tgt_iterator *tgt_it = NULL; 3135 3135 struct smb3_fs_context tmp_ctx = {NULL}; 3136 3136
+191 -38
fs/cifs/dfs_cache.c
··· 19 19 #include "cifs_debug.h" 20 20 #include "cifs_unicode.h" 21 21 #include "smb2glob.h" 22 + #include "dns_resolve.h" 22 23 23 24 #include "dfs_cache.h" 24 25 ··· 912 911 913 912 err_free_it: 914 913 list_for_each_entry_safe(it, nit, head, it_list) { 914 + list_del(&it->it_list); 915 915 kfree(it->it_name); 916 916 kfree(it); 917 917 } ··· 1295 1293 return 0; 1296 1294 } 1297 1295 1296 + static bool target_share_equal(struct TCP_Server_Info *server, const char *s1, const char *s2) 1297 + { 1298 + char unc[sizeof("\\\\") + SERVER_NAME_LENGTH] = {0}; 1299 + const char *host; 1300 + size_t hostlen; 1301 + char *ip = NULL; 1302 + struct sockaddr sa; 1303 + bool match; 1304 + int rc; 1305 + 1306 + if (strcasecmp(s1, s2)) 1307 + return false; 1308 + 1309 + /* 1310 + * Resolve share's hostname and check if server address matches. Otherwise just ignore it 1311 + * as we could not have upcall to resolve hostname or failed to convert ip address. 1312 + */ 1313 + match = true; 1314 + extract_unc_hostname(s1, &host, &hostlen); 1315 + scnprintf(unc, sizeof(unc), "\\\\%.*s", (int)hostlen, host); 1316 + 1317 + rc = dns_resolve_server_name_to_ip(unc, &ip, NULL); 1318 + if (rc < 0) { 1319 + cifs_dbg(FYI, "%s: could not resolve %.*s. assuming server address matches.\n", 1320 + __func__, (int)hostlen, host); 1321 + return true; 1322 + } 1323 + 1324 + if (!cifs_convert_address(&sa, ip, strlen(ip))) { 1325 + cifs_dbg(VFS, "%s: failed to convert address \'%s\'. skip address matching.\n", 1326 + __func__, ip); 1327 + } else { 1328 + mutex_lock(&server->srv_mutex); 1329 + match = cifs_match_ipaddr((struct sockaddr *)&server->dstaddr, &sa); 1330 + mutex_unlock(&server->srv_mutex); 1331 + } 1332 + 1333 + kfree(ip); 1334 + return match; 1335 + } 1336 + 1337 + /* 1338 + * Mark dfs tcon for reconnecting when the currently connected tcon does not match any of the new 1339 + * target shares in @refs. 1340 + */ 1341 + static void mark_for_reconnect_if_needed(struct cifs_tcon *tcon, struct dfs_cache_tgt_list *tl, 1342 + const struct dfs_info3_param *refs, int numrefs) 1343 + { 1344 + struct dfs_cache_tgt_iterator *it; 1345 + int i; 1346 + 1347 + for (it = dfs_cache_get_tgt_iterator(tl); it; it = dfs_cache_get_next_tgt(tl, it)) { 1348 + for (i = 0; i < numrefs; i++) { 1349 + if (target_share_equal(tcon->ses->server, dfs_cache_get_tgt_name(it), 1350 + refs[i].node_name)) 1351 + return; 1352 + } 1353 + } 1354 + 1355 + cifs_dbg(FYI, "%s: no cached or matched targets. mark dfs share for reconnect.\n", __func__); 1356 + for (i = 0; i < tcon->ses->chan_count; i++) { 1357 + spin_lock(&GlobalMid_Lock); 1358 + if (tcon->ses->chans[i].server->tcpStatus != CifsExiting) 1359 + tcon->ses->chans[i].server->tcpStatus = CifsNeedReconnect; 1360 + spin_unlock(&GlobalMid_Lock); 1361 + } 1362 + } 1363 + 1364 + /* Refresh dfs referral of tcon and mark it for reconnect if needed */ 1365 + static int refresh_tcon(struct cifs_ses **sessions, struct cifs_tcon *tcon, bool force_refresh) 1366 + { 1367 + const char *path = tcon->dfs_path + 1; 1368 + struct cifs_ses *ses; 1369 + struct cache_entry *ce; 1370 + struct dfs_info3_param *refs = NULL; 1371 + int numrefs = 0; 1372 + bool needs_refresh = false; 1373 + struct dfs_cache_tgt_list tl = DFS_CACHE_TGT_LIST_INIT(tl); 1374 + int rc = 0; 1375 + unsigned int xid; 1376 + 1377 + ses = find_ipc_from_server_path(sessions, path); 1378 + if (IS_ERR(ses)) { 1379 + cifs_dbg(FYI, "%s: could not find ipc session\n", __func__); 1380 + return PTR_ERR(ses); 1381 + } 1382 + 1383 + down_read(&htable_rw_lock); 1384 + ce = lookup_cache_entry(path); 1385 + needs_refresh = force_refresh || IS_ERR(ce) || cache_entry_expired(ce); 1386 + if (!IS_ERR(ce)) { 1387 + rc = get_targets(ce, &tl); 1388 + if (rc) 1389 + cifs_dbg(FYI, "%s: could not get dfs targets: %d\n", __func__, rc); 1390 + } 1391 + up_read(&htable_rw_lock); 1392 + 1393 + if (!needs_refresh) { 1394 + rc = 0; 1395 + goto out; 1396 + } 1397 + 1398 + xid = get_xid(); 1399 + rc = get_dfs_referral(xid, ses, path, &refs, &numrefs); 1400 + free_xid(xid); 1401 + 1402 + /* Create or update a cache entry with the new referral */ 1403 + if (!rc) { 1404 + dump_refs(refs, numrefs); 1405 + 1406 + down_write(&htable_rw_lock); 1407 + ce = lookup_cache_entry(path); 1408 + if (IS_ERR(ce)) 1409 + add_cache_entry_locked(refs, numrefs); 1410 + else if (force_refresh || cache_entry_expired(ce)) 1411 + update_cache_entry_locked(ce, refs, numrefs); 1412 + up_write(&htable_rw_lock); 1413 + 1414 + mark_for_reconnect_if_needed(tcon, &tl, refs, numrefs); 1415 + } 1416 + 1417 + out: 1418 + dfs_cache_free_tgts(&tl); 1419 + free_dfs_info_array(refs, numrefs); 1420 + return rc; 1421 + } 1422 + 1423 + /** 1424 + * dfs_cache_remount_fs - remount a DFS share 1425 + * 1426 + * Reconfigure dfs mount by forcing a new DFS referral and if the currently cached targets do not 1427 + * match any of the new targets, mark it for reconnect. 1428 + * 1429 + * @cifs_sb: cifs superblock. 1430 + * 1431 + * Return zero if remounted, otherwise non-zero. 1432 + */ 1433 + int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb) 1434 + { 1435 + struct cifs_tcon *tcon; 1436 + struct mount_group *mg; 1437 + struct cifs_ses *sessions[CACHE_MAX_ENTRIES + 1] = {NULL}; 1438 + int rc; 1439 + 1440 + if (!cifs_sb || !cifs_sb->master_tlink) 1441 + return -EINVAL; 1442 + 1443 + tcon = cifs_sb_master_tcon(cifs_sb); 1444 + if (!tcon->dfs_path) { 1445 + cifs_dbg(FYI, "%s: not a dfs tcon\n", __func__); 1446 + return 0; 1447 + } 1448 + 1449 + if (uuid_is_null(&cifs_sb->dfs_mount_id)) { 1450 + cifs_dbg(FYI, "%s: tcon has no dfs mount group id\n", __func__); 1451 + return -EINVAL; 1452 + } 1453 + 1454 + mutex_lock(&mount_group_list_lock); 1455 + mg = find_mount_group_locked(&cifs_sb->dfs_mount_id); 1456 + if (IS_ERR(mg)) { 1457 + mutex_unlock(&mount_group_list_lock); 1458 + cifs_dbg(FYI, "%s: tcon has ipc session to refresh referral\n", __func__); 1459 + return PTR_ERR(mg); 1460 + } 1461 + kref_get(&mg->refcount); 1462 + mutex_unlock(&mount_group_list_lock); 1463 + 1464 + spin_lock(&mg->lock); 1465 + memcpy(&sessions, mg->sessions, mg->num_sessions * sizeof(mg->sessions[0])); 1466 + spin_unlock(&mg->lock); 1467 + 1468 + /* 1469 + * After reconnecting to a different server, unique ids won't match anymore, so we disable 1470 + * serverino. This prevents dentry revalidation to think the dentry are stale (ESTALE). 1471 + */ 1472 + cifs_autodisable_serverino(cifs_sb); 1473 + /* 1474 + * Force the use of prefix path to support failover on DFS paths that resolve to targets 1475 + * that have different prefix paths. 1476 + */ 1477 + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; 1478 + rc = refresh_tcon(sessions, tcon, true); 1479 + 1480 + kref_put(&mg->refcount, mount_group_release); 1481 + return rc; 1482 + } 1483 + 1298 1484 /* 1299 1485 * Refresh all active dfs mounts regardless of whether they are in cache or not. 1300 1486 * (cache can be cleared) ··· 1493 1303 struct cifs_ses *ses; 1494 1304 struct cifs_tcon *tcon, *ntcon; 1495 1305 struct list_head tcons; 1496 - unsigned int xid; 1497 1306 1498 1307 INIT_LIST_HEAD(&tcons); 1499 1308 ··· 1510 1321 spin_unlock(&cifs_tcp_ses_lock); 1511 1322 1512 1323 list_for_each_entry_safe(tcon, ntcon, &tcons, ulist) { 1513 - const char *path = tcon->dfs_path + 1; 1514 - struct cache_entry *ce; 1515 - struct dfs_info3_param *refs = NULL; 1516 - int numrefs = 0; 1517 - bool needs_refresh = false; 1518 - int rc = 0; 1519 - 1520 1324 list_del_init(&tcon->ulist); 1521 - 1522 - ses = find_ipc_from_server_path(sessions, path); 1523 - if (IS_ERR(ses)) 1524 - goto next_tcon; 1525 - 1526 - down_read(&htable_rw_lock); 1527 - ce = lookup_cache_entry(path); 1528 - needs_refresh = IS_ERR(ce) || cache_entry_expired(ce); 1529 - up_read(&htable_rw_lock); 1530 - 1531 - if (!needs_refresh) 1532 - goto next_tcon; 1533 - 1534 - xid = get_xid(); 1535 - rc = get_dfs_referral(xid, ses, path, &refs, &numrefs); 1536 - free_xid(xid); 1537 - 1538 - /* Create or update a cache entry with the new referral */ 1539 - if (!rc) { 1540 - down_write(&htable_rw_lock); 1541 - ce = lookup_cache_entry(path); 1542 - if (IS_ERR(ce)) 1543 - add_cache_entry_locked(refs, numrefs); 1544 - else if (cache_entry_expired(ce)) 1545 - update_cache_entry_locked(ce, refs, numrefs); 1546 - up_write(&htable_rw_lock); 1547 - } 1548 - 1549 - next_tcon: 1550 - free_dfs_info_array(refs, numrefs); 1325 + refresh_tcon(sessions, tcon, false); 1551 1326 cifs_put_tcon(tcon); 1552 1327 } 1553 1328 }
+3
fs/cifs/dfs_cache.h
··· 13 13 #include <linux/uuid.h> 14 14 #include "cifsglob.h" 15 15 16 + #define DFS_CACHE_TGT_LIST_INIT(var) { .tl_numtgts = 0, .tl_list = LIST_HEAD_INIT((var).tl_list), } 17 + 16 18 struct dfs_cache_tgt_list { 17 19 int tl_numtgts; 18 20 struct list_head tl_list; ··· 46 44 void dfs_cache_put_refsrv_sessions(const uuid_t *mount_id); 47 45 void dfs_cache_add_refsrv_session(const uuid_t *mount_id, struct cifs_ses *ses); 48 46 char *dfs_cache_canonical_path(const char *path, const struct nls_table *cp, int remap); 47 + int dfs_cache_remount_fs(struct cifs_sb_info *cifs_sb); 49 48 50 49 static inline struct dfs_cache_tgt_iterator * 51 50 dfs_cache_get_next_tgt(struct dfs_cache_tgt_list *tl,
+7
fs/cifs/fs_context.c
··· 13 13 #include <linux/magic.h> 14 14 #include <linux/security.h> 15 15 #include <net/net_namespace.h> 16 + #ifdef CONFIG_CIFS_DFS_UPCALL 17 + #include "dfs_cache.h" 18 + #endif 16 19 */ 17 20 18 21 #include <linux/ctype.h> ··· 782 779 smb3_cleanup_fs_context_contents(cifs_sb->ctx); 783 780 rc = smb3_fs_context_dup(cifs_sb->ctx, ctx); 784 781 smb3_update_mnt_flags(cifs_sb); 782 + #ifdef CONFIG_CIFS_DFS_UPCALL 783 + if (!rc) 784 + rc = dfs_cache_remount_fs(cifs_sb); 785 + #endif 785 786 786 787 return rc; 787 788 }
+37 -12
fs/cifs/smb2ops.c
··· 3617 3617 char *buf) 3618 3618 { 3619 3619 struct cifs_io_parms io_parms = {0}; 3620 - int nbytes; 3620 + int rc, nbytes; 3621 3621 struct kvec iov[2]; 3622 3622 3623 3623 io_parms.netfid = cfile->fid.netfid; ··· 3625 3625 io_parms.tcon = tcon; 3626 3626 io_parms.persistent_fid = cfile->fid.persistent_fid; 3627 3627 io_parms.volatile_fid = cfile->fid.volatile_fid; 3628 - io_parms.offset = off; 3629 - io_parms.length = len; 3630 3628 3631 - /* iov[0] is reserved for smb header */ 3632 - iov[1].iov_base = buf; 3633 - iov[1].iov_len = io_parms.length; 3634 - return SMB2_write(xid, &io_parms, &nbytes, iov, 1); 3629 + while (len) { 3630 + io_parms.offset = off; 3631 + io_parms.length = len; 3632 + if (io_parms.length > SMB2_MAX_BUFFER_SIZE) 3633 + io_parms.length = SMB2_MAX_BUFFER_SIZE; 3634 + /* iov[0] is reserved for smb header */ 3635 + iov[1].iov_base = buf; 3636 + iov[1].iov_len = io_parms.length; 3637 + rc = SMB2_write(xid, &io_parms, &nbytes, iov, 1); 3638 + if (rc) 3639 + break; 3640 + if (nbytes > len) 3641 + return -EINVAL; 3642 + buf += nbytes; 3643 + off += nbytes; 3644 + len -= nbytes; 3645 + } 3646 + return rc; 3635 3647 } 3636 3648 3637 3649 static int smb3_simple_fallocate_range(unsigned int xid, ··· 3666 3654 1024 * sizeof(struct file_allocated_range_buffer), 3667 3655 (char **)&out_data, &out_data_len); 3668 3656 if (rc) 3669 - goto out; 3670 - /* 3671 - * It is already all allocated 3672 - */ 3673 - if (out_data_len == 0) 3674 3657 goto out; 3675 3658 3676 3659 buf = kzalloc(1024 * 1024, GFP_KERNEL); ··· 3787 3780 if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) { 3788 3781 rc = 0; 3789 3782 goto out; 3783 + } 3784 + 3785 + if (keep_size == true) { 3786 + /* 3787 + * We can not preallocate pages beyond the end of the file 3788 + * in SMB2 3789 + */ 3790 + if (off >= i_size_read(inode)) { 3791 + rc = 0; 3792 + goto out; 3793 + } 3794 + /* 3795 + * For fallocates that are partially beyond the end of file, 3796 + * clamp len so we only fallocate up to the end of file. 3797 + */ 3798 + if (off + len > i_size_read(inode)) { 3799 + len = i_size_read(inode) - off; 3800 + } 3790 3801 } 3791 3802 3792 3803 if ((keep_size == true) || (i_size_read(inode) >= off + len)) {
+6 -6
fs/ext2/dir.c
··· 106 106 return err; 107 107 } 108 108 109 - static bool ext2_check_page(struct page *page, int quiet) 109 + static bool ext2_check_page(struct page *page, int quiet, char *kaddr) 110 110 { 111 111 struct inode *dir = page->mapping->host; 112 112 struct super_block *sb = dir->i_sb; 113 113 unsigned chunk_size = ext2_chunk_size(dir); 114 - char *kaddr = page_address(page); 115 114 u32 max_inumber = le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count); 116 115 unsigned offs, rec_len; 117 116 unsigned limit = PAGE_SIZE; ··· 204 205 if (!IS_ERR(page)) { 205 206 *page_addr = kmap_local_page(page); 206 207 if (unlikely(!PageChecked(page))) { 207 - if (PageError(page) || !ext2_check_page(page, quiet)) 208 + if (PageError(page) || !ext2_check_page(page, quiet, 209 + *page_addr)) 208 210 goto fail; 209 211 } 210 212 } ··· 584 584 * ext2_delete_entry deletes a directory entry by merging it with the 585 585 * previous entry. Page is up-to-date. 586 586 */ 587 - int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page ) 587 + int ext2_delete_entry (struct ext2_dir_entry_2 *dir, struct page *page, 588 + char *kaddr) 588 589 { 589 590 struct inode *inode = page->mapping->host; 590 - char *kaddr = page_address(page); 591 591 unsigned from = ((char*)dir - kaddr) & ~(ext2_chunk_size(inode)-1); 592 592 unsigned to = ((char *)dir - kaddr) + 593 593 ext2_rec_len_from_disk(dir->rec_len); ··· 607 607 de = ext2_next_entry(de); 608 608 } 609 609 if (pde) 610 - from = (char*)pde - (char*)page_address(page); 610 + from = (char *)pde - kaddr; 611 611 pos = page_offset(page) + from; 612 612 lock_page(page); 613 613 err = ext2_prepare_chunk(page, pos, to - from);
+2 -1
fs/ext2/ext2.h
··· 740 740 extern int ext2_make_empty(struct inode *, struct inode *); 741 741 extern struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *, 742 742 struct page **, void **res_page_addr); 743 - extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *); 743 + extern int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct page *page, 744 + char *kaddr); 744 745 extern int ext2_empty_dir (struct inode *); 745 746 extern struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p, void **pa); 746 747 extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, void *,
+2 -2
fs/ext2/namei.c
··· 293 293 goto out; 294 294 } 295 295 296 - err = ext2_delete_entry (de, page); 296 + err = ext2_delete_entry (de, page, page_addr); 297 297 ext2_put_page(page, page_addr); 298 298 if (err) 299 299 goto out; ··· 397 397 old_inode->i_ctime = current_time(old_inode); 398 398 mark_inode_dirty(old_inode); 399 399 400 - ext2_delete_entry(old_de, old_page); 400 + ext2_delete_entry(old_de, old_page, old_page_addr); 401 401 402 402 if (dir_de) { 403 403 if (old_dir != new_dir)
+3
fs/fs-writeback.c
··· 521 521 */ 522 522 smp_mb(); 523 523 524 + if (IS_DAX(inode)) 525 + return false; 526 + 524 527 /* while holding I_WB_SWITCH, no one else can update the association */ 525 528 spin_lock(&inode->i_lock); 526 529 if (!(inode->i_sb->s_flags & SB_ACTIVE) ||
+1 -1
fs/hugetlbfs/inode.c
··· 77 77 static const struct fs_parameter_spec hugetlb_fs_parameters[] = { 78 78 fsparam_u32 ("gid", Opt_gid), 79 79 fsparam_string("min_size", Opt_min_size), 80 - fsparam_u32 ("mode", Opt_mode), 80 + fsparam_u32oct("mode", Opt_mode), 81 81 fsparam_string("nr_inodes", Opt_nr_inodes), 82 82 fsparam_string("pagesize", Opt_pagesize), 83 83 fsparam_string("size", Opt_size),
-1
fs/internal.h
··· 61 61 */ 62 62 extern const struct fs_context_operations legacy_fs_context_ops; 63 63 extern int parse_monolithic_mount_data(struct fs_context *, void *); 64 - extern void fc_drop_locked(struct fs_context *); 65 64 extern void vfs_clean_context(struct fs_context *fc); 66 65 extern int finish_clean_context(struct fs_context *fc); 67 66
+6 -1
fs/io-wq.c
··· 731 731 int work_flags; 732 732 unsigned long flags; 733 733 734 - if (test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state)) { 734 + /* 735 + * If io-wq is exiting for this task, or if the request has explicitly 736 + * been marked as one that should not get executed, cancel it here. 737 + */ 738 + if (test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state) || 739 + (work->flags & IO_WQ_WORK_CANCEL)) { 735 740 io_run_cancel(work, wqe); 736 741 return; 737 742 }
+70 -23
fs/io_uring.c
··· 1279 1279 { 1280 1280 struct io_kiocb *cur; 1281 1281 1282 - io_for_each_link(cur, req) 1283 - io_prep_async_work(cur); 1282 + if (req->flags & REQ_F_LINK_TIMEOUT) { 1283 + struct io_ring_ctx *ctx = req->ctx; 1284 + 1285 + spin_lock_irq(&ctx->completion_lock); 1286 + io_for_each_link(cur, req) 1287 + io_prep_async_work(cur); 1288 + spin_unlock_irq(&ctx->completion_lock); 1289 + } else { 1290 + io_for_each_link(cur, req) 1291 + io_prep_async_work(cur); 1292 + } 1284 1293 } 1285 1294 1286 1295 static void io_queue_async_work(struct io_kiocb *req) ··· 1303 1294 1304 1295 /* init ->work of the whole link before punting */ 1305 1296 io_prep_async_link(req); 1297 + 1298 + /* 1299 + * Not expected to happen, but if we do have a bug where this _can_ 1300 + * happen, catch it here and ensure the request is marked as 1301 + * canceled. That will make io-wq go through the usual work cancel 1302 + * procedure rather than attempt to run this request (or create a new 1303 + * worker for it). 1304 + */ 1305 + if (WARN_ON_ONCE(!same_thread_group(req->task, current))) 1306 + req->work.flags |= IO_WQ_WORK_CANCEL; 1307 + 1306 1308 trace_io_uring_queue_async_work(ctx, io_wq_is_hashed(&req->work), req, 1307 1309 &req->work, req->flags); 1308 1310 io_wq_enqueue(tctx->io_wq, &req->work); ··· 1959 1939 node = next; 1960 1940 } 1961 1941 if (wq_list_empty(&tctx->task_list)) { 1942 + spin_lock_irq(&tctx->task_lock); 1962 1943 clear_bit(0, &tctx->task_state); 1963 - if (wq_list_empty(&tctx->task_list)) 1944 + if (wq_list_empty(&tctx->task_list)) { 1945 + spin_unlock_irq(&tctx->task_lock); 1964 1946 break; 1947 + } 1948 + spin_unlock_irq(&tctx->task_lock); 1965 1949 /* another tctx_task_work() is enqueued, yield */ 1966 1950 if (test_and_set_bit(0, &tctx->task_state)) 1967 1951 break; ··· 2057 2033 static void io_req_task_queue(struct io_kiocb *req) 2058 2034 { 2059 2035 req->io_task_work.func = io_req_task_submit; 2036 + io_req_task_work_add(req); 2037 + } 2038 + 2039 + static void io_req_task_queue_reissue(struct io_kiocb *req) 2040 + { 2041 + req->io_task_work.func = io_queue_async_work; 2060 2042 io_req_task_work_add(req); 2061 2043 } 2062 2044 ··· 2235 2205 * Find and free completed poll iocbs 2236 2206 */ 2237 2207 static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, 2238 - struct list_head *done) 2208 + struct list_head *done, bool resubmit) 2239 2209 { 2240 2210 struct req_batch rb; 2241 2211 struct io_kiocb *req; ··· 2250 2220 req = list_first_entry(done, struct io_kiocb, inflight_entry); 2251 2221 list_del(&req->inflight_entry); 2252 2222 2253 - if (READ_ONCE(req->result) == -EAGAIN && 2223 + if (READ_ONCE(req->result) == -EAGAIN && resubmit && 2254 2224 !(req->flags & REQ_F_DONT_REISSUE)) { 2255 2225 req->iopoll_completed = 0; 2256 2226 req_ref_get(req); 2257 - io_queue_async_work(req); 2227 + io_req_task_queue_reissue(req); 2258 2228 continue; 2259 2229 } 2260 2230 ··· 2274 2244 } 2275 2245 2276 2246 static int io_do_iopoll(struct io_ring_ctx *ctx, unsigned int *nr_events, 2277 - long min) 2247 + long min, bool resubmit) 2278 2248 { 2279 2249 struct io_kiocb *req, *tmp; 2280 2250 LIST_HEAD(done); ··· 2317 2287 } 2318 2288 2319 2289 if (!list_empty(&done)) 2320 - io_iopoll_complete(ctx, nr_events, &done); 2290 + io_iopoll_complete(ctx, nr_events, &done, resubmit); 2321 2291 2322 2292 return ret; 2323 2293 } ··· 2335 2305 while (!list_empty(&ctx->iopoll_list)) { 2336 2306 unsigned int nr_events = 0; 2337 2307 2338 - io_do_iopoll(ctx, &nr_events, 0); 2308 + io_do_iopoll(ctx, &nr_events, 0, false); 2339 2309 2340 2310 /* let it sleep and repeat later if can't complete a request */ 2341 2311 if (nr_events == 0) ··· 2397 2367 list_empty(&ctx->iopoll_list)) 2398 2368 break; 2399 2369 } 2400 - ret = io_do_iopoll(ctx, &nr_events, min); 2370 + ret = io_do_iopoll(ctx, &nr_events, min, true); 2401 2371 } while (!ret && nr_events < min && !need_resched()); 2402 2372 out: 2403 2373 mutex_unlock(&ctx->uring_lock); ··· 2446 2416 * -EAGAIN. 2447 2417 */ 2448 2418 if (percpu_ref_is_dying(&ctx->refs)) 2419 + return false; 2420 + /* 2421 + * Play it safe and assume not safe to re-import and reissue if we're 2422 + * not in the original thread group (or in task context). 2423 + */ 2424 + if (!same_thread_group(req->task, current) || !in_task()) 2449 2425 return false; 2450 2426 return true; 2451 2427 } ··· 2783 2747 req->flags &= ~REQ_F_REISSUE; 2784 2748 if (io_resubmit_prep(req)) { 2785 2749 req_ref_get(req); 2786 - io_queue_async_work(req); 2750 + io_req_task_queue_reissue(req); 2787 2751 } else { 2788 2752 int cflags = 0; 2789 2753 ··· 4838 4802 struct io_poll_table { 4839 4803 struct poll_table_struct pt; 4840 4804 struct io_kiocb *req; 4805 + int nr_entries; 4841 4806 int error; 4842 4807 }; 4843 4808 ··· 4939 4902 if (req->poll.events & EPOLLONESHOT) 4940 4903 flags = 0; 4941 4904 if (!io_cqring_fill_event(ctx, req->user_data, error, flags)) { 4942 - io_poll_remove_waitqs(req); 4943 4905 req->poll.done = true; 4944 4906 flags = 0; 4945 4907 } ··· 4961 4925 4962 4926 done = io_poll_complete(req, req->result); 4963 4927 if (done) { 4928 + io_poll_remove_double(req); 4964 4929 hash_del(&req->hash_node); 4965 4930 } else { 4966 4931 req->result = 0; ··· 5032 4995 struct io_kiocb *req = pt->req; 5033 4996 5034 4997 /* 5035 - * If poll->head is already set, it's because the file being polled 5036 - * uses multiple waitqueues for poll handling (eg one for read, one 5037 - * for write). Setup a separate io_poll_iocb if this happens. 4998 + * The file being polled uses multiple waitqueues for poll handling 4999 + * (e.g. one for read, one for write). Setup a separate io_poll_iocb 5000 + * if this happens. 5038 5001 */ 5039 - if (unlikely(poll->head)) { 5002 + if (unlikely(pt->nr_entries)) { 5040 5003 struct io_poll_iocb *poll_one = poll; 5041 5004 5042 5005 /* already have a 2nd entry, fail a third attempt */ ··· 5064 5027 *poll_ptr = poll; 5065 5028 } 5066 5029 5067 - pt->error = 0; 5030 + pt->nr_entries++; 5068 5031 poll->head = head; 5069 5032 5070 5033 if (poll->events & EPOLLEXCLUSIVE) ··· 5141 5104 5142 5105 ipt->pt._key = mask; 5143 5106 ipt->req = req; 5144 - ipt->error = -EINVAL; 5107 + ipt->error = 0; 5108 + ipt->nr_entries = 0; 5145 5109 5146 5110 mask = vfs_poll(req->file, &ipt->pt) & poll->events; 5111 + if (unlikely(!ipt->nr_entries) && !ipt->error) 5112 + ipt->error = -EINVAL; 5147 5113 5148 5114 spin_lock_irq(&ctx->completion_lock); 5115 + if (ipt->error || (mask && (poll->events & EPOLLONESHOT))) 5116 + io_poll_remove_double(req); 5149 5117 if (likely(poll->head)) { 5150 5118 spin_lock(&poll->head->lock); 5151 5119 if (unlikely(list_empty(&poll->wait.entry))) { ··· 5221 5179 ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask, 5222 5180 io_async_wake); 5223 5181 if (ret || ipt.error) { 5224 - io_poll_remove_double(req); 5225 5182 spin_unlock_irq(&ctx->completion_lock); 5226 5183 if (ret) 5227 5184 return IO_APOLL_READY; ··· 6833 6792 6834 6793 mutex_lock(&ctx->uring_lock); 6835 6794 if (!list_empty(&ctx->iopoll_list)) 6836 - io_do_iopoll(ctx, &nr_events, 0); 6795 + io_do_iopoll(ctx, &nr_events, 0, true); 6837 6796 6838 6797 /* 6839 6798 * Don't submit if refs are dying, good for io_uring_register(), ··· 7940 7899 struct io_wq_data data; 7941 7900 unsigned int concurrency; 7942 7901 7902 + mutex_lock(&ctx->uring_lock); 7943 7903 hash = ctx->hash_map; 7944 7904 if (!hash) { 7945 7905 hash = kzalloc(sizeof(*hash), GFP_KERNEL); 7946 - if (!hash) 7906 + if (!hash) { 7907 + mutex_unlock(&ctx->uring_lock); 7947 7908 return ERR_PTR(-ENOMEM); 7909 + } 7948 7910 refcount_set(&hash->refs, 1); 7949 7911 init_waitqueue_head(&hash->wait); 7950 7912 ctx->hash_map = hash; 7951 7913 } 7914 + mutex_unlock(&ctx->uring_lock); 7952 7915 7953 7916 data.hash = hash; 7954 7917 data.task = task; ··· 8026 7981 f = fdget(p->wq_fd); 8027 7982 if (!f.file) 8028 7983 return -ENXIO; 8029 - fdput(f); 8030 - if (f.file->f_op != &io_uring_fops) 7984 + if (f.file->f_op != &io_uring_fops) { 7985 + fdput(f); 8031 7986 return -EINVAL; 7987 + } 7988 + fdput(f); 8032 7989 } 8033 7990 if (ctx->flags & IORING_SETUP_SQPOLL) { 8034 7991 struct task_struct *tsk;
+62 -41
fs/ocfs2/file.c
··· 1529 1529 } 1530 1530 } 1531 1531 1532 + /* 1533 + * zero out partial blocks of one cluster. 1534 + * 1535 + * start: file offset where zero starts, will be made upper block aligned. 1536 + * len: it will be trimmed to the end of current cluster if "start + len" 1537 + * is bigger than it. 1538 + */ 1539 + static int ocfs2_zeroout_partial_cluster(struct inode *inode, 1540 + u64 start, u64 len) 1541 + { 1542 + int ret; 1543 + u64 start_block, end_block, nr_blocks; 1544 + u64 p_block, offset; 1545 + u32 cluster, p_cluster, nr_clusters; 1546 + struct super_block *sb = inode->i_sb; 1547 + u64 end = ocfs2_align_bytes_to_clusters(sb, start); 1548 + 1549 + if (start + len < end) 1550 + end = start + len; 1551 + 1552 + start_block = ocfs2_blocks_for_bytes(sb, start); 1553 + end_block = ocfs2_blocks_for_bytes(sb, end); 1554 + nr_blocks = end_block - start_block; 1555 + if (!nr_blocks) 1556 + return 0; 1557 + 1558 + cluster = ocfs2_bytes_to_clusters(sb, start); 1559 + ret = ocfs2_get_clusters(inode, cluster, &p_cluster, 1560 + &nr_clusters, NULL); 1561 + if (ret) 1562 + return ret; 1563 + if (!p_cluster) 1564 + return 0; 1565 + 1566 + offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); 1567 + p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; 1568 + return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); 1569 + } 1570 + 1532 1571 static int ocfs2_zero_partial_clusters(struct inode *inode, 1533 1572 u64 start, u64 len) 1534 1573 { ··· 1577 1538 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1578 1539 unsigned int csize = osb->s_clustersize; 1579 1540 handle_t *handle; 1541 + loff_t isize = i_size_read(inode); 1580 1542 1581 1543 /* 1582 1544 * The "start" and "end" values are NOT necessarily part of ··· 1598 1558 if ((start & (csize - 1)) == 0 && (end & (csize - 1)) == 0) 1599 1559 goto out; 1600 1560 1561 + /* No page cache for EOF blocks, issue zero out to disk. */ 1562 + if (end > isize) { 1563 + /* 1564 + * zeroout eof blocks in last cluster starting from 1565 + * "isize" even "start" > "isize" because it is 1566 + * complicated to zeroout just at "start" as "start" 1567 + * may be not aligned with block size, buffer write 1568 + * would be required to do that, but out of eof buffer 1569 + * write is not supported. 1570 + */ 1571 + ret = ocfs2_zeroout_partial_cluster(inode, isize, 1572 + end - isize); 1573 + if (ret) { 1574 + mlog_errno(ret); 1575 + goto out; 1576 + } 1577 + if (start >= isize) 1578 + goto out; 1579 + end = isize; 1580 + } 1601 1581 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 1602 1582 if (IS_ERR(handle)) { 1603 1583 ret = PTR_ERR(handle); ··· 1916 1856 } 1917 1857 1918 1858 /* 1919 - * zero out partial blocks of one cluster. 1920 - * 1921 - * start: file offset where zero starts, will be made upper block aligned. 1922 - * len: it will be trimmed to the end of current cluster if "start + len" 1923 - * is bigger than it. 1924 - */ 1925 - static int ocfs2_zeroout_partial_cluster(struct inode *inode, 1926 - u64 start, u64 len) 1927 - { 1928 - int ret; 1929 - u64 start_block, end_block, nr_blocks; 1930 - u64 p_block, offset; 1931 - u32 cluster, p_cluster, nr_clusters; 1932 - struct super_block *sb = inode->i_sb; 1933 - u64 end = ocfs2_align_bytes_to_clusters(sb, start); 1934 - 1935 - if (start + len < end) 1936 - end = start + len; 1937 - 1938 - start_block = ocfs2_blocks_for_bytes(sb, start); 1939 - end_block = ocfs2_blocks_for_bytes(sb, end); 1940 - nr_blocks = end_block - start_block; 1941 - if (!nr_blocks) 1942 - return 0; 1943 - 1944 - cluster = ocfs2_bytes_to_clusters(sb, start); 1945 - ret = ocfs2_get_clusters(inode, cluster, &p_cluster, 1946 - &nr_clusters, NULL); 1947 - if (ret) 1948 - return ret; 1949 - if (!p_cluster) 1950 - return 0; 1951 - 1952 - offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); 1953 - p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; 1954 - return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); 1955 - } 1956 - 1957 - /* 1958 1859 * Parts of this function taken from xfs_change_file_space() 1959 1860 */ 1960 1861 static int __ocfs2_change_file_space(struct file *file, struct inode *inode, ··· 1956 1935 goto out_inode_unlock; 1957 1936 } 1958 1937 1959 - orig_isize = i_size_read(inode); 1960 1938 switch (sr->l_whence) { 1961 1939 case 0: /*SEEK_SET*/ 1962 1940 break; ··· 1963 1943 sr->l_start += f_pos; 1964 1944 break; 1965 1945 case 2: /*SEEK_END*/ 1966 - sr->l_start += orig_isize; 1946 + sr->l_start += i_size_read(inode); 1967 1947 break; 1968 1948 default: 1969 1949 ret = -EINVAL; ··· 2018 1998 ret = -EINVAL; 2019 1999 } 2020 2000 2001 + orig_isize = i_size_read(inode); 2021 2002 /* zeroout eof blocks in the cluster. */ 2022 2003 if (!ret && change_size && orig_isize < size) { 2023 2004 ret = ocfs2_zeroout_partial_cluster(inode, orig_isize,
+5 -5
fs/pipe.c
··· 429 429 #endif 430 430 431 431 /* 432 - * Only wake up if the pipe started out empty, since 433 - * otherwise there should be no readers waiting. 432 + * Epoll nonsensically wants a wakeup whether the pipe 433 + * was already empty or not. 434 434 * 435 435 * If it wasn't empty we try to merge new data into 436 436 * the last buffer. 437 437 * 438 438 * That naturally merges small writes, but it also 439 - * page-aligs the rest of the writes for large writes 439 + * page-aligns the rest of the writes for large writes 440 440 * spanning multiple pages. 441 441 */ 442 442 head = pipe->head; 443 - was_empty = pipe_empty(head, pipe->tail); 443 + was_empty = true; 444 444 chars = total_len & (PAGE_SIZE-1); 445 - if (chars && !was_empty) { 445 + if (chars && !pipe_empty(head, pipe->tail)) { 446 446 unsigned int mask = pipe->ring_size - 1; 447 447 struct pipe_buffer *buf = &pipe->bufs[(head - 1) & mask]; 448 448 int offset = buf->offset + buf->len;
+26 -5
fs/reiserfs/stree.c
··· 387 387 search_path->path_length = ILLEGAL_PATH_ELEMENT_OFFSET; 388 388 } 389 389 390 + static int has_valid_deh_location(struct buffer_head *bh, struct item_head *ih) 391 + { 392 + struct reiserfs_de_head *deh; 393 + int i; 394 + 395 + deh = B_I_DEH(bh, ih); 396 + for (i = 0; i < ih_entry_count(ih); i++) { 397 + if (deh_location(&deh[i]) > ih_item_len(ih)) { 398 + reiserfs_warning(NULL, "reiserfs-5094", 399 + "directory entry location seems wrong %h", 400 + &deh[i]); 401 + return 0; 402 + } 403 + } 404 + 405 + return 1; 406 + } 407 + 390 408 static int is_leaf(char *buf, int blocksize, struct buffer_head *bh) 391 409 { 392 410 struct block_head *blkh; ··· 472 454 "(second one): %h", ih); 473 455 return 0; 474 456 } 475 - if (is_direntry_le_ih(ih) && (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE))) { 476 - reiserfs_warning(NULL, "reiserfs-5093", 477 - "item entry count seems wrong %h", 478 - ih); 479 - return 0; 457 + if (is_direntry_le_ih(ih)) { 458 + if (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE)) { 459 + reiserfs_warning(NULL, "reiserfs-5093", 460 + "item entry count seems wrong %h", 461 + ih); 462 + return 0; 463 + } 464 + return has_valid_deh_location(bh, ih); 480 465 } 481 466 prev_location = ih_location(ih); 482 467 }
+8
fs/reiserfs/super.c
··· 2082 2082 unlock_new_inode(root_inode); 2083 2083 } 2084 2084 2085 + if (!S_ISDIR(root_inode->i_mode) || !inode_get_bytes(root_inode) || 2086 + !root_inode->i_size) { 2087 + SWARN(silent, s, "", "corrupt root inode, run fsck"); 2088 + iput(root_inode); 2089 + errval = -EUCLEAN; 2090 + goto error; 2091 + } 2092 + 2085 2093 s->s_root = d_make_root(root_inode); 2086 2094 if (!s->s_root) 2087 2095 goto error;
+12 -14
fs/userfaultfd.c
··· 1236 1236 } 1237 1237 1238 1238 static __always_inline int validate_range(struct mm_struct *mm, 1239 - __u64 *start, __u64 len) 1239 + __u64 start, __u64 len) 1240 1240 { 1241 1241 __u64 task_size = mm->task_size; 1242 1242 1243 - *start = untagged_addr(*start); 1244 - 1245 - if (*start & ~PAGE_MASK) 1243 + if (start & ~PAGE_MASK) 1246 1244 return -EINVAL; 1247 1245 if (len & ~PAGE_MASK) 1248 1246 return -EINVAL; 1249 1247 if (!len) 1250 1248 return -EINVAL; 1251 - if (*start < mmap_min_addr) 1249 + if (start < mmap_min_addr) 1252 1250 return -EINVAL; 1253 - if (*start >= task_size) 1251 + if (start >= task_size) 1254 1252 return -EINVAL; 1255 - if (len > task_size - *start) 1253 + if (len > task_size - start) 1256 1254 return -EINVAL; 1257 1255 return 0; 1258 1256 } ··· 1314 1316 vm_flags |= VM_UFFD_MINOR; 1315 1317 } 1316 1318 1317 - ret = validate_range(mm, &uffdio_register.range.start, 1319 + ret = validate_range(mm, uffdio_register.range.start, 1318 1320 uffdio_register.range.len); 1319 1321 if (ret) 1320 1322 goto out; ··· 1520 1522 if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister))) 1521 1523 goto out; 1522 1524 1523 - ret = validate_range(mm, &uffdio_unregister.start, 1525 + ret = validate_range(mm, uffdio_unregister.start, 1524 1526 uffdio_unregister.len); 1525 1527 if (ret) 1526 1528 goto out; ··· 1669 1671 if (copy_from_user(&uffdio_wake, buf, sizeof(uffdio_wake))) 1670 1672 goto out; 1671 1673 1672 - ret = validate_range(ctx->mm, &uffdio_wake.start, uffdio_wake.len); 1674 + ret = validate_range(ctx->mm, uffdio_wake.start, uffdio_wake.len); 1673 1675 if (ret) 1674 1676 goto out; 1675 1677 ··· 1709 1711 sizeof(uffdio_copy)-sizeof(__s64))) 1710 1712 goto out; 1711 1713 1712 - ret = validate_range(ctx->mm, &uffdio_copy.dst, uffdio_copy.len); 1714 + ret = validate_range(ctx->mm, uffdio_copy.dst, uffdio_copy.len); 1713 1715 if (ret) 1714 1716 goto out; 1715 1717 /* ··· 1766 1768 sizeof(uffdio_zeropage)-sizeof(__s64))) 1767 1769 goto out; 1768 1770 1769 - ret = validate_range(ctx->mm, &uffdio_zeropage.range.start, 1771 + ret = validate_range(ctx->mm, uffdio_zeropage.range.start, 1770 1772 uffdio_zeropage.range.len); 1771 1773 if (ret) 1772 1774 goto out; ··· 1816 1818 sizeof(struct uffdio_writeprotect))) 1817 1819 return -EFAULT; 1818 1820 1819 - ret = validate_range(ctx->mm, &uffdio_wp.range.start, 1821 + ret = validate_range(ctx->mm, uffdio_wp.range.start, 1820 1822 uffdio_wp.range.len); 1821 1823 if (ret) 1822 1824 return ret; ··· 1864 1866 sizeof(uffdio_continue) - (sizeof(__s64)))) 1865 1867 goto out; 1866 1868 1867 - ret = validate_range(ctx->mm, &uffdio_continue.range.start, 1869 + ret = validate_range(ctx->mm, uffdio_continue.range.start, 1868 1870 uffdio_continue.range.len); 1869 1871 if (ret) 1870 1872 goto out;
+2 -6
include/acpi/acpi_bus.h
··· 707 707 * @hrv: Hardware Revision of the device, pass -1 to not check _HRV 708 708 * 709 709 * The caller is responsible for invoking acpi_dev_put() on the returned device. 710 - * 711 - * FIXME: Due to above requirement there is a window that may invalidate @adev 712 - * and next iteration will use a dangling pointer, e.g. in the case of a 713 - * hotplug event. That said, the caller should ensure that this will never 714 - * happen. 715 710 */ 716 711 #define for_each_acpi_dev_match(adev, hid, uid, hrv) \ 717 712 for (adev = acpi_dev_get_first_match_dev(hid, uid, hrv); \ ··· 720 725 721 726 static inline void acpi_dev_put(struct acpi_device *adev) 722 727 { 723 - put_device(&adev->dev); 728 + if (adev) 729 + put_device(&adev->dev); 724 730 } 725 731 726 732 struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle);
+1
include/drm/drm_ioctl.h
··· 68 68 unsigned long arg); 69 69 70 70 #define DRM_IOCTL_NR(n) _IOC_NR(n) 71 + #define DRM_IOCTL_TYPE(n) _IOC_TYPE(n) 71 72 #define DRM_MAJOR 226 72 73 73 74 /**
+1 -1
include/linux/blkdev.h
··· 57 57 * Maximum number of blkcg policies allowed to be registered concurrently. 58 58 * Defined here to simplify include dependency. 59 59 */ 60 - #define BLKCG_MAX_POLS 5 60 + #define BLKCG_MAX_POLS 6 61 61 62 62 typedef void (rq_end_io_fn)(struct request *, blk_status_t); 63 63
+1
include/linux/bpf_types.h
··· 134 134 BPF_LINK_TYPE(BPF_LINK_TYPE_ITER, iter) 135 135 #ifdef CONFIG_NET 136 136 BPF_LINK_TYPE(BPF_LINK_TYPE_NETNS, netns) 137 + BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp) 137 138 #endif
+2 -1
include/linux/bpf_verifier.h
··· 354 354 }; 355 355 u64 map_key_state; /* constant (32 bit) key tracking for maps */ 356 356 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ 357 - int sanitize_stack_off; /* stack slot to be cleared */ 358 357 u32 seen; /* this insn was processed by the verifier at env->pass_cnt */ 358 + bool sanitize_stack_spill; /* subject to Spectre v4 sanitation */ 359 359 bool zext_dst; /* this insn zero extends dst reg */ 360 360 u8 alu_state; /* used in combination with alu_limit */ 361 361 ··· 429 429 u32 used_map_cnt; /* number of used maps */ 430 430 u32 used_btf_cnt; /* number of used BTF objects */ 431 431 u32 id_gen; /* used to generate unique reg IDs */ 432 + bool explore_alu_limits; 432 433 bool allow_ptr_leaks; 433 434 bool allow_uninit_stack; 434 435 bool allow_ptr_to_map_access;
+15
include/linux/filter.h
··· 73 73 /* unused opcode to mark call to interpreter with arguments */ 74 74 #define BPF_CALL_ARGS 0xe0 75 75 76 + /* unused opcode to mark speculation barrier for mitigating 77 + * Speculative Store Bypass 78 + */ 79 + #define BPF_NOSPEC 0xc0 80 + 76 81 /* As per nm, we expose JITed images as text (code) section for 77 82 * kallsyms. That way, tools like perf can find it to match 78 83 * addresses. ··· 390 385 #define BPF_EXIT_INSN() \ 391 386 ((struct bpf_insn) { \ 392 387 .code = BPF_JMP | BPF_EXIT, \ 388 + .dst_reg = 0, \ 389 + .src_reg = 0, \ 390 + .off = 0, \ 391 + .imm = 0 }) 392 + 393 + /* Speculation barrier */ 394 + 395 + #define BPF_ST_NOSPEC() \ 396 + ((struct bpf_insn) { \ 397 + .code = BPF_ST | BPF_NOSPEC, \ 393 398 .dst_reg = 0, \ 394 399 .src_reg = 0, \ 395 400 .off = 0, \
+1
include/linux/fs_context.h
··· 141 141 extern void put_fs_context(struct fs_context *fc); 142 142 extern int vfs_parse_fs_param_source(struct fs_context *fc, 143 143 struct fs_parameter *param); 144 + extern void fc_drop_locked(struct fs_context *fc); 144 145 145 146 /* 146 147 * sget() wrappers to be called from the ->get_tree() op.
+4 -2
include/linux/highmem.h
··· 318 318 319 319 VM_BUG_ON(offset + len > PAGE_SIZE); 320 320 memcpy(to + offset, from, len); 321 + flush_dcache_page(page); 321 322 kunmap_local(to); 322 323 } 323 324 324 325 static inline void memzero_page(struct page *page, size_t offset, size_t len) 325 326 { 326 - char *addr = kmap_atomic(page); 327 + char *addr = kmap_local_page(page); 327 328 memset(addr + offset, 0, len); 328 - kunmap_atomic(addr); 329 + flush_dcache_page(page); 330 + kunmap_local(addr); 329 331 } 330 332 331 333 #endif /* _LINUX_HIGHMEM_H */
+2
include/linux/intel-ish-client-if.h
··· 81 81 82 82 /* Get the device * from ishtp device instance */ 83 83 struct device *ishtp_device(struct ishtp_cl_device *cl_device); 84 + /* wait for IPC resume */ 85 + bool ishtp_wait_resume(struct ishtp_device *dev); 84 86 /* Trace interface for clients */ 85 87 ishtp_print_log ishtp_trace_callback(struct ishtp_cl_device *cl_device); 86 88 /* Get device pointer of PCI device for DMA acces */
+2 -2
include/linux/memblock.h
··· 209 209 */ 210 210 #define for_each_mem_range(i, p_start, p_end) \ 211 211 __for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, \ 212 - MEMBLOCK_NONE, p_start, p_end, NULL) 212 + MEMBLOCK_HOTPLUG, p_start, p_end, NULL) 213 213 214 214 /** 215 215 * for_each_mem_range_rev - reverse iterate through memblock areas from ··· 220 220 */ 221 221 #define for_each_mem_range_rev(i, p_start, p_end) \ 222 222 __for_each_mem_range_rev(i, &memblock.memory, NULL, NUMA_NO_NODE, \ 223 - MEMBLOCK_NONE, p_start, p_end, NULL) 223 + MEMBLOCK_HOTPLUG, p_start, p_end, NULL) 224 224 225 225 /** 226 226 * for_each_reserved_mem_range - iterate over all reserved memblock areas
+35 -19
include/linux/skmsg.h
··· 285 285 return rcu_dereference_sk_user_data(sk); 286 286 } 287 287 288 + static inline void sk_psock_set_state(struct sk_psock *psock, 289 + enum sk_psock_state_bits bit) 290 + { 291 + set_bit(bit, &psock->state); 292 + } 293 + 294 + static inline void sk_psock_clear_state(struct sk_psock *psock, 295 + enum sk_psock_state_bits bit) 296 + { 297 + clear_bit(bit, &psock->state); 298 + } 299 + 300 + static inline bool sk_psock_test_state(const struct sk_psock *psock, 301 + enum sk_psock_state_bits bit) 302 + { 303 + return test_bit(bit, &psock->state); 304 + } 305 + 306 + static inline void sock_drop(struct sock *sk, struct sk_buff *skb) 307 + { 308 + sk_drops_add(sk, skb); 309 + kfree_skb(skb); 310 + } 311 + 312 + static inline void drop_sk_msg(struct sk_psock *psock, struct sk_msg *msg) 313 + { 314 + if (msg->skb) 315 + sock_drop(psock->sk, msg->skb); 316 + kfree(msg); 317 + } 318 + 288 319 static inline void sk_psock_queue_msg(struct sk_psock *psock, 289 320 struct sk_msg *msg) 290 321 { 291 322 spin_lock_bh(&psock->ingress_lock); 292 - list_add_tail(&msg->list, &psock->ingress_msg); 323 + if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) 324 + list_add_tail(&msg->list, &psock->ingress_msg); 325 + else 326 + drop_sk_msg(psock, msg); 293 327 spin_unlock_bh(&psock->ingress_lock); 294 328 } 295 329 ··· 438 404 { 439 405 if (psock->psock_update_sk_prot) 440 406 psock->psock_update_sk_prot(sk, psock, true); 441 - } 442 - 443 - static inline void sk_psock_set_state(struct sk_psock *psock, 444 - enum sk_psock_state_bits bit) 445 - { 446 - set_bit(bit, &psock->state); 447 - } 448 - 449 - static inline void sk_psock_clear_state(struct sk_psock *psock, 450 - enum sk_psock_state_bits bit) 451 - { 452 - clear_bit(bit, &psock->state); 453 - } 454 - 455 - static inline bool sk_psock_test_state(const struct sk_psock *psock, 456 - enum sk_psock_state_bits bit) 457 - { 458 - return test_bit(bit, &psock->state); 459 407 } 460 408 461 409 static inline struct sk_psock *sk_psock_get(struct sock *sk)
+23 -8
include/net/llc_pdu.h
··· 15 15 #include <linux/if_ether.h> 16 16 17 17 /* Lengths of frame formats */ 18 - #define LLC_PDU_LEN_I 4 /* header and 2 control bytes */ 19 - #define LLC_PDU_LEN_S 4 20 - #define LLC_PDU_LEN_U 3 /* header and 1 control byte */ 18 + #define LLC_PDU_LEN_I 4 /* header and 2 control bytes */ 19 + #define LLC_PDU_LEN_S 4 20 + #define LLC_PDU_LEN_U 3 /* header and 1 control byte */ 21 + /* header and 1 control byte and XID info */ 22 + #define LLC_PDU_LEN_U_XID (LLC_PDU_LEN_U + sizeof(struct llc_xid_info)) 21 23 /* Known SAP addresses */ 22 24 #define LLC_GLOBAL_SAP 0xFF 23 25 #define LLC_NULL_SAP 0x00 /* not network-layer visible */ ··· 52 50 #define LLC_PDU_TYPE_U_MASK 0x03 /* 8-bit control field */ 53 51 #define LLC_PDU_TYPE_MASK 0x03 54 52 55 - #define LLC_PDU_TYPE_I 0 /* first bit */ 56 - #define LLC_PDU_TYPE_S 1 /* first two bits */ 57 - #define LLC_PDU_TYPE_U 3 /* first two bits */ 53 + #define LLC_PDU_TYPE_I 0 /* first bit */ 54 + #define LLC_PDU_TYPE_S 1 /* first two bits */ 55 + #define LLC_PDU_TYPE_U 3 /* first two bits */ 56 + #define LLC_PDU_TYPE_U_XID 4 /* private type for detecting XID commands */ 58 57 59 58 #define LLC_PDU_TYPE_IS_I(pdu) \ 60 59 ((!(pdu->ctrl_1 & LLC_PDU_TYPE_I_MASK)) ? 1 : 0) ··· 233 230 static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type, 234 231 u8 ssap, u8 dsap, u8 cr) 235 232 { 236 - const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; 233 + int hlen = 4; /* default value for I and S types */ 237 234 struct llc_pdu_un *pdu; 235 + 236 + switch (type) { 237 + case LLC_PDU_TYPE_U: 238 + hlen = 3; 239 + break; 240 + case LLC_PDU_TYPE_U_XID: 241 + hlen = 6; 242 + break; 243 + } 238 244 239 245 skb_push(skb, hlen); 240 246 skb_reset_network_header(skb); ··· 386 374 xid_info->fmt_id = LLC_XID_FMT_ID; /* 0x81 */ 387 375 xid_info->type = svcs_supported; 388 376 xid_info->rw = rx_window << 1; /* size of receive window */ 389 - skb_put(skb, sizeof(struct llc_xid_info)); 377 + 378 + /* no need to push/put since llc_pdu_header_init() has already 379 + * pushed 3 + 3 bytes 380 + */ 390 381 } 391 382 392 383 /**
+3 -2
include/net/sctp/structs.h
··· 984 984 } cacc; 985 985 986 986 struct { 987 + __u32 last_rtx_chunks; 987 988 __u16 pmtu; 988 989 __u16 probe_size; 989 990 __u16 probe_high; ··· 1025 1024 void sctp_transport_immediate_rtx(struct sctp_transport *); 1026 1025 void sctp_transport_dst_release(struct sctp_transport *t); 1027 1026 void sctp_transport_dst_confirm(struct sctp_transport *t); 1028 - void sctp_transport_pl_send(struct sctp_transport *t); 1029 - void sctp_transport_pl_recv(struct sctp_transport *t); 1027 + bool sctp_transport_pl_send(struct sctp_transport *t); 1028 + bool sctp_transport_pl_recv(struct sctp_transport *t); 1030 1029 1031 1030 1032 1031 /* This is the structure we use to queue packets as they come into
+6
include/sound/soc.h
··· 712 712 /* Do not create a PCM for this DAI link (Backend link) */ 713 713 unsigned int ignore:1; 714 714 715 + /* This flag will reorder stop sequence. By enabling this flag 716 + * DMA controller stop sequence will be invoked first followed by 717 + * CPU DAI driver stop sequence 718 + */ 719 + unsigned int stop_dma_first:1; 720 + 715 721 #ifdef CONFIG_SND_SOC_TOPOLOGY 716 722 struct snd_soc_dobj dobj; /* For topology */ 717 723 #endif
+1 -1
include/uapi/linux/idxd.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 1 + /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */ 2 2 /* Copyright(c) 2019 Intel Corporation. All rights rsvd. */ 3 3 #ifndef _USR_IDXD_H_ 4 4 #define _USR_IDXD_H_
+1 -1
include/uapi/rdma/irdma-abi.h
··· 1 - /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ 1 + /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB */ 2 2 /* 3 3 * Copyright (c) 2006 - 2021 Intel Corporation. All rights reserved. 4 4 * Copyright (c) 2005 Topspin Communications. All rights reserved.
+18 -1
kernel/bpf/core.c
··· 32 32 #include <linux/perf_event.h> 33 33 #include <linux/extable.h> 34 34 #include <linux/log2.h> 35 + 36 + #include <asm/barrier.h> 35 37 #include <asm/unaligned.h> 36 38 37 39 /* Registers */ ··· 1379 1377 /* Non-UAPI available opcodes. */ 1380 1378 [BPF_JMP | BPF_CALL_ARGS] = &&JMP_CALL_ARGS, 1381 1379 [BPF_JMP | BPF_TAIL_CALL] = &&JMP_TAIL_CALL, 1380 + [BPF_ST | BPF_NOSPEC] = &&ST_NOSPEC, 1382 1381 [BPF_LDX | BPF_PROBE_MEM | BPF_B] = &&LDX_PROBE_MEM_B, 1383 1382 [BPF_LDX | BPF_PROBE_MEM | BPF_H] = &&LDX_PROBE_MEM_H, 1384 1383 [BPF_LDX | BPF_PROBE_MEM | BPF_W] = &&LDX_PROBE_MEM_W, ··· 1624 1621 COND_JMP(s, JSGE, >=) 1625 1622 COND_JMP(s, JSLE, <=) 1626 1623 #undef COND_JMP 1627 - /* STX and ST and LDX*/ 1624 + /* ST, STX and LDX*/ 1625 + ST_NOSPEC: 1626 + /* Speculation barrier for mitigating Speculative Store Bypass. 1627 + * In case of arm64, we rely on the firmware mitigation as 1628 + * controlled via the ssbd kernel parameter. Whenever the 1629 + * mitigation is enabled, it works for all of the kernel code 1630 + * with no need to provide any additional instructions here. 1631 + * In case of x86, we use 'lfence' insn for mitigation. We 1632 + * reuse preexisting logic from Spectre v1 mitigation that 1633 + * happens to produce the required code on x86 for v4 as well. 1634 + */ 1635 + #ifdef CONFIG_X86 1636 + barrier_nospec(); 1637 + #endif 1638 + CONT; 1628 1639 #define LDST(SIZEOP, SIZE) \ 1629 1640 STX_MEM_##SIZEOP: \ 1630 1641 *(SIZE *)(unsigned long) (DST + insn->off) = SRC; \
+9 -7
kernel/bpf/disasm.c
··· 206 206 verbose(cbs->private_data, "BUG_%02x\n", insn->code); 207 207 } 208 208 } else if (class == BPF_ST) { 209 - if (BPF_MODE(insn->code) != BPF_MEM) { 209 + if (BPF_MODE(insn->code) == BPF_MEM) { 210 + verbose(cbs->private_data, "(%02x) *(%s *)(r%d %+d) = %d\n", 211 + insn->code, 212 + bpf_ldst_string[BPF_SIZE(insn->code) >> 3], 213 + insn->dst_reg, 214 + insn->off, insn->imm); 215 + } else if (BPF_MODE(insn->code) == 0xc0 /* BPF_NOSPEC, no UAPI */) { 216 + verbose(cbs->private_data, "(%02x) nospec\n", insn->code); 217 + } else { 210 218 verbose(cbs->private_data, "BUG_st_%02x\n", insn->code); 211 - return; 212 219 } 213 - verbose(cbs->private_data, "(%02x) *(%s *)(r%d %+d) = %d\n", 214 - insn->code, 215 - bpf_ldst_string[BPF_SIZE(insn->code) >> 3], 216 - insn->dst_reg, 217 - insn->off, insn->imm); 218 220 } else if (class == BPF_LDX) { 219 221 if (BPF_MODE(insn->code) != BPF_MEM) { 220 222 verbose(cbs->private_data, "BUG_ldx_%02x\n", insn->code);
+49 -99
kernel/bpf/verifier.c
··· 2667 2667 cur = env->cur_state->frame[env->cur_state->curframe]; 2668 2668 if (value_regno >= 0) 2669 2669 reg = &cur->regs[value_regno]; 2670 + if (!env->bypass_spec_v4) { 2671 + bool sanitize = reg && is_spillable_regtype(reg->type); 2672 + 2673 + for (i = 0; i < size; i++) { 2674 + if (state->stack[spi].slot_type[i] == STACK_INVALID) { 2675 + sanitize = true; 2676 + break; 2677 + } 2678 + } 2679 + 2680 + if (sanitize) 2681 + env->insn_aux_data[insn_idx].sanitize_stack_spill = true; 2682 + } 2670 2683 2671 2684 if (reg && size == BPF_REG_SIZE && register_is_bounded(reg) && 2672 2685 !register_is_null(reg) && env->bpf_capable) { ··· 2702 2689 verbose(env, "invalid size of register spill\n"); 2703 2690 return -EACCES; 2704 2691 } 2705 - 2706 2692 if (state != cur && reg->type == PTR_TO_STACK) { 2707 2693 verbose(env, "cannot spill pointers to stack into stack frame of the caller\n"); 2708 2694 return -EINVAL; 2709 - } 2710 - 2711 - if (!env->bypass_spec_v4) { 2712 - bool sanitize = false; 2713 - 2714 - if (state->stack[spi].slot_type[0] == STACK_SPILL && 2715 - register_is_const(&state->stack[spi].spilled_ptr)) 2716 - sanitize = true; 2717 - for (i = 0; i < BPF_REG_SIZE; i++) 2718 - if (state->stack[spi].slot_type[i] == STACK_MISC) { 2719 - sanitize = true; 2720 - break; 2721 - } 2722 - if (sanitize) { 2723 - int *poff = &env->insn_aux_data[insn_idx].sanitize_stack_off; 2724 - int soff = (-spi - 1) * BPF_REG_SIZE; 2725 - 2726 - /* detected reuse of integer stack slot with a pointer 2727 - * which means either llvm is reusing stack slot or 2728 - * an attacker is trying to exploit CVE-2018-3639 2729 - * (speculative store bypass) 2730 - * Have to sanitize that slot with preemptive 2731 - * store of zero. 2732 - */ 2733 - if (*poff && *poff != soff) { 2734 - /* disallow programs where single insn stores 2735 - * into two different stack slots, since verifier 2736 - * cannot sanitize them 2737 - */ 2738 - verbose(env, 2739 - "insn %d cannot access two stack slots fp%d and fp%d", 2740 - insn_idx, *poff, soff); 2741 - return -EINVAL; 2742 - } 2743 - *poff = soff; 2744 - } 2745 2695 } 2746 2696 save_register_state(state, spi, reg); 2747 2697 } else { ··· 6780 6804 alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0; 6781 6805 alu_state |= ptr_is_dst_reg ? 6782 6806 BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST; 6807 + 6808 + /* Limit pruning on unknown scalars to enable deep search for 6809 + * potential masking differences from other program paths. 6810 + */ 6811 + if (!off_is_imm) 6812 + env->explore_alu_limits = true; 6783 6813 } 6784 6814 6785 6815 err = update_alu_sanitation_state(aux, alu_state, alu_limit); ··· 10189 10207 } 10190 10208 10191 10209 /* Returns true if (rold safe implies rcur safe) */ 10192 - static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, 10193 - struct bpf_id_pair *idmap) 10210 + static bool regsafe(struct bpf_verifier_env *env, struct bpf_reg_state *rold, 10211 + struct bpf_reg_state *rcur, struct bpf_id_pair *idmap) 10194 10212 { 10195 10213 bool equal; 10196 10214 ··· 10216 10234 return false; 10217 10235 switch (rold->type) { 10218 10236 case SCALAR_VALUE: 10237 + if (env->explore_alu_limits) 10238 + return false; 10219 10239 if (rcur->type == SCALAR_VALUE) { 10220 10240 if (!rold->precise && !rcur->precise) 10221 10241 return true; ··· 10308 10324 return false; 10309 10325 } 10310 10326 10311 - static bool stacksafe(struct bpf_func_state *old, 10312 - struct bpf_func_state *cur, 10313 - struct bpf_id_pair *idmap) 10327 + static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old, 10328 + struct bpf_func_state *cur, struct bpf_id_pair *idmap) 10314 10329 { 10315 10330 int i, spi; 10316 10331 ··· 10354 10371 continue; 10355 10372 if (old->stack[spi].slot_type[0] != STACK_SPILL) 10356 10373 continue; 10357 - if (!regsafe(&old->stack[spi].spilled_ptr, 10358 - &cur->stack[spi].spilled_ptr, 10359 - idmap)) 10374 + if (!regsafe(env, &old->stack[spi].spilled_ptr, 10375 + &cur->stack[spi].spilled_ptr, idmap)) 10360 10376 /* when explored and current stack slot are both storing 10361 10377 * spilled registers, check that stored pointers types 10362 10378 * are the same as well. ··· 10412 10430 10413 10431 memset(env->idmap_scratch, 0, sizeof(env->idmap_scratch)); 10414 10432 for (i = 0; i < MAX_BPF_REG; i++) 10415 - if (!regsafe(&old->regs[i], &cur->regs[i], env->idmap_scratch)) 10433 + if (!regsafe(env, &old->regs[i], &cur->regs[i], 10434 + env->idmap_scratch)) 10416 10435 return false; 10417 10436 10418 - if (!stacksafe(old, cur, env->idmap_scratch)) 10437 + if (!stacksafe(env, old, cur, env->idmap_scratch)) 10419 10438 return false; 10420 10439 10421 10440 if (!refsafe(old, cur)) ··· 12181 12198 12182 12199 for (i = 0; i < insn_cnt; i++, insn++) { 12183 12200 bpf_convert_ctx_access_t convert_ctx_access; 12201 + bool ctx_access; 12184 12202 12185 12203 if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) || 12186 12204 insn->code == (BPF_LDX | BPF_MEM | BPF_H) || 12187 12205 insn->code == (BPF_LDX | BPF_MEM | BPF_W) || 12188 - insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) 12206 + insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) { 12189 12207 type = BPF_READ; 12190 - else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || 12191 - insn->code == (BPF_STX | BPF_MEM | BPF_H) || 12192 - insn->code == (BPF_STX | BPF_MEM | BPF_W) || 12193 - insn->code == (BPF_STX | BPF_MEM | BPF_DW)) 12208 + ctx_access = true; 12209 + } else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || 12210 + insn->code == (BPF_STX | BPF_MEM | BPF_H) || 12211 + insn->code == (BPF_STX | BPF_MEM | BPF_W) || 12212 + insn->code == (BPF_STX | BPF_MEM | BPF_DW) || 12213 + insn->code == (BPF_ST | BPF_MEM | BPF_B) || 12214 + insn->code == (BPF_ST | BPF_MEM | BPF_H) || 12215 + insn->code == (BPF_ST | BPF_MEM | BPF_W) || 12216 + insn->code == (BPF_ST | BPF_MEM | BPF_DW)) { 12194 12217 type = BPF_WRITE; 12195 - else 12218 + ctx_access = BPF_CLASS(insn->code) == BPF_STX; 12219 + } else { 12196 12220 continue; 12221 + } 12197 12222 12198 12223 if (type == BPF_WRITE && 12199 - env->insn_aux_data[i + delta].sanitize_stack_off) { 12224 + env->insn_aux_data[i + delta].sanitize_stack_spill) { 12200 12225 struct bpf_insn patch[] = { 12201 - /* Sanitize suspicious stack slot with zero. 12202 - * There are no memory dependencies for this store, 12203 - * since it's only using frame pointer and immediate 12204 - * constant of zero 12205 - */ 12206 - BPF_ST_MEM(BPF_DW, BPF_REG_FP, 12207 - env->insn_aux_data[i + delta].sanitize_stack_off, 12208 - 0), 12209 - /* the original STX instruction will immediately 12210 - * overwrite the same stack slot with appropriate value 12211 - */ 12212 12226 *insn, 12227 + BPF_ST_NOSPEC(), 12213 12228 }; 12214 12229 12215 12230 cnt = ARRAY_SIZE(patch); ··· 12220 12239 insn = new_prog->insnsi + i + delta; 12221 12240 continue; 12222 12241 } 12242 + 12243 + if (!ctx_access) 12244 + continue; 12223 12245 12224 12246 switch (env->insn_aux_data[i + delta].ptr_type) { 12225 12247 case PTR_TO_CTX: ··· 13077 13093 } 13078 13094 } 13079 13095 13080 - /* The verifier is using insn_aux_data[] to store temporary data during 13081 - * verification and to store information for passes that run after the 13082 - * verification like dead code sanitization. do_check_common() for subprogram N 13083 - * may analyze many other subprograms. sanitize_insn_aux_data() clears all 13084 - * temporary data after do_check_common() finds that subprogram N cannot be 13085 - * verified independently. pass_cnt counts the number of times 13086 - * do_check_common() was run and insn->aux->seen tells the pass number 13087 - * insn_aux_data was touched. These variables are compared to clear temporary 13088 - * data from failed pass. For testing and experiments do_check_common() can be 13089 - * run multiple times even when prior attempt to verify is unsuccessful. 13090 - * 13091 - * Note that special handling is needed on !env->bypass_spec_v1 if this is 13092 - * ever called outside of error path with subsequent program rejection. 13093 - */ 13094 - static void sanitize_insn_aux_data(struct bpf_verifier_env *env) 13095 - { 13096 - struct bpf_insn *insn = env->prog->insnsi; 13097 - struct bpf_insn_aux_data *aux; 13098 - int i, class; 13099 - 13100 - for (i = 0; i < env->prog->len; i++) { 13101 - class = BPF_CLASS(insn[i].code); 13102 - if (class != BPF_LDX && class != BPF_STX) 13103 - continue; 13104 - aux = &env->insn_aux_data[i]; 13105 - if (aux->seen != env->pass_cnt) 13106 - continue; 13107 - memset(aux, 0, offsetof(typeof(*aux), orig_idx)); 13108 - } 13109 - } 13110 - 13111 13096 static int do_check_common(struct bpf_verifier_env *env, int subprog) 13112 13097 { 13113 13098 bool pop_log = !(env->log.level & BPF_LOG_LEVEL2); ··· 13153 13200 if (!ret && pop_log) 13154 13201 bpf_vlog_reset(&env->log, 0); 13155 13202 free_states(env); 13156 - if (ret) 13157 - /* clean aux data in case subprog was rejected */ 13158 - sanitize_insn_aux_data(env); 13159 13203 return ret; 13160 13204 } 13161 13205
+1 -3
kernel/cgroup/cgroup-v1.c
··· 1221 1221 ret = cgroup_do_get_tree(fc); 1222 1222 1223 1223 if (!ret && percpu_ref_is_dying(&ctx->root->cgrp.self.refcnt)) { 1224 - struct super_block *sb = fc->root->d_sb; 1225 - dput(fc->root); 1226 - deactivate_locked_super(sb); 1224 + fc_drop_locked(fc); 1227 1225 ret = 1; 1228 1226 } 1229 1227
+10 -2
kernel/dma/ops_helpers.c
··· 5 5 */ 6 6 #include <linux/dma-map-ops.h> 7 7 8 + static struct page *dma_common_vaddr_to_page(void *cpu_addr) 9 + { 10 + if (is_vmalloc_addr(cpu_addr)) 11 + return vmalloc_to_page(cpu_addr); 12 + return virt_to_page(cpu_addr); 13 + } 14 + 8 15 /* 9 16 * Create scatter-list for the already allocated DMA buffer. 10 17 */ ··· 19 12 void *cpu_addr, dma_addr_t dma_addr, size_t size, 20 13 unsigned long attrs) 21 14 { 22 - struct page *page = virt_to_page(cpu_addr); 15 + struct page *page = dma_common_vaddr_to_page(cpu_addr); 23 16 int ret; 24 17 25 18 ret = sg_alloc_table(sgt, 1, GFP_KERNEL); ··· 39 32 unsigned long user_count = vma_pages(vma); 40 33 unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT; 41 34 unsigned long off = vma->vm_pgoff; 35 + struct page *page = dma_common_vaddr_to_page(cpu_addr); 42 36 int ret = -ENXIO; 43 37 44 38 vma->vm_page_prot = dma_pgprot(dev, vma->vm_page_prot, attrs); ··· 51 43 return -ENXIO; 52 44 53 45 return remap_pfn_range(vma, vma->vm_start, 54 - page_to_pfn(virt_to_page(cpu_addr)) + vma->vm_pgoff, 46 + page_to_pfn(page) + vma->vm_pgoff, 55 47 user_count << PAGE_SHIFT, vma->vm_page_prot); 56 48 #else 57 49 return -ENXIO;
+1 -1
kernel/smpboot.c
··· 47 47 * 48 48 * Creates the thread if it does not exist. 49 49 */ 50 - static inline void idle_init(unsigned int cpu) 50 + static __always_inline void idle_init(unsigned int cpu) 51 51 { 52 52 struct task_struct *tsk = per_cpu(idle_threads, cpu); 53 53
+5 -5
kernel/time/posix-cpu-timers.c
··· 991 991 if (!p) 992 992 goto out; 993 993 994 + /* Protect timer list r/w in arm_timer() */ 995 + sighand = lock_task_sighand(p, &flags); 996 + if (unlikely(sighand == NULL)) 997 + goto out; 998 + 994 999 /* 995 1000 * Fetch the current sample and update the timer's expiry time. 996 1001 */ ··· 1005 1000 now = cpu_clock_sample_group(clkid, p, true); 1006 1001 1007 1002 bump_cpu_timer(timer, now); 1008 - 1009 - /* Protect timer list r/w in arm_timer() */ 1010 - sighand = lock_task_sighand(p, &flags); 1011 - if (unlikely(sighand == NULL)) 1012 - goto out; 1013 1003 1014 1004 /* 1015 1005 * Now re-arm for the new expiry time.
+5 -3
kernel/time/timer.c
··· 207 207 unsigned int cpu; 208 208 bool next_expiry_recalc; 209 209 bool is_idle; 210 + bool timers_pending; 210 211 DECLARE_BITMAP(pending_map, WHEEL_SIZE); 211 212 struct hlist_head vectors[WHEEL_SIZE]; 212 213 } ____cacheline_aligned; ··· 596 595 * can reevaluate the wheel: 597 596 */ 598 597 base->next_expiry = bucket_expiry; 598 + base->timers_pending = true; 599 599 base->next_expiry_recalc = false; 600 600 trigger_dyntick_cpu(base, timer); 601 601 } ··· 1584 1582 } 1585 1583 1586 1584 base->next_expiry_recalc = false; 1585 + base->timers_pending = !(next == base->clk + NEXT_TIMER_MAX_DELTA); 1587 1586 1588 1587 return next; 1589 1588 } ··· 1636 1633 struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); 1637 1634 u64 expires = KTIME_MAX; 1638 1635 unsigned long nextevt; 1639 - bool is_max_delta; 1640 1636 1641 1637 /* 1642 1638 * Pretend that there is no timer pending if the cpu is offline. ··· 1648 1646 if (base->next_expiry_recalc) 1649 1647 base->next_expiry = __next_timer_interrupt(base); 1650 1648 nextevt = base->next_expiry; 1651 - is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA); 1652 1649 1653 1650 /* 1654 1651 * We have a fresh next event. Check whether we can forward the ··· 1665 1664 expires = basem; 1666 1665 base->is_idle = false; 1667 1666 } else { 1668 - if (!is_max_delta) 1667 + if (base->timers_pending) 1669 1668 expires = basem + (u64)(nextevt - basej) * TICK_NSEC; 1670 1669 /* 1671 1670 * If we expect to sleep more than a tick, mark the base idle. ··· 1948 1947 base = per_cpu_ptr(&timer_bases[b], cpu); 1949 1948 base->clk = jiffies; 1950 1949 base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA; 1950 + base->timers_pending = false; 1951 1951 base->is_idle = false; 1952 1952 } 1953 1953 return 0;
+3 -2
kernel/trace/ftrace.c
··· 5985 5985 * infrastructure to do the synchronization, thus we must do it 5986 5986 * ourselves. 5987 5987 */ 5988 - synchronize_rcu_tasks_rude(); 5988 + if (old_hash != EMPTY_HASH) 5989 + synchronize_rcu_tasks_rude(); 5989 5990 5990 5991 free_ftrace_hash(old_hash); 5991 5992 } ··· 7545 7544 */ 7546 7545 int register_ftrace_function(struct ftrace_ops *ops) 7547 7546 { 7548 - int ret = -1; 7547 + int ret; 7549 7548 7550 7549 ftrace_ops_init(ops); 7551 7550
+24 -4
kernel/trace/ring_buffer.c
··· 3880 3880 if (unlikely(!head)) 3881 3881 return true; 3882 3882 3883 - return reader->read == rb_page_commit(reader) && 3884 - (commit == reader || 3885 - (commit == head && 3886 - head->read == rb_page_commit(commit))); 3883 + /* Reader should exhaust content in reader page */ 3884 + if (reader->read != rb_page_commit(reader)) 3885 + return false; 3886 + 3887 + /* 3888 + * If writers are committing on the reader page, knowing all 3889 + * committed content has been read, the ring buffer is empty. 3890 + */ 3891 + if (commit == reader) 3892 + return true; 3893 + 3894 + /* 3895 + * If writers are committing on a page other than reader page 3896 + * and head page, there should always be content to read. 3897 + */ 3898 + if (commit != head) 3899 + return false; 3900 + 3901 + /* 3902 + * Writers are committing on the head page, we just need 3903 + * to care about there're committed data, and the reader will 3904 + * swap reader page with head page when it is to read data. 3905 + */ 3906 + return rb_page_commit(commit) == 0; 3887 3907 } 3888 3908 3889 3909 /**
+4
kernel/trace/trace.c
··· 5609 5609 "\t [:name=histname1]\n" 5610 5610 "\t [:<handler>.<action>]\n" 5611 5611 "\t [if <filter>]\n\n" 5612 + "\t Note, special fields can be used as well:\n" 5613 + "\t common_timestamp - to record current timestamp\n" 5614 + "\t common_cpu - to record the CPU the event happened on\n" 5615 + "\n" 5612 5616 "\t When a matching event is hit, an entry is added to a hash\n" 5613 5617 "\t table using the key(s) and value(s) named, and the value of a\n" 5614 5618 "\t sum called 'hitcount' is incremented. Keys and values\n"
+16 -6
kernel/trace/trace_events_hist.c
··· 1111 1111 field->flags & HIST_FIELD_FL_ALIAS) 1112 1112 field_name = hist_field_name(field->operands[0], ++level); 1113 1113 else if (field->flags & HIST_FIELD_FL_CPU) 1114 - field_name = "cpu"; 1114 + field_name = "common_cpu"; 1115 1115 else if (field->flags & HIST_FIELD_FL_EXPR || 1116 1116 field->flags & HIST_FIELD_FL_VAR_REF) { 1117 1117 if (field->system) { ··· 1991 1991 hist_data->enable_timestamps = true; 1992 1992 if (*flags & HIST_FIELD_FL_TIMESTAMP_USECS) 1993 1993 hist_data->attrs->ts_in_usecs = true; 1994 - } else if (strcmp(field_name, "cpu") == 0) 1994 + } else if (strcmp(field_name, "common_cpu") == 0) 1995 1995 *flags |= HIST_FIELD_FL_CPU; 1996 1996 else { 1997 1997 field = trace_find_event_field(file->event_call, field_name); 1998 1998 if (!field || !field->size) { 1999 - hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, errpos(field_name)); 2000 - field = ERR_PTR(-EINVAL); 2001 - goto out; 1999 + /* 2000 + * For backward compatibility, if field_name 2001 + * was "cpu", then we treat this the same as 2002 + * common_cpu. 2003 + */ 2004 + if (strcmp(field_name, "cpu") == 0) { 2005 + *flags |= HIST_FIELD_FL_CPU; 2006 + } else { 2007 + hist_err(tr, HIST_ERR_FIELD_NOT_FOUND, 2008 + errpos(field_name)); 2009 + field = ERR_PTR(-EINVAL); 2010 + goto out; 2011 + } 2002 2012 } 2003 2013 } 2004 2014 out: ··· 5095 5085 seq_printf(m, "%s=", hist_field->var.name); 5096 5086 5097 5087 if (hist_field->flags & HIST_FIELD_FL_CPU) 5098 - seq_puts(m, "cpu"); 5088 + seq_puts(m, "common_cpu"); 5099 5089 else if (field_name) { 5100 5090 if (hist_field->flags & HIST_FIELD_FL_VAR_REF || 5101 5091 hist_field->flags & HIST_FIELD_FL_ALIAS)
+3 -5
kernel/trace/trace_events_synth.c
··· 893 893 dyn_event_init(&event->devent, &synth_event_ops); 894 894 895 895 for (i = 0, j = 0; i < n_fields; i++) { 896 + fields[i]->field_pos = i; 896 897 event->fields[i] = fields[i]; 897 898 898 - if (fields[i]->is_dynamic) { 899 - event->dynamic_fields[j] = fields[i]; 900 - event->dynamic_fields[j]->field_pos = i; 899 + if (fields[i]->is_dynamic) 901 900 event->dynamic_fields[j++] = fields[i]; 902 - event->n_dynamic_fields++; 903 - } 904 901 } 902 + event->n_dynamic_fields = j; 905 903 event->n_fields = n_fields; 906 904 out: 907 905 return event;
+1 -1
kernel/trace/trace_synth.h
··· 14 14 char *name; 15 15 size_t size; 16 16 unsigned int offset; 17 + unsigned int field_pos; 17 18 bool is_signed; 18 19 bool is_string; 19 20 bool is_dynamic; 20 - bool field_pos; 21 21 }; 22 22 23 23 struct synth_event {
+1 -1
kernel/tracepoint.c
··· 299 299 * a pointer to it. This array is referenced by __DO_TRACE from 300 300 * include/linux/tracepoint.h using rcu_dereference_sched(). 301 301 */ 302 - rcu_assign_pointer(tp->funcs, tp_funcs); 303 302 tracepoint_update_call(tp, tp_funcs, false); 303 + rcu_assign_pointer(tp->funcs, tp_funcs); 304 304 static_key_enable(&tp->key); 305 305 306 306 release_probes(old);
+13 -7
kernel/workqueue.c
··· 3676 3676 unbound_release_work); 3677 3677 struct workqueue_struct *wq = pwq->wq; 3678 3678 struct worker_pool *pool = pwq->pool; 3679 - bool is_last; 3679 + bool is_last = false; 3680 3680 3681 - if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND))) 3682 - return; 3681 + /* 3682 + * when @pwq is not linked, it doesn't hold any reference to the 3683 + * @wq, and @wq is invalid to access. 3684 + */ 3685 + if (!list_empty(&pwq->pwqs_node)) { 3686 + if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND))) 3687 + return; 3683 3688 3684 - mutex_lock(&wq->mutex); 3685 - list_del_rcu(&pwq->pwqs_node); 3686 - is_last = list_empty(&wq->pwqs); 3687 - mutex_unlock(&wq->mutex); 3689 + mutex_lock(&wq->mutex); 3690 + list_del_rcu(&pwq->pwqs_node); 3691 + is_last = list_empty(&wq->pwqs); 3692 + mutex_unlock(&wq->mutex); 3693 + } 3688 3694 3689 3695 mutex_lock(&wq_pool_mutex); 3690 3696 put_unbound_pool(pool);
-3
lib/Kconfig
··· 683 683 config OBJAGG 684 684 tristate "objagg" if COMPILE_TEST 685 685 686 - config STRING_SELFTEST 687 - tristate "Test string functions" 688 - 689 686 endmenu 690 687 691 688 config GENERIC_IOREMAP
+3
lib/Kconfig.debug
··· 2180 2180 config TEST_HEXDUMP 2181 2181 tristate "Test functions located in the hexdump module at runtime" 2182 2182 2183 + config STRING_SELFTEST 2184 + tristate "Test string functions at runtime" 2185 + 2183 2186 config TEST_STRING_HELPERS 2184 2187 tristate "Test functions located in the string_helpers module at runtime" 2185 2188
+1 -1
mm/backing-dev.c
··· 398 398 blkcg_unpin_online(blkcg); 399 399 400 400 fprop_local_destroy_percpu(&wb->memcg_completions); 401 - percpu_ref_exit(&wb->refcnt); 402 401 403 402 spin_lock_irq(&cgwb_lock); 404 403 list_del(&wb->offline_node); 405 404 spin_unlock_irq(&cgwb_lock); 406 405 406 + percpu_ref_exit(&wb->refcnt); 407 407 wb_exit(wb); 408 408 WARN_ON_ONCE(!list_empty(&wb->b_attached)); 409 409 kfree_rcu(wb, rcu);
+16 -3
mm/kfence/core.c
··· 734 734 void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags) 735 735 { 736 736 /* 737 + * Perform size check before switching kfence_allocation_gate, so that 738 + * we don't disable KFENCE without making an allocation. 739 + */ 740 + if (size > PAGE_SIZE) 741 + return NULL; 742 + 743 + /* 744 + * Skip allocations from non-default zones, including DMA. We cannot 745 + * guarantee that pages in the KFENCE pool will have the requested 746 + * properties (e.g. reside in DMAable memory). 747 + */ 748 + if ((flags & GFP_ZONEMASK) || 749 + (s->flags & (SLAB_CACHE_DMA | SLAB_CACHE_DMA32))) 750 + return NULL; 751 + 752 + /* 737 753 * allocation_gate only needs to become non-zero, so it doesn't make 738 754 * sense to continue writing to it and pay the associated contention 739 755 * cost, in case we have a large number of concurrent allocations. ··· 771 755 #endif 772 756 773 757 if (!READ_ONCE(kfence_enabled)) 774 - return NULL; 775 - 776 - if (size > PAGE_SIZE) 777 758 return NULL; 778 759 779 760 return kfence_guarded_alloc(s, size, flags);
+1 -1
mm/kfence/kfence_test.c
··· 852 852 tracepoint_synchronize_unregister(); 853 853 } 854 854 855 - late_initcall(kfence_test_init); 855 + late_initcall_sync(kfence_test_init); 856 856 module_exit(kfence_test_exit); 857 857 858 858 MODULE_LICENSE("GPL v2");
+2 -1
mm/memblock.c
··· 947 947 return true; 948 948 949 949 /* skip hotpluggable memory regions if needed */ 950 - if (movable_node_is_enabled() && memblock_is_hotpluggable(m)) 950 + if (movable_node_is_enabled() && memblock_is_hotpluggable(m) && 951 + !(flags & MEMBLOCK_HOTPLUG)) 951 952 return true; 952 953 953 954 /* if we want mirror memory skip non-mirror memory regions */
+2 -1
mm/memcontrol.c
··· 3574 3574 unsigned long val; 3575 3575 3576 3576 if (mem_cgroup_is_root(memcg)) { 3577 - cgroup_rstat_flush(memcg->css.cgroup); 3577 + /* mem_cgroup_threshold() calls here from irqsafe context */ 3578 + cgroup_rstat_flush_irqsafe(memcg->css.cgroup); 3578 3579 val = memcg_page_state(memcg, NR_FILE_PAGES) + 3579 3580 memcg_page_state(memcg, NR_ANON_MAPPED); 3580 3581 if (swap)
+10 -1
mm/memory.c
··· 4026 4026 return ret; 4027 4027 } 4028 4028 4029 - if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd))) 4029 + if (vmf->prealloc_pte) { 4030 + vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); 4031 + if (likely(pmd_none(*vmf->pmd))) { 4032 + mm_inc_nr_ptes(vma->vm_mm); 4033 + pmd_populate(vma->vm_mm, vmf->pmd, vmf->prealloc_pte); 4034 + vmf->prealloc_pte = NULL; 4035 + } 4036 + spin_unlock(vmf->ptl); 4037 + } else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd))) { 4030 4038 return VM_FAULT_OOM; 4039 + } 4031 4040 } 4032 4041 4033 4042 /* See comment in handle_pte_fault() */
+1 -1
mm/migrate.c
··· 2068 2068 LIST_HEAD(migratepages); 2069 2069 new_page_t *new; 2070 2070 bool compound; 2071 - unsigned int nr_pages = thp_nr_pages(page); 2071 + int nr_pages = thp_nr_pages(page); 2072 2072 2073 2073 /* 2074 2074 * PTE mapped THP or HugeTLB page can't reach here so the page could
+2 -2
mm/mmap_lock.c
··· 156 156 #define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ 157 157 do { \ 158 158 const char *memcg_path; \ 159 - preempt_disable(); \ 159 + local_lock(&memcg_paths.lock); \ 160 160 memcg_path = get_mm_memcg_path(mm); \ 161 161 trace_mmap_lock_##type(mm, \ 162 162 memcg_path != NULL ? memcg_path : "", \ 163 163 ##__VA_ARGS__); \ 164 164 if (likely(memcg_path != NULL)) \ 165 165 put_memcg_path_buf(); \ 166 - preempt_enable(); \ 166 + local_unlock(&memcg_paths.lock); \ 167 167 } while (0) 168 168 169 169 #else /* !CONFIG_MEMCG */
+16 -13
mm/page_alloc.c
··· 840 840 } 841 841 #endif 842 842 843 - if (_init_on_alloc_enabled_early) { 844 - if (page_poisoning_requested) 845 - pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " 846 - "will take precedence over init_on_alloc\n"); 847 - else 848 - static_branch_enable(&init_on_alloc); 843 + if ((_init_on_alloc_enabled_early || _init_on_free_enabled_early) && 844 + page_poisoning_requested) { 845 + pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " 846 + "will take precedence over init_on_alloc and init_on_free\n"); 847 + _init_on_alloc_enabled_early = false; 848 + _init_on_free_enabled_early = false; 849 849 } 850 - if (_init_on_free_enabled_early) { 851 - if (page_poisoning_requested) 852 - pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " 853 - "will take precedence over init_on_free\n"); 854 - else 855 - static_branch_enable(&init_on_free); 856 - } 850 + 851 + if (_init_on_alloc_enabled_early) 852 + static_branch_enable(&init_on_alloc); 853 + else 854 + static_branch_disable(&init_on_alloc); 855 + 856 + if (_init_on_free_enabled_early) 857 + static_branch_enable(&init_on_free); 858 + else 859 + static_branch_disable(&init_on_free); 857 860 858 861 #ifdef CONFIG_DEBUG_PAGEALLOC 859 862 if (!debug_pagealloc_enabled())
+1
mm/secretmem.c
··· 152 152 } 153 153 154 154 const struct address_space_operations secretmem_aops = { 155 + .set_page_dirty = __set_page_dirty_no_writeback, 155 156 .freepage = secretmem_freepage, 156 157 .migratepage = secretmem_migratepage, 157 158 .isolate_page = secretmem_isolate_page,
+1 -1
mm/slab.h
··· 346 346 continue; 347 347 348 348 page = virt_to_head_page(p[i]); 349 - objcgs = page_objcgs(page); 349 + objcgs = page_objcgs_check(page); 350 350 if (!objcgs) 351 351 continue; 352 352
+12 -10
mm/slub.c
··· 3236 3236 struct kmem_cache *s; 3237 3237 }; 3238 3238 3239 + static inline void free_nonslab_page(struct page *page) 3240 + { 3241 + unsigned int order = compound_order(page); 3242 + 3243 + VM_BUG_ON_PAGE(!PageCompound(page), page); 3244 + kfree_hook(page_address(page)); 3245 + mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, -(PAGE_SIZE << order)); 3246 + __free_pages(page, order); 3247 + } 3248 + 3239 3249 /* 3240 3250 * This function progressively scans the array with free objects (with 3241 3251 * a limited look ahead) and extract objects belonging to the same ··· 3282 3272 if (!s) { 3283 3273 /* Handle kalloc'ed objects */ 3284 3274 if (unlikely(!PageSlab(page))) { 3285 - BUG_ON(!PageCompound(page)); 3286 - kfree_hook(object); 3287 - __free_pages(page, compound_order(page)); 3275 + free_nonslab_page(page); 3288 3276 p[size] = NULL; /* mark object processed */ 3289 3277 return size; 3290 3278 } ··· 4258 4250 4259 4251 page = virt_to_head_page(x); 4260 4252 if (unlikely(!PageSlab(page))) { 4261 - unsigned int order = compound_order(page); 4262 - 4263 - BUG_ON(!PageCompound(page)); 4264 - kfree_hook(object); 4265 - mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, 4266 - -(PAGE_SIZE << order)); 4267 - __free_pages(page, order); 4253 + free_nonslab_page(page); 4268 4254 return; 4269 4255 } 4270 4256 slab_free(page->slab_cache, page, object, NULL, 1, _RET_IP_);
+8 -3
net/can/j1939/transport.c
··· 1076 1076 1077 1077 static bool j1939_session_deactivate(struct j1939_session *session) 1078 1078 { 1079 + struct j1939_priv *priv = session->priv; 1079 1080 bool active; 1080 1081 1081 - j1939_session_list_lock(session->priv); 1082 + j1939_session_list_lock(priv); 1083 + /* This function should be called with a session ref-count of at 1084 + * least 2. 1085 + */ 1086 + WARN_ON_ONCE(kref_read(&session->kref) < 2); 1082 1087 active = j1939_session_deactivate_locked(session); 1083 - j1939_session_list_unlock(session->priv); 1088 + j1939_session_list_unlock(priv); 1084 1089 1085 1090 return active; 1086 1091 } ··· 1879 1874 if (!session->transmission) 1880 1875 j1939_tp_schedule_txtimer(session, 0); 1881 1876 } else { 1882 - j1939_tp_set_rxtimeout(session, 250); 1877 + j1939_tp_set_rxtimeout(session, 750); 1883 1878 } 1884 1879 session->last_cmd = 0xff; 1885 1880 consume_skb(se_skb);
+18 -2
net/can/raw.c
··· 546 546 return -EFAULT; 547 547 } 548 548 549 + rtnl_lock(); 549 550 lock_sock(sk); 550 551 551 - if (ro->bound && ro->ifindex) 552 + if (ro->bound && ro->ifindex) { 552 553 dev = dev_get_by_index(sock_net(sk), ro->ifindex); 554 + if (!dev) { 555 + if (count > 1) 556 + kfree(filter); 557 + err = -ENODEV; 558 + goto out_fil; 559 + } 560 + } 553 561 554 562 if (ro->bound) { 555 563 /* (try to) register the new filters */ ··· 596 588 dev_put(dev); 597 589 598 590 release_sock(sk); 591 + rtnl_unlock(); 599 592 600 593 break; 601 594 ··· 609 600 610 601 err_mask &= CAN_ERR_MASK; 611 602 603 + rtnl_lock(); 612 604 lock_sock(sk); 613 605 614 - if (ro->bound && ro->ifindex) 606 + if (ro->bound && ro->ifindex) { 615 607 dev = dev_get_by_index(sock_net(sk), ro->ifindex); 608 + if (!dev) { 609 + err = -ENODEV; 610 + goto out_err; 611 + } 612 + } 616 613 617 614 /* remove current error mask */ 618 615 if (ro->bound) { ··· 642 627 dev_put(dev); 643 628 644 629 release_sock(sk); 630 + rtnl_unlock(); 645 631 646 632 break; 647 633
+2 -8
net/core/devlink.c
··· 9327 9327 9328 9328 switch (attrs->flavour) { 9329 9329 case DEVLINK_PORT_FLAVOUR_PHYSICAL: 9330 - case DEVLINK_PORT_FLAVOUR_VIRTUAL: 9331 9330 n = snprintf(name, len, "p%u", attrs->phys.port_number); 9332 9331 if (n < len && attrs->split) 9333 9332 n += snprintf(name + n, len - n, "s%u", 9334 9333 attrs->phys.split_subport_number); 9335 - if (!attrs->split) 9336 - n = snprintf(name, len, "p%u", attrs->phys.port_number); 9337 - else 9338 - n = snprintf(name, len, "p%us%u", 9339 - attrs->phys.port_number, 9340 - attrs->phys.split_subport_number); 9341 - 9342 9334 break; 9343 9335 case DEVLINK_PORT_FLAVOUR_CPU: 9344 9336 case DEVLINK_PORT_FLAVOUR_DSA: ··· 9372 9380 n = snprintf(name, len, "pf%usf%u", attrs->pci_sf.pf, 9373 9381 attrs->pci_sf.sf); 9374 9382 break; 9383 + case DEVLINK_PORT_FLAVOUR_VIRTUAL: 9384 + return -EOPNOTSUPP; 9375 9385 } 9376 9386 9377 9387 if (n >= len)
+9 -9
net/core/flow_dissector.c
··· 1508 1508 } 1509 1509 EXPORT_SYMBOL(flow_get_u32_dst); 1510 1510 1511 - /* Sort the source and destination IP (and the ports if the IP are the same), 1511 + /* Sort the source and destination IP and the ports, 1512 1512 * to have consistent hash within the two directions 1513 1513 */ 1514 1514 static inline void __flow_hash_consistentify(struct flow_keys *keys) ··· 1519 1519 case FLOW_DISSECTOR_KEY_IPV4_ADDRS: 1520 1520 addr_diff = (__force u32)keys->addrs.v4addrs.dst - 1521 1521 (__force u32)keys->addrs.v4addrs.src; 1522 - if ((addr_diff < 0) || 1523 - (addr_diff == 0 && 1524 - ((__force u16)keys->ports.dst < 1525 - (__force u16)keys->ports.src))) { 1522 + if (addr_diff < 0) 1526 1523 swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst); 1524 + 1525 + if ((__force u16)keys->ports.dst < 1526 + (__force u16)keys->ports.src) { 1527 1527 swap(keys->ports.src, keys->ports.dst); 1528 1528 } 1529 1529 break; ··· 1531 1531 addr_diff = memcmp(&keys->addrs.v6addrs.dst, 1532 1532 &keys->addrs.v6addrs.src, 1533 1533 sizeof(keys->addrs.v6addrs.dst)); 1534 - if ((addr_diff < 0) || 1535 - (addr_diff == 0 && 1536 - ((__force u16)keys->ports.dst < 1537 - (__force u16)keys->ports.src))) { 1534 + if (addr_diff < 0) { 1538 1535 for (i = 0; i < 4; i++) 1539 1536 swap(keys->addrs.v6addrs.src.s6_addr32[i], 1540 1537 keys->addrs.v6addrs.dst.s6_addr32[i]); 1538 + } 1539 + if ((__force u16)keys->ports.dst < 1540 + (__force u16)keys->ports.src) { 1541 1541 swap(keys->ports.src, keys->ports.dst); 1542 1542 } 1543 1543 break;
+28 -11
net/core/skmsg.c
··· 584 584 return sk_psock_skb_ingress(psock, skb); 585 585 } 586 586 587 - static void sock_drop(struct sock *sk, struct sk_buff *skb) 587 + static void sk_psock_skb_state(struct sk_psock *psock, 588 + struct sk_psock_work_state *state, 589 + struct sk_buff *skb, 590 + int len, int off) 588 591 { 589 - sk_drops_add(sk, skb); 590 - kfree_skb(skb); 592 + spin_lock_bh(&psock->ingress_lock); 593 + if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) { 594 + state->skb = skb; 595 + state->len = len; 596 + state->off = off; 597 + } else { 598 + sock_drop(psock->sk, skb); 599 + } 600 + spin_unlock_bh(&psock->ingress_lock); 591 601 } 592 602 593 603 static void sk_psock_backlog(struct work_struct *work) 594 604 { 595 605 struct sk_psock *psock = container_of(work, struct sk_psock, work); 596 606 struct sk_psock_work_state *state = &psock->work_state; 597 - struct sk_buff *skb; 607 + struct sk_buff *skb = NULL; 598 608 bool ingress; 599 609 u32 len, off; 600 610 int ret; 601 611 602 612 mutex_lock(&psock->work_mutex); 603 - if (state->skb) { 613 + if (unlikely(state->skb)) { 614 + spin_lock_bh(&psock->ingress_lock); 604 615 skb = state->skb; 605 616 len = state->len; 606 617 off = state->off; 607 618 state->skb = NULL; 608 - goto start; 619 + spin_unlock_bh(&psock->ingress_lock); 609 620 } 621 + if (skb) 622 + goto start; 610 623 611 624 while ((skb = skb_dequeue(&psock->ingress_skb))) { 612 625 len = skb->len; ··· 634 621 len, ingress); 635 622 if (ret <= 0) { 636 623 if (ret == -EAGAIN) { 637 - state->skb = skb; 638 - state->len = len; 639 - state->off = off; 624 + sk_psock_skb_state(psock, state, skb, 625 + len, off); 640 626 goto end; 641 627 } 642 628 /* Hard errors break pipe and stop xmit. */ ··· 734 722 skb_bpf_redirect_clear(skb); 735 723 sock_drop(psock->sk, skb); 736 724 } 725 + kfree_skb(psock->work_state.skb); 726 + /* We null the skb here to ensure that calls to sk_psock_backlog 727 + * do not pick up the free'd skb. 728 + */ 729 + psock->work_state.skb = NULL; 737 730 __sk_psock_purge_ingress_msg(psock); 738 731 } 739 732 ··· 790 773 791 774 void sk_psock_drop(struct sock *sk, struct sk_psock *psock) 792 775 { 793 - sk_psock_stop(psock, false); 794 - 795 776 write_lock_bh(&sk->sk_callback_lock); 796 777 sk_psock_restore_proto(sk, psock); 797 778 rcu_assign_sk_user_data(sk, NULL); ··· 798 783 else if (psock->progs.stream_verdict || psock->progs.skb_verdict) 799 784 sk_psock_stop_verdict(sk, psock); 800 785 write_unlock_bh(&sk->sk_callback_lock); 786 + 787 + sk_psock_stop(psock, false); 801 788 802 789 INIT_RCU_WORK(&psock->rwork, sk_psock_destroy); 803 790 queue_rcu_work(system_wq, &psock->rwork);
+1 -1
net/ipv4/ip_tunnel.c
··· 390 390 tunnel->i_seqno = ntohl(tpi->seq) + 1; 391 391 } 392 392 393 - skb_reset_network_header(skb); 393 + skb_set_network_header(skb, (tunnel->dev->type == ARPHRD_ETHER) ? ETH_HLEN : 0); 394 394 395 395 err = IP_ECN_decapsulate(iph, skb); 396 396 if (unlikely(err)) {
+3 -2
net/ipv6/ip6_output.c
··· 549 549 if (net->ipv6.devconf_all->proxy_ndp && 550 550 pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) { 551 551 int proxied = ip6_forward_proxy_check(skb); 552 - if (proxied > 0) 552 + if (proxied > 0) { 553 + hdr->hop_limit--; 553 554 return ip6_input(skb); 554 - else if (proxied < 0) { 555 + } else if (proxied < 0) { 555 556 __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); 556 557 goto drop; 557 558 }
+9 -1
net/llc/af_llc.c
··· 98 98 { 99 99 u8 rc = LLC_PDU_LEN_U; 100 100 101 - if (addr->sllc_test || addr->sllc_xid) 101 + if (addr->sllc_test) 102 102 rc = LLC_PDU_LEN_U; 103 + else if (addr->sllc_xid) 104 + /* We need to expand header to sizeof(struct llc_xid_info) 105 + * since llc_pdu_init_as_xid_cmd() sets 4,5,6 bytes of LLC header 106 + * as XID PDU. In llc_ui_sendmsg() we reserved header size and then 107 + * filled all other space with user data. If we won't reserve this 108 + * bytes, llc_pdu_init_as_xid_cmd() will overwrite user data 109 + */ 110 + rc = LLC_PDU_LEN_U_XID; 103 111 else if (sk->sk_type == SOCK_STREAM) 104 112 rc = LLC_PDU_LEN_I; 105 113 return rc;
+1 -1
net/llc/llc_s_ac.c
··· 79 79 struct llc_sap_state_ev *ev = llc_sap_ev(skb); 80 80 int rc; 81 81 82 - llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, 82 + llc_pdu_header_init(skb, LLC_PDU_TYPE_U_XID, ev->saddr.lsap, 83 83 ev->daddr.lsap, LLC_PDU_CMD); 84 84 llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); 85 85 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac);
+19
net/mac80211/cfg.c
··· 152 152 struct vif_params *params) 153 153 { 154 154 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 155 + struct ieee80211_local *local = sdata->local; 156 + struct sta_info *sta; 155 157 int ret; 156 158 157 159 ret = ieee80211_if_change_type(sdata, type); ··· 164 162 RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); 165 163 ieee80211_check_fast_rx_iface(sdata); 166 164 } else if (type == NL80211_IFTYPE_STATION && params->use_4addr >= 0) { 165 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 166 + 167 + if (params->use_4addr == ifmgd->use_4addr) 168 + return 0; 169 + 167 170 sdata->u.mgd.use_4addr = params->use_4addr; 171 + if (!ifmgd->associated) 172 + return 0; 173 + 174 + mutex_lock(&local->sta_mtx); 175 + sta = sta_info_get(sdata, ifmgd->bssid); 176 + if (sta) 177 + drv_sta_set_4addr(local, sdata, &sta->sta, 178 + params->use_4addr); 179 + mutex_unlock(&local->sta_mtx); 180 + 181 + if (params->use_4addr) 182 + ieee80211_send_4addr_nullfunc(local, sdata); 168 183 } 169 184 170 185 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {
+2
net/mac80211/ieee80211_i.h
··· 2201 2201 void ieee80211_send_nullfunc(struct ieee80211_local *local, 2202 2202 struct ieee80211_sub_if_data *sdata, 2203 2203 bool powersave); 2204 + void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, 2205 + struct ieee80211_sub_if_data *sdata); 2204 2206 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 2205 2207 struct ieee80211_hdr *hdr, bool ack, u16 tx_time); 2206 2208
+2 -2
net/mac80211/mlme.c
··· 1095 1095 ieee80211_tx_skb(sdata, skb); 1096 1096 } 1097 1097 1098 - static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, 1099 - struct ieee80211_sub_if_data *sdata) 1098 + void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, 1099 + struct ieee80211_sub_if_data *sdata) 1100 1100 { 1101 1101 struct sk_buff *skb; 1102 1102 struct ieee80211_hdr *nullfunc;
+2 -1
net/mac80211/rx.c
··· 730 730 * Need to make a copy and possibly remove radiotap header 731 731 * and FCS from the original. 732 732 */ 733 - skb = skb_copy_expand(*origskb, needed_headroom, 0, GFP_ATOMIC); 733 + skb = skb_copy_expand(*origskb, needed_headroom + NET_SKB_PAD, 734 + 0, GFP_ATOMIC); 734 735 735 736 if (!skb) 736 737 return NULL;
+32 -25
net/mac80211/tx.c
··· 1147 1147 return queued; 1148 1148 } 1149 1149 1150 + static void 1151 + ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, 1152 + struct sta_info *sta, 1153 + struct sk_buff *skb) 1154 + { 1155 + struct rate_control_ref *ref = sdata->local->rate_ctrl; 1156 + u16 tid; 1157 + 1158 + if (!ref || !(ref->ops->capa & RATE_CTRL_CAPA_AMPDU_TRIGGER)) 1159 + return; 1160 + 1161 + if (!sta || !sta->sta.ht_cap.ht_supported || 1162 + !sta->sta.wme || skb_get_queue_mapping(skb) == IEEE80211_AC_VO || 1163 + skb->protocol == sdata->control_port_protocol) 1164 + return; 1165 + 1166 + tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; 1167 + if (likely(sta->ampdu_mlme.tid_tx[tid])) 1168 + return; 1169 + 1170 + ieee80211_start_tx_ba_session(&sta->sta, tid, 0); 1171 + } 1172 + 1150 1173 /* 1151 1174 * initialises @tx 1152 1175 * pass %NULL for the station if unknown, a valid pointer if known ··· 1183 1160 struct ieee80211_local *local = sdata->local; 1184 1161 struct ieee80211_hdr *hdr; 1185 1162 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1163 + bool aggr_check = false; 1186 1164 int tid; 1187 1165 1188 1166 memset(tx, 0, sizeof(*tx)); ··· 1212 1188 } else if (tx->sdata->control_port_protocol == tx->skb->protocol) { 1213 1189 tx->sta = sta_info_get_bss(sdata, hdr->addr1); 1214 1190 } 1215 - if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) 1191 + if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) { 1216 1192 tx->sta = sta_info_get(sdata, hdr->addr1); 1193 + aggr_check = true; 1194 + } 1217 1195 } 1218 1196 1219 1197 if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && ··· 1225 1199 struct tid_ampdu_tx *tid_tx; 1226 1200 1227 1201 tid = ieee80211_get_tid(hdr); 1228 - 1229 1202 tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]); 1203 + if (!tid_tx && aggr_check) { 1204 + ieee80211_aggr_check(sdata, tx->sta, skb); 1205 + tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]); 1206 + } 1207 + 1230 1208 if (tid_tx) { 1231 1209 bool queued; 1232 1210 ··· 4149 4119 spin_unlock_bh(&air_sched->lock); 4150 4120 } 4151 4121 EXPORT_SYMBOL(ieee80211_txq_schedule_start); 4152 - 4153 - static void 4154 - ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, 4155 - struct sta_info *sta, 4156 - struct sk_buff *skb) 4157 - { 4158 - struct rate_control_ref *ref = sdata->local->rate_ctrl; 4159 - u16 tid; 4160 - 4161 - if (!ref || !(ref->ops->capa & RATE_CTRL_CAPA_AMPDU_TRIGGER)) 4162 - return; 4163 - 4164 - if (!sta || !sta->sta.ht_cap.ht_supported || 4165 - !sta->sta.wme || skb_get_queue_mapping(skb) == IEEE80211_AC_VO || 4166 - skb->protocol == sdata->control_port_protocol) 4167 - return; 4168 - 4169 - tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; 4170 - if (likely(sta->ampdu_mlme.tid_tx[tid])) 4171 - return; 4172 - 4173 - ieee80211_start_tx_ba_session(&sta->sta, tid, 0); 4174 - } 4175 4122 4176 4123 void __ieee80211_subif_start_xmit(struct sk_buff *skb, 4177 4124 struct net_device *dev,
+6 -1
net/netfilter/nf_conntrack_core.c
··· 670 670 return false; 671 671 672 672 tstamp = nf_conn_tstamp_find(ct); 673 - if (tstamp && tstamp->stop == 0) 673 + if (tstamp) { 674 + s32 timeout = ct->timeout - nfct_time_stamp; 675 + 674 676 tstamp->stop = ktime_get_real_ns(); 677 + if (timeout < 0) 678 + tstamp->stop -= jiffies_to_nsecs(-timeout); 679 + } 675 680 676 681 if (nf_conntrack_event_report(IPCT_DESTROY, ct, 677 682 portid, report) < 0) {
+5 -1
net/netfilter/nf_flow_table_core.c
··· 331 331 void flow_offload_refresh(struct nf_flowtable *flow_table, 332 332 struct flow_offload *flow) 333 333 { 334 - flow->timeout = nf_flowtable_time_stamp + flow_offload_get_timeout(flow); 334 + u32 timeout; 335 + 336 + timeout = nf_flowtable_time_stamp + flow_offload_get_timeout(flow); 337 + if (READ_ONCE(flow->timeout) != timeout) 338 + WRITE_ONCE(flow->timeout, timeout); 335 339 336 340 if (likely(!nf_flowtable_hw_offload(flow_table))) 337 341 return;
+12
net/netfilter/nf_tables_api.c
··· 8445 8445 return 0; 8446 8446 } 8447 8447 8448 + static void nf_tables_commit_audit_free(struct list_head *adl) 8449 + { 8450 + struct nft_audit_data *adp, *adn; 8451 + 8452 + list_for_each_entry_safe(adp, adn, adl, list) { 8453 + list_del(&adp->list); 8454 + kfree(adp); 8455 + } 8456 + } 8457 + 8448 8458 static void nf_tables_commit_audit_collect(struct list_head *adl, 8449 8459 struct nft_table *table, u32 op) 8450 8460 { ··· 8519 8509 ret = nf_tables_commit_audit_alloc(&adl, trans->ctx.table); 8520 8510 if (ret) { 8521 8511 nf_tables_commit_chain_prepare_cancel(net); 8512 + nf_tables_commit_audit_free(&adl); 8522 8513 return ret; 8523 8514 } 8524 8515 if (trans->msg_type == NFT_MSG_NEWRULE || ··· 8529 8518 ret = nf_tables_commit_chain_prepare(net, chain); 8530 8519 if (ret < 0) { 8531 8520 nf_tables_commit_chain_prepare_cancel(net); 8521 + nf_tables_commit_audit_free(&adl); 8532 8522 return ret; 8533 8523 } 8534 8524 }
+13 -7
net/netfilter/nft_last.c
··· 48 48 { 49 49 struct nft_last_priv *priv = nft_expr_priv(expr); 50 50 51 - priv->last_jiffies = jiffies; 52 - priv->last_set = 1; 51 + if (READ_ONCE(priv->last_jiffies) != jiffies) 52 + WRITE_ONCE(priv->last_jiffies, jiffies); 53 + if (READ_ONCE(priv->last_set) == 0) 54 + WRITE_ONCE(priv->last_set, 1); 53 55 } 54 56 55 57 static int nft_last_dump(struct sk_buff *skb, const struct nft_expr *expr) 56 58 { 57 59 struct nft_last_priv *priv = nft_expr_priv(expr); 60 + unsigned long last_jiffies = READ_ONCE(priv->last_jiffies); 61 + u32 last_set = READ_ONCE(priv->last_set); 58 62 __be64 msecs; 59 63 60 - if (time_before(jiffies, priv->last_jiffies)) 61 - priv->last_set = 0; 64 + if (time_before(jiffies, last_jiffies)) { 65 + WRITE_ONCE(priv->last_set, 0); 66 + last_set = 0; 67 + } 62 68 63 - if (priv->last_set) 64 - msecs = nf_jiffies64_to_msecs(jiffies - priv->last_jiffies); 69 + if (last_set) 70 + msecs = nf_jiffies64_to_msecs(jiffies - last_jiffies); 65 71 else 66 72 msecs = 0; 67 73 68 - if (nla_put_be32(skb, NFTA_LAST_SET, htonl(priv->last_set)) || 74 + if (nla_put_be32(skb, NFTA_LAST_SET, htonl(last_set)) || 69 75 nla_put_be64(skb, NFTA_LAST_MSECS, msecs, NFTA_LAST_PAD)) 70 76 goto nla_put_failure; 71 77
+3 -1
net/netfilter/nft_nat.c
··· 201 201 alen = sizeof_field(struct nf_nat_range, min_addr.ip6); 202 202 break; 203 203 default: 204 - return -EAFNOSUPPORT; 204 + if (tb[NFTA_NAT_REG_ADDR_MIN]) 205 + return -EAFNOSUPPORT; 206 + break; 205 207 } 206 208 priv->family = family; 207 209
+5 -1
net/qrtr/qrtr.c
··· 518 518 if (!ipc) 519 519 goto err; 520 520 521 - if (sock_queue_rcv_skb(&ipc->sk, skb)) 521 + if (sock_queue_rcv_skb(&ipc->sk, skb)) { 522 + qrtr_port_put(ipc); 522 523 goto err; 524 + } 523 525 524 526 qrtr_port_put(ipc); 525 527 } ··· 841 839 842 840 ipc = qrtr_port_lookup(to->sq_port); 843 841 if (!ipc || &ipc->sk == skb->sk) { /* do not send to self */ 842 + if (ipc) 843 + qrtr_port_put(ipc); 844 844 kfree_skb(skb); 845 845 return -ENODEV; 846 846 }
+1 -1
net/sctp/input.c
··· 1203 1203 if (unlikely(!af)) 1204 1204 return NULL; 1205 1205 1206 - if (af->from_addr_param(&paddr, param, peer_port, 0)) 1206 + if (!af->from_addr_param(&paddr, param, peer_port, 0)) 1207 1207 return NULL; 1208 1208 1209 1209 return __sctp_lookup_association(net, laddr, &paddr, transportp);
+3 -2
net/sctp/ipv6.c
··· 100 100 list_for_each_entry_safe(addr, temp, 101 101 &net->sctp.local_addr_list, list) { 102 102 if (addr->a.sa.sa_family == AF_INET6 && 103 - ipv6_addr_equal(&addr->a.v6.sin6_addr, 104 - &ifa->addr)) { 103 + ipv6_addr_equal(&addr->a.v6.sin6_addr, 104 + &ifa->addr) && 105 + addr->a.v6.sin6_scope_id == ifa->idev->dev->ifindex) { 105 106 sctp_addr_wq_mgmt(net, addr, SCTP_ADDR_DEL); 106 107 found = 1; 107 108 addr->valid = 0;
+7 -8
net/sctp/sm_statefuns.c
··· 1109 1109 if (!sctp_transport_pl_enabled(transport)) 1110 1110 return SCTP_DISPOSITION_CONSUME; 1111 1111 1112 - sctp_transport_pl_send(transport); 1113 - 1114 - reply = sctp_make_heartbeat(asoc, transport, transport->pl.probe_size); 1115 - if (!reply) 1116 - return SCTP_DISPOSITION_NOMEM; 1117 - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); 1112 + if (sctp_transport_pl_send(transport)) { 1113 + reply = sctp_make_heartbeat(asoc, transport, transport->pl.probe_size); 1114 + if (!reply) 1115 + return SCTP_DISPOSITION_NOMEM; 1116 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); 1117 + } 1118 1118 sctp_add_cmd_sf(commands, SCTP_CMD_PROBE_TIMER_UPDATE, 1119 1119 SCTP_TRANSPORT(transport)); 1120 1120 ··· 1274 1274 !sctp_transport_pl_enabled(link)) 1275 1275 return SCTP_DISPOSITION_DISCARD; 1276 1276 1277 - sctp_transport_pl_recv(link); 1278 - if (link->pl.state == SCTP_PL_COMPLETE) 1277 + if (sctp_transport_pl_recv(link)) 1279 1278 return SCTP_DISPOSITION_CONSUME; 1280 1279 1281 1280 return sctp_sf_send_probe(net, ep, asoc, type, link, commands);
+27 -18
net/sctp/transport.c
··· 258 258 sctp_transport_pl_update(transport); 259 259 } 260 260 261 - void sctp_transport_pl_send(struct sctp_transport *t) 261 + bool sctp_transport_pl_send(struct sctp_transport *t) 262 262 { 263 - pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", 264 - __func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, t->pl.probe_high); 263 + if (t->pl.probe_count < SCTP_MAX_PROBES) 264 + goto out; 265 265 266 - if (t->pl.probe_count < SCTP_MAX_PROBES) { 267 - t->pl.probe_count++; 268 - return; 269 - } 270 - 266 + t->pl.last_rtx_chunks = t->asoc->rtx_data_chunks; 267 + t->pl.probe_count = 0; 271 268 if (t->pl.state == SCTP_PL_BASE) { 272 269 if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */ 273 270 t->pl.state = SCTP_PL_ERROR; /* Base -> Error */ ··· 296 299 sctp_assoc_sync_pmtu(t->asoc); 297 300 } 298 301 } 299 - t->pl.probe_count = 1; 302 + 303 + out: 304 + if (t->pl.state == SCTP_PL_COMPLETE && t->pl.raise_count < 30 && 305 + !t->pl.probe_count && t->pl.last_rtx_chunks == t->asoc->rtx_data_chunks) { 306 + t->pl.raise_count++; 307 + return false; 308 + } 309 + 310 + pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", 311 + __func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, t->pl.probe_high); 312 + 313 + t->pl.probe_count++; 314 + return true; 300 315 } 301 316 302 - void sctp_transport_pl_recv(struct sctp_transport *t) 317 + bool sctp_transport_pl_recv(struct sctp_transport *t) 303 318 { 304 319 pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n", 305 320 __func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, t->pl.probe_high); 306 321 322 + t->pl.last_rtx_chunks = t->asoc->rtx_data_chunks; 307 323 t->pl.pmtu = t->pl.probe_size; 308 324 t->pl.probe_count = 0; 309 325 if (t->pl.state == SCTP_PL_BASE) { ··· 333 323 if (!t->pl.probe_high) { 334 324 t->pl.probe_size = min(t->pl.probe_size + SCTP_PL_BIG_STEP, 335 325 SCTP_MAX_PLPMTU); 336 - return; 326 + return false; 337 327 } 338 328 t->pl.probe_size += SCTP_PL_MIN_STEP; 339 329 if (t->pl.probe_size >= t->pl.probe_high) { ··· 345 335 t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t); 346 336 sctp_assoc_sync_pmtu(t->asoc); 347 337 } 348 - } else if (t->pl.state == SCTP_PL_COMPLETE) { 349 - t->pl.raise_count++; 350 - if (t->pl.raise_count == 30) { 351 - /* Raise probe_size again after 30 * interval in Search Complete */ 352 - t->pl.state = SCTP_PL_SEARCH; /* Search Complete -> Search */ 353 - t->pl.probe_size += SCTP_PL_MIN_STEP; 354 - } 338 + } else if (t->pl.state == SCTP_PL_COMPLETE && t->pl.raise_count == 30) { 339 + /* Raise probe_size again after 30 * interval in Search Complete */ 340 + t->pl.state = SCTP_PL_SEARCH; /* Search Complete -> Search */ 341 + t->pl.probe_size += SCTP_PL_MIN_STEP; 355 342 } 343 + 344 + return t->pl.state == SCTP_PL_COMPLETE; 356 345 } 357 346 358 347 static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
+4 -10
net/tipc/crypto.c
··· 898 898 if (unlikely(!aead)) 899 899 return -ENOKEY; 900 900 901 - /* Cow skb data if needed */ 902 - if (likely(!skb_cloned(skb) && 903 - (!skb_is_nonlinear(skb) || !skb_has_frag_list(skb)))) { 904 - nsg = 1 + skb_shinfo(skb)->nr_frags; 905 - } else { 906 - nsg = skb_cow_data(skb, 0, &unused); 907 - if (unlikely(nsg < 0)) { 908 - pr_err("RX: skb_cow_data() returned %d\n", nsg); 909 - return nsg; 910 - } 901 + nsg = skb_cow_data(skb, 0, &unused); 902 + if (unlikely(nsg < 0)) { 903 + pr_err("RX: skb_cow_data() returned %d\n", nsg); 904 + return nsg; 911 905 } 912 906 913 907 /* Allocate memory for the AEAD operation */
+17 -13
net/tipc/socket.c
··· 158 158 static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dsz); 159 159 static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dsz); 160 160 static void tipc_sk_push_backlog(struct tipc_sock *tsk, bool nagle_ack); 161 + static int tipc_wait_for_connect(struct socket *sock, long *timeo_p); 161 162 162 163 static const struct proto_ops packet_ops; 163 164 static const struct proto_ops stream_ops; ··· 1516 1515 rc = 0; 1517 1516 } 1518 1517 1519 - if (unlikely(syn && !rc)) 1518 + if (unlikely(syn && !rc)) { 1520 1519 tipc_set_sk_state(sk, TIPC_CONNECTING); 1520 + if (timeout) { 1521 + timeout = msecs_to_jiffies(timeout); 1522 + tipc_wait_for_connect(sock, &timeout); 1523 + } 1524 + } 1521 1525 1522 1526 return rc ? rc : dlen; 1523 1527 } ··· 1570 1564 return -EMSGSIZE; 1571 1565 1572 1566 /* Handle implicit connection setup */ 1573 - if (unlikely(dest)) { 1567 + if (unlikely(dest && sk->sk_state == TIPC_OPEN)) { 1574 1568 rc = __tipc_sendmsg(sock, m, dlen); 1575 1569 if (dlen && dlen == rc) { 1576 1570 tsk->peer_caps = tipc_node_get_capabilities(net, dnode); ··· 2672 2666 static int tipc_wait_for_accept(struct socket *sock, long timeo) 2673 2667 { 2674 2668 struct sock *sk = sock->sk; 2675 - DEFINE_WAIT(wait); 2669 + DEFINE_WAIT_FUNC(wait, woken_wake_function); 2676 2670 int err; 2677 2671 2678 2672 /* True wake-one mechanism for incoming connections: only ··· 2681 2675 * anymore, the common case will execute the loop only once. 2682 2676 */ 2683 2677 for (;;) { 2684 - prepare_to_wait_exclusive(sk_sleep(sk), &wait, 2685 - TASK_INTERRUPTIBLE); 2686 2678 if (timeo && skb_queue_empty(&sk->sk_receive_queue)) { 2679 + add_wait_queue(sk_sleep(sk), &wait); 2687 2680 release_sock(sk); 2688 - timeo = schedule_timeout(timeo); 2681 + timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo); 2689 2682 lock_sock(sk); 2683 + remove_wait_queue(sk_sleep(sk), &wait); 2690 2684 } 2691 2685 err = 0; 2692 2686 if (!skb_queue_empty(&sk->sk_receive_queue)) ··· 2698 2692 if (signal_pending(current)) 2699 2693 break; 2700 2694 } 2701 - finish_wait(sk_sleep(sk), &wait); 2702 2695 return err; 2703 2696 } 2704 2697 ··· 2714 2709 bool kern) 2715 2710 { 2716 2711 struct sock *new_sk, *sk = sock->sk; 2717 - struct sk_buff *buf; 2718 2712 struct tipc_sock *new_tsock; 2713 + struct msghdr m = {NULL,}; 2719 2714 struct tipc_msg *msg; 2715 + struct sk_buff *buf; 2720 2716 long timeo; 2721 2717 int res; 2722 2718 ··· 2763 2757 } 2764 2758 2765 2759 /* 2766 - * Respond to 'SYN-' by discarding it & returning 'ACK'-. 2767 - * Respond to 'SYN+' by queuing it on new socket. 2760 + * Respond to 'SYN-' by discarding it & returning 'ACK'. 2761 + * Respond to 'SYN+' by queuing it on new socket & returning 'ACK'. 2768 2762 */ 2769 2763 if (!msg_data_sz(msg)) { 2770 - struct msghdr m = {NULL,}; 2771 - 2772 2764 tsk_advance_rx_queue(sk); 2773 - __tipc_sendstream(new_sock, &m, 0); 2774 2765 } else { 2775 2766 __skb_dequeue(&sk->sk_receive_queue); 2776 2767 __skb_queue_head(&new_sk->sk_receive_queue, buf); 2777 2768 skb_set_owner_r(buf, new_sk); 2778 2769 } 2770 + __tipc_sendstream(new_sock, &m, 0); 2779 2771 release_sock(new_sk); 2780 2772 exit: 2781 2773 release_sock(sk);
+49 -2
net/unix/af_unix.c
··· 1543 1543 return err; 1544 1544 } 1545 1545 1546 + static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb) 1547 + { 1548 + scm->fp = scm_fp_dup(UNIXCB(skb).fp); 1549 + 1550 + /* 1551 + * Garbage collection of unix sockets starts by selecting a set of 1552 + * candidate sockets which have reference only from being in flight 1553 + * (total_refs == inflight_refs). This condition is checked once during 1554 + * the candidate collection phase, and candidates are marked as such, so 1555 + * that non-candidates can later be ignored. While inflight_refs is 1556 + * protected by unix_gc_lock, total_refs (file count) is not, hence this 1557 + * is an instantaneous decision. 1558 + * 1559 + * Once a candidate, however, the socket must not be reinstalled into a 1560 + * file descriptor while the garbage collection is in progress. 1561 + * 1562 + * If the above conditions are met, then the directed graph of 1563 + * candidates (*) does not change while unix_gc_lock is held. 1564 + * 1565 + * Any operations that changes the file count through file descriptors 1566 + * (dup, close, sendmsg) does not change the graph since candidates are 1567 + * not installed in fds. 1568 + * 1569 + * Dequeing a candidate via recvmsg would install it into an fd, but 1570 + * that takes unix_gc_lock to decrement the inflight count, so it's 1571 + * serialized with garbage collection. 1572 + * 1573 + * MSG_PEEK is special in that it does not change the inflight count, 1574 + * yet does install the socket into an fd. The following lock/unlock 1575 + * pair is to ensure serialization with garbage collection. It must be 1576 + * done between incrementing the file count and installing the file into 1577 + * an fd. 1578 + * 1579 + * If garbage collection starts after the barrier provided by the 1580 + * lock/unlock, then it will see the elevated refcount and not mark this 1581 + * as a candidate. If a garbage collection is already in progress 1582 + * before the file count was incremented, then the lock/unlock pair will 1583 + * ensure that garbage collection is finished before progressing to 1584 + * installing the fd. 1585 + * 1586 + * (*) A -> B where B is on the queue of A or B is on the queue of C 1587 + * which is on the queue of listening socket A. 1588 + */ 1589 + spin_lock(&unix_gc_lock); 1590 + spin_unlock(&unix_gc_lock); 1591 + } 1592 + 1546 1593 static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) 1547 1594 { 1548 1595 int err = 0; ··· 2239 2192 sk_peek_offset_fwd(sk, size); 2240 2193 2241 2194 if (UNIXCB(skb).fp) 2242 - scm.fp = scm_fp_dup(UNIXCB(skb).fp); 2195 + unix_peek_fds(&scm, skb); 2243 2196 } 2244 2197 err = (flags & MSG_TRUNC) ? skb->len - skip : size; 2245 2198 ··· 2529 2482 /* It is questionable, see note in unix_dgram_recvmsg. 2530 2483 */ 2531 2484 if (UNIXCB(skb).fp) 2532 - scm.fp = scm_fp_dup(UNIXCB(skb).fp); 2485 + unix_peek_fds(&scm, skb); 2533 2486 2534 2487 sk_peek_offset_fwd(sk, chunk); 2535 2488
+4 -1
net/wireless/nl80211.c
··· 2351 2351 goto nla_put_failure; 2352 2352 2353 2353 for (band = state->band_start; 2354 - band < NUM_NL80211_BANDS; band++) { 2354 + band < (state->split ? 2355 + NUM_NL80211_BANDS : 2356 + NL80211_BAND_60GHZ + 1); 2357 + band++) { 2355 2358 struct ieee80211_supported_band *sband; 2356 2359 2357 2360 /* omit higher bands for ancient software */
+2 -4
net/wireless/scan.c
··· 1754 1754 * be grouped with this beacon for updates ... 1755 1755 */ 1756 1756 if (!cfg80211_combine_bsses(rdev, new)) { 1757 - kfree(new); 1757 + bss_ref_put(rdev, new); 1758 1758 goto drop; 1759 1759 } 1760 1760 } 1761 1761 1762 1762 if (rdev->bss_entries >= bss_entries_limit && 1763 1763 !cfg80211_bss_expire_oldest(rdev)) { 1764 - if (!list_empty(&new->hidden_list)) 1765 - list_del(&new->hidden_list); 1766 - kfree(new); 1764 + bss_ref_put(rdev, new); 1767 1765 goto drop; 1768 1766 } 1769 1767
+20 -7
sound/core/pcm_native.c
··· 246 246 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) 247 247 return false; 248 248 249 - if (substream->ops->mmap || 250 - (substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV && 251 - substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV_UC)) 249 + if (substream->ops->mmap) 252 250 return true; 253 251 254 - return dma_can_mmap(substream->dma_buffer.dev.dev); 252 + switch (substream->dma_buffer.dev.type) { 253 + case SNDRV_DMA_TYPE_UNKNOWN: 254 + return false; 255 + case SNDRV_DMA_TYPE_CONTINUOUS: 256 + case SNDRV_DMA_TYPE_VMALLOC: 257 + return true; 258 + default: 259 + return dma_can_mmap(substream->dma_buffer.dev.dev); 260 + } 255 261 } 256 262 257 263 static int constrain_mask_params(struct snd_pcm_substream *substream, ··· 3069 3063 boundary = 0x7fffffff; 3070 3064 snd_pcm_stream_lock_irq(substream); 3071 3065 /* FIXME: we should consider the boundary for the sync from app */ 3072 - if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) 3073 - control->appl_ptr = scontrol.appl_ptr; 3074 - else 3066 + if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) { 3067 + err = pcm_lib_apply_appl_ptr(substream, 3068 + scontrol.appl_ptr); 3069 + if (err < 0) { 3070 + snd_pcm_stream_unlock_irq(substream); 3071 + return err; 3072 + } 3073 + } else 3075 3074 scontrol.appl_ptr = control->appl_ptr % boundary; 3076 3075 if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) 3077 3076 control->avail_min = scontrol.avail_min; ··· 3675 3664 return VM_FAULT_SIGBUS; 3676 3665 if (substream->ops->page) 3677 3666 page = substream->ops->page(substream, offset); 3667 + else if (!snd_pcm_get_dma_buf(substream)) 3668 + page = virt_to_page(runtime->dma_area + offset); 3678 3669 else 3679 3670 page = snd_sgbuf_get_page(snd_pcm_get_dma_buf(substream), offset); 3680 3671 if (!page)
+4
sound/hda/intel-dsp-config.c
··· 319 319 .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, 320 320 .device = 0x4b55, 321 321 }, 322 + { 323 + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, 324 + .device = 0x4b58, 325 + }, 322 326 #endif 323 327 324 328 /* Alder Lake */
+4
sound/isa/sb/sb16_csp.c
··· 816 816 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); 817 817 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); 818 818 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); 819 + spin_unlock_irqrestore(&p->chip->mixer_lock, flags); 819 820 820 821 spin_lock(&p->chip->reg_lock); 821 822 set_mode_register(p->chip, 0xc0); /* c0 = STOP */ ··· 856 855 spin_unlock(&p->chip->reg_lock); 857 856 858 857 /* restore PCM volume */ 858 + spin_lock_irqsave(&p->chip->mixer_lock, flags); 859 859 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); 860 860 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); 861 861 spin_unlock_irqrestore(&p->chip->mixer_lock, flags); ··· 882 880 mixR = snd_sbmixer_read(p->chip, SB_DSP4_PCM_DEV + 1); 883 881 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL & 0x7); 884 882 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR & 0x7); 883 + spin_unlock_irqrestore(&p->chip->mixer_lock, flags); 885 884 886 885 spin_lock(&p->chip->reg_lock); 887 886 if (p->running & SNDRV_SB_CSP_ST_QSOUND) { ··· 897 894 spin_unlock(&p->chip->reg_lock); 898 895 899 896 /* restore PCM volume */ 897 + spin_lock_irqsave(&p->chip->mixer_lock, flags); 900 898 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV, mixL); 901 899 snd_sbmixer_write(p->chip, SB_DSP4_PCM_DEV + 1, mixR); 902 900 spin_unlock_irqrestore(&p->chip->mixer_lock, flags);
+2
sound/pci/hda/patch_hdmi.c
··· 1940 1940 static const struct snd_pci_quirk force_connect_list[] = { 1941 1941 SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1), 1942 1942 SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), 1943 + SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), 1944 + SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", 1), 1943 1945 {} 1944 1946 }; 1945 1947
+1
sound/pci/hda/patch_realtek.c
··· 8626 8626 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 8627 8627 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 8628 8628 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 8629 + SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340), 8629 8630 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), 8630 8631 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), 8631 8632 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
+5
sound/soc/amd/acp-da7219-max98357a.c
··· 576 576 | SND_SOC_DAIFMT_CBM_CFM, 577 577 .init = cz_rt5682_init, 578 578 .dpcm_playback = 1, 579 + .stop_dma_first = 1, 579 580 .ops = &cz_rt5682_play_ops, 580 581 SND_SOC_DAILINK_REG(designware1, rt5682, platform), 581 582 }, ··· 586 585 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 587 586 | SND_SOC_DAIFMT_CBM_CFM, 588 587 .dpcm_capture = 1, 588 + .stop_dma_first = 1, 589 589 .ops = &cz_rt5682_cap_ops, 590 590 SND_SOC_DAILINK_REG(designware2, rt5682, platform), 591 591 }, ··· 596 594 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 597 595 | SND_SOC_DAIFMT_CBM_CFM, 598 596 .dpcm_playback = 1, 597 + .stop_dma_first = 1, 599 598 .ops = &cz_rt5682_max_play_ops, 600 599 SND_SOC_DAILINK_REG(designware3, mx, platform), 601 600 }, ··· 607 604 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 608 605 | SND_SOC_DAIFMT_CBM_CFM, 609 606 .dpcm_capture = 1, 607 + .stop_dma_first = 1, 610 608 .ops = &cz_rt5682_dmic0_cap_ops, 611 609 SND_SOC_DAILINK_REG(designware3, adau, platform), 612 610 }, ··· 618 614 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 619 615 | SND_SOC_DAIFMT_CBM_CFM, 620 616 .dpcm_capture = 1, 617 + .stop_dma_first = 1, 621 618 .ops = &cz_rt5682_dmic1_cap_ops, 622 619 SND_SOC_DAILINK_REG(designware2, adau, platform), 623 620 },
+2 -6
sound/soc/codecs/Kconfig
··· 1325 1325 high-efficiency mono Class-D audio power amplifiers. 1326 1326 1327 1327 config SND_SOC_SSM2518 1328 - tristate 1328 + tristate "Analog Devices SSM2518 Class-D Amplifier" 1329 1329 depends on I2C 1330 1330 1331 1331 config SND_SOC_SSM2602 ··· 1557 1557 Qualcomm SoCs like SDM845. 1558 1558 1559 1559 config SND_SOC_WCD938X 1560 + depends on SND_SOC_WCD938X_SDW 1560 1561 tristate 1561 1562 1562 1563 config SND_SOC_WCD938X_SDW ··· 1813 1812 Support for ZL38060 Connected Home Audio Processor from Microsemi, 1814 1813 which consists of a Digital Signal Processor (DSP), several Digital 1815 1814 Audio Interfaces (DAIs), analog outputs, and a block of 14 GPIOs. 1816 - 1817 - config SND_SOC_ZX_AUD96P22 1818 - tristate "ZTE ZX AUD96P22 CODEC" 1819 - depends on I2C 1820 - select REGMAP_I2C 1821 1815 1822 1816 # Amp 1823 1817 config SND_SOC_LM4857
+2
sound/soc/codecs/rt5631.c
··· 1695 1695 .reg_defaults = rt5631_reg, 1696 1696 .num_reg_defaults = ARRAY_SIZE(rt5631_reg), 1697 1697 .cache_type = REGCACHE_RBTREE, 1698 + .use_single_read = true, 1699 + .use_single_write = true, 1698 1700 }; 1699 1701 1700 1702 static int rt5631_i2c_probe(struct i2c_client *i2c,
+6 -2
sound/soc/codecs/rt5682.c
··· 973 973 rt5682_enable_push_button_irq(component, false); 974 974 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, 975 975 RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW); 976 - if (!snd_soc_dapm_get_pin_status(dapm, "MICBIAS")) 976 + if (!snd_soc_dapm_get_pin_status(dapm, "MICBIAS") && 977 + !snd_soc_dapm_get_pin_status(dapm, "PLL1") && 978 + !snd_soc_dapm_get_pin_status(dapm, "PLL2B")) 977 979 snd_soc_component_update_bits(component, 978 980 RT5682_PWR_ANLG_1, RT5682_PWR_MB, 0); 979 - if (!snd_soc_dapm_get_pin_status(dapm, "Vref2")) 981 + if (!snd_soc_dapm_get_pin_status(dapm, "Vref2") && 982 + !snd_soc_dapm_get_pin_status(dapm, "PLL1") && 983 + !snd_soc_dapm_get_pin_status(dapm, "PLL2B")) 980 984 snd_soc_component_update_bits(component, 981 985 RT5682_PWR_ANLG_1, RT5682_PWR_VREF2, 0); 982 986 snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
+2
sound/soc/codecs/tlv320aic31xx.c
··· 1604 1604 ret); 1605 1605 return ret; 1606 1606 } 1607 + regcache_cache_only(aic31xx->regmap, true); 1608 + 1607 1609 aic31xx->dev = &i2c->dev; 1608 1610 aic31xx->irq = i2c->irq; 1609 1611
+2 -2
sound/soc/codecs/tlv320aic31xx.h
··· 151 151 #define AIC31XX_WORD_LEN_24BITS 0x02 152 152 #define AIC31XX_WORD_LEN_32BITS 0x03 153 153 #define AIC31XX_IFACE1_MASTER_MASK GENMASK(3, 2) 154 - #define AIC31XX_BCLK_MASTER BIT(2) 155 - #define AIC31XX_WCLK_MASTER BIT(3) 154 + #define AIC31XX_BCLK_MASTER BIT(3) 155 + #define AIC31XX_WCLK_MASTER BIT(2) 156 156 157 157 /* AIC31XX_DATA_OFFSET */ 158 158 #define AIC31XX_DATA_OFFSET_MASK GENMASK(7, 0)
+13 -14
sound/soc/codecs/tlv320aic32x4.c
··· 250 250 static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0); 251 251 /* -12dB min, 0.5dB steps */ 252 252 static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0); 253 - 254 - static DECLARE_TLV_DB_LINEAR(tlv_spk_vol, TLV_DB_GAIN_MUTE, 0); 253 + /* -6dB min, 1dB steps */ 254 + static DECLARE_TLV_DB_SCALE(tlv_tas_driver_gain, -5850, 50, 0); 255 255 static DECLARE_TLV_DB_SCALE(tlv_amp_vol, 0, 600, 1); 256 256 257 257 static const char * const lo_cm_text[] = { ··· 1063 1063 }; 1064 1064 1065 1065 static const struct snd_kcontrol_new aic32x4_tas2505_snd_controls[] = { 1066 - SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL, 1067 - AIC32X4_LDACVOL, 0, -0x7f, 0x30, 7, 0, tlv_pcm), 1066 + SOC_SINGLE_S8_TLV("PCM Playback Volume", 1067 + AIC32X4_LDACVOL, -0x7f, 0x30, tlv_pcm), 1068 1068 SOC_ENUM("DAC Playback PowerTune Switch", l_ptm_enum), 1069 - SOC_DOUBLE_R_S_TLV("HP Driver Playback Volume", AIC32X4_HPLGAIN, 1070 - AIC32X4_HPLGAIN, 0, -0x6, 0x1d, 5, 0, 1071 - tlv_driver_gain), 1072 - SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN, 1073 - AIC32X4_HPLGAIN, 6, 0x01, 1), 1069 + 1070 + SOC_SINGLE_TLV("HP Driver Gain Volume", 1071 + AIC32X4_HPLGAIN, 0, 0x74, 1, tlv_tas_driver_gain), 1072 + SOC_SINGLE("HP DAC Playback Switch", AIC32X4_HPLGAIN, 6, 1, 1), 1073 + 1074 + SOC_SINGLE_TLV("Speaker Driver Playback Volume", 1075 + TAS2505_SPKVOL1, 0, 0x74, 1, tlv_tas_driver_gain), 1076 + SOC_SINGLE_TLV("Speaker Amplifier Playback Volume", 1077 + TAS2505_SPKVOL2, 4, 5, 0, tlv_amp_vol), 1074 1078 1075 1079 SOC_SINGLE("Auto-mute Switch", AIC32X4_DACMUTE, 4, 7, 0), 1076 - 1077 - SOC_SINGLE_RANGE_TLV("Speaker Driver Playback Volume", TAS2505_SPKVOL1, 1078 - 0, 0, 117, 1, tlv_spk_vol), 1079 - SOC_SINGLE_TLV("Speaker Amplifier Playback Volume", TAS2505_SPKVOL2, 1080 - 4, 5, 0, tlv_amp_vol), 1081 1080 }; 1082 1081 1083 1082 static const struct snd_kcontrol_new hp_output_mixer_controls[] = {
+9 -9
sound/soc/codecs/wcd938x.c
··· 3317 3317 (WCD938X_DIGITAL_INTR_LEVEL_0 + i), 0); 3318 3318 } 3319 3319 3320 - ret = wcd938x_irq_init(wcd938x, component->dev); 3321 - if (ret) { 3322 - dev_err(component->dev, "%s: IRQ init failed: %d\n", 3323 - __func__, ret); 3324 - return ret; 3325 - } 3326 - 3327 3320 wcd938x->hphr_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip, 3328 3321 WCD938X_IRQ_HPHR_PDM_WD_INT); 3329 3322 wcd938x->hphl_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip, ··· 3546 3553 } 3547 3554 wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev); 3548 3555 wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x; 3549 - wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq; 3550 3556 3551 3557 wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode); 3552 3558 if (!wcd938x->txdev) { ··· 3554 3562 } 3555 3563 wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev); 3556 3564 wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x; 3557 - wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq; 3558 3565 wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev); 3559 3566 if (!wcd938x->tx_sdw_dev) { 3560 3567 dev_err(dev, "could not get txslave with matching of dev\n"); ··· 3585 3594 dev_err(dev, "%s: tx csr regmap not found\n", __func__); 3586 3595 return PTR_ERR(wcd938x->regmap); 3587 3596 } 3597 + 3598 + ret = wcd938x_irq_init(wcd938x, dev); 3599 + if (ret) { 3600 + dev_err(dev, "%s: IRQ init failed: %d\n", __func__, ret); 3601 + return ret; 3602 + } 3603 + 3604 + wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq; 3605 + wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq; 3588 3606 3589 3607 ret = wcd938x_set_micbias_data(wcd938x); 3590 3608 if (ret < 0) {
+4 -2
sound/soc/codecs/wm_adsp.c
··· 282 282 /* 283 283 * HALO_CCM_CORE_CONTROL 284 284 */ 285 + #define HALO_CORE_RESET 0x00000200 285 286 #define HALO_CORE_EN 0x00000001 286 287 287 288 /* ··· 1214 1213 1215 1214 mutex_lock(&ctl->dsp->pwr_lock); 1216 1215 1217 - ret = wm_coeff_read_ctrl_raw(ctl, ctl->cache, size); 1216 + ret = wm_coeff_read_ctrl(ctl, ctl->cache, size); 1218 1217 1219 1218 if (!ret && copy_to_user(bytes, ctl->cache, size)) 1220 1219 ret = -EFAULT; ··· 3334 3333 { 3335 3334 return regmap_update_bits(dsp->regmap, 3336 3335 dsp->base + HALO_CCM_CORE_CONTROL, 3337 - HALO_CORE_EN, HALO_CORE_EN); 3336 + HALO_CORE_RESET | HALO_CORE_EN, 3337 + HALO_CORE_RESET | HALO_CORE_EN); 3338 3338 } 3339 3339 3340 3340 static void wm_halo_stop_core(struct wm_adsp *dsp)
+51 -26
sound/soc/intel/boards/sof_sdw_max98373.c
··· 55 55 return ret; 56 56 } 57 57 58 - static int max98373_sdw_trigger(struct snd_pcm_substream *substream, int cmd) 58 + static int mx8373_enable_spk_pin(struct snd_pcm_substream *substream, bool enable) 59 59 { 60 + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 61 + struct snd_soc_dai *codec_dai; 62 + struct snd_soc_dai *cpu_dai; 60 63 int ret; 64 + int j; 61 65 62 - switch (cmd) { 63 - case SNDRV_PCM_TRIGGER_START: 64 - case SNDRV_PCM_TRIGGER_RESUME: 65 - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 66 - /* enable max98373 first */ 67 - ret = max_98373_trigger(substream, cmd); 68 - if (ret < 0) 69 - break; 66 + /* set spk pin by playback only */ 67 + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 68 + return 0; 70 69 71 - ret = sdw_trigger(substream, cmd); 72 - break; 73 - case SNDRV_PCM_TRIGGER_STOP: 74 - case SNDRV_PCM_TRIGGER_SUSPEND: 75 - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 76 - ret = sdw_trigger(substream, cmd); 77 - if (ret < 0) 78 - break; 70 + cpu_dai = asoc_rtd_to_cpu(rtd, 0); 71 + for_each_rtd_codec_dais(rtd, j, codec_dai) { 72 + struct snd_soc_dapm_context *dapm = 73 + snd_soc_component_get_dapm(cpu_dai->component); 74 + char pin_name[16]; 79 75 80 - ret = max_98373_trigger(substream, cmd); 81 - break; 82 - default: 83 - ret = -EINVAL; 84 - break; 76 + snprintf(pin_name, ARRAY_SIZE(pin_name), "%s Spk", 77 + codec_dai->component->name_prefix); 78 + 79 + if (enable) 80 + ret = snd_soc_dapm_enable_pin(dapm, pin_name); 81 + else 82 + ret = snd_soc_dapm_disable_pin(dapm, pin_name); 83 + 84 + if (!ret) 85 + snd_soc_dapm_sync(dapm); 85 86 } 86 87 87 - return ret; 88 + return 0; 89 + } 90 + 91 + static int mx8373_sdw_prepare(struct snd_pcm_substream *substream) 92 + { 93 + int ret = 0; 94 + 95 + /* according to soc_pcm_prepare dai link prepare is called first */ 96 + ret = sdw_prepare(substream); 97 + if (ret < 0) 98 + return ret; 99 + 100 + return mx8373_enable_spk_pin(substream, true); 101 + } 102 + 103 + static int mx8373_sdw_hw_free(struct snd_pcm_substream *substream) 104 + { 105 + int ret = 0; 106 + 107 + /* according to soc_pcm_hw_free dai link free is called first */ 108 + ret = sdw_hw_free(substream); 109 + if (ret < 0) 110 + return ret; 111 + 112 + return mx8373_enable_spk_pin(substream, false); 88 113 } 89 114 90 115 static const struct snd_soc_ops max_98373_sdw_ops = { 91 116 .startup = sdw_startup, 92 - .prepare = sdw_prepare, 93 - .trigger = max98373_sdw_trigger, 94 - .hw_free = sdw_hw_free, 117 + .prepare = mx8373_sdw_prepare, 118 + .trigger = sdw_trigger, 119 + .hw_free = mx8373_sdw_hw_free, 95 120 .shutdown = sdw_shutdown, 96 121 }; 97 122
+16 -6
sound/soc/soc-pcm.c
··· 1015 1015 1016 1016 static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) 1017 1017 { 1018 + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 1018 1019 int ret = -EINVAL, _ret = 0; 1019 1020 int rollback = 0; 1020 1021 ··· 1056 1055 case SNDRV_PCM_TRIGGER_STOP: 1057 1056 case SNDRV_PCM_TRIGGER_SUSPEND: 1058 1057 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1059 - ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); 1060 - if (ret < 0) 1061 - break; 1058 + if (rtd->dai_link->stop_dma_first) { 1059 + ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); 1060 + if (ret < 0) 1061 + break; 1062 1062 1063 - ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); 1064 - if (ret < 0) 1065 - break; 1063 + ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); 1064 + if (ret < 0) 1065 + break; 1066 + } else { 1067 + ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback); 1068 + if (ret < 0) 1069 + break; 1066 1070 1071 + ret = snd_soc_pcm_component_trigger(substream, cmd, rollback); 1072 + if (ret < 0) 1073 + break; 1074 + } 1067 1075 ret = snd_soc_link_trigger(substream, cmd, rollback); 1068 1076 break; 1069 1077 }
+1
sound/soc/sof/intel/pci-tgl.c
··· 89 89 static const struct sof_dev_desc adl_desc = { 90 90 .machines = snd_soc_acpi_intel_adl_machines, 91 91 .alt_machines = snd_soc_acpi_intel_adl_sdw_machines, 92 + .use_acpi_target_states = true, 92 93 .resindex_lpe_base = 0, 93 94 .resindex_pcicfg_base = -1, 94 95 .resindex_imr_base = -1,
+18 -12
sound/soc/tegra/tegra_pcm.c
··· 213 213 } 214 214 EXPORT_SYMBOL_GPL(tegra_pcm_pointer); 215 215 216 - static int tegra_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream, 216 + static int tegra_pcm_preallocate_dma_buffer(struct device *dev, struct snd_pcm *pcm, int stream, 217 217 size_t size) 218 218 { 219 219 struct snd_pcm_substream *substream = pcm->streams[stream].substream; 220 220 struct snd_dma_buffer *buf = &substream->dma_buffer; 221 221 222 - buf->area = dma_alloc_wc(pcm->card->dev, size, &buf->addr, GFP_KERNEL); 222 + buf->area = dma_alloc_wc(dev, size, &buf->addr, GFP_KERNEL); 223 223 if (!buf->area) 224 224 return -ENOMEM; 225 225 226 226 buf->private_data = NULL; 227 227 buf->dev.type = SNDRV_DMA_TYPE_DEV; 228 - buf->dev.dev = pcm->card->dev; 228 + buf->dev.dev = dev; 229 229 buf->bytes = size; 230 230 231 231 return 0; ··· 244 244 if (!buf->area) 245 245 return; 246 246 247 - dma_free_wc(pcm->card->dev, buf->bytes, buf->area, buf->addr); 247 + dma_free_wc(buf->dev.dev, buf->bytes, buf->area, buf->addr); 248 248 buf->area = NULL; 249 249 } 250 250 251 - static int tegra_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd, 251 + static int tegra_pcm_dma_allocate(struct device *dev, struct snd_soc_pcm_runtime *rtd, 252 252 size_t size) 253 253 { 254 - struct snd_card *card = rtd->card->snd_card; 255 254 struct snd_pcm *pcm = rtd->pcm; 256 255 int ret; 257 256 258 - ret = dma_set_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); 257 + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); 259 258 if (ret < 0) 260 259 return ret; 261 260 262 261 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 263 - ret = tegra_pcm_preallocate_dma_buffer(pcm, 264 - SNDRV_PCM_STREAM_PLAYBACK, size); 262 + ret = tegra_pcm_preallocate_dma_buffer(dev, pcm, SNDRV_PCM_STREAM_PLAYBACK, size); 265 263 if (ret) 266 264 goto err; 267 265 } 268 266 269 267 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 270 - ret = tegra_pcm_preallocate_dma_buffer(pcm, 271 - SNDRV_PCM_STREAM_CAPTURE, size); 268 + ret = tegra_pcm_preallocate_dma_buffer(dev, pcm, SNDRV_PCM_STREAM_CAPTURE, size); 272 269 if (ret) 273 270 goto err_free_play; 274 271 } ··· 281 284 int tegra_pcm_construct(struct snd_soc_component *component, 282 285 struct snd_soc_pcm_runtime *rtd) 283 286 { 284 - return tegra_pcm_dma_allocate(rtd, tegra_pcm_hardware.buffer_bytes_max); 287 + struct device *dev = component->dev; 288 + 289 + /* 290 + * Fallback for backwards-compatibility with older device trees that 291 + * have the iommus property in the virtual, top-level "sound" node. 292 + */ 293 + if (!of_get_property(dev->of_node, "iommus", NULL)) 294 + dev = rtd->card->snd_card->dev; 295 + 296 + return tegra_pcm_dma_allocate(dev, rtd, tegra_pcm_hardware.buffer_bytes_max); 285 297 } 286 298 EXPORT_SYMBOL_GPL(tegra_pcm_construct); 287 299
+12 -6
sound/soc/ti/j721e-evm.c
··· 197 197 return ret; 198 198 } 199 199 200 - if (priv->hsdiv_rates[domain->parent_clk_id] != scki) { 200 + if (domain->parent_clk_id == -1 || priv->hsdiv_rates[domain->parent_clk_id] != scki) { 201 201 dev_dbg(priv->dev, 202 202 "%s configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n", 203 203 audio_domain == J721E_AUDIO_DOMAIN_CPB ? "CPB" : "IVI", ··· 278 278 j721e_rule_rate, &priv->rate_range, 279 279 SNDRV_PCM_HW_PARAM_RATE, -1); 280 280 281 - mutex_unlock(&priv->mutex); 282 281 283 282 if (ret) 284 - return ret; 283 + goto out; 285 284 286 285 /* Reset TDM slots to 32 */ 287 286 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, 32); 288 287 if (ret && ret != -ENOTSUPP) 289 - return ret; 288 + goto out; 290 289 291 290 for_each_rtd_codec_dais(rtd, i, codec_dai) { 292 291 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 2, 32); 293 292 if (ret && ret != -ENOTSUPP) 294 - return ret; 293 + goto out; 295 294 } 296 295 297 - return 0; 296 + if (ret == -ENOTSUPP) 297 + ret = 0; 298 + out: 299 + if (ret) 300 + domain->active--; 301 + mutex_unlock(&priv->mutex); 302 + 303 + return ret; 298 304 } 299 305 300 306 static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
+9 -1
sound/usb/mixer.c
··· 3295 3295 { 3296 3296 struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); 3297 3297 static const char * const val_types[] = { 3298 - "BOOLEAN", "INV_BOOLEAN", "S8", "U8", "S16", "U16", "S32", "U32", 3298 + [USB_MIXER_BOOLEAN] = "BOOLEAN", 3299 + [USB_MIXER_INV_BOOLEAN] = "INV_BOOLEAN", 3300 + [USB_MIXER_S8] = "S8", 3301 + [USB_MIXER_U8] = "U8", 3302 + [USB_MIXER_S16] = "S16", 3303 + [USB_MIXER_U16] = "U16", 3304 + [USB_MIXER_S32] = "S32", 3305 + [USB_MIXER_U32] = "U32", 3306 + [USB_MIXER_BESPOKEN] = "BESPOKEN", 3299 3307 }; 3300 3308 snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " 3301 3309 "channels=%i, type=\"%s\"\n", cval->head.id,
+3
sound/usb/quirks.c
··· 1897 1897 REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ 1898 1898 REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ 1899 1899 REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ 1900 + REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ 1901 + REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ 1902 + REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ 1900 1903 { 0 } /* terminator */ 1901 1904 }; 1902 1905
+229
tools/testing/selftests/bpf/verifier/value_ptr_arith.c
··· 1 1 { 2 + "map access: known scalar += value_ptr unknown vs const", 3 + .insns = { 4 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 5 + offsetof(struct __sk_buff, len)), 6 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 7 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 8 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 9 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 10 + BPF_LD_MAP_FD(BPF_REG_1, 0), 11 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 12 + BPF_LD_MAP_FD(BPF_REG_1, 0), 13 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 14 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9), 15 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 16 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4), 17 + BPF_MOV64_IMM(BPF_REG_1, 6), 18 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 19 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7), 20 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 21 + BPF_MOV64_IMM(BPF_REG_1, 3), 22 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 23 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 24 + BPF_MOV64_IMM(BPF_REG_0, 1), 25 + BPF_EXIT_INSN(), 26 + }, 27 + .fixup_map_hash_16b = { 5 }, 28 + .fixup_map_array_48b = { 8 }, 29 + .result_unpriv = REJECT, 30 + .errstr_unpriv = "R1 tried to add from different maps, paths or scalars", 31 + .result = ACCEPT, 32 + .retval = 1, 33 + }, 34 + { 35 + "map access: known scalar += value_ptr const vs unknown", 36 + .insns = { 37 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 38 + offsetof(struct __sk_buff, len)), 39 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 40 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 41 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 42 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 43 + BPF_LD_MAP_FD(BPF_REG_1, 0), 44 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 45 + BPF_LD_MAP_FD(BPF_REG_1, 0), 46 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 47 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9), 48 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 49 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 2), 50 + BPF_MOV64_IMM(BPF_REG_1, 3), 51 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 52 + BPF_MOV64_IMM(BPF_REG_1, 6), 53 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 54 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7), 55 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 56 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 57 + BPF_MOV64_IMM(BPF_REG_0, 1), 58 + BPF_EXIT_INSN(), 59 + }, 60 + .fixup_map_hash_16b = { 5 }, 61 + .fixup_map_array_48b = { 8 }, 62 + .result_unpriv = REJECT, 63 + .errstr_unpriv = "R1 tried to add from different maps, paths or scalars", 64 + .result = ACCEPT, 65 + .retval = 1, 66 + }, 67 + { 68 + "map access: known scalar += value_ptr const vs const (ne)", 69 + .insns = { 70 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 71 + offsetof(struct __sk_buff, len)), 72 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 73 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 74 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 75 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 76 + BPF_LD_MAP_FD(BPF_REG_1, 0), 77 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 78 + BPF_LD_MAP_FD(BPF_REG_1, 0), 79 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 80 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7), 81 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 82 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 2), 83 + BPF_MOV64_IMM(BPF_REG_1, 3), 84 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 85 + BPF_MOV64_IMM(BPF_REG_1, 5), 86 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 87 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 88 + BPF_MOV64_IMM(BPF_REG_0, 1), 89 + BPF_EXIT_INSN(), 90 + }, 91 + .fixup_map_hash_16b = { 5 }, 92 + .fixup_map_array_48b = { 8 }, 93 + .result_unpriv = REJECT, 94 + .errstr_unpriv = "R1 tried to add from different maps, paths or scalars", 95 + .result = ACCEPT, 96 + .retval = 1, 97 + }, 98 + { 99 + "map access: known scalar += value_ptr const vs const (eq)", 100 + .insns = { 101 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 102 + offsetof(struct __sk_buff, len)), 103 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 104 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 105 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 106 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 107 + BPF_LD_MAP_FD(BPF_REG_1, 0), 108 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 109 + BPF_LD_MAP_FD(BPF_REG_1, 0), 110 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 111 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7), 112 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 113 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 2), 114 + BPF_MOV64_IMM(BPF_REG_1, 5), 115 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 116 + BPF_MOV64_IMM(BPF_REG_1, 5), 117 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 118 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 119 + BPF_MOV64_IMM(BPF_REG_0, 1), 120 + BPF_EXIT_INSN(), 121 + }, 122 + .fixup_map_hash_16b = { 5 }, 123 + .fixup_map_array_48b = { 8 }, 124 + .result = ACCEPT, 125 + .retval = 1, 126 + }, 127 + { 128 + "map access: known scalar += value_ptr unknown vs unknown (eq)", 129 + .insns = { 130 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 131 + offsetof(struct __sk_buff, len)), 132 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 133 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 134 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 135 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 136 + BPF_LD_MAP_FD(BPF_REG_1, 0), 137 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 138 + BPF_LD_MAP_FD(BPF_REG_1, 0), 139 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 140 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 11), 141 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 142 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4), 143 + BPF_MOV64_IMM(BPF_REG_1, 6), 144 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 145 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7), 146 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 147 + BPF_MOV64_IMM(BPF_REG_1, 6), 148 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 149 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7), 150 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 151 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 152 + BPF_MOV64_IMM(BPF_REG_0, 1), 153 + BPF_EXIT_INSN(), 154 + }, 155 + .fixup_map_hash_16b = { 5 }, 156 + .fixup_map_array_48b = { 8 }, 157 + .result = ACCEPT, 158 + .retval = 1, 159 + }, 160 + { 161 + "map access: known scalar += value_ptr unknown vs unknown (lt)", 162 + .insns = { 163 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 164 + offsetof(struct __sk_buff, len)), 165 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 166 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 167 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 168 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 169 + BPF_LD_MAP_FD(BPF_REG_1, 0), 170 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 171 + BPF_LD_MAP_FD(BPF_REG_1, 0), 172 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 173 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 11), 174 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 175 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4), 176 + BPF_MOV64_IMM(BPF_REG_1, 6), 177 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 178 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x3), 179 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 180 + BPF_MOV64_IMM(BPF_REG_1, 6), 181 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 182 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7), 183 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 184 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 185 + BPF_MOV64_IMM(BPF_REG_0, 1), 186 + BPF_EXIT_INSN(), 187 + }, 188 + .fixup_map_hash_16b = { 5 }, 189 + .fixup_map_array_48b = { 8 }, 190 + .result_unpriv = REJECT, 191 + .errstr_unpriv = "R1 tried to add from different maps, paths or scalars", 192 + .result = ACCEPT, 193 + .retval = 1, 194 + }, 195 + { 196 + "map access: known scalar += value_ptr unknown vs unknown (gt)", 197 + .insns = { 198 + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 199 + offsetof(struct __sk_buff, len)), 200 + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), 201 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), 202 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), 203 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3), 204 + BPF_LD_MAP_FD(BPF_REG_1, 0), 205 + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2), 206 + BPF_LD_MAP_FD(BPF_REG_1, 0), 207 + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), 208 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 11), 209 + BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0), 210 + BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4), 211 + BPF_MOV64_IMM(BPF_REG_1, 6), 212 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 213 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7), 214 + BPF_JMP_IMM(BPF_JA, 0, 0, 3), 215 + BPF_MOV64_IMM(BPF_REG_1, 6), 216 + BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0), 217 + BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x3), 218 + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0), 219 + BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0), 220 + BPF_MOV64_IMM(BPF_REG_0, 1), 221 + BPF_EXIT_INSN(), 222 + }, 223 + .fixup_map_hash_16b = { 5 }, 224 + .fixup_map_array_48b = { 8 }, 225 + .result_unpriv = REJECT, 226 + .errstr_unpriv = "R1 tried to add from different maps, paths or scalars", 227 + .result = ACCEPT, 228 + .retval = 1, 229 + }, 230 + { 2 231 "map access: known scalar += value_ptr from different maps", 3 232 .insns = { 4 233 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
+1
tools/testing/selftests/kvm/.gitignore
··· 38 38 /x86_64/xen_vmcall_test 39 39 /x86_64/xss_msr_test 40 40 /x86_64/vmx_pmu_msrs_test 41 + /access_tracking_perf_test 41 42 /demand_paging_test 42 43 /dirty_log_test 43 44 /dirty_log_perf_test
+1
tools/testing/selftests/kvm/Makefile
··· 71 71 TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_msrs_test 72 72 TEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test 73 73 TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test 74 + TEST_GEN_PROGS_x86_64 += access_tracking_perf_test 74 75 TEST_GEN_PROGS_x86_64 += demand_paging_test 75 76 TEST_GEN_PROGS_x86_64 += dirty_log_test 76 77 TEST_GEN_PROGS_x86_64 += dirty_log_perf_test
+2 -1
tools/testing/selftests/kvm/aarch64/get-reg-list.c
··· 1019 1019 #define VREGS_SUBLIST \ 1020 1020 { "vregs", .regs = vregs, .regs_n = ARRAY_SIZE(vregs), } 1021 1021 #define PMU_SUBLIST \ 1022 - { "pmu", .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), } 1022 + { "pmu", .capability = KVM_CAP_ARM_PMU_V3, .feature = KVM_ARM_VCPU_PMU_V3, \ 1023 + .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), } 1023 1024 #define SVE_SUBLIST \ 1024 1025 { "sve", .capability = KVM_CAP_ARM_SVE, .feature = KVM_ARM_VCPU_SVE, .finalize = true, \ 1025 1026 .regs = sve_regs, .regs_n = ARRAY_SIZE(sve_regs), \
+429
tools/testing/selftests/kvm/access_tracking_perf_test.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * access_tracking_perf_test 4 + * 5 + * Copyright (C) 2021, Google, Inc. 6 + * 7 + * This test measures the performance effects of KVM's access tracking. 8 + * Access tracking is driven by the MMU notifiers test_young, clear_young, and 9 + * clear_flush_young. These notifiers do not have a direct userspace API, 10 + * however the clear_young notifier can be triggered by marking a pages as idle 11 + * in /sys/kernel/mm/page_idle/bitmap. This test leverages that mechanism to 12 + * enable access tracking on guest memory. 13 + * 14 + * To measure performance this test runs a VM with a configurable number of 15 + * vCPUs that each touch every page in disjoint regions of memory. Performance 16 + * is measured in the time it takes all vCPUs to finish touching their 17 + * predefined region. 18 + * 19 + * Note that a deterministic correctness test of access tracking is not possible 20 + * by using page_idle as it exists today. This is for a few reasons: 21 + * 22 + * 1. page_idle only issues clear_young notifiers, which lack a TLB flush. This 23 + * means subsequent guest accesses are not guaranteed to see page table 24 + * updates made by KVM until some time in the future. 25 + * 26 + * 2. page_idle only operates on LRU pages. Newly allocated pages are not 27 + * immediately allocated to LRU lists. Instead they are held in a "pagevec", 28 + * which is drained to LRU lists some time in the future. There is no 29 + * userspace API to force this drain to occur. 30 + * 31 + * These limitations are worked around in this test by using a large enough 32 + * region of memory for each vCPU such that the number of translations cached in 33 + * the TLB and the number of pages held in pagevecs are a small fraction of the 34 + * overall workload. And if either of those conditions are not true this test 35 + * will fail rather than silently passing. 36 + */ 37 + #include <inttypes.h> 38 + #include <limits.h> 39 + #include <pthread.h> 40 + #include <sys/mman.h> 41 + #include <sys/types.h> 42 + #include <sys/stat.h> 43 + 44 + #include "kvm_util.h" 45 + #include "test_util.h" 46 + #include "perf_test_util.h" 47 + #include "guest_modes.h" 48 + 49 + /* Global variable used to synchronize all of the vCPU threads. */ 50 + static int iteration = -1; 51 + 52 + /* Defines what vCPU threads should do during a given iteration. */ 53 + static enum { 54 + /* Run the vCPU to access all its memory. */ 55 + ITERATION_ACCESS_MEMORY, 56 + /* Mark the vCPU's memory idle in page_idle. */ 57 + ITERATION_MARK_IDLE, 58 + } iteration_work; 59 + 60 + /* Set to true when vCPU threads should exit. */ 61 + static bool done; 62 + 63 + /* The iteration that was last completed by each vCPU. */ 64 + static int vcpu_last_completed_iteration[KVM_MAX_VCPUS]; 65 + 66 + /* Whether to overlap the regions of memory vCPUs access. */ 67 + static bool overlap_memory_access; 68 + 69 + struct test_params { 70 + /* The backing source for the region of memory. */ 71 + enum vm_mem_backing_src_type backing_src; 72 + 73 + /* The amount of memory to allocate for each vCPU. */ 74 + uint64_t vcpu_memory_bytes; 75 + 76 + /* The number of vCPUs to create in the VM. */ 77 + int vcpus; 78 + }; 79 + 80 + static uint64_t pread_uint64(int fd, const char *filename, uint64_t index) 81 + { 82 + uint64_t value; 83 + off_t offset = index * sizeof(value); 84 + 85 + TEST_ASSERT(pread(fd, &value, sizeof(value), offset) == sizeof(value), 86 + "pread from %s offset 0x%" PRIx64 " failed!", 87 + filename, offset); 88 + 89 + return value; 90 + 91 + } 92 + 93 + #define PAGEMAP_PRESENT (1ULL << 63) 94 + #define PAGEMAP_PFN_MASK ((1ULL << 55) - 1) 95 + 96 + static uint64_t lookup_pfn(int pagemap_fd, struct kvm_vm *vm, uint64_t gva) 97 + { 98 + uint64_t hva = (uint64_t) addr_gva2hva(vm, gva); 99 + uint64_t entry; 100 + uint64_t pfn; 101 + 102 + entry = pread_uint64(pagemap_fd, "pagemap", hva / getpagesize()); 103 + if (!(entry & PAGEMAP_PRESENT)) 104 + return 0; 105 + 106 + pfn = entry & PAGEMAP_PFN_MASK; 107 + if (!pfn) { 108 + print_skip("Looking up PFNs requires CAP_SYS_ADMIN"); 109 + exit(KSFT_SKIP); 110 + } 111 + 112 + return pfn; 113 + } 114 + 115 + static bool is_page_idle(int page_idle_fd, uint64_t pfn) 116 + { 117 + uint64_t bits = pread_uint64(page_idle_fd, "page_idle", pfn / 64); 118 + 119 + return !!((bits >> (pfn % 64)) & 1); 120 + } 121 + 122 + static void mark_page_idle(int page_idle_fd, uint64_t pfn) 123 + { 124 + uint64_t bits = 1ULL << (pfn % 64); 125 + 126 + TEST_ASSERT(pwrite(page_idle_fd, &bits, 8, 8 * (pfn / 64)) == 8, 127 + "Set page_idle bits for PFN 0x%" PRIx64, pfn); 128 + } 129 + 130 + static void mark_vcpu_memory_idle(struct kvm_vm *vm, int vcpu_id) 131 + { 132 + uint64_t base_gva = perf_test_args.vcpu_args[vcpu_id].gva; 133 + uint64_t pages = perf_test_args.vcpu_args[vcpu_id].pages; 134 + uint64_t page; 135 + uint64_t still_idle = 0; 136 + uint64_t no_pfn = 0; 137 + int page_idle_fd; 138 + int pagemap_fd; 139 + 140 + /* If vCPUs are using an overlapping region, let vCPU 0 mark it idle. */ 141 + if (overlap_memory_access && vcpu_id) 142 + return; 143 + 144 + page_idle_fd = open("/sys/kernel/mm/page_idle/bitmap", O_RDWR); 145 + TEST_ASSERT(page_idle_fd > 0, "Failed to open page_idle."); 146 + 147 + pagemap_fd = open("/proc/self/pagemap", O_RDONLY); 148 + TEST_ASSERT(pagemap_fd > 0, "Failed to open pagemap."); 149 + 150 + for (page = 0; page < pages; page++) { 151 + uint64_t gva = base_gva + page * perf_test_args.guest_page_size; 152 + uint64_t pfn = lookup_pfn(pagemap_fd, vm, gva); 153 + 154 + if (!pfn) { 155 + no_pfn++; 156 + continue; 157 + } 158 + 159 + if (is_page_idle(page_idle_fd, pfn)) { 160 + still_idle++; 161 + continue; 162 + } 163 + 164 + mark_page_idle(page_idle_fd, pfn); 165 + } 166 + 167 + /* 168 + * Assumption: Less than 1% of pages are going to be swapped out from 169 + * under us during this test. 170 + */ 171 + TEST_ASSERT(no_pfn < pages / 100, 172 + "vCPU %d: No PFN for %" PRIu64 " out of %" PRIu64 " pages.", 173 + vcpu_id, no_pfn, pages); 174 + 175 + /* 176 + * Test that at least 90% of memory has been marked idle (the rest might 177 + * not be marked idle because the pages have not yet made it to an LRU 178 + * list or the translations are still cached in the TLB). 90% is 179 + * arbitrary; high enough that we ensure most memory access went through 180 + * access tracking but low enough as to not make the test too brittle 181 + * over time and across architectures. 182 + */ 183 + TEST_ASSERT(still_idle < pages / 10, 184 + "vCPU%d: Too many pages still idle (%"PRIu64 " out of %" 185 + PRIu64 ").\n", 186 + vcpu_id, still_idle, pages); 187 + 188 + close(page_idle_fd); 189 + close(pagemap_fd); 190 + } 191 + 192 + static void assert_ucall(struct kvm_vm *vm, uint32_t vcpu_id, 193 + uint64_t expected_ucall) 194 + { 195 + struct ucall uc; 196 + uint64_t actual_ucall = get_ucall(vm, vcpu_id, &uc); 197 + 198 + TEST_ASSERT(expected_ucall == actual_ucall, 199 + "Guest exited unexpectedly (expected ucall %" PRIu64 200 + ", got %" PRIu64 ")", 201 + expected_ucall, actual_ucall); 202 + } 203 + 204 + static bool spin_wait_for_next_iteration(int *current_iteration) 205 + { 206 + int last_iteration = *current_iteration; 207 + 208 + do { 209 + if (READ_ONCE(done)) 210 + return false; 211 + 212 + *current_iteration = READ_ONCE(iteration); 213 + } while (last_iteration == *current_iteration); 214 + 215 + return true; 216 + } 217 + 218 + static void *vcpu_thread_main(void *arg) 219 + { 220 + struct perf_test_vcpu_args *vcpu_args = arg; 221 + struct kvm_vm *vm = perf_test_args.vm; 222 + int vcpu_id = vcpu_args->vcpu_id; 223 + int current_iteration = -1; 224 + 225 + vcpu_args_set(vm, vcpu_id, 1, vcpu_id); 226 + 227 + while (spin_wait_for_next_iteration(&current_iteration)) { 228 + switch (READ_ONCE(iteration_work)) { 229 + case ITERATION_ACCESS_MEMORY: 230 + vcpu_run(vm, vcpu_id); 231 + assert_ucall(vm, vcpu_id, UCALL_SYNC); 232 + break; 233 + case ITERATION_MARK_IDLE: 234 + mark_vcpu_memory_idle(vm, vcpu_id); 235 + break; 236 + }; 237 + 238 + vcpu_last_completed_iteration[vcpu_id] = current_iteration; 239 + } 240 + 241 + return NULL; 242 + } 243 + 244 + static void spin_wait_for_vcpu(int vcpu_id, int target_iteration) 245 + { 246 + while (READ_ONCE(vcpu_last_completed_iteration[vcpu_id]) != 247 + target_iteration) { 248 + continue; 249 + } 250 + } 251 + 252 + /* The type of memory accesses to perform in the VM. */ 253 + enum access_type { 254 + ACCESS_READ, 255 + ACCESS_WRITE, 256 + }; 257 + 258 + static void run_iteration(struct kvm_vm *vm, int vcpus, const char *description) 259 + { 260 + struct timespec ts_start; 261 + struct timespec ts_elapsed; 262 + int next_iteration; 263 + int vcpu_id; 264 + 265 + /* Kick off the vCPUs by incrementing iteration. */ 266 + next_iteration = ++iteration; 267 + 268 + clock_gettime(CLOCK_MONOTONIC, &ts_start); 269 + 270 + /* Wait for all vCPUs to finish the iteration. */ 271 + for (vcpu_id = 0; vcpu_id < vcpus; vcpu_id++) 272 + spin_wait_for_vcpu(vcpu_id, next_iteration); 273 + 274 + ts_elapsed = timespec_elapsed(ts_start); 275 + pr_info("%-30s: %ld.%09lds\n", 276 + description, ts_elapsed.tv_sec, ts_elapsed.tv_nsec); 277 + } 278 + 279 + static void access_memory(struct kvm_vm *vm, int vcpus, enum access_type access, 280 + const char *description) 281 + { 282 + perf_test_args.wr_fract = (access == ACCESS_READ) ? INT_MAX : 1; 283 + sync_global_to_guest(vm, perf_test_args); 284 + iteration_work = ITERATION_ACCESS_MEMORY; 285 + run_iteration(vm, vcpus, description); 286 + } 287 + 288 + static void mark_memory_idle(struct kvm_vm *vm, int vcpus) 289 + { 290 + /* 291 + * Even though this parallelizes the work across vCPUs, this is still a 292 + * very slow operation because page_idle forces the test to mark one pfn 293 + * at a time and the clear_young notifier serializes on the KVM MMU 294 + * lock. 295 + */ 296 + pr_debug("Marking VM memory idle (slow)...\n"); 297 + iteration_work = ITERATION_MARK_IDLE; 298 + run_iteration(vm, vcpus, "Mark memory idle"); 299 + } 300 + 301 + static pthread_t *create_vcpu_threads(int vcpus) 302 + { 303 + pthread_t *vcpu_threads; 304 + int i; 305 + 306 + vcpu_threads = malloc(vcpus * sizeof(vcpu_threads[0])); 307 + TEST_ASSERT(vcpu_threads, "Failed to allocate vcpu_threads."); 308 + 309 + for (i = 0; i < vcpus; i++) { 310 + vcpu_last_completed_iteration[i] = iteration; 311 + pthread_create(&vcpu_threads[i], NULL, vcpu_thread_main, 312 + &perf_test_args.vcpu_args[i]); 313 + } 314 + 315 + return vcpu_threads; 316 + } 317 + 318 + static void terminate_vcpu_threads(pthread_t *vcpu_threads, int vcpus) 319 + { 320 + int i; 321 + 322 + /* Set done to signal the vCPU threads to exit */ 323 + done = true; 324 + 325 + for (i = 0; i < vcpus; i++) 326 + pthread_join(vcpu_threads[i], NULL); 327 + } 328 + 329 + static void run_test(enum vm_guest_mode mode, void *arg) 330 + { 331 + struct test_params *params = arg; 332 + struct kvm_vm *vm; 333 + pthread_t *vcpu_threads; 334 + int vcpus = params->vcpus; 335 + 336 + vm = perf_test_create_vm(mode, vcpus, params->vcpu_memory_bytes, 337 + params->backing_src); 338 + 339 + perf_test_setup_vcpus(vm, vcpus, params->vcpu_memory_bytes, 340 + !overlap_memory_access); 341 + 342 + vcpu_threads = create_vcpu_threads(vcpus); 343 + 344 + pr_info("\n"); 345 + access_memory(vm, vcpus, ACCESS_WRITE, "Populating memory"); 346 + 347 + /* As a control, read and write to the populated memory first. */ 348 + access_memory(vm, vcpus, ACCESS_WRITE, "Writing to populated memory"); 349 + access_memory(vm, vcpus, ACCESS_READ, "Reading from populated memory"); 350 + 351 + /* Repeat on memory that has been marked as idle. */ 352 + mark_memory_idle(vm, vcpus); 353 + access_memory(vm, vcpus, ACCESS_WRITE, "Writing to idle memory"); 354 + mark_memory_idle(vm, vcpus); 355 + access_memory(vm, vcpus, ACCESS_READ, "Reading from idle memory"); 356 + 357 + terminate_vcpu_threads(vcpu_threads, vcpus); 358 + free(vcpu_threads); 359 + perf_test_destroy_vm(vm); 360 + } 361 + 362 + static void help(char *name) 363 + { 364 + puts(""); 365 + printf("usage: %s [-h] [-m mode] [-b vcpu_bytes] [-v vcpus] [-o] [-s mem_type]\n", 366 + name); 367 + puts(""); 368 + printf(" -h: Display this help message."); 369 + guest_modes_help(); 370 + printf(" -b: specify the size of the memory region which should be\n" 371 + " dirtied by each vCPU. e.g. 10M or 3G.\n" 372 + " (default: 1G)\n"); 373 + printf(" -v: specify the number of vCPUs to run.\n"); 374 + printf(" -o: Overlap guest memory accesses instead of partitioning\n" 375 + " them into a separate region of memory for each vCPU.\n"); 376 + printf(" -s: specify the type of memory that should be used to\n" 377 + " back the guest data region.\n\n"); 378 + backing_src_help(); 379 + puts(""); 380 + exit(0); 381 + } 382 + 383 + int main(int argc, char *argv[]) 384 + { 385 + struct test_params params = { 386 + .backing_src = VM_MEM_SRC_ANONYMOUS, 387 + .vcpu_memory_bytes = DEFAULT_PER_VCPU_MEM_SIZE, 388 + .vcpus = 1, 389 + }; 390 + int page_idle_fd; 391 + int opt; 392 + 393 + guest_modes_append_default(); 394 + 395 + while ((opt = getopt(argc, argv, "hm:b:v:os:")) != -1) { 396 + switch (opt) { 397 + case 'm': 398 + guest_modes_cmdline(optarg); 399 + break; 400 + case 'b': 401 + params.vcpu_memory_bytes = parse_size(optarg); 402 + break; 403 + case 'v': 404 + params.vcpus = atoi(optarg); 405 + break; 406 + case 'o': 407 + overlap_memory_access = true; 408 + break; 409 + case 's': 410 + params.backing_src = parse_backing_src_type(optarg); 411 + break; 412 + case 'h': 413 + default: 414 + help(argv[0]); 415 + break; 416 + } 417 + } 418 + 419 + page_idle_fd = open("/sys/kernel/mm/page_idle/bitmap", O_RDWR); 420 + if (page_idle_fd < 0) { 421 + print_skip("CONFIG_IDLE_PAGE_TRACKING is not enabled"); 422 + exit(KSFT_SKIP); 423 + } 424 + close(page_idle_fd); 425 + 426 + for_each_guest_mode(run_test, &params); 427 + 428 + return 0; 429 + }
+1
tools/testing/selftests/kvm/dirty_log_perf_test.c
··· 312 312 break; 313 313 case 'o': 314 314 p.partition_vcpu_memory_access = false; 315 + break; 315 316 case 's': 316 317 p.backing_src = parse_backing_src_type(optarg); 317 318 break;
+1 -1
tools/testing/selftests/kvm/steal_time.c
··· 320 320 run_delay = get_run_delay(); 321 321 pthread_create(&thread, &attr, do_steal_time, NULL); 322 322 do 323 - pthread_yield(); 323 + sched_yield(); 324 324 while (get_run_delay() - run_delay < MIN_RUN_DELAY_NS); 325 325 pthread_join(thread, NULL); 326 326 run_delay = get_run_delay() - run_delay;
+4 -2
tools/testing/selftests/vm/userfaultfd.c
··· 210 210 211 211 static void anon_allocate_area(void **alloc_area) 212 212 { 213 - if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) 214 - err("posix_memalign() failed"); 213 + *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 214 + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); 215 + if (*alloc_area == MAP_FAILED) 216 + err("mmap of anonymous memory failed"); 215 217 } 216 218 217 219 static void noop_alias_mapping(__u64 *start, size_t len, unsigned long offset)
+29
virt/kvm/kvm_main.c
··· 3110 3110 ++vcpu->stat.generic.halt_poll_invalid; 3111 3111 goto out; 3112 3112 } 3113 + cpu_relax(); 3113 3114 poll_end = cur = ktime_get(); 3114 3115 } while (kvm_vcpu_can_poll(cur, stop)); 3115 3116 } ··· 4391 4390 }; 4392 4391 }; 4393 4392 4393 + struct compat_kvm_clear_dirty_log { 4394 + __u32 slot; 4395 + __u32 num_pages; 4396 + __u64 first_page; 4397 + union { 4398 + compat_uptr_t dirty_bitmap; /* one bit per page */ 4399 + __u64 padding2; 4400 + }; 4401 + }; 4402 + 4394 4403 static long kvm_vm_compat_ioctl(struct file *filp, 4395 4404 unsigned int ioctl, unsigned long arg) 4396 4405 { ··· 4410 4399 if (kvm->mm != current->mm) 4411 4400 return -EIO; 4412 4401 switch (ioctl) { 4402 + #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT 4403 + case KVM_CLEAR_DIRTY_LOG: { 4404 + struct compat_kvm_clear_dirty_log compat_log; 4405 + struct kvm_clear_dirty_log log; 4406 + 4407 + if (copy_from_user(&compat_log, (void __user *)arg, 4408 + sizeof(compat_log))) 4409 + return -EFAULT; 4410 + log.slot = compat_log.slot; 4411 + log.num_pages = compat_log.num_pages; 4412 + log.first_page = compat_log.first_page; 4413 + log.padding2 = compat_log.padding2; 4414 + log.dirty_bitmap = compat_ptr(compat_log.dirty_bitmap); 4415 + 4416 + r = kvm_vm_ioctl_clear_dirty_log(kvm, &log); 4417 + break; 4418 + } 4419 + #endif 4413 4420 case KVM_GET_DIRTY_LOG: { 4414 4421 struct compat_kvm_dirty_log compat_log; 4415 4422 struct kvm_dirty_log log;