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

Merge 5.16-rc5 into usb-next

We need the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+3698 -1574
+2
.mailmap
··· 126 126 Greg Kroah-Hartman <greg@kroah.com> 127 127 Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com> 128 128 Gregory CLEMENT <gregory.clement@bootlin.com> <gregory.clement@free-electrons.com> 129 + Guo Ren <guoren@kernel.org> <guoren@linux.alibaba.com> 130 + Guo Ren <guoren@kernel.org> <ren_guo@c-sky.com> 129 131 Gustavo Padovan <gustavo@las.ic.unicamp.br> 130 132 Gustavo Padovan <padovan@profusion.mobi> 131 133 Hanjun Guo <guohanjun@huawei.com> <hanjun.guo@linaro.org>
+2 -2
Documentation/admin-guide/blockdev/drbd/figures.rst
··· 25 25 :alt: disk-states-8.dot 26 26 :align: center 27 27 28 - .. kernel-figure:: node-states-8.dot 29 - :alt: node-states-8.dot 28 + .. kernel-figure:: peer-states-8.dot 29 + :alt: peer-states-8.dot 30 30 :align: center
-5
Documentation/admin-guide/blockdev/drbd/node-states-8.dot Documentation/admin-guide/blockdev/drbd/peer-states-8.dot
··· 1 - digraph node_states { 2 - Secondary -> Primary [ label = "ioctl_set_state()" ] 3 - Primary -> Secondary [ label = "ioctl_set_state()" ] 4 - } 5 - 6 1 digraph peer_states { 7 2 Secondary -> Primary [ label = "recv state packet" ] 8 3 Primary -> Secondary [ label = "recv state packet" ]
+10 -5
Documentation/conf.py
··· 249 249 250 250 html_static_path = ['sphinx-static'] 251 251 252 - html_context = { 253 - 'css_files': [ 254 - '_static/theme_overrides.css', 255 - ], 256 - } 252 + html_css_files = [ 253 + 'theme_overrides.css', 254 + ] 255 + 256 + if major <= 1 and minor < 8: 257 + html_context = { 258 + 'css_files': [ 259 + '_static/theme_overrides.css', 260 + ], 261 + } 257 262 258 263 # Add any extra paths that contain custom files (such as robots.txt or 259 264 # .htaccess) here, relative to this directory. These files are copied
+1 -1
Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
··· 136 136 samsung,syscon-phandle = <&pmu_system_controller>; 137 137 138 138 /* NTC thermistor is a hwmon device */ 139 - ncp15wb473 { 139 + thermistor { 140 140 compatible = "murata,ncp15wb473"; 141 141 pullup-uv = <1800000>; 142 142 pullup-ohm = <47000>;
+1 -1
Documentation/devicetree/bindings/input/gpio-keys.yaml
··· 142 142 down { 143 143 label = "GPIO Key DOWN"; 144 144 linux,code = <108>; 145 - interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 145 + interrupts = <1 IRQ_TYPE_EDGE_FALLING>; 146 146 }; 147 147 }; 148 148
+2 -12
Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml
··· 79 79 80 80 properties: 81 81 data-lanes: 82 + description: 83 + Note that 'fsl,imx7-mipi-csi2' only supports up to 2 data lines. 82 84 items: 83 85 minItems: 1 84 86 maxItems: 4 ··· 92 90 93 91 required: 94 92 - data-lanes 95 - 96 - allOf: 97 - - if: 98 - properties: 99 - compatible: 100 - contains: 101 - const: fsl,imx7-mipi-csi2 102 - then: 103 - properties: 104 - data-lanes: 105 - items: 106 - maxItems: 2 107 93 108 94 port@1: 109 95 $ref: /schemas/graph.yaml#/properties/port
+8
Documentation/devicetree/bindings/net/ethernet-phy.yaml
··· 91 91 compensate for the board being designed with the lanes 92 92 swapped. 93 93 94 + enet-phy-lane-no-swap: 95 + $ref: /schemas/types.yaml#/definitions/flag 96 + description: 97 + If set, indicates that PHY will disable swap of the 98 + TX/RX lanes. This property allows the PHY to work correcly after 99 + e.g. wrong bootstrap configuration caused by issues in PCB 100 + layout design. 101 + 94 102 eee-broken-100tx: 95 103 $ref: /schemas/types.yaml#/definitions/flag 96 104 description:
+1 -1
Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml
··· 29 29 - PHY_TYPE_PCIE 30 30 - PHY_TYPE_SATA 31 31 - PHY_TYPE_SGMII 32 - - PHY_TYPE_USB 32 + - PHY_TYPE_USB3 33 33 - description: The PHY instance 34 34 minimum: 0 35 35 maximum: 1 # for DP, SATA or USB
+1 -1
Documentation/devicetree/bindings/power/supply/bq25980.yaml
··· 105 105 reg = <0x65>; 106 106 interrupt-parent = <&gpio1>; 107 107 interrupts = <16 IRQ_TYPE_EDGE_FALLING>; 108 - ti,watchdog-timer = <0>; 108 + ti,watchdog-timeout-ms = <0>; 109 109 ti,sc-ocp-limit-microamp = <2000000>; 110 110 ti,sc-ovp-limit-microvolt = <17800000>; 111 111 monitored-battery = <&bat>;
+3
Documentation/devicetree/bindings/sound/wlf,wm8962.yaml
··· 19 19 clocks: 20 20 maxItems: 1 21 21 22 + interrupts: 23 + maxItems: 1 24 + 22 25 "#sound-dai-cells": 23 26 const: 0 24 27
+1
Documentation/devicetree/bindings/spi/spi-rockchip.yaml
··· 33 33 - rockchip,rk3328-spi 34 34 - rockchip,rk3368-spi 35 35 - rockchip,rk3399-spi 36 + - rockchip,rk3568-spi 36 37 - rockchip,rv1126-spi 37 38 - const: rockchip,rk3066-spi 38 39
+3 -6
Documentation/locking/locktypes.rst
··· 439 439 spin_lock(&p->lock); 440 440 p->count += this_cpu_read(var2); 441 441 442 - On a non-PREEMPT_RT kernel migrate_disable() maps to preempt_disable() 443 - which makes the above code fully equivalent. On a PREEMPT_RT kernel 444 442 migrate_disable() ensures that the task is pinned on the current CPU which 445 443 in turn guarantees that the per-CPU access to var1 and var2 are staying on 446 - the same CPU. 444 + the same CPU while the task remains preemptible. 447 445 448 446 The migrate_disable() substitution is not valid for the following 449 447 scenario:: ··· 454 456 p = this_cpu_ptr(&var1); 455 457 p->val = func2(); 456 458 457 - While correct on a non-PREEMPT_RT kernel, this breaks on PREEMPT_RT because 458 - here migrate_disable() does not protect against reentrancy from a 459 - preempting task. A correct substitution for this case is:: 459 + This breaks because migrate_disable() does not protect against reentrancy from 460 + a preempting task. A correct substitution for this case is:: 460 461 461 462 func() 462 463 {
+11
Documentation/process/changes.rst
··· 35 35 binutils 2.23 ld -v 36 36 flex 2.5.35 flex --version 37 37 bison 2.0 bison --version 38 + pahole 1.16 pahole --version 38 39 util-linux 2.10o fdformat --version 39 40 kmod 13 depmod -V 40 41 e2fsprogs 1.41.4 e2fsck -V ··· 108 107 109 108 Since Linux 4.16, the build system generates parsers 110 109 during build. This requires bison 2.0 or later. 110 + 111 + pahole: 112 + ------- 113 + 114 + Since Linux 5.2, if CONFIG_DEBUG_INFO_BTF is selected, the build system 115 + generates BTF (BPF Type Format) from DWARF in vmlinux, a bit later from kernel 116 + modules as well. This requires pahole v1.16 or later. 117 + 118 + It is found in the 'dwarves' or 'pahole' distro packages or from 119 + https://fedorapeople.org/~acme/dwarves/. 111 120 112 121 Perl 113 122 ----
+2 -1
Documentation/process/submitting-patches.rst
··· 14 14 Documentation/process/submit-checklist.rst 15 15 for a list of items to check before submitting code. If you are submitting 16 16 a driver, also read Documentation/process/submitting-drivers.rst; for device 17 - tree binding patches, read Documentation/process/submitting-patches.rst. 17 + tree binding patches, read 18 + Documentation/devicetree/bindings/submitting-patches.rst. 18 19 19 20 This documentation assumes that you're using ``git`` to prepare your patches. 20 21 If you're unfamiliar with ``git``, you would be well-advised to learn how to
+11 -5
MAINTAINERS
··· 9329 9329 F: drivers/iio/pressure/dps310.c 9330 9330 9331 9331 INFINIBAND SUBSYSTEM 9332 - M: Doug Ledford <dledford@redhat.com> 9333 9332 M: Jason Gunthorpe <jgg@nvidia.com> 9334 9333 L: linux-rdma@vger.kernel.org 9335 9334 S: Supported ··· 10279 10280 F: scripts/Makefile.kcsan 10280 10281 10281 10282 KDUMP 10282 - M: Dave Young <dyoung@redhat.com> 10283 10283 M: Baoquan He <bhe@redhat.com> 10284 10284 R: Vivek Goyal <vgoyal@redhat.com> 10285 + R: Dave Young <dyoung@redhat.com> 10285 10286 L: kexec@lists.infradead.org 10286 10287 S: Maintained 10287 10288 W: http://lse.sourceforge.net/kdump/ ··· 12179 12180 F: include/linux/mlx5/mlx5_ifc_fpga.h 12180 12181 12181 12182 MELLANOX ETHERNET SWITCH DRIVERS 12182 - M: Jiri Pirko <jiri@nvidia.com> 12183 12183 M: Ido Schimmel <idosch@nvidia.com> 12184 + M: Petr Machata <petrm@nvidia.com> 12184 12185 L: netdev@vger.kernel.org 12185 12186 S: Supported 12186 12187 W: http://www.mellanox.com ··· 15770 15771 F: Documentation/devicetree/bindings/net/qcom,ethqos.txt 15771 15772 F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c 15772 15773 15774 + QUALCOMM FASTRPC DRIVER 15775 + M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> 15776 + M: Amol Maheshwari <amahesh@qti.qualcomm.com> 15777 + L: linux-arm-msm@vger.kernel.org 15778 + S: Maintained 15779 + F: Documentation/devicetree/bindings/misc/qcom,fastrpc.txt 15780 + F: drivers/misc/fastrpc.c 15781 + F: include/uapi/misc/fastrpc.h 15782 + 15773 15783 QUALCOMM GENERIC INTERFACE I2C DRIVER 15774 15784 M: Akash Asthana <akashast@codeaurora.org> 15775 15785 M: Mukesh Savaliya <msavaliy@codeaurora.org> ··· 16637 16629 F: drivers/iommu/s390-iommu.c 16638 16630 16639 16631 S390 IUCV NETWORK LAYER 16640 - M: Julian Wiedmann <jwi@linux.ibm.com> 16641 16632 M: Alexandra Winter <wintera@linux.ibm.com> 16642 16633 M: Wenjia Zhang <wenjia@linux.ibm.com> 16643 16634 L: linux-s390@vger.kernel.org ··· 16648 16641 F: net/iucv/ 16649 16642 16650 16643 S390 NETWORK DRIVERS 16651 - M: Julian Wiedmann <jwi@linux.ibm.com> 16652 16644 M: Alexandra Winter <wintera@linux.ibm.com> 16653 16645 M: Wenjia Zhang <wenjia@linux.ibm.com> 16654 16646 L: linux-s390@vger.kernel.org
+7 -7
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 16 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc4 5 + EXTRAVERSION = -rc5 6 6 NAME = Gobble Gobble 7 7 8 8 # *DOCUMENTATION* ··· 789 789 KBUILD_CFLAGS += $(stackp-flags-y) 790 790 791 791 KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror 792 - KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) 792 + KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH:"%"=%) 793 793 794 794 ifdef CONFIG_CC_IS_CLANG 795 795 KBUILD_CPPFLAGS += -Qunused-arguments ··· 1374 1374 1375 1375 ifneq ($(dtstree),) 1376 1376 1377 - %.dtb: dt_binding_check include/config/kernel.release scripts_dtc 1378 - $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(dtstree)/$*.dt.yaml 1377 + %.dtb: include/config/kernel.release scripts_dtc 1378 + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ 1379 1379 1380 - %.dtbo: dt_binding_check include/config/kernel.release scripts_dtc 1381 - $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(dtstree)/$*.dt.yaml 1380 + %.dtbo: include/config/kernel.release scripts_dtc 1381 + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ 1382 1382 1383 1383 PHONY += dtbs dtbs_install dtbs_check 1384 1384 dtbs: include/config/kernel.release scripts_dtc 1385 1385 $(Q)$(MAKE) $(build)=$(dtstree) 1386 1386 1387 - ifneq ($(filter dtbs_check %.dtb %.dtbo, $(MAKECMDGOALS)),) 1387 + ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) 1388 1388 export CHECK_DTBS=y 1389 1389 dtbs: dt_binding_check 1390 1390 endif
+4 -3
arch/arm64/boot/dts/apple/t8103.dtsi
··· 7 7 * Copyright The Asahi Linux Contributors 8 8 */ 9 9 10 + #include <dt-bindings/gpio/gpio.h> 10 11 #include <dt-bindings/interrupt-controller/apple-aic.h> 11 12 #include <dt-bindings/interrupt-controller/irq.h> 12 13 #include <dt-bindings/pinctrl/apple.h> ··· 282 281 port00: pci@0,0 { 283 282 device_type = "pci"; 284 283 reg = <0x0 0x0 0x0 0x0 0x0>; 285 - reset-gpios = <&pinctrl_ap 152 0>; 284 + reset-gpios = <&pinctrl_ap 152 GPIO_ACTIVE_LOW>; 286 285 max-link-speed = <2>; 287 286 288 287 #address-cells = <3>; ··· 302 301 port01: pci@1,0 { 303 302 device_type = "pci"; 304 303 reg = <0x800 0x0 0x0 0x0 0x0>; 305 - reset-gpios = <&pinctrl_ap 153 0>; 304 + reset-gpios = <&pinctrl_ap 153 GPIO_ACTIVE_LOW>; 306 305 max-link-speed = <2>; 307 306 308 307 #address-cells = <3>; ··· 322 321 port02: pci@2,0 { 323 322 device_type = "pci"; 324 323 reg = <0x1000 0x0 0x0 0x0 0x0>; 325 - reset-gpios = <&pinctrl_ap 33 0>; 324 + reset-gpios = <&pinctrl_ap 33 GPIO_ACTIVE_LOW>; 326 325 max-link-speed = <1>; 327 326 328 327 #address-cells = <3>;
+2 -2
arch/csky/kernel/traps.c
··· 209 209 210 210 asmlinkage void do_trap_fpe(struct pt_regs *regs) 211 211 { 212 - #ifdef CONFIG_CPU_HAS_FP 212 + #ifdef CONFIG_CPU_HAS_FPU 213 213 return fpu_fpe(regs); 214 214 #else 215 215 do_trap_error(regs, SIGILL, ILL_ILLOPC, regs->pc, ··· 219 219 220 220 asmlinkage void do_trap_priv(struct pt_regs *regs) 221 221 { 222 - #ifdef CONFIG_CPU_HAS_FP 222 + #ifdef CONFIG_CPU_HAS_FPU 223 223 if (user_mode(regs) && fpu_libc_helper(regs)) 224 224 return; 225 225 #endif
+1 -1
arch/mips/net/bpf_jit_comp.h
··· 98 98 #define emit(...) __emit(__VA_ARGS__) 99 99 100 100 /* Workaround for R10000 ll/sc errata */ 101 - #ifdef CONFIG_WAR_R10000 101 + #ifdef CONFIG_WAR_R10000_LLSC 102 102 #define LLSC_beqz beqzl 103 103 #else 104 104 #define LLSC_beqz beqz
+1
arch/x86/Kconfig
··· 1932 1932 depends on ACPI 1933 1933 select UCS2_STRING 1934 1934 select EFI_RUNTIME_WRAPPERS 1935 + select ARCH_USE_MEMREMAP_PROT 1935 1936 help 1936 1937 This enables the kernel to use EFI runtime services that are 1937 1938 available (such as the EFI variable services).
+1 -1
arch/x86/include/asm/kvm_host.h
··· 97 97 KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) 98 98 #define KVM_REQ_TLB_FLUSH_CURRENT KVM_ARCH_REQ(26) 99 99 #define KVM_REQ_TLB_FLUSH_GUEST \ 100 - KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_NO_WAKEUP) 100 + KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) 101 101 #define KVM_REQ_APF_READY KVM_ARCH_REQ(28) 102 102 #define KVM_REQ_MSR_FILTER_CHANGED KVM_ARCH_REQ(29) 103 103 #define KVM_REQ_UPDATE_CPU_DIRTY_LOGGING \
+14
arch/x86/kernel/smpboot.c
··· 579 579 { NULL, }, 580 580 }; 581 581 582 + static struct sched_domain_topology_level x86_hybrid_topology[] = { 583 + #ifdef CONFIG_SCHED_SMT 584 + { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) }, 585 + #endif 586 + #ifdef CONFIG_SCHED_MC 587 + { cpu_coregroup_mask, x86_core_flags, SD_INIT_NAME(MC) }, 588 + #endif 589 + { cpu_cpu_mask, SD_INIT_NAME(DIE) }, 590 + { NULL, }, 591 + }; 592 + 582 593 static struct sched_domain_topology_level x86_topology[] = { 583 594 #ifdef CONFIG_SCHED_SMT 584 595 { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) }, ··· 1480 1469 1481 1470 calculate_max_logical_packages(); 1482 1471 1472 + /* XXX for now assume numa-in-package and hybrid don't overlap */ 1483 1473 if (x86_has_numa_in_package) 1484 1474 set_sched_topology(x86_numa_in_package_topology); 1475 + if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) 1476 + set_sched_topology(x86_hybrid_topology); 1485 1477 1486 1478 nmi_selftest(); 1487 1479 impress_friends();
+5 -2
arch/x86/kvm/hyperv.c
··· 1922 1922 1923 1923 all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL; 1924 1924 1925 + if (all_cpus) 1926 + goto check_and_send_ipi; 1927 + 1925 1928 if (!sparse_banks_len) 1926 1929 goto ret_success; 1927 1930 1928 - if (!all_cpus && 1929 - kvm_read_guest(kvm, 1931 + if (kvm_read_guest(kvm, 1930 1932 hc->ingpa + offsetof(struct hv_send_ipi_ex, 1931 1933 vp_set.bank_contents), 1932 1934 sparse_banks, ··· 1936 1934 return HV_STATUS_INVALID_HYPERCALL_INPUT; 1937 1935 } 1938 1936 1937 + check_and_send_ipi: 1939 1938 if ((vector < HV_IPI_LOW_VECTOR) || (vector > HV_IPI_HIGH_VECTOR)) 1940 1939 return HV_STATUS_INVALID_HYPERCALL_INPUT; 1941 1940
+13 -9
arch/x86/kvm/vmx/vmx.c
··· 2646 2646 if (!loaded_vmcs->msr_bitmap) 2647 2647 goto out_vmcs; 2648 2648 memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE); 2649 - 2650 - if (IS_ENABLED(CONFIG_HYPERV) && 2651 - static_branch_unlikely(&enable_evmcs) && 2652 - (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { 2653 - struct hv_enlightened_vmcs *evmcs = 2654 - (struct hv_enlightened_vmcs *)loaded_vmcs->vmcs; 2655 - 2656 - evmcs->hv_enlightenments_control.msr_bitmap = 1; 2657 - } 2658 2649 } 2659 2650 2660 2651 memset(&loaded_vmcs->host_state, 0, sizeof(struct vmcs_host_state)); ··· 6832 6841 err = alloc_loaded_vmcs(&vmx->vmcs01); 6833 6842 if (err < 0) 6834 6843 goto free_pml; 6844 + 6845 + /* 6846 + * Use Hyper-V 'Enlightened MSR Bitmap' feature when KVM runs as a 6847 + * nested (L1) hypervisor and Hyper-V in L0 supports it. Enable the 6848 + * feature only for vmcs01, KVM currently isn't equipped to realize any 6849 + * performance benefits from enabling it for vmcs02. 6850 + */ 6851 + if (IS_ENABLED(CONFIG_HYPERV) && static_branch_unlikely(&enable_evmcs) && 6852 + (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { 6853 + struct hv_enlightened_vmcs *evmcs = (void *)vmx->vmcs01.vmcs; 6854 + 6855 + evmcs->hv_enlightenments_control.msr_bitmap = 1; 6856 + } 6835 6857 6836 6858 /* The MSR bitmap starts with all ones */ 6837 6859 bitmap_fill(vmx->shadow_msr_intercept.read, MAX_POSSIBLE_PASSTHROUGH_MSRS);
+9 -3
arch/x86/kvm/x86.c
··· 890 890 !load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu))) 891 891 return 1; 892 892 893 - if (!(cr0 & X86_CR0_PG) && kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE)) 893 + if (!(cr0 & X86_CR0_PG) && 894 + (is_64_bit_mode(vcpu) || kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE))) 894 895 return 1; 895 896 896 897 static_call(kvm_x86_set_cr0)(vcpu, cr0); ··· 7122 7121 unsigned short port, void *val, unsigned int count) 7123 7122 { 7124 7123 if (vcpu->arch.pio.count) { 7125 - /* Complete previous iteration. */ 7124 + /* 7125 + * Complete a previous iteration that required userspace I/O. 7126 + * Note, @count isn't guaranteed to match pio.count as userspace 7127 + * can modify ECX before rerunning the vCPU. Ignore any such 7128 + * shenanigans as KVM doesn't support modifying the rep count, 7129 + * and the emulator ensures @count doesn't overflow the buffer. 7130 + */ 7126 7131 } else { 7127 7132 int r = __emulator_pio_in(vcpu, size, port, count); 7128 7133 if (!r) ··· 7137 7130 /* Results already available, fall through. */ 7138 7131 } 7139 7132 7140 - WARN_ON(count != vcpu->arch.pio.count); 7141 7133 complete_emulator_pio_in(vcpu, val); 7142 7134 return 1; 7143 7135 }
+2 -1
arch/x86/platform/efi/quirks.c
··· 277 277 return; 278 278 } 279 279 280 - new = early_memremap(data.phys_map, data.size); 280 + new = early_memremap_prot(data.phys_map, data.size, 281 + pgprot_val(pgprot_encrypted(FIXMAP_PAGE_NORMAL))); 281 282 if (!new) { 282 283 pr_err("Failed to map new boot services memmap\n"); 283 284 return;
+2 -2
block/fops.c
··· 15 15 #include <linux/falloc.h> 16 16 #include <linux/suspend.h> 17 17 #include <linux/fs.h> 18 + #include <linux/module.h> 18 19 #include "blk.h" 19 20 20 21 static inline struct inode *bdev_file_inode(struct file *file) ··· 341 340 } else { 342 341 ret = bio_iov_iter_get_pages(bio, iter); 343 342 if (unlikely(ret)) { 344 - bio->bi_status = BLK_STS_IOERR; 345 - bio_endio(bio); 343 + bio_put(bio); 346 344 return ret; 347 345 } 348 346 }
+3
block/ioprio.c
··· 220 220 pgrp = task_pgrp(current); 221 221 else 222 222 pgrp = find_vpid(who); 223 + read_lock(&tasklist_lock); 223 224 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { 224 225 tmpio = get_task_ioprio(p); 225 226 if (tmpio < 0) ··· 230 229 else 231 230 ret = ioprio_best(ret, tmpio); 232 231 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); 232 + read_unlock(&tasklist_lock); 233 + 233 234 break; 234 235 case IOPRIO_WHO_USER: 235 236 uid = make_kuid(current_user_ns(), who);
+9 -12
drivers/android/binder.c
··· 4422 4422 __release(&t->lock); 4423 4423 4424 4424 /* 4425 - * If this thread used poll, make sure we remove the waitqueue 4426 - * from any epoll data structures holding it with POLLFREE. 4427 - * waitqueue_active() is safe to use here because we're holding 4428 - * the inner lock. 4425 + * If this thread used poll, make sure we remove the waitqueue from any 4426 + * poll data structures holding it. 4429 4427 */ 4430 - if ((thread->looper & BINDER_LOOPER_STATE_POLL) && 4431 - waitqueue_active(&thread->wait)) { 4432 - wake_up_poll(&thread->wait, EPOLLHUP | POLLFREE); 4433 - } 4428 + if (thread->looper & BINDER_LOOPER_STATE_POLL) 4429 + wake_up_pollfree(&thread->wait); 4434 4430 4435 4431 binder_inner_proc_unlock(thread->proc); 4436 4432 4437 4433 /* 4438 - * This is needed to avoid races between wake_up_poll() above and 4439 - * and ep_remove_waitqueue() called for other reasons (eg the epoll file 4440 - * descriptor being closed); ep_remove_waitqueue() holds an RCU read 4441 - * lock, so we can be sure it's done after calling synchronize_rcu(). 4434 + * This is needed to avoid races between wake_up_pollfree() above and 4435 + * someone else removing the last entry from the queue for other reasons 4436 + * (e.g. ep_remove_wait_queue() being called due to an epoll file 4437 + * descriptor being closed). Such other users hold an RCU read lock, so 4438 + * we can be sure they're done after we call synchronize_rcu(). 4442 4439 */ 4443 4440 if (thread->looper & BINDER_LOOPER_STATE_POLL) 4444 4441 synchronize_rcu();
+2 -1
drivers/ata/ahci_ceva.c
··· 94 94 static unsigned int ceva_ahci_read_id(struct ata_device *dev, 95 95 struct ata_taskfile *tf, u16 *id) 96 96 { 97 + __le16 *__id = (__le16 *)id; 97 98 u32 err_mask; 98 99 99 100 err_mask = ata_do_dev_read_id(dev, tf, id); ··· 104 103 * Since CEVA controller does not support device sleep feature, we 105 104 * need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data. 106 105 */ 107 - id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); 106 + __id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); 108 107 109 108 return 0; 110 109 }
+2
drivers/ata/libata-core.c
··· 3920 3920 { "VRFDFC22048UCHC-TE*", NULL, ATA_HORKAGE_NODMA }, 3921 3921 /* Odd clown on sil3726/4726 PMPs */ 3922 3922 { "Config Disk", NULL, ATA_HORKAGE_DISABLE }, 3923 + /* Similar story with ASMedia 1092 */ 3924 + { "ASMT109x- Config", NULL, ATA_HORKAGE_DISABLE }, 3923 3925 3924 3926 /* Weird ATAPI devices */ 3925 3927 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
+18 -3
drivers/bus/mhi/core/pm.c
··· 881 881 } 882 882 EXPORT_SYMBOL_GPL(mhi_pm_suspend); 883 883 884 - int mhi_pm_resume(struct mhi_controller *mhi_cntrl) 884 + static int __mhi_pm_resume(struct mhi_controller *mhi_cntrl, bool force) 885 885 { 886 886 struct mhi_chan *itr, *tmp; 887 887 struct device *dev = &mhi_cntrl->mhi_dev->dev; ··· 898 898 if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) 899 899 return -EIO; 900 900 901 - if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) 902 - return -EINVAL; 901 + if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) { 902 + dev_warn(dev, "Resuming from non M3 state (%s)\n", 903 + TO_MHI_STATE_STR(mhi_get_mhi_state(mhi_cntrl))); 904 + if (!force) 905 + return -EINVAL; 906 + } 903 907 904 908 /* Notify clients about exiting LPM */ 905 909 list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) { ··· 944 940 945 941 return 0; 946 942 } 943 + 944 + int mhi_pm_resume(struct mhi_controller *mhi_cntrl) 945 + { 946 + return __mhi_pm_resume(mhi_cntrl, false); 947 + } 947 948 EXPORT_SYMBOL_GPL(mhi_pm_resume); 949 + 950 + int mhi_pm_resume_force(struct mhi_controller *mhi_cntrl) 951 + { 952 + return __mhi_pm_resume(mhi_cntrl, true); 953 + } 954 + EXPORT_SYMBOL_GPL(mhi_pm_resume_force); 948 955 949 956 int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl) 950 957 {
+1 -1
drivers/bus/mhi/pci_generic.c
··· 20 20 21 21 #define MHI_PCI_DEFAULT_BAR_NUM 0 22 22 23 - #define MHI_POST_RESET_DELAY_MS 500 23 + #define MHI_POST_RESET_DELAY_MS 2000 24 24 25 25 #define HEALTH_CHECK_PERIOD (HZ * 2) 26 26
+1 -1
drivers/clk/imx/clk-imx8qxp-lpcg.c
··· 370 370 .probe = imx8qxp_lpcg_clk_probe, 371 371 }; 372 372 373 - builtin_platform_driver(imx8qxp_lpcg_clk_driver); 373 + module_platform_driver(imx8qxp_lpcg_clk_driver); 374 374 375 375 MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); 376 376 MODULE_DESCRIPTION("NXP i.MX8QXP LPCG clock driver");
+1 -1
drivers/clk/imx/clk-imx8qxp.c
··· 308 308 }, 309 309 .probe = imx8qxp_clk_probe, 310 310 }; 311 - builtin_platform_driver(imx8qxp_clk_driver); 311 + module_platform_driver(imx8qxp_clk_driver); 312 312 313 313 MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); 314 314 MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");
+9
drivers/clk/qcom/clk-alpha-pll.c
··· 1429 1429 void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, 1430 1430 const struct alpha_pll_config *config) 1431 1431 { 1432 + /* 1433 + * If the bootloader left the PLL enabled it's likely that there are 1434 + * RCGs that will lock up if we disable the PLL below. 1435 + */ 1436 + if (trion_pll_is_enabled(pll, regmap)) { 1437 + pr_debug("Trion PLL is already enabled, skipping configuration\n"); 1438 + return; 1439 + } 1440 + 1432 1441 clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l); 1433 1442 regmap_write(regmap, PLL_CAL_L_VAL(pll), TRION_PLL_CAL_VAL); 1434 1443 clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha);
+1 -1
drivers/clk/qcom/clk-regmap-mux.c
··· 28 28 val &= mask; 29 29 30 30 if (mux->parent_map) 31 - return qcom_find_src_index(hw, mux->parent_map, val); 31 + return qcom_find_cfg_index(hw, mux->parent_map, val); 32 32 33 33 return val; 34 34 }
+12
drivers/clk/qcom/common.c
··· 69 69 } 70 70 EXPORT_SYMBOL_GPL(qcom_find_src_index); 71 71 72 + int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, u8 cfg) 73 + { 74 + int i, num_parents = clk_hw_get_num_parents(hw); 75 + 76 + for (i = 0; i < num_parents; i++) 77 + if (cfg == map[i].cfg) 78 + return i; 79 + 80 + return -ENOENT; 81 + } 82 + EXPORT_SYMBOL_GPL(qcom_find_cfg_index); 83 + 72 84 struct regmap * 73 85 qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc) 74 86 {
+2
drivers/clk/qcom/common.h
··· 49 49 qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); 50 50 extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, 51 51 u8 src); 52 + extern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, 53 + u8 cfg); 52 54 53 55 extern int qcom_cc_register_board_clk(struct device *dev, const char *path, 54 56 const char *name, unsigned long rate);
+2 -2
drivers/clk/qcom/gcc-sm6125.c
··· 1121 1121 .name = "gcc_sdcc1_apps_clk_src", 1122 1122 .parent_data = gcc_parent_data_1, 1123 1123 .num_parents = ARRAY_SIZE(gcc_parent_data_1), 1124 - .ops = &clk_rcg2_ops, 1124 + .ops = &clk_rcg2_floor_ops, 1125 1125 }, 1126 1126 }; 1127 1127 ··· 1143 1143 .name = "gcc_sdcc1_ice_core_clk_src", 1144 1144 .parent_data = gcc_parent_data_0, 1145 1145 .num_parents = ARRAY_SIZE(gcc_parent_data_0), 1146 - .ops = &clk_rcg2_floor_ops, 1146 + .ops = &clk_rcg2_ops, 1147 1147 }, 1148 1148 }; 1149 1149
+1 -1
drivers/clk/versatile/clk-icst.c
··· 543 543 544 544 regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype); 545 545 if (IS_ERR(regclk)) { 546 - kfree(name); 547 546 pr_err("error setting up syscon ICST clock %s\n", name); 547 + kfree(name); 548 548 return; 549 549 } 550 550 of_clk_add_provider(np, of_clk_src_simple_get, regclk);
+7 -2
drivers/clocksource/arm_arch_timer.c
··· 394 394 395 395 static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0); 396 396 397 - static void erratum_set_next_event_generic(const int access, unsigned long evt, 398 - struct clock_event_device *clk) 397 + /* 398 + * Force the inlining of this function so that the register accesses 399 + * can be themselves correctly inlined. 400 + */ 401 + static __always_inline 402 + void erratum_set_next_event_generic(const int access, unsigned long evt, 403 + struct clock_event_device *clk) 399 404 { 400 405 unsigned long ctrl; 401 406 u64 cval;
+1 -1
drivers/clocksource/dw_apb_timer_of.c
··· 47 47 pr_warn("pclk for %pOFn is present, but could not be activated\n", 48 48 np); 49 49 50 - if (!of_property_read_u32(np, "clock-freq", rate) && 50 + if (!of_property_read_u32(np, "clock-freq", rate) || 51 51 !of_property_read_u32(np, "clock-frequency", rate)) 52 52 return 0; 53 53
+6 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 2576 2576 */ 2577 2577 link_enc_cfg_init(dm->dc, dc_state); 2578 2578 2579 - amdgpu_dm_outbox_init(adev); 2579 + if (dc_enable_dmub_notifications(adev->dm.dc)) 2580 + amdgpu_dm_outbox_init(adev); 2580 2581 2581 2582 r = dm_dmub_hw_init(adev); 2582 2583 if (r) ··· 2625 2624 dm_state->context = dc_create_state(dm->dc); 2626 2625 /* TODO: Remove dc_state->dccg, use dc->dccg directly. */ 2627 2626 dc_resource_state_construct(dm->dc, dm_state->context); 2627 + 2628 + /* Re-enable outbox interrupts for DPIA. */ 2629 + if (dc_enable_dmub_notifications(adev->dm.dc)) 2630 + amdgpu_dm_outbox_init(adev); 2628 2631 2629 2632 /* Before powering on DC we need to re-initialize DMUB. */ 2630 2633 r = dm_dmub_hw_init(adev);
+2
drivers/gpu/drm/amd/display/dc/dc_link.h
··· 226 226 *edp_num = 0; 227 227 for (i = 0; i < dc->link_count; i++) { 228 228 // report any eDP links, even unconnected DDI's 229 + if (!dc->links[i]) 230 + continue; 229 231 if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) { 230 232 edp_links[*edp_num] = dc->links[i]; 231 233 if (++(*edp_num) == MAX_NUM_EDP)
+1
drivers/gpu/drm/drm_gem_shmem_helper.c
··· 9 9 #include <linux/shmem_fs.h> 10 10 #include <linux/slab.h> 11 11 #include <linux/vmalloc.h> 12 + #include <linux/module.h> 12 13 13 14 #ifdef CONFIG_X86 14 15 #include <asm/set_memory.h>
+10 -1
drivers/gpu/drm/drm_syncobj.c
··· 404 404 405 405 if (*fence) { 406 406 ret = dma_fence_chain_find_seqno(fence, point); 407 - if (!ret) 407 + if (!ret) { 408 + /* If the requested seqno is already signaled 409 + * drm_syncobj_find_fence may return a NULL 410 + * fence. To make sure the recipient gets 411 + * signalled, use a new fence instead. 412 + */ 413 + if (!*fence) 414 + *fence = dma_fence_get_stub(); 415 + 408 416 goto out; 417 + } 409 418 dma_fence_put(*fence); 410 419 } else { 411 420 ret = -EINVAL;
+1
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 3277 3277 out_fence = eb_requests_create(&eb, in_fence, out_fence_fd); 3278 3278 if (IS_ERR(out_fence)) { 3279 3279 err = PTR_ERR(out_fence); 3280 + out_fence = NULL; 3280 3281 if (eb.requests[0]) 3281 3282 goto err_request; 3282 3283 else
+1
drivers/gpu/drm/i915/gt/intel_gtt.c
··· 6 6 #include <linux/slab.h> /* fault-inject.h is not standalone! */ 7 7 8 8 #include <linux/fault-inject.h> 9 + #include <linux/sched/mm.h> 9 10 10 11 #include "gem/i915_gem_lmem.h" 11 12 #include "i915_trace.h"
+9 -9
drivers/gpu/drm/i915/gt/intel_workarounds.c
··· 1127 1127 GAMT_CHKN_BIT_REG, 1128 1128 GAMT_CHKN_DISABLE_L3_COH_PIPE); 1129 1129 1130 + /* Wa_1407352427:icl,ehl */ 1131 + wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2, 1132 + PSDUNIT_CLKGATE_DIS); 1133 + 1134 + /* Wa_1406680159:icl,ehl */ 1135 + wa_write_or(wal, 1136 + SUBSLICE_UNIT_LEVEL_CLKGATE, 1137 + GWUNIT_CLKGATE_DIS); 1138 + 1130 1139 /* Wa_1607087056:icl,ehl,jsl */ 1131 1140 if (IS_ICELAKE(i915) || 1132 1141 IS_JSL_EHL_GT_STEP(i915, STEP_A0, STEP_B0)) ··· 1860 1851 */ 1861 1852 wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE, 1862 1853 VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS); 1863 - 1864 - /* Wa_1407352427:icl,ehl */ 1865 - wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2, 1866 - PSDUNIT_CLKGATE_DIS); 1867 - 1868 - /* Wa_1406680159:icl,ehl */ 1869 - wa_write_or(wal, 1870 - SUBSLICE_UNIT_LEVEL_CLKGATE, 1871 - GWUNIT_CLKGATE_DIS); 1872 1854 1873 1855 /* 1874 1856 * Wa_1408767742:icl[a2..forever],ehl[all]
+1
drivers/gpu/drm/i915/i915_request.c
··· 29 29 #include <linux/sched.h> 30 30 #include <linux/sched/clock.h> 31 31 #include <linux/sched/signal.h> 32 + #include <linux/sched/mm.h> 32 33 33 34 #include "gem/i915_gem_context.h" 34 35 #include "gt/intel_breadcrumbs.h"
+1
drivers/gpu/drm/lima/lima_device.c
··· 4 4 #include <linux/regulator/consumer.h> 5 5 #include <linux/reset.h> 6 6 #include <linux/clk.h> 7 + #include <linux/slab.h> 7 8 #include <linux/dma-mapping.h> 8 9 #include <linux/platform_device.h> 9 10
+1
drivers/gpu/drm/msm/msm_gem_shrinker.c
··· 5 5 */ 6 6 7 7 #include <linux/vmalloc.h> 8 + #include <linux/sched/mm.h> 8 9 9 10 #include "msm_drv.h" 10 11 #include "msm_gem.h"
+2 -1
drivers/gpu/drm/ttm/ttm_bo.c
··· 1103 1103 * as an indication that we're about to swap out. 1104 1104 */ 1105 1105 memset(&place, 0, sizeof(place)); 1106 - place.mem_type = TTM_PL_SYSTEM; 1106 + place.mem_type = bo->resource->mem_type; 1107 1107 if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL)) 1108 1108 return -EBUSY; 1109 1109 ··· 1135 1135 struct ttm_place hop; 1136 1136 1137 1137 memset(&hop, 0, sizeof(hop)); 1138 + place.mem_type = TTM_PL_SYSTEM; 1138 1139 ret = ttm_resource_alloc(bo, &place, &evict_mem); 1139 1140 if (unlikely(ret)) 1140 1141 goto out;
+1
drivers/gpu/drm/ttm/ttm_tt.c
··· 34 34 #include <linux/sched.h> 35 35 #include <linux/shmem_fs.h> 36 36 #include <linux/file.h> 37 + #include <linux/module.h> 37 38 #include <drm/drm_cache.h> 38 39 #include <drm/ttm/ttm_bo_driver.h> 39 40
+5 -5
drivers/hid/Kconfig
··· 207 207 208 208 config HID_CHICONY 209 209 tristate "Chicony devices" 210 - depends on HID 210 + depends on USB_HID 211 211 default !EXPERT 212 212 help 213 213 Support for Chicony Tactical pad and special keys on Chicony keyboards. 214 214 215 215 config HID_CORSAIR 216 216 tristate "Corsair devices" 217 - depends on HID && USB && LEDS_CLASS 217 + depends on USB_HID && LEDS_CLASS 218 218 help 219 219 Support for Corsair devices that are not fully compliant with the 220 220 HID standard. ··· 245 245 246 246 config HID_PRODIKEYS 247 247 tristate "Prodikeys PC-MIDI Keyboard support" 248 - depends on HID && SND 248 + depends on USB_HID && SND 249 249 select SND_RAWMIDI 250 250 help 251 251 Support for Prodikeys PC-MIDI Keyboard device support. ··· 560 560 561 561 config HID_LOGITECH 562 562 tristate "Logitech devices" 563 - depends on HID 563 + depends on USB_HID 564 564 depends on LEDS_CLASS 565 565 default !EXPERT 566 566 help ··· 951 951 952 952 config HID_SAMSUNG 953 953 tristate "Samsung InfraRed remote control or keyboards" 954 - depends on HID 954 + depends on USB_HID 955 955 help 956 956 Support for Samsung InfraRed remote control or keyboards. 957 957
+2 -4
drivers/hid/hid-asus.c
··· 1028 1028 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) 1029 1029 drvdata->tp = &asus_i2c_tp; 1030 1030 1031 - if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && 1032 - hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 1031 + if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && hid_is_usb(hdev)) { 1033 1032 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 1034 1033 1035 1034 if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { ··· 1056 1057 drvdata->tp = &asus_t100chi_tp; 1057 1058 } 1058 1059 1059 - if ((drvdata->quirks & QUIRK_MEDION_E1239T) && 1060 - hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 1060 + if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb(hdev)) { 1061 1061 struct usb_host_interface *alt = 1062 1062 to_usb_interface(hdev->dev.parent)->altsetting; 1063 1063
+1 -1
drivers/hid/hid-bigbenff.c
··· 191 191 struct bigben_device, worker); 192 192 struct hid_field *report_field = bigben->report->field[0]; 193 193 194 - if (bigben->removed) 194 + if (bigben->removed || !report_field) 195 195 return; 196 196 197 197 if (bigben->work_led) {
+3
drivers/hid/hid-chicony.c
··· 114 114 { 115 115 int ret; 116 116 117 + if (!hid_is_usb(hdev)) 118 + return -EINVAL; 119 + 117 120 hdev->quirks |= HID_QUIRK_INPUT_PER_APP; 118 121 ret = hid_parse(hdev); 119 122 if (ret) {
+6 -1
drivers/hid/hid-corsair.c
··· 553 553 int ret; 554 554 unsigned long quirks = id->driver_data; 555 555 struct corsair_drvdata *drvdata; 556 - struct usb_interface *usbif = to_usb_interface(dev->dev.parent); 556 + struct usb_interface *usbif; 557 + 558 + if (!hid_is_usb(dev)) 559 + return -EINVAL; 560 + 561 + usbif = to_usb_interface(dev->dev.parent); 557 562 558 563 drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata), 559 564 GFP_KERNEL);
+1 -1
drivers/hid/hid-elan.c
··· 50 50 51 51 static int is_not_elan_touchpad(struct hid_device *hdev) 52 52 { 53 - if (hdev->bus == BUS_USB) { 53 + if (hid_is_usb(hdev)) { 54 54 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 55 55 56 56 return (intf->altsetting->desc.bInterfaceNumber !=
+3
drivers/hid/hid-elo.c
··· 230 230 int ret; 231 231 struct usb_device *udev; 232 232 233 + if (!hid_is_usb(hdev)) 234 + return -EINVAL; 235 + 233 236 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 234 237 if (!priv) 235 238 return -ENOMEM;
+3
drivers/hid/hid-ft260.c
··· 915 915 struct ft260_get_chip_version_report version; 916 916 int ret; 917 917 918 + if (!hid_is_usb(hdev)) 919 + return -EINVAL; 920 + 918 921 dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); 919 922 if (!dev) 920 923 return -ENOMEM;
+2
drivers/hid/hid-google-hammer.c
··· 586 586 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 587 587 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) }, 588 588 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 589 + USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) }, 590 + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 589 591 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) }, 590 592 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, 591 593 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
+7 -2
drivers/hid/hid-holtek-kbd.c
··· 140 140 static int holtek_kbd_probe(struct hid_device *hdev, 141 141 const struct hid_device_id *id) 142 142 { 143 - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 144 - int ret = hid_parse(hdev); 143 + struct usb_interface *intf; 144 + int ret; 145 145 146 + if (!hid_is_usb(hdev)) 147 + return -EINVAL; 148 + 149 + ret = hid_parse(hdev); 146 150 if (!ret) 147 151 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 148 152 153 + intf = to_usb_interface(hdev->dev.parent); 149 154 if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) { 150 155 struct hid_input *hidinput; 151 156 list_for_each_entry(hidinput, &hdev->inputs, list) {
+9
drivers/hid/hid-holtek-mouse.c
··· 62 62 return rdesc; 63 63 } 64 64 65 + static int holtek_mouse_probe(struct hid_device *hdev, 66 + const struct hid_device_id *id) 67 + { 68 + if (!hid_is_usb(hdev)) 69 + return -EINVAL; 70 + return 0; 71 + } 72 + 65 73 static const struct hid_device_id holtek_mouse_devices[] = { 66 74 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, 67 75 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, ··· 91 83 .name = "holtek_mouse", 92 84 .id_table = holtek_mouse_devices, 93 85 .report_fixup = holtek_mouse_report_fixup, 86 + .probe = holtek_mouse_probe, 94 87 }; 95 88 96 89 module_hid_driver(holtek_mouse_driver);
+3
drivers/hid/hid-ids.h
··· 399 399 #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 400 400 #define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05 401 401 #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 402 + #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 402 403 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 403 404 #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A 404 405 ··· 502 501 #define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d 503 502 #define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044 504 503 #define USB_DEVICE_ID_GOOGLE_DON 0x5050 504 + #define USB_DEVICE_ID_GOOGLE_EEL 0x5057 505 505 506 506 #define USB_VENDOR_ID_GOTOP 0x08f2 507 507 #define USB_DEVICE_ID_SUPER_Q2 0x007f ··· 888 886 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 889 887 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 890 888 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da 889 + #define USB_DEVICE_ID_MS_SURFACE3_COVER 0x07de 891 890 #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd 892 891 #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb 893 892 #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
+2
drivers/hid/hid-input.c
··· 325 325 HID_BATTERY_QUIRK_IGNORE }, 326 326 { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN), 327 327 HID_BATTERY_QUIRK_IGNORE }, 328 + { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN), 329 + HID_BATTERY_QUIRK_IGNORE }, 328 330 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15), 329 331 HID_BATTERY_QUIRK_IGNORE }, 330 332 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
+8 -2
drivers/hid/hid-lg.c
··· 749 749 750 750 static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) 751 751 { 752 - struct usb_interface *iface = to_usb_interface(hdev->dev.parent); 753 - __u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 752 + struct usb_interface *iface; 753 + __u8 iface_num; 754 754 unsigned int connect_mask = HID_CONNECT_DEFAULT; 755 755 struct lg_drv_data *drv_data; 756 756 int ret; 757 + 758 + if (!hid_is_usb(hdev)) 759 + return -EINVAL; 760 + 761 + iface = to_usb_interface(hdev->dev.parent); 762 + iface_num = iface->cur_altsetting->desc.bInterfaceNumber; 757 763 758 764 /* G29 only work with the 1st interface */ 759 765 if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
+1 -1
drivers/hid/hid-logitech-dj.c
··· 1777 1777 case recvr_type_bluetooth: no_dj_interfaces = 2; break; 1778 1778 case recvr_type_dinovo: no_dj_interfaces = 2; break; 1779 1779 } 1780 - if (hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 1780 + if (hid_is_usb(hdev)) { 1781 1781 intf = to_usb_interface(hdev->dev.parent); 1782 1782 if (intf && intf->altsetting->desc.bInterfaceNumber >= 1783 1783 no_dj_interfaces) {
+8 -2
drivers/hid/hid-prodikeys.c
··· 798 798 static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) 799 799 { 800 800 int ret; 801 - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 802 - unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber; 801 + struct usb_interface *intf; 802 + unsigned short ifnum; 803 803 unsigned long quirks = id->driver_data; 804 804 struct pk_device *pk; 805 805 struct pcmidi_snd *pm = NULL; 806 + 807 + if (!hid_is_usb(hdev)) 808 + return -EINVAL; 809 + 810 + intf = to_usb_interface(hdev->dev.parent); 811 + ifnum = intf->cur_altsetting->desc.bInterfaceNumber; 806 812 807 813 pk = kzalloc(sizeof(*pk), GFP_KERNEL); 808 814 if (pk == NULL) {
+1
drivers/hid/hid-quirks.c
··· 124 124 { HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT }, 125 125 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL }, 126 126 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS }, 127 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS }, 127 128 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS }, 128 129 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS }, 129 130 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
+3
drivers/hid/hid-roccat-arvo.c
··· 344 344 { 345 345 int retval; 346 346 347 + if (!hid_is_usb(hdev)) 348 + return -EINVAL; 349 + 347 350 retval = hid_parse(hdev); 348 351 if (retval) { 349 352 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-isku.c
··· 324 324 { 325 325 int retval; 326 326 327 + if (!hid_is_usb(hdev)) 328 + return -EINVAL; 329 + 327 330 retval = hid_parse(hdev); 328 331 if (retval) { 329 332 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-kone.c
··· 749 749 { 750 750 int retval; 751 751 752 + if (!hid_is_usb(hdev)) 753 + return -EINVAL; 754 + 752 755 retval = hid_parse(hdev); 753 756 if (retval) { 754 757 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-koneplus.c
··· 431 431 { 432 432 int retval; 433 433 434 + if (!hid_is_usb(hdev)) 435 + return -EINVAL; 436 + 434 437 retval = hid_parse(hdev); 435 438 if (retval) { 436 439 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-konepure.c
··· 133 133 { 134 134 int retval; 135 135 136 + if (!hid_is_usb(hdev)) 137 + return -EINVAL; 138 + 136 139 retval = hid_parse(hdev); 137 140 if (retval) { 138 141 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-kovaplus.c
··· 501 501 { 502 502 int retval; 503 503 504 + if (!hid_is_usb(hdev)) 505 + return -EINVAL; 506 + 504 507 retval = hid_parse(hdev); 505 508 if (retval) { 506 509 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-lua.c
··· 160 160 { 161 161 int retval; 162 162 163 + if (!hid_is_usb(hdev)) 164 + return -EINVAL; 165 + 163 166 retval = hid_parse(hdev); 164 167 if (retval) { 165 168 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-pyra.c
··· 449 449 { 450 450 int retval; 451 451 452 + if (!hid_is_usb(hdev)) 453 + return -EINVAL; 454 + 452 455 retval = hid_parse(hdev); 453 456 if (retval) { 454 457 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-ryos.c
··· 141 141 { 142 142 int retval; 143 143 144 + if (!hid_is_usb(hdev)) 145 + return -EINVAL; 146 + 144 147 retval = hid_parse(hdev); 145 148 if (retval) { 146 149 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-roccat-savu.c
··· 113 113 { 114 114 int retval; 115 115 116 + if (!hid_is_usb(hdev)) 117 + return -EINVAL; 118 + 116 119 retval = hid_parse(hdev); 117 120 if (retval) { 118 121 hid_err(hdev, "parse failed\n");
+3
drivers/hid/hid-samsung.c
··· 152 152 int ret; 153 153 unsigned int cmask = HID_CONNECT_DEFAULT; 154 154 155 + if (!hid_is_usb(hdev)) 156 + return -EINVAL; 157 + 155 158 ret = hid_parse(hdev); 156 159 if (ret) { 157 160 hid_err(hdev, "parse failed\n");
+18 -6
drivers/hid/hid-sony.c
··· 3000 3000 sc->quirks = quirks; 3001 3001 hid_set_drvdata(hdev, sc); 3002 3002 sc->hdev = hdev; 3003 - usbdev = to_usb_device(sc->hdev->dev.parent->parent); 3004 3003 3005 3004 ret = hid_parse(hdev); 3006 3005 if (ret) { ··· 3037 3038 */ 3038 3039 if (!(hdev->claimed & HID_CLAIMED_INPUT)) { 3039 3040 hid_err(hdev, "failed to claim input\n"); 3040 - hid_hw_stop(hdev); 3041 - return -ENODEV; 3041 + ret = -ENODEV; 3042 + goto err; 3042 3043 } 3043 3044 3044 3045 if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) { 3046 + if (!hid_is_usb(hdev)) { 3047 + ret = -EINVAL; 3048 + goto err; 3049 + } 3050 + 3051 + usbdev = to_usb_device(sc->hdev->dev.parent->parent); 3052 + 3045 3053 sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC); 3046 - if (!sc->ghl_urb) 3047 - return -ENOMEM; 3054 + if (!sc->ghl_urb) { 3055 + ret = -ENOMEM; 3056 + goto err; 3057 + } 3048 3058 3049 3059 if (sc->quirks & GHL_GUITAR_PS3WIIU) 3050 3060 ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data, ··· 3063 3055 ARRAY_SIZE(ghl_ps4_magic_data)); 3064 3056 if (ret) { 3065 3057 hid_err(hdev, "error preparing URB\n"); 3066 - return ret; 3058 + goto err; 3067 3059 } 3068 3060 3069 3061 timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0); ··· 3071 3063 jiffies + GHL_GUITAR_POKE_INTERVAL*HZ); 3072 3064 } 3073 3065 3066 + return ret; 3067 + 3068 + err: 3069 + hid_hw_stop(hdev); 3074 3070 return ret; 3075 3071 } 3076 3072
+3
drivers/hid/hid-thrustmaster.c
··· 274 274 int ret = 0; 275 275 struct tm_wheel *tm_wheel = NULL; 276 276 277 + if (!hid_is_usb(hdev)) 278 + return -EINVAL; 279 + 277 280 ret = hid_parse(hdev); 278 281 if (ret) { 279 282 hid_err(hdev, "parse failed with error %d\n", ret);
+1 -1
drivers/hid/hid-u2fzero.c
··· 311 311 unsigned int minor; 312 312 int ret; 313 313 314 - if (!hid_is_using_ll_driver(hdev, &usb_hid_driver)) 314 + if (!hid_is_usb(hdev)) 315 315 return -EINVAL; 316 316 317 317 dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
+3
drivers/hid/hid-uclogic-core.c
··· 164 164 struct uclogic_drvdata *drvdata = NULL; 165 165 bool params_initialized = false; 166 166 167 + if (!hid_is_usb(hdev)) 168 + return -EINVAL; 169 + 167 170 /* 168 171 * libinput requires the pad interface to be on a different node 169 172 * than the pen, so use QUIRK_MULTI_INPUT for all tablets.
+1 -2
drivers/hid/hid-uclogic-params.c
··· 843 843 struct uclogic_params p = {0, }; 844 844 845 845 /* Check arguments */ 846 - if (params == NULL || hdev == NULL || 847 - !hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 846 + if (params == NULL || hdev == NULL || !hid_is_usb(hdev)) { 848 847 rc = -EINVAL; 849 848 goto cleanup; 850 849 }
+4 -2
drivers/hid/intel-ish-hid/ipc/pci-ish.c
··· 266 266 267 267 if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag 268 268 && IPC_IS_ISH_ILUP(fwsts)) { 269 - disable_irq_wake(pdev->irq); 269 + if (device_may_wakeup(&pdev->dev)) 270 + disable_irq_wake(pdev->irq); 270 271 271 272 ish_set_host_ready(dev); 272 273 ··· 338 337 */ 339 338 pci_save_state(pdev); 340 339 341 - enable_irq_wake(pdev->irq); 340 + if (device_may_wakeup(&pdev->dev)) 341 + enable_irq_wake(pdev->irq); 342 342 } 343 343 } else { 344 344 /*
+13 -6
drivers/hid/wacom_sys.c
··· 726 726 * Skip the query for this type and modify defaults based on 727 727 * interface number. 728 728 */ 729 - if (features->type == WIRELESS) { 729 + if (features->type == WIRELESS && intf) { 730 730 if (intf->cur_altsetting->desc.bInterfaceNumber == 0) 731 731 features->device_type = WACOM_DEVICETYPE_WL_MONITOR; 732 732 else ··· 2214 2214 if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) { 2215 2215 char *product_name = wacom->hdev->name; 2216 2216 2217 - if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) { 2217 + if (hid_is_usb(wacom->hdev)) { 2218 2218 struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent); 2219 2219 struct usb_device *dev = interface_to_usbdev(intf); 2220 2220 product_name = dev->product; ··· 2450 2450 */ 2451 2451 2452 2452 wacom_destroy_battery(wacom); 2453 + 2454 + if (!usbdev) 2455 + return; 2453 2456 2454 2457 /* Stylus interface */ 2455 2458 hdev1 = usb_get_intfdata(usbdev->config->interface[1]); ··· 2733 2730 static int wacom_probe(struct hid_device *hdev, 2734 2731 const struct hid_device_id *id) 2735 2732 { 2736 - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 2737 - struct usb_device *dev = interface_to_usbdev(intf); 2738 2733 struct wacom *wacom; 2739 2734 struct wacom_wac *wacom_wac; 2740 2735 struct wacom_features *features; ··· 2767 2766 wacom_wac->hid_data.inputmode = -1; 2768 2767 wacom_wac->mode_report = -1; 2769 2768 2770 - wacom->usbdev = dev; 2771 - wacom->intf = intf; 2769 + if (hid_is_usb(hdev)) { 2770 + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 2771 + struct usb_device *dev = interface_to_usbdev(intf); 2772 + 2773 + wacom->usbdev = dev; 2774 + wacom->intf = intf; 2775 + } 2776 + 2772 2777 mutex_init(&wacom->lock); 2773 2778 INIT_DELAYED_WORK(&wacom->init_work, wacom_init_work); 2774 2779 INIT_WORK(&wacom->wireless_work, wacom_wireless_work);
+1 -1
drivers/hwmon/corsair-psu.c
··· 729 729 corsairpsu_check_cmd_support(priv); 730 730 731 731 priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "corsairpsu", priv, 732 - &corsairpsu_chip_info, 0); 732 + &corsairpsu_chip_info, NULL); 733 733 734 734 if (IS_ERR(priv->hwmon_dev)) { 735 735 ret = PTR_ERR(priv->hwmon_dev);
+3 -4
drivers/hwmon/dell-smm-hwmon.c
··· 627 627 { 628 628 struct dell_smm_data *data = dev_get_drvdata(dev); 629 629 630 - /* Register the proc entry */ 631 - proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data); 632 - 633 - devm_add_action_or_reset(dev, i8k_exit_procfs, NULL); 630 + /* Only register exit function if creation was successful */ 631 + if (proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data)) 632 + devm_add_action_or_reset(dev, i8k_exit_procfs, NULL); 634 633 } 635 634 636 635 #else
+1 -1
drivers/hwmon/nct6775.c
··· 1527 1527 1528 1528 nct6775_wmi_set_bank(data, reg); 1529 1529 1530 - err = nct6775_asuswmi_read(data->bank, reg, &tmp); 1530 + err = nct6775_asuswmi_read(data->bank, reg & 0xff, &tmp); 1531 1531 if (err) 1532 1532 return 0; 1533 1533
-2
drivers/hwmon/pwm-fan.c
··· 336 336 return ret; 337 337 } 338 338 339 - ctx->pwm_value = MAX_PWM; 340 - 341 339 pwm_init_state(ctx->pwm, &ctx->pwm_state); 342 340 343 341 /*
+2 -2
drivers/hwmon/sht4x.c
··· 23 23 /* 24 24 * I2C command delays (in microseconds) 25 25 */ 26 - #define SHT4X_MEAS_DELAY 1000 26 + #define SHT4X_MEAS_DELAY_HPM 8200 /* see t_MEAS,h in datasheet */ 27 27 #define SHT4X_DELAY_EXTRA 10000 28 28 29 29 /* ··· 90 90 if (ret < 0) 91 91 goto unlock; 92 92 93 - usleep_range(SHT4X_MEAS_DELAY, SHT4X_MEAS_DELAY + SHT4X_DELAY_EXTRA); 93 + usleep_range(SHT4X_MEAS_DELAY_HPM, SHT4X_MEAS_DELAY_HPM + SHT4X_DELAY_EXTRA); 94 94 95 95 ret = i2c_master_recv(client, raw_data, SHT4X_RESPONSE_LENGTH); 96 96 if (ret != SHT4X_RESPONSE_LENGTH) {
+1 -1
drivers/i2c/busses/i2c-mpc.c
··· 636 636 status = readb(i2c->base + MPC_I2C_SR); 637 637 if (status & CSR_MIF) { 638 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); 639 + readb_poll_timeout_atomic(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;
+12 -20
drivers/i2c/busses/i2c-virtio.c
··· 22 22 /** 23 23 * struct virtio_i2c - virtio I2C data 24 24 * @vdev: virtio device for this controller 25 - * @completion: completion of virtio I2C message 26 25 * @adap: I2C adapter for this controller 27 26 * @vq: the virtio virtqueue for communication 28 27 */ 29 28 struct virtio_i2c { 30 29 struct virtio_device *vdev; 31 - struct completion completion; 32 30 struct i2c_adapter adap; 33 31 struct virtqueue *vq; 34 32 }; 35 33 36 34 /** 37 35 * struct virtio_i2c_req - the virtio I2C request structure 36 + * @completion: completion of virtio I2C message 38 37 * @out_hdr: the OUT header of the virtio I2C message 39 38 * @buf: the buffer into which data is read, or from which it's written 40 39 * @in_hdr: the IN header of the virtio I2C message 41 40 */ 42 41 struct virtio_i2c_req { 42 + struct completion completion; 43 43 struct virtio_i2c_out_hdr out_hdr ____cacheline_aligned; 44 44 uint8_t *buf ____cacheline_aligned; 45 45 struct virtio_i2c_in_hdr in_hdr ____cacheline_aligned; ··· 47 47 48 48 static void virtio_i2c_msg_done(struct virtqueue *vq) 49 49 { 50 - struct virtio_i2c *vi = vq->vdev->priv; 50 + struct virtio_i2c_req *req; 51 + unsigned int len; 51 52 52 - complete(&vi->completion); 53 + while ((req = virtqueue_get_buf(vq, &len))) 54 + complete(&req->completion); 53 55 } 54 56 55 57 static int virtio_i2c_prepare_reqs(struct virtqueue *vq, ··· 63 61 64 62 for (i = 0; i < num; i++) { 65 63 int outcnt = 0, incnt = 0; 64 + 65 + init_completion(&reqs[i].completion); 66 66 67 67 /* 68 68 * Only 7-bit mode supported for this moment. For the address ··· 110 106 struct virtio_i2c_req *reqs, 111 107 struct i2c_msg *msgs, int num) 112 108 { 113 - struct virtio_i2c_req *req; 114 109 bool failed = false; 115 - unsigned int len; 116 110 int i, j = 0; 117 111 118 112 for (i = 0; i < num; i++) { 119 - /* Detach the ith request from the vq */ 120 - req = virtqueue_get_buf(vq, &len); 113 + struct virtio_i2c_req *req = &reqs[i]; 121 114 122 - /* 123 - * Condition req == &reqs[i] should always meet since we have 124 - * total num requests in the vq. reqs[i] can never be NULL here. 125 - */ 126 - if (!failed && (WARN_ON(req != &reqs[i]) || 127 - req->in_hdr.status != VIRTIO_I2C_MSG_OK)) 115 + wait_for_completion(&req->completion); 116 + 117 + if (!failed && req->in_hdr.status != VIRTIO_I2C_MSG_OK) 128 118 failed = true; 129 119 130 120 i2c_put_dma_safe_msg_buf(reqs[i].buf, &msgs[i], !failed); ··· 154 156 * remote here to clear the virtqueue, so we can try another set of 155 157 * messages later on. 156 158 */ 157 - 158 - reinit_completion(&vi->completion); 159 159 virtqueue_kick(vq); 160 - 161 - wait_for_completion(&vi->completion); 162 160 163 161 count = virtio_i2c_complete_reqs(vq, reqs, msgs, count); 164 162 ··· 203 209 204 210 vdev->priv = vi; 205 211 vi->vdev = vdev; 206 - 207 - init_completion(&vi->completion); 208 212 209 213 ret = virtio_i2c_setup_vqs(vi); 210 214 if (ret)
+2 -3
drivers/iio/accel/kxcjk-1013.c
··· 1595 1595 return 0; 1596 1596 1597 1597 err_buffer_cleanup: 1598 - if (data->dready_trig) 1599 - iio_triggered_buffer_cleanup(indio_dev); 1598 + iio_triggered_buffer_cleanup(indio_dev); 1600 1599 err_trigger_unregister: 1601 1600 if (data->dready_trig) 1602 1601 iio_trigger_unregister(data->dready_trig); ··· 1617 1618 pm_runtime_disable(&client->dev); 1618 1619 pm_runtime_set_suspended(&client->dev); 1619 1620 1621 + iio_triggered_buffer_cleanup(indio_dev); 1620 1622 if (data->dready_trig) { 1621 - iio_triggered_buffer_cleanup(indio_dev); 1622 1623 iio_trigger_unregister(data->dready_trig); 1623 1624 iio_trigger_unregister(data->motion_trig); 1624 1625 }
+3 -3
drivers/iio/accel/kxsd9.c
··· 224 224 hw_values.chan, 225 225 sizeof(hw_values.chan)); 226 226 if (ret) { 227 - dev_err(st->dev, 228 - "error reading data\n"); 229 - return ret; 227 + dev_err(st->dev, "error reading data: %d\n", ret); 228 + goto out; 230 229 } 231 230 232 231 iio_push_to_buffers_with_timestamp(indio_dev, 233 232 &hw_values, 234 233 iio_get_time_ns(indio_dev)); 234 + out: 235 235 iio_trigger_notify_done(indio_dev->trig); 236 236 237 237 return IRQ_HANDLED;
+1 -1
drivers/iio/accel/mma8452.c
··· 1470 1470 if (ret) 1471 1471 return ret; 1472 1472 1473 - indio_dev->trig = trig; 1473 + indio_dev->trig = iio_trigger_get(trig); 1474 1474 1475 1475 return 0; 1476 1476 }
+1 -1
drivers/iio/adc/Kconfig
··· 532 532 533 533 config IMX8QXP_ADC 534 534 tristate "NXP IMX8QXP ADC driver" 535 - depends on ARCH_MXC_ARM64 || COMPILE_TEST 535 + depends on ARCH_MXC || COMPILE_TEST 536 536 depends on HAS_IOMEM 537 537 help 538 538 Say yes here to build support for IMX8QXP ADC.
+1 -1
drivers/iio/adc/ad7768-1.c
··· 480 480 iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan, 481 481 iio_get_time_ns(indio_dev)); 482 482 483 - iio_trigger_notify_done(indio_dev->trig); 484 483 err_unlock: 484 + iio_trigger_notify_done(indio_dev->trig); 485 485 mutex_unlock(&st->lock); 486 486 487 487 return IRQ_HANDLED;
+2 -1
drivers/iio/adc/at91-sama5d2_adc.c
··· 1586 1586 *val = st->conversion_value; 1587 1587 ret = at91_adc_adjust_val_osr(st, val); 1588 1588 if (chan->scan_type.sign == 's') 1589 - *val = sign_extend32(*val, 11); 1589 + *val = sign_extend32(*val, 1590 + chan->scan_type.realbits - 1); 1590 1591 st->conversion_done = false; 1591 1592 } 1592 1593
+3 -15
drivers/iio/adc/axp20x_adc.c
··· 251 251 struct iio_chan_spec const *chan, int *val) 252 252 { 253 253 struct axp20x_adc_iio *info = iio_priv(indio_dev); 254 - int size; 255 254 256 - /* 257 - * N.B.: Unlike the Chinese datasheets tell, the charging current is 258 - * stored on 12 bits, not 13 bits. Only discharging current is on 13 259 - * bits. 260 - */ 261 - if (chan->type == IIO_CURRENT && chan->channel == AXP22X_BATT_DISCHRG_I) 262 - size = 13; 263 - else 264 - size = 12; 265 - 266 - *val = axp20x_read_variable_width(info->regmap, chan->address, size); 255 + *val = axp20x_read_variable_width(info->regmap, chan->address, 12); 267 256 if (*val < 0) 268 257 return *val; 269 258 ··· 375 386 return IIO_VAL_INT_PLUS_MICRO; 376 387 377 388 case IIO_CURRENT: 378 - *val = 0; 379 - *val2 = 500000; 380 - return IIO_VAL_INT_PLUS_MICRO; 389 + *val = 1; 390 + return IIO_VAL_INT; 381 391 382 392 case IIO_TEMP: 383 393 *val = 100;
+12 -9
drivers/iio/adc/dln2-adc.c
··· 248 248 static int dln2_adc_read(struct dln2_adc *dln2, unsigned int channel) 249 249 { 250 250 int ret, i; 251 - struct iio_dev *indio_dev = platform_get_drvdata(dln2->pdev); 252 251 u16 conflict; 253 252 __le16 value; 254 253 int olen = sizeof(value); ··· 256 257 .chan = channel, 257 258 }; 258 259 259 - ret = iio_device_claim_direct_mode(indio_dev); 260 - if (ret < 0) 261 - return ret; 262 - 263 260 ret = dln2_adc_set_chan_enabled(dln2, channel, true); 264 261 if (ret < 0) 265 - goto release_direct; 262 + return ret; 266 263 267 264 ret = dln2_adc_set_port_enabled(dln2, true, &conflict); 268 265 if (ret < 0) { ··· 295 300 dln2_adc_set_port_enabled(dln2, false, NULL); 296 301 disable_chan: 297 302 dln2_adc_set_chan_enabled(dln2, channel, false); 298 - release_direct: 299 - iio_device_release_direct_mode(indio_dev); 300 303 301 304 return ret; 302 305 } ··· 330 337 331 338 switch (mask) { 332 339 case IIO_CHAN_INFO_RAW: 340 + ret = iio_device_claim_direct_mode(indio_dev); 341 + if (ret < 0) 342 + return ret; 343 + 333 344 mutex_lock(&dln2->mutex); 334 345 ret = dln2_adc_read(dln2, chan->channel); 335 346 mutex_unlock(&dln2->mutex); 347 + 348 + iio_device_release_direct_mode(indio_dev); 336 349 337 350 if (ret < 0) 338 351 return ret; ··· 655 656 return -ENOMEM; 656 657 } 657 658 iio_trigger_set_drvdata(dln2->trig, dln2); 658 - devm_iio_trigger_register(dev, dln2->trig); 659 + ret = devm_iio_trigger_register(dev, dln2->trig); 660 + if (ret) { 661 + dev_err(dev, "failed to register trigger: %d\n", ret); 662 + return ret; 663 + } 659 664 iio_trigger_set_immutable(indio_dev, dln2->trig); 660 665 661 666 ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
+2 -1
drivers/iio/adc/stm32-adc.c
··· 1117 1117 { 1118 1118 struct stm32_adc *adc = iio_priv(indio_dev); 1119 1119 1120 + stm32_adc_writel(adc, STM32H7_ADC_PCSEL, 0); 1120 1121 stm32h7_adc_disable(indio_dev); 1121 1122 stm32_adc_int_ch_disable(adc); 1122 1123 stm32h7_adc_enter_pwr_down(adc); ··· 1987 1986 /* Get calibration data for vrefint channel */ 1988 1987 ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint); 1989 1988 if (ret && ret != -ENOENT) { 1990 - return dev_err_probe(&indio_dev->dev, ret, 1989 + return dev_err_probe(indio_dev->dev.parent, ret, 1991 1990 "nvmem access error\n"); 1992 1991 } 1993 1992 if (ret == -ENOENT)
+3 -2
drivers/iio/gyro/adxrs290.c
··· 7 7 */ 8 8 9 9 #include <linux/bitfield.h> 10 + #include <linux/bitops.h> 10 11 #include <linux/delay.h> 11 12 #include <linux/device.h> 12 13 #include <linux/kernel.h> ··· 125 124 goto err_unlock; 126 125 } 127 126 128 - *val = temp; 127 + *val = sign_extend32(temp, 15); 129 128 130 129 err_unlock: 131 130 mutex_unlock(&st->lock); ··· 147 146 } 148 147 149 148 /* extract lower 12 bits temperature reading */ 150 - *val = temp & 0x0FFF; 149 + *val = sign_extend32(temp, 11); 151 150 152 151 err_unlock: 153 152 mutex_unlock(&st->lock);
+1 -1
drivers/iio/gyro/itg3200_buffer.c
··· 61 61 62 62 iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp); 63 63 64 + error_ret: 64 65 iio_trigger_notify_done(indio_dev->trig); 65 66 66 - error_ret: 67 67 return IRQ_HANDLED; 68 68 } 69 69
-1
drivers/iio/industrialio-trigger.c
··· 556 556 irq_modify_status(trig->subirq_base + i, 557 557 IRQ_NOREQUEST | IRQ_NOAUTOEN, IRQ_NOPROBE); 558 558 } 559 - get_device(&trig->dev); 560 559 561 560 return trig; 562 561
+1 -1
drivers/iio/light/ltr501.c
··· 1275 1275 ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1, 1276 1276 als_buf, sizeof(als_buf)); 1277 1277 if (ret < 0) 1278 - return ret; 1278 + goto done; 1279 1279 if (test_bit(0, indio_dev->active_scan_mask)) 1280 1280 scan.channels[j++] = le16_to_cpu(als_buf[1]); 1281 1281 if (test_bit(1, indio_dev->active_scan_mask))
+3 -3
drivers/iio/light/stk3310.c
··· 546 546 mutex_lock(&data->lock); 547 547 ret = regmap_field_read(data->reg_flag_nf, &dir); 548 548 if (ret < 0) { 549 - dev_err(&data->client->dev, "register read failed\n"); 550 - mutex_unlock(&data->lock); 551 - return ret; 549 + dev_err(&data->client->dev, "register read failed: %d\n", ret); 550 + goto out; 552 551 } 553 552 event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, 554 553 IIO_EV_TYPE_THRESH, ··· 559 560 ret = regmap_field_write(data->reg_flag_psint, 0); 560 561 if (ret < 0) 561 562 dev_err(&data->client->dev, "failed to reset interrupts\n"); 563 + out: 562 564 mutex_unlock(&data->lock); 563 565 564 566 return IRQ_HANDLED;
+1 -1
drivers/iio/trigger/stm32-timer-trigger.c
··· 912 912 }; 913 913 module_platform_driver(stm32_timer_trigger_driver); 914 914 915 - MODULE_ALIAS("platform: stm32-timer-trigger"); 915 + MODULE_ALIAS("platform:stm32-timer-trigger"); 916 916 MODULE_DESCRIPTION("STMicroelectronics STM32 Timer Trigger driver"); 917 917 MODULE_LICENSE("GPL v2");
+2
drivers/infiniband/hw/hfi1/chip.c
··· 8415 8415 */ 8416 8416 static void __hfi1_rcd_eoi_intr(struct hfi1_ctxtdata *rcd) 8417 8417 { 8418 + if (!rcd->rcvhdrq) 8419 + return; 8418 8420 clear_recv_intr(rcd); 8419 8421 if (check_packet_present(rcd)) 8420 8422 force_recv_intr(rcd);
+2
drivers/infiniband/hw/hfi1/driver.c
··· 1012 1012 struct hfi1_packet packet; 1013 1013 int skip_pkt = 0; 1014 1014 1015 + if (!rcd->rcvhdrq) 1016 + return RCV_PKT_OK; 1015 1017 /* Control context will always use the slow path interrupt handler */ 1016 1018 needset = (rcd->ctxt == HFI1_CTRL_CTXT) ? 0 : 1; 1017 1019
+17 -23
drivers/infiniband/hw/hfi1/init.c
··· 113 113 rcd->fast_handler = get_dma_rtail_setting(rcd) ? 114 114 handle_receive_interrupt_dma_rtail : 115 115 handle_receive_interrupt_nodma_rtail; 116 - rcd->slow_handler = handle_receive_interrupt; 117 116 118 117 hfi1_set_seq_cnt(rcd, 1); 119 118 ··· 333 334 rcd->numa_id = numa; 334 335 rcd->rcv_array_groups = dd->rcv_entries.ngroups; 335 336 rcd->rhf_rcv_function_map = normal_rhf_rcv_functions; 337 + rcd->slow_handler = handle_receive_interrupt; 338 + rcd->do_interrupt = rcd->slow_handler; 336 339 rcd->msix_intr = CCE_NUM_MSIX_VECTORS; 337 340 338 341 mutex_init(&rcd->exp_mutex); ··· 875 874 if (ret) 876 875 goto done; 877 876 878 - /* allocate dummy tail memory for all receive contexts */ 879 - dd->rcvhdrtail_dummy_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, 880 - sizeof(u64), 881 - &dd->rcvhdrtail_dummy_dma, 882 - GFP_KERNEL); 883 - 884 - if (!dd->rcvhdrtail_dummy_kvaddr) { 885 - dd_dev_err(dd, "cannot allocate dummy tail memory\n"); 886 - ret = -ENOMEM; 887 - goto done; 888 - } 889 - 890 877 /* dd->rcd can be NULL if early initialization failed */ 891 878 for (i = 0; dd->rcd && i < dd->first_dyn_alloc_ctxt; ++i) { 892 879 /* ··· 886 897 rcd = hfi1_rcd_get_by_index(dd, i); 887 898 if (!rcd) 888 899 continue; 889 - 890 - rcd->do_interrupt = &handle_receive_interrupt; 891 900 892 901 lastfail = hfi1_create_rcvhdrq(dd, rcd); 893 902 if (!lastfail) ··· 1107 1120 rcd->egrbufs.rcvtids = NULL; 1108 1121 1109 1122 for (e = 0; e < rcd->egrbufs.alloced; e++) { 1110 - if (rcd->egrbufs.buffers[e].dma) 1123 + if (rcd->egrbufs.buffers[e].addr) 1111 1124 dma_free_coherent(&dd->pcidev->dev, 1112 1125 rcd->egrbufs.buffers[e].len, 1113 1126 rcd->egrbufs.buffers[e].addr, ··· 1188 1201 dd->tx_opstats = NULL; 1189 1202 kfree(dd->comp_vect); 1190 1203 dd->comp_vect = NULL; 1204 + if (dd->rcvhdrtail_dummy_kvaddr) 1205 + dma_free_coherent(&dd->pcidev->dev, sizeof(u64), 1206 + (void *)dd->rcvhdrtail_dummy_kvaddr, 1207 + dd->rcvhdrtail_dummy_dma); 1208 + dd->rcvhdrtail_dummy_kvaddr = NULL; 1191 1209 sdma_clean(dd, dd->num_sdma); 1192 1210 rvt_dealloc_device(&dd->verbs_dev.rdi); 1193 1211 } ··· 1286 1294 1287 1295 dd->comp_vect = kzalloc(sizeof(*dd->comp_vect), GFP_KERNEL); 1288 1296 if (!dd->comp_vect) { 1297 + ret = -ENOMEM; 1298 + goto bail; 1299 + } 1300 + 1301 + /* allocate dummy tail memory for all receive contexts */ 1302 + dd->rcvhdrtail_dummy_kvaddr = 1303 + dma_alloc_coherent(&dd->pcidev->dev, sizeof(u64), 1304 + &dd->rcvhdrtail_dummy_dma, GFP_KERNEL); 1305 + if (!dd->rcvhdrtail_dummy_kvaddr) { 1289 1306 ret = -ENOMEM; 1290 1307 goto bail; 1291 1308 } ··· 1505 1504 } 1506 1505 1507 1506 free_credit_return(dd); 1508 - 1509 - if (dd->rcvhdrtail_dummy_kvaddr) { 1510 - dma_free_coherent(&dd->pcidev->dev, sizeof(u64), 1511 - (void *)dd->rcvhdrtail_dummy_kvaddr, 1512 - dd->rcvhdrtail_dummy_dma); 1513 - dd->rcvhdrtail_dummy_kvaddr = NULL; 1514 - } 1515 1507 1516 1508 /* 1517 1509 * Free any resources still in use (usually just kernel contexts)
+1 -1
drivers/infiniband/hw/hfi1/sdma.c
··· 838 838 if (current->nr_cpus_allowed != 1) 839 839 goto out; 840 840 841 - cpu_id = smp_processor_id(); 842 841 rcu_read_lock(); 842 + cpu_id = smp_processor_id(); 843 843 rht_node = rhashtable_lookup(dd->sdma_rht, &cpu_id, 844 844 sdma_rht_params); 845 845
+11 -3
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
··· 33 33 #include <linux/acpi.h> 34 34 #include <linux/etherdevice.h> 35 35 #include <linux/interrupt.h> 36 + #include <linux/iopoll.h> 36 37 #include <linux/kernel.h> 37 38 #include <linux/types.h> 38 39 #include <net/addrconf.h> ··· 1051 1050 unsigned long instance_stage, 1052 1051 unsigned long reset_stage) 1053 1052 { 1053 + #define HW_RESET_TIMEOUT_US 1000000 1054 + #define HW_RESET_SLEEP_US 1000 1055 + 1054 1056 struct hns_roce_v2_priv *priv = hr_dev->priv; 1055 1057 struct hnae3_handle *handle = priv->handle; 1056 1058 const struct hnae3_ae_ops *ops = handle->ae_algo->ops; 1059 + unsigned long val; 1060 + int ret; 1057 1061 1058 1062 /* When hardware reset is detected, we should stop sending mailbox&cmq& 1059 1063 * doorbell to hardware. If now in .init_instance() function, we should ··· 1070 1064 * again. 1071 1065 */ 1072 1066 hr_dev->dis_db = true; 1073 - if (!ops->get_hw_reset_stat(handle)) 1067 + 1068 + ret = read_poll_timeout(ops->ae_dev_reset_cnt, val, 1069 + val > hr_dev->reset_cnt, HW_RESET_SLEEP_US, 1070 + HW_RESET_TIMEOUT_US, false, handle); 1071 + if (!ret) 1074 1072 hr_dev->is_reset = true; 1075 1073 1076 1074 if (!hr_dev->is_reset || reset_stage == HNS_ROCE_STATE_RST_INIT || ··· 6397 6387 if (!hr_dev) 6398 6388 return 0; 6399 6389 6400 - hr_dev->is_reset = true; 6401 6390 hr_dev->active = false; 6402 6391 hr_dev->dis_db = true; 6403 - 6404 6392 hr_dev->state = HNS_ROCE_DEVICE_STATE_RST_DOWN; 6405 6393 6406 6394 return 0;
+6 -1
drivers/infiniband/hw/irdma/hw.c
··· 60 60 { 61 61 struct irdma_cq *cq = iwcq->back_cq; 62 62 63 + if (!cq->user_mode) 64 + cq->armed = false; 63 65 if (cq->ibcq.comp_handler) 64 66 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); 65 67 } ··· 148 146 qp->flush_code = FLUSH_PROT_ERR; 149 147 break; 150 148 case IRDMA_AE_AMP_BAD_QP: 149 + case IRDMA_AE_WQE_UNEXPECTED_OPCODE: 151 150 qp->flush_code = FLUSH_LOC_QP_OP_ERR; 152 151 break; 153 152 case IRDMA_AE_AMP_BAD_STAG_KEY: ··· 159 156 case IRDMA_AE_PRIV_OPERATION_DENIED: 160 157 case IRDMA_AE_IB_INVALID_REQUEST: 161 158 case IRDMA_AE_IB_REMOTE_ACCESS_ERROR: 162 - case IRDMA_AE_IB_REMOTE_OP_ERROR: 163 159 qp->flush_code = FLUSH_REM_ACCESS_ERR; 164 160 qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; 165 161 break; ··· 185 183 case IRDMA_AE_AMP_MWBIND_BIND_DISABLED: 186 184 case IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS: 187 185 qp->flush_code = FLUSH_MW_BIND_ERR; 186 + break; 187 + case IRDMA_AE_IB_REMOTE_OP_ERROR: 188 + qp->flush_code = FLUSH_REM_OP_ERR; 188 189 break; 189 190 default: 190 191 qp->flush_code = FLUSH_FATAL_ERR;
+1
drivers/infiniband/hw/irdma/main.h
··· 542 542 void (*callback_fcn)(struct irdma_cqp_request *cqp_request), 543 543 void *cb_param); 544 544 void irdma_gsi_ud_qp_ah_cb(struct irdma_cqp_request *cqp_request); 545 + bool irdma_cq_empty(struct irdma_cq *iwcq); 545 546 int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event, 546 547 void *ptr); 547 548 int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event,
+3 -5
drivers/infiniband/hw/irdma/pble.c
··· 25 25 list_del(&chunk->list); 26 26 if (chunk->type == PBLE_SD_PAGED) 27 27 irdma_pble_free_paged_mem(chunk); 28 - if (chunk->bitmapbuf) 29 - kfree(chunk->bitmapmem.va); 28 + bitmap_free(chunk->bitmapbuf); 30 29 kfree(chunk->chunkmem.va); 31 30 } 32 31 } ··· 282 283 "PBLE: next_fpm_addr = %llx chunk_size[%llu] = 0x%llx\n", 283 284 pble_rsrc->next_fpm_addr, chunk->size, chunk->size); 284 285 pble_rsrc->unallocated_pble -= (u32)(chunk->size >> 3); 285 - list_add(&chunk->list, &pble_rsrc->pinfo.clist); 286 286 sd_reg_val = (sd_entry_type == IRDMA_SD_TYPE_PAGED) ? 287 287 sd_entry->u.pd_table.pd_page_addr.pa : 288 288 sd_entry->u.bp.addr.pa; ··· 293 295 goto error; 294 296 } 295 297 298 + list_add(&chunk->list, &pble_rsrc->pinfo.clist); 296 299 sd_entry->valid = true; 297 300 return 0; 298 301 299 302 error: 300 - if (chunk->bitmapbuf) 301 - kfree(chunk->bitmapmem.va); 303 + bitmap_free(chunk->bitmapbuf); 302 304 kfree(chunk->chunkmem.va); 303 305 304 306 return ret_code;
-1
drivers/infiniband/hw/irdma/pble.h
··· 78 78 u32 pg_cnt; 79 79 enum irdma_alloc_type type; 80 80 struct irdma_sc_dev *dev; 81 - struct irdma_virt_mem bitmapmem; 82 81 struct irdma_virt_mem chunkmem; 83 82 }; 84 83
+17 -7
drivers/infiniband/hw/irdma/utils.c
··· 2239 2239 2240 2240 sizeofbitmap = (u64)pchunk->size >> pprm->pble_shift; 2241 2241 2242 - pchunk->bitmapmem.size = sizeofbitmap >> 3; 2243 - pchunk->bitmapmem.va = kzalloc(pchunk->bitmapmem.size, GFP_KERNEL); 2244 - 2245 - if (!pchunk->bitmapmem.va) 2242 + pchunk->bitmapbuf = bitmap_zalloc(sizeofbitmap, GFP_KERNEL); 2243 + if (!pchunk->bitmapbuf) 2246 2244 return IRDMA_ERR_NO_MEMORY; 2247 - 2248 - pchunk->bitmapbuf = pchunk->bitmapmem.va; 2249 - bitmap_zero(pchunk->bitmapbuf, sizeofbitmap); 2250 2245 2251 2246 pchunk->sizeofbitmap = sizeofbitmap; 2252 2247 /* each pble is 8 bytes hence shift by 3 */ ··· 2485 2490 ibevent.device = iwqp->ibqp.device; 2486 2491 ibevent.element.qp = &iwqp->ibqp; 2487 2492 iwqp->ibqp.event_handler(&ibevent, iwqp->ibqp.qp_context); 2493 + } 2494 + 2495 + bool irdma_cq_empty(struct irdma_cq *iwcq) 2496 + { 2497 + struct irdma_cq_uk *ukcq; 2498 + u64 qword3; 2499 + __le64 *cqe; 2500 + u8 polarity; 2501 + 2502 + ukcq = &iwcq->sc_cq.cq_uk; 2503 + cqe = IRDMA_GET_CURRENT_CQ_ELEM(ukcq); 2504 + get_64bit_val(cqe, 24, &qword3); 2505 + polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword3); 2506 + 2507 + return polarity != ukcq->polarity; 2488 2508 }
+18 -5
drivers/infiniband/hw/irdma/verbs.c
··· 3584 3584 struct irdma_cq *iwcq; 3585 3585 struct irdma_cq_uk *ukcq; 3586 3586 unsigned long flags; 3587 - enum irdma_cmpl_notify cq_notify = IRDMA_CQ_COMPL_EVENT; 3587 + enum irdma_cmpl_notify cq_notify; 3588 + bool promo_event = false; 3589 + int ret = 0; 3588 3590 3591 + cq_notify = notify_flags == IB_CQ_SOLICITED ? 3592 + IRDMA_CQ_COMPL_SOLICITED : IRDMA_CQ_COMPL_EVENT; 3589 3593 iwcq = to_iwcq(ibcq); 3590 3594 ukcq = &iwcq->sc_cq.cq_uk; 3591 - if (notify_flags == IB_CQ_SOLICITED) 3592 - cq_notify = IRDMA_CQ_COMPL_SOLICITED; 3593 3595 3594 3596 spin_lock_irqsave(&iwcq->lock, flags); 3595 - irdma_uk_cq_request_notification(ukcq, cq_notify); 3597 + /* Only promote to arm the CQ for any event if the last arm event was solicited. */ 3598 + if (iwcq->last_notify == IRDMA_CQ_COMPL_SOLICITED && notify_flags != IB_CQ_SOLICITED) 3599 + promo_event = true; 3600 + 3601 + if (!iwcq->armed || promo_event) { 3602 + iwcq->armed = true; 3603 + iwcq->last_notify = cq_notify; 3604 + irdma_uk_cq_request_notification(ukcq, cq_notify); 3605 + } 3606 + 3607 + if ((notify_flags & IB_CQ_REPORT_MISSED_EVENTS) && !irdma_cq_empty(iwcq)) 3608 + ret = 1; 3596 3609 spin_unlock_irqrestore(&iwcq->lock, flags); 3597 3610 3598 - return 0; 3611 + return ret; 3599 3612 } 3600 3613 3601 3614 static int irdma_roce_port_immutable(struct ib_device *ibdev, u32 port_num,
+2
drivers/infiniband/hw/irdma/verbs.h
··· 110 110 u16 cq_size; 111 111 u16 cq_num; 112 112 bool user_mode; 113 + bool armed; 114 + enum irdma_cmpl_notify last_notify; 113 115 u32 polled_cmpls; 114 116 u32 cq_mem_size; 115 117 struct irdma_dma_mem kmem;
+3 -3
drivers/infiniband/hw/mlx5/mlx5_ib.h
··· 664 664 665 665 /* User MR data */ 666 666 struct mlx5_cache_ent *cache_ent; 667 - struct ib_umem *umem; 668 667 669 668 /* This is zero'd when the MR is allocated */ 670 669 union { ··· 675 676 struct list_head list; 676 677 }; 677 678 678 - /* Used only by kernel MRs (umem == NULL) */ 679 + /* Used only by kernel MRs */ 679 680 struct { 680 681 void *descs; 681 682 void *descs_alloc; ··· 696 697 int data_length; 697 698 }; 698 699 699 - /* Used only by User MRs (umem != NULL) */ 700 + /* Used only by User MRs */ 700 701 struct { 702 + struct ib_umem *umem; 701 703 unsigned int page_shift; 702 704 /* Current access_flags */ 703 705 int access_flags;
+12 -14
drivers/infiniband/hw/mlx5/mr.c
··· 1904 1904 return ret; 1905 1905 } 1906 1906 1907 - static void 1908 - mlx5_free_priv_descs(struct mlx5_ib_mr *mr) 1907 + static void mlx5_free_priv_descs(struct mlx5_ib_mr *mr) 1909 1908 { 1910 - if (!mr->umem && mr->descs) { 1911 - struct ib_device *device = mr->ibmr.device; 1912 - int size = mr->max_descs * mr->desc_size; 1913 - struct mlx5_ib_dev *dev = to_mdev(device); 1909 + struct mlx5_ib_dev *dev = to_mdev(mr->ibmr.device); 1910 + int size = mr->max_descs * mr->desc_size; 1914 1911 1915 - dma_unmap_single(&dev->mdev->pdev->dev, mr->desc_map, size, 1916 - DMA_TO_DEVICE); 1917 - kfree(mr->descs_alloc); 1918 - mr->descs = NULL; 1919 - } 1912 + if (!mr->descs) 1913 + return; 1914 + 1915 + dma_unmap_single(&dev->mdev->pdev->dev, mr->desc_map, size, 1916 + DMA_TO_DEVICE); 1917 + kfree(mr->descs_alloc); 1918 + mr->descs = NULL; 1920 1919 } 1921 1920 1922 1921 int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) ··· 1991 1992 if (mr->cache_ent) { 1992 1993 mlx5_mr_cache_free(dev, mr); 1993 1994 } else { 1994 - mlx5_free_priv_descs(mr); 1995 + if (!udata) 1996 + mlx5_free_priv_descs(mr); 1995 1997 kfree(mr); 1996 1998 } 1997 1999 return 0; ··· 2079 2079 if (err) 2080 2080 goto err_free_in; 2081 2081 2082 - mr->umem = NULL; 2083 2082 kfree(in); 2084 2083 2085 2084 return mr; ··· 2205 2206 } 2206 2207 2207 2208 mr->ibmr.device = pd->device; 2208 - mr->umem = NULL; 2209 2209 2210 2210 switch (mr_type) { 2211 2211 case IB_MR_TYPE_MEM_REG:
+1
drivers/infiniband/sw/rxe/rxe_qp.c
··· 359 359 360 360 err2: 361 361 rxe_queue_cleanup(qp->sq.queue); 362 + qp->sq.queue = NULL; 362 363 err1: 363 364 qp->pd = NULL; 364 365 qp->rcq = NULL;
+6 -3
drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c
··· 19 19 int cpu; 20 20 21 21 cpu = raw_smp_processor_id(); 22 - s = this_cpu_ptr(stats->pcpu_stats); 22 + s = get_cpu_ptr(stats->pcpu_stats); 23 23 if (con->cpu != cpu) { 24 24 s->cpu_migr.to++; 25 25 ··· 27 27 s = per_cpu_ptr(stats->pcpu_stats, con->cpu); 28 28 atomic_inc(&s->cpu_migr.from); 29 29 } 30 + put_cpu_ptr(stats->pcpu_stats); 30 31 } 31 32 32 33 void rtrs_clt_inc_failover_cnt(struct rtrs_clt_stats *stats) 33 34 { 34 35 struct rtrs_clt_stats_pcpu *s; 35 36 36 - s = this_cpu_ptr(stats->pcpu_stats); 37 + s = get_cpu_ptr(stats->pcpu_stats); 37 38 s->rdma.failover_cnt++; 39 + put_cpu_ptr(stats->pcpu_stats); 38 40 } 39 41 40 42 int rtrs_clt_stats_migration_from_cnt_to_str(struct rtrs_clt_stats *stats, char *buf) ··· 171 169 { 172 170 struct rtrs_clt_stats_pcpu *s; 173 171 174 - s = this_cpu_ptr(stats->pcpu_stats); 172 + s = get_cpu_ptr(stats->pcpu_stats); 175 173 s->rdma.dir[d].cnt++; 176 174 s->rdma.dir[d].size_total += size; 175 + put_cpu_ptr(stats->pcpu_stats); 177 176 } 178 177 179 178 void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir)
+1 -1
drivers/irqchip/irq-apple-aic.c
··· 707 707 .free = aic_ipi_free, 708 708 }; 709 709 710 - static int aic_init_smp(struct aic_irq_chip *irqc, struct device_node *node) 710 + static int __init aic_init_smp(struct aic_irq_chip *irqc, struct device_node *node) 711 711 { 712 712 struct irq_domain *ipi_domain; 713 713 int base_ipi;
+7 -11
drivers/irqchip/irq-armada-370-xp.c
··· 232 232 int hwirq, i; 233 233 234 234 mutex_lock(&msi_used_lock); 235 - 236 - hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR, 237 - 0, nr_irqs, 0); 238 - if (hwirq >= PCI_MSI_DOORBELL_NR) { 239 - mutex_unlock(&msi_used_lock); 240 - return -ENOSPC; 241 - } 242 - 243 - bitmap_set(msi_used, hwirq, nr_irqs); 235 + hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR, 236 + order_base_2(nr_irqs)); 244 237 mutex_unlock(&msi_used_lock); 238 + 239 + if (hwirq < 0) 240 + return -ENOSPC; 245 241 246 242 for (i = 0; i < nr_irqs; i++) { 247 243 irq_domain_set_info(domain, virq + i, hwirq + i, ··· 246 250 NULL, NULL); 247 251 } 248 252 249 - return hwirq; 253 + return 0; 250 254 } 251 255 252 256 static void armada_370_xp_msi_free(struct irq_domain *domain, ··· 255 259 struct irq_data *d = irq_domain_get_irq_data(domain, virq); 256 260 257 261 mutex_lock(&msi_used_lock); 258 - bitmap_clear(msi_used, d->hwirq, nr_irqs); 262 + bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs)); 259 263 mutex_unlock(&msi_used_lock); 260 264 } 261 265
+2 -2
drivers/irqchip/irq-aspeed-scu-ic.c
··· 76 76 generic_handle_domain_irq(scu_ic->irq_domain, 77 77 bit - scu_ic->irq_shift); 78 78 79 - regmap_update_bits(scu_ic->scu, scu_ic->reg, mask, 80 - BIT(bit + ASPEED_SCU_IC_STATUS_SHIFT)); 79 + regmap_write_bits(scu_ic->scu, scu_ic->reg, mask, 80 + BIT(bit + ASPEED_SCU_IC_STATUS_SHIFT)); 81 81 } 82 82 83 83 chained_irq_exit(chip, desc);
+1
drivers/irqchip/irq-bcm7120-l2.c
··· 238 238 } 239 239 240 240 data->num_parent_irqs = platform_irq_count(pdev); 241 + put_device(&pdev->dev); 241 242 if (data->num_parent_irqs <= 0) { 242 243 pr_err("invalid number of parent interrupts\n"); 243 244 ret = -ENOMEM;
+1 -1
drivers/irqchip/irq-gic-v3-its.c
··· 742 742 743 743 its_fixup_cmd(cmd); 744 744 745 - return NULL; 745 + return desc->its_invall_cmd.col; 746 746 } 747 747 748 748 static struct its_vpe *its_build_vinvall_cmd(struct its_node *its,
+2 -2
drivers/irqchip/irq-mips-gic.c
··· 9 9 10 10 #define pr_fmt(fmt) "irq-mips-gic: " fmt 11 11 12 + #include <linux/bitfield.h> 12 13 #include <linux/bitmap.h> 13 14 #include <linux/clocksource.h> 14 15 #include <linux/cpuhotplug.h> ··· 736 735 mips_gic_base = ioremap(gic_base, gic_len); 737 736 738 737 gicconfig = read_gic_config(); 739 - gic_shared_intrs = gicconfig & GIC_CONFIG_NUMINTERRUPTS; 740 - gic_shared_intrs >>= __ffs(GIC_CONFIG_NUMINTERRUPTS); 738 + gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig); 741 739 gic_shared_intrs = (gic_shared_intrs + 1) * 8; 742 740 743 741 if (cpu_has_veic) {
+1 -1
drivers/irqchip/irq-nvic.c
··· 26 26 27 27 #define NVIC_ISER 0x000 28 28 #define NVIC_ICER 0x080 29 - #define NVIC_IPR 0x300 29 + #define NVIC_IPR 0x400 30 30 31 31 #define NVIC_MAX_BANKS 16 32 32 /*
+3 -1
drivers/md/md.c
··· 2189 2189 2190 2190 if (!num_sectors || num_sectors > max_sectors) 2191 2191 num_sectors = max_sectors; 2192 + rdev->sb_start = sb_start; 2192 2193 } 2193 2194 sb = page_address(rdev->sb_page); 2194 2195 sb->data_size = cpu_to_le64(num_sectors); ··· 6271 6270 spin_lock(&mddev->lock); 6272 6271 mddev->pers = NULL; 6273 6272 spin_unlock(&mddev->lock); 6274 - pers->free(mddev, mddev->private); 6273 + if (mddev->private) 6274 + pers->free(mddev, mddev->private); 6275 6275 mddev->private = NULL; 6276 6276 if (pers->sync_request && mddev->to_remove == NULL) 6277 6277 mddev->to_remove = &md_redundancy_group;
-4
drivers/misc/cardreader/rtsx_pcr.c
··· 1803 1803 mutex_lock(&pcr->pcr_mutex); 1804 1804 rtsx_pci_power_off(pcr, HOST_ENTER_S3); 1805 1805 1806 - free_irq(pcr->irq, (void *)pcr); 1807 - 1808 1806 mutex_unlock(&pcr->pcr_mutex); 1809 1807 1810 1808 pcr->is_runtime_suspended = true; ··· 1823 1825 mutex_lock(&pcr->pcr_mutex); 1824 1826 1825 1827 rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, 0x00); 1826 - rtsx_pci_acquire_irq(pcr); 1827 - synchronize_irq(pcr->irq); 1828 1828 1829 1829 if (pcr->ops->fetch_vendor_settings) 1830 1830 pcr->ops->fetch_vendor_settings(pcr);
+18 -20
drivers/misc/eeprom/at25.c
··· 376 376 static int at25_probe(struct spi_device *spi) 377 377 { 378 378 struct at25_data *at25 = NULL; 379 - struct spi_eeprom chip; 380 379 int err; 381 380 int sr; 382 381 u8 id[FM25_ID_LEN]; ··· 388 389 if (match && !strcmp(match->compatible, "cypress,fm25")) 389 390 is_fram = 1; 390 391 392 + at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL); 393 + if (!at25) 394 + return -ENOMEM; 395 + 391 396 /* Chip description */ 392 - if (!spi->dev.platform_data) { 393 - if (!is_fram) { 394 - err = at25_fw_to_chip(&spi->dev, &chip); 395 - if (err) 396 - return err; 397 - } 398 - } else 399 - chip = *(struct spi_eeprom *)spi->dev.platform_data; 397 + if (spi->dev.platform_data) { 398 + memcpy(&at25->chip, spi->dev.platform_data, sizeof(at25->chip)); 399 + } else if (!is_fram) { 400 + err = at25_fw_to_chip(&spi->dev, &at25->chip); 401 + if (err) 402 + return err; 403 + } 400 404 401 405 /* Ping the chip ... the status register is pretty portable, 402 406 * unlike probing manufacturer IDs. We do expect that system ··· 411 409 return -ENXIO; 412 410 } 413 411 414 - at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL); 415 - if (!at25) 416 - return -ENOMEM; 417 - 418 412 mutex_init(&at25->lock); 419 - at25->chip = chip; 420 413 at25->spi = spi; 421 414 spi_set_drvdata(spi, at25); 422 415 ··· 428 431 dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]); 429 432 return -ENODEV; 430 433 } 431 - chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; 434 + at25->chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; 432 435 433 436 if (at25->chip.byte_len > 64 * 1024) 434 437 at25->chip.flags |= EE_ADDR3; ··· 461 464 at25->nvmem_config.type = is_fram ? NVMEM_TYPE_FRAM : NVMEM_TYPE_EEPROM; 462 465 at25->nvmem_config.name = dev_name(&spi->dev); 463 466 at25->nvmem_config.dev = &spi->dev; 464 - at25->nvmem_config.read_only = chip.flags & EE_READONLY; 467 + at25->nvmem_config.read_only = at25->chip.flags & EE_READONLY; 465 468 at25->nvmem_config.root_only = true; 466 469 at25->nvmem_config.owner = THIS_MODULE; 467 470 at25->nvmem_config.compat = true; ··· 471 474 at25->nvmem_config.priv = at25; 472 475 at25->nvmem_config.stride = 1; 473 476 at25->nvmem_config.word_size = 1; 474 - at25->nvmem_config.size = chip.byte_len; 477 + at25->nvmem_config.size = at25->chip.byte_len; 475 478 476 479 at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config); 477 480 if (IS_ERR(at25->nvmem)) 478 481 return PTR_ERR(at25->nvmem); 479 482 480 483 dev_info(&spi->dev, "%d %s %s %s%s, pagesize %u\n", 481 - (chip.byte_len < 1024) ? chip.byte_len : (chip.byte_len / 1024), 482 - (chip.byte_len < 1024) ? "Byte" : "KByte", 484 + (at25->chip.byte_len < 1024) ? 485 + at25->chip.byte_len : (at25->chip.byte_len / 1024), 486 + (at25->chip.byte_len < 1024) ? "Byte" : "KByte", 483 487 at25->chip.name, is_fram ? "fram" : "eeprom", 484 - (chip.flags & EE_READONLY) ? " (readonly)" : "", 488 + (at25->chip.flags & EE_READONLY) ? " (readonly)" : "", 485 489 at25->chip.page_size); 486 490 return 0; 487 491 }
+6 -4
drivers/misc/fastrpc.c
··· 719 719 static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen) 720 720 { 721 721 u64 size = 0; 722 - int i; 722 + int oix; 723 723 724 724 size = ALIGN(metalen, FASTRPC_ALIGN); 725 - for (i = 0; i < ctx->nscalars; i++) { 725 + for (oix = 0; oix < ctx->nbufs; oix++) { 726 + int i = ctx->olaps[oix].raix; 727 + 726 728 if (ctx->args[i].fd == 0 || ctx->args[i].fd == -1) { 727 729 728 - if (ctx->olaps[i].offset == 0) 730 + if (ctx->olaps[oix].offset == 0) 729 731 size = ALIGN(size, FASTRPC_ALIGN); 730 732 731 - size += (ctx->olaps[i].mend - ctx->olaps[i].mstart); 733 + size += (ctx->olaps[oix].mend - ctx->olaps[oix].mstart); 732 734 } 733 735 } 734 736
+3 -1
drivers/mmc/host/mtk-sd.c
··· 2291 2291 sdr_set_field(host->base + PAD_DS_TUNE, 2292 2292 PAD_DS_TUNE_DLY1, i); 2293 2293 ret = mmc_get_ext_csd(card, &ext_csd); 2294 - if (!ret) 2294 + if (!ret) { 2295 2295 result_dly1 |= (1 << i); 2296 + kfree(ext_csd); 2297 + } 2296 2298 } 2297 2299 host->hs400_tuning = false; 2298 2300
+1 -1
drivers/mmc/host/renesas_sdhi_core.c
··· 673 673 674 674 /* Issue CMD19 twice for each tap */ 675 675 for (i = 0; i < 2 * priv->tap_num; i++) { 676 - int cmd_error; 676 + int cmd_error = 0; 677 677 678 678 /* Set sampling clock position */ 679 679 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num);
+8
drivers/mtd/devices/mtd_dataflash.c
··· 96 96 struct mtd_info mtd; 97 97 }; 98 98 99 + static const struct spi_device_id dataflash_dev_ids[] = { 100 + { "at45" }, 101 + { "dataflash" }, 102 + { }, 103 + }; 104 + MODULE_DEVICE_TABLE(spi, dataflash_dev_ids); 105 + 99 106 #ifdef CONFIG_OF 100 107 static const struct of_device_id dataflash_dt_ids[] = { 101 108 { .compatible = "atmel,at45", }, ··· 934 927 .name = "mtd_dataflash", 935 928 .of_match_table = of_match_ptr(dataflash_dt_ids), 936 929 }, 930 + .id_table = dataflash_dev_ids, 937 931 938 932 .probe = dataflash_probe, 939 933 .remove = dataflash_remove,
+1 -1
drivers/mtd/nand/raw/Kconfig
··· 26 26 config MTD_NAND_DENALI_DT 27 27 tristate "Denali NAND controller as a DT device" 28 28 select MTD_NAND_DENALI 29 - depends on HAS_DMA && HAVE_CLK && OF 29 + depends on HAS_DMA && HAVE_CLK && OF && HAS_IOMEM 30 30 help 31 31 Enable the driver for NAND flash on platforms using a Denali NAND 32 32 controller as a DT device.
+28 -8
drivers/mtd/nand/raw/fsmc_nand.c
··· 15 15 16 16 #include <linux/clk.h> 17 17 #include <linux/completion.h> 18 + #include <linux/delay.h> 18 19 #include <linux/dmaengine.h> 19 20 #include <linux/dma-direction.h> 20 21 #include <linux/dma-mapping.h> ··· 93 92 #define FSMC_NAND_BANK_SZ 0x20 94 93 95 94 #define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ) 95 + 96 + /* 97 + * According to SPEAr300 Reference Manual (RM0082) 98 + * TOUDEL = 7ns (Output delay from the flip-flops to the board) 99 + * TINDEL = 5ns (Input delay from the board to the flipflop) 100 + */ 101 + #define TOUTDEL 7000 102 + #define TINDEL 5000 96 103 97 104 struct fsmc_nand_timings { 98 105 u8 tclr; ··· 286 277 { 287 278 unsigned long hclk = clk_get_rate(host->clk); 288 279 unsigned long hclkn = NSEC_PER_SEC / hclk; 289 - u32 thiz, thold, twait, tset; 280 + u32 thiz, thold, twait, tset, twait_min; 290 281 291 282 if (sdrt->tRC_min < 30000) 292 283 return -EOPNOTSUPP; ··· 318 309 else if (tims->thold > FSMC_THOLD_MASK) 319 310 tims->thold = FSMC_THOLD_MASK; 320 311 321 - twait = max(sdrt->tRP_min, sdrt->tWP_min); 322 - tims->twait = DIV_ROUND_UP(twait / 1000, hclkn) - 1; 323 - if (tims->twait == 0) 324 - tims->twait = 1; 325 - else if (tims->twait > FSMC_TWAIT_MASK) 326 - tims->twait = FSMC_TWAIT_MASK; 327 - 328 312 tset = max(sdrt->tCS_min - sdrt->tWP_min, 329 313 sdrt->tCEA_max - sdrt->tREA_max); 330 314 tims->tset = DIV_ROUND_UP(tset / 1000, hclkn) - 1; ··· 325 323 tims->tset = 1; 326 324 else if (tims->tset > FSMC_TSET_MASK) 327 325 tims->tset = FSMC_TSET_MASK; 326 + 327 + /* 328 + * According to SPEAr300 Reference Manual (RM0082) which gives more 329 + * information related to FSMSC timings than the SPEAr600 one (RM0305), 330 + * twait >= tCEA - (tset * TCLK) + TOUTDEL + TINDEL 331 + */ 332 + twait_min = sdrt->tCEA_max - ((tims->tset + 1) * hclkn * 1000) 333 + + TOUTDEL + TINDEL; 334 + twait = max3(sdrt->tRP_min, sdrt->tWP_min, twait_min); 335 + 336 + tims->twait = DIV_ROUND_UP(twait / 1000, hclkn) - 1; 337 + if (tims->twait == 0) 338 + tims->twait = 1; 339 + else if (tims->twait > FSMC_TWAIT_MASK) 340 + tims->twait = FSMC_TWAIT_MASK; 328 341 329 342 return 0; 330 343 } ··· 681 664 instr->ctx.waitrdy.timeout_ms); 682 665 break; 683 666 } 667 + 668 + if (instr->delay_ns) 669 + ndelay(instr->delay_ns); 684 670 } 685 671 686 672 return ret;
+3 -3
drivers/mtd/nand/raw/nand_base.c
··· 926 926 struct nand_sdr_timings *spec_timings) 927 927 { 928 928 const struct nand_controller_ops *ops = chip->controller->ops; 929 - int best_mode = 0, mode, ret; 929 + int best_mode = 0, mode, ret = -EOPNOTSUPP; 930 930 931 931 iface->type = NAND_SDR_IFACE; 932 932 ··· 977 977 struct nand_nvddr_timings *spec_timings) 978 978 { 979 979 const struct nand_controller_ops *ops = chip->controller->ops; 980 - int best_mode = 0, mode, ret; 980 + int best_mode = 0, mode, ret = -EOPNOTSUPP; 981 981 982 982 iface->type = NAND_NVDDR_IFACE; 983 983 ··· 1837 1837 NAND_OP_CMD(NAND_CMD_ERASE1, 0), 1838 1838 NAND_OP_ADDR(2, addrs, 0), 1839 1839 NAND_OP_CMD(NAND_CMD_ERASE2, 1840 - NAND_COMMON_TIMING_MS(conf, tWB_max)), 1840 + NAND_COMMON_TIMING_NS(conf, tWB_max)), 1841 1841 NAND_OP_WAIT_RDY(NAND_COMMON_TIMING_MS(conf, tBERS_max), 1842 1842 0), 1843 1843 };
+8 -6
drivers/net/bonding/bond_alb.c
··· 1501 1501 struct slave *slave; 1502 1502 1503 1503 if (!bond_has_slaves(bond)) { 1504 - bond_info->tx_rebalance_counter = 0; 1504 + atomic_set(&bond_info->tx_rebalance_counter, 0); 1505 1505 bond_info->lp_counter = 0; 1506 1506 goto re_arm; 1507 1507 } 1508 1508 1509 1509 rcu_read_lock(); 1510 1510 1511 - bond_info->tx_rebalance_counter++; 1511 + atomic_inc(&bond_info->tx_rebalance_counter); 1512 1512 bond_info->lp_counter++; 1513 1513 1514 1514 /* send learning packets */ ··· 1530 1530 } 1531 1531 1532 1532 /* rebalance tx traffic */ 1533 - if (bond_info->tx_rebalance_counter >= BOND_TLB_REBALANCE_TICKS) { 1533 + if (atomic_read(&bond_info->tx_rebalance_counter) >= BOND_TLB_REBALANCE_TICKS) { 1534 1534 bond_for_each_slave_rcu(bond, slave, iter) { 1535 1535 tlb_clear_slave(bond, slave, 1); 1536 1536 if (slave == rcu_access_pointer(bond->curr_active_slave)) { ··· 1540 1540 bond_info->unbalanced_load = 0; 1541 1541 } 1542 1542 } 1543 - bond_info->tx_rebalance_counter = 0; 1543 + atomic_set(&bond_info->tx_rebalance_counter, 0); 1544 1544 } 1545 1545 1546 1546 if (bond_info->rlb_enabled) { ··· 1610 1610 tlb_init_slave(slave); 1611 1611 1612 1612 /* order a rebalance ASAP */ 1613 - bond->alb_info.tx_rebalance_counter = BOND_TLB_REBALANCE_TICKS; 1613 + atomic_set(&bond->alb_info.tx_rebalance_counter, 1614 + BOND_TLB_REBALANCE_TICKS); 1614 1615 1615 1616 if (bond->alb_info.rlb_enabled) 1616 1617 bond->alb_info.rlb_rebalance = 1; ··· 1648 1647 rlb_clear_slave(bond, slave); 1649 1648 } else if (link == BOND_LINK_UP) { 1650 1649 /* order a rebalance ASAP */ 1651 - bond_info->tx_rebalance_counter = BOND_TLB_REBALANCE_TICKS; 1650 + atomic_set(&bond_info->tx_rebalance_counter, 1651 + BOND_TLB_REBALANCE_TICKS); 1652 1652 if (bond->alb_info.rlb_enabled) { 1653 1653 bond->alb_info.rlb_rebalance = 1; 1654 1654 /* If the updelay module parameter is smaller than the
+7 -1
drivers/net/can/kvaser_pciefd.c
··· 248 248 #define KVASER_PCIEFD_SPACK_EWLR BIT(23) 249 249 #define KVASER_PCIEFD_SPACK_EPLR BIT(24) 250 250 251 + /* Kvaser KCAN_EPACK second word */ 252 + #define KVASER_PCIEFD_EPACK_DIR_TX BIT(0) 253 + 251 254 struct kvaser_pciefd; 252 255 253 256 struct kvaser_pciefd_can { ··· 1288 1285 1289 1286 can->err_rep_cnt++; 1290 1287 can->can.can_stats.bus_error++; 1291 - stats->rx_errors++; 1288 + if (p->header[1] & KVASER_PCIEFD_EPACK_DIR_TX) 1289 + stats->tx_errors++; 1290 + else 1291 + stats->rx_errors++; 1292 1292 1293 1293 can->bec.txerr = bec.txerr; 1294 1294 can->bec.rxerr = bec.rxerr;
+27 -15
drivers/net/can/m_can/m_can.c
··· 204 204 205 205 /* Interrupts for version 3.0.x */ 206 206 #define IR_ERR_LEC_30X (IR_STE | IR_FOE | IR_ACKE | IR_BE | IR_CRCE) 207 - #define IR_ERR_BUS_30X (IR_ERR_LEC_30X | IR_WDI | IR_ELO | IR_BEU | \ 208 - IR_BEC | IR_TOO | IR_MRAF | IR_TSW | IR_TEFL | \ 209 - IR_RF1L | IR_RF0L) 207 + #define IR_ERR_BUS_30X (IR_ERR_LEC_30X | IR_WDI | IR_BEU | IR_BEC | \ 208 + IR_TOO | IR_MRAF | IR_TSW | IR_TEFL | IR_RF1L | \ 209 + IR_RF0L) 210 210 #define IR_ERR_ALL_30X (IR_ERR_STATE | IR_ERR_BUS_30X) 211 211 212 212 /* Interrupts for version >= 3.1.x */ 213 213 #define IR_ERR_LEC_31X (IR_PED | IR_PEA) 214 - #define IR_ERR_BUS_31X (IR_ERR_LEC_31X | IR_WDI | IR_ELO | IR_BEU | \ 215 - IR_BEC | IR_TOO | IR_MRAF | IR_TSW | IR_TEFL | \ 216 - IR_RF1L | IR_RF0L) 214 + #define IR_ERR_BUS_31X (IR_ERR_LEC_31X | IR_WDI | IR_BEU | IR_BEC | \ 215 + IR_TOO | IR_MRAF | IR_TSW | IR_TEFL | IR_RF1L | \ 216 + IR_RF0L) 217 217 #define IR_ERR_ALL_31X (IR_ERR_STATE | IR_ERR_BUS_31X) 218 218 219 219 /* Interrupt Line Select (ILS) */ ··· 517 517 err = m_can_fifo_read(cdev, fgi, M_CAN_FIFO_DATA, 518 518 cf->data, DIV_ROUND_UP(cf->len, 4)); 519 519 if (err) 520 - goto out_fail; 520 + goto out_free_skb; 521 521 } 522 522 523 523 /* acknowledge rx fifo 0 */ ··· 532 532 533 533 return 0; 534 534 535 + out_free_skb: 536 + kfree_skb(skb); 535 537 out_fail: 536 538 netdev_err(dev, "FIFO read returned %d\n", err); 537 539 return err; ··· 812 810 { 813 811 if (irqstatus & IR_WDI) 814 812 netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); 815 - if (irqstatus & IR_ELO) 816 - netdev_err(dev, "Error Logging Overflow\n"); 817 813 if (irqstatus & IR_BEU) 818 814 netdev_err(dev, "Bit Error Uncorrected\n"); 819 815 if (irqstatus & IR_BEC) ··· 1494 1494 case 30: 1495 1495 /* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.0.x */ 1496 1496 can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO); 1497 - cdev->can.bittiming_const = &m_can_bittiming_const_30X; 1498 - cdev->can.data_bittiming_const = &m_can_data_bittiming_const_30X; 1497 + cdev->can.bittiming_const = cdev->bit_timing ? 1498 + cdev->bit_timing : &m_can_bittiming_const_30X; 1499 + 1500 + cdev->can.data_bittiming_const = cdev->data_timing ? 1501 + cdev->data_timing : 1502 + &m_can_data_bittiming_const_30X; 1499 1503 break; 1500 1504 case 31: 1501 1505 /* CAN_CTRLMODE_FD_NON_ISO is fixed with M_CAN IP v3.1.x */ 1502 1506 can_set_static_ctrlmode(dev, CAN_CTRLMODE_FD_NON_ISO); 1503 - cdev->can.bittiming_const = &m_can_bittiming_const_31X; 1504 - cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X; 1507 + cdev->can.bittiming_const = cdev->bit_timing ? 1508 + cdev->bit_timing : &m_can_bittiming_const_31X; 1509 + 1510 + cdev->can.data_bittiming_const = cdev->data_timing ? 1511 + cdev->data_timing : 1512 + &m_can_data_bittiming_const_31X; 1505 1513 break; 1506 1514 case 32: 1507 1515 case 33: 1508 1516 /* Support both MCAN version v3.2.x and v3.3.0 */ 1509 - cdev->can.bittiming_const = &m_can_bittiming_const_31X; 1510 - cdev->can.data_bittiming_const = &m_can_data_bittiming_const_31X; 1517 + cdev->can.bittiming_const = cdev->bit_timing ? 1518 + cdev->bit_timing : &m_can_bittiming_const_31X; 1519 + 1520 + cdev->can.data_bittiming_const = cdev->data_timing ? 1521 + cdev->data_timing : 1522 + &m_can_data_bittiming_const_31X; 1511 1523 1512 1524 cdev->can.ctrlmode_supported |= 1513 1525 (m_can_niso_supported(cdev) ?
+3
drivers/net/can/m_can/m_can.h
··· 85 85 struct sk_buff *tx_skb; 86 86 struct phy *transceiver; 87 87 88 + const struct can_bittiming_const *bit_timing; 89 + const struct can_bittiming_const *data_timing; 90 + 88 91 struct m_can_ops *ops; 89 92 90 93 int version;
+56 -6
drivers/net/can/m_can/m_can_pci.c
··· 18 18 19 19 #define M_CAN_PCI_MMIO_BAR 0 20 20 21 - #define M_CAN_CLOCK_FREQ_EHL 100000000 22 21 #define CTL_CSR_INT_CTL_OFFSET 0x508 22 + 23 + struct m_can_pci_config { 24 + const struct can_bittiming_const *bit_timing; 25 + const struct can_bittiming_const *data_timing; 26 + unsigned int clock_freq; 27 + }; 23 28 24 29 struct m_can_pci_priv { 25 30 struct m_can_classdev cdev; ··· 47 42 static int iomap_read_fifo(struct m_can_classdev *cdev, int offset, void *val, size_t val_count) 48 43 { 49 44 struct m_can_pci_priv *priv = cdev_to_priv(cdev); 45 + void __iomem *src = priv->base + offset; 50 46 51 - ioread32_rep(priv->base + offset, val, val_count); 47 + while (val_count--) { 48 + *(unsigned int *)val = ioread32(src); 49 + val += 4; 50 + src += 4; 51 + } 52 52 53 53 return 0; 54 54 } ··· 71 61 const void *val, size_t val_count) 72 62 { 73 63 struct m_can_pci_priv *priv = cdev_to_priv(cdev); 64 + void __iomem *dst = priv->base + offset; 74 65 75 - iowrite32_rep(priv->base + offset, val, val_count); 66 + while (val_count--) { 67 + iowrite32(*(unsigned int *)val, dst); 68 + val += 4; 69 + dst += 4; 70 + } 76 71 77 72 return 0; 78 73 } ··· 89 74 .read_fifo = iomap_read_fifo, 90 75 }; 91 76 77 + static const struct can_bittiming_const m_can_bittiming_const_ehl = { 78 + .name = KBUILD_MODNAME, 79 + .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ 80 + .tseg1_max = 64, 81 + .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ 82 + .tseg2_max = 128, 83 + .sjw_max = 128, 84 + .brp_min = 1, 85 + .brp_max = 512, 86 + .brp_inc = 1, 87 + }; 88 + 89 + static const struct can_bittiming_const m_can_data_bittiming_const_ehl = { 90 + .name = KBUILD_MODNAME, 91 + .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ 92 + .tseg1_max = 16, 93 + .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ 94 + .tseg2_max = 8, 95 + .sjw_max = 4, 96 + .brp_min = 1, 97 + .brp_max = 32, 98 + .brp_inc = 1, 99 + }; 100 + 101 + static const struct m_can_pci_config m_can_pci_ehl = { 102 + .bit_timing = &m_can_bittiming_const_ehl, 103 + .data_timing = &m_can_data_bittiming_const_ehl, 104 + .clock_freq = 200000000, 105 + }; 106 + 92 107 static int m_can_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) 93 108 { 94 109 struct device *dev = &pci->dev; 110 + const struct m_can_pci_config *cfg; 95 111 struct m_can_classdev *mcan_class; 96 112 struct m_can_pci_priv *priv; 97 113 void __iomem *base; ··· 150 104 if (!mcan_class) 151 105 return -ENOMEM; 152 106 107 + cfg = (const struct m_can_pci_config *)id->driver_data; 108 + 153 109 priv = cdev_to_priv(mcan_class); 154 110 155 111 priv->base = base; ··· 163 115 mcan_class->dev = &pci->dev; 164 116 mcan_class->net->irq = pci_irq_vector(pci, 0); 165 117 mcan_class->pm_clock_support = 1; 166 - mcan_class->can.clock.freq = id->driver_data; 118 + mcan_class->bit_timing = cfg->bit_timing; 119 + mcan_class->data_timing = cfg->data_timing; 120 + mcan_class->can.clock.freq = cfg->clock_freq; 167 121 mcan_class->ops = &m_can_pci_ops; 168 122 169 123 pci_set_drvdata(pci, mcan_class); ··· 218 168 m_can_pci_suspend, m_can_pci_resume); 219 169 220 170 static const struct pci_device_id m_can_pci_id_table[] = { 221 - { PCI_VDEVICE(INTEL, 0x4bc1), M_CAN_CLOCK_FREQ_EHL, }, 222 - { PCI_VDEVICE(INTEL, 0x4bc2), M_CAN_CLOCK_FREQ_EHL, }, 171 + { PCI_VDEVICE(INTEL, 0x4bc1), (kernel_ulong_t)&m_can_pci_ehl, }, 172 + { PCI_VDEVICE(INTEL, 0x4bc2), (kernel_ulong_t)&m_can_pci_ehl, }, 223 173 { } /* Terminating Entry */ 224 174 }; 225 175 MODULE_DEVICE_TABLE(pci, m_can_pci_id_table);
+1 -1
drivers/net/can/pch_can.c
··· 692 692 cf->data[i + 1] = data_reg >> 8; 693 693 } 694 694 695 - netif_receive_skb(skb); 696 695 rcv_pkts++; 697 696 stats->rx_packets++; 698 697 quota--; 699 698 stats->rx_bytes += cf->len; 699 + netif_receive_skb(skb); 700 700 701 701 pch_fifo_thresh(priv, obj_num); 702 702 obj_num++;
+6 -1
drivers/net/can/sja1000/ems_pcmcia.c
··· 234 234 free_sja1000dev(dev); 235 235 } 236 236 237 - err = request_irq(dev->irq, &ems_pcmcia_interrupt, IRQF_SHARED, 237 + if (!card->channels) { 238 + err = -ENODEV; 239 + goto failure_cleanup; 240 + } 241 + 242 + err = request_irq(pdev->irq, &ems_pcmcia_interrupt, IRQF_SHARED, 238 243 DRV_NAME, card); 239 244 if (!err) 240 245 return 0;
+73 -28
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
··· 28 28 29 29 #include "kvaser_usb.h" 30 30 31 - /* Forward declaration */ 32 - static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg; 33 - 34 - #define CAN_USB_CLOCK 8000000 35 31 #define MAX_USBCAN_NET_DEVICES 2 36 32 37 33 /* Command header size */ ··· 75 79 #define CMD_FLUSH_QUEUE_REPLY 68 76 80 77 81 #define CMD_LEAF_LOG_MESSAGE 106 82 + 83 + /* Leaf frequency options */ 84 + #define KVASER_USB_LEAF_SWOPTION_FREQ_MASK 0x60 85 + #define KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK 0 86 + #define KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK BIT(5) 87 + #define KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK BIT(6) 78 88 79 89 /* error factors */ 80 90 #define M16C_EF_ACKE BIT(0) ··· 342 340 }; 343 341 }; 344 342 343 + static const struct can_bittiming_const kvaser_usb_leaf_bittiming_const = { 344 + .name = "kvaser_usb", 345 + .tseg1_min = KVASER_USB_TSEG1_MIN, 346 + .tseg1_max = KVASER_USB_TSEG1_MAX, 347 + .tseg2_min = KVASER_USB_TSEG2_MIN, 348 + .tseg2_max = KVASER_USB_TSEG2_MAX, 349 + .sjw_max = KVASER_USB_SJW_MAX, 350 + .brp_min = KVASER_USB_BRP_MIN, 351 + .brp_max = KVASER_USB_BRP_MAX, 352 + .brp_inc = KVASER_USB_BRP_INC, 353 + }; 354 + 355 + static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_8mhz = { 356 + .clock = { 357 + .freq = 8000000, 358 + }, 359 + .timestamp_freq = 1, 360 + .bittiming_const = &kvaser_usb_leaf_bittiming_const, 361 + }; 362 + 363 + static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_16mhz = { 364 + .clock = { 365 + .freq = 16000000, 366 + }, 367 + .timestamp_freq = 1, 368 + .bittiming_const = &kvaser_usb_leaf_bittiming_const, 369 + }; 370 + 371 + static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_24mhz = { 372 + .clock = { 373 + .freq = 24000000, 374 + }, 375 + .timestamp_freq = 1, 376 + .bittiming_const = &kvaser_usb_leaf_bittiming_const, 377 + }; 378 + 379 + static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_32mhz = { 380 + .clock = { 381 + .freq = 32000000, 382 + }, 383 + .timestamp_freq = 1, 384 + .bittiming_const = &kvaser_usb_leaf_bittiming_const, 385 + }; 386 + 345 387 static void * 346 388 kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv, 347 389 const struct sk_buff *skb, int *frame_len, ··· 517 471 return rc; 518 472 } 519 473 474 + static void kvaser_usb_leaf_get_software_info_leaf(struct kvaser_usb *dev, 475 + const struct leaf_cmd_softinfo *softinfo) 476 + { 477 + u32 sw_options = le32_to_cpu(softinfo->sw_options); 478 + 479 + dev->fw_version = le32_to_cpu(softinfo->fw_version); 480 + dev->max_tx_urbs = le16_to_cpu(softinfo->max_outstanding_tx); 481 + 482 + switch (sw_options & KVASER_USB_LEAF_SWOPTION_FREQ_MASK) { 483 + case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK: 484 + dev->cfg = &kvaser_usb_leaf_dev_cfg_16mhz; 485 + break; 486 + case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK: 487 + dev->cfg = &kvaser_usb_leaf_dev_cfg_24mhz; 488 + break; 489 + case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK: 490 + dev->cfg = &kvaser_usb_leaf_dev_cfg_32mhz; 491 + break; 492 + } 493 + } 494 + 520 495 static int kvaser_usb_leaf_get_software_info_inner(struct kvaser_usb *dev) 521 496 { 522 497 struct kvaser_cmd cmd; ··· 553 486 554 487 switch (dev->card_data.leaf.family) { 555 488 case KVASER_LEAF: 556 - dev->fw_version = le32_to_cpu(cmd.u.leaf.softinfo.fw_version); 557 - dev->max_tx_urbs = 558 - le16_to_cpu(cmd.u.leaf.softinfo.max_outstanding_tx); 489 + kvaser_usb_leaf_get_software_info_leaf(dev, &cmd.u.leaf.softinfo); 559 490 break; 560 491 case KVASER_USBCAN: 561 492 dev->fw_version = le32_to_cpu(cmd.u.usbcan.softinfo.fw_version); 562 493 dev->max_tx_urbs = 563 494 le16_to_cpu(cmd.u.usbcan.softinfo.max_outstanding_tx); 495 + dev->cfg = &kvaser_usb_leaf_dev_cfg_8mhz; 564 496 break; 565 497 } 566 498 ··· 1291 1225 { 1292 1226 struct kvaser_usb_dev_card_data *card_data = &dev->card_data; 1293 1227 1294 - dev->cfg = &kvaser_usb_leaf_dev_cfg; 1295 1228 card_data->ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES; 1296 1229 1297 1230 return 0; 1298 1231 } 1299 - 1300 - static const struct can_bittiming_const kvaser_usb_leaf_bittiming_const = { 1301 - .name = "kvaser_usb", 1302 - .tseg1_min = KVASER_USB_TSEG1_MIN, 1303 - .tseg1_max = KVASER_USB_TSEG1_MAX, 1304 - .tseg2_min = KVASER_USB_TSEG2_MIN, 1305 - .tseg2_max = KVASER_USB_TSEG2_MAX, 1306 - .sjw_max = KVASER_USB_SJW_MAX, 1307 - .brp_min = KVASER_USB_BRP_MIN, 1308 - .brp_max = KVASER_USB_BRP_MAX, 1309 - .brp_inc = KVASER_USB_BRP_INC, 1310 - }; 1311 1232 1312 1233 static int kvaser_usb_leaf_set_bittiming(struct net_device *netdev) 1313 1234 { ··· 1400 1347 .dev_flush_queue = kvaser_usb_leaf_flush_queue, 1401 1348 .dev_read_bulk_callback = kvaser_usb_leaf_read_bulk_callback, 1402 1349 .dev_frame_to_cmd = kvaser_usb_leaf_frame_to_cmd, 1403 - }; 1404 - 1405 - static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg = { 1406 - .clock = { 1407 - .freq = CAN_USB_CLOCK, 1408 - }, 1409 - .timestamp_freq = 1, 1410 - .bittiming_const = &kvaser_usb_leaf_bittiming_const, 1411 1350 };
+46 -37
drivers/net/dsa/mv88e6xxx/chip.c
··· 471 471 u16 reg; 472 472 int err; 473 473 474 + /* The 88e6250 family does not have the PHY detect bit. Instead, 475 + * report whether the port is internal. 476 + */ 477 + if (chip->info->family == MV88E6XXX_FAMILY_6250) 478 + return port < chip->info->num_internal_phys; 479 + 474 480 err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg); 475 481 if (err) { 476 482 dev_err(chip->dev, ··· 698 692 { 699 693 struct mv88e6xxx_chip *chip = ds->priv; 700 694 struct mv88e6xxx_port *p; 701 - int err; 695 + int err = 0; 702 696 703 697 p = &chip->ports[port]; 704 698 705 - /* FIXME: is this the correct test? If we're in fixed mode on an 706 - * internal port, why should we process this any different from 707 - * PHY mode? On the other hand, the port may be automedia between 708 - * an internal PHY and the serdes... 709 - */ 710 - if ((mode == MLO_AN_PHY) && mv88e6xxx_phy_is_internal(ds, port)) 711 - return; 712 - 713 699 mv88e6xxx_reg_lock(chip); 714 - /* In inband mode, the link may come up at any time while the link 715 - * is not forced down. Force the link down while we reconfigure the 716 - * interface mode. 717 - */ 718 - if (mode == MLO_AN_INBAND && p->interface != state->interface && 719 - chip->info->ops->port_set_link) 720 - chip->info->ops->port_set_link(chip, port, LINK_FORCED_DOWN); 721 700 722 - err = mv88e6xxx_port_config_interface(chip, port, state->interface); 723 - if (err && err != -EOPNOTSUPP) 724 - goto err_unlock; 701 + if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(ds, port)) { 702 + /* In inband mode, the link may come up at any time while the 703 + * link is not forced down. Force the link down while we 704 + * reconfigure the interface mode. 705 + */ 706 + if (mode == MLO_AN_INBAND && 707 + p->interface != state->interface && 708 + chip->info->ops->port_set_link) 709 + chip->info->ops->port_set_link(chip, port, 710 + LINK_FORCED_DOWN); 725 711 726 - err = mv88e6xxx_serdes_pcs_config(chip, port, mode, state->interface, 727 - state->advertising); 728 - /* FIXME: we should restart negotiation if something changed - which 729 - * is something we get if we convert to using phylinks PCS operations. 730 - */ 731 - if (err > 0) 732 - err = 0; 712 + err = mv88e6xxx_port_config_interface(chip, port, 713 + state->interface); 714 + if (err && err != -EOPNOTSUPP) 715 + goto err_unlock; 716 + 717 + err = mv88e6xxx_serdes_pcs_config(chip, port, mode, 718 + state->interface, 719 + state->advertising); 720 + /* FIXME: we should restart negotiation if something changed - 721 + * which is something we get if we convert to using phylinks 722 + * PCS operations. 723 + */ 724 + if (err > 0) 725 + err = 0; 726 + } 733 727 734 728 /* Undo the forced down state above after completing configuration 735 - * irrespective of its state on entry, which allows the link to come up. 729 + * irrespective of its state on entry, which allows the link to come 730 + * up in the in-band case where there is no separate SERDES. Also 731 + * ensure that the link can come up if the PPU is in use and we are 732 + * in PHY mode (we treat the PPU as an effective in-band mechanism.) 736 733 */ 737 - if (mode == MLO_AN_INBAND && p->interface != state->interface && 738 - chip->info->ops->port_set_link) 734 + if (chip->info->ops->port_set_link && 735 + ((mode == MLO_AN_INBAND && p->interface != state->interface) || 736 + (mode == MLO_AN_PHY && mv88e6xxx_port_ppu_updates(chip, port)))) 739 737 chip->info->ops->port_set_link(chip, port, LINK_UNFORCED); 740 738 741 739 p->interface = state->interface; ··· 762 752 ops = chip->info->ops; 763 753 764 754 mv88e6xxx_reg_lock(chip); 765 - /* Internal PHYs propagate their configuration directly to the MAC. 766 - * External PHYs depend on whether the PPU is enabled for this port. 755 + /* Force the link down if we know the port may not be automatically 756 + * updated by the switch or if we are using fixed-link mode. 767 757 */ 768 - if (((!mv88e6xxx_phy_is_internal(ds, port) && 769 - !mv88e6xxx_port_ppu_updates(chip, port)) || 758 + if ((!mv88e6xxx_port_ppu_updates(chip, port) || 770 759 mode == MLO_AN_FIXED) && ops->port_sync_link) 771 760 err = ops->port_sync_link(chip, port, mode, false); 772 761 mv88e6xxx_reg_unlock(chip); ··· 788 779 ops = chip->info->ops; 789 780 790 781 mv88e6xxx_reg_lock(chip); 791 - /* Internal PHYs propagate their configuration directly to the MAC. 792 - * External PHYs depend on whether the PPU is enabled for this port. 782 + /* Configure and force the link up if we know that the port may not 783 + * automatically updated by the switch or if we are using fixed-link 784 + * mode. 793 785 */ 794 - if ((!mv88e6xxx_phy_is_internal(ds, port) && 795 - !mv88e6xxx_port_ppu_updates(chip, port)) || 786 + if (!mv88e6xxx_port_ppu_updates(chip, port) || 796 787 mode == MLO_AN_FIXED) { 797 788 /* FIXME: for an automedia port, should we force the link 798 789 * down here - what if the link comes up due to "other" media
+7 -1
drivers/net/dsa/mv88e6xxx/serdes.c
··· 830 830 bool up) 831 831 { 832 832 u8 cmode = chip->ports[port].cmode; 833 - int err = 0; 833 + int err; 834 834 835 835 switch (cmode) { 836 836 case MV88E6XXX_PORT_STS_CMODE_SGMII: ··· 841 841 case MV88E6XXX_PORT_STS_CMODE_XAUI: 842 842 case MV88E6XXX_PORT_STS_CMODE_RXAUI: 843 843 err = mv88e6390_serdes_power_10g(chip, lane, up); 844 + break; 845 + default: 846 + err = -EINVAL; 844 847 break; 845 848 } 846 849 ··· 1543 1540 case MV88E6393X_PORT_STS_CMODE_5GBASER: 1544 1541 case MV88E6393X_PORT_STS_CMODE_10GBASER: 1545 1542 err = mv88e6390_serdes_power_10g(chip, lane, on); 1543 + break; 1544 + default: 1545 + err = -EINVAL; 1546 1546 break; 1547 1547 } 1548 1548
+4 -1
drivers/net/dsa/ocelot/felix.c
··· 290 290 } 291 291 } 292 292 293 - if (cpu < 0) 293 + if (cpu < 0) { 294 + kfree(tagging_rule); 295 + kfree(redirect_rule); 294 296 return -EINVAL; 297 + } 295 298 296 299 tagging_rule->key_type = OCELOT_VCAP_KEY_ETYPE; 297 300 *(__be16 *)tagging_rule->key.etype.etype.value = htons(ETH_P_1588);
+6 -3
drivers/net/ethernet/altera/altera_tse_main.c
··· 1430 1430 priv->rxdescmem_busaddr = dma_res->start; 1431 1431 1432 1432 } else { 1433 + ret = -ENODEV; 1433 1434 goto err_free_netdev; 1434 1435 } 1435 1436 1436 - if (!dma_set_mask(priv->device, DMA_BIT_MASK(priv->dmaops->dmamask))) 1437 + if (!dma_set_mask(priv->device, DMA_BIT_MASK(priv->dmaops->dmamask))) { 1437 1438 dma_set_coherent_mask(priv->device, 1438 1439 DMA_BIT_MASK(priv->dmaops->dmamask)); 1439 - else if (!dma_set_mask(priv->device, DMA_BIT_MASK(32))) 1440 + } else if (!dma_set_mask(priv->device, DMA_BIT_MASK(32))) { 1440 1441 dma_set_coherent_mask(priv->device, DMA_BIT_MASK(32)); 1441 - else 1442 + } else { 1443 + ret = -EIO; 1442 1444 goto err_free_netdev; 1445 + } 1443 1446 1444 1447 /* MAC address space */ 1445 1448 ret = request_and_map(pdev, "control_port", &control_port,
+3 -1
drivers/net/ethernet/broadcom/bcm4908_enet.c
··· 708 708 709 709 enet->irq_tx = platform_get_irq_byname(pdev, "tx"); 710 710 711 - dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); 711 + err = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); 712 + if (err) 713 + return err; 712 714 713 715 err = bcm4908_enet_dma_alloc(enet); 714 716 if (err)
+3
drivers/net/ethernet/freescale/fec.h
··· 377 377 #define FEC_ENET_WAKEUP ((uint)0x00020000) /* Wakeup request */ 378 378 #define FEC_ENET_TXF (FEC_ENET_TXF_0 | FEC_ENET_TXF_1 | FEC_ENET_TXF_2) 379 379 #define FEC_ENET_RXF (FEC_ENET_RXF_0 | FEC_ENET_RXF_1 | FEC_ENET_RXF_2) 380 + #define FEC_ENET_RXF_GET(X) (((X) == 0) ? FEC_ENET_RXF_0 : \ 381 + (((X) == 1) ? FEC_ENET_RXF_1 : \ 382 + FEC_ENET_RXF_2)) 380 383 #define FEC_ENET_TS_AVAIL ((uint)0x00010000) 381 384 #define FEC_ENET_TS_TIMER ((uint)0x00008000) 382 385
+1 -1
drivers/net/ethernet/freescale/fec_main.c
··· 1480 1480 break; 1481 1481 pkt_received++; 1482 1482 1483 - writel(FEC_ENET_RXF, fep->hwp + FEC_IEVENT); 1483 + writel(FEC_ENET_RXF_GET(queue_id), fep->hwp + FEC_IEVENT); 1484 1484 1485 1485 /* Check for errors. */ 1486 1486 status ^= BD_ENET_RX_LAST;
+3
drivers/net/ethernet/google/gve/gve_utils.c
··· 68 68 set_protocol = ctx->curr_frag_cnt == ctx->expected_frag_cnt - 1; 69 69 } else { 70 70 skb = napi_alloc_skb(napi, len); 71 + 72 + if (unlikely(!skb)) 73 + return NULL; 71 74 set_protocol = true; 72 75 } 73 76 __skb_put(skb, len);
+1
drivers/net/ethernet/huawei/hinic/hinic_sriov.c
··· 8 8 #include <linux/interrupt.h> 9 9 #include <linux/etherdevice.h> 10 10 #include <linux/netdevice.h> 11 + #include <linux/module.h> 11 12 12 13 #include "hinic_hw_dev.h" 13 14 #include "hinic_dev.h"
+8
drivers/net/ethernet/intel/i40e/i40e_debugfs.c
··· 553 553 dev_info(&pf->pdev->dev, "vsi %d not found\n", vsi_seid); 554 554 return; 555 555 } 556 + if (vsi->type != I40E_VSI_MAIN && 557 + vsi->type != I40E_VSI_FDIR && 558 + vsi->type != I40E_VSI_VMDQ2) { 559 + dev_info(&pf->pdev->dev, 560 + "vsi %d type %d descriptor rings not available\n", 561 + vsi_seid, vsi->type); 562 + return; 563 + } 556 564 if (type == RING_TYPE_XDP && !i40e_enabled_xdp_vsi(vsi)) { 557 565 dev_info(&pf->pdev->dev, "XDP not enabled on VSI %d\n", vsi_seid); 558 566 return;
+48 -27
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 1949 1949 } 1950 1950 1951 1951 /** 1952 + * i40e_sync_vf_state 1953 + * @vf: pointer to the VF info 1954 + * @state: VF state 1955 + * 1956 + * Called from a VF message to synchronize the service with a potential 1957 + * VF reset state 1958 + **/ 1959 + static bool i40e_sync_vf_state(struct i40e_vf *vf, enum i40e_vf_states state) 1960 + { 1961 + int i; 1962 + 1963 + /* When handling some messages, it needs VF state to be set. 1964 + * It is possible that this flag is cleared during VF reset, 1965 + * so there is a need to wait until the end of the reset to 1966 + * handle the request message correctly. 1967 + */ 1968 + for (i = 0; i < I40E_VF_STATE_WAIT_COUNT; i++) { 1969 + if (test_bit(state, &vf->vf_states)) 1970 + return true; 1971 + usleep_range(10000, 20000); 1972 + } 1973 + 1974 + return test_bit(state, &vf->vf_states); 1975 + } 1976 + 1977 + /** 1952 1978 * i40e_vc_get_version_msg 1953 1979 * @vf: pointer to the VF info 1954 1980 * @msg: pointer to the msg buffer ··· 2034 2008 size_t len = 0; 2035 2009 int ret; 2036 2010 2037 - if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) { 2011 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_INIT)) { 2038 2012 aq_ret = I40E_ERR_PARAM; 2039 2013 goto err; 2040 2014 } ··· 2157 2131 bool allmulti = false; 2158 2132 bool alluni = false; 2159 2133 2160 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 2134 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 2161 2135 aq_ret = I40E_ERR_PARAM; 2162 2136 goto err_out; 2163 2137 } ··· 2245 2219 struct i40e_vsi *vsi; 2246 2220 u16 num_qps_all = 0; 2247 2221 2248 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 2222 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 2249 2223 aq_ret = I40E_ERR_PARAM; 2250 2224 goto error_param; 2251 2225 } ··· 2394 2368 i40e_status aq_ret = 0; 2395 2369 int i; 2396 2370 2397 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 2371 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 2398 2372 aq_ret = I40E_ERR_PARAM; 2399 2373 goto error_param; 2400 2374 } ··· 2566 2540 struct i40e_pf *pf = vf->pf; 2567 2541 i40e_status aq_ret = 0; 2568 2542 2569 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 2543 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 2570 2544 aq_ret = I40E_ERR_PARAM; 2571 2545 goto error_param; 2572 2546 } ··· 2616 2590 u8 cur_pairs = vf->num_queue_pairs; 2617 2591 struct i40e_pf *pf = vf->pf; 2618 2592 2619 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) 2593 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) 2620 2594 return -EINVAL; 2621 2595 2622 2596 if (req_pairs > I40E_MAX_VF_QUEUES) { ··· 2661 2635 2662 2636 memset(&stats, 0, sizeof(struct i40e_eth_stats)); 2663 2637 2664 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 2638 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 2665 2639 aq_ret = I40E_ERR_PARAM; 2666 2640 goto error_param; 2667 2641 } ··· 2778 2752 i40e_status ret = 0; 2779 2753 int i; 2780 2754 2781 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) || 2755 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) || 2782 2756 !i40e_vc_isvalid_vsi_id(vf, al->vsi_id)) { 2783 2757 ret = I40E_ERR_PARAM; 2784 2758 goto error_param; ··· 2850 2824 i40e_status ret = 0; 2851 2825 int i; 2852 2826 2853 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) || 2827 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) || 2854 2828 !i40e_vc_isvalid_vsi_id(vf, al->vsi_id)) { 2855 2829 ret = I40E_ERR_PARAM; 2856 2830 goto error_param; ··· 2994 2968 i40e_status aq_ret = 0; 2995 2969 int i; 2996 2970 2997 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) || 2971 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) || 2998 2972 !i40e_vc_isvalid_vsi_id(vf, vfl->vsi_id)) { 2999 2973 aq_ret = I40E_ERR_PARAM; 3000 2974 goto error_param; ··· 3114 3088 struct i40e_vsi *vsi = NULL; 3115 3089 i40e_status aq_ret = 0; 3116 3090 3117 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) || 3091 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) || 3118 3092 !i40e_vc_isvalid_vsi_id(vf, vrk->vsi_id) || 3119 - (vrk->key_len != I40E_HKEY_ARRAY_SIZE)) { 3093 + vrk->key_len != I40E_HKEY_ARRAY_SIZE) { 3120 3094 aq_ret = I40E_ERR_PARAM; 3121 3095 goto err; 3122 3096 } ··· 3145 3119 i40e_status aq_ret = 0; 3146 3120 u16 i; 3147 3121 3148 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) || 3122 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) || 3149 3123 !i40e_vc_isvalid_vsi_id(vf, vrl->vsi_id) || 3150 - (vrl->lut_entries != I40E_VF_HLUT_ARRAY_SIZE)) { 3124 + vrl->lut_entries != I40E_VF_HLUT_ARRAY_SIZE) { 3151 3125 aq_ret = I40E_ERR_PARAM; 3152 3126 goto err; 3153 3127 } ··· 3180 3154 i40e_status aq_ret = 0; 3181 3155 int len = 0; 3182 3156 3183 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3157 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3184 3158 aq_ret = I40E_ERR_PARAM; 3185 3159 goto err; 3186 3160 } ··· 3216 3190 struct i40e_hw *hw = &pf->hw; 3217 3191 i40e_status aq_ret = 0; 3218 3192 3219 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3193 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3220 3194 aq_ret = I40E_ERR_PARAM; 3221 3195 goto err; 3222 3196 } ··· 3241 3215 i40e_status aq_ret = 0; 3242 3216 struct i40e_vsi *vsi; 3243 3217 3244 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3218 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3245 3219 aq_ret = I40E_ERR_PARAM; 3246 3220 goto err; 3247 3221 } ··· 3267 3241 i40e_status aq_ret = 0; 3268 3242 struct i40e_vsi *vsi; 3269 3243 3270 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3244 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3271 3245 aq_ret = I40E_ERR_PARAM; 3272 3246 goto err; 3273 3247 } ··· 3494 3468 i40e_status aq_ret = 0; 3495 3469 int i, ret; 3496 3470 3497 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3471 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3498 3472 aq_ret = I40E_ERR_PARAM; 3499 3473 goto err; 3500 3474 } ··· 3625 3599 i40e_status aq_ret = 0; 3626 3600 int i, ret; 3627 3601 3628 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3602 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3629 3603 aq_ret = I40E_ERR_PARAM; 3630 3604 goto err_out; 3631 3605 } ··· 3734 3708 i40e_status aq_ret = 0; 3735 3709 u64 speed = 0; 3736 3710 3737 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3711 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3738 3712 aq_ret = I40E_ERR_PARAM; 3739 3713 goto err; 3740 3714 } ··· 3823 3797 3824 3798 /* set this flag only after making sure all inputs are sane */ 3825 3799 vf->adq_enabled = true; 3826 - /* num_req_queues is set when user changes number of queues via ethtool 3827 - * and this causes issue for default VSI(which depends on this variable) 3828 - * when ADq is enabled, hence reset it. 3829 - */ 3830 - vf->num_req_queues = 0; 3831 3800 3832 3801 /* reset the VF in order to allocate resources */ 3833 3802 i40e_vc_reset_vf(vf, true); ··· 3845 3824 struct i40e_pf *pf = vf->pf; 3846 3825 i40e_status aq_ret = 0; 3847 3826 3848 - if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) { 3827 + if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) { 3849 3828 aq_ret = I40E_ERR_PARAM; 3850 3829 goto err; 3851 3830 }
+2
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
··· 18 18 19 19 #define I40E_MAX_VF_PROMISC_FLAGS 3 20 20 21 + #define I40E_VF_STATE_WAIT_COUNT 20 22 + 21 23 /* Various queue ctrls */ 22 24 enum i40e_queue_ctrl { 23 25 I40E_QUEUE_CTRL_UNKNOWN = 0,
+32 -11
drivers/net/ethernet/intel/iavf/iavf_ethtool.c
··· 615 615 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 616 616 return -EINVAL; 617 617 618 - new_tx_count = clamp_t(u32, ring->tx_pending, 619 - IAVF_MIN_TXD, 620 - IAVF_MAX_TXD); 621 - new_tx_count = ALIGN(new_tx_count, IAVF_REQ_DESCRIPTOR_MULTIPLE); 618 + if (ring->tx_pending > IAVF_MAX_TXD || 619 + ring->tx_pending < IAVF_MIN_TXD || 620 + ring->rx_pending > IAVF_MAX_RXD || 621 + ring->rx_pending < IAVF_MIN_RXD) { 622 + netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n", 623 + ring->tx_pending, ring->rx_pending, IAVF_MIN_TXD, 624 + IAVF_MAX_RXD, IAVF_REQ_DESCRIPTOR_MULTIPLE); 625 + return -EINVAL; 626 + } 622 627 623 - new_rx_count = clamp_t(u32, ring->rx_pending, 624 - IAVF_MIN_RXD, 625 - IAVF_MAX_RXD); 626 - new_rx_count = ALIGN(new_rx_count, IAVF_REQ_DESCRIPTOR_MULTIPLE); 628 + new_tx_count = ALIGN(ring->tx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE); 629 + if (new_tx_count != ring->tx_pending) 630 + netdev_info(netdev, "Requested Tx descriptor count rounded up to %d\n", 631 + new_tx_count); 632 + 633 + new_rx_count = ALIGN(ring->rx_pending, IAVF_REQ_DESCRIPTOR_MULTIPLE); 634 + if (new_rx_count != ring->rx_pending) 635 + netdev_info(netdev, "Requested Rx descriptor count rounded up to %d\n", 636 + new_rx_count); 627 637 628 638 /* if nothing to do return success */ 629 639 if ((new_tx_count == adapter->tx_desc_count) && 630 - (new_rx_count == adapter->rx_desc_count)) 640 + (new_rx_count == adapter->rx_desc_count)) { 641 + netdev_dbg(netdev, "Nothing to change, descriptor count is same as requested\n"); 631 642 return 0; 643 + } 632 644 633 - adapter->tx_desc_count = new_tx_count; 634 - adapter->rx_desc_count = new_rx_count; 645 + if (new_tx_count != adapter->tx_desc_count) { 646 + netdev_dbg(netdev, "Changing Tx descriptor count from %d to %d\n", 647 + adapter->tx_desc_count, new_tx_count); 648 + adapter->tx_desc_count = new_tx_count; 649 + } 650 + 651 + if (new_rx_count != adapter->rx_desc_count) { 652 + netdev_dbg(netdev, "Changing Rx descriptor count from %d to %d\n", 653 + adapter->rx_desc_count, new_rx_count); 654 + adapter->rx_desc_count = new_rx_count; 655 + } 635 656 636 657 if (netif_running(netdev)) { 637 658 adapter->flags |= IAVF_FLAG_RESET_NEEDED;
+1
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 2248 2248 } 2249 2249 2250 2250 pci_set_master(adapter->pdev); 2251 + pci_restore_msi_state(adapter->pdev); 2251 2252 2252 2253 if (i == IAVF_RESET_WAIT_COMPLETE_COUNT) { 2253 2254 dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n",
+12 -6
drivers/net/ethernet/intel/ice/ice_dcb_nl.c
··· 97 97 98 98 new_cfg->etscfg.maxtcs = pf->hw.func_caps.common_cap.maxtc; 99 99 100 + if (!bwcfg) 101 + new_cfg->etscfg.tcbwtable[0] = 100; 102 + 100 103 if (!bwrec) 101 104 new_cfg->etsrec.tcbwtable[0] = 100; 102 105 ··· 170 167 if (mode == pf->dcbx_cap) 171 168 return ICE_DCB_NO_HW_CHG; 172 169 173 - pf->dcbx_cap = mode; 174 170 qos_cfg = &pf->hw.port_info->qos_cfg; 175 - if (mode & DCB_CAP_DCBX_VER_CEE) { 176 - if (qos_cfg->local_dcbx_cfg.pfc_mode == ICE_QOS_MODE_DSCP) 177 - return ICE_DCB_NO_HW_CHG; 171 + 172 + /* DSCP configuration is not DCBx negotiated */ 173 + if (qos_cfg->local_dcbx_cfg.pfc_mode == ICE_QOS_MODE_DSCP) 174 + return ICE_DCB_NO_HW_CHG; 175 + 176 + pf->dcbx_cap = mode; 177 + 178 + if (mode & DCB_CAP_DCBX_VER_CEE) 178 179 qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; 179 - } else { 180 + else 180 181 qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; 181 - } 182 182 183 183 dev_info(ice_pf_to_dev(pf), "DCBx mode = 0x%x\n", mode); 184 184 return ICE_DCB_HW_CHG_RST;
+2 -2
drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
··· 1268 1268 bool is_tun = tun == ICE_FD_HW_SEG_TUN; 1269 1269 int err; 1270 1270 1271 - if (is_tun && !ice_get_open_tunnel_port(&pf->hw, &port_num)) 1271 + if (is_tun && !ice_get_open_tunnel_port(&pf->hw, &port_num, TNL_ALL)) 1272 1272 continue; 1273 1273 err = ice_fdir_write_fltr(pf, input, add, is_tun); 1274 1274 if (err) ··· 1652 1652 } 1653 1653 1654 1654 /* return error if not an update and no available filters */ 1655 - fltrs_needed = ice_get_open_tunnel_port(hw, &tunnel_port) ? 2 : 1; 1655 + fltrs_needed = ice_get_open_tunnel_port(hw, &tunnel_port, TNL_ALL) ? 2 : 1; 1656 1656 if (!ice_fdir_find_fltr_by_idx(hw, fsp->location) && 1657 1657 ice_fdir_num_avail_fltr(hw, pf->vsi[vsi->idx]) < fltrs_needed) { 1658 1658 dev_err(dev, "Failed to add filter. The maximum number of flow director filters has been reached.\n");
+1 -1
drivers/net/ethernet/intel/ice/ice_fdir.c
··· 924 924 memcpy(pkt, ice_fdir_pkt[idx].pkt, ice_fdir_pkt[idx].pkt_len); 925 925 loc = pkt; 926 926 } else { 927 - if (!ice_get_open_tunnel_port(hw, &tnl_port)) 927 + if (!ice_get_open_tunnel_port(hw, &tnl_port, TNL_ALL)) 928 928 return ICE_ERR_DOES_NOT_EXIST; 929 929 if (!ice_fdir_pkt[idx].tun_pkt) 930 930 return ICE_ERR_PARAM;
+5 -2
drivers/net/ethernet/intel/ice/ice_flex_pipe.c
··· 1899 1899 * ice_get_open_tunnel_port - retrieve an open tunnel port 1900 1900 * @hw: pointer to the HW structure 1901 1901 * @port: returns open port 1902 + * @type: type of tunnel, can be TNL_LAST if it doesn't matter 1902 1903 */ 1903 1904 bool 1904 - ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port) 1905 + ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port, 1906 + enum ice_tunnel_type type) 1905 1907 { 1906 1908 bool res = false; 1907 1909 u16 i; ··· 1911 1909 mutex_lock(&hw->tnl_lock); 1912 1910 1913 1911 for (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++) 1914 - if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].port) { 1912 + if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].port && 1913 + (type == TNL_LAST || type == hw->tnl.tbl[i].type)) { 1915 1914 *port = hw->tnl.tbl[i].port; 1916 1915 res = true; 1917 1916 break;
+2 -1
drivers/net/ethernet/intel/ice/ice_flex_pipe.h
··· 33 33 ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt, 34 34 unsigned long *bm, struct list_head *fv_list); 35 35 bool 36 - ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port); 36 + ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port, 37 + enum ice_tunnel_type type); 37 38 int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table, 38 39 unsigned int idx, struct udp_tunnel_info *ti); 39 40 int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,
+21 -11
drivers/net/ethernet/intel/ice/ice_main.c
··· 5881 5881 netif_carrier_on(vsi->netdev); 5882 5882 } 5883 5883 5884 + /* clear this now, and the first stats read will be used as baseline */ 5885 + vsi->stat_offsets_loaded = false; 5886 + 5884 5887 ice_service_task_schedule(pf); 5885 5888 5886 5889 return 0; ··· 5930 5927 /** 5931 5928 * ice_update_vsi_tx_ring_stats - Update VSI Tx ring stats counters 5932 5929 * @vsi: the VSI to be updated 5930 + * @vsi_stats: the stats struct to be updated 5933 5931 * @rings: rings to work on 5934 5932 * @count: number of rings 5935 5933 */ 5936 5934 static void 5937 - ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, struct ice_tx_ring **rings, 5938 - u16 count) 5935 + ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, 5936 + struct rtnl_link_stats64 *vsi_stats, 5937 + struct ice_tx_ring **rings, u16 count) 5939 5938 { 5940 - struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats; 5941 5939 u16 i; 5942 5940 5943 5941 for (i = 0; i < count; i++) { ··· 5962 5958 */ 5963 5959 static void ice_update_vsi_ring_stats(struct ice_vsi *vsi) 5964 5960 { 5965 - struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats; 5961 + struct rtnl_link_stats64 *vsi_stats; 5966 5962 u64 pkts, bytes; 5967 5963 int i; 5968 5964 5969 - /* reset netdev stats */ 5970 - vsi_stats->tx_packets = 0; 5971 - vsi_stats->tx_bytes = 0; 5972 - vsi_stats->rx_packets = 0; 5973 - vsi_stats->rx_bytes = 0; 5965 + vsi_stats = kzalloc(sizeof(*vsi_stats), GFP_ATOMIC); 5966 + if (!vsi_stats) 5967 + return; 5974 5968 5975 5969 /* reset non-netdev (extended) stats */ 5976 5970 vsi->tx_restart = 0; ··· 5980 5978 rcu_read_lock(); 5981 5979 5982 5980 /* update Tx rings counters */ 5983 - ice_update_vsi_tx_ring_stats(vsi, vsi->tx_rings, vsi->num_txq); 5981 + ice_update_vsi_tx_ring_stats(vsi, vsi_stats, vsi->tx_rings, 5982 + vsi->num_txq); 5984 5983 5985 5984 /* update Rx rings counters */ 5986 5985 ice_for_each_rxq(vsi, i) { ··· 5996 5993 5997 5994 /* update XDP Tx rings counters */ 5998 5995 if (ice_is_xdp_ena_vsi(vsi)) 5999 - ice_update_vsi_tx_ring_stats(vsi, vsi->xdp_rings, 5996 + ice_update_vsi_tx_ring_stats(vsi, vsi_stats, vsi->xdp_rings, 6000 5997 vsi->num_xdp_txq); 6001 5998 6002 5999 rcu_read_unlock(); 6000 + 6001 + vsi->net_stats.tx_packets = vsi_stats->tx_packets; 6002 + vsi->net_stats.tx_bytes = vsi_stats->tx_bytes; 6003 + vsi->net_stats.rx_packets = vsi_stats->rx_packets; 6004 + vsi->net_stats.rx_bytes = vsi_stats->rx_bytes; 6005 + 6006 + kfree(vsi_stats); 6003 6007 } 6004 6008 6005 6009 /**
+14 -7
drivers/net/ethernet/intel/ice/ice_switch.c
··· 3796 3796 * ice_find_recp - find a recipe 3797 3797 * @hw: pointer to the hardware structure 3798 3798 * @lkup_exts: extension sequence to match 3799 + * @tun_type: type of recipe tunnel 3799 3800 * 3800 3801 * Returns index of matching recipe, or ICE_MAX_NUM_RECIPES if not found. 3801 3802 */ 3802 - static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts) 3803 + static u16 3804 + ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts, 3805 + enum ice_sw_tunnel_type tun_type) 3803 3806 { 3804 3807 bool refresh_required = true; 3805 3808 struct ice_sw_recipe *recp; ··· 3863 3860 } 3864 3861 /* If for "i"th recipe the found was never set to false 3865 3862 * then it means we found our match 3863 + * Also tun type of recipe needs to be checked 3866 3864 */ 3867 - if (found) 3865 + if (found && recp[i].tun_type == tun_type) 3868 3866 return i; /* Return the recipe ID */ 3869 3867 } 3870 3868 } ··· 4655 4651 } 4656 4652 4657 4653 /* Look for a recipe which matches our requested fv / mask list */ 4658 - *rid = ice_find_recp(hw, lkup_exts); 4654 + *rid = ice_find_recp(hw, lkup_exts, rinfo->tun_type); 4659 4655 if (*rid < ICE_MAX_NUM_RECIPES) 4660 4656 /* Success if found a recipe that match the existing criteria */ 4661 4657 goto err_unroll; 4662 4658 4659 + rm->tun_type = rinfo->tun_type; 4663 4660 /* Recipe we need does not exist, add a recipe */ 4664 4661 status = ice_add_sw_recipe(hw, rm, profiles); 4665 4662 if (status) ··· 4963 4958 4964 4959 switch (tun_type) { 4965 4960 case ICE_SW_TUN_VXLAN: 4966 - case ICE_SW_TUN_GENEVE: 4967 - if (!ice_get_open_tunnel_port(hw, &open_port)) 4961 + if (!ice_get_open_tunnel_port(hw, &open_port, TNL_VXLAN)) 4968 4962 return ICE_ERR_CFG; 4969 4963 break; 4970 - 4964 + case ICE_SW_TUN_GENEVE: 4965 + if (!ice_get_open_tunnel_port(hw, &open_port, TNL_GENEVE)) 4966 + return ICE_ERR_CFG; 4967 + break; 4971 4968 default: 4972 4969 /* Nothing needs to be done for this tunnel type */ 4973 4970 return 0; ··· 5562 5555 if (status) 5563 5556 return status; 5564 5557 5565 - rid = ice_find_recp(hw, &lkup_exts); 5558 + rid = ice_find_recp(hw, &lkup_exts, rinfo->tun_type); 5566 5559 /* If did not find a recipe that match the existing criteria */ 5567 5560 if (rid == ICE_MAX_NUM_RECIPES) 5568 5561 return ICE_ERR_PARAM;
+12 -18
drivers/net/ethernet/intel/ice/ice_tc_lib.c
··· 74 74 return inner ? ICE_IPV6_IL : ICE_IPV6_OFOS; 75 75 } 76 76 77 - static enum ice_protocol_type 78 - ice_proto_type_from_l4_port(bool inner, u16 ip_proto) 77 + static enum ice_protocol_type ice_proto_type_from_l4_port(u16 ip_proto) 79 78 { 80 - if (inner) { 81 - switch (ip_proto) { 82 - case IPPROTO_UDP: 83 - return ICE_UDP_ILOS; 84 - } 85 - } else { 86 - switch (ip_proto) { 87 - case IPPROTO_TCP: 88 - return ICE_TCP_IL; 89 - case IPPROTO_UDP: 90 - return ICE_UDP_OF; 91 - } 79 + switch (ip_proto) { 80 + case IPPROTO_TCP: 81 + return ICE_TCP_IL; 82 + case IPPROTO_UDP: 83 + return ICE_UDP_ILOS; 92 84 } 93 85 94 86 return 0; ··· 183 191 i++; 184 192 } 185 193 186 - if (flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) { 187 - list[i].type = ice_proto_type_from_l4_port(false, hdr->l3_key.ip_proto); 194 + if ((flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) && 195 + hdr->l3_key.ip_proto == IPPROTO_UDP) { 196 + list[i].type = ICE_UDP_OF; 188 197 list[i].h_u.l4_hdr.dst_port = hdr->l4_key.dst_port; 189 198 list[i].m_u.l4_hdr.dst_port = hdr->l4_mask.dst_port; 190 199 i++; ··· 310 317 ICE_TC_FLWR_FIELD_SRC_L4_PORT)) { 311 318 struct ice_tc_l4_hdr *l4_key, *l4_mask; 312 319 313 - list[i].type = ice_proto_type_from_l4_port(inner, headers->l3_key.ip_proto); 320 + list[i].type = ice_proto_type_from_l4_port(headers->l3_key.ip_proto); 314 321 l4_key = &headers->l4_key; 315 322 l4_mask = &headers->l4_mask; 316 323 ··· 795 802 headers->l3_mask.ttl = match.mask->ttl; 796 803 } 797 804 798 - if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS)) { 805 + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS) && 806 + fltr->tunnel_type != TNL_VXLAN && fltr->tunnel_type != TNL_GENEVE) { 799 807 struct flow_match_ports match; 800 808 801 809 flow_rule_match_enc_ports(rule, &match);
+6
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
··· 1617 1617 ice_vc_set_default_allowlist(vf); 1618 1618 1619 1619 ice_vf_fdir_exit(vf); 1620 + ice_vf_fdir_init(vf); 1620 1621 /* clean VF control VSI when resetting VFs since it should be 1621 1622 * setup only when VF creates its first FDIR rule. 1622 1623 */ ··· 1748 1747 } 1749 1748 1750 1749 ice_vf_fdir_exit(vf); 1750 + ice_vf_fdir_init(vf); 1751 1751 /* clean VF control VSI when resetting VF since it should be setup 1752 1752 * only when VF creates its first FDIR rule. 1753 1753 */ ··· 2022 2020 ret = ice_eswitch_configure(pf); 2023 2021 if (ret) 2024 2022 goto err_unroll_sriov; 2023 + 2024 + /* rearm global interrupts */ 2025 + if (test_and_clear_bit(ICE_OICR_INTR_DIS, pf->state)) 2026 + ice_irq_dynamic_ena(hw, NULL, NULL); 2025 2027 2026 2028 return 0; 2027 2029
+2 -2
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 2960 2960 mvpp2_rxq_status_update(port, rxq->id, 0, rxq->size); 2961 2961 2962 2962 if (priv->percpu_pools) { 2963 - err = xdp_rxq_info_reg(&rxq->xdp_rxq_short, port->dev, rxq->id, 0); 2963 + err = xdp_rxq_info_reg(&rxq->xdp_rxq_short, port->dev, rxq->logic_rxq, 0); 2964 2964 if (err < 0) 2965 2965 goto err_free_dma; 2966 2966 2967 - err = xdp_rxq_info_reg(&rxq->xdp_rxq_long, port->dev, rxq->id, 0); 2967 + err = xdp_rxq_info_reg(&rxq->xdp_rxq_long, port->dev, rxq->logic_rxq, 0); 2968 2968 if (err < 0) 2969 2969 goto err_unregister_rxq_short; 2970 2970
+2
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
··· 5 5 * 6 6 */ 7 7 8 + #include <linux/module.h> 9 + 8 10 #include "otx2_common.h" 9 11 #include "otx2_ptp.h" 10 12
+5 -5
drivers/net/ethernet/microsoft/mana/hw_channel.c
··· 480 480 if (err) 481 481 goto out; 482 482 483 - err = mana_hwc_alloc_dma_buf(hwc, q_depth, max_msg_size, 484 - &hwc_wq->msg_buf); 485 - if (err) 486 - goto out; 487 - 488 483 hwc_wq->hwc = hwc; 489 484 hwc_wq->gdma_wq = queue; 490 485 hwc_wq->queue_depth = q_depth; 491 486 hwc_wq->hwc_cq = hwc_cq; 487 + 488 + err = mana_hwc_alloc_dma_buf(hwc, q_depth, max_msg_size, 489 + &hwc_wq->msg_buf); 490 + if (err) 491 + goto out; 492 492 493 493 *hwc_wq_ptr = hwc_wq; 494 494 return 0;
+3 -1
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
··· 803 803 return -ENOMEM; 804 804 805 805 cache = kzalloc(sizeof(*cache), GFP_KERNEL); 806 - if (!cache) 806 + if (!cache) { 807 + nfp_cpp_area_free(area); 807 808 return -ENOMEM; 809 + } 808 810 809 811 cache->id = 0; 810 812 cache->addr = 0;
+7
drivers/net/ethernet/qlogic/qede/qede_fp.c
··· 1643 1643 data_split = true; 1644 1644 } 1645 1645 } else { 1646 + if (unlikely(skb->len > ETH_TX_MAX_NON_LSO_PKT_LEN)) { 1647 + DP_ERR(edev, "Unexpected non LSO skb length = 0x%x\n", skb->len); 1648 + qede_free_failed_tx_pkt(txq, first_bd, 0, false); 1649 + qede_update_tx_producer(txq); 1650 + return NETDEV_TX_OK; 1651 + } 1652 + 1646 1653 val |= ((skb->len & ETH_TX_DATA_1ST_BD_PKT_LEN_MASK) << 1647 1654 ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT); 1648 1655 }
+9 -10
drivers/net/ethernet/qlogic/qla3xxx.c
··· 3480 3480 3481 3481 spin_lock_irqsave(&qdev->hw_lock, hw_flags); 3482 3482 3483 - err = ql_wait_for_drvr_lock(qdev); 3484 - if (err) { 3485 - err = ql_adapter_initialize(qdev); 3486 - if (err) { 3487 - netdev_err(ndev, "Unable to initialize adapter\n"); 3488 - goto err_init; 3489 - } 3490 - netdev_err(ndev, "Releasing driver lock\n"); 3491 - ql_sem_unlock(qdev, QL_DRVR_SEM_MASK); 3492 - } else { 3483 + if (!ql_wait_for_drvr_lock(qdev)) { 3493 3484 netdev_err(ndev, "Could not acquire driver lock\n"); 3485 + err = -ENODEV; 3494 3486 goto err_lock; 3495 3487 } 3488 + 3489 + err = ql_adapter_initialize(qdev); 3490 + if (err) { 3491 + netdev_err(ndev, "Unable to initialize adapter\n"); 3492 + goto err_init; 3493 + } 3494 + ql_sem_unlock(qdev, QL_DRVR_SEM_MASK); 3496 3495 3497 3496 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 3498 3497
+1
drivers/net/phy/phylink.c
··· 1388 1388 * @mac_wol: true if the MAC needs to receive packets for Wake-on-Lan 1389 1389 * 1390 1390 * Handle a network device suspend event. There are several cases: 1391 + * 1391 1392 * - If Wake-on-Lan is not active, we can bring down the link between 1392 1393 * the MAC and PHY by calling phylink_stop(). 1393 1394 * - If Wake-on-Lan is active, and being handled only by the PHY, we
+2
drivers/net/usb/cdc_ncm.c
··· 181 181 min = ctx->max_datagram_size + ctx->max_ndp_size + sizeof(struct usb_cdc_ncm_nth32); 182 182 183 183 max = min_t(u32, CDC_NCM_NTB_MAX_SIZE_TX, le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize)); 184 + if (max == 0) 185 + max = CDC_NCM_NTB_MAX_SIZE_TX; /* dwNtbOutMaxSize not set */ 184 186 185 187 /* some devices set dwNtbOutMaxSize too low for the above default */ 186 188 min = min(min, max);
+7 -6
drivers/net/vmxnet3/vmxnet3_drv.c
··· 3261 3261 3262 3262 #ifdef CONFIG_PCI_MSI 3263 3263 if (adapter->intr.type == VMXNET3_IT_MSIX) { 3264 - int i, nvec; 3264 + int i, nvec, nvec_allocated; 3265 3265 3266 3266 nvec = adapter->share_intr == VMXNET3_INTR_TXSHARE ? 3267 3267 1 : adapter->num_tx_queues; ··· 3274 3274 for (i = 0; i < nvec; i++) 3275 3275 adapter->intr.msix_entries[i].entry = i; 3276 3276 3277 - nvec = vmxnet3_acquire_msix_vectors(adapter, nvec); 3278 - if (nvec < 0) 3277 + nvec_allocated = vmxnet3_acquire_msix_vectors(adapter, nvec); 3278 + if (nvec_allocated < 0) 3279 3279 goto msix_err; 3280 3280 3281 3281 /* If we cannot allocate one MSIx vector per queue 3282 3282 * then limit the number of rx queues to 1 3283 3283 */ 3284 - if (nvec == VMXNET3_LINUX_MIN_MSIX_VECT) { 3284 + if (nvec_allocated == VMXNET3_LINUX_MIN_MSIX_VECT && 3285 + nvec != VMXNET3_LINUX_MIN_MSIX_VECT) { 3285 3286 if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE 3286 3287 || adapter->num_rx_queues != 1) { 3287 3288 adapter->share_intr = VMXNET3_INTR_TXSHARE; ··· 3292 3291 } 3293 3292 } 3294 3293 3295 - adapter->intr.num_intrs = nvec; 3294 + adapter->intr.num_intrs = nvec_allocated; 3296 3295 return; 3297 3296 3298 3297 msix_err: 3299 3298 /* If we cannot allocate MSIx vectors use only one rx queue */ 3300 3299 dev_info(&adapter->pdev->dev, 3301 3300 "Failed to enable MSI-X, error %d. " 3302 - "Limiting #rx queues to 1, try MSI.\n", nvec); 3301 + "Limiting #rx queues to 1, try MSI.\n", nvec_allocated); 3303 3302 3304 3303 adapter->intr.type = VMXNET3_IT_MSI; 3305 3304 }
+4 -4
drivers/net/vrf.c
··· 770 770 771 771 skb->dev = vrf_dev; 772 772 773 - vrf_nf_set_untracked(skb); 774 - 775 773 err = nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, 776 774 skb, NULL, vrf_dev, vrf_ip6_out_direct_finish); 777 775 ··· 789 791 /* don't divert link scope packets */ 790 792 if (rt6_need_strict(&ipv6_hdr(skb)->daddr)) 791 793 return skb; 794 + 795 + vrf_nf_set_untracked(skb); 792 796 793 797 if (qdisc_tx_is_default(vrf_dev) || 794 798 IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) ··· 1000 1000 1001 1001 skb->dev = vrf_dev; 1002 1002 1003 - vrf_nf_set_untracked(skb); 1004 - 1005 1003 err = nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk, 1006 1004 skb, NULL, vrf_dev, vrf_ip_out_direct_finish); 1007 1005 ··· 1020 1022 if (ipv4_is_multicast(ip_hdr(skb)->daddr) || 1021 1023 ipv4_is_lbcast(ip_hdr(skb)->daddr)) 1022 1024 return skb; 1025 + 1026 + vrf_nf_set_untracked(skb); 1023 1027 1024 1028 if (qdisc_tx_is_default(vrf_dev) || 1025 1029 IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED)
+5 -1
drivers/net/wireless/ath/ath11k/mhi.c
··· 533 533 ret = mhi_pm_suspend(ab_pci->mhi_ctrl); 534 534 break; 535 535 case ATH11K_MHI_RESUME: 536 - ret = mhi_pm_resume(ab_pci->mhi_ctrl); 536 + /* Do force MHI resume as some devices like QCA6390, WCN6855 537 + * are not in M3 state but they are functional. So just ignore 538 + * the MHI state while resuming. 539 + */ 540 + ret = mhi_pm_resume_force(ab_pci->mhi_ctrl); 537 541 break; 538 542 case ATH11K_MHI_TRIGGER_RDDM: 539 543 ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl);
+17 -9
drivers/net/wwan/iosm/iosm_ipc_imem.c
··· 181 181 bool ipc_imem_ul_write_td(struct iosm_imem *ipc_imem) 182 182 { 183 183 struct ipc_mem_channel *channel; 184 + bool hpda_ctrl_pending = false; 184 185 struct sk_buff_head *ul_list; 185 186 bool hpda_pending = false; 186 - bool forced_hpdu = false; 187 187 struct ipc_pipe *pipe; 188 188 int i; 189 189 ··· 200 200 ul_list = &channel->ul_list; 201 201 202 202 /* Fill the transfer descriptor with the uplink buffer info. */ 203 - hpda_pending |= ipc_protocol_ul_td_send(ipc_imem->ipc_protocol, 203 + if (!ipc_imem_check_wwan_ips(channel)) { 204 + hpda_ctrl_pending |= 205 + ipc_protocol_ul_td_send(ipc_imem->ipc_protocol, 204 206 pipe, ul_list); 205 - 206 - /* forced HP update needed for non data channels */ 207 - if (hpda_pending && !ipc_imem_check_wwan_ips(channel)) 208 - forced_hpdu = true; 207 + } else { 208 + hpda_pending |= 209 + ipc_protocol_ul_td_send(ipc_imem->ipc_protocol, 210 + pipe, ul_list); 211 + } 209 212 } 210 213 211 - if (forced_hpdu) { 214 + /* forced HP update needed for non data channels */ 215 + if (hpda_ctrl_pending) { 212 216 hpda_pending = false; 213 217 ipc_protocol_doorbell_trigger(ipc_imem->ipc_protocol, 214 218 IPC_HP_UL_WRITE_TD); ··· 530 526 "Modem link down. Exit run state worker."); 531 527 return; 532 528 } 529 + 530 + if (test_and_clear_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag)) 531 + ipc_devlink_deinit(ipc_imem->ipc_devlink); 533 532 534 533 if (!ipc_imem_setup_cp_mux_cap_init(ipc_imem, &mux_cfg)) 535 534 ipc_imem->mux = ipc_mux_init(&mux_cfg, ipc_imem); ··· 1174 1167 ipc_port_deinit(ipc_imem->ipc_port); 1175 1168 } 1176 1169 1177 - if (ipc_imem->ipc_devlink) 1170 + if (test_and_clear_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag)) 1178 1171 ipc_devlink_deinit(ipc_imem->ipc_devlink); 1179 1172 1180 1173 ipc_imem_device_ipc_uninit(ipc_imem); ··· 1270 1263 1271 1264 ipc_imem->pci_device_id = device_id; 1272 1265 1273 - ipc_imem->ev_cdev_write_pending = false; 1274 1266 ipc_imem->cp_version = 0; 1275 1267 ipc_imem->device_sleep = IPC_HOST_SLEEP_ENTER_SLEEP; 1276 1268 ··· 1337 1331 1338 1332 if (ipc_flash_link_establish(ipc_imem)) 1339 1333 goto devlink_channel_fail; 1334 + 1335 + set_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag); 1340 1336 } 1341 1337 return ipc_imem; 1342 1338 devlink_channel_fail:
+1 -3
drivers/net/wwan/iosm/iosm_ipc_imem.h
··· 101 101 #define IOSM_CHIP_INFO_SIZE_MAX 100 102 102 103 103 #define FULLY_FUNCTIONAL 0 104 + #define IOSM_DEVLINK_INIT 1 104 105 105 106 /* List of the supported UL/DL pipes. */ 106 107 enum ipc_mem_pipes { ··· 336 335 * process the irq actions. 337 336 * @flag: Flag to monitor the state of driver 338 337 * @td_update_timer_suspended: if true then td update timer suspend 339 - * @ev_cdev_write_pending: 0 means inform the IPC tasklet to pass 340 - * the accumulated uplink buffers to CP. 341 338 * @ev_mux_net_transmit_pending:0 means inform the IPC tasklet to pass 342 339 * @reset_det_n: Reset detect flag 343 340 * @pcie_wake_n: Pcie wake flag ··· 373 374 u8 ev_irq_pending[IPC_IRQ_VECTORS]; 374 375 unsigned long flag; 375 376 u8 td_update_timer_suspended:1, 376 - ev_cdev_write_pending:1, 377 377 ev_mux_net_transmit_pending:1, 378 378 reset_det_n:1, 379 379 pcie_wake_n:1;
+1 -6
drivers/net/wwan/iosm/iosm_ipc_imem_ops.c
··· 41 41 static int ipc_imem_tq_cdev_write(struct iosm_imem *ipc_imem, int arg, 42 42 void *msg, size_t size) 43 43 { 44 - ipc_imem->ev_cdev_write_pending = false; 45 44 ipc_imem_ul_send(ipc_imem); 46 45 47 46 return 0; ··· 49 50 /* Through tasklet to do sio write. */ 50 51 static int ipc_imem_call_cdev_write(struct iosm_imem *ipc_imem) 51 52 { 52 - if (ipc_imem->ev_cdev_write_pending) 53 - return -1; 54 - 55 - ipc_imem->ev_cdev_write_pending = true; 56 - 57 53 return ipc_task_queue_send_task(ipc_imem, ipc_imem_tq_cdev_write, 0, 58 54 NULL, 0, false); 59 55 } ··· 444 450 /* Release the pipe resources */ 445 451 ipc_imem_pipe_cleanup(ipc_imem, &channel->ul_pipe); 446 452 ipc_imem_pipe_cleanup(ipc_imem, &channel->dl_pipe); 453 + ipc_imem->nr_of_channels--; 447 454 } 448 455 449 456 void ipc_imem_sys_devlink_notify_rx(struct iosm_devlink *ipc_devlink,
+18 -5
drivers/nvme/host/core.c
··· 666 666 struct request *rq) 667 667 { 668 668 if (ctrl->state != NVME_CTRL_DELETING_NOIO && 669 + ctrl->state != NVME_CTRL_DELETING && 669 670 ctrl->state != NVME_CTRL_DEAD && 670 671 !test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) && 671 672 !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH)) ··· 1750 1749 */ 1751 1750 if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT))) 1752 1751 return -EINVAL; 1753 - if (ctrl->max_integrity_segments) 1754 - ns->features |= 1755 - (NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); 1752 + 1753 + ns->features |= NVME_NS_EXT_LBAS; 1754 + 1755 + /* 1756 + * The current fabrics transport drivers support namespace 1757 + * metadata formats only if nvme_ns_has_pi() returns true. 1758 + * Suppress support for all other formats so the namespace will 1759 + * have a 0 capacity and not be usable through the block stack. 1760 + * 1761 + * Note, this check will need to be modified if any drivers 1762 + * gain the ability to use other metadata formats. 1763 + */ 1764 + if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns)) 1765 + ns->features |= NVME_NS_METADATA_SUPPORTED; 1756 1766 } else { 1757 1767 /* 1758 1768 * For PCIe controllers, we can't easily remap the separate ··· 2708 2696 2709 2697 if (tmp->cntlid == ctrl->cntlid) { 2710 2698 dev_err(ctrl->device, 2711 - "Duplicate cntlid %u with %s, rejecting\n", 2712 - ctrl->cntlid, dev_name(tmp->device)); 2699 + "Duplicate cntlid %u with %s, subsys %s, rejecting\n", 2700 + ctrl->cntlid, dev_name(tmp->device), 2701 + subsys->subnqn); 2713 2702 return false; 2714 2703 } 2715 2704
+2 -1
drivers/nvme/host/multipath.c
··· 866 866 } 867 867 if (ana_log_size > ctrl->ana_log_size) { 868 868 nvme_mpath_stop(ctrl); 869 - kfree(ctrl->ana_log_buf); 869 + nvme_mpath_uninit(ctrl); 870 870 ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL); 871 871 if (!ctrl->ana_log_buf) 872 872 return -ENOMEM; ··· 886 886 { 887 887 kfree(ctrl->ana_log_buf); 888 888 ctrl->ana_log_buf = NULL; 889 + ctrl->ana_log_size = 0; 889 890 }
+1 -1
drivers/nvme/host/nvme.h
··· 709 709 return true; 710 710 if (ctrl->ops->flags & NVME_F_FABRICS && 711 711 ctrl->state == NVME_CTRL_DELETING) 712 - return true; 712 + return queue_live; 713 713 return __nvme_check_ready(ctrl, rq, queue_live); 714 714 } 715 715 int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
+4 -1
drivers/nvme/host/zns.c
··· 166 166 zone.len = ns->zsze; 167 167 zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap)); 168 168 zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba)); 169 - zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); 169 + if (zone.cond == BLK_ZONE_COND_FULL) 170 + zone.wp = zone.start + zone.len; 171 + else 172 + zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); 170 173 171 174 return cb(&zone, idx, data); 172 175 }
+8 -1
drivers/nvme/target/tcp.c
··· 922 922 size_t data_len = le32_to_cpu(req->cmd->common.dptr.sgl.length); 923 923 int ret; 924 924 925 - if (!nvme_is_write(cmd->req.cmd) || 925 + /* 926 + * This command has not been processed yet, hence we are trying to 927 + * figure out if there is still pending data left to receive. If 928 + * we don't, we can simply prepare for the next pdu and bail out, 929 + * otherwise we will need to prepare a buffer and receive the 930 + * stale data before continuing forward. 931 + */ 932 + if (!nvme_is_write(cmd->req.cmd) || !data_len || 926 933 data_len > cmd->req.port->inline_data_size) { 927 934 nvmet_prepare_receive_pdu(queue); 928 935 return;
+25 -2
drivers/of/irq.c
··· 76 76 } 77 77 EXPORT_SYMBOL_GPL(of_irq_find_parent); 78 78 79 + /* 80 + * These interrupt controllers abuse interrupt-map for unspeakable 81 + * reasons and rely on the core code to *ignore* it (the drivers do 82 + * their own parsing of the property). 83 + * 84 + * If you think of adding to the list for something *new*, think 85 + * again. There is a high chance that you will be sent back to the 86 + * drawing board. 87 + */ 88 + static const char * const of_irq_imap_abusers[] = { 89 + "CBEA,platform-spider-pic", 90 + "sti,platform-spider-pic", 91 + "realtek,rtl-intc", 92 + "fsl,ls1021a-extirq", 93 + "fsl,ls1043a-extirq", 94 + "fsl,ls1088a-extirq", 95 + "renesas,rza1-irqc", 96 + NULL, 97 + }; 98 + 79 99 /** 80 100 * of_irq_parse_raw - Low level interrupt tree parsing 81 101 * @addr: address specifier (start of "reg" property of the device) in be32 format ··· 179 159 /* 180 160 * Now check if cursor is an interrupt-controller and 181 161 * if it is then we are done, unless there is an 182 - * interrupt-map which takes precedence. 162 + * interrupt-map which takes precedence except on one 163 + * of these broken platforms that want to parse 164 + * interrupt-map themselves for $reason. 183 165 */ 184 166 bool intc = of_property_read_bool(ipar, "interrupt-controller"); 185 167 186 168 imap = of_get_property(ipar, "interrupt-map", &imaplen); 187 - if (imap == NULL && intc) { 169 + if (intc && 170 + (!imap || of_device_compatible_match(ipar, of_irq_imap_abusers))) { 188 171 pr_debug(" -> got it !\n"); 189 172 return 0; 190 173 }
+1
drivers/pci/controller/dwc/pci-exynos.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/phy/phy.h> 21 21 #include <linux/regulator/consumer.h> 22 + #include <linux/module.h> 22 23 23 24 #include "pcie-designware.h" 24 25
+1
drivers/pci/controller/dwc/pcie-qcom-ep.c
··· 18 18 #include <linux/pm_domain.h> 19 19 #include <linux/regmap.h> 20 20 #include <linux/reset.h> 21 + #include <linux/module.h> 21 22 22 23 #include "pcie-designware.h" 23 24
-9
drivers/pci/controller/pci-aardvark.c
··· 32 32 #define PCIE_CORE_DEV_ID_REG 0x0 33 33 #define PCIE_CORE_CMD_STATUS_REG 0x4 34 34 #define PCIE_CORE_DEV_REV_REG 0x8 35 - #define PCIE_CORE_EXP_ROM_BAR_REG 0x30 36 35 #define PCIE_CORE_PCIEXP_CAP 0xc0 37 36 #define PCIE_CORE_ERR_CAPCTL_REG 0x118 38 37 #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5) ··· 773 774 *value = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); 774 775 return PCI_BRIDGE_EMUL_HANDLED; 775 776 776 - case PCI_ROM_ADDRESS1: 777 - *value = advk_readl(pcie, PCIE_CORE_EXP_ROM_BAR_REG); 778 - return PCI_BRIDGE_EMUL_HANDLED; 779 - 780 777 case PCI_INTERRUPT_LINE: { 781 778 /* 782 779 * From the whole 32bit register we support reading from HW only ··· 803 808 switch (reg) { 804 809 case PCI_COMMAND: 805 810 advk_writel(pcie, new, PCIE_CORE_CMD_STATUS_REG); 806 - break; 807 - 808 - case PCI_ROM_ADDRESS1: 809 - advk_writel(pcie, new, PCIE_CORE_EXP_ROM_BAR_REG); 810 811 break; 811 812 812 813 case PCI_INTERRUPT_LINE:
+12 -2
drivers/pci/controller/pcie-apple.c
··· 516 516 int ret, i; 517 517 518 518 reset = gpiod_get_from_of_node(np, "reset-gpios", 0, 519 - GPIOD_OUT_LOW, "#PERST"); 519 + GPIOD_OUT_LOW, "PERST#"); 520 520 if (IS_ERR(reset)) 521 521 return PTR_ERR(reset); 522 522 ··· 539 539 540 540 rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK); 541 541 542 + /* Assert PERST# before setting up the clock */ 543 + gpiod_set_value(reset, 1); 544 + 542 545 ret = apple_pcie_setup_refclk(pcie, port); 543 546 if (ret < 0) 544 547 return ret; 545 548 549 + /* The minimal Tperst-clk value is 100us (PCIe CEM r5.0, 2.9.2) */ 550 + usleep_range(100, 200); 551 + 552 + /* Deassert PERST# */ 546 553 rmw_set(PORT_PERST_OFF, port->base + PORT_PERST); 547 - gpiod_set_value(reset, 1); 554 + gpiod_set_value(reset, 0); 555 + 556 + /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ 557 + msleep(100); 548 558 549 559 ret = readl_relaxed_poll_timeout(port->base + PORT_STATUS, stat, 550 560 stat & PORT_STATUS_READY, 100, 250000);
+2 -2
drivers/phy/hisilicon/phy-hi3670-pcie.c
··· 757 757 return PTR_ERR(phy->sysctrl); 758 758 759 759 phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl"); 760 - if (IS_ERR(phy->sysctrl)) 761 - return PTR_ERR(phy->sysctrl); 760 + if (IS_ERR(phy->pmctrl)) 761 + return PTR_ERR(phy->pmctrl); 762 762 763 763 /* clocks */ 764 764 phy->phy_ref_clk = devm_clk_get(dev, "phy_ref");
+2 -2
drivers/phy/marvell/phy-mvebu-cp110-utmi.c
··· 82 82 * struct mvebu_cp110_utmi - PHY driver data 83 83 * 84 84 * @regs: PHY registers 85 - * @syscom: Regmap with system controller registers 85 + * @syscon: Regmap with system controller registers 86 86 * @dev: device driver handle 87 - * @caps: PHY capabilities 87 + * @ops: phy ops 88 88 */ 89 89 struct mvebu_cp110_utmi { 90 90 void __iomem *regs;
+14 -12
drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
··· 127 127 }; 128 128 129 129 /** 130 - * Write register and read back masked value to confirm it is written 130 + * usb_phy_write_readback() - Write register and read back masked value to 131 + * confirm it is written 131 132 * 132 - * @base - QCOM DWC3 PHY base virtual address. 133 - * @offset - register offset. 134 - * @mask - register bitmask specifying what should be updated 135 - * @val - value to write. 133 + * @phy_dwc3: QCOM DWC3 phy context 134 + * @offset: register offset. 135 + * @mask: register bitmask specifying what should be updated 136 + * @val: value to write. 136 137 */ 137 138 static inline void usb_phy_write_readback(struct usb_phy *phy_dwc3, 138 139 u32 offset, ··· 172 171 } 173 172 174 173 /** 175 - * Write SSPHY register 174 + * usb_ss_write_phycreg() - Write SSPHY register 176 175 * 177 - * @base - QCOM DWC3 PHY base virtual address. 178 - * @addr - SSPHY address to write. 179 - * @val - value to write. 176 + * @phy_dwc3: QCOM DWC3 phy context 177 + * @addr: SSPHY address to write. 178 + * @val: value to write. 180 179 */ 181 180 static int usb_ss_write_phycreg(struct usb_phy *phy_dwc3, 182 181 u32 addr, u32 val) ··· 210 209 } 211 210 212 211 /** 213 - * Read SSPHY register. 212 + * usb_ss_read_phycreg() - Read SSPHY register. 214 213 * 215 - * @base - QCOM DWC3 PHY base virtual address. 216 - * @addr - SSPHY address to read. 214 + * @phy_dwc3: QCOM DWC3 phy context 215 + * @addr: SSPHY address to read. 216 + * @val: pointer in which read is store. 217 217 */ 218 218 static int usb_ss_read_phycreg(struct usb_phy *phy_dwc3, 219 219 u32 addr, u32 *val)
+3
drivers/phy/qualcomm/phy-qcom-qmp.c
··· 2973 2973 * @qmp: QMP phy to which this lane belongs 2974 2974 * @lane_rst: lane's reset controller 2975 2975 * @mode: current PHY mode 2976 + * @dp_aux_cfg: Display port aux config 2977 + * @dp_opts: Display port optional config 2978 + * @dp_clks: Display port clocks 2976 2979 */ 2977 2980 struct qmp_phy { 2978 2981 struct phy *phy;
+1 -1
drivers/phy/qualcomm/phy-qcom-usb-hsic.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 - /** 2 + /* 3 3 * Copyright (C) 2016 Linaro Ltd 4 4 */ 5 5 #include <linux/module.h>
+1 -1
drivers/phy/st/phy-stm32-usbphyc.c
··· 478 478 if (!of_property_read_bool(np, "st,no-lsfs-fb-cap")) 479 479 usbphyc_phy->tune |= LFSCAPEN; 480 480 481 - if (of_property_read_bool(np, "st,slow-hs-slew-rate")) 481 + if (of_property_read_bool(np, "st,decrease-hs-slew-rate")) 482 482 usbphyc_phy->tune |= HSDRVSLEW; 483 483 484 484 ret = of_property_read_u32(np, "st,tune-hs-dc-level", &val);
+1 -1
drivers/phy/ti/phy-am654-serdes.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /** 2 + /* 3 3 * PCIe SERDES driver for AM654x SoC 4 4 * 5 5 * Copyright (C) 2018 - 2019 Texas Instruments Incorporated - http://www.ti.com/
+1 -1
drivers/phy/ti/phy-j721e-wiz.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /** 2 + /* 3 3 * Wrapper driver for SERDES used in J721E 4 4 * 5 5 * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+3 -3
drivers/phy/ti/phy-omap-usb2.c
··· 89 89 } 90 90 91 91 /** 92 - * omap_usb2_set_comparator - links the comparator present in the system with 93 - * this phy 94 - * @comparator - the companion phy(comparator) for this phy 92 + * omap_usb2_set_comparator() - links the comparator present in the system with this phy 93 + * 94 + * @comparator: the companion phy(comparator) for this phy 95 95 * 96 96 * The phy companion driver should call this API passing the phy_companion 97 97 * filled with set_vbus and start_srp to be used by usb phy.
+1 -1
drivers/phy/ti/phy-tusb1210.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 - /** 2 + /* 3 3 * tusb1210.c - TUSB1210 USB ULPI PHY driver 4 4 * 5 5 * Copyright (C) 2015 Intel Corporation
+1 -1
drivers/platform/x86/amd-pmc.c
··· 76 76 #define AMD_CPU_ID_CZN AMD_CPU_ID_RN 77 77 #define AMD_CPU_ID_YC 0x14B5 78 78 79 - #define PMC_MSG_DELAY_MIN_US 100 79 + #define PMC_MSG_DELAY_MIN_US 50 80 80 #define RESPONSE_REGISTER_LOOP_MAX 20000 81 81 82 82 #define SOC_SUBSYSTEM_IP_MAX 12
+7
drivers/platform/x86/intel/hid.c
··· 99 99 DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"), 100 100 }, 101 101 }, 102 + { 103 + .ident = "Microsoft Surface Go 3", 104 + .matches = { 105 + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 106 + DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"), 107 + }, 108 + }, 102 109 { } 103 110 }; 104 111
+12
drivers/platform/x86/lg-laptop.c
··· 657 657 if (product && strlen(product) > 4) 658 658 switch (product[4]) { 659 659 case '5': 660 + if (strlen(product) > 5) 661 + switch (product[5]) { 662 + case 'N': 663 + year = 2021; 664 + break; 665 + case '0': 666 + year = 2016; 667 + break; 668 + default: 669 + year = 2022; 670 + } 671 + break; 660 672 case '6': 661 673 year = 2016; 662 674 break;
+4 -2
drivers/platform/x86/thinkpad_acpi.c
··· 3015 3015 &dev_attr_hotkey_all_mask.attr, 3016 3016 &dev_attr_hotkey_adaptive_all_mask.attr, 3017 3017 &dev_attr_hotkey_recommended_mask.attr, 3018 + &dev_attr_hotkey_tablet_mode.attr, 3019 + &dev_attr_hotkey_radio_sw.attr, 3018 3020 #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 3019 3021 &dev_attr_hotkey_source_mask.attr, 3020 3022 &dev_attr_hotkey_poll_freq.attr, ··· 5728 5726 "tpacpi::standby", 5729 5727 "tpacpi::dock_status1", 5730 5728 "tpacpi::dock_status2", 5731 - "tpacpi::unknown_led2", 5729 + "tpacpi::lid_logo_dot", 5732 5730 "tpacpi::unknown_led3", 5733 5731 "tpacpi::thinkvantage", 5734 5732 }; 5735 - #define TPACPI_SAFE_LEDS 0x1081U 5733 + #define TPACPI_SAFE_LEDS 0x1481U 5736 5734 5737 5735 static inline bool tpacpi_is_led_restricted(const unsigned int led) 5738 5736 {
+18
drivers/platform/x86/touchscreen_dmi.c
··· 905 905 .properties = trekstor_primetab_t13b_props, 906 906 }; 907 907 908 + static const struct property_entry trekstor_surftab_duo_w1_props[] = { 909 + PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"), 910 + { } 911 + }; 912 + 913 + static const struct ts_dmi_data trekstor_surftab_duo_w1_data = { 914 + .acpi_name = "GDIX1001:00", 915 + .properties = trekstor_surftab_duo_w1_props, 916 + }; 917 + 908 918 static const struct property_entry trekstor_surftab_twin_10_1_props[] = { 909 919 PROPERTY_ENTRY_U32("touchscreen-min-x", 20), 910 920 PROPERTY_ENTRY_U32("touchscreen-min-y", 0), ··· 1510 1500 .matches = { 1511 1501 DMI_MATCH(DMI_SYS_VENDOR, "TREKSTOR"), 1512 1502 DMI_MATCH(DMI_PRODUCT_NAME, "Primetab T13B"), 1503 + }, 1504 + }, 1505 + { 1506 + /* TrekStor SurfTab duo W1 10.1 ST10432-10b */ 1507 + .driver_data = (void *)&trekstor_surftab_duo_w1_data, 1508 + .matches = { 1509 + DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"), 1510 + DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab duo W1 10.1 (VT4)"), 1513 1511 }, 1514 1512 }, 1515 1513 {
+2 -4
drivers/scsi/pm8001/pm8001_init.c
··· 282 282 if (rc) { 283 283 pm8001_dbg(pm8001_ha, FAIL, 284 284 "pm8001_setup_irq failed [ret: %d]\n", rc); 285 - goto err_out_shost; 285 + goto err_out; 286 286 } 287 287 /* Request Interrupt */ 288 288 rc = pm8001_request_irq(pm8001_ha); 289 289 if (rc) 290 - goto err_out_shost; 290 + goto err_out; 291 291 292 292 count = pm8001_ha->max_q_num; 293 293 /* Queues are chosen based on the number of cores/msix availability */ ··· 423 423 pm8001_tag_init(pm8001_ha); 424 424 return 0; 425 425 426 - err_out_shost: 427 - scsi_remove_host(pm8001_ha->shost); 428 426 err_out_nodev: 429 427 for (i = 0; i < pm8001_ha->max_memcnt; i++) { 430 428 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
+15 -22
drivers/scsi/qedi/qedi_fw.c
··· 732 732 { 733 733 struct qedi_work_map *work, *work_tmp; 734 734 u32 proto_itt = cqe->itid; 735 - itt_t protoitt = 0; 736 735 int found = 0; 737 736 struct qedi_cmd *qedi_cmd = NULL; 738 737 u32 iscsi_cid; ··· 811 812 return; 812 813 813 814 check_cleanup_reqs: 814 - if (qedi_conn->cmd_cleanup_req > 0) { 815 - QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, 815 + if (atomic_inc_return(&qedi_conn->cmd_cleanup_cmpl) == 816 + qedi_conn->cmd_cleanup_req) { 817 + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 816 818 "Freeing tid=0x%x for cid=0x%x\n", 817 819 cqe->itid, qedi_conn->iscsi_conn_id); 818 - qedi_conn->cmd_cleanup_cmpl++; 819 820 wake_up(&qedi_conn->wait_queue); 820 - } else { 821 - QEDI_ERR(&qedi->dbg_ctx, 822 - "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x\n", 823 - protoitt, cqe->itid, qedi_conn->iscsi_conn_id); 824 821 } 825 822 } 826 823 ··· 1158 1163 } 1159 1164 1160 1165 qedi_conn->cmd_cleanup_req = 0; 1161 - qedi_conn->cmd_cleanup_cmpl = 0; 1166 + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); 1162 1167 1163 1168 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 1164 1169 "active_cmd_count=%d, cid=0x%x, in_recovery=%d, lun_reset=%d\n", ··· 1210 1215 qedi_conn->iscsi_conn_id); 1211 1216 1212 1217 rval = wait_event_interruptible_timeout(qedi_conn->wait_queue, 1213 - ((qedi_conn->cmd_cleanup_req == 1214 - qedi_conn->cmd_cleanup_cmpl) || 1215 - test_bit(QEDI_IN_RECOVERY, 1216 - &qedi->flags)), 1217 - 5 * HZ); 1218 + (qedi_conn->cmd_cleanup_req == 1219 + atomic_read(&qedi_conn->cmd_cleanup_cmpl)) || 1220 + test_bit(QEDI_IN_RECOVERY, &qedi->flags), 1221 + 5 * HZ); 1218 1222 if (rval) { 1219 1223 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 1220 1224 "i/o cmd_cleanup_req=%d, equal to cmd_cleanup_cmpl=%d, cid=0x%x\n", 1221 1225 qedi_conn->cmd_cleanup_req, 1222 - qedi_conn->cmd_cleanup_cmpl, 1226 + atomic_read(&qedi_conn->cmd_cleanup_cmpl), 1223 1227 qedi_conn->iscsi_conn_id); 1224 1228 1225 1229 return 0; ··· 1227 1233 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 1228 1234 "i/o cmd_cleanup_req=%d, not equal to cmd_cleanup_cmpl=%d, cid=0x%x\n", 1229 1235 qedi_conn->cmd_cleanup_req, 1230 - qedi_conn->cmd_cleanup_cmpl, 1236 + atomic_read(&qedi_conn->cmd_cleanup_cmpl), 1231 1237 qedi_conn->iscsi_conn_id); 1232 1238 1233 1239 iscsi_host_for_each_session(qedi->shost, ··· 1236 1242 1237 1243 /* Enable IOs for all other sessions except current.*/ 1238 1244 if (!wait_event_interruptible_timeout(qedi_conn->wait_queue, 1239 - (qedi_conn->cmd_cleanup_req == 1240 - qedi_conn->cmd_cleanup_cmpl) || 1241 - test_bit(QEDI_IN_RECOVERY, 1242 - &qedi->flags), 1243 - 5 * HZ)) { 1245 + (qedi_conn->cmd_cleanup_req == 1246 + atomic_read(&qedi_conn->cmd_cleanup_cmpl)) || 1247 + test_bit(QEDI_IN_RECOVERY, &qedi->flags), 1248 + 5 * HZ)) { 1244 1249 iscsi_host_for_each_session(qedi->shost, 1245 1250 qedi_mark_device_available); 1246 1251 return -1; ··· 1259 1266 1260 1267 qedi_ep = qedi_conn->ep; 1261 1268 qedi_conn->cmd_cleanup_req = 0; 1262 - qedi_conn->cmd_cleanup_cmpl = 0; 1269 + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); 1263 1270 1264 1271 if (!qedi_ep) { 1265 1272 QEDI_WARN(&qedi->dbg_ctx,
+1 -1
drivers/scsi/qedi/qedi_iscsi.c
··· 412 412 qedi_conn->iscsi_conn_id = qedi_ep->iscsi_cid; 413 413 qedi_conn->fw_cid = qedi_ep->fw_cid; 414 414 qedi_conn->cmd_cleanup_req = 0; 415 - qedi_conn->cmd_cleanup_cmpl = 0; 415 + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); 416 416 417 417 if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) { 418 418 rc = -EINVAL;
+1 -1
drivers/scsi/qedi/qedi_iscsi.h
··· 155 155 spinlock_t list_lock; /* internal conn lock */ 156 156 u32 active_cmd_count; 157 157 u32 cmd_cleanup_req; 158 - u32 cmd_cleanup_cmpl; 158 + atomic_t cmd_cleanup_cmpl; 159 159 160 160 u32 iscsi_conn_id; 161 161 int itt;
+3
drivers/scsi/qla2xxx/qla_dbg.c
··· 2491 2491 struct va_format vaf; 2492 2492 char pbuf[64]; 2493 2493 2494 + if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled()) 2495 + return; 2496 + 2494 2497 va_start(va, fmt); 2495 2498 2496 2499 vaf.fmt = fmt;
+1 -1
drivers/scsi/scsi_debug.c
··· 4342 4342 rep_max_zones = min((alloc_len - 64) >> ilog2(RZONES_DESC_HD), 4343 4343 max_zones); 4344 4344 4345 - arr = kcalloc(RZONES_DESC_HD, alloc_len, GFP_ATOMIC); 4345 + arr = kzalloc(alloc_len, GFP_ATOMIC); 4346 4346 if (!arr) { 4347 4347 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, 4348 4348 INSUFF_RES_ASCQ);
+1 -1
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
··· 29 29 }; 30 30 31 31 static const struct mmio_reg tgl_fivr_mmio_regs[] = { 32 - { 0, 0x5A18, 3, 0x7, 12}, /* vco_ref_code_lo */ 32 + { 0, 0x5A18, 3, 0x7, 11}, /* vco_ref_code_lo */ 33 33 { 0, 0x5A18, 8, 0xFF, 16}, /* vco_ref_code_hi */ 34 34 { 0, 0x5A08, 8, 0xFF, 0}, /* spread_spectrum_pct */ 35 35 { 0, 0x5A08, 1, 0x1, 8}, /* spread_spectrum_clk_enable */
+1
drivers/usb/cdns3/host.c
··· 10 10 */ 11 11 12 12 #include <linux/platform_device.h> 13 + #include <linux/slab.h> 13 14 #include "core.h" 14 15 #include "drd.h" 15 16 #include "host-export.h"
+3 -3
drivers/usb/core/config.c
··· 406 406 * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 407 407 * (see the end of section 5.6.3), so don't warn about them. 408 408 */ 409 - maxp = usb_endpoint_maxp(&endpoint->desc); 409 + maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize); 410 410 if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { 411 411 dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", 412 412 cfgno, inum, asnum, d->bEndpointAddress); ··· 422 422 maxpacket_maxes = full_speed_maxpacket_maxes; 423 423 break; 424 424 case USB_SPEED_HIGH: 425 - /* Bits 12..11 are allowed only for HS periodic endpoints */ 425 + /* Multiple-transactions bits are allowed only for HS periodic endpoints */ 426 426 if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) { 427 - i = maxp & (BIT(12) | BIT(11)); 427 + i = maxp & USB_EP_MAXP_MULT_MASK; 428 428 maxp &= ~i; 429 429 } 430 430 fallthrough;
-15
drivers/usb/dwc3/dwc3-qcom.c
··· 649 649 struct dwc3_qcom *qcom = platform_get_drvdata(pdev); 650 650 struct device_node *np = pdev->dev.of_node, *dwc3_np; 651 651 struct device *dev = &pdev->dev; 652 - struct property *prop; 653 652 int ret; 654 653 655 654 dwc3_np = of_get_compatible_child(np, "snps,dwc3"); 656 655 if (!dwc3_np) { 657 656 dev_err(dev, "failed to find dwc3 core child\n"); 658 657 return -ENODEV; 659 - } 660 - 661 - prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL); 662 - if (!prop) { 663 - ret = -ENOMEM; 664 - dev_err(dev, "unable to allocate memory for property\n"); 665 - goto node_put; 666 - } 667 - 668 - prop->name = "tx-fifo-resize"; 669 - ret = of_add_property(dwc3_np, prop); 670 - if (ret) { 671 - dev_err(dev, "unable to add property\n"); 672 - goto node_put; 673 658 } 674 659 675 660 ret = of_platform_populate(np, NULL, NULL, dev);
+13 -1
drivers/usb/gadget/composite.c
··· 1692 1692 struct usb_function *f = NULL; 1693 1693 u8 endp; 1694 1694 1695 + if (w_length > USB_COMP_EP0_BUFSIZ) { 1696 + if (ctrl->bRequestType == USB_DIR_OUT) { 1697 + goto done; 1698 + } else { 1699 + /* Cast away the const, we are going to overwrite on purpose. */ 1700 + __le16 *temp = (__le16 *)&ctrl->wLength; 1701 + 1702 + *temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ); 1703 + w_length = USB_COMP_EP0_BUFSIZ; 1704 + } 1705 + } 1706 + 1695 1707 /* partial re-init of the response message; the function or the 1696 1708 * gadget might need to intercept e.g. a control-OUT completion 1697 1709 * when we delegate to it. ··· 2234 2222 if (!cdev->req) 2235 2223 return -ENOMEM; 2236 2224 2237 - cdev->req->buf = kmalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL); 2225 + cdev->req->buf = kzalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL); 2238 2226 if (!cdev->req->buf) 2239 2227 goto fail; 2240 2228
+14 -1
drivers/usb/gadget/legacy/dbgp.c
··· 137 137 goto fail_1; 138 138 } 139 139 140 - req->buf = kmalloc(DBGP_REQ_LEN, GFP_KERNEL); 140 + req->buf = kzalloc(DBGP_REQ_LEN, GFP_KERNEL); 141 141 if (!req->buf) { 142 142 err = -ENOMEM; 143 143 stp = 2; ··· 344 344 int err = -EOPNOTSUPP; 345 345 void *data = NULL; 346 346 u16 len = 0; 347 + 348 + if (length > DBGP_REQ_LEN) { 349 + if (ctrl->bRequestType == USB_DIR_OUT) { 350 + return err; 351 + } else { 352 + /* Cast away the const, we are going to overwrite on purpose. */ 353 + __le16 *temp = (__le16 *)&ctrl->wLength; 354 + 355 + *temp = cpu_to_le16(DBGP_REQ_LEN); 356 + length = DBGP_REQ_LEN; 357 + } 358 + } 359 + 347 360 348 361 if (request == USB_REQ_GET_DESCRIPTOR) { 349 362 switch (value>>8) {
+15 -1
drivers/usb/gadget/legacy/inode.c
··· 110 110 /* enough for the whole queue: most events invalidate others */ 111 111 #define N_EVENT 5 112 112 113 + #define RBUF_SIZE 256 114 + 113 115 struct dev_data { 114 116 spinlock_t lock; 115 117 refcount_t count; ··· 146 144 struct dentry *dentry; 147 145 148 146 /* except this scratch i/o buffer for ep0 */ 149 - u8 rbuf [256]; 147 + u8 rbuf[RBUF_SIZE]; 150 148 }; 151 149 152 150 static inline void get_dev (struct dev_data *data) ··· 1332 1330 struct usb_gadgetfs_event *event; 1333 1331 u16 w_value = le16_to_cpu(ctrl->wValue); 1334 1332 u16 w_length = le16_to_cpu(ctrl->wLength); 1333 + 1334 + if (w_length > RBUF_SIZE) { 1335 + if (ctrl->bRequestType == USB_DIR_OUT) { 1336 + return value; 1337 + } else { 1338 + /* Cast away the const, we are going to overwrite on purpose. */ 1339 + __le16 *temp = (__le16 *)&ctrl->wLength; 1340 + 1341 + *temp = cpu_to_le16(RBUF_SIZE); 1342 + w_length = RBUF_SIZE; 1343 + } 1344 + } 1335 1345 1336 1346 spin_lock (&dev->lock); 1337 1347 dev->setup_abort = 0;
+1
drivers/usb/host/xhci-hub.c
··· 717 717 continue; 718 718 719 719 retval = xhci_disable_slot(xhci, i); 720 + xhci_free_virt_device(xhci, i); 720 721 if (retval) 721 722 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", 722 723 i, retval);
-1
drivers/usb/host/xhci-ring.c
··· 1525 1525 if (xhci->quirks & XHCI_EP_LIMIT_QUIRK) 1526 1526 /* Delete default control endpoint resources */ 1527 1527 xhci_free_device_endpoint_resources(xhci, virt_dev, true); 1528 - xhci_free_virt_device(xhci, slot_id); 1529 1528 } 1530 1529 1531 1530 static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id,
+15 -11
drivers/usb/host/xhci.c
··· 3934 3934 struct xhci_slot_ctx *slot_ctx; 3935 3935 int i, ret; 3936 3936 3937 - #ifndef CONFIG_USB_DEFAULT_PERSIST 3938 3937 /* 3939 3938 * We called pm_runtime_get_noresume when the device was attached. 3940 3939 * Decrement the counter here to allow controller to runtime suspend ··· 3941 3942 */ 3942 3943 if (xhci->quirks & XHCI_RESET_ON_RESUME) 3943 3944 pm_runtime_put_noidle(hcd->self.controller); 3944 - #endif 3945 3945 3946 3946 ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); 3947 3947 /* If the host is halted due to driver unload, we still need to free the ··· 3959 3961 del_timer_sync(&virt_dev->eps[i].stop_cmd_timer); 3960 3962 } 3961 3963 virt_dev->udev = NULL; 3962 - ret = xhci_disable_slot(xhci, udev->slot_id); 3963 - if (ret) 3964 - xhci_free_virt_device(xhci, udev->slot_id); 3964 + xhci_disable_slot(xhci, udev->slot_id); 3965 + xhci_free_virt_device(xhci, udev->slot_id); 3965 3966 } 3966 3967 3967 3968 int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) ··· 3970 3973 u32 state; 3971 3974 int ret = 0; 3972 3975 3973 - command = xhci_alloc_command(xhci, false, GFP_KERNEL); 3976 + command = xhci_alloc_command(xhci, true, GFP_KERNEL); 3974 3977 if (!command) 3975 3978 return -ENOMEM; 3976 3979 ··· 3995 3998 } 3996 3999 xhci_ring_cmd_db(xhci); 3997 4000 spin_unlock_irqrestore(&xhci->lock, flags); 4001 + 4002 + wait_for_completion(command->completion); 4003 + 4004 + if (command->status != COMP_SUCCESS) 4005 + xhci_warn(xhci, "Unsuccessful disable slot %u command, status %d\n", 4006 + slot_id, command->status); 4007 + 4008 + xhci_free_command(xhci, command); 4009 + 3998 4010 return ret; 3999 4011 } 4000 4012 ··· 4100 4094 4101 4095 xhci_debugfs_create_slot(xhci, slot_id); 4102 4096 4103 - #ifndef CONFIG_USB_DEFAULT_PERSIST 4104 4097 /* 4105 4098 * If resetting upon resume, we can't put the controller into runtime 4106 4099 * suspend if there is a device attached. 4107 4100 */ 4108 4101 if (xhci->quirks & XHCI_RESET_ON_RESUME) 4109 4102 pm_runtime_get_noresume(hcd->self.controller); 4110 - #endif 4111 4103 4112 4104 /* Is this a LS or FS device under a HS hub? */ 4113 4105 /* Hub or peripherial? */ 4114 4106 return 1; 4115 4107 4116 4108 disable_slot: 4117 - ret = xhci_disable_slot(xhci, udev->slot_id); 4118 - if (ret) 4119 - xhci_free_virt_device(xhci, udev->slot_id); 4109 + xhci_disable_slot(xhci, udev->slot_id); 4110 + xhci_free_virt_device(xhci, udev->slot_id); 4120 4111 4121 4112 return 0; 4122 4113 } ··· 4243 4240 4244 4241 mutex_unlock(&xhci->mutex); 4245 4242 ret = xhci_disable_slot(xhci, udev->slot_id); 4243 + xhci_free_virt_device(xhci, udev->slot_id); 4246 4244 if (!ret) 4247 4245 xhci_alloc_dev(hcd, udev); 4248 4246 kfree(command->completion);
+152 -34
fs/aio.c
··· 181 181 struct file *file; 182 182 struct wait_queue_head *head; 183 183 __poll_t events; 184 - bool done; 185 184 bool cancelled; 185 + bool work_scheduled; 186 + bool work_need_resched; 186 187 struct wait_queue_entry wait; 187 188 struct work_struct work; 188 189 }; ··· 1620 1619 iocb_put(iocb); 1621 1620 } 1622 1621 1622 + /* 1623 + * Safely lock the waitqueue which the request is on, synchronizing with the 1624 + * case where the ->poll() provider decides to free its waitqueue early. 1625 + * 1626 + * Returns true on success, meaning that req->head->lock was locked, req->wait 1627 + * is on req->head, and an RCU read lock was taken. Returns false if the 1628 + * request was already removed from its waitqueue (which might no longer exist). 1629 + */ 1630 + static bool poll_iocb_lock_wq(struct poll_iocb *req) 1631 + { 1632 + wait_queue_head_t *head; 1633 + 1634 + /* 1635 + * While we hold the waitqueue lock and the waitqueue is nonempty, 1636 + * wake_up_pollfree() will wait for us. However, taking the waitqueue 1637 + * lock in the first place can race with the waitqueue being freed. 1638 + * 1639 + * We solve this as eventpoll does: by taking advantage of the fact that 1640 + * all users of wake_up_pollfree() will RCU-delay the actual free. If 1641 + * we enter rcu_read_lock() and see that the pointer to the queue is 1642 + * non-NULL, we can then lock it without the memory being freed out from 1643 + * under us, then check whether the request is still on the queue. 1644 + * 1645 + * Keep holding rcu_read_lock() as long as we hold the queue lock, in 1646 + * case the caller deletes the entry from the queue, leaving it empty. 1647 + * In that case, only RCU prevents the queue memory from being freed. 1648 + */ 1649 + rcu_read_lock(); 1650 + head = smp_load_acquire(&req->head); 1651 + if (head) { 1652 + spin_lock(&head->lock); 1653 + if (!list_empty(&req->wait.entry)) 1654 + return true; 1655 + spin_unlock(&head->lock); 1656 + } 1657 + rcu_read_unlock(); 1658 + return false; 1659 + } 1660 + 1661 + static void poll_iocb_unlock_wq(struct poll_iocb *req) 1662 + { 1663 + spin_unlock(&req->head->lock); 1664 + rcu_read_unlock(); 1665 + } 1666 + 1623 1667 static void aio_poll_complete_work(struct work_struct *work) 1624 1668 { 1625 1669 struct poll_iocb *req = container_of(work, struct poll_iocb, work); ··· 1684 1638 * avoid further branches in the fast path. 1685 1639 */ 1686 1640 spin_lock_irq(&ctx->ctx_lock); 1687 - if (!mask && !READ_ONCE(req->cancelled)) { 1688 - add_wait_queue(req->head, &req->wait); 1689 - spin_unlock_irq(&ctx->ctx_lock); 1690 - return; 1691 - } 1641 + if (poll_iocb_lock_wq(req)) { 1642 + if (!mask && !READ_ONCE(req->cancelled)) { 1643 + /* 1644 + * The request isn't actually ready to be completed yet. 1645 + * Reschedule completion if another wakeup came in. 1646 + */ 1647 + if (req->work_need_resched) { 1648 + schedule_work(&req->work); 1649 + req->work_need_resched = false; 1650 + } else { 1651 + req->work_scheduled = false; 1652 + } 1653 + poll_iocb_unlock_wq(req); 1654 + spin_unlock_irq(&ctx->ctx_lock); 1655 + return; 1656 + } 1657 + list_del_init(&req->wait.entry); 1658 + poll_iocb_unlock_wq(req); 1659 + } /* else, POLLFREE has freed the waitqueue, so we must complete */ 1692 1660 list_del_init(&iocb->ki_list); 1693 1661 iocb->ki_res.res = mangle_poll(mask); 1694 - req->done = true; 1695 1662 spin_unlock_irq(&ctx->ctx_lock); 1696 1663 1697 1664 iocb_put(iocb); ··· 1716 1657 struct aio_kiocb *aiocb = container_of(iocb, struct aio_kiocb, rw); 1717 1658 struct poll_iocb *req = &aiocb->poll; 1718 1659 1719 - spin_lock(&req->head->lock); 1720 - WRITE_ONCE(req->cancelled, true); 1721 - if (!list_empty(&req->wait.entry)) { 1722 - list_del_init(&req->wait.entry); 1723 - schedule_work(&aiocb->poll.work); 1724 - } 1725 - spin_unlock(&req->head->lock); 1660 + if (poll_iocb_lock_wq(req)) { 1661 + WRITE_ONCE(req->cancelled, true); 1662 + if (!req->work_scheduled) { 1663 + schedule_work(&aiocb->poll.work); 1664 + req->work_scheduled = true; 1665 + } 1666 + poll_iocb_unlock_wq(req); 1667 + } /* else, the request was force-cancelled by POLLFREE already */ 1726 1668 1727 1669 return 0; 1728 1670 } ··· 1740 1680 if (mask && !(mask & req->events)) 1741 1681 return 0; 1742 1682 1743 - list_del_init(&req->wait.entry); 1744 - 1745 - if (mask && spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) { 1683 + /* 1684 + * Complete the request inline if possible. This requires that three 1685 + * conditions be met: 1686 + * 1. An event mask must have been passed. If a plain wakeup was done 1687 + * instead, then mask == 0 and we have to call vfs_poll() to get 1688 + * the events, so inline completion isn't possible. 1689 + * 2. The completion work must not have already been scheduled. 1690 + * 3. ctx_lock must not be busy. We have to use trylock because we 1691 + * already hold the waitqueue lock, so this inverts the normal 1692 + * locking order. Use irqsave/irqrestore because not all 1693 + * filesystems (e.g. fuse) call this function with IRQs disabled, 1694 + * yet IRQs have to be disabled before ctx_lock is obtained. 1695 + */ 1696 + if (mask && !req->work_scheduled && 1697 + spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) { 1746 1698 struct kioctx *ctx = iocb->ki_ctx; 1747 1699 1748 - /* 1749 - * Try to complete the iocb inline if we can. Use 1750 - * irqsave/irqrestore because not all filesystems (e.g. fuse) 1751 - * call this function with IRQs disabled and because IRQs 1752 - * have to be disabled before ctx_lock is obtained. 1753 - */ 1700 + list_del_init(&req->wait.entry); 1754 1701 list_del(&iocb->ki_list); 1755 1702 iocb->ki_res.res = mangle_poll(mask); 1756 - req->done = true; 1757 - if (iocb->ki_eventfd && eventfd_signal_allowed()) { 1703 + if (iocb->ki_eventfd && !eventfd_signal_allowed()) { 1758 1704 iocb = NULL; 1759 1705 INIT_WORK(&req->work, aio_poll_put_work); 1760 1706 schedule_work(&req->work); ··· 1769 1703 if (iocb) 1770 1704 iocb_put(iocb); 1771 1705 } else { 1772 - schedule_work(&req->work); 1706 + /* 1707 + * Schedule the completion work if needed. If it was already 1708 + * scheduled, record that another wakeup came in. 1709 + * 1710 + * Don't remove the request from the waitqueue here, as it might 1711 + * not actually be complete yet (we won't know until vfs_poll() 1712 + * is called), and we must not miss any wakeups. POLLFREE is an 1713 + * exception to this; see below. 1714 + */ 1715 + if (req->work_scheduled) { 1716 + req->work_need_resched = true; 1717 + } else { 1718 + schedule_work(&req->work); 1719 + req->work_scheduled = true; 1720 + } 1721 + 1722 + /* 1723 + * If the waitqueue is being freed early but we can't complete 1724 + * the request inline, we have to tear down the request as best 1725 + * we can. That means immediately removing the request from its 1726 + * waitqueue and preventing all further accesses to the 1727 + * waitqueue via the request. We also need to schedule the 1728 + * completion work (done above). Also mark the request as 1729 + * cancelled, to potentially skip an unneeded call to ->poll(). 1730 + */ 1731 + if (mask & POLLFREE) { 1732 + WRITE_ONCE(req->cancelled, true); 1733 + list_del_init(&req->wait.entry); 1734 + 1735 + /* 1736 + * Careful: this *must* be the last step, since as soon 1737 + * as req->head is NULL'ed out, the request can be 1738 + * completed and freed, since aio_poll_complete_work() 1739 + * will no longer need to take the waitqueue lock. 1740 + */ 1741 + smp_store_release(&req->head, NULL); 1742 + } 1773 1743 } 1774 1744 return 1; 1775 1745 } ··· 1813 1711 struct aio_poll_table { 1814 1712 struct poll_table_struct pt; 1815 1713 struct aio_kiocb *iocb; 1714 + bool queued; 1816 1715 int error; 1817 1716 }; 1818 1717 ··· 1824 1721 struct aio_poll_table *pt = container_of(p, struct aio_poll_table, pt); 1825 1722 1826 1723 /* multiple wait queues per file are not supported */ 1827 - if (unlikely(pt->iocb->poll.head)) { 1724 + if (unlikely(pt->queued)) { 1828 1725 pt->error = -EINVAL; 1829 1726 return; 1830 1727 } 1831 1728 1729 + pt->queued = true; 1832 1730 pt->error = 0; 1833 1731 pt->iocb->poll.head = head; 1834 1732 add_wait_queue(head, &pt->iocb->poll.wait); ··· 1854 1750 req->events = demangle_poll(iocb->aio_buf) | EPOLLERR | EPOLLHUP; 1855 1751 1856 1752 req->head = NULL; 1857 - req->done = false; 1858 1753 req->cancelled = false; 1754 + req->work_scheduled = false; 1755 + req->work_need_resched = false; 1859 1756 1860 1757 apt.pt._qproc = aio_poll_queue_proc; 1861 1758 apt.pt._key = req->events; 1862 1759 apt.iocb = aiocb; 1760 + apt.queued = false; 1863 1761 apt.error = -EINVAL; /* same as no support for IOCB_CMD_POLL */ 1864 1762 1865 1763 /* initialized the list so that we can do list_empty checks */ ··· 1870 1764 1871 1765 mask = vfs_poll(req->file, &apt.pt) & req->events; 1872 1766 spin_lock_irq(&ctx->ctx_lock); 1873 - if (likely(req->head)) { 1874 - spin_lock(&req->head->lock); 1875 - if (unlikely(list_empty(&req->wait.entry))) { 1876 - if (apt.error) 1767 + if (likely(apt.queued)) { 1768 + bool on_queue = poll_iocb_lock_wq(req); 1769 + 1770 + if (!on_queue || req->work_scheduled) { 1771 + /* 1772 + * aio_poll_wake() already either scheduled the async 1773 + * completion work, or completed the request inline. 1774 + */ 1775 + if (apt.error) /* unsupported case: multiple queues */ 1877 1776 cancel = true; 1878 1777 apt.error = 0; 1879 1778 mask = 0; 1880 1779 } 1881 1780 if (mask || apt.error) { 1781 + /* Steal to complete synchronously. */ 1882 1782 list_del_init(&req->wait.entry); 1883 1783 } else if (cancel) { 1784 + /* Cancel if possible (may be too late though). */ 1884 1785 WRITE_ONCE(req->cancelled, true); 1885 - } else if (!req->done) { /* actually waiting for an event */ 1786 + } else if (on_queue) { 1787 + /* 1788 + * Actually waiting for an event, so add the request to 1789 + * active_reqs so that it can be cancelled if needed. 1790 + */ 1886 1791 list_add_tail(&aiocb->ki_list, &ctx->active_reqs); 1887 1792 aiocb->ki_cancel = aio_poll_cancel; 1888 1793 } 1889 - spin_unlock(&req->head->lock); 1794 + if (on_queue) 1795 + poll_iocb_unlock_wq(req); 1890 1796 } 1891 1797 if (mask) { /* no async, we'd stolen it */ 1892 1798 aiocb->ki_res.res = mangle_poll(mask);
+9 -3
fs/btrfs/delalloc-space.c
··· 143 143 144 144 /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ 145 145 ret = btrfs_qgroup_reserve_data(inode, reserved, start, len); 146 - if (ret < 0) 146 + if (ret < 0) { 147 147 btrfs_free_reserved_data_space_noquota(fs_info, len); 148 - else 148 + extent_changeset_free(*reserved); 149 + *reserved = NULL; 150 + } else { 149 151 ret = 0; 152 + } 150 153 return ret; 151 154 } 152 155 ··· 455 452 if (ret < 0) 456 453 return ret; 457 454 ret = btrfs_delalloc_reserve_metadata(inode, len); 458 - if (ret < 0) 455 + if (ret < 0) { 459 456 btrfs_free_reserved_data_space(inode, *reserved, start, len); 457 + extent_changeset_free(*reserved); 458 + *reserved = NULL; 459 + } 460 460 return ret; 461 461 } 462 462
+3
fs/btrfs/extent-tree.c
··· 6051 6051 int dev_ret = 0; 6052 6052 int ret = 0; 6053 6053 6054 + if (range->start == U64_MAX) 6055 + return -EINVAL; 6056 + 6054 6057 /* 6055 6058 * Check range overflow if range->len is set. 6056 6059 * The default range->len is U64_MAX.
+14
fs/btrfs/extent_io.c
··· 4314 4314 return; 4315 4315 4316 4316 /* 4317 + * A read may stumble upon this buffer later, make sure that it gets an 4318 + * error and knows there was an error. 4319 + */ 4320 + clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); 4321 + 4322 + /* 4323 + * We need to set the mapping with the io error as well because a write 4324 + * error will flip the file system readonly, and then syncfs() will 4325 + * return a 0 because we are readonly if we don't modify the err seq for 4326 + * the superblock. 4327 + */ 4328 + mapping_set_error(page->mapping, -EIO); 4329 + 4330 + /* 4317 4331 * If we error out, we should add back the dirty_metadata_bytes 4318 4332 * to make it consistent. 4319 4333 */
+2 -4
fs/btrfs/ioctl.c
··· 3187 3187 return -EPERM; 3188 3188 3189 3189 vol_args = memdup_user(arg, sizeof(*vol_args)); 3190 - if (IS_ERR(vol_args)) { 3191 - ret = PTR_ERR(vol_args); 3192 - goto out; 3193 - } 3190 + if (IS_ERR(vol_args)) 3191 + return PTR_ERR(vol_args); 3194 3192 3195 3193 if (vol_args->flags & ~BTRFS_DEVICE_REMOVE_ARGS_MASK) { 3196 3194 ret = -EOPNOTSUPP;
+2 -1
fs/btrfs/root-tree.c
··· 334 334 key.offset = ref_id; 335 335 again: 336 336 ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1); 337 - BUG_ON(ret < 0); 337 + if (ret < 0) 338 + goto out; 338 339 if (ret == 0) { 339 340 leaf = path->nodes[0]; 340 341 ref = btrfs_item_ptr(leaf, path->slots[0],
+3 -2
fs/btrfs/tree-log.c
··· 2908 2908 path->nodes[*level]->len); 2909 2909 if (ret) 2910 2910 return ret; 2911 + btrfs_redirty_list_add(trans->transaction, 2912 + next); 2911 2913 } else { 2912 2914 if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags)) 2913 2915 clear_extent_buffer_dirty(next); ··· 2990 2988 next->start, next->len); 2991 2989 if (ret) 2992 2990 goto out; 2991 + btrfs_redirty_list_add(trans->transaction, next); 2993 2992 } else { 2994 2993 if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags)) 2995 2994 clear_extent_buffer_dirty(next); ··· 3441 3438 EXTENT_DIRTY | EXTENT_NEW | EXTENT_NEED_WAIT); 3442 3439 extent_io_tree_release(&log->log_csum_range); 3443 3440 3444 - if (trans && log->node) 3445 - btrfs_redirty_list_add(trans->transaction, log->node); 3446 3441 btrfs_put_root(log); 3447 3442 } 3448 3443
+2
fs/btrfs/zoned.c
··· 1860 1860 block_group->alloc_offset = block_group->zone_capacity; 1861 1861 block_group->free_space_ctl->free_space = 0; 1862 1862 btrfs_clear_treelog_bg(block_group); 1863 + btrfs_clear_data_reloc_bg(block_group); 1863 1864 spin_unlock(&block_group->lock); 1864 1865 1865 1866 ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, ··· 1943 1942 ASSERT(block_group->alloc_offset == block_group->zone_capacity); 1944 1943 ASSERT(block_group->free_space_ctl->free_space == 0); 1945 1944 btrfs_clear_treelog_bg(block_group); 1945 + btrfs_clear_data_reloc_bg(block_group); 1946 1946 spin_unlock(&block_group->lock); 1947 1947 1948 1948 map = block_group->physical_map;
+36 -18
fs/cifs/sess.c
··· 590 590 { 591 591 unsigned int tioffset; /* challenge message target info area */ 592 592 unsigned int tilen; /* challenge message target info area length */ 593 - 594 593 CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr; 594 + __u32 server_flags; 595 595 596 596 if (blob_len < sizeof(CHALLENGE_MESSAGE)) { 597 597 cifs_dbg(VFS, "challenge blob len %d too small\n", blob_len); ··· 609 609 return -EINVAL; 610 610 } 611 611 612 + server_flags = le32_to_cpu(pblob->NegotiateFlags); 613 + cifs_dbg(FYI, "%s: negotiate=0x%08x challenge=0x%08x\n", __func__, 614 + ses->ntlmssp->client_flags, server_flags); 615 + 616 + if ((ses->ntlmssp->client_flags & (NTLMSSP_NEGOTIATE_SEAL | NTLMSSP_NEGOTIATE_SIGN)) && 617 + (!(server_flags & NTLMSSP_NEGOTIATE_56) && !(server_flags & NTLMSSP_NEGOTIATE_128))) { 618 + cifs_dbg(VFS, "%s: requested signing/encryption but server did not return either 56-bit or 128-bit session key size\n", 619 + __func__); 620 + return -EINVAL; 621 + } 622 + if (!(server_flags & NTLMSSP_NEGOTIATE_NTLM) && !(server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC)) { 623 + cifs_dbg(VFS, "%s: server does not seem to support either NTLMv1 or NTLMv2\n", __func__); 624 + return -EINVAL; 625 + } 626 + if (ses->server->sign && !(server_flags & NTLMSSP_NEGOTIATE_SIGN)) { 627 + cifs_dbg(VFS, "%s: forced packet signing but server does not seem to support it\n", 628 + __func__); 629 + return -EOPNOTSUPP; 630 + } 631 + if ((ses->ntlmssp->client_flags & NTLMSSP_NEGOTIATE_KEY_XCH) && 632 + !(server_flags & NTLMSSP_NEGOTIATE_KEY_XCH)) 633 + pr_warn_once("%s: authentication has been weakened as server does not support key exchange\n", 634 + __func__); 635 + 636 + ses->ntlmssp->server_flags = server_flags; 637 + 612 638 memcpy(ses->ntlmssp->cryptkey, pblob->Challenge, CIFS_CRYPTO_KEY_SIZE); 613 - /* BB we could decode pblob->NegotiateFlags; some may be useful */ 614 639 /* In particular we can examine sign flags */ 615 640 /* BB spec says that if AvId field of MsvAvTimestamp is populated then 616 641 we must set the MIC field of the AUTHENTICATE_MESSAGE */ 617 - ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags); 642 + 618 643 tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset); 619 644 tilen = le16_to_cpu(pblob->TargetInfoArray.Length); 620 645 if (tioffset > blob_len || tioffset + tilen > blob_len) { ··· 746 721 flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | 747 722 NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | 748 723 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC | 749 - NTLMSSP_NEGOTIATE_SEAL; 750 - if (server->sign) 751 - flags |= NTLMSSP_NEGOTIATE_SIGN; 724 + NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NTLMSSP_NEGOTIATE_SEAL | 725 + NTLMSSP_NEGOTIATE_SIGN; 752 726 if (!server->session_estab || ses->ntlmssp->sesskey_per_smbsess) 753 727 flags |= NTLMSSP_NEGOTIATE_KEY_XCH; 754 728 755 729 tmp = *pbuffer + sizeof(NEGOTIATE_MESSAGE); 730 + ses->ntlmssp->client_flags = flags; 756 731 sec_blob->NegotiateFlags = cpu_to_le32(flags); 757 732 758 733 /* these fields should be null in negotiate phase MS-NLMP 3.1.5.1.1 */ ··· 804 779 memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8); 805 780 sec_blob->MessageType = NtLmAuthenticate; 806 781 807 - flags = NTLMSSP_NEGOTIATE_56 | 808 - NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO | 809 - NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | 810 - NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC | 811 - NTLMSSP_NEGOTIATE_SEAL | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED; 812 - if (ses->server->sign) 813 - flags |= NTLMSSP_NEGOTIATE_SIGN; 814 - if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) 815 - flags |= NTLMSSP_NEGOTIATE_KEY_XCH; 782 + flags = ses->ntlmssp->server_flags | NTLMSSP_REQUEST_TARGET | 783 + NTLMSSP_NEGOTIATE_TARGET_INFO | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED; 816 784 817 785 tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE); 818 786 sec_blob->NegotiateFlags = cpu_to_le32(flags); ··· 852 834 *pbuffer, &tmp, 853 835 nls_cp); 854 836 855 - if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) || 856 - (ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC)) 857 - && !calc_seckey(ses)) { 837 + if ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) && 838 + (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) && 839 + !calc_seckey(ses)) { 858 840 memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE); 859 841 sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - *pbuffer); 860 842 sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE);
+23 -6
fs/io-wq.c
··· 142 142 struct io_wqe_acct *acct, 143 143 struct io_cb_cancel_data *match); 144 144 static void create_worker_cb(struct callback_head *cb); 145 + static void io_wq_cancel_tw_create(struct io_wq *wq); 145 146 146 147 static bool io_worker_get(struct io_worker *worker) 147 148 { ··· 358 357 test_and_set_bit_lock(0, &worker->create_state)) 359 358 goto fail_release; 360 359 360 + atomic_inc(&wq->worker_refs); 361 361 init_task_work(&worker->create_work, func); 362 362 worker->create_index = acct->index; 363 363 if (!task_work_add(wq->task, &worker->create_work, TWA_SIGNAL)) { 364 - clear_bit_unlock(0, &worker->create_state); 364 + /* 365 + * EXIT may have been set after checking it above, check after 366 + * adding the task_work and remove any creation item if it is 367 + * now set. wq exit does that too, but we can have added this 368 + * work item after we canceled in io_wq_exit_workers(). 369 + */ 370 + if (test_bit(IO_WQ_BIT_EXIT, &wq->state)) 371 + io_wq_cancel_tw_create(wq); 372 + io_worker_ref_put(wq); 365 373 return true; 366 374 } 375 + io_worker_ref_put(wq); 367 376 clear_bit_unlock(0, &worker->create_state); 368 377 fail_release: 369 378 io_worker_release(worker); ··· 1209 1198 set_bit(IO_WQ_BIT_EXIT, &wq->state); 1210 1199 } 1211 1200 1212 - static void io_wq_exit_workers(struct io_wq *wq) 1201 + static void io_wq_cancel_tw_create(struct io_wq *wq) 1213 1202 { 1214 1203 struct callback_head *cb; 1215 - int node; 1216 - 1217 - if (!wq->task) 1218 - return; 1219 1204 1220 1205 while ((cb = task_work_cancel_match(wq->task, io_task_work_match, wq)) != NULL) { 1221 1206 struct io_worker *worker; ··· 1219 1212 worker = container_of(cb, struct io_worker, create_work); 1220 1213 io_worker_cancel_cb(worker); 1221 1214 } 1215 + } 1216 + 1217 + static void io_wq_exit_workers(struct io_wq *wq) 1218 + { 1219 + int node; 1220 + 1221 + if (!wq->task) 1222 + return; 1223 + 1224 + io_wq_cancel_tw_create(wq); 1222 1225 1223 1226 rcu_read_lock(); 1224 1227 for_each_node(node) {
+4 -2
fs/io_uring.c
··· 9824 9824 9825 9825 /* 9826 9826 * Find any io_uring ctx that this task has registered or done IO on, and cancel 9827 - * requests. @sqd should be not-null IIF it's an SQPOLL thread cancellation. 9827 + * requests. @sqd should be not-null IFF it's an SQPOLL thread cancellation. 9828 9828 */ 9829 9829 static __cold void io_uring_cancel_generic(bool cancel_all, 9830 9830 struct io_sq_data *sqd) ··· 9866 9866 cancel_all); 9867 9867 } 9868 9868 9869 - prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE); 9869 + prepare_to_wait(&tctx->wait, &wait, TASK_INTERRUPTIBLE); 9870 + io_run_task_work(); 9870 9871 io_uring_drop_tctx_refs(current); 9872 + 9871 9873 /* 9872 9874 * If we've seen completions, retry without waiting. This 9873 9875 * avoids a race where a completion comes in before we did
+8 -13
fs/netfs/read_helper.c
··· 354 354 netfs_rreq_do_write_to_cache(rreq); 355 355 } 356 356 357 - static void netfs_rreq_write_to_cache(struct netfs_read_request *rreq, 358 - bool was_async) 357 + static void netfs_rreq_write_to_cache(struct netfs_read_request *rreq) 359 358 { 360 - if (was_async) { 361 - rreq->work.func = netfs_rreq_write_to_cache_work; 362 - if (!queue_work(system_unbound_wq, &rreq->work)) 363 - BUG(); 364 - } else { 365 - netfs_rreq_do_write_to_cache(rreq); 366 - } 359 + rreq->work.func = netfs_rreq_write_to_cache_work; 360 + if (!queue_work(system_unbound_wq, &rreq->work)) 361 + BUG(); 367 362 } 368 363 369 364 /* ··· 553 558 wake_up_bit(&rreq->flags, NETFS_RREQ_IN_PROGRESS); 554 559 555 560 if (test_bit(NETFS_RREQ_WRITE_TO_CACHE, &rreq->flags)) 556 - return netfs_rreq_write_to_cache(rreq, was_async); 561 + return netfs_rreq_write_to_cache(rreq); 557 562 558 563 netfs_rreq_completed(rreq, was_async); 559 564 } ··· 955 960 rreq = netfs_alloc_read_request(ops, netfs_priv, file); 956 961 if (!rreq) { 957 962 if (netfs_priv) 958 - ops->cleanup(netfs_priv, folio_file_mapping(folio)); 963 + ops->cleanup(folio_file_mapping(folio), netfs_priv); 959 964 folio_unlock(folio); 960 965 return -ENOMEM; 961 966 } ··· 1186 1191 goto error; 1187 1192 have_folio_no_wait: 1188 1193 if (netfs_priv) 1189 - ops->cleanup(netfs_priv, mapping); 1194 + ops->cleanup(mapping, netfs_priv); 1190 1195 *_folio = folio; 1191 1196 _leave(" = 0"); 1192 1197 return 0; ··· 1197 1202 folio_unlock(folio); 1198 1203 folio_put(folio); 1199 1204 if (netfs_priv) 1200 - ops->cleanup(netfs_priv, mapping); 1205 + ops->cleanup(mapping, netfs_priv); 1201 1206 _leave(" = %d", ret); 1202 1207 return ret; 1203 1208 }
+1
fs/nfsd/nfs4recover.c
··· 2156 2156 int 2157 2157 register_cld_notifier(void) 2158 2158 { 2159 + WARN_ON(!nfsd_net_id); 2159 2160 return rpc_pipefs_notifier_register(&nfsd4_cld_block); 2160 2161 } 2161 2162
+7 -2
fs/nfsd/nfs4state.c
··· 1207 1207 return 0; 1208 1208 } 1209 1209 1210 + static bool delegation_hashed(struct nfs4_delegation *dp) 1211 + { 1212 + return !(list_empty(&dp->dl_perfile)); 1213 + } 1214 + 1210 1215 static bool 1211 1216 unhash_delegation_locked(struct nfs4_delegation *dp) 1212 1217 { ··· 1219 1214 1220 1215 lockdep_assert_held(&state_lock); 1221 1216 1222 - if (list_empty(&dp->dl_perfile)) 1217 + if (!delegation_hashed(dp)) 1223 1218 return false; 1224 1219 1225 1220 dp->dl_stid.sc_type = NFS4_CLOSED_DELEG_STID; ··· 4603 4598 * queued for a lease break. Don't queue it again. 4604 4599 */ 4605 4600 spin_lock(&state_lock); 4606 - if (dp->dl_time == 0) { 4601 + if (delegation_hashed(dp) && dp->dl_time == 0) { 4607 4602 dp->dl_time = ktime_get_boottime_seconds(); 4608 4603 list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru); 4609 4604 }
+7 -7
fs/nfsd/nfsctl.c
··· 1521 1521 int retval; 1522 1522 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); 1523 1523 1524 - retval = register_cld_notifier(); 1525 - if (retval) 1526 - return retval; 1527 1524 retval = nfsd4_init_slabs(); 1528 1525 if (retval) 1529 - goto out_unregister_notifier; 1526 + return retval; 1530 1527 retval = nfsd4_init_pnfs(); 1531 1528 if (retval) 1532 1529 goto out_free_slabs; ··· 1542 1545 goto out_free_exports; 1543 1546 retval = register_pernet_subsys(&nfsd_net_ops); 1544 1547 if (retval < 0) 1548 + goto out_free_filesystem; 1549 + retval = register_cld_notifier(); 1550 + if (retval) 1545 1551 goto out_free_all; 1546 1552 return 0; 1547 1553 out_free_all: 1554 + unregister_pernet_subsys(&nfsd_net_ops); 1555 + out_free_filesystem: 1548 1556 unregister_filesystem(&nfsd_fs_type); 1549 1557 out_free_exports: 1550 1558 remove_proc_entry("fs/nfs/exports", NULL); ··· 1563 1561 nfsd4_exit_pnfs(); 1564 1562 out_free_slabs: 1565 1563 nfsd4_free_slabs(); 1566 - out_unregister_notifier: 1567 - unregister_cld_notifier(); 1568 1564 return retval; 1569 1565 } 1570 1566 1571 1567 static void __exit exit_nfsd(void) 1572 1568 { 1569 + unregister_cld_notifier(); 1573 1570 unregister_pernet_subsys(&nfsd_net_ops); 1574 1571 nfsd_drc_slab_free(); 1575 1572 remove_proc_entry("fs/nfs/exports", NULL); ··· 1578 1577 nfsd4_free_slabs(); 1579 1578 nfsd4_exit_pnfs(); 1580 1579 unregister_filesystem(&nfsd_fs_type); 1581 - unregister_cld_notifier(); 1582 1580 } 1583 1581 1584 1582 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
+1 -11
fs/signalfd.c
··· 35 35 36 36 void signalfd_cleanup(struct sighand_struct *sighand) 37 37 { 38 - wait_queue_head_t *wqh = &sighand->signalfd_wqh; 39 - /* 40 - * The lockless check can race with remove_wait_queue() in progress, 41 - * but in this case its caller should run under rcu_read_lock() and 42 - * sighand_cachep is SLAB_TYPESAFE_BY_RCU, we can safely return. 43 - */ 44 - if (likely(!waitqueue_active(wqh))) 45 - return; 46 - 47 - /* wait_queue_entry_t->func(POLLFREE) should do remove_wait_queue() */ 48 - wake_up_poll(wqh, EPOLLHUP | POLLFREE); 38 + wake_up_pollfree(&sighand->signalfd_wqh); 49 39 } 50 40 51 41 struct signalfd_ctx {
-13
fs/smbfs_common/cifs_arc4.c
··· 72 72 ctx->y = y; 73 73 } 74 74 EXPORT_SYMBOL_GPL(cifs_arc4_crypt); 75 - 76 - static int __init 77 - init_smbfs_common(void) 78 - { 79 - return 0; 80 - } 81 - static void __init 82 - exit_smbfs_common(void) 83 - { 84 - } 85 - 86 - module_init(init_smbfs_common) 87 - module_exit(exit_smbfs_common)
+76
fs/tracefs/inode.c
··· 161 161 struct tracefs_mount_opts mount_opts; 162 162 }; 163 163 164 + static void change_gid(struct dentry *dentry, kgid_t gid) 165 + { 166 + if (!dentry->d_inode) 167 + return; 168 + dentry->d_inode->i_gid = gid; 169 + } 170 + 171 + /* 172 + * Taken from d_walk, but without he need for handling renames. 173 + * Nothing can be renamed while walking the list, as tracefs 174 + * does not support renames. This is only called when mounting 175 + * or remounting the file system, to set all the files to 176 + * the given gid. 177 + */ 178 + static void set_gid(struct dentry *parent, kgid_t gid) 179 + { 180 + struct dentry *this_parent; 181 + struct list_head *next; 182 + 183 + this_parent = parent; 184 + spin_lock(&this_parent->d_lock); 185 + 186 + change_gid(this_parent, gid); 187 + repeat: 188 + next = this_parent->d_subdirs.next; 189 + resume: 190 + while (next != &this_parent->d_subdirs) { 191 + struct list_head *tmp = next; 192 + struct dentry *dentry = list_entry(tmp, struct dentry, d_child); 193 + next = tmp->next; 194 + 195 + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 196 + 197 + change_gid(dentry, gid); 198 + 199 + if (!list_empty(&dentry->d_subdirs)) { 200 + spin_unlock(&this_parent->d_lock); 201 + spin_release(&dentry->d_lock.dep_map, _RET_IP_); 202 + this_parent = dentry; 203 + spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); 204 + goto repeat; 205 + } 206 + spin_unlock(&dentry->d_lock); 207 + } 208 + /* 209 + * All done at this level ... ascend and resume the search. 210 + */ 211 + rcu_read_lock(); 212 + ascend: 213 + if (this_parent != parent) { 214 + struct dentry *child = this_parent; 215 + this_parent = child->d_parent; 216 + 217 + spin_unlock(&child->d_lock); 218 + spin_lock(&this_parent->d_lock); 219 + 220 + /* go into the first sibling still alive */ 221 + do { 222 + next = child->d_child.next; 223 + if (next == &this_parent->d_subdirs) 224 + goto ascend; 225 + child = list_entry(next, struct dentry, d_child); 226 + } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); 227 + rcu_read_unlock(); 228 + goto resume; 229 + } 230 + rcu_read_unlock(); 231 + spin_unlock(&this_parent->d_lock); 232 + return; 233 + } 234 + 164 235 static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) 165 236 { 166 237 substring_t args[MAX_OPT_ARGS]; ··· 264 193 if (!gid_valid(gid)) 265 194 return -EINVAL; 266 195 opts->gid = gid; 196 + set_gid(tracefs_mount->mnt_root, gid); 267 197 break; 268 198 case Opt_mode: 269 199 if (match_octal(&args[0], &option)) ··· 486 414 inode->i_mode = mode; 487 415 inode->i_fop = fops ? fops : &tracefs_file_operations; 488 416 inode->i_private = data; 417 + inode->i_uid = d_inode(dentry->d_parent)->i_uid; 418 + inode->i_gid = d_inode(dentry->d_parent)->i_gid; 489 419 d_instantiate(dentry, inode); 490 420 fsnotify_create(dentry->d_parent->d_inode, dentry); 491 421 return end_creating(dentry); ··· 510 436 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP; 511 437 inode->i_op = ops; 512 438 inode->i_fop = &simple_dir_operations; 439 + inode->i_uid = d_inode(dentry->d_parent)->i_uid; 440 + inode->i_gid = d_inode(dentry->d_parent)->i_gid; 513 441 514 442 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 515 443 inc_nlink(inode);
+11 -3
fs/xfs/xfs_super.c
··· 1765 1765 xfs_remount_ro( 1766 1766 struct xfs_mount *mp) 1767 1767 { 1768 - int error; 1768 + struct xfs_icwalk icw = { 1769 + .icw_flags = XFS_ICWALK_FLAG_SYNC, 1770 + }; 1771 + int error; 1769 1772 1770 1773 /* 1771 1774 * Cancel background eofb scanning so it cannot race with the final ··· 1776 1773 */ 1777 1774 xfs_blockgc_stop(mp); 1778 1775 1779 - /* Get rid of any leftover CoW reservations... */ 1780 - error = xfs_blockgc_free_space(mp, NULL); 1776 + /* 1777 + * Clear out all remaining COW staging extents and speculative post-EOF 1778 + * preallocations so that we don't leave inodes requiring inactivation 1779 + * cleanups during reclaim on a read-only mount. We must process every 1780 + * cached inode, so this requires a synchronous cache scan. 1781 + */ 1782 + error = xfs_blockgc_free_space(mp, &icw); 1781 1783 if (error) { 1782 1784 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 1783 1785 return error;
+3 -14
include/linux/bpf.h
··· 732 732 struct bpf_trampoline *bpf_trampoline_get(u64 key, 733 733 struct bpf_attach_target_info *tgt_info); 734 734 void bpf_trampoline_put(struct bpf_trampoline *tr); 735 + int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs); 735 736 #define BPF_DISPATCHER_INIT(_name) { \ 736 737 .mutex = __MUTEX_INITIALIZER(_name.mutex), \ 737 738 .func = &_name##_func, \ ··· 1353 1352 * kprobes, tracepoints) to prevent deadlocks on map operations as any of 1354 1353 * these events can happen inside a region which holds a map bucket lock 1355 1354 * and can deadlock on it. 1356 - * 1357 - * Use the preemption safe inc/dec variants on RT because migrate disable 1358 - * is preemptible on RT and preemption in the middle of the RMW operation 1359 - * might lead to inconsistent state. Use the raw variants for non RT 1360 - * kernels as migrate_disable() maps to preempt_disable() so the slightly 1361 - * more expensive save operation can be avoided. 1362 1355 */ 1363 1356 static inline void bpf_disable_instrumentation(void) 1364 1357 { 1365 1358 migrate_disable(); 1366 - if (IS_ENABLED(CONFIG_PREEMPT_RT)) 1367 - this_cpu_inc(bpf_prog_active); 1368 - else 1369 - __this_cpu_inc(bpf_prog_active); 1359 + this_cpu_inc(bpf_prog_active); 1370 1360 } 1371 1361 1372 1362 static inline void bpf_enable_instrumentation(void) 1373 1363 { 1374 - if (IS_ENABLED(CONFIG_PREEMPT_RT)) 1375 - this_cpu_dec(bpf_prog_active); 1376 - else 1377 - __this_cpu_dec(bpf_prog_active); 1364 + this_cpu_dec(bpf_prog_active); 1378 1365 migrate_enable(); 1379 1366 } 1380 1367
+10 -4
include/linux/btf.h
··· 245 245 struct module *owner; 246 246 }; 247 247 248 - struct kfunc_btf_id_list; 248 + struct kfunc_btf_id_list { 249 + struct list_head list; 250 + struct mutex mutex; 251 + }; 249 252 250 253 #ifdef CONFIG_DEBUG_INFO_BTF_MODULES 251 254 void register_kfunc_btf_id_set(struct kfunc_btf_id_list *l, ··· 257 254 struct kfunc_btf_id_set *s); 258 255 bool bpf_check_mod_kfunc_call(struct kfunc_btf_id_list *klist, u32 kfunc_id, 259 256 struct module *owner); 257 + 258 + extern struct kfunc_btf_id_list bpf_tcp_ca_kfunc_list; 259 + extern struct kfunc_btf_id_list prog_test_kfunc_list; 260 260 #else 261 261 static inline void register_kfunc_btf_id_set(struct kfunc_btf_id_list *l, 262 262 struct kfunc_btf_id_set *s) ··· 274 268 { 275 269 return false; 276 270 } 271 + 272 + static struct kfunc_btf_id_list bpf_tcp_ca_kfunc_list __maybe_unused; 273 + static struct kfunc_btf_id_list prog_test_kfunc_list __maybe_unused; 277 274 #endif 278 275 279 276 #define DEFINE_KFUNC_BTF_ID_SET(set, name) \ 280 277 struct kfunc_btf_id_set name = { LIST_HEAD_INIT(name.list), (set), \ 281 278 THIS_MODULE } 282 - 283 - extern struct kfunc_btf_id_list bpf_tcp_ca_kfunc_list; 284 - extern struct kfunc_btf_id_list prog_test_kfunc_list; 285 279 286 280 #endif
-1
include/linux/cacheinfo.h
··· 3 3 #define _LINUX_CACHEINFO_H 4 4 5 5 #include <linux/bitops.h> 6 - #include <linux/cpu.h> 7 6 #include <linux/cpumask.h> 8 7 #include <linux/smp.h> 9 8
+13 -1
include/linux/delay.h
··· 20 20 */ 21 21 22 22 #include <linux/math.h> 23 + #include <linux/sched.h> 23 24 24 25 extern unsigned long loops_per_jiffy; 25 26 ··· 59 58 void __attribute__((weak)) calibration_delay_done(void); 60 59 void msleep(unsigned int msecs); 61 60 unsigned long msleep_interruptible(unsigned int msecs); 62 - void usleep_range(unsigned long min, unsigned long max); 61 + void usleep_range_state(unsigned long min, unsigned long max, 62 + unsigned int state); 63 + 64 + static inline void usleep_range(unsigned long min, unsigned long max) 65 + { 66 + usleep_range_state(min, max, TASK_UNINTERRUPTIBLE); 67 + } 68 + 69 + static inline void usleep_idle_range(unsigned long min, unsigned long max) 70 + { 71 + usleep_range_state(min, max, TASK_IDLE); 72 + } 63 73 64 74 static inline void ssleep(unsigned int seconds) 65 75 {
+1
include/linux/device/driver.h
··· 18 18 #include <linux/klist.h> 19 19 #include <linux/pm.h> 20 20 #include <linux/device/bus.h> 21 + #include <linux/module.h> 21 22 22 23 /** 23 24 * enum probe_type - device driver probe type to try
+1 -4
include/linux/filter.h
··· 6 6 #define __LINUX_FILTER_H__ 7 7 8 8 #include <linux/atomic.h> 9 + #include <linux/bpf.h> 9 10 #include <linux/refcount.h> 10 11 #include <linux/compat.h> 11 12 #include <linux/skbuff.h> ··· 27 26 28 27 #include <asm/byteorder.h> 29 28 #include <uapi/linux/filter.h> 30 - #include <uapi/linux/bpf.h> 31 29 32 30 struct sk_buff; 33 31 struct sock; ··· 640 640 * This uses migrate_disable/enable() explicitly to document that the 641 641 * invocation of a BPF program does not require reentrancy protection 642 642 * against a BPF program which is invoked from a preempting task. 643 - * 644 - * For non RT enabled kernels migrate_disable/enable() maps to 645 - * preempt_disable/enable(), i.e. it disables also preemption. 646 643 */ 647 644 static inline u32 bpf_prog_run_pin_on_cpu(const struct bpf_prog *prog, 648 645 const void *ctx)
+5
include/linux/hid.h
··· 840 840 return hdev->ll_driver == driver; 841 841 } 842 842 843 + static inline bool hid_is_usb(struct hid_device *hdev) 844 + { 845 + return hid_is_using_ll_driver(hdev, &usb_hid_driver); 846 + } 847 + 843 848 #define PM_HINT_FULLON 1<<5 844 849 #define PM_HINT_NORMAL 1<<1 845 850
+13
include/linux/mhi.h
··· 664 664 int mhi_pm_resume(struct mhi_controller *mhi_cntrl); 665 665 666 666 /** 667 + * mhi_pm_resume_force - Force resume MHI from suspended state 668 + * @mhi_cntrl: MHI controller 669 + * 670 + * Resume the device irrespective of its MHI state. As per the MHI spec, devices 671 + * has to be in M3 state during resume. But some devices seem to be in a 672 + * different MHI state other than M3 but they continue working fine if allowed. 673 + * This API is intented to be used for such devices. 674 + * 675 + * Return: 0 if the resume succeeds, a negative error code otherwise 676 + */ 677 + int mhi_pm_resume_force(struct mhi_controller *mhi_cntrl); 678 + 679 + /** 667 680 * mhi_download_rddm_image - Download ramdump image from device for 668 681 * debugging purpose. 669 682 * @mhi_cntrl: MHI controller
+1 -1
include/linux/percpu-refcount.h
··· 51 51 #define _LINUX_PERCPU_REFCOUNT_H 52 52 53 53 #include <linux/atomic.h> 54 - #include <linux/kernel.h> 55 54 #include <linux/percpu.h> 56 55 #include <linux/rcupdate.h> 56 + #include <linux/types.h> 57 57 #include <linux/gfp.h> 58 58 59 59 struct percpu_ref;
+6 -5
include/linux/phy.h
··· 538 538 * @mac_managed_pm: Set true if MAC driver takes of suspending/resuming PHY 539 539 * @state: State of the PHY for management purposes 540 540 * @dev_flags: Device-specific flags used by the PHY driver. 541 - * Bits [15:0] are free to use by the PHY driver to communicate 542 - * driver specific behavior. 543 - * Bits [23:16] are currently reserved for future use. 544 - * Bits [31:24] are reserved for defining generic 545 - * PHY driver behavior. 541 + * 542 + * - Bits [15:0] are free to use by the PHY driver to communicate 543 + * driver specific behavior. 544 + * - Bits [23:16] are currently reserved for future use. 545 + * - Bits [31:24] are reserved for defining generic 546 + * PHY driver behavior. 546 547 * @irq: IRQ number of the PHY's interrupt (-1 if none) 547 548 * @phy_timer: The timer for handling the state machine 548 549 * @phylink: Pointer to phylink instance for this PHY
+1 -1
include/linux/pm_runtime.h
··· 129 129 * pm_runtime_active - Check whether or not a device is runtime-active. 130 130 * @dev: Target device. 131 131 * 132 - * Return %true if runtime PM is enabled for @dev and its runtime PM status is 132 + * Return %true if runtime PM is disabled for @dev or its runtime PM status is 133 133 * %RPM_ACTIVE, or %false otherwise. 134 134 * 135 135 * Note that the return value of this function can only be trusted if it is
+8 -6
include/linux/regulator/driver.h
··· 499 499 * best to shut-down regulator(s) or reboot the SOC if error 500 500 * handling is repeatedly failing. If fatal_cnt is given the IRQ 501 501 * handling is aborted if it fails for fatal_cnt times and die() 502 - * callback (if populated) or BUG() is called to try to prevent 502 + * callback (if populated) is called. If die() is not populated 503 + * poweroff for the system is attempted in order to prevent any 503 504 * further damage. 504 505 * @reread_ms: The time which is waited before attempting to re-read status 505 506 * at the worker if IC reading fails. Immediate re-read is done ··· 517 516 * @data: Driver private data pointer which will be passed as such to 518 517 * the renable, map_event and die callbacks in regulator_irq_data. 519 518 * @die: Protection callback. If IC status reading or recovery actions 520 - * fail fatal_cnt times this callback or BUG() is called. This 521 - * callback should implement a final protection attempt like 522 - * disabling the regulator. If protection succeeded this may 523 - * return 0. If anything else is returned the core assumes final 524 - * protection failed and calls BUG() as a last resort. 519 + * fail fatal_cnt times this callback is called or system is 520 + * powered off. This callback should implement a final protection 521 + * attempt like disabling the regulator. If protection succeeded 522 + * die() may return 0. If anything else is returned the core 523 + * assumes final protection failed and attempts to perform a 524 + * poweroff as a last resort. 525 525 * @map_event: Driver callback to map IRQ status into regulator devices with 526 526 * events / errors. NOTE: callback MUST initialize both the 527 527 * errors and notifs for all rdevs which it signals having
+26
include/linux/wait.h
··· 217 217 void __wake_up_locked_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); 218 218 void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr); 219 219 void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode); 220 + void __wake_up_pollfree(struct wait_queue_head *wq_head); 220 221 221 222 #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 222 223 #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) ··· 245 244 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m)) 246 245 #define wake_up_interruptible_sync_poll_locked(x, m) \ 247 246 __wake_up_locked_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m)) 247 + 248 + /** 249 + * wake_up_pollfree - signal that a polled waitqueue is going away 250 + * @wq_head: the wait queue head 251 + * 252 + * In the very rare cases where a ->poll() implementation uses a waitqueue whose 253 + * lifetime is tied to a task rather than to the 'struct file' being polled, 254 + * this function must be called before the waitqueue is freed so that 255 + * non-blocking polls (e.g. epoll) are notified that the queue is going away. 256 + * 257 + * The caller must also RCU-delay the freeing of the wait_queue_head, e.g. via 258 + * an explicit synchronize_rcu() or call_rcu(), or via SLAB_TYPESAFE_BY_RCU. 259 + */ 260 + static inline void wake_up_pollfree(struct wait_queue_head *wq_head) 261 + { 262 + /* 263 + * For performance reasons, we don't always take the queue lock here. 264 + * Therefore, we might race with someone removing the last entry from 265 + * the queue, and proceed while they still hold the queue lock. 266 + * However, rcu_read_lock() is required to be held in such cases, so we 267 + * can safely proceed with an RCU-delayed free. 268 + */ 269 + if (waitqueue_active(wq_head)) 270 + __wake_up_pollfree(wq_head); 271 + } 248 272 249 273 #define ___wait_cond_timeout(condition) \ 250 274 ({ \
+1 -1
include/net/bond_alb.h
··· 126 126 struct alb_bond_info { 127 127 struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ 128 128 u32 unbalanced_load; 129 - int tx_rebalance_counter; 129 + atomic_t tx_rebalance_counter; 130 130 int lp_counter; 131 131 /* -------- rlb parameters -------- */ 132 132 int rlb_enabled;
+13
include/net/busy_poll.h
··· 136 136 sk_rx_queue_update(sk, skb); 137 137 } 138 138 139 + /* Variant of sk_mark_napi_id() for passive flow setup, 140 + * as sk->sk_napi_id and sk->sk_rx_queue_mapping content 141 + * needs to be set. 142 + */ 143 + static inline void sk_mark_napi_id_set(struct sock *sk, 144 + const struct sk_buff *skb) 145 + { 146 + #ifdef CONFIG_NET_RX_BUSY_POLL 147 + WRITE_ONCE(sk->sk_napi_id, skb->napi_id); 148 + #endif 149 + sk_rx_queue_set(sk, skb); 150 + } 151 + 139 152 static inline void __sk_mark_napi_id_once(struct sock *sk, unsigned int napi_id) 140 153 { 141 154 #ifdef CONFIG_NET_RX_BUSY_POLL
+3 -3
include/net/netfilter/nf_conntrack.h
··· 276 276 /* jiffies until ct expires, 0 if already expired */ 277 277 static inline unsigned long nf_ct_expires(const struct nf_conn *ct) 278 278 { 279 - s32 timeout = ct->timeout - nfct_time_stamp; 279 + s32 timeout = READ_ONCE(ct->timeout) - nfct_time_stamp; 280 280 281 281 return timeout > 0 ? timeout : 0; 282 282 } 283 283 284 284 static inline bool nf_ct_is_expired(const struct nf_conn *ct) 285 285 { 286 - return (__s32)(ct->timeout - nfct_time_stamp) <= 0; 286 + return (__s32)(READ_ONCE(ct->timeout) - nfct_time_stamp) <= 0; 287 287 } 288 288 289 289 /* use after obtaining a reference count */ ··· 302 302 static inline void nf_ct_offload_timeout(struct nf_conn *ct) 303 303 { 304 304 if (nf_ct_expires(ct) < NF_CT_DAY / 2) 305 - ct->timeout = nfct_time_stamp + NF_CT_DAY; 305 + WRITE_ONCE(ct->timeout, nfct_time_stamp + NF_CT_DAY); 306 306 } 307 307 308 308 struct kernel_param;
+1 -1
include/uapi/asm-generic/poll.h
··· 29 29 #define POLLRDHUP 0x2000 30 30 #endif 31 31 32 - #define POLLFREE (__force __poll_t)0x4000 /* currently only for epoll */ 32 + #define POLLFREE (__force __poll_t)0x4000 33 33 34 34 #define POLL_BUSY_LOOP (__force __poll_t)0x8000 35 35
+10 -3
include/uapi/linux/resource.h
··· 66 66 #define _STK_LIM (8*1024*1024) 67 67 68 68 /* 69 - * GPG2 wants 64kB of mlocked memory, to make sure pass phrases 70 - * and other sensitive information are never written to disk. 69 + * Limit the amount of locked memory by some sane default: 70 + * root can always increase this limit if needed. 71 + * 72 + * The main use-cases are (1) preventing sensitive memory 73 + * from being swapped; (2) real-time operations; (3) via 74 + * IOURING_REGISTER_BUFFERS. 75 + * 76 + * The first two don't need much. The latter will take as 77 + * much as it can get. 8MB is a reasonably sane default. 71 78 */ 72 - #define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) 79 + #define MLOCK_LIMIT (8*1024*1024) 73 80 74 81 /* 75 82 * Due to binary compatibility, the actual resource numbers
+2 -9
kernel/bpf/btf.c
··· 6346 6346 6347 6347 /* BTF ID set registration API for modules */ 6348 6348 6349 - struct kfunc_btf_id_list { 6350 - struct list_head list; 6351 - struct mutex mutex; 6352 - }; 6353 - 6354 6349 #ifdef CONFIG_DEBUG_INFO_BTF_MODULES 6355 6350 6356 6351 void register_kfunc_btf_id_set(struct kfunc_btf_id_list *l, ··· 6371 6376 { 6372 6377 struct kfunc_btf_id_set *s; 6373 6378 6374 - if (!owner) 6375 - return false; 6376 6379 mutex_lock(&klist->mutex); 6377 6380 list_for_each_entry(s, &klist->list, list) { 6378 6381 if (s->owner == owner && btf_id_set_contains(s->set, kfunc_id)) { ··· 6382 6389 return false; 6383 6390 } 6384 6391 6385 - #endif 6386 - 6387 6392 #define DEFINE_KFUNC_BTF_ID_LIST(name) \ 6388 6393 struct kfunc_btf_id_list name = { LIST_HEAD_INIT(name.list), \ 6389 6394 __MUTEX_INITIALIZER(name.mutex) }; \ ··· 6389 6398 6390 6399 DEFINE_KFUNC_BTF_ID_LIST(bpf_tcp_ca_kfunc_list); 6391 6400 DEFINE_KFUNC_BTF_ID_LIST(prog_test_kfunc_list); 6401 + 6402 + #endif
+1 -1
kernel/bpf/verifier.c
··· 8422 8422 8423 8423 new_range = dst_reg->off; 8424 8424 if (range_right_open) 8425 - new_range--; 8425 + new_range++; 8426 8426 8427 8427 /* Examples for register markings: 8428 8428 *
+7
kernel/sched/wait.c
··· 238 238 } 239 239 EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */ 240 240 241 + void __wake_up_pollfree(struct wait_queue_head *wq_head) 242 + { 243 + __wake_up(wq_head, TASK_NORMAL, 0, poll_to_key(EPOLLHUP | POLLFREE)); 244 + /* POLLFREE must have cleared the queue. */ 245 + WARN_ON_ONCE(waitqueue_active(wq_head)); 246 + } 247 + 241 248 /* 242 249 * Note: we use "set_current_state()" _after_ the wait-queue add, 243 250 * because we need a memory barrier there on SMP, so that any
+9 -7
kernel/time/timer.c
··· 2054 2054 EXPORT_SYMBOL(msleep_interruptible); 2055 2055 2056 2056 /** 2057 - * usleep_range - Sleep for an approximate time 2058 - * @min: Minimum time in usecs to sleep 2059 - * @max: Maximum time in usecs to sleep 2057 + * usleep_range_state - Sleep for an approximate time in a given state 2058 + * @min: Minimum time in usecs to sleep 2059 + * @max: Maximum time in usecs to sleep 2060 + * @state: State of the current task that will be while sleeping 2060 2061 * 2061 2062 * In non-atomic context where the exact wakeup time is flexible, use 2062 - * usleep_range() instead of udelay(). The sleep improves responsiveness 2063 + * usleep_range_state() instead of udelay(). The sleep improves responsiveness 2063 2064 * by avoiding the CPU-hogging busy-wait of udelay(), and the range reduces 2064 2065 * power usage by allowing hrtimers to take advantage of an already- 2065 2066 * scheduled interrupt instead of scheduling a new one just for this sleep. 2066 2067 */ 2067 - void __sched usleep_range(unsigned long min, unsigned long max) 2068 + void __sched usleep_range_state(unsigned long min, unsigned long max, 2069 + unsigned int state) 2068 2070 { 2069 2071 ktime_t exp = ktime_add_us(ktime_get(), min); 2070 2072 u64 delta = (u64)(max - min) * NSEC_PER_USEC; 2071 2073 2072 2074 for (;;) { 2073 - __set_current_state(TASK_UNINTERRUPTIBLE); 2075 + __set_current_state(state); 2074 2076 /* Do not return before the requested sleep time has elapsed */ 2075 2077 if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS)) 2076 2078 break; 2077 2079 } 2078 2080 } 2079 - EXPORT_SYMBOL(usleep_range); 2081 + EXPORT_SYMBOL(usleep_range_state);
+7 -1
kernel/trace/ftrace.c
··· 5217 5217 { 5218 5218 struct ftrace_direct_func *direct; 5219 5219 struct ftrace_func_entry *entry; 5220 + struct ftrace_hash *hash; 5220 5221 int ret = -ENODEV; 5221 5222 5222 5223 mutex_lock(&direct_mutex); ··· 5226 5225 if (!entry) 5227 5226 goto out_unlock; 5228 5227 5229 - if (direct_functions->count == 1) 5228 + hash = direct_ops.func_hash->filter_hash; 5229 + if (hash->count == 1) 5230 5230 unregister_ftrace_function(&direct_ops); 5231 5231 5232 5232 ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0); ··· 5542 5540 err = unregister_ftrace_function(ops); 5543 5541 remove_direct_functions_hash(hash, addr); 5544 5542 mutex_unlock(&direct_mutex); 5543 + 5544 + /* cleanup for possible another register call */ 5545 + ops->func = NULL; 5546 + ops->trampoline = 0; 5545 5547 return err; 5546 5548 } 5547 5549 EXPORT_SYMBOL_GPL(unregister_ftrace_direct_multi);
+6 -5
kernel/trace/trace_events_synth.c
··· 1237 1237 argv + consumed, &consumed, 1238 1238 &field_version); 1239 1239 if (IS_ERR(field)) { 1240 - argv_free(argv); 1241 1240 ret = PTR_ERR(field); 1242 - goto err; 1241 + goto err_free_arg; 1243 1242 } 1244 1243 1245 1244 /* ··· 1261 1262 if (cmd_version > 1 && n_fields_this_loop >= 1) { 1262 1263 synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str)); 1263 1264 ret = -EINVAL; 1264 - goto err; 1265 + goto err_free_arg; 1265 1266 } 1266 1267 1267 1268 fields[n_fields++] = field; 1268 1269 if (n_fields == SYNTH_FIELDS_MAX) { 1269 1270 synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0); 1270 1271 ret = -EINVAL; 1271 - goto err; 1272 + goto err_free_arg; 1272 1273 } 1273 1274 1274 1275 n_fields_this_loop++; 1275 1276 } 1277 + argv_free(argv); 1276 1278 1277 1279 if (consumed < argc) { 1278 1280 synth_err(SYNTH_ERR_INVALID_CMD, 0); ··· 1281 1281 goto err; 1282 1282 } 1283 1283 1284 - argv_free(argv); 1285 1284 } 1286 1285 1287 1286 if (n_fields == 0) { ··· 1306 1307 kfree(saved_fields); 1307 1308 1308 1309 return ret; 1310 + err_free_arg: 1311 + argv_free(argv); 1309 1312 err: 1310 1313 for (i = 0; i < n_fields; i++) 1311 1314 free_synth_field(fields[i]);
+1
lib/Kconfig.debug
··· 316 316 bool "Generate BTF typeinfo" 317 317 depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED 318 318 depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST 319 + depends on BPF_SYSCALL 319 320 help 320 321 Generate deduplicated BTF type information from DWARF debug info. 321 322 Turning this on expects presence of pahole tool, which will convert
+1 -1
mm/Kconfig
··· 428 428 # UP and nommu archs use km based percpu allocator 429 429 # 430 430 config NEED_PER_CPU_KM 431 - depends on !SMP 431 + depends on !SMP || !MMU 432 432 bool 433 433 default y 434 434
+7
mm/backing-dev.c
··· 945 945 wb_shutdown(&bdi->wb); 946 946 cgwb_bdi_unregister(bdi); 947 947 948 + /* 949 + * If this BDI's min ratio has been set, use bdi_set_min_ratio() to 950 + * update the global bdi_min_ratio. 951 + */ 952 + if (bdi->min_ratio) 953 + bdi_set_min_ratio(bdi, 0); 954 + 948 955 if (bdi->dev) { 949 956 bdi_debug_unregister(bdi); 950 957 device_unregister(bdi->dev);
+7 -13
mm/damon/core.c
··· 282 282 for (i = 0; i < nr_ids; i++) { 283 283 t = damon_new_target(ids[i]); 284 284 if (!t) { 285 - pr_err("Failed to alloc damon_target\n"); 286 285 /* The caller should do cleanup of the ids itself */ 287 286 damon_for_each_target_safe(t, next, ctx) 288 287 damon_destroy_target(t); ··· 311 312 unsigned long aggr_int, unsigned long primitive_upd_int, 312 313 unsigned long min_nr_reg, unsigned long max_nr_reg) 313 314 { 314 - if (min_nr_reg < 3) { 315 - pr_err("min_nr_regions (%lu) must be at least 3\n", 316 - min_nr_reg); 315 + if (min_nr_reg < 3) 317 316 return -EINVAL; 318 - } 319 - if (min_nr_reg > max_nr_reg) { 320 - pr_err("invalid nr_regions. min (%lu) > max (%lu)\n", 321 - min_nr_reg, max_nr_reg); 317 + if (min_nr_reg > max_nr_reg) 322 318 return -EINVAL; 323 - } 324 319 325 320 ctx->sample_interval = sample_int; 326 321 ctx->aggr_interval = aggr_int; ··· 973 980 974 981 static void kdamond_usleep(unsigned long usecs) 975 982 { 976 - if (usecs > 100 * 1000) 977 - schedule_timeout_interruptible(usecs_to_jiffies(usecs)); 983 + /* See Documentation/timers/timers-howto.rst for the thresholds */ 984 + if (usecs > 20 * USEC_PER_MSEC) 985 + schedule_timeout_idle(usecs_to_jiffies(usecs)); 978 986 else 979 - usleep_range(usecs, usecs + 1); 987 + usleep_idle_range(usecs, usecs + 1); 980 988 } 981 989 982 990 /* Returns negative error code if it's not activated but should return */ ··· 1032 1038 ctx->callback.after_sampling(ctx)) 1033 1039 done = true; 1034 1040 1035 - usleep_range(ctx->sample_interval, ctx->sample_interval + 1); 1041 + kdamond_usleep(ctx->sample_interval); 1036 1042 1037 1043 if (ctx->primitive.check_accesses) 1038 1044 max_nr_accesses = ctx->primitive.check_accesses(ctx);
+1 -3
mm/damon/dbgfs.c
··· 210 210 &wmarks.low, &parsed); 211 211 if (ret != 18) 212 212 break; 213 - if (!damos_action_valid(action)) { 214 - pr_err("wrong action %d\n", action); 213 + if (!damos_action_valid(action)) 215 214 goto fail; 216 - } 217 215 218 216 pos += parsed; 219 217 scheme = damon_new_scheme(min_sz, max_sz, min_nr_a, max_nr_a,
+45 -50
mm/damon/vaddr-test.h
··· 135 135 struct damon_addr_range *three_regions, 136 136 unsigned long *expected, int nr_expected) 137 137 { 138 - struct damon_ctx *ctx = damon_new_ctx(); 139 138 struct damon_target *t; 140 139 struct damon_region *r; 141 140 int i; ··· 144 145 r = damon_new_region(regions[i * 2], regions[i * 2 + 1]); 145 146 damon_add_region(r, t); 146 147 } 147 - damon_add_target(ctx, t); 148 148 149 149 damon_va_apply_three_regions(t, three_regions); 150 150 ··· 152 154 KUNIT_EXPECT_EQ(test, r->ar.start, expected[i * 2]); 153 155 KUNIT_EXPECT_EQ(test, r->ar.end, expected[i * 2 + 1]); 154 156 } 155 - 156 - damon_destroy_ctx(ctx); 157 157 } 158 158 159 159 /* ··· 248 252 new_three_regions, expected, ARRAY_SIZE(expected)); 249 253 } 250 254 251 - static void damon_test_split_evenly(struct kunit *test) 255 + static void damon_test_split_evenly_fail(struct kunit *test, 256 + unsigned long start, unsigned long end, unsigned int nr_pieces) 252 257 { 253 - struct damon_ctx *c = damon_new_ctx(); 254 - struct damon_target *t; 255 - struct damon_region *r; 256 - unsigned long i; 257 - 258 - KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(NULL, NULL, 5), 259 - -EINVAL); 260 - 261 - t = damon_new_target(42); 262 - r = damon_new_region(0, 100); 263 - KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 0), -EINVAL); 258 + struct damon_target *t = damon_new_target(42); 259 + struct damon_region *r = damon_new_region(start, end); 264 260 265 261 damon_add_region(r, t); 266 - KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 10), 0); 267 - KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 10u); 268 - 269 - i = 0; 270 - damon_for_each_region(r, t) { 271 - KUNIT_EXPECT_EQ(test, r->ar.start, i++ * 10); 272 - KUNIT_EXPECT_EQ(test, r->ar.end, i * 10); 273 - } 274 - damon_free_target(t); 275 - 276 - t = damon_new_target(42); 277 - r = damon_new_region(5, 59); 278 - damon_add_region(r, t); 279 - KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 5), 0); 280 - KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 5u); 281 - 282 - i = 0; 283 - damon_for_each_region(r, t) { 284 - if (i == 4) 285 - break; 286 - KUNIT_EXPECT_EQ(test, r->ar.start, 5 + 10 * i++); 287 - KUNIT_EXPECT_EQ(test, r->ar.end, 5 + 10 * i); 288 - } 289 - KUNIT_EXPECT_EQ(test, r->ar.start, 5 + 10 * i); 290 - KUNIT_EXPECT_EQ(test, r->ar.end, 59ul); 291 - damon_free_target(t); 292 - 293 - t = damon_new_target(42); 294 - r = damon_new_region(5, 6); 295 - damon_add_region(r, t); 296 - KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 2), -EINVAL); 262 + KUNIT_EXPECT_EQ(test, 263 + damon_va_evenly_split_region(t, r, nr_pieces), -EINVAL); 297 264 KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1u); 298 265 299 266 damon_for_each_region(r, t) { 300 - KUNIT_EXPECT_EQ(test, r->ar.start, 5ul); 301 - KUNIT_EXPECT_EQ(test, r->ar.end, 6ul); 267 + KUNIT_EXPECT_EQ(test, r->ar.start, start); 268 + KUNIT_EXPECT_EQ(test, r->ar.end, end); 302 269 } 270 + 303 271 damon_free_target(t); 304 - damon_destroy_ctx(c); 272 + } 273 + 274 + static void damon_test_split_evenly_succ(struct kunit *test, 275 + unsigned long start, unsigned long end, unsigned int nr_pieces) 276 + { 277 + struct damon_target *t = damon_new_target(42); 278 + struct damon_region *r = damon_new_region(start, end); 279 + unsigned long expected_width = (end - start) / nr_pieces; 280 + unsigned long i = 0; 281 + 282 + damon_add_region(r, t); 283 + KUNIT_EXPECT_EQ(test, 284 + damon_va_evenly_split_region(t, r, nr_pieces), 0); 285 + KUNIT_EXPECT_EQ(test, damon_nr_regions(t), nr_pieces); 286 + 287 + damon_for_each_region(r, t) { 288 + if (i == nr_pieces - 1) 289 + break; 290 + KUNIT_EXPECT_EQ(test, 291 + r->ar.start, start + i++ * expected_width); 292 + KUNIT_EXPECT_EQ(test, r->ar.end, start + i * expected_width); 293 + } 294 + KUNIT_EXPECT_EQ(test, r->ar.start, start + i * expected_width); 295 + KUNIT_EXPECT_EQ(test, r->ar.end, end); 296 + damon_free_target(t); 297 + } 298 + 299 + static void damon_test_split_evenly(struct kunit *test) 300 + { 301 + KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(NULL, NULL, 5), 302 + -EINVAL); 303 + 304 + damon_test_split_evenly_fail(test, 0, 100, 0); 305 + damon_test_split_evenly_succ(test, 0, 100, 10); 306 + damon_test_split_evenly_succ(test, 5, 59, 5); 307 + damon_test_split_evenly_fail(test, 5, 6, 2); 305 308 } 306 309 307 310 static struct kunit_case damon_test_cases[] = {
+1 -1
mm/damon/vaddr.c
··· 13 13 #include <linux/mmu_notifier.h> 14 14 #include <linux/page_idle.h> 15 15 #include <linux/pagewalk.h> 16 + #include <linux/sched/mm.h> 16 17 17 18 #include "prmtv-common.h" 18 19 ··· 627 626 case DAMOS_STAT: 628 627 return 0; 629 628 default: 630 - pr_warn("Wrong action %d\n", scheme->action); 631 629 return -EINVAL; 632 630 } 633 631
-2
mm/filemap.c
··· 3253 3253 goto skip; 3254 3254 if (!PageUptodate(page) || PageReadahead(page)) 3255 3255 goto skip; 3256 - if (PageHWPoison(page)) 3257 - goto skip; 3258 3256 if (!trylock_page(page)) 3259 3257 goto skip; 3260 3258 if (page->mapping != mapping)
+1 -1
mm/hugetlb.c
··· 2973 2973 struct huge_bootmem_page *m = NULL; /* initialize for clang */ 2974 2974 int nr_nodes, node; 2975 2975 2976 - if (nid >= nr_online_nodes) 2976 + if (nid != NUMA_NO_NODE && nid >= nr_online_nodes) 2977 2977 return 0; 2978 2978 /* do node specific alloc */ 2979 2979 if (nid != NUMA_NO_NODE) {
+53 -53
mm/memcontrol.c
··· 776 776 rcu_read_unlock(); 777 777 } 778 778 779 - /* 780 - * mod_objcg_mlstate() may be called with irq enabled, so 781 - * mod_memcg_lruvec_state() should be used. 782 - */ 783 - static inline void mod_objcg_mlstate(struct obj_cgroup *objcg, 784 - struct pglist_data *pgdat, 785 - enum node_stat_item idx, int nr) 786 - { 787 - struct mem_cgroup *memcg; 788 - struct lruvec *lruvec; 789 - 790 - rcu_read_lock(); 791 - memcg = obj_cgroup_memcg(objcg); 792 - lruvec = mem_cgroup_lruvec(memcg, pgdat); 793 - mod_memcg_lruvec_state(lruvec, idx, nr); 794 - rcu_read_unlock(); 795 - } 796 - 797 779 /** 798 780 * __count_memcg_events - account VM events in a cgroup 799 781 * @memcg: the memory cgroup ··· 2119 2137 } 2120 2138 #endif 2121 2139 2122 - /* 2123 - * Most kmem_cache_alloc() calls are from user context. The irq disable/enable 2124 - * sequence used in this case to access content from object stock is slow. 2125 - * To optimize for user context access, there are now two object stocks for 2126 - * task context and interrupt context access respectively. 2127 - * 2128 - * The task context object stock can be accessed by disabling preemption only 2129 - * which is cheap in non-preempt kernel. The interrupt context object stock 2130 - * can only be accessed after disabling interrupt. User context code can 2131 - * access interrupt object stock, but not vice versa. 2132 - */ 2133 - static inline struct obj_stock *get_obj_stock(unsigned long *pflags) 2134 - { 2135 - struct memcg_stock_pcp *stock; 2136 - 2137 - if (likely(in_task())) { 2138 - *pflags = 0UL; 2139 - preempt_disable(); 2140 - stock = this_cpu_ptr(&memcg_stock); 2141 - return &stock->task_obj; 2142 - } 2143 - 2144 - local_irq_save(*pflags); 2145 - stock = this_cpu_ptr(&memcg_stock); 2146 - return &stock->irq_obj; 2147 - } 2148 - 2149 - static inline void put_obj_stock(unsigned long flags) 2150 - { 2151 - if (likely(in_task())) 2152 - preempt_enable(); 2153 - else 2154 - local_irq_restore(flags); 2155 - } 2156 - 2157 2140 /** 2158 2141 * consume_stock: Try to consume stocked charge on this cpu. 2159 2142 * @memcg: memcg to consume from. ··· 2762 2815 * reclaimable. So those GFP bits should be masked off. 2763 2816 */ 2764 2817 #define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT) 2818 + 2819 + /* 2820 + * Most kmem_cache_alloc() calls are from user context. The irq disable/enable 2821 + * sequence used in this case to access content from object stock is slow. 2822 + * To optimize for user context access, there are now two object stocks for 2823 + * task context and interrupt context access respectively. 2824 + * 2825 + * The task context object stock can be accessed by disabling preemption only 2826 + * which is cheap in non-preempt kernel. The interrupt context object stock 2827 + * can only be accessed after disabling interrupt. User context code can 2828 + * access interrupt object stock, but not vice versa. 2829 + */ 2830 + static inline struct obj_stock *get_obj_stock(unsigned long *pflags) 2831 + { 2832 + struct memcg_stock_pcp *stock; 2833 + 2834 + if (likely(in_task())) { 2835 + *pflags = 0UL; 2836 + preempt_disable(); 2837 + stock = this_cpu_ptr(&memcg_stock); 2838 + return &stock->task_obj; 2839 + } 2840 + 2841 + local_irq_save(*pflags); 2842 + stock = this_cpu_ptr(&memcg_stock); 2843 + return &stock->irq_obj; 2844 + } 2845 + 2846 + static inline void put_obj_stock(unsigned long flags) 2847 + { 2848 + if (likely(in_task())) 2849 + preempt_enable(); 2850 + else 2851 + local_irq_restore(flags); 2852 + } 2853 + 2854 + /* 2855 + * mod_objcg_mlstate() may be called with irq enabled, so 2856 + * mod_memcg_lruvec_state() should be used. 2857 + */ 2858 + static inline void mod_objcg_mlstate(struct obj_cgroup *objcg, 2859 + struct pglist_data *pgdat, 2860 + enum node_stat_item idx, int nr) 2861 + { 2862 + struct mem_cgroup *memcg; 2863 + struct lruvec *lruvec; 2864 + 2865 + rcu_read_lock(); 2866 + memcg = obj_cgroup_memcg(objcg); 2867 + lruvec = mem_cgroup_lruvec(memcg, pgdat); 2868 + mod_memcg_lruvec_state(lruvec, idx, nr); 2869 + rcu_read_unlock(); 2870 + } 2765 2871 2766 2872 int memcg_alloc_page_obj_cgroups(struct page *page, struct kmem_cache *s, 2767 2873 gfp_t gfp, bool new_page)
+1
mm/memory_hotplug.c
··· 35 35 #include <linux/memblock.h> 36 36 #include <linux/compaction.h> 37 37 #include <linux/rmap.h> 38 + #include <linux/module.h> 38 39 39 40 #include <asm/tlbflush.h> 40 41
+9 -6
mm/slub.c
··· 5081 5081 unsigned long max; 5082 5082 unsigned long count; 5083 5083 struct location *loc; 5084 + loff_t idx; 5084 5085 }; 5085 5086 5086 5087 static struct dentry *slab_debugfs_root; ··· 6053 6052 #if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS) 6054 6053 static int slab_debugfs_show(struct seq_file *seq, void *v) 6055 6054 { 6056 - 6057 - struct location *l; 6058 - unsigned int idx = *(unsigned int *)v; 6059 6055 struct loc_track *t = seq->private; 6056 + struct location *l; 6057 + unsigned long idx; 6060 6058 6059 + idx = (unsigned long) t->idx; 6061 6060 if (idx < t->count) { 6062 6061 l = &t->loc[idx]; 6063 6062 ··· 6106 6105 { 6107 6106 struct loc_track *t = seq->private; 6108 6107 6109 - v = ppos; 6110 - ++*ppos; 6108 + t->idx = ++(*ppos); 6111 6109 if (*ppos <= t->count) 6112 - return v; 6110 + return ppos; 6113 6111 6114 6112 return NULL; 6115 6113 } 6116 6114 6117 6115 static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos) 6118 6116 { 6117 + struct loc_track *t = seq->private; 6118 + 6119 + t->idx = *ppos; 6119 6120 return ppos; 6120 6121 } 6121 6122
+1
mm/swap_slots.c
··· 30 30 #include <linux/swap_slots.h> 31 31 #include <linux/cpu.h> 32 32 #include <linux/cpumask.h> 33 + #include <linux/slab.h> 33 34 #include <linux/vmalloc.h> 34 35 #include <linux/mutex.h> 35 36 #include <linux/mm.h>
+8 -8
net/core/devlink.c
··· 4110 4110 return err; 4111 4111 } 4112 4112 4113 - if (info->attrs[DEVLINK_ATTR_NETNS_PID] || 4114 - info->attrs[DEVLINK_ATTR_NETNS_FD] || 4115 - info->attrs[DEVLINK_ATTR_NETNS_ID]) { 4116 - dest_net = devlink_netns_get(skb, info); 4117 - if (IS_ERR(dest_net)) 4118 - return PTR_ERR(dest_net); 4119 - } 4120 - 4121 4113 if (info->attrs[DEVLINK_ATTR_RELOAD_ACTION]) 4122 4114 action = nla_get_u8(info->attrs[DEVLINK_ATTR_RELOAD_ACTION]); 4123 4115 else ··· 4152 4160 return -EINVAL; 4153 4161 } 4154 4162 } 4163 + if (info->attrs[DEVLINK_ATTR_NETNS_PID] || 4164 + info->attrs[DEVLINK_ATTR_NETNS_FD] || 4165 + info->attrs[DEVLINK_ATTR_NETNS_ID]) { 4166 + dest_net = devlink_netns_get(skb, info); 4167 + if (IS_ERR(dest_net)) 4168 + return PTR_ERR(dest_net); 4169 + } 4170 + 4155 4171 err = devlink_reload(devlink, dest_net, action, limit, &actions_performed, info->extack); 4156 4172 4157 4173 if (dest_net)
+1 -2
net/core/neighbour.c
··· 763 763 764 764 ASSERT_RTNL(); 765 765 766 - n = kmalloc(sizeof(*n) + key_len, GFP_KERNEL); 766 + n = kzalloc(sizeof(*n) + key_len, GFP_KERNEL); 767 767 if (!n) 768 768 goto out; 769 769 770 - n->protocol = 0; 771 770 write_pnet(&n->net, net); 772 771 memcpy(n->key, pkey, key_len); 773 772 n->dev = dev;
+5
net/core/skmsg.c
··· 1124 1124 1125 1125 void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock) 1126 1126 { 1127 + psock_set_prog(&psock->progs.stream_parser, NULL); 1128 + 1127 1129 if (!psock->saved_data_ready) 1128 1130 return; 1129 1131 ··· 1214 1212 1215 1213 void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock) 1216 1214 { 1215 + psock_set_prog(&psock->progs.stream_verdict, NULL); 1216 + psock_set_prog(&psock->progs.skb_verdict, NULL); 1217 + 1217 1218 if (!psock->saved_data_ready) 1218 1219 return; 1219 1220
+10 -5
net/core/sock_map.c
··· 167 167 write_lock_bh(&sk->sk_callback_lock); 168 168 if (strp_stop) 169 169 sk_psock_stop_strp(sk, psock); 170 - else 170 + if (verdict_stop) 171 171 sk_psock_stop_verdict(sk, psock); 172 + 173 + if (psock->psock_update_sk_prot) 174 + psock->psock_update_sk_prot(sk, psock, false); 172 175 write_unlock_bh(&sk->sk_callback_lock); 173 176 } 174 177 } ··· 285 282 286 283 if (msg_parser) 287 284 psock_set_prog(&psock->progs.msg_parser, msg_parser); 285 + if (stream_parser) 286 + psock_set_prog(&psock->progs.stream_parser, stream_parser); 287 + if (stream_verdict) 288 + psock_set_prog(&psock->progs.stream_verdict, stream_verdict); 289 + if (skb_verdict) 290 + psock_set_prog(&psock->progs.skb_verdict, skb_verdict); 288 291 289 292 ret = sock_map_init_proto(sk, psock); 290 293 if (ret < 0) ··· 301 292 ret = sk_psock_init_strp(sk, psock); 302 293 if (ret) 303 294 goto out_unlock_drop; 304 - psock_set_prog(&psock->progs.stream_verdict, stream_verdict); 305 - psock_set_prog(&psock->progs.stream_parser, stream_parser); 306 295 sk_psock_start_strp(sk, psock); 307 296 } else if (!stream_parser && stream_verdict && !psock->saved_data_ready) { 308 - psock_set_prog(&psock->progs.stream_verdict, stream_verdict); 309 297 sk_psock_start_verdict(sk,psock); 310 298 } else if (!stream_verdict && skb_verdict && !psock->saved_data_ready) { 311 - psock_set_prog(&psock->progs.skb_verdict, skb_verdict); 312 299 sk_psock_start_verdict(sk, psock); 313 300 } 314 301 write_unlock_bh(&sk->sk_callback_lock);
+2 -1
net/ethtool/netlink.c
··· 40 40 if (dev->dev.parent) 41 41 pm_runtime_get_sync(dev->dev.parent); 42 42 43 - if (!netif_device_present(dev)) { 43 + if (!netif_device_present(dev) || 44 + dev->reg_state == NETREG_UNREGISTERING) { 44 45 ret = -ENODEV; 45 46 goto err; 46 47 }
+1 -1
net/ipv4/inet_connection_sock.c
··· 721 721 722 722 sk_node_init(&nreq_sk->sk_node); 723 723 nreq_sk->sk_tx_queue_mapping = req_sk->sk_tx_queue_mapping; 724 - #ifdef CONFIG_XPS 724 + #ifdef CONFIG_SOCK_RX_QUEUE_MAPPING 725 725 nreq_sk->sk_rx_queue_mapping = req_sk->sk_rx_queue_mapping; 726 726 #endif 727 727 nreq_sk->sk_incoming_cpu = req_sk->sk_incoming_cpu;
+2 -2
net/ipv4/tcp_minisocks.c
··· 829 829 int ret = 0; 830 830 int state = child->sk_state; 831 831 832 - /* record NAPI ID of child */ 833 - sk_mark_napi_id(child, skb); 832 + /* record sk_napi_id and sk_rx_queue_mapping of child. */ 833 + sk_mark_napi_id_set(child, skb); 834 834 835 835 tcp_segs_in(tcp_sk(child), skb); 836 836 if (!sock_owned_by_user(child)) {
+1 -1
net/ipv4/udp.c
··· 916 916 kfree_skb(skb); 917 917 return -EINVAL; 918 918 } 919 - if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) { 919 + if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) { 920 920 kfree_skb(skb); 921 921 return -EINVAL; 922 922 }
+8
net/ipv6/seg6_iptunnel.c
··· 161 161 hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb)); 162 162 163 163 memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); 164 + 165 + /* the control block has been erased, so we have to set the 166 + * iif once again. 167 + * We read the receiving interface index directly from the 168 + * skb->skb_iif as it is done in the IPv4 receiving path (i.e.: 169 + * ip_rcv_core(...)). 170 + */ 171 + IP6CB(skb)->iif = skb->skb_iif; 164 172 } 165 173 166 174 hdr->nexthdr = NEXTHDR_ROUTING;
+3 -3
net/netfilter/nf_conntrack_core.c
··· 684 684 685 685 tstamp = nf_conn_tstamp_find(ct); 686 686 if (tstamp) { 687 - s32 timeout = ct->timeout - nfct_time_stamp; 687 + s32 timeout = READ_ONCE(ct->timeout) - nfct_time_stamp; 688 688 689 689 tstamp->stop = ktime_get_real_ns(); 690 690 if (timeout < 0) ··· 1036 1036 } 1037 1037 1038 1038 /* We want the clashing entry to go away real soon: 1 second timeout. */ 1039 - loser_ct->timeout = nfct_time_stamp + HZ; 1039 + WRITE_ONCE(loser_ct->timeout, nfct_time_stamp + HZ); 1040 1040 1041 1041 /* IPS_NAT_CLASH removes the entry automatically on the first 1042 1042 * reply. Also prevents UDP tracker from moving the entry to ··· 1560 1560 /* save hash for reusing when confirming */ 1561 1561 *(unsigned long *)(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev) = hash; 1562 1562 ct->status = 0; 1563 - ct->timeout = 0; 1563 + WRITE_ONCE(ct->timeout, 0); 1564 1564 write_pnet(&ct->ct_net, net); 1565 1565 memset(&ct->__nfct_init_offset, 0, 1566 1566 offsetof(struct nf_conn, proto) -
+1 -1
net/netfilter/nf_conntrack_netlink.c
··· 1998 1998 1999 1999 if (timeout > INT_MAX) 2000 2000 timeout = INT_MAX; 2001 - ct->timeout = nfct_time_stamp + (u32)timeout; 2001 + WRITE_ONCE(ct->timeout, nfct_time_stamp + (u32)timeout); 2002 2002 2003 2003 if (test_bit(IPS_DYING_BIT, &ct->status)) 2004 2004 return -ETIME;
+2 -2
net/netfilter/nf_flow_table_core.c
··· 201 201 if (timeout < 0) 202 202 timeout = 0; 203 203 204 - if (nf_flow_timeout_delta(ct->timeout) > (__s32)timeout) 205 - ct->timeout = nfct_time_stamp + timeout; 204 + if (nf_flow_timeout_delta(READ_ONCE(ct->timeout)) > (__s32)timeout) 205 + WRITE_ONCE(ct->timeout, nfct_time_stamp + timeout); 206 206 } 207 207 208 208 static void flow_offload_fixup_ct_state(struct nf_conn *ct)
+7 -4
net/netfilter/nft_exthdr.c
··· 236 236 237 237 tcph = nft_tcp_header_pointer(pkt, sizeof(buff), buff, &tcphdr_len); 238 238 if (!tcph) 239 - return; 239 + goto err; 240 240 241 241 opt = (u8 *)tcph; 242 242 for (i = sizeof(*tcph); i < tcphdr_len - 1; i += optl) { ··· 251 251 continue; 252 252 253 253 if (i + optl > tcphdr_len || priv->len + priv->offset > optl) 254 - return; 254 + goto err; 255 255 256 256 if (skb_ensure_writable(pkt->skb, 257 257 nft_thoff(pkt) + i + priv->len)) 258 - return; 258 + goto err; 259 259 260 260 tcph = nft_tcp_header_pointer(pkt, sizeof(buff), buff, 261 261 &tcphdr_len); 262 262 if (!tcph) 263 - return; 263 + goto err; 264 264 265 265 offset = i + priv->offset; 266 266 ··· 303 303 304 304 return; 305 305 } 306 + return; 307 + err: 308 + regs->verdict.code = NFT_BREAK; 306 309 } 307 310 308 311 static void nft_exthdr_sctp_eval(const struct nft_expr *expr,
+1 -1
net/netfilter/nft_set_pipapo_avx2.c
··· 886 886 NFT_PIPAPO_AVX2_BUCKET_LOAD8(4, lt, 4, pkt[4], bsize); 887 887 888 888 NFT_PIPAPO_AVX2_AND(5, 0, 1); 889 - NFT_PIPAPO_AVX2_BUCKET_LOAD8(6, lt, 6, pkt[5], bsize); 889 + NFT_PIPAPO_AVX2_BUCKET_LOAD8(6, lt, 5, pkt[5], bsize); 890 890 NFT_PIPAPO_AVX2_AND(7, 2, 3); 891 891 892 892 /* Stall */
+8 -4
net/nfc/netlink.c
··· 636 636 { 637 637 struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; 638 638 639 - nfc_device_iter_exit(iter); 640 - kfree(iter); 639 + if (iter) { 640 + nfc_device_iter_exit(iter); 641 + kfree(iter); 642 + } 641 643 642 644 return 0; 643 645 } ··· 1394 1392 { 1395 1393 struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; 1396 1394 1397 - nfc_device_iter_exit(iter); 1398 - kfree(iter); 1395 + if (iter) { 1396 + nfc_device_iter_exit(iter); 1397 + kfree(iter); 1398 + } 1399 1399 1400 1400 return 0; 1401 1401 }
+1
net/sched/sch_fq_pie.c
··· 531 531 struct fq_pie_sched_data *q = qdisc_priv(sch); 532 532 533 533 tcf_block_put(q->block); 534 + q->p_params.tupdate = 0; 534 535 del_timer_sync(&q->adapt_timer); 535 536 kvfree(q->flows); 536 537 }
+1
samples/ftrace/Makefile
··· 4 4 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct-too.o 5 5 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct-modify.o 6 6 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT_MULTI) += ftrace-direct-multi.o 7 + obj-$(CONFIG_SAMPLE_FTRACE_DIRECT_MULTI) += ftrace-direct-multi-modify.o 7 8 8 9 CFLAGS_sample-trace-array.o := -I$(src) 9 10 obj-$(CONFIG_SAMPLE_TRACE_ARRAY) += sample-trace-array.o
+152
samples/ftrace/ftrace-direct-multi-modify.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include <linux/module.h> 3 + #include <linux/kthread.h> 4 + #include <linux/ftrace.h> 5 + #include <asm/asm-offsets.h> 6 + 7 + void my_direct_func1(unsigned long ip) 8 + { 9 + trace_printk("my direct func1 ip %lx\n", ip); 10 + } 11 + 12 + void my_direct_func2(unsigned long ip) 13 + { 14 + trace_printk("my direct func2 ip %lx\n", ip); 15 + } 16 + 17 + extern void my_tramp1(void *); 18 + extern void my_tramp2(void *); 19 + 20 + #ifdef CONFIG_X86_64 21 + 22 + asm ( 23 + " .pushsection .text, \"ax\", @progbits\n" 24 + " .type my_tramp1, @function\n" 25 + " .globl my_tramp1\n" 26 + " my_tramp1:" 27 + " pushq %rbp\n" 28 + " movq %rsp, %rbp\n" 29 + " pushq %rdi\n" 30 + " movq 8(%rbp), %rdi\n" 31 + " call my_direct_func1\n" 32 + " popq %rdi\n" 33 + " leave\n" 34 + " ret\n" 35 + " .size my_tramp1, .-my_tramp1\n" 36 + " .type my_tramp2, @function\n" 37 + "\n" 38 + " .globl my_tramp2\n" 39 + " my_tramp2:" 40 + " pushq %rbp\n" 41 + " movq %rsp, %rbp\n" 42 + " pushq %rdi\n" 43 + " movq 8(%rbp), %rdi\n" 44 + " call my_direct_func2\n" 45 + " popq %rdi\n" 46 + " leave\n" 47 + " ret\n" 48 + " .size my_tramp2, .-my_tramp2\n" 49 + " .popsection\n" 50 + ); 51 + 52 + #endif /* CONFIG_X86_64 */ 53 + 54 + #ifdef CONFIG_S390 55 + 56 + asm ( 57 + " .pushsection .text, \"ax\", @progbits\n" 58 + " .type my_tramp1, @function\n" 59 + " .globl my_tramp1\n" 60 + " my_tramp1:" 61 + " lgr %r1,%r15\n" 62 + " stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" 63 + " stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" 64 + " aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n" 65 + " stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n" 66 + " lgr %r2,%r0\n" 67 + " brasl %r14,my_direct_func1\n" 68 + " aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n" 69 + " lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" 70 + " lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" 71 + " lgr %r1,%r0\n" 72 + " br %r1\n" 73 + " .size my_tramp1, .-my_tramp1\n" 74 + "\n" 75 + " .type my_tramp2, @function\n" 76 + " .globl my_tramp2\n" 77 + " my_tramp2:" 78 + " lgr %r1,%r15\n" 79 + " stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" 80 + " stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" 81 + " aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n" 82 + " stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n" 83 + " lgr %r2,%r0\n" 84 + " brasl %r14,my_direct_func2\n" 85 + " aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n" 86 + " lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" 87 + " lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" 88 + " lgr %r1,%r0\n" 89 + " br %r1\n" 90 + " .size my_tramp2, .-my_tramp2\n" 91 + " .popsection\n" 92 + ); 93 + 94 + #endif /* CONFIG_S390 */ 95 + 96 + static unsigned long my_tramp = (unsigned long)my_tramp1; 97 + static unsigned long tramps[2] = { 98 + (unsigned long)my_tramp1, 99 + (unsigned long)my_tramp2, 100 + }; 101 + 102 + static struct ftrace_ops direct; 103 + 104 + static int simple_thread(void *arg) 105 + { 106 + static int t; 107 + int ret = 0; 108 + 109 + while (!kthread_should_stop()) { 110 + set_current_state(TASK_INTERRUPTIBLE); 111 + schedule_timeout(2 * HZ); 112 + 113 + if (ret) 114 + continue; 115 + t ^= 1; 116 + ret = modify_ftrace_direct_multi(&direct, tramps[t]); 117 + if (!ret) 118 + my_tramp = tramps[t]; 119 + WARN_ON_ONCE(ret); 120 + } 121 + 122 + return 0; 123 + } 124 + 125 + static struct task_struct *simple_tsk; 126 + 127 + static int __init ftrace_direct_multi_init(void) 128 + { 129 + int ret; 130 + 131 + ftrace_set_filter_ip(&direct, (unsigned long) wake_up_process, 0, 0); 132 + ftrace_set_filter_ip(&direct, (unsigned long) schedule, 0, 0); 133 + 134 + ret = register_ftrace_direct_multi(&direct, my_tramp); 135 + 136 + if (!ret) 137 + simple_tsk = kthread_run(simple_thread, NULL, "event-sample-fn"); 138 + return ret; 139 + } 140 + 141 + static void __exit ftrace_direct_multi_exit(void) 142 + { 143 + kthread_stop(simple_tsk); 144 + unregister_ftrace_direct_multi(&direct, my_tramp); 145 + } 146 + 147 + module_init(ftrace_direct_multi_init); 148 + module_exit(ftrace_direct_multi_exit); 149 + 150 + MODULE_AUTHOR("Jiri Olsa"); 151 + MODULE_DESCRIPTION("Example use case of using modify_ftrace_direct_multi()"); 152 + MODULE_LICENSE("GPL");
+3
sound/core/control_compat.c
··· 264 264 struct snd_ctl_elem_value *data, 265 265 int type, int count) 266 266 { 267 + struct snd_ctl_elem_value32 __user *data32 = userdata; 267 268 int i, size; 268 269 269 270 if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN || ··· 281 280 if (copy_to_user(valuep, data->value.bytes.data, size)) 282 281 return -EFAULT; 283 282 } 283 + if (copy_to_user(&data32->id, &data->id, sizeof(data32->id))) 284 + return -EFAULT; 284 285 return 0; 285 286 } 286 287
+25 -12
sound/core/oss/pcm_oss.c
··· 147 147 * 148 148 * Return the maximum value for field PAR. 149 149 */ 150 - static unsigned int 150 + static int 151 151 snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params, 152 152 snd_pcm_hw_param_t var, int *dir) 153 153 { ··· 682 682 struct snd_pcm_hw_params *oss_params, 683 683 struct snd_pcm_hw_params *slave_params) 684 684 { 685 - size_t s; 686 - size_t oss_buffer_size, oss_period_size, oss_periods; 687 - size_t min_period_size, max_period_size; 685 + ssize_t s; 686 + ssize_t oss_buffer_size; 687 + ssize_t oss_period_size, oss_periods; 688 + ssize_t min_period_size, max_period_size; 688 689 struct snd_pcm_runtime *runtime = substream->runtime; 689 690 size_t oss_frame_size; 690 691 691 692 oss_frame_size = snd_pcm_format_physical_width(params_format(oss_params)) * 692 693 params_channels(oss_params) / 8; 693 694 695 + oss_buffer_size = snd_pcm_hw_param_value_max(slave_params, 696 + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 697 + NULL); 698 + if (oss_buffer_size <= 0) 699 + return -EINVAL; 694 700 oss_buffer_size = snd_pcm_plug_client_size(substream, 695 - snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size; 696 - if (!oss_buffer_size) 701 + oss_buffer_size * oss_frame_size); 702 + if (oss_buffer_size <= 0) 697 703 return -EINVAL; 698 704 oss_buffer_size = rounddown_pow_of_two(oss_buffer_size); 699 705 if (atomic_read(&substream->mmap_count)) { ··· 736 730 737 731 min_period_size = snd_pcm_plug_client_size(substream, 738 732 snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); 739 - if (min_period_size) { 733 + if (min_period_size > 0) { 740 734 min_period_size *= oss_frame_size; 741 735 min_period_size = roundup_pow_of_two(min_period_size); 742 736 if (oss_period_size < min_period_size) ··· 745 739 746 740 max_period_size = snd_pcm_plug_client_size(substream, 747 741 snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); 748 - if (max_period_size) { 742 + if (max_period_size > 0) { 749 743 max_period_size *= oss_frame_size; 750 744 max_period_size = rounddown_pow_of_two(max_period_size); 751 745 if (oss_period_size > max_period_size) ··· 758 752 oss_periods = substream->oss.setup.periods; 759 753 760 754 s = snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIODS, NULL); 761 - if (runtime->oss.maxfrags && s > runtime->oss.maxfrags) 755 + if (s > 0 && runtime->oss.maxfrags && s > runtime->oss.maxfrags) 762 756 s = runtime->oss.maxfrags; 763 757 if (oss_periods > s) 764 758 oss_periods = s; ··· 884 878 err = -EINVAL; 885 879 goto failure; 886 880 } 887 - choose_rate(substream, sparams, runtime->oss.rate); 888 - snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL); 881 + 882 + err = choose_rate(substream, sparams, runtime->oss.rate); 883 + if (err < 0) 884 + goto failure; 885 + err = snd_pcm_hw_param_near(substream, sparams, 886 + SNDRV_PCM_HW_PARAM_CHANNELS, 887 + runtime->oss.channels, NULL); 888 + if (err < 0) 889 + goto failure; 889 890 890 891 format = snd_pcm_oss_format_from(runtime->oss.format); 891 892 ··· 1969 1956 if (runtime->oss.subdivision || runtime->oss.fragshift) 1970 1957 return -EINVAL; 1971 1958 fragshift = val & 0xffff; 1972 - if (fragshift >= 31) 1959 + if (fragshift >= 25) /* should be large enough */ 1973 1960 return -EINVAL; 1974 1961 runtime->oss.fragshift = fragshift; 1975 1962 runtime->oss.maxfrags = (val >> 16) & 0xffff;
+62 -18
sound/pci/hda/patch_realtek.c
··· 6503 6503 /* for alc285_fixup_ideapad_s740_coef() */ 6504 6504 #include "ideapad_s740_helper.c" 6505 6505 6506 - static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, 6507 - const struct hda_fixup *fix, 6508 - int action) 6506 + static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = { 6507 + WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000), 6508 + WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000), 6509 + WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089), 6510 + {} 6511 + }; 6512 + 6513 + static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, 6514 + const struct hda_fixup *fix, 6515 + int action) 6509 6516 { 6510 6517 /* 6511 - * A certain other OS sets these coeffs to different values. On at least one TongFang 6512 - * barebone these settings might survive even a cold reboot. So to restore a clean slate the 6513 - * values are explicitly reset to default here. Without this, the external microphone is 6514 - * always in a plugged-in state, while the internal microphone is always in an unplugged 6515 - * state, breaking the ability to use the internal microphone. 6516 - */ 6517 - alc_write_coef_idx(codec, 0x24, 0x0000); 6518 - alc_write_coef_idx(codec, 0x26, 0x0000); 6519 - alc_write_coef_idx(codec, 0x29, 0x3000); 6520 - alc_write_coef_idx(codec, 0x37, 0xfe05); 6521 - alc_write_coef_idx(codec, 0x45, 0x5089); 6518 + * A certain other OS sets these coeffs to different values. On at least 6519 + * one TongFang barebone these settings might survive even a cold 6520 + * reboot. So to restore a clean slate the values are explicitly reset 6521 + * to default here. Without this, the external microphone is always in a 6522 + * plugged-in state, while the internal microphone is always in an 6523 + * unplugged state, breaking the ability to use the internal microphone. 6524 + */ 6525 + alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); 6522 6526 } 6523 6527 6524 6528 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = { ··· 6763 6759 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, 6764 6760 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, 6765 6761 ALC287_FIXUP_13S_GEN2_SPEAKERS, 6766 - ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS, 6762 + ALC256_FIXUP_SET_COEF_DEFAULTS, 6767 6763 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, 6768 6764 ALC233_FIXUP_NO_AUDIO_JACK, 6769 6765 }; ··· 8469 8465 .chained = true, 8470 8466 .chain_id = ALC269_FIXUP_HEADSET_MODE, 8471 8467 }, 8472 - [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = { 8468 + [ALC256_FIXUP_SET_COEF_DEFAULTS] = { 8473 8469 .type = HDA_FIXUP_FUNC, 8474 - .v.func = alc256_fixup_tongfang_reset_persistent_settings, 8470 + .v.func = alc256_fixup_set_coef_defaults, 8475 8471 }, 8476 8472 [ALC245_FIXUP_HP_GPIO_LED] = { 8477 8473 .type = HDA_FIXUP_FUNC, ··· 8933 8929 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ 8934 8930 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), 8935 8931 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), 8936 - SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS), 8932 + SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS), 8937 8933 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), 8938 8934 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), 8939 8935 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), ··· 10235 10231 } 10236 10232 } 10237 10233 10234 + static void alc897_hp_automute_hook(struct hda_codec *codec, 10235 + struct hda_jack_callback *jack) 10236 + { 10237 + struct alc_spec *spec = codec->spec; 10238 + int vref; 10239 + 10240 + snd_hda_gen_hp_automute(codec, jack); 10241 + vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; 10242 + snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 10243 + vref); 10244 + } 10245 + 10246 + static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, 10247 + const struct hda_fixup *fix, int action) 10248 + { 10249 + struct alc_spec *spec = codec->spec; 10250 + if (action == HDA_FIXUP_ACT_PRE_PROBE) { 10251 + spec->gen.hp_automute_hook = alc897_hp_automute_hook; 10252 + } 10253 + } 10254 + 10238 10255 static const struct coef_fw alc668_coefs[] = { 10239 10256 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), 10240 10257 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), ··· 10336 10311 ALC668_FIXUP_ASUS_NO_HEADSET_MIC, 10337 10312 ALC668_FIXUP_HEADSET_MIC, 10338 10313 ALC668_FIXUP_MIC_DET_COEF, 10314 + ALC897_FIXUP_LENOVO_HEADSET_MIC, 10315 + ALC897_FIXUP_HEADSET_MIC_PIN, 10339 10316 }; 10340 10317 10341 10318 static const struct hda_fixup alc662_fixups[] = { ··· 10744 10717 {} 10745 10718 }, 10746 10719 }, 10720 + [ALC897_FIXUP_LENOVO_HEADSET_MIC] = { 10721 + .type = HDA_FIXUP_FUNC, 10722 + .v.func = alc897_fixup_lenovo_headset_mic, 10723 + }, 10724 + [ALC897_FIXUP_HEADSET_MIC_PIN] = { 10725 + .type = HDA_FIXUP_PINS, 10726 + .v.pins = (const struct hda_pintbl[]) { 10727 + { 0x1a, 0x03a11050 }, 10728 + { } 10729 + }, 10730 + .chained = true, 10731 + .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC 10732 + }, 10747 10733 }; 10748 10734 10749 10735 static const struct snd_pci_quirk alc662_fixup_tbl[] = { ··· 10801 10761 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 10802 10762 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE), 10803 10763 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS), 10764 + SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN), 10765 + SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN), 10766 + SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN), 10767 + SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN), 10804 10768 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 10805 10769 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 10806 10770 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
+2 -1
sound/soc/amd/yc/pci-acp6x.c
··· 146 146 { 147 147 struct acp6x_dev_data *adata; 148 148 struct platform_device_info pdevinfo[ACP6x_DEVS]; 149 - int ret, index; 149 + int index = 0; 150 150 int val = 0x00; 151 151 u32 addr; 152 152 unsigned int irqflags; 153 + int ret; 153 154 154 155 irqflags = IRQF_SHARED; 155 156 /* Yellow Carp device check */
+6 -4
sound/soc/codecs/rt5682.c
··· 2858 2858 2859 2859 for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) { 2860 2860 struct clk_init_data init = { }; 2861 + struct clk_parent_data parent_data; 2862 + const struct clk_hw *parent; 2861 2863 2862 2864 dai_clk_hw = &rt5682->dai_clks_hw[i]; 2863 2865 ··· 2867 2865 case RT5682_DAI_WCLK_IDX: 2868 2866 /* Make MCLK the parent of WCLK */ 2869 2867 if (rt5682->mclk) { 2870 - init.parent_data = &(struct clk_parent_data){ 2868 + parent_data = (struct clk_parent_data){ 2871 2869 .fw_name = "mclk", 2872 2870 }; 2871 + init.parent_data = &parent_data; 2873 2872 init.num_parents = 1; 2874 2873 } 2875 2874 break; 2876 2875 case RT5682_DAI_BCLK_IDX: 2877 2876 /* Make WCLK the parent of BCLK */ 2878 - init.parent_hws = &(const struct clk_hw *){ 2879 - &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX] 2880 - }; 2877 + parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]; 2878 + init.parent_hws = &parent; 2881 2879 init.num_parents = 1; 2882 2880 break; 2883 2881 default:
+6 -4
sound/soc/codecs/rt5682s.c
··· 2693 2693 2694 2694 for (i = 0; i < RT5682S_DAI_NUM_CLKS; ++i) { 2695 2695 struct clk_init_data init = { }; 2696 + struct clk_parent_data parent_data; 2697 + const struct clk_hw *parent; 2696 2698 2697 2699 dai_clk_hw = &rt5682s->dai_clks_hw[i]; 2698 2700 ··· 2702 2700 case RT5682S_DAI_WCLK_IDX: 2703 2701 /* Make MCLK the parent of WCLK */ 2704 2702 if (rt5682s->mclk) { 2705 - init.parent_data = &(struct clk_parent_data){ 2703 + parent_data = (struct clk_parent_data){ 2706 2704 .fw_name = "mclk", 2707 2705 }; 2706 + init.parent_data = &parent_data; 2708 2707 init.num_parents = 1; 2709 2708 } 2710 2709 break; 2711 2710 case RT5682S_DAI_BCLK_IDX: 2712 2711 /* Make WCLK the parent of BCLK */ 2713 - init.parent_hws = &(const struct clk_hw *){ 2714 - &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX] 2715 - }; 2712 + parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]; 2713 + init.parent_hws = &parent; 2716 2714 init.num_parents = 1; 2717 2715 break; 2718 2716 default:
+93 -33
sound/soc/codecs/wcd934x.c
··· 3256 3256 int value = ucontrol->value.integer.value[0]; 3257 3257 int sel; 3258 3258 3259 + if (wcd->comp_enabled[comp] == value) 3260 + return 0; 3261 + 3259 3262 wcd->comp_enabled[comp] = value; 3260 3263 sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER : 3261 3264 WCD934X_HPH_GAIN_SRC_SEL_REGISTER; ··· 3282 3279 case COMPANDER_8: 3283 3280 break; 3284 3281 default: 3285 - break; 3282 + return 0; 3286 3283 } 3287 3284 3288 - return 0; 3285 + return 1; 3289 3286 } 3290 3287 3291 3288 static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc, ··· 3329 3326 return 0; 3330 3327 } 3331 3328 3329 + static int slim_rx_mux_to_dai_id(int mux) 3330 + { 3331 + int aif_id; 3332 + 3333 + switch (mux) { 3334 + case 1: 3335 + aif_id = AIF1_PB; 3336 + break; 3337 + case 2: 3338 + aif_id = AIF2_PB; 3339 + break; 3340 + case 3: 3341 + aif_id = AIF3_PB; 3342 + break; 3343 + case 4: 3344 + aif_id = AIF4_PB; 3345 + break; 3346 + default: 3347 + aif_id = -1; 3348 + break; 3349 + } 3350 + 3351 + return aif_id; 3352 + } 3353 + 3332 3354 static int slim_rx_mux_put(struct snd_kcontrol *kc, 3333 3355 struct snd_ctl_elem_value *ucontrol) 3334 3356 { ··· 3361 3333 struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev); 3362 3334 struct soc_enum *e = (struct soc_enum *)kc->private_value; 3363 3335 struct snd_soc_dapm_update *update = NULL; 3336 + struct wcd934x_slim_ch *ch, *c; 3364 3337 u32 port_id = w->shift; 3338 + bool found = false; 3339 + int mux_idx; 3340 + int prev_mux_idx = wcd->rx_port_value[port_id]; 3341 + int aif_id; 3365 3342 3366 - if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0]) 3343 + mux_idx = ucontrol->value.enumerated.item[0]; 3344 + 3345 + if (mux_idx == prev_mux_idx) 3367 3346 return 0; 3368 3347 3369 - wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; 3370 - 3371 - switch (wcd->rx_port_value[port_id]) { 3348 + switch(mux_idx) { 3372 3349 case 0: 3373 - list_del_init(&wcd->rx_chs[port_id].list); 3350 + aif_id = slim_rx_mux_to_dai_id(prev_mux_idx); 3351 + if (aif_id < 0) 3352 + return 0; 3353 + 3354 + list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) { 3355 + if (ch->port == port_id + WCD934X_RX_START) { 3356 + found = true; 3357 + list_del_init(&ch->list); 3358 + break; 3359 + } 3360 + } 3361 + if (!found) 3362 + return 0; 3363 + 3374 3364 break; 3375 - case 1: 3376 - list_add_tail(&wcd->rx_chs[port_id].list, 3377 - &wcd->dai[AIF1_PB].slim_ch_list); 3365 + case 1 ... 4: 3366 + aif_id = slim_rx_mux_to_dai_id(mux_idx); 3367 + if (aif_id < 0) 3368 + return 0; 3369 + 3370 + if (list_empty(&wcd->rx_chs[port_id].list)) { 3371 + list_add_tail(&wcd->rx_chs[port_id].list, 3372 + &wcd->dai[aif_id].slim_ch_list); 3373 + } else { 3374 + dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id); 3375 + return 0; 3376 + } 3378 3377 break; 3379 - case 2: 3380 - list_add_tail(&wcd->rx_chs[port_id].list, 3381 - &wcd->dai[AIF2_PB].slim_ch_list); 3382 - break; 3383 - case 3: 3384 - list_add_tail(&wcd->rx_chs[port_id].list, 3385 - &wcd->dai[AIF3_PB].slim_ch_list); 3386 - break; 3387 - case 4: 3388 - list_add_tail(&wcd->rx_chs[port_id].list, 3389 - &wcd->dai[AIF4_PB].slim_ch_list); 3390 - break; 3378 + 3391 3379 default: 3392 - dev_err(wcd->dev, "Unknown AIF %d\n", 3393 - wcd->rx_port_value[port_id]); 3380 + dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx); 3394 3381 goto err; 3395 3382 } 3396 3383 3384 + wcd->rx_port_value[port_id] = mux_idx; 3397 3385 snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id], 3398 3386 e, update); 3399 3387 3400 - return 0; 3388 + return 1; 3401 3389 err: 3402 3390 return -EINVAL; 3403 3391 } ··· 3859 3815 struct soc_mixer_control *mixer = 3860 3816 (struct soc_mixer_control *)kc->private_value; 3861 3817 int enable = ucontrol->value.integer.value[0]; 3818 + struct wcd934x_slim_ch *ch, *c; 3862 3819 int dai_id = widget->shift; 3863 3820 int port_id = mixer->shift; 3864 3821 ··· 3867 3822 if (enable == wcd->tx_port_value[port_id]) 3868 3823 return 0; 3869 3824 3825 + if (enable) { 3826 + if (list_empty(&wcd->tx_chs[port_id].list)) { 3827 + list_add_tail(&wcd->tx_chs[port_id].list, 3828 + &wcd->dai[dai_id].slim_ch_list); 3829 + } else { 3830 + dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id); 3831 + return 0; 3832 + } 3833 + } else { 3834 + bool found = false; 3835 + 3836 + list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) { 3837 + if (ch->port == port_id) { 3838 + found = true; 3839 + list_del_init(&wcd->tx_chs[port_id].list); 3840 + break; 3841 + } 3842 + } 3843 + if (!found) 3844 + return 0; 3845 + } 3846 + 3870 3847 wcd->tx_port_value[port_id] = enable; 3871 - 3872 - if (enable) 3873 - list_add_tail(&wcd->tx_chs[port_id].list, 3874 - &wcd->dai[dai_id].slim_ch_list); 3875 - else 3876 - list_del_init(&wcd->tx_chs[port_id].list); 3877 - 3878 3848 snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update); 3879 3849 3880 - return 0; 3850 + return 1; 3881 3851 } 3882 3852 3883 3853 static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = {
+12 -4
sound/soc/codecs/wsa881x.c
··· 772 772 773 773 usleep_range(1000, 1010); 774 774 } 775 - return 0; 775 + 776 + return 1; 776 777 } 777 778 778 779 static int wsa881x_get_port(struct snd_kcontrol *kcontrol, ··· 817 816 (struct soc_mixer_control *)kcontrol->private_value; 818 817 int portidx = mixer->reg; 819 818 820 - if (ucontrol->value.integer.value[0]) 819 + if (ucontrol->value.integer.value[0]) { 820 + if (data->port_enable[portidx]) 821 + return 0; 822 + 821 823 data->port_enable[portidx] = true; 822 - else 824 + } else { 825 + if (!data->port_enable[portidx]) 826 + return 0; 827 + 823 828 data->port_enable[portidx] = false; 829 + } 824 830 825 831 if (portidx == WSA881X_PORT_BOOST) /* Boost Switch */ 826 832 wsa881x_boost_ctrl(comp, data->port_enable[portidx]); 827 833 828 - return 0; 834 + return 1; 829 835 } 830 836 831 837 static const char * const smart_boost_lvl_text[] = {
+5 -3
sound/soc/qcom/qdsp6/q6routing.c
··· 498 498 struct session_data *session = &data->sessions[session_id]; 499 499 500 500 if (ucontrol->value.integer.value[0]) { 501 + if (session->port_id == be_id) 502 + return 0; 503 + 501 504 session->port_id = be_id; 502 505 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update); 503 506 } else { 504 - if (session->port_id == be_id) { 505 - session->port_id = -1; 507 + if (session->port_id == -1 || session->port_id != be_id) 506 508 return 0; 507 - } 508 509 510 + session->port_id = -1; 509 511 snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update); 510 512 } 511 513
+31 -21
sound/soc/rockchip/rockchip_i2s_tdm.c
··· 95 95 spinlock_t lock; /* xfer lock */ 96 96 bool has_playback; 97 97 bool has_capture; 98 + struct snd_soc_dai_driver *dai; 98 99 }; 99 100 100 101 static int to_ch_num(unsigned int val) ··· 1311 1310 {}, 1312 1311 }; 1313 1312 1314 - static struct snd_soc_dai_driver i2s_tdm_dai = { 1313 + static const struct snd_soc_dai_driver i2s_tdm_dai = { 1315 1314 .probe = rockchip_i2s_tdm_dai_probe, 1316 - .playback = { 1317 - .stream_name = "Playback", 1318 - }, 1319 - .capture = { 1320 - .stream_name = "Capture", 1321 - }, 1322 1315 .ops = &rockchip_i2s_tdm_dai_ops, 1323 1316 }; 1324 1317 1325 - static void rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm) 1318 + static int rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm) 1326 1319 { 1320 + struct snd_soc_dai_driver *dai; 1327 1321 struct property *dma_names; 1328 1322 const char *dma_name; 1329 1323 u64 formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | ··· 1333 1337 i2s_tdm->has_capture = true; 1334 1338 } 1335 1339 1340 + dai = devm_kmemdup(i2s_tdm->dev, &i2s_tdm_dai, 1341 + sizeof(*dai), GFP_KERNEL); 1342 + if (!dai) 1343 + return -ENOMEM; 1344 + 1336 1345 if (i2s_tdm->has_playback) { 1337 - i2s_tdm_dai.playback.channels_min = 2; 1338 - i2s_tdm_dai.playback.channels_max = 8; 1339 - i2s_tdm_dai.playback.rates = SNDRV_PCM_RATE_8000_192000; 1340 - i2s_tdm_dai.playback.formats = formats; 1346 + dai->playback.stream_name = "Playback"; 1347 + dai->playback.channels_min = 2; 1348 + dai->playback.channels_max = 8; 1349 + dai->playback.rates = SNDRV_PCM_RATE_8000_192000; 1350 + dai->playback.formats = formats; 1341 1351 } 1342 1352 1343 1353 if (i2s_tdm->has_capture) { 1344 - i2s_tdm_dai.capture.channels_min = 2; 1345 - i2s_tdm_dai.capture.channels_max = 8; 1346 - i2s_tdm_dai.capture.rates = SNDRV_PCM_RATE_8000_192000; 1347 - i2s_tdm_dai.capture.formats = formats; 1354 + dai->capture.stream_name = "Capture"; 1355 + dai->capture.channels_min = 2; 1356 + dai->capture.channels_max = 8; 1357 + dai->capture.rates = SNDRV_PCM_RATE_8000_192000; 1358 + dai->capture.formats = formats; 1348 1359 } 1360 + 1361 + if (i2s_tdm->clk_trcm != TRCM_TXRX) 1362 + dai->symmetric_rate = 1; 1363 + 1364 + i2s_tdm->dai = dai; 1365 + 1366 + return 0; 1349 1367 } 1350 1368 1351 1369 static int rockchip_i2s_tdm_path_check(struct rk_i2s_tdm_dev *i2s_tdm, ··· 1551 1541 spin_lock_init(&i2s_tdm->lock); 1552 1542 i2s_tdm->soc_data = (struct rk_i2s_soc_data *)of_id->data; 1553 1543 1554 - rockchip_i2s_tdm_init_dai(i2s_tdm); 1555 - 1556 1544 i2s_tdm->frame_width = 64; 1557 1545 1558 1546 i2s_tdm->clk_trcm = TRCM_TXRX; ··· 1563 1555 } 1564 1556 i2s_tdm->clk_trcm = TRCM_RX; 1565 1557 } 1566 - if (i2s_tdm->clk_trcm != TRCM_TXRX) 1567 - i2s_tdm_dai.symmetric_rate = 1; 1558 + 1559 + ret = rockchip_i2s_tdm_init_dai(i2s_tdm); 1560 + if (ret) 1561 + return ret; 1568 1562 1569 1563 i2s_tdm->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf"); 1570 1564 if (IS_ERR(i2s_tdm->grf)) ··· 1688 1678 1689 1679 ret = devm_snd_soc_register_component(&pdev->dev, 1690 1680 &rockchip_i2s_tdm_component, 1691 - &i2s_tdm_dai, 1); 1681 + i2s_tdm->dai, 1); 1692 1682 1693 1683 if (ret) { 1694 1684 dev_err(&pdev->dev, "Could not register DAI\n");
+9 -5
sound/soc/sof/intel/hda-codec.c
··· 22 22 23 23 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) 24 24 #define IDISP_VID_INTEL 0x80860000 25 + #define CODEC_PROBE_RETRIES 3 25 26 26 27 /* load the legacy HDA codec driver */ 27 28 static int request_codec_module(struct hda_codec *codec) ··· 122 121 u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) | 123 122 (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; 124 123 u32 resp = -1; 125 - int ret; 124 + int ret, retry = 0; 126 125 127 - mutex_lock(&hbus->core.cmd_mutex); 128 - snd_hdac_bus_send_cmd(&hbus->core, hda_cmd); 129 - snd_hdac_bus_get_response(&hbus->core, address, &resp); 130 - mutex_unlock(&hbus->core.cmd_mutex); 126 + do { 127 + mutex_lock(&hbus->core.cmd_mutex); 128 + snd_hdac_bus_send_cmd(&hbus->core, hda_cmd); 129 + snd_hdac_bus_get_response(&hbus->core, address, &resp); 130 + mutex_unlock(&hbus->core.cmd_mutex); 131 + } while (resp == -1 && retry++ < CODEC_PROBE_RETRIES); 132 + 131 133 if (resp == -1) 132 134 return -EIO; 133 135 dev_dbg(sdev->dev, "HDA codec #%d probed OK: response: %x\n",
+2 -2
sound/soc/tegra/tegra210_adx.c
··· 514 514 static const struct dev_pm_ops tegra210_adx_pm_ops = { 515 515 SET_RUNTIME_PM_OPS(tegra210_adx_runtime_suspend, 516 516 tegra210_adx_runtime_resume, NULL) 517 - SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 518 - pm_runtime_force_resume) 517 + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 518 + pm_runtime_force_resume) 519 519 }; 520 520 521 521 static struct platform_driver tegra210_adx_driver = {
+2 -2
sound/soc/tegra/tegra210_amx.c
··· 583 583 static const struct dev_pm_ops tegra210_amx_pm_ops = { 584 584 SET_RUNTIME_PM_OPS(tegra210_amx_runtime_suspend, 585 585 tegra210_amx_runtime_resume, NULL) 586 - SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 587 - pm_runtime_force_resume) 586 + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 587 + pm_runtime_force_resume) 588 588 }; 589 589 590 590 static struct platform_driver tegra210_amx_driver = {
+2 -2
sound/soc/tegra/tegra210_mixer.c
··· 666 666 static const struct dev_pm_ops tegra210_mixer_pm_ops = { 667 667 SET_RUNTIME_PM_OPS(tegra210_mixer_runtime_suspend, 668 668 tegra210_mixer_runtime_resume, NULL) 669 - SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 670 - pm_runtime_force_resume) 669 + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 670 + pm_runtime_force_resume) 671 671 }; 672 672 673 673 static struct platform_driver tegra210_mixer_driver = {
+4 -4
sound/soc/tegra/tegra210_mvc.c
··· 164 164 if (err < 0) 165 165 goto end; 166 166 167 - return 1; 167 + err = 1; 168 168 169 169 end: 170 170 pm_runtime_put(cmpnt->dev); ··· 236 236 TEGRA210_MVC_VOLUME_SWITCH_MASK, 237 237 TEGRA210_MVC_VOLUME_SWITCH_TRIGGER); 238 238 239 - return 1; 239 + err = 1; 240 240 241 241 end: 242 242 pm_runtime_put(cmpnt->dev); ··· 639 639 static const struct dev_pm_ops tegra210_mvc_pm_ops = { 640 640 SET_RUNTIME_PM_OPS(tegra210_mvc_runtime_suspend, 641 641 tegra210_mvc_runtime_resume, NULL) 642 - SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 643 - pm_runtime_force_resume) 642 + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 643 + pm_runtime_force_resume) 644 644 }; 645 645 646 646 static struct platform_driver tegra210_mvc_driver = {
+2 -2
sound/soc/tegra/tegra210_sfc.c
··· 3594 3594 static const struct dev_pm_ops tegra210_sfc_pm_ops = { 3595 3595 SET_RUNTIME_PM_OPS(tegra210_sfc_runtime_suspend, 3596 3596 tegra210_sfc_runtime_resume, NULL) 3597 - SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 3598 - pm_runtime_force_resume) 3597 + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 3598 + pm_runtime_force_resume) 3599 3599 }; 3600 3600 3601 3601 static struct platform_driver tegra210_sfc_driver = {
+5 -5
sound/usb/mixer_quirks.c
··· 3016 3016 3017 3017 3018 3018 static const struct snd_djm_device snd_djm_devices[] = { 3019 - SND_DJM_DEVICE(250mk2), 3020 - SND_DJM_DEVICE(750), 3021 - SND_DJM_DEVICE(750mk2), 3022 - SND_DJM_DEVICE(850), 3023 - SND_DJM_DEVICE(900nxs2) 3019 + [SND_DJM_250MK2_IDX] = SND_DJM_DEVICE(250mk2), 3020 + [SND_DJM_750_IDX] = SND_DJM_DEVICE(750), 3021 + [SND_DJM_850_IDX] = SND_DJM_DEVICE(850), 3022 + [SND_DJM_900NXS2_IDX] = SND_DJM_DEVICE(900nxs2), 3023 + [SND_DJM_750MK2_IDX] = SND_DJM_DEVICE(750mk2), 3024 3024 }; 3025 3025 3026 3026
+5 -3
tools/bpf/resolve_btfids/main.c
··· 83 83 int cnt; 84 84 }; 85 85 int addr_cnt; 86 + bool is_set; 86 87 Elf64_Addr addr[ADDR_CNT]; 87 88 }; 88 89 ··· 452 451 * in symbol's size, together with 'cnt' field hence 453 452 * that - 1. 454 453 */ 455 - if (id) 454 + if (id) { 456 455 id->cnt = sym.st_size / sizeof(int) - 1; 456 + id->is_set = true; 457 + } 457 458 } else { 458 459 pr_err("FAILED unsupported prefix %s\n", prefix); 459 460 return -1; ··· 571 568 int *ptr = data->d_buf; 572 569 int i; 573 570 574 - if (!id->id) { 571 + if (!id->id && !id->is_set) 575 572 pr_err("WARN: resolve_btfids: unresolved symbol %s\n", id->name); 576 - } 577 573 578 574 for (i = 0; i < id->addr_cnt; i++) { 579 575 unsigned long addr = id->addr[i];
-1
tools/build/Makefile.feature
··· 48 48 numa_num_possible_cpus \ 49 49 libperl \ 50 50 libpython \ 51 - libpython-version \ 52 51 libslang \ 53 52 libslang-include-subdir \ 54 53 libtraceevent \
-4
tools/build/feature/Makefile
··· 32 32 test-numa_num_possible_cpus.bin \ 33 33 test-libperl.bin \ 34 34 test-libpython.bin \ 35 - test-libpython-version.bin \ 36 35 test-libslang.bin \ 37 36 test-libslang-include-subdir.bin \ 38 37 test-libtraceevent.bin \ ··· 225 226 226 227 $(OUTPUT)test-libpython.bin: 227 228 $(BUILD) $(FLAGS_PYTHON_EMBED) 228 - 229 - $(OUTPUT)test-libpython-version.bin: 230 - $(BUILD) 231 229 232 230 $(OUTPUT)test-libbfd.bin: 233 231 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
-5
tools/build/feature/test-all.c
··· 14 14 # include "test-libpython.c" 15 15 #undef main 16 16 17 - #define main main_test_libpython_version 18 - # include "test-libpython-version.c" 19 - #undef main 20 - 21 17 #define main main_test_libperl 22 18 # include "test-libperl.c" 23 19 #undef main ··· 173 177 int main(int argc, char *argv[]) 174 178 { 175 179 main_test_libpython(); 176 - main_test_libpython_version(); 177 180 main_test_libperl(); 178 181 main_test_hello(); 179 182 main_test_libelf();
-11
tools/build/feature/test-libpython-version.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <Python.h> 3 - 4 - #if PY_VERSION_HEX >= 0x03000000 5 - #error 6 - #endif 7 - 8 - int main(void) 9 - { 10 - return 0; 11 - }
-14
tools/include/linux/debug_locks.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LIBLOCKDEP_DEBUG_LOCKS_H_ 3 - #define _LIBLOCKDEP_DEBUG_LOCKS_H_ 4 - 5 - #include <stddef.h> 6 - #include <linux/compiler.h> 7 - #include <asm/bug.h> 8 - 9 - #define DEBUG_LOCKS_WARN_ON(x) WARN_ON(x) 10 - 11 - extern bool debug_locks; 12 - extern bool debug_locks_silent; 13 - 14 - #endif
-12
tools/include/linux/hardirq.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LIBLOCKDEP_LINUX_HARDIRQ_H_ 3 - #define _LIBLOCKDEP_LINUX_HARDIRQ_H_ 4 - 5 - #define SOFTIRQ_BITS 0UL 6 - #define HARDIRQ_BITS 0UL 7 - #define SOFTIRQ_SHIFT 0UL 8 - #define HARDIRQ_SHIFT 0UL 9 - #define hardirq_count() 0UL 10 - #define softirq_count() 0UL 11 - 12 - #endif
-39
tools/include/linux/irqflags.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ 3 - #define _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ 4 - 5 - # define lockdep_hardirq_context() 0 6 - # define lockdep_softirq_context(p) 0 7 - # define lockdep_hardirqs_enabled() 0 8 - # define lockdep_softirqs_enabled(p) 0 9 - # define lockdep_hardirq_enter() do { } while (0) 10 - # define lockdep_hardirq_exit() do { } while (0) 11 - # define lockdep_softirq_enter() do { } while (0) 12 - # define lockdep_softirq_exit() do { } while (0) 13 - # define INIT_TRACE_IRQFLAGS 14 - 15 - # define stop_critical_timings() do { } while (0) 16 - # define start_critical_timings() do { } while (0) 17 - 18 - #define raw_local_irq_disable() do { } while (0) 19 - #define raw_local_irq_enable() do { } while (0) 20 - #define raw_local_irq_save(flags) ((flags) = 0) 21 - #define raw_local_irq_restore(flags) ((void)(flags)) 22 - #define raw_local_save_flags(flags) ((flags) = 0) 23 - #define raw_irqs_disabled_flags(flags) ((void)(flags)) 24 - #define raw_irqs_disabled() 0 25 - #define raw_safe_halt() 26 - 27 - #define local_irq_enable() do { } while (0) 28 - #define local_irq_disable() do { } while (0) 29 - #define local_irq_save(flags) ((flags) = 0) 30 - #define local_irq_restore(flags) ((void)(flags)) 31 - #define local_save_flags(flags) ((flags) = 0) 32 - #define irqs_disabled() (1) 33 - #define irqs_disabled_flags(flags) ((void)(flags), 0) 34 - #define safe_halt() do { } while (0) 35 - 36 - #define trace_lock_release(x, y) 37 - #define trace_lock_acquire(a, b, c, d, e, f, g) 38 - 39 - #endif
-72
tools/include/linux/lockdep.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LIBLOCKDEP_LOCKDEP_H_ 3 - #define _LIBLOCKDEP_LOCKDEP_H_ 4 - 5 - #include <sys/prctl.h> 6 - #include <sys/syscall.h> 7 - #include <string.h> 8 - #include <limits.h> 9 - #include <linux/utsname.h> 10 - #include <linux/compiler.h> 11 - #include <linux/export.h> 12 - #include <linux/kern_levels.h> 13 - #include <linux/err.h> 14 - #include <linux/rcu.h> 15 - #include <linux/list.h> 16 - #include <linux/hardirq.h> 17 - #include <unistd.h> 18 - 19 - #define MAX_LOCK_DEPTH 63UL 20 - 21 - #define asmlinkage 22 - #define __visible 23 - 24 - #include "../../../include/linux/lockdep.h" 25 - 26 - struct task_struct { 27 - u64 curr_chain_key; 28 - int lockdep_depth; 29 - unsigned int lockdep_recursion; 30 - struct held_lock held_locks[MAX_LOCK_DEPTH]; 31 - gfp_t lockdep_reclaim_gfp; 32 - int pid; 33 - int state; 34 - char comm[17]; 35 - }; 36 - 37 - #define TASK_RUNNING 0 38 - 39 - extern struct task_struct *__curr(void); 40 - 41 - #define current (__curr()) 42 - 43 - static inline int debug_locks_off(void) 44 - { 45 - return 1; 46 - } 47 - 48 - #define task_pid_nr(tsk) ((tsk)->pid) 49 - 50 - #define KSYM_NAME_LEN 128 51 - #define printk(...) dprintf(STDOUT_FILENO, __VA_ARGS__) 52 - #define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__) 53 - #define pr_warn pr_err 54 - #define pr_cont pr_err 55 - 56 - #define list_del_rcu list_del 57 - 58 - #define atomic_t unsigned long 59 - #define atomic_inc(x) ((*(x))++) 60 - 61 - #define print_tainted() "" 62 - #define static_obj(x) 1 63 - 64 - #define debug_show_all_locks() 65 - extern void debug_check_no_locks_held(void); 66 - 67 - static __used bool __is_kernel_percpu_address(unsigned long addr, void *can_addr) 68 - { 69 - return false; 70 - } 71 - 72 - #endif
-4
tools/include/linux/proc_fs.h
··· 1 - #ifndef _TOOLS_INCLUDE_LINUX_PROC_FS_H 2 - #define _TOOLS_INCLUDE_LINUX_PROC_FS_H 3 - 4 - #endif /* _TOOLS_INCLUDE_LINUX_PROC_FS_H */
-2
tools/include/linux/spinlock.h
··· 37 37 return true; 38 38 } 39 39 40 - #include <linux/lockdep.h> 41 - 42 40 #endif
-33
tools/include/linux/stacktrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _LIBLOCKDEP_LINUX_STACKTRACE_H_ 3 - #define _LIBLOCKDEP_LINUX_STACKTRACE_H_ 4 - 5 - #include <execinfo.h> 6 - 7 - struct stack_trace { 8 - unsigned int nr_entries, max_entries; 9 - unsigned long *entries; 10 - int skip; 11 - }; 12 - 13 - static inline void print_stack_trace(struct stack_trace *trace, int spaces) 14 - { 15 - backtrace_symbols_fd((void **)trace->entries, trace->nr_entries, 1); 16 - } 17 - 18 - #define save_stack_trace(trace) \ 19 - ((trace)->nr_entries = \ 20 - backtrace((void **)(trace)->entries, (trace)->max_entries)) 21 - 22 - static inline int dump_stack(void) 23 - { 24 - void *array[64]; 25 - size_t size; 26 - 27 - size = backtrace(array, 64); 28 - backtrace_symbols_fd(array, size, 1); 29 - 30 - return 0; 31 - } 32 - 33 - #endif
-2
tools/perf/Makefile.config
··· 271 271 272 272 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) 273 273 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) 274 - FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) 275 - FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) 276 274 277 275 FEATURE_CHECK_LDFLAGS-libaio = -lrt 278 276
+1
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
··· 528 528 446 common landlock_restrict_self sys_landlock_restrict_self 529 529 # 447 reserved for memfd_secret 530 530 448 common process_mrelease sys_process_mrelease 531 + 449 common futex_waitv sys_futex_waitv
+1
tools/perf/arch/s390/entry/syscalls/syscall.tbl
··· 451 451 446 common landlock_restrict_self sys_landlock_restrict_self sys_landlock_restrict_self 452 452 # 447 reserved for memfd_secret 453 453 448 common process_mrelease sys_process_mrelease sys_process_mrelease 454 + 449 common futex_waitv sys_futex_waitv sys_futex_waitv
-4
tools/perf/bench/sched-messaging.c
··· 223 223 snd_ctx->out_fds[i] = fds[1]; 224 224 if (!thread_mode) 225 225 close(fds[0]); 226 - 227 - free(ctx); 228 226 } 229 227 230 228 /* Now we have all the fds, fork the senders */ ··· 238 240 if (!thread_mode) 239 241 for (i = 0; i < num_fds; i++) 240 242 close(snd_ctx->out_fds[i]); 241 - 242 - free(snd_ctx); 243 243 244 244 /* Return number of children to reap */ 245 245 return num_fds * 2;
+1 -1
tools/perf/builtin-inject.c
··· 820 820 inject->tool.ordered_events = true; 821 821 inject->tool.ordering_requires_timestamps = true; 822 822 /* Allow space in the header for new attributes */ 823 - output_data_offset = 4096; 823 + output_data_offset = roundup(8192 + session->header.data_offset, 4096); 824 824 if (inject->strip) 825 825 strip_init(inject); 826 826 }
+3 -1
tools/perf/tests/expr.c
··· 169 169 TEST_ASSERT_VAL("#num_dies", expr__parse(&num_dies, ctx, "#num_dies") == 0); 170 170 TEST_ASSERT_VAL("#num_cores >= #num_dies", num_cores >= num_dies); 171 171 TEST_ASSERT_VAL("#num_packages", expr__parse(&num_packages, ctx, "#num_packages") == 0); 172 - TEST_ASSERT_VAL("#num_dies >= #num_packages", num_dies >= num_packages); 172 + 173 + if (num_dies) // Some platforms do not have CPU die support, for example s390 174 + TEST_ASSERT_VAL("#num_dies >= #num_packages", num_dies >= num_packages); 173 175 174 176 /* 175 177 * Source count returns the number of events aggregating in a leader
+1
tools/perf/tests/parse-metric.c
··· 109 109 struct evsel *evsel; 110 110 u64 count; 111 111 112 + perf_stat__reset_shadow_stats(); 112 113 evlist__for_each_entry(evlist, evsel) { 113 114 count = find_value(evsel->name, vals); 114 115 perf_stat__update_shadow_stats(evsel, count, 0, st);
-14
tools/perf/util/bpf_skel/bperf.h
··· 1 - // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 - // Copyright (c) 2021 Facebook 3 - 4 - #ifndef __BPERF_STAT_H 5 - #define __BPERF_STAT_H 6 - 7 - typedef struct { 8 - __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); 9 - __uint(key_size, sizeof(__u32)); 10 - __uint(value_size, sizeof(struct bpf_perf_event_value)); 11 - __uint(max_entries, 1); 12 - } reading_map; 13 - 14 - #endif /* __BPERF_STAT_H */
+14 -5
tools/perf/util/bpf_skel/bperf_follower.bpf.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 // Copyright (c) 2021 Facebook 3 - #include <linux/bpf.h> 4 - #include <linux/perf_event.h> 3 + #include "vmlinux.h" 5 4 #include <bpf/bpf_helpers.h> 6 5 #include <bpf/bpf_tracing.h> 7 - #include "bperf.h" 8 6 #include "bperf_u.h" 9 7 10 - reading_map diff_readings SEC(".maps"); 11 - reading_map accum_readings SEC(".maps"); 8 + struct { 9 + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); 10 + __uint(key_size, sizeof(__u32)); 11 + __uint(value_size, sizeof(struct bpf_perf_event_value)); 12 + __uint(max_entries, 1); 13 + } diff_readings SEC(".maps"); 14 + 15 + struct { 16 + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); 17 + __uint(key_size, sizeof(__u32)); 18 + __uint(value_size, sizeof(struct bpf_perf_event_value)); 19 + __uint(max_entries, 1); 20 + } accum_readings SEC(".maps"); 12 21 13 22 struct { 14 23 __uint(type, BPF_MAP_TYPE_HASH);
+14 -5
tools/perf/util/bpf_skel/bperf_leader.bpf.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 // Copyright (c) 2021 Facebook 3 - #include <linux/bpf.h> 4 - #include <linux/perf_event.h> 3 + #include "vmlinux.h" 5 4 #include <bpf/bpf_helpers.h> 6 5 #include <bpf/bpf_tracing.h> 7 - #include "bperf.h" 8 6 9 7 struct { 10 8 __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); ··· 11 13 __uint(map_flags, BPF_F_PRESERVE_ELEMS); 12 14 } events SEC(".maps"); 13 15 14 - reading_map prev_readings SEC(".maps"); 15 - reading_map diff_readings SEC(".maps"); 16 + struct { 17 + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); 18 + __uint(key_size, sizeof(__u32)); 19 + __uint(value_size, sizeof(struct bpf_perf_event_value)); 20 + __uint(max_entries, 1); 21 + } prev_readings SEC(".maps"); 22 + 23 + struct { 24 + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); 25 + __uint(key_size, sizeof(__u32)); 26 + __uint(value_size, sizeof(struct bpf_perf_event_value)); 27 + __uint(max_entries, 1); 28 + } diff_readings SEC(".maps"); 16 29 17 30 SEC("raw_tp/sched_switch") 18 31 int BPF_PROG(on_switch)
+1 -1
tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 // Copyright (c) 2020 Facebook 3 - #include <linux/bpf.h> 3 + #include "vmlinux.h" 4 4 #include <bpf/bpf_helpers.h> 5 5 #include <bpf/bpf_tracing.h> 6 6
+4 -1
tools/perf/util/event.h
··· 44 44 /* perf sample has 16 bits size limit */ 45 45 #define PERF_SAMPLE_MAX_SIZE (1 << 16) 46 46 47 + /* number of register is bound by the number of bits in regs_dump::mask (64) */ 48 + #define PERF_SAMPLE_REGS_CACHE_SIZE (8 * sizeof(u64)) 49 + 47 50 struct regs_dump { 48 51 u64 abi; 49 52 u64 mask; 50 53 u64 *regs; 51 54 52 55 /* Cached values/mask filled by first register access. */ 53 - u64 cache_regs[PERF_REGS_MAX]; 56 + u64 cache_regs[PERF_SAMPLE_REGS_CACHE_SIZE]; 54 57 u64 cache_mask; 55 58 }; 56 59
+10 -5
tools/perf/util/header.c
··· 2321 2321 #define FEAT_PROCESS_STR_FUN(__feat, __feat_env) \ 2322 2322 static int process_##__feat(struct feat_fd *ff, void *data __maybe_unused) \ 2323 2323 {\ 2324 + free(ff->ph->env.__feat_env); \ 2324 2325 ff->ph->env.__feat_env = do_read_string(ff); \ 2325 2326 return ff->ph->env.__feat_env ? 0 : -ENOMEM; \ 2326 2327 } ··· 4125 4124 struct perf_record_header_feature *fe = (struct perf_record_header_feature *)event; 4126 4125 int type = fe->header.type; 4127 4126 u64 feat = fe->feat_id; 4127 + int ret = 0; 4128 4128 4129 4129 if (type < 0 || type >= PERF_RECORD_HEADER_MAX) { 4130 4130 pr_warning("invalid record type %d in pipe-mode\n", type); ··· 4143 4141 ff.size = event->header.size - sizeof(*fe); 4144 4142 ff.ph = &session->header; 4145 4143 4146 - if (feat_ops[feat].process(&ff, NULL)) 4147 - return -1; 4144 + if (feat_ops[feat].process(&ff, NULL)) { 4145 + ret = -1; 4146 + goto out; 4147 + } 4148 4148 4149 4149 if (!feat_ops[feat].print || !tool->show_feat_hdr) 4150 - return 0; 4150 + goto out; 4151 4151 4152 4152 if (!feat_ops[feat].full_only || 4153 4153 tool->show_feat_hdr >= SHOW_FEAT_HEADER_FULL_INFO) { ··· 4158 4154 fprintf(stdout, "# %s info available, use -I to display\n", 4159 4155 feat_ops[feat].name); 4160 4156 } 4161 - 4162 - return 0; 4157 + out: 4158 + free_event_desc(ff.events); 4159 + return ret; 4163 4160 } 4164 4161 4165 4162 size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp)
+55 -30
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
··· 1205 1205 1206 1206 static bool intel_pt_fup_event(struct intel_pt_decoder *decoder) 1207 1207 { 1208 + enum intel_pt_sample_type type = decoder->state.type; 1208 1209 bool ret = false; 1210 + 1211 + decoder->state.type &= ~INTEL_PT_BRANCH; 1209 1212 1210 1213 if (decoder->set_fup_tx_flags) { 1211 1214 decoder->set_fup_tx_flags = false; 1212 1215 decoder->tx_flags = decoder->fup_tx_flags; 1213 - decoder->state.type = INTEL_PT_TRANSACTION; 1216 + decoder->state.type |= INTEL_PT_TRANSACTION; 1214 1217 if (decoder->fup_tx_flags & INTEL_PT_ABORT_TX) 1215 1218 decoder->state.type |= INTEL_PT_BRANCH; 1216 - decoder->state.from_ip = decoder->ip; 1217 - decoder->state.to_ip = 0; 1218 1219 decoder->state.flags = decoder->fup_tx_flags; 1219 - return true; 1220 + ret = true; 1220 1221 } 1221 1222 if (decoder->set_fup_ptw) { 1222 1223 decoder->set_fup_ptw = false; 1223 - decoder->state.type = INTEL_PT_PTW; 1224 + decoder->state.type |= INTEL_PT_PTW; 1224 1225 decoder->state.flags |= INTEL_PT_FUP_IP; 1225 - decoder->state.from_ip = decoder->ip; 1226 - decoder->state.to_ip = 0; 1227 1226 decoder->state.ptw_payload = decoder->fup_ptw_payload; 1228 - return true; 1227 + ret = true; 1229 1228 } 1230 1229 if (decoder->set_fup_mwait) { 1231 1230 decoder->set_fup_mwait = false; 1232 - decoder->state.type = INTEL_PT_MWAIT_OP; 1233 - decoder->state.from_ip = decoder->ip; 1234 - decoder->state.to_ip = 0; 1231 + decoder->state.type |= INTEL_PT_MWAIT_OP; 1235 1232 decoder->state.mwait_payload = decoder->fup_mwait_payload; 1236 1233 ret = true; 1237 1234 } 1238 1235 if (decoder->set_fup_pwre) { 1239 1236 decoder->set_fup_pwre = false; 1240 1237 decoder->state.type |= INTEL_PT_PWR_ENTRY; 1241 - decoder->state.type &= ~INTEL_PT_BRANCH; 1242 - decoder->state.from_ip = decoder->ip; 1243 - decoder->state.to_ip = 0; 1244 1238 decoder->state.pwre_payload = decoder->fup_pwre_payload; 1245 1239 ret = true; 1246 1240 } 1247 1241 if (decoder->set_fup_exstop) { 1248 1242 decoder->set_fup_exstop = false; 1249 1243 decoder->state.type |= INTEL_PT_EX_STOP; 1250 - decoder->state.type &= ~INTEL_PT_BRANCH; 1251 1244 decoder->state.flags |= INTEL_PT_FUP_IP; 1252 - decoder->state.from_ip = decoder->ip; 1253 - decoder->state.to_ip = 0; 1254 1245 ret = true; 1255 1246 } 1256 1247 if (decoder->set_fup_bep) { 1257 1248 decoder->set_fup_bep = false; 1258 1249 decoder->state.type |= INTEL_PT_BLK_ITEMS; 1259 - decoder->state.type &= ~INTEL_PT_BRANCH; 1250 + ret = true; 1251 + } 1252 + if (decoder->overflow) { 1253 + decoder->overflow = false; 1254 + if (!ret && !decoder->pge) { 1255 + if (decoder->hop) { 1256 + decoder->state.type = 0; 1257 + decoder->pkt_state = INTEL_PT_STATE_RESAMPLE; 1258 + } 1259 + decoder->pge = true; 1260 + decoder->state.type |= INTEL_PT_BRANCH | INTEL_PT_TRACE_BEGIN; 1261 + decoder->state.from_ip = 0; 1262 + decoder->state.to_ip = decoder->ip; 1263 + return true; 1264 + } 1265 + } 1266 + if (ret) { 1260 1267 decoder->state.from_ip = decoder->ip; 1261 1268 decoder->state.to_ip = 0; 1262 - ret = true; 1269 + } else { 1270 + decoder->state.type = type; 1263 1271 } 1264 1272 return ret; 1265 1273 } ··· 1616 1608 intel_pt_clear_tx_flags(decoder); 1617 1609 intel_pt_set_nr(decoder); 1618 1610 decoder->timestamp_insn_cnt = 0; 1619 - decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC; 1611 + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; 1612 + decoder->state.from_ip = decoder->ip; 1613 + decoder->ip = 0; 1614 + decoder->pge = false; 1615 + decoder->set_fup_tx_flags = false; 1616 + decoder->set_fup_ptw = false; 1617 + decoder->set_fup_mwait = false; 1618 + decoder->set_fup_pwre = false; 1619 + decoder->set_fup_exstop = false; 1620 + decoder->set_fup_bep = false; 1620 1621 decoder->overflow = true; 1621 1622 return -EOVERFLOW; 1622 1623 } ··· 2683 2666 /* Hop mode: Ignore TNT, do not walk code, but get ip from FUPs and TIPs */ 2684 2667 static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, int *err) 2685 2668 { 2669 + *err = 0; 2670 + 2686 2671 /* Leap from PSB to PSB, getting ip from FUP within PSB+ */ 2687 2672 if (decoder->leap && !decoder->in_psb && decoder->packet.type != INTEL_PT_PSB) { 2688 2673 *err = intel_pt_scan_for_psb(decoder); ··· 2697 2678 return HOP_IGNORE; 2698 2679 2699 2680 case INTEL_PT_TIP_PGD: 2681 + decoder->pge = false; 2700 2682 if (!decoder->packet.count) { 2701 2683 intel_pt_set_nr(decoder); 2702 2684 return HOP_IGNORE; ··· 2725 2705 if (!decoder->packet.count) 2726 2706 return HOP_IGNORE; 2727 2707 intel_pt_set_ip(decoder); 2728 - if (intel_pt_fup_event(decoder)) 2729 - return HOP_RETURN; 2730 - if (!decoder->branch_enable) 2708 + if (decoder->set_fup_mwait || decoder->set_fup_pwre) 2709 + *no_tip = true; 2710 + if (!decoder->branch_enable || !decoder->pge) 2731 2711 *no_tip = true; 2732 2712 if (*no_tip) { 2733 2713 decoder->state.type = INTEL_PT_INSTRUCTION; 2734 2714 decoder->state.from_ip = decoder->ip; 2735 2715 decoder->state.to_ip = 0; 2716 + intel_pt_fup_event(decoder); 2736 2717 return HOP_RETURN; 2737 2718 } 2719 + intel_pt_fup_event(decoder); 2720 + decoder->state.type |= INTEL_PT_INSTRUCTION | INTEL_PT_BRANCH; 2738 2721 *err = intel_pt_walk_fup_tip(decoder); 2739 - if (!*err) 2722 + if (!*err && decoder->state.to_ip) 2740 2723 decoder->pkt_state = INTEL_PT_STATE_RESAMPLE; 2741 2724 return HOP_RETURN; 2742 2725 ··· 2920 2897 { 2921 2898 struct intel_pt_psb_info data = { .fup = false }; 2922 2899 2923 - if (!decoder->branch_enable || !decoder->pge) 2900 + if (!decoder->branch_enable) 2924 2901 return false; 2925 2902 2926 2903 intel_pt_pkt_lookahead(decoder, intel_pt_psb_lookahead_cb, &data); ··· 2947 2924 if (err) 2948 2925 return err; 2949 2926 next: 2927 + err = 0; 2950 2928 if (decoder->cyc_threshold) { 2951 2929 if (decoder->sample_cyc && last_packet_type != INTEL_PT_CYC) 2952 2930 decoder->sample_cyc = false; ··· 2986 2962 2987 2963 case INTEL_PT_TIP_PGE: { 2988 2964 decoder->pge = true; 2965 + decoder->overflow = false; 2989 2966 intel_pt_mtc_cyc_cnt_pge(decoder); 2990 2967 intel_pt_set_nr(decoder); 2991 2968 if (decoder->packet.count == 0) { ··· 3024 2999 break; 3025 3000 } 3026 3001 intel_pt_set_last_ip(decoder); 3027 - if (!decoder->branch_enable) { 3002 + if (!decoder->branch_enable || !decoder->pge) { 3028 3003 decoder->ip = decoder->last_ip; 3029 3004 if (intel_pt_fup_event(decoder)) 3030 3005 return 0; ··· 3492 3467 decoder->set_fup_pwre = false; 3493 3468 decoder->set_fup_exstop = false; 3494 3469 decoder->set_fup_bep = false; 3470 + decoder->overflow = false; 3495 3471 3496 3472 if (!decoder->branch_enable) { 3497 3473 decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; 3498 - decoder->overflow = false; 3499 3474 decoder->state.type = 0; /* Do not have a sample */ 3500 3475 return 0; 3501 3476 } ··· 3510 3485 decoder->pkt_state = INTEL_PT_STATE_RESAMPLE; 3511 3486 else 3512 3487 decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; 3513 - decoder->overflow = false; 3514 3488 3515 3489 decoder->state.from_ip = 0; 3516 3490 decoder->state.to_ip = decoder->ip; ··· 3631 3607 } 3632 3608 3633 3609 decoder->have_last_ip = true; 3634 - decoder->pkt_state = INTEL_PT_STATE_NO_IP; 3610 + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; 3635 3611 3636 3612 err = intel_pt_walk_psb(decoder); 3637 3613 if (err) ··· 3728 3704 3729 3705 if (err) { 3730 3706 decoder->state.err = intel_pt_ext_err(err); 3731 - decoder->state.from_ip = decoder->ip; 3707 + if (err != -EOVERFLOW) 3708 + decoder->state.from_ip = decoder->ip; 3732 3709 intel_pt_update_sample_time(decoder); 3733 3710 decoder->sample_tot_cyc_cnt = decoder->tot_cyc_cnt; 3734 3711 intel_pt_set_nr(decoder);
+1
tools/perf/util/intel-pt.c
··· 2565 2565 ptq->sync_switch = false; 2566 2566 intel_pt_next_tid(pt, ptq); 2567 2567 } 2568 + ptq->timestamp = state->est_timestamp; 2568 2569 if (pt->synth_opts.errors) { 2569 2570 err = intel_ptq_synth_error(ptq, state); 2570 2571 if (err)
+3
tools/perf/util/perf_regs.c
··· 25 25 int i, idx = 0; 26 26 u64 mask = regs->mask; 27 27 28 + if ((u64)id >= PERF_SAMPLE_REGS_CACHE_SIZE) 29 + return -EINVAL; 30 + 28 31 if (regs->cache_mask & (1ULL << id)) 29 32 goto out; 30 33
+1 -1
tools/perf/util/python.c
··· 461 461 struct tep_event *tp_format; 462 462 463 463 tp_format = trace_event__tp_format_id(evsel->core.attr.config); 464 - if (!tp_format) 464 + if (IS_ERR_OR_NULL(tp_format)) 465 465 return NULL; 466 466 467 467 evsel->tp_format = tp_format;
+1 -1
tools/perf/util/smt.c
··· 15 15 if (cached) 16 16 return cached_result; 17 17 18 - if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) > 0) 18 + if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) >= 0) 19 19 goto done; 20 20 21 21 ncpu = sysconf(_SC_NPROCESSORS_CONF);
+1
tools/power/acpi/Makefile.config
··· 69 69 ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica 70 70 CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) 71 71 CFLAGS += $(WARNINGS) 72 + MKDIR = mkdir 72 73 73 74 ifeq ($(strip $(V)),false) 74 75 QUIET=@
+1
tools/power/acpi/Makefile.rules
··· 21 21 22 22 $(objdir)%.o: %.c $(KERNEL_INCLUDE) 23 23 $(ECHO) " CC " $(subst $(OUTPUT),,$@) 24 + $(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null 24 25 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $< 25 26 26 27 all: $(OUTPUT)$(TOOL)
+600 -32
tools/testing/selftests/bpf/verifier/xdp_direct_packet_access.c
··· 35 35 .prog_type = BPF_PROG_TYPE_XDP, 36 36 }, 37 37 { 38 - "XDP pkt read, pkt_data' > pkt_end, good access", 38 + "XDP pkt read, pkt_data' > pkt_end, corner case, good access", 39 39 .insns = { 40 40 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 41 41 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, ··· 88 88 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 89 89 }, 90 90 { 91 + "XDP pkt read, pkt_data' > pkt_end, corner case +1, good access", 92 + .insns = { 93 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 94 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 95 + offsetof(struct xdp_md, data_end)), 96 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 97 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 98 + BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1), 99 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 100 + BPF_MOV64_IMM(BPF_REG_0, 0), 101 + BPF_EXIT_INSN(), 102 + }, 103 + .result = ACCEPT, 104 + .prog_type = BPF_PROG_TYPE_XDP, 105 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 106 + }, 107 + { 108 + "XDP pkt read, pkt_data' > pkt_end, corner case -1, bad access", 109 + .insns = { 110 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 111 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 112 + offsetof(struct xdp_md, data_end)), 113 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 114 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 115 + BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1), 116 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 117 + BPF_MOV64_IMM(BPF_REG_0, 0), 118 + BPF_EXIT_INSN(), 119 + }, 120 + .errstr = "R1 offset is outside of the packet", 121 + .result = REJECT, 122 + .prog_type = BPF_PROG_TYPE_XDP, 123 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 124 + }, 125 + { 91 126 "XDP pkt read, pkt_end > pkt_data', good access", 92 127 .insns = { 93 128 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), ··· 141 106 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 142 107 }, 143 108 { 144 - "XDP pkt read, pkt_end > pkt_data', bad access 1", 109 + "XDP pkt read, pkt_end > pkt_data', corner case -1, bad access", 145 110 .insns = { 146 111 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 147 112 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 148 113 offsetof(struct xdp_md, data_end)), 149 114 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 150 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 115 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 151 116 BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1), 152 117 BPF_JMP_IMM(BPF_JA, 0, 0, 1), 153 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 118 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 154 119 BPF_MOV64_IMM(BPF_REG_0, 0), 155 120 BPF_EXIT_INSN(), 156 121 }, ··· 178 143 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 179 144 }, 180 145 { 146 + "XDP pkt read, pkt_end > pkt_data', corner case, good access", 147 + .insns = { 148 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 149 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 150 + offsetof(struct xdp_md, data_end)), 151 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 152 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 153 + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1), 154 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 155 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 156 + BPF_MOV64_IMM(BPF_REG_0, 0), 157 + BPF_EXIT_INSN(), 158 + }, 159 + .result = ACCEPT, 160 + .prog_type = BPF_PROG_TYPE_XDP, 161 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 162 + }, 163 + { 164 + "XDP pkt read, pkt_end > pkt_data', corner case +1, good access", 165 + .insns = { 166 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 167 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 168 + offsetof(struct xdp_md, data_end)), 169 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 170 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 171 + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1), 172 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 173 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 174 + BPF_MOV64_IMM(BPF_REG_0, 0), 175 + BPF_EXIT_INSN(), 176 + }, 177 + .result = ACCEPT, 178 + .prog_type = BPF_PROG_TYPE_XDP, 179 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 180 + }, 181 + { 181 182 "XDP pkt read, pkt_data' < pkt_end, good access", 182 183 .insns = { 183 184 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), ··· 232 161 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 233 162 }, 234 163 { 235 - "XDP pkt read, pkt_data' < pkt_end, bad access 1", 164 + "XDP pkt read, pkt_data' < pkt_end, corner case -1, bad access", 236 165 .insns = { 237 166 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 238 167 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 239 168 offsetof(struct xdp_md, data_end)), 240 169 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 241 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 170 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 242 171 BPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1), 243 172 BPF_JMP_IMM(BPF_JA, 0, 0, 1), 244 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 173 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 245 174 BPF_MOV64_IMM(BPF_REG_0, 0), 246 175 BPF_EXIT_INSN(), 247 176 }, ··· 269 198 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 270 199 }, 271 200 { 272 - "XDP pkt read, pkt_end < pkt_data', good access", 201 + "XDP pkt read, pkt_data' < pkt_end, corner case, good access", 202 + .insns = { 203 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 204 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 205 + offsetof(struct xdp_md, data_end)), 206 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 207 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 208 + BPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1), 209 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 210 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 211 + BPF_MOV64_IMM(BPF_REG_0, 0), 212 + BPF_EXIT_INSN(), 213 + }, 214 + .result = ACCEPT, 215 + .prog_type = BPF_PROG_TYPE_XDP, 216 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 217 + }, 218 + { 219 + "XDP pkt read, pkt_data' < pkt_end, corner case +1, good access", 220 + .insns = { 221 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 222 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 223 + offsetof(struct xdp_md, data_end)), 224 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 225 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 226 + BPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1), 227 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 228 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 229 + BPF_MOV64_IMM(BPF_REG_0, 0), 230 + BPF_EXIT_INSN(), 231 + }, 232 + .result = ACCEPT, 233 + .prog_type = BPF_PROG_TYPE_XDP, 234 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 235 + }, 236 + { 237 + "XDP pkt read, pkt_end < pkt_data', corner case, good access", 273 238 .insns = { 274 239 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 275 240 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, ··· 358 251 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 359 252 }, 360 253 { 254 + "XDP pkt read, pkt_end < pkt_data', corner case +1, good access", 255 + .insns = { 256 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 257 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 258 + offsetof(struct xdp_md, data_end)), 259 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 260 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 261 + BPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 1), 262 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 263 + BPF_MOV64_IMM(BPF_REG_0, 0), 264 + BPF_EXIT_INSN(), 265 + }, 266 + .result = ACCEPT, 267 + .prog_type = BPF_PROG_TYPE_XDP, 268 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 269 + }, 270 + { 271 + "XDP pkt read, pkt_end < pkt_data', corner case -1, bad access", 272 + .insns = { 273 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 274 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 275 + offsetof(struct xdp_md, data_end)), 276 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 277 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 278 + BPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 1), 279 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 280 + BPF_MOV64_IMM(BPF_REG_0, 0), 281 + BPF_EXIT_INSN(), 282 + }, 283 + .errstr = "R1 offset is outside of the packet", 284 + .result = REJECT, 285 + .prog_type = BPF_PROG_TYPE_XDP, 286 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 287 + }, 288 + { 361 289 "XDP pkt read, pkt_data' >= pkt_end, good access", 362 290 .insns = { 363 291 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), ··· 410 268 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 411 269 }, 412 270 { 413 - "XDP pkt read, pkt_data' >= pkt_end, bad access 1", 271 + "XDP pkt read, pkt_data' >= pkt_end, corner case -1, bad access", 414 272 .insns = { 415 273 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 416 274 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 417 275 offsetof(struct xdp_md, data_end)), 418 276 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 419 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 277 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 420 278 BPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1), 421 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 279 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 422 280 BPF_MOV64_IMM(BPF_REG_0, 0), 423 281 BPF_EXIT_INSN(), 424 282 }, ··· 446 304 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 447 305 }, 448 306 { 449 - "XDP pkt read, pkt_end >= pkt_data', good access", 307 + "XDP pkt read, pkt_data' >= pkt_end, corner case, good access", 308 + .insns = { 309 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 310 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 311 + offsetof(struct xdp_md, data_end)), 312 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 313 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 314 + BPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1), 315 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 316 + BPF_MOV64_IMM(BPF_REG_0, 0), 317 + BPF_EXIT_INSN(), 318 + }, 319 + .result = ACCEPT, 320 + .prog_type = BPF_PROG_TYPE_XDP, 321 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 322 + }, 323 + { 324 + "XDP pkt read, pkt_data' >= pkt_end, corner case +1, good access", 325 + .insns = { 326 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 327 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 328 + offsetof(struct xdp_md, data_end)), 329 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 330 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 331 + BPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1), 332 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 333 + BPF_MOV64_IMM(BPF_REG_0, 0), 334 + BPF_EXIT_INSN(), 335 + }, 336 + .result = ACCEPT, 337 + .prog_type = BPF_PROG_TYPE_XDP, 338 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 339 + }, 340 + { 341 + "XDP pkt read, pkt_end >= pkt_data', corner case, good access", 450 342 .insns = { 451 343 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 452 344 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, ··· 535 359 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 536 360 }, 537 361 { 538 - "XDP pkt read, pkt_data' <= pkt_end, good access", 362 + "XDP pkt read, pkt_end >= pkt_data', corner case +1, good access", 363 + .insns = { 364 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 365 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 366 + offsetof(struct xdp_md, data_end)), 367 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 368 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 369 + BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1), 370 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 371 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 372 + BPF_MOV64_IMM(BPF_REG_0, 0), 373 + BPF_EXIT_INSN(), 374 + }, 375 + .result = ACCEPT, 376 + .prog_type = BPF_PROG_TYPE_XDP, 377 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 378 + }, 379 + { 380 + "XDP pkt read, pkt_end >= pkt_data', corner case -1, bad access", 381 + .insns = { 382 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 383 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 384 + offsetof(struct xdp_md, data_end)), 385 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 386 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 387 + BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1), 388 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 389 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 390 + BPF_MOV64_IMM(BPF_REG_0, 0), 391 + BPF_EXIT_INSN(), 392 + }, 393 + .errstr = "R1 offset is outside of the packet", 394 + .result = REJECT, 395 + .prog_type = BPF_PROG_TYPE_XDP, 396 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 397 + }, 398 + { 399 + "XDP pkt read, pkt_data' <= pkt_end, corner case, good access", 539 400 .insns = { 540 401 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 541 402 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, ··· 627 414 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 628 415 }, 629 416 { 417 + "XDP pkt read, pkt_data' <= pkt_end, corner case +1, good access", 418 + .insns = { 419 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 420 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 421 + offsetof(struct xdp_md, data_end)), 422 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 423 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 424 + BPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1), 425 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 426 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 427 + BPF_MOV64_IMM(BPF_REG_0, 0), 428 + BPF_EXIT_INSN(), 429 + }, 430 + .result = ACCEPT, 431 + .prog_type = BPF_PROG_TYPE_XDP, 432 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 433 + }, 434 + { 435 + "XDP pkt read, pkt_data' <= pkt_end, corner case -1, bad access", 436 + .insns = { 437 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 438 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 439 + offsetof(struct xdp_md, data_end)), 440 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 441 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 442 + BPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1), 443 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 444 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 445 + BPF_MOV64_IMM(BPF_REG_0, 0), 446 + BPF_EXIT_INSN(), 447 + }, 448 + .errstr = "R1 offset is outside of the packet", 449 + .result = REJECT, 450 + .prog_type = BPF_PROG_TYPE_XDP, 451 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 452 + }, 453 + { 630 454 "XDP pkt read, pkt_end <= pkt_data', good access", 631 455 .insns = { 632 456 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), ··· 681 431 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 682 432 }, 683 433 { 684 - "XDP pkt read, pkt_end <= pkt_data', bad access 1", 434 + "XDP pkt read, pkt_end <= pkt_data', corner case -1, bad access", 685 435 .insns = { 686 436 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 687 437 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 688 438 offsetof(struct xdp_md, data_end)), 689 439 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 690 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 440 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 691 441 BPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1), 692 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 442 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 693 443 BPF_MOV64_IMM(BPF_REG_0, 0), 694 444 BPF_EXIT_INSN(), 695 445 }, ··· 717 467 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 718 468 }, 719 469 { 720 - "XDP pkt read, pkt_meta' > pkt_data, good access", 470 + "XDP pkt read, pkt_end <= pkt_data', corner case, good access", 471 + .insns = { 472 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 473 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 474 + offsetof(struct xdp_md, data_end)), 475 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 476 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 477 + BPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1), 478 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 479 + BPF_MOV64_IMM(BPF_REG_0, 0), 480 + BPF_EXIT_INSN(), 481 + }, 482 + .result = ACCEPT, 483 + .prog_type = BPF_PROG_TYPE_XDP, 484 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 485 + }, 486 + { 487 + "XDP pkt read, pkt_end <= pkt_data', corner case +1, good access", 488 + .insns = { 489 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)), 490 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 491 + offsetof(struct xdp_md, data_end)), 492 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 493 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 494 + BPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1), 495 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 496 + BPF_MOV64_IMM(BPF_REG_0, 0), 497 + BPF_EXIT_INSN(), 498 + }, 499 + .result = ACCEPT, 500 + .prog_type = BPF_PROG_TYPE_XDP, 501 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 502 + }, 503 + { 504 + "XDP pkt read, pkt_meta' > pkt_data, corner case, good access", 721 505 .insns = { 722 506 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 723 507 offsetof(struct xdp_md, data_meta)), ··· 804 520 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 805 521 }, 806 522 { 523 + "XDP pkt read, pkt_meta' > pkt_data, corner case +1, good access", 524 + .insns = { 525 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 526 + offsetof(struct xdp_md, data_meta)), 527 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 528 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 529 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 530 + BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1), 531 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 532 + BPF_MOV64_IMM(BPF_REG_0, 0), 533 + BPF_EXIT_INSN(), 534 + }, 535 + .result = ACCEPT, 536 + .prog_type = BPF_PROG_TYPE_XDP, 537 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 538 + }, 539 + { 540 + "XDP pkt read, pkt_meta' > pkt_data, corner case -1, bad access", 541 + .insns = { 542 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 543 + offsetof(struct xdp_md, data_meta)), 544 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 545 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 546 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 547 + BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 1), 548 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 549 + BPF_MOV64_IMM(BPF_REG_0, 0), 550 + BPF_EXIT_INSN(), 551 + }, 552 + .errstr = "R1 offset is outside of the packet", 553 + .result = REJECT, 554 + .prog_type = BPF_PROG_TYPE_XDP, 555 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 556 + }, 557 + { 807 558 "XDP pkt read, pkt_data > pkt_meta', good access", 808 559 .insns = { 809 560 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, ··· 857 538 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 858 539 }, 859 540 { 860 - "XDP pkt read, pkt_data > pkt_meta', bad access 1", 541 + "XDP pkt read, pkt_data > pkt_meta', corner case -1, bad access", 861 542 .insns = { 862 543 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 863 544 offsetof(struct xdp_md, data_meta)), 864 545 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 865 546 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 866 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 547 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 867 548 BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1), 868 549 BPF_JMP_IMM(BPF_JA, 0, 0, 1), 869 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 550 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 870 551 BPF_MOV64_IMM(BPF_REG_0, 0), 871 552 BPF_EXIT_INSN(), 872 553 }, ··· 894 575 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 895 576 }, 896 577 { 578 + "XDP pkt read, pkt_data > pkt_meta', corner case, good access", 579 + .insns = { 580 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 581 + offsetof(struct xdp_md, data_meta)), 582 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 583 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 584 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 585 + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1), 586 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 587 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 588 + BPF_MOV64_IMM(BPF_REG_0, 0), 589 + BPF_EXIT_INSN(), 590 + }, 591 + .result = ACCEPT, 592 + .prog_type = BPF_PROG_TYPE_XDP, 593 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 594 + }, 595 + { 596 + "XDP pkt read, pkt_data > pkt_meta', corner case +1, good access", 597 + .insns = { 598 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 599 + offsetof(struct xdp_md, data_meta)), 600 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 601 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 602 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 603 + BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_1, 1), 604 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 605 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 606 + BPF_MOV64_IMM(BPF_REG_0, 0), 607 + BPF_EXIT_INSN(), 608 + }, 609 + .result = ACCEPT, 610 + .prog_type = BPF_PROG_TYPE_XDP, 611 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 612 + }, 613 + { 897 614 "XDP pkt read, pkt_meta' < pkt_data, good access", 898 615 .insns = { 899 616 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, ··· 948 593 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 949 594 }, 950 595 { 951 - "XDP pkt read, pkt_meta' < pkt_data, bad access 1", 596 + "XDP pkt read, pkt_meta' < pkt_data, corner case -1, bad access", 952 597 .insns = { 953 598 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 954 599 offsetof(struct xdp_md, data_meta)), 955 600 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 956 601 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 957 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 602 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 958 603 BPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1), 959 604 BPF_JMP_IMM(BPF_JA, 0, 0, 1), 960 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 605 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 961 606 BPF_MOV64_IMM(BPF_REG_0, 0), 962 607 BPF_EXIT_INSN(), 963 608 }, ··· 985 630 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 986 631 }, 987 632 { 988 - "XDP pkt read, pkt_data < pkt_meta', good access", 633 + "XDP pkt read, pkt_meta' < pkt_data, corner case, good access", 634 + .insns = { 635 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 636 + offsetof(struct xdp_md, data_meta)), 637 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 638 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 639 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 640 + BPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1), 641 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 642 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 643 + BPF_MOV64_IMM(BPF_REG_0, 0), 644 + BPF_EXIT_INSN(), 645 + }, 646 + .result = ACCEPT, 647 + .prog_type = BPF_PROG_TYPE_XDP, 648 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 649 + }, 650 + { 651 + "XDP pkt read, pkt_meta' < pkt_data, corner case +1, good access", 652 + .insns = { 653 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 654 + offsetof(struct xdp_md, data_meta)), 655 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 656 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 657 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 658 + BPF_JMP_REG(BPF_JLT, BPF_REG_1, BPF_REG_3, 1), 659 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 660 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 661 + BPF_MOV64_IMM(BPF_REG_0, 0), 662 + BPF_EXIT_INSN(), 663 + }, 664 + .result = ACCEPT, 665 + .prog_type = BPF_PROG_TYPE_XDP, 666 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 667 + }, 668 + { 669 + "XDP pkt read, pkt_data < pkt_meta', corner case, good access", 989 670 .insns = { 990 671 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 991 672 offsetof(struct xdp_md, data_meta)), ··· 1074 683 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1075 684 }, 1076 685 { 686 + "XDP pkt read, pkt_data < pkt_meta', corner case +1, good access", 687 + .insns = { 688 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 689 + offsetof(struct xdp_md, data_meta)), 690 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 691 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 692 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 693 + BPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 1), 694 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 695 + BPF_MOV64_IMM(BPF_REG_0, 0), 696 + BPF_EXIT_INSN(), 697 + }, 698 + .result = ACCEPT, 699 + .prog_type = BPF_PROG_TYPE_XDP, 700 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 701 + }, 702 + { 703 + "XDP pkt read, pkt_data < pkt_meta', corner case -1, bad access", 704 + .insns = { 705 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 706 + offsetof(struct xdp_md, data_meta)), 707 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 708 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 709 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 710 + BPF_JMP_REG(BPF_JLT, BPF_REG_3, BPF_REG_1, 1), 711 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 712 + BPF_MOV64_IMM(BPF_REG_0, 0), 713 + BPF_EXIT_INSN(), 714 + }, 715 + .errstr = "R1 offset is outside of the packet", 716 + .result = REJECT, 717 + .prog_type = BPF_PROG_TYPE_XDP, 718 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 719 + }, 720 + { 1077 721 "XDP pkt read, pkt_meta' >= pkt_data, good access", 1078 722 .insns = { 1079 723 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, ··· 1126 700 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1127 701 }, 1128 702 { 1129 - "XDP pkt read, pkt_meta' >= pkt_data, bad access 1", 703 + "XDP pkt read, pkt_meta' >= pkt_data, corner case -1, bad access", 1130 704 .insns = { 1131 705 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1132 706 offsetof(struct xdp_md, data_meta)), 1133 707 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1134 708 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 1135 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 709 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 1136 710 BPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1), 1137 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 711 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 1138 712 BPF_MOV64_IMM(BPF_REG_0, 0), 1139 713 BPF_EXIT_INSN(), 1140 714 }, ··· 1162 736 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1163 737 }, 1164 738 { 1165 - "XDP pkt read, pkt_data >= pkt_meta', good access", 739 + "XDP pkt read, pkt_meta' >= pkt_data, corner case, good access", 740 + .insns = { 741 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 742 + offsetof(struct xdp_md, data_meta)), 743 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 744 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 745 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 746 + BPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1), 747 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 748 + BPF_MOV64_IMM(BPF_REG_0, 0), 749 + BPF_EXIT_INSN(), 750 + }, 751 + .result = ACCEPT, 752 + .prog_type = BPF_PROG_TYPE_XDP, 753 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 754 + }, 755 + { 756 + "XDP pkt read, pkt_meta' >= pkt_data, corner case +1, good access", 757 + .insns = { 758 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 759 + offsetof(struct xdp_md, data_meta)), 760 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 761 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 762 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 763 + BPF_JMP_REG(BPF_JGE, BPF_REG_1, BPF_REG_3, 1), 764 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 765 + BPF_MOV64_IMM(BPF_REG_0, 0), 766 + BPF_EXIT_INSN(), 767 + }, 768 + .result = ACCEPT, 769 + .prog_type = BPF_PROG_TYPE_XDP, 770 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 771 + }, 772 + { 773 + "XDP pkt read, pkt_data >= pkt_meta', corner case, good access", 1166 774 .insns = { 1167 775 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1168 776 offsetof(struct xdp_md, data_meta)), ··· 1251 791 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1252 792 }, 1253 793 { 1254 - "XDP pkt read, pkt_meta' <= pkt_data, good access", 794 + "XDP pkt read, pkt_data >= pkt_meta', corner case +1, good access", 795 + .insns = { 796 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 797 + offsetof(struct xdp_md, data_meta)), 798 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 799 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 800 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 801 + BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1), 802 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 803 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 804 + BPF_MOV64_IMM(BPF_REG_0, 0), 805 + BPF_EXIT_INSN(), 806 + }, 807 + .result = ACCEPT, 808 + .prog_type = BPF_PROG_TYPE_XDP, 809 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 810 + }, 811 + { 812 + "XDP pkt read, pkt_data >= pkt_meta', corner case -1, bad access", 813 + .insns = { 814 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 815 + offsetof(struct xdp_md, data_meta)), 816 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 817 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 818 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 819 + BPF_JMP_REG(BPF_JGE, BPF_REG_3, BPF_REG_1, 1), 820 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 821 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 822 + BPF_MOV64_IMM(BPF_REG_0, 0), 823 + BPF_EXIT_INSN(), 824 + }, 825 + .errstr = "R1 offset is outside of the packet", 826 + .result = REJECT, 827 + .prog_type = BPF_PROG_TYPE_XDP, 828 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 829 + }, 830 + { 831 + "XDP pkt read, pkt_meta' <= pkt_data, corner case, good access", 1255 832 .insns = { 1256 833 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1257 834 offsetof(struct xdp_md, data_meta)), ··· 1343 846 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1344 847 }, 1345 848 { 849 + "XDP pkt read, pkt_meta' <= pkt_data, corner case +1, good access", 850 + .insns = { 851 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 852 + offsetof(struct xdp_md, data_meta)), 853 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 854 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 855 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 9), 856 + BPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1), 857 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 858 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -9), 859 + BPF_MOV64_IMM(BPF_REG_0, 0), 860 + BPF_EXIT_INSN(), 861 + }, 862 + .result = ACCEPT, 863 + .prog_type = BPF_PROG_TYPE_XDP, 864 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 865 + }, 866 + { 867 + "XDP pkt read, pkt_meta' <= pkt_data, corner case -1, bad access", 868 + .insns = { 869 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 870 + offsetof(struct xdp_md, data_meta)), 871 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 872 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 873 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 874 + BPF_JMP_REG(BPF_JLE, BPF_REG_1, BPF_REG_3, 1), 875 + BPF_JMP_IMM(BPF_JA, 0, 0, 1), 876 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 877 + BPF_MOV64_IMM(BPF_REG_0, 0), 878 + BPF_EXIT_INSN(), 879 + }, 880 + .errstr = "R1 offset is outside of the packet", 881 + .result = REJECT, 882 + .prog_type = BPF_PROG_TYPE_XDP, 883 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 884 + }, 885 + { 1346 886 "XDP pkt read, pkt_data <= pkt_meta', good access", 1347 887 .insns = { 1348 888 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, ··· 1397 863 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1398 864 }, 1399 865 { 1400 - "XDP pkt read, pkt_data <= pkt_meta', bad access 1", 866 + "XDP pkt read, pkt_data <= pkt_meta', corner case -1, bad access", 1401 867 .insns = { 1402 868 BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 1403 869 offsetof(struct xdp_md, data_meta)), 1404 870 BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 1405 871 BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 1406 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 872 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 6), 1407 873 BPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1), 1408 - BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 874 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -6), 1409 875 BPF_MOV64_IMM(BPF_REG_0, 0), 1410 876 BPF_EXIT_INSN(), 1411 877 }, ··· 1429 895 }, 1430 896 .errstr = "R1 offset is outside of the packet", 1431 897 .result = REJECT, 898 + .prog_type = BPF_PROG_TYPE_XDP, 899 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 900 + }, 901 + { 902 + "XDP pkt read, pkt_data <= pkt_meta', corner case, good access", 903 + .insns = { 904 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 905 + offsetof(struct xdp_md, data_meta)), 906 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 907 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 908 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 7), 909 + BPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1), 910 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -7), 911 + BPF_MOV64_IMM(BPF_REG_0, 0), 912 + BPF_EXIT_INSN(), 913 + }, 914 + .result = ACCEPT, 915 + .prog_type = BPF_PROG_TYPE_XDP, 916 + .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 917 + }, 918 + { 919 + "XDP pkt read, pkt_data <= pkt_meta', corner case +1, good access", 920 + .insns = { 921 + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 922 + offsetof(struct xdp_md, data_meta)), 923 + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data)), 924 + BPF_MOV64_REG(BPF_REG_1, BPF_REG_2), 925 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 8), 926 + BPF_JMP_REG(BPF_JLE, BPF_REG_3, BPF_REG_1, 1), 927 + BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8), 928 + BPF_MOV64_IMM(BPF_REG_0, 0), 929 + BPF_EXIT_INSN(), 930 + }, 931 + .result = ACCEPT, 1432 932 .prog_type = BPF_PROG_TYPE_XDP, 1433 933 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, 1434 934 },
+2
tools/testing/selftests/damon/.gitignore
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + huge_count_read_write
+5 -2
tools/testing/selftests/damon/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Makefile for damon selftests 3 3 4 - TEST_FILES = _chk_dependency.sh 5 - TEST_PROGS = debugfs_attrs.sh 4 + TEST_GEN_FILES += huge_count_read_write 5 + 6 + TEST_FILES = _chk_dependency.sh _debugfs_common.sh 7 + TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh 8 + TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh 6 9 7 10 include ../lib.mk
+52
tools/testing/selftests/damon/_debugfs_common.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + test_write_result() { 5 + file=$1 6 + content=$2 7 + orig_content=$3 8 + expect_reason=$4 9 + expected=$5 10 + 11 + echo "$content" > "$file" 12 + if [ $? -ne "$expected" ] 13 + then 14 + echo "writing $content to $file doesn't return $expected" 15 + echo "expected because: $expect_reason" 16 + echo "$orig_content" > "$file" 17 + exit 1 18 + fi 19 + } 20 + 21 + test_write_succ() { 22 + test_write_result "$1" "$2" "$3" "$4" 0 23 + } 24 + 25 + test_write_fail() { 26 + test_write_result "$1" "$2" "$3" "$4" 1 27 + } 28 + 29 + test_content() { 30 + file=$1 31 + orig_content=$2 32 + expected=$3 33 + expect_reason=$4 34 + 35 + content=$(cat "$file") 36 + if [ "$content" != "$expected" ] 37 + then 38 + echo "reading $file expected $expected but $content" 39 + echo "expected because: $expect_reason" 40 + echo "$orig_content" > "$file" 41 + exit 1 42 + fi 43 + } 44 + 45 + source ./_chk_dependency.sh 46 + 47 + damon_onoff="$DBGFS/monitor_on" 48 + if [ $(cat "$damon_onoff") = "on" ] 49 + then 50 + echo "monitoring is on" 51 + exit $ksft_skip 52 + fi
+1 -72
tools/testing/selftests/damon/debugfs_attrs.sh
··· 1 1 #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 - test_write_result() { 5 - file=$1 6 - content=$2 7 - orig_content=$3 8 - expect_reason=$4 9 - expected=$5 10 - 11 - echo "$content" > "$file" 12 - if [ $? -ne "$expected" ] 13 - then 14 - echo "writing $content to $file doesn't return $expected" 15 - echo "expected because: $expect_reason" 16 - echo "$orig_content" > "$file" 17 - exit 1 18 - fi 19 - } 20 - 21 - test_write_succ() { 22 - test_write_result "$1" "$2" "$3" "$4" 0 23 - } 24 - 25 - test_write_fail() { 26 - test_write_result "$1" "$2" "$3" "$4" 1 27 - } 28 - 29 - test_content() { 30 - file=$1 31 - orig_content=$2 32 - expected=$3 33 - expect_reason=$4 34 - 35 - content=$(cat "$file") 36 - if [ "$content" != "$expected" ] 37 - then 38 - echo "reading $file expected $expected but $content" 39 - echo "expected because: $expect_reason" 40 - echo "$orig_content" > "$file" 41 - exit 1 42 - fi 43 - } 44 - 45 - source ./_chk_dependency.sh 4 + source _debugfs_common.sh 46 5 47 6 # Test attrs file 48 7 # =============== ··· 15 56 "min_nr_regions > max_nr_regions" 16 57 test_content "$file" "$orig_content" "1 2 3 4 5" "successfully written" 17 58 echo "$orig_content" > "$file" 18 - 19 - # Test schemes file 20 - # ================= 21 - 22 - file="$DBGFS/schemes" 23 - orig_content=$(cat "$file") 24 - 25 - test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \ 26 - "$orig_content" "valid input" 27 - test_write_fail "$file" "1 2 28 - 3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines" 29 - test_write_succ "$file" "" "$orig_content" "disabling" 30 - echo "$orig_content" > "$file" 31 - 32 - # Test target_ids file 33 - # ==================== 34 - 35 - file="$DBGFS/target_ids" 36 - orig_content=$(cat "$file") 37 - 38 - test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input" 39 - test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input" 40 - test_content "$file" "$orig_content" "1 2" "non-integer was there" 41 - test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input" 42 - test_content "$file" "$orig_content" "" "wrong input written" 43 - test_write_succ "$file" "" "$orig_content" "empty input" 44 - test_content "$file" "$orig_content" "" "empty input written" 45 - echo "$orig_content" > "$file" 46 - 47 - echo "PASS"
+13
tools/testing/selftests/damon/debugfs_empty_targets.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + source _debugfs_common.sh 5 + 6 + # Test empty targets case 7 + # ======================= 8 + 9 + orig_target_ids=$(cat "$DBGFS/target_ids") 10 + echo "" > "$DBGFS/target_ids" 11 + orig_monitor_on=$(cat "$DBGFS/monitor_on") 12 + test_write_fail "$DBGFS/monitor_on" "on" "orig_monitor_on" "empty target ids" 13 + echo "$orig_target_ids" > "$DBGFS/target_ids"
+22
tools/testing/selftests/damon/debugfs_huge_count_read_write.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + source _debugfs_common.sh 5 + 6 + # Test huge count read write 7 + # ========================== 8 + 9 + dmesg -C 10 + 11 + for file in "$DBGFS/"* 12 + do 13 + ./huge_count_read_write "$file" 14 + done 15 + 16 + if dmesg | grep -q WARNING 17 + then 18 + dmesg 19 + exit 1 20 + else 21 + exit 0 22 + fi
+19
tools/testing/selftests/damon/debugfs_schemes.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + source _debugfs_common.sh 5 + 6 + # Test schemes file 7 + # ================= 8 + 9 + file="$DBGFS/schemes" 10 + orig_content=$(cat "$file") 11 + 12 + test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \ 13 + "$orig_content" "valid input" 14 + test_write_fail "$file" "1 2 15 + 3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines" 16 + test_write_succ "$file" "" "$orig_content" "disabling" 17 + test_write_fail "$file" "2 1 2 1 10 1 3 10 1 1 1 1 1 1 1 1 2 3" \ 18 + "$orig_content" "wrong condition ranges" 19 + echo "$orig_content" > "$file"
+19
tools/testing/selftests/damon/debugfs_target_ids.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + source _debugfs_common.sh 5 + 6 + # Test target_ids file 7 + # ==================== 8 + 9 + file="$DBGFS/target_ids" 10 + orig_content=$(cat "$file") 11 + 12 + test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input" 13 + test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input" 14 + test_content "$file" "$orig_content" "1 2" "non-integer was there" 15 + test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input" 16 + test_content "$file" "$orig_content" "" "wrong input written" 17 + test_write_succ "$file" "" "$orig_content" "empty input" 18 + test_content "$file" "$orig_content" "" "empty input written" 19 + echo "$orig_content" > "$file"
+39
tools/testing/selftests/damon/huge_count_read_write.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Author: SeongJae Park <sj@kernel.org> 4 + */ 5 + 6 + #include <fcntl.h> 7 + #include <stdlib.h> 8 + #include <unistd.h> 9 + #include <stdio.h> 10 + 11 + void write_read_with_huge_count(char *file) 12 + { 13 + int filedesc = open(file, O_RDWR); 14 + char buf[25]; 15 + int ret; 16 + 17 + printf("%s %s\n", __func__, file); 18 + if (filedesc < 0) { 19 + fprintf(stderr, "failed opening %s\n", file); 20 + exit(1); 21 + } 22 + 23 + write(filedesc, "", 0xfffffffful); 24 + perror("after write: "); 25 + ret = read(filedesc, buf, 0xfffffffful); 26 + perror("after read: "); 27 + close(filedesc); 28 + } 29 + 30 + int main(int argc, char *argv[]) 31 + { 32 + if (argc != 2) { 33 + fprintf(stderr, "Usage: %s <file>\n", argv[0]); 34 + exit(1); 35 + } 36 + write_read_with_huge_count(argv[1]); 37 + 38 + return 0; 39 + }
+1
tools/testing/selftests/kvm/.gitignore
··· 30 30 /x86_64/svm_int_ctl_test 31 31 /x86_64/sync_regs_test 32 32 /x86_64/tsc_msrs_test 33 + /x86_64/userspace_io_test 33 34 /x86_64/userspace_msr_exit_test 34 35 /x86_64/vmx_apic_access_test 35 36 /x86_64/vmx_close_while_nested_test
+1
tools/testing/selftests/kvm/Makefile
··· 59 59 TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test 60 60 TEST_GEN_PROGS_x86_64 += x86_64/svm_int_ctl_test 61 61 TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test 62 + TEST_GEN_PROGS_x86_64 += x86_64/userspace_io_test 62 63 TEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test 63 64 TEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test 64 65 TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test
+9
tools/testing/selftests/kvm/include/kvm_util.h
··· 71 71 72 72 #endif 73 73 74 + #if defined(__x86_64__) 75 + unsigned long vm_compute_max_gfn(struct kvm_vm *vm); 76 + #else 77 + static inline unsigned long vm_compute_max_gfn(struct kvm_vm *vm) 78 + { 79 + return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1; 80 + } 81 + #endif 82 + 74 83 #define MIN_PAGE_SIZE (1U << MIN_PAGE_SHIFT) 75 84 #define PTES_PER_MIN_PAGE ptes_per_page(MIN_PAGE_SIZE) 76 85
+1 -1
tools/testing/selftests/kvm/lib/kvm_util.c
··· 302 302 (1ULL << (vm->va_bits - 1)) >> vm->page_shift); 303 303 304 304 /* Limit physical addresses to PA-bits. */ 305 - vm->max_gfn = ((1ULL << vm->pa_bits) >> vm->page_shift) - 1; 305 + vm->max_gfn = vm_compute_max_gfn(vm); 306 306 307 307 /* Allocate and setup memory for guest. */ 308 308 vm->vpages_mapped = sparsebit_alloc();
+68
tools/testing/selftests/kvm/lib/x86_64/processor.c
··· 1431 1431 1432 1432 return cpuid; 1433 1433 } 1434 + 1435 + #define X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx 0x68747541 1436 + #define X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx 0x444d4163 1437 + #define X86EMUL_CPUID_VENDOR_AuthenticAMD_edx 0x69746e65 1438 + 1439 + static inline unsigned x86_family(unsigned int eax) 1440 + { 1441 + unsigned int x86; 1442 + 1443 + x86 = (eax >> 8) & 0xf; 1444 + 1445 + if (x86 == 0xf) 1446 + x86 += (eax >> 20) & 0xff; 1447 + 1448 + return x86; 1449 + } 1450 + 1451 + unsigned long vm_compute_max_gfn(struct kvm_vm *vm) 1452 + { 1453 + const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */ 1454 + unsigned long ht_gfn, max_gfn, max_pfn; 1455 + uint32_t eax, ebx, ecx, edx, max_ext_leaf; 1456 + 1457 + max_gfn = (1ULL << (vm->pa_bits - vm->page_shift)) - 1; 1458 + 1459 + /* Avoid reserved HyperTransport region on AMD processors. */ 1460 + eax = ecx = 0; 1461 + cpuid(&eax, &ebx, &ecx, &edx); 1462 + if (ebx != X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx || 1463 + ecx != X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx || 1464 + edx != X86EMUL_CPUID_VENDOR_AuthenticAMD_edx) 1465 + return max_gfn; 1466 + 1467 + /* On parts with <40 physical address bits, the area is fully hidden */ 1468 + if (vm->pa_bits < 40) 1469 + return max_gfn; 1470 + 1471 + /* Before family 17h, the HyperTransport area is just below 1T. */ 1472 + ht_gfn = (1 << 28) - num_ht_pages; 1473 + eax = 1; 1474 + cpuid(&eax, &ebx, &ecx, &edx); 1475 + if (x86_family(eax) < 0x17) 1476 + goto done; 1477 + 1478 + /* 1479 + * Otherwise it's at the top of the physical address space, possibly 1480 + * reduced due to SME by bits 11:6 of CPUID[0x8000001f].EBX. Use 1481 + * the old conservative value if MAXPHYADDR is not enumerated. 1482 + */ 1483 + eax = 0x80000000; 1484 + cpuid(&eax, &ebx, &ecx, &edx); 1485 + max_ext_leaf = eax; 1486 + if (max_ext_leaf < 0x80000008) 1487 + goto done; 1488 + 1489 + eax = 0x80000008; 1490 + cpuid(&eax, &ebx, &ecx, &edx); 1491 + max_pfn = (1ULL << ((eax & 0xff) - vm->page_shift)) - 1; 1492 + if (max_ext_leaf >= 0x8000001f) { 1493 + eax = 0x8000001f; 1494 + cpuid(&eax, &ebx, &ecx, &edx); 1495 + max_pfn >>= (ebx >> 6) & 0x3f; 1496 + } 1497 + 1498 + ht_gfn = max_pfn - num_ht_pages; 1499 + done: 1500 + return min(max_gfn, ht_gfn - 1); 1501 + }
+1 -1
tools/testing/selftests/kvm/x86_64/svm_int_ctl_test.c
··· 75 75 vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK; 76 76 77 77 /* No intercepts for real and virtual interrupts */ 78 - vmcb->control.intercept &= ~(1ULL << INTERCEPT_INTR | INTERCEPT_VINTR); 78 + vmcb->control.intercept &= ~(BIT(INTERCEPT_INTR) | BIT(INTERCEPT_VINTR)); 79 79 80 80 /* Make a virtual interrupt VINTR_IRQ_NUMBER pending */ 81 81 vmcb->control.int_ctl |= V_IRQ_MASK | (0x1 << V_INTR_PRIO_SHIFT);
+114
tools/testing/selftests/kvm/x86_64/userspace_io_test.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <fcntl.h> 3 + #include <stdio.h> 4 + #include <stdlib.h> 5 + #include <string.h> 6 + #include <sys/ioctl.h> 7 + 8 + #include "test_util.h" 9 + 10 + #include "kvm_util.h" 11 + #include "processor.h" 12 + 13 + #define VCPU_ID 1 14 + 15 + static void guest_ins_port80(uint8_t *buffer, unsigned int count) 16 + { 17 + unsigned long end; 18 + 19 + if (count == 2) 20 + end = (unsigned long)buffer + 1; 21 + else 22 + end = (unsigned long)buffer + 8192; 23 + 24 + asm volatile("cld; rep; insb" : "+D"(buffer), "+c"(count) : "d"(0x80) : "memory"); 25 + GUEST_ASSERT_1(count == 0, count); 26 + GUEST_ASSERT_2((unsigned long)buffer == end, buffer, end); 27 + } 28 + 29 + static void guest_code(void) 30 + { 31 + uint8_t buffer[8192]; 32 + int i; 33 + 34 + /* 35 + * Special case tests. main() will adjust RCX 2 => 1 and 3 => 8192 to 36 + * test that KVM doesn't explode when userspace modifies the "count" on 37 + * a userspace I/O exit. KVM isn't required to play nice with the I/O 38 + * itself as KVM doesn't support manipulating the count, it just needs 39 + * to not explode or overflow a buffer. 40 + */ 41 + guest_ins_port80(buffer, 2); 42 + guest_ins_port80(buffer, 3); 43 + 44 + /* Verify KVM fills the buffer correctly when not stuffing RCX. */ 45 + memset(buffer, 0, sizeof(buffer)); 46 + guest_ins_port80(buffer, 8192); 47 + for (i = 0; i < 8192; i++) 48 + GUEST_ASSERT_2(buffer[i] == 0xaa, i, buffer[i]); 49 + 50 + GUEST_DONE(); 51 + } 52 + 53 + int main(int argc, char *argv[]) 54 + { 55 + struct kvm_regs regs; 56 + struct kvm_run *run; 57 + struct kvm_vm *vm; 58 + struct ucall uc; 59 + int rc; 60 + 61 + /* Tell stdout not to buffer its content */ 62 + setbuf(stdout, NULL); 63 + 64 + /* Create VM */ 65 + vm = vm_create_default(VCPU_ID, 0, guest_code); 66 + run = vcpu_state(vm, VCPU_ID); 67 + 68 + memset(&regs, 0, sizeof(regs)); 69 + 70 + while (1) { 71 + rc = _vcpu_run(vm, VCPU_ID); 72 + 73 + TEST_ASSERT(rc == 0, "vcpu_run failed: %d\n", rc); 74 + TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, 75 + "Unexpected exit reason: %u (%s),\n", 76 + run->exit_reason, 77 + exit_reason_str(run->exit_reason)); 78 + 79 + if (get_ucall(vm, VCPU_ID, &uc)) 80 + break; 81 + 82 + TEST_ASSERT(run->io.port == 0x80, 83 + "Expected I/O at port 0x80, got port 0x%x\n", run->io.port); 84 + 85 + /* 86 + * Modify the rep string count in RCX: 2 => 1 and 3 => 8192. 87 + * Note, this abuses KVM's batching of rep string I/O to avoid 88 + * getting stuck in an infinite loop. That behavior isn't in 89 + * scope from a testing perspective as it's not ABI in any way, 90 + * i.e. it really is abusing internal KVM knowledge. 91 + */ 92 + vcpu_regs_get(vm, VCPU_ID, &regs); 93 + if (regs.rcx == 2) 94 + regs.rcx = 1; 95 + if (regs.rcx == 3) 96 + regs.rcx = 8192; 97 + memset((void *)run + run->io.data_offset, 0xaa, 4096); 98 + vcpu_regs_set(vm, VCPU_ID, &regs); 99 + } 100 + 101 + switch (uc.cmd) { 102 + case UCALL_DONE: 103 + break; 104 + case UCALL_ABORT: 105 + TEST_FAIL("%s at %s:%ld : argN+1 = 0x%lx, argN+2 = 0x%lx", 106 + (const char *)uc.args[0], __FILE__, uc.args[1], 107 + uc.args[2], uc.args[3]); 108 + default: 109 + TEST_FAIL("Unknown ucall %lu", uc.cmd); 110 + } 111 + 112 + kvm_vm_free(vm); 113 + return 0; 114 + }
+8
tools/testing/selftests/net/fcnal-test.sh
··· 4077 4077 4078 4078 printf "\nTests passed: %3d\n" ${nsuccess} 4079 4079 printf "Tests failed: %3d\n" ${nfail} 4080 + 4081 + if [ $nfail -ne 0 ]; then 4082 + exit 1 # KSFT_FAIL 4083 + elif [ $nsuccess -eq 0 ]; then 4084 + exit $ksft_skip 4085 + fi 4086 + 4087 + exit 0 # KSFT_PASS
+49 -10
tools/testing/selftests/net/fib_tests.sh
··· 444 444 setup 445 445 446 446 set -e 447 + ip netns add ns2 448 + ip netns set ns2 auto 449 + 450 + ip -netns ns2 link set dev lo up 451 + 452 + $IP link add name veth1 type veth peer name veth2 453 + $IP link set dev veth2 netns ns2 454 + $IP address add 192.0.2.1/24 dev veth1 455 + ip -netns ns2 address add 192.0.2.1/24 dev veth2 456 + $IP link set dev veth1 up 457 + ip -netns ns2 link set dev veth2 up 458 + 447 459 $IP link set dev lo address 52:54:00:6a:c7:5e 448 - $IP link set dummy0 address 52:54:00:6a:c7:5e 449 - $IP link add dummy1 type dummy 450 - $IP link set dummy1 address 52:54:00:6a:c7:5e 451 - $IP link set dev dummy1 up 460 + $IP link set dev veth1 address 52:54:00:6a:c7:5e 461 + ip -netns ns2 link set dev lo address 52:54:00:6a:c7:5e 462 + ip -netns ns2 link set dev veth2 address 52:54:00:6a:c7:5e 463 + 464 + # 1. (ns2) redirect lo's egress to veth2's egress 465 + ip netns exec ns2 tc qdisc add dev lo parent root handle 1: fq_codel 466 + ip netns exec ns2 tc filter add dev lo parent 1: protocol arp basic \ 467 + action mirred egress redirect dev veth2 468 + ip netns exec ns2 tc filter add dev lo parent 1: protocol ip basic \ 469 + action mirred egress redirect dev veth2 470 + 471 + # 2. (ns1) redirect veth1's ingress to lo's ingress 472 + $NS_EXEC tc qdisc add dev veth1 ingress 473 + $NS_EXEC tc filter add dev veth1 ingress protocol arp basic \ 474 + action mirred ingress redirect dev lo 475 + $NS_EXEC tc filter add dev veth1 ingress protocol ip basic \ 476 + action mirred ingress redirect dev lo 477 + 478 + # 3. (ns1) redirect lo's egress to veth1's egress 479 + $NS_EXEC tc qdisc add dev lo parent root handle 1: fq_codel 480 + $NS_EXEC tc filter add dev lo parent 1: protocol arp basic \ 481 + action mirred egress redirect dev veth1 482 + $NS_EXEC tc filter add dev lo parent 1: protocol ip basic \ 483 + action mirred egress redirect dev veth1 484 + 485 + # 4. (ns2) redirect veth2's ingress to lo's ingress 486 + ip netns exec ns2 tc qdisc add dev veth2 ingress 487 + ip netns exec ns2 tc filter add dev veth2 ingress protocol arp basic \ 488 + action mirred ingress redirect dev lo 489 + ip netns exec ns2 tc filter add dev veth2 ingress protocol ip basic \ 490 + action mirred ingress redirect dev lo 491 + 452 492 $NS_EXEC sysctl -qw net.ipv4.conf.all.rp_filter=1 453 493 $NS_EXEC sysctl -qw net.ipv4.conf.all.accept_local=1 454 494 $NS_EXEC sysctl -qw net.ipv4.conf.all.route_localnet=1 455 - 456 - $NS_EXEC tc qd add dev dummy1 parent root handle 1: fq_codel 457 - $NS_EXEC tc filter add dev dummy1 parent 1: protocol arp basic action mirred egress redirect dev lo 458 - $NS_EXEC tc filter add dev dummy1 parent 1: protocol ip basic action mirred egress redirect dev lo 495 + ip netns exec ns2 sysctl -qw net.ipv4.conf.all.rp_filter=1 496 + ip netns exec ns2 sysctl -qw net.ipv4.conf.all.accept_local=1 497 + ip netns exec ns2 sysctl -qw net.ipv4.conf.all.route_localnet=1 459 498 set +e 460 499 461 - run_cmd "ip netns exec ns1 ping -I dummy1 -w1 -c1 198.51.100.1" 500 + run_cmd "ip netns exec ns2 ping -w1 -c1 192.0.2.1" 462 501 log_test $? 0 "rp_filter passes local packets" 463 502 464 - run_cmd "ip netns exec ns1 ping -I dummy1 -w1 -c1 127.0.0.1" 503 + run_cmd "ip netns exec ns2 ping -w1 -c1 127.0.0.1" 465 504 log_test $? 0 "rp_filter passes loopback packets" 466 505 467 506 cleanup
+36
tools/testing/selftests/net/tls.c
··· 31 31 struct tls12_crypto_info_chacha20_poly1305 chacha20; 32 32 struct tls12_crypto_info_sm4_gcm sm4gcm; 33 33 struct tls12_crypto_info_sm4_ccm sm4ccm; 34 + struct tls12_crypto_info_aes_ccm_128 aesccm128; 35 + struct tls12_crypto_info_aes_gcm_256 aesgcm256; 34 36 }; 35 37 size_t len; 36 38 }; ··· 62 60 tls12->len = sizeof(struct tls12_crypto_info_sm4_ccm); 63 61 tls12->sm4ccm.info.version = tls_version; 64 62 tls12->sm4ccm.info.cipher_type = cipher_type; 63 + break; 64 + case TLS_CIPHER_AES_CCM_128: 65 + tls12->len = sizeof(struct tls12_crypto_info_aes_ccm_128); 66 + tls12->aesccm128.info.version = tls_version; 67 + tls12->aesccm128.info.cipher_type = cipher_type; 68 + break; 69 + case TLS_CIPHER_AES_GCM_256: 70 + tls12->len = sizeof(struct tls12_crypto_info_aes_gcm_256); 71 + tls12->aesgcm256.info.version = tls_version; 72 + tls12->aesgcm256.info.cipher_type = cipher_type; 65 73 break; 66 74 default: 67 75 break; ··· 271 259 { 272 260 .tls_version = TLS_1_3_VERSION, 273 261 .cipher_type = TLS_CIPHER_SM4_CCM, 262 + }; 263 + 264 + FIXTURE_VARIANT_ADD(tls, 12_aes_ccm) 265 + { 266 + .tls_version = TLS_1_2_VERSION, 267 + .cipher_type = TLS_CIPHER_AES_CCM_128, 268 + }; 269 + 270 + FIXTURE_VARIANT_ADD(tls, 13_aes_ccm) 271 + { 272 + .tls_version = TLS_1_3_VERSION, 273 + .cipher_type = TLS_CIPHER_AES_CCM_128, 274 + }; 275 + 276 + FIXTURE_VARIANT_ADD(tls, 12_aes_gcm_256) 277 + { 278 + .tls_version = TLS_1_2_VERSION, 279 + .cipher_type = TLS_CIPHER_AES_GCM_256, 280 + }; 281 + 282 + FIXTURE_VARIANT_ADD(tls, 13_aes_gcm_256) 283 + { 284 + .tls_version = TLS_1_3_VERSION, 285 + .cipher_type = TLS_CIPHER_AES_GCM_256, 274 286 }; 275 287 276 288 FIXTURE_SETUP(tls)
+26 -4
tools/testing/selftests/netfilter/conntrack_vrf.sh
··· 150 150 # oifname is the vrf device. 151 151 test_masquerade_vrf() 152 152 { 153 + local qdisc=$1 154 + 155 + if [ "$qdisc" != "default" ]; then 156 + tc -net $ns0 qdisc add dev tvrf root $qdisc 157 + fi 158 + 153 159 ip netns exec $ns0 conntrack -F 2>/dev/null 154 160 155 161 ip netns exec $ns0 nft -f - <<EOF 156 162 flush ruleset 157 163 table ip nat { 164 + chain rawout { 165 + type filter hook output priority raw; 166 + 167 + oif tvrf ct state untracked counter 168 + } 169 + chain postrouting2 { 170 + type filter hook postrouting priority mangle; 171 + 172 + oif tvrf ct state untracked counter 173 + } 158 174 chain postrouting { 159 175 type nat hook postrouting priority 0; 160 176 # NB: masquerade should always be combined with 'oif(name) bla', ··· 187 171 fi 188 172 189 173 # must also check that nat table was evaluated on second (lower device) iteration. 190 - ip netns exec $ns0 nft list table ip nat |grep -q 'counter packets 2' 174 + ip netns exec $ns0 nft list table ip nat |grep -q 'counter packets 2' && 175 + ip netns exec $ns0 nft list table ip nat |grep -q 'untracked counter packets [1-9]' 191 176 if [ $? -eq 0 ]; then 192 - echo "PASS: iperf3 connect with masquerade + sport rewrite on vrf device" 177 + echo "PASS: iperf3 connect with masquerade + sport rewrite on vrf device ($qdisc qdisc)" 193 178 else 194 - echo "FAIL: vrf masq rule has unexpected counter value" 179 + echo "FAIL: vrf rules have unexpected counter value" 195 180 ret=1 181 + fi 182 + 183 + if [ "$qdisc" != "default" ]; then 184 + tc -net $ns0 qdisc del dev tvrf root 196 185 fi 197 186 } 198 187 ··· 234 213 } 235 214 236 215 test_ct_zone_in 237 - test_masquerade_vrf 216 + test_masquerade_vrf "default" 217 + test_masquerade_vrf "pfifo" 238 218 test_masquerade_veth 239 219 240 220 exit $ret
+21 -3
tools/testing/selftests/netfilter/nft_concat_range.sh
··· 23 23 24 24 # Set types, defined by TYPE_ variables below 25 25 TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto 26 - net_port_net net_mac net_mac_icmp net6_mac_icmp net6_port_net6_port 27 - net_port_mac_proto_net" 26 + net_port_net net_mac mac_net net_mac_icmp net6_mac_icmp 27 + net6_port_net6_port net_port_mac_proto_net" 28 28 29 29 # Reported bugs, also described by TYPE_ variables below 30 30 BUGS="flush_remove_add" ··· 275 275 perf_src 276 276 perf_entries 1000 277 277 perf_proto ipv4 278 + " 279 + 280 + TYPE_mac_net=" 281 + display mac,net 282 + type_spec ether_addr . ipv4_addr 283 + chain_spec ether saddr . ip saddr 284 + dst 285 + src mac addr4 286 + start 1 287 + count 5 288 + src_delta 2000 289 + tools sendip nc bash 290 + proto udp 291 + 292 + race_repeat 0 293 + 294 + perf_duration 0 278 295 " 279 296 280 297 TYPE_net_mac_icmp=" ··· 1001 984 fi 1002 985 done 1003 986 for f in ${src}; do 1004 - __expr="${__expr} . " 987 + [ "${__expr}" != "{ " ] && __expr="${__expr} . " 988 + 1005 989 __start="$(eval format_"${f}" "${srcstart}")" 1006 990 __end="$(eval format_"${f}" "${srcend}")" 1007 991
+13 -6
tools/testing/selftests/netfilter/nft_zones_many.sh
··· 18 18 ip netns del $ns 19 19 } 20 20 21 - ip netns add $ns 22 - if [ $? -ne 0 ];then 23 - echo "SKIP: Could not create net namespace $gw" 24 - exit $ksft_skip 25 - fi 21 + checktool (){ 22 + if ! $1 > /dev/null 2>&1; then 23 + echo "SKIP: Could not $2" 24 + exit $ksft_skip 25 + fi 26 + } 27 + 28 + checktool "nft --version" "run test without nft tool" 29 + checktool "ip -Version" "run test without ip tool" 30 + checktool "socat -V" "run test without socat tool" 31 + checktool "ip netns add $ns" "create net namespace" 26 32 27 33 trap cleanup EXIT 28 34 ··· 77 71 local start=$(date +%s%3N) 78 72 i=$((i + 10000)) 79 73 j=$((j + 1)) 80 - dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" nc -w 1 -q 1 -u -p 12345 127.0.0.1 12345 > /dev/null 74 + # nft rule in output places each packet in a different zone. 75 + dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345 81 76 if [ $? -ne 0 ] ;then 82 77 ret=1 83 78 break
+2
tools/testing/selftests/tc-testing/config
··· 60 60 CONFIG_NET_SCH_FIFO=y 61 61 CONFIG_NET_SCH_ETS=m 62 62 CONFIG_NET_SCH_RED=m 63 + CONFIG_NET_SCH_FQ_PIE=m 64 + CONFIG_NETDEVSIM=m 63 65 64 66 # 65 67 ## Network testing
+5 -3
tools/testing/selftests/tc-testing/tdc.py
··· 716 716 list_test_cases(alltests) 717 717 exit(0) 718 718 719 + exit_code = 0 # KSFT_PASS 719 720 if len(alltests): 720 721 req_plugins = pm.get_required_plugins(alltests) 721 722 try: ··· 725 724 print('The following plugins were not found:') 726 725 print('{}'.format(pde.missing_pg)) 727 726 catresults = test_runner(pm, args, alltests) 727 + if catresults.count_failures() != 0: 728 + exit_code = 1 # KSFT_FAIL 728 729 if args.format == 'none': 729 730 print('Test results output suppression requested\n') 730 731 else: ··· 751 748 gid=int(os.getenv('SUDO_GID'))) 752 749 else: 753 750 print('No tests found\n') 751 + exit_code = 4 # KSFT_SKIP 752 + exit(exit_code) 754 753 755 754 def main(): 756 755 """ ··· 771 766 print('args is {}'.format(args)) 772 767 773 768 set_operation_mode(pm, parser, args, remaining) 774 - 775 - exit(0) 776 - 777 769 778 770 if __name__ == "__main__": 779 771 main()
+1
tools/testing/selftests/tc-testing/tdc.sh
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 + modprobe netdevsim 4 5 ./tdc.py -c actions --nobuildebpf 5 6 ./tdc.py -c qdisc