Workaround for Cavium/Marvell ThunderX2 erratum #219. * errata/tx2-219: arm64: Allow CAVIUM_TX2_ERRATUM_219 to be selected arm64: Avoid Cavium TX2 erratum 219 when switching TTBR arm64: Enable workaround for Cavium TX2 erratum 219 when running SMT arm64: KVM: Trap VM ops when ARM64_WORKAROUND_CAVIUM_TX2_219_TVM is set
Unified · Split
| @@ -107,6 +107,8 @@ stable kernels. · 106 unmodified lines | ||
| 107 | 107 | +----------------+-----------------+-----------------+-----------------------------+ |
| 108 | 108 | | Cavium | ThunderX2 SMMUv3| #126 | N/A | |
| 109 | 109 | +----------------+-----------------+-----------------+-----------------------------+ |
| 110 | +| Cavium | ThunderX2 Core | #219 | CAVIUM_TX2_ERRATUM_219 | | |
| 111 | ++----------------+-----------------+-----------------+-----------------------------+ | |
| 110 | 112 | +----------------+-----------------+-----------------+-----------------------------+ |
| 111 | 113 | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | |
| 112 | 114 | +----------------+-----------------+-----------------+-----------------------------+ |
| @@ -85,4 +85,5 @@ examples: · 84 unmodified lines | ||
| 85 | 85 | <&pd IMX_SC_R_DSP_RAM>; |
| 86 | 86 | mbox-names = "txdb0", "txdb1", "rxdb0", "rxdb1"; |
| 87 | 87 | mboxes = <&lsio_mu13 2 0>, <&lsio_mu13 2 1>, <&lsio_mu13 3 0>, <&lsio_mu13 3 1>; |
| 88 | + memory-region = <&dsp_reserved>; | |
| 88 | 89 | }; |
| @@ -43,13 +43,9 @@ properties: · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | dvdd-supply: |
| 45 | 45 | description: DVdd voltage supply |
| 46 | − items: | |
| 47 | − - const: dvdd | |
| 48 | 46 | |
| 49 | 47 | avdd-supply: |
| 50 | 48 | description: AVdd voltage supply |
| 51 | − items: | |
| 52 | − - const: avdd | |
| 53 | 49 | |
| 54 | 50 | adi,rejection-60-Hz-enable: |
| 55 | 51 | description: | |
| @@ -99,6 +95,9 @@ required: · 43 unmodified lines | ||
| 99 | 95 | examples: |
| 100 | 96 | - | |
| 101 | 97 | spi0 { |
| 98 | + #address-cells = <1>; | |
| 99 | + #size-cells = <0>; | |
| 100 | + | |
| 102 | 101 | adc@0 { |
| 103 | 102 | compatible = "adi,ad7192"; |
| 104 | 103 | reg = <0>; |
| @@ -73,7 +73,6 @@ properties: · 72 unmodified lines | ||
| 73 | 73 | - rc-genius-tvgo-a11mce |
| 74 | 74 | - rc-gotview7135 |
| 75 | 75 | - rc-hauppauge |
| 76 | − - rc-hauppauge | |
| 77 | 76 | - rc-hisi-poplar |
| 78 | 77 | - rc-hisi-tv-demo |
| 79 | 78 | - rc-imon-mce |
| @@ -37,7 +37,7 @@ properties: · 36 unmodified lines | ||
| 37 | 37 | - description: exclusive PHY reset line |
| 38 | 38 | - description: shared reset line between the PCIe PHY and PCIe controller |
| 39 | 39 | |
| 40 | − resets-names: | |
| 40 | + reset-names: | |
| 41 | 41 | items: |
| 42 | 42 | - const: phy |
| 43 | 43 | - const: pcie |
| @@ -954,11 +954,6 @@ When kbuild executes, the following steps are followed (roughly): · 953 unmodified lines | ||
| 954 | 954 | |
| 955 | 955 | From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). |
| 956 | 956 | |
| 957 | − KBUILD_ARFLAGS Options for $(AR) when creating archives | |
| 958 | − | |
| 959 | − $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic | |
| 960 | − mode) if this option is supported by $(AR). | |
| 961 | − | |
| 962 | 957 | KBUILD_LDS |
| 963 | 958 | |
| 964 | 959 | The linker script with full path. Assigned by the top-level Makefile. |
| @@ -498,10 +498,11 @@ build. · 497 unmodified lines | ||
| 498 | 498 | will be written containing all exported symbols that were not |
| 499 | 499 | defined in the kernel. |
| 500 | 500 | |
| 501 | −--- 6.3 Symbols From Another External Module | |
| 501 | +6.3 Symbols From Another External Module | |
| 502 | +---------------------------------------- | |
| 502 | 503 | |
| 503 | 504 | Sometimes, an external module uses exported symbols from |
| 504 | − another external module. kbuild needs to have full knowledge of | |
| 505 | + another external module. Kbuild needs to have full knowledge of | |
| 505 | 506 | all symbols to avoid spitting out warnings about undefined |
| 506 | 507 | symbols. Three solutions exist for this situation. |
| 507 | 508 | |
| @@ -521,7 +522,7 @@ build. · 13 unmodified lines | ||
| 521 | 522 | The top-level kbuild file would then look like:: |
| 522 | 523 | |
| 523 | 524 | #./Kbuild (or ./Makefile): |
| 524 | − obj-y := foo/ bar/ | |
| 525 | + obj-m := foo/ bar/ | |
| 525 | 526 | |
| 526 | 527 | And executing:: |
| 527 | 528 | |
| @@ -16,16 +16,21 @@ the kernel may be unreproducible, and how to avoid them. · 15 unmodified lines | ||
| 16 | 16 | Timestamps |
| 17 | 17 | ---------- |
| 18 | 18 | |
| 19 | −The kernel embeds a timestamp in two places: | |
| 19 | +The kernel embeds timestamps in three places: | |
| 20 | 20 | |
| 21 | 21 | * The version string exposed by ``uname()`` and included in |
| 22 | 22 | ``/proc/version`` |
| 23 | 23 | |
| 24 | 24 | * File timestamps in the embedded initramfs |
| 25 | 25 | |
| 26 | −By default the timestamp is the current time. This must be overridden | |
| 27 | −using the `KBUILD_BUILD_TIMESTAMP`_ variable. If you are building | |
| 28 | −from a git commit, you could use its commit date. | |
| 26 | +* If enabled via ``CONFIG_IKHEADERS``, file timestamps of kernel | |
| 27 | + headers embedded in the kernel or respective module, | |
| 28 | + exposed via ``/sys/kernel/kheaders.tar.xz`` | |
| 29 | + | |
| 30 | +By default the timestamp is the current time and in the case of | |
| 31 | +``kheaders`` the various files' modification times. This must | |
| 32 | +be overridden using the `KBUILD_BUILD_TIMESTAMP`_ variable. | |
| 33 | +If you are building from a git commit, you could use its commit date. | |
| 29 | 34 | |
| 30 | 35 | The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros, |
| 31 | 36 | and enables warnings if they are used. If you incorporate external |
| @@ -23,6 +23,7 @@ Contents: · 22 unmodified lines | ||
| 23 | 23 | intel/ice |
| 24 | 24 | google/gve |
| 25 | 25 | mellanox/mlx5 |
| 26 | + netronome/nfp | |
| 26 | 27 | pensando/ionic |
| 27 | 28 | |
| 28 | 29 | .. only:: subproject and html |
| @@ -272,7 +272,7 @@ supported flags are: · 271 unmodified lines | ||
| 272 | 272 | * MSG_DONTWAIT, i.e. non-blocking operation. |
| 273 | 273 | |
| 274 | 274 | recvmsg(2) |
| 275 | −^^^^^^^^^ | |
| 275 | +^^^^^^^^^^ | |
| 276 | 276 | |
| 277 | 277 | In most cases recvmsg(2) is needed if you want to extract more information than |
| 278 | 278 | recvfrom(2) can provide. For example package priority and timestamp. The |
| @@ -6112,7 +6112,10 @@ M: Gao Xiang <gaoxiang25@huawei.com> · 6111 unmodified lines | ||
| 6112 | 6112 | M: Chao Yu <yuchao0@huawei.com> |
| 6113 | 6113 | L: linux-erofs@lists.ozlabs.org |
| 6114 | 6114 | S: Maintained |
| 6115 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git | |
| 6116 | +F: Documentation/filesystems/erofs.txt | |
| 6115 | 6117 | F: fs/erofs/ |
| 6118 | +F: include/trace/events/erofs.h | |
| 6116 | 6119 | |
| 6117 | 6120 | ERRSEQ ERROR TRACKING INFRASTRUCTURE |
| 6118 | 6121 | M: Jeff Layton <jlayton@kernel.org> |
| @@ -9075,6 +9078,7 @@ F: security/keys/ · 2956 unmodified lines | ||
| 9075 | 9078 | KGDB / KDB /debug_core |
| 9076 | 9079 | M: Jason Wessel <jason.wessel@windriver.com> |
| 9077 | 9080 | M: Daniel Thompson <daniel.thompson@linaro.org> |
| 9081 | +R: Douglas Anderson <dianders@chromium.org> | |
| 9078 | 9082 | W: http://kgdb.wiki.kernel.org/ |
| 9079 | 9083 | L: kgdb-bugreport@lists.sourceforge.net |
| 9080 | 9084 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git |
| @@ -2,8 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 4 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc1 | |
| 6 | −NAME = Bobtail Squid | |
| 5 | +EXTRAVERSION = -rc2 | |
| 6 | +NAME = Nesting Opossum | |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| 9 | 9 | # To see a list of typical targets execute "make help" |
| @@ -206,24 +206,8 @@ ifndef KBUILD_CHECKSRC · 196 unmodified lines | ||
| 206 | 206 | KBUILD_CHECKSRC = 0 |
| 207 | 207 | endif |
| 208 | 208 | |
| 209 | −# Use make M=dir to specify directory of external module to build | |
| 210 | −# Old syntax make ... SUBDIRS=$PWD is still supported | |
| 211 | −# Setting the environment variable KBUILD_EXTMOD take precedence | |
| 212 | −ifdef SUBDIRS | |
| 213 | − $(warning ================= WARNING ================) | |
| 214 | − $(warning 'SUBDIRS' will be removed after Linux 5.3) | |
| 215 | − $(warning ) | |
| 216 | − $(warning If you are building an individual subdirectory) | |
| 217 | − $(warning in the kernel tree, you can do like this:) | |
| 218 | − $(warning $$ make path/to/dir/you/want/to/build/) | |
| 219 | − $(warning (Do not forget the trailing slash)) | |
| 220 | − $(warning ) | |
| 221 | − $(warning If you are building an external module,) | |
| 222 | − $(warning Please use 'M=' or 'KBUILD_EXTMOD' instead) | |
| 223 | − $(warning ==========================================) | |
| 224 | − KBUILD_EXTMOD ?= $(SUBDIRS) | |
| 225 | −endif | |
| 226 | − | |
| 209 | +# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the | |
| 210 | +# directory of external module to build. Setting M= takes precedence. | |
| 227 | 211 | ifeq ("$(origin M)", "command line") |
| 228 | 212 | KBUILD_EXTMOD := $(M) |
| 229 | 213 | endif |
| @@ -498,7 +482,6 @@ export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN · 268 unmodified lines | ||
| 498 | 482 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE |
| 499 | 483 | export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE |
| 500 | 484 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL |
| 501 | −export KBUILD_ARFLAGS | |
| 502 | 485 | |
| 503 | 486 | # Files to ignore in find ... statements |
| 504 | 487 | |
| @@ -914,9 +897,6 @@ ifdef CONFIG_RETPOLINE · 409 unmodified lines | ||
| 914 | 897 | KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) |
| 915 | 898 | endif |
| 916 | 899 | |
| 917 | −# use the deterministic mode of AR if available | |
| 918 | −KBUILD_ARFLAGS := $(call ar-option,D) | |
| 919 | − | |
| 920 | 900 | include scripts/Makefile.kasan |
| 921 | 901 | include scripts/Makefile.extrawarn |
| 922 | 902 | include scripts/Makefile.ubsan |
| @@ -432,7 +432,7 @@ · 431 unmodified lines | ||
| 432 | 432 | pinctrl-0 = <&mmc0_pins_default>; |
| 433 | 433 | }; |
| 434 | 434 | |
| 435 | −&gpio0 { | |
| 435 | +&gpio0_target { | |
| 436 | 436 | /* Do not idle the GPIO used for holding the VTT regulator */ |
| 437 | 437 | ti,no-reset-on-init; |
| 438 | 438 | ti,no-idle-on-init; |
| @@ -127,7 +127,7 @@ · 126 unmodified lines | ||
| 127 | 127 | ranges = <0x0 0x5000 0x1000>; |
| 128 | 128 | }; |
| 129 | 129 | |
| 130 | − target-module@7000 { /* 0x44e07000, ap 14 20.0 */ | |
| 130 | + gpio0_target: target-module@7000 { /* 0x44e07000, ap 14 20.0 */ | |
| 131 | 131 | compatible = "ti,sysc-omap2", "ti,sysc"; |
| 132 | 132 | ti,hwmods = "gpio1"; |
| 133 | 133 | reg = <0x7000 0x4>, |
| @@ -2038,7 +2038,9 @@ · 1904 unmodified lines | ||
| 2038 | 2038 | reg = <0xe000 0x4>, |
| 2039 | 2039 | <0xe054 0x4>; |
| 2040 | 2040 | reg-names = "rev", "sysc"; |
| 2041 | − ti,sysc-midle ; | |
| 2041 | + ti,sysc-midle = <SYSC_IDLE_FORCE>, | |
| 2042 | + <SYSC_IDLE_NO>, | |
| 2043 | + <SYSC_IDLE_SMART>; | |
| 2042 | 2044 | ti,sysc-sidle = <SYSC_IDLE_FORCE>, |
| 2043 | 2045 | <SYSC_IDLE_NO>, |
| 2044 | 2046 | <SYSC_IDLE_SMART>; |
| @@ -337,6 +337,8 @@ · 336 unmodified lines | ||
| 337 | 337 | ti,hwmods = "dss_dispc"; |
| 338 | 338 | clocks = <&disp_clk>; |
| 339 | 339 | clock-names = "fck"; |
| 340 | + | |
| 341 | + max-memory-bandwidth = <230000000>; | |
| 340 | 342 | }; |
| 341 | 343 | |
| 342 | 344 | rfbi: rfbi@4832a800 { |
| @@ -2732,7 +2732,7 @@ · 2731 unmodified lines | ||
| 2732 | 2732 | interrupt-names = "tx", "rx"; |
| 2733 | 2733 | dmas = <&edma_xbar 129 1>, <&edma_xbar 128 1>; |
| 2734 | 2734 | dma-names = "tx", "rx"; |
| 2735 | − clocks = <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 22>, | |
| 2735 | + clocks = <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 0>, | |
| 2736 | 2736 | <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 24>, |
| 2737 | 2737 | <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 28>; |
| 2738 | 2738 | clock-names = "fck", "ahclkx", "ahclkr"; |
| @@ -2768,8 +2768,8 @@ · 29 unmodified lines | ||
| 2768 | 2768 | interrupt-names = "tx", "rx"; |
| 2769 | 2769 | dmas = <&edma_xbar 131 1>, <&edma_xbar 130 1>; |
| 2770 | 2770 | dma-names = "tx", "rx"; |
| 2771 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 22>, | |
| 2772 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 24>, | |
| 2771 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 0>, | |
| 2772 | + <&ipu_clkctrl DRA7_IPU_MCASP1_CLKCTRL 24>, | |
| 2773 | 2773 | <&l4per2_clkctrl DRA7_L4PER2_MCASP2_CLKCTRL 28>; |
| 2774 | 2774 | clock-names = "fck", "ahclkx", "ahclkr"; |
| 2775 | 2775 | status = "disabled"; |
| @@ -2786,9 +2786,8 @@ · 10 unmodified lines | ||
| 2786 | 2786 | <SYSC_IDLE_SMART>; |
| 2787 | 2787 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2788 | 2788 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 0>, |
| 2789 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>, | |
| 2790 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 28>; | |
| 2791 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2789 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>; | |
| 2790 | + clock-names = "fck", "ahclkx"; | |
| 2792 | 2791 | #address-cells = <1>; |
| 2793 | 2792 | #size-cells = <1>; |
| 2794 | 2793 | ranges = <0x0 0x68000 0x2000>, |
| @@ -2804,7 +2803,7 @@ · 9 unmodified lines | ||
| 2804 | 2803 | interrupt-names = "tx", "rx"; |
| 2805 | 2804 | dmas = <&edma_xbar 133 1>, <&edma_xbar 132 1>; |
| 2806 | 2805 | dma-names = "tx", "rx"; |
| 2807 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 22>, | |
| 2806 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 0>, | |
| 2808 | 2807 | <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>; |
| 2809 | 2808 | clock-names = "fck", "ahclkx"; |
| 2810 | 2809 | status = "disabled"; |
| @@ -2821,9 +2820,8 @@ · 10 unmodified lines | ||
| 2821 | 2820 | <SYSC_IDLE_SMART>; |
| 2822 | 2821 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2823 | 2822 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 0>, |
| 2824 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>, | |
| 2825 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 28>; | |
| 2826 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2823 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>; | |
| 2824 | + clock-names = "fck", "ahclkx"; | |
| 2827 | 2825 | #address-cells = <1>; |
| 2828 | 2826 | #size-cells = <1>; |
| 2829 | 2827 | ranges = <0x0 0x6c000 0x2000>, |
| @@ -2839,7 +2837,7 @@ · 9 unmodified lines | ||
| 2839 | 2837 | interrupt-names = "tx", "rx"; |
| 2840 | 2838 | dmas = <&edma_xbar 135 1>, <&edma_xbar 134 1>; |
| 2841 | 2839 | dma-names = "tx", "rx"; |
| 2842 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 22>, | |
| 2840 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 0>, | |
| 2843 | 2841 | <&l4per2_clkctrl DRA7_L4PER2_MCASP4_CLKCTRL 24>; |
| 2844 | 2842 | clock-names = "fck", "ahclkx"; |
| 2845 | 2843 | status = "disabled"; |
| @@ -2856,9 +2854,8 @@ · 10 unmodified lines | ||
| 2856 | 2854 | <SYSC_IDLE_SMART>; |
| 2857 | 2855 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2858 | 2856 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 0>, |
| 2859 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>, | |
| 2860 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 28>; | |
| 2861 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2857 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>; | |
| 2858 | + clock-names = "fck", "ahclkx"; | |
| 2862 | 2859 | #address-cells = <1>; |
| 2863 | 2860 | #size-cells = <1>; |
| 2864 | 2861 | ranges = <0x0 0x70000 0x2000>, |
| @@ -2874,7 +2871,7 @@ · 9 unmodified lines | ||
| 2874 | 2871 | interrupt-names = "tx", "rx"; |
| 2875 | 2872 | dmas = <&edma_xbar 137 1>, <&edma_xbar 136 1>; |
| 2876 | 2873 | dma-names = "tx", "rx"; |
| 2877 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 22>, | |
| 2874 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 0>, | |
| 2878 | 2875 | <&l4per2_clkctrl DRA7_L4PER2_MCASP5_CLKCTRL 24>; |
| 2879 | 2876 | clock-names = "fck", "ahclkx"; |
| 2880 | 2877 | status = "disabled"; |
| @@ -2891,9 +2888,8 @@ · 10 unmodified lines | ||
| 2891 | 2888 | <SYSC_IDLE_SMART>; |
| 2892 | 2889 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2893 | 2890 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 0>, |
| 2894 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>, | |
| 2895 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 28>; | |
| 2896 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2891 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>; | |
| 2892 | + clock-names = "fck", "ahclkx"; | |
| 2897 | 2893 | #address-cells = <1>; |
| 2898 | 2894 | #size-cells = <1>; |
| 2899 | 2895 | ranges = <0x0 0x74000 0x2000>, |
| @@ -2909,7 +2905,7 @@ · 9 unmodified lines | ||
| 2909 | 2905 | interrupt-names = "tx", "rx"; |
| 2910 | 2906 | dmas = <&edma_xbar 139 1>, <&edma_xbar 138 1>; |
| 2911 | 2907 | dma-names = "tx", "rx"; |
| 2912 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 22>, | |
| 2908 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 0>, | |
| 2913 | 2909 | <&l4per2_clkctrl DRA7_L4PER2_MCASP6_CLKCTRL 24>; |
| 2914 | 2910 | clock-names = "fck", "ahclkx"; |
| 2915 | 2911 | status = "disabled"; |
| @@ -2926,9 +2922,8 @@ · 10 unmodified lines | ||
| 2926 | 2922 | <SYSC_IDLE_SMART>; |
| 2927 | 2923 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2928 | 2924 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 0>, |
| 2929 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>, | |
| 2930 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 28>; | |
| 2931 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2925 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>; | |
| 2926 | + clock-names = "fck", "ahclkx"; | |
| 2932 | 2927 | #address-cells = <1>; |
| 2933 | 2928 | #size-cells = <1>; |
| 2934 | 2929 | ranges = <0x0 0x78000 0x2000>, |
| @@ -2944,7 +2939,7 @@ · 9 unmodified lines | ||
| 2944 | 2939 | interrupt-names = "tx", "rx"; |
| 2945 | 2940 | dmas = <&edma_xbar 141 1>, <&edma_xbar 140 1>; |
| 2946 | 2941 | dma-names = "tx", "rx"; |
| 2947 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 22>, | |
| 2942 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 0>, | |
| 2948 | 2943 | <&l4per2_clkctrl DRA7_L4PER2_MCASP7_CLKCTRL 24>; |
| 2949 | 2944 | clock-names = "fck", "ahclkx"; |
| 2950 | 2945 | status = "disabled"; |
| @@ -2961,9 +2956,8 @@ · 10 unmodified lines | ||
| 2961 | 2956 | <SYSC_IDLE_SMART>; |
| 2962 | 2957 | /* Domains (P, C): l4per_pwrdm, l4per2_clkdm */ |
| 2963 | 2958 | clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 0>, |
| 2964 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>, | |
| 2965 | − <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 28>; | |
| 2966 | − clock-names = "fck", "ahclkx", "ahclkr"; | |
| 2959 | + <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>; | |
| 2960 | + clock-names = "fck", "ahclkx"; | |
| 2967 | 2961 | #address-cells = <1>; |
| 2968 | 2962 | #size-cells = <1>; |
| 2969 | 2963 | ranges = <0x0 0x7c000 0x2000>, |
| @@ -2979,7 +2973,7 @@ · 9 unmodified lines | ||
| 2979 | 2973 | interrupt-names = "tx", "rx"; |
| 2980 | 2974 | dmas = <&edma_xbar 143 1>, <&edma_xbar 142 1>; |
| 2981 | 2975 | dma-names = "tx", "rx"; |
| 2982 | − clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 22>, | |
| 2976 | + clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 0>, | |
| 2983 | 2977 | <&l4per2_clkctrl DRA7_L4PER2_MCASP8_CLKCTRL 24>; |
| 2984 | 2978 | clock-names = "fck", "ahclkx"; |
| 2985 | 2979 | status = "disabled"; |
| @@ -124,6 +124,7 @@ · 123 unmodified lines | ||
| 124 | 124 | spi-max-frequency = <100000>; |
| 125 | 125 | spi-cpol; |
| 126 | 126 | spi-cpha; |
| 127 | + spi-cs-high; | |
| 127 | 128 | |
| 128 | 129 | backlight= <&backlight>; |
| 129 | 130 | label = "lcd"; |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <dt-bindings/mfd/dbx500-prcmu.h> |
| 9 | 9 | #include <dt-bindings/arm/ux500_pm_domains.h> |
| 10 | 10 | #include <dt-bindings/gpio/gpio.h> |
| 11 | +#include <dt-bindings/thermal/thermal.h> | |
| 11 | 12 | |
| 12 | 13 | / { |
| 13 | 14 | #address-cells = <1>; |
| @@ -59,8 +60,12 @@ · 45 unmodified lines | ||
| 59 | 60 | * cooling. |
| 60 | 61 | */ |
| 61 | 62 | cpu_thermal: cpu-thermal { |
| 62 | − polling-delay-passive = <0>; | |
| 63 | − polling-delay = <1000>; | |
| 63 | + polling-delay-passive = <250>; | |
| 64 | + /* | |
| 65 | + * This sensor fires interrupts to update the thermal | |
| 66 | + * zone, so no polling is needed. | |
| 67 | + */ | |
| 68 | + polling-delay = <0>; | |
| 64 | 69 | |
| 65 | 70 | thermal-sensors = <&thermal>; |
| 66 | 71 | |
| @@ -79,7 +84,7 @@ · 12 unmodified lines | ||
| 79 | 84 | |
| 80 | 85 | cooling-maps { |
| 81 | 86 | trip = <&cpu_alert>; |
| 82 | − cooling-device = <&CPU0 0 2>; | |
| 87 | + cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; | |
| 83 | 88 | contribution = <100>; |
| 84 | 89 | }; |
| 85 | 90 | }; |
| @@ -228,7 +228,7 @@ CONFIG_RTC_DRV_OMAP=m · 227 unmodified lines | ||
| 228 | 228 | CONFIG_DMADEVICES=y |
| 229 | 229 | CONFIG_TI_EDMA=y |
| 230 | 230 | CONFIG_COMMON_CLK_PWM=m |
| 231 | −CONFIG_REMOTEPROC=m | |
| 231 | +CONFIG_REMOTEPROC=y | |
| 232 | 232 | CONFIG_DA8XX_REMOTEPROC=m |
| 233 | 233 | CONFIG_MEMORY=y |
| 234 | 234 | CONFIG_TI_AEMIF=m |
| @@ -415,7 +415,7 @@ CONFIG_SPI_SH_MSIOF=m · 414 unmodified lines | ||
| 415 | 415 | CONFIG_SPI_SH_HSPI=y |
| 416 | 416 | CONFIG_SPI_SIRF=y |
| 417 | 417 | CONFIG_SPI_STM32=m |
| 418 | −CONFIG_SPI_STM32_QSPI=m | |
| 418 | +CONFIG_SPI_STM32_QSPI=y | |
| 419 | 419 | CONFIG_SPI_SUN4I=y |
| 420 | 420 | CONFIG_SPI_SUN6I=y |
| 421 | 421 | CONFIG_SPI_TEGRA114=y |
| @@ -933,7 +933,7 @@ CONFIG_BCM2835_MBOX=y · 511 unmodified lines | ||
| 933 | 933 | CONFIG_ROCKCHIP_IOMMU=y |
| 934 | 934 | CONFIG_TEGRA_IOMMU_GART=y |
| 935 | 935 | CONFIG_TEGRA_IOMMU_SMMU=y |
| 936 | −CONFIG_REMOTEPROC=m | |
| 936 | +CONFIG_REMOTEPROC=y | |
| 937 | 937 | CONFIG_ST_REMOTEPROC=m |
| 938 | 938 | CONFIG_RPMSG_VIRTIO=m |
| 939 | 939 | CONFIG_ASPEED_LPC_CTRL=m |
| @@ -364,6 +364,7 @@ CONFIG_DRM_OMAP_PANEL_TPO_TD043MTEA1=m · 363 unmodified lines | ||
| 364 | 364 | CONFIG_DRM_OMAP_PANEL_NEC_NL8048HL11=m |
| 365 | 365 | CONFIG_DRM_TILCDC=m |
| 366 | 366 | CONFIG_DRM_PANEL_SIMPLE=m |
| 367 | +CONFIG_DRM_TI_TFP410=m | |
| 367 | 368 | CONFIG_FB=y |
| 368 | 369 | CONFIG_FIRMWARE_EDID=y |
| 369 | 370 | CONFIG_FB_MODE_HELPERS=y |
| @@ -423,6 +424,7 @@ CONFIG_USB_SERIAL_GENERIC=y · 53 unmodified lines | ||
| 423 | 424 | CONFIG_USB_SERIAL_SIMPLE=m |
| 424 | 425 | CONFIG_USB_SERIAL_FTDI_SIO=m |
| 425 | 426 | CONFIG_USB_SERIAL_PL2303=m |
| 427 | +CONFIG_USB_SERIAL_OPTION=m | |
| 426 | 428 | CONFIG_USB_TEST=m |
| 427 | 429 | CONFIG_NOP_USB_XCEIV=m |
| 428 | 430 | CONFIG_AM335X_PHY_USB=m |
| @@ -460,6 +462,7 @@ CONFIG_MMC_SDHCI_OMAP=y · 31 unmodified lines | ||
| 460 | 462 | CONFIG_NEW_LEDS=y |
| 461 | 463 | CONFIG_LEDS_CLASS=m |
| 462 | 464 | CONFIG_LEDS_CPCAP=m |
| 465 | +CONFIG_LEDS_LM3532=m | |
| 463 | 466 | CONFIG_LEDS_GPIO=m |
| 464 | 467 | CONFIG_LEDS_PCA963X=m |
| 465 | 468 | CONFIG_LEDS_PWM=m |
| @@ -481,7 +484,7 @@ CONFIG_RTC_DRV_OMAP=m · 15 unmodified lines | ||
| 481 | 484 | CONFIG_RTC_DRV_CPCAP=m |
| 482 | 485 | CONFIG_DMADEVICES=y |
| 483 | 486 | CONFIG_OMAP_IOMMU=y |
| 484 | −CONFIG_REMOTEPROC=m | |
| 487 | +CONFIG_REMOTEPROC=y | |
| 485 | 488 | CONFIG_OMAP_REMOTEPROC=m |
| 486 | 489 | CONFIG_WKUP_M3_RPROC=m |
| 487 | 490 | CONFIG_SOC_TI=y |
| @@ -1,6 +0,0 @@ | ||
| 1 | −#ifndef _ASM_XEN_OPS_H | |
| 2 | −#define _ASM_XEN_OPS_H | |
| 3 | − | |
| 4 | −void xen_efi_runtime_setup(void); | |
| 5 | − | |
| 6 | −#endif /* _ASM_XEN_OPS_H */ | |
| @@ -763,7 +763,8 @@ static struct omap_hwmod_class_sysconfig am33xx_timer_sysc = { · 762 unmodified lines | ||
| 763 | 763 | .rev_offs = 0x0000, |
| 764 | 764 | .sysc_offs = 0x0010, |
| 765 | 765 | .syss_offs = 0x0014, |
| 766 | − .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), | |
| 766 | + .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | | |
| 767 | + SYSC_HAS_RESET_STATUS, | |
| 767 | 768 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | |
| 768 | 769 | SIDLE_SMART_WKUP), |
| 769 | 770 | .sysc_fields = &omap_hwmod_sysc_type2, |
| @@ -231,8 +231,9 @@ static struct omap_hwmod am33xx_control_hwmod = { · 230 unmodified lines | ||
| 231 | 231 | static struct omap_hwmod_class_sysconfig lcdc_sysc = { |
| 232 | 232 | .rev_offs = 0x0, |
| 233 | 233 | .sysc_offs = 0x54, |
| 234 | − .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE), | |
| 235 | − .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | |
| 234 | + .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE, | |
| 235 | + .idlemodes = SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | |
| 236 | + MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART, | |
| 236 | 237 | .sysc_fields = &omap_hwmod_sysc_type2, |
| 237 | 238 | }; |
| 238 | 239 | |
| @@ -74,83 +74,6 @@ int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) · 73 unmodified lines | ||
| 74 | 74 | return 0; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | −/* | |
| 78 | − * This API is to be called during init to set the various voltage | |
| 79 | − * domains to the voltage as per the opp table. Typically we boot up | |
| 80 | − * at the nominal voltage. So this function finds out the rate of | |
| 81 | − * the clock associated with the voltage domain, finds out the correct | |
| 82 | − * opp entry and sets the voltage domain to the voltage specified | |
| 83 | − * in the opp entry | |
| 84 | − */ | |
| 85 | −static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, | |
| 86 | − const char *oh_name) | |
| 87 | −{ | |
| 88 | − struct voltagedomain *voltdm; | |
| 89 | − struct clk *clk; | |
| 90 | − struct dev_pm_opp *opp; | |
| 91 | − unsigned long freq, bootup_volt; | |
| 92 | − struct device *dev; | |
| 93 | − | |
| 94 | − if (!vdd_name || !clk_name || !oh_name) { | |
| 95 | − pr_err("%s: invalid parameters\n", __func__); | |
| 96 | − goto exit; | |
| 97 | − } | |
| 98 | − | |
| 99 | − if (!strncmp(oh_name, "mpu", 3)) | |
| 100 | − /* | |
| 101 | − * All current OMAPs share voltage rail and clock | |
| 102 | − * source, so CPU0 is used to represent the MPU-SS. | |
| 103 | − */ | |
| 104 | − dev = get_cpu_device(0); | |
| 105 | − else | |
| 106 | − dev = omap_device_get_by_hwmod_name(oh_name); | |
| 107 | − | |
| 108 | − if (IS_ERR(dev)) { | |
| 109 | − pr_err("%s: Unable to get dev pointer for hwmod %s\n", | |
| 110 | − __func__, oh_name); | |
| 111 | − goto exit; | |
| 112 | − } | |
| 113 | − | |
| 114 | − voltdm = voltdm_lookup(vdd_name); | |
| 115 | − if (!voltdm) { | |
| 116 | − pr_err("%s: unable to get vdd pointer for vdd_%s\n", | |
| 117 | − __func__, vdd_name); | |
| 118 | − goto exit; | |
| 119 | − } | |
| 120 | − | |
| 121 | − clk = clk_get(NULL, clk_name); | |
| 122 | − if (IS_ERR(clk)) { | |
| 123 | − pr_err("%s: unable to get clk %s\n", __func__, clk_name); | |
| 124 | − goto exit; | |
| 125 | − } | |
| 126 | − | |
| 127 | − freq = clk_get_rate(clk); | |
| 128 | − clk_put(clk); | |
| 129 | − | |
| 130 | − opp = dev_pm_opp_find_freq_ceil(dev, &freq); | |
| 131 | − if (IS_ERR(opp)) { | |
| 132 | − pr_err("%s: unable to find boot up OPP for vdd_%s\n", | |
| 133 | − __func__, vdd_name); | |
| 134 | − goto exit; | |
| 135 | − } | |
| 136 | − | |
| 137 | − bootup_volt = dev_pm_opp_get_voltage(opp); | |
| 138 | − dev_pm_opp_put(opp); | |
| 139 | − | |
| 140 | − if (!bootup_volt) { | |
| 141 | − pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n", | |
| 142 | − __func__, vdd_name); | |
| 143 | − goto exit; | |
| 144 | − } | |
| 145 | − | |
| 146 | − voltdm_scale(voltdm, bootup_volt); | |
| 147 | − return 0; | |
| 148 | − | |
| 149 | −exit: | |
| 150 | − pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name); | |
| 151 | − return -EINVAL; | |
| 152 | −} | |
| 153 | − | |
| 154 | 77 | #ifdef CONFIG_SUSPEND |
| 155 | 78 | static int omap_pm_enter(suspend_state_t suspend_state) |
| 156 | 79 | { |
| @@ -208,25 +131,6 @@ void omap_common_suspend_init(void *pm_suspend) · 51 unmodified lines | ||
| 208 | 131 | } |
| 209 | 132 | #endif /* CONFIG_SUSPEND */ |
| 210 | 133 | |
| 211 | −static void __init omap3_init_voltages(void) | |
| 212 | −{ | |
| 213 | − if (!soc_is_omap34xx()) | |
| 214 | − return; | |
| 215 | − | |
| 216 | − omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu"); | |
| 217 | − omap2_set_init_voltage("core", "l3_ick", "l3_main"); | |
| 218 | −} | |
| 219 | − | |
| 220 | −static void __init omap4_init_voltages(void) | |
| 221 | −{ | |
| 222 | − if (!soc_is_omap44xx()) | |
| 223 | − return; | |
| 224 | − | |
| 225 | − omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu"); | |
| 226 | − omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1"); | |
| 227 | − omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); | |
| 228 | −} | |
| 229 | − | |
| 230 | 134 | int __maybe_unused omap_pm_nop_init(void) |
| 231 | 135 | { |
| 232 | 136 | return 0; |
| @@ -246,10 +150,6 @@ int __init omap2_common_pm_late_init(void) · 13 unmodified lines | ||
| 246 | 150 | omap4_twl_init(); |
| 247 | 151 | omap_voltage_late_init(); |
| 248 | 152 | |
| 249 | − /* Initialize the voltages */ | |
| 250 | − omap3_init_voltages(); | |
| 251 | − omap4_init_voltages(); | |
| 252 | − | |
| 253 | 153 | /* Smartreflex device init */ |
| 254 | 154 | omap_devinit_smartreflex(); |
| 255 | 155 | |
| @@ -1,3 +1,2 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o |
| 3 | −obj-$(CONFIG_XEN_EFI) += efi.o | |
| @@ -1,28 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * Copyright (c) 2015, Linaro Limited, Shannon Zhao | |
| 4 | − */ | |
| 5 | − | |
| 6 | −#include <linux/efi.h> | |
| 7 | −#include <xen/xen-ops.h> | |
| 8 | −#include <asm/xen/xen-ops.h> | |
| 9 | − | |
| 10 | −/* Set XEN EFI runtime services function pointers. Other fields of struct efi, | |
| 11 | − * e.g. efi.systab, will be set like normal EFI. | |
| 12 | − */ | |
| 13 | −void __init xen_efi_runtime_setup(void) | |
| 14 | −{ | |
| 15 | − efi.get_time = xen_efi_get_time; | |
| 16 | − efi.set_time = xen_efi_set_time; | |
| 17 | − efi.get_wakeup_time = xen_efi_get_wakeup_time; | |
| 18 | − efi.set_wakeup_time = xen_efi_set_wakeup_time; | |
| 19 | − efi.get_variable = xen_efi_get_variable; | |
| 20 | − efi.get_next_variable = xen_efi_get_next_variable; | |
| 21 | − efi.set_variable = xen_efi_set_variable; | |
| 22 | − efi.query_variable_info = xen_efi_query_variable_info; | |
| 23 | − efi.update_capsule = xen_efi_update_capsule; | |
| 24 | − efi.query_capsule_caps = xen_efi_query_capsule_caps; | |
| 25 | − efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; | |
| 26 | − efi.reset_system = xen_efi_reset_system; | |
| 27 | −} | |
| 28 | −EXPORT_SYMBOL_GPL(xen_efi_runtime_setup); | |
| @@ -15,7 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <xen/xen-ops.h> |
| 16 | 16 | #include <asm/xen/hypervisor.h> |
| 17 | 17 | #include <asm/xen/hypercall.h> |
| 18 | −#include <asm/xen/xen-ops.h> | |
| 19 | 18 | #include <asm/system_misc.h> |
| 20 | 19 | #include <asm/efi.h> |
| 21 | 20 | #include <linux/interrupt.h> |
| @@ -437,7 +436,7 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op); · 415 unmodified lines | ||
| 437 | 436 | EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); |
| 438 | 437 | EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op); |
| 439 | 438 | EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op); |
| 440 | −EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op); | |
| 439 | +EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw); | |
| 441 | 440 | EXPORT_SYMBOL_GPL(HYPERVISOR_multicall); |
| 442 | 441 | EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist); |
| 443 | 442 | EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op); |
| @@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | for_each_memblock(memory, reg) { |
| 30 | 30 | if (reg->base < (phys_addr_t)0xffffffff) { |
| 31 | − flags |= __GFP_DMA; | |
| 31 | + if (IS_ENABLED(CONFIG_ZONE_DMA32)) | |
| 32 | + flags |= __GFP_DMA32; | |
| 33 | + else | |
| 34 | + flags |= __GFP_DMA; | |
| 32 | 35 | break; |
| 33 | 36 | } |
| 34 | 37 | } |
| @@ -616,6 +616,23 @@ config CAVIUM_ERRATUM_30115 · 615 unmodified lines | ||
| 616 | 616 | |
| 617 | 617 | If unsure, say Y. |
| 618 | 618 | |
| 619 | +config CAVIUM_TX2_ERRATUM_219 | |
| 620 | + bool "Cavium ThunderX2 erratum 219: PRFM between TTBR change and ISB fails" | |
| 621 | + default y | |
| 622 | + help | |
| 623 | + On Cavium ThunderX2, a load, store or prefetch instruction between a | |
| 624 | + TTBR update and the corresponding context synchronizing operation can | |
| 625 | + cause a spurious Data Abort to be delivered to any hardware thread in | |
| 626 | + the CPU core. | |
| 627 | + | |
| 628 | + Work around the issue by avoiding the problematic code sequence and | |
| 629 | + trapping KVM guest TTBRx_EL1 writes to EL2 when SMT is enabled. The | |
| 630 | + trap handler performs the corresponding register access, skips the | |
| 631 | + instruction and ensures context synchronization by virtue of the | |
| 632 | + exception return. | |
| 633 | + | |
| 634 | + If unsure, say Y. | |
| 635 | + | |
| 619 | 636 | config QCOM_FALKOR_ERRATUM_1003 |
| 620 | 637 | bool "Falkor E1003: Incorrect translation due to ASID change" |
| 621 | 638 | default y |
| @@ -723,7 +723,7 @@ CONFIG_TEGRA_IOMMU_SMMU=y · 722 unmodified lines | ||
| 723 | 723 | CONFIG_ARM_SMMU=y |
| 724 | 724 | CONFIG_ARM_SMMU_V3=y |
| 725 | 725 | CONFIG_QCOM_IOMMU=y |
| 726 | −CONFIG_REMOTEPROC=m | |
| 726 | +CONFIG_REMOTEPROC=y | |
| 727 | 727 | CONFIG_QCOM_Q6V5_MSS=m |
| 728 | 728 | CONFIG_QCOM_Q6V5_PAS=m |
| 729 | 729 | CONFIG_QCOM_SYSMON=m |
| @@ -52,7 +52,9 @@ · 51 unmodified lines | ||
| 52 | 52 | #define ARM64_HAS_IRQ_PRIO_MASKING 42 |
| 53 | 53 | #define ARM64_HAS_DCPODP 43 |
| 54 | 54 | #define ARM64_WORKAROUND_1463225 44 |
| 55 | +#define ARM64_WORKAROUND_CAVIUM_TX2_219_TVM 45 | |
| 56 | +#define ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM 46 | |
| 55 | 57 | |
| 56 | −#define ARM64_NCAPS 45 | |
| 58 | +#define ARM64_NCAPS 47 | |
| 57 | 59 | |
| 58 | 60 | #endif /* __ASM_CPUCAPS_H */ |
| @@ -47,30 +47,6 @@ · 46 unmodified lines | ||
| 47 | 47 | #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1) |
| 48 | 48 | #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1) |
| 49 | 49 | |
| 50 | −/** | |
| 51 | − * hyp_alternate_select - Generates patchable code sequences that are | |
| 52 | − * used to switch between two implementations of a function, depending | |
| 53 | − * on the availability of a feature. | |
| 54 | − * | |
| 55 | − * @fname: a symbol name that will be defined as a function returning a | |
| 56 | − * function pointer whose type will match @orig and @alt | |
| 57 | − * @orig: A pointer to the default function, as returned by @fname when | |
| 58 | − * @cond doesn't hold | |
| 59 | − * @alt: A pointer to the alternate function, as returned by @fname | |
| 60 | − * when @cond holds | |
| 61 | − * @cond: a CPU feature (as described in asm/cpufeature.h) | |
| 62 | − */ | |
| 63 | −#define hyp_alternate_select(fname, orig, alt, cond) \ | |
| 64 | −typeof(orig) * __hyp_text fname(void) \ | |
| 65 | −{ \ | |
| 66 | − typeof(alt) *val = orig; \ | |
| 67 | − asm volatile(ALTERNATIVE("nop \n", \ | |
| 68 | − "mov %0, %1 \n", \ | |
| 69 | − cond) \ | |
| 70 | − : "+r" (val) : "r" (alt)); \ | |
| 71 | − return val; \ | |
| 72 | −} | |
| 73 | − | |
| 74 | 50 | int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu); |
| 75 | 51 | |
| 76 | 52 | void __vgic_v3_save_state(struct kvm_vcpu *vcpu); |
| @@ -1,7 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef _ASM_XEN_OPS_H | |
| 3 | −#define _ASM_XEN_OPS_H | |
| 4 | − | |
| 5 | −void xen_efi_runtime_setup(void); | |
| 6 | − | |
| 7 | −#endif /* _ASM_XEN_OPS_H */ | |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <asm/cpu.h> |
| 13 | 13 | #include <asm/cputype.h> |
| 14 | 14 | #include <asm/cpufeature.h> |
| 15 | +#include <asm/smp_plat.h> | |
| 15 | 16 | |
| 16 | 17 | static bool __maybe_unused |
| 17 | 18 | is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) |
| @@ -623,6 +624,30 @@ check_branch_predictor(const struct arm64_cpu_capabilities *entry, int scope) · 605 unmodified lines | ||
| 623 | 624 | return (need_wa > 0); |
| 624 | 625 | } |
| 625 | 626 | |
| 627 | +static const __maybe_unused struct midr_range tx2_family_cpus[] = { | |
| 628 | + MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), | |
| 629 | + MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), | |
| 630 | + {}, | |
| 631 | +}; | |
| 632 | + | |
| 633 | +static bool __maybe_unused | |
| 634 | +needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry, | |
| 635 | + int scope) | |
| 636 | +{ | |
| 637 | + int i; | |
| 638 | + | |
| 639 | + if (!is_affected_midr_range_list(entry, scope) || | |
| 640 | + !is_hyp_mode_available()) | |
| 641 | + return false; | |
| 642 | + | |
| 643 | + for_each_possible_cpu(i) { | |
| 644 | + if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0) | |
| 645 | + return true; | |
| 646 | + } | |
| 647 | + | |
| 648 | + return false; | |
| 649 | +} | |
| 650 | + | |
| 626 | 651 | #ifdef CONFIG_HARDEN_EL2_VECTORS |
| 627 | 652 | |
| 628 | 653 | static const struct midr_range arm64_harden_el2_vectors[] = { |
| @@ -851,6 +876,19 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 222 unmodified lines | ||
| 851 | 876 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
| 852 | 877 | .matches = has_cortex_a76_erratum_1463225, |
| 853 | 878 | }, |
| 879 | +#endif | |
| 880 | +#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219 | |
| 881 | + { | |
| 882 | + .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)", | |
| 883 | + .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM, | |
| 884 | + ERRATA_MIDR_RANGE_LIST(tx2_family_cpus), | |
| 885 | + .matches = needs_tx2_tvm_workaround, | |
| 886 | + }, | |
| 887 | + { | |
| 888 | + .desc = "Cavium ThunderX2 erratum 219 (PRFM removal)", | |
| 889 | + .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM, | |
| 890 | + ERRATA_MIDR_RANGE_LIST(tx2_family_cpus), | |
| 891 | + }, | |
| 854 | 892 | #endif |
| 855 | 893 | { |
| 856 | 894 | } |
| @@ -1071,7 +1071,9 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 · 1070 unmodified lines | ||
| 1071 | 1071 | #else |
| 1072 | 1072 | ldr x30, =vectors |
| 1073 | 1073 | #endif |
| 1074 | +alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM | |
| 1074 | 1075 | prfm plil1strm, [x30, #(1b - tramp_vectors)] |
| 1076 | +alternative_else_nop_endif | |
| 1075 | 1077 | msr vbar_el1, x30 |
| 1076 | 1078 | add x30, x30, #(1b - tramp_vectors) |
| 1077 | 1079 | isb |
| @@ -124,6 +124,9 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) · 123 unmodified lines | ||
| 124 | 124 | { |
| 125 | 125 | u64 hcr = vcpu->arch.hcr_el2; |
| 126 | 126 | |
| 127 | + if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM)) | |
| 128 | + hcr |= HCR_TVM; | |
| 129 | + | |
| 127 | 130 | write_sysreg(hcr, hcr_el2); |
| 128 | 131 | |
| 129 | 132 | if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE)) |
| @@ -174,8 +177,10 @@ static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) · 44 unmodified lines | ||
| 174 | 177 | * the crucial bit is "On taking a vSError interrupt, |
| 175 | 178 | * HCR_EL2.VSE is cleared to 0." |
| 176 | 179 | */ |
| 177 | − if (vcpu->arch.hcr_el2 & HCR_VSE) | |
| 178 | − vcpu->arch.hcr_el2 = read_sysreg(hcr_el2); | |
| 180 | + if (vcpu->arch.hcr_el2 & HCR_VSE) { | |
| 181 | + vcpu->arch.hcr_el2 &= ~HCR_VSE; | |
| 182 | + vcpu->arch.hcr_el2 |= read_sysreg(hcr_el2) & HCR_VSE; | |
| 183 | + } | |
| 179 | 184 | |
| 180 | 185 | if (has_vhe()) |
| 181 | 186 | deactivate_traps_vhe(); |
| @@ -229,20 +234,6 @@ static void __hyp_text __hyp_vgic_restore_state(struct kvm_vcpu *vcpu) · 47 unmodified lines | ||
| 229 | 234 | } |
| 230 | 235 | } |
| 231 | 236 | |
| 232 | −static bool __hyp_text __true_value(void) | |
| 233 | −{ | |
| 234 | − return true; | |
| 235 | −} | |
| 236 | − | |
| 237 | −static bool __hyp_text __false_value(void) | |
| 238 | −{ | |
| 239 | − return false; | |
| 240 | −} | |
| 241 | − | |
| 242 | −static hyp_alternate_select(__check_arm_834220, | |
| 243 | − __false_value, __true_value, | |
| 244 | − ARM64_WORKAROUND_834220); | |
| 245 | − | |
| 246 | 237 | static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar) |
| 247 | 238 | { |
| 248 | 239 | u64 par, tmp; |
| @@ -298,7 +289,8 @@ static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu) · 49 unmodified lines | ||
| 298 | 289 | * resolve the IPA using the AT instruction. |
| 299 | 290 | */ |
| 300 | 291 | if (!(esr & ESR_ELx_S1PTW) && |
| 301 | − (__check_arm_834220()() || (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) { | |
| 292 | + (cpus_have_const_cap(ARM64_WORKAROUND_834220) || | |
| 293 | + (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) { | |
| 302 | 294 | if (!__translate_far_to_hpfar(far, &hpfar)) |
| 303 | 295 | return false; |
| 304 | 296 | } else { |
| @@ -393,6 +385,61 @@ static bool __hyp_text __hyp_handle_fpsimd(struct kvm_vcpu *vcpu) · 88 unmodified lines | ||
| 393 | 385 | return true; |
| 394 | 386 | } |
| 395 | 387 | |
| 388 | +static bool __hyp_text handle_tx2_tvm(struct kvm_vcpu *vcpu) | |
| 389 | +{ | |
| 390 | + u32 sysreg = esr_sys64_to_sysreg(kvm_vcpu_get_hsr(vcpu)); | |
| 391 | + int rt = kvm_vcpu_sys_get_rt(vcpu); | |
| 392 | + u64 val = vcpu_get_reg(vcpu, rt); | |
| 393 | + | |
| 394 | + /* | |
| 395 | + * The normal sysreg handling code expects to see the traps, | |
| 396 | + * let's not do anything here. | |
| 397 | + */ | |
| 398 | + if (vcpu->arch.hcr_el2 & HCR_TVM) | |
| 399 | + return false; | |
| 400 | + | |
| 401 | + switch (sysreg) { | |
| 402 | + case SYS_SCTLR_EL1: | |
| 403 | + write_sysreg_el1(val, SYS_SCTLR); | |
| 404 | + break; | |
| 405 | + case SYS_TTBR0_EL1: | |
| 406 | + write_sysreg_el1(val, SYS_TTBR0); | |
| 407 | + break; | |
| 408 | + case SYS_TTBR1_EL1: | |
| 409 | + write_sysreg_el1(val, SYS_TTBR1); | |
| 410 | + break; | |
| 411 | + case SYS_TCR_EL1: | |
| 412 | + write_sysreg_el1(val, SYS_TCR); | |
| 413 | + break; | |
| 414 | + case SYS_ESR_EL1: | |
| 415 | + write_sysreg_el1(val, SYS_ESR); | |
| 416 | + break; | |
| 417 | + case SYS_FAR_EL1: | |
| 418 | + write_sysreg_el1(val, SYS_FAR); | |
| 419 | + break; | |
| 420 | + case SYS_AFSR0_EL1: | |
| 421 | + write_sysreg_el1(val, SYS_AFSR0); | |
| 422 | + break; | |
| 423 | + case SYS_AFSR1_EL1: | |
| 424 | + write_sysreg_el1(val, SYS_AFSR1); | |
| 425 | + break; | |
| 426 | + case SYS_MAIR_EL1: | |
| 427 | + write_sysreg_el1(val, SYS_MAIR); | |
| 428 | + break; | |
| 429 | + case SYS_AMAIR_EL1: | |
| 430 | + write_sysreg_el1(val, SYS_AMAIR); | |
| 431 | + break; | |
| 432 | + case SYS_CONTEXTIDR_EL1: | |
| 433 | + write_sysreg_el1(val, SYS_CONTEXTIDR); | |
| 434 | + break; | |
| 435 | + default: | |
| 436 | + return false; | |
| 437 | + } | |
| 438 | + | |
| 439 | + __kvm_skip_instr(vcpu); | |
| 440 | + return true; | |
| 441 | +} | |
| 442 | + | |
| 396 | 443 | /* |
| 397 | 444 | * Return true when we were able to fixup the guest exit and should return to |
| 398 | 445 | * the guest, false when we should restore the host state and return to the |
| @@ -412,6 +459,11 @@ static bool __hyp_text fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 13 unmodified lines | ||
| 412 | 459 | if (*exit_code != ARM_EXCEPTION_TRAP) |
| 413 | 460 | goto exit; |
| 414 | 461 | |
| 462 | + if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) && | |
| 463 | + kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_SYS64 && | |
| 464 | + handle_tx2_tvm(vcpu)) | |
| 465 | + return true; | |
| 466 | + | |
| 415 | 467 | /* |
| 416 | 468 | * We trap the first access to the FP/SIMD to save the host context |
| 417 | 469 | * and restore the guest context lazily. |
| @@ -67,10 +67,14 @@ static void __hyp_text __tlb_switch_to_guest_nvhe(struct kvm *kvm, · 66 unmodified lines | ||
| 67 | 67 | isb(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | −static hyp_alternate_select(__tlb_switch_to_guest, | |
| 71 | − __tlb_switch_to_guest_nvhe, | |
| 72 | − __tlb_switch_to_guest_vhe, | |
| 73 | − ARM64_HAS_VIRT_HOST_EXTN); | |
| 70 | +static void __hyp_text __tlb_switch_to_guest(struct kvm *kvm, | |
| 71 | + struct tlb_inv_context *cxt) | |
| 72 | +{ | |
| 73 | + if (has_vhe()) | |
| 74 | + __tlb_switch_to_guest_vhe(kvm, cxt); | |
| 75 | + else | |
| 76 | + __tlb_switch_to_guest_nvhe(kvm, cxt); | |
| 77 | +} | |
| 74 | 78 | |
| 75 | 79 | static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm, |
| 76 | 80 | struct tlb_inv_context *cxt) |
| @@ -98,10 +102,14 @@ static void __hyp_text __tlb_switch_to_host_nvhe(struct kvm *kvm, · 21 unmodified lines | ||
| 98 | 102 | write_sysreg(0, vttbr_el2); |
| 99 | 103 | } |
| 100 | 104 | |
| 101 | −static hyp_alternate_select(__tlb_switch_to_host, | |
| 102 | − __tlb_switch_to_host_nvhe, | |
| 103 | − __tlb_switch_to_host_vhe, | |
| 104 | − ARM64_HAS_VIRT_HOST_EXTN); | |
| 105 | +static void __hyp_text __tlb_switch_to_host(struct kvm *kvm, | |
| 106 | + struct tlb_inv_context *cxt) | |
| 107 | +{ | |
| 108 | + if (has_vhe()) | |
| 109 | + __tlb_switch_to_host_vhe(kvm, cxt); | |
| 110 | + else | |
| 111 | + __tlb_switch_to_host_nvhe(kvm, cxt); | |
| 112 | +} | |
| 105 | 113 | |
| 106 | 114 | void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) |
| 107 | 115 | { |
| @@ -111,7 +119,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 3 unmodified lines | ||
| 111 | 119 | |
| 112 | 120 | /* Switch to requested VMID */ |
| 113 | 121 | kvm = kern_hyp_va(kvm); |
| 114 | − __tlb_switch_to_guest()(kvm, &cxt); | |
| 122 | + __tlb_switch_to_guest(kvm, &cxt); | |
| 115 | 123 | |
| 116 | 124 | /* |
| 117 | 125 | * We could do so much better if we had the VA as well. |
| @@ -154,7 +162,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) · 36 unmodified lines | ||
| 154 | 162 | if (!has_vhe() && icache_is_vpipt()) |
| 155 | 163 | __flush_icache_all(); |
| 156 | 164 | |
| 157 | − __tlb_switch_to_host()(kvm, &cxt); | |
| 165 | + __tlb_switch_to_host(kvm, &cxt); | |
| 158 | 166 | } |
| 159 | 167 | |
| 160 | 168 | void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) |
| @@ -165,13 +173,13 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) · 4 unmodified lines | ||
| 165 | 173 | |
| 166 | 174 | /* Switch to requested VMID */ |
| 167 | 175 | kvm = kern_hyp_va(kvm); |
| 168 | − __tlb_switch_to_guest()(kvm, &cxt); | |
| 176 | + __tlb_switch_to_guest(kvm, &cxt); | |
| 169 | 177 | |
| 170 | 178 | __tlbi(vmalls12e1is); |
| 171 | 179 | dsb(ish); |
| 172 | 180 | isb(); |
| 173 | 181 | |
| 174 | − __tlb_switch_to_host()(kvm, &cxt); | |
| 182 | + __tlb_switch_to_host(kvm, &cxt); | |
| 175 | 183 | } |
| 176 | 184 | |
| 177 | 185 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) |
| @@ -180,13 +188,13 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) · 2 unmodified lines | ||
| 180 | 188 | struct tlb_inv_context cxt; |
| 181 | 189 | |
| 182 | 190 | /* Switch to requested VMID */ |
| 183 | − __tlb_switch_to_guest()(kvm, &cxt); | |
| 191 | + __tlb_switch_to_guest(kvm, &cxt); | |
| 184 | 192 | |
| 185 | 193 | __tlbi(vmalle1); |
| 186 | 194 | dsb(nsh); |
| 187 | 195 | isb(); |
| 188 | 196 | |
| 189 | − __tlb_switch_to_host()(kvm, &cxt); | |
| 197 | + __tlb_switch_to_host(kvm, &cxt); | |
| 190 | 198 | } |
| 191 | 199 | |
| 192 | 200 | void __hyp_text __kvm_flush_vm_context(void) |
| @@ -1,4 +1,3 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) |
| 3 | 3 | obj-y := xen-arm.o hypercall.o |
| 4 | −obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o) | |
| @@ -99,7 +99,7 @@ · 98 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | miscintc: interrupt-controller@18060010 { |
| 101 | 101 | compatible = "qca,ar7240-misc-intc"; |
| 102 | − reg = <0x18060010 0x4>; | |
| 102 | + reg = <0x18060010 0x8>; | |
| 103 | 103 | |
| 104 | 104 | interrupt-parent = <&cpuintc>; |
| 105 | 105 | interrupts = <6>; |
| @@ -160,7 +160,6 @@ void __init prom_meminit(void) · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | void __init prom_free_prom_memory(void) |
| 162 | 162 | { |
| 163 | − unsigned long addr; | |
| 164 | 163 | int i; |
| 165 | 164 | |
| 166 | 165 | if (prom_flags & PROM_FLAG_DONT_FREE_TEMP) |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <asm/octeon/octeon-feature.h> |
| 37 | 37 | |
| 38 | 38 | #include <asm/octeon/cvmx-ipd-defs.h> |
| 39 | +#include <asm/octeon/cvmx-pip-defs.h> | |
| 39 | 40 | |
| 40 | 41 | enum cvmx_ipd_mode { |
| 41 | 42 | CVMX_IPD_OPC_MODE_STT = 0LL, /* All blocks DRAM, not cached in L2 */ |
| @@ -52,6 +52,7 @@ · 51 unmodified lines | ||
| 52 | 52 | # endif |
| 53 | 53 | #define __ARCH_WANT_SYS_FORK |
| 54 | 54 | #define __ARCH_WANT_SYS_CLONE |
| 55 | +#define __ARCH_WANT_SYS_CLONE3 | |
| 55 | 56 | |
| 56 | 57 | /* whitelists for checksyscalls */ |
| 57 | 58 | #define __IGNORE_fadvise64_64 |
| @@ -24,7 +24,8 @@ static char r4kwar[] __initdata = · 23 unmodified lines | ||
| 24 | 24 | static char daddiwar[] __initdata = |
| 25 | 25 | "Enable CPU_DADDI_WORKAROUNDS to rectify."; |
| 26 | 26 | |
| 27 | −static inline void align_mod(const int align, const int mod) | |
| 27 | +static __always_inline __init | |
| 28 | +void align_mod(const int align, const int mod) | |
| 28 | 29 | { |
| 29 | 30 | asm volatile( |
| 30 | 31 | ".set push\n\t" |
| @@ -38,8 +39,9 @@ static inline void align_mod(const int align, const int mod) · 7 unmodified lines | ||
| 38 | 39 | : "n"(align), "n"(mod)); |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | −static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, | |
| 42 | − const int align, const int mod) | |
| 42 | +static __always_inline __init | |
| 43 | +void mult_sh_align_mod(long *v1, long *v2, long *w, | |
| 44 | + const int align, const int mod) | |
| 43 | 45 | { |
| 44 | 46 | unsigned long flags; |
| 45 | 47 | int m1, m2; |
| @@ -113,7 +115,7 @@ static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w, · 67 unmodified lines | ||
| 113 | 115 | *w = lw; |
| 114 | 116 | } |
| 115 | 117 | |
| 116 | −static inline void check_mult_sh(void) | |
| 118 | +static __always_inline __init void check_mult_sh(void) | |
| 117 | 119 | { |
| 118 | 120 | long v1[8], v2[8], w[8]; |
| 119 | 121 | int bug, fix, i; |
| @@ -176,7 +178,7 @@ asmlinkage void __init do_daddi_ov(struct pt_regs *regs) · 56 unmodified lines | ||
| 176 | 178 | exception_exit(prev_state); |
| 177 | 179 | } |
| 178 | 180 | |
| 179 | −static inline void check_daddi(void) | |
| 181 | +static __init void check_daddi(void) | |
| 180 | 182 | { |
| 181 | 183 | extern asmlinkage void handle_daddi_ov(void); |
| 182 | 184 | unsigned long flags; |
| @@ -242,7 +244,7 @@ static inline void check_daddi(void) · 59 unmodified lines | ||
| 242 | 244 | |
| 243 | 245 | int daddiu_bug = IS_ENABLED(CONFIG_CPU_MIPSR6) ? 0 : -1; |
| 244 | 246 | |
| 245 | −static inline void check_daddiu(void) | |
| 247 | +static __init void check_daddiu(void) | |
| 246 | 248 | { |
| 247 | 249 | long v, w, tmp; |
| 248 | 250 | |
| @@ -108,6 +108,9 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type) · 107 unmodified lines | ||
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + if (start < PHYS_OFFSET) | |
| 112 | + return; | |
| 113 | + | |
| 111 | 114 | memblock_add(start, size); |
| 112 | 115 | /* Reserve any memory except the ordinary RAM ranges. */ |
| 113 | 116 | switch (type) { |
| @@ -321,7 +324,7 @@ static void __init bootmem_init(void) · 207 unmodified lines | ||
| 321 | 324 | * Reserve any memory between the start of RAM and PHYS_OFFSET |
| 322 | 325 | */ |
| 323 | 326 | if (ramstart > PHYS_OFFSET) |
| 324 | − memblock_reserve(PHYS_OFFSET, PFN_UP(ramstart) - PHYS_OFFSET); | |
| 327 | + memblock_reserve(PHYS_OFFSET, ramstart - PHYS_OFFSET); | |
| 325 | 328 | |
| 326 | 329 | if (PFN_UP(ramstart) > ARCH_PFN_OFFSET) { |
| 327 | 330 | pr_info("Wasting %lu bytes for tracking %lu unused pages\n", |
| @@ -80,6 +80,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len, · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | save_static_function(sys_fork); |
| 82 | 82 | save_static_function(sys_clone); |
| 83 | +save_static_function(sys_clone3); | |
| 83 | 84 | |
| 84 | 85 | SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) |
| 85 | 86 | { |
| @@ -373,4 +373,4 @@ · 372 unmodified lines | ||
| 373 | 373 | 432 n32 fsmount sys_fsmount |
| 374 | 374 | 433 n32 fspick sys_fspick |
| 375 | 375 | 434 n32 pidfd_open sys_pidfd_open |
| 376 | −# 435 reserved for clone3 | |
| 376 | +435 n32 clone3 __sys_clone3 | |
| @@ -349,4 +349,4 @@ · 348 unmodified lines | ||
| 349 | 349 | 432 n64 fsmount sys_fsmount |
| 350 | 350 | 433 n64 fspick sys_fspick |
| 351 | 351 | 434 n64 pidfd_open sys_pidfd_open |
| 352 | −# 435 reserved for clone3 | |
| 352 | +435 n64 clone3 __sys_clone3 | |
| @@ -422,4 +422,4 @@ · 421 unmodified lines | ||
| 422 | 422 | 432 o32 fsmount sys_fsmount |
| 423 | 423 | 433 o32 fspick sys_fspick |
| 424 | 424 | 434 o32 pidfd_open sys_pidfd_open |
| 425 | −# 435 reserved for clone3 | |
| 425 | +435 o32 clone3 __sys_clone3 | |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | */ |
| 4 | 4 | #include <linux/fs.h> |
| 5 | 5 | #include <linux/fcntl.h> |
| 6 | +#include <linux/memblock.h> | |
| 6 | 7 | #include <linux/mm.h> |
| 7 | 8 | |
| 8 | 9 | #include <asm/bootinfo.h> |
| @@ -64,24 +65,22 @@ void __init prom_init_memory(void) · 55 unmodified lines | ||
| 64 | 65 | node_id = loongson_memmap->map[i].node_id; |
| 65 | 66 | mem_type = loongson_memmap->map[i].mem_type; |
| 66 | 67 | |
| 67 | − if (node_id == 0) { | |
| 68 | − switch (mem_type) { | |
| 69 | − case SYSTEM_RAM_LOW: | |
| 70 | − add_memory_region(loongson_memmap->map[i].mem_start, | |
| 71 | − (u64)loongson_memmap->map[i].mem_size << 20, | |
| 72 | − BOOT_MEM_RAM); | |
| 73 | − break; | |
| 74 | − case SYSTEM_RAM_HIGH: | |
| 75 | − add_memory_region(loongson_memmap->map[i].mem_start, | |
| 76 | − (u64)loongson_memmap->map[i].mem_size << 20, | |
| 77 | − BOOT_MEM_RAM); | |
| 78 | − break; | |
| 79 | − case SYSTEM_RAM_RESERVED: | |
| 80 | − add_memory_region(loongson_memmap->map[i].mem_start, | |
| 81 | − (u64)loongson_memmap->map[i].mem_size << 20, | |
| 82 | − BOOT_MEM_RESERVED); | |
| 83 | − break; | |
| 84 | − } | |
| 68 | + if (node_id != 0) | |
| 69 | + continue; | |
| 70 | + | |
| 71 | + switch (mem_type) { | |
| 72 | + case SYSTEM_RAM_LOW: | |
| 73 | + memblock_add(loongson_memmap->map[i].mem_start, | |
| 74 | + (u64)loongson_memmap->map[i].mem_size << 20); | |
| 75 | + break; | |
| 76 | + case SYSTEM_RAM_HIGH: | |
| 77 | + memblock_add(loongson_memmap->map[i].mem_start, | |
| 78 | + (u64)loongson_memmap->map[i].mem_size << 20); | |
| 79 | + break; | |
| 80 | + case SYSTEM_RAM_RESERVED: | |
| 81 | + memblock_reserve(loongson_memmap->map[i].mem_start, | |
| 82 | + (u64)loongson_memmap->map[i].mem_size << 20); | |
| 83 | + break; | |
| 85 | 84 | } |
| 86 | 85 | } |
| 87 | 86 | } |
| @@ -110,7 +110,7 @@ static int __init serial_init(void) · 109 unmodified lines | ||
| 110 | 110 | } |
| 111 | 111 | module_init(serial_init); |
| 112 | 112 | |
| 113 | −static void __init serial_exit(void) | |
| 113 | +static void __exit serial_exit(void) | |
| 114 | 114 | { |
| 115 | 115 | platform_device_unregister(&uart8250_device); |
| 116 | 116 | } |
| @@ -142,8 +142,6 @@ static void __init szmem(unsigned int node) · 141 unmodified lines | ||
| 142 | 142 | (u32)node_id, mem_type, mem_start, mem_size); |
| 143 | 143 | pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", |
| 144 | 144 | start_pfn, end_pfn, num_physpages); |
| 145 | − add_memory_region((node_id << 44) + mem_start, | |
| 146 | − (u64)mem_size << 20, BOOT_MEM_RAM); | |
| 147 | 145 | memblock_add_node(PFN_PHYS(start_pfn), |
| 148 | 146 | PFN_PHYS(end_pfn - start_pfn), node); |
| 149 | 147 | break; |
| @@ -156,16 +154,12 @@ static void __init szmem(unsigned int node) · 6 unmodified lines | ||
| 156 | 154 | (u32)node_id, mem_type, mem_start, mem_size); |
| 157 | 155 | pr_info(" start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n", |
| 158 | 156 | start_pfn, end_pfn, num_physpages); |
| 159 | − add_memory_region((node_id << 44) + mem_start, | |
| 160 | − (u64)mem_size << 20, BOOT_MEM_RAM); | |
| 161 | 157 | memblock_add_node(PFN_PHYS(start_pfn), |
| 162 | 158 | PFN_PHYS(end_pfn - start_pfn), node); |
| 163 | 159 | break; |
| 164 | 160 | case SYSTEM_RAM_RESERVED: |
| 165 | 161 | pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n", |
| 166 | 162 | (u32)node_id, mem_type, mem_start, mem_size); |
| 167 | − add_memory_region((node_id << 44) + mem_start, | |
| 168 | − (u64)mem_size << 20, BOOT_MEM_RESERVED); | |
| 169 | 163 | memblock_reserve(((node_id << 44) + mem_start), |
| 170 | 164 | mem_size << 20); |
| 171 | 165 | break; |
| @@ -191,8 +185,6 @@ static void __init node_mem_init(unsigned int node) · 19 unmodified lines | ||
| 191 | 185 | NODE_DATA(node)->node_start_pfn = start_pfn; |
| 192 | 186 | NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; |
| 193 | 187 | |
| 194 | − free_bootmem_with_active_regions(node, end_pfn); | |
| 195 | − | |
| 196 | 188 | if (node == 0) { |
| 197 | 189 | /* kernel end address */ |
| 198 | 190 | unsigned long kernel_end_pfn = PFN_UP(__pa_symbol(&_end)); |
| @@ -209,8 +201,6 @@ static void __init node_mem_init(unsigned int node) · 10 unmodified lines | ||
| 209 | 201 | memblock_reserve((node_addrspace_offset | 0xfe000000), |
| 210 | 202 | 32 << 20); |
| 211 | 203 | } |
| 212 | − | |
| 213 | − sparse_memory_present_with_active_regions(node); | |
| 214 | 204 | } |
| 215 | 205 | |
| 216 | 206 | static __init void prom_meminit(void) |
| @@ -227,6 +217,7 @@ static __init void prom_meminit(void) · 10 unmodified lines | ||
| 227 | 217 | cpumask_clear(&__node_data[(node)]->cpumask); |
| 228 | 218 | } |
| 229 | 219 | } |
| 220 | + memblocks_present(); | |
| 230 | 221 | max_low_pfn = PHYS_PFN(memblock_end_of_DRAM()); |
| 231 | 222 | |
| 232 | 223 | for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) { |
| @@ -61,6 +61,7 @@ int init_debug = 1; · 60 unmodified lines | ||
| 61 | 61 | /* memory blocks */ |
| 62 | 62 | struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; |
| 63 | 63 | |
| 64 | +#define MAX_PROM_MEM 5 | |
| 64 | 65 | static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata; |
| 65 | 66 | static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata; |
| 66 | 67 | static unsigned int nr_prom_mem __initdata; |
| @@ -358,7 +359,7 @@ void __init prom_meminit(void) · 291 unmodified lines | ||
| 358 | 359 | p++; |
| 359 | 360 | |
| 360 | 361 | if (type == BOOT_MEM_ROM_DATA) { |
| 361 | − if (nr_prom_mem >= 5) { | |
| 362 | + if (nr_prom_mem >= MAX_PROM_MEM) { | |
| 362 | 363 | pr_err("Too many ROM DATA regions"); |
| 363 | 364 | continue; |
| 364 | 365 | } |
| @@ -377,7 +378,6 @@ void __init prom_free_prom_memory(void) · 12 unmodified lines | ||
| 377 | 378 | char *ptr; |
| 378 | 379 | int len = 0; |
| 379 | 380 | int i; |
| 380 | − unsigned long addr; | |
| 381 | 381 | |
| 382 | 382 | /* |
| 383 | 383 | * preserve environment variables and command line from pmon/bbload |
| @@ -59,7 +59,7 @@ CFLAGS_REMOVE_vgettimeofday.o = -pg · 58 unmodified lines | ||
| 59 | 59 | ifndef CONFIG_CPU_MIPSR6 |
| 60 | 60 | ifeq ($(call ld-ifversion, -lt, 225000000, y),y) |
| 61 | 61 | $(warning MIPS VDSO requires binutils >= 2.25) |
| 62 | − obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y)) | |
| 62 | + obj-vdso-y := $(filter-out vgettimeofday.o, $(obj-vdso-y)) | |
| 63 | 63 | ccflags-vdso += -DDISABLE_MIPS_VDSO |
| 64 | 64 | endif |
| 65 | 65 | endif |
| @@ -1,269 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * Copyright (C) 2015 Imagination Technologies | |
| 4 | − * Author: Alex Smith <alex.smith@imgtec.com> | |
| 5 | − */ | |
| 6 | − | |
| 7 | −#include "vdso.h" | |
| 8 | − | |
| 9 | −#include <linux/compiler.h> | |
| 10 | −#include <linux/time.h> | |
| 11 | − | |
| 12 | −#include <asm/clocksource.h> | |
| 13 | −#include <asm/io.h> | |
| 14 | −#include <asm/unistd.h> | |
| 15 | −#include <asm/vdso.h> | |
| 16 | − | |
| 17 | −#ifdef CONFIG_MIPS_CLOCK_VSYSCALL | |
| 18 | − | |
| 19 | −static __always_inline long gettimeofday_fallback(struct timeval *_tv, | |
| 20 | − struct timezone *_tz) | |
| 21 | −{ | |
| 22 | − register struct timezone *tz asm("a1") = _tz; | |
| 23 | − register struct timeval *tv asm("a0") = _tv; | |
| 24 | − register long ret asm("v0"); | |
| 25 | − register long nr asm("v0") = __NR_gettimeofday; | |
| 26 | − register long error asm("a3"); | |
| 27 | − | |
| 28 | − asm volatile( | |
| 29 | − " syscall\n" | |
| 30 | − : "=r" (ret), "=r" (error) | |
| 31 | − : "r" (tv), "r" (tz), "r" (nr) | |
| 32 | − : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", | |
| 33 | − "$14", "$15", "$24", "$25", "hi", "lo", "memory"); | |
| 34 | − | |
| 35 | − return error ? -ret : ret; | |
| 36 | −} | |
| 37 | − | |
| 38 | −#endif | |
| 39 | − | |
| 40 | −static __always_inline long clock_gettime_fallback(clockid_t _clkid, | |
| 41 | − struct timespec *_ts) | |
| 42 | −{ | |
| 43 | − register struct timespec *ts asm("a1") = _ts; | |
| 44 | − register clockid_t clkid asm("a0") = _clkid; | |
| 45 | − register long ret asm("v0"); | |
| 46 | − register long nr asm("v0") = __NR_clock_gettime; | |
| 47 | − register long error asm("a3"); | |
| 48 | − | |
| 49 | − asm volatile( | |
| 50 | − " syscall\n" | |
| 51 | − : "=r" (ret), "=r" (error) | |
| 52 | − : "r" (clkid), "r" (ts), "r" (nr) | |
| 53 | − : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", | |
| 54 | − "$14", "$15", "$24", "$25", "hi", "lo", "memory"); | |
| 55 | − | |
| 56 | − return error ? -ret : ret; | |
| 57 | −} | |
| 58 | − | |
| 59 | −static __always_inline int do_realtime_coarse(struct timespec *ts, | |
| 60 | − const union mips_vdso_data *data) | |
| 61 | −{ | |
| 62 | − u32 start_seq; | |
| 63 | − | |
| 64 | − do { | |
| 65 | − start_seq = vdso_data_read_begin(data); | |
| 66 | − | |
| 67 | − ts->tv_sec = data->xtime_sec; | |
| 68 | − ts->tv_nsec = data->xtime_nsec >> data->cs_shift; | |
| 69 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 70 | − | |
| 71 | − return 0; | |
| 72 | −} | |
| 73 | − | |
| 74 | −static __always_inline int do_monotonic_coarse(struct timespec *ts, | |
| 75 | − const union mips_vdso_data *data) | |
| 76 | −{ | |
| 77 | − u32 start_seq; | |
| 78 | − u64 to_mono_sec; | |
| 79 | − u64 to_mono_nsec; | |
| 80 | − | |
| 81 | − do { | |
| 82 | − start_seq = vdso_data_read_begin(data); | |
| 83 | − | |
| 84 | − ts->tv_sec = data->xtime_sec; | |
| 85 | − ts->tv_nsec = data->xtime_nsec >> data->cs_shift; | |
| 86 | − | |
| 87 | − to_mono_sec = data->wall_to_mono_sec; | |
| 88 | − to_mono_nsec = data->wall_to_mono_nsec; | |
| 89 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 90 | − | |
| 91 | − ts->tv_sec += to_mono_sec; | |
| 92 | − timespec_add_ns(ts, to_mono_nsec); | |
| 93 | − | |
| 94 | − return 0; | |
| 95 | −} | |
| 96 | − | |
| 97 | −#ifdef CONFIG_CSRC_R4K | |
| 98 | − | |
| 99 | −static __always_inline u64 read_r4k_count(void) | |
| 100 | −{ | |
| 101 | − unsigned int count; | |
| 102 | − | |
| 103 | − __asm__ __volatile__( | |
| 104 | − " .set push\n" | |
| 105 | − " .set mips32r2\n" | |
| 106 | − " rdhwr %0, $2\n" | |
| 107 | − " .set pop\n" | |
| 108 | − : "=r" (count)); | |
| 109 | − | |
| 110 | − return count; | |
| 111 | −} | |
| 112 | − | |
| 113 | −#endif | |
| 114 | − | |
| 115 | −#ifdef CONFIG_CLKSRC_MIPS_GIC | |
| 116 | − | |
| 117 | −static __always_inline u64 read_gic_count(const union mips_vdso_data *data) | |
| 118 | −{ | |
| 119 | − void __iomem *gic = get_gic(data); | |
| 120 | − u32 hi, hi2, lo; | |
| 121 | − | |
| 122 | − do { | |
| 123 | − hi = __raw_readl(gic + sizeof(lo)); | |
| 124 | − lo = __raw_readl(gic); | |
| 125 | − hi2 = __raw_readl(gic + sizeof(lo)); | |
| 126 | − } while (hi2 != hi); | |
| 127 | − | |
| 128 | − return (((u64)hi) << 32) + lo; | |
| 129 | −} | |
| 130 | − | |
| 131 | −#endif | |
| 132 | − | |
| 133 | −static __always_inline u64 get_ns(const union mips_vdso_data *data) | |
| 134 | −{ | |
| 135 | − u64 cycle_now, delta, nsec; | |
| 136 | − | |
| 137 | − switch (data->clock_mode) { | |
| 138 | −#ifdef CONFIG_CSRC_R4K | |
| 139 | − case VDSO_CLOCK_R4K: | |
| 140 | − cycle_now = read_r4k_count(); | |
| 141 | − break; | |
| 142 | −#endif | |
| 143 | −#ifdef CONFIG_CLKSRC_MIPS_GIC | |
| 144 | − case VDSO_CLOCK_GIC: | |
| 145 | − cycle_now = read_gic_count(data); | |
| 146 | − break; | |
| 147 | −#endif | |
| 148 | − default: | |
| 149 | − return 0; | |
| 150 | − } | |
| 151 | − | |
| 152 | − delta = (cycle_now - data->cs_cycle_last) & data->cs_mask; | |
| 153 | − | |
| 154 | − nsec = (delta * data->cs_mult) + data->xtime_nsec; | |
| 155 | − nsec >>= data->cs_shift; | |
| 156 | − | |
| 157 | − return nsec; | |
| 158 | −} | |
| 159 | − | |
| 160 | −static __always_inline int do_realtime(struct timespec *ts, | |
| 161 | − const union mips_vdso_data *data) | |
| 162 | −{ | |
| 163 | − u32 start_seq; | |
| 164 | − u64 ns; | |
| 165 | − | |
| 166 | − do { | |
| 167 | − start_seq = vdso_data_read_begin(data); | |
| 168 | − | |
| 169 | − if (data->clock_mode == VDSO_CLOCK_NONE) | |
| 170 | − return -ENOSYS; | |
| 171 | − | |
| 172 | − ts->tv_sec = data->xtime_sec; | |
| 173 | − ns = get_ns(data); | |
| 174 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 175 | − | |
| 176 | − ts->tv_nsec = 0; | |
| 177 | − timespec_add_ns(ts, ns); | |
| 178 | − | |
| 179 | − return 0; | |
| 180 | −} | |
| 181 | − | |
| 182 | −static __always_inline int do_monotonic(struct timespec *ts, | |
| 183 | − const union mips_vdso_data *data) | |
| 184 | −{ | |
| 185 | − u32 start_seq; | |
| 186 | − u64 ns; | |
| 187 | − u64 to_mono_sec; | |
| 188 | − u64 to_mono_nsec; | |
| 189 | − | |
| 190 | − do { | |
| 191 | − start_seq = vdso_data_read_begin(data); | |
| 192 | − | |
| 193 | − if (data->clock_mode == VDSO_CLOCK_NONE) | |
| 194 | − return -ENOSYS; | |
| 195 | − | |
| 196 | − ts->tv_sec = data->xtime_sec; | |
| 197 | − ns = get_ns(data); | |
| 198 | − | |
| 199 | − to_mono_sec = data->wall_to_mono_sec; | |
| 200 | − to_mono_nsec = data->wall_to_mono_nsec; | |
| 201 | − } while (vdso_data_read_retry(data, start_seq)); | |
| 202 | − | |
| 203 | − ts->tv_sec += to_mono_sec; | |
| 204 | − ts->tv_nsec = 0; | |
| 205 | − timespec_add_ns(ts, ns + to_mono_nsec); | |
| 206 | − | |
| 207 | − return 0; | |
| 208 | −} | |
| 209 | − | |
| 210 | −#ifdef CONFIG_MIPS_CLOCK_VSYSCALL | |
| 211 | − | |
| 212 | −/* | |
| 213 | − * This is behind the ifdef so that we don't provide the symbol when there's no | |
| 214 | − * possibility of there being a usable clocksource, because there's nothing we | |
| 215 | − * can do without it. When libc fails the symbol lookup it should fall back on | |
| 216 | − * the standard syscall path. | |
| 217 | − */ | |
| 218 | −int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) | |
| 219 | −{ | |
| 220 | − const union mips_vdso_data *data = get_vdso_data(); | |
| 221 | − struct timespec ts; | |
| 222 | − int ret; | |
| 223 | − | |
| 224 | − ret = do_realtime(&ts, data); | |
| 225 | − if (ret) | |
| 226 | − return gettimeofday_fallback(tv, tz); | |
| 227 | − | |
| 228 | − if (tv) { | |
| 229 | − tv->tv_sec = ts.tv_sec; | |
| 230 | − tv->tv_usec = ts.tv_nsec / 1000; | |
| 231 | − } | |
| 232 | − | |
| 233 | − if (tz) { | |
| 234 | − tz->tz_minuteswest = data->tz_minuteswest; | |
| 235 | − tz->tz_dsttime = data->tz_dsttime; | |
| 236 | − } | |
| 237 | − | |
| 238 | − return 0; | |
| 239 | −} | |
| 240 | − | |
| 241 | −#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ | |
| 242 | − | |
| 243 | −int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts) | |
| 244 | −{ | |
| 245 | − const union mips_vdso_data *data = get_vdso_data(); | |
| 246 | − int ret = -1; | |
| 247 | − | |
| 248 | − switch (clkid) { | |
| 249 | − case CLOCK_REALTIME_COARSE: | |
| 250 | − ret = do_realtime_coarse(ts, data); | |
| 251 | − break; | |
| 252 | − case CLOCK_MONOTONIC_COARSE: | |
| 253 | − ret = do_monotonic_coarse(ts, data); | |
| 254 | − break; | |
| 255 | − case CLOCK_REALTIME: | |
| 256 | − ret = do_realtime(ts, data); | |
| 257 | − break; | |
| 258 | − case CLOCK_MONOTONIC: | |
| 259 | − ret = do_monotonic(ts, data); | |
| 260 | − break; | |
| 261 | − default: | |
| 262 | − break; | |
| 263 | − } | |
| 264 | − | |
| 265 | − if (ret) | |
| 266 | − ret = clock_gettime_fallback(clkid, ts); | |
| 267 | − | |
| 268 | − return ret; | |
| 269 | −} | |
| @@ -50,7 +50,7 @@ endif · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc |
| 52 | 52 | |
| 53 | −BOOTARFLAGS := -cr$(KBUILD_ARFLAGS) | |
| 53 | +BOOTARFLAGS := -crD | |
| 54 | 54 | |
| 55 | 55 | ifdef CONFIG_CC_IS_CLANG |
| 56 | 56 | BOOTCFLAGS += $(CLANG_FLAGS) |
| @@ -36,8 +36,8 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "book3s.h" |
| 37 | 37 | #include "trace.h" |
| 38 | 38 | |
| 39 | −#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM | |
| 40 | −#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU | |
| 39 | +#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__ | |
| 40 | +#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__ | |
| 41 | 41 | |
| 42 | 42 | /* #define EXIT_DEBUG */ |
| 43 | 43 | |
| @@ -69,8 +69,8 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 25 unmodified lines | ||
| 69 | 69 | { "pthru_all", VCPU_STAT(pthru_all) }, |
| 70 | 70 | { "pthru_host", VCPU_STAT(pthru_host) }, |
| 71 | 71 | { "pthru_bad_aff", VCPU_STAT(pthru_bad_aff) }, |
| 72 | − { "largepages_2M", VM_STAT(num_2M_pages) }, | |
| 73 | − { "largepages_1G", VM_STAT(num_1G_pages) }, | |
| 72 | + { "largepages_2M", VM_STAT(num_2M_pages, .mode = 0444) }, | |
| 73 | + { "largepages_1G", VM_STAT(num_1G_pages, .mode = 0444) }, | |
| 74 | 74 | { NULL } |
| 75 | 75 | }; |
| 76 | 76 | |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #define REG_L __REG_SEL(ld, lw) |
| 24 | 24 | #define REG_S __REG_SEL(sd, sw) |
| 25 | +#define REG_SC __REG_SEL(sc.d, sc.w) | |
| 25 | 26 | #define SZREG __REG_SEL(8, 4) |
| 26 | 27 | #define LGREG __REG_SEL(3, 2) |
| 27 | 28 | |
| @@ -98,7 +98,26 @@ _save_context: · 97 unmodified lines | ||
| 98 | 98 | */ |
| 99 | 99 | .macro RESTORE_ALL |
| 100 | 100 | REG_L a0, PT_SSTATUS(sp) |
| 101 | − REG_L a2, PT_SEPC(sp) | |
| 101 | + /* | |
| 102 | + * The current load reservation is effectively part of the processor's | |
| 103 | + * state, in the sense that load reservations cannot be shared between | |
| 104 | + * different hart contexts. We can't actually save and restore a load | |
| 105 | + * reservation, so instead here we clear any existing reservation -- | |
| 106 | + * it's always legal for implementations to clear load reservations at | |
| 107 | + * any point (as long as the forward progress guarantee is kept, but | |
| 108 | + * we'll ignore that here). | |
| 109 | + * | |
| 110 | + * Dangling load reservations can be the result of taking a trap in the | |
| 111 | + * middle of an LR/SC sequence, but can also be the result of a taken | |
| 112 | + * forward branch around an SC -- which is how we implement CAS. As a | |
| 113 | + * result we need to clear reservations between the last CAS and the | |
| 114 | + * jump back to the new context. While it is unlikely the store | |
| 115 | + * completes, implementations are allowed to expand reservations to be | |
| 116 | + * arbitrarily large. | |
| 117 | + */ | |
| 118 | + REG_L a2, PT_SEPC(sp) | |
| 119 | + REG_SC x0, a2, PT_SEPC(sp) | |
| 120 | + | |
| 102 | 121 | csrw CSR_SSTATUS, a0 |
| 103 | 122 | csrw CSR_SEPC, a2 |
| 104 | 123 | |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/swap.h> |
| 12 | 12 | #include <linux/sizes.h> |
| 13 | 13 | #include <linux/of_fdt.h> |
| 14 | +#include <linux/libfdt.h> | |
| 14 | 15 | |
| 15 | 16 | #include <asm/fixmap.h> |
| 16 | 17 | #include <asm/tlbflush.h> |
| @@ -82,6 +83,8 @@ disable: · 65 unmodified lines | ||
| 82 | 83 | } |
| 83 | 84 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 84 | 85 | |
| 86 | +static phys_addr_t dtb_early_pa __initdata; | |
| 87 | + | |
| 85 | 88 | void __init setup_bootmem(void) |
| 86 | 89 | { |
| 87 | 90 | struct memblock_region *reg; |
| @@ -117,7 +120,12 @@ void __init setup_bootmem(void) · 29 unmodified lines | ||
| 117 | 120 | setup_initrd(); |
| 118 | 121 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 119 | 122 | |
| 120 | − early_init_fdt_reserve_self(); | |
| 123 | + /* | |
| 124 | + * Avoid using early_init_fdt_reserve_self() since __pa() does | |
| 125 | + * not work for DTB pointers that are fixmap addresses | |
| 126 | + */ | |
| 127 | + memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va)); | |
| 128 | + | |
| 121 | 129 | early_init_fdt_scan_reserved_mem(); |
| 122 | 130 | memblock_allow_resize(); |
| 123 | 131 | memblock_dump_all(); |
| @@ -393,6 +401,8 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 269 unmodified lines | ||
| 393 | 401 | |
| 394 | 402 | /* Save pointer to DTB for early FDT parsing */ |
| 395 | 403 | dtb_early_va = (void *)fix_to_virt(FIX_FDT) + (dtb_pa & ~PAGE_MASK); |
| 404 | + /* Save physical address for memblock reservation */ | |
| 405 | + dtb_early_pa = dtb_pa; | |
| 396 | 406 | } |
| 397 | 407 | |
| 398 | 408 | static void __init setup_vm_final(void) |
| @@ -44,6 +44,7 @@ CONFIG_NR_CPUS=512 · 43 unmodified lines | ||
| 44 | 44 | CONFIG_NUMA=y |
| 45 | 45 | CONFIG_HZ_100=y |
| 46 | 46 | CONFIG_KEXEC_FILE=y |
| 47 | +CONFIG_KEXEC_SIG=y | |
| 47 | 48 | CONFIG_EXPOLINE=y |
| 48 | 49 | CONFIG_EXPOLINE_AUTO=y |
| 49 | 50 | CONFIG_CHSC_SCH=y |
| @@ -69,12 +70,13 @@ CONFIG_MODULE_UNLOAD=y · 19 unmodified lines | ||
| 69 | 70 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 70 | 71 | CONFIG_MODVERSIONS=y |
| 71 | 72 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 72 | −CONFIG_MODULE_SIG=y | |
| 73 | 73 | CONFIG_MODULE_SIG_SHA256=y |
| 74 | +CONFIG_UNUSED_SYMBOLS=y | |
| 74 | 75 | CONFIG_BLK_DEV_INTEGRITY=y |
| 75 | 76 | CONFIG_BLK_DEV_THROTTLING=y |
| 76 | 77 | CONFIG_BLK_WBT=y |
| 77 | 78 | CONFIG_BLK_CGROUP_IOLATENCY=y |
| 79 | +CONFIG_BLK_CGROUP_IOCOST=y | |
| 78 | 80 | CONFIG_PARTITION_ADVANCED=y |
| 79 | 81 | CONFIG_IBM_PARTITION=y |
| 80 | 82 | CONFIG_BSD_DISKLABEL=y |
| @@ -370,6 +372,7 @@ CONFIG_NETLINK_DIAG=m · 289 unmodified lines | ||
| 370 | 372 | CONFIG_CGROUP_NET_PRIO=y |
| 371 | 373 | CONFIG_BPF_JIT=y |
| 372 | 374 | CONFIG_NET_PKTGEN=m |
| 375 | +# CONFIG_NET_DROP_MONITOR is not set | |
| 373 | 376 | CONFIG_PCI=y |
| 374 | 377 | CONFIG_PCI_DEBUG=y |
| 375 | 378 | CONFIG_HOTPLUG_PCI=y |
| @@ -424,6 +427,7 @@ CONFIG_DM_CRYPT=m · 48 unmodified lines | ||
| 424 | 427 | CONFIG_DM_SNAPSHOT=m |
| 425 | 428 | CONFIG_DM_THIN_PROVISIONING=m |
| 426 | 429 | CONFIG_DM_WRITECACHE=m |
| 430 | +CONFIG_DM_CLONE=m | |
| 427 | 431 | CONFIG_DM_MIRROR=m |
| 428 | 432 | CONFIG_DM_LOG_USERSPACE=m |
| 429 | 433 | CONFIG_DM_RAID=m |
| @@ -435,6 +439,7 @@ CONFIG_DM_DELAY=m · 5 unmodified lines | ||
| 435 | 439 | CONFIG_DM_UEVENT=y |
| 436 | 440 | CONFIG_DM_FLAKEY=m |
| 437 | 441 | CONFIG_DM_VERITY=m |
| 442 | +CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y | |
| 438 | 443 | CONFIG_DM_SWITCH=m |
| 439 | 444 | CONFIG_NETDEVICES=y |
| 440 | 445 | CONFIG_BONDING=m |
| @@ -489,6 +494,7 @@ CONFIG_MLX5_CORE_EN=y · 48 unmodified lines | ||
| 489 | 494 | # CONFIG_NET_VENDOR_NVIDIA is not set |
| 490 | 495 | # CONFIG_NET_VENDOR_OKI is not set |
| 491 | 496 | # CONFIG_NET_VENDOR_PACKET_ENGINES is not set |
| 497 | +# CONFIG_NET_VENDOR_PENSANDO is not set | |
| 492 | 498 | # CONFIG_NET_VENDOR_QLOGIC is not set |
| 493 | 499 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 494 | 500 | # CONFIG_NET_VENDOR_RDC is not set |
| @@ -538,15 +544,16 @@ CONFIG_WATCHDOG=y · 43 unmodified lines | ||
| 538 | 544 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 539 | 545 | CONFIG_SOFT_WATCHDOG=m |
| 540 | 546 | CONFIG_DIAG288_WATCHDOG=m |
| 541 | −CONFIG_DRM=y | |
| 542 | −CONFIG_DRM_VIRTIO_GPU=y | |
| 547 | +CONFIG_FB=y | |
| 543 | 548 | CONFIG_FRAMEBUFFER_CONSOLE=y |
| 549 | +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | |
| 544 | 550 | # CONFIG_HID is not set |
| 545 | 551 | # CONFIG_USB_SUPPORT is not set |
| 546 | 552 | CONFIG_INFINIBAND=m |
| 547 | 553 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 548 | 554 | CONFIG_MLX4_INFINIBAND=m |
| 549 | 555 | CONFIG_MLX5_INFINIBAND=m |
| 556 | +CONFIG_SYNC_FILE=y | |
| 550 | 557 | CONFIG_VFIO=m |
| 551 | 558 | CONFIG_VFIO_PCI=m |
| 552 | 559 | CONFIG_VFIO_MDEV=m |
| @@ -580,6 +587,8 @@ CONFIG_NILFS2_FS=m · 27 unmodified lines | ||
| 580 | 587 | CONFIG_FS_DAX=y |
| 581 | 588 | CONFIG_EXPORTFS_BLOCK_OPS=y |
| 582 | 589 | CONFIG_FS_ENCRYPTION=y |
| 590 | +CONFIG_FS_VERITY=y | |
| 591 | +CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y | |
| 583 | 592 | CONFIG_FANOTIFY=y |
| 584 | 593 | CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y |
| 585 | 594 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| @@ -589,6 +598,7 @@ CONFIG_QFMT_V2=m · 3 unmodified lines | ||
| 589 | 598 | CONFIG_AUTOFS4_FS=m |
| 590 | 599 | CONFIG_FUSE_FS=y |
| 591 | 600 | CONFIG_CUSE=m |
| 601 | +CONFIG_VIRTIO_FS=m | |
| 592 | 602 | CONFIG_OVERLAY_FS=m |
| 593 | 603 | CONFIG_FSCACHE=m |
| 594 | 604 | CONFIG_CACHEFILES=m |
| @@ -648,12 +658,15 @@ CONFIG_FORTIFY_SOURCE=y · 53 unmodified lines | ||
| 648 | 658 | CONFIG_SECURITY_SELINUX=y |
| 649 | 659 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 650 | 660 | CONFIG_SECURITY_SELINUX_DISABLE=y |
| 661 | +CONFIG_SECURITY_LOCKDOWN_LSM=y | |
| 662 | +CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y | |
| 651 | 663 | CONFIG_INTEGRITY_SIGNATURE=y |
| 652 | 664 | CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y |
| 653 | 665 | CONFIG_IMA=y |
| 654 | 666 | CONFIG_IMA_DEFAULT_HASH_SHA256=y |
| 655 | 667 | CONFIG_IMA_WRITE_POLICY=y |
| 656 | 668 | CONFIG_IMA_APPRAISE=y |
| 669 | +CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor" | |
| 657 | 670 | CONFIG_CRYPTO_USER=m |
| 658 | 671 | # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set |
| 659 | 672 | CONFIG_CRYPTO_PCRYPT=m |
| @@ -664,10 +677,6 @@ CONFIG_CRYPTO_ECDH=m · 4 unmodified lines | ||
| 664 | 677 | CONFIG_CRYPTO_ECRDSA=m |
| 665 | 678 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| 666 | 679 | CONFIG_CRYPTO_AEGIS128=m |
| 667 | −CONFIG_CRYPTO_AEGIS128L=m | |
| 668 | −CONFIG_CRYPTO_AEGIS256=m | |
| 669 | −CONFIG_CRYPTO_MORUS640=m | |
| 670 | −CONFIG_CRYPTO_MORUS1280=m | |
| 671 | 680 | CONFIG_CRYPTO_CFB=m |
| 672 | 681 | CONFIG_CRYPTO_LRW=m |
| 673 | 682 | CONFIG_CRYPTO_PCBC=m |
| @@ -739,7 +748,6 @@ CONFIG_DEBUG_INFO=y · 65 unmodified lines | ||
| 739 | 748 | CONFIG_DEBUG_INFO_DWARF4=y |
| 740 | 749 | CONFIG_GDB_SCRIPTS=y |
| 741 | 750 | CONFIG_FRAME_WARN=1024 |
| 742 | −CONFIG_UNUSED_SYMBOLS=y | |
| 743 | 751 | CONFIG_HEADERS_INSTALL=y |
| 744 | 752 | CONFIG_HEADERS_CHECK=y |
| 745 | 753 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| @@ -44,6 +44,7 @@ CONFIG_NUMA=y · 43 unmodified lines | ||
| 44 | 44 | # CONFIG_NUMA_EMU is not set |
| 45 | 45 | CONFIG_HZ_100=y |
| 46 | 46 | CONFIG_KEXEC_FILE=y |
| 47 | +CONFIG_KEXEC_SIG=y | |
| 47 | 48 | CONFIG_EXPOLINE=y |
| 48 | 49 | CONFIG_EXPOLINE_AUTO=y |
| 49 | 50 | CONFIG_CHSC_SCH=y |
| @@ -66,11 +67,12 @@ CONFIG_MODULE_UNLOAD=y · 16 unmodified lines | ||
| 66 | 67 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 67 | 68 | CONFIG_MODVERSIONS=y |
| 68 | 69 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 69 | −CONFIG_MODULE_SIG=y | |
| 70 | 70 | CONFIG_MODULE_SIG_SHA256=y |
| 71 | +CONFIG_UNUSED_SYMBOLS=y | |
| 71 | 72 | CONFIG_BLK_DEV_THROTTLING=y |
| 72 | 73 | CONFIG_BLK_WBT=y |
| 73 | 74 | CONFIG_BLK_CGROUP_IOLATENCY=y |
| 75 | +CONFIG_BLK_CGROUP_IOCOST=y | |
| 74 | 76 | CONFIG_PARTITION_ADVANCED=y |
| 75 | 77 | CONFIG_IBM_PARTITION=y |
| 76 | 78 | CONFIG_BSD_DISKLABEL=y |
| @@ -363,6 +365,7 @@ CONFIG_NETLINK_DIAG=m · 286 unmodified lines | ||
| 363 | 365 | CONFIG_CGROUP_NET_PRIO=y |
| 364 | 366 | CONFIG_BPF_JIT=y |
| 365 | 367 | CONFIG_NET_PKTGEN=m |
| 368 | +# CONFIG_NET_DROP_MONITOR is not set | |
| 366 | 369 | CONFIG_PCI=y |
| 367 | 370 | CONFIG_HOTPLUG_PCI=y |
| 368 | 371 | CONFIG_HOTPLUG_PCI_S390=y |
| @@ -418,6 +421,7 @@ CONFIG_DM_CRYPT=m · 49 unmodified lines | ||
| 418 | 421 | CONFIG_DM_SNAPSHOT=m |
| 419 | 422 | CONFIG_DM_THIN_PROVISIONING=m |
| 420 | 423 | CONFIG_DM_WRITECACHE=m |
| 424 | +CONFIG_DM_CLONE=m | |
| 421 | 425 | CONFIG_DM_MIRROR=m |
| 422 | 426 | CONFIG_DM_LOG_USERSPACE=m |
| 423 | 427 | CONFIG_DM_RAID=m |
| @@ -429,6 +433,7 @@ CONFIG_DM_DELAY=m · 5 unmodified lines | ||
| 429 | 433 | CONFIG_DM_UEVENT=y |
| 430 | 434 | CONFIG_DM_FLAKEY=m |
| 431 | 435 | CONFIG_DM_VERITY=m |
| 436 | +CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG=y | |
| 432 | 437 | CONFIG_DM_SWITCH=m |
| 433 | 438 | CONFIG_DM_INTEGRITY=m |
| 434 | 439 | CONFIG_NETDEVICES=y |
| @@ -484,6 +489,7 @@ CONFIG_MLX5_CORE_EN=y · 49 unmodified lines | ||
| 484 | 489 | # CONFIG_NET_VENDOR_NVIDIA is not set |
| 485 | 490 | # CONFIG_NET_VENDOR_OKI is not set |
| 486 | 491 | # CONFIG_NET_VENDOR_PACKET_ENGINES is not set |
| 492 | +# CONFIG_NET_VENDOR_PENSANDO is not set | |
| 487 | 493 | # CONFIG_NET_VENDOR_QLOGIC is not set |
| 488 | 494 | # CONFIG_NET_VENDOR_QUALCOMM is not set |
| 489 | 495 | # CONFIG_NET_VENDOR_RDC is not set |
| @@ -533,16 +539,16 @@ CONFIG_WATCHDOG_CORE=y · 43 unmodified lines | ||
| 533 | 539 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 534 | 540 | CONFIG_SOFT_WATCHDOG=m |
| 535 | 541 | CONFIG_DIAG288_WATCHDOG=m |
| 536 | −CONFIG_DRM=y | |
| 537 | −CONFIG_DRM_VIRTIO_GPU=y | |
| 538 | −# CONFIG_BACKLIGHT_CLASS_DEVICE is not set | |
| 542 | +CONFIG_FB=y | |
| 539 | 543 | CONFIG_FRAMEBUFFER_CONSOLE=y |
| 544 | +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | |
| 540 | 545 | # CONFIG_HID is not set |
| 541 | 546 | # CONFIG_USB_SUPPORT is not set |
| 542 | 547 | CONFIG_INFINIBAND=m |
| 543 | 548 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 544 | 549 | CONFIG_MLX4_INFINIBAND=m |
| 545 | 550 | CONFIG_MLX5_INFINIBAND=m |
| 551 | +CONFIG_SYNC_FILE=y | |
| 546 | 552 | CONFIG_VFIO=m |
| 547 | 553 | CONFIG_VFIO_PCI=m |
| 548 | 554 | CONFIG_VFIO_MDEV=m |
| @@ -573,6 +579,8 @@ CONFIG_NILFS2_FS=m · 24 unmodified lines | ||
| 573 | 579 | CONFIG_FS_DAX=y |
| 574 | 580 | CONFIG_EXPORTFS_BLOCK_OPS=y |
| 575 | 581 | CONFIG_FS_ENCRYPTION=y |
| 582 | +CONFIG_FS_VERITY=y | |
| 583 | +CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y | |
| 576 | 584 | CONFIG_FANOTIFY=y |
| 577 | 585 | CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y |
| 578 | 586 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| @@ -581,6 +589,7 @@ CONFIG_QFMT_V2=m · 2 unmodified lines | ||
| 581 | 589 | CONFIG_AUTOFS4_FS=m |
| 582 | 590 | CONFIG_FUSE_FS=y |
| 583 | 591 | CONFIG_CUSE=m |
| 592 | +CONFIG_VIRTIO_FS=m | |
| 584 | 593 | CONFIG_OVERLAY_FS=m |
| 585 | 594 | CONFIG_FSCACHE=m |
| 586 | 595 | CONFIG_CACHEFILES=m |
| @@ -639,12 +648,15 @@ CONFIG_SECURITY_NETWORK=y · 52 unmodified lines | ||
| 639 | 648 | CONFIG_SECURITY_SELINUX=y |
| 640 | 649 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 641 | 650 | CONFIG_SECURITY_SELINUX_DISABLE=y |
| 651 | +CONFIG_SECURITY_LOCKDOWN_LSM=y | |
| 652 | +CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y | |
| 642 | 653 | CONFIG_INTEGRITY_SIGNATURE=y |
| 643 | 654 | CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y |
| 644 | 655 | CONFIG_IMA=y |
| 645 | 656 | CONFIG_IMA_DEFAULT_HASH_SHA256=y |
| 646 | 657 | CONFIG_IMA_WRITE_POLICY=y |
| 647 | 658 | CONFIG_IMA_APPRAISE=y |
| 659 | +CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor" | |
| 648 | 660 | CONFIG_CRYPTO_FIPS=y |
| 649 | 661 | CONFIG_CRYPTO_USER=m |
| 650 | 662 | # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set |
| @@ -656,10 +668,6 @@ CONFIG_CRYPTO_ECDH=m · 5 unmodified lines | ||
| 656 | 668 | CONFIG_CRYPTO_ECRDSA=m |
| 657 | 669 | CONFIG_CRYPTO_CHACHA20POLY1305=m |
| 658 | 670 | CONFIG_CRYPTO_AEGIS128=m |
| 659 | −CONFIG_CRYPTO_AEGIS128L=m | |
| 660 | −CONFIG_CRYPTO_AEGIS256=m | |
| 661 | −CONFIG_CRYPTO_MORUS640=m | |
| 662 | −CONFIG_CRYPTO_MORUS1280=m | |
| 663 | 671 | CONFIG_CRYPTO_CFB=m |
| 664 | 672 | CONFIG_CRYPTO_LRW=m |
| 665 | 673 | CONFIG_CRYPTO_OFB=m |
| @@ -727,7 +735,6 @@ CONFIG_DEBUG_INFO=y · 61 unmodified lines | ||
| 727 | 735 | CONFIG_DEBUG_INFO_DWARF4=y |
| 728 | 736 | CONFIG_GDB_SCRIPTS=y |
| 729 | 737 | CONFIG_FRAME_WARN=1024 |
| 730 | −CONFIG_UNUSED_SYMBOLS=y | |
| 731 | 738 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| 732 | 739 | CONFIG_MAGIC_SYSRQ=y |
| 733 | 740 | CONFIG_DEBUG_MEMORY_INIT=y |
| @@ -61,7 +61,7 @@ CONFIG_RAW_DRIVER=y · 60 unmodified lines | ||
| 61 | 61 | CONFIG_CONFIGFS_FS=y |
| 62 | 62 | # CONFIG_MISC_FILESYSTEMS is not set |
| 63 | 63 | # CONFIG_NETWORK_FILESYSTEMS is not set |
| 64 | −# CONFIG_DIMLIB is not set | |
| 64 | +CONFIG_LSM="yama,loadpin,safesetid,integrity" | |
| 65 | 65 | CONFIG_PRINTK_TIME=y |
| 66 | 66 | CONFIG_DEBUG_INFO=y |
| 67 | 67 | CONFIG_DEBUG_FS=y |
| @@ -41,7 +41,7 @@ __ATOMIC_OPS(__atomic64_xor, long, "laxg") · 40 unmodified lines | ||
| 41 | 41 | #undef __ATOMIC_OP |
| 42 | 42 | |
| 43 | 43 | #define __ATOMIC_CONST_OP(op_name, op_type, op_string, op_barrier) \ |
| 44 | −static inline void op_name(op_type val, op_type *ptr) \ | |
| 44 | +static __always_inline void op_name(op_type val, op_type *ptr) \ | |
| 45 | 45 | { \ |
| 46 | 46 | asm volatile( \ |
| 47 | 47 | op_string " %[ptr],%[val]\n" \ |
| @@ -56,7 +56,7 @@ __bitops_byte(unsigned long nr, volatile unsigned long *ptr) · 55 unmodified lines | ||
| 56 | 56 | return ((unsigned char *)ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | −static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 59 | +static __always_inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 60 | 60 | { |
| 61 | 61 | unsigned long *addr = __bitops_word(nr, ptr); |
| 62 | 62 | unsigned long mask; |
| @@ -77,7 +77,7 @@ static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr) · 14 unmodified lines | ||
| 77 | 77 | __atomic64_or(mask, (long *)addr); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | −static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 80 | +static __always_inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) | |
| 81 | 81 | { |
| 82 | 82 | unsigned long *addr = __bitops_word(nr, ptr); |
| 83 | 83 | unsigned long mask; |
| @@ -98,8 +98,8 @@ static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr) · 14 unmodified lines | ||
| 98 | 98 | __atomic64_and(mask, (long *)addr); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | −static inline void arch_change_bit(unsigned long nr, | |
| 102 | − volatile unsigned long *ptr) | |
| 101 | +static __always_inline void arch_change_bit(unsigned long nr, | |
| 102 | + volatile unsigned long *ptr) | |
| 103 | 103 | { |
| 104 | 104 | unsigned long *addr = __bitops_word(nr, ptr); |
| 105 | 105 | unsigned long mask; |
| @@ -171,7 +171,7 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t; · 170 unmodified lines | ||
| 171 | 171 | * |
| 172 | 172 | * Returns 1 if @func is available for @opcode, 0 otherwise |
| 173 | 173 | */ |
| 174 | −static inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) | |
| 174 | +static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask) | |
| 175 | 175 | { |
| 176 | 176 | register unsigned long r0 asm("0") = 0; /* query function */ |
| 177 | 177 | register unsigned long r1 asm("1") = (unsigned long) mask; |
| @@ -28,6 +28,8 @@ asm(".include \"asm/cpu_mf-insn.h\"\n"); · 27 unmodified lines | ||
| 28 | 28 | CPU_MF_INT_SF_PRA|CPU_MF_INT_SF_SACA| \ |
| 29 | 29 | CPU_MF_INT_SF_LSDA) |
| 30 | 30 | |
| 31 | +#define CPU_MF_SF_RIBM_NOTAV 0x1 /* Sampling unavailable */ | |
| 32 | + | |
| 31 | 33 | /* CPU measurement facility support */ |
| 32 | 34 | static inline int cpum_cf_avail(void) |
| 33 | 35 | { |
| @@ -69,7 +71,8 @@ struct hws_qsi_info_block { /* Bit(s) */ · 35 unmodified lines | ||
| 69 | 71 | unsigned long max_sampl_rate; /* 16-23: maximum sampling interval*/ |
| 70 | 72 | unsigned long tear; /* 24-31: TEAR contents */ |
| 71 | 73 | unsigned long dear; /* 32-39: DEAR contents */ |
| 72 | − unsigned int rsvrd0; /* 40-43: reserved */ | |
| 74 | + unsigned int rsvrd0:24; /* 40-42: reserved */ | |
| 75 | + unsigned int ribm:8; /* 43: Reserved by IBM */ | |
| 73 | 76 | unsigned int cpu_speed; /* 44-47: CPU speed */ |
| 74 | 77 | unsigned long long rsvrd1; /* 48-55: reserved */ |
| 75 | 78 | unsigned long long rsvrd2; /* 56-63: reserved */ |
| @@ -220,7 +223,8 @@ enum stcctm_ctr_set { · 144 unmodified lines | ||
| 220 | 223 | MT_DIAG = 5, |
| 221 | 224 | MT_DIAG_CLEARING = 9, /* clears loss-of-MT-ctr-data alert */ |
| 222 | 225 | }; |
| 223 | −static inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest) | |
| 226 | + | |
| 227 | +static __always_inline int stcctm(enum stcctm_ctr_set set, u64 range, u64 *dest) | |
| 224 | 228 | { |
| 225 | 229 | int cc; |
| 226 | 230 | |
| @@ -12,8 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <asm/page.h> |
| 13 | 13 | #include <asm/pgtable.h> |
| 14 | 14 | |
| 15 | − | |
| 16 | −#define is_hugepage_only_range(mm, addr, len) 0 | |
| 17 | 15 | #define hugetlb_free_pgd_range free_pgd_range |
| 18 | 16 | #define hugepages_supported() (MACHINE_HAS_EDAT1) |
| 19 | 17 | |
| @@ -23,6 +21,13 @@ pte_t huge_ptep_get(pte_t *ptep); · 3 unmodified lines | ||
| 23 | 21 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, |
| 24 | 22 | unsigned long addr, pte_t *ptep); |
| 25 | 23 | |
| 24 | +static inline bool is_hugepage_only_range(struct mm_struct *mm, | |
| 25 | + unsigned long addr, | |
| 26 | + unsigned long len) | |
| 27 | +{ | |
| 28 | + return false; | |
| 29 | +} | |
| 30 | + | |
| 26 | 31 | /* |
| 27 | 32 | * If the arch doesn't supply something else, assume that hugepage |
| 28 | 33 | * size aligned regions are ok without further preparation. |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | * We use a brcl 0,2 instruction for jump labels at compile time so it |
| 21 | 21 | * can be easily distinguished from a hotpatch generated instruction. |
| 22 | 22 | */ |
| 23 | −static inline bool arch_static_branch(struct static_key *key, bool branch) | |
| 23 | +static __always_inline bool arch_static_branch(struct static_key *key, bool branch) | |
| 24 | 24 | { |
| 25 | 25 | asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n" |
| 26 | 26 | ".pushsection __jump_table,\"aw\"\n" |
| @@ -34,7 +34,7 @@ label: · 7 unmodified lines | ||
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | −static inline bool arch_static_branch_jump(struct static_key *key, bool branch) | |
| 37 | +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) | |
| 38 | 38 | { |
| 39 | 39 | asm_volatile_goto("0: brcl 15,%l[label]\n" |
| 40 | 40 | ".pushsection __jump_table,\"aw\"\n" |
| @@ -997,9 +997,9 @@ static inline pte_t pte_mkhuge(pte_t pte) · 996 unmodified lines | ||
| 997 | 997 | #define IPTE_NODAT 0x400 |
| 998 | 998 | #define IPTE_GUEST_ASCE 0x800 |
| 999 | 999 | |
| 1000 | −static inline void __ptep_ipte(unsigned long address, pte_t *ptep, | |
| 1001 | − unsigned long opt, unsigned long asce, | |
| 1002 | − int local) | |
| 1000 | +static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep, | |
| 1001 | + unsigned long opt, unsigned long asce, | |
| 1002 | + int local) | |
| 1003 | 1003 | { |
| 1004 | 1004 | unsigned long pto = (unsigned long) ptep; |
| 1005 | 1005 | |
| @@ -1020,8 +1020,8 @@ static inline void __ptep_ipte(unsigned long address, pte_t *ptep, · 14 unmodified lines | ||
| 1020 | 1020 | : [r1] "a" (pto), [m4] "i" (local) : "memory"); |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | −static inline void __ptep_ipte_range(unsigned long address, int nr, | |
| 1024 | − pte_t *ptep, int local) | |
| 1023 | +static __always_inline void __ptep_ipte_range(unsigned long address, int nr, | |
| 1024 | + pte_t *ptep, int local) | |
| 1025 | 1025 | { |
| 1026 | 1026 | unsigned long pto = (unsigned long) ptep; |
| 1027 | 1027 | |
| @@ -1269,7 +1269,8 @@ static inline pte_t *pte_offset(pmd_t *pmd, unsigned long address) · 241 unmodified lines | ||
| 1269 | 1269 | |
| 1270 | 1270 | #define pte_offset_kernel(pmd, address) pte_offset(pmd, address) |
| 1271 | 1271 | #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) |
| 1272 | −#define pte_unmap(pte) do { } while (0) | |
| 1272 | + | |
| 1273 | +static inline void pte_unmap(pte_t *pte) { } | |
| 1273 | 1274 | |
| 1274 | 1275 | static inline bool gup_fast_permitted(unsigned long start, unsigned long end) |
| 1275 | 1276 | { |
| @@ -1435,9 +1436,9 @@ static inline void __pmdp_csp(pmd_t *pmdp) · 159 unmodified lines | ||
| 1435 | 1436 | #define IDTE_NODAT 0x1000 |
| 1436 | 1437 | #define IDTE_GUEST_ASCE 0x2000 |
| 1437 | 1438 | |
| 1438 | −static inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, | |
| 1439 | − unsigned long opt, unsigned long asce, | |
| 1440 | − int local) | |
| 1439 | +static __always_inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, | |
| 1440 | + unsigned long opt, unsigned long asce, | |
| 1441 | + int local) | |
| 1441 | 1442 | { |
| 1442 | 1443 | unsigned long sto; |
| 1443 | 1444 | |
| @@ -1461,9 +1462,9 @@ static inline void __pmdp_idte(unsigned long addr, pmd_t *pmdp, · 17 unmodified lines | ||
| 1461 | 1462 | } |
| 1462 | 1463 | } |
| 1463 | 1464 | |
| 1464 | −static inline void __pudp_idte(unsigned long addr, pud_t *pudp, | |
| 1465 | − unsigned long opt, unsigned long asce, | |
| 1466 | − int local) | |
| 1465 | +static __always_inline void __pudp_idte(unsigned long addr, pud_t *pudp, | |
| 1466 | + unsigned long opt, unsigned long asce, | |
| 1467 | + int local) | |
| 1467 | 1468 | { |
| 1468 | 1469 | unsigned long r3o; |
| 1469 | 1470 | |
| @@ -111,7 +111,7 @@ struct qib { · 110 unmodified lines | ||
| 111 | 111 | /* private: */ |
| 112 | 112 | u8 res[88]; |
| 113 | 113 | /* public: */ |
| 114 | − u8 parm[QDIO_MAX_BUFFERS_PER_Q]; | |
| 114 | + u8 parm[128]; | |
| 115 | 115 | } __attribute__ ((packed, aligned(256))); |
| 116 | 116 | |
| 117 | 117 | /** |
| @@ -390,7 +390,7 @@ static size_t cf_diag_getctrset(struct cf_ctrset_entry *ctrdata, int ctrset, · 389 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | debug_sprintf_event(cf_diag_dbg, 6, |
| 392 | 392 | "%s ctrset %d ctrset_size %zu cfvn %d csvn %d" |
| 393 | − " need %zd rc:%d\n", | |
| 393 | + " need %zd rc %d\n", | |
| 394 | 394 | __func__, ctrset, ctrset_size, cpuhw->info.cfvn, |
| 395 | 395 | cpuhw->info.csvn, need, rc); |
| 396 | 396 | return need; |
| @@ -567,7 +567,7 @@ static int cf_diag_add(struct perf_event *event, int flags) · 170 unmodified lines | ||
| 567 | 567 | int err = 0; |
| 568 | 568 | |
| 569 | 569 | debug_sprintf_event(cf_diag_dbg, 5, |
| 570 | − "%s event %p cpu %d flags %#x cpuhw:%p\n", | |
| 570 | + "%s event %p cpu %d flags %#x cpuhw %p\n", | |
| 571 | 571 | __func__, event, event->cpu, flags, cpuhw); |
| 572 | 572 | |
| 573 | 573 | if (cpuhw->flags & PMU_F_IN_USE) { |
| @@ -803,6 +803,12 @@ static int __hw_perf_event_init(struct perf_event *event) · 802 unmodified lines | ||
| 803 | 803 | goto out; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | + if (si.ribm & CPU_MF_SF_RIBM_NOTAV) { | |
| 807 | + pr_warn("CPU Measurement Facility sampling is temporarily not available\n"); | |
| 808 | + err = -EBUSY; | |
| 809 | + goto out; | |
| 810 | + } | |
| 811 | + | |
| 806 | 812 | /* Always enable basic sampling */ |
| 807 | 813 | SAMPL_FLAGS(hwc) = PERF_CPUM_SF_BASIC_MODE; |
| 808 | 814 | |
| @@ -895,7 +901,7 @@ static int cpumsf_pmu_event_init(struct perf_event *event) · 86 unmodified lines | ||
| 895 | 901 | |
| 896 | 902 | /* Check online status of the CPU to which the event is pinned */ |
| 897 | 903 | if (event->cpu >= 0 && !cpu_online(event->cpu)) |
| 898 | − return -ENODEV; | |
| 904 | + return -ENODEV; | |
| 899 | 905 | |
| 900 | 906 | /* Force reset of idle/hv excludes regardless of what the |
| 901 | 907 | * user requested. |
| @@ -332,7 +332,7 @@ static inline int plo_test_bit(unsigned char nr) · 331 unmodified lines | ||
| 332 | 332 | return cc == 0; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | −static inline void __insn32_query(unsigned int opcode, u8 query[32]) | |
| 335 | +static __always_inline void __insn32_query(unsigned int opcode, u8 *query) | |
| 336 | 336 | { |
| 337 | 337 | register unsigned long r0 asm("0") = 0; /* query function */ |
| 338 | 338 | register unsigned long r1 asm("1") = (unsigned long) query; |
| @@ -340,9 +340,9 @@ static inline void __insn32_query(unsigned int opcode, u8 query[32]) · 1 unmodified line | ||
| 340 | 340 | asm volatile( |
| 341 | 341 | /* Parameter regs are ignored */ |
| 342 | 342 | " .insn rrf,%[opc] << 16,2,4,6,0\n" |
| 343 | − : "=m" (*query) | |
| 343 | + : | |
| 344 | 344 | : "d" (r0), "a" (r1), [opc] "i" (opcode) |
| 345 | − : "cc"); | |
| 345 | + : "cc", "memory"); | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | #define INSN_SORTL 0xb938 |
| @@ -66,7 +66,7 @@ static inline int clp_get_ilp(unsigned long *ilp) · 65 unmodified lines | ||
| 66 | 66 | /* |
| 67 | 67 | * Call Logical Processor with c=0, the give constant lps and an lpcb request. |
| 68 | 68 | */ |
| 69 | −static inline int clp_req(void *data, unsigned int lps) | |
| 69 | +static __always_inline int clp_req(void *data, unsigned int lps) | |
| 70 | 70 | { |
| 71 | 71 | struct { u8 _[CLP_BLK_SIZE]; } *req = data; |
| 72 | 72 | u64 ignored; |
| @@ -219,13 +219,6 @@ enum { · 218 unmodified lines | ||
| 219 | 219 | PFERR_WRITE_MASK | \ |
| 220 | 220 | PFERR_PRESENT_MASK) |
| 221 | 221 | |
| 222 | −/* | |
| 223 | − * The mask used to denote special SPTEs, which can be either MMIO SPTEs or | |
| 224 | − * Access Tracking SPTEs. We use bit 62 instead of bit 63 to avoid conflicting | |
| 225 | − * with the SVE bit in EPT PTEs. | |
| 226 | − */ | |
| 227 | −#define SPTE_SPECIAL_MASK (1ULL << 62) | |
| 228 | − | |
| 229 | 222 | /* apic attention bits */ |
| 230 | 223 | #define KVM_APIC_CHECK_VAPIC 0 |
| 231 | 224 | /* |
| @@ -485,6 +485,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, · 484 unmodified lines | ||
| 485 | 485 | |
| 486 | 486 | /* cpuid 0x80000008.ebx */ |
| 487 | 487 | const u32 kvm_cpuid_8000_0008_ebx_x86_features = |
| 488 | + F(CLZERO) | F(XSAVEERPTR) | | |
| 488 | 489 | F(WBNOINVD) | F(AMD_IBPB) | F(AMD_IBRS) | F(AMD_SSBD) | F(VIRT_SSBD) | |
| 489 | 490 | F(AMD_SSB_NO) | F(AMD_STIBP) | F(AMD_STIBP_ALWAYS_ON); |
| 490 | 491 | |
| @@ -618,16 +619,20 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, · 127 unmodified lines | ||
| 618 | 619 | */ |
| 619 | 620 | case 0x1f: |
| 620 | 621 | case 0xb: { |
| 621 | − int i, level_type; | |
| 622 | + int i; | |
| 622 | 623 | |
| 623 | − /* read more entries until level_type is zero */ | |
| 624 | − for (i = 1; ; ++i) { | |
| 624 | + /* | |
| 625 | + * We filled in entry[0] for CPUID(EAX=<function>, | |
| 626 | + * ECX=00H) above. If its level type (ECX[15:8]) is | |
| 627 | + * zero, then the leaf is unimplemented, and we're | |
| 628 | + * done. Otherwise, continue to populate entries | |
| 629 | + * until the level type (ECX[15:8]) of the previously | |
| 630 | + * added entry is zero. | |
| 631 | + */ | |
| 632 | + for (i = 1; entry[i - 1].ecx & 0xff00; ++i) { | |
| 625 | 633 | if (*nent >= maxnent) |
| 626 | 634 | goto out; |
| 627 | 635 | |
| 628 | − level_type = entry[i - 1].ecx & 0xff00; | |
| 629 | − if (!level_type) | |
| 630 | − break; | |
| 631 | 636 | do_host_cpuid(&entry[i], function, i); |
| 632 | 637 | ++*nent; |
| 633 | 638 | } |
| @@ -969,53 +974,66 @@ struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu, · 335 unmodified lines | ||
| 969 | 974 | EXPORT_SYMBOL_GPL(kvm_find_cpuid_entry); |
| 970 | 975 | |
| 971 | 976 | /* |
| 972 | − * If no match is found, check whether we exceed the vCPU's limit | |
| 973 | − * and return the content of the highest valid _standard_ leaf instead. | |
| 974 | − * This is to satisfy the CPUID specification. | |
| 977 | + * If the basic or extended CPUID leaf requested is higher than the | |
| 978 | + * maximum supported basic or extended leaf, respectively, then it is | |
| 979 | + * out of range. | |
| 975 | 980 | */ |
| 976 | −static struct kvm_cpuid_entry2* check_cpuid_limit(struct kvm_vcpu *vcpu, | |
| 977 | − u32 function, u32 index) | |
| 981 | +static bool cpuid_function_in_range(struct kvm_vcpu *vcpu, u32 function) | |
| 978 | 982 | { |
| 979 | − struct kvm_cpuid_entry2 *maxlevel; | |
| 980 | − | |
| 981 | − maxlevel = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0); | |
| 982 | − if (!maxlevel || maxlevel->eax >= function) | |
| 983 | − return NULL; | |
| 984 | − if (function & 0x80000000) { | |
| 985 | − maxlevel = kvm_find_cpuid_entry(vcpu, 0, 0); | |
| 986 | − if (!maxlevel) | |
| 987 | − return NULL; | |
| 988 | − } | |
| 989 | − return kvm_find_cpuid_entry(vcpu, maxlevel->eax, index); | |
| 983 | + struct kvm_cpuid_entry2 *max; | |
| 984 | + | |
| 985 | + max = kvm_find_cpuid_entry(vcpu, function & 0x80000000, 0); | |
| 986 | + return max && function <= max->eax; | |
| 990 | 987 | } |
| 991 | 988 | |
| 992 | 989 | bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, |
| 993 | 990 | u32 *ecx, u32 *edx, bool check_limit) |
| 994 | 991 | { |
| 995 | 992 | u32 function = *eax, index = *ecx; |
| 996 | − struct kvm_cpuid_entry2 *best; | |
| 997 | − bool entry_found = true; | |
| 998 | − | |
| 999 | − best = kvm_find_cpuid_entry(vcpu, function, index); | |
| 1000 | − | |
| 1001 | − if (!best) { | |
| 1002 | − entry_found = false; | |
| 1003 | − if (!check_limit) | |
| 1004 | − goto out; | |
| 993 | + struct kvm_cpuid_entry2 *entry; | |
| 994 | + struct kvm_cpuid_entry2 *max; | |
| 995 | + bool found; | |
| 1005 | 996 | |
| 1006 | − best = check_cpuid_limit(vcpu, function, index); | |
| 997 | + entry = kvm_find_cpuid_entry(vcpu, function, index); | |
| 998 | + found = entry; | |
| 999 | + /* | |
| 1000 | + * Intel CPUID semantics treats any query for an out-of-range | |
| 1001 | + * leaf as if the highest basic leaf (i.e. CPUID.0H:EAX) were | |
| 1002 | + * requested. AMD CPUID semantics returns all zeroes for any | |
| 1003 | + * undefined leaf, whether or not the leaf is in range. | |
| 1004 | + */ | |
| 1005 | + if (!entry && check_limit && !guest_cpuid_is_amd(vcpu) && | |
| 1006 | + !cpuid_function_in_range(vcpu, function)) { | |
| 1007 | + max = kvm_find_cpuid_entry(vcpu, 0, 0); | |
| 1008 | + if (max) { | |
| 1009 | + function = max->eax; | |
| 1010 | + entry = kvm_find_cpuid_entry(vcpu, function, index); | |
| 1011 | + } | |
| 1007 | 1012 | } |
| 1008 | − | |
| 1009 | −out: | |
| 1010 | − if (best) { | |
| 1011 | − *eax = best->eax; | |
| 1012 | − *ebx = best->ebx; | |
| 1013 | − *ecx = best->ecx; | |
| 1014 | − *edx = best->edx; | |
| 1015 | − } else | |
| 1013 | + if (entry) { | |
| 1014 | + *eax = entry->eax; | |
| 1015 | + *ebx = entry->ebx; | |
| 1016 | + *ecx = entry->ecx; | |
| 1017 | + *edx = entry->edx; | |
| 1018 | + } else { | |
| 1016 | 1019 | *eax = *ebx = *ecx = *edx = 0; |
| 1017 | − trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, entry_found); | |
| 1018 | − return entry_found; | |
| 1020 | + /* | |
| 1021 | + * When leaf 0BH or 1FH is defined, CL is pass-through | |
| 1022 | + * and EDX is always the x2APIC ID, even for undefined | |
| 1023 | + * subleaves. Index 1 will exist iff the leaf is | |
| 1024 | + * implemented, so we pass through CL iff leaf 1 | |
| 1025 | + * exists. EDX can be copied from any existing index. | |
| 1026 | + */ | |
| 1027 | + if (function == 0xb || function == 0x1f) { | |
| 1028 | + entry = kvm_find_cpuid_entry(vcpu, function, 1); | |
| 1029 | + if (entry) { | |
| 1030 | + *ecx = index & 0xff; | |
| 1031 | + *edx = entry->edx; | |
| 1032 | + } | |
| 1033 | + } | |
| 1034 | + } | |
| 1035 | + trace_kvm_cpuid(function, *eax, *ebx, *ecx, *edx, found); | |
| 1036 | + return found; | |
| 1019 | 1037 | } |
| 1020 | 1038 | EXPORT_SYMBOL_GPL(kvm_cpuid); |
| 1021 | 1039 | |
| @@ -66,9 +66,10 @@ · 65 unmodified lines | ||
| 66 | 66 | #define X2APIC_BROADCAST 0xFFFFFFFFul |
| 67 | 67 | |
| 68 | 68 | static bool lapic_timer_advance_dynamic __read_mostly; |
| 69 | −#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 | |
| 70 | −#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 5000 | |
| 71 | −#define LAPIC_TIMER_ADVANCE_ADJUST_INIT 1000 | |
| 69 | +#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 /* clock cycles */ | |
| 70 | +#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000 /* clock cycles */ | |
| 71 | +#define LAPIC_TIMER_ADVANCE_NS_INIT 1000 | |
| 72 | +#define LAPIC_TIMER_ADVANCE_NS_MAX 5000 | |
| 72 | 73 | /* step-by-step approximation to mitigate fluctuation */ |
| 73 | 74 | #define LAPIC_TIMER_ADVANCE_ADJUST_STEP 8 |
| 74 | 75 | |
| @@ -1504,8 +1505,8 @@ static inline void adjust_lapic_timer_advance(struct kvm_vcpu *vcpu, · 1429 unmodified lines | ||
| 1504 | 1505 | timer_advance_ns += ns/LAPIC_TIMER_ADVANCE_ADJUST_STEP; |
| 1505 | 1506 | } |
| 1506 | 1507 | |
| 1507 | − if (unlikely(timer_advance_ns > LAPIC_TIMER_ADVANCE_ADJUST_MAX)) | |
| 1508 | − timer_advance_ns = LAPIC_TIMER_ADVANCE_ADJUST_INIT; | |
| 1508 | + if (unlikely(timer_advance_ns > LAPIC_TIMER_ADVANCE_NS_MAX)) | |
| 1509 | + timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT; | |
| 1509 | 1510 | apic->lapic_timer.timer_advance_ns = timer_advance_ns; |
| 1510 | 1511 | } |
| 1511 | 1512 | |
| @@ -2302,7 +2303,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns) · 790 unmodified lines | ||
| 2302 | 2303 | HRTIMER_MODE_ABS_HARD); |
| 2303 | 2304 | apic->lapic_timer.timer.function = apic_timer_fn; |
| 2304 | 2305 | if (timer_advance_ns == -1) { |
| 2305 | − apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_ADJUST_INIT; | |
| 2306 | + apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT; | |
| 2306 | 2307 | lapic_timer_advance_dynamic = true; |
| 2307 | 2308 | } else { |
| 2308 | 2309 | apic->lapic_timer.timer_advance_ns = timer_advance_ns; |
| @@ -83,7 +83,17 @@ module_param(dbg, bool, 0644); · 82 unmodified lines | ||
| 83 | 83 | #define PTE_PREFETCH_NUM 8 |
| 84 | 84 | |
| 85 | 85 | #define PT_FIRST_AVAIL_BITS_SHIFT 10 |
| 86 | −#define PT64_SECOND_AVAIL_BITS_SHIFT 52 | |
| 86 | +#define PT64_SECOND_AVAIL_BITS_SHIFT 54 | |
| 87 | + | |
| 88 | +/* | |
| 89 | + * The mask used to denote special SPTEs, which can be either MMIO SPTEs or | |
| 90 | + * Access Tracking SPTEs. | |
| 91 | + */ | |
| 92 | +#define SPTE_SPECIAL_MASK (3ULL << 52) | |
| 93 | +#define SPTE_AD_ENABLED_MASK (0ULL << 52) | |
| 94 | +#define SPTE_AD_DISABLED_MASK (1ULL << 52) | |
| 95 | +#define SPTE_AD_WRPROT_ONLY_MASK (2ULL << 52) | |
| 96 | +#define SPTE_MMIO_MASK (3ULL << 52) | |
| 87 | 97 | |
| 88 | 98 | #define PT64_LEVEL_BITS 9 |
| 89 | 99 | |
| @@ -219,12 +229,11 @@ static u64 __read_mostly shadow_present_mask; · 129 unmodified lines | ||
| 219 | 229 | static u64 __read_mostly shadow_me_mask; |
| 220 | 230 | |
| 221 | 231 | /* |
| 222 | − * SPTEs used by MMUs without A/D bits are marked with shadow_acc_track_value. | |
| 223 | − * Non-present SPTEs with shadow_acc_track_value set are in place for access | |
| 224 | − * tracking. | |
| 232 | + * SPTEs used by MMUs without A/D bits are marked with SPTE_AD_DISABLED_MASK; | |
| 233 | + * shadow_acc_track_mask is the set of bits to be cleared in non-accessed | |
| 234 | + * pages. | |
| 225 | 235 | */ |
| 226 | 236 | static u64 __read_mostly shadow_acc_track_mask; |
| 227 | −static const u64 shadow_acc_track_value = SPTE_SPECIAL_MASK; | |
| 228 | 237 | |
| 229 | 238 | /* |
| 230 | 239 | * The mask/shift to use for saving the original R/X bits when marking the PTE |
| @@ -304,7 +313,7 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask, u64 mmio_value, u64 access_mask) · 73 unmodified lines | ||
| 304 | 313 | { |
| 305 | 314 | BUG_ON((u64)(unsigned)access_mask != access_mask); |
| 306 | 315 | BUG_ON((mmio_mask & mmio_value) != mmio_value); |
| 307 | − shadow_mmio_value = mmio_value | SPTE_SPECIAL_MASK; | |
| 316 | + shadow_mmio_value = mmio_value | SPTE_MMIO_MASK; | |
| 308 | 317 | shadow_mmio_mask = mmio_mask | SPTE_SPECIAL_MASK; |
| 309 | 318 | shadow_mmio_access_mask = access_mask; |
| 310 | 319 | } |
| @@ -320,10 +329,27 @@ static inline bool sp_ad_disabled(struct kvm_mmu_page *sp) · 9 unmodified lines | ||
| 320 | 329 | return sp->role.ad_disabled; |
| 321 | 330 | } |
| 322 | 331 | |
| 332 | +static inline bool kvm_vcpu_ad_need_write_protect(struct kvm_vcpu *vcpu) | |
| 333 | +{ | |
| 334 | + /* | |
| 335 | + * When using the EPT page-modification log, the GPAs in the log | |
| 336 | + * would come from L2 rather than L1. Therefore, we need to rely | |
| 337 | + * on write protection to record dirty pages. This also bypasses | |
| 338 | + * PML, since writes now result in a vmexit. | |
| 339 | + */ | |
| 340 | + return vcpu->arch.mmu == &vcpu->arch.guest_mmu; | |
| 341 | +} | |
| 342 | + | |
| 323 | 343 | static inline bool spte_ad_enabled(u64 spte) |
| 324 | 344 | { |
| 325 | 345 | MMU_WARN_ON(is_mmio_spte(spte)); |
| 326 | − return !(spte & shadow_acc_track_value); | |
| 346 | + return (spte & SPTE_SPECIAL_MASK) != SPTE_AD_DISABLED_MASK; | |
| 347 | +} | |
| 348 | + | |
| 349 | +static inline bool spte_ad_need_write_protect(u64 spte) | |
| 350 | +{ | |
| 351 | + MMU_WARN_ON(is_mmio_spte(spte)); | |
| 352 | + return (spte & SPTE_SPECIAL_MASK) != SPTE_AD_ENABLED_MASK; | |
| 327 | 353 | } |
| 328 | 354 | |
| 329 | 355 | static inline u64 spte_shadow_accessed_mask(u64 spte) |
| @@ -461,7 +487,7 @@ void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, · 131 unmodified lines | ||
| 461 | 487 | { |
| 462 | 488 | BUG_ON(!dirty_mask != !accessed_mask); |
| 463 | 489 | BUG_ON(!accessed_mask && !acc_track_mask); |
| 464 | − BUG_ON(acc_track_mask & shadow_acc_track_value); | |
| 490 | + BUG_ON(acc_track_mask & SPTE_SPECIAL_MASK); | |
| 465 | 491 | |
| 466 | 492 | shadow_user_mask = user_mask; |
| 467 | 493 | shadow_accessed_mask = accessed_mask; |
| @@ -1589,16 +1615,16 @@ static bool spte_clear_dirty(u64 *sptep) · 1121 unmodified lines | ||
| 1589 | 1615 | |
| 1590 | 1616 | rmap_printk("rmap_clear_dirty: spte %p %llx\n", sptep, *sptep); |
| 1591 | 1617 | |
| 1618 | + MMU_WARN_ON(!spte_ad_enabled(spte)); | |
| 1592 | 1619 | spte &= ~shadow_dirty_mask; |
| 1593 | − | |
| 1594 | 1620 | return mmu_spte_update(sptep, spte); |
| 1595 | 1621 | } |
| 1596 | 1622 | |
| 1597 | −static bool wrprot_ad_disabled_spte(u64 *sptep) | |
| 1623 | +static bool spte_wrprot_for_clear_dirty(u64 *sptep) | |
| 1598 | 1624 | { |
| 1599 | 1625 | bool was_writable = test_and_clear_bit(PT_WRITABLE_SHIFT, |
| 1600 | 1626 | (unsigned long *)sptep); |
| 1601 | − if (was_writable) | |
| 1627 | + if (was_writable && !spte_ad_enabled(*sptep)) | |
| 1602 | 1628 | kvm_set_pfn_dirty(spte_to_pfn(*sptep)); |
| 1603 | 1629 | |
| 1604 | 1630 | return was_writable; |
| @@ -1617,10 +1643,10 @@ static bool __rmap_clear_dirty(struct kvm *kvm, struct kvm_rmap_head *rmap_head) · 12 unmodified lines | ||
| 1617 | 1643 | bool flush = false; |
| 1618 | 1644 | |
| 1619 | 1645 | for_each_rmap_spte(rmap_head, &iter, sptep) |
| 1620 | − if (spte_ad_enabled(*sptep)) | |
| 1621 | − flush |= spte_clear_dirty(sptep); | |
| 1646 | + if (spte_ad_need_write_protect(*sptep)) | |
| 1647 | + flush |= spte_wrprot_for_clear_dirty(sptep); | |
| 1622 | 1648 | else |
| 1623 | − flush |= wrprot_ad_disabled_spte(sptep); | |
| 1649 | + flush |= spte_clear_dirty(sptep); | |
| 1624 | 1650 | |
| 1625 | 1651 | return flush; |
| 1626 | 1652 | } |
| @@ -1631,6 +1657,11 @@ static bool spte_set_dirty(u64 *sptep) · 4 unmodified lines | ||
| 1631 | 1657 | |
| 1632 | 1658 | rmap_printk("rmap_set_dirty: spte %p %llx\n", sptep, *sptep); |
| 1633 | 1659 | |
| 1660 | + /* | |
| 1661 | + * Similar to the !kvm_x86_ops->slot_disable_log_dirty case, | |
| 1662 | + * do not bother adding back write access to pages marked | |
| 1663 | + * SPTE_AD_WRPROT_ONLY_MASK. | |
| 1664 | + */ | |
| 1634 | 1665 | spte |= shadow_dirty_mask; |
| 1635 | 1666 | |
| 1636 | 1667 | return mmu_spte_update(sptep, spte); |
| @@ -2622,7 +2653,7 @@ static void link_shadow_page(struct kvm_vcpu *vcpu, u64 *sptep, · 985 unmodified lines | ||
| 2622 | 2653 | shadow_user_mask | shadow_x_mask | shadow_me_mask; |
| 2623 | 2654 | |
| 2624 | 2655 | if (sp_ad_disabled(sp)) |
| 2625 | − spte |= shadow_acc_track_value; | |
| 2656 | + spte |= SPTE_AD_DISABLED_MASK; | |
| 2626 | 2657 | else |
| 2627 | 2658 | spte |= shadow_accessed_mask; |
| 2628 | 2659 | |
| @@ -2968,7 +2999,9 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, · 339 unmodified lines | ||
| 2968 | 2999 | |
| 2969 | 3000 | sp = page_header(__pa(sptep)); |
| 2970 | 3001 | if (sp_ad_disabled(sp)) |
| 2971 | − spte |= shadow_acc_track_value; | |
| 3002 | + spte |= SPTE_AD_DISABLED_MASK; | |
| 3003 | + else if (kvm_vcpu_ad_need_write_protect(vcpu)) | |
| 3004 | + spte |= SPTE_AD_WRPROT_ONLY_MASK; | |
| 2972 | 3005 | |
| 2973 | 3006 | /* |
| 2974 | 3007 | * For the EPT case, shadow_present_mask is 0 if hardware |
| @@ -2610,7 +2610,7 @@ static int nested_check_vm_entry_controls(struct kvm_vcpu *vcpu, · 2609 unmodified lines | ||
| 2610 | 2610 | |
| 2611 | 2611 | /* VM-entry exception error code */ |
| 2612 | 2612 | if (CC(has_error_code && |
| 2613 | − vmcs12->vm_entry_exception_error_code & GENMASK(31, 15))) | |
| 2613 | + vmcs12->vm_entry_exception_error_code & GENMASK(31, 16))) | |
| 2614 | 2614 | return -EINVAL; |
| 2615 | 2615 | |
| 2616 | 2616 | /* VM-entry interruption-info field: reserved bits */ |
| @@ -262,6 +262,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 261 unmodified lines | ||
| 262 | 262 | static void intel_pmu_refresh(struct kvm_vcpu *vcpu) |
| 263 | 263 | { |
| 264 | 264 | struct kvm_pmu *pmu = vcpu_to_pmu(vcpu); |
| 265 | + struct x86_pmu_capability x86_pmu; | |
| 265 | 266 | struct kvm_cpuid_entry2 *entry; |
| 266 | 267 | union cpuid10_eax eax; |
| 267 | 268 | union cpuid10_edx edx; |
| @@ -283,8 +284,10 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) · 15 unmodified lines | ||
| 283 | 284 | if (!pmu->version) |
| 284 | 285 | return; |
| 285 | 286 | |
| 287 | + perf_get_x86_pmu_capability(&x86_pmu); | |
| 288 | + | |
| 286 | 289 | pmu->nr_arch_gp_counters = min_t(int, eax.split.num_counters, |
| 287 | − INTEL_PMC_MAX_GENERIC); | |
| 290 | + x86_pmu.num_counters_gp); | |
| 288 | 291 | pmu->counter_bitmask[KVM_PMC_GP] = ((u64)1 << eax.split.bit_width) - 1; |
| 289 | 292 | pmu->available_event_types = ~entry->ebx & |
| 290 | 293 | ((1ull << eax.split.mask_length) - 1); |
| @@ -294,7 +297,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) · 3 unmodified lines | ||
| 294 | 297 | } else { |
| 295 | 298 | pmu->nr_arch_fixed_counters = |
| 296 | 299 | min_t(int, edx.split.num_counters_fixed, |
| 297 | − INTEL_PMC_MAX_FIXED); | |
| 300 | + x86_pmu.num_counters_fixed); | |
| 298 | 301 | pmu->counter_bitmask[KVM_PMC_FIXED] = |
| 299 | 302 | ((u64)1 << edx.split.bit_width_fixed) - 1; |
| 300 | 303 | } |
| @@ -209,6 +209,11 @@ static int vmx_setup_l1d_flush(enum vmx_l1d_flush_state l1tf) · 208 unmodified lines | ||
| 209 | 209 | struct page *page; |
| 210 | 210 | unsigned int i; |
| 211 | 211 | |
| 212 | + if (!boot_cpu_has_bug(X86_BUG_L1TF)) { | |
| 213 | + l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NOT_REQUIRED; | |
| 214 | + return 0; | |
| 215 | + } | |
| 216 | + | |
| 212 | 217 | if (!enable_ept) { |
| 213 | 218 | l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_EPT_DISABLED; |
| 214 | 219 | return 0; |
| @@ -7995,12 +8000,10 @@ static int __init vmx_init(void) · 7780 unmodified lines | ||
| 7995 | 8000 | * contain 'auto' which will be turned into the default 'cond' |
| 7996 | 8001 | * mitigation mode. |
| 7997 | 8002 | */ |
| 7998 | − if (boot_cpu_has(X86_BUG_L1TF)) { | |
| 7999 | − r = vmx_setup_l1d_flush(vmentry_l1d_flush_param); | |
| 8000 | − if (r) { | |
| 8001 | − vmx_exit(); | |
| 8002 | − return r; | |
| 8003 | − } | |
| 8003 | + r = vmx_setup_l1d_flush(vmentry_l1d_flush_param); | |
| 8004 | + if (r) { | |
| 8005 | + vmx_exit(); | |
| 8006 | + return r; | |
| 8004 | 8007 | } |
| 8005 | 8008 | |
| 8006 | 8009 | #ifdef CONFIG_KEXEC_CORE |
| @@ -92,8 +92,8 @@ u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE | EFER_LME | EFER_LMA)); · 91 unmodified lines | ||
| 92 | 92 | static u64 __read_mostly efer_reserved_bits = ~((u64)EFER_SCE); |
| 93 | 93 | #endif |
| 94 | 94 | |
| 95 | −#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM | |
| 96 | −#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU | |
| 95 | +#define VM_STAT(x, ...) offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__ | |
| 96 | +#define VCPU_STAT(x, ...) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__ | |
| 97 | 97 | |
| 98 | 98 | #define KVM_X2APIC_API_VALID_FLAGS (KVM_X2APIC_API_USE_32BIT_IDS | \ |
| 99 | 99 | KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK) |
| @@ -212,7 +212,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 112 unmodified lines | ||
| 212 | 212 | { "mmu_cache_miss", VM_STAT(mmu_cache_miss) }, |
| 213 | 213 | { "mmu_unsync", VM_STAT(mmu_unsync) }, |
| 214 | 214 | { "remote_tlb_flush", VM_STAT(remote_tlb_flush) }, |
| 215 | − { "largepages", VM_STAT(lpages) }, | |
| 215 | + { "largepages", VM_STAT(lpages, .mode = 0444) }, | |
| 216 | 216 | { "max_mmu_page_hash_collisions", |
| 217 | 217 | VM_STAT(max_mmu_page_hash_collisions) }, |
| 218 | 218 | { NULL } |
| @@ -885,34 +885,42 @@ int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) · 666 unmodified lines | ||
| 885 | 885 | } |
| 886 | 886 | EXPORT_SYMBOL_GPL(kvm_set_xcr); |
| 887 | 887 | |
| 888 | −int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |
| 888 | +static int kvm_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |
| 889 | 889 | { |
| 890 | − unsigned long old_cr4 = kvm_read_cr4(vcpu); | |
| 891 | − unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | | |
| 892 | − X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE; | |
| 893 | − | |
| 894 | 890 | if (cr4 & CR4_RESERVED_BITS) |
| 895 | − return 1; | |
| 891 | + return -EINVAL; | |
| 896 | 892 | |
| 897 | 893 | if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) && (cr4 & X86_CR4_OSXSAVE)) |
| 898 | − return 1; | |
| 894 | + return -EINVAL; | |
| 899 | 895 | |
| 900 | 896 | if (!guest_cpuid_has(vcpu, X86_FEATURE_SMEP) && (cr4 & X86_CR4_SMEP)) |
| 901 | − return 1; | |
| 897 | + return -EINVAL; | |
| 902 | 898 | |
| 903 | 899 | if (!guest_cpuid_has(vcpu, X86_FEATURE_SMAP) && (cr4 & X86_CR4_SMAP)) |
| 904 | − return 1; | |
| 900 | + return -EINVAL; | |
| 905 | 901 | |
| 906 | 902 | if (!guest_cpuid_has(vcpu, X86_FEATURE_FSGSBASE) && (cr4 & X86_CR4_FSGSBASE)) |
| 907 | − return 1; | |
| 903 | + return -EINVAL; | |
| 908 | 904 | |
| 909 | 905 | if (!guest_cpuid_has(vcpu, X86_FEATURE_PKU) && (cr4 & X86_CR4_PKE)) |
| 910 | − return 1; | |
| 906 | + return -EINVAL; | |
| 911 | 907 | |
| 912 | 908 | if (!guest_cpuid_has(vcpu, X86_FEATURE_LA57) && (cr4 & X86_CR4_LA57)) |
| 913 | − return 1; | |
| 909 | + return -EINVAL; | |
| 914 | 910 | |
| 915 | 911 | if (!guest_cpuid_has(vcpu, X86_FEATURE_UMIP) && (cr4 & X86_CR4_UMIP)) |
| 912 | + return -EINVAL; | |
| 913 | + | |
| 914 | + return 0; | |
| 915 | +} | |
| 916 | + | |
| 917 | +int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |
| 918 | +{ | |
| 919 | + unsigned long old_cr4 = kvm_read_cr4(vcpu); | |
| 920 | + unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | | |
| 921 | + X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE; | |
| 922 | + | |
| 923 | + if (kvm_valid_cr4(vcpu, cr4)) | |
| 916 | 924 | return 1; |
| 917 | 925 | |
| 918 | 926 | if (is_long_mode(vcpu)) { |
| @@ -1161,13 +1169,6 @@ static u32 msrs_to_save[] = { · 242 unmodified lines | ||
| 1161 | 1169 | MSR_ARCH_PERFMON_PERFCTR0 + 12, MSR_ARCH_PERFMON_PERFCTR0 + 13, |
| 1162 | 1170 | MSR_ARCH_PERFMON_PERFCTR0 + 14, MSR_ARCH_PERFMON_PERFCTR0 + 15, |
| 1163 | 1171 | MSR_ARCH_PERFMON_PERFCTR0 + 16, MSR_ARCH_PERFMON_PERFCTR0 + 17, |
| 1164 | − MSR_ARCH_PERFMON_PERFCTR0 + 18, MSR_ARCH_PERFMON_PERFCTR0 + 19, | |
| 1165 | − MSR_ARCH_PERFMON_PERFCTR0 + 20, MSR_ARCH_PERFMON_PERFCTR0 + 21, | |
| 1166 | − MSR_ARCH_PERFMON_PERFCTR0 + 22, MSR_ARCH_PERFMON_PERFCTR0 + 23, | |
| 1167 | − MSR_ARCH_PERFMON_PERFCTR0 + 24, MSR_ARCH_PERFMON_PERFCTR0 + 25, | |
| 1168 | − MSR_ARCH_PERFMON_PERFCTR0 + 26, MSR_ARCH_PERFMON_PERFCTR0 + 27, | |
| 1169 | − MSR_ARCH_PERFMON_PERFCTR0 + 28, MSR_ARCH_PERFMON_PERFCTR0 + 29, | |
| 1170 | − MSR_ARCH_PERFMON_PERFCTR0 + 30, MSR_ARCH_PERFMON_PERFCTR0 + 31, | |
| 1171 | 1172 | MSR_ARCH_PERFMON_EVENTSEL0, MSR_ARCH_PERFMON_EVENTSEL1, |
| 1172 | 1173 | MSR_ARCH_PERFMON_EVENTSEL0 + 2, MSR_ARCH_PERFMON_EVENTSEL0 + 3, |
| 1173 | 1174 | MSR_ARCH_PERFMON_EVENTSEL0 + 4, MSR_ARCH_PERFMON_EVENTSEL0 + 5, |
| @@ -1177,13 +1178,6 @@ static u32 msrs_to_save[] = { · 3 unmodified lines | ||
| 1177 | 1178 | MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13, |
| 1178 | 1179 | MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15, |
| 1179 | 1180 | MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17, |
| 1180 | − MSR_ARCH_PERFMON_EVENTSEL0 + 18, MSR_ARCH_PERFMON_EVENTSEL0 + 19, | |
| 1181 | − MSR_ARCH_PERFMON_EVENTSEL0 + 20, MSR_ARCH_PERFMON_EVENTSEL0 + 21, | |
| 1182 | − MSR_ARCH_PERFMON_EVENTSEL0 + 22, MSR_ARCH_PERFMON_EVENTSEL0 + 23, | |
| 1183 | − MSR_ARCH_PERFMON_EVENTSEL0 + 24, MSR_ARCH_PERFMON_EVENTSEL0 + 25, | |
| 1184 | − MSR_ARCH_PERFMON_EVENTSEL0 + 26, MSR_ARCH_PERFMON_EVENTSEL0 + 27, | |
| 1185 | − MSR_ARCH_PERFMON_EVENTSEL0 + 28, MSR_ARCH_PERFMON_EVENTSEL0 + 29, | |
| 1186 | − MSR_ARCH_PERFMON_EVENTSEL0 + 30, MSR_ARCH_PERFMON_EVENTSEL0 + 31, | |
| 1187 | 1181 | }; |
| 1188 | 1182 | |
| 1189 | 1183 | static unsigned num_msrs_to_save; |
| @@ -5097,13 +5091,14 @@ out: · 3907 unmodified lines | ||
| 5097 | 5091 | |
| 5098 | 5092 | static void kvm_init_msr_list(void) |
| 5099 | 5093 | { |
| 5094 | + struct x86_pmu_capability x86_pmu; | |
| 5100 | 5095 | u32 dummy[2]; |
| 5101 | 5096 | unsigned i, j; |
| 5102 | 5097 | |
| 5103 | 5098 | BUILD_BUG_ON_MSG(INTEL_PMC_MAX_FIXED != 4, |
| 5104 | 5099 | "Please update the fixed PMCs in msrs_to_save[]"); |
| 5105 | − BUILD_BUG_ON_MSG(INTEL_PMC_MAX_GENERIC != 32, | |
| 5106 | − "Please update the generic perfctr/eventsel MSRs in msrs_to_save[]"); | |
| 5100 | + | |
| 5101 | + perf_get_x86_pmu_capability(&x86_pmu); | |
| 5107 | 5102 | |
| 5108 | 5103 | for (i = j = 0; i < ARRAY_SIZE(msrs_to_save); i++) { |
| 5109 | 5104 | if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0) |
| @@ -5145,6 +5140,15 @@ static void kvm_init_msr_list(void) · 35 unmodified lines | ||
| 5145 | 5140 | intel_pt_validate_hw_cap(PT_CAP_num_address_ranges) * 2) |
| 5146 | 5141 | continue; |
| 5147 | 5142 | break; |
| 5143 | + case MSR_ARCH_PERFMON_PERFCTR0 ... MSR_ARCH_PERFMON_PERFCTR0 + 17: | |
| 5144 | + if (msrs_to_save[i] - MSR_ARCH_PERFMON_PERFCTR0 >= | |
| 5145 | + min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp)) | |
| 5146 | + continue; | |
| 5147 | + break; | |
| 5148 | + case MSR_ARCH_PERFMON_EVENTSEL0 ... MSR_ARCH_PERFMON_EVENTSEL0 + 17: | |
| 5149 | + if (msrs_to_save[i] - MSR_ARCH_PERFMON_EVENTSEL0 >= | |
| 5150 | + min(INTEL_PMC_MAX_GENERIC, x86_pmu.num_counters_gp)) | |
| 5151 | + continue; | |
| 5148 | 5152 | } |
| 5149 | 5153 | default: |
| 5150 | 5154 | break; |
| @@ -8714,10 +8718,6 @@ EXPORT_SYMBOL_GPL(kvm_task_switch); · 3563 unmodified lines | ||
| 8714 | 8718 | |
| 8715 | 8719 | static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) |
| 8716 | 8720 | { |
| 8717 | − if (!guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) && | |
| 8718 | − (sregs->cr4 & X86_CR4_OSXSAVE)) | |
| 8719 | − return -EINVAL; | |
| 8720 | − | |
| 8721 | 8721 | if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) { |
| 8722 | 8722 | /* |
| 8723 | 8723 | * When EFER.LME and CR0.PG are set, the processor is in |
| @@ -8736,7 +8736,7 @@ static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) · 12 unmodified lines | ||
| 8736 | 8736 | return -EINVAL; |
| 8737 | 8737 | } |
| 8738 | 8738 | |
| 8739 | − return 0; | |
| 8739 | + return kvm_valid_cr4(vcpu, sregs->cr4); | |
| 8740 | 8740 | } |
| 8741 | 8741 | |
| 8742 | 8742 | static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) |
| @@ -57,19 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void) · 56 unmodified lines | ||
| 57 | 57 | return NULL; |
| 58 | 58 | |
| 59 | 59 | /* Here we know that Xen runs on EFI platform. */ |
| 60 | − | |
| 61 | − efi.get_time = xen_efi_get_time; | |
| 62 | − efi.set_time = xen_efi_set_time; | |
| 63 | − efi.get_wakeup_time = xen_efi_get_wakeup_time; | |
| 64 | − efi.set_wakeup_time = xen_efi_set_wakeup_time; | |
| 65 | − efi.get_variable = xen_efi_get_variable; | |
| 66 | − efi.get_next_variable = xen_efi_get_next_variable; | |
| 67 | − efi.set_variable = xen_efi_set_variable; | |
| 68 | − efi.query_variable_info = xen_efi_query_variable_info; | |
| 69 | − efi.update_capsule = xen_efi_update_capsule; | |
| 70 | − efi.query_capsule_caps = xen_efi_query_capsule_caps; | |
| 71 | − efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; | |
| 72 | − efi.reset_system = xen_efi_reset_system; | |
| 60 | + xen_efi_runtime_setup(); | |
| 73 | 61 | |
| 74 | 62 | efi_systab_xen.tables = info->cfg.addr; |
| 75 | 63 | efi_systab_xen.nr_tables = info->cfg.nent; |
| @@ -1992,10 +1992,14 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1991 unmodified lines | ||
| 1992 | 1992 | /* bypass scheduler for flush rq */ |
| 1993 | 1993 | blk_insert_flush(rq); |
| 1994 | 1994 | blk_mq_run_hw_queue(data.hctx, true); |
| 1995 | − } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs)) { | |
| 1995 | + } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs || | |
| 1996 | + !blk_queue_nonrot(q))) { | |
| 1996 | 1997 | /* |
| 1997 | 1998 | * Use plugging if we have a ->commit_rqs() hook as well, as |
| 1998 | 1999 | * we know the driver uses bd->last in a smart fashion. |
| 2000 | + * | |
| 2001 | + * Use normal plugging if this disk is slow HDD, as sequential | |
| 2002 | + * IO may benefit a lot from plug merging. | |
| 1999 | 2003 | */ |
| 2000 | 2004 | unsigned int request_count = plug->rq_count; |
| 2001 | 2005 | struct request *last = NULL; |
| @@ -2012,6 +2016,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 10 unmodified lines | ||
| 2012 | 2016 | } |
| 2013 | 2017 | |
| 2014 | 2018 | blk_add_rq_to_plug(plug, rq); |
| 2019 | + } else if (q->elevator) { | |
| 2020 | + blk_mq_sched_insert_request(rq, false, true, true); | |
| 2015 | 2021 | } else if (plug && !blk_queue_nomerges(q)) { |
| 2016 | 2022 | /* |
| 2017 | 2023 | * We do limited plugging. If the bio can be merged, do that. |
| @@ -2035,8 +2041,8 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 17 unmodified lines | ||
| 2035 | 2041 | blk_mq_try_issue_directly(data.hctx, same_queue_rq, |
| 2036 | 2042 | &cookie); |
| 2037 | 2043 | } |
| 2038 | − } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator && | |
| 2039 | − !data.hctx->dispatch_busy)) { | |
| 2044 | + } else if ((q->nr_hw_queues > 1 && is_sync) || | |
| 2045 | + !data.hctx->dispatch_busy) { | |
| 2040 | 2046 | blk_mq_try_issue_directly(data.hctx, rq, &cookie); |
| 2041 | 2047 | } else { |
| 2042 | 2048 | blk_mq_sched_insert_request(rq, false, true, true); |
| @@ -129,7 +129,7 @@ static const u8 opaluid[][OPAL_UID_LENGTH] = { · 128 unmodified lines | ||
| 129 | 129 | { 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x84, 0x01 }, |
| 130 | 130 | |
| 131 | 131 | /* tables */ |
| 132 | − [OPAL_TABLE_TABLE] | |
| 132 | + [OPAL_TABLE_TABLE] = | |
| 133 | 133 | { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01 }, |
| 134 | 134 | [OPAL_LOCKINGRANGE_GLOBAL] = |
| 135 | 135 | { 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x01 }, |
| @@ -372,8 +372,8 @@ static void check_geometry(struct opal_dev *dev, const void *data) · 236 unmodified lines | ||
| 372 | 372 | { |
| 373 | 373 | const struct d0_geometry_features *geo = data; |
| 374 | 374 | |
| 375 | − dev->align = geo->alignment_granularity; | |
| 376 | − dev->lowest_lba = geo->lowest_aligned_lba; | |
| 375 | + dev->align = be64_to_cpu(geo->alignment_granularity); | |
| 376 | + dev->lowest_lba = be64_to_cpu(geo->lowest_aligned_lba); | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | static int execute_step(struct opal_dev *dev, |
| @@ -994,6 +994,16 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, · 993 unmodified lines | ||
| 994 | 994 | if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync) |
| 995 | 995 | blk_queue_write_cache(lo->lo_queue, true, false); |
| 996 | 996 | |
| 997 | + if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) { | |
| 998 | + /* In case of direct I/O, match underlying block size */ | |
| 999 | + unsigned short bsize = bdev_logical_block_size( | |
| 1000 | + inode->i_sb->s_bdev); | |
| 1001 | + | |
| 1002 | + blk_queue_logical_block_size(lo->lo_queue, bsize); | |
| 1003 | + blk_queue_physical_block_size(lo->lo_queue, bsize); | |
| 1004 | + blk_queue_io_min(lo->lo_queue, bsize); | |
| 1005 | + } | |
| 1006 | + | |
| 997 | 1007 | loop_update_rotational(lo); |
| 998 | 1008 | loop_update_dio(lo); |
| 999 | 1009 | set_capacity(lo->lo_disk, size); |
| @@ -2520,4 +2520,4 @@ void add_bootloader_randomness(const void *buf, unsigned int size) · 2519 unmodified lines | ||
| 2520 | 2520 | else |
| 2521 | 2521 | add_device_randomness(buf, size); |
| 2522 | 2522 | } |
| 2523 | −EXPORT_SYMBOL_GPL(add_bootloader_randomness); | |
| 2523 | +EXPORT_SYMBOL_GPL(add_bootloader_randomness); | |
| @@ -683,7 +683,7 @@ static const struct omap_clkctrl_reg_data dra7_l4per2_clkctrl_regs[] __initconst · 682 unmodified lines | ||
| 683 | 683 | { DRA7_L4PER2_MCASP2_CLKCTRL, dra7_mcasp2_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0154:22" }, |
| 684 | 684 | { DRA7_L4PER2_MCASP3_CLKCTRL, dra7_mcasp3_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:015c:22" }, |
| 685 | 685 | { DRA7_L4PER2_MCASP5_CLKCTRL, dra7_mcasp5_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:016c:22" }, |
| 686 | − { DRA7_L4PER2_MCASP8_CLKCTRL, dra7_mcasp8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0184:24" }, | |
| 686 | + { DRA7_L4PER2_MCASP8_CLKCTRL, dra7_mcasp8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:0184:22" }, | |
| 687 | 687 | { DRA7_L4PER2_MCASP4_CLKCTRL, dra7_mcasp4_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:018c:22" }, |
| 688 | 688 | { DRA7_L4PER2_UART7_CLKCTRL, dra7_uart7_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:01c4:24" }, |
| 689 | 689 | { DRA7_L4PER2_UART8_CLKCTRL, dra7_uart8_bit_data, CLKF_SW_SUP, "l4per2-clkctrl:01d4:24" }, |
| @@ -828,8 +828,8 @@ static struct ti_dt_clk dra7xx_clks[] = { · 138 unmodified lines | ||
| 828 | 828 | DT_CLK(NULL, "mcasp6_aux_gfclk_mux", "l4per2-clkctrl:01f8:22"), |
| 829 | 829 | DT_CLK(NULL, "mcasp7_ahclkx_mux", "l4per2-clkctrl:01fc:24"), |
| 830 | 830 | DT_CLK(NULL, "mcasp7_aux_gfclk_mux", "l4per2-clkctrl:01fc:22"), |
| 831 | − DT_CLK(NULL, "mcasp8_ahclkx_mux", "l4per2-clkctrl:0184:22"), | |
| 832 | − DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "l4per2-clkctrl:0184:24"), | |
| 831 | + DT_CLK(NULL, "mcasp8_ahclkx_mux", "l4per2-clkctrl:0184:24"), | |
| 832 | + DT_CLK(NULL, "mcasp8_aux_gfclk_mux", "l4per2-clkctrl:0184:22"), | |
| 833 | 833 | DT_CLK(NULL, "mmc1_clk32k", "l3init-clkctrl:0008:8"), |
| 834 | 834 | DT_CLK(NULL, "mmc1_fclk_div", "l3init-clkctrl:0008:25"), |
| 835 | 835 | DT_CLK(NULL, "mmc1_fclk_mux", "l3init-clkctrl:0008:24"), |
| @@ -25,7 +25,9 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq) · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | struct clock_event_device *clkevt = &to->clkevt; |
| 27 | 27 | |
| 28 | − of_irq->percpu ? free_percpu_irq(of_irq->irq, clkevt) : | |
| 28 | + if (of_irq->percpu) | |
| 29 | + free_percpu_irq(of_irq->irq, clkevt); | |
| 30 | + else | |
| 29 | 31 | free_irq(of_irq->irq, clkevt); |
| 30 | 32 | } |
| 31 | 33 | |
| @@ -54,7 +54,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ · 53 unmodified lines | ||
| 54 | 54 | amdgpu_gtt_mgr.o amdgpu_vram_mgr.o amdgpu_virt.o amdgpu_atomfirmware.o \ |
| 55 | 55 | amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ |
| 56 | 56 | amdgpu_gmc.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ |
| 57 | − amdgpu_vm_sdma.o amdgpu_pmu.o amdgpu_discovery.o amdgpu_ras_eeprom.o smu_v11_0_i2c.o | |
| 57 | + amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o smu_v11_0_i2c.o | |
| 58 | 58 | |
| 59 | 59 | amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o |
| 60 | 60 | |
| @@ -189,7 +189,7 @@ static int acp_hw_init(void *handle) · 188 unmodified lines | ||
| 189 | 189 | u32 val = 0; |
| 190 | 190 | u32 count = 0; |
| 191 | 191 | struct device *dev; |
| 192 | − struct i2s_platform_data *i2s_pdata; | |
| 192 | + struct i2s_platform_data *i2s_pdata = NULL; | |
| 193 | 193 | |
| 194 | 194 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 195 | 195 | |
| @@ -231,20 +231,21 @@ static int acp_hw_init(void *handle) · 35 unmodified lines | ||
| 231 | 231 | adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell), |
| 232 | 232 | GFP_KERNEL); |
| 233 | 233 | |
| 234 | − if (adev->acp.acp_cell == NULL) | |
| 235 | − return -ENOMEM; | |
| 234 | + if (adev->acp.acp_cell == NULL) { | |
| 235 | + r = -ENOMEM; | |
| 236 | + goto failure; | |
| 237 | + } | |
| 236 | 238 | |
| 237 | 239 | adev->acp.acp_res = kcalloc(5, sizeof(struct resource), GFP_KERNEL); |
| 238 | 240 | if (adev->acp.acp_res == NULL) { |
| 239 | − kfree(adev->acp.acp_cell); | |
| 240 | − return -ENOMEM; | |
| 241 | + r = -ENOMEM; | |
| 242 | + goto failure; | |
| 241 | 243 | } |
| 242 | 244 | |
| 243 | 245 | i2s_pdata = kcalloc(3, sizeof(struct i2s_platform_data), GFP_KERNEL); |
| 244 | 246 | if (i2s_pdata == NULL) { |
| 245 | − kfree(adev->acp.acp_res); | |
| 246 | − kfree(adev->acp.acp_cell); | |
| 247 | − return -ENOMEM; | |
| 247 | + r = -ENOMEM; | |
| 248 | + goto failure; | |
| 248 | 249 | } |
| 249 | 250 | |
| 250 | 251 | switch (adev->asic_type) { |
| @@ -341,14 +342,14 @@ static int acp_hw_init(void *handle) · 90 unmodified lines | ||
| 341 | 342 | r = mfd_add_hotplug_devices(adev->acp.parent, adev->acp.acp_cell, |
| 342 | 343 | ACP_DEVS); |
| 343 | 344 | if (r) |
| 344 | − return r; | |
| 345 | + goto failure; | |
| 345 | 346 | |
| 346 | 347 | for (i = 0; i < ACP_DEVS ; i++) { |
| 347 | 348 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
| 348 | 349 | r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); |
| 349 | 350 | if (r) { |
| 350 | 351 | dev_err(dev, "Failed to add dev to genpd\n"); |
| 351 | − return r; | |
| 352 | + goto failure; | |
| 352 | 353 | } |
| 353 | 354 | } |
| 354 | 355 | |
| @@ -367,7 +368,8 @@ static int acp_hw_init(void *handle) · 12 unmodified lines | ||
| 367 | 368 | break; |
| 368 | 369 | if (--count == 0) { |
| 369 | 370 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); |
| 370 | − return -ETIMEDOUT; | |
| 371 | + r = -ETIMEDOUT; | |
| 372 | + goto failure; | |
| 371 | 373 | } |
| 372 | 374 | udelay(100); |
| 373 | 375 | } |
| @@ -384,7 +386,8 @@ static int acp_hw_init(void *handle) · 10 unmodified lines | ||
| 384 | 386 | break; |
| 385 | 387 | if (--count == 0) { |
| 386 | 388 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); |
| 387 | − return -ETIMEDOUT; | |
| 389 | + r = -ETIMEDOUT; | |
| 390 | + goto failure; | |
| 388 | 391 | } |
| 389 | 392 | udelay(100); |
| 390 | 393 | } |
| @@ -393,6 +396,13 @@ static int acp_hw_init(void *handle) · 2 unmodified lines | ||
| 393 | 396 | val &= ~ACP_SOFT_RESET__SoftResetAud_MASK; |
| 394 | 397 | cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val); |
| 395 | 398 | return 0; |
| 399 | + | |
| 400 | +failure: | |
| 401 | + kfree(i2s_pdata); | |
| 402 | + kfree(adev->acp.acp_res); | |
| 403 | + kfree(adev->acp.acp_cell); | |
| 404 | + kfree(adev->acp.acp_genpd); | |
| 405 | + return r; | |
| 396 | 406 | } |
| 397 | 407 | |
| 398 | 408 | /** |
| @@ -81,9 +81,10 @@ · 80 unmodified lines | ||
| 81 | 81 | * - 3.32.0 - Add syncobj timeline support to AMDGPU_CS. |
| 82 | 82 | * - 3.33.0 - Fixes for GDS ENOMEM failures in AMDGPU_CS. |
| 83 | 83 | * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches |
| 84 | + * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask | |
| 84 | 85 | */ |
| 85 | 86 | #define KMS_DRIVER_MAJOR 3 |
| 86 | −#define KMS_DRIVER_MINOR 34 | |
| 87 | +#define KMS_DRIVER_MINOR 35 | |
| 87 | 88 | #define KMS_DRIVER_PATCHLEVEL 0 |
| 88 | 89 | |
| 89 | 90 | #define AMDGPU_MAX_TIMEOUT_PARAM_LENTH 256 |
| @@ -165,6 +165,7 @@ struct amdgpu_gfx_config { · 164 unmodified lines | ||
| 165 | 165 | uint32_t num_sc_per_sh; |
| 166 | 166 | uint32_t num_packer_per_sc; |
| 167 | 167 | uint32_t pa_sc_tile_steering_override; |
| 168 | + uint64_t tcc_disabled_mask; | |
| 168 | 169 | }; |
| 169 | 170 | |
| 170 | 171 | struct amdgpu_cu_info { |
| @@ -787,6 +787,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 786 unmodified lines | ||
| 787 | 787 | dev_info.pa_sc_tile_steering_override = |
| 788 | 788 | adev->gfx.config.pa_sc_tile_steering_override; |
| 789 | 789 | |
| 790 | + dev_info.tcc_disabled_mask = adev->gfx.config.tcc_disabled_mask; | |
| 791 | + | |
| 790 | 792 | return copy_to_user(out, &dev_info, |
| 791 | 793 | min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; |
| 792 | 794 | } |
| @@ -603,14 +603,12 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev, · 602 unmodified lines | ||
| 603 | 603 | struct ttm_bo_global *glob = adev->mman.bdev.glob; |
| 604 | 604 | struct amdgpu_vm_bo_base *bo_base; |
| 605 | 605 | |
| 606 | −#if 0 | |
| 607 | 606 | if (vm->bulk_moveable) { |
| 608 | 607 | spin_lock(&glob->lru_lock); |
| 609 | 608 | ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); |
| 610 | 609 | spin_unlock(&glob->lru_lock); |
| 611 | 610 | return; |
| 612 | 611 | } |
| 613 | −#endif | |
| 614 | 612 | |
| 615 | 613 | memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); |
| 616 | 614 | |
| @@ -1691,6 +1691,17 @@ static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) · 1690 unmodified lines | ||
| 1691 | 1691 | } |
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | +static void gfx_v10_0_get_tcc_info(struct amdgpu_device *adev) | |
| 1695 | +{ | |
| 1696 | + /* TCCs are global (not instanced). */ | |
| 1697 | + uint32_t tcc_disable = RREG32_SOC15(GC, 0, mmCGTS_TCC_DISABLE) | | |
| 1698 | + RREG32_SOC15(GC, 0, mmCGTS_USER_TCC_DISABLE); | |
| 1699 | + | |
| 1700 | + adev->gfx.config.tcc_disabled_mask = | |
| 1701 | + REG_GET_FIELD(tcc_disable, CGTS_TCC_DISABLE, TCC_DISABLE) | | |
| 1702 | + (REG_GET_FIELD(tcc_disable, CGTS_TCC_DISABLE, HI_TCC_DISABLE) << 16); | |
| 1703 | +} | |
| 1704 | + | |
| 1694 | 1705 | static void gfx_v10_0_constants_init(struct amdgpu_device *adev) |
| 1695 | 1706 | { |
| 1696 | 1707 | u32 tmp; |
| @@ -1702,6 +1713,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev) · 5 unmodified lines | ||
| 1702 | 1713 | |
| 1703 | 1714 | gfx_v10_0_setup_rb(adev); |
| 1704 | 1715 | gfx_v10_0_get_cu_info(adev, &adev->gfx.cu_info); |
| 1716 | + gfx_v10_0_get_tcc_info(adev); | |
| 1705 | 1717 | adev->gfx.config.pa_sc_tile_steering_override = |
| 1706 | 1718 | gfx_v10_0_init_pa_sc_tile_steering_override(adev); |
| 1707 | 1719 | |
| @@ -317,10 +317,12 @@ static int nv_asic_reset(struct amdgpu_device *adev) · 316 unmodified lines | ||
| 317 | 317 | struct smu_context *smu = &adev->smu; |
| 318 | 318 | |
| 319 | 319 | if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { |
| 320 | − amdgpu_inc_vram_lost(adev); | |
| 320 | + if (!adev->in_suspend) | |
| 321 | + amdgpu_inc_vram_lost(adev); | |
| 321 | 322 | ret = smu_baco_reset(smu); |
| 322 | 323 | } else { |
| 323 | − amdgpu_inc_vram_lost(adev); | |
| 324 | + if (!adev->in_suspend) | |
| 325 | + amdgpu_inc_vram_lost(adev); | |
| 324 | 326 | ret = nv_asic_mode1_reset(adev); |
| 325 | 327 | } |
| 326 | 328 | |
| @@ -558,12 +558,14 @@ static int soc15_asic_reset(struct amdgpu_device *adev) · 557 unmodified lines | ||
| 558 | 558 | { |
| 559 | 559 | switch (soc15_asic_reset_method(adev)) { |
| 560 | 560 | case AMD_RESET_METHOD_BACO: |
| 561 | − amdgpu_inc_vram_lost(adev); | |
| 561 | + if (!adev->in_suspend) | |
| 562 | + amdgpu_inc_vram_lost(adev); | |
| 562 | 563 | return soc15_asic_baco_reset(adev); |
| 563 | 564 | case AMD_RESET_METHOD_MODE2: |
| 564 | 565 | return soc15_mode2_reset(adev); |
| 565 | 566 | default: |
| 566 | − amdgpu_inc_vram_lost(adev); | |
| 567 | + if (!adev->in_suspend) | |
| 568 | + amdgpu_inc_vram_lost(adev); | |
| 567 | 569 | return soc15_asic_mode1_reset(adev); |
| 568 | 570 | } |
| 569 | 571 | } |
| @@ -771,8 +773,6 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev) · 201 unmodified lines | ||
| 771 | 773 | #if defined(CONFIG_DRM_AMD_DC) |
| 772 | 774 | else if (amdgpu_device_has_dc_support(adev)) |
| 773 | 775 | amdgpu_device_ip_block_add(adev, &dm_ip_block); |
| 774 | −#else | |
| 775 | −# warning "Enable CONFIG_DRM_AMD_DC for display support on SOC15." | |
| 776 | 776 | #endif |
| 777 | 777 | amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); |
| 778 | 778 | break; |
| @@ -2385,8 +2385,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 2384 unmodified lines | ||
| 2385 | 2385 | |
| 2386 | 2386 | if (adev->asic_type != CHIP_CARRIZO && adev->asic_type != CHIP_STONEY) |
| 2387 | 2387 | dm->dc->debug.disable_stutter = amdgpu_pp_feature_mask & PP_STUTTER_MODE ? false : true; |
| 2388 | − if (adev->asic_type == CHIP_RENOIR) | |
| 2389 | − dm->dc->debug.disable_stutter = true; | |
| 2390 | 2388 | |
| 2391 | 2389 | return 0; |
| 2392 | 2390 | fail: |
| @@ -6019,7 +6017,9 @@ static void amdgpu_dm_enable_crtc_interrupts(struct drm_device *dev, · 3626 unmodified lines | ||
| 6019 | 6017 | struct drm_crtc *crtc; |
| 6020 | 6018 | struct drm_crtc_state *old_crtc_state, *new_crtc_state; |
| 6021 | 6019 | int i; |
| 6020 | +#ifdef CONFIG_DEBUG_FS | |
| 6022 | 6021 | enum amdgpu_dm_pipe_crc_source source; |
| 6022 | +#endif | |
| 6023 | 6023 | |
| 6024 | 6024 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, |
| 6025 | 6025 | new_crtc_state, i) { |
| @@ -668,6 +668,7 @@ struct clock_source *dce100_clock_source_create( · 667 unmodified lines | ||
| 668 | 668 | return &clk_src->base; |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | + kfree(clk_src); | |
| 671 | 672 | BREAK_TO_DEBUGGER(); |
| 672 | 673 | return NULL; |
| 673 | 674 | } |
| @@ -714,6 +714,7 @@ struct clock_source *dce110_clock_source_create( · 713 unmodified lines | ||
| 714 | 714 | return &clk_src->base; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | + kfree(clk_src); | |
| 717 | 718 | BREAK_TO_DEBUGGER(); |
| 718 | 719 | return NULL; |
| 719 | 720 | } |
| @@ -687,6 +687,7 @@ struct clock_source *dce112_clock_source_create( · 686 unmodified lines | ||
| 687 | 687 | return &clk_src->base; |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | + kfree(clk_src); | |
| 690 | 691 | BREAK_TO_DEBUGGER(); |
| 691 | 692 | return NULL; |
| 692 | 693 | } |
| @@ -500,6 +500,7 @@ static struct clock_source *dce120_clock_source_create( · 499 unmodified lines | ||
| 500 | 500 | return &clk_src->base; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | + kfree(clk_src); | |
| 503 | 504 | BREAK_TO_DEBUGGER(); |
| 504 | 505 | return NULL; |
| 505 | 506 | } |
| @@ -701,6 +701,7 @@ struct clock_source *dce80_clock_source_create( · 700 unmodified lines | ||
| 701 | 701 | return &clk_src->base; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | + kfree(clk_src); | |
| 704 | 705 | BREAK_TO_DEBUGGER(); |
| 705 | 706 | return NULL; |
| 706 | 707 | } |
| @@ -786,6 +786,7 @@ struct clock_source *dcn10_clock_source_create( · 785 unmodified lines | ||
| 786 | 786 | return &clk_src->base; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | + kfree(clk_src); | |
| 789 | 790 | BREAK_TO_DEBUGGER(); |
| 790 | 791 | return NULL; |
| 791 | 792 | } |
| @@ -1077,6 +1077,7 @@ struct clock_source *dcn20_clock_source_create( · 1076 unmodified lines | ||
| 1077 | 1077 | return &clk_src->base; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | + kfree(clk_src); | |
| 1080 | 1081 | BREAK_TO_DEBUGGER(); |
| 1081 | 1082 | return NULL; |
| 1082 | 1083 | } |
| @@ -3,7 +3,17 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o |
| 5 | 5 | |
| 6 | −CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 | |
| 6 | +ifneq ($(call cc-option, -mpreferred-stack-boundary=4),) | |
| 7 | + cc_stack_align := -mpreferred-stack-boundary=4 | |
| 8 | +else ifneq ($(call cc-option, -mstack-alignment=16),) | |
| 9 | + cc_stack_align := -mstack-alignment=16 | |
| 10 | +endif | |
| 11 | + | |
| 12 | +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse $(cc_stack_align) | |
| 13 | + | |
| 14 | +ifdef CONFIG_CC_IS_CLANG | |
| 15 | +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 | |
| 16 | +endif | |
| 7 | 17 | |
| 8 | 18 | AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21)) |
| 9 | 19 | |
| @@ -39,9 +39,6 @@ · 38 unmodified lines | ||
| 39 | 39 | * ways. Unless there is something clearly wrong with it the code should |
| 40 | 40 | * remain as-is as it provides us with a guarantee from HW that it is correct. |
| 41 | 41 | */ |
| 42 | − | |
| 43 | −typedef unsigned int uint; | |
| 44 | − | |
| 45 | 42 | typedef struct { |
| 46 | 43 | double DPPCLK; |
| 47 | 44 | double DISPCLK; |
| @@ -4774,7 +4771,7 @@ void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l · 4726 unmodified lines | ||
| 4774 | 4771 | mode_lib->vba.MaximumReadBandwidthWithoutPrefetch = 0.0; |
| 4775 | 4772 | mode_lib->vba.MaximumReadBandwidthWithPrefetch = 0.0; |
| 4776 | 4773 | for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) { |
| 4777 | − uint m; | |
| 4774 | + unsigned int m; | |
| 4778 | 4775 | |
| 4779 | 4776 | locals->cursor_bw[k] = 0; |
| 4780 | 4777 | locals->cursor_bw_pre[k] = 0; |
| @@ -5285,7 +5282,7 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport( · 504 unmodified lines | ||
| 5285 | 5282 | double SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank; |
| 5286 | 5283 | double FullDETBufferingTimeYStutterCriticalPlane = 0; |
| 5287 | 5284 | double TimeToFinishSwathTransferStutterCriticalPlane = 0; |
| 5288 | − uint k, j; | |
| 5285 | + unsigned int k, j; | |
| 5289 | 5286 | |
| 5290 | 5287 | mode_lib->vba.TotalActiveDPP = 0; |
| 5291 | 5288 | mode_lib->vba.TotalDCCActiveDPP = 0; |
| @@ -5507,7 +5504,7 @@ static void CalculateDCFCLKDeepSleep( · 215 unmodified lines | ||
| 5507 | 5504 | double DPPCLK[], |
| 5508 | 5505 | double *DCFCLKDeepSleep) |
| 5509 | 5506 | { |
| 5510 | − uint k; | |
| 5507 | + unsigned int k; | |
| 5511 | 5508 | double DisplayPipeLineDeliveryTimeLuma; |
| 5512 | 5509 | double DisplayPipeLineDeliveryTimeChroma; |
| 5513 | 5510 | //double DCFCLKDeepSleepPerPlane[DC__NUM_DPP__MAX]; |
| @@ -5727,7 +5724,7 @@ static void CalculatePixelDeliveryTimes( · 213 unmodified lines | ||
| 5727 | 5724 | double DisplayPipeRequestDeliveryTimeChromaPrefetch[]) |
| 5728 | 5725 | { |
| 5729 | 5726 | double req_per_swath_ub; |
| 5730 | − uint k; | |
| 5727 | + unsigned int k; | |
| 5731 | 5728 | |
| 5732 | 5729 | for (k = 0; k < NumberOfActivePlanes; ++k) { |
| 5733 | 5730 | if (VRatio[k] <= 1) { |
| @@ -5869,7 +5866,7 @@ static void CalculateMetaAndPTETimes( · 135 unmodified lines | ||
| 5869 | 5866 | unsigned int dpte_groups_per_row_chroma_ub; |
| 5870 | 5867 | unsigned int num_group_per_lower_vm_stage; |
| 5871 | 5868 | unsigned int num_req_per_lower_vm_stage; |
| 5872 | − uint k; | |
| 5869 | + unsigned int k; | |
| 5873 | 5870 | |
| 5874 | 5871 | for (k = 0; k < NumberOfActivePlanes; ++k) { |
| 5875 | 5872 | if (GPUVMEnable == true) { |
| @@ -843,6 +843,8 @@ static int smu_sw_init(void *handle) · 842 unmodified lines | ||
| 843 | 843 | smu->smu_baco.state = SMU_BACO_STATE_EXIT; |
| 844 | 844 | smu->smu_baco.platform_support = false; |
| 845 | 845 | |
| 846 | + mutex_init(&smu->sensor_lock); | |
| 847 | + | |
| 846 | 848 | smu->watermarks_bitmap = 0; |
| 847 | 849 | smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| 848 | 850 | smu->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT; |
| @@ -1018,6 +1018,7 @@ static int arcturus_read_sensor(struct smu_context *smu, · 1017 unmodified lines | ||
| 1018 | 1018 | if (!data || !size) |
| 1019 | 1019 | return -EINVAL; |
| 1020 | 1020 | |
| 1021 | + mutex_lock(&smu->sensor_lock); | |
| 1021 | 1022 | switch (sensor) { |
| 1022 | 1023 | case AMDGPU_PP_SENSOR_MAX_FAN_RPM: |
| 1023 | 1024 | *(uint32_t *)data = pptable->FanMaximumRpm; |
| @@ -1044,6 +1045,7 @@ static int arcturus_read_sensor(struct smu_context *smu, · 20 unmodified lines | ||
| 1044 | 1045 | default: |
| 1045 | 1046 | ret = smu_smc_read_sensor(smu, sensor, data, size); |
| 1046 | 1047 | } |
| 1048 | + mutex_unlock(&smu->sensor_lock); | |
| 1047 | 1049 | |
| 1048 | 1050 | return ret; |
| 1049 | 1051 | } |
| @@ -344,6 +344,7 @@ struct smu_context · 343 unmodified lines | ||
| 344 | 344 | const struct smu_funcs *funcs; |
| 345 | 345 | const struct pptable_funcs *ppt_funcs; |
| 346 | 346 | struct mutex mutex; |
| 347 | + struct mutex sensor_lock; | |
| 347 | 348 | uint64_t pool_size; |
| 348 | 349 | |
| 349 | 350 | struct smu_table_context smu_table; |
| @@ -547,7 +547,7 @@ static int navi10_get_metrics_table(struct smu_context *smu, · 546 unmodified lines | ||
| 547 | 547 | struct smu_table_context *smu_table= &smu->smu_table; |
| 548 | 548 | int ret = 0; |
| 549 | 549 | |
| 550 | − if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + HZ / 1000)) { | |
| 550 | + if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(100))) { | |
| 551 | 551 | ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0, |
| 552 | 552 | (void *)smu_table->metrics_table, false); |
| 553 | 553 | if (ret) { |
| @@ -1386,6 +1386,7 @@ static int navi10_read_sensor(struct smu_context *smu, · 832 unmodified lines | ||
| 1386 | 1386 | if(!data || !size) |
| 1387 | 1387 | return -EINVAL; |
| 1388 | 1388 | |
| 1389 | + mutex_lock(&smu->sensor_lock); | |
| 1389 | 1390 | switch (sensor) { |
| 1390 | 1391 | case AMDGPU_PP_SENSOR_MAX_FAN_RPM: |
| 1391 | 1392 | *(uint32_t *)data = pptable->FanMaximumRpm; |
| @@ -1409,6 +1410,7 @@ static int navi10_read_sensor(struct smu_context *smu, · 17 unmodified lines | ||
| 1409 | 1410 | default: |
| 1410 | 1411 | ret = smu_smc_read_sensor(smu, sensor, data, size); |
| 1411 | 1412 | } |
| 1413 | + mutex_unlock(&smu->sensor_lock); | |
| 1412 | 1414 | |
| 1413 | 1415 | return ret; |
| 1414 | 1416 | } |
| @@ -3023,6 +3023,7 @@ static int vega20_read_sensor(struct smu_context *smu, · 3022 unmodified lines | ||
| 3023 | 3023 | if(!data || !size) |
| 3024 | 3024 | return -EINVAL; |
| 3025 | 3025 | |
| 3026 | + mutex_lock(&smu->sensor_lock); | |
| 3026 | 3027 | switch (sensor) { |
| 3027 | 3028 | case AMDGPU_PP_SENSOR_MAX_FAN_RPM: |
| 3028 | 3029 | *(uint32_t *)data = pptable->FanMaximumRpm; |
| @@ -3048,6 +3049,7 @@ static int vega20_read_sensor(struct smu_context *smu, · 19 unmodified lines | ||
| 3048 | 3049 | default: |
| 3049 | 3050 | ret = smu_smc_read_sensor(smu, sensor, data, size); |
| 3050 | 3051 | } |
| 3052 | + mutex_unlock(&smu->sensor_lock); | |
| 3051 | 3053 | |
| 3052 | 3054 | return ret; |
| 3053 | 3055 | } |
| @@ -43,9 +43,8 @@ komeda_wb_encoder_atomic_check(struct drm_encoder *encoder, · 42 unmodified lines | ||
| 43 | 43 | struct komeda_data_flow_cfg dflow; |
| 44 | 44 | int err; |
| 45 | 45 | |
| 46 | − if (!writeback_job || !writeback_job->fb) { | |
| 46 | + if (!writeback_job) | |
| 47 | 47 | return 0; |
| 48 | − } | |
| 49 | 48 | |
| 50 | 49 | if (!crtc_st->active) { |
| 51 | 50 | DRM_DEBUG_ATOMIC("Cannot write the composition result out on a inactive CRTC.\n"); |
| @@ -166,8 +165,10 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, · 114 unmodified lines | ||
| 166 | 165 | &komeda_wb_encoder_helper_funcs, |
| 167 | 166 | formats, n_formats); |
| 168 | 167 | komeda_put_fourcc_list(formats); |
| 169 | − if (err) | |
| 168 | + if (err) { | |
| 169 | + kfree(kwb_conn); | |
| 170 | 170 | return err; |
| 171 | + } | |
| 171 | 172 | |
| 172 | 173 | drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs); |
| 173 | 174 | |
| @@ -131,7 +131,7 @@ malidp_mw_encoder_atomic_check(struct drm_encoder *encoder, · 130 unmodified lines | ||
| 131 | 131 | struct drm_framebuffer *fb; |
| 132 | 132 | int i, n_planes; |
| 133 | 133 | |
| 134 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 134 | + if (!conn_state->writeback_job) | |
| 135 | 135 | return 0; |
| 136 | 136 | |
| 137 | 137 | fb = conn_state->writeback_job->fb; |
| @@ -248,7 +248,7 @@ void malidp_mw_atomic_commit(struct drm_device *drm, · 110 unmodified lines | ||
| 248 | 248 | |
| 249 | 249 | mw_state = to_mw_state(conn_state); |
| 250 | 250 | |
| 251 | − if (conn_state->writeback_job && conn_state->writeback_job->fb) { | |
| 251 | + if (conn_state->writeback_job) { | |
| 252 | 252 | struct drm_framebuffer *fb = conn_state->writeback_job->fb; |
| 253 | 253 | |
| 254 | 254 | DRM_DEV_DEBUG_DRIVER(drm->dev, |
| @@ -430,10 +430,15 @@ static int drm_atomic_connector_check(struct drm_connector *connector, · 429 unmodified lines | ||
| 430 | 430 | return -EINVAL; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | − if (writeback_job->out_fence && !writeback_job->fb) { | |
| 434 | − DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", | |
| 435 | − connector->base.id, connector->name); | |
| 436 | − return -EINVAL; | |
| 433 | + if (!writeback_job->fb) { | |
| 434 | + if (writeback_job->out_fence) { | |
| 435 | + DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] requesting out-fence without framebuffer\n", | |
| 436 | + connector->base.id, connector->name); | |
| 437 | + return -EINVAL; | |
| 438 | + } | |
| 439 | + | |
| 440 | + drm_writeback_cleanup_job(writeback_job); | |
| 441 | + state->writeback_job = NULL; | |
| 437 | 442 | } |
| 438 | 443 | |
| 439 | 444 | return 0; |
| @@ -324,6 +324,9 @@ void drm_writeback_cleanup_job(struct drm_writeback_job *job) · 323 unmodified lines | ||
| 324 | 324 | if (job->fb) |
| 325 | 325 | drm_framebuffer_put(job->fb); |
| 326 | 326 | |
| 327 | + if (job->out_fence) | |
| 328 | + dma_fence_put(job->out_fence); | |
| 329 | + | |
| 327 | 330 | kfree(job); |
| 328 | 331 | } |
| 329 | 332 | EXPORT_SYMBOL(drm_writeback_cleanup_job); |
| @@ -366,25 +369,29 @@ drm_writeback_signal_completion(struct drm_writeback_connector *wb_connector, · 36 unmodified lines | ||
| 366 | 369 | { |
| 367 | 370 | unsigned long flags; |
| 368 | 371 | struct drm_writeback_job *job; |
| 372 | + struct dma_fence *out_fence; | |
| 369 | 373 | |
| 370 | 374 | spin_lock_irqsave(&wb_connector->job_lock, flags); |
| 371 | 375 | job = list_first_entry_or_null(&wb_connector->job_queue, |
| 372 | 376 | struct drm_writeback_job, |
| 373 | 377 | list_entry); |
| 374 | − if (job) { | |
| 378 | + if (job) | |
| 375 | 379 | list_del(&job->list_entry); |
| 376 | − if (job->out_fence) { | |
| 377 | − if (status) | |
| 378 | − dma_fence_set_error(job->out_fence, status); | |
| 379 | − dma_fence_signal(job->out_fence); | |
| 380 | − dma_fence_put(job->out_fence); | |
| 381 | − } | |
| 382 | − } | |
| 380 | + | |
| 383 | 381 | spin_unlock_irqrestore(&wb_connector->job_lock, flags); |
| 384 | 382 | |
| 385 | 383 | if (WARN_ON(!job)) |
| 386 | 384 | return; |
| 387 | 385 | |
| 386 | + out_fence = job->out_fence; | |
| 387 | + if (out_fence) { | |
| 388 | + if (status) | |
| 389 | + dma_fence_set_error(out_fence, status); | |
| 390 | + dma_fence_signal(out_fence); | |
| 391 | + dma_fence_put(out_fence); | |
| 392 | + job->out_fence = NULL; | |
| 393 | + } | |
| 394 | + | |
| 388 | 395 | INIT_WORK(&job->cleanup_work, cleanup_work); |
| 389 | 396 | queue_work(system_long_wq, &job->cleanup_work); |
| 390 | 397 | } |
| @@ -7261,7 +7261,7 @@ retry: · 7260 unmodified lines | ||
| 7261 | 7261 | pipe_config->fdi_lanes = lane; |
| 7262 | 7262 | |
| 7263 | 7263 | intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock, |
| 7264 | − link_bw, &pipe_config->fdi_m_n, false); | |
| 7264 | + link_bw, &pipe_config->fdi_m_n, false, false); | |
| 7265 | 7265 | |
| 7266 | 7266 | ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config); |
| 7267 | 7267 | if (ret == -EDEADLK) |
| @@ -7508,11 +7508,15 @@ void · 240 unmodified lines | ||
| 7508 | 7508 | intel_link_compute_m_n(u16 bits_per_pixel, int nlanes, |
| 7509 | 7509 | int pixel_clock, int link_clock, |
| 7510 | 7510 | struct intel_link_m_n *m_n, |
| 7511 | − bool constant_n) | |
| 7511 | + bool constant_n, bool fec_enable) | |
| 7512 | 7512 | { |
| 7513 | − m_n->tu = 64; | |
| 7513 | + u32 data_clock = bits_per_pixel * pixel_clock; | |
| 7514 | + | |
| 7515 | + if (fec_enable) | |
| 7516 | + data_clock = intel_dp_mode_to_fec_clock(data_clock); | |
| 7514 | 7517 | |
| 7515 | − compute_m_n(bits_per_pixel * pixel_clock, | |
| 7518 | + m_n->tu = 64; | |
| 7519 | + compute_m_n(data_clock, | |
| 7516 | 7520 | link_clock * nlanes * 8, |
| 7517 | 7521 | &m_n->gmch_m, &m_n->gmch_n, |
| 7518 | 7522 | constant_n); |
| @@ -414,7 +414,7 @@ enum phy_fia { · 413 unmodified lines | ||
| 414 | 414 | void intel_link_compute_m_n(u16 bpp, int nlanes, |
| 415 | 415 | int pixel_clock, int link_clock, |
| 416 | 416 | struct intel_link_m_n *m_n, |
| 417 | − bool constant_n); | |
| 417 | + bool constant_n, bool fec_enable); | |
| 418 | 418 | bool is_ccs_modifier(u64 modifier); |
| 419 | 419 | void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv); |
| 420 | 420 | u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv, |
| @@ -78,8 +78,8 @@ · 77 unmodified lines | ||
| 78 | 78 | #define DP_DSC_MAX_ENC_THROUGHPUT_0 340000 |
| 79 | 79 | #define DP_DSC_MAX_ENC_THROUGHPUT_1 400000 |
| 80 | 80 | |
| 81 | −/* DP DSC FEC Overhead factor = (100 - 2.4)/100 */ | |
| 82 | −#define DP_DSC_FEC_OVERHEAD_FACTOR 976 | |
| 81 | +/* DP DSC FEC Overhead factor = 1/(0.972261) */ | |
| 82 | +#define DP_DSC_FEC_OVERHEAD_FACTOR 972261 | |
| 83 | 83 | |
| 84 | 84 | /* Compliance test status bits */ |
| 85 | 85 | #define INTEL_DP_RESOLUTION_SHIFT_MASK 0 |
| @@ -494,6 +494,97 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, · 408 unmodified lines | ||
| 494 | 494 | return 0; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | +u32 intel_dp_mode_to_fec_clock(u32 mode_clock) | |
| 498 | +{ | |
| 499 | + return div_u64(mul_u32_u32(mode_clock, 1000000U), | |
| 500 | + DP_DSC_FEC_OVERHEAD_FACTOR); | |
| 501 | +} | |
| 502 | + | |
| 503 | +static u16 intel_dp_dsc_get_output_bpp(u32 link_clock, u32 lane_count, | |
| 504 | + u32 mode_clock, u32 mode_hdisplay) | |
| 505 | +{ | |
| 506 | + u32 bits_per_pixel, max_bpp_small_joiner_ram; | |
| 507 | + int i; | |
| 508 | + | |
| 509 | + /* | |
| 510 | + * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)* | |
| 511 | + * (LinkSymbolClock)* 8 * (TimeSlotsPerMTP) | |
| 512 | + * for SST -> TimeSlotsPerMTP is 1, | |
| 513 | + * for MST -> TimeSlotsPerMTP has to be calculated | |
| 514 | + */ | |
| 515 | + bits_per_pixel = (link_clock * lane_count * 8) / | |
| 516 | + intel_dp_mode_to_fec_clock(mode_clock); | |
| 517 | + DRM_DEBUG_KMS("Max link bpp: %u\n", bits_per_pixel); | |
| 518 | + | |
| 519 | + /* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */ | |
| 520 | + max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER / mode_hdisplay; | |
| 521 | + DRM_DEBUG_KMS("Max small joiner bpp: %u\n", max_bpp_small_joiner_ram); | |
| 522 | + | |
| 523 | + /* | |
| 524 | + * Greatest allowed DSC BPP = MIN (output BPP from available Link BW | |
| 525 | + * check, output bpp from small joiner RAM check) | |
| 526 | + */ | |
| 527 | + bits_per_pixel = min(bits_per_pixel, max_bpp_small_joiner_ram); | |
| 528 | + | |
| 529 | + /* Error out if the max bpp is less than smallest allowed valid bpp */ | |
| 530 | + if (bits_per_pixel < valid_dsc_bpp[0]) { | |
| 531 | + DRM_DEBUG_KMS("Unsupported BPP %u, min %u\n", | |
| 532 | + bits_per_pixel, valid_dsc_bpp[0]); | |
| 533 | + return 0; | |
| 534 | + } | |
| 535 | + | |
| 536 | + /* Find the nearest match in the array of known BPPs from VESA */ | |
| 537 | + for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) { | |
| 538 | + if (bits_per_pixel < valid_dsc_bpp[i + 1]) | |
| 539 | + break; | |
| 540 | + } | |
| 541 | + bits_per_pixel = valid_dsc_bpp[i]; | |
| 542 | + | |
| 543 | + /* | |
| 544 | + * Compressed BPP in U6.4 format so multiply by 16, for Gen 11, | |
| 545 | + * fractional part is 0 | |
| 546 | + */ | |
| 547 | + return bits_per_pixel << 4; | |
| 548 | +} | |
| 549 | + | |
| 550 | +static u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, | |
| 551 | + int mode_clock, int mode_hdisplay) | |
| 552 | +{ | |
| 553 | + u8 min_slice_count, i; | |
| 554 | + int max_slice_width; | |
| 555 | + | |
| 556 | + if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE) | |
| 557 | + min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 558 | + DP_DSC_MAX_ENC_THROUGHPUT_0); | |
| 559 | + else | |
| 560 | + min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 561 | + DP_DSC_MAX_ENC_THROUGHPUT_1); | |
| 562 | + | |
| 563 | + max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd); | |
| 564 | + if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) { | |
| 565 | + DRM_DEBUG_KMS("Unsupported slice width %d by DP DSC Sink device\n", | |
| 566 | + max_slice_width); | |
| 567 | + return 0; | |
| 568 | + } | |
| 569 | + /* Also take into account max slice width */ | |
| 570 | + min_slice_count = min_t(u8, min_slice_count, | |
| 571 | + DIV_ROUND_UP(mode_hdisplay, | |
| 572 | + max_slice_width)); | |
| 573 | + | |
| 574 | + /* Find the closest match to the valid slice count values */ | |
| 575 | + for (i = 0; i < ARRAY_SIZE(valid_dsc_slicecount); i++) { | |
| 576 | + if (valid_dsc_slicecount[i] > | |
| 577 | + drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, | |
| 578 | + false)) | |
| 579 | + break; | |
| 580 | + if (min_slice_count <= valid_dsc_slicecount[i]) | |
| 581 | + return valid_dsc_slicecount[i]; | |
| 582 | + } | |
| 583 | + | |
| 584 | + DRM_DEBUG_KMS("Unsupported Slice Count %d\n", min_slice_count); | |
| 585 | + return 0; | |
| 586 | +} | |
| 587 | + | |
| 497 | 588 | static enum drm_mode_status |
| 498 | 589 | intel_dp_mode_valid(struct drm_connector *connector, |
| 499 | 590 | struct drm_display_mode *mode) |
| @@ -2226,7 +2317,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 1726 unmodified lines | ||
| 2226 | 2317 | adjusted_mode->crtc_clock, |
| 2227 | 2318 | pipe_config->port_clock, |
| 2228 | 2319 | &pipe_config->dp_m_n, |
| 2229 | − constant_n); | |
| 2320 | + constant_n, pipe_config->fec_enable); | |
| 2230 | 2321 | |
| 2231 | 2322 | if (intel_connector->panel.downclock_mode != NULL && |
| 2232 | 2323 | dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) { |
| @@ -2236,7 +2327,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 3 unmodified lines | ||
| 2236 | 2327 | intel_connector->panel.downclock_mode->clock, |
| 2237 | 2328 | pipe_config->port_clock, |
| 2238 | 2329 | &pipe_config->dp_m2_n2, |
| 2239 | − constant_n); | |
| 2330 | + constant_n, pipe_config->fec_enable); | |
| 2240 | 2331 | } |
| 2241 | 2332 | |
| 2242 | 2333 | if (!HAS_DDI(dev_priv)) |
| @@ -4323,91 +4414,6 @@ intel_dp_get_sink_irq_esi(struct intel_dp *intel_dp, u8 *sink_irq_vector) · 2080 unmodified lines | ||
| 4323 | 4414 | DP_DPRX_ESI_LEN; |
| 4324 | 4415 | } |
| 4325 | 4416 | |
| 4326 | −u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count, | |
| 4327 | − int mode_clock, int mode_hdisplay) | |
| 4328 | −{ | |
| 4329 | − u16 bits_per_pixel, max_bpp_small_joiner_ram; | |
| 4330 | − int i; | |
| 4331 | − | |
| 4332 | − /* | |
| 4333 | − * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)* | |
| 4334 | − * (LinkSymbolClock)* 8 * ((100-FECOverhead)/100)*(TimeSlotsPerMTP) | |
| 4335 | − * FECOverhead = 2.4%, for SST -> TimeSlotsPerMTP is 1, | |
| 4336 | − * for MST -> TimeSlotsPerMTP has to be calculated | |
| 4337 | − */ | |
| 4338 | − bits_per_pixel = (link_clock * lane_count * 8 * | |
| 4339 | − DP_DSC_FEC_OVERHEAD_FACTOR) / | |
| 4340 | − mode_clock; | |
| 4341 | − | |
| 4342 | − /* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */ | |
| 4343 | − max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER / | |
| 4344 | − mode_hdisplay; | |
| 4345 | − | |
| 4346 | − /* | |
| 4347 | − * Greatest allowed DSC BPP = MIN (output BPP from avaialble Link BW | |
| 4348 | − * check, output bpp from small joiner RAM check) | |
| 4349 | − */ | |
| 4350 | − bits_per_pixel = min(bits_per_pixel, max_bpp_small_joiner_ram); | |
| 4351 | − | |
| 4352 | − /* Error out if the max bpp is less than smallest allowed valid bpp */ | |
| 4353 | − if (bits_per_pixel < valid_dsc_bpp[0]) { | |
| 4354 | − DRM_DEBUG_KMS("Unsupported BPP %d\n", bits_per_pixel); | |
| 4355 | − return 0; | |
| 4356 | − } | |
| 4357 | − | |
| 4358 | − /* Find the nearest match in the array of known BPPs from VESA */ | |
| 4359 | − for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp) - 1; i++) { | |
| 4360 | − if (bits_per_pixel < valid_dsc_bpp[i + 1]) | |
| 4361 | − break; | |
| 4362 | − } | |
| 4363 | − bits_per_pixel = valid_dsc_bpp[i]; | |
| 4364 | − | |
| 4365 | − /* | |
| 4366 | − * Compressed BPP in U6.4 format so multiply by 16, for Gen 11, | |
| 4367 | − * fractional part is 0 | |
| 4368 | − */ | |
| 4369 | − return bits_per_pixel << 4; | |
| 4370 | −} | |
| 4371 | − | |
| 4372 | −u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, | |
| 4373 | − int mode_clock, | |
| 4374 | − int mode_hdisplay) | |
| 4375 | −{ | |
| 4376 | − u8 min_slice_count, i; | |
| 4377 | − int max_slice_width; | |
| 4378 | − | |
| 4379 | − if (mode_clock <= DP_DSC_PEAK_PIXEL_RATE) | |
| 4380 | − min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 4381 | − DP_DSC_MAX_ENC_THROUGHPUT_0); | |
| 4382 | − else | |
| 4383 | − min_slice_count = DIV_ROUND_UP(mode_clock, | |
| 4384 | − DP_DSC_MAX_ENC_THROUGHPUT_1); | |
| 4385 | − | |
| 4386 | − max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd); | |
| 4387 | − if (max_slice_width < DP_DSC_MIN_SLICE_WIDTH_VALUE) { | |
| 4388 | − DRM_DEBUG_KMS("Unsupported slice width %d by DP DSC Sink device\n", | |
| 4389 | − max_slice_width); | |
| 4390 | − return 0; | |
| 4391 | − } | |
| 4392 | − /* Also take into account max slice width */ | |
| 4393 | − min_slice_count = min_t(u8, min_slice_count, | |
| 4394 | − DIV_ROUND_UP(mode_hdisplay, | |
| 4395 | − max_slice_width)); | |
| 4396 | − | |
| 4397 | − /* Find the closest match to the valid slice count values */ | |
| 4398 | − for (i = 0; i < ARRAY_SIZE(valid_dsc_slicecount); i++) { | |
| 4399 | − if (valid_dsc_slicecount[i] > | |
| 4400 | − drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, | |
| 4401 | − false)) | |
| 4402 | − break; | |
| 4403 | − if (min_slice_count <= valid_dsc_slicecount[i]) | |
| 4404 | − return valid_dsc_slicecount[i]; | |
| 4405 | − } | |
| 4406 | − | |
| 4407 | − DRM_DEBUG_KMS("Unsupported Slice Count %d\n", min_slice_count); | |
| 4408 | − return 0; | |
| 4409 | −} | |
| 4410 | − | |
| 4411 | 4417 | static void |
| 4412 | 4418 | intel_pixel_encoding_setup_vsc(struct intel_dp *intel_dp, |
| 4413 | 4419 | const struct intel_crtc_state *crtc_state) |
| @@ -102,10 +102,6 @@ bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp); · 101 unmodified lines | ||
| 102 | 102 | bool intel_dp_source_supports_hbr3(struct intel_dp *intel_dp); |
| 103 | 103 | bool |
| 104 | 104 | intel_dp_get_link_status(struct intel_dp *intel_dp, u8 *link_status); |
| 105 | −u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count, | |
| 106 | − int mode_clock, int mode_hdisplay); | |
| 107 | −u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, int mode_clock, | |
| 108 | − int mode_hdisplay); | |
| 109 | 105 | |
| 110 | 106 | bool intel_dp_read_dpcd(struct intel_dp *intel_dp); |
| 111 | 107 | bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp); |
| @@ -118,4 +114,6 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count) · 6 unmodified lines | ||
| 118 | 114 | return ~((1 << lane_count) - 1) & 0xf; |
| 119 | 115 | } |
| 120 | 116 | |
| 117 | +u32 intel_dp_mode_to_fec_clock(u32 mode_clock); | |
| 118 | + | |
| 121 | 119 | #endif /* __INTEL_DP_H__ */ |
| @@ -81,7 +81,7 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, · 80 unmodified lines | ||
| 81 | 81 | adjusted_mode->crtc_clock, |
| 82 | 82 | crtc_state->port_clock, |
| 83 | 83 | &crtc_state->dp_m_n, |
| 84 | − constant_n); | |
| 84 | + constant_n, crtc_state->fec_enable); | |
| 85 | 85 | crtc_state->dp_m_n.tu = slots; |
| 86 | 86 | |
| 87 | 87 | return 0; |
| @@ -615,7 +615,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum · 527 unmodified lines | ||
| 615 | 615 | intel_encoder->type = INTEL_OUTPUT_DP_MST; |
| 616 | 616 | intel_encoder->power_domain = intel_dig_port->base.power_domain; |
| 617 | 617 | intel_encoder->port = intel_dig_port->base.port; |
| 618 | − intel_encoder->crtc_mask = BIT(pipe); | |
| 618 | + intel_encoder->crtc_mask = 0x7; | |
| 619 | 619 | intel_encoder->cloneable = 0; |
| 620 | 620 | |
| 621 | 621 | intel_encoder->compute_config = intel_dp_mst_compute_config; |
| @@ -1528,6 +1528,7 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 1527 unmodified lines | ||
| 1528 | 1528 | int src_x, src_w, src_h, crtc_w, crtc_h; |
| 1529 | 1529 | const struct drm_display_mode *adjusted_mode = |
| 1530 | 1530 | &crtc_state->base.adjusted_mode; |
| 1531 | + unsigned int stride = plane_state->color_plane[0].stride; | |
| 1531 | 1532 | unsigned int cpp = fb->format->cpp[0]; |
| 1532 | 1533 | unsigned int width_bytes; |
| 1533 | 1534 | int min_width, min_height; |
| @@ -1569,9 +1570,9 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, · 35 unmodified lines | ||
| 1569 | 1570 | return -EINVAL; |
| 1570 | 1571 | } |
| 1571 | 1572 | |
| 1572 | − if (width_bytes > 4096 || fb->pitches[0] > 4096) { | |
| 1573 | + if (stride > 4096) { | |
| 1573 | 1574 | DRM_DEBUG_KMS("Stride (%u) exceeds hardware max with scaling (%u)\n", |
| 1574 | − fb->pitches[0], 4096); | |
| 1575 | + stride, 4096); | |
| 1575 | 1576 | return -EINVAL; |
| 1576 | 1577 | } |
| 1577 | 1578 | |
| @@ -1083,7 +1083,7 @@ static const struct dss_features omap34xx_dss_feats = { · 1082 unmodified lines | ||
| 1083 | 1083 | |
| 1084 | 1084 | static const struct dss_features omap3630_dss_feats = { |
| 1085 | 1085 | .model = DSS_MODEL_OMAP3, |
| 1086 | − .fck_div_max = 32, | |
| 1086 | + .fck_div_max = 31, | |
| 1087 | 1087 | .fck_freq_max = 173000000, |
| 1088 | 1088 | .dss_fck_multiplier = 1, |
| 1089 | 1089 | .parent_clk_name = "dpll4_ck", |
| @@ -147,7 +147,7 @@ static int rcar_du_wb_enc_atomic_check(struct drm_encoder *encoder, · 146 unmodified lines | ||
| 147 | 147 | struct drm_device *dev = encoder->dev; |
| 148 | 148 | struct drm_framebuffer *fb; |
| 149 | 149 | |
| 150 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 150 | + if (!conn_state->writeback_job) | |
| 151 | 151 | return 0; |
| 152 | 152 | |
| 153 | 153 | fb = conn_state->writeback_job->fb; |
| @@ -221,7 +221,7 @@ void rcar_du_writeback_setup(struct rcar_du_crtc *rcrtc, · 67 unmodified lines | ||
| 221 | 221 | unsigned int i; |
| 222 | 222 | |
| 223 | 223 | state = rcrtc->writeback.base.state; |
| 224 | − if (!state || !state->writeback_job || !state->writeback_job->fb) | |
| 224 | + if (!state || !state->writeback_job) | |
| 225 | 225 | return; |
| 226 | 226 | |
| 227 | 227 | fb = state->writeback_job->fb; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/gpio.h> |
| 8 | 8 | #include <linux/mod_devicetable.h> |
| 9 | 9 | #include <linux/of_gpio.h> |
| 10 | +#include <linux/pinctrl/consumer.h> | |
| 10 | 11 | #include <linux/platform_device.h> |
| 11 | 12 | |
| 12 | 13 | #include <drm/drm_atomic_helper.h> |
| @@ -231,7 +231,7 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn, · 230 unmodified lines | ||
| 231 | 231 | int i; |
| 232 | 232 | |
| 233 | 233 | conn_state = drm_atomic_get_new_connector_state(state, conn); |
| 234 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 234 | + if (!conn_state->writeback_job) | |
| 235 | 235 | return 0; |
| 236 | 236 | |
| 237 | 237 | crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); |
| @@ -271,8 +271,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn, · 33 unmodified lines | ||
| 271 | 271 | u32 ctrl; |
| 272 | 272 | int i; |
| 273 | 273 | |
| 274 | − if (WARN_ON(!conn_state->writeback_job || | |
| 275 | − !conn_state->writeback_job->fb)) | |
| 274 | + if (WARN_ON(!conn_state->writeback_job)) | |
| 276 | 275 | return; |
| 277 | 276 | |
| 278 | 277 | mode = &conn_state->crtc->state->adjusted_mode; |
| @@ -705,7 +705,7 @@ qca8k_setup(struct dsa_switch *ds) · 704 unmodified lines | ||
| 705 | 705 | BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); |
| 706 | 706 | |
| 707 | 707 | /* Setup connection between CPU port & user ports */ |
| 708 | − for (i = 0; i < DSA_MAX_PORTS; i++) { | |
| 708 | + for (i = 0; i < QCA8K_NUM_PORTS; i++) { | |
| 709 | 709 | /* CPU port gets connected to all user ports of the switch */ |
| 710 | 710 | if (dsa_is_cpu_port(ds, i)) { |
| 711 | 711 | qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), |
| @@ -1077,7 +1077,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) · 365 unmodified lines | ||
| 1077 | 1077 | if (id != QCA8K_ID_QCA8337) |
| 1078 | 1078 | return -ENODEV; |
| 1079 | 1079 | |
| 1080 | − priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS); | |
| 1080 | + priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS); | |
| 1081 | 1081 | if (!priv->ds) |
| 1082 | 1082 | return -ENOMEM; |
| 1083 | 1083 | |
| @@ -339,10 +339,12 @@ int rtl8366_vlan_prepare(struct dsa_switch *ds, int port, · 338 unmodified lines | ||
| 339 | 339 | const struct switchdev_obj_port_vlan *vlan) |
| 340 | 340 | { |
| 341 | 341 | struct realtek_smi *smi = ds->priv; |
| 342 | + u16 vid; | |
| 342 | 343 | int ret; |
| 343 | 344 | |
| 344 | − if (!smi->ops->is_vlan_valid(smi, port)) | |
| 345 | − return -EINVAL; | |
| 345 | + for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++) | |
| 346 | + if (!smi->ops->is_vlan_valid(smi, vid)) | |
| 347 | + return -EINVAL; | |
| 346 | 348 | |
| 347 | 349 | dev_info(smi->dev, "prepare VLANs %04x..%04x\n", |
| 348 | 350 | vlan->vid_begin, vlan->vid_end); |
| @@ -370,8 +372,9 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, · 21 unmodified lines | ||
| 370 | 372 | u16 vid; |
| 371 | 373 | int ret; |
| 372 | 374 | |
| 373 | − if (!smi->ops->is_vlan_valid(smi, port)) | |
| 374 | − return; | |
| 375 | + for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++) | |
| 376 | + if (!smi->ops->is_vlan_valid(smi, vid)) | |
| 377 | + return; | |
| 375 | 378 | |
| 376 | 379 | dev_info(smi->dev, "add VLAN on port %d, %s, %s\n", |
| 377 | 380 | port, |
| @@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 506 unmodified lines | ||
| 507 | 507 | irq = of_irq_get(intc, 0); |
| 508 | 508 | if (irq <= 0) { |
| 509 | 509 | dev_err(smi->dev, "failed to get parent IRQ\n"); |
| 510 | − return irq ? irq : -EINVAL; | |
| 510 | + ret = irq ? irq : -EINVAL; | |
| 511 | + goto out_put_node; | |
| 511 | 512 | } |
| 512 | 513 | |
| 513 | 514 | /* This clears the IRQ status register */ |
| @@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line | ||
| 515 | 516 | &val); |
| 516 | 517 | if (ret) { |
| 517 | 518 | dev_err(smi->dev, "can't read interrupt status\n"); |
| 518 | − return ret; | |
| 519 | + goto out_put_node; | |
| 519 | 520 | } |
| 520 | 521 | |
| 521 | 522 | /* Fetch IRQ edge information from the descriptor */ |
| @@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 15 unmodified lines | ||
| 537 | 538 | val); |
| 538 | 539 | if (ret) { |
| 539 | 540 | dev_err(smi->dev, "could not configure IRQ polarity\n"); |
| 540 | − return ret; | |
| 541 | + goto out_put_node; | |
| 541 | 542 | } |
| 542 | 543 | |
| 543 | 544 | ret = devm_request_threaded_irq(smi->dev, irq, NULL, |
| @@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line | ||
| 545 | 546 | "RTL8366RB", smi); |
| 546 | 547 | if (ret) { |
| 547 | 548 | dev_err(smi->dev, "unable to request irq: %d\n", ret); |
| 548 | − return ret; | |
| 549 | + goto out_put_node; | |
| 549 | 550 | } |
| 550 | 551 | smi->irqdomain = irq_domain_add_linear(intc, |
| 551 | 552 | RTL8366RB_NUM_INTERRUPT, |
| @@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) · 1 unmodified line | ||
| 553 | 554 | smi); |
| 554 | 555 | if (!smi->irqdomain) { |
| 555 | 556 | dev_err(smi->dev, "failed to create IRQ domain\n"); |
| 556 | − return -EINVAL; | |
| 557 | + ret = -EINVAL; | |
| 558 | + goto out_put_node; | |
| 557 | 559 | } |
| 558 | 560 | for (i = 0; i < smi->num_ports; i++) |
| 559 | 561 | irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq); |
| 560 | 562 | |
| 561 | − return 0; | |
| 563 | +out_put_node: | |
| 564 | + of_node_put(intc); | |
| 565 | + return ret; | |
| 562 | 566 | } |
| 563 | 567 | |
| 564 | 568 | static int rtl8366rb_set_addr(struct realtek_smi *smi) |
| @@ -1897,7 +1897,9 @@ static int sja1105_set_ageing_time(struct dsa_switch *ds, · 1896 unmodified lines | ||
| 1897 | 1897 | return sja1105_static_config_reload(priv); |
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | −/* Caller must hold priv->tagger_data.meta_lock */ | |
| 1900 | +/* Must be called only with priv->tagger_data.state bit | |
| 1901 | + * SJA1105_HWTS_RX_EN cleared | |
| 1902 | + */ | |
| 1901 | 1903 | static int sja1105_change_rxtstamping(struct sja1105_private *priv, |
| 1902 | 1904 | bool on) |
| 1903 | 1905 | { |
| @@ -1954,16 +1956,17 @@ static int sja1105_hwtstamp_set(struct dsa_switch *ds, int port, · 50 unmodified lines | ||
| 1954 | 1956 | break; |
| 1955 | 1957 | } |
| 1956 | 1958 | |
| 1957 | − if (rx_on != priv->tagger_data.hwts_rx_en) { | |
| 1958 | − spin_lock(&priv->tagger_data.meta_lock); | |
| 1959 | + if (rx_on != test_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state)) { | |
| 1960 | + clear_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state); | |
| 1961 | + | |
| 1959 | 1962 | rc = sja1105_change_rxtstamping(priv, rx_on); |
| 1960 | − spin_unlock(&priv->tagger_data.meta_lock); | |
| 1961 | 1963 | if (rc < 0) { |
| 1962 | 1964 | dev_err(ds->dev, |
| 1963 | 1965 | "Failed to change RX timestamping: %d\n", rc); |
| 1964 | − return -EFAULT; | |
| 1966 | + return rc; | |
| 1965 | 1967 | } |
| 1966 | − priv->tagger_data.hwts_rx_en = rx_on; | |
| 1968 | + if (rx_on) | |
| 1969 | + set_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state); | |
| 1967 | 1970 | } |
| 1968 | 1971 | |
| 1969 | 1972 | if (copy_to_user(ifr->ifr_data, &config, sizeof(config))) |
| @@ -1982,7 +1985,7 @@ static int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, · 12 unmodified lines | ||
| 1982 | 1985 | config.tx_type = HWTSTAMP_TX_ON; |
| 1983 | 1986 | else |
| 1984 | 1987 | config.tx_type = HWTSTAMP_TX_OFF; |
| 1985 | − if (priv->tagger_data.hwts_rx_en) | |
| 1988 | + if (test_bit(SJA1105_HWTS_RX_EN, &priv->tagger_data.state)) | |
| 1986 | 1989 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; |
| 1987 | 1990 | else |
| 1988 | 1991 | config.rx_filter = HWTSTAMP_FILTER_NONE; |
| @@ -2005,12 +2008,12 @@ static void sja1105_rxtstamp_work(struct work_struct *work) · 16 unmodified lines | ||
| 2005 | 2008 | |
| 2006 | 2009 | mutex_lock(&priv->ptp_lock); |
| 2007 | 2010 | |
| 2008 | − now = priv->tstamp_cc.read(&priv->tstamp_cc); | |
| 2009 | − | |
| 2010 | 2011 | while ((skb = skb_dequeue(&data->skb_rxtstamp_queue)) != NULL) { |
| 2011 | 2012 | struct skb_shared_hwtstamps *shwt = skb_hwtstamps(skb); |
| 2012 | 2013 | u64 ts; |
| 2013 | 2014 | |
| 2015 | + now = priv->tstamp_cc.read(&priv->tstamp_cc); | |
| 2016 | + | |
| 2014 | 2017 | *shwt = (struct skb_shared_hwtstamps) {0}; |
| 2015 | 2018 | |
| 2016 | 2019 | ts = SJA1105_SKB_CB(skb)->meta_tstamp; |
| @@ -2031,7 +2034,7 @@ static bool sja1105_port_rxtstamp(struct dsa_switch *ds, int port, · 14 unmodified lines | ||
| 2031 | 2034 | struct sja1105_private *priv = ds->priv; |
| 2032 | 2035 | struct sja1105_tagger_data *data = &priv->tagger_data; |
| 2033 | 2036 | |
| 2034 | − if (!data->hwts_rx_en) | |
| 2037 | + if (!test_bit(SJA1105_HWTS_RX_EN, &data->state)) | |
| 2035 | 2038 | return false; |
| 2036 | 2039 | |
| 2037 | 2040 | /* We need to read the full PTP clock to reconstruct the Rx |
| @@ -2201,6 +2204,7 @@ static int sja1105_probe(struct spi_device *spi) · 163 unmodified lines | ||
| 2201 | 2204 | tagger_data = &priv->tagger_data; |
| 2202 | 2205 | skb_queue_head_init(&tagger_data->skb_rxtstamp_queue); |
| 2203 | 2206 | INIT_WORK(&tagger_data->rxtstamp_work, sja1105_rxtstamp_work); |
| 2207 | + spin_lock_init(&tagger_data->meta_lock); | |
| 2204 | 2208 | |
| 2205 | 2209 | /* Connections between dsa_port and sja1105_port */ |
| 2206 | 2210 | for (i = 0; i < SJA1105_NUM_PORTS; i++) { |
| @@ -409,7 +409,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv) · 408 unmodified lines | ||
| 409 | 409 | rc = static_config_buf_prepare_for_upload(priv, config_buf, buf_len); |
| 410 | 410 | if (rc < 0) { |
| 411 | 411 | dev_err(dev, "Invalid config, cannot upload\n"); |
| 412 | − return -EINVAL; | |
| 412 | + rc = -EINVAL; | |
| 413 | + goto out; | |
| 413 | 414 | } |
| 414 | 415 | /* Prevent PHY jabbering during switch reset by inhibiting |
| 415 | 416 | * Tx on all ports and waiting for current packet to drain. |
| @@ -418,7 +419,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv) · 2 unmodified lines | ||
| 418 | 419 | rc = sja1105_inhibit_tx(priv, port_bitmap, true); |
| 419 | 420 | if (rc < 0) { |
| 420 | 421 | dev_err(dev, "Failed to inhibit Tx on ports\n"); |
| 421 | − return -ENXIO; | |
| 422 | + rc = -ENXIO; | |
| 423 | + goto out; | |
| 422 | 424 | } |
| 423 | 425 | /* Wait for an eventual egress packet to finish transmission |
| 424 | 426 | * (reach IFG). It is guaranteed that a second one will not |
| @@ -526,7 +526,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) · 525 unmodified lines | ||
| 526 | 526 | struct device *dev = &ag->pdev->dev; |
| 527 | 527 | struct net_device *ndev = ag->ndev; |
| 528 | 528 | static struct mii_bus *mii_bus; |
| 529 | − struct device_node *np; | |
| 529 | + struct device_node *np, *mnp; | |
| 530 | 530 | int err; |
| 531 | 531 | |
| 532 | 532 | np = dev->of_node; |
| @@ -571,7 +571,9 @@ static int ag71xx_mdio_probe(struct ag71xx *ag) · 38 unmodified lines | ||
| 571 | 571 | msleep(200); |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | − err = of_mdiobus_register(mii_bus, np); | |
| 574 | + mnp = of_get_child_by_name(np, "mdio"); | |
| 575 | + err = of_mdiobus_register(mii_bus, mnp); | |
| 576 | + of_node_put(mnp); | |
| 575 | 577 | if (err) |
| 576 | 578 | goto mdio_err_put_clk; |
| 577 | 579 | |
| @@ -137,13 +137,12 @@ static int uldrx_handler(struct sge_rspq *q, const __be64 *rsp, · 136 unmodified lines | ||
| 137 | 137 | static int alloc_uld_rxqs(struct adapter *adap, |
| 138 | 138 | struct sge_uld_rxq_info *rxq_info, bool lro) |
| 139 | 139 | { |
| 140 | − struct sge *s = &adap->sge; | |
| 141 | 140 | unsigned int nq = rxq_info->nrxq + rxq_info->nciq; |
| 141 | + int i, err, msi_idx, que_idx = 0, bmap_idx = 0; | |
| 142 | 142 | struct sge_ofld_rxq *q = rxq_info->uldrxq; |
| 143 | 143 | unsigned short *ids = rxq_info->rspq_id; |
| 144 | − unsigned int bmap_idx = 0; | |
| 144 | + struct sge *s = &adap->sge; | |
| 145 | 145 | unsigned int per_chan; |
| 146 | − int i, err, msi_idx, que_idx = 0; | |
| 147 | 146 | |
| 148 | 147 | per_chan = rxq_info->nrxq / adap->params.nports; |
| 149 | 148 | |
| @@ -161,6 +160,10 @@ static int alloc_uld_rxqs(struct adapter *adap, · 11 unmodified lines | ||
| 161 | 160 | |
| 162 | 161 | if (msi_idx >= 0) { |
| 163 | 162 | bmap_idx = get_msix_idx_from_bmap(adap); |
| 163 | + if (bmap_idx < 0) { | |
| 164 | + err = -ENOSPC; | |
| 165 | + goto freeout; | |
| 166 | + } | |
| 164 | 167 | msi_idx = adap->msix_info_ulds[bmap_idx].idx; |
| 165 | 168 | } |
| 166 | 169 | err = t4_sge_alloc_rxq(adap, &q->rspq, false, |
| @@ -148,11 +148,15 @@ static int mdio_sc_cfg_reg_write(struct hns_mdio_device *mdio_dev, · 147 unmodified lines | ||
| 148 | 148 | { |
| 149 | 149 | u32 time_cnt; |
| 150 | 150 | u32 reg_value; |
| 151 | + int ret; | |
| 151 | 152 | |
| 152 | 153 | regmap_write(mdio_dev->subctrl_vbase, cfg_reg, set_val); |
| 153 | 154 | |
| 154 | 155 | for (time_cnt = MDIO_TIMEOUT; time_cnt; time_cnt--) { |
| 155 | − regmap_read(mdio_dev->subctrl_vbase, st_reg, ®_value); | |
| 156 | + ret = regmap_read(mdio_dev->subctrl_vbase, st_reg, ®_value); | |
| 157 | + if (ret) | |
| 158 | + return ret; | |
| 159 | + | |
| 156 | 160 | reg_value &= st_msk; |
| 157 | 161 | if ((!!check_st) == (!!reg_value)) |
| 158 | 162 | break; |
| @@ -137,7 +137,8 @@ dr_icm_pool_mr_create(struct mlx5dr_icm_pool *pool, · 136 unmodified lines | ||
| 137 | 137 | |
| 138 | 138 | icm_mr->icm_start_addr = icm_mr->dm.addr; |
| 139 | 139 | |
| 140 | − align_diff = icm_mr->icm_start_addr % align_base; | |
| 140 | + /* align_base is always a power of 2 */ | |
| 141 | + align_diff = icm_mr->icm_start_addr & (align_base - 1); | |
| 141 | 142 | if (align_diff) |
| 142 | 143 | icm_mr->used_length = align_base - align_diff; |
| 143 | 144 | |
| @@ -388,13 +388,14 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 387 unmodified lines | ||
| 388 | 388 | continue; |
| 389 | 389 | |
| 390 | 390 | phy = of_phy_find_device(phy_node); |
| 391 | + of_node_put(phy_node); | |
| 391 | 392 | if (!phy) |
| 392 | 393 | continue; |
| 393 | 394 | |
| 394 | 395 | err = ocelot_probe_port(ocelot, port, regs, phy); |
| 395 | 396 | if (err) { |
| 396 | 397 | of_node_put(portnp); |
| 397 | − return err; | |
| 398 | + goto out_put_ports; | |
| 398 | 399 | } |
| 399 | 400 | |
| 400 | 401 | phy_mode = of_get_phy_mode(portnp); |
| @@ -422,7 +423,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 21 unmodified lines | ||
| 422 | 423 | "invalid phy mode for port%d, (Q)SGMII only\n", |
| 423 | 424 | port); |
| 424 | 425 | of_node_put(portnp); |
| 425 | − return -EINVAL; | |
| 426 | + err = -EINVAL; | |
| 427 | + goto out_put_ports; | |
| 426 | 428 | } |
| 427 | 429 | |
| 428 | 430 | serdes = devm_of_phy_get(ocelot->dev, portnp, NULL); |
| @@ -435,7 +437,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 435 | 437 | "missing SerDes phys for port%d\n", |
| 436 | 438 | port); |
| 437 | 439 | |
| 438 | − goto err_probe_ports; | |
| 440 | + of_node_put(portnp); | |
| 441 | + goto out_put_ports; | |
| 439 | 442 | } |
| 440 | 443 | |
| 441 | 444 | ocelot->ports[port]->serdes = serdes; |
| @@ -447,9 +450,8 @@ static int mscc_ocelot_probe(struct platform_device *pdev) · 5 unmodified lines | ||
| 447 | 450 | |
| 448 | 451 | dev_info(&pdev->dev, "Ocelot switch probed\n"); |
| 449 | 452 | |
| 450 | − return 0; | |
| 451 | − | |
| 452 | −err_probe_ports: | |
| 453 | +out_put_ports: | |
| 454 | + of_node_put(ports); | |
| 453 | 455 | return err; |
| 454 | 456 | } |
| 455 | 457 | |
| @@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO · 19 unmodified lines | ||
| 20 | 20 | config IONIC |
| 21 | 21 | tristate "Pensando Ethernet IONIC Support" |
| 22 | 22 | depends on 64BIT && PCI |
| 23 | + select NET_DEVLINK | |
| 23 | 24 | help |
| 24 | 25 | This enables the support for the Pensando family of Ethernet |
| 25 | 26 | adapters. More specific information on this driver can be |
| @@ -2787,6 +2787,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev) · 2786 unmodified lines | ||
| 2787 | 2787 | netdev_err(qdev->ndev, |
| 2788 | 2788 | "PCI mapping failed with error: %d\n", |
| 2789 | 2789 | err); |
| 2790 | + dev_kfree_skb_irq(skb); | |
| 2790 | 2791 | ql_free_large_buffers(qdev); |
| 2791 | 2792 | return -ENOMEM; |
| 2792 | 2793 | } |
| @@ -282,7 +282,6 @@ struct netsec_desc_ring { · 281 unmodified lines | ||
| 282 | 282 | void *vaddr; |
| 283 | 283 | u16 head, tail; |
| 284 | 284 | u16 xdp_xmit; /* netsec_xdp_xmit packets */ |
| 285 | − bool is_xdp; | |
| 286 | 285 | struct page_pool *page_pool; |
| 287 | 286 | struct xdp_rxq_info xdp_rxq; |
| 288 | 287 | spinlock_t lock; /* XDP tx queue locking */ |
| @@ -634,8 +633,7 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv) · 345 unmodified lines | ||
| 634 | 633 | unsigned int bytes; |
| 635 | 634 | int cnt = 0; |
| 636 | 635 | |
| 637 | − if (dring->is_xdp) | |
| 638 | − spin_lock(&dring->lock); | |
| 636 | + spin_lock(&dring->lock); | |
| 639 | 637 | |
| 640 | 638 | bytes = 0; |
| 641 | 639 | entry = dring->vaddr + DESC_SZ * tail; |
| @@ -682,8 +680,8 @@ next: · 40 unmodified lines | ||
| 682 | 680 | entry = dring->vaddr + DESC_SZ * tail; |
| 683 | 681 | cnt++; |
| 684 | 682 | } |
| 685 | − if (dring->is_xdp) | |
| 686 | − spin_unlock(&dring->lock); | |
| 683 | + | |
| 684 | + spin_unlock(&dring->lock); | |
| 687 | 685 | |
| 688 | 686 | if (!cnt) |
| 689 | 687 | return false; |
| @@ -799,9 +797,6 @@ static void netsec_set_tx_de(struct netsec_priv *priv, · 109 unmodified lines | ||
| 799 | 797 | de->data_buf_addr_lw = lower_32_bits(desc->dma_addr); |
| 800 | 798 | de->buf_len_info = (tx_ctrl->tcp_seg_len << 16) | desc->len; |
| 801 | 799 | de->attr = attr; |
| 802 | − /* under spin_lock if using XDP */ | |
| 803 | − if (!dring->is_xdp) | |
| 804 | − dma_wmb(); | |
| 805 | 800 | |
| 806 | 801 | dring->desc[idx] = *desc; |
| 807 | 802 | if (desc->buf_type == TYPE_NETSEC_SKB) |
| @@ -1123,12 +1118,10 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 315 unmodified lines | ||
| 1123 | 1118 | u16 tso_seg_len = 0; |
| 1124 | 1119 | int filled; |
| 1125 | 1120 | |
| 1126 | − if (dring->is_xdp) | |
| 1127 | − spin_lock_bh(&dring->lock); | |
| 1121 | + spin_lock_bh(&dring->lock); | |
| 1128 | 1122 | filled = netsec_desc_used(dring); |
| 1129 | 1123 | if (netsec_check_stop_tx(priv, filled)) { |
| 1130 | − if (dring->is_xdp) | |
| 1131 | − spin_unlock_bh(&dring->lock); | |
| 1124 | + spin_unlock_bh(&dring->lock); | |
| 1132 | 1125 | net_warn_ratelimited("%s %s Tx queue full\n", |
| 1133 | 1126 | dev_name(priv->dev), ndev->name); |
| 1134 | 1127 | return NETDEV_TX_BUSY; |
| @@ -1161,8 +1154,7 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 26 unmodified lines | ||
| 1161 | 1154 | tx_desc.dma_addr = dma_map_single(priv->dev, skb->data, |
| 1162 | 1155 | skb_headlen(skb), DMA_TO_DEVICE); |
| 1163 | 1156 | if (dma_mapping_error(priv->dev, tx_desc.dma_addr)) { |
| 1164 | − if (dring->is_xdp) | |
| 1165 | − spin_unlock_bh(&dring->lock); | |
| 1157 | + spin_unlock_bh(&dring->lock); | |
| 1166 | 1158 | netif_err(priv, drv, priv->ndev, |
| 1167 | 1159 | "%s: DMA mapping failed\n", __func__); |
| 1168 | 1160 | ndev->stats.tx_dropped++; |
| @@ -1177,8 +1169,7 @@ static netdev_tx_t netsec_netdev_start_xmit(struct sk_buff *skb, · 8 unmodified lines | ||
| 1177 | 1169 | netdev_sent_queue(priv->ndev, skb->len); |
| 1178 | 1170 | |
| 1179 | 1171 | netsec_set_tx_de(priv, dring, &tx_ctrl, &tx_desc, skb); |
| 1180 | − if (dring->is_xdp) | |
| 1181 | − spin_unlock_bh(&dring->lock); | |
| 1172 | + spin_unlock_bh(&dring->lock); | |
| 1182 | 1173 | netsec_write(priv, NETSEC_REG_NRM_TX_PKTCNT, 1); /* submit another tx */ |
| 1183 | 1174 | |
| 1184 | 1175 | return NETDEV_TX_OK; |
| @@ -1262,7 +1253,6 @@ err: · 77 unmodified lines | ||
| 1262 | 1253 | static void netsec_setup_tx_dring(struct netsec_priv *priv) |
| 1263 | 1254 | { |
| 1264 | 1255 | struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_TX]; |
| 1265 | − struct bpf_prog *xdp_prog = READ_ONCE(priv->xdp_prog); | |
| 1266 | 1256 | int i; |
| 1267 | 1257 | |
| 1268 | 1258 | for (i = 0; i < DESC_NUM; i++) { |
| @@ -1275,12 +1265,6 @@ static void netsec_setup_tx_dring(struct netsec_priv *priv) · 6 unmodified lines | ||
| 1275 | 1265 | */ |
| 1276 | 1266 | de->attr = 1U << NETSEC_TX_SHIFT_OWN_FIELD; |
| 1277 | 1267 | } |
| 1278 | − | |
| 1279 | − if (xdp_prog) | |
| 1280 | − dring->is_xdp = true; | |
| 1281 | − else | |
| 1282 | − dring->is_xdp = false; | |
| 1283 | − | |
| 1284 | 1268 | } |
| 1285 | 1269 | |
| 1286 | 1270 | static int netsec_setup_rx_dring(struct netsec_priv *priv) |
| @@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 400 unmodified lines | ||
| 401 | 401 | int numhashregs = (hw->multicast_filter_bins >> 5); |
| 402 | 402 | int mcbitslog2 = hw->mcast_bits_log2; |
| 403 | 403 | unsigned int value; |
| 404 | + u32 mc_filter[8]; | |
| 404 | 405 | int i; |
| 405 | 406 | |
| 407 | + memset(mc_filter, 0, sizeof(mc_filter)); | |
| 408 | + | |
| 406 | 409 | value = readl(ioaddr + GMAC_PACKET_FILTER); |
| 407 | 410 | value &= ~GMAC_PACKET_FILTER_HMC; |
| 408 | 411 | value &= ~GMAC_PACKET_FILTER_HPF; |
| @@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 7 unmodified lines | ||
| 416 | 419 | /* Pass all multi */ |
| 417 | 420 | value |= GMAC_PACKET_FILTER_PM; |
| 418 | 421 | /* Set all the bits of the HASH tab */ |
| 419 | − for (i = 0; i < numhashregs; i++) | |
| 420 | − writel(0xffffffff, ioaddr + GMAC_HASH_TAB(i)); | |
| 422 | + memset(mc_filter, 0xff, sizeof(mc_filter)); | |
| 421 | 423 | } else if (!netdev_mc_empty(dev)) { |
| 422 | 424 | struct netdev_hw_addr *ha; |
| 423 | − u32 mc_filter[8]; | |
| 424 | 425 | |
| 425 | 426 | /* Hash filter for multicast */ |
| 426 | 427 | value |= GMAC_PACKET_FILTER_HMC; |
| 427 | 428 | |
| 428 | − memset(mc_filter, 0, sizeof(mc_filter)); | |
| 429 | 429 | netdev_for_each_mc_addr(ha, dev) { |
| 430 | 430 | /* The upper n bits of the calculated CRC are used to |
| 431 | 431 | * index the contents of the hash table. The number of |
| @@ -440,10 +440,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 8 unmodified lines | ||
| 440 | 440 | */ |
| 441 | 441 | mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f)); |
| 442 | 442 | } |
| 443 | − for (i = 0; i < numhashregs; i++) | |
| 444 | − writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i)); | |
| 445 | 443 | } |
| 446 | 444 | |
| 445 | + for (i = 0; i < numhashregs; i++) | |
| 446 | + writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i)); | |
| 447 | + | |
| 447 | 448 | value |= GMAC_PACKET_FILTER_HPF; |
| 448 | 449 | |
| 449 | 450 | /* Handle multiple unicast addresses */ |
| @@ -84,7 +84,7 @@ · 83 unmodified lines | ||
| 84 | 84 | #define XGMAC_TSIE BIT(12) |
| 85 | 85 | #define XGMAC_LPIIE BIT(5) |
| 86 | 86 | #define XGMAC_PMTIE BIT(4) |
| 87 | −#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE | XGMAC_TSIE) | |
| 87 | +#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE) | |
| 88 | 88 | #define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4) |
| 89 | 89 | #define XGMAC_PT GENMASK(31, 16) |
| 90 | 90 | #define XGMAC_PT_SHIFT 16 |
| @@ -122,6 +122,7 @@ · 31 unmodified lines | ||
| 122 | 122 | #define XGMAC_HWFEAT_GMIISEL BIT(1) |
| 123 | 123 | #define XGMAC_HW_FEATURE1 0x00000120 |
| 124 | 124 | #define XGMAC_HWFEAT_L3L4FNUM GENMASK(30, 27) |
| 125 | +#define XGMAC_HWFEAT_HASHTBLSZ GENMASK(25, 24) | |
| 125 | 126 | #define XGMAC_HWFEAT_RSSEN BIT(20) |
| 126 | 127 | #define XGMAC_HWFEAT_TSOEN BIT(18) |
| 127 | 128 | #define XGMAC_HWFEAT_SPHEN BIT(17) |
| @@ -472,7 +472,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, · 471 unmodified lines | ||
| 472 | 472 | dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2); |
| 473 | 473 | |
| 474 | 474 | /* Handle multiple unicast addresses */ |
| 475 | − if (netdev_uc_count(dev) > XGMAC_ADDR_MAX) { | |
| 475 | + if (netdev_uc_count(dev) > hw->unicast_filter_entries) { | |
| 476 | 476 | value |= XGMAC_FILTER_PR; |
| 477 | 477 | } else { |
| 478 | 478 | struct netdev_hw_addr *ha; |
| @@ -523,8 +523,8 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, · 44 unmodified lines | ||
| 523 | 523 | struct stmmac_rss *cfg, u32 num_rxq) |
| 524 | 524 | { |
| 525 | 525 | void __iomem *ioaddr = hw->pcsr; |
| 526 | + u32 value, *key; | |
| 526 | 527 | int i, ret; |
| 527 | − u32 value; | |
| 528 | 528 | |
| 529 | 529 | value = readl(ioaddr + XGMAC_RSS_CTRL); |
| 530 | 530 | if (!cfg || !cfg->enable) { |
| @@ -533,8 +533,9 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, · 2 unmodified lines | ||
| 533 | 533 | return 0; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | − for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) { | |
| 537 | − ret = dwxgmac2_rss_write_reg(ioaddr, true, i, cfg->key[i]); | |
| 536 | + key = (u32 *)cfg->key; | |
| 537 | + for (i = 0; i < (ARRAY_SIZE(cfg->key) / sizeof(u32)); i++) { | |
| 538 | + ret = dwxgmac2_rss_write_reg(ioaddr, true, i, key[i]); | |
| 538 | 539 | if (ret) |
| 539 | 540 | return ret; |
| 540 | 541 | } |
| @@ -380,6 +380,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, · 379 unmodified lines | ||
| 380 | 380 | /* MAC HW feature 1 */ |
| 381 | 381 | hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1); |
| 382 | 382 | dma_cap->l3l4fnum = (hw_cap & XGMAC_HWFEAT_L3L4FNUM) >> 27; |
| 383 | + dma_cap->hash_tb_sz = (hw_cap & XGMAC_HWFEAT_HASHTBLSZ) >> 24; | |
| 383 | 384 | dma_cap->rssen = (hw_cap & XGMAC_HWFEAT_RSSEN) >> 20; |
| 384 | 385 | dma_cap->tsoen = (hw_cap & XGMAC_HWFEAT_TSOEN) >> 18; |
| 385 | 386 | dma_cap->sphen = (hw_cap & XGMAC_HWFEAT_SPHEN) >> 17; |
| @@ -629,6 +629,7 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) · 628 unmodified lines | ||
| 629 | 629 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
| 630 | 630 | ptp_v2 = PTP_TCR_TSVER2ENA; |
| 631 | 631 | snap_type_sel = PTP_TCR_SNAPTYPSEL_1; |
| 632 | + ts_event_en = PTP_TCR_TSEVNTENA; | |
| 632 | 633 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 633 | 634 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| 634 | 635 | ptp_over_ethernet = PTP_TCR_TSIPENA; |
| @@ -4715,11 +4716,9 @@ int stmmac_suspend(struct device *dev) · 4080 unmodified lines | ||
| 4715 | 4716 | if (!ndev || !netif_running(ndev)) |
| 4716 | 4717 | return 0; |
| 4717 | 4718 | |
| 4718 | − mutex_lock(&priv->lock); | |
| 4719 | + phylink_mac_change(priv->phylink, false); | |
| 4719 | 4720 | |
| 4720 | − rtnl_lock(); | |
| 4721 | − phylink_stop(priv->phylink); | |
| 4722 | − rtnl_unlock(); | |
| 4721 | + mutex_lock(&priv->lock); | |
| 4723 | 4722 | |
| 4724 | 4723 | netif_device_detach(ndev); |
| 4725 | 4724 | stmmac_stop_all_queues(priv); |
| @@ -4734,6 +4733,12 @@ int stmmac_suspend(struct device *dev) · 8 unmodified lines | ||
| 4734 | 4733 | stmmac_pmt(priv, priv->hw, priv->wolopts); |
| 4735 | 4734 | priv->irq_wake = 1; |
| 4736 | 4735 | } else { |
| 4736 | + mutex_unlock(&priv->lock); | |
| 4737 | + rtnl_lock(); | |
| 4738 | + phylink_stop(priv->phylink); | |
| 4739 | + rtnl_unlock(); | |
| 4740 | + mutex_lock(&priv->lock); | |
| 4741 | + | |
| 4737 | 4742 | stmmac_mac_set(priv, priv->ioaddr, false); |
| 4738 | 4743 | pinctrl_pm_select_sleep_state(priv->device); |
| 4739 | 4744 | /* Disable clock in case of PWM is off */ |
| @@ -4824,12 +4829,16 @@ int stmmac_resume(struct device *dev) · 84 unmodified lines | ||
| 4824 | 4829 | |
| 4825 | 4830 | stmmac_start_all_queues(priv); |
| 4826 | 4831 | |
| 4827 | − rtnl_lock(); | |
| 4828 | − phylink_start(priv->phylink); | |
| 4829 | − rtnl_unlock(); | |
| 4830 | − | |
| 4831 | 4832 | mutex_unlock(&priv->lock); |
| 4832 | 4833 | |
| 4834 | + if (!device_may_wakeup(priv->device)) { | |
| 4835 | + rtnl_lock(); | |
| 4836 | + phylink_start(priv->phylink); | |
| 4837 | + rtnl_unlock(); | |
| 4838 | + } | |
| 4839 | + | |
| 4840 | + phylink_mac_change(priv->phylink, true); | |
| 4841 | + | |
| 4833 | 4842 | return 0; |
| 4834 | 4843 | } |
| 4835 | 4844 | EXPORT_SYMBOL_GPL(stmmac_resume); |
| @@ -1564,10 +1564,6 @@ static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue) · 1563 unmodified lines | ||
| 1564 | 1564 | struct stmmac_packet_attrs attr = { }; |
| 1565 | 1565 | int size = priv->dma_buf_sz; |
| 1566 | 1566 | |
| 1567 | − /* Only XGMAC has SW support for multiple RX descs in same packet */ | |
| 1568 | − if (priv->plat->has_xgmac) | |
| 1569 | − size = priv->dev->max_mtu; | |
| 1570 | − | |
| 1571 | 1567 | attr.dst = priv->dev->dev_addr; |
| 1572 | 1568 | attr.max_size = size - ETH_FCS_LEN; |
| 1573 | 1569 | attr.queue_mapping = queue; |
| @@ -1137,10 +1137,11 @@ static void atusb_disconnect(struct usb_interface *interface) · 1136 unmodified lines | ||
| 1137 | 1137 | |
| 1138 | 1138 | ieee802154_unregister_hw(atusb->hw); |
| 1139 | 1139 | |
| 1140 | + usb_put_dev(atusb->usb_dev); | |
| 1141 | + | |
| 1140 | 1142 | ieee802154_free_hw(atusb->hw); |
| 1141 | 1143 | |
| 1142 | 1144 | usb_set_intfdata(interface, NULL); |
| 1143 | − usb_put_dev(atusb->usb_dev); | |
| 1144 | 1145 | |
| 1145 | 1146 | pr_debug("%s done\n", __func__); |
| 1146 | 1147 | } |
| @@ -3145,12 +3145,12 @@ static int ca8210_probe(struct spi_device *spi_device) · 3144 unmodified lines | ||
| 3145 | 3145 | goto error; |
| 3146 | 3146 | } |
| 3147 | 3147 | |
| 3148 | + priv->spi->dev.platform_data = pdata; | |
| 3148 | 3149 | ret = ca8210_get_platform_data(priv->spi, pdata); |
| 3149 | 3150 | if (ret) { |
| 3150 | 3151 | dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n"); |
| 3151 | 3152 | goto error; |
| 3152 | 3153 | } |
| 3153 | − priv->spi->dev.platform_data = pdata; | |
| 3154 | 3154 | |
| 3155 | 3155 | ret = ca8210_dev_com_init(priv); |
| 3156 | 3156 | if (ret) { |
| @@ -800,7 +800,7 @@ mcr20a_handle_rx_read_buf_complete(void *context) · 799 unmodified lines | ||
| 800 | 800 | if (!skb) |
| 801 | 801 | return; |
| 802 | 802 | |
| 803 | − memcpy(skb_put(skb, len), lp->rx_buf, len); | |
| 803 | + __skb_put_data(skb, lp->rx_buf, len); | |
| 804 | 804 | ieee802154_rx_irqsafe(lp->hw, skb, lp->rx_lqi[0]); |
| 805 | 805 | |
| 806 | 806 | print_hex_dump_debug("mcr20a rx: ", DUMP_PREFIX_OFFSET, 16, 1, |
| @@ -15,6 +15,15 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/of_gpio.h> |
| 16 | 16 | #include <linux/gpio/consumer.h> |
| 17 | 17 | |
| 18 | +#define AT803X_SPECIFIC_STATUS 0x11 | |
| 19 | +#define AT803X_SS_SPEED_MASK (3 << 14) | |
| 20 | +#define AT803X_SS_SPEED_1000 (2 << 14) | |
| 21 | +#define AT803X_SS_SPEED_100 (1 << 14) | |
| 22 | +#define AT803X_SS_SPEED_10 (0 << 14) | |
| 23 | +#define AT803X_SS_DUPLEX BIT(13) | |
| 24 | +#define AT803X_SS_SPEED_DUPLEX_RESOLVED BIT(11) | |
| 25 | +#define AT803X_SS_MDIX BIT(6) | |
| 26 | + | |
| 18 | 27 | #define AT803X_INTR_ENABLE 0x12 |
| 19 | 28 | #define AT803X_INTR_ENABLE_AUTONEG_ERR BIT(15) |
| 20 | 29 | #define AT803X_INTR_ENABLE_SPEED_CHANGED BIT(14) |
| @@ -357,6 +366,64 @@ static int at803x_aneg_done(struct phy_device *phydev) · 336 unmodified lines | ||
| 357 | 366 | return aneg_done; |
| 358 | 367 | } |
| 359 | 368 | |
| 369 | +static int at803x_read_status(struct phy_device *phydev) | |
| 370 | +{ | |
| 371 | + int ss, err, old_link = phydev->link; | |
| 372 | + | |
| 373 | + /* Update the link, but return if there was an error */ | |
| 374 | + err = genphy_update_link(phydev); | |
| 375 | + if (err) | |
| 376 | + return err; | |
| 377 | + | |
| 378 | + /* why bother the PHY if nothing can have changed */ | |
| 379 | + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) | |
| 380 | + return 0; | |
| 381 | + | |
| 382 | + phydev->speed = SPEED_UNKNOWN; | |
| 383 | + phydev->duplex = DUPLEX_UNKNOWN; | |
| 384 | + phydev->pause = 0; | |
| 385 | + phydev->asym_pause = 0; | |
| 386 | + | |
| 387 | + err = genphy_read_lpa(phydev); | |
| 388 | + if (err < 0) | |
| 389 | + return err; | |
| 390 | + | |
| 391 | + /* Read the AT8035 PHY-Specific Status register, which indicates the | |
| 392 | + * speed and duplex that the PHY is actually using, irrespective of | |
| 393 | + * whether we are in autoneg mode or not. | |
| 394 | + */ | |
| 395 | + ss = phy_read(phydev, AT803X_SPECIFIC_STATUS); | |
| 396 | + if (ss < 0) | |
| 397 | + return ss; | |
| 398 | + | |
| 399 | + if (ss & AT803X_SS_SPEED_DUPLEX_RESOLVED) { | |
| 400 | + switch (ss & AT803X_SS_SPEED_MASK) { | |
| 401 | + case AT803X_SS_SPEED_10: | |
| 402 | + phydev->speed = SPEED_10; | |
| 403 | + break; | |
| 404 | + case AT803X_SS_SPEED_100: | |
| 405 | + phydev->speed = SPEED_100; | |
| 406 | + break; | |
| 407 | + case AT803X_SS_SPEED_1000: | |
| 408 | + phydev->speed = SPEED_1000; | |
| 409 | + break; | |
| 410 | + } | |
| 411 | + if (ss & AT803X_SS_DUPLEX) | |
| 412 | + phydev->duplex = DUPLEX_FULL; | |
| 413 | + else | |
| 414 | + phydev->duplex = DUPLEX_HALF; | |
| 415 | + if (ss & AT803X_SS_MDIX) | |
| 416 | + phydev->mdix = ETH_TP_MDI_X; | |
| 417 | + else | |
| 418 | + phydev->mdix = ETH_TP_MDI; | |
| 419 | + } | |
| 420 | + | |
| 421 | + if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) | |
| 422 | + phy_resolve_aneg_pause(phydev); | |
| 423 | + | |
| 424 | + return 0; | |
| 425 | +} | |
| 426 | + | |
| 360 | 427 | static struct phy_driver at803x_driver[] = { |
| 361 | 428 | { |
| 362 | 429 | /* ATHEROS 8035 */ |
| @@ -370,6 +437,7 @@ static struct phy_driver at803x_driver[] = { · 7 unmodified lines | ||
| 370 | 437 | .suspend = at803x_suspend, |
| 371 | 438 | .resume = at803x_resume, |
| 372 | 439 | /* PHY_GBIT_FEATURES */ |
| 440 | + .read_status = at803x_read_status, | |
| 373 | 441 | .ack_interrupt = at803x_ack_interrupt, |
| 374 | 442 | .config_intr = at803x_config_intr, |
| 375 | 443 | }, { |
| @@ -399,6 +467,7 @@ static struct phy_driver at803x_driver[] = { · 23 unmodified lines | ||
| 399 | 467 | .suspend = at803x_suspend, |
| 400 | 468 | .resume = at803x_resume, |
| 401 | 469 | /* PHY_GBIT_FEATURES */ |
| 470 | + .read_status = at803x_read_status, | |
| 402 | 471 | .aneg_done = at803x_aneg_done, |
| 403 | 472 | .ack_interrupt = &at803x_ack_interrupt, |
| 404 | 473 | .config_intr = &at803x_config_intr, |
| @@ -121,7 +121,7 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value) · 120 unmodified lines | ||
| 121 | 121 | return; |
| 122 | 122 | |
| 123 | 123 | if (mdiodev->reset_gpio) |
| 124 | − gpiod_set_value(mdiodev->reset_gpio, value); | |
| 124 | + gpiod_set_value_cansleep(mdiodev->reset_gpio, value); | |
| 125 | 125 | |
| 126 | 126 | if (mdiodev->reset_ctrl) { |
| 127 | 127 | if (value) |
| @@ -283,6 +283,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev) · 282 unmodified lines | ||
| 283 | 283 | phydev->eee_broken_modes = broken; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | +void phy_resolve_aneg_pause(struct phy_device *phydev) | |
| 287 | +{ | |
| 288 | + if (phydev->duplex == DUPLEX_FULL) { | |
| 289 | + phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, | |
| 290 | + phydev->lp_advertising); | |
| 291 | + phydev->asym_pause = linkmode_test_bit( | |
| 292 | + ETHTOOL_LINK_MODE_Asym_Pause_BIT, | |
| 293 | + phydev->lp_advertising); | |
| 294 | + } | |
| 295 | +} | |
| 296 | +EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause); | |
| 297 | + | |
| 286 | 298 | /** |
| 287 | 299 | * phy_resolve_aneg_linkmode - resolve the advertisements into phy settings |
| 288 | 300 | * @phydev: The phy_device struct |
| @@ -305,13 +317,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev) · 16 unmodified lines | ||
| 305 | 317 | break; |
| 306 | 318 | } |
| 307 | 319 | |
| 308 | − if (phydev->duplex == DUPLEX_FULL) { | |
| 309 | − phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, | |
| 310 | − phydev->lp_advertising); | |
| 311 | − phydev->asym_pause = linkmode_test_bit( | |
| 312 | − ETHTOOL_LINK_MODE_Asym_Pause_BIT, | |
| 313 | − phydev->lp_advertising); | |
| 314 | − } | |
| 320 | + phy_resolve_aneg_pause(phydev); | |
| 315 | 321 | } |
| 316 | 322 | EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode); |
| 317 | 323 | |
| @@ -457,6 +457,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) · 456 unmodified lines | ||
| 457 | 457 | val); |
| 458 | 458 | change_autoneg = true; |
| 459 | 459 | break; |
| 460 | + case MII_CTRL1000: | |
| 461 | + mii_ctrl1000_mod_linkmode_adv_t(phydev->advertising, | |
| 462 | + val); | |
| 463 | + change_autoneg = true; | |
| 464 | + break; | |
| 460 | 465 | default: |
| 461 | 466 | /* do nothing */ |
| 462 | 467 | break; |
| @@ -1783,32 +1783,9 @@ done: · 1782 unmodified lines | ||
| 1783 | 1783 | } |
| 1784 | 1784 | EXPORT_SYMBOL(genphy_update_link); |
| 1785 | 1785 | |
| 1786 | −/** | |
| 1787 | − * genphy_read_status - check the link status and update current link state | |
| 1788 | − * @phydev: target phy_device struct | |
| 1789 | − * | |
| 1790 | − * Description: Check the link, then figure out the current state | |
| 1791 | − * by comparing what we advertise with what the link partner | |
| 1792 | − * advertises. Start by checking the gigabit possibilities, | |
| 1793 | − * then move on to 10/100. | |
| 1794 | − */ | |
| 1795 | −int genphy_read_status(struct phy_device *phydev) | |
| 1786 | +int genphy_read_lpa(struct phy_device *phydev) | |
| 1796 | 1787 | { |
| 1797 | − int lpa, lpagb, err, old_link = phydev->link; | |
| 1798 | − | |
| 1799 | − /* Update the link, but return if there was an error */ | |
| 1800 | − err = genphy_update_link(phydev); | |
| 1801 | − if (err) | |
| 1802 | − return err; | |
| 1803 | − | |
| 1804 | − /* why bother the PHY if nothing can have changed */ | |
| 1805 | − if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) | |
| 1806 | − return 0; | |
| 1807 | − | |
| 1808 | − phydev->speed = SPEED_UNKNOWN; | |
| 1809 | − phydev->duplex = DUPLEX_UNKNOWN; | |
| 1810 | − phydev->pause = 0; | |
| 1811 | − phydev->asym_pause = 0; | |
| 1788 | + int lpa, lpagb; | |
| 1812 | 1789 | |
| 1813 | 1790 | if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { |
| 1814 | 1791 | if (phydev->is_gigabit_capable) { |
| @@ -1838,6 +1815,44 @@ int genphy_read_status(struct phy_device *phydev) · 23 unmodified lines | ||
| 1838 | 1815 | return lpa; |
| 1839 | 1816 | |
| 1840 | 1817 | mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); |
| 1818 | + } | |
| 1819 | + | |
| 1820 | + return 0; | |
| 1821 | +} | |
| 1822 | +EXPORT_SYMBOL(genphy_read_lpa); | |
| 1823 | + | |
| 1824 | +/** | |
| 1825 | + * genphy_read_status - check the link status and update current link state | |
| 1826 | + * @phydev: target phy_device struct | |
| 1827 | + * | |
| 1828 | + * Description: Check the link, then figure out the current state | |
| 1829 | + * by comparing what we advertise with what the link partner | |
| 1830 | + * advertises. Start by checking the gigabit possibilities, | |
| 1831 | + * then move on to 10/100. | |
| 1832 | + */ | |
| 1833 | +int genphy_read_status(struct phy_device *phydev) | |
| 1834 | +{ | |
| 1835 | + int err, old_link = phydev->link; | |
| 1836 | + | |
| 1837 | + /* Update the link, but return if there was an error */ | |
| 1838 | + err = genphy_update_link(phydev); | |
| 1839 | + if (err) | |
| 1840 | + return err; | |
| 1841 | + | |
| 1842 | + /* why bother the PHY if nothing can have changed */ | |
| 1843 | + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) | |
| 1844 | + return 0; | |
| 1845 | + | |
| 1846 | + phydev->speed = SPEED_UNKNOWN; | |
| 1847 | + phydev->duplex = DUPLEX_UNKNOWN; | |
| 1848 | + phydev->pause = 0; | |
| 1849 | + phydev->asym_pause = 0; | |
| 1850 | + | |
| 1851 | + err = genphy_read_lpa(phydev); | |
| 1852 | + if (err < 0) | |
| 1853 | + return err; | |
| 1854 | + | |
| 1855 | + if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { | |
| 1841 | 1856 | phy_resolve_aneg_linkmode(phydev); |
| 1842 | 1857 | } else if (phydev->autoneg == AUTONEG_DISABLE) { |
| 1843 | 1858 | int bmcr = phy_read(phydev, MII_BMCR); |
| @@ -238,7 +238,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) · 237 unmodified lines | ||
| 238 | 238 | skb_dst_drop(skb); |
| 239 | 239 | skb_dst_set(skb, &rt->dst); |
| 240 | 240 | |
| 241 | − nf_reset(skb); | |
| 241 | + nf_reset_ct(skb); | |
| 242 | 242 | |
| 243 | 243 | skb->ip_summed = CHECKSUM_NONE; |
| 244 | 244 | ip_select_ident(net, skb, NULL); |
| @@ -358,7 +358,7 @@ static int pptp_rcv(struct sk_buff *skb) · 113 unmodified lines | ||
| 358 | 358 | po = lookup_chan(htons(header->call_id), iph->saddr); |
| 359 | 359 | if (po) { |
| 360 | 360 | skb_dst_drop(skb); |
| 361 | − nf_reset(skb); | |
| 361 | + nf_reset_ct(skb); | |
| 362 | 362 | return sk_receive_skb(sk_pppox(po), skb, 0); |
| 363 | 363 | } |
| 364 | 364 | drop: |
| @@ -1104,7 +1104,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) · 1103 unmodified lines | ||
| 1104 | 1104 | */ |
| 1105 | 1105 | skb_orphan(skb); |
| 1106 | 1106 | |
| 1107 | − nf_reset(skb); | |
| 1107 | + nf_reset_ct(skb); | |
| 1108 | 1108 | |
| 1109 | 1109 | if (ptr_ring_produce(&tfile->tx_ring, skb)) |
| 1110 | 1110 | goto drop; |
| @@ -2620,14 +2620,18 @@ static struct hso_device *hso_create_bulk_serial_device( · 2619 unmodified lines | ||
| 2620 | 2620 | */ |
| 2621 | 2621 | if (serial->tiocmget) { |
| 2622 | 2622 | tiocmget = serial->tiocmget; |
| 2623 | + tiocmget->endp = hso_get_ep(interface, | |
| 2624 | + USB_ENDPOINT_XFER_INT, | |
| 2625 | + USB_DIR_IN); | |
| 2626 | + if (!tiocmget->endp) { | |
| 2627 | + dev_err(&interface->dev, "Failed to find INT IN ep\n"); | |
| 2628 | + goto exit; | |
| 2629 | + } | |
| 2630 | + | |
| 2623 | 2631 | tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL); |
| 2624 | 2632 | if (tiocmget->urb) { |
| 2625 | 2633 | mutex_init(&tiocmget->mutex); |
| 2626 | 2634 | init_waitqueue_head(&tiocmget->waitq); |
| 2627 | − tiocmget->endp = hso_get_ep( | |
| 2628 | − interface, | |
| 2629 | − USB_ENDPOINT_XFER_INT, | |
| 2630 | − USB_DIR_IN); | |
| 2631 | 2635 | } else |
| 2632 | 2636 | hso_free_tiomget(serial); |
| 2633 | 2637 | } |
| @@ -1350,6 +1350,7 @@ static const struct usb_device_id products[] = { · 1349 unmodified lines | ||
| 1350 | 1350 | {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
| 1351 | 1351 | {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ |
| 1352 | 1352 | {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ |
| 1353 | + {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */ | |
| 1353 | 1354 | {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 1354 | 1355 | {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ |
| 1355 | 1356 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
| @@ -4799,10 +4799,9 @@ static int rtl8152_reset_resume(struct usb_interface *intf) · 4798 unmodified lines | ||
| 4799 | 4799 | struct r8152 *tp = usb_get_intfdata(intf); |
| 4800 | 4800 | |
| 4801 | 4801 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
| 4802 | − mutex_lock(&tp->control); | |
| 4803 | 4802 | tp->rtl_ops.init(tp); |
| 4804 | 4803 | queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); |
| 4805 | − mutex_unlock(&tp->control); | |
| 4804 | + set_ethernet_addr(tp); | |
| 4806 | 4805 | return rtl8152_resume(intf); |
| 4807 | 4806 | } |
| 4808 | 4807 | |
| @@ -1585,7 +1585,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 1584 unmodified lines | ||
| 1585 | 1585 | /* Don't wait up for transmitted skbs to be freed. */ |
| 1586 | 1586 | if (!use_napi) { |
| 1587 | 1587 | skb_orphan(skb); |
| 1588 | − nf_reset(skb); | |
| 1588 | + nf_reset_ct(skb); | |
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | /* If running out of space, stop queue to avoid getting packets that we |
| @@ -366,7 +366,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, · 365 unmodified lines | ||
| 366 | 366 | struct neighbour *neigh; |
| 367 | 367 | int ret; |
| 368 | 368 | |
| 369 | − nf_reset(skb); | |
| 369 | + nf_reset_ct(skb); | |
| 370 | 370 | |
| 371 | 371 | skb->protocol = htons(ETH_P_IPV6); |
| 372 | 372 | skb->dev = dev; |
| @@ -459,7 +459,7 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, · 86 unmodified lines | ||
| 459 | 459 | |
| 460 | 460 | /* reset skb device */ |
| 461 | 461 | if (likely(err == 1)) |
| 462 | − nf_reset(skb); | |
| 462 | + nf_reset_ct(skb); | |
| 463 | 463 | else |
| 464 | 464 | skb = NULL; |
| 465 | 465 | |
| @@ -560,7 +560,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s · 94 unmodified lines | ||
| 560 | 560 | bool is_v6gw = false; |
| 561 | 561 | int ret = -EINVAL; |
| 562 | 562 | |
| 563 | − nf_reset(skb); | |
| 563 | + nf_reset_ct(skb); | |
| 564 | 564 | |
| 565 | 565 | /* Be paranoid, rather than too clever. */ |
| 566 | 566 | if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { |
| @@ -670,7 +670,7 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, · 103 unmodified lines | ||
| 670 | 670 | |
| 671 | 671 | /* reset skb device */ |
| 672 | 672 | if (likely(err == 1)) |
| 673 | − nf_reset(skb); | |
| 673 | + nf_reset_ct(skb); | |
| 674 | 674 | else |
| 675 | 675 | skb = NULL; |
| 676 | 676 | |
| @@ -1261,8 +1261,8 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, · 1260 unmodified lines | ||
| 1261 | 1261 | skb_orphan(skb); |
| 1262 | 1262 | skb_dst_drop(skb); |
| 1263 | 1263 | skb->mark = 0; |
| 1264 | − secpath_reset(skb); | |
| 1265 | − nf_reset(skb); | |
| 1264 | + skb_ext_reset(skb); | |
| 1265 | + nf_reset_ct(skb); | |
| 1266 | 1266 | |
| 1267 | 1267 | /* |
| 1268 | 1268 | * Get absolute mactime here so all HWs RX at the "same time", and |
| @@ -887,9 +887,9 @@ static int xennet_set_skb_gso(struct sk_buff *skb, · 886 unmodified lines | ||
| 887 | 887 | return 0; |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | −static RING_IDX xennet_fill_frags(struct netfront_queue *queue, | |
| 891 | − struct sk_buff *skb, | |
| 892 | − struct sk_buff_head *list) | |
| 890 | +static int xennet_fill_frags(struct netfront_queue *queue, | |
| 891 | + struct sk_buff *skb, | |
| 892 | + struct sk_buff_head *list) | |
| 893 | 893 | { |
| 894 | 894 | RING_IDX cons = queue->rx.rsp_cons; |
| 895 | 895 | struct sk_buff *nskb; |
| @@ -908,7 +908,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 12 unmodified lines | ||
| 908 | 908 | if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { |
| 909 | 909 | queue->rx.rsp_cons = ++cons + skb_queue_len(list); |
| 910 | 910 | kfree_skb(nskb); |
| 911 | − return ~0U; | |
| 911 | + return -ENOENT; | |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
| @@ -919,7 +919,9 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, · 4 unmodified lines | ||
| 919 | 919 | kfree_skb(nskb); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | − return cons; | |
| 922 | + queue->rx.rsp_cons = cons; | |
| 923 | + | |
| 924 | + return 0; | |
| 923 | 925 | } |
| 924 | 926 | |
| 925 | 927 | static int checksum_setup(struct net_device *dev, struct sk_buff *skb) |
| @@ -1045,8 +1047,7 @@ err: · 119 unmodified lines | ||
| 1045 | 1047 | skb->data_len = rx->status; |
| 1046 | 1048 | skb->len += rx->status; |
| 1047 | 1049 | |
| 1048 | − i = xennet_fill_frags(queue, skb, &tmpq); | |
| 1049 | − if (unlikely(i == ~0U)) | |
| 1050 | + if (unlikely(xennet_fill_frags(queue, skb, &tmpq))) | |
| 1050 | 1051 | goto err; |
| 1051 | 1052 | |
| 1052 | 1053 | if (rx->flags & XEN_NETRXF_csum_blank) |
| @@ -1056,7 +1057,7 @@ err: · 3 unmodified lines | ||
| 1056 | 1057 | |
| 1057 | 1058 | __skb_queue_tail(&rxq, skb); |
| 1058 | 1059 | |
| 1059 | − queue->rx.rsp_cons = ++i; | |
| 1060 | + i = ++queue->rx.rsp_cons; | |
| 1060 | 1061 | work_done++; |
| 1061 | 1062 | } |
| 1062 | 1063 | |
| @@ -102,10 +102,13 @@ static void nvme_set_queue_dying(struct nvme_ns *ns) · 101 unmodified lines | ||
| 102 | 102 | */ |
| 103 | 103 | if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags)) |
| 104 | 104 | return; |
| 105 | − revalidate_disk(ns->disk); | |
| 106 | 105 | blk_set_queue_dying(ns->queue); |
| 107 | 106 | /* Forcibly unquiesce queues to avoid blocking dispatch */ |
| 108 | 107 | blk_mq_unquiesce_queue(ns->queue); |
| 108 | + /* | |
| 109 | + * Revalidate after unblocking dispatchers that may be holding bd_butex | |
| 110 | + */ | |
| 111 | + revalidate_disk(ns->disk); | |
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | static void nvme_queue_scan(struct nvme_ctrl *ctrl) |
| @@ -847,7 +850,7 @@ out: · 735 unmodified lines | ||
| 847 | 850 | static int nvme_submit_user_cmd(struct request_queue *q, |
| 848 | 851 | struct nvme_command *cmd, void __user *ubuffer, |
| 849 | 852 | unsigned bufflen, void __user *meta_buffer, unsigned meta_len, |
| 850 | − u32 meta_seed, u32 *result, unsigned timeout) | |
| 853 | + u32 meta_seed, u64 *result, unsigned timeout) | |
| 851 | 854 | { |
| 852 | 855 | bool write = nvme_is_write(cmd); |
| 853 | 856 | struct nvme_ns *ns = q->queuedata; |
| @@ -888,7 +891,7 @@ static int nvme_submit_user_cmd(struct request_queue *q, · 34 unmodified lines | ||
| 888 | 891 | else |
| 889 | 892 | ret = nvme_req(req)->status; |
| 890 | 893 | if (result) |
| 891 | − *result = le32_to_cpu(nvme_req(req)->result.u32); | |
| 894 | + *result = le64_to_cpu(nvme_req(req)->result.u64); | |
| 892 | 895 | if (meta && !ret && !write) { |
| 893 | 896 | if (copy_to_user(meta_buffer, meta, meta_len)) |
| 894 | 897 | ret = -EFAULT; |
| @@ -1335,6 +1338,54 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 440 unmodified lines | ||
| 1335 | 1338 | struct nvme_command c; |
| 1336 | 1339 | unsigned timeout = 0; |
| 1337 | 1340 | u32 effects; |
| 1341 | + u64 result; | |
| 1342 | + int status; | |
| 1343 | + | |
| 1344 | + if (!capable(CAP_SYS_ADMIN)) | |
| 1345 | + return -EACCES; | |
| 1346 | + if (copy_from_user(&cmd, ucmd, sizeof(cmd))) | |
| 1347 | + return -EFAULT; | |
| 1348 | + if (cmd.flags) | |
| 1349 | + return -EINVAL; | |
| 1350 | + | |
| 1351 | + memset(&c, 0, sizeof(c)); | |
| 1352 | + c.common.opcode = cmd.opcode; | |
| 1353 | + c.common.flags = cmd.flags; | |
| 1354 | + c.common.nsid = cpu_to_le32(cmd.nsid); | |
| 1355 | + c.common.cdw2[0] = cpu_to_le32(cmd.cdw2); | |
| 1356 | + c.common.cdw2[1] = cpu_to_le32(cmd.cdw3); | |
| 1357 | + c.common.cdw10 = cpu_to_le32(cmd.cdw10); | |
| 1358 | + c.common.cdw11 = cpu_to_le32(cmd.cdw11); | |
| 1359 | + c.common.cdw12 = cpu_to_le32(cmd.cdw12); | |
| 1360 | + c.common.cdw13 = cpu_to_le32(cmd.cdw13); | |
| 1361 | + c.common.cdw14 = cpu_to_le32(cmd.cdw14); | |
| 1362 | + c.common.cdw15 = cpu_to_le32(cmd.cdw15); | |
| 1363 | + | |
| 1364 | + if (cmd.timeout_ms) | |
| 1365 | + timeout = msecs_to_jiffies(cmd.timeout_ms); | |
| 1366 | + | |
| 1367 | + effects = nvme_passthru_start(ctrl, ns, cmd.opcode); | |
| 1368 | + status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, | |
| 1369 | + (void __user *)(uintptr_t)cmd.addr, cmd.data_len, | |
| 1370 | + (void __user *)(uintptr_t)cmd.metadata, | |
| 1371 | + cmd.metadata_len, 0, &result, timeout); | |
| 1372 | + nvme_passthru_end(ctrl, effects); | |
| 1373 | + | |
| 1374 | + if (status >= 0) { | |
| 1375 | + if (put_user(result, &ucmd->result)) | |
| 1376 | + return -EFAULT; | |
| 1377 | + } | |
| 1378 | + | |
| 1379 | + return status; | |
| 1380 | +} | |
| 1381 | + | |
| 1382 | +static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, | |
| 1383 | + struct nvme_passthru_cmd64 __user *ucmd) | |
| 1384 | +{ | |
| 1385 | + struct nvme_passthru_cmd64 cmd; | |
| 1386 | + struct nvme_command c; | |
| 1387 | + unsigned timeout = 0; | |
| 1388 | + u32 effects; | |
| 1338 | 1389 | int status; |
| 1339 | 1390 | |
| 1340 | 1391 | if (!capable(CAP_SYS_ADMIN)) |
| @@ -1405,6 +1456,41 @@ static void nvme_put_ns_from_disk(struct nvme_ns_head *head, int idx) · 64 unmodified lines | ||
| 1405 | 1456 | srcu_read_unlock(&head->srcu, idx); |
| 1406 | 1457 | } |
| 1407 | 1458 | |
| 1459 | +static bool is_ctrl_ioctl(unsigned int cmd) | |
| 1460 | +{ | |
| 1461 | + if (cmd == NVME_IOCTL_ADMIN_CMD || cmd == NVME_IOCTL_ADMIN64_CMD) | |
| 1462 | + return true; | |
| 1463 | + if (is_sed_ioctl(cmd)) | |
| 1464 | + return true; | |
| 1465 | + return false; | |
| 1466 | +} | |
| 1467 | + | |
| 1468 | +static int nvme_handle_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd, | |
| 1469 | + void __user *argp, | |
| 1470 | + struct nvme_ns_head *head, | |
| 1471 | + int srcu_idx) | |
| 1472 | +{ | |
| 1473 | + struct nvme_ctrl *ctrl = ns->ctrl; | |
| 1474 | + int ret; | |
| 1475 | + | |
| 1476 | + nvme_get_ctrl(ns->ctrl); | |
| 1477 | + nvme_put_ns_from_disk(head, srcu_idx); | |
| 1478 | + | |
| 1479 | + switch (cmd) { | |
| 1480 | + case NVME_IOCTL_ADMIN_CMD: | |
| 1481 | + ret = nvme_user_cmd(ctrl, NULL, argp); | |
| 1482 | + break; | |
| 1483 | + case NVME_IOCTL_ADMIN64_CMD: | |
| 1484 | + ret = nvme_user_cmd64(ctrl, NULL, argp); | |
| 1485 | + break; | |
| 1486 | + default: | |
| 1487 | + ret = sed_ioctl(ctrl->opal_dev, cmd, argp); | |
| 1488 | + break; | |
| 1489 | + } | |
| 1490 | + nvme_put_ctrl(ctrl); | |
| 1491 | + return ret; | |
| 1492 | +} | |
| 1493 | + | |
| 1408 | 1494 | static int nvme_ioctl(struct block_device *bdev, fmode_t mode, |
| 1409 | 1495 | unsigned int cmd, unsigned long arg) |
| 1410 | 1496 | { |
| @@ -1422,20 +1508,8 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, · 11 unmodified lines | ||
| 1422 | 1508 | * seperately and drop the ns SRCU reference early. This avoids a |
| 1423 | 1509 | * deadlock when deleting namespaces using the passthrough interface. |
| 1424 | 1510 | */ |
| 1425 | − if (cmd == NVME_IOCTL_ADMIN_CMD || is_sed_ioctl(cmd)) { | |
| 1426 | − struct nvme_ctrl *ctrl = ns->ctrl; | |
| 1427 | − | |
| 1428 | − nvme_get_ctrl(ns->ctrl); | |
| 1429 | − nvme_put_ns_from_disk(head, srcu_idx); | |
| 1430 | − | |
| 1431 | − if (cmd == NVME_IOCTL_ADMIN_CMD) | |
| 1432 | − ret = nvme_user_cmd(ctrl, NULL, argp); | |
| 1433 | − else | |
| 1434 | − ret = sed_ioctl(ctrl->opal_dev, cmd, argp); | |
| 1435 | − | |
| 1436 | − nvme_put_ctrl(ctrl); | |
| 1437 | − return ret; | |
| 1438 | − } | |
| 1511 | + if (is_ctrl_ioctl(cmd)) | |
| 1512 | + return nvme_handle_ctrl_ioctl(ns, cmd, argp, head, srcu_idx); | |
| 1439 | 1513 | |
| 1440 | 1514 | switch (cmd) { |
| 1441 | 1515 | case NVME_IOCTL_ID: |
| @@ -1448,6 +1522,9 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, · 6 unmodified lines | ||
| 1448 | 1522 | case NVME_IOCTL_SUBMIT_IO: |
| 1449 | 1523 | ret = nvme_submit_io(ns, argp); |
| 1450 | 1524 | break; |
| 1525 | + case NVME_IOCTL_IO64_CMD: | |
| 1526 | + ret = nvme_user_cmd64(ns->ctrl, ns, argp); | |
| 1527 | + break; | |
| 1451 | 1528 | default: |
| 1452 | 1529 | if (ns->ndev) |
| 1453 | 1530 | ret = nvme_nvm_ioctl(ns, cmd, arg); |
| @@ -2289,6 +2366,16 @@ static const struct nvme_core_quirk_entry core_quirks[] = { · 835 unmodified lines | ||
| 2289 | 2366 | .vid = 0x14a4, |
| 2290 | 2367 | .fr = "22301111", |
| 2291 | 2368 | .quirks = NVME_QUIRK_SIMPLE_SUSPEND, |
| 2369 | + }, | |
| 2370 | + { | |
| 2371 | + /* | |
| 2372 | + * This Kingston E8FK11.T firmware version has no interrupt | |
| 2373 | + * after resume with actions related to suspend to idle | |
| 2374 | + * https://bugzilla.kernel.org/show_bug.cgi?id=204887 | |
| 2375 | + */ | |
| 2376 | + .vid = 0x2646, | |
| 2377 | + .fr = "E8FK11.T", | |
| 2378 | + .quirks = NVME_QUIRK_SIMPLE_SUSPEND, | |
| 2292 | 2379 | } |
| 2293 | 2380 | }; |
| 2294 | 2381 | |
| @@ -2540,8 +2627,9 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 245 unmodified lines | ||
| 2540 | 2627 | list_add_tail(&subsys->entry, &nvme_subsystems); |
| 2541 | 2628 | } |
| 2542 | 2629 | |
| 2543 | − if (sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj, | |
| 2544 | − dev_name(ctrl->device))) { | |
| 2630 | + ret = sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj, | |
| 2631 | + dev_name(ctrl->device)); | |
| 2632 | + if (ret) { | |
| 2545 | 2633 | dev_err(ctrl->device, |
| 2546 | 2634 | "failed to create sysfs link from subsystem.\n"); |
| 2547 | 2635 | goto out_put_subsystem; |
| @@ -2838,6 +2926,8 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd, · 290 unmodified lines | ||
| 2838 | 2926 | switch (cmd) { |
| 2839 | 2927 | case NVME_IOCTL_ADMIN_CMD: |
| 2840 | 2928 | return nvme_user_cmd(ctrl, NULL, argp); |
| 2929 | + case NVME_IOCTL_ADMIN64_CMD: | |
| 2930 | + return nvme_user_cmd64(ctrl, NULL, argp); | |
| 2841 | 2931 | case NVME_IOCTL_IO_CMD: |
| 2842 | 2932 | return nvme_dev_user_cmd(ctrl, argp); |
| 2843 | 2933 | case NVME_IOCTL_RESET: |
| @@ -3045,6 +3135,8 @@ static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL); · 201 unmodified lines | ||
| 3045 | 3135 | |
| 3046 | 3136 | nvme_show_int_function(cntlid); |
| 3047 | 3137 | nvme_show_int_function(numa_node); |
| 3138 | +nvme_show_int_function(queue_count); | |
| 3139 | +nvme_show_int_function(sqsize); | |
| 3048 | 3140 | |
| 3049 | 3141 | static ssize_t nvme_sysfs_delete(struct device *dev, |
| 3050 | 3142 | struct device_attribute *attr, const char *buf, |
| @@ -3125,6 +3217,8 @@ static struct attribute *nvme_dev_attrs[] = { · 74 unmodified lines | ||
| 3125 | 3217 | &dev_attr_address.attr, |
| 3126 | 3218 | &dev_attr_state.attr, |
| 3127 | 3219 | &dev_attr_numa_node.attr, |
| 3220 | + &dev_attr_queue_count.attr, | |
| 3221 | + &dev_attr_sqsize.attr, | |
| 3128 | 3222 | NULL |
| 3129 | 3223 | }; |
| 3130 | 3224 | |
| @@ -221,6 +221,7 @@ struct nvme_ctrl { · 220 unmodified lines | ||
| 221 | 221 | u16 oacs; |
| 222 | 222 | u16 nssa; |
| 223 | 223 | u16 nr_streams; |
| 224 | + u16 sqsize; | |
| 224 | 225 | u32 max_namespaces; |
| 225 | 226 | atomic_t abort_limit; |
| 226 | 227 | u8 vwc; |
| @@ -269,7 +270,6 @@ struct nvme_ctrl { · 42 unmodified lines | ||
| 269 | 270 | u16 hmmaxd; |
| 270 | 271 | |
| 271 | 272 | /* Fabrics only */ |
| 272 | − u16 sqsize; | |
| 273 | 273 | u32 ioccsz; |
| 274 | 274 | u32 iorcsz; |
| 275 | 275 | u16 icdoff; |
| @@ -2946,11 +2946,21 @@ static int nvme_suspend(struct device *dev) · 2945 unmodified lines | ||
| 2946 | 2946 | if (ret < 0) |
| 2947 | 2947 | goto unfreeze; |
| 2948 | 2948 | |
| 2949 | + /* | |
| 2950 | + * A saved state prevents pci pm from generically controlling the | |
| 2951 | + * device's power. If we're using protocol specific settings, we don't | |
| 2952 | + * want pci interfering. | |
| 2953 | + */ | |
| 2954 | + pci_save_state(pdev); | |
| 2955 | + | |
| 2949 | 2956 | ret = nvme_set_power_state(ctrl, ctrl->npss); |
| 2950 | 2957 | if (ret < 0) |
| 2951 | 2958 | goto unfreeze; |
| 2952 | 2959 | |
| 2953 | 2960 | if (ret) { |
| 2961 | + /* discard the saved state */ | |
| 2962 | + pci_load_saved_state(pdev, NULL); | |
| 2963 | + | |
| 2954 | 2964 | /* |
| 2955 | 2965 | * Clearing npss forces a controller reset on resume. The |
| 2956 | 2966 | * correct value will be resdicovered then. |
| @@ -2958,14 +2968,7 @@ static int nvme_suspend(struct device *dev) · 1 unmodified line | ||
| 2958 | 2968 | nvme_dev_disable(ndev, true); |
| 2959 | 2969 | ctrl->npss = 0; |
| 2960 | 2970 | ret = 0; |
| 2961 | − goto unfreeze; | |
| 2962 | 2971 | } |
| 2963 | − /* | |
| 2964 | − * A saved state prevents pci pm from generically controlling the | |
| 2965 | − * device's power. If we're using protocol specific settings, we don't | |
| 2966 | − * want pci interfering. | |
| 2967 | − */ | |
| 2968 | − pci_save_state(pdev); | |
| 2969 | 2972 | unfreeze: |
| 2970 | 2973 | nvme_unfreeze(ctrl); |
| 2971 | 2974 | return ret; |
| @@ -3090,6 +3093,9 @@ static const struct pci_device_id nvme_id_table[] = { · 118 unmodified lines | ||
| 3090 | 3093 | .driver_data = NVME_QUIRK_LIGHTNVM, }, |
| 3091 | 3094 | { PCI_DEVICE(0x10ec, 0x5762), /* ADATA SX6000LNP */ |
| 3092 | 3095 | .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, |
| 3096 | + { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */ | |
| 3097 | + .driver_data = NVME_QUIRK_NO_DEEPEST_PS | | |
| 3098 | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, | |
| 3093 | 3099 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
| 3094 | 3100 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, |
| 3095 | 3101 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) }, |
| @@ -427,7 +427,7 @@ static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) · 426 unmodified lines | ||
| 427 | 427 | static int nvme_rdma_get_max_fr_pages(struct ib_device *ibdev) |
| 428 | 428 | { |
| 429 | 429 | return min_t(u32, NVME_RDMA_MAX_SEGMENTS, |
| 430 | − ibdev->attrs.max_fast_reg_page_list_len); | |
| 430 | + ibdev->attrs.max_fast_reg_page_list_len - 1); | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) |
| @@ -437,7 +437,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) · 3 unmodified lines | ||
| 437 | 437 | const int cq_factor = send_wr_factor + 1; /* + RECV */ |
| 438 | 438 | int comp_vector, idx = nvme_rdma_queue_idx(queue); |
| 439 | 439 | enum ib_poll_context poll_ctx; |
| 440 | − int ret; | |
| 440 | + int ret, pages_per_mr; | |
| 441 | 441 | |
| 442 | 442 | queue->device = nvme_rdma_find_get_device(queue->cm_id); |
| 443 | 443 | if (!queue->device) { |
| @@ -479,10 +479,16 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) · 35 unmodified lines | ||
| 479 | 479 | goto out_destroy_qp; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | + /* | |
| 483 | + * Currently we don't use SG_GAPS MR's so if the first entry is | |
| 484 | + * misaligned we'll end up using two entries for a single data page, | |
| 485 | + * so one additional entry is required. | |
| 486 | + */ | |
| 487 | + pages_per_mr = nvme_rdma_get_max_fr_pages(ibdev) + 1; | |
| 482 | 488 | ret = ib_mr_pool_init(queue->qp, &queue->qp->rdma_mrs, |
| 483 | 489 | queue->queue_size, |
| 484 | 490 | IB_MR_TYPE_MEM_REG, |
| 485 | − nvme_rdma_get_max_fr_pages(ibdev), 0); | |
| 491 | + pages_per_mr, 0); | |
| 486 | 492 | if (ret) { |
| 487 | 493 | dev_err(queue->ctrl->ctrl.device, |
| 488 | 494 | "failed to initialize MR pool sized %d for QID %d\n", |
| @@ -614,7 +620,8 @@ static int nvme_rdma_start_queue(struct nvme_rdma_ctrl *ctrl, int idx) · 125 unmodified lines | ||
| 614 | 620 | if (!ret) { |
| 615 | 621 | set_bit(NVME_RDMA_Q_LIVE, &queue->flags); |
| 616 | 622 | } else { |
| 617 | − __nvme_rdma_stop_queue(queue); | |
| 623 | + if (test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) | |
| 624 | + __nvme_rdma_stop_queue(queue); | |
| 618 | 625 | dev_info(ctrl->ctrl.device, |
| 619 | 626 | "failed to connect queue: %d ret=%d\n", idx, ret); |
| 620 | 627 | } |
| @@ -820,8 +827,8 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, · 199 unmodified lines | ||
| 820 | 827 | if (error) |
| 821 | 828 | goto out_stop_queue; |
| 822 | 829 | |
| 823 | − ctrl->ctrl.max_hw_sectors = | |
| 824 | − (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9); | |
| 830 | + ctrl->ctrl.max_segments = ctrl->max_fr_pages; | |
| 831 | + ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9); | |
| 825 | 832 | |
| 826 | 833 | blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
| 827 | 834 | |
| @@ -1042,7 +1042,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 1041 unmodified lines | ||
| 1042 | 1042 | { |
| 1043 | 1043 | struct nvme_tcp_queue *queue = |
| 1044 | 1044 | container_of(w, struct nvme_tcp_queue, io_work); |
| 1045 | − unsigned long start = jiffies + msecs_to_jiffies(1); | |
| 1045 | + unsigned long deadline = jiffies + msecs_to_jiffies(1); | |
| 1046 | 1046 | |
| 1047 | 1047 | do { |
| 1048 | 1048 | bool pending = false; |
| @@ -1067,7 +1067,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 18 unmodified lines | ||
| 1067 | 1067 | if (!pending) |
| 1068 | 1068 | return; |
| 1069 | 1069 | |
| 1070 | − } while (time_after(jiffies, start)); /* quota is exhausted */ | |
| 1070 | + } while (!time_after(jiffies, deadline)); /* quota is exhausted */ | |
| 1071 | 1071 | |
| 1072 | 1072 | queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); |
| 1073 | 1073 | } |
| @@ -11,10 +11,10 @@ · 10 unmodified lines | ||
| 11 | 11 | void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) |
| 12 | 12 | { |
| 13 | 13 | const struct queue_limits *ql = &bdev_get_queue(bdev)->limits; |
| 14 | − /* Number of physical blocks per logical block. */ | |
| 15 | − const u32 ppl = ql->physical_block_size / ql->logical_block_size; | |
| 16 | − /* Physical blocks per logical block, 0's based. */ | |
| 17 | − const __le16 ppl0b = to0based(ppl); | |
| 14 | + /* Number of logical blocks per physical block. */ | |
| 15 | + const u32 lpp = ql->physical_block_size / ql->logical_block_size; | |
| 16 | + /* Logical blocks per physical block, 0's based. */ | |
| 17 | + const __le16 lpp0b = to0based(lpp); | |
| 18 | 18 | |
| 19 | 19 | /* |
| 20 | 20 | * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN, |
| @@ -25,9 +25,9 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) · 4 unmodified lines | ||
| 25 | 25 | * field from the identify controller data structure should be used. |
| 26 | 26 | */ |
| 27 | 27 | id->nsfeat |= 1 << 1; |
| 28 | − id->nawun = ppl0b; | |
| 29 | − id->nawupf = ppl0b; | |
| 30 | − id->nacwu = ppl0b; | |
| 28 | + id->nawun = lpp0b; | |
| 29 | + id->nawupf = lpp0b; | |
| 30 | + id->nacwu = lpp0b; | |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | 33 | * Bit 4 indicates that the fields NPWG, NPWA, NPDG, NPDA, and |
| @@ -36,7 +36,7 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) · 2 unmodified lines | ||
| 36 | 36 | */ |
| 37 | 37 | id->nsfeat |= 1 << 4; |
| 38 | 38 | /* NPWG = Namespace Preferred Write Granularity. 0's based */ |
| 39 | − id->npwg = ppl0b; | |
| 39 | + id->npwg = lpp0b; | |
| 40 | 40 | /* NPWA = Namespace Preferred Write Alignment. 0's based */ |
| 41 | 41 | id->npwa = id->npwg; |
| 42 | 42 | /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */ |
| @@ -348,8 +348,7 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd) · 347 unmodified lines | ||
| 348 | 348 | |
| 349 | 349 | return 0; |
| 350 | 350 | err: |
| 351 | − if (cmd->req.sg_cnt) | |
| 352 | − sgl_free(cmd->req.sg); | |
| 351 | + sgl_free(cmd->req.sg); | |
| 353 | 352 | return NVME_SC_INTERNAL; |
| 354 | 353 | } |
| 355 | 354 | |
| @@ -554,8 +553,7 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd) · 198 unmodified lines | ||
| 554 | 553 | |
| 555 | 554 | if (queue->nvme_sq.sqhd_disabled) { |
| 556 | 555 | kfree(cmd->iov); |
| 557 | − if (cmd->req.sg_cnt) | |
| 558 | − sgl_free(cmd->req.sg); | |
| 556 | + sgl_free(cmd->req.sg); | |
| 559 | 557 | } |
| 560 | 558 | |
| 561 | 559 | return 1; |
| @@ -586,8 +584,7 @@ static int nvmet_try_send_response(struct nvmet_tcp_cmd *cmd, · 24 unmodified lines | ||
| 586 | 584 | return -EAGAIN; |
| 587 | 585 | |
| 588 | 586 | kfree(cmd->iov); |
| 589 | − if (cmd->req.sg_cnt) | |
| 590 | − sgl_free(cmd->req.sg); | |
| 587 | + sgl_free(cmd->req.sg); | |
| 591 | 588 | cmd->queue->snd_cmd = NULL; |
| 592 | 589 | nvmet_tcp_put_cmd(cmd); |
| 593 | 590 | return 1; |
| @@ -1310,8 +1307,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd) · 716 unmodified lines | ||
| 1310 | 1307 | nvmet_req_uninit(&cmd->req); |
| 1311 | 1308 | nvmet_tcp_unmap_pdu_iovec(cmd); |
| 1312 | 1309 | kfree(cmd->iov); |
| 1313 | − if (cmd->req.sg_cnt) | |
| 1314 | − sgl_free(cmd->req.sg); | |
| 1310 | + sgl_free(cmd->req.sg); | |
| 1315 | 1311 | } |
| 1316 | 1312 | |
| 1317 | 1313 | static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue) |
| @@ -507,6 +507,8 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, · 506 unmodified lines | ||
| 507 | 507 | ptp_qoriq->regs.etts_regs = base + ETTS_REGS_OFFSET; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | + spin_lock_init(&ptp_qoriq->lock); | |
| 511 | + | |
| 510 | 512 | ktime_get_real_ts64(&now); |
| 511 | 513 | ptp_qoriq_settime(&ptp_qoriq->caps, &now); |
| 512 | 514 | |
| @@ -514,7 +516,6 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, · 1 unmodified line | ||
| 514 | 516 | (ptp_qoriq->tclk_period & TCLK_PERIOD_MASK) << TCLK_PERIOD_SHIFT | |
| 515 | 517 | (ptp_qoriq->cksel & CKSEL_MASK) << CKSEL_SHIFT; |
| 516 | 518 | |
| 517 | − spin_lock_init(&ptp_qoriq->lock); | |
| 518 | 519 | spin_lock_irqsave(&ptp_qoriq->lock, flags); |
| 519 | 520 | |
| 520 | 521 | regs = &ptp_qoriq->regs; |
| @@ -1553,8 +1553,8 @@ static int dasd_eckd_read_vol_info(struct dasd_device *device) · 1552 unmodified lines | ||
| 1553 | 1553 | if (rc == 0) { |
| 1554 | 1554 | memcpy(&private->vsq, vsq, sizeof(*vsq)); |
| 1555 | 1555 | } else { |
| 1556 | − dev_warn(&device->cdev->dev, | |
| 1557 | − "Reading the volume storage information failed with rc=%d\n", rc); | |
| 1556 | + DBF_EVENT_DEVID(DBF_WARNING, device->cdev, | |
| 1557 | + "Reading the volume storage information failed with rc=%d", rc); | |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | if (useglobal) |
| @@ -1737,8 +1737,8 @@ static int dasd_eckd_read_ext_pool_info(struct dasd_device *device) · 176 unmodified lines | ||
| 1737 | 1737 | if (rc == 0) { |
| 1738 | 1738 | dasd_eckd_cpy_ext_pool_data(device, lcq); |
| 1739 | 1739 | } else { |
| 1740 | − dev_warn(&device->cdev->dev, | |
| 1741 | − "Reading the logical configuration failed with rc=%d\n", rc); | |
| 1740 | + DBF_EVENT_DEVID(DBF_WARNING, device->cdev, | |
| 1741 | + "Reading the logical configuration failed with rc=%d", rc); | |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | dasd_sfree_request(cqr, cqr->memdev); |
| @@ -2020,14 +2020,10 @@ dasd_eckd_check_characteristics(struct dasd_device *device) · 275 unmodified lines | ||
| 2020 | 2020 | dasd_eckd_read_features(device); |
| 2021 | 2021 | |
| 2022 | 2022 | /* Read Volume Information */ |
| 2023 | − rc = dasd_eckd_read_vol_info(device); | |
| 2024 | − if (rc) | |
| 2025 | − goto out_err3; | |
| 2023 | + dasd_eckd_read_vol_info(device); | |
| 2026 | 2024 | |
| 2027 | 2025 | /* Read Extent Pool Information */ |
| 2028 | − rc = dasd_eckd_read_ext_pool_info(device); | |
| 2029 | − if (rc) | |
| 2030 | − goto out_err3; | |
| 2026 | + dasd_eckd_read_ext_pool_info(device); | |
| 2031 | 2027 | |
| 2032 | 2028 | /* Read Device Characteristics */ |
| 2033 | 2029 | rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC, |
| @@ -2059,9 +2055,6 @@ dasd_eckd_check_characteristics(struct dasd_device *device) · 25 unmodified lines | ||
| 2059 | 2055 | if (readonly) |
| 2060 | 2056 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
| 2061 | 2057 | |
| 2062 | − if (dasd_eckd_is_ese(device)) | |
| 2063 | − dasd_set_feature(device->cdev, DASD_FEATURE_DISCARD, 1); | |
| 2064 | − | |
| 2065 | 2058 | dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " |
| 2066 | 2059 | "with %d cylinders, %d heads, %d sectors%s\n", |
| 2067 | 2060 | private->rdc_data.dev_type, |
| @@ -3695,14 +3688,6 @@ static int dasd_eckd_release_space(struct dasd_device *device, · 1627 unmodified lines | ||
| 3695 | 3688 | return -EINVAL; |
| 3696 | 3689 | } |
| 3697 | 3690 | |
| 3698 | −static struct dasd_ccw_req * | |
| 3699 | −dasd_eckd_build_cp_discard(struct dasd_device *device, struct dasd_block *block, | |
| 3700 | − struct request *req, sector_t first_trk, | |
| 3701 | − sector_t last_trk) | |
| 3702 | −{ | |
| 3703 | − return dasd_eckd_dso_ras(device, block, req, first_trk, last_trk, 1); | |
| 3704 | −} | |
| 3705 | − | |
| 3706 | 3691 | static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single( |
| 3707 | 3692 | struct dasd_device *startdev, |
| 3708 | 3693 | struct dasd_block *block, |
| @@ -4447,10 +4432,6 @@ static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, · 738 unmodified lines | ||
| 4447 | 4432 | cmdwtd = private->features.feature[12] & 0x40; |
| 4448 | 4433 | use_prefix = private->features.feature[8] & 0x01; |
| 4449 | 4434 | |
| 4450 | − if (req_op(req) == REQ_OP_DISCARD) | |
| 4451 | − return dasd_eckd_build_cp_discard(startdev, block, req, | |
| 4452 | − first_trk, last_trk); | |
| 4453 | − | |
| 4454 | 4435 | cqr = NULL; |
| 4455 | 4436 | if (cdlspecial || dasd_page_cache) { |
| 4456 | 4437 | /* do nothing, just fall through to the cmd mode single case */ |
| @@ -4729,14 +4710,12 @@ static struct dasd_ccw_req *dasd_eckd_build_alias_cp(struct dasd_device *base, · 272 unmodified lines | ||
| 4729 | 4710 | struct dasd_block *block, |
| 4730 | 4711 | struct request *req) |
| 4731 | 4712 | { |
| 4732 | − struct dasd_device *startdev = NULL; | |
| 4733 | 4713 | struct dasd_eckd_private *private; |
| 4734 | − struct dasd_ccw_req *cqr; | |
| 4714 | + struct dasd_device *startdev; | |
| 4735 | 4715 | unsigned long flags; |
| 4716 | + struct dasd_ccw_req *cqr; | |
| 4736 | 4717 | |
| 4737 | − /* Discard requests can only be processed on base devices */ | |
| 4738 | − if (req_op(req) != REQ_OP_DISCARD) | |
| 4739 | − startdev = dasd_alias_get_start_dev(base); | |
| 4718 | + startdev = dasd_alias_get_start_dev(base); | |
| 4740 | 4719 | if (!startdev) |
| 4741 | 4720 | startdev = base; |
| 4742 | 4721 | private = startdev->private; |
| @@ -5663,14 +5642,10 @@ static int dasd_eckd_restore_device(struct dasd_device *device) · 920 unmodified lines | ||
| 5663 | 5642 | dasd_eckd_read_features(device); |
| 5664 | 5643 | |
| 5665 | 5644 | /* Read Volume Information */ |
| 5666 | − rc = dasd_eckd_read_vol_info(device); | |
| 5667 | − if (rc) | |
| 5668 | − goto out_err2; | |
| 5645 | + dasd_eckd_read_vol_info(device); | |
| 5669 | 5646 | |
| 5670 | 5647 | /* Read Extent Pool Information */ |
| 5671 | − rc = dasd_eckd_read_ext_pool_info(device); | |
| 5672 | − if (rc) | |
| 5673 | − goto out_err2; | |
| 5648 | + dasd_eckd_read_ext_pool_info(device); | |
| 5674 | 5649 | |
| 5675 | 5650 | /* Read Device Characteristics */ |
| 5676 | 5651 | rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC, |
| @@ -6521,20 +6496,8 @@ static void dasd_eckd_setup_blk_queue(struct dasd_block *block) · 844 unmodified lines | ||
| 6521 | 6496 | unsigned int logical_block_size = block->bp_block; |
| 6522 | 6497 | struct request_queue *q = block->request_queue; |
| 6523 | 6498 | struct dasd_device *device = block->base; |
| 6524 | − struct dasd_eckd_private *private; | |
| 6525 | − unsigned int max_discard_sectors; | |
| 6526 | − unsigned int max_bytes; | |
| 6527 | − unsigned int ext_bytes; /* Extent Size in Bytes */ | |
| 6528 | − int recs_per_trk; | |
| 6529 | − int trks_per_cyl; | |
| 6530 | − int ext_limit; | |
| 6531 | − int ext_size; /* Extent Size in Cylinders */ | |
| 6532 | 6499 | int max; |
| 6533 | 6500 | |
| 6534 | − private = device->private; | |
| 6535 | − trks_per_cyl = private->rdc_data.trk_per_cyl; | |
| 6536 | − recs_per_trk = recs_per_track(&private->rdc_data, 0, logical_block_size); | |
| 6537 | − | |
| 6538 | 6501 | if (device->features & DASD_FEATURE_USERAW) { |
| 6539 | 6502 | /* |
| 6540 | 6503 | * the max_blocks value for raw_track access is 256 |
| @@ -6555,28 +6518,6 @@ static void dasd_eckd_setup_blk_queue(struct dasd_block *block) · 14 unmodified lines | ||
| 6555 | 6518 | /* With page sized segments each segment can be translated into one idaw/tidaw */ |
| 6556 | 6519 | blk_queue_max_segment_size(q, PAGE_SIZE); |
| 6557 | 6520 | blk_queue_segment_boundary(q, PAGE_SIZE - 1); |
| 6558 | − | |
| 6559 | − if (dasd_eckd_is_ese(device)) { | |
| 6560 | − /* | |
| 6561 | − * Depending on the extent size, up to UINT_MAX bytes can be | |
| 6562 | − * accepted. However, neither DASD_ECKD_RAS_EXTS_MAX nor the | |
| 6563 | − * device limits should be exceeded. | |
| 6564 | − */ | |
| 6565 | − ext_size = dasd_eckd_ext_size(device); | |
| 6566 | − ext_limit = min(private->real_cyl / ext_size, DASD_ECKD_RAS_EXTS_MAX); | |
| 6567 | − ext_bytes = ext_size * trks_per_cyl * recs_per_trk * | |
| 6568 | − logical_block_size; | |
| 6569 | − max_bytes = UINT_MAX - (UINT_MAX % ext_bytes); | |
| 6570 | − if (max_bytes / ext_bytes > ext_limit) | |
| 6571 | − max_bytes = ext_bytes * ext_limit; | |
| 6572 | − | |
| 6573 | − max_discard_sectors = max_bytes / 512; | |
| 6574 | − | |
| 6575 | − blk_queue_max_discard_sectors(q, max_discard_sectors); | |
| 6576 | − blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); | |
| 6577 | − q->limits.discard_granularity = ext_bytes; | |
| 6578 | − q->limits.discard_alignment = ext_bytes; | |
| 6579 | − } | |
| 6580 | 6521 | } |
| 6581 | 6522 | |
| 6582 | 6523 | static struct ccw_driver dasd_eckd_driver = { |
| @@ -113,7 +113,7 @@ static void set_impl_params(struct qdio_irq *irq_ptr, · 112 unmodified lines | ||
| 113 | 113 | irq_ptr->qib.pfmt = qib_param_field_format; |
| 114 | 114 | if (qib_param_field) |
| 115 | 115 | memcpy(irq_ptr->qib.parm, qib_param_field, |
| 116 | − QDIO_MAX_BUFFERS_PER_Q); | |
| 116 | + sizeof(irq_ptr->qib.parm)); | |
| 117 | 117 | |
| 118 | 118 | if (!input_slib_elements) |
| 119 | 119 | goto output; |
| @@ -4715,8 +4715,7 @@ static int qeth_qdio_establish(struct qeth_card *card) · 4714 unmodified lines | ||
| 4715 | 4715 | |
| 4716 | 4716 | QETH_CARD_TEXT(card, 2, "qdioest"); |
| 4717 | 4717 | |
| 4718 | − qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q, | |
| 4719 | − GFP_KERNEL); | |
| 4718 | + qib_param_field = kzalloc(FIELD_SIZEOF(struct qib, parm), GFP_KERNEL); | |
| 4720 | 4719 | if (!qib_param_field) { |
| 4721 | 4720 | rc = -ENOMEM; |
| 4722 | 4721 | goto out_free_nothing; |
| @@ -1923,6 +1923,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · 1922 unmodified lines | ||
| 1923 | 1923 | struct fcoe_fcp_rsp_payload *fcp_rsp; |
| 1924 | 1924 | struct bnx2fc_rport *tgt = io_req->tgt; |
| 1925 | 1925 | struct scsi_cmnd *sc_cmd; |
| 1926 | + u16 scope = 0, qualifier = 0; | |
| 1926 | 1927 | |
| 1927 | 1928 | /* scsi_cmd_cmpl is called with tgt lock held */ |
| 1928 | 1929 | |
| @@ -1990,12 +1991,30 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · 61 unmodified lines | ||
| 1990 | 1991 | |
| 1991 | 1992 | if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL || |
| 1992 | 1993 | io_req->cdb_status == SAM_STAT_BUSY) { |
| 1993 | − /* Set the jiffies + retry_delay_timer * 100ms | |
| 1994 | − for the rport/tgt */ | |
| 1995 | − tgt->retry_delay_timestamp = jiffies + | |
| 1996 | − fcp_rsp->retry_delay_timer * HZ / 10; | |
| 1994 | + /* Newer array firmware with BUSY or | |
| 1995 | + * TASK_SET_FULL may return a status that needs | |
| 1996 | + * the scope bits masked. | |
| 1997 | + * Or a huge delay timestamp up to 27 minutes | |
| 1998 | + * can result. | |
| 1999 | + */ | |
| 2000 | + if (fcp_rsp->retry_delay_timer) { | |
| 2001 | + /* Upper 2 bits */ | |
| 2002 | + scope = fcp_rsp->retry_delay_timer | |
| 2003 | + & 0xC000; | |
| 2004 | + /* Lower 14 bits */ | |
| 2005 | + qualifier = fcp_rsp->retry_delay_timer | |
| 2006 | + & 0x3FFF; | |
| 2007 | + } | |
| 2008 | + if (scope > 0 && qualifier > 0 && | |
| 2009 | + qualifier <= 0x3FEF) { | |
| 2010 | + /* Set the jiffies + | |
| 2011 | + * retry_delay_timer * 100ms | |
| 2012 | + * for the rport/tgt | |
| 2013 | + */ | |
| 2014 | + tgt->retry_delay_timestamp = jiffies + | |
| 2015 | + (qualifier * HZ / 10); | |
| 2016 | + } | |
| 1997 | 2017 | } |
| 1998 | − | |
| 1999 | 2018 | } |
| 2000 | 2019 | if (io_req->fcp_resid) |
| 2001 | 2020 | scsi_set_resid(sc_cmd, io_req->fcp_resid); |
| @@ -3683,7 +3683,7 @@ void hisi_sas_debugfs_work_handler(struct work_struct *work) · 3682 unmodified lines | ||
| 3683 | 3683 | } |
| 3684 | 3684 | EXPORT_SYMBOL_GPL(hisi_sas_debugfs_work_handler); |
| 3685 | 3685 | |
| 3686 | −void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) | |
| 3686 | +static void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) | |
| 3687 | 3687 | { |
| 3688 | 3688 | struct device *dev = hisi_hba->dev; |
| 3689 | 3689 | int i; |
| @@ -3705,7 +3705,7 @@ void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba) · 15 unmodified lines | ||
| 3705 | 3705 | devm_kfree(dev, hisi_hba->debugfs_port_reg[i]); |
| 3706 | 3706 | } |
| 3707 | 3707 | |
| 3708 | −int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba) | |
| 3708 | +static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba) | |
| 3709 | 3709 | { |
| 3710 | 3710 | const struct hisi_sas_hw *hw = hisi_hba->hw; |
| 3711 | 3711 | struct device *dev = hisi_hba->dev; |
| @@ -3796,7 +3796,7 @@ fail: · 84 unmodified lines | ||
| 3796 | 3796 | return -ENOMEM; |
| 3797 | 3797 | } |
| 3798 | 3798 | |
| 3799 | −void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) | |
| 3799 | +static void hisi_sas_debugfs_bist_init(struct hisi_hba *hisi_hba) | |
| 3800 | 3800 | { |
| 3801 | 3801 | hisi_hba->debugfs_bist_dentry = |
| 3802 | 3802 | debugfs_create_dir("bist", hisi_hba->debugfs_dir); |
| @@ -4183,11 +4183,11 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 4182 unmodified lines | ||
| 4183 | 4183 | */ |
| 4184 | 4184 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ && |
| 4185 | 4185 | pdev->subsystem_device == 0xC000) |
| 4186 | − return -ENODEV; | |
| 4186 | + goto out_disable_device; | |
| 4187 | 4187 | /* Now check the magic signature byte */ |
| 4188 | 4188 | pci_read_config_word(pdev, PCI_CONF_AMISIG, &magic); |
| 4189 | 4189 | if (magic != HBA_SIGNATURE_471 && magic != HBA_SIGNATURE) |
| 4190 | − return -ENODEV; | |
| 4190 | + goto out_disable_device; | |
| 4191 | 4191 | /* Ok it is probably a megaraid */ |
| 4192 | 4192 | } |
| 4193 | 4193 | |
| @@ -596,7 +596,7 @@ static void qedf_dcbx_handler(void *dev, struct qed_dcbx_get *get, u32 mib_type) · 595 unmodified lines | ||
| 596 | 596 | tmp_prio = get->operational.app_prio.fcoe; |
| 597 | 597 | if (qedf_default_prio > -1) |
| 598 | 598 | qedf->prio = qedf_default_prio; |
| 599 | − else if (tmp_prio < 0 || tmp_prio > 7) { | |
| 599 | + else if (tmp_prio > 7) { | |
| 600 | 600 | QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, |
| 601 | 601 | "FIP/FCoE prio %d out of range, setting to %d.\n", |
| 602 | 602 | tmp_prio, QEDF_DEFAULT_PRIO); |
| @@ -2920,6 +2920,8 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) · 2919 unmodified lines | ||
| 2920 | 2920 | struct qla_hw_data *ha = vha->hw; |
| 2921 | 2921 | uint16_t id = vha->vp_idx; |
| 2922 | 2922 | |
| 2923 | + set_bit(VPORT_DELETE, &vha->dpc_flags); | |
| 2924 | + | |
| 2923 | 2925 | while (test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags) || |
| 2924 | 2926 | test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) |
| 2925 | 2927 | msleep(1000); |
| @@ -2396,6 +2396,7 @@ typedef struct fc_port { · 2395 unmodified lines | ||
| 2396 | 2396 | unsigned int query:1; |
| 2397 | 2397 | unsigned int id_changed:1; |
| 2398 | 2398 | unsigned int scan_needed:1; |
| 2399 | + unsigned int n2n_flag:1; | |
| 2399 | 2400 | |
| 2400 | 2401 | struct completion nvme_del_done; |
| 2401 | 2402 | uint32_t nvme_prli_service_param; |
| @@ -2446,7 +2447,6 @@ typedef struct fc_port { · 44 unmodified lines | ||
| 2446 | 2447 | uint8_t fc4_type; |
| 2447 | 2448 | uint8_t fc4f_nvme; |
| 2448 | 2449 | uint8_t scan_state; |
| 2449 | − uint8_t n2n_flag; | |
| 2450 | 2450 | |
| 2451 | 2451 | unsigned long last_queue_full; |
| 2452 | 2452 | unsigned long last_ramp_up; |
| @@ -3036,6 +3036,7 @@ enum scan_flags_t { · 583 unmodified lines | ||
| 3036 | 3036 | enum fc4type_t { |
| 3037 | 3037 | FS_FC4TYPE_FCP = BIT_0, |
| 3038 | 3038 | FS_FC4TYPE_NVME = BIT_1, |
| 3039 | + FS_FCP_IS_N2N = BIT_7, | |
| 3039 | 3040 | }; |
| 3040 | 3041 | |
| 3041 | 3042 | struct fab_scan_rp { |
| @@ -4394,6 +4395,7 @@ typedef struct scsi_qla_host { · 1352 unmodified lines | ||
| 4394 | 4395 | #define IOCB_WORK_ACTIVE 31 |
| 4395 | 4396 | #define SET_ZIO_THRESHOLD_NEEDED 32 |
| 4396 | 4397 | #define ISP_ABORT_TO_ROM 33 |
| 4398 | +#define VPORT_DELETE 34 | |
| 4397 | 4399 | |
| 4398 | 4400 | unsigned long pci_flags; |
| 4399 | 4401 | #define PFLG_DISCONNECTED 0 /* PCI device removed */ |
| @@ -3102,7 +3102,8 @@ int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id) · 3101 unmodified lines | ||
| 3102 | 3102 | { |
| 3103 | 3103 | struct qla_work_evt *e; |
| 3104 | 3104 | |
| 3105 | − if (test_bit(UNLOADING, &vha->dpc_flags)) | |
| 3105 | + if (test_bit(UNLOADING, &vha->dpc_flags) || | |
| 3106 | + (vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags))) | |
| 3106 | 3107 | return 0; |
| 3107 | 3108 | |
| 3108 | 3109 | e = qla2x00_alloc_work(vha, QLA_EVT_GPNID); |
| @@ -746,12 +746,15 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, · 745 unmodified lines | ||
| 746 | 746 | break; |
| 747 | 747 | default: |
| 748 | 748 | if ((id.b24 != fcport->d_id.b24 && |
| 749 | − fcport->d_id.b24) || | |
| 749 | + fcport->d_id.b24 && | |
| 750 | + fcport->loop_id != FC_NO_LOOP_ID) || | |
| 750 | 751 | (fcport->loop_id != FC_NO_LOOP_ID && |
| 751 | 752 | fcport->loop_id != loop_id)) { |
| 752 | 753 | ql_dbg(ql_dbg_disc, vha, 0x20e3, |
| 753 | 754 | "%s %d %8phC post del sess\n", |
| 754 | 755 | __func__, __LINE__, fcport->port_name); |
| 756 | + if (fcport->n2n_flag) | |
| 757 | + fcport->d_id.b24 = 0; | |
| 755 | 758 | qlt_schedule_sess_for_deletion(fcport); |
| 756 | 759 | return; |
| 757 | 760 | } |
| @@ -759,6 +762,8 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, · 1 unmodified line | ||
| 759 | 762 | } |
| 760 | 763 | |
| 761 | 764 | fcport->loop_id = loop_id; |
| 765 | + if (fcport->n2n_flag) | |
| 766 | + fcport->d_id.b24 = id.b24; | |
| 762 | 767 | |
| 763 | 768 | wwn = wwn_to_u64(fcport->port_name); |
| 764 | 769 | qlt_find_sess_invalidate_other(vha, wwn, |
| @@ -972,7 +977,7 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res) · 207 unmodified lines | ||
| 972 | 977 | wwn = wwn_to_u64(e->port_name); |
| 973 | 978 | |
| 974 | 979 | ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20e8, |
| 975 | − "%s %8phC %02x:%02x:%02x state %d/%d lid %x \n", | |
| 980 | + "%s %8phC %02x:%02x:%02x CLS %x/%x lid %x \n", | |
| 976 | 981 | __func__, (void *)&wwn, e->port_id[2], e->port_id[1], |
| 977 | 982 | e->port_id[0], e->current_login_state, e->last_login_state, |
| 978 | 983 | (loop_id & 0x7fff)); |
| @@ -1499,7 +1504,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) · 520 unmodified lines | ||
| 1499 | 1504 | (fcport->fw_login_state == DSC_LS_PRLI_PEND))) |
| 1500 | 1505 | return 0; |
| 1501 | 1506 | |
| 1502 | − if (fcport->fw_login_state == DSC_LS_PLOGI_COMP) { | |
| 1507 | + if (fcport->fw_login_state == DSC_LS_PLOGI_COMP && | |
| 1508 | + !N2N_TOPO(vha->hw)) { | |
| 1503 | 1509 | if (time_before_eq(jiffies, fcport->plogi_nack_done_deadline)) { |
| 1504 | 1510 | set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
| 1505 | 1511 | return 0; |
| @@ -1570,8 +1576,9 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) · 64 unmodified lines | ||
| 1570 | 1576 | qla24xx_post_gpdb_work(vha, fcport, 0); |
| 1571 | 1577 | } else { |
| 1572 | 1578 | ql_dbg(ql_dbg_disc, vha, 0x2118, |
| 1573 | − "%s %d %8phC post NVMe PRLI\n", | |
| 1574 | − __func__, __LINE__, fcport->port_name); | |
| 1579 | + "%s %d %8phC post %s PRLI\n", | |
| 1580 | + __func__, __LINE__, fcport->port_name, | |
| 1581 | + fcport->fc4f_nvme ? "NVME" : "FC"); | |
| 1575 | 1582 | qla24xx_post_prli_work(vha, fcport); |
| 1576 | 1583 | } |
| 1577 | 1584 | break; |
| @@ -1853,17 +1860,38 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea) · 275 unmodified lines | ||
| 1853 | 1860 | break; |
| 1854 | 1861 | } |
| 1855 | 1862 | |
| 1856 | − if (ea->fcport->n2n_flag) { | |
| 1863 | + if (ea->fcport->fc4f_nvme) { | |
| 1857 | 1864 | ql_dbg(ql_dbg_disc, vha, 0x2118, |
| 1858 | 1865 | "%s %d %8phC post fc4 prli\n", |
| 1859 | 1866 | __func__, __LINE__, ea->fcport->port_name); |
| 1860 | 1867 | ea->fcport->fc4f_nvme = 0; |
| 1861 | − ea->fcport->n2n_flag = 0; | |
| 1862 | 1868 | qla24xx_post_prli_work(vha, ea->fcport); |
| 1869 | + return; | |
| 1870 | + } | |
| 1871 | + | |
| 1872 | + /* at this point both PRLI NVME & PRLI FCP failed */ | |
| 1873 | + if (N2N_TOPO(vha->hw)) { | |
| 1874 | + if (ea->fcport->n2n_link_reset_cnt < 3) { | |
| 1875 | + ea->fcport->n2n_link_reset_cnt++; | |
| 1876 | + /* | |
| 1877 | + * remote port is not sending Plogi. Reset | |
| 1878 | + * link to kick start his state machine | |
| 1879 | + */ | |
| 1880 | + set_bit(N2N_LINK_RESET, &vha->dpc_flags); | |
| 1881 | + } else { | |
| 1882 | + ql_log(ql_log_warn, vha, 0x2119, | |
| 1883 | + "%s %d %8phC Unable to reconnect\n", | |
| 1884 | + __func__, __LINE__, ea->fcport->port_name); | |
| 1885 | + } | |
| 1886 | + } else { | |
| 1887 | + /* | |
| 1888 | + * switch connect. login failed. Take connection | |
| 1889 | + * down and allow relogin to retrigger | |
| 1890 | + */ | |
| 1891 | + ea->fcport->flags &= ~FCF_ASYNC_SENT; | |
| 1892 | + ea->fcport->keep_nport_handle = 0; | |
| 1893 | + qlt_schedule_sess_for_deletion(ea->fcport); | |
| 1863 | 1894 | } |
| 1864 | − ql_dbg(ql_dbg_disc, vha, 0x2119, | |
| 1865 | − "%s %d %8phC unhandle event of %x\n", | |
| 1866 | − __func__, __LINE__, ea->fcport->port_name, ea->data[0]); | |
| 1867 | 1895 | break; |
| 1868 | 1896 | } |
| 1869 | 1897 | } |
| @@ -3190,7 +3218,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) · 1320 unmodified lines | ||
| 3190 | 3218 | |
| 3191 | 3219 | for (j = 0; j < 2; j++, fwdt++) { |
| 3192 | 3220 | if (!fwdt->template) { |
| 3193 | − ql_log(ql_log_warn, vha, 0x00ba, | |
| 3221 | + ql_dbg(ql_dbg_init, vha, 0x00ba, | |
| 3194 | 3222 | "-> fwdt%u no template\n", j); |
| 3195 | 3223 | continue; |
| 3196 | 3224 | } |
| @@ -4986,28 +5014,47 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) · 1789 unmodified lines | ||
| 4986 | 5014 | unsigned long flags; |
| 4987 | 5015 | |
| 4988 | 5016 | /* Inititae N2N login. */ |
| 4989 | − if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) { | |
| 4990 | − /* borrowing */ | |
| 4991 | − u32 *bp, i, sz; | |
| 4992 | − | |
| 4993 | − memset(ha->init_cb, 0, ha->init_cb_size); | |
| 4994 | − sz = min_t(int, sizeof(struct els_plogi_payload), | |
| 4995 | − ha->init_cb_size); | |
| 4996 | − rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma, | |
| 4997 | − (void *)ha->init_cb, sz); | |
| 4998 | − if (rval == QLA_SUCCESS) { | |
| 4999 | − bp = (uint32_t *)ha->init_cb; | |
| 5000 | − for (i = 0; i < sz/4 ; i++, bp++) | |
| 5001 | − *bp = cpu_to_be32(*bp); | |
| 5017 | + if (N2N_TOPO(ha)) { | |
| 5018 | + if (test_and_clear_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags)) { | |
| 5019 | + /* borrowing */ | |
| 5020 | + u32 *bp, i, sz; | |
| 5021 | + | |
| 5022 | + memset(ha->init_cb, 0, ha->init_cb_size); | |
| 5023 | + sz = min_t(int, sizeof(struct els_plogi_payload), | |
| 5024 | + ha->init_cb_size); | |
| 5025 | + rval = qla24xx_get_port_login_templ(vha, | |
| 5026 | + ha->init_cb_dma, (void *)ha->init_cb, sz); | |
| 5027 | + if (rval == QLA_SUCCESS) { | |
| 5028 | + bp = (uint32_t *)ha->init_cb; | |
| 5029 | + for (i = 0; i < sz/4 ; i++, bp++) | |
| 5030 | + *bp = cpu_to_be32(*bp); | |
| 5002 | 5031 | |
| 5003 | − memcpy(&ha->plogi_els_payld.data, (void *)ha->init_cb, | |
| 5004 | − sizeof(ha->plogi_els_payld.data)); | |
| 5005 | − set_bit(RELOGIN_NEEDED, &vha->dpc_flags); | |
| 5006 | − } else { | |
| 5007 | − ql_dbg(ql_dbg_init, vha, 0x00d1, | |
| 5008 | − "PLOGI ELS param read fail.\n"); | |
| 5032 | + memcpy(&ha->plogi_els_payld.data, | |
| 5033 | + (void *)ha->init_cb, | |
| 5034 | + sizeof(ha->plogi_els_payld.data)); | |
| 5035 | + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); | |
| 5036 | + } else { | |
| 5037 | + ql_dbg(ql_dbg_init, vha, 0x00d1, | |
| 5038 | + "PLOGI ELS param read fail.\n"); | |
| 5039 | + goto skip_login; | |
| 5040 | + } | |
| 5041 | + } | |
| 5042 | + | |
| 5043 | + list_for_each_entry(fcport, &vha->vp_fcports, list) { | |
| 5044 | + if (fcport->n2n_flag) { | |
| 5045 | + qla24xx_fcport_handle_login(vha, fcport); | |
| 5046 | + return QLA_SUCCESS; | |
| 5047 | + } | |
| 5048 | + } | |
| 5049 | +skip_login: | |
| 5050 | + spin_lock_irqsave(&vha->work_lock, flags); | |
| 5051 | + vha->scan.scan_retry++; | |
| 5052 | + spin_unlock_irqrestore(&vha->work_lock, flags); | |
| 5053 | + | |
| 5054 | + if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { | |
| 5055 | + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); | |
| 5056 | + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); | |
| 5009 | 5057 | } |
| 5010 | − return QLA_SUCCESS; | |
| 5011 | 5058 | } |
| 5012 | 5059 | |
| 5013 | 5060 | found_devs = 0; |
| @@ -2656,9 +2656,10 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) · 2655 unmodified lines | ||
| 2656 | 2656 | els_iocb->port_id[0] = sp->fcport->d_id.b.al_pa; |
| 2657 | 2657 | els_iocb->port_id[1] = sp->fcport->d_id.b.area; |
| 2658 | 2658 | els_iocb->port_id[2] = sp->fcport->d_id.b.domain; |
| 2659 | − els_iocb->s_id[0] = vha->d_id.b.al_pa; | |
| 2660 | − els_iocb->s_id[1] = vha->d_id.b.area; | |
| 2661 | − els_iocb->s_id[2] = vha->d_id.b.domain; | |
| 2659 | + /* For SID the byte order is different than DID */ | |
| 2660 | + els_iocb->s_id[1] = vha->d_id.b.al_pa; | |
| 2661 | + els_iocb->s_id[2] = vha->d_id.b.area; | |
| 2662 | + els_iocb->s_id[0] = vha->d_id.b.domain; | |
| 2662 | 2663 | |
| 2663 | 2664 | if (elsio->u.els_logo.els_cmd == ELS_DCMD_PLOGI) { |
| 2664 | 2665 | els_iocb->control_flags = 0; |
| @@ -2249,7 +2249,7 @@ qla2x00_lip_reset(scsi_qla_host_t *vha) · 2248 unmodified lines | ||
| 2249 | 2249 | mbx_cmd_t mc; |
| 2250 | 2250 | mbx_cmd_t *mcp = &mc; |
| 2251 | 2251 | |
| 2252 | − ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x105a, | |
| 2252 | + ql_dbg(ql_dbg_disc, vha, 0x105a, | |
| 2253 | 2253 | "Entered %s.\n", __func__); |
| 2254 | 2254 | |
| 2255 | 2255 | if (IS_CNA_CAPABLE(vha->hw)) { |
| @@ -3883,14 +3883,24 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 1627 unmodified lines | ||
| 3883 | 3883 | case TOPO_N2N: |
| 3884 | 3884 | ha->current_topology = ISP_CFG_N; |
| 3885 | 3885 | spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); |
| 3886 | + list_for_each_entry(fcport, &vha->vp_fcports, list) { | |
| 3887 | + fcport->scan_state = QLA_FCPORT_SCAN; | |
| 3888 | + fcport->n2n_flag = 0; | |
| 3889 | + } | |
| 3890 | + | |
| 3886 | 3891 | fcport = qla2x00_find_fcport_by_wwpn(vha, |
| 3887 | 3892 | rptid_entry->u.f1.port_name, 1); |
| 3888 | 3893 | spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); |
| 3889 | 3894 | |
| 3890 | 3895 | if (fcport) { |
| 3891 | 3896 | fcport->plogi_nack_done_deadline = jiffies + HZ; |
| 3892 | − fcport->dm_login_expire = jiffies + 3*HZ; | |
| 3897 | + fcport->dm_login_expire = jiffies + 2*HZ; | |
| 3893 | 3898 | fcport->scan_state = QLA_FCPORT_FOUND; |
| 3899 | + fcport->n2n_flag = 1; | |
| 3900 | + fcport->keep_nport_handle = 1; | |
| 3901 | + if (vha->flags.nvme_enabled) | |
| 3902 | + fcport->fc4f_nvme = 1; | |
| 3903 | + | |
| 3894 | 3904 | switch (fcport->disc_state) { |
| 3895 | 3905 | case DSC_DELETED: |
| 3896 | 3906 | set_bit(RELOGIN_NEEDED, |
| @@ -3924,7 +3934,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 27 unmodified lines | ||
| 3924 | 3934 | rptid_entry->u.f1.port_name, |
| 3925 | 3935 | rptid_entry->u.f1.node_name, |
| 3926 | 3936 | NULL, |
| 3927 | − FC4_TYPE_UNKNOWN); | |
| 3937 | + FS_FCP_IS_N2N); | |
| 3928 | 3938 | } |
| 3929 | 3939 | |
| 3930 | 3940 | /* if our portname is higher then initiate N2N login */ |
| @@ -4023,6 +4033,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 92 unmodified lines | ||
| 4023 | 4033 | |
| 4024 | 4034 | list_for_each_entry(fcport, &vha->vp_fcports, list) { |
| 4025 | 4035 | fcport->scan_state = QLA_FCPORT_SCAN; |
| 4036 | + fcport->n2n_flag = 0; | |
| 4026 | 4037 | } |
| 4027 | 4038 | |
| 4028 | 4039 | fcport = qla2x00_find_fcport_by_wwpn(vha, |
| @@ -4032,6 +4043,14 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 3 unmodified lines | ||
| 4032 | 4043 | fcport->login_retry = vha->hw->login_retry_count; |
| 4033 | 4044 | fcport->plogi_nack_done_deadline = jiffies + HZ; |
| 4034 | 4045 | fcport->scan_state = QLA_FCPORT_FOUND; |
| 4046 | + fcport->keep_nport_handle = 1; | |
| 4047 | + fcport->n2n_flag = 1; | |
| 4048 | + fcport->d_id.b.domain = | |
| 4049 | + rptid_entry->u.f2.remote_nport_id[2]; | |
| 4050 | + fcport->d_id.b.area = | |
| 4051 | + rptid_entry->u.f2.remote_nport_id[1]; | |
| 4052 | + fcport->d_id.b.al_pa = | |
| 4053 | + rptid_entry->u.f2.remote_nport_id[0]; | |
| 4035 | 4054 | } |
| 4036 | 4055 | } |
| 4037 | 4056 | } |
| @@ -66,6 +66,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 65 unmodified lines | ||
| 66 | 66 | uint16_t vp_id; |
| 67 | 67 | struct qla_hw_data *ha = vha->hw; |
| 68 | 68 | unsigned long flags = 0; |
| 69 | + u8 i; | |
| 69 | 70 | |
| 70 | 71 | mutex_lock(&ha->vport_lock); |
| 71 | 72 | /* |
| @@ -75,8 +76,9 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) · 3 unmodified lines | ||
| 75 | 76 | * ensures no active vp_list traversal while the vport is removed |
| 76 | 77 | * from the queue) |
| 77 | 78 | */ |
| 78 | − wait_event_timeout(vha->vref_waitq, !atomic_read(&vha->vref_count), | |
| 79 | − 10*HZ); | |
| 79 | + for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++) | |
| 80 | + wait_event_timeout(vha->vref_waitq, | |
| 81 | + atomic_read(&vha->vref_count), HZ); | |
| 80 | 82 | |
| 81 | 83 | spin_lock_irqsave(&ha->vport_slock, flags); |
| 82 | 84 | if (atomic_read(&vha->vref_count)) { |
| @@ -262,6 +264,9 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 179 unmodified lines | ||
| 262 | 264 | spin_lock_irqsave(&ha->vport_slock, flags); |
| 263 | 265 | list_for_each_entry(vha, &ha->vp_list, list) { |
| 264 | 266 | if (vha->vp_idx) { |
| 267 | + if (test_bit(VPORT_DELETE, &vha->dpc_flags)) | |
| 268 | + continue; | |
| 269 | + | |
| 265 | 270 | atomic_inc(&vha->vref_count); |
| 266 | 271 | spin_unlock_irqrestore(&ha->vport_slock, flags); |
| 267 | 272 | |
| @@ -300,6 +305,20 @@ qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) · 32 unmodified lines | ||
| 300 | 305 | int |
| 301 | 306 | qla2x00_vp_abort_isp(scsi_qla_host_t *vha) |
| 302 | 307 | { |
| 308 | + fc_port_t *fcport; | |
| 309 | + | |
| 310 | + /* | |
| 311 | + * To exclusively reset vport, we need to log it out first. | |
| 312 | + * Note: This control_vp can fail if ISP reset is already | |
| 313 | + * issued, this is expected, as the vp would be already | |
| 314 | + * logged out due to ISP reset. | |
| 315 | + */ | |
| 316 | + if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) { | |
| 317 | + qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | |
| 318 | + list_for_each_entry(fcport, &vha->vp_fcports, list) | |
| 319 | + fcport->logout_on_delete = 0; | |
| 320 | + } | |
| 321 | + | |
| 303 | 322 | /* |
| 304 | 323 | * Physical port will do most of the abort and recovery work. We can |
| 305 | 324 | * just treat it as a loop down |
| @@ -312,16 +331,9 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha) · 6 unmodified lines | ||
| 312 | 331 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
| 313 | 332 | } |
| 314 | 333 | |
| 315 | − /* | |
| 316 | − * To exclusively reset vport, we need to log it out first. Note: this | |
| 317 | − * control_vp can fail if ISP reset is already issued, this is | |
| 318 | − * expected, as the vp would be already logged out due to ISP reset. | |
| 319 | − */ | |
| 320 | − if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) | |
| 321 | − qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | |
| 322 | − | |
| 323 | 334 | ql_dbg(ql_dbg_taskm, vha, 0x801d, |
| 324 | 335 | "Scheduling enable of Vport %d.\n", vha->vp_idx); |
| 336 | + | |
| 325 | 337 | return qla24xx_enable_vp(vha); |
| 326 | 338 | } |
| 327 | 339 | |
| @@ -1115,9 +1115,15 @@ static inline int test_fcport_count(scsi_qla_host_t *vha) · 1114 unmodified lines | ||
| 1115 | 1115 | void |
| 1116 | 1116 | qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha) |
| 1117 | 1117 | { |
| 1118 | + u8 i; | |
| 1119 | + | |
| 1118 | 1120 | qla2x00_mark_all_devices_lost(vha, 0); |
| 1119 | 1121 | |
| 1120 | − wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), 10*HZ); | |
| 1122 | + for (i = 0; i < 10; i++) | |
| 1123 | + wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha), | |
| 1124 | + HZ); | |
| 1125 | + | |
| 1126 | + flush_workqueue(vha->hw->wq); | |
| 1121 | 1127 | } |
| 1122 | 1128 | |
| 1123 | 1129 | /* |
| @@ -5036,6 +5042,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · 3912 unmodified lines | ||
| 5036 | 5042 | |
| 5037 | 5043 | memcpy(fcport->port_name, e->u.new_sess.port_name, |
| 5038 | 5044 | WWN_SIZE); |
| 5045 | + | |
| 5046 | + if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) | |
| 5047 | + fcport->n2n_flag = 1; | |
| 5048 | + | |
| 5039 | 5049 | } else { |
| 5040 | 5050 | ql_dbg(ql_dbg_disc, vha, 0xffff, |
| 5041 | 5051 | "%s %8phC mem alloc fail.\n", |
| @@ -5134,11 +5144,9 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · 92 unmodified lines | ||
| 5134 | 5144 | if (dfcp) |
| 5135 | 5145 | qlt_schedule_sess_for_deletion(tfcp); |
| 5136 | 5146 | |
| 5137 | − | |
| 5138 | − if (N2N_TOPO(vha->hw)) | |
| 5139 | − fcport->flags &= ~FCF_FABRIC_DEVICE; | |
| 5140 | − | |
| 5141 | 5147 | if (N2N_TOPO(vha->hw)) { |
| 5148 | + fcport->flags &= ~FCF_FABRIC_DEVICE; | |
| 5149 | + fcport->keep_nport_handle = 1; | |
| 5142 | 5150 | if (vha->flags.nvme_enabled) { |
| 5143 | 5151 | fcport->fc4f_nvme = 1; |
| 5144 | 5152 | fcport->n2n_flag = 1; |
| @@ -953,7 +953,7 @@ void qlt_free_session_done(struct work_struct *work) · 952 unmodified lines | ||
| 953 | 953 | struct qla_hw_data *ha = vha->hw; |
| 954 | 954 | unsigned long flags; |
| 955 | 955 | bool logout_started = false; |
| 956 | − scsi_qla_host_t *base_vha; | |
| 956 | + scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | |
| 957 | 957 | struct qlt_plogi_ack_t *own = |
| 958 | 958 | sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN]; |
| 959 | 959 | |
| @@ -1020,6 +1020,7 @@ void qlt_free_session_done(struct work_struct *work) · 60 unmodified lines | ||
| 1020 | 1020 | |
| 1021 | 1021 | if (logout_started) { |
| 1022 | 1022 | bool traced = false; |
| 1023 | + u16 cnt = 0; | |
| 1023 | 1024 | |
| 1024 | 1025 | while (!READ_ONCE(sess->logout_completed)) { |
| 1025 | 1026 | if (!traced) { |
| @@ -1029,6 +1030,9 @@ void qlt_free_session_done(struct work_struct *work) · 3 unmodified lines | ||
| 1029 | 1030 | traced = true; |
| 1030 | 1031 | } |
| 1031 | 1032 | msleep(100); |
| 1033 | + cnt++; | |
| 1034 | + if (cnt > 200) | |
| 1035 | + break; | |
| 1032 | 1036 | } |
| 1033 | 1037 | |
| 1034 | 1038 | ql_dbg(ql_dbg_disc, vha, 0xf087, |
| @@ -1101,6 +1105,7 @@ void qlt_free_session_done(struct work_struct *work) · 66 unmodified lines | ||
| 1101 | 1105 | } |
| 1102 | 1106 | |
| 1103 | 1107 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
| 1108 | + sess->free_pending = 0; | |
| 1104 | 1109 | |
| 1105 | 1110 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf001, |
| 1106 | 1111 | "Unregistration of sess %p %8phC finished fcp_cnt %d\n", |
| @@ -1109,17 +1114,9 @@ void qlt_free_session_done(struct work_struct *work) · 2 unmodified lines | ||
| 1109 | 1114 | if (tgt && (tgt->sess_count == 0)) |
| 1110 | 1115 | wake_up_all(&tgt->waitQ); |
| 1111 | 1116 | |
| 1112 | − if (vha->fcport_count == 0) | |
| 1113 | − wake_up_all(&vha->fcport_waitQ); | |
| 1114 | − | |
| 1115 | − base_vha = pci_get_drvdata(ha->pdev); | |
| 1116 | − | |
| 1117 | − sess->free_pending = 0; | |
| 1118 | − | |
| 1119 | − if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags)) | |
| 1120 | − return; | |
| 1121 | − | |
| 1122 | − if ((!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) { | |
| 1117 | + if (!test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags) && | |
| 1118 | + !(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)) && | |
| 1119 | + (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) { | |
| 1123 | 1120 | switch (vha->host->active_mode) { |
| 1124 | 1121 | case MODE_INITIATOR: |
| 1125 | 1122 | case MODE_DUAL: |
| @@ -1132,6 +1129,9 @@ void qlt_free_session_done(struct work_struct *work) · 6 unmodified lines | ||
| 1132 | 1129 | break; |
| 1133 | 1130 | } |
| 1134 | 1131 | } |
| 1132 | + | |
| 1133 | + if (vha->fcport_count == 0) | |
| 1134 | + wake_up_all(&vha->fcport_waitQ); | |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /* ha->tgt.sess_lock supposed to be held on entry */ |
| @@ -1161,7 +1161,7 @@ void qlt_unreg_sess(struct fc_port *sess) · 23 unmodified lines | ||
| 1161 | 1161 | sess->last_login_gen = sess->login_gen; |
| 1162 | 1162 | |
| 1163 | 1163 | INIT_WORK(&sess->free_work, qlt_free_session_done); |
| 1164 | − schedule_work(&sess->free_work); | |
| 1164 | + queue_work(sess->vha->hw->wq, &sess->free_work); | |
| 1165 | 1165 | } |
| 1166 | 1166 | EXPORT_SYMBOL(qlt_unreg_sess); |
| 1167 | 1167 | |
| @@ -1837,8 +1837,7 @@ static int storvsc_probe(struct hv_device *device, · 1836 unmodified lines | ||
| 1837 | 1837 | /* |
| 1838 | 1838 | * Set the number of HW queues we are supporting. |
| 1839 | 1839 | */ |
| 1840 | − if (stor_device->num_sc != 0) | |
| 1841 | − host->nr_hw_queues = stor_device->num_sc + 1; | |
| 1840 | + host->nr_hw_queues = num_present_cpus(); | |
| 1842 | 1841 | |
| 1843 | 1842 | /* |
| 1844 | 1843 | * Set the error handler work queue. |
| @@ -8143,6 +8143,9 @@ int ufshcd_shutdown(struct ufs_hba *hba) · 8142 unmodified lines | ||
| 8143 | 8143 | { |
| 8144 | 8144 | int ret = 0; |
| 8145 | 8145 | |
| 8146 | + if (!hba->is_powered) | |
| 8147 | + goto out; | |
| 8148 | + | |
| 8146 | 8149 | if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) |
| 8147 | 8150 | goto out; |
| 8148 | 8151 | |
| @@ -349,10 +349,8 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · 348 unmodified lines | ||
| 349 | 349 | */ |
| 350 | 350 | dst_release(skb_dst(skb)); |
| 351 | 351 | skb_dst_set(skb, NULL); |
| 352 | −#ifdef CONFIG_XFRM | |
| 353 | − secpath_reset(skb); | |
| 354 | −#endif | |
| 355 | − nf_reset(skb); | |
| 352 | + skb_ext_reset(skb); | |
| 353 | + nf_reset_ct(skb); | |
| 356 | 354 | |
| 357 | 355 | #ifdef CONFIG_NET_SCHED |
| 358 | 356 | skb->tc_index = 0; |
| @@ -18,23 +18,6 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | # How to generate logo's |
| 20 | 20 | |
| 21 | −# Use logo-cfiles to retrieve list of .c files to be built | |
| 22 | −logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \ | |
| 23 | − $(wildcard $(srctree)/$(src)/*$(1).$(2)))) | |
| 24 | − | |
| 25 | − | |
| 26 | −# Mono logos | |
| 27 | −extra-y += $(call logo-cfiles,_mono,pbm) | |
| 28 | − | |
| 29 | −# VGA16 logos | |
| 30 | −extra-y += $(call logo-cfiles,_vga16,ppm) | |
| 31 | − | |
| 32 | −# 224 Logos | |
| 33 | −extra-y += $(call logo-cfiles,_clut224,ppm) | |
| 34 | − | |
| 35 | −# Gray 256 | |
| 36 | −extra-y += $(call logo-cfiles,_gray256,pgm) | |
| 37 | − | |
| 38 | 21 | pnmtologo := scripts/pnmtologo |
| 39 | 22 | |
| 40 | 23 | # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..." |
| @@ -55,5 +38,5 @@ $(obj)/%_clut224.c: $(src)/%_clut224.ppm $(pnmtologo) FORCE · 14 unmodified lines | ||
| 55 | 38 | $(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE |
| 56 | 39 | $(call if_changed,logo) |
| 57 | 40 | |
| 58 | −# Files generated that shall be removed upon make clean | |
| 59 | −clean-files := *.o *_mono.c *_vga16.c *_clut224.c *_gray256.c | |
| 41 | +# generated C files | |
| 42 | +targets += *_mono.c *_vga16.c *_clut224.c *_gray256.c | |
| @@ -156,8 +156,10 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); · 155 unmodified lines | ||
| 156 | 156 | (GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC) |
| 157 | 157 | |
| 158 | 158 | /* balloon_append: add the given page to the balloon. */ |
| 159 | −static void __balloon_append(struct page *page) | |
| 159 | +static void balloon_append(struct page *page) | |
| 160 | 160 | { |
| 161 | + __SetPageOffline(page); | |
| 162 | + | |
| 161 | 163 | /* Lowmem is re-populated first, so highmem pages go at list tail. */ |
| 162 | 164 | if (PageHighMem(page)) { |
| 163 | 165 | list_add_tail(&page->lru, &ballooned_pages); |
| @@ -169,11 +171,6 @@ static void __balloon_append(struct page *page) · 5 unmodified lines | ||
| 169 | 171 | wake_up(&balloon_wq); |
| 170 | 172 | } |
| 171 | 173 | |
| 172 | −static void balloon_append(struct page *page) | |
| 173 | −{ | |
| 174 | − __balloon_append(page); | |
| 175 | −} | |
| 176 | − | |
| 177 | 174 | /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ |
| 178 | 175 | static struct page *balloon_retrieve(bool require_lowmem) |
| 179 | 176 | { |
| @@ -192,6 +189,7 @@ static struct page *balloon_retrieve(bool require_lowmem) · 12 unmodified lines | ||
| 192 | 189 | else |
| 193 | 190 | balloon_stats.balloon_low--; |
| 194 | 191 | |
| 192 | + __ClearPageOffline(page); | |
| 195 | 193 | return page; |
| 196 | 194 | } |
| 197 | 195 | |
| @@ -377,8 +375,7 @@ static void xen_online_page(struct page *page, unsigned int order) · 179 unmodified lines | ||
| 377 | 375 | for (i = 0; i < size; i++) { |
| 378 | 376 | p = pfn_to_page(start_pfn + i); |
| 379 | 377 | __online_page_set_limits(p); |
| 380 | − __SetPageOffline(p); | |
| 381 | − __balloon_append(p); | |
| 378 | + balloon_append(p); | |
| 382 | 379 | } |
| 383 | 380 | mutex_unlock(&balloon_mutex); |
| 384 | 381 | } |
| @@ -444,7 +441,6 @@ static enum bp_state increase_reservation(unsigned long nr_pages) · 59 unmodified lines | ||
| 444 | 441 | xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]); |
| 445 | 442 | |
| 446 | 443 | /* Relinquish the page back to the allocator. */ |
| 447 | − __ClearPageOffline(page); | |
| 448 | 444 | free_reserved_page(page); |
| 449 | 445 | } |
| 450 | 446 | |
| @@ -471,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 20 unmodified lines | ||
| 471 | 467 | state = BP_EAGAIN; |
| 472 | 468 | break; |
| 473 | 469 | } |
| 474 | − __SetPageOffline(page); | |
| 475 | 470 | adjust_managed_page_count(page, -1); |
| 476 | 471 | xenmem_reservation_scrub_page(page); |
| 477 | 472 | list_add(&page->lru, &pages); |
| @@ -611,7 +606,6 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) · 133 unmodified lines | ||
| 611 | 606 | while (pgno < nr_pages) { |
| 612 | 607 | page = balloon_retrieve(true); |
| 613 | 608 | if (page) { |
| 614 | − __ClearPageOffline(page); | |
| 615 | 609 | pages[pgno++] = page; |
| 616 | 610 | #ifdef CONFIG_XEN_HAVE_PVMMU |
| 617 | 611 | /* |
| @@ -653,10 +647,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 35 unmodified lines | ||
| 653 | 647 | mutex_lock(&balloon_mutex); |
| 654 | 648 | |
| 655 | 649 | for (i = 0; i < nr_pages; i++) { |
| 656 | − if (pages[i]) { | |
| 657 | − __SetPageOffline(pages[i]); | |
| 650 | + if (pages[i]) | |
| 658 | 651 | balloon_append(pages[i]); |
| 659 | − } | |
| 660 | 652 | } |
| 661 | 653 | |
| 662 | 654 | balloon_stats.target_unpopulated -= nr_pages; |
| @@ -674,7 +666,6 @@ static void __init balloon_add_region(unsigned long start_pfn, · 11 unmodified lines | ||
| 674 | 666 | unsigned long pages) |
| 675 | 667 | { |
| 676 | 668 | unsigned long pfn, extra_pfn_end; |
| 677 | − struct page *page; | |
| 678 | 669 | |
| 679 | 670 | /* |
| 680 | 671 | * If the amount of usable memory has been limited (e.g., with |
| @@ -684,11 +675,10 @@ static void __init balloon_add_region(unsigned long start_pfn, · 3 unmodified lines | ||
| 684 | 675 | extra_pfn_end = min(max_pfn, start_pfn + pages); |
| 685 | 676 | |
| 686 | 677 | for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) { |
| 687 | − page = pfn_to_page(pfn); | |
| 688 | 678 | /* totalram_pages and totalhigh_pages do not |
| 689 | 679 | include the boot-time balloon extension, so |
| 690 | 680 | don't subtract from it. */ |
| 691 | − __balloon_append(page); | |
| 681 | + balloon_append(pfn_to_page(pfn)); | |
| 692 | 682 | } |
| 693 | 683 | |
| 694 | 684 | balloon_stats.total_pages += extra_pfn_end - start_pfn; |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | #define efi_data(op) (op.u.efi_runtime_call) |
| 42 | 42 | |
| 43 | −efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | |
| 43 | +static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | |
| 44 | 44 | { |
| 45 | 45 | struct xen_platform_op op = INIT_EFI_OP(get_time); |
| 46 | 46 | |
| @@ -61,9 +61,8 @@ efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) · 14 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | return efi_data(op).status; |
| 63 | 63 | } |
| 64 | −EXPORT_SYMBOL_GPL(xen_efi_get_time); | |
| 65 | 64 | |
| 66 | −efi_status_t xen_efi_set_time(efi_time_t *tm) | |
| 65 | +static efi_status_t xen_efi_set_time(efi_time_t *tm) | |
| 67 | 66 | { |
| 68 | 67 | struct xen_platform_op op = INIT_EFI_OP(set_time); |
| 69 | 68 | |
| @@ -75,10 +74,10 @@ efi_status_t xen_efi_set_time(efi_time_t *tm) · 5 unmodified lines | ||
| 75 | 74 | |
| 76 | 75 | return efi_data(op).status; |
| 77 | 76 | } |
| 78 | −EXPORT_SYMBOL_GPL(xen_efi_set_time); | |
| 79 | 77 | |
| 80 | −efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, | |
| 81 | − efi_time_t *tm) | |
| 78 | +static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, | |
| 79 | + efi_bool_t *pending, | |
| 80 | + efi_time_t *tm) | |
| 82 | 81 | { |
| 83 | 82 | struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); |
| 84 | 83 | |
| @@ -98,9 +97,8 @@ efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, · 13 unmodified lines | ||
| 98 | 97 | |
| 99 | 98 | return efi_data(op).status; |
| 100 | 99 | } |
| 101 | −EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time); | |
| 102 | 100 | |
| 103 | −efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) | |
| 101 | +static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) | |
| 104 | 102 | { |
| 105 | 103 | struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); |
| 106 | 104 | |
| @@ -117,11 +115,10 @@ efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) · 10 unmodified lines | ||
| 117 | 115 | |
| 118 | 116 | return efi_data(op).status; |
| 119 | 117 | } |
| 120 | −EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time); | |
| 121 | 118 | |
| 122 | −efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 123 | − u32 *attr, unsigned long *data_size, | |
| 124 | − void *data) | |
| 119 | +static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 120 | + u32 *attr, unsigned long *data_size, | |
| 121 | + void *data) | |
| 125 | 122 | { |
| 126 | 123 | struct xen_platform_op op = INIT_EFI_OP(get_variable); |
| 127 | 124 | |
| @@ -141,11 +138,10 @@ efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, · 13 unmodified lines | ||
| 141 | 138 | |
| 142 | 139 | return efi_data(op).status; |
| 143 | 140 | } |
| 144 | −EXPORT_SYMBOL_GPL(xen_efi_get_variable); | |
| 145 | 141 | |
| 146 | −efi_status_t xen_efi_get_next_variable(unsigned long *name_size, | |
| 147 | − efi_char16_t *name, | |
| 148 | − efi_guid_t *vendor) | |
| 142 | +static efi_status_t xen_efi_get_next_variable(unsigned long *name_size, | |
| 143 | + efi_char16_t *name, | |
| 144 | + efi_guid_t *vendor) | |
| 149 | 145 | { |
| 150 | 146 | struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name); |
| 151 | 147 | |
| @@ -165,11 +161,10 @@ efi_status_t xen_efi_get_next_variable(unsigned long *name_size, · 13 unmodified lines | ||
| 165 | 161 | |
| 166 | 162 | return efi_data(op).status; |
| 167 | 163 | } |
| 168 | −EXPORT_SYMBOL_GPL(xen_efi_get_next_variable); | |
| 169 | 164 | |
| 170 | −efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 171 | − u32 attr, unsigned long data_size, | |
| 172 | − void *data) | |
| 165 | +static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 166 | + u32 attr, unsigned long data_size, | |
| 167 | + void *data) | |
| 173 | 168 | { |
| 174 | 169 | struct xen_platform_op op = INIT_EFI_OP(set_variable); |
| 175 | 170 | |
| @@ -186,11 +181,10 @@ efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, · 10 unmodified lines | ||
| 186 | 181 | |
| 187 | 182 | return efi_data(op).status; |
| 188 | 183 | } |
| 189 | −EXPORT_SYMBOL_GPL(xen_efi_set_variable); | |
| 190 | 184 | |
| 191 | −efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, | |
| 192 | − u64 *remaining_space, | |
| 193 | − u64 *max_variable_size) | |
| 185 | +static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, | |
| 186 | + u64 *remaining_space, | |
| 187 | + u64 *max_variable_size) | |
| 194 | 188 | { |
| 195 | 189 | struct xen_platform_op op = INIT_EFI_OP(query_variable_info); |
| 196 | 190 | |
| @@ -208,9 +202,8 @@ efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, · 11 unmodified lines | ||
| 208 | 202 | |
| 209 | 203 | return efi_data(op).status; |
| 210 | 204 | } |
| 211 | −EXPORT_SYMBOL_GPL(xen_efi_query_variable_info); | |
| 212 | 205 | |
| 213 | −efi_status_t xen_efi_get_next_high_mono_count(u32 *count) | |
| 206 | +static efi_status_t xen_efi_get_next_high_mono_count(u32 *count) | |
| 214 | 207 | { |
| 215 | 208 | struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); |
| 216 | 209 | |
| @@ -221,10 +214,9 @@ efi_status_t xen_efi_get_next_high_mono_count(u32 *count) · 4 unmodified lines | ||
| 221 | 214 | |
| 222 | 215 | return efi_data(op).status; |
| 223 | 216 | } |
| 224 | −EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count); | |
| 225 | 217 | |
| 226 | −efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, | |
| 227 | − unsigned long count, unsigned long sg_list) | |
| 218 | +static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, | |
| 219 | + unsigned long count, unsigned long sg_list) | |
| 228 | 220 | { |
| 229 | 221 | struct xen_platform_op op = INIT_EFI_OP(update_capsule); |
| 230 | 222 | |
| @@ -241,11 +233,9 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, · 10 unmodified lines | ||
| 241 | 233 | |
| 242 | 234 | return efi_data(op).status; |
| 243 | 235 | } |
| 244 | −EXPORT_SYMBOL_GPL(xen_efi_update_capsule); | |
| 245 | 236 | |
| 246 | −efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, | |
| 247 | − unsigned long count, u64 *max_size, | |
| 248 | − int *reset_type) | |
| 237 | +static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, | |
| 238 | + unsigned long count, u64 *max_size, int *reset_type) | |
| 249 | 239 | { |
| 250 | 240 | struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); |
| 251 | 241 | |
| @@ -264,10 +254,9 @@ efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, · 12 unmodified lines | ||
| 264 | 254 | |
| 265 | 255 | return efi_data(op).status; |
| 266 | 256 | } |
| 267 | −EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps); | |
| 268 | 257 | |
| 269 | −void xen_efi_reset_system(int reset_type, efi_status_t status, | |
| 270 | − unsigned long data_size, efi_char16_t *data) | |
| 258 | +static void xen_efi_reset_system(int reset_type, efi_status_t status, | |
| 259 | + unsigned long data_size, efi_char16_t *data) | |
| 271 | 260 | { |
| 272 | 261 | switch (reset_type) { |
| 273 | 262 | case EFI_RESET_COLD: |
| @@ -281,4 +270,25 @@ void xen_efi_reset_system(int reset_type, efi_status_t status, · 7 unmodified lines | ||
| 281 | 270 | BUG(); |
| 282 | 271 | } |
| 283 | 272 | } |
| 284 | −EXPORT_SYMBOL_GPL(xen_efi_reset_system); | |
| 273 | + | |
| 274 | +/* | |
| 275 | + * Set XEN EFI runtime services function pointers. Other fields of struct efi, | |
| 276 | + * e.g. efi.systab, will be set like normal EFI. | |
| 277 | + */ | |
| 278 | +void __init xen_efi_runtime_setup(void) | |
| 279 | +{ | |
| 280 | + efi.get_time = xen_efi_get_time; | |
| 281 | + efi.set_time = xen_efi_set_time; | |
| 282 | + efi.get_wakeup_time = xen_efi_get_wakeup_time; | |
| 283 | + efi.set_wakeup_time = xen_efi_set_wakeup_time; | |
| 284 | + efi.get_variable = xen_efi_get_variable; | |
| 285 | + efi.get_next_variable = xen_efi_get_next_variable; | |
| 286 | + efi.set_variable = xen_efi_set_variable; | |
| 287 | + efi.set_variable_nonblocking = xen_efi_set_variable; | |
| 288 | + efi.query_variable_info = xen_efi_query_variable_info; | |
| 289 | + efi.query_variable_info_nonblocking = xen_efi_query_variable_info; | |
| 290 | + efi.update_capsule = xen_efi_update_capsule; | |
| 291 | + efi.query_capsule_caps = xen_efi_query_capsule_caps; | |
| 292 | + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; | |
| 293 | + efi.reset_system = xen_efi_reset_system; | |
| 294 | +} | |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | #include <linux/string.h> |
| 56 | 56 | #include <linux/slab.h> |
| 57 | 57 | #include <linux/miscdevice.h> |
| 58 | +#include <linux/workqueue.h> | |
| 58 | 59 | |
| 59 | 60 | #include <xen/xenbus.h> |
| 60 | 61 | #include <xen/xen.h> |
| @@ -116,6 +117,8 @@ struct xenbus_file_priv { · 55 unmodified lines | ||
| 116 | 117 | wait_queue_head_t read_waitq; |
| 117 | 118 | |
| 118 | 119 | struct kref kref; |
| 120 | + | |
| 121 | + struct work_struct wq; | |
| 119 | 122 | }; |
| 120 | 123 | |
| 121 | 124 | /* Read out any raw xenbus messages queued up. */ |
| @@ -300,14 +303,14 @@ static void watch_fired(struct xenbus_watch *watch, · 178 unmodified lines | ||
| 300 | 303 | mutex_unlock(&adap->dev_data->reply_mutex); |
| 301 | 304 | } |
| 302 | 305 | |
| 303 | −static void xenbus_file_free(struct kref *kref) | |
| 306 | +static void xenbus_worker(struct work_struct *wq) | |
| 304 | 307 | { |
| 305 | 308 | struct xenbus_file_priv *u; |
| 306 | 309 | struct xenbus_transaction_holder *trans, *tmp; |
| 307 | 310 | struct watch_adapter *watch, *tmp_watch; |
| 308 | 311 | struct read_buffer *rb, *tmp_rb; |
| 309 | 312 | |
| 310 | − u = container_of(kref, struct xenbus_file_priv, kref); | |
| 313 | + u = container_of(wq, struct xenbus_file_priv, wq); | |
| 311 | 314 | |
| 312 | 315 | /* |
| 313 | 316 | * No need for locking here because there are no other users, |
| @@ -333,6 +336,18 @@ static void xenbus_file_free(struct kref *kref) · 19 unmodified lines | ||
| 333 | 336 | kfree(u); |
| 334 | 337 | } |
| 335 | 338 | |
| 339 | +static void xenbus_file_free(struct kref *kref) | |
| 340 | +{ | |
| 341 | + struct xenbus_file_priv *u; | |
| 342 | + | |
| 343 | + /* | |
| 344 | + * We might be called in xenbus_thread(). | |
| 345 | + * Use workqueue to avoid deadlock. | |
| 346 | + */ | |
| 347 | + u = container_of(kref, struct xenbus_file_priv, kref); | |
| 348 | + schedule_work(&u->wq); | |
| 349 | +} | |
| 350 | + | |
| 336 | 351 | static struct xenbus_transaction_holder *xenbus_get_transaction( |
| 337 | 352 | struct xenbus_file_priv *u, uint32_t tx_id) |
| 338 | 353 | { |
| @@ -650,6 +665,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) · 311 unmodified lines | ||
| 650 | 665 | INIT_LIST_HEAD(&u->watches); |
| 651 | 666 | INIT_LIST_HEAD(&u->read_buffers); |
| 652 | 667 | init_waitqueue_head(&u->read_waitq); |
| 668 | + INIT_WORK(&u->wq, xenbus_worker); | |
| 653 | 669 | |
| 654 | 670 | mutex_init(&u->reply_mutex); |
| 655 | 671 | mutex_init(&u->msgbuffer_mutex); |
| @@ -879,7 +879,7 @@ out_free_interp: · 878 unmodified lines | ||
| 879 | 879 | the correct location in memory. */ |
| 880 | 880 | for(i = 0, elf_ppnt = elf_phdata; |
| 881 | 881 | i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { |
| 882 | − int elf_prot, elf_flags, elf_fixed = MAP_FIXED_NOREPLACE; | |
| 882 | + int elf_prot, elf_flags; | |
| 883 | 883 | unsigned long k, vaddr; |
| 884 | 884 | unsigned long total_size = 0; |
| 885 | 885 | |
| @@ -911,13 +911,6 @@ out_free_interp: · 25 unmodified lines | ||
| 911 | 911 | */ |
| 912 | 912 | } |
| 913 | 913 | } |
| 914 | − | |
| 915 | − /* | |
| 916 | − * Some binaries have overlapping elf segments and then | |
| 917 | − * we have to forcefully map over an existing mapping | |
| 918 | − * e.g. over this newly established brk mapping. | |
| 919 | − */ | |
| 920 | − elf_fixed = MAP_FIXED; | |
| 921 | 914 | } |
| 922 | 915 | |
| 923 | 916 | elf_prot = make_prot(elf_ppnt->p_flags); |
| @@ -930,7 +923,7 @@ out_free_interp: · 6 unmodified lines | ||
| 930 | 923 | * the ET_DYN load_addr calculations, proceed normally. |
| 931 | 924 | */ |
| 932 | 925 | if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { |
| 933 | − elf_flags |= elf_fixed; | |
| 926 | + elf_flags |= MAP_FIXED; | |
| 934 | 927 | } else if (loc->elf_ex.e_type == ET_DYN) { |
| 935 | 928 | /* |
| 936 | 929 | * This logic is run once for the first LOAD Program |
| @@ -966,7 +959,7 @@ out_free_interp: · 29 unmodified lines | ||
| 966 | 959 | load_bias = ELF_ET_DYN_BASE; |
| 967 | 960 | if (current->flags & PF_RANDOMIZE) |
| 968 | 961 | load_bias += arch_mmap_rnd(); |
| 969 | − elf_flags |= elf_fixed; | |
| 962 | + elf_flags |= MAP_FIXED; | |
| 970 | 963 | } else |
| 971 | 964 | load_bias = 0; |
| 972 | 965 | |
| @@ -34,11 +34,15 @@ static void erofs_readendio(struct bio *bio) · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr) |
| 36 | 36 | { |
| 37 | − struct inode *const bd_inode = sb->s_bdev->bd_inode; | |
| 38 | − struct address_space *const mapping = bd_inode->i_mapping; | |
| 37 | + struct address_space *const mapping = sb->s_bdev->bd_inode->i_mapping; | |
| 38 | + struct page *page; | |
| 39 | 39 | |
| 40 | − return read_cache_page_gfp(mapping, blkaddr, | |
| 40 | + page = read_cache_page_gfp(mapping, blkaddr, | |
| 41 | 41 | mapping_gfp_constraint(mapping, ~__GFP_FS)); |
| 42 | + /* should already be PageUptodate */ | |
| 43 | + if (!IS_ERR(page)) | |
| 44 | + lock_page(page); | |
| 45 | + return page; | |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | static int erofs_map_blocks_flatmode(struct inode *inode, |
| @@ -105,9 +105,9 @@ static int erofs_read_superblock(struct super_block *sb) · 104 unmodified lines | ||
| 105 | 105 | int ret; |
| 106 | 106 | |
| 107 | 107 | page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL); |
| 108 | − if (!page) { | |
| 108 | + if (IS_ERR(page)) { | |
| 109 | 109 | erofs_err(sb, "cannot read erofs superblock"); |
| 110 | − return -EIO; | |
| 110 | + return PTR_ERR(page); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | sbi = EROFS_SB(sb); |
| @@ -575,7 +575,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, · 574 unmodified lines | ||
| 575 | 575 | struct erofs_map_blocks *const map = &fe->map; |
| 576 | 576 | struct z_erofs_collector *const clt = &fe->clt; |
| 577 | 577 | const loff_t offset = page_offset(page); |
| 578 | − bool tight = (clt->mode >= COLLECT_PRIMARY_HOOKED); | |
| 578 | + bool tight = true; | |
| 579 | 579 | |
| 580 | 580 | enum z_erofs_cache_alloctype cache_strategy; |
| 581 | 581 | enum z_erofs_page_type page_type; |
| @@ -628,8 +628,16 @@ restart_now: · 46 unmodified lines | ||
| 628 | 628 | preload_compressed_pages(clt, MNGD_MAPPING(sbi), |
| 629 | 629 | cache_strategy, pagepool); |
| 630 | 630 | |
| 631 | − tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED); | |
| 632 | 631 | hitted: |
| 632 | + /* | |
| 633 | + * Ensure the current partial page belongs to this submit chain rather | |
| 634 | + * than other concurrent submit chains or the noio(bypass) chain since | |
| 635 | + * those chains are handled asynchronously thus the page cannot be used | |
| 636 | + * for inplace I/O or pagevec (should be processed in strict order.) | |
| 637 | + */ | |
| 638 | + tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED && | |
| 639 | + clt->mode != COLLECT_PRIMARY_FOLLOWED_NOINPLACE); | |
| 640 | + | |
| 633 | 641 | cur = end - min_t(unsigned int, offset + end - map->m_la, end); |
| 634 | 642 | if (!(map->m_flags & EROFS_MAP_MAPPED)) { |
| 635 | 643 | zero_user_segment(page, cur, end); |
| @@ -1892,15 +1892,15 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 1891 unmodified lines | ||
| 1892 | 1892 | unsigned count, req_dist, tail_index; |
| 1893 | 1893 | struct io_ring_ctx *ctx = req->ctx; |
| 1894 | 1894 | struct list_head *entry; |
| 1895 | − struct timespec ts; | |
| 1895 | + struct timespec64 ts; | |
| 1896 | 1896 | |
| 1897 | 1897 | if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) |
| 1898 | 1898 | return -EINVAL; |
| 1899 | 1899 | if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->timeout_flags || |
| 1900 | 1900 | sqe->len != 1) |
| 1901 | 1901 | return -EINVAL; |
| 1902 | − if (copy_from_user(&ts, (void __user *) (unsigned long) sqe->addr, | |
| 1903 | − sizeof(ts))) | |
| 1902 | + | |
| 1903 | + if (get_timespec64(&ts, u64_to_user_ptr(sqe->addr))) | |
| 1904 | 1904 | return -EFAULT; |
| 1905 | 1905 | |
| 1906 | 1906 | /* |
| @@ -1934,7 +1934,7 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 27 unmodified lines | ||
| 1934 | 1934 | |
| 1935 | 1935 | hrtimer_init(&req->timeout.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
| 1936 | 1936 | req->timeout.timer.function = io_timeout_fn; |
| 1937 | − hrtimer_start(&req->timeout.timer, timespec_to_ktime(ts), | |
| 1937 | + hrtimer_start(&req->timeout.timer, timespec64_to_ktime(ts), | |
| 1938 | 1938 | HRTIMER_MODE_REL); |
| 1939 | 1939 | return 0; |
| 1940 | 1940 | } |
| @@ -20,9 +20,63 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/syscalls.h> |
| 21 | 21 | #include <linux/unistd.h> |
| 22 | 22 | #include <linux/compat.h> |
| 23 | − | |
| 24 | 23 | #include <linux/uaccess.h> |
| 25 | 24 | |
| 25 | +#include <asm/unaligned.h> | |
| 26 | + | |
| 27 | +/* | |
| 28 | + * Note the "unsafe_put_user() semantics: we goto a | |
| 29 | + * label for errors. | |
| 30 | + * | |
| 31 | + * Also note how we use a "while()" loop here, even though | |
| 32 | + * only the biggest size needs to loop. The compiler (well, | |
| 33 | + * at least gcc) is smart enough to turn the smaller sizes | |
| 34 | + * into just if-statements, and this way we don't need to | |
| 35 | + * care whether 'u64' or 'u32' is the biggest size. | |
| 36 | + */ | |
| 37 | +#define unsafe_copy_loop(dst, src, len, type, label) \ | |
| 38 | + while (len >= sizeof(type)) { \ | |
| 39 | + unsafe_put_user(get_unaligned((type *)src), \ | |
| 40 | + (type __user *)dst, label); \ | |
| 41 | + dst += sizeof(type); \ | |
| 42 | + src += sizeof(type); \ | |
| 43 | + len -= sizeof(type); \ | |
| 44 | + } | |
| 45 | + | |
| 46 | +/* | |
| 47 | + * We avoid doing 64-bit copies on 32-bit architectures. They | |
| 48 | + * might be better, but the component names are mostly small, | |
| 49 | + * and the 64-bit cases can end up being much more complex and | |
| 50 | + * put much more register pressure on the code, so it's likely | |
| 51 | + * not worth the pain of unaligned accesses etc. | |
| 52 | + * | |
| 53 | + * So limit the copies to "unsigned long" size. I did verify | |
| 54 | + * that at least the x86-32 case is ok without this limiting, | |
| 55 | + * but I worry about random other legacy 32-bit cases that | |
| 56 | + * might not do as well. | |
| 57 | + */ | |
| 58 | +#define unsafe_copy_type(dst, src, len, type, label) do { \ | |
| 59 | + if (sizeof(type) <= sizeof(unsigned long)) \ | |
| 60 | + unsafe_copy_loop(dst, src, len, type, label); \ | |
| 61 | +} while (0) | |
| 62 | + | |
| 63 | +/* | |
| 64 | + * Copy the dirent name to user space, and NUL-terminate | |
| 65 | + * it. This should not be a function call, since we're doing | |
| 66 | + * the copy inside a "user_access_begin/end()" section. | |
| 67 | + */ | |
| 68 | +#define unsafe_copy_dirent_name(_dst, _src, _len, label) do { \ | |
| 69 | + char __user *dst = (_dst); \ | |
| 70 | + const char *src = (_src); \ | |
| 71 | + size_t len = (_len); \ | |
| 72 | + unsafe_copy_type(dst, src, len, u64, label); \ | |
| 73 | + unsafe_copy_type(dst, src, len, u32, label); \ | |
| 74 | + unsafe_copy_type(dst, src, len, u16, label); \ | |
| 75 | + unsafe_copy_type(dst, src, len, u8, label); \ | |
| 76 | + unsafe_put_user(0, dst, label); \ | |
| 77 | +} while (0) | |
| 78 | + | |
| 79 | + | |
| 26 | 80 | int iterate_dir(struct file *file, struct dir_context *ctx) |
| 27 | 81 | { |
| 28 | 82 | struct inode *inode = file_inode(file); |
| @@ -64,6 +118,40 @@ out: · 35 unmodified lines | ||
| 64 | 118 | } |
| 65 | 119 | EXPORT_SYMBOL(iterate_dir); |
| 66 | 120 | |
| 121 | +/* | |
| 122 | + * POSIX says that a dirent name cannot contain NULL or a '/'. | |
| 123 | + * | |
| 124 | + * It's not 100% clear what we should really do in this case. | |
| 125 | + * The filesystem is clearly corrupted, but returning a hard | |
| 126 | + * error means that you now don't see any of the other names | |
| 127 | + * either, so that isn't a perfect alternative. | |
| 128 | + * | |
| 129 | + * And if you return an error, what error do you use? Several | |
| 130 | + * filesystems seem to have decided on EUCLEAN being the error | |
| 131 | + * code for EFSCORRUPTED, and that may be the error to use. Or | |
| 132 | + * just EIO, which is perhaps more obvious to users. | |
| 133 | + * | |
| 134 | + * In order to see the other file names in the directory, the | |
| 135 | + * caller might want to make this a "soft" error: skip the | |
| 136 | + * entry, and return the error at the end instead. | |
| 137 | + * | |
| 138 | + * Note that this should likely do a "memchr(name, 0, len)" | |
| 139 | + * check too, since that would be filesystem corruption as | |
| 140 | + * well. However, that case can't actually confuse user space, | |
| 141 | + * which has to do a strlen() on the name anyway to find the | |
| 142 | + * filename length, and the above "soft error" worry means | |
| 143 | + * that it's probably better left alone until we have that | |
| 144 | + * issue clarified. | |
| 145 | + */ | |
| 146 | +static int verify_dirent_name(const char *name, int len) | |
| 147 | +{ | |
| 148 | + if (WARN_ON_ONCE(!len)) | |
| 149 | + return -EIO; | |
| 150 | + if (WARN_ON_ONCE(memchr(name, '/', len))) | |
| 151 | + return -EIO; | |
| 152 | + return 0; | |
| 153 | +} | |
| 154 | + | |
| 67 | 155 | /* |
| 68 | 156 | * Traditional linux readdir() handling.. |
| 69 | 157 | * |
| @@ -173,6 +261,9 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, · 103 unmodified lines | ||
| 173 | 261 | int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, |
| 174 | 262 | sizeof(long)); |
| 175 | 263 | |
| 264 | + buf->error = verify_dirent_name(name, namlen); | |
| 265 | + if (unlikely(buf->error)) | |
| 266 | + return buf->error; | |
| 176 | 267 | buf->error = -EINVAL; /* only used if we fail.. */ |
| 177 | 268 | if (reclen > buf->count) |
| 178 | 269 | return -EINVAL; |
| @@ -182,28 +273,31 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, · 3 unmodified lines | ||
| 182 | 273 | return -EOVERFLOW; |
| 183 | 274 | } |
| 184 | 275 | dirent = buf->previous; |
| 185 | − if (dirent) { | |
| 186 | − if (signal_pending(current)) | |
| 187 | − return -EINTR; | |
| 188 | − if (__put_user(offset, &dirent->d_off)) | |
| 189 | − goto efault; | |
| 190 | − } | |
| 191 | − dirent = buf->current_dir; | |
| 192 | − if (__put_user(d_ino, &dirent->d_ino)) | |
| 193 | − goto efault; | |
| 194 | − if (__put_user(reclen, &dirent->d_reclen)) | |
| 195 | − goto efault; | |
| 196 | − if (copy_to_user(dirent->d_name, name, namlen)) | |
| 197 | − goto efault; | |
| 198 | − if (__put_user(0, dirent->d_name + namlen)) | |
| 199 | − goto efault; | |
| 200 | − if (__put_user(d_type, (char __user *) dirent + reclen - 1)) | |
| 276 | + if (dirent && signal_pending(current)) | |
| 277 | + return -EINTR; | |
| 278 | + | |
| 279 | + /* | |
| 280 | + * Note! This range-checks 'previous' (which may be NULL). | |
| 281 | + * The real range was checked in getdents | |
| 282 | + */ | |
| 283 | + if (!user_access_begin(dirent, sizeof(*dirent))) | |
| 201 | 284 | goto efault; |
| 285 | + if (dirent) | |
| 286 | + unsafe_put_user(offset, &dirent->d_off, efault_end); | |
| 287 | + dirent = buf->current_dir; | |
| 288 | + unsafe_put_user(d_ino, &dirent->d_ino, efault_end); | |
| 289 | + unsafe_put_user(reclen, &dirent->d_reclen, efault_end); | |
| 290 | + unsafe_put_user(d_type, (char __user *) dirent + reclen - 1, efault_end); | |
| 291 | + unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); | |
| 292 | + user_access_end(); | |
| 293 | + | |
| 202 | 294 | buf->previous = dirent; |
| 203 | 295 | dirent = (void __user *)dirent + reclen; |
| 204 | 296 | buf->current_dir = dirent; |
| 205 | 297 | buf->count -= reclen; |
| 206 | 298 | return 0; |
| 299 | +efault_end: | |
| 300 | + user_access_end(); | |
| 207 | 301 | efault: |
| 208 | 302 | buf->error = -EFAULT; |
| 209 | 303 | return -EFAULT; |
| @@ -259,34 +353,38 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, · 49 unmodified lines | ||
| 259 | 353 | int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, |
| 260 | 354 | sizeof(u64)); |
| 261 | 355 | |
| 356 | + buf->error = verify_dirent_name(name, namlen); | |
| 357 | + if (unlikely(buf->error)) | |
| 358 | + return buf->error; | |
| 262 | 359 | buf->error = -EINVAL; /* only used if we fail.. */ |
| 263 | 360 | if (reclen > buf->count) |
| 264 | 361 | return -EINVAL; |
| 265 | 362 | dirent = buf->previous; |
| 266 | − if (dirent) { | |
| 267 | − if (signal_pending(current)) | |
| 268 | − return -EINTR; | |
| 269 | − if (__put_user(offset, &dirent->d_off)) | |
| 270 | − goto efault; | |
| 271 | − } | |
| 272 | − dirent = buf->current_dir; | |
| 273 | − if (__put_user(ino, &dirent->d_ino)) | |
| 274 | − goto efault; | |
| 275 | − if (__put_user(0, &dirent->d_off)) | |
| 276 | − goto efault; | |
| 277 | − if (__put_user(reclen, &dirent->d_reclen)) | |
| 278 | − goto efault; | |
| 279 | − if (__put_user(d_type, &dirent->d_type)) | |
| 280 | − goto efault; | |
| 281 | − if (copy_to_user(dirent->d_name, name, namlen)) | |
| 282 | − goto efault; | |
| 283 | − if (__put_user(0, dirent->d_name + namlen)) | |
| 363 | + if (dirent && signal_pending(current)) | |
| 364 | + return -EINTR; | |
| 365 | + | |
| 366 | + /* | |
| 367 | + * Note! This range-checks 'previous' (which may be NULL). | |
| 368 | + * The real range was checked in getdents | |
| 369 | + */ | |
| 370 | + if (!user_access_begin(dirent, sizeof(*dirent))) | |
| 284 | 371 | goto efault; |
| 372 | + if (dirent) | |
| 373 | + unsafe_put_user(offset, &dirent->d_off, efault_end); | |
| 374 | + dirent = buf->current_dir; | |
| 375 | + unsafe_put_user(ino, &dirent->d_ino, efault_end); | |
| 376 | + unsafe_put_user(reclen, &dirent->d_reclen, efault_end); | |
| 377 | + unsafe_put_user(d_type, &dirent->d_type, efault_end); | |
| 378 | + unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); | |
| 379 | + user_access_end(); | |
| 380 | + | |
| 285 | 381 | buf->previous = dirent; |
| 286 | 382 | dirent = (void __user *)dirent + reclen; |
| 287 | 383 | buf->current_dir = dirent; |
| 288 | 384 | buf->count -= reclen; |
| 289 | 385 | return 0; |
| 386 | +efault_end: | |
| 387 | + user_access_end(); | |
| 290 | 388 | efault: |
| 291 | 389 | buf->error = -EFAULT; |
| 292 | 390 | return -EFAULT; |
| @@ -318,19 +318,10 @@ COMPAT_SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct compat_statfs __user *, · 317 unmodified lines | ||
| 318 | 318 | static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf) |
| 319 | 319 | { |
| 320 | 320 | struct compat_statfs64 buf; |
| 321 | − if (sizeof(ubuf->f_bsize) == 4) { | |
| 322 | − if ((kbuf->f_type | kbuf->f_bsize | kbuf->f_namelen | | |
| 323 | − kbuf->f_frsize | kbuf->f_flags) & 0xffffffff00000000ULL) | |
| 324 | − return -EOVERFLOW; | |
| 325 | − /* f_files and f_ffree may be -1; it's okay | |
| 326 | − * to stuff that into 32 bits */ | |
| 327 | − if (kbuf->f_files != 0xffffffffffffffffULL | |
| 328 | − && (kbuf->f_files & 0xffffffff00000000ULL)) | |
| 329 | − return -EOVERFLOW; | |
| 330 | − if (kbuf->f_ffree != 0xffffffffffffffffULL | |
| 331 | − && (kbuf->f_ffree & 0xffffffff00000000ULL)) | |
| 332 | − return -EOVERFLOW; | |
| 333 | − } | |
| 321 | + | |
| 322 | + if ((kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL) | |
| 323 | + return -EOVERFLOW; | |
| 324 | + | |
| 334 | 325 | memset(&buf, 0, sizeof(struct compat_statfs64)); |
| 335 | 326 | buf.f_type = kbuf->f_type; |
| 336 | 327 | buf.f_bsize = kbuf->f_bsize; |
| @@ -4,6 +4,13 @@ · 3 unmodified lines | ||
| 4 | 4 | #include <asm/types.h> |
| 5 | 5 | #include <linux/bits.h> |
| 6 | 6 | |
| 7 | +/* Set bits in the first 'n' bytes when loaded from memory */ | |
| 8 | +#ifdef __LITTLE_ENDIAN | |
| 9 | +# define aligned_byte_mask(n) ((1UL << 8*(n))-1) | |
| 10 | +#else | |
| 11 | +# define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n))) | |
| 12 | +#endif | |
| 13 | + | |
| 7 | 14 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) |
| 8 | 15 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) |
| 9 | 16 | |
| @@ -31,6 +31,8 @@ · 30 unmodified lines | ||
| 31 | 31 | #define SJA1105_META_SMAC 0x222222222222ull |
| 32 | 32 | #define SJA1105_META_DMAC 0x0180C200000Eull |
| 33 | 33 | |
| 34 | +#define SJA1105_HWTS_RX_EN 0 | |
| 35 | + | |
| 34 | 36 | /* Global tagger data: each struct sja1105_port has a reference to |
| 35 | 37 | * the structure defined in struct sja1105_private. |
| 36 | 38 | */ |
| @@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines | ||
| 42 | 44 | * from taggers running on multiple ports on SMP systems |
| 43 | 45 | */ |
| 44 | 46 | spinlock_t meta_lock; |
| 45 | − bool hwts_rx_en; | |
| 47 | + unsigned long state; | |
| 46 | 48 | }; |
| 47 | 49 | |
| 48 | 50 | struct sja1105_skb_cb { |
| @@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines | ||
| 1090 | 1090 | |
| 1091 | 1091 | struct kvm_stat_data { |
| 1092 | 1092 | int offset; |
| 1093 | + int mode; | |
| 1093 | 1094 | struct kvm *kvm; |
| 1094 | 1095 | }; |
| 1095 | 1096 | |
| @@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line | ||
| 1097 | 1098 | const char *name; |
| 1098 | 1099 | int offset; |
| 1099 | 1100 | enum kvm_stat_kind kind; |
| 1101 | + int mode; | |
| 1100 | 1102 | }; |
| 1101 | 1103 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
| 1102 | 1104 | extern struct dentry *kvm_debugfs_dir; |
| @@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines | ||
| 455 | 455 | lp_advertising, lpa & LPA_LPACK); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | +static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising, | |
| 459 | + u32 ctrl1000) | |
| 460 | +{ | |
| 461 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising, | |
| 462 | + ctrl1000 & ADVERTISE_1000HALF); | |
| 463 | + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising, | |
| 464 | + ctrl1000 & ADVERTISE_1000FULL); | |
| 465 | +} | |
| 466 | + | |
| 458 | 467 | /** |
| 459 | 468 | * linkmode_adv_to_lcl_adv_t |
| 460 | 469 | * @advertising:pointer to linkmode advertising |
| @@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines | ||
| 678 | 678 | return phydev->state >= PHY_UP; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | +void phy_resolve_aneg_pause(struct phy_device *phydev); | |
| 681 | 682 | void phy_resolve_aneg_linkmode(struct phy_device *phydev); |
| 682 | 683 | |
| 683 | 684 | /** |
| @@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines | ||
| 1076 | 1077 | int __genphy_config_aneg(struct phy_device *phydev, bool changed); |
| 1077 | 1078 | int genphy_aneg_done(struct phy_device *phydev); |
| 1078 | 1079 | int genphy_update_link(struct phy_device *phydev); |
| 1080 | +int genphy_read_lpa(struct phy_device *phydev); | |
| 1079 | 1081 | int genphy_read_status(struct phy_device *phydev); |
| 1080 | 1082 | int genphy_suspend(struct phy_device *phydev); |
| 1081 | 1083 | int genphy_resume(struct phy_device *phydev); |
| @@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} · 4159 unmodified lines | ||
| 4160 | 4160 | static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} |
| 4161 | 4161 | #endif /* CONFIG_SKB_EXTENSIONS */ |
| 4162 | 4162 | |
| 4163 | −static inline void nf_reset(struct sk_buff *skb) | |
| 4163 | +static inline void nf_reset_ct(struct sk_buff *skb) | |
| 4164 | 4164 | { |
| 4165 | 4165 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
| 4166 | 4166 | nf_conntrack_put(skb_nfct(skb)); |
| 4167 | 4167 | skb->_nfct = 0; |
| 4168 | 4168 | #endif |
| 4169 | −#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) | |
| 4170 | − skb_ext_del(skb, SKB_EXT_BRIDGE_NF); | |
| 4171 | −#endif | |
| 4172 | 4169 | } |
| 4173 | 4170 | |
| 4174 | 4171 | static inline void nf_reset_trace(struct sk_buff *skb) |
| @@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from, · 230 unmodified lines | ||
| 231 | 231 | |
| 232 | 232 | #endif /* ARCH_HAS_NOCACHE_UACCESS */ |
| 233 | 233 | |
| 234 | +extern __must_check int check_zeroed_user(const void __user *from, size_t size); | |
| 235 | + | |
| 236 | +/** | |
| 237 | + * copy_struct_from_user: copy a struct from userspace | |
| 238 | + * @dst: Destination address, in kernel space. This buffer must be @ksize | |
| 239 | + * bytes long. | |
| 240 | + * @ksize: Size of @dst struct. | |
| 241 | + * @src: Source address, in userspace. | |
| 242 | + * @usize: (Alleged) size of @src struct. | |
| 243 | + * | |
| 244 | + * Copies a struct from userspace to kernel space, in a way that guarantees | |
| 245 | + * backwards-compatibility for struct syscall arguments (as long as future | |
| 246 | + * struct extensions are made such that all new fields are *appended* to the | |
| 247 | + * old struct, and zeroed-out new fields have the same meaning as the old | |
| 248 | + * struct). | |
| 249 | + * | |
| 250 | + * @ksize is just sizeof(*dst), and @usize should've been passed by userspace. | |
| 251 | + * The recommended usage is something like the following: | |
| 252 | + * | |
| 253 | + * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize) | |
| 254 | + * { | |
| 255 | + * int err; | |
| 256 | + * struct foo karg = {}; | |
| 257 | + * | |
| 258 | + * if (usize > PAGE_SIZE) | |
| 259 | + * return -E2BIG; | |
| 260 | + * if (usize < FOO_SIZE_VER0) | |
| 261 | + * return -EINVAL; | |
| 262 | + * | |
| 263 | + * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize); | |
| 264 | + * if (err) | |
| 265 | + * return err; | |
| 266 | + * | |
| 267 | + * // ... | |
| 268 | + * } | |
| 269 | + * | |
| 270 | + * There are three cases to consider: | |
| 271 | + * * If @usize == @ksize, then it's copied verbatim. | |
| 272 | + * * If @usize < @ksize, then the userspace has passed an old struct to a | |
| 273 | + * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize) | |
| 274 | + * are to be zero-filled. | |
| 275 | + * * If @usize > @ksize, then the userspace has passed a new struct to an | |
| 276 | + * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize) | |
| 277 | + * are checked to ensure they are zeroed, otherwise -E2BIG is returned. | |
| 278 | + * | |
| 279 | + * Returns (in all cases, some data may have been copied): | |
| 280 | + * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src. | |
| 281 | + * * -EFAULT: access to userspace failed. | |
| 282 | + */ | |
| 283 | +static __always_inline __must_check int | |
| 284 | +copy_struct_from_user(void *dst, size_t ksize, const void __user *src, | |
| 285 | + size_t usize) | |
| 286 | +{ | |
| 287 | + size_t size = min(ksize, usize); | |
| 288 | + size_t rest = max(ksize, usize) - size; | |
| 289 | + | |
| 290 | + /* Deal with trailing bytes. */ | |
| 291 | + if (usize < ksize) { | |
| 292 | + memset(dst + size, 0, rest); | |
| 293 | + } else if (usize > ksize) { | |
| 294 | + int ret = check_zeroed_user(src + size, rest); | |
| 295 | + if (ret <= 0) | |
| 296 | + return ret ?: -E2BIG; | |
| 297 | + } | |
| 298 | + /* Copy the interoperable parts of the struct. */ | |
| 299 | + if (copy_from_user(dst, src, size)) | |
| 300 | + return -EFAULT; | |
| 301 | + return 0; | |
| 302 | +} | |
| 303 | + | |
| 234 | 304 | /* |
| 235 | 305 | * probe_kernel_read(): safely attempt to read from a location |
| 236 | 306 | * @dst: pointer to the buffer that shall take the data |
| @@ -1068,7 +1068,7 @@ TRACE_EVENT(rxrpc_recvmsg, · 1067 unmodified lines | ||
| 1068 | 1068 | ), |
| 1069 | 1069 | |
| 1070 | 1070 | TP_fast_assign( |
| 1071 | − __entry->call = call->debug_id; | |
| 1071 | + __entry->call = call ? call->debug_id : 0; | |
| 1072 | 1072 | __entry->why = why; |
| 1073 | 1073 | __entry->seq = seq; |
| 1074 | 1074 | __entry->offset = offset; |
| @@ -1003,6 +1003,8 @@ struct drm_amdgpu_info_device { · 1002 unmodified lines | ||
| 1003 | 1003 | __u64 high_va_max; |
| 1004 | 1004 | /* gfx10 pa_sc_tile_steering_override */ |
| 1005 | 1005 | __u32 pa_sc_tile_steering_override; |
| 1006 | + /* disabled TCCs */ | |
| 1007 | + __u64 tcc_disabled_mask; | |
| 1006 | 1008 | }; |
| 1007 | 1009 | |
| 1008 | 1010 | struct drm_amdgpu_info_hw_ip { |
| @@ -45,6 +45,27 @@ struct nvme_passthru_cmd { · 44 unmodified lines | ||
| 45 | 45 | __u32 result; |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | +struct nvme_passthru_cmd64 { | |
| 49 | + __u8 opcode; | |
| 50 | + __u8 flags; | |
| 51 | + __u16 rsvd1; | |
| 52 | + __u32 nsid; | |
| 53 | + __u32 cdw2; | |
| 54 | + __u32 cdw3; | |
| 55 | + __u64 metadata; | |
| 56 | + __u64 addr; | |
| 57 | + __u32 metadata_len; | |
| 58 | + __u32 data_len; | |
| 59 | + __u32 cdw10; | |
| 60 | + __u32 cdw11; | |
| 61 | + __u32 cdw12; | |
| 62 | + __u32 cdw13; | |
| 63 | + __u32 cdw14; | |
| 64 | + __u32 cdw15; | |
| 65 | + __u32 timeout_ms; | |
| 66 | + __u64 result; | |
| 67 | +}; | |
| 68 | + | |
| 48 | 69 | #define nvme_admin_cmd nvme_passthru_cmd |
| 49 | 70 | |
| 50 | 71 | #define NVME_IOCTL_ID _IO('N', 0x40) |
| @@ -54,5 +75,7 @@ struct nvme_passthru_cmd { · 3 unmodified lines | ||
| 54 | 75 | #define NVME_IOCTL_RESET _IO('N', 0x44) |
| 55 | 76 | #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) |
| 56 | 77 | #define NVME_IOCTL_RESCAN _IO('N', 0x46) |
| 78 | +#define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64) | |
| 79 | +#define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64) | |
| 57 | 80 | |
| 58 | 81 | #endif /* _UAPI_LINUX_NVME_IOCTL_H */ |
| @@ -35,6 +35,9 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | +#ifndef _UAPI_LINUX_PG_H | |
| 39 | +#define _UAPI_LINUX_PG_H | |
| 40 | + | |
| 38 | 41 | #define PG_MAGIC 'P' |
| 39 | 42 | #define PG_RESET 'Z' |
| 40 | 43 | #define PG_COMMAND 'C' |
| @@ -61,4 +64,4 @@ struct pg_read_hdr { · 20 unmodified lines | ||
| 61 | 64 | |
| 62 | 65 | }; |
| 63 | 66 | |
| 64 | −/* end of pg.h */ | |
| 67 | +#endif /* _UAPI_LINUX_PG_H */ | |
| @@ -33,8 +33,31 @@ · 32 unmodified lines | ||
| 33 | 33 | #define CLONE_NEWNET 0x40000000 /* New network namespace */ |
| 34 | 34 | #define CLONE_IO 0x80000000 /* Clone io context */ |
| 35 | 35 | |
| 36 | −/* | |
| 37 | − * Arguments for the clone3 syscall | |
| 36 | +#ifndef __ASSEMBLY__ | |
| 37 | +/** | |
| 38 | + * struct clone_args - arguments for the clone3 syscall | |
| 39 | + * @flags: Flags for the new process as listed above. | |
| 40 | + * All flags are valid except for CSIGNAL and | |
| 41 | + * CLONE_DETACHED. | |
| 42 | + * @pidfd: If CLONE_PIDFD is set, a pidfd will be | |
| 43 | + * returned in this argument. | |
| 44 | + * @child_tid: If CLONE_CHILD_SETTID is set, the TID of the | |
| 45 | + * child process will be returned in the child's | |
| 46 | + * memory. | |
| 47 | + * @parent_tid: If CLONE_PARENT_SETTID is set, the TID of | |
| 48 | + * the child process will be returned in the | |
| 49 | + * parent's memory. | |
| 50 | + * @exit_signal: The exit_signal the parent process will be | |
| 51 | + * sent when the child exits. | |
| 52 | + * @stack: Specify the location of the stack for the | |
| 53 | + * child process. | |
| 54 | + * @stack_size: The size of the stack for the child process. | |
| 55 | + * @tls: If CLONE_SETTLS is set, the tls descriptor | |
| 56 | + * is set to tls. | |
| 57 | + * | |
| 58 | + * The structure is versioned by size and thus extensible. | |
| 59 | + * New struct members must go at the end of the struct and | |
| 60 | + * must be properly 64bit aligned. | |
| 38 | 61 | */ |
| 39 | 62 | struct clone_args { |
| 40 | 63 | __aligned_u64 flags; |
| @@ -46,6 +69,9 @@ struct clone_args { · 5 unmodified lines | ||
| 46 | 69 | __aligned_u64 stack_size; |
| 47 | 70 | __aligned_u64 tls; |
| 48 | 71 | }; |
| 72 | +#endif | |
| 73 | + | |
| 74 | +#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */ | |
| 49 | 75 | |
| 50 | 76 | /* |
| 51 | 77 | * Scheduling policies |
| @@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr, · 211 unmodified lines | ||
| 212 | 212 | |
| 213 | 213 | bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); |
| 214 | 214 | |
| 215 | −efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); | |
| 216 | −efi_status_t xen_efi_set_time(efi_time_t *tm); | |
| 217 | −efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, | |
| 218 | − efi_time_t *tm); | |
| 219 | −efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm); | |
| 220 | −efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 221 | − u32 *attr, unsigned long *data_size, | |
| 222 | − void *data); | |
| 223 | −efi_status_t xen_efi_get_next_variable(unsigned long *name_size, | |
| 224 | − efi_char16_t *name, efi_guid_t *vendor); | |
| 225 | −efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, | |
| 226 | − u32 attr, unsigned long data_size, | |
| 227 | − void *data); | |
| 228 | −efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, | |
| 229 | − u64 *remaining_space, | |
| 230 | − u64 *max_variable_size); | |
| 231 | −efi_status_t xen_efi_get_next_high_mono_count(u32 *count); | |
| 232 | −efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, | |
| 233 | − unsigned long count, unsigned long sg_list); | |
| 234 | −efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, | |
| 235 | − unsigned long count, u64 *max_size, | |
| 236 | − int *reset_type); | |
| 237 | −void xen_efi_reset_system(int reset_type, efi_status_t status, | |
| 238 | − unsigned long data_size, efi_char16_t *data); | |
| 215 | +void xen_efi_runtime_setup(void); | |
| 239 | 216 | |
| 240 | 217 | |
| 241 | 218 | #ifdef CONFIG_PREEMPT |
| @@ -87,9 +87,9 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, · 86 unmodified lines | ||
| 87 | 87 | */ |
| 88 | 88 | void dma_common_free_remap(void *cpu_addr, size_t size) |
| 89 | 89 | { |
| 90 | − struct page **pages = dma_common_find_pages(cpu_addr); | |
| 90 | + struct vm_struct *area = find_vm_area(cpu_addr); | |
| 91 | 91 | |
| 92 | − if (!pages) { | |
| 92 | + if (!area || area->flags != VM_DMA_COHERENT) { | |
| 93 | 93 | WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); |
| 94 | 94 | return; |
| 95 | 95 | } |
| @@ -10586,55 +10586,26 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, · 10585 unmodified lines | ||
| 10586 | 10586 | u32 size; |
| 10587 | 10587 | int ret; |
| 10588 | 10588 | |
| 10589 | − if (!access_ok(uattr, PERF_ATTR_SIZE_VER0)) | |
| 10590 | − return -EFAULT; | |
| 10591 | − | |
| 10592 | − /* | |
| 10593 | − * zero the full structure, so that a short copy will be nice. | |
| 10594 | − */ | |
| 10589 | + /* Zero the full structure, so that a short copy will be nice. */ | |
| 10595 | 10590 | memset(attr, 0, sizeof(*attr)); |
| 10596 | 10591 | |
| 10597 | 10592 | ret = get_user(size, &uattr->size); |
| 10598 | 10593 | if (ret) |
| 10599 | 10594 | return ret; |
| 10600 | 10595 | |
| 10601 | − if (size > PAGE_SIZE) /* silly large */ | |
| 10602 | − goto err_size; | |
| 10603 | − | |
| 10604 | − if (!size) /* abi compat */ | |
| 10596 | + /* ABI compatibility quirk: */ | |
| 10597 | + if (!size) | |
| 10605 | 10598 | size = PERF_ATTR_SIZE_VER0; |
| 10606 | − | |
| 10607 | − if (size < PERF_ATTR_SIZE_VER0) | |
| 10599 | + if (size < PERF_ATTR_SIZE_VER0 || size > PAGE_SIZE) | |
| 10608 | 10600 | goto err_size; |
| 10609 | 10601 | |
| 10610 | − /* | |
| 10611 | − * If we're handed a bigger struct than we know of, | |
| 10612 | − * ensure all the unknown bits are 0 - i.e. new | |
| 10613 | − * user-space does not rely on any kernel feature | |
| 10614 | − * extensions we dont know about yet. | |
| 10615 | − */ | |
| 10616 | − if (size > sizeof(*attr)) { | |
| 10617 | − unsigned char __user *addr; | |
| 10618 | − unsigned char __user *end; | |
| 10619 | − unsigned char val; | |
| 10620 | − | |
| 10621 | − addr = (void __user *)uattr + sizeof(*attr); | |
| 10622 | − end = (void __user *)uattr + size; | |
| 10623 | − | |
| 10624 | − for (; addr < end; addr++) { | |
| 10625 | − ret = get_user(val, addr); | |
| 10626 | − if (ret) | |
| 10627 | − return ret; | |
| 10628 | − if (val) | |
| 10629 | − goto err_size; | |
| 10630 | − } | |
| 10631 | − size = sizeof(*attr); | |
| 10602 | + ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size); | |
| 10603 | + if (ret) { | |
| 10604 | + if (ret == -E2BIG) | |
| 10605 | + goto err_size; | |
| 10606 | + return ret; | |
| 10632 | 10607 | } |
| 10633 | 10608 | |
| 10634 | − ret = copy_from_user(attr, uattr, size); | |
| 10635 | − if (ret) | |
| 10636 | − return -EFAULT; | |
| 10637 | − | |
| 10638 | 10609 | attr->size = size; |
| 10639 | 10610 | |
| 10640 | 10611 | if (attr->__reserved_1) |
| @@ -2525,39 +2525,19 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, · 2524 unmodified lines | ||
| 2525 | 2525 | #ifdef __ARCH_WANT_SYS_CLONE3 |
| 2526 | 2526 | noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, |
| 2527 | 2527 | struct clone_args __user *uargs, |
| 2528 | − size_t size) | |
| 2528 | + size_t usize) | |
| 2529 | 2529 | { |
| 2530 | + int err; | |
| 2530 | 2531 | struct clone_args args; |
| 2531 | 2532 | |
| 2532 | − if (unlikely(size > PAGE_SIZE)) | |
| 2533 | + if (unlikely(usize > PAGE_SIZE)) | |
| 2533 | 2534 | return -E2BIG; |
| 2534 | − | |
| 2535 | − if (unlikely(size < sizeof(struct clone_args))) | |
| 2535 | + if (unlikely(usize < CLONE_ARGS_SIZE_VER0)) | |
| 2536 | 2536 | return -EINVAL; |
| 2537 | 2537 | |
| 2538 | − if (unlikely(!access_ok(uargs, size))) | |
| 2539 | − return -EFAULT; | |
| 2540 | − | |
| 2541 | − if (size > sizeof(struct clone_args)) { | |
| 2542 | − unsigned char __user *addr; | |
| 2543 | − unsigned char __user *end; | |
| 2544 | − unsigned char val; | |
| 2545 | − | |
| 2546 | − addr = (void __user *)uargs + sizeof(struct clone_args); | |
| 2547 | − end = (void __user *)uargs + size; | |
| 2548 | − | |
| 2549 | − for (; addr < end; addr++) { | |
| 2550 | − if (get_user(val, addr)) | |
| 2551 | − return -EFAULT; | |
| 2552 | − if (val) | |
| 2553 | − return -E2BIG; | |
| 2554 | − } | |
| 2555 | − | |
| 2556 | − size = sizeof(struct clone_args); | |
| 2557 | − } | |
| 2558 | − | |
| 2559 | − if (copy_from_user(&args, uargs, size)) | |
| 2560 | − return -EFAULT; | |
| 2538 | + err = copy_struct_from_user(&args, sizeof(args), uargs, usize); | |
| 2539 | + if (err) | |
| 2540 | + return err; | |
| 2561 | 2541 | |
| 2562 | 2542 | /* |
| 2563 | 2543 | * Verify that higher 32bits of exit_signal are unset and that |
| @@ -2604,6 +2584,17 @@ static bool clone3_args_valid(const struct kernel_clone_args *kargs) · 40 unmodified lines | ||
| 2604 | 2584 | return true; |
| 2605 | 2585 | } |
| 2606 | 2586 | |
| 2587 | +/** | |
| 2588 | + * clone3 - create a new process with specific properties | |
| 2589 | + * @uargs: argument structure | |
| 2590 | + * @size: size of @uargs | |
| 2591 | + * | |
| 2592 | + * clone3() is the extensible successor to clone()/clone2(). | |
| 2593 | + * It takes a struct as argument that is versioned by its size. | |
| 2594 | + * | |
| 2595 | + * Return: On success, a positive PID for the child process. | |
| 2596 | + * On error, a negative errno number. | |
| 2597 | + */ | |
| 2607 | 2598 | SYSCALL_DEFINE2(clone3, struct clone_args __user *, uargs, size_t, size) |
| 2608 | 2599 | { |
| 2609 | 2600 | int err; |
| @@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 · 70 unmodified lines | ||
| 71 | 71 | find $cpio_dir -type f -print0 | |
| 72 | 72 | xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' |
| 73 | 73 | |
| 74 | −tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null | |
| 74 | +# Create archive and try to normalize metadata for reproducibility | |
| 75 | +tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ | |
| 76 | + --owner=0 --group=0 --sort=name --numeric-owner \ | |
| 77 | + -Jcf $tarfile -C $cpio_dir/ . > /dev/null | |
| 75 | 78 | |
| 76 | 79 | echo "$src_files_md5" > kernel/kheaders.md5 |
| 77 | 80 | echo "$obj_files_md5" >> kernel/kheaders.md5 |
| @@ -5106,9 +5106,6 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a · 5105 unmodified lines | ||
| 5106 | 5106 | u32 size; |
| 5107 | 5107 | int ret; |
| 5108 | 5108 | |
| 5109 | − if (!access_ok(uattr, SCHED_ATTR_SIZE_VER0)) | |
| 5110 | − return -EFAULT; | |
| 5111 | − | |
| 5112 | 5109 | /* Zero the full structure, so that a short copy will be nice: */ |
| 5113 | 5110 | memset(attr, 0, sizeof(*attr)); |
| 5114 | 5111 | |
| @@ -5116,45 +5113,19 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a · 1 unmodified line | ||
| 5116 | 5113 | if (ret) |
| 5117 | 5114 | return ret; |
| 5118 | 5115 | |
| 5119 | − /* Bail out on silly large: */ | |
| 5120 | − if (size > PAGE_SIZE) | |
| 5121 | − goto err_size; | |
| 5122 | − | |
| 5123 | 5116 | /* ABI compatibility quirk: */ |
| 5124 | 5117 | if (!size) |
| 5125 | 5118 | size = SCHED_ATTR_SIZE_VER0; |
| 5126 | − | |
| 5127 | − if (size < SCHED_ATTR_SIZE_VER0) | |
| 5119 | + if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE) | |
| 5128 | 5120 | goto err_size; |
| 5129 | 5121 | |
| 5130 | − /* | |
| 5131 | − * If we're handed a bigger struct than we know of, | |
| 5132 | − * ensure all the unknown bits are 0 - i.e. new | |
| 5133 | − * user-space does not rely on any kernel feature | |
| 5134 | − * extensions we dont know about yet. | |
| 5135 | − */ | |
| 5136 | − if (size > sizeof(*attr)) { | |
| 5137 | − unsigned char __user *addr; | |
| 5138 | − unsigned char __user *end; | |
| 5139 | − unsigned char val; | |
| 5140 | − | |
| 5141 | − addr = (void __user *)uattr + sizeof(*attr); | |
| 5142 | − end = (void __user *)uattr + size; | |
| 5143 | − | |
| 5144 | − for (; addr < end; addr++) { | |
| 5145 | − ret = get_user(val, addr); | |
| 5146 | − if (ret) | |
| 5147 | − return ret; | |
| 5148 | − if (val) | |
| 5149 | − goto err_size; | |
| 5150 | − } | |
| 5151 | − size = sizeof(*attr); | |
| 5122 | + ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size); | |
| 5123 | + if (ret) { | |
| 5124 | + if (ret == -E2BIG) | |
| 5125 | + goto err_size; | |
| 5126 | + return ret; | |
| 5152 | 5127 | } |
| 5153 | 5128 | |
| 5154 | − ret = copy_from_user(attr, uattr, size); | |
| 5155 | − if (ret) | |
| 5156 | − return -EFAULT; | |
| 5157 | − | |
| 5158 | 5129 | if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) && |
| 5159 | 5130 | size < SCHED_ATTR_SIZE_VER1) |
| 5160 | 5131 | return -EINVAL; |
| @@ -5354,7 +5325,7 @@ sched_attr_copy_to_user(struct sched_attr __user *uattr, · 193 unmodified lines | ||
| 5354 | 5325 | * sys_sched_getattr - similar to sched_getparam, but with sched_attr |
| 5355 | 5326 | * @pid: the pid in question. |
| 5356 | 5327 | * @uattr: structure containing the extended parameters. |
| 5357 | − * @usize: sizeof(attr) that user-space knows about, for forwards and backwards compatibility. | |
| 5328 | + * @usize: sizeof(attr) for fwd/bwd comp. | |
| 5358 | 5329 | * @flags: for future extension. |
| 5359 | 5330 | */ |
| 5360 | 5331 | SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, |
| @@ -174,7 +174,6 @@ static int membarrier_private_expedited(int flags) · 173 unmodified lines | ||
| 174 | 174 | */ |
| 175 | 175 | if (cpu == raw_smp_processor_id()) |
| 176 | 176 | continue; |
| 177 | − rcu_read_lock(); | |
| 178 | 177 | p = rcu_dereference(cpu_rq(cpu)->curr); |
| 179 | 178 | if (p && p->mm == mm) |
| 180 | 179 | __cpumask_set_cpu(cpu, tmpmask); |
| @@ -42,39 +42,39 @@ static int bc_shutdown(struct clock_event_device *evt) · 41 unmodified lines | ||
| 42 | 42 | */ |
| 43 | 43 | static int bc_set_next(ktime_t expires, struct clock_event_device *bc) |
| 44 | 44 | { |
| 45 | − int bc_moved; | |
| 46 | 45 | /* |
| 47 | − * We try to cancel the timer first. If the callback is on | |
| 48 | − * flight on some other cpu then we let it handle it. If we | |
| 49 | − * were able to cancel the timer nothing can rearm it as we | |
| 50 | − * own broadcast_lock. | |
| 46 | + * This is called either from enter/exit idle code or from the | |
| 47 | + * broadcast handler. In all cases tick_broadcast_lock is held. | |
| 51 | 48 | * |
| 52 | − * However we can also be called from the event handler of | |
| 53 | − * ce_broadcast_hrtimer itself when it expires. We cannot | |
| 54 | − * restart the timer because we are in the callback, but we | |
| 55 | − * can set the expiry time and let the callback return | |
| 56 | − * HRTIMER_RESTART. | |
| 49 | + * hrtimer_cancel() cannot be called here neither from the | |
| 50 | + * broadcast handler nor from the enter/exit idle code. The idle | |
| 51 | + * code can run into the problem described in bc_shutdown() and the | |
| 52 | + * broadcast handler cannot wait for itself to complete for obvious | |
| 53 | + * reasons. | |
| 57 | 54 | * |
| 58 | − * Since we are in the idle loop at this point and because | |
| 59 | − * hrtimer_{start/cancel} functions call into tracing, | |
| 60 | − * calls to these functions must be bound within RCU_NONIDLE. | |
| 55 | + * Each caller tries to arm the hrtimer on its own CPU, but if the | |
| 56 | + * hrtimer callbback function is currently running, then | |
| 57 | + * hrtimer_start() cannot move it and the timer stays on the CPU on | |
| 58 | + * which it is assigned at the moment. | |
| 59 | + * | |
| 60 | + * As this can be called from idle code, the hrtimer_start() | |
| 61 | + * invocation has to be wrapped with RCU_NONIDLE() as | |
| 62 | + * hrtimer_start() can call into tracing. | |
| 61 | 63 | */ |
| 62 | − RCU_NONIDLE( | |
| 63 | − { | |
| 64 | − bc_moved = hrtimer_try_to_cancel(&bctimer) >= 0; | |
| 65 | − if (bc_moved) { | |
| 66 | − hrtimer_start(&bctimer, expires, | |
| 67 | − HRTIMER_MODE_ABS_PINNED_HARD); | |
| 68 | − } | |
| 69 | − } | |
| 70 | − ); | |
| 71 | − | |
| 72 | − if (bc_moved) { | |
| 73 | − /* Bind the "device" to the cpu */ | |
| 74 | − bc->bound_on = smp_processor_id(); | |
| 75 | − } else if (bc->bound_on == smp_processor_id()) { | |
| 76 | − hrtimer_set_expires(&bctimer, expires); | |
| 77 | − } | |
| 64 | + RCU_NONIDLE( { | |
| 65 | + hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED_HARD); | |
| 66 | + /* | |
| 67 | + * The core tick broadcast mode expects bc->bound_on to be set | |
| 68 | + * correctly to prevent a CPU which has the broadcast hrtimer | |
| 69 | + * armed from going deep idle. | |
| 70 | + * | |
| 71 | + * As tick_broadcast_lock is held, nothing can change the cpu | |
| 72 | + * base which was just established in hrtimer_start() above. So | |
| 73 | + * the below access is safe even without holding the hrtimer | |
| 74 | + * base lock. | |
| 75 | + */ | |
| 76 | + bc->bound_on = bctimer.base->cpu_base->cpu; | |
| 77 | + } ); | |
| 78 | 78 | return 0; |
| 79 | 79 | } |
| 80 | 80 | |
| @@ -100,10 +100,6 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t) · 19 unmodified lines | ||
| 100 | 100 | { |
| 101 | 101 | ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer); |
| 102 | 102 | |
| 103 | − if (clockevent_state_oneshot(&ce_broadcast_hrtimer)) | |
| 104 | − if (ce_broadcast_hrtimer.next_event != KTIME_MAX) | |
| 105 | − return HRTIMER_RESTART; | |
| 106 | − | |
| 107 | 103 | return HRTIMER_NORESTART; |
| 108 | 104 | } |
| 109 | 105 | |
| @@ -3,16 +3,10 @@ · 2 unmodified lines | ||
| 3 | 3 | #include <linux/export.h> |
| 4 | 4 | #include <linux/uaccess.h> |
| 5 | 5 | #include <linux/mm.h> |
| 6 | +#include <linux/bitops.h> | |
| 6 | 7 | |
| 7 | 8 | #include <asm/word-at-a-time.h> |
| 8 | 9 | |
| 9 | −/* Set bits in the first 'n' bytes when loaded from memory */ | |
| 10 | −#ifdef __LITTLE_ENDIAN | |
| 11 | −# define aligned_byte_mask(n) ((1ul << 8*(n))-1) | |
| 12 | −#else | |
| 13 | −# define aligned_byte_mask(n) (~0xfful << (BITS_PER_LONG - 8 - 8*(n))) | |
| 14 | −#endif | |
| 15 | − | |
| 16 | 10 | /* |
| 17 | 11 | * Do a strnlen, return length of string *with* final '\0'. |
| 18 | 12 | * 'count' is the user-supplied count, while 'max' is the |
| @@ -31,14 +31,133 @@ · 30 unmodified lines | ||
| 31 | 31 | # define TEST_U64 |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | −#define test(condition, msg) \ | |
| 35 | −({ \ | |
| 36 | − int cond = (condition); \ | |
| 37 | − if (cond) \ | |
| 38 | − pr_warn("%s\n", msg); \ | |
| 39 | − cond; \ | |
| 34 | +#define test(condition, msg, ...) \ | |
| 35 | +({ \ | |
| 36 | + int cond = (condition); \ | |
| 37 | + if (cond) \ | |
| 38 | + pr_warn("[%d] " msg "\n", __LINE__, ##__VA_ARGS__); \ | |
| 39 | + cond; \ | |
| 40 | 40 | }) |
| 41 | 41 | |
| 42 | +static bool is_zeroed(void *from, size_t size) | |
| 43 | +{ | |
| 44 | + return memchr_inv(from, 0x0, size) == NULL; | |
| 45 | +} | |
| 46 | + | |
| 47 | +static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size) | |
| 48 | +{ | |
| 49 | + int ret = 0; | |
| 50 | + size_t start, end, i; | |
| 51 | + size_t zero_start = size / 4; | |
| 52 | + size_t zero_end = size - zero_start; | |
| 53 | + | |
| 54 | + /* | |
| 55 | + * We conduct a series of check_nonzero_user() tests on a block of memory | |
| 56 | + * with the following byte-pattern (trying every possible [start,end] | |
| 57 | + * pair): | |
| 58 | + * | |
| 59 | + * [ 00 ff 00 ff ... 00 00 00 00 ... ff 00 ff 00 ] | |
| 60 | + * | |
| 61 | + * And we verify that check_nonzero_user() acts identically to memchr_inv(). | |
| 62 | + */ | |
| 63 | + | |
| 64 | + memset(kmem, 0x0, size); | |
| 65 | + for (i = 1; i < zero_start; i += 2) | |
| 66 | + kmem[i] = 0xff; | |
| 67 | + for (i = zero_end; i < size; i += 2) | |
| 68 | + kmem[i] = 0xff; | |
| 69 | + | |
| 70 | + ret |= test(copy_to_user(umem, kmem, size), | |
| 71 | + "legitimate copy_to_user failed"); | |
| 72 | + | |
| 73 | + for (start = 0; start <= size; start++) { | |
| 74 | + for (end = start; end <= size; end++) { | |
| 75 | + size_t len = end - start; | |
| 76 | + int retval = check_zeroed_user(umem + start, len); | |
| 77 | + int expected = is_zeroed(kmem + start, len); | |
| 78 | + | |
| 79 | + ret |= test(retval != expected, | |
| 80 | + "check_nonzero_user(=%d) != memchr_inv(=%d) mismatch (start=%zu, end=%zu)", | |
| 81 | + retval, expected, start, end); | |
| 82 | + } | |
| 83 | + } | |
| 84 | + | |
| 85 | + return ret; | |
| 86 | +} | |
| 87 | + | |
| 88 | +static int test_copy_struct_from_user(char *kmem, char __user *umem, | |
| 89 | + size_t size) | |
| 90 | +{ | |
| 91 | + int ret = 0; | |
| 92 | + char *umem_src = NULL, *expected = NULL; | |
| 93 | + size_t ksize, usize; | |
| 94 | + | |
| 95 | + umem_src = kmalloc(size, GFP_KERNEL); | |
| 96 | + if ((ret |= test(umem_src == NULL, "kmalloc failed"))) | |
| 97 | + goto out_free; | |
| 98 | + | |
| 99 | + expected = kmalloc(size, GFP_KERNEL); | |
| 100 | + if ((ret |= test(expected == NULL, "kmalloc failed"))) | |
| 101 | + goto out_free; | |
| 102 | + | |
| 103 | + /* Fill umem with a fixed byte pattern. */ | |
| 104 | + memset(umem_src, 0x3e, size); | |
| 105 | + ret |= test(copy_to_user(umem, umem_src, size), | |
| 106 | + "legitimate copy_to_user failed"); | |
| 107 | + | |
| 108 | + /* Check basic case -- (usize == ksize). */ | |
| 109 | + ksize = size; | |
| 110 | + usize = size; | |
| 111 | + | |
| 112 | + memcpy(expected, umem_src, ksize); | |
| 113 | + | |
| 114 | + memset(kmem, 0x0, size); | |
| 115 | + ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), | |
| 116 | + "copy_struct_from_user(usize == ksize) failed"); | |
| 117 | + ret |= test(memcmp(kmem, expected, ksize), | |
| 118 | + "copy_struct_from_user(usize == ksize) gives unexpected copy"); | |
| 119 | + | |
| 120 | + /* Old userspace case -- (usize < ksize). */ | |
| 121 | + ksize = size; | |
| 122 | + usize = size / 2; | |
| 123 | + | |
| 124 | + memcpy(expected, umem_src, usize); | |
| 125 | + memset(expected + usize, 0x0, ksize - usize); | |
| 126 | + | |
| 127 | + memset(kmem, 0x0, size); | |
| 128 | + ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), | |
| 129 | + "copy_struct_from_user(usize < ksize) failed"); | |
| 130 | + ret |= test(memcmp(kmem, expected, ksize), | |
| 131 | + "copy_struct_from_user(usize < ksize) gives unexpected copy"); | |
| 132 | + | |
| 133 | + /* New userspace (-E2BIG) case -- (usize > ksize). */ | |
| 134 | + ksize = size / 2; | |
| 135 | + usize = size; | |
| 136 | + | |
| 137 | + memset(kmem, 0x0, size); | |
| 138 | + ret |= test(copy_struct_from_user(kmem, ksize, umem, usize) != -E2BIG, | |
| 139 | + "copy_struct_from_user(usize > ksize) didn't give E2BIG"); | |
| 140 | + | |
| 141 | + /* New userspace (success) case -- (usize > ksize). */ | |
| 142 | + ksize = size / 2; | |
| 143 | + usize = size; | |
| 144 | + | |
| 145 | + memcpy(expected, umem_src, ksize); | |
| 146 | + ret |= test(clear_user(umem + ksize, usize - ksize), | |
| 147 | + "legitimate clear_user failed"); | |
| 148 | + | |
| 149 | + memset(kmem, 0x0, size); | |
| 150 | + ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), | |
| 151 | + "copy_struct_from_user(usize > ksize) failed"); | |
| 152 | + ret |= test(memcmp(kmem, expected, ksize), | |
| 153 | + "copy_struct_from_user(usize > ksize) gives unexpected copy"); | |
| 154 | + | |
| 155 | +out_free: | |
| 156 | + kfree(expected); | |
| 157 | + kfree(umem_src); | |
| 158 | + return ret; | |
| 159 | +} | |
| 160 | + | |
| 42 | 161 | static int __init test_user_copy_init(void) |
| 43 | 162 | { |
| 44 | 163 | int ret = 0; |
| @@ -106,6 +225,11 @@ static int __init test_user_copy_init(void) · 61 unmodified lines | ||
| 106 | 225 | #endif |
| 107 | 226 | #undef test_legit |
| 108 | 227 | |
| 228 | + /* Test usage of check_nonzero_user(). */ | |
| 229 | + ret |= test_check_nonzero_user(kmem, usermem, 2 * PAGE_SIZE); | |
| 230 | + /* Test usage of copy_struct_from_user(). */ | |
| 231 | + ret |= test_copy_struct_from_user(kmem, usermem, 2 * PAGE_SIZE); | |
| 232 | + | |
| 109 | 233 | /* |
| 110 | 234 | * Invalid usage: none of these copies should succeed. |
| 111 | 235 | */ |
| @@ -89,9 +89,9 @@ · 88 unmodified lines | ||
| 89 | 89 | * goto errout; |
| 90 | 90 | * } |
| 91 | 91 | * |
| 92 | − * pos = textsearch_find_continuous(conf, \&state, example, strlen(example)); | |
| 92 | + * pos = textsearch_find_continuous(conf, &state, example, strlen(example)); | |
| 93 | 93 | * if (pos != UINT_MAX) |
| 94 | − * panic("Oh my god, dancing chickens at \%d\n", pos); | |
| 94 | + * panic("Oh my god, dancing chickens at %d\n", pos); | |
| 95 | 95 | * |
| 96 | 96 | * textsearch_destroy(conf); |
| 97 | 97 | */ |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | #include <linux/uaccess.h> |
| 3 | +#include <linux/bitops.h> | |
| 3 | 4 | |
| 4 | 5 | /* out-of-line parts */ |
| 5 | 6 | |
| @@ -31,3 +32,57 @@ unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n) · 25 unmodified lines | ||
| 31 | 32 | } |
| 32 | 33 | EXPORT_SYMBOL(_copy_to_user); |
| 33 | 34 | #endif |
| 35 | + | |
| 36 | +/** | |
| 37 | + * check_zeroed_user: check if a userspace buffer only contains zero bytes | |
| 38 | + * @from: Source address, in userspace. | |
| 39 | + * @size: Size of buffer. | |
| 40 | + * | |
| 41 | + * This is effectively shorthand for "memchr_inv(from, 0, size) == NULL" for | |
| 42 | + * userspace addresses (and is more efficient because we don't care where the | |
| 43 | + * first non-zero byte is). | |
| 44 | + * | |
| 45 | + * Returns: | |
| 46 | + * * 0: There were non-zero bytes present in the buffer. | |
| 47 | + * * 1: The buffer was full of zero bytes. | |
| 48 | + * * -EFAULT: access to userspace failed. | |
| 49 | + */ | |
| 50 | +int check_zeroed_user(const void __user *from, size_t size) | |
| 51 | +{ | |
| 52 | + unsigned long val; | |
| 53 | + uintptr_t align = (uintptr_t) from % sizeof(unsigned long); | |
| 54 | + | |
| 55 | + if (unlikely(size == 0)) | |
| 56 | + return 1; | |
| 57 | + | |
| 58 | + from -= align; | |
| 59 | + size += align; | |
| 60 | + | |
| 61 | + if (!user_access_begin(from, size)) | |
| 62 | + return -EFAULT; | |
| 63 | + | |
| 64 | + unsafe_get_user(val, (unsigned long __user *) from, err_fault); | |
| 65 | + if (align) | |
| 66 | + val &= ~aligned_byte_mask(align); | |
| 67 | + | |
| 68 | + while (size > sizeof(unsigned long)) { | |
| 69 | + if (unlikely(val)) | |
| 70 | + goto done; | |
| 71 | + | |
| 72 | + from += sizeof(unsigned long); | |
| 73 | + size -= sizeof(unsigned long); | |
| 74 | + | |
| 75 | + unsafe_get_user(val, (unsigned long __user *) from, err_fault); | |
| 76 | + } | |
| 77 | + | |
| 78 | + if (size < sizeof(unsigned long)) | |
| 79 | + val &= aligned_byte_mask(size); | |
| 80 | + | |
| 81 | +done: | |
| 82 | + user_access_end(); | |
| 83 | + return (val == 0); | |
| 84 | +err_fault: | |
| 85 | + user_access_end(); | |
| 86 | + return -EFAULT; | |
| 87 | +} | |
| 88 | +EXPORT_SYMBOL(check_zeroed_user); | |
| @@ -436,7 +436,7 @@ void batadv_interface_rx(struct net_device *soft_iface, · 435 unmodified lines | ||
| 436 | 436 | /* clean the netfilter state now that the batman-adv header has been |
| 437 | 437 | * removed |
| 438 | 438 | */ |
| 439 | − nf_reset(skb); | |
| 439 | + nf_reset_ct(skb); | |
| 440 | 440 | |
| 441 | 441 | if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) |
| 442 | 442 | goto dropped; |
| @@ -3172,7 +3172,7 @@ static int devlink_nl_cmd_param_get_dumpit(struct sk_buff *msg, · 3171 unmodified lines | ||
| 3172 | 3172 | NETLINK_CB(cb->skb).portid, |
| 3173 | 3173 | cb->nlh->nlmsg_seq, |
| 3174 | 3174 | NLM_F_MULTI); |
| 3175 | − if (err) { | |
| 3175 | + if (err && err != -EOPNOTSUPP) { | |
| 3176 | 3176 | mutex_unlock(&devlink->lock); |
| 3177 | 3177 | goto out; |
| 3178 | 3178 | } |
| @@ -3432,7 +3432,7 @@ static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg, · 253 unmodified lines | ||
| 3432 | 3432 | NETLINK_CB(cb->skb).portid, |
| 3433 | 3433 | cb->nlh->nlmsg_seq, |
| 3434 | 3434 | NLM_F_MULTI); |
| 3435 | − if (err) { | |
| 3435 | + if (err && err != -EOPNOTSUPP) { | |
| 3436 | 3436 | mutex_unlock(&devlink->lock); |
| 3437 | 3437 | goto out; |
| 3438 | 3438 | } |
| @@ -4088,7 +4088,7 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg, · 649 unmodified lines | ||
| 4088 | 4088 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
| 4089 | 4089 | cb->extack); |
| 4090 | 4090 | mutex_unlock(&devlink->lock); |
| 4091 | − if (err) | |
| 4091 | + if (err && err != -EOPNOTSUPP) | |
| 4092 | 4092 | break; |
| 4093 | 4093 | idx++; |
| 4094 | 4094 | } |
| @@ -5120,7 +5120,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) · 5119 unmodified lines | ||
| 5120 | 5120 | skb->ignore_df = 0; |
| 5121 | 5121 | skb_dst_drop(skb); |
| 5122 | 5122 | skb_ext_reset(skb); |
| 5123 | − nf_reset(skb); | |
| 5123 | + nf_reset_ct(skb); | |
| 5124 | 5124 | nf_reset_trace(skb); |
| 5125 | 5125 | |
| 5126 | 5126 | #ifdef CONFIG_NET_SWITCHDEV |
| @@ -1700,8 +1700,6 @@ static void __sk_destruct(struct rcu_head *head) · 1699 unmodified lines | ||
| 1700 | 1700 | sk_filter_uncharge(sk, filter); |
| 1701 | 1701 | RCU_INIT_POINTER(sk->sk_filter, NULL); |
| 1702 | 1702 | } |
| 1703 | − if (rcu_access_pointer(sk->sk_reuseport_cb)) | |
| 1704 | − reuseport_detach_sock(sk); | |
| 1705 | 1703 | |
| 1706 | 1704 | sock_disable_timestamp(sk, SK_FLAGS_TIMESTAMP); |
| 1707 | 1705 | |
| @@ -1728,7 +1726,14 @@ static void __sk_destruct(struct rcu_head *head) · 20 unmodified lines | ||
| 1728 | 1726 | |
| 1729 | 1727 | void sk_destruct(struct sock *sk) |
| 1730 | 1728 | { |
| 1731 | − if (sock_flag(sk, SOCK_RCU_FREE)) | |
| 1729 | + bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE); | |
| 1730 | + | |
| 1731 | + if (rcu_access_pointer(sk->sk_reuseport_cb)) { | |
| 1732 | + reuseport_detach_sock(sk); | |
| 1733 | + use_call_rcu = true; | |
| 1734 | + } | |
| 1735 | + | |
| 1736 | + if (use_call_rcu) | |
| 1732 | 1737 | call_rcu(&sk->sk_rcu, __sk_destruct); |
| 1733 | 1738 | else |
| 1734 | 1739 | __sk_destruct(&sk->sk_rcu); |
| @@ -3492,7 +3497,7 @@ static long sock_prot_memory_allocated(struct proto *proto) · 1757 unmodified lines | ||
| 3492 | 3497 | return proto->memory_allocated != NULL ? proto_memory_allocated(proto) : -1L; |
| 3493 | 3498 | } |
| 3494 | 3499 | |
| 3495 | −static char *sock_prot_memory_pressure(struct proto *proto) | |
| 3500 | +static const char *sock_prot_memory_pressure(struct proto *proto) | |
| 3496 | 3501 | { |
| 3497 | 3502 | return proto->memory_pressure != NULL ? |
| 3498 | 3503 | proto_memory_pressure(proto) ? "yes" : "no" : "NI"; |
| @@ -871,7 +871,7 @@ lookup: · 870 unmodified lines | ||
| 871 | 871 | |
| 872 | 872 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) |
| 873 | 873 | goto discard_and_relse; |
| 874 | − nf_reset(skb); | |
| 874 | + nf_reset_ct(skb); | |
| 875 | 875 | |
| 876 | 876 | return __sk_receive_skb(sk, skb, 1, dh->dccph_doff * 4, refcounted); |
| 877 | 877 | |
| @@ -156,7 +156,11 @@ static struct sk_buff · 155 unmodified lines | ||
| 156 | 156 | /* Step 1: A timestampable frame was received. |
| 157 | 157 | * Buffer it until we get its meta frame. |
| 158 | 158 | */ |
| 159 | − if (is_link_local && sp->data->hwts_rx_en) { | |
| 159 | + if (is_link_local) { | |
| 160 | + if (!test_bit(SJA1105_HWTS_RX_EN, &sp->data->state)) | |
| 161 | + /* Do normal processing. */ | |
| 162 | + return skb; | |
| 163 | + | |
| 160 | 164 | spin_lock(&sp->data->meta_lock); |
| 161 | 165 | /* Was this a link-local frame instead of the meta |
| 162 | 166 | * that we were expecting? |
| @@ -187,6 +191,12 @@ static struct sk_buff · 24 unmodified lines | ||
| 187 | 191 | } else if (is_meta) { |
| 188 | 192 | struct sk_buff *stampable_skb; |
| 189 | 193 | |
| 194 | + /* Drop the meta frame if we're not in the right state | |
| 195 | + * to process it. | |
| 196 | + */ | |
| 197 | + if (!test_bit(SJA1105_HWTS_RX_EN, &sp->data->state)) | |
| 198 | + return NULL; | |
| 199 | + | |
| 190 | 200 | spin_lock(&sp->data->meta_lock); |
| 191 | 201 | |
| 192 | 202 | stampable_skb = sp->data->stampable_skb; |
| @@ -1446,6 +1446,7 @@ static void erspan_setup(struct net_device *dev) · 1445 unmodified lines | ||
| 1446 | 1446 | struct ip_tunnel *t = netdev_priv(dev); |
| 1447 | 1447 | |
| 1448 | 1448 | ether_setup(dev); |
| 1449 | + dev->max_mtu = 0; | |
| 1449 | 1450 | dev->netdev_ops = &erspan_netdev_ops; |
| 1450 | 1451 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 1451 | 1452 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; |
| @@ -199,7 +199,7 @@ resubmit: · 198 unmodified lines | ||
| 199 | 199 | kfree_skb(skb); |
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | − nf_reset(skb); | |
| 202 | + nf_reset_ct(skb); | |
| 203 | 203 | } |
| 204 | 204 | ret = INDIRECT_CALL_2(ipprot->handler, tcp_v4_rcv, udp_rcv, |
| 205 | 205 | skb); |
| @@ -1794,7 +1794,7 @@ static void ip_encap(struct net *net, struct sk_buff *skb, · 1793 unmodified lines | ||
| 1794 | 1794 | ip_send_check(iph); |
| 1795 | 1795 | |
| 1796 | 1796 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
| 1797 | − nf_reset(skb); | |
| 1797 | + nf_reset_ct(skb); | |
| 1798 | 1798 | } |
| 1799 | 1799 | |
| 1800 | 1800 | static inline int ipmr_forward_finish(struct net *net, struct sock *sk, |
| @@ -2140,7 +2140,7 @@ int ip_mr_input(struct sk_buff *skb) · 339 unmodified lines | ||
| 2140 | 2140 | |
| 2141 | 2141 | mroute_sk = rcu_dereference(mrt->mroute_sk); |
| 2142 | 2142 | if (mroute_sk) { |
| 2143 | − nf_reset(skb); | |
| 2143 | + nf_reset_ct(skb); | |
| 2144 | 2144 | raw_rcv(mroute_sk, skb); |
| 2145 | 2145 | return 0; |
| 2146 | 2146 | } |
| @@ -65,7 +65,7 @@ void nf_dup_ipv4(struct net *net, struct sk_buff *skb, unsigned int hooknum, · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) |
| 67 | 67 | /* Avoid counting cloned packets towards the original connection. */ |
| 68 | − nf_reset(skb); | |
| 68 | + nf_reset_ct(skb); | |
| 69 | 69 | nf_ct_set(skb, NULL, IP_CT_UNTRACKED); |
| 70 | 70 | #endif |
| 71 | 71 | /* |
| @@ -332,7 +332,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) · 331 unmodified lines | ||
| 332 | 332 | kfree_skb(skb); |
| 333 | 333 | return NET_RX_DROP; |
| 334 | 334 | } |
| 335 | − nf_reset(skb); | |
| 335 | + nf_reset_ct(skb); | |
| 336 | 336 | |
| 337 | 337 | skb_push(skb, skb->data - skb_network_header(skb)); |
| 338 | 338 | |
| @@ -916,16 +916,15 @@ void ip_rt_send_redirect(struct sk_buff *skb) · 915 unmodified lines | ||
| 916 | 916 | if (peer->rate_tokens == 0 || |
| 917 | 917 | time_after(jiffies, |
| 918 | 918 | (peer->rate_last + |
| 919 | − (ip_rt_redirect_load << peer->rate_tokens)))) { | |
| 919 | + (ip_rt_redirect_load << peer->n_redirects)))) { | |
| 920 | 920 | __be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr); |
| 921 | 921 | |
| 922 | 922 | icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw); |
| 923 | 923 | peer->rate_last = jiffies; |
| 924 | − ++peer->rate_tokens; | |
| 925 | 924 | ++peer->n_redirects; |
| 926 | 925 | #ifdef CONFIG_IP_ROUTE_VERBOSE |
| 927 | 926 | if (log_martians && |
| 928 | − peer->rate_tokens == ip_rt_redirect_number) | |
| 927 | + peer->n_redirects == ip_rt_redirect_number) | |
| 929 | 928 | net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n", |
| 930 | 929 | &ip_hdr(skb)->saddr, inet_iif(skb), |
| 931 | 930 | &ip_hdr(skb)->daddr, &gw); |
| @@ -1798,13 +1798,11 @@ static int tcp_zerocopy_receive(struct sock *sk, · 1797 unmodified lines | ||
| 1798 | 1798 | } |
| 1799 | 1799 | if (skb_frag_size(frags) != PAGE_SIZE || skb_frag_off(frags)) { |
| 1800 | 1800 | int remaining = zc->recv_skip_hint; |
| 1801 | − int size = skb_frag_size(frags); | |
| 1802 | 1801 | |
| 1803 | − while (remaining && (size != PAGE_SIZE || | |
| 1802 | + while (remaining && (skb_frag_size(frags) != PAGE_SIZE || | |
| 1804 | 1803 | skb_frag_off(frags))) { |
| 1805 | − remaining -= size; | |
| 1804 | + remaining -= skb_frag_size(frags); | |
| 1806 | 1805 | frags++; |
| 1807 | − size = skb_frag_size(frags); | |
| 1808 | 1806 | } |
| 1809 | 1807 | zc->recv_skip_hint -= remaining; |
| 1810 | 1808 | break; |
| @@ -1916,7 +1916,7 @@ process: · 1915 unmodified lines | ||
| 1916 | 1916 | if (tcp_v4_inbound_md5_hash(sk, skb)) |
| 1917 | 1917 | goto discard_and_relse; |
| 1918 | 1918 | |
| 1919 | − nf_reset(skb); | |
| 1919 | + nf_reset_ct(skb); | |
| 1920 | 1920 | |
| 1921 | 1921 | if (tcp_filter(sk, skb)) |
| 1922 | 1922 | goto discard_and_relse; |
| @@ -198,8 +198,13 @@ static bool retransmits_timed_out(struct sock *sk, · 197 unmodified lines | ||
| 198 | 198 | return false; |
| 199 | 199 | |
| 200 | 200 | start_ts = tcp_sk(sk)->retrans_stamp; |
| 201 | − if (likely(timeout == 0)) | |
| 202 | − timeout = tcp_model_timeout(sk, boundary, TCP_RTO_MIN); | |
| 201 | + if (likely(timeout == 0)) { | |
| 202 | + unsigned int rto_base = TCP_RTO_MIN; | |
| 203 | + | |
| 204 | + if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) | |
| 205 | + rto_base = tcp_timeout_init(sk); | |
| 206 | + timeout = tcp_model_timeout(sk, boundary, rto_base); | |
| 207 | + } | |
| 203 | 208 | |
| 204 | 209 | return (s32)(tcp_time_stamp(tcp_sk(sk)) - start_ts - timeout) >= 0; |
| 205 | 210 | } |
| @@ -821,6 +821,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, · 820 unmodified lines | ||
| 821 | 821 | int is_udplite = IS_UDPLITE(sk); |
| 822 | 822 | int offset = skb_transport_offset(skb); |
| 823 | 823 | int len = skb->len - offset; |
| 824 | + int datalen = len - sizeof(*uh); | |
| 824 | 825 | __wsum csum = 0; |
| 825 | 826 | |
| 826 | 827 | /* |
| @@ -854,10 +855,12 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, · 27 unmodified lines | ||
| 854 | 855 | return -EIO; |
| 855 | 856 | } |
| 856 | 857 | |
| 857 | − skb_shinfo(skb)->gso_size = cork->gso_size; | |
| 858 | − skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; | |
| 859 | − skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh), | |
| 860 | − cork->gso_size); | |
| 858 | + if (datalen > cork->gso_size) { | |
| 859 | + skb_shinfo(skb)->gso_size = cork->gso_size; | |
| 860 | + skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; | |
| 861 | + skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(datalen, | |
| 862 | + cork->gso_size); | |
| 863 | + } | |
| 861 | 864 | goto csum_partial; |
| 862 | 865 | } |
| 863 | 866 | |
| @@ -1969,7 +1972,7 @@ static int udp_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb) · 1105 unmodified lines | ||
| 1969 | 1972 | */ |
| 1970 | 1973 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) |
| 1971 | 1974 | goto drop; |
| 1972 | − nf_reset(skb); | |
| 1975 | + nf_reset_ct(skb); | |
| 1973 | 1976 | |
| 1974 | 1977 | if (static_branch_unlikely(&udp_encap_needed_key) && up->encap_type) { |
| 1975 | 1978 | int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); |
| @@ -2298,7 +2301,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, · 322 unmodified lines | ||
| 2298 | 2301 | |
| 2299 | 2302 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) |
| 2300 | 2303 | goto drop; |
| 2301 | − nf_reset(skb); | |
| 2304 | + nf_reset_ct(skb); | |
| 2302 | 2305 | |
| 2303 | 2306 | /* No socket. Drop packet silently, if checksum is wrong */ |
| 2304 | 2307 | if (udp_lib_checksum_complete(skb)) |
| @@ -5964,13 +5964,20 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) · 5963 unmodified lines | ||
| 5964 | 5964 | switch (event) { |
| 5965 | 5965 | case RTM_NEWADDR: |
| 5966 | 5966 | /* |
| 5967 | − * If the address was optimistic | |
| 5968 | − * we inserted the route at the start of | |
| 5969 | − * our DAD process, so we don't need | |
| 5970 | − * to do it again | |
| 5967 | + * If the address was optimistic we inserted the route at the | |
| 5968 | + * start of our DAD process, so we don't need to do it again. | |
| 5969 | + * If the device was taken down in the middle of the DAD | |
| 5970 | + * cycle there is a race where we could get here without a | |
| 5971 | + * host route, so nothing to insert. That will be fixed when | |
| 5972 | + * the device is brought up. | |
| 5971 | 5973 | */ |
| 5972 | − if (!rcu_access_pointer(ifp->rt->fib6_node)) | |
| 5974 | + if (ifp->rt && !rcu_access_pointer(ifp->rt->fib6_node)) { | |
| 5973 | 5975 | ip6_ins_rt(net, ifp->rt); |
| 5976 | + } else if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) { | |
| 5977 | + pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n", | |
| 5978 | + &ifp->addr, ifp->idev->dev->name); | |
| 5979 | + } | |
| 5980 | + | |
| 5974 | 5981 | if (ifp->idev->cnf.forwarding) |
| 5975 | 5982 | addrconf_join_anycast(ifp); |
| 5976 | 5983 | if (!ipv6_addr_any(&ifp->peer_addr)) |
| @@ -223,6 +223,16 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev, · 222 unmodified lines | ||
| 223 | 223 | if (ipv6_addr_is_multicast(&hdr->saddr)) |
| 224 | 224 | goto err; |
| 225 | 225 | |
| 226 | + /* While RFC4291 is not explicit about v4mapped addresses | |
| 227 | + * in IPv6 headers, it seems clear linux dual-stack | |
| 228 | + * model can not deal properly with these. | |
| 229 | + * Security models could be fooled by ::ffff:127.0.0.1 for example. | |
| 230 | + * | |
| 231 | + * https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02 | |
| 232 | + */ | |
| 233 | + if (ipv6_addr_v4mapped(&hdr->saddr)) | |
| 234 | + goto err; | |
| 235 | + | |
| 226 | 236 | skb->transport_header = skb->network_header + sizeof(*hdr); |
| 227 | 237 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
| 228 | 238 | |
| @@ -371,7 +381,7 @@ resubmit_final: · 142 unmodified lines | ||
| 371 | 381 | /* Free reference early: we don't need it any more, |
| 372 | 382 | and it may hold ip_conntrack module loaded |
| 373 | 383 | indefinitely. */ |
| 374 | − nf_reset(skb); | |
| 384 | + nf_reset_ct(skb); | |
| 375 | 385 | |
| 376 | 386 | skb_postpull_rcsum(skb, skb_network_header(skb), |
| 377 | 387 | skb_network_header_len(skb)); |
| @@ -54,7 +54,7 @@ void nf_dup_ipv6(struct net *net, struct sk_buff *skb, unsigned int hooknum, · 53 unmodified lines | ||
| 54 | 54 | return; |
| 55 | 55 | |
| 56 | 56 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) |
| 57 | − nf_reset(skb); | |
| 57 | + nf_reset_ct(skb); | |
| 58 | 58 | nf_ct_set(skb, NULL, IP_CT_UNTRACKED); |
| 59 | 59 | #endif |
| 60 | 60 | if (hooknum == NF_INET_PRE_ROUTING || |
| @@ -215,7 +215,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) · 214 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | /* Not releasing hash table! */ |
| 217 | 217 | if (clone) { |
| 218 | − nf_reset(clone); | |
| 218 | + nf_reset_ct(clone); | |
| 219 | 219 | rawv6_rcv(sk, clone); |
| 220 | 220 | } |
| 221 | 221 | } |
| @@ -1109,6 +1109,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, · 1108 unmodified lines | ||
| 1109 | 1109 | __wsum csum = 0; |
| 1110 | 1110 | int offset = skb_transport_offset(skb); |
| 1111 | 1111 | int len = skb->len - offset; |
| 1112 | + int datalen = len - sizeof(*uh); | |
| 1112 | 1113 | |
| 1113 | 1114 | /* |
| 1114 | 1115 | * Create a UDP header |
| @@ -1141,8 +1142,12 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, · 26 unmodified lines | ||
| 1141 | 1142 | return -EIO; |
| 1142 | 1143 | } |
| 1143 | 1144 | |
| 1144 | − skb_shinfo(skb)->gso_size = cork->gso_size; | |
| 1145 | − skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; | |
| 1145 | + if (datalen > cork->gso_size) { | |
| 1146 | + skb_shinfo(skb)->gso_size = cork->gso_size; | |
| 1147 | + skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4; | |
| 1148 | + skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(datalen, | |
| 1149 | + cork->gso_size); | |
| 1150 | + } | |
| 1146 | 1151 | goto csum_partial; |
| 1147 | 1152 | } |
| 1148 | 1153 | |
| @@ -1078,7 +1078,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len · 1077 unmodified lines | ||
| 1078 | 1078 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
| 1079 | 1079 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | |
| 1080 | 1080 | IPSKB_REROUTED); |
| 1081 | − nf_reset(skb); | |
| 1081 | + nf_reset_ct(skb); | |
| 1082 | 1082 | |
| 1083 | 1083 | bh_lock_sock(sk); |
| 1084 | 1084 | if (sock_owned_by_user(sk)) { |
| @@ -151,7 +151,7 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, · 150 unmodified lines | ||
| 151 | 151 | skb->ip_summed = CHECKSUM_NONE; |
| 152 | 152 | |
| 153 | 153 | skb_dst_drop(skb); |
| 154 | − nf_reset(skb); | |
| 154 | + nf_reset_ct(skb); | |
| 155 | 155 | |
| 156 | 156 | rcu_read_lock(); |
| 157 | 157 | dev = rcu_dereference(spriv->dev); |
| @@ -193,7 +193,7 @@ pass_up: · 192 unmodified lines | ||
| 193 | 193 | if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) |
| 194 | 194 | goto discard_put; |
| 195 | 195 | |
| 196 | − nf_reset(skb); | |
| 196 | + nf_reset_ct(skb); | |
| 197 | 197 | |
| 198 | 198 | return sk_receive_skb(sk, skb, 1); |
| 199 | 199 | |
| @@ -206,7 +206,7 @@ pass_up: · 205 unmodified lines | ||
| 206 | 206 | if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) |
| 207 | 207 | goto discard_put; |
| 208 | 208 | |
| 209 | − nf_reset(skb); | |
| 209 | + nf_reset_ct(skb); | |
| 210 | 210 | |
| 211 | 211 | return sk_receive_skb(sk, skb, 1); |
| 212 | 212 | |
| @@ -487,9 +487,14 @@ static ssize_t ieee80211_if_fmt_aqm( · 486 unmodified lines | ||
| 487 | 487 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
| 488 | 488 | { |
| 489 | 489 | struct ieee80211_local *local = sdata->local; |
| 490 | − struct txq_info *txqi = to_txq_info(sdata->vif.txq); | |
| 490 | + struct txq_info *txqi; | |
| 491 | 491 | int len; |
| 492 | 492 | |
| 493 | + if (!sdata->vif.txq) | |
| 494 | + return 0; | |
| 495 | + | |
| 496 | + txqi = to_txq_info(sdata->vif.txq); | |
| 497 | + | |
| 493 | 498 | spin_lock_bh(&local->fq.lock); |
| 494 | 499 | rcu_read_lock(); |
| 495 | 500 | |
| @@ -658,7 +663,9 @@ static void add_common_files(struct ieee80211_sub_if_data *sdata) · 162 unmodified lines | ||
| 658 | 663 | DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz); |
| 659 | 664 | DEBUGFS_ADD(hw_queues); |
| 660 | 665 | |
| 661 | − if (sdata->local->ops->wake_tx_queue) | |
| 666 | + if (sdata->local->ops->wake_tx_queue && | |
| 667 | + sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && | |
| 668 | + sdata->vif.type != NL80211_IFTYPE_NAN) | |
| 662 | 669 | DEBUGFS_ADD(aqm); |
| 663 | 670 | } |
| 664 | 671 | |
| @@ -247,7 +247,8 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 246 unmodified lines | ||
| 247 | 247 | struct sta_info *sta; |
| 248 | 248 | int i; |
| 249 | 249 | |
| 250 | − spin_lock_bh(&fq->lock); | |
| 250 | + local_bh_disable(); | |
| 251 | + spin_lock(&fq->lock); | |
| 251 | 252 | |
| 252 | 253 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
| 253 | 254 | ps = &sdata->bss->ps; |
| @@ -273,9 +274,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 19 unmodified lines | ||
| 273 | 274 | &txqi->flags)) |
| 274 | 275 | continue; |
| 275 | 276 | |
| 276 | − spin_unlock_bh(&fq->lock); | |
| 277 | + spin_unlock(&fq->lock); | |
| 277 | 278 | drv_wake_tx_queue(local, txqi); |
| 278 | − spin_lock_bh(&fq->lock); | |
| 279 | + spin_lock(&fq->lock); | |
| 279 | 280 | } |
| 280 | 281 | } |
| 281 | 282 | |
| @@ -288,12 +289,14 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) · 6 unmodified lines | ||
| 288 | 289 | (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) |
| 289 | 290 | goto out; |
| 290 | 291 | |
| 291 | − spin_unlock_bh(&fq->lock); | |
| 292 | + spin_unlock(&fq->lock); | |
| 292 | 293 | |
| 293 | 294 | drv_wake_tx_queue(local, txqi); |
| 295 | + local_bh_enable(); | |
| 294 | 296 | return; |
| 295 | 297 | out: |
| 296 | − spin_unlock_bh(&fq->lock); | |
| 298 | + spin_unlock(&fq->lock); | |
| 299 | + local_bh_enable(); | |
| 297 | 300 | } |
| 298 | 301 | |
| 299 | 302 | static void |
| @@ -613,7 +613,7 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb, · 612 unmodified lines | ||
| 613 | 613 | if (unlikely(cp->flags & IP_VS_CONN_F_NFCT)) |
| 614 | 614 | ret = ip_vs_confirm_conntrack(skb); |
| 615 | 615 | if (ret == NF_ACCEPT) { |
| 616 | − nf_reset(skb); | |
| 616 | + nf_reset_ct(skb); | |
| 617 | 617 | skb_forward_csum(skb); |
| 618 | 618 | } |
| 619 | 619 | return ret; |
| @@ -218,8 +218,13 @@ static void nft_connlimit_destroy_clone(const struct nft_ctx *ctx, · 217 unmodified lines | ||
| 218 | 218 | static bool nft_connlimit_gc(struct net *net, const struct nft_expr *expr) |
| 219 | 219 | { |
| 220 | 220 | struct nft_connlimit *priv = nft_expr_priv(expr); |
| 221 | + bool ret; | |
| 221 | 222 | |
| 222 | − return nf_conncount_gc_list(net, &priv->list); | |
| 223 | + local_bh_disable(); | |
| 224 | + ret = nf_conncount_gc_list(net, &priv->list); | |
| 225 | + local_bh_enable(); | |
| 226 | + | |
| 227 | + return ret; | |
| 223 | 228 | } |
| 224 | 229 | |
| 225 | 230 | static struct nft_expr_type nft_connlimit_type; |
| @@ -107,9 +107,14 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) · 106 unmodified lines | ||
| 107 | 107 | llcp_sock->service_name = kmemdup(llcp_addr.service_name, |
| 108 | 108 | llcp_sock->service_name_len, |
| 109 | 109 | GFP_KERNEL); |
| 110 | − | |
| 110 | + if (!llcp_sock->service_name) { | |
| 111 | + ret = -ENOMEM; | |
| 112 | + goto put_dev; | |
| 113 | + } | |
| 111 | 114 | llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); |
| 112 | 115 | if (llcp_sock->ssap == LLCP_SAP_MAX) { |
| 116 | + kfree(llcp_sock->service_name); | |
| 117 | + llcp_sock->service_name = NULL; | |
| 113 | 118 | ret = -EADDRINUSE; |
| 114 | 119 | goto put_dev; |
| 115 | 120 | } |
| @@ -237,7 +237,7 @@ static netdev_tx_t internal_dev_recv(struct sk_buff *skb) · 236 unmodified lines | ||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | skb_dst_drop(skb); |
| 240 | − nf_reset(skb); | |
| 240 | + nf_reset_ct(skb); | |
| 241 | 241 | secpath_reset(skb); |
| 242 | 242 | |
| 243 | 243 | skb->pkt_type = PACKET_HOST; |
| @@ -1821,7 +1821,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, · 1820 unmodified lines | ||
| 1821 | 1821 | skb_dst_drop(skb); |
| 1822 | 1822 | |
| 1823 | 1823 | /* drop conntrack reference */ |
| 1824 | − nf_reset(skb); | |
| 1824 | + nf_reset_ct(skb); | |
| 1825 | 1825 | |
| 1826 | 1826 | spkt = &PACKET_SKB_CB(skb)->sa.pkt; |
| 1827 | 1827 | |
| @@ -2121,7 +2121,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, · 293 unmodified lines | ||
| 2121 | 2121 | skb_dst_drop(skb); |
| 2122 | 2122 | |
| 2123 | 2123 | /* drop conntrack reference */ |
| 2124 | − nf_reset(skb); | |
| 2124 | + nf_reset_ct(skb); | |
| 2125 | 2125 | |
| 2126 | 2126 | spin_lock(&sk->sk_receive_queue.lock); |
| 2127 | 2127 | po->stats.stats1.tp_packets++; |
| @@ -143,6 +143,9 @@ static void rds_ib_add_one(struct ib_device *device) · 142 unmodified lines | ||
| 143 | 143 | refcount_set(&rds_ibdev->refcount, 1); |
| 144 | 144 | INIT_WORK(&rds_ibdev->free_work, rds_ib_dev_free); |
| 145 | 145 | |
| 146 | + INIT_LIST_HEAD(&rds_ibdev->ipaddr_list); | |
| 147 | + INIT_LIST_HEAD(&rds_ibdev->conn_list); | |
| 148 | + | |
| 146 | 149 | rds_ibdev->max_wrs = device->attrs.max_qp_wr; |
| 147 | 150 | rds_ibdev->max_sge = min(device->attrs.max_send_sge, RDS_IB_MAX_SGE); |
| 148 | 151 | |
| @@ -203,9 +206,6 @@ static void rds_ib_add_one(struct ib_device *device) · 54 unmodified lines | ||
| 203 | 206 | device->name, |
| 204 | 207 | rds_ibdev->use_fastreg ? "FRMR" : "FMR"); |
| 205 | 208 | |
| 206 | − INIT_LIST_HEAD(&rds_ibdev->ipaddr_list); | |
| 207 | − INIT_LIST_HEAD(&rds_ibdev->conn_list); | |
| 208 | − | |
| 209 | 209 | down_write(&rds_ib_devices_lock); |
| 210 | 210 | list_add_tail_rcu(&rds_ibdev->list, &rds_ib_devices); |
| 211 | 211 | up_write(&rds_ib_devices_lock); |
| @@ -1127,6 +1127,33 @@ static const struct nla_policy cbq_policy[TCA_CBQ_MAX + 1] = { · 1126 unmodified lines | ||
| 1127 | 1127 | [TCA_CBQ_POLICE] = { .len = sizeof(struct tc_cbq_police) }, |
| 1128 | 1128 | }; |
| 1129 | 1129 | |
| 1130 | +static int cbq_opt_parse(struct nlattr *tb[TCA_CBQ_MAX + 1], | |
| 1131 | + struct nlattr *opt, | |
| 1132 | + struct netlink_ext_ack *extack) | |
| 1133 | +{ | |
| 1134 | + int err; | |
| 1135 | + | |
| 1136 | + if (!opt) { | |
| 1137 | + NL_SET_ERR_MSG(extack, "CBQ options are required for this operation"); | |
| 1138 | + return -EINVAL; | |
| 1139 | + } | |
| 1140 | + | |
| 1141 | + err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, | |
| 1142 | + cbq_policy, extack); | |
| 1143 | + if (err < 0) | |
| 1144 | + return err; | |
| 1145 | + | |
| 1146 | + if (tb[TCA_CBQ_WRROPT]) { | |
| 1147 | + const struct tc_cbq_wrropt *wrr = nla_data(tb[TCA_CBQ_WRROPT]); | |
| 1148 | + | |
| 1149 | + if (wrr->priority > TC_CBQ_MAXPRIO) { | |
| 1150 | + NL_SET_ERR_MSG(extack, "priority is bigger than TC_CBQ_MAXPRIO"); | |
| 1151 | + err = -EINVAL; | |
| 1152 | + } | |
| 1153 | + } | |
| 1154 | + return err; | |
| 1155 | +} | |
| 1156 | + | |
| 1130 | 1157 | static int cbq_init(struct Qdisc *sch, struct nlattr *opt, |
| 1131 | 1158 | struct netlink_ext_ack *extack) |
| 1132 | 1159 | { |
| @@ -1139,13 +1166,7 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt, · 6 unmodified lines | ||
| 1139 | 1166 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED); |
| 1140 | 1167 | q->delay_timer.function = cbq_undelay; |
| 1141 | 1168 | |
| 1142 | − if (!opt) { | |
| 1143 | − NL_SET_ERR_MSG(extack, "CBQ options are required for this operation"); | |
| 1144 | − return -EINVAL; | |
| 1145 | − } | |
| 1146 | − | |
| 1147 | − err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy, | |
| 1148 | − extack); | |
| 1169 | + err = cbq_opt_parse(tb, opt, extack); | |
| 1149 | 1170 | if (err < 0) |
| 1150 | 1171 | return err; |
| 1151 | 1172 | |
| @@ -1464,13 +1485,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t · 312 unmodified lines | ||
| 1464 | 1485 | struct cbq_class *parent; |
| 1465 | 1486 | struct qdisc_rate_table *rtab = NULL; |
| 1466 | 1487 | |
| 1467 | − if (!opt) { | |
| 1468 | − NL_SET_ERR_MSG(extack, "Mandatory qdisc options missing"); | |
| 1469 | − return -EINVAL; | |
| 1470 | − } | |
| 1471 | − | |
| 1472 | − err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy, | |
| 1473 | − extack); | |
| 1488 | + err = cbq_opt_parse(tb, opt, extack); | |
| 1474 | 1489 | if (err < 0) |
| 1475 | 1490 | return err; |
| 1476 | 1491 | |
| @@ -306,7 +306,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) · 305 unmodified lines | ||
| 306 | 306 | if (err < 0) |
| 307 | 307 | goto skip; |
| 308 | 308 | |
| 309 | − if (ecmd.base.speed != SPEED_UNKNOWN) | |
| 309 | + if (ecmd.base.speed && ecmd.base.speed != SPEED_UNKNOWN) | |
| 310 | 310 | speed = ecmd.base.speed; |
| 311 | 311 | |
| 312 | 312 | skip: |
| @@ -361,6 +361,8 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt, · 360 unmodified lines | ||
| 361 | 361 | goto errout; |
| 362 | 362 | |
| 363 | 363 | err = -EINVAL; |
| 364 | + if (!tb[TCA_DSMARK_INDICES]) | |
| 365 | + goto errout; | |
| 364 | 366 | indices = nla_get_u16(tb[TCA_DSMARK_INDICES]); |
| 365 | 367 | |
| 366 | 368 | if (hweight32(indices) != 1) |
| @@ -1044,12 +1044,11 @@ static void taprio_set_picos_per_byte(struct net_device *dev, · 1043 unmodified lines | ||
| 1044 | 1044 | if (err < 0) |
| 1045 | 1045 | goto skip; |
| 1046 | 1046 | |
| 1047 | − if (ecmd.base.speed != SPEED_UNKNOWN) | |
| 1047 | + if (ecmd.base.speed && ecmd.base.speed != SPEED_UNKNOWN) | |
| 1048 | 1048 | speed = ecmd.base.speed; |
| 1049 | 1049 | |
| 1050 | 1050 | skip: |
| 1051 | − picos_per_byte = div64_s64(NSEC_PER_SEC * 1000LL * 8, | |
| 1052 | − speed * 1000 * 1000); | |
| 1051 | + picos_per_byte = (USEC_PER_SEC * 8) / speed; | |
| 1053 | 1052 | |
| 1054 | 1053 | atomic64_set(&q->picos_per_byte, picos_per_byte); |
| 1055 | 1054 | netdev_dbg(dev, "taprio: set %s's picos_per_byte to: %lld, linkspeed: %d\n", |
| @@ -201,7 +201,7 @@ int sctp_rcv(struct sk_buff *skb) · 200 unmodified lines | ||
| 201 | 201 | |
| 202 | 202 | if (!xfrm_policy_check(sk, XFRM_POLICY_IN, skb, family)) |
| 203 | 203 | goto discard_release; |
| 204 | − nf_reset(skb); | |
| 204 | + nf_reset_ct(skb); | |
| 205 | 205 | |
| 206 | 206 | if (sk_filter(sk, skb)) |
| 207 | 207 | goto discard_release; |
| @@ -160,6 +160,7 @@ struct tipc_link { · 159 unmodified lines | ||
| 160 | 160 | struct { |
| 161 | 161 | u16 len; |
| 162 | 162 | u16 limit; |
| 163 | + struct sk_buff *target_bskb; | |
| 163 | 164 | } backlog[5]; |
| 164 | 165 | u16 snd_nxt; |
| 165 | 166 | u16 window; |
| @@ -880,6 +881,7 @@ static void link_prepare_wakeup(struct tipc_link *l) · 714 unmodified lines | ||
| 880 | 881 | void tipc_link_reset(struct tipc_link *l) |
| 881 | 882 | { |
| 882 | 883 | struct sk_buff_head list; |
| 884 | + u32 imp; | |
| 883 | 885 | |
| 884 | 886 | __skb_queue_head_init(&list); |
| 885 | 887 | |
| @@ -901,11 +903,10 @@ void tipc_link_reset(struct tipc_link *l) · 15 unmodified lines | ||
| 901 | 903 | __skb_queue_purge(&l->deferdq); |
| 902 | 904 | __skb_queue_purge(&l->backlogq); |
| 903 | 905 | __skb_queue_purge(&l->failover_deferdq); |
| 904 | − l->backlog[TIPC_LOW_IMPORTANCE].len = 0; | |
| 905 | − l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0; | |
| 906 | − l->backlog[TIPC_HIGH_IMPORTANCE].len = 0; | |
| 907 | − l->backlog[TIPC_CRITICAL_IMPORTANCE].len = 0; | |
| 908 | − l->backlog[TIPC_SYSTEM_IMPORTANCE].len = 0; | |
| 906 | + for (imp = 0; imp <= TIPC_SYSTEM_IMPORTANCE; imp++) { | |
| 907 | + l->backlog[imp].len = 0; | |
| 908 | + l->backlog[imp].target_bskb = NULL; | |
| 909 | + } | |
| 909 | 910 | kfree_skb(l->reasm_buf); |
| 910 | 911 | kfree_skb(l->reasm_tnlmsg); |
| 911 | 912 | kfree_skb(l->failover_reasm_skb); |
| @@ -947,7 +948,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 35 unmodified lines | ||
| 947 | 948 | u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; |
| 948 | 949 | struct sk_buff_head *transmq = &l->transmq; |
| 949 | 950 | struct sk_buff_head *backlogq = &l->backlogq; |
| 950 | − struct sk_buff *skb, *_skb, *bskb; | |
| 951 | + struct sk_buff *skb, *_skb, **tskb; | |
| 951 | 952 | int pkt_cnt = skb_queue_len(list); |
| 952 | 953 | int rc = 0; |
| 953 | 954 | |
| @@ -999,19 +1000,21 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, · 45 unmodified lines | ||
| 999 | 1000 | seqno++; |
| 1000 | 1001 | continue; |
| 1001 | 1002 | } |
| 1002 | − if (tipc_msg_bundle(skb_peek_tail(backlogq), hdr, mtu)) { | |
| 1003 | + tskb = &l->backlog[imp].target_bskb; | |
| 1004 | + if (tipc_msg_bundle(*tskb, hdr, mtu)) { | |
| 1003 | 1005 | kfree_skb(__skb_dequeue(list)); |
| 1004 | 1006 | l->stats.sent_bundled++; |
| 1005 | 1007 | continue; |
| 1006 | 1008 | } |
| 1007 | − if (tipc_msg_make_bundle(&bskb, hdr, mtu, l->addr)) { | |
| 1009 | + if (tipc_msg_make_bundle(tskb, hdr, mtu, l->addr)) { | |
| 1008 | 1010 | kfree_skb(__skb_dequeue(list)); |
| 1009 | − __skb_queue_tail(backlogq, bskb); | |
| 1010 | − l->backlog[msg_importance(buf_msg(bskb))].len++; | |
| 1011 | + __skb_queue_tail(backlogq, *tskb); | |
| 1012 | + l->backlog[imp].len++; | |
| 1011 | 1013 | l->stats.sent_bundled++; |
| 1012 | 1014 | l->stats.sent_bundles++; |
| 1013 | 1015 | continue; |
| 1014 | 1016 | } |
| 1017 | + l->backlog[imp].target_bskb = NULL; | |
| 1015 | 1018 | l->backlog[imp].len += skb_queue_len(list); |
| 1016 | 1019 | skb_queue_splice_tail_init(list, backlogq); |
| 1017 | 1020 | } |
| @@ -1027,6 +1030,7 @@ static void tipc_link_advance_backlog(struct tipc_link *l, · 9 unmodified lines | ||
| 1027 | 1030 | u16 seqno = l->snd_nxt; |
| 1028 | 1031 | u16 ack = l->rcv_nxt - 1; |
| 1029 | 1032 | u16 bc_ack = l->bc_rcvlink->rcv_nxt - 1; |
| 1033 | + u32 imp; | |
| 1030 | 1034 | |
| 1031 | 1035 | while (skb_queue_len(&l->transmq) < l->window) { |
| 1032 | 1036 | skb = skb_peek(&l->backlogq); |
| @@ -1037,7 +1041,10 @@ static void tipc_link_advance_backlog(struct tipc_link *l, · 4 unmodified lines | ||
| 1037 | 1041 | break; |
| 1038 | 1042 | __skb_dequeue(&l->backlogq); |
| 1039 | 1043 | hdr = buf_msg(skb); |
| 1040 | − l->backlog[msg_importance(hdr)].len--; | |
| 1044 | + imp = msg_importance(hdr); | |
| 1045 | + l->backlog[imp].len--; | |
| 1046 | + if (unlikely(skb == l->backlog[imp].target_bskb)) | |
| 1047 | + l->backlog[imp].target_bskb = NULL; | |
| 1041 | 1048 | __skb_queue_tail(&l->transmq, skb); |
| 1042 | 1049 | /* next retransmit attempt */ |
| 1043 | 1050 | if (link_is_bc_sndlink(l)) |
| @@ -543,10 +543,7 @@ bool tipc_msg_make_bundle(struct sk_buff **skb, struct tipc_msg *msg, · 542 unmodified lines | ||
| 543 | 543 | bmsg = buf_msg(_skb); |
| 544 | 544 | tipc_msg_init(msg_prevnode(msg), bmsg, MSG_BUNDLER, 0, |
| 545 | 545 | INT_H_SIZE, dnode); |
| 546 | − if (msg_isdata(msg)) | |
| 547 | − msg_set_importance(bmsg, TIPC_CRITICAL_IMPORTANCE); | |
| 548 | − else | |
| 549 | − msg_set_importance(bmsg, TIPC_SYSTEM_IMPORTANCE); | |
| 546 | + msg_set_importance(bmsg, msg_importance(msg)); | |
| 550 | 547 | msg_set_seqno(bmsg, msg_seqno(msg)); |
| 551 | 548 | msg_set_ack(bmsg, msg_ack(msg)); |
| 552 | 549 | msg_set_bcast_ack(bmsg, msg_bcast_ack(msg)); |
| @@ -638,7 +638,7 @@ struct sock *__vsock_create(struct net *net, · 637 unmodified lines | ||
| 638 | 638 | } |
| 639 | 639 | EXPORT_SYMBOL_GPL(__vsock_create); |
| 640 | 640 | |
| 641 | −static void __vsock_release(struct sock *sk) | |
| 641 | +static void __vsock_release(struct sock *sk, int level) | |
| 642 | 642 | { |
| 643 | 643 | if (sk) { |
| 644 | 644 | struct sk_buff *skb; |
| @@ -648,9 +648,17 @@ static void __vsock_release(struct sock *sk) · 3 unmodified lines | ||
| 648 | 648 | vsk = vsock_sk(sk); |
| 649 | 649 | pending = NULL; /* Compiler warning. */ |
| 650 | 650 | |
| 651 | + /* The release call is supposed to use lock_sock_nested() | |
| 652 | + * rather than lock_sock(), if a sock lock should be acquired. | |
| 653 | + */ | |
| 651 | 654 | transport->release(vsk); |
| 652 | 655 | |
| 653 | − lock_sock(sk); | |
| 656 | + /* When "level" is SINGLE_DEPTH_NESTING, use the nested | |
| 657 | + * version to avoid the warning "possible recursive locking | |
| 658 | + * detected". When "level" is 0, lock_sock_nested(sk, level) | |
| 659 | + * is the same as lock_sock(sk). | |
| 660 | + */ | |
| 661 | + lock_sock_nested(sk, level); | |
| 654 | 662 | sock_orphan(sk); |
| 655 | 663 | sk->sk_shutdown = SHUTDOWN_MASK; |
| 656 | 664 | |
| @@ -659,7 +667,7 @@ static void __vsock_release(struct sock *sk) · 2 unmodified lines | ||
| 659 | 667 | |
| 660 | 668 | /* Clean up any sockets that never were accepted. */ |
| 661 | 669 | while ((pending = vsock_dequeue_accept(sk)) != NULL) { |
| 662 | − __vsock_release(pending); | |
| 670 | + __vsock_release(pending, SINGLE_DEPTH_NESTING); | |
| 663 | 671 | sock_put(pending); |
| 664 | 672 | } |
| 665 | 673 | |
| @@ -708,7 +716,7 @@ EXPORT_SYMBOL_GPL(vsock_stream_has_space); · 42 unmodified lines | ||
| 708 | 716 | |
| 709 | 717 | static int vsock_release(struct socket *sock) |
| 710 | 718 | { |
| 711 | − __vsock_release(sock->sk); | |
| 719 | + __vsock_release(sock->sk, 0); | |
| 712 | 720 | sock->sk = NULL; |
| 713 | 721 | sock->state = SS_FREE; |
| 714 | 722 | |
| @@ -559,7 +559,7 @@ static void hvs_release(struct vsock_sock *vsk) · 558 unmodified lines | ||
| 559 | 559 | struct sock *sk = sk_vsock(vsk); |
| 560 | 560 | bool remove_sock; |
| 561 | 561 | |
| 562 | − lock_sock(sk); | |
| 562 | + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); | |
| 563 | 563 | remove_sock = hvs_close_lock_held(vsk); |
| 564 | 564 | release_sock(sk); |
| 565 | 565 | if (remove_sock) |
| @@ -820,7 +820,7 @@ void virtio_transport_release(struct vsock_sock *vsk) · 819 unmodified lines | ||
| 820 | 820 | struct sock *sk = &vsk->sk; |
| 821 | 821 | bool remove_sock = true; |
| 822 | 822 | |
| 823 | − lock_sock(sk); | |
| 823 | + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); | |
| 824 | 824 | if (sk->sk_type == SOCK_STREAM) |
| 825 | 825 | remove_sock = virtio_transport_close(vsk); |
| 826 | 826 | |
| @@ -201,6 +201,38 @@ cfg80211_get_dev_from_info(struct net *netns, struct genl_info *info) · 200 unmodified lines | ||
| 201 | 201 | return __cfg80211_rdev_from_attrs(netns, info->attrs); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | +static int validate_beacon_head(const struct nlattr *attr, | |
| 205 | + struct netlink_ext_ack *extack) | |
| 206 | +{ | |
| 207 | + const u8 *data = nla_data(attr); | |
| 208 | + unsigned int len = nla_len(attr); | |
| 209 | + const struct element *elem; | |
| 210 | + const struct ieee80211_mgmt *mgmt = (void *)data; | |
| 211 | + unsigned int fixedlen = offsetof(struct ieee80211_mgmt, | |
| 212 | + u.beacon.variable); | |
| 213 | + | |
| 214 | + if (len < fixedlen) | |
| 215 | + goto err; | |
| 216 | + | |
| 217 | + if (ieee80211_hdrlen(mgmt->frame_control) != | |
| 218 | + offsetof(struct ieee80211_mgmt, u.beacon)) | |
| 219 | + goto err; | |
| 220 | + | |
| 221 | + data += fixedlen; | |
| 222 | + len -= fixedlen; | |
| 223 | + | |
| 224 | + for_each_element(elem, data, len) { | |
| 225 | + /* nothing */ | |
| 226 | + } | |
| 227 | + | |
| 228 | + if (for_each_element_completed(elem, data, len)) | |
| 229 | + return 0; | |
| 230 | + | |
| 231 | +err: | |
| 232 | + NL_SET_ERR_MSG_ATTR(extack, attr, "malformed beacon head"); | |
| 233 | + return -EINVAL; | |
| 234 | +} | |
| 235 | + | |
| 204 | 236 | static int validate_ie_attr(const struct nlattr *attr, |
| 205 | 237 | struct netlink_ext_ack *extack) |
| 206 | 238 | { |
| @@ -338,8 +370,9 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 131 unmodified lines | ||
| 338 | 370 | |
| 339 | 371 | [NL80211_ATTR_BEACON_INTERVAL] = { .type = NLA_U32 }, |
| 340 | 372 | [NL80211_ATTR_DTIM_PERIOD] = { .type = NLA_U32 }, |
| 341 | − [NL80211_ATTR_BEACON_HEAD] = { .type = NLA_BINARY, | |
| 342 | − .len = IEEE80211_MAX_DATA_LEN }, | |
| 373 | + [NL80211_ATTR_BEACON_HEAD] = | |
| 374 | + NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_beacon_head, | |
| 375 | + IEEE80211_MAX_DATA_LEN), | |
| 343 | 376 | [NL80211_ATTR_BEACON_TAIL] = |
| 344 | 377 | NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_ie_attr, |
| 345 | 378 | IEEE80211_MAX_DATA_LEN), |
| @@ -2636,6 +2669,8 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, · 2290 unmodified lines | ||
| 2636 | 2669 | |
| 2637 | 2670 | control_freq = nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]); |
| 2638 | 2671 | |
| 2672 | + memset(chandef, 0, sizeof(*chandef)); | |
| 2673 | + | |
| 2639 | 2674 | chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq); |
| 2640 | 2675 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; |
| 2641 | 2676 | chandef->center_freq1 = control_freq; |
| @@ -3176,7 +3211,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag · 534 unmodified lines | ||
| 3176 | 3211 | |
| 3177 | 3212 | if (rdev->ops->get_channel) { |
| 3178 | 3213 | int ret; |
| 3179 | − struct cfg80211_chan_def chandef; | |
| 3214 | + struct cfg80211_chan_def chandef = {}; | |
| 3180 | 3215 | |
| 3181 | 3216 | ret = rdev_get_channel(rdev, wdev, &chandef); |
| 3182 | 3217 | if (ret == 0) { |
| @@ -6270,6 +6305,9 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info) · 3087 unmodified lines | ||
| 6270 | 6305 | if (!rdev->ops->del_mpath) |
| 6271 | 6306 | return -EOPNOTSUPP; |
| 6272 | 6307 | |
| 6308 | + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) | |
| 6309 | + return -EOPNOTSUPP; | |
| 6310 | + | |
| 6273 | 6311 | return rdev_del_mpath(rdev, dev, dst); |
| 6274 | 6312 | } |
| 6275 | 6313 | |
| @@ -2108,7 +2108,7 @@ static void reg_call_notifier(struct wiphy *wiphy, · 2107 unmodified lines | ||
| 2108 | 2108 | |
| 2109 | 2109 | static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) |
| 2110 | 2110 | { |
| 2111 | − struct cfg80211_chan_def chandef; | |
| 2111 | + struct cfg80211_chan_def chandef = {}; | |
| 2112 | 2112 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
| 2113 | 2113 | enum nl80211_iftype iftype; |
| 2114 | 2114 | |
| @@ -1723,7 +1723,12 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, · 1722 unmodified lines | ||
| 1723 | 1723 | return; |
| 1724 | 1724 | new_ie_len -= trans_ssid[1]; |
| 1725 | 1725 | mbssid = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ie, ielen); |
| 1726 | − if (!mbssid) | |
| 1726 | + /* | |
| 1727 | + * It's not valid to have the MBSSID element before SSID | |
| 1728 | + * ignore if that happens - the code below assumes it is | |
| 1729 | + * after (while copying things inbetween). | |
| 1730 | + */ | |
| 1731 | + if (!mbssid || mbssid < trans_ssid) | |
| 1727 | 1732 | return; |
| 1728 | 1733 | new_ie_len -= mbssid[1]; |
| 1729 | 1734 | rcu_read_lock(); |
| @@ -798,7 +798,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, · 797 unmodified lines | ||
| 798 | 798 | { |
| 799 | 799 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 800 | 800 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
| 801 | − struct cfg80211_chan_def chandef; | |
| 801 | + struct cfg80211_chan_def chandef = {}; | |
| 802 | 802 | int ret; |
| 803 | 803 | |
| 804 | 804 | switch (wdev->iftype) { |
| @@ -706,7 +706,7 @@ resume: · 705 unmodified lines | ||
| 706 | 706 | if (err) |
| 707 | 707 | goto drop; |
| 708 | 708 | |
| 709 | − nf_reset(skb); | |
| 709 | + nf_reset_ct(skb); | |
| 710 | 710 | |
| 711 | 711 | if (decaps) { |
| 712 | 712 | sp = skb_sec_path(skb); |
| @@ -185,7 +185,7 @@ static void xfrmi_scrub_packet(struct sk_buff *skb, bool xnet) · 184 unmodified lines | ||
| 185 | 185 | skb->skb_iif = 0; |
| 186 | 186 | skb->ignore_df = 0; |
| 187 | 187 | skb_dst_drop(skb); |
| 188 | − nf_reset(skb); | |
| 188 | + nf_reset_ct(skb); | |
| 189 | 189 | nf_reset_trace(skb); |
| 190 | 190 | |
| 191 | 191 | if (!xnet) |
| @@ -502,7 +502,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err) · 501 unmodified lines | ||
| 502 | 502 | struct net *net = xs_net(skb_dst(skb)->xfrm); |
| 503 | 503 | |
| 504 | 504 | while (likely((err = xfrm_output_one(skb, err)) == 0)) { |
| 505 | − nf_reset(skb); | |
| 505 | + nf_reset_ct(skb); | |
| 506 | 506 | |
| 507 | 507 | err = skb_dst(skb)->ops->local_out(net, skb->sk, skb); |
| 508 | 508 | if (unlikely(err != 1)) |
| @@ -2808,7 +2808,7 @@ static void xfrm_policy_queue_process(struct timer_list *t) · 2807 unmodified lines | ||
| 2808 | 2808 | continue; |
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | − nf_reset(skb); | |
| 2811 | + nf_reset_ct(skb); | |
| 2812 | 2812 | skb_dst_drop(skb); |
| 2813 | 2813 | skb_dst_set(skb, dst); |
| 2814 | 2814 | |
| @@ -143,11 +143,6 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e · 142 unmodified lines | ||
| 143 | 143 | # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) |
| 144 | 144 | ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3)) |
| 145 | 145 | |
| 146 | −# ar-option | |
| 147 | −# Usage: KBUILD_ARFLAGS := $(call ar-option,D) | |
| 148 | −# Important: no spaces around options | |
| 149 | −ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2)) | |
| 150 | − | |
| 151 | 146 | # ld-version |
| 152 | 147 | # Note this is mainly for HJ Lu's 3 number binutil versions |
| 153 | 148 | ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh) |
| @@ -389,7 +389,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 388 unmodified lines | ||
| 389 | 389 | ifdef builtin-target |
| 390 | 390 | |
| 391 | 391 | quiet_cmd_ar_builtin = AR $@ |
| 392 | − cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) | |
| 392 | + cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs) | |
| 393 | 393 | |
| 394 | 394 | $(builtin-target): $(real-obj-y) FORCE |
| 395 | 395 | $(call if_changed,ar_builtin) |
| @@ -232,7 +232,7 @@ quiet_cmd_ld = LD $@ · 231 unmodified lines | ||
| 232 | 232 | # --------------------------------------------------------------------------- |
| 233 | 233 | |
| 234 | 234 | quiet_cmd_ar = AR $@ |
| 235 | − cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs) | |
| 235 | + cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs) | |
| 236 | 236 | |
| 237 | 237 | # Objcopy |
| 238 | 238 | # --------------------------------------------------------------------------- |
| @@ -2652,15 +2652,20 @@ int main(int argc, char **argv) · 2651 unmodified lines | ||
| 2652 | 2652 | fatal("modpost: Section mismatches detected.\n" |
| 2653 | 2653 | "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); |
| 2654 | 2654 | for (n = 0; n < SYMBOL_HASH_SIZE; n++) { |
| 2655 | − struct symbol *s = symbolhash[n]; | |
| 2655 | + struct symbol *s; | |
| 2656 | + | |
| 2657 | + for (s = symbolhash[n]; s; s = s->next) { | |
| 2658 | + /* | |
| 2659 | + * Do not check "vmlinux". This avoids the same warnings | |
| 2660 | + * shown twice, and false-positives for ARCH=um. | |
| 2661 | + */ | |
| 2662 | + if (is_vmlinux(s->module->name) && !s->module->is_dot_o) | |
| 2663 | + continue; | |
| 2656 | 2664 | |
| 2657 | − while (s) { | |
| 2658 | 2665 | if (s->is_static) |
| 2659 | 2666 | warn("\"%s\" [%s] is a static %s\n", |
| 2660 | 2667 | s->name, s->module->name, |
| 2661 | 2668 | export_str(s->export)); |
| 2662 | − | |
| 2663 | − s = s->next; | |
| 2664 | 2669 | } |
| 2665 | 2670 | } |
| 2666 | 2671 | |
| @@ -65,13 +65,14 @@ · 64 unmodified lines | ||
| 65 | 65 | use warnings; |
| 66 | 66 | use strict; |
| 67 | 67 | use File::Find; |
| 68 | +use File::Spec; | |
| 68 | 69 | |
| 69 | 70 | my $nm = ($ENV{'NM'} || "nm") . " -p"; |
| 70 | 71 | my $objdump = ($ENV{'OBJDUMP'} || "objdump") . " -s -j .comment"; |
| 71 | −my $srctree = ""; | |
| 72 | −my $objtree = ""; | |
| 73 | −$srctree = "$ENV{'srctree'}/" if (exists($ENV{'srctree'})); | |
| 74 | −$objtree = "$ENV{'objtree'}/" if (exists($ENV{'objtree'})); | |
| 72 | +my $srctree = File::Spec->curdir(); | |
| 73 | +my $objtree = File::Spec->curdir(); | |
| 74 | +$srctree = File::Spec->rel2abs($ENV{'srctree'}) if (exists($ENV{'srctree'})); | |
| 75 | +$objtree = File::Spec->rel2abs($ENV{'objtree'}) if (exists($ENV{'objtree'})); | |
| 75 | 76 | |
| 76 | 77 | if ($#ARGV != -1) { |
| 77 | 78 | print STDERR "usage: $0 takes no parameters\n"; |
| @@ -231,9 +232,9 @@ sub do_nm · 153 unmodified lines | ||
| 231 | 232 | } |
| 232 | 233 | ($source = $basename) =~ s/\.o$//; |
| 233 | 234 | if (-e "$source.c" || -e "$source.S") { |
| 234 | − $source = "$objtree$File::Find::dir/$source"; | |
| 235 | + $source = File::Spec->catfile($objtree, $File::Find::dir, $source) | |
| 235 | 236 | } else { |
| 236 | − $source = "$srctree$File::Find::dir/$source"; | |
| 237 | + $source = File::Spec->catfile($srctree, $File::Find::dir, $source) | |
| 237 | 238 | } |
| 238 | 239 | if (! -e "$source.c" && ! -e "$source.S") { |
| 239 | 240 | # No obvious source, exclude the object if it is conglomerate |
| @@ -126,7 +126,7 @@ scm_version() · 125 unmodified lines | ||
| 126 | 126 | |
| 127 | 127 | collect_files() |
| 128 | 128 | { |
| 129 | − local file res | |
| 129 | + local file res= | |
| 130 | 130 | |
| 131 | 131 | for file; do |
| 132 | 132 | case "$file" in |
| @@ -13,9 +13,6 @@ integrity-$(CONFIG_INTEGRITY_PLATFORM_KEYRING) += platform_certs/platform_keyrin · 12 unmodified lines | ||
| 13 | 13 | integrity-$(CONFIG_LOAD_UEFI_KEYS) += platform_certs/efi_parser.o \ |
| 14 | 14 | platform_certs/load_uefi.o |
| 15 | 15 | integrity-$(CONFIG_LOAD_IPL_KEYS) += platform_certs/load_ipl_s390.o |
| 16 | −$(obj)/load_uefi.o: KBUILD_CFLAGS += -fshort-wchar | |
| 17 | 16 | |
| 18 | −subdir-$(CONFIG_IMA) += ima | |
| 19 | 17 | obj-$(CONFIG_IMA) += ima/ |
| 20 | −subdir-$(CONFIG_EVM) += evm | |
| 21 | 18 | obj-$(CONFIG_EVM) += evm/ |
| @@ -22,6 +22,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/smm_test · 21 unmodified lines | ||
| 22 | 22 | TEST_GEN_PROGS_x86_64 += x86_64/state_test |
| 23 | 23 | TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test |
| 24 | 24 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test |
| 25 | +TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test | |
| 25 | 26 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test |
| 26 | 27 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test |
| 27 | 28 | TEST_GEN_PROGS_x86_64 += clear_dirty_log_test |
| @@ -48,7 +49,7 @@ CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ · 20 unmodified lines | ||
| 48 | 49 | -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I.. |
| 49 | 50 | |
| 50 | 51 | no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \ |
| 51 | − $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie) | |
| 52 | + $(CC) -Werror -no-pie -x c - -o "$$TMP", -no-pie) | |
| 52 | 53 | |
| 53 | 54 | # On s390, build the testcases KVM-enabled |
| 54 | 55 | pgste-option = $(call try-run, echo 'int main() { return 0; }' | \ |
| @@ -1083,6 +1083,9 @@ void kvm_get_cpu_address_width(unsigned int *pa_bits, unsigned int *va_bits); · 1082 unmodified lines | ||
| 1083 | 1083 | #define VMX_BASIC_MEM_TYPE_WB 6LLU |
| 1084 | 1084 | #define VMX_BASIC_INOUT 0x0040000000000000LLU |
| 1085 | 1085 | |
| 1086 | +/* VMX_EPT_VPID_CAP bits */ | |
| 1087 | +#define VMX_EPT_VPID_CAP_AD_BITS (1ULL << 21) | |
| 1088 | + | |
| 1086 | 1089 | /* MSR_IA32_VMX_MISC bits */ |
| 1087 | 1090 | #define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29) |
| 1088 | 1091 | #define MSR_IA32_VMX_MISC_PREEMPTION_TIMER_SCALE 0x1F |
| @@ -569,6 +569,10 @@ struct vmx_pages { · 568 unmodified lines | ||
| 569 | 569 | void *enlightened_vmcs_hva; |
| 570 | 570 | uint64_t enlightened_vmcs_gpa; |
| 571 | 571 | void *enlightened_vmcs; |
| 572 | + | |
| 573 | + void *eptp_hva; | |
| 574 | + uint64_t eptp_gpa; | |
| 575 | + void *eptp; | |
| 572 | 576 | }; |
| 573 | 577 | |
| 574 | 578 | struct vmx_pages *vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva); |
| @@ -576,4 +580,14 @@ bool prepare_for_vmx_operation(struct vmx_pages *vmx); · 1 unmodified line | ||
| 576 | 580 | void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp); |
| 577 | 581 | bool load_vmcs(struct vmx_pages *vmx); |
| 578 | 582 | |
| 583 | +void nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 584 | + uint64_t nested_paddr, uint64_t paddr, uint32_t eptp_memslot); | |
| 585 | +void nested_map(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 586 | + uint64_t nested_paddr, uint64_t paddr, uint64_t size, | |
| 587 | + uint32_t eptp_memslot); | |
| 588 | +void nested_map_memslot(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 589 | + uint32_t memslot, uint32_t eptp_memslot); | |
| 590 | +void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 591 | + uint32_t eptp_memslot); | |
| 592 | + | |
| 579 | 593 | #endif /* SELFTEST_KVM_VMX_H */ |
| @@ -705,7 +705,7 @@ void vm_userspace_mem_region_add(struct kvm_vm *vm, · 704 unmodified lines | ||
| 705 | 705 | * on error (e.g. currently no memory region using memslot as a KVM |
| 706 | 706 | * memory slot ID). |
| 707 | 707 | */ |
| 708 | −static struct userspace_mem_region * | |
| 708 | +struct userspace_mem_region * | |
| 709 | 709 | memslot2region(struct kvm_vm *vm, uint32_t memslot) |
| 710 | 710 | { |
| 711 | 711 | struct userspace_mem_region *region; |
| @@ -68,4 +68,7 @@ void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent); · 67 unmodified lines | ||
| 68 | 68 | void regs_dump(FILE *stream, struct kvm_regs *regs, uint8_t indent); |
| 69 | 69 | void sregs_dump(FILE *stream, struct kvm_sregs *sregs, uint8_t indent); |
| 70 | 70 | |
| 71 | +struct userspace_mem_region * | |
| 72 | +memslot2region(struct kvm_vm *vm, uint32_t memslot); | |
| 73 | + | |
| 71 | 74 | #endif /* SELFTEST_KVM_UTIL_INTERNAL_H */ |
| @@ -1085,7 +1085,7 @@ struct kvm_x86_state *vcpu_save_state(struct kvm_vm *vm, uint32_t vcpuid) · 1084 unmodified lines | ||
| 1085 | 1085 | for (i = 0; i < nmsrs; i++) |
| 1086 | 1086 | state->msrs.entries[i].index = list->indices[i]; |
| 1087 | 1087 | r = ioctl(vcpu->fd, KVM_GET_MSRS, &state->msrs); |
| 1088 | − TEST_ASSERT(r == nmsrs, "Unexpected result from KVM_GET_MSRS, r: %i (failed at %x)", | |
| 1088 | + TEST_ASSERT(r == nmsrs, "Unexpected result from KVM_GET_MSRS, r: %i (failed MSR was 0x%x)", | |
| 1089 | 1089 | r, r == nmsrs ? -1 : list->indices[r]); |
| 1090 | 1090 | |
| 1091 | 1091 | r = ioctl(vcpu->fd, KVM_GET_DEBUGREGS, &state->debugregs); |
| @@ -7,11 +7,39 @@ · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | #include "test_util.h" |
| 9 | 9 | #include "kvm_util.h" |
| 10 | +#include "../kvm_util_internal.h" | |
| 10 | 11 | #include "processor.h" |
| 11 | 12 | #include "vmx.h" |
| 12 | 13 | |
| 14 | +#define PAGE_SHIFT_4K 12 | |
| 15 | + | |
| 16 | +#define KVM_EPT_PAGE_TABLE_MIN_PADDR 0x1c0000 | |
| 17 | + | |
| 13 | 18 | bool enable_evmcs; |
| 14 | 19 | |
| 20 | +struct eptPageTableEntry { | |
| 21 | + uint64_t readable:1; | |
| 22 | + uint64_t writable:1; | |
| 23 | + uint64_t executable:1; | |
| 24 | + uint64_t memory_type:3; | |
| 25 | + uint64_t ignore_pat:1; | |
| 26 | + uint64_t page_size:1; | |
| 27 | + uint64_t accessed:1; | |
| 28 | + uint64_t dirty:1; | |
| 29 | + uint64_t ignored_11_10:2; | |
| 30 | + uint64_t address:40; | |
| 31 | + uint64_t ignored_62_52:11; | |
| 32 | + uint64_t suppress_ve:1; | |
| 33 | +}; | |
| 34 | + | |
| 35 | +struct eptPageTablePointer { | |
| 36 | + uint64_t memory_type:3; | |
| 37 | + uint64_t page_walk_length:3; | |
| 38 | + uint64_t ad_enabled:1; | |
| 39 | + uint64_t reserved_11_07:5; | |
| 40 | + uint64_t address:40; | |
| 41 | + uint64_t reserved_63_52:12; | |
| 42 | +}; | |
| 15 | 43 | int vcpu_enable_evmcs(struct kvm_vm *vm, int vcpu_id) |
| 16 | 44 | { |
| 17 | 45 | uint16_t evmcs_ver; |
| @@ -174,15 +202,35 @@ bool load_vmcs(struct vmx_pages *vmx) · 156 unmodified lines | ||
| 174 | 202 | */ |
| 175 | 203 | static inline void init_vmcs_control_fields(struct vmx_pages *vmx) |
| 176 | 204 | { |
| 205 | + uint32_t sec_exec_ctl = 0; | |
| 206 | + | |
| 177 | 207 | vmwrite(VIRTUAL_PROCESSOR_ID, 0); |
| 178 | 208 | vmwrite(POSTED_INTR_NV, 0); |
| 179 | 209 | |
| 180 | 210 | vmwrite(PIN_BASED_VM_EXEC_CONTROL, rdmsr(MSR_IA32_VMX_TRUE_PINBASED_CTLS)); |
| 181 | − if (!vmwrite(SECONDARY_VM_EXEC_CONTROL, 0)) | |
| 211 | + | |
| 212 | + if (vmx->eptp_gpa) { | |
| 213 | + uint64_t ept_paddr; | |
| 214 | + struct eptPageTablePointer eptp = { | |
| 215 | + .memory_type = VMX_BASIC_MEM_TYPE_WB, | |
| 216 | + .page_walk_length = 3, /* + 1 */ | |
| 217 | + .ad_enabled = !!(rdmsr(MSR_IA32_VMX_EPT_VPID_CAP) & VMX_EPT_VPID_CAP_AD_BITS), | |
| 218 | + .address = vmx->eptp_gpa >> PAGE_SHIFT_4K, | |
| 219 | + }; | |
| 220 | + | |
| 221 | + memcpy(&ept_paddr, &eptp, sizeof(ept_paddr)); | |
| 222 | + vmwrite(EPT_POINTER, ept_paddr); | |
| 223 | + sec_exec_ctl |= SECONDARY_EXEC_ENABLE_EPT; | |
| 224 | + } | |
| 225 | + | |
| 226 | + if (!vmwrite(SECONDARY_VM_EXEC_CONTROL, sec_exec_ctl)) | |
| 182 | 227 | vmwrite(CPU_BASED_VM_EXEC_CONTROL, |
| 183 | 228 | rdmsr(MSR_IA32_VMX_TRUE_PROCBASED_CTLS) | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS); |
| 184 | − else | |
| 229 | + else { | |
| 185 | 230 | vmwrite(CPU_BASED_VM_EXEC_CONTROL, rdmsr(MSR_IA32_VMX_TRUE_PROCBASED_CTLS)); |
| 231 | + GUEST_ASSERT(!sec_exec_ctl); | |
| 232 | + } | |
| 233 | + | |
| 186 | 234 | vmwrite(EXCEPTION_BITMAP, 0); |
| 187 | 235 | vmwrite(PAGE_FAULT_ERROR_CODE_MASK, 0); |
| 188 | 236 | vmwrite(PAGE_FAULT_ERROR_CODE_MATCH, -1); /* Never match */ |
| @@ -327,3 +375,152 @@ void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp) · 138 unmodified lines | ||
| 327 | 375 | init_vmcs_host_state(); |
| 328 | 376 | init_vmcs_guest_state(guest_rip, guest_rsp); |
| 329 | 377 | } |
| 378 | + | |
| 379 | +void nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 380 | + uint64_t nested_paddr, uint64_t paddr, uint32_t eptp_memslot) | |
| 381 | +{ | |
| 382 | + uint16_t index[4]; | |
| 383 | + struct eptPageTableEntry *pml4e; | |
| 384 | + | |
| 385 | + TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Attempt to use " | |
| 386 | + "unknown or unsupported guest mode, mode: 0x%x", vm->mode); | |
| 387 | + | |
| 388 | + TEST_ASSERT((nested_paddr % vm->page_size) == 0, | |
| 389 | + "Nested physical address not on page boundary,\n" | |
| 390 | + " nested_paddr: 0x%lx vm->page_size: 0x%x", | |
| 391 | + nested_paddr, vm->page_size); | |
| 392 | + TEST_ASSERT((nested_paddr >> vm->page_shift) <= vm->max_gfn, | |
| 393 | + "Physical address beyond beyond maximum supported,\n" | |
| 394 | + " nested_paddr: 0x%lx vm->max_gfn: 0x%lx vm->page_size: 0x%x", | |
| 395 | + paddr, vm->max_gfn, vm->page_size); | |
| 396 | + TEST_ASSERT((paddr % vm->page_size) == 0, | |
| 397 | + "Physical address not on page boundary,\n" | |
| 398 | + " paddr: 0x%lx vm->page_size: 0x%x", | |
| 399 | + paddr, vm->page_size); | |
| 400 | + TEST_ASSERT((paddr >> vm->page_shift) <= vm->max_gfn, | |
| 401 | + "Physical address beyond beyond maximum supported,\n" | |
| 402 | + " paddr: 0x%lx vm->max_gfn: 0x%lx vm->page_size: 0x%x", | |
| 403 | + paddr, vm->max_gfn, vm->page_size); | |
| 404 | + | |
| 405 | + index[0] = (nested_paddr >> 12) & 0x1ffu; | |
| 406 | + index[1] = (nested_paddr >> 21) & 0x1ffu; | |
| 407 | + index[2] = (nested_paddr >> 30) & 0x1ffu; | |
| 408 | + index[3] = (nested_paddr >> 39) & 0x1ffu; | |
| 409 | + | |
| 410 | + /* Allocate page directory pointer table if not present. */ | |
| 411 | + pml4e = vmx->eptp_hva; | |
| 412 | + if (!pml4e[index[3]].readable) { | |
| 413 | + pml4e[index[3]].address = vm_phy_page_alloc(vm, | |
| 414 | + KVM_EPT_PAGE_TABLE_MIN_PADDR, eptp_memslot) | |
| 415 | + >> vm->page_shift; | |
| 416 | + pml4e[index[3]].writable = true; | |
| 417 | + pml4e[index[3]].readable = true; | |
| 418 | + pml4e[index[3]].executable = true; | |
| 419 | + } | |
| 420 | + | |
| 421 | + /* Allocate page directory table if not present. */ | |
| 422 | + struct eptPageTableEntry *pdpe; | |
| 423 | + pdpe = addr_gpa2hva(vm, pml4e[index[3]].address * vm->page_size); | |
| 424 | + if (!pdpe[index[2]].readable) { | |
| 425 | + pdpe[index[2]].address = vm_phy_page_alloc(vm, | |
| 426 | + KVM_EPT_PAGE_TABLE_MIN_PADDR, eptp_memslot) | |
| 427 | + >> vm->page_shift; | |
| 428 | + pdpe[index[2]].writable = true; | |
| 429 | + pdpe[index[2]].readable = true; | |
| 430 | + pdpe[index[2]].executable = true; | |
| 431 | + } | |
| 432 | + | |
| 433 | + /* Allocate page table if not present. */ | |
| 434 | + struct eptPageTableEntry *pde; | |
| 435 | + pde = addr_gpa2hva(vm, pdpe[index[2]].address * vm->page_size); | |
| 436 | + if (!pde[index[1]].readable) { | |
| 437 | + pde[index[1]].address = vm_phy_page_alloc(vm, | |
| 438 | + KVM_EPT_PAGE_TABLE_MIN_PADDR, eptp_memslot) | |
| 439 | + >> vm->page_shift; | |
| 440 | + pde[index[1]].writable = true; | |
| 441 | + pde[index[1]].readable = true; | |
| 442 | + pde[index[1]].executable = true; | |
| 443 | + } | |
| 444 | + | |
| 445 | + /* Fill in page table entry. */ | |
| 446 | + struct eptPageTableEntry *pte; | |
| 447 | + pte = addr_gpa2hva(vm, pde[index[1]].address * vm->page_size); | |
| 448 | + pte[index[0]].address = paddr >> vm->page_shift; | |
| 449 | + pte[index[0]].writable = true; | |
| 450 | + pte[index[0]].readable = true; | |
| 451 | + pte[index[0]].executable = true; | |
| 452 | + | |
| 453 | + /* | |
| 454 | + * For now mark these as accessed and dirty because the only | |
| 455 | + * testcase we have needs that. Can be reconsidered later. | |
| 456 | + */ | |
| 457 | + pte[index[0]].accessed = true; | |
| 458 | + pte[index[0]].dirty = true; | |
| 459 | +} | |
| 460 | + | |
| 461 | +/* | |
| 462 | + * Map a range of EPT guest physical addresses to the VM's physical address | |
| 463 | + * | |
| 464 | + * Input Args: | |
| 465 | + * vm - Virtual Machine | |
| 466 | + * nested_paddr - Nested guest physical address to map | |
| 467 | + * paddr - VM Physical Address | |
| 468 | + * size - The size of the range to map | |
| 469 | + * eptp_memslot - Memory region slot for new virtual translation tables | |
| 470 | + * | |
| 471 | + * Output Args: None | |
| 472 | + * | |
| 473 | + * Return: None | |
| 474 | + * | |
| 475 | + * Within the VM given by vm, creates a nested guest translation for the | |
| 476 | + * page range starting at nested_paddr to the page range starting at paddr. | |
| 477 | + */ | |
| 478 | +void nested_map(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 479 | + uint64_t nested_paddr, uint64_t paddr, uint64_t size, | |
| 480 | + uint32_t eptp_memslot) | |
| 481 | +{ | |
| 482 | + size_t page_size = vm->page_size; | |
| 483 | + size_t npages = size / page_size; | |
| 484 | + | |
| 485 | + TEST_ASSERT(nested_paddr + size > nested_paddr, "Vaddr overflow"); | |
| 486 | + TEST_ASSERT(paddr + size > paddr, "Paddr overflow"); | |
| 487 | + | |
| 488 | + while (npages--) { | |
| 489 | + nested_pg_map(vmx, vm, nested_paddr, paddr, eptp_memslot); | |
| 490 | + nested_paddr += page_size; | |
| 491 | + paddr += page_size; | |
| 492 | + } | |
| 493 | +} | |
| 494 | + | |
| 495 | +/* Prepare an identity extended page table that maps all the | |
| 496 | + * physical pages in VM. | |
| 497 | + */ | |
| 498 | +void nested_map_memslot(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 499 | + uint32_t memslot, uint32_t eptp_memslot) | |
| 500 | +{ | |
| 501 | + sparsebit_idx_t i, last; | |
| 502 | + struct userspace_mem_region *region = | |
| 503 | + memslot2region(vm, memslot); | |
| 504 | + | |
| 505 | + i = (region->region.guest_phys_addr >> vm->page_shift) - 1; | |
| 506 | + last = i + (region->region.memory_size >> vm->page_shift); | |
| 507 | + for (;;) { | |
| 508 | + i = sparsebit_next_clear(region->unused_phy_pages, i); | |
| 509 | + if (i > last) | |
| 510 | + break; | |
| 511 | + | |
| 512 | + nested_map(vmx, vm, | |
| 513 | + (uint64_t)i << vm->page_shift, | |
| 514 | + (uint64_t)i << vm->page_shift, | |
| 515 | + 1 << vm->page_shift, | |
| 516 | + eptp_memslot); | |
| 517 | + } | |
| 518 | +} | |
| 519 | + | |
| 520 | +void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm, | |
| 521 | + uint32_t eptp_memslot) | |
| 522 | +{ | |
| 523 | + vmx->eptp = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); | |
| 524 | + vmx->eptp_hva = addr_gva2hva(vm, (uintptr_t)vmx->eptp); | |
| 525 | + vmx->eptp_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->eptp); | |
| 526 | +} | |
| @@ -0,0 +1,156 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +/* | |
| 3 | + * KVM dirty page logging test | |
| 4 | + * | |
| 5 | + * Copyright (C) 2018, Red Hat, Inc. | |
| 6 | + */ | |
| 7 | + | |
| 8 | +#define _GNU_SOURCE /* for program_invocation_name */ | |
| 9 | + | |
| 10 | +#include <stdio.h> | |
| 11 | +#include <stdlib.h> | |
| 12 | +#include <linux/bitmap.h> | |
| 13 | +#include <linux/bitops.h> | |
| 14 | + | |
| 15 | +#include "test_util.h" | |
| 16 | +#include "kvm_util.h" | |
| 17 | +#include "processor.h" | |
| 18 | +#include "vmx.h" | |
| 19 | + | |
| 20 | +#define VCPU_ID 1 | |
| 21 | + | |
| 22 | +/* The memory slot index to track dirty pages */ | |
| 23 | +#define TEST_MEM_SLOT_INDEX 1 | |
| 24 | +#define TEST_MEM_SIZE 3 | |
| 25 | + | |
| 26 | +/* L1 guest test virtual memory offset */ | |
| 27 | +#define GUEST_TEST_MEM 0xc0000000 | |
| 28 | + | |
| 29 | +/* L2 guest test virtual memory offset */ | |
| 30 | +#define NESTED_TEST_MEM1 0xc0001000 | |
| 31 | +#define NESTED_TEST_MEM2 0xc0002000 | |
| 32 | + | |
| 33 | +static void l2_guest_code(void) | |
| 34 | +{ | |
| 35 | + *(volatile uint64_t *)NESTED_TEST_MEM1; | |
| 36 | + *(volatile uint64_t *)NESTED_TEST_MEM1 = 1; | |
| 37 | + GUEST_SYNC(true); | |
| 38 | + GUEST_SYNC(false); | |
| 39 | + | |
| 40 | + *(volatile uint64_t *)NESTED_TEST_MEM2 = 1; | |
| 41 | + GUEST_SYNC(true); | |
| 42 | + *(volatile uint64_t *)NESTED_TEST_MEM2 = 1; | |
| 43 | + GUEST_SYNC(true); | |
| 44 | + GUEST_SYNC(false); | |
| 45 | + | |
| 46 | + /* Exit to L1 and never come back. */ | |
| 47 | + vmcall(); | |
| 48 | +} | |
| 49 | + | |
| 50 | +void l1_guest_code(struct vmx_pages *vmx) | |
| 51 | +{ | |
| 52 | +#define L2_GUEST_STACK_SIZE 64 | |
| 53 | + unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE]; | |
| 54 | + | |
| 55 | + GUEST_ASSERT(vmx->vmcs_gpa); | |
| 56 | + GUEST_ASSERT(prepare_for_vmx_operation(vmx)); | |
| 57 | + GUEST_ASSERT(load_vmcs(vmx)); | |
| 58 | + | |
| 59 | + prepare_vmcs(vmx, l2_guest_code, | |
| 60 | + &l2_guest_stack[L2_GUEST_STACK_SIZE]); | |
| 61 | + | |
| 62 | + GUEST_SYNC(false); | |
| 63 | + GUEST_ASSERT(!vmlaunch()); | |
| 64 | + GUEST_SYNC(false); | |
| 65 | + GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL); | |
| 66 | + GUEST_DONE(); | |
| 67 | +} | |
| 68 | + | |
| 69 | +int main(int argc, char *argv[]) | |
| 70 | +{ | |
| 71 | + vm_vaddr_t vmx_pages_gva = 0; | |
| 72 | + struct vmx_pages *vmx; | |
| 73 | + unsigned long *bmap; | |
| 74 | + uint64_t *host_test_mem; | |
| 75 | + | |
| 76 | + struct kvm_vm *vm; | |
| 77 | + struct kvm_run *run; | |
| 78 | + struct ucall uc; | |
| 79 | + bool done = false; | |
| 80 | + | |
| 81 | + /* Create VM */ | |
| 82 | + vm = vm_create_default(VCPU_ID, 0, l1_guest_code); | |
| 83 | + vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid()); | |
| 84 | + vmx = vcpu_alloc_vmx(vm, &vmx_pages_gva); | |
| 85 | + vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_gva); | |
| 86 | + run = vcpu_state(vm, VCPU_ID); | |
| 87 | + | |
| 88 | + /* Add an extra memory slot for testing dirty logging */ | |
| 89 | + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, | |
| 90 | + GUEST_TEST_MEM, | |
| 91 | + TEST_MEM_SLOT_INDEX, | |
| 92 | + TEST_MEM_SIZE, | |
| 93 | + KVM_MEM_LOG_DIRTY_PAGES); | |
| 94 | + | |
| 95 | + /* | |
| 96 | + * Add an identity map for GVA range [0xc0000000, 0xc0002000). This | |
| 97 | + * affects both L1 and L2. However... | |
| 98 | + */ | |
| 99 | + virt_map(vm, GUEST_TEST_MEM, GUEST_TEST_MEM, | |
| 100 | + TEST_MEM_SIZE * 4096, 0); | |
| 101 | + | |
| 102 | + /* | |
| 103 | + * ... pages in the L2 GPA range [0xc0001000, 0xc0003000) will map to | |
| 104 | + * 0xc0000000. | |
| 105 | + * | |
| 106 | + * Note that prepare_eptp should be called only L1's GPA map is done, | |
| 107 | + * meaning after the last call to virt_map. | |
| 108 | + */ | |
| 109 | + prepare_eptp(vmx, vm, 0); | |
| 110 | + nested_map_memslot(vmx, vm, 0, 0); | |
| 111 | + nested_map(vmx, vm, NESTED_TEST_MEM1, GUEST_TEST_MEM, 4096, 0); | |
| 112 | + nested_map(vmx, vm, NESTED_TEST_MEM2, GUEST_TEST_MEM, 4096, 0); | |
| 113 | + | |
| 114 | + bmap = bitmap_alloc(TEST_MEM_SIZE); | |
| 115 | + host_test_mem = addr_gpa2hva(vm, GUEST_TEST_MEM); | |
| 116 | + | |
| 117 | + while (!done) { | |
| 118 | + memset(host_test_mem, 0xaa, TEST_MEM_SIZE * 4096); | |
| 119 | + _vcpu_run(vm, VCPU_ID); | |
| 120 | + TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, | |
| 121 | + "Unexpected exit reason: %u (%s),\n", | |
| 122 | + run->exit_reason, | |
| 123 | + exit_reason_str(run->exit_reason)); | |
| 124 | + | |
| 125 | + switch (get_ucall(vm, VCPU_ID, &uc)) { | |
| 126 | + case UCALL_ABORT: | |
| 127 | + TEST_ASSERT(false, "%s at %s:%d", (const char *)uc.args[0], | |
| 128 | + __FILE__, uc.args[1]); | |
| 129 | + /* NOT REACHED */ | |
| 130 | + case UCALL_SYNC: | |
| 131 | + /* | |
| 132 | + * The nested guest wrote at offset 0x1000 in the memslot, but the | |
| 133 | + * dirty bitmap must be filled in according to L1 GPA, not L2. | |
| 134 | + */ | |
| 135 | + kvm_vm_get_dirty_log(vm, TEST_MEM_SLOT_INDEX, bmap); | |
| 136 | + if (uc.args[1]) { | |
| 137 | + TEST_ASSERT(test_bit(0, bmap), "Page 0 incorrectly reported clean\n"); | |
| 138 | + TEST_ASSERT(host_test_mem[0] == 1, "Page 0 not written by guest\n"); | |
| 139 | + } else { | |
| 140 | + TEST_ASSERT(!test_bit(0, bmap), "Page 0 incorrectly reported dirty\n"); | |
| 141 | + TEST_ASSERT(host_test_mem[0] == 0xaaaaaaaaaaaaaaaaULL, "Page 0 written by guest\n"); | |
| 142 | + } | |
| 143 | + | |
| 144 | + TEST_ASSERT(!test_bit(1, bmap), "Page 1 incorrectly reported dirty\n"); | |
| 145 | + TEST_ASSERT(host_test_mem[4096 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 1 written by guest\n"); | |
| 146 | + TEST_ASSERT(!test_bit(2, bmap), "Page 2 incorrectly reported dirty\n"); | |
| 147 | + TEST_ASSERT(host_test_mem[8192 / 8] == 0xaaaaaaaaaaaaaaaaULL, "Page 2 written by guest\n"); | |
| 148 | + break; | |
| 149 | + case UCALL_DONE: | |
| 150 | + done = true; | |
| 151 | + break; | |
| 152 | + default: | |
| 153 | + TEST_ASSERT(false, "Unknown ucall 0x%x.", uc.cmd); | |
| 154 | + } | |
| 155 | + } | |
| 156 | +} | |
| @@ -21,3 +21,4 @@ ipv6_flowlabel · 20 unmodified lines | ||
| 21 | 21 | ipv6_flowlabel_mgr |
| 22 | 22 | so_txtime |
| 23 | 23 | tcp_fastopen_backup_key |
| 24 | +nettest | |
| @@ -89,12 +89,9 @@ struct testcase testcases_v4[] = { · 88 unmodified lines | ||
| 89 | 89 | .tfail = true, |
| 90 | 90 | }, |
| 91 | 91 | { |
| 92 | − /* send a single MSS: will fail with GSO, because the segment | |
| 93 | − * logic in udp4_ufo_fragment demands a gso skb to be > MTU | |
| 94 | − */ | |
| 92 | + /* send a single MSS: will fall back to no GSO */ | |
| 95 | 93 | .tlen = CONST_MSS_V4, |
| 96 | 94 | .gso_len = CONST_MSS_V4, |
| 97 | − .tfail = true, | |
| 98 | 95 | .r_num_mss = 1, |
| 99 | 96 | }, |
| 100 | 97 | { |
| @@ -139,10 +136,9 @@ struct testcase testcases_v4[] = { · 38 unmodified lines | ||
| 139 | 136 | .tfail = true, |
| 140 | 137 | }, |
| 141 | 138 | { |
| 142 | − /* send a single 1B MSS: will fail, see single MSS above */ | |
| 139 | + /* send a single 1B MSS: will fall back to no GSO */ | |
| 143 | 140 | .tlen = 1, |
| 144 | 141 | .gso_len = 1, |
| 145 | − .tfail = true, | |
| 146 | 142 | .r_num_mss = 1, |
| 147 | 143 | }, |
| 148 | 144 | { |
| @@ -196,12 +192,9 @@ struct testcase testcases_v6[] = { · 47 unmodified lines | ||
| 196 | 192 | .tfail = true, |
| 197 | 193 | }, |
| 198 | 194 | { |
| 199 | − /* send a single MSS: will fail with GSO, because the segment | |
| 200 | − * logic in udp4_ufo_fragment demands a gso skb to be > MTU | |
| 201 | − */ | |
| 195 | + /* send a single MSS: will fall back to no GSO */ | |
| 202 | 196 | .tlen = CONST_MSS_V6, |
| 203 | 197 | .gso_len = CONST_MSS_V6, |
| 204 | − .tfail = true, | |
| 205 | 198 | .r_num_mss = 1, |
| 206 | 199 | }, |
| 207 | 200 | { |
| @@ -246,10 +239,9 @@ struct testcase testcases_v6[] = { · 38 unmodified lines | ||
| 246 | 239 | .tfail = true, |
| 247 | 240 | }, |
| 248 | 241 | { |
| 249 | − /* send a single 1B MSS: will fail, see single MSS above */ | |
| 242 | + /* send a single 1B MSS: will fall back to no GSO */ | |
| 250 | 243 | .tlen = 1, |
| 251 | 244 | .gso_len = 1, |
| 252 | − .tfail = true, | |
| 253 | 245 | .r_num_mss = 1, |
| 254 | 246 | }, |
| 255 | 247 | { |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | −CFLAGS += -g -I../../../../usr/include/ -lpthread | |
| 2 | +CFLAGS += -g -I../../../../usr/include/ -pthread | |
| 3 | 3 | |
| 4 | 4 | TEST_GEN_PROGS := pidfd_test pidfd_open_test pidfd_poll_test pidfd_wait |
| 5 | 5 | |
| @@ -29,13 +29,11 @@ header-test- += linux/android/binderfs.h · 28 unmodified lines | ||
| 29 | 29 | header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h |
| 30 | 30 | header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h |
| 31 | 31 | header-test- += linux/coda.h |
| 32 | −header-test- += linux/coda_psdev.h | |
| 33 | 32 | header-test- += linux/elfcore.h |
| 34 | 33 | header-test- += linux/errqueue.h |
| 35 | 34 | header-test- += linux/fsmap.h |
| 36 | 35 | header-test- += linux/hdlc/ioctl.h |
| 37 | 36 | header-test- += linux/ivtv.h |
| 38 | −header-test- += linux/jffs2.h | |
| 39 | 37 | header-test- += linux/kexec.h |
| 40 | 38 | header-test- += linux/matroxfb.h |
| 41 | 39 | header-test- += linux/netfilter_ipv4/ipt_LOG.h |
| @@ -55,20 +53,12 @@ header-test- += linux/v4l2-mediabus.h · 13 unmodified lines | ||
| 55 | 53 | header-test- += linux/v4l2-subdev.h |
| 56 | 54 | header-test- += linux/videodev2.h |
| 57 | 55 | header-test- += linux/vm_sockets.h |
| 58 | −header-test- += scsi/scsi_bsg_fc.h | |
| 59 | −header-test- += scsi/scsi_netlink.h | |
| 60 | −header-test- += scsi/scsi_netlink_fc.h | |
| 61 | 56 | header-test- += sound/asequencer.h |
| 62 | 57 | header-test- += sound/asoc.h |
| 63 | 58 | header-test- += sound/asound.h |
| 64 | 59 | header-test- += sound/compress_offload.h |
| 65 | 60 | header-test- += sound/emu10k1.h |
| 66 | 61 | header-test- += sound/sfnt_info.h |
| 67 | −header-test- += sound/sof/eq.h | |
| 68 | −header-test- += sound/sof/fw.h | |
| 69 | −header-test- += sound/sof/header.h | |
| 70 | −header-test- += sound/sof/manifest.h | |
| 71 | −header-test- += sound/sof/trace.h | |
| 72 | 62 | header-test- += xen/evtchn.h |
| 73 | 63 | header-test- += xen/gntdev.h |
| 74 | 64 | header-test- += xen/privcmd.h |
| @@ -30,7 +30,7 @@ TRACE_EVENT(vgic_update_irq_pending, · 29 unmodified lines | ||
| 30 | 30 | #endif /* _TRACE_VGIC_H */ |
| 31 | 31 | |
| 32 | 32 | #undef TRACE_INCLUDE_PATH |
| 33 | −#define TRACE_INCLUDE_PATH ../../../virt/kvm/arm/vgic | |
| 33 | +#define TRACE_INCLUDE_PATH ../../virt/kvm/arm/vgic | |
| 34 | 34 | #undef TRACE_INCLUDE_FILE |
| 35 | 35 | #define TRACE_INCLUDE_FILE trace |
| 36 | 36 | |
| @@ -617,8 +617,9 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) · 616 unmodified lines | ||
| 617 | 617 | |
| 618 | 618 | stat_data->kvm = kvm; |
| 619 | 619 | stat_data->offset = p->offset; |
| 620 | + stat_data->mode = p->mode ? p->mode : 0644; | |
| 620 | 621 | kvm->debugfs_stat_data[p - debugfs_entries] = stat_data; |
| 621 | − debugfs_create_file(p->name, 0644, kvm->debugfs_dentry, | |
| 622 | + debugfs_create_file(p->name, stat_data->mode, kvm->debugfs_dentry, | |
| 622 | 623 | stat_data, stat_fops_per_vm[p->kind]); |
| 623 | 624 | } |
| 624 | 625 | return 0; |
| @@ -3929,7 +3930,9 @@ static int kvm_debugfs_open(struct inode *inode, struct file *file, · 3304 unmodified lines | ||
| 3929 | 3930 | if (!refcount_inc_not_zero(&stat_data->kvm->users_count)) |
| 3930 | 3931 | return -ENOENT; |
| 3931 | 3932 | |
| 3932 | − if (simple_attr_open(inode, file, get, set, fmt)) { | |
| 3933 | + if (simple_attr_open(inode, file, get, | |
| 3934 | + stat_data->mode & S_IWUGO ? set : NULL, | |
| 3935 | + fmt)) { | |
| 3933 | 3936 | kvm_put_kvm(stat_data->kvm); |
| 3934 | 3937 | return -ENOMEM; |
| 3935 | 3938 | } |
| @@ -4177,7 +4180,8 @@ static void kvm_init_debug(void) · 241 unmodified lines | ||
| 4177 | 4180 | |
| 4178 | 4181 | kvm_debugfs_num_entries = 0; |
| 4179 | 4182 | for (p = debugfs_entries; p->name; ++p, kvm_debugfs_num_entries++) { |
| 4180 | − debugfs_create_file(p->name, 0644, kvm_debugfs_dir, | |
| 4183 | + int mode = p->mode ? p->mode : 0644; | |
| 4184 | + debugfs_create_file(p->name, mode, kvm_debugfs_dir, | |
| 4181 | 4185 | (void *)(long)p->offset, |
| 4182 | 4186 | stat_fops[p->kind]); |
| 4183 | 4187 | } |