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

Merge branch 'master' into i2c/for-mergewindow

+3420 -3082
+1
.mailmap
··· 315 315 Mythri P K <mythripk@ti.com> 316 316 Nadia Yvette Chambers <nyc@holomorphy.com> William Lee Irwin III <wli@holomorphy.com> 317 317 Nathan Chancellor <nathan@kernel.org> <natechancellor@gmail.com> 318 + Neil Armstrong <neil.armstrong@linaro.org> <narmstrong@baylibre.com> 318 319 Nguyen Anh Quynh <aquynh@gmail.com> 319 320 Nicholas Piggin <npiggin@gmail.com> <npiggen@suse.de> 320 321 Nicholas Piggin <npiggin@gmail.com> <npiggin@kernel.dk>
+1 -1
Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml
··· 8 8 title: Amlogic Meson Firmware registers Interface 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The Meson SoCs have a register bank with status and data shared with the
+1 -1
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml
··· 8 8 title: Amlogic specific extensions to the Synopsys Designware HDMI Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 allOf: 14 14 - $ref: /schemas/sound/name-prefix.yaml#
+1 -1
Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml
··· 8 8 title: Amlogic Meson Display Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The Amlogic Meson Display controller is composed of several components
+1 -1
Documentation/devicetree/bindings/display/bridge/analogix,anx7814.yaml
··· 8 8 9 9 maintainers: 10 10 - Andrzej Hajda <andrzej.hajda@intel.com> 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 - Robert Foss <robert.foss@linaro.org> 13 13 14 14 properties:
+1 -1
Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
··· 8 8 9 9 maintainers: 10 10 - Phong LE <ple@baylibre.com> 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The IT66121 is a high-performance and low-power single channel HDMI
+1 -1
Documentation/devicetree/bindings/display/panel/sgd,gktw70sdae4se.yaml
··· 7 7 title: Solomon Goldentek Display GKTW70SDAE4SE 7" WVGA LVDS Display Panel 8 8 9 9 maintainers: 10 - - Neil Armstrong <narmstrong@baylibre.com> 10 + - Neil Armstrong <neil.armstrong@linaro.org> 11 11 - Thierry Reding <thierry.reding@gmail.com> 12 12 13 13 allOf:
+2 -2
Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt
··· 34 34 Use specific request line passing from dma 35 35 For example, MMC request line is 5 36 36 37 - sdhci: sdhci@98e00000 { 38 - compatible = "moxa,moxart-sdhci"; 37 + mmc: mmc@98e00000 { 38 + compatible = "moxa,moxart-mmc"; 39 39 reg = <0x98e00000 0x5C>; 40 40 interrupts = <5 0>; 41 41 clocks = <&clk_apb>;
+1 -1
Documentation/devicetree/bindings/i2c/amlogic,meson6-i2c.yaml
··· 8 8 title: Amlogic Meson I2C Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 - Beniamino Galvani <b.galvani@gmail.com> 13 13 14 14 allOf:
+1 -1
Documentation/devicetree/bindings/interconnect/fsl,imx8m-noc.yaml
··· 7 7 title: Generic i.MX bus frequency device 8 8 9 9 maintainers: 10 - - Leonard Crestez <leonard.crestez@nxp.com> 10 + - Peng Fan <peng.fan@nxp.com> 11 11 12 12 description: | 13 13 The i.MX SoC family has multiple buses for which clock frequency (and
+1 -1
Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
··· 96 96 Documentation/devicetree/bindings/arm/cpus.yaml). 97 97 98 98 required: 99 - - fiq-index 99 + - apple,fiq-index 100 100 - cpus 101 101 102 102 required:
+1 -1
Documentation/devicetree/bindings/mailbox/amlogic,meson-gxbb-mhu.yaml
··· 8 8 title: Amlogic Meson Message-Handling-Unit Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The Amlogic's Meson SoCs Message-Handling-Unit (MHU) is a mailbox controller
+1 -1
Documentation/devicetree/bindings/media/amlogic,axg-ge2d.yaml
··· 8 8 title: Amlogic GE2D Acceleration Unit 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 properties: 14 14 compatible:
+1 -1
Documentation/devicetree/bindings/media/amlogic,gx-vdec.yaml
··· 8 8 title: Amlogic Video Decoder 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 - Maxime Jourdan <mjourdan@baylibre.com> 13 13 14 14 description: |
+1 -1
Documentation/devicetree/bindings/media/amlogic,meson-gx-ao-cec.yaml
··· 8 8 title: Amlogic Meson AO-CEC Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The Amlogic Meson AO-CEC module is present is Amlogic SoCs and its purpose is
+1 -1
Documentation/devicetree/bindings/memory-controllers/fsl/imx8m-ddrc.yaml
··· 7 7 title: i.MX8M DDR Controller 8 8 9 9 maintainers: 10 - - Leonard Crestez <leonard.crestez@nxp.com> 10 + - Peng Fan <peng.fan@nxp.com> 11 11 12 12 description: 13 13 The DDRC block is integrated in i.MX8M for interfacing with DDR based
+1 -1
Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
··· 7 7 title: Khadas on-board Microcontroller Device Tree Bindings 8 8 9 9 maintainers: 10 - - Neil Armstrong <narmstrong@baylibre.com> 10 + - Neil Armstrong <neil.armstrong@linaro.org> 11 11 12 12 description: | 13 13 Khadas embeds a microcontroller on their VIM and Edge boards adding some
+1 -1
Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml
··· 8 8 title: Amlogic Meson DWMAC Ethernet controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 - Martin Blumenstingl <martin.blumenstingl@googlemail.com> 13 13 14 14 # We need a select here so we don't match all nodes with 'snps,dwmac'
+1
Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml
··· 40 40 patternProperties: 41 41 '^opp-?[0-9]+$': 42 42 type: object 43 + additionalProperties: false 43 44 44 45 properties: 45 46 opp-hz: true
+1
Documentation/devicetree/bindings/opp/opp-v2-qcom-level.yaml
··· 19 19 patternProperties: 20 20 '^opp-?[0-9]+$': 21 21 type: object 22 + additionalProperties: false 22 23 23 24 properties: 24 25 opp-level: true
+1 -1
Documentation/devicetree/bindings/phy/amlogic,axg-mipi-dphy.yaml
··· 8 8 title: Amlogic AXG MIPI D-PHY 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 properties: 14 14 compatible:
+1 -1
Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb2-phy.yaml
··· 8 8 title: Amlogic G12A USB2 PHY 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 properties: 14 14 compatible:
+1 -1
Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml
··· 8 8 title: Amlogic G12A USB3 + PCIE Combo PHY 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 properties: 14 14 compatible:
-1
Documentation/devicetree/bindings/pinctrl/qcom,sc7280-lpass-lpi-pinctrl.yaml
··· 8 8 Low Power Island (LPI) TLMM block 9 9 10 10 maintainers: 11 - - Srinivasa Rao Mandadapu <srivasam@codeaurora.org> 12 11 - Srinivas Kandagatla <srinivas.kandagatla@linaro.org> 13 12 14 13 description: |
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,sc7280-pinctrl.yaml
··· 7 7 title: Qualcomm Technologies, Inc. SC7280 TLMM block 8 8 9 9 maintainers: 10 - - Rajendra Nayak <rnayak@codeaurora.org> 10 + - Bjorn Andersson <andersson@kernel.org> 11 11 12 12 description: | 13 13 This binding describes the Top Level Mode Multiplexer block found in the
+1 -1
Documentation/devicetree/bindings/power/amlogic,meson-ee-pwrc.yaml
··· 8 8 title: Amlogic Meson Everything-Else Power Domains 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: |+ 14 14 The Everything-Else Power Domains node should be the child of a syscon
+1 -1
Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
··· 7 7 title: Qualcomm RPM/RPMh Power domains 8 8 9 9 maintainers: 10 - - Rajendra Nayak <rnayak@codeaurora.org> 10 + - Bjorn Andersson <andersson@kernel.org> 11 11 12 12 description: 13 13 For RPM/RPMh Power domains, we communicate a performance state to RPM/RPMh
+1 -1
Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml
··· 8 8 title: Amlogic Meson SoC Reset Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 properties: 14 14 compatible:
+1 -1
Documentation/devicetree/bindings/rng/amlogic,meson-rng.yaml
··· 8 8 title: Amlogic Meson Random number generator 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 properties: 14 14 compatible:
+1 -1
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
··· 8 8 title: Amlogic Meson SoC UART Serial Interface 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The Amlogic Meson SoC UART Serial Interface is present on a large range
+1 -1
Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.yaml
··· 8 8 title: Amlogic Canvas Video Lookup Table 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 - Maxime Jourdan <mjourdan@baylibre.com> 13 13 14 14 description: |
+1 -1
Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
··· 8 8 title: Amlogic Meson SPI Communication Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 allOf: 14 14 - $ref: "spi-controller.yaml#"
+1 -1
Documentation/devicetree/bindings/spi/amlogic,meson6-spifc.yaml
··· 8 8 title: Amlogic Meson SPI Flash Controller 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 allOf: 14 14 - $ref: "spi-controller.yaml#"
+1 -1
Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
··· 8 8 title: Amlogic Meson G12A DWC3 USB SoC Controller Glue 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 description: | 14 14 The Amlogic G12A embeds a DWC3 USB IP Core configured for USB2 and USB3
+1 -1
Documentation/devicetree/bindings/watchdog/amlogic,meson-gxbb-wdt.yaml
··· 8 8 title: Meson GXBB SoCs Watchdog timer 9 9 10 10 maintainers: 11 - - Neil Armstrong <narmstrong@baylibre.com> 11 + - Neil Armstrong <neil.armstrong@linaro.org> 12 12 13 13 allOf: 14 14 - $ref: watchdog.yaml#
+1 -1
Documentation/i2c/dev-interface.rst
··· 148 148 You do not need to pass the address byte; instead, set it through 149 149 ioctl I2C_SLAVE before you try to access the device. 150 150 151 - You can do SMBus level transactions (see documentation file smbus-protocol 151 + You can do SMBus level transactions (see documentation file smbus-protocol.rst 152 152 for details) through the following functions:: 153 153 154 154 __s32 i2c_smbus_write_quick(int file, __u8 value);
+3 -3
Documentation/i2c/slave-interface.rst
··· 32 32 =========== 33 33 34 34 I2C slave backends behave like standard I2C clients. So, you can instantiate 35 - them as described in the document 'instantiating-devices'. The only difference 36 - is that i2c slave backends have their own address space. So, you have to add 37 - 0x1000 to the address you would originally request. An example for 35 + them as described in the document instantiating-devices.rst. The only 36 + difference is that i2c slave backends have their own address space. So, you 37 + have to add 0x1000 to the address you would originally request. An example for 38 38 instantiating the slave-eeprom driver from userspace at the 7 bit address 0x64 39 39 on bus 1:: 40 40
+2 -2
Documentation/i2c/writing-clients.rst
··· 364 364 contains for each message the client address, the number of bytes of the 365 365 message and the message data itself. 366 366 367 - You can read the file ``i2c-protocol`` for more information about the 367 + You can read the file i2c-protocol.rst for more information about the 368 368 actual I2C protocol. 369 369 370 370 ··· 414 414 value, except for block transactions, which return the number of values 415 415 read. The block buffers need not be longer than 32 bytes. 416 416 417 - You can read the file ``smbus-protocol`` for more information about the 417 + You can read the file smbus-protocol.rst for more information about the 418 418 actual SMBus protocol. 419 419 420 420
-1
Documentation/networking/mptcp-sysctl.rst
··· 47 47 Default: 1 48 48 49 49 pm_type - INTEGER 50 - 51 50 Set the default path manager type to use for each new MPTCP 52 51 socket. In-kernel path management will control subflow 53 52 connections and address advertisements according to
-9
Documentation/networking/nf_conntrack-sysctl.rst
··· 70 70 Default for generic timeout. This refers to layer 4 unknown/unsupported 71 71 protocols. 72 72 73 - nf_conntrack_helper - BOOLEAN 74 - - 0 - disabled (default) 75 - - not 0 - enabled 76 - 77 - Enable automatic conntrack helper assignment. 78 - If disabled it is required to set up iptables rules to assign 79 - helpers to connections. See the CT target description in the 80 - iptables-extensions(8) man page for further information. 81 - 82 73 nf_conntrack_icmp_timeout - INTEGER (seconds) 83 74 default 30 84 75
+20 -17
MAINTAINERS
··· 671 671 F: include/trace/events/afs.h 672 672 673 673 AGPGART DRIVER 674 - M: David Airlie <airlied@linux.ie> 674 + M: David Airlie <airlied@redhat.com> 675 + L: dri-devel@lists.freedesktop.org 675 676 S: Maintained 676 677 T: git git://anongit.freedesktop.org/drm/drm 677 678 F: drivers/char/agp/ ··· 1011 1010 1012 1011 AMD MP2 I2C DRIVER 1013 1012 M: Elie Morisse <syniurge@gmail.com> 1014 - M: Nehal Shah <nehal-bakulchandra.shah@amd.com> 1015 1013 M: Shyam Sundar S K <shyam-sundar.s-k@amd.com> 1016 1014 L: linux-i2c@vger.kernel.org 1017 1015 S: Maintained ··· 1803 1803 N: sun50i 1804 1804 1805 1805 ARM/Amlogic Meson SoC CLOCK FRAMEWORK 1806 - M: Neil Armstrong <narmstrong@baylibre.com> 1806 + M: Neil Armstrong <neil.armstrong@linaro.org> 1807 1807 M: Jerome Brunet <jbrunet@baylibre.com> 1808 1808 L: linux-amlogic@lists.infradead.org 1809 1809 S: Maintained ··· 1828 1828 F: sound/soc/meson/ 1829 1829 1830 1830 ARM/Amlogic Meson SoC support 1831 - M: Neil Armstrong <narmstrong@baylibre.com> 1831 + M: Neil Armstrong <neil.armstrong@linaro.org> 1832 1832 M: Kevin Hilman <khilman@baylibre.com> 1833 1833 R: Jerome Brunet <jbrunet@baylibre.com> 1834 1834 R: Martin Blumenstingl <martin.blumenstingl@googlemail.com> ··· 2531 2531 F: arch/arm/mach-orion5x/ts78xx-* 2532 2532 2533 2533 ARM/OXNAS platform support 2534 - M: Neil Armstrong <narmstrong@baylibre.com> 2534 + M: Neil Armstrong <neil.armstrong@linaro.org> 2535 2535 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 2536 2536 L: linux-oxnas@groups.io (moderated for non-subscribers) 2537 2537 S: Maintained ··· 5245 5245 F: include/linux/blk-cgroup.h 5246 5246 5247 5247 CONTROL GROUP - CPUSET 5248 + M: Waiman Long <longman@redhat.com> 5248 5249 M: Zefan Li <lizefan.x@bytedance.com> 5249 5250 L: cgroups@vger.kernel.org 5250 5251 S: Maintained ··· 6754 6753 F: drivers/gpu/drm/panel/panel-widechips-ws2401.c 6755 6754 6756 6755 DRM DRIVERS 6757 - M: David Airlie <airlied@linux.ie> 6756 + M: David Airlie <airlied@gmail.com> 6758 6757 M: Daniel Vetter <daniel@ffwll.ch> 6759 6758 L: dri-devel@lists.freedesktop.org 6760 6759 S: Maintained ··· 6793 6792 F: drivers/gpu/drm/sun4i/ 6794 6793 6795 6794 DRM DRIVERS FOR AMLOGIC SOCS 6796 - M: Neil Armstrong <narmstrong@baylibre.com> 6795 + M: Neil Armstrong <neil.armstrong@linaro.org> 6797 6796 L: dri-devel@lists.freedesktop.org 6798 6797 L: linux-amlogic@lists.infradead.org 6799 6798 S: Supported ··· 6815 6814 6816 6815 DRM DRIVERS FOR BRIDGE CHIPS 6817 6816 M: Andrzej Hajda <andrzej.hajda@intel.com> 6818 - M: Neil Armstrong <narmstrong@baylibre.com> 6817 + M: Neil Armstrong <neil.armstrong@linaro.org> 6819 6818 M: Robert Foss <robert.foss@linaro.org> 6820 6819 R: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> 6821 6820 R: Jonas Karlman <jonas@kwiboo.se> ··· 8653 8652 8654 8653 GOOGLE ETHERNET DRIVERS 8655 8654 M: Jeroen de Borst <jeroendb@google.com> 8656 - R: Catherine Sullivan <csully@google.com> 8657 - R: David Awogbemila <awogbemila@google.com> 8655 + M: Catherine Sullivan <csully@google.com> 8656 + R: Shailend Chand <shailend@google.com> 8658 8657 L: netdev@vger.kernel.org 8659 8658 S: Supported 8660 8659 F: Documentation/networking/device_drivers/ethernet/google/gve.rst ··· 9123 9122 F: drivers/dma/hisi_dma.c 9124 9123 9125 9124 HISILICON GPIO DRIVER 9126 - M: Luo Jiaxing <luojiaxing@huawei.com> 9125 + M: Jay Fang <f.fangjian@huawei.com> 9127 9126 L: linux-gpio@vger.kernel.org 9128 9127 S: Maintained 9129 9128 F: drivers/gpio/gpio-hisi.c ··· 10829 10828 10830 10829 ITE IT66121 HDMI BRIDGE DRIVER 10831 10830 M: Phong LE <ple@baylibre.com> 10832 - M: Neil Armstrong <narmstrong@baylibre.com> 10831 + M: Neil Armstrong <neil.armstrong@linaro.org> 10833 10832 S: Maintained 10834 10833 T: git git://anongit.freedesktop.org/drm/drm-misc 10835 10834 F: Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml ··· 11348 11347 F: kernel/module/kdb.c 11349 11348 11350 11349 KHADAS MCU MFD DRIVER 11351 - M: Neil Armstrong <narmstrong@baylibre.com> 11350 + M: Neil Armstrong <neil.armstrong@linaro.org> 11352 11351 L: linux-amlogic@lists.infradead.org 11353 11352 S: Maintained 11354 11353 F: Documentation/devicetree/bindings/mfd/khadas,mcu.yaml ··· 13219 13218 F: drivers/watchdog/menz69_wdt.c 13220 13219 13221 13220 MESON AO CEC DRIVER FOR AMLOGIC SOCS 13222 - M: Neil Armstrong <narmstrong@baylibre.com> 13221 + M: Neil Armstrong <neil.armstrong@linaro.org> 13223 13222 L: linux-media@vger.kernel.org 13224 13223 L: linux-amlogic@lists.infradead.org 13225 13224 S: Supported ··· 13230 13229 F: drivers/media/cec/platform/meson/ao-cec.c 13231 13230 13232 13231 MESON GE2D DRIVER FOR AMLOGIC SOCS 13233 - M: Neil Armstrong <narmstrong@baylibre.com> 13232 + M: Neil Armstrong <neil.armstrong@linaro.org> 13234 13233 L: linux-media@vger.kernel.org 13235 13234 L: linux-amlogic@lists.infradead.org 13236 13235 S: Supported ··· 13246 13245 F: drivers/mtd/nand/raw/meson_* 13247 13246 13248 13247 MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS 13249 - M: Neil Armstrong <narmstrong@baylibre.com> 13248 + M: Neil Armstrong <neil.armstrong@linaro.org> 13250 13249 L: linux-media@vger.kernel.org 13251 13250 L: linux-amlogic@lists.infradead.org 13252 13251 S: Supported ··· 16858 16857 16859 16858 QUALCOMM ETHQOS ETHERNET DRIVER 16860 16859 M: Vinod Koul <vkoul@kernel.org> 16860 + R: Bhupesh Sharma <bhupesh.sharma@linaro.org> 16861 16861 L: netdev@vger.kernel.org 16862 16862 S: Maintained 16863 16863 F: Documentation/devicetree/bindings/net/qcom,ethqos.txt ··· 19961 19959 F: drivers/net/team/ 19962 19960 F: include/linux/if_team.h 19963 19961 F: include/uapi/linux/if_team.h 19962 + F: tools/testing/selftests/net/team/ 19964 19963 19965 19964 TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT 19966 19965 M: "Savoir-faire Linux Inc." <kernel@savoirfairelinux.com> ··· 21568 21565 F: include/uapi/linux/virtio_gpio.h 21569 21566 21570 21567 VIRTIO GPU DRIVER 21571 - M: David Airlie <airlied@linux.ie> 21568 + M: David Airlie <airlied@redhat.com> 21572 21569 M: Gerd Hoffmann <kraxel@redhat.com> 21573 21570 R: Gurchetan Singh <gurchetansingh@chromium.org> 21574 21571 R: Chia-I Wu <olvaffe@gmail.com>
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 0 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc5 5 + EXTRAVERSION = -rc7 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION*
+2 -2
arch/arm/boot/dts/lan966x.dtsi
··· 541 541 542 542 phy0: ethernet-phy@1 { 543 543 reg = <1>; 544 - interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; 544 + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; 545 545 status = "disabled"; 546 546 }; 547 547 548 548 phy1: ethernet-phy@2 { 549 549 reg = <2>; 550 - interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>; 550 + interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>; 551 551 status = "disabled"; 552 552 }; 553 553 };
+1 -1
arch/arm/boot/dts/moxart-uc7112lx.dts
··· 79 79 clocks = <&ref12>; 80 80 }; 81 81 82 - &sdhci { 82 + &mmc { 83 83 status = "okay"; 84 84 }; 85 85
+2 -2
arch/arm/boot/dts/moxart.dtsi
··· 93 93 clock-names = "PCLK"; 94 94 }; 95 95 96 - sdhci: sdhci@98e00000 { 97 - compatible = "moxa,moxart-sdhci"; 96 + mmc: mmc@98e00000 { 97 + compatible = "moxa,moxart-mmc"; 98 98 reg = <0x98e00000 0x5C>; 99 99 interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; 100 100 clocks = <&clk_apb>;
+5 -5
arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts
··· 152 152 * CPLD_reset is RESET_SOFT in schematic 153 153 */ 154 154 gpio-line-names = 155 - "CPLD_D[1]", "CPLD_int", "CPLD_reset", "", 156 - "", "CPLD_D[0]", "", "", 157 - "", "", "", "CPLD_D[2]", 158 - "CPLD_D[3]", "CPLD_D[4]", "CPLD_D[5]", "CPLD_D[6]", 159 - "CPLD_D[7]", "", "", "", 155 + "CPLD_D[6]", "CPLD_int", "CPLD_reset", "", 156 + "", "CPLD_D[7]", "", "", 157 + "", "", "", "CPLD_D[5]", 158 + "CPLD_D[4]", "CPLD_D[3]", "CPLD_D[2]", "CPLD_D[1]", 159 + "CPLD_D[0]", "", "", "", 160 160 "", "", "", "", 161 161 "", "", "", "KBD_intK", 162 162 "", "", "", "";
-1
arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
··· 5 5 6 6 /dts-v1/; 7 7 8 - #include <dt-bindings/phy/phy-imx8-pcie.h> 9 8 #include "imx8mm-tqma8mqml.dtsi" 10 9 #include "mba8mx.dtsi" 11 10
+1
arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi
··· 3 3 * Copyright 2020-2021 TQ-Systems GmbH 4 4 */ 5 5 6 + #include <dt-bindings/phy/phy-imx8-pcie.h> 6 7 #include "imx8mm.dtsi" 7 8 8 9 / {
+5 -5
arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
··· 367 367 nxp,dvs-standby-voltage = <850000>; 368 368 regulator-always-on; 369 369 regulator-boot-on; 370 - regulator-max-microvolt = <950000>; 371 - regulator-min-microvolt = <850000>; 370 + regulator-max-microvolt = <1050000>; 371 + regulator-min-microvolt = <805000>; 372 372 regulator-name = "On-module +VDD_ARM (BUCK2)"; 373 373 regulator-ramp-delay = <3125>; 374 374 }; ··· 376 376 reg_vdd_dram: BUCK3 { 377 377 regulator-always-on; 378 378 regulator-boot-on; 379 - regulator-max-microvolt = <950000>; 380 - regulator-min-microvolt = <850000>; 379 + regulator-max-microvolt = <1000000>; 380 + regulator-min-microvolt = <805000>; 381 381 regulator-name = "On-module +VDD_GPU_VPU_DDR (BUCK3)"; 382 382 }; 383 383 ··· 416 416 reg_vdd_snvs: LDO2 { 417 417 regulator-always-on; 418 418 regulator-boot-on; 419 - regulator-max-microvolt = <900000>; 419 + regulator-max-microvolt = <800000>; 420 420 regulator-min-microvolt = <800000>; 421 421 regulator-name = "On-module +V0.8_SNVS (LDO2)"; 422 422 };
-1
arch/arm64/boot/dts/freescale/imx8mn.dtsi
··· 672 672 <&clk IMX8MN_CLK_GPU_SHADER>, 673 673 <&clk IMX8MN_CLK_GPU_BUS_ROOT>, 674 674 <&clk IMX8MN_CLK_GPU_AHB>; 675 - resets = <&src IMX8MQ_RESET_GPU_RESET>; 676 675 }; 677 676 678 677 pgc_dispmix: power-domain@3 {
+8 -2
arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts
··· 57 57 switch-1 { 58 58 label = "S12"; 59 59 linux,code = <BTN_0>; 60 - gpios = <&gpio5 26 GPIO_ACTIVE_LOW>; 60 + gpios = <&gpio5 27 GPIO_ACTIVE_LOW>; 61 61 }; 62 62 63 63 switch-2 { 64 64 label = "S13"; 65 65 linux,code = <BTN_1>; 66 - gpios = <&gpio5 27 GPIO_ACTIVE_LOW>; 66 + gpios = <&gpio5 26 GPIO_ACTIVE_LOW>; 67 67 }; 68 68 }; 69 69 ··· 394 394 395 395 &pcf85063 { 396 396 /* RTC_EVENT# is connected on MBa8MPxL */ 397 + pinctrl-names = "default"; 398 + pinctrl-0 = <&pinctrl_pcf85063>; 397 399 interrupt-parent = <&gpio4>; 398 400 interrupts = <28 IRQ_TYPE_EDGE_FALLING>; 399 401 }; ··· 630 628 631 629 pinctrl_lvdsdisplay: lvdsdisplaygrp { 632 630 fsl,pins = <MX8MP_IOMUXC_SAI5_RXC__GPIO3_IO20 0x10>; /* Power enable */ 631 + }; 632 + 633 + pinctrl_pcf85063: pcf85063grp { 634 + fsl,pins = <MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28 0x80>; 633 635 }; 634 636 635 637 /* LVDS Backlight */
+8 -4
arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts
··· 123 123 pinctrl-names = "default"; 124 124 pinctrl-0 = <&pinctrl_reg_can>; 125 125 regulator-name = "can2_stby"; 126 - gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; 127 - enable-active-high; 126 + gpio = <&gpio3 19 GPIO_ACTIVE_LOW>; 128 127 regulator-min-microvolt = <3300000>; 129 128 regulator-max-microvolt = <3300000>; 130 129 }; ··· 483 484 lan1: port@0 { 484 485 reg = <0>; 485 486 label = "lan1"; 487 + phy-mode = "internal"; 486 488 local-mac-address = [00 00 00 00 00 00]; 487 489 }; 488 490 489 491 lan2: port@1 { 490 492 reg = <1>; 491 493 label = "lan2"; 494 + phy-mode = "internal"; 492 495 local-mac-address = [00 00 00 00 00 00]; 493 496 }; 494 497 495 498 lan3: port@2 { 496 499 reg = <2>; 497 500 label = "lan3"; 501 + phy-mode = "internal"; 498 502 local-mac-address = [00 00 00 00 00 00]; 499 503 }; 500 504 501 505 lan4: port@3 { 502 506 reg = <3>; 503 507 label = "lan4"; 508 + phy-mode = "internal"; 504 509 local-mac-address = [00 00 00 00 00 00]; 505 510 }; 506 511 507 512 lan5: port@4 { 508 513 reg = <4>; 509 514 label = "lan5"; 515 + phy-mode = "internal"; 510 516 local-mac-address = [00 00 00 00 00 00]; 511 517 }; 512 518 513 - port@6 { 514 - reg = <6>; 519 + port@5 { 520 + reg = <5>; 515 521 label = "cpu"; 516 522 ethernet = <&fec>; 517 523 phy-mode = "rgmii-id";
+3
arch/arm64/boot/dts/freescale/imx8ulp.dtsi
··· 172 172 compatible = "fsl,imx8ulp-pcc3"; 173 173 reg = <0x292d0000 0x10000>; 174 174 #clock-cells = <1>; 175 + #reset-cells = <1>; 175 176 }; 176 177 177 178 tpm5: tpm@29340000 { ··· 271 270 compatible = "fsl,imx8ulp-pcc4"; 272 271 reg = <0x29800000 0x10000>; 273 272 #clock-cells = <1>; 273 + #reset-cells = <1>; 274 274 }; 275 275 276 276 lpi2c6: i2c@29840000 { ··· 416 414 compatible = "fsl,imx8ulp-pcc5"; 417 415 reg = <0x2da70000 0x10000>; 418 416 #clock-cells = <1>; 417 + #reset-cells = <1>; 419 418 }; 420 419 }; 421 420
+2 -2
arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi
··· 2 2 /* 3 3 * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd 4 4 * Copyright (c) 2020 Engicam srl 5 - * Copyright (c) 2020 Amarula Solutons 6 - * Copyright (c) 2020 Amarula Solutons(India) 5 + * Copyright (c) 2020 Amarula Solutions 6 + * Copyright (c) 2020 Amarula Solutions(India) 7 7 */ 8 8 9 9 #include <dt-bindings/gpio/gpio.h>
+5
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts
··· 88 88 }; 89 89 }; 90 90 }; 91 + 92 + &wlan_host_wake_l { 93 + /* Kevin has an external pull up, but Bob does not. */ 94 + rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; 95 + };
+9
arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi
··· 244 244 &edp { 245 245 status = "okay"; 246 246 247 + /* 248 + * eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only 249 + * set this here, because rk3399-gru.dtsi ensures we can generate this 250 + * off GPLL=600MHz, whereas some other RK3399 boards may not. 251 + */ 252 + assigned-clocks = <&cru PCLK_EDP>; 253 + assigned-clock-rates = <24000000>; 254 + 247 255 ports { 248 256 edp_out: port@1 { 249 257 reg = <1>; ··· 586 578 }; 587 579 588 580 wlan_host_wake_l: wlan-host-wake-l { 581 + /* Kevin has an external pull up, but Bob does not */ 589 582 rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; 590 583 }; 591 584 };
-1
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
··· 62 62 vcc5v0_host: vcc5v0-host-regulator { 63 63 compatible = "regulator-fixed"; 64 64 gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>; 65 - enable-active-low; 66 65 pinctrl-names = "default"; 67 66 pinctrl-0 = <&vcc5v0_host_en>; 68 67 regulator-name = "vcc5v0_host";
-1
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
··· 189 189 190 190 vcc3v3_sd: vcc3v3_sd { 191 191 compatible = "regulator-fixed"; 192 - enable-active-low; 193 192 gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; 194 193 pinctrl-names = "default"; 195 194 pinctrl-0 = <&vcc_sd_h>;
+1 -1
arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts
··· 506 506 disable-wp; 507 507 pinctrl-names = "default"; 508 508 pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; 509 - sd-uhs-sdr104; 509 + sd-uhs-sdr50; 510 510 vmmc-supply = <&vcc3v3_sd>; 511 511 vqmmc-supply = <&vccio_sd>; 512 512 status = "okay";
+1 -1
arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts
··· 678 678 }; 679 679 680 680 &usb_host0_xhci { 681 - extcon = <&usb2phy0>; 681 + dr_mode = "host"; 682 682 status = "okay"; 683 683 }; 684 684
+1 -1
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts
··· 656 656 }; 657 657 658 658 &usb2phy0_otg { 659 - vbus-supply = <&vcc5v0_usb_otg>; 659 + phy-supply = <&vcc5v0_usb_otg>; 660 660 status = "okay"; 661 661 }; 662 662
+1 -1
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
··· 581 581 }; 582 582 583 583 &usb2phy0_otg { 584 - vbus-supply = <&vcc5v0_usb_otg>; 584 + phy-supply = <&vcc5v0_usb_otg>; 585 585 status = "okay"; 586 586 }; 587 587
+1
arch/arm64/configs/defconfig
··· 48 48 CONFIG_ARCH_MEDIATEK=y 49 49 CONFIG_ARCH_MESON=y 50 50 CONFIG_ARCH_MVEBU=y 51 + CONFIG_ARCH_NXP=y 51 52 CONFIG_ARCH_MXC=y 52 53 CONFIG_ARCH_NPCM=y 53 54 CONFIG_ARCH_QCOM=y
+1 -1
arch/arm64/kernel/topology.c
··· 237 237 for_each_cpu(cpu, cpus) { 238 238 if (!freq_counters_valid(cpu) || 239 239 freq_inv_set_max_ratio(cpu, 240 - cpufreq_get_hw_max_freq(cpu) * 1000, 240 + cpufreq_get_hw_max_freq(cpu) * 1000ULL, 241 241 arch_timer_get_rate())) 242 242 return; 243 243 }
+1 -1
arch/arm64/kvm/arm.c
··· 2114 2114 * at, which would end badly once inaccessible. 2115 2115 */ 2116 2116 kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start); 2117 - kmemleak_free_part(__va(hyp_mem_base), hyp_mem_size); 2117 + kmemleak_free_part_phys(hyp_mem_base, hyp_mem_size); 2118 2118 return pkvm_drop_host_privileges(); 2119 2119 } 2120 2120
+18 -14
arch/arm64/mm/mmu.c
··· 331 331 } 332 332 BUG_ON(p4d_bad(p4d)); 333 333 334 - /* 335 - * No need for locking during early boot. And it doesn't work as 336 - * expected with KASLR enabled. 337 - */ 338 - if (system_state != SYSTEM_BOOTING) 339 - mutex_lock(&fixmap_lock); 340 334 pudp = pud_set_fixmap_offset(p4dp, addr); 341 335 do { 342 336 pud_t old_pud = READ_ONCE(*pudp); ··· 362 368 } while (pudp++, addr = next, addr != end); 363 369 364 370 pud_clear_fixmap(); 365 - if (system_state != SYSTEM_BOOTING) 366 - mutex_unlock(&fixmap_lock); 367 371 } 368 372 369 - static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, 370 - unsigned long virt, phys_addr_t size, 371 - pgprot_t prot, 372 - phys_addr_t (*pgtable_alloc)(int), 373 - int flags) 373 + static void __create_pgd_mapping_locked(pgd_t *pgdir, phys_addr_t phys, 374 + unsigned long virt, phys_addr_t size, 375 + pgprot_t prot, 376 + phys_addr_t (*pgtable_alloc)(int), 377 + int flags) 374 378 { 375 379 unsigned long addr, end, next; 376 380 pgd_t *pgdp = pgd_offset_pgd(pgdir, virt); ··· 392 400 } while (pgdp++, addr = next, addr != end); 393 401 } 394 402 403 + static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys, 404 + unsigned long virt, phys_addr_t size, 405 + pgprot_t prot, 406 + phys_addr_t (*pgtable_alloc)(int), 407 + int flags) 408 + { 409 + mutex_lock(&fixmap_lock); 410 + __create_pgd_mapping_locked(pgdir, phys, virt, size, prot, 411 + pgtable_alloc, flags); 412 + mutex_unlock(&fixmap_lock); 413 + } 414 + 395 415 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 396 - extern __alias(__create_pgd_mapping) 416 + extern __alias(__create_pgd_mapping_locked) 397 417 void create_kpti_ng_temp_pgd(pgd_t *pgdir, phys_addr_t phys, unsigned long virt, 398 418 phys_addr_t size, pgprot_t prot, 399 419 phys_addr_t (*pgtable_alloc)(int), int flags);
+1
arch/mips/lantiq/clk.c
··· 50 50 { 51 51 return &cpu_clk_generic[2]; 52 52 } 53 + EXPORT_SYMBOL_GPL(clk_get_io); 53 54 54 55 struct clk *clk_get_ppe(void) 55 56 {
+8 -8
arch/mips/loongson32/common/platform.c
··· 98 98 if (plat_dat->bus_id) { 99 99 __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 | 100 100 GMAC1_USE_UART0, LS1X_MUX_CTRL0); 101 - switch (plat_dat->interface) { 101 + switch (plat_dat->phy_interface) { 102 102 case PHY_INTERFACE_MODE_RGMII: 103 103 val &= ~(GMAC1_USE_TXCLK | GMAC1_USE_PWM23); 104 104 break; ··· 107 107 break; 108 108 default: 109 109 pr_err("unsupported mii mode %d\n", 110 - plat_dat->interface); 110 + plat_dat->phy_interface); 111 111 return -ENOTSUPP; 112 112 } 113 113 val &= ~GMAC1_SHUT; 114 114 } else { 115 - switch (plat_dat->interface) { 115 + switch (plat_dat->phy_interface) { 116 116 case PHY_INTERFACE_MODE_RGMII: 117 117 val &= ~(GMAC0_USE_TXCLK | GMAC0_USE_PWM01); 118 118 break; ··· 121 121 break; 122 122 default: 123 123 pr_err("unsupported mii mode %d\n", 124 - plat_dat->interface); 124 + plat_dat->phy_interface); 125 125 return -ENOTSUPP; 126 126 } 127 127 val &= ~GMAC0_SHUT; ··· 131 131 plat_dat = dev_get_platdata(&pdev->dev); 132 132 133 133 val &= ~PHY_INTF_SELI; 134 - if (plat_dat->interface == PHY_INTERFACE_MODE_RMII) 134 + if (plat_dat->phy_interface == PHY_INTERFACE_MODE_RMII) 135 135 val |= 0x4 << PHY_INTF_SELI_SHIFT; 136 136 __raw_writel(val, LS1X_MUX_CTRL1); 137 137 ··· 146 146 .bus_id = 0, 147 147 .phy_addr = -1, 148 148 #if defined(CONFIG_LOONGSON1_LS1B) 149 - .interface = PHY_INTERFACE_MODE_MII, 149 + .phy_interface = PHY_INTERFACE_MODE_MII, 150 150 #elif defined(CONFIG_LOONGSON1_LS1C) 151 - .interface = PHY_INTERFACE_MODE_RMII, 151 + .phy_interface = PHY_INTERFACE_MODE_RMII, 152 152 #endif 153 153 .mdio_bus_data = &ls1x_mdio_bus_data, 154 154 .dma_cfg = &ls1x_eth_dma_cfg, ··· 186 186 static struct plat_stmmacenet_data ls1x_eth1_pdata = { 187 187 .bus_id = 1, 188 188 .phy_addr = -1, 189 - .interface = PHY_INTERFACE_MODE_MII, 189 + .phy_interface = PHY_INTERFACE_MODE_MII, 190 190 .mdio_bus_data = &ls1x_mdio_bus_data, 191 191 .dma_cfg = &ls1x_eth_dma_cfg, 192 192 .has_gmac = 1,
+11 -1
arch/parisc/Kconfig
··· 224 224 Enabling this option will probably slow down your kernel. 225 225 226 226 config 64BIT 227 - def_bool "$(ARCH)" = "parisc64" 227 + def_bool y if "$(ARCH)" = "parisc64" 228 + bool "64-bit kernel" if "$(ARCH)" = "parisc" 228 229 depends on PA8X00 230 + help 231 + Enable this if you want to support 64bit kernel on PA-RISC platform. 232 + 233 + At the moment, only people willing to use more than 2GB of RAM, 234 + or having a 64bit-only capable PA-RISC machine should say Y here. 235 + 236 + Since there is no 64bit userland on PA-RISC, there is no point to 237 + enable this option otherwise. The 64bit kernel is significantly bigger 238 + and slower than the 32bit one. 229 239 230 240 choice 231 241 prompt "Kernel page size"
+1
arch/riscv/Kconfig
··· 386 386 config RISCV_ISA_SVPBMT 387 387 bool "SVPBMT extension support" 388 388 depends on 64BIT && MMU 389 + depends on !XIP_KERNEL 389 390 select RISCV_ALTERNATIVE 390 391 default y 391 392 help
+2 -2
arch/riscv/Kconfig.erratas
··· 46 46 47 47 config ERRATA_THEAD_PBMT 48 48 bool "Apply T-Head memory type errata" 49 - depends on ERRATA_THEAD && 64BIT 49 + depends on ERRATA_THEAD && 64BIT && MMU 50 50 select RISCV_ALTERNATIVE_EARLY 51 51 default y 52 52 help ··· 57 57 58 58 config ERRATA_THEAD_CMO 59 59 bool "Apply T-Head cache management errata" 60 - depends on ERRATA_THEAD 60 + depends on ERRATA_THEAD && MMU 61 61 select RISCV_DMA_NONCOHERENT 62 62 default y 63 63 help
+1
arch/riscv/errata/thead/errata.c
··· 37 37 if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) 38 38 return false; 39 39 40 + riscv_cbom_block_size = L1_CACHE_BYTES; 40 41 riscv_noncoherent_supported(); 41 42 return true; 42 43 #else
+5
arch/riscv/include/asm/cacheflush.h
··· 42 42 43 43 #endif /* CONFIG_SMP */ 44 44 45 + /* 46 + * The T-Head CMO errata internally probe the CBOM block size, but otherwise 47 + * don't depend on Zicbom. 48 + */ 49 + extern unsigned int riscv_cbom_block_size; 45 50 #ifdef CONFIG_RISCV_ISA_ZICBOM 46 51 void riscv_init_cbom_blocksize(void); 47 52 #else
+1 -1
arch/riscv/kernel/setup.c
··· 296 296 setup_smp(); 297 297 #endif 298 298 299 - riscv_fill_hwcap(); 300 299 riscv_init_cbom_blocksize(); 300 + riscv_fill_hwcap(); 301 301 apply_boot_alternatives(); 302 302 } 303 303
+2
arch/riscv/kernel/signal.c
··· 124 124 if (restore_altstack(&frame->uc.uc_stack)) 125 125 goto badframe; 126 126 127 + regs->cause = -1UL; 128 + 127 129 return regs->a0; 128 130 129 131 badframe:
+13 -10
arch/riscv/mm/dma-noncoherent.c
··· 12 12 #include <linux/of_device.h> 13 13 #include <asm/cacheflush.h> 14 14 15 - static unsigned int riscv_cbom_block_size = L1_CACHE_BYTES; 15 + unsigned int riscv_cbom_block_size; 16 16 static bool noncoherent_supported; 17 17 18 18 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, ··· 79 79 void riscv_init_cbom_blocksize(void) 80 80 { 81 81 struct device_node *node; 82 + unsigned long cbom_hartid; 83 + u32 val, probed_block_size; 82 84 int ret; 83 - u32 val; 84 85 86 + probed_block_size = 0; 85 87 for_each_of_cpu_node(node) { 86 88 unsigned long hartid; 87 - int cbom_hartid; 88 89 89 90 ret = riscv_of_processor_hartid(node, &hartid); 90 91 if (ret) 91 - continue; 92 - 93 - if (hartid < 0) 94 92 continue; 95 93 96 94 /* set block-size for cbom extension if available */ ··· 96 98 if (ret) 97 99 continue; 98 100 99 - if (!riscv_cbom_block_size) { 100 - riscv_cbom_block_size = val; 101 + if (!probed_block_size) { 102 + probed_block_size = val; 101 103 cbom_hartid = hartid; 102 104 } else { 103 - if (riscv_cbom_block_size != val) 104 - pr_warn("cbom-block-size mismatched between harts %d and %lu\n", 105 + if (probed_block_size != val) 106 + pr_warn("cbom-block-size mismatched between harts %lu and %lu\n", 105 107 cbom_hartid, hartid); 106 108 } 107 109 } 110 + 111 + if (probed_block_size) 112 + riscv_cbom_block_size = probed_block_size; 108 113 } 109 114 #endif 110 115 111 116 void riscv_noncoherent_supported(void) 112 117 { 118 + WARN(!riscv_cbom_block_size, 119 + "Non-coherent DMA support enabled without a block size\n"); 113 120 noncoherent_supported = true; 114 121 }
+13 -3
arch/s390/kvm/gaccess.c
··· 489 489 PROT_TYPE_ALC = 2, 490 490 PROT_TYPE_DAT = 3, 491 491 PROT_TYPE_IEP = 4, 492 + /* Dummy value for passing an initialized value when code != PGM_PROTECTION */ 493 + PROT_NONE, 492 494 }; 493 495 494 496 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar, ··· 506 504 switch (code) { 507 505 case PGM_PROTECTION: 508 506 switch (prot) { 507 + case PROT_NONE: 508 + /* We should never get here, acts like termination */ 509 + WARN_ON_ONCE(1); 510 + break; 509 511 case PROT_TYPE_IEP: 510 512 tec->b61 = 1; 511 513 fallthrough; ··· 974 968 return rc; 975 969 } else { 976 970 gpa = kvm_s390_real_to_abs(vcpu, ga); 977 - if (kvm_is_error_gpa(vcpu->kvm, gpa)) 971 + if (kvm_is_error_gpa(vcpu->kvm, gpa)) { 978 972 rc = PGM_ADDRESSING; 973 + prot = PROT_NONE; 974 + } 979 975 } 980 976 if (rc) 981 977 return trans_exc(vcpu, rc, ga, ar, mode, prot); ··· 1120 1112 if (rc == PGM_PROTECTION && try_storage_prot_override) 1121 1113 rc = access_guest_page_with_key(vcpu->kvm, mode, gpas[idx], 1122 1114 data, fragment_len, PAGE_SPO_ACC); 1123 - if (rc == PGM_PROTECTION) 1124 - prot = PROT_TYPE_KEYC; 1125 1115 if (rc) 1126 1116 break; 1127 1117 len -= fragment_len; ··· 1129 1123 if (rc > 0) { 1130 1124 bool terminate = (mode == GACC_STORE) && (idx > 0); 1131 1125 1126 + if (rc == PGM_PROTECTION) 1127 + prot = PROT_TYPE_KEYC; 1128 + else 1129 + prot = PROT_NONE; 1132 1130 rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate); 1133 1131 } 1134 1132 out_unlock:
+1 -1
arch/s390/kvm/interrupt.c
··· 3324 3324 if (gaite->count == 0) 3325 3325 return; 3326 3326 if (gaite->aisb != 0) 3327 - set_bit_inv(gaite->aisbo, (unsigned long *)gaite->aisb); 3327 + set_bit_inv(gaite->aisbo, phys_to_virt(gaite->aisb)); 3328 3328 3329 3329 kvm = kvm_s390_pci_si_to_kvm(aift, si); 3330 3330 if (!kvm)
+2 -2
arch/s390/kvm/kvm-s390.c
··· 505 505 goto out; 506 506 } 507 507 508 - if (kvm_s390_pci_interp_allowed()) { 508 + if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)) { 509 509 rc = kvm_s390_pci_init(); 510 510 if (rc) { 511 511 pr_err("Unable to allocate AIFT for PCI\n"); ··· 527 527 void kvm_arch_exit(void) 528 528 { 529 529 kvm_s390_gib_destroy(); 530 - if (kvm_s390_pci_interp_allowed()) 530 + if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)) 531 531 kvm_s390_pci_exit(); 532 532 debug_unregister(kvm_s390_dbf); 533 533 debug_unregister(kvm_s390_dbf_uv);
+14 -6
arch/s390/kvm/pci.c
··· 58 58 if (!zpci_aipb) 59 59 return -ENOMEM; 60 60 61 - aift->sbv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC, 0); 61 + aift->sbv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC, NULL); 62 62 if (!aift->sbv) { 63 63 rc = -ENOMEM; 64 64 goto free_aipb; ··· 71 71 rc = -ENOMEM; 72 72 goto free_sbv; 73 73 } 74 - aift->gait = (struct zpci_gaite *)page_to_phys(page); 74 + aift->gait = (struct zpci_gaite *)page_to_virt(page); 75 75 76 76 zpci_aipb->aipb.faisb = virt_to_phys(aift->sbv->vector); 77 77 zpci_aipb->aipb.gait = virt_to_phys(aift->gait); ··· 373 373 gaite->gisc = 0; 374 374 gaite->aisbo = 0; 375 375 gaite->gisa = 0; 376 - aift->kzdev[zdev->aisb] = 0; 376 + aift->kzdev[zdev->aisb] = NULL; 377 377 /* Clear zdev info */ 378 378 airq_iv_free_bit(aift->sbv, zdev->aisb); 379 379 airq_iv_release(zdev->aibv); ··· 672 672 673 673 int kvm_s390_pci_init(void) 674 674 { 675 + zpci_kvm_hook.kvm_register = kvm_s390_pci_register_kvm; 676 + zpci_kvm_hook.kvm_unregister = kvm_s390_pci_unregister_kvm; 677 + 678 + if (!kvm_s390_pci_interp_allowed()) 679 + return 0; 680 + 675 681 aift = kzalloc(sizeof(struct zpci_aift), GFP_KERNEL); 676 682 if (!aift) 677 683 return -ENOMEM; 678 684 679 685 spin_lock_init(&aift->gait_lock); 680 686 mutex_init(&aift->aift_lock); 681 - zpci_kvm_hook.kvm_register = kvm_s390_pci_register_kvm; 682 - zpci_kvm_hook.kvm_unregister = kvm_s390_pci_unregister_kvm; 683 687 684 688 return 0; 685 689 } 686 690 687 691 void kvm_s390_pci_exit(void) 688 692 { 689 - mutex_destroy(&aift->aift_lock); 690 693 zpci_kvm_hook.kvm_register = NULL; 691 694 zpci_kvm_hook.kvm_unregister = NULL; 695 + 696 + if (!kvm_s390_pci_interp_allowed()) 697 + return; 698 + 699 + mutex_destroy(&aift->aift_lock); 692 700 693 701 kfree(aift); 694 702 }
+3 -3
arch/s390/kvm/pci.h
··· 46 46 static inline struct kvm *kvm_s390_pci_si_to_kvm(struct zpci_aift *aift, 47 47 unsigned long si) 48 48 { 49 - if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == 0 || 50 - aift->kzdev[si] == 0) 51 - return 0; 49 + if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || !aift->kzdev || 50 + !aift->kzdev[si]) 51 + return NULL; 52 52 return aift->kzdev[si]->kvm; 53 53 }; 54 54
+8
arch/um/Makefile
··· 132 132 # The wrappers will select whether using "malloc" or the kernel allocator. 133 133 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 134 134 135 + # Avoid binutils 2.39+ warnings by marking the stack non-executable and 136 + # ignorning warnings for the kallsyms sections. 137 + LDFLAGS_EXECSTACK = -z noexecstack 138 + ifeq ($(CONFIG_LD_IS_BFD),y) 139 + LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments) 140 + endif 141 + 135 142 LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt)) 136 143 137 144 # Used by link-vmlinux.sh which has special support for um link 138 145 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) 146 + export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK) 139 147 140 148 # When cleaning we don't include .config, so we don't include 141 149 # TT or skas makefiles and don't clean skas_ptregs.h.
+2 -1
arch/um/kernel/sysrq.c
··· 48 48 break; 49 49 if (i && ((i % STACKSLOTS_PER_LINE) == 0)) 50 50 pr_cont("\n"); 51 - pr_cont(" %08lx", *stack++); 51 + pr_cont(" %08lx", READ_ONCE_NOCHECK(*stack)); 52 + stack++; 52 53 } 53 54 54 55 printk("%sCall Trace:\n", loglvl);
+1 -1
arch/um/kernel/um_arch.c
··· 33 33 #include "um_arch.h" 34 34 35 35 #define DEFAULT_COMMAND_LINE_ROOT "root=98:0" 36 - #define DEFAULT_COMMAND_LINE_CONSOLE "console=tty" 36 + #define DEFAULT_COMMAND_LINE_CONSOLE "console=tty0" 37 37 38 38 /* Changed in add_arg and setup_arch, which run before SMP is started */ 39 39 static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
+1
arch/x86/include/asm/kvm_host.h
··· 729 729 struct fpu_guest guest_fpu; 730 730 731 731 u64 xcr0; 732 + u64 guest_supported_xcr0; 732 733 733 734 struct kvm_pio_request pio; 734 735 void *pio_data;
+8 -3
arch/x86/kvm/cpuid.c
··· 315 315 { 316 316 struct kvm_lapic *apic = vcpu->arch.apic; 317 317 struct kvm_cpuid_entry2 *best; 318 - u64 guest_supported_xcr0; 319 318 320 319 best = kvm_find_cpuid_entry(vcpu, 1); 321 320 if (best && apic) { ··· 326 327 kvm_apic_set_version(vcpu); 327 328 } 328 329 329 - guest_supported_xcr0 = 330 + vcpu->arch.guest_supported_xcr0 = 330 331 cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent); 331 332 332 - vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0; 333 + /* 334 + * FP+SSE can always be saved/restored via KVM_{G,S}ET_XSAVE, even if 335 + * XSAVE/XCRO are not exposed to the guest, and even if XSAVE isn't 336 + * supported by the host. 337 + */ 338 + vcpu->arch.guest_fpu.fpstate->user_xfeatures = vcpu->arch.guest_supported_xcr0 | 339 + XFEATURE_MASK_FPSSE; 333 340 334 341 kvm_update_pv_runtime(vcpu); 335 342
+3
arch/x86/kvm/emulate.c
··· 4132 4132 { 4133 4133 u32 eax, ecx, edx; 4134 4134 4135 + if (!(ctxt->ops->get_cr(ctxt, 4) & X86_CR4_OSXSAVE)) 4136 + return emulate_ud(ctxt); 4137 + 4135 4138 eax = reg_read(ctxt, VCPU_REGS_RAX); 4136 4139 edx = reg_read(ctxt, VCPU_REGS_RDX); 4137 4140 ecx = reg_read(ctxt, VCPU_REGS_RCX);
+2
arch/x86/kvm/mmu/mmu.c
··· 1596 1596 rmap_head = gfn_to_rmap(gfn, sp->role.level, slot); 1597 1597 rmap_count = pte_list_add(cache, spte, rmap_head); 1598 1598 1599 + if (rmap_count > kvm->stat.max_mmu_rmap_size) 1600 + kvm->stat.max_mmu_rmap_size = rmap_count; 1599 1601 if (rmap_count > RMAP_RECYCLE_THRESHOLD) { 1600 1602 kvm_zap_all_rmap_sptes(kvm, rmap_head); 1601 1603 kvm_flush_remote_tlbs_with_address(
+3 -7
arch/x86/kvm/x86.c
··· 1011 1011 } 1012 1012 EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state); 1013 1013 1014 - static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu) 1015 - { 1016 - return vcpu->arch.guest_fpu.fpstate->user_xfeatures; 1017 - } 1018 - 1019 1014 #ifdef CONFIG_X86_64 1020 1015 static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu) 1021 1016 { 1022 - return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC; 1017 + return vcpu->arch.guest_supported_xcr0 & XFEATURE_MASK_USER_DYNAMIC; 1023 1018 } 1024 1019 #endif 1025 1020 ··· 1037 1042 * saving. However, xcr0 bit 0 is always set, even if the 1038 1043 * emulated CPU does not support XSAVE (see kvm_vcpu_reset()). 1039 1044 */ 1040 - valid_bits = kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP; 1045 + valid_bits = vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP; 1041 1046 if (xcr0 & ~valid_bits) 1042 1047 return 1; 1043 1048 ··· 1065 1070 1066 1071 int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu) 1067 1072 { 1073 + /* Note, #UD due to CR4.OSXSAVE=0 has priority over the intercept. */ 1068 1074 if (static_call(kvm_x86_get_cpl)(vcpu) != 0 || 1069 1075 __kvm_set_xcr(vcpu, kvm_rcx_read(vcpu), kvm_read_edx_eax(vcpu))) { 1070 1076 kvm_inject_gp(vcpu, 0);
+2 -3
arch/x86/um/shared/sysdep/syscalls_32.h
··· 6 6 #include <asm/unistd.h> 7 7 #include <sysdep/ptrace.h> 8 8 9 - typedef long syscall_handler_t(struct pt_regs); 9 + typedef long syscall_handler_t(struct syscall_args); 10 10 11 11 extern syscall_handler_t *sys_call_table[]; 12 12 13 13 #define EXECUTE_SYSCALL(syscall, regs) \ 14 - ((long (*)(struct syscall_args)) \ 15 - (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs)) 14 + ((*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
-6
arch/x86/um/tls_32.c
··· 65 65 struct thread_struct *t = &task->thread; 66 66 int idx; 67 67 68 - if (!t->arch.tls_array) 69 - return GDT_ENTRY_TLS_MIN; 70 - 71 68 for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) 72 69 if (!t->arch.tls_array[idx].present) 73 70 return idx + GDT_ENTRY_TLS_MIN; ··· 236 239 int idx) 237 240 { 238 241 struct thread_struct *t = &task->thread; 239 - 240 - if (!t->arch.tls_array) 241 - goto clear; 242 242 243 243 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) 244 244 return -EINVAL;
+1 -1
arch/x86/um/vdso/Makefile
··· 65 65 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ 66 66 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' 67 67 68 - VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv 68 + VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv -z noexecstack 69 69 GCOV_PROFILE := n 70 70 71 71 #
+2 -2
block/blk-core.c
··· 295 295 296 296 while (!blk_try_enter_queue(q, pm)) { 297 297 if (flags & BLK_MQ_REQ_NOWAIT) 298 - return -EBUSY; 298 + return -EAGAIN; 299 299 300 300 /* 301 301 * read pair of barrier in blk_freeze_queue_start(), we need to ··· 325 325 if (test_bit(GD_DEAD, &disk->state)) 326 326 goto dead; 327 327 bio_wouldblock_error(bio); 328 - return -EBUSY; 328 + return -EAGAIN; 329 329 } 330 330 331 331 /*
+8 -3
block/blk-lib.c
··· 309 309 struct blk_plug plug; 310 310 int ret = 0; 311 311 312 + /* make sure that "len << SECTOR_SHIFT" doesn't overflow */ 313 + if (max_sectors > UINT_MAX >> SECTOR_SHIFT) 314 + max_sectors = UINT_MAX >> SECTOR_SHIFT; 315 + max_sectors &= ~bs_mask; 316 + 312 317 if (max_sectors == 0) 313 318 return -EOPNOTSUPP; 314 319 if ((sector | nr_sects) & bs_mask) ··· 327 322 328 323 bio = blk_next_bio(bio, bdev, 0, REQ_OP_SECURE_ERASE, gfp); 329 324 bio->bi_iter.bi_sector = sector; 330 - bio->bi_iter.bi_size = len; 325 + bio->bi_iter.bi_size = len << SECTOR_SHIFT; 331 326 332 - sector += len << SECTOR_SHIFT; 333 - nr_sects -= len << SECTOR_SHIFT; 327 + sector += len; 328 + nr_sects -= len; 334 329 if (!nr_sects) { 335 330 ret = submit_bio_wait(bio); 336 331 bio_put(bio);
+2 -1
block/genhd.c
··· 602 602 * Prevent new I/O from crossing bio_queue_enter(). 603 603 */ 604 604 blk_queue_start_drain(q); 605 - blk_mq_freeze_queue_wait(q); 606 605 607 606 if (!(disk->flags & GENHD_FL_HIDDEN)) { 608 607 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); ··· 624 625 sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); 625 626 pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); 626 627 device_del(disk_to_dev(disk)); 628 + 629 + blk_mq_freeze_queue_wait(q); 627 630 628 631 blk_throtl_cancel_bios(disk->queue); 629 632
+1 -1
certs/Kconfig
··· 43 43 bool "Provide system-wide ring of trusted keys" 44 44 depends on KEYS 45 45 depends on ASYMMETRIC_KEY_TYPE 46 - depends on X509_CERTIFICATE_PARSER 46 + depends on X509_CERTIFICATE_PARSER = y 47 47 help 48 48 Provide a system keyring to which trusted keys can be added. Keys in 49 49 the keyring are considered to be trusted. Keys may be added at will
+1 -1
drivers/base/core.c
··· 1625 1625 } 1626 1626 early_param("fw_devlink", fw_devlink_setup); 1627 1627 1628 - static bool fw_devlink_strict = true; 1628 + static bool fw_devlink_strict; 1629 1629 static int __init fw_devlink_strict_setup(char *arg) 1630 1630 { 1631 1631 return strtobool(arg, &fw_devlink_strict);
+3 -3
drivers/counter/104-quad-8.c
··· 449 449 return -EINVAL; 450 450 } 451 451 452 + /* Enable IRQ line */ 453 + irq_enabled |= BIT(event_node->channel); 454 + 452 455 /* Skip configuration if it is the same as previously set */ 453 456 if (priv->irq_trigger[event_node->channel] == next_irq_trigger) 454 457 continue; ··· 465 462 priv->irq_trigger[event_node->channel] << 3; 466 463 iowrite8(QUAD8_CTR_IOR | ior_cfg, 467 464 &priv->reg->channel[event_node->channel].control); 468 - 469 - /* Enable IRQ line */ 470 - irq_enabled |= BIT(event_node->channel); 471 465 } 472 466 473 467 iowrite8(irq_enabled, &priv->reg->index_interrupt);
+1
drivers/dax/hmem/device.c
··· 15 15 .start = r->start, 16 16 .end = r->end, 17 17 .flags = IORESOURCE_MEM, 18 + .desc = IORES_DESC_SOFT_RESERVED, 18 19 }; 19 20 struct platform_device *pdev; 20 21 struct memregion_info info;
+3 -3
drivers/dma/ti/k3-udma-private.c
··· 31 31 } 32 32 33 33 pdev = of_find_device_by_node(udma_node); 34 + if (np != udma_node) 35 + of_node_put(udma_node); 36 + 34 37 if (!pdev) { 35 38 pr_debug("UDMA device not found\n"); 36 39 return ERR_PTR(-EPROBE_DEFER); 37 40 } 38 - 39 - if (np != udma_node) 40 - of_node_put(udma_node); 41 41 42 42 ud = platform_get_drvdata(pdev); 43 43 if (!ud) {
+13 -8
drivers/dma/xilinx/xilinx_dma.c
··· 3040 3040 3041 3041 /* Request and map I/O memory */ 3042 3042 xdev->regs = devm_platform_ioremap_resource(pdev, 0); 3043 - if (IS_ERR(xdev->regs)) 3044 - return PTR_ERR(xdev->regs); 3045 - 3043 + if (IS_ERR(xdev->regs)) { 3044 + err = PTR_ERR(xdev->regs); 3045 + goto disable_clks; 3046 + } 3046 3047 /* Retrieve the DMA engine properties from the device tree */ 3047 3048 xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0); 3048 3049 xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2; ··· 3071 3070 if (err < 0) { 3072 3071 dev_err(xdev->dev, 3073 3072 "missing xlnx,num-fstores property\n"); 3074 - return err; 3073 + goto disable_clks; 3075 3074 } 3076 3075 3077 3076 err = of_property_read_u32(node, "xlnx,flush-fsync", ··· 3091 3090 xdev->ext_addr = false; 3092 3091 3093 3092 /* Set the dma mask bits */ 3094 - dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); 3093 + err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); 3094 + if (err < 0) { 3095 + dev_err(xdev->dev, "DMA mask error %d\n", err); 3096 + goto disable_clks; 3097 + } 3095 3098 3096 3099 /* Initialize the DMA engine */ 3097 3100 xdev->common.dev = &pdev->dev; ··· 3142 3137 for_each_child_of_node(node, child) { 3143 3138 err = xilinx_dma_child_probe(xdev, child); 3144 3139 if (err < 0) 3145 - goto disable_clks; 3140 + goto error; 3146 3141 } 3147 3142 3148 3143 if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { ··· 3177 3172 3178 3173 return 0; 3179 3174 3180 - disable_clks: 3181 - xdma_disable_allclks(xdev); 3182 3175 error: 3183 3176 for (i = 0; i < xdev->dma_config->max_channels; i++) 3184 3177 if (xdev->chan[i]) 3185 3178 xilinx_dma_chan_remove(xdev->chan[i]); 3179 + disable_clks: 3180 + xdma_disable_allclks(xdev); 3186 3181 3187 3182 return err; 3188 3183 }
+1 -1
drivers/dma/xilinx/zynqmp_dma.c
··· 849 849 850 850 zynqmp_dma_desc_config_eod(chan, desc); 851 851 async_tx_ack(&first->async_tx); 852 - first->async_tx.flags = flags; 852 + first->async_tx.flags = (enum dma_ctrl_flags)flags; 853 853 return &first->async_tx; 854 854 } 855 855
+5 -1
drivers/firmware/arm_scmi/clock.c
··· 450 450 static const struct scmi_clock_info * 451 451 scmi_clock_info_get(const struct scmi_protocol_handle *ph, u32 clk_id) 452 452 { 453 + struct scmi_clock_info *clk; 453 454 struct clock_info *ci = ph->get_priv(ph); 454 - struct scmi_clock_info *clk = ci->clk + clk_id; 455 455 456 + if (clk_id >= ci->num_clocks) 457 + return NULL; 458 + 459 + clk = ci->clk + clk_id; 456 460 if (!clk->name[0]) 457 461 return NULL; 458 462
+1
drivers/firmware/arm_scmi/optee.c
··· 106 106 * @channel_id: OP-TEE channel ID used for this transport 107 107 * @tee_session: TEE session identifier 108 108 * @caps: OP-TEE SCMI channel capabilities 109 + * @rx_len: Response size 109 110 * @mu: Mutex protection on channel access 110 111 * @cinfo: SCMI channel information 111 112 * @shmem: Virtual base address of the shared memory
+7 -3
drivers/firmware/arm_scmi/reset.c
··· 166 166 struct scmi_xfer *t; 167 167 struct scmi_msg_reset_domain_reset *dom; 168 168 struct scmi_reset_info *pi = ph->get_priv(ph); 169 - struct reset_dom_info *rdom = pi->dom_info + domain; 169 + struct reset_dom_info *rdom; 170 170 171 - if (rdom->async_reset) 171 + if (domain >= pi->num_domains) 172 + return -EINVAL; 173 + 174 + rdom = pi->dom_info + domain; 175 + if (rdom->async_reset && flags & AUTONOMOUS_RESET) 172 176 flags |= ASYNCHRONOUS_RESET; 173 177 174 178 ret = ph->xops->xfer_get_init(ph, RESET, sizeof(*dom), 0, &t); ··· 184 180 dom->flags = cpu_to_le32(flags); 185 181 dom->reset_state = cpu_to_le32(state); 186 182 187 - if (rdom->async_reset) 183 + if (flags & ASYNCHRONOUS_RESET) 188 184 ret = ph->xops->do_xfer_with_response(ph, t); 189 185 else 190 186 ret = ph->xops->do_xfer(ph, t);
+20
drivers/firmware/arm_scmi/scmi_pm_domain.c
··· 138 138 scmi_pd_data->domains = domains; 139 139 scmi_pd_data->num_domains = num_domains; 140 140 141 + dev_set_drvdata(dev, scmi_pd_data); 142 + 141 143 return of_genpd_add_provider_onecell(np, scmi_pd_data); 144 + } 145 + 146 + static void scmi_pm_domain_remove(struct scmi_device *sdev) 147 + { 148 + int i; 149 + struct genpd_onecell_data *scmi_pd_data; 150 + struct device *dev = &sdev->dev; 151 + struct device_node *np = dev->of_node; 152 + 153 + of_genpd_del_provider(np); 154 + 155 + scmi_pd_data = dev_get_drvdata(dev); 156 + for (i = 0; i < scmi_pd_data->num_domains; i++) { 157 + if (!scmi_pd_data->domains[i]) 158 + continue; 159 + pm_genpd_remove(scmi_pd_data->domains[i]); 160 + } 142 161 } 143 162 144 163 static const struct scmi_device_id scmi_id_table[] = { ··· 169 150 static struct scmi_driver scmi_power_domain_driver = { 170 151 .name = "scmi-power-domain", 171 152 .probe = scmi_pm_domain_probe, 153 + .remove = scmi_pm_domain_remove, 172 154 .id_table = scmi_id_table, 173 155 }; 174 156 module_scmi_driver(scmi_power_domain_driver);
+21 -4
drivers/firmware/arm_scmi/sensors.c
··· 762 762 { 763 763 int ret; 764 764 struct scmi_xfer *t; 765 + struct sensors_info *si = ph->get_priv(ph); 766 + 767 + if (sensor_id >= si->num_sensors) 768 + return -EINVAL; 765 769 766 770 ret = ph->xops->xfer_get_init(ph, SENSOR_CONFIG_GET, 767 771 sizeof(__le32), sizeof(__le32), &t); ··· 775 771 put_unaligned_le32(sensor_id, t->tx.buf); 776 772 ret = ph->xops->do_xfer(ph, t); 777 773 if (!ret) { 778 - struct sensors_info *si = ph->get_priv(ph); 779 774 struct scmi_sensor_info *s = si->sensors + sensor_id; 780 775 781 776 *sensor_config = get_unaligned_le64(t->rx.buf); ··· 791 788 int ret; 792 789 struct scmi_xfer *t; 793 790 struct scmi_msg_sensor_config_set *msg; 791 + struct sensors_info *si = ph->get_priv(ph); 792 + 793 + if (sensor_id >= si->num_sensors) 794 + return -EINVAL; 794 795 795 796 ret = ph->xops->xfer_get_init(ph, SENSOR_CONFIG_SET, 796 797 sizeof(*msg), 0, &t); ··· 807 800 808 801 ret = ph->xops->do_xfer(ph, t); 809 802 if (!ret) { 810 - struct sensors_info *si = ph->get_priv(ph); 811 803 struct scmi_sensor_info *s = si->sensors + sensor_id; 812 804 813 805 s->sensor_config = sensor_config; ··· 837 831 int ret; 838 832 struct scmi_xfer *t; 839 833 struct scmi_msg_sensor_reading_get *sensor; 834 + struct scmi_sensor_info *s; 840 835 struct sensors_info *si = ph->get_priv(ph); 841 - struct scmi_sensor_info *s = si->sensors + sensor_id; 836 + 837 + if (sensor_id >= si->num_sensors) 838 + return -EINVAL; 842 839 843 840 ret = ph->xops->xfer_get_init(ph, SENSOR_READING_GET, 844 841 sizeof(*sensor), 0, &t); ··· 850 841 851 842 sensor = t->tx.buf; 852 843 sensor->id = cpu_to_le32(sensor_id); 844 + s = si->sensors + sensor_id; 853 845 if (s->async) { 854 846 sensor->flags = cpu_to_le32(SENSOR_READ_ASYNC); 855 847 ret = ph->xops->do_xfer_with_response(ph, t); ··· 905 895 int ret; 906 896 struct scmi_xfer *t; 907 897 struct scmi_msg_sensor_reading_get *sensor; 898 + struct scmi_sensor_info *s; 908 899 struct sensors_info *si = ph->get_priv(ph); 909 - struct scmi_sensor_info *s = si->sensors + sensor_id; 910 900 901 + if (sensor_id >= si->num_sensors) 902 + return -EINVAL; 903 + 904 + s = si->sensors + sensor_id; 911 905 if (!count || !readings || 912 906 (!s->num_axis && count > 1) || (s->num_axis && count > s->num_axis)) 913 907 return -EINVAL; ··· 961 947 scmi_sensor_info_get(const struct scmi_protocol_handle *ph, u32 sensor_id) 962 948 { 963 949 struct sensors_info *si = ph->get_priv(ph); 950 + 951 + if (sensor_id >= si->num_sensors) 952 + return NULL; 964 953 965 954 return si->sensors + sensor_id; 966 955 }
+3
drivers/firmware/efi/efibc.c
··· 48 48 return NOTIFY_DONE; 49 49 50 50 wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL); 51 + if (!wdata) 52 + return NOTIFY_DONE; 53 + 51 54 for (l = 0; l < MAX_DATA_LEN - 1 && str[l] != '\0'; l++) 52 55 wdata[l] = str[l]; 53 56 wdata[l] = L'\0';
+4 -4
drivers/firmware/efi/libstub/secureboot.c
··· 14 14 15 15 /* SHIM variables */ 16 16 static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID; 17 - static const efi_char16_t shim_MokSBState_name[] = L"MokSBState"; 17 + static const efi_char16_t shim_MokSBState_name[] = L"MokSBStateRT"; 18 18 19 19 static efi_status_t get_var(efi_char16_t *name, efi_guid_t *vendor, u32 *attr, 20 20 unsigned long *data_size, void *data) ··· 43 43 44 44 /* 45 45 * See if a user has put the shim into insecure mode. If so, and if the 46 - * variable doesn't have the runtime attribute set, we might as well 47 - * honor that. 46 + * variable doesn't have the non-volatile attribute set, we might as 47 + * well honor that. 48 48 */ 49 49 size = sizeof(moksbstate); 50 50 status = get_efi_var(shim_MokSBState_name, &shim_guid, ··· 53 53 /* If it fails, we don't care why. Default to secure */ 54 54 if (status != EFI_SUCCESS) 55 55 goto secure_boot_enabled; 56 - if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS) && moksbstate == 1) 56 + if (!(attr & EFI_VARIABLE_NON_VOLATILE) && moksbstate == 1) 57 57 return efi_secureboot_mode_disabled; 58 58 59 59 secure_boot_enabled:
+7
drivers/firmware/efi/libstub/x86-stub.c
··· 516 516 hdr->ramdisk_image = 0; 517 517 hdr->ramdisk_size = 0; 518 518 519 + /* 520 + * Disregard any setup data that was provided by the bootloader: 521 + * setup_data could be pointing anywhere, and we have no way of 522 + * authenticating or validating the payload. 523 + */ 524 + hdr->setup_data = 0; 525 + 519 526 efi_stub_entry(handle, sys_table_arg, boot_params); 520 527 /* not reached */ 521 528
+4 -4
drivers/fpga/intel-m10-bmc-sec-update.c
··· 148 148 stride = regmap_get_reg_stride(sec->m10bmc->regmap); 149 149 num_bits = FLASH_COUNT_SIZE * 8; 150 150 151 - flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL); 152 - if (!flash_buf) 153 - return -ENOMEM; 154 - 155 151 if (FLASH_COUNT_SIZE % stride) { 156 152 dev_err(sec->dev, 157 153 "FLASH_COUNT_SIZE (0x%x) not aligned to stride (0x%x)\n", ··· 155 159 WARN_ON_ONCE(1); 156 160 return -EINVAL; 157 161 } 162 + 163 + flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL); 164 + if (!flash_buf) 165 + return -ENOMEM; 158 166 159 167 ret = regmap_bulk_read(sec->m10bmc->regmap, STAGING_FLASH_COUNT, 160 168 flash_buf, FLASH_COUNT_SIZE / stride);
+13 -9
drivers/gpio/gpio-ftgpio010.c
··· 41 41 * struct ftgpio_gpio - Gemini GPIO state container 42 42 * @dev: containing device for this instance 43 43 * @gc: gpiochip for this instance 44 - * @irq: irqchip for this instance 45 44 * @base: remapped I/O-memory base 46 45 * @clk: silicon clock 47 46 */ 48 47 struct ftgpio_gpio { 49 48 struct device *dev; 50 49 struct gpio_chip gc; 51 - struct irq_chip irq; 52 50 void __iomem *base; 53 51 struct clk *clk; 54 52 }; ··· 68 70 val = readl(g->base + GPIO_INT_EN); 69 71 val &= ~BIT(irqd_to_hwirq(d)); 70 72 writel(val, g->base + GPIO_INT_EN); 73 + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); 71 74 } 72 75 73 76 static void ftgpio_gpio_unmask_irq(struct irq_data *d) ··· 77 78 struct ftgpio_gpio *g = gpiochip_get_data(gc); 78 79 u32 val; 79 80 81 + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); 80 82 val = readl(g->base + GPIO_INT_EN); 81 83 val |= BIT(irqd_to_hwirq(d)); 82 84 writel(val, g->base + GPIO_INT_EN); ··· 221 221 return 0; 222 222 } 223 223 224 + static const struct irq_chip ftgpio_irq_chip = { 225 + .name = "FTGPIO010", 226 + .irq_ack = ftgpio_gpio_ack_irq, 227 + .irq_mask = ftgpio_gpio_mask_irq, 228 + .irq_unmask = ftgpio_gpio_unmask_irq, 229 + .irq_set_type = ftgpio_gpio_set_irq_type, 230 + .flags = IRQCHIP_IMMUTABLE, 231 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 232 + }; 233 + 224 234 static int ftgpio_gpio_probe(struct platform_device *pdev) 225 235 { 226 236 struct device *dev = &pdev->dev; ··· 287 277 if (!IS_ERR(g->clk)) 288 278 g->gc.set_config = ftgpio_gpio_set_config; 289 279 290 - g->irq.name = "FTGPIO010"; 291 - g->irq.irq_ack = ftgpio_gpio_ack_irq; 292 - g->irq.irq_mask = ftgpio_gpio_mask_irq; 293 - g->irq.irq_unmask = ftgpio_gpio_unmask_irq; 294 - g->irq.irq_set_type = ftgpio_gpio_set_irq_type; 295 - 296 280 girq = &g->gc.irq; 297 - girq->chip = &g->irq; 281 + gpio_irq_chip_set_chip(girq, &ftgpio_irq_chip); 298 282 girq->parent_handler = ftgpio_gpio_irq_handler; 299 283 girq->num_parents = 1; 300 284 girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
+14 -3
drivers/gpio/gpio-ixp4xx.c
··· 63 63 __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); 64 64 } 65 65 66 + static void ixp4xx_gpio_mask_irq(struct irq_data *d) 67 + { 68 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 69 + 70 + irq_chip_mask_parent(d); 71 + gpiochip_disable_irq(gc, d->hwirq); 72 + } 73 + 66 74 static void ixp4xx_gpio_irq_unmask(struct irq_data *d) 67 75 { 68 76 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); ··· 80 72 if (!(g->irq_edge & BIT(d->hwirq))) 81 73 ixp4xx_gpio_irq_ack(d); 82 74 75 + gpiochip_enable_irq(gc, d->hwirq); 83 76 irq_chip_unmask_parent(d); 84 77 } 85 78 ··· 158 149 return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); 159 150 } 160 151 161 - static struct irq_chip ixp4xx_gpio_irqchip = { 152 + static const struct irq_chip ixp4xx_gpio_irqchip = { 162 153 .name = "IXP4GPIO", 163 154 .irq_ack = ixp4xx_gpio_irq_ack, 164 - .irq_mask = irq_chip_mask_parent, 155 + .irq_mask = ixp4xx_gpio_mask_irq, 165 156 .irq_unmask = ixp4xx_gpio_irq_unmask, 166 157 .irq_set_type = ixp4xx_gpio_irq_set_type, 158 + .flags = IRQCHIP_IMMUTABLE, 159 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 167 160 }; 168 161 169 162 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, ··· 274 263 g->gc.owner = THIS_MODULE; 275 264 276 265 girq = &g->gc.irq; 277 - girq->chip = &ixp4xx_gpio_irqchip; 266 + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); 278 267 girq->fwnode = g->fwnode; 279 268 girq->parent_domain = parent; 280 269 girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;
+4 -2
drivers/gpio/gpio-mockup.c
··· 533 533 } 534 534 535 535 fwnode = fwnode_create_software_node(properties, NULL); 536 - if (IS_ERR(fwnode)) 536 + if (IS_ERR(fwnode)) { 537 + kfree_strarray(line_names, ngpio); 537 538 return PTR_ERR(fwnode); 539 + } 538 540 539 541 pdevinfo.name = "gpio-mockup"; 540 542 pdevinfo.id = idx; ··· 599 597 600 598 static void __exit gpio_mockup_exit(void) 601 599 { 600 + gpio_mockup_unregister_pdevs(); 602 601 debugfs_remove_recursive(gpio_mockup_dbg_dir); 603 602 platform_driver_unregister(&gpio_mockup_driver); 604 - gpio_mockup_unregister_pdevs(); 605 603 } 606 604 607 605 module_init(gpio_mockup_init);
+1
drivers/gpio/gpio-mpc8xxx.c
··· 169 169 170 170 switch (flow_type) { 171 171 case IRQ_TYPE_EDGE_FALLING: 172 + case IRQ_TYPE_LEVEL_LOW: 172 173 raw_spin_lock_irqsave(&mpc8xxx_gc->lock, flags); 173 174 gc->write_reg(mpc8xxx_gc->regs + GPIO_ICR, 174 175 gc->read_reg(mpc8xxx_gc->regs + GPIO_ICR)
+15 -6
drivers/gpio/gpio-mt7621.c
··· 112 112 unsigned long flags; 113 113 u32 rise, fall, high, low; 114 114 115 + gpiochip_enable_irq(gc, d->hwirq); 116 + 115 117 spin_lock_irqsave(&rg->lock, flags); 116 118 rise = mtk_gpio_r32(rg, GPIO_REG_REDGE); 117 119 fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE); ··· 145 143 mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin)); 146 144 mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin)); 147 145 spin_unlock_irqrestore(&rg->lock, flags); 146 + 147 + gpiochip_disable_irq(gc, d->hwirq); 148 148 } 149 149 150 150 static int ··· 208 204 return gpio % MTK_BANK_WIDTH; 209 205 } 210 206 207 + static const struct irq_chip mt7621_irq_chip = { 208 + .name = "mt7621-gpio", 209 + .irq_mask_ack = mediatek_gpio_irq_mask, 210 + .irq_mask = mediatek_gpio_irq_mask, 211 + .irq_unmask = mediatek_gpio_irq_unmask, 212 + .irq_set_type = mediatek_gpio_irq_type, 213 + .flags = IRQCHIP_IMMUTABLE, 214 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 215 + }; 216 + 211 217 static int 212 218 mediatek_gpio_bank_probe(struct device *dev, int bank) 213 219 { ··· 252 238 return -ENOMEM; 253 239 254 240 rg->chip.offset = bank * MTK_BANK_WIDTH; 255 - rg->irq_chip.name = dev_name(dev); 256 - rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask; 257 - rg->irq_chip.irq_mask = mediatek_gpio_irq_mask; 258 - rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask; 259 - rg->irq_chip.irq_set_type = mediatek_gpio_irq_type; 260 241 261 242 if (mtk->gpio_irq) { 262 243 struct gpio_irq_chip *girq; ··· 271 262 } 272 263 273 264 girq = &rg->chip.irq; 274 - girq->chip = &rg->irq_chip; 265 + gpio_irq_chip_set_chip(girq, &mt7621_irq_chip); 275 266 /* This will let us handle the parent IRQ in the driver */ 276 267 girq->parent_handler = NULL; 277 268 girq->num_parents = 0;
+2 -2
drivers/gpio/gpio-rockchip.c
··· 419 419 goto out; 420 420 } else { 421 421 bank->toggle_edge_mode |= mask; 422 - level |= mask; 422 + level &= ~mask; 423 423 424 424 /* 425 425 * Determine gpio state. If 1 next interrupt should be 426 - * falling otherwise rising. 426 + * low otherwise high. 427 427 */ 428 428 data = readl(bank->reg_base + bank->gpio_regs->ext_port); 429 429 if (data & mask)
+2 -2
drivers/gpio/gpio-tqmx86.c
··· 307 307 girq->default_type = IRQ_TYPE_NONE; 308 308 girq->handler = handle_simple_irq; 309 309 girq->init_valid_mask = tqmx86_init_irq_valid_mask; 310 + 311 + irq_domain_set_pm_device(girq->domain, dev); 310 312 } 311 313 312 314 ret = devm_gpiochip_add_data(dev, chip, gpio); ··· 316 314 dev_err(dev, "Could not register GPIO chip\n"); 317 315 goto out_pm_dis; 318 316 } 319 - 320 - irq_domain_set_pm_device(girq->domain, dev); 321 317 322 318 dev_info(dev, "GPIO functionality initialized with %d pins\n", 323 319 chip->ngpio);
+3 -2
drivers/gpio/gpiolib-cdev.c
··· 1986 1986 ret = -ENODEV; 1987 1987 goto out_free_le; 1988 1988 } 1989 - le->irq = irq; 1990 1989 1991 1990 if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) 1992 1991 irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? ··· 1999 2000 init_waitqueue_head(&le->wait); 2000 2001 2001 2002 /* Request a thread to read the events */ 2002 - ret = request_threaded_irq(le->irq, 2003 + ret = request_threaded_irq(irq, 2003 2004 lineevent_irq_handler, 2004 2005 lineevent_irq_thread, 2005 2006 irqflags, ··· 2007 2008 le); 2008 2009 if (ret) 2009 2010 goto out_free_le; 2011 + 2012 + le->irq = irq; 2010 2013 2011 2014 fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC); 2012 2015 if (fd < 0) {
+11 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2365 2365 } 2366 2366 adev->ip_blocks[i].status.sw = true; 2367 2367 2368 - /* need to do gmc hw init early so we can allocate gpu mem */ 2369 - if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { 2368 + if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) { 2369 + /* need to do common hw init early so everything is set up for gmc */ 2370 + r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev); 2371 + if (r) { 2372 + DRM_ERROR("hw_init %d failed %d\n", i, r); 2373 + goto init_failed; 2374 + } 2375 + adev->ip_blocks[i].status.hw = true; 2376 + } else if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { 2377 + /* need to do gmc hw init early so we can allocate gpu mem */ 2370 2378 /* Try to reserve bad pages early */ 2371 2379 if (amdgpu_sriov_vf(adev)) 2372 2380 amdgpu_virt_exchange_data(adev); ··· 3060 3052 int i, r; 3061 3053 3062 3054 static enum amd_ip_block_type ip_order[] = { 3063 - AMD_IP_BLOCK_TYPE_GMC, 3064 3055 AMD_IP_BLOCK_TYPE_COMMON, 3056 + AMD_IP_BLOCK_TYPE_GMC, 3065 3057 AMD_IP_BLOCK_TYPE_PSP, 3066 3058 AMD_IP_BLOCK_TYPE_IH, 3067 3059 };
+12 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
··· 38 38 #include <linux/pci.h> 39 39 #include <linux/pm_runtime.h> 40 40 #include <drm/drm_crtc_helper.h> 41 + #include <drm/drm_damage_helper.h> 42 + #include <drm/drm_drv.h> 41 43 #include <drm/drm_edid.h> 42 44 #include <drm/drm_gem_framebuffer_helper.h> 43 45 #include <drm/drm_fb_helper.h> ··· 498 496 static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { 499 497 .destroy = drm_gem_fb_destroy, 500 498 .create_handle = drm_gem_fb_create_handle, 499 + }; 500 + 501 + static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { 502 + .destroy = drm_gem_fb_destroy, 503 + .create_handle = drm_gem_fb_create_handle, 504 + .dirty = drm_atomic_helper_dirtyfb, 501 505 }; 502 506 503 507 uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, ··· 1108 1100 if (ret) 1109 1101 goto err; 1110 1102 1111 - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); 1103 + if (drm_drv_uses_atomic_modeset(dev)) 1104 + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic); 1105 + else 1106 + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); 1112 1107 if (ret) 1113 1108 goto err; 1114 1109
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
··· 181 181 for (i = 0; i < AMDGPU_MES_MAX_SDMA_PIPES; i++) { 182 182 if (adev->ip_versions[SDMA0_HWIP][0] < IP_VERSION(6, 0, 0)) 183 183 adev->mes.sdma_hqd_mask[i] = i ? 0 : 0x3fc; 184 + /* zero sdma_hqd_mask for non-existent engine */ 185 + else if (adev->sdma.num_instances == 1) 186 + adev->mes.sdma_hqd_mask[i] = i ? 0 : 0xfc; 184 187 else 185 188 adev->mes.sdma_hqd_mask[i] = 0xfc; 186 189 }
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 756 756 } 757 757 758 758 pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; 759 - ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE(psp->adev), 759 + ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT, 760 760 AMDGPU_GEM_DOMAIN_VRAM, 761 761 &psp->tmr_bo, &psp->tmr_mc_addr, pptr); 762 762
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
··· 36 36 #define PSP_CMD_BUFFER_SIZE 0x1000 37 37 #define PSP_1_MEG 0x100000 38 38 #define PSP_TMR_SIZE(adev) ((adev)->asic_type == CHIP_ALDEBARAN ? 0x800000 : 0x400000) 39 + #define PSP_TMR_ALIGNMENT 0x100000 39 40 #define PSP_FW_NAME_LEN 0x24 40 41 41 42 enum psp_shared_mem_size {
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
··· 1811 1811 amdgpu_ras_query_error_status(adev, &info); 1812 1812 1813 1813 if (adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 2) && 1814 - adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 4)) { 1814 + adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 4) && 1815 + adev->ip_versions[MP0_HWIP][0] != IP_VERSION(13, 0, 0)) { 1815 1816 if (amdgpu_ras_reset_error_status(adev, info.head.block)) 1816 1817 dev_warn(adev->dev, "Failed to reset error counter and error status"); 1817 1818 }
+1 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 2484 2484 /* Intentionally setting invalid PTE flag 2485 2485 * combination to force a no-retry-fault 2486 2486 */ 2487 - flags = AMDGPU_PTE_EXECUTABLE | AMDGPU_PDE_PTE | 2488 - AMDGPU_PTE_TF; 2487 + flags = AMDGPU_PTE_SNOOPED | AMDGPU_PTE_PRT; 2489 2488 value = 0; 2490 2489 } else if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_NEVER) { 2491 2490 /* Redirect the access to the dummy page */
+5 -2
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 1103 1103 *flags |= AMDGPU_PDE_BFS(0x9); 1104 1104 1105 1105 } else if (level == AMDGPU_VM_PDB0) { 1106 - if (*flags & AMDGPU_PDE_PTE) 1106 + if (*flags & AMDGPU_PDE_PTE) { 1107 1107 *flags &= ~AMDGPU_PDE_PTE; 1108 - else 1108 + if (!(*flags & AMDGPU_PTE_VALID)) 1109 + *addr |= 1 << PAGE_SHIFT; 1110 + } else { 1109 1111 *flags |= AMDGPU_PTE_TF; 1112 + } 1110 1113 } 1111 1114 } 1112 1115
+8 -1
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
··· 380 380 WREG32_PCIE(smnPCIE_LC_CNTL, data); 381 381 } 382 382 383 + #ifdef CONFIG_PCIEASPM 383 384 static void nbio_v2_3_program_ltr(struct amdgpu_device *adev) 384 385 { 385 386 uint32_t def, data; ··· 402 401 if (def != data) 403 402 WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); 404 403 } 404 + #endif 405 405 406 406 static void nbio_v2_3_program_aspm(struct amdgpu_device *adev) 407 407 { 408 + #ifdef CONFIG_PCIEASPM 408 409 uint32_t def, data; 409 410 410 411 def = data = RREG32_PCIE(smnPCIE_LC_CNTL); ··· 462 459 if (def != data) 463 460 WREG32_PCIE(smnPCIE_LC_CNTL6, data); 464 461 465 - nbio_v2_3_program_ltr(adev); 462 + /* Don't bother about LTR if LTR is not enabled 463 + * in the path */ 464 + if (adev->pdev->ltr_path) 465 + nbio_v2_3_program_ltr(adev); 466 466 467 467 def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3); 468 468 data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; ··· 489 483 data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; 490 484 if (def != data) 491 485 WREG32_PCIE(smnPCIE_LC_CNTL3, data); 486 + #endif 492 487 } 493 488 494 489 static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev)
+8 -1
drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
··· 282 282 mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; 283 283 } 284 284 285 + #ifdef CONFIG_PCIEASPM 285 286 static void nbio_v6_1_program_ltr(struct amdgpu_device *adev) 286 287 { 287 288 uint32_t def, data; ··· 304 303 if (def != data) 305 304 WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); 306 305 } 306 + #endif 307 307 308 308 static void nbio_v6_1_program_aspm(struct amdgpu_device *adev) 309 309 { 310 + #ifdef CONFIG_PCIEASPM 310 311 uint32_t def, data; 311 312 312 313 def = data = RREG32_PCIE(smnPCIE_LC_CNTL); ··· 364 361 if (def != data) 365 362 WREG32_PCIE(smnPCIE_LC_CNTL6, data); 366 363 367 - nbio_v6_1_program_ltr(adev); 364 + /* Don't bother about LTR if LTR is not enabled 365 + * in the path */ 366 + if (adev->pdev->ltr_path) 367 + nbio_v6_1_program_ltr(adev); 368 368 369 369 def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); 370 370 data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; ··· 391 385 data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; 392 386 if (def != data) 393 387 WREG32_PCIE(smnPCIE_LC_CNTL3, data); 388 + #endif 394 389 } 395 390 396 391 const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
+8 -1
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
··· 673 673 }; 674 674 675 675 676 + #ifdef CONFIG_PCIEASPM 676 677 static void nbio_v7_4_program_ltr(struct amdgpu_device *adev) 677 678 { 678 679 uint32_t def, data; ··· 695 694 if (def != data) 696 695 WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); 697 696 } 697 + #endif 698 698 699 699 static void nbio_v7_4_program_aspm(struct amdgpu_device *adev) 700 700 { 701 + #ifdef CONFIG_PCIEASPM 701 702 uint32_t def, data; 702 703 703 704 if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(7, 4, 4)) ··· 758 755 if (def != data) 759 756 WREG32_PCIE(smnPCIE_LC_CNTL6, data); 760 757 761 - nbio_v7_4_program_ltr(adev); 758 + /* Don't bother about LTR if LTR is not enabled 759 + * in the path */ 760 + if (adev->pdev->ltr_path) 761 + nbio_v7_4_program_ltr(adev); 762 762 763 763 def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); 764 764 data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; ··· 785 779 data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; 786 780 if (def != data) 787 781 WREG32_PCIE(smnPCIE_LC_CNTL3, data); 782 + #endif 788 783 } 789 784 790 785 const struct amdgpu_nbio_funcs nbio_v7_4_funcs = {
+9
drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c
··· 28 28 #include "nbio/nbio_7_7_0_sh_mask.h" 29 29 #include <uapi/linux/kfd_ioctl.h> 30 30 31 + static void nbio_v7_7_remap_hdp_registers(struct amdgpu_device *adev) 32 + { 33 + WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL, 34 + adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL); 35 + WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL, 36 + adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL); 37 + } 38 + 31 39 static u32 nbio_v7_7_get_rev_id(struct amdgpu_device *adev) 32 40 { 33 41 u32 tmp; ··· 344 336 .get_clockgating_state = nbio_v7_7_get_clockgating_state, 345 337 .ih_control = nbio_v7_7_ih_control, 346 338 .init_registers = nbio_v7_7_init_registers, 339 + .remap_hdp_registers = nbio_v7_7_remap_hdp_registers, 347 340 };
+5
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
··· 1504 1504 WREG32_SDMA(i, mmSDMA0_CNTL, temp); 1505 1505 1506 1506 if (!amdgpu_sriov_vf(adev)) { 1507 + ring = &adev->sdma.instance[i].ring; 1508 + adev->nbio.funcs->sdma_doorbell_range(adev, i, 1509 + ring->use_doorbell, ring->doorbell_index, 1510 + adev->doorbell_index.sdma_doorbell_range); 1511 + 1507 1512 /* unhalt engine */ 1508 1513 temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL); 1509 1514 temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0);
-25
drivers/gpu/drm/amd/amdgpu/soc15.c
··· 1211 1211 return 0; 1212 1212 } 1213 1213 1214 - static void soc15_doorbell_range_init(struct amdgpu_device *adev) 1215 - { 1216 - int i; 1217 - struct amdgpu_ring *ring; 1218 - 1219 - /* sdma/ih doorbell range are programed by hypervisor */ 1220 - if (!amdgpu_sriov_vf(adev)) { 1221 - for (i = 0; i < adev->sdma.num_instances; i++) { 1222 - ring = &adev->sdma.instance[i].ring; 1223 - adev->nbio.funcs->sdma_doorbell_range(adev, i, 1224 - ring->use_doorbell, ring->doorbell_index, 1225 - adev->doorbell_index.sdma_doorbell_range); 1226 - } 1227 - 1228 - adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, 1229 - adev->irq.ih.doorbell_index); 1230 - } 1231 - } 1232 - 1233 1214 static int soc15_common_hw_init(void *handle) 1234 1215 { 1235 1216 struct amdgpu_device *adev = (struct amdgpu_device *)handle; ··· 1230 1249 1231 1250 /* enable the doorbell aperture */ 1232 1251 soc15_enable_doorbell_aperture(adev, true); 1233 - /* HW doorbell routing policy: doorbell writing not 1234 - * in SDMA/IH/MM/ACV range will be routed to CP. So 1235 - * we need to init SDMA/IH/MM/ACV doorbell range prior 1236 - * to CP ip block init and ring test. 1237 - */ 1238 - soc15_doorbell_range_init(adev); 1239 1252 1240 1253 return 0; 1241 1254 }
+1
drivers/gpu/drm/amd/amdgpu/soc21.c
··· 421 421 { 422 422 switch (adev->ip_versions[GC_HWIP][0]) { 423 423 case IP_VERSION(11, 0, 0): 424 + return amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC); 424 425 case IP_VERSION(11, 0, 2): 425 426 return false; 426 427 default:
+4
drivers/gpu/drm/amd/amdgpu/vega10_ih.c
··· 289 289 } 290 290 } 291 291 292 + if (!amdgpu_sriov_vf(adev)) 293 + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, 294 + adev->irq.ih.doorbell_index); 295 + 292 296 pci_set_master(adev->pdev); 293 297 294 298 /* enable interrupts */
+4
drivers/gpu/drm/amd/amdgpu/vega20_ih.c
··· 340 340 } 341 341 } 342 342 343 + if (!amdgpu_sriov_vf(adev)) 344 + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, 345 + adev->irq.ih.doorbell_index); 346 + 343 347 pci_set_master(adev->pdev); 344 348 345 349 /* enable interrupts */
+10 -2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4759 4759 plane_info->visible = true; 4760 4760 plane_info->stereo_format = PLANE_STEREO_FORMAT_NONE; 4761 4761 4762 - plane_info->layer_index = 0; 4762 + plane_info->layer_index = plane_state->normalized_zpos; 4763 4763 4764 4764 ret = fill_plane_color_attributes(plane_state, plane_info->format, 4765 4765 &plane_info->color_space); ··· 4827 4827 dc_plane_state->global_alpha = plane_info.global_alpha; 4828 4828 dc_plane_state->global_alpha_value = plane_info.global_alpha_value; 4829 4829 dc_plane_state->dcc = plane_info.dcc; 4830 - dc_plane_state->layer_index = plane_info.layer_index; // Always returns 0 4830 + dc_plane_state->layer_index = plane_info.layer_index; 4831 4831 dc_plane_state->flip_int_enabled = true; 4832 4832 4833 4833 /* ··· 9484 9484 } 9485 9485 } 9486 9486 } 9487 + 9488 + /* 9489 + * DC consults the zpos (layer_index in DC terminology) to determine the 9490 + * hw plane on which to enable the hw cursor (see 9491 + * `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in 9492 + * atomic state, so call drm helper to normalize zpos. 9493 + */ 9494 + drm_atomic_normalize_zpos(dev, state); 9487 9495 9488 9496 /* Remove exiting planes if they are modified */ 9489 9497 for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) {
+6 -5
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
··· 99 99 return display_count; 100 100 } 101 101 102 - static void dcn31_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable) 102 + static void dcn31_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable) 103 103 { 104 104 struct dc *dc = clk_mgr_base->ctx->dc; 105 105 int i; ··· 110 110 if (pipe->top_pipe || pipe->prev_odm_pipe) 111 111 continue; 112 112 if (pipe->stream && (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal))) { 113 - if (disable) 113 + if (disable) { 114 114 pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg); 115 - else 115 + reset_sync_context_for_pipe(dc, context, i); 116 + } else 116 117 pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg); 117 118 } 118 119 } ··· 212 211 } 213 212 214 213 if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { 215 - dcn31_disable_otg_wa(clk_mgr_base, true); 214 + dcn31_disable_otg_wa(clk_mgr_base, context, true); 216 215 217 216 clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; 218 217 dcn31_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz); 219 - dcn31_disable_otg_wa(clk_mgr_base, false); 218 + dcn31_disable_otg_wa(clk_mgr_base, context, false); 220 219 221 220 update_dispclk = true; 222 221 }
+9 -7
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c
··· 119 119 return display_count; 120 120 } 121 121 122 - static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable) 122 + static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable) 123 123 { 124 124 struct dc *dc = clk_mgr_base->ctx->dc; 125 125 int i; ··· 129 129 130 130 if (pipe->top_pipe || pipe->prev_odm_pipe) 131 131 continue; 132 - if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL || 133 - dc_is_virtual_signal(pipe->stream->signal))) { 134 - if (disable) 132 + if (pipe->stream && (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal))) { 133 + if (disable) { 135 134 pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg); 136 - else 135 + reset_sync_context_for_pipe(dc, context, i); 136 + } else 137 137 pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg); 138 138 } 139 139 } ··· 233 233 } 234 234 235 235 if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { 236 - dcn314_disable_otg_wa(clk_mgr_base, true); 236 + dcn314_disable_otg_wa(clk_mgr_base, context, true); 237 237 238 238 clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; 239 239 dcn314_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz); 240 - dcn314_disable_otg_wa(clk_mgr_base, false); 240 + dcn314_disable_otg_wa(clk_mgr_base, context, false); 241 241 242 242 update_dispclk = true; 243 243 } ··· 670 670 } 671 671 ASSERT(bw_params->clk_table.entries[i-1].dcfclk_mhz); 672 672 bw_params->vram_type = bios_info->memory_type; 673 + 674 + bw_params->dram_channel_width_bytes = bios_info->memory_type == 0x22 ? 8 : 4; 673 675 bw_params->num_channels = bios_info->ma_channel_number ? bios_info->ma_channel_number : 4; 674 676 675 677 for (i = 0; i < WM_SET_COUNT; i++) {
+21 -15
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
··· 46 46 #define TO_CLK_MGR_DCN315(clk_mgr)\ 47 47 container_of(clk_mgr, struct clk_mgr_dcn315, base) 48 48 49 + #define UNSUPPORTED_DCFCLK 10000000 50 + #define MIN_DPP_DISP_CLK 100000 51 + 49 52 static int dcn315_get_active_display_cnt_wa( 50 53 struct dc *dc, 51 54 struct dc_state *context) ··· 82 79 return display_count; 83 80 } 84 81 85 - static void dcn315_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable) 82 + static void dcn315_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable) 86 83 { 87 84 struct dc *dc = clk_mgr_base->ctx->dc; 88 85 int i; ··· 94 91 continue; 95 92 if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL || 96 93 dc_is_virtual_signal(pipe->stream->signal))) { 97 - if (disable) 94 + if (disable) { 98 95 pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg); 99 - else 96 + reset_sync_context_for_pipe(dc, context, i); 97 + } else 100 98 pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg); 101 99 } 102 100 } ··· 150 146 } 151 147 } 152 148 149 + /* Lock pstate by requesting unsupported dcfclk if change is unsupported */ 150 + if (!new_clocks->p_state_change_support) 151 + new_clocks->dcfclk_khz = UNSUPPORTED_DCFCLK; 153 152 if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) { 154 153 clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz; 155 154 dcn315_smu_set_hard_min_dcfclk(clk_mgr, clk_mgr_base->clks.dcfclk_khz); ··· 166 159 167 160 // workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. 168 161 if (!IS_DIAG_DC(dc->ctx->dce_environment)) { 169 - if (new_clocks->dppclk_khz < 100000) 170 - new_clocks->dppclk_khz = 100000; 171 - if (new_clocks->dispclk_khz < 100000) 172 - new_clocks->dispclk_khz = 100000; 162 + if (new_clocks->dppclk_khz < MIN_DPP_DISP_CLK) 163 + new_clocks->dppclk_khz = MIN_DPP_DISP_CLK; 164 + if (new_clocks->dispclk_khz < MIN_DPP_DISP_CLK) 165 + new_clocks->dispclk_khz = MIN_DPP_DISP_CLK; 173 166 } 174 167 175 168 if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) { ··· 182 175 if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { 183 176 /* No need to apply the w/a if we haven't taken over from bios yet */ 184 177 if (clk_mgr_base->clks.dispclk_khz) 185 - dcn315_disable_otg_wa(clk_mgr_base, true); 178 + dcn315_disable_otg_wa(clk_mgr_base, context, true); 186 179 187 180 clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; 188 181 dcn315_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz); 189 182 if (clk_mgr_base->clks.dispclk_khz) 190 - dcn315_disable_otg_wa(clk_mgr_base, false); 183 + dcn315_disable_otg_wa(clk_mgr_base, context, false); 191 184 192 185 update_dispclk = true; 193 186 } ··· 282 275 { 283 276 .wm_inst = WM_A, 284 277 .wm_type = WM_TYPE_PSTATE_CHG, 285 - .pstate_latency_us = 64.0, 278 + .pstate_latency_us = 129.0, 286 279 .sr_exit_time_us = 11.5, 287 280 .sr_enter_plus_exit_time_us = 14.5, 288 281 .valid = true, ··· 290 283 { 291 284 .wm_inst = WM_B, 292 285 .wm_type = WM_TYPE_PSTATE_CHG, 293 - .pstate_latency_us = 64.0, 286 + .pstate_latency_us = 129.0, 294 287 .sr_exit_time_us = 11.5, 295 288 .sr_enter_plus_exit_time_us = 14.5, 296 289 .valid = true, ··· 298 291 { 299 292 .wm_inst = WM_C, 300 293 .wm_type = WM_TYPE_PSTATE_CHG, 301 - .pstate_latency_us = 64.0, 294 + .pstate_latency_us = 129.0, 302 295 .sr_exit_time_us = 11.5, 303 296 .sr_enter_plus_exit_time_us = 14.5, 304 297 .valid = true, ··· 306 299 { 307 300 .wm_inst = WM_D, 308 301 .wm_type = WM_TYPE_PSTATE_CHG, 309 - .pstate_latency_us = 64.0, 302 + .pstate_latency_us = 129.0, 310 303 .sr_exit_time_us = 11.5, 311 304 .sr_enter_plus_exit_time_us = 14.5, 312 305 .valid = true, ··· 563 556 ASSERT(bw_params->clk_table.entries[i-1].dcfclk_mhz); 564 557 bw_params->vram_type = bios_info->memory_type; 565 558 bw_params->num_channels = bios_info->ma_channel_number; 566 - if (!bw_params->num_channels) 567 - bw_params->num_channels = 2; 559 + bw_params->dram_channel_width_bytes = bios_info->memory_type == 0x22 ? 8 : 4; 568 560 569 561 for (i = 0; i < WM_SET_COUNT; i++) { 570 562 bw_params->wm_table.entries[i].wm_inst = i;
+6 -5
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c
··· 112 112 return display_count; 113 113 } 114 114 115 - static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable) 115 + static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable) 116 116 { 117 117 struct dc *dc = clk_mgr_base->ctx->dc; 118 118 int i; ··· 124 124 continue; 125 125 if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL || 126 126 dc_is_virtual_signal(pipe->stream->signal))) { 127 - if (disable) 127 + if (disable) { 128 128 pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg); 129 - else 129 + reset_sync_context_for_pipe(dc, context, i); 130 + } else 130 131 pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg); 131 132 } 132 133 } ··· 222 221 } 223 222 224 223 if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { 225 - dcn316_disable_otg_wa(clk_mgr_base, true); 224 + dcn316_disable_otg_wa(clk_mgr_base, context, true); 226 225 227 226 clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; 228 227 dcn316_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz); 229 - dcn316_disable_otg_wa(clk_mgr_base, false); 228 + dcn316_disable_otg_wa(clk_mgr_base, context, false); 230 229 231 230 update_dispclk = true; 232 231 }
+17
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 3584 3584 } 3585 3585 } 3586 3586 3587 + void reset_sync_context_for_pipe(const struct dc *dc, 3588 + struct dc_state *context, 3589 + uint8_t pipe_idx) 3590 + { 3591 + int i; 3592 + struct pipe_ctx *pipe_ctx_reset; 3593 + 3594 + /* reset the otg sync context for the pipe and its slave pipes if any */ 3595 + for (i = 0; i < dc->res_pool->pipe_count; i++) { 3596 + pipe_ctx_reset = &context->res_ctx.pipe_ctx[i]; 3597 + 3598 + if (((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_reset) == pipe_idx) && 3599 + IS_PIPE_SYNCD_VALID(pipe_ctx_reset)) || (i == pipe_idx)) 3600 + SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_reset, i); 3601 + } 3602 + } 3603 + 3587 3604 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter) 3588 3605 { 3589 3606 /* TODO - get transmitter to phy idx mapping from DMUB */
+1 -1
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
··· 329 329 330 330 dc = stream->ctx->dc; 331 331 332 - if (attributes->height * attributes->width * 4 > 16384) 332 + if (dc->debug.allow_sw_cursor_fallback && attributes->height * attributes->width * 4 > 16384) 333 333 if (stream->mall_stream_config.type == SUBVP_MAIN) 334 334 return false; 335 335
+1
drivers/gpu/drm/amd/display/dc/dc.h
··· 745 745 bool disable_fixed_vs_aux_timeout_wa; 746 746 bool force_disable_subvp; 747 747 bool force_subvp_mclk_switch; 748 + bool allow_sw_cursor_fallback; 748 749 bool force_usr_allow; 749 750 /* uses value at boot and disables switch */ 750 751 bool disable_dtb_ref_clk_switch;
+43 -44
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
··· 417 417 struct dc_crtc_timing *main_timing = &subvp_pipe->stream->timing; 418 418 struct dc_crtc_timing *phantom_timing = &subvp_pipe->stream->mall_stream_config.paired_stream->timing; 419 419 struct dc_crtc_timing *drr_timing = &vblank_pipe->stream->timing; 420 - int16_t drr_frame_us = 0; 421 - int16_t min_drr_supported_us = 0; 422 - int16_t max_drr_supported_us = 0; 423 - int16_t max_drr_vblank_us = 0; 424 - int16_t max_drr_mallregion_us = 0; 425 - int16_t mall_region_us = 0; 426 - int16_t prefetch_us = 0; 427 - int16_t subvp_active_us = 0; 428 - int16_t drr_active_us = 0; 429 - int16_t min_vtotal_supported = 0; 430 - int16_t max_vtotal_supported = 0; 420 + uint16_t drr_frame_us = 0; 421 + uint16_t min_drr_supported_us = 0; 422 + uint16_t max_drr_supported_us = 0; 423 + uint16_t max_drr_vblank_us = 0; 424 + uint16_t max_drr_mallregion_us = 0; 425 + uint16_t mall_region_us = 0; 426 + uint16_t prefetch_us = 0; 427 + uint16_t subvp_active_us = 0; 428 + uint16_t drr_active_us = 0; 429 + uint16_t min_vtotal_supported = 0; 430 + uint16_t max_vtotal_supported = 0; 431 431 432 432 pipe_data->pipe_config.vblank_data.drr_info.drr_in_use = true; 433 433 pipe_data->pipe_config.vblank_data.drr_info.use_ramping = false; // for now don't use ramping 434 434 pipe_data->pipe_config.vblank_data.drr_info.drr_window_size_ms = 4; // hardcode 4ms DRR window for now 435 435 436 - drr_frame_us = div64_s64(drr_timing->v_total * drr_timing->h_total, 437 - (int64_t)(drr_timing->pix_clk_100hz * 100) * 1000000); 436 + drr_frame_us = div64_u64(((uint64_t)drr_timing->v_total * drr_timing->h_total * 1000000), 437 + (((uint64_t)drr_timing->pix_clk_100hz * 100))); 438 438 // P-State allow width and FW delays already included phantom_timing->v_addressable 439 - mall_region_us = div64_s64(phantom_timing->v_addressable * phantom_timing->h_total, 440 - (int64_t)(phantom_timing->pix_clk_100hz * 100) * 1000000); 439 + mall_region_us = div64_u64(((uint64_t)phantom_timing->v_addressable * phantom_timing->h_total * 1000000), 440 + (((uint64_t)phantom_timing->pix_clk_100hz * 100))); 441 441 min_drr_supported_us = drr_frame_us + mall_region_us + SUBVP_DRR_MARGIN_US; 442 - min_vtotal_supported = div64_s64(drr_timing->pix_clk_100hz * 100 * 443 - (div64_s64((int64_t)min_drr_supported_us, 1000000)), 444 - (int64_t)drr_timing->h_total); 442 + min_vtotal_supported = div64_u64(((uint64_t)drr_timing->pix_clk_100hz * 100 * min_drr_supported_us), 443 + (((uint64_t)drr_timing->h_total * 1000000))); 445 444 446 - prefetch_us = div64_s64((phantom_timing->v_total - phantom_timing->v_front_porch) * phantom_timing->h_total, 447 - (int64_t)(phantom_timing->pix_clk_100hz * 100) * 1000000 + 448 - dc->caps.subvp_prefetch_end_to_mall_start_us); 449 - subvp_active_us = div64_s64(main_timing->v_addressable * main_timing->h_total, 450 - (int64_t)(main_timing->pix_clk_100hz * 100) * 1000000); 451 - drr_active_us = div64_s64(drr_timing->v_addressable * drr_timing->h_total, 452 - (int64_t)(drr_timing->pix_clk_100hz * 100) * 1000000); 453 - max_drr_vblank_us = div64_s64((int64_t)(subvp_active_us - prefetch_us - drr_active_us), 2) + drr_active_us; 445 + prefetch_us = div64_u64(((uint64_t)(phantom_timing->v_total - phantom_timing->v_front_porch) * phantom_timing->h_total * 1000000), 446 + (((uint64_t)phantom_timing->pix_clk_100hz * 100) + dc->caps.subvp_prefetch_end_to_mall_start_us)); 447 + subvp_active_us = div64_u64(((uint64_t)main_timing->v_addressable * main_timing->h_total * 1000000), 448 + (((uint64_t)main_timing->pix_clk_100hz * 100))); 449 + drr_active_us = div64_u64(((uint64_t)drr_timing->v_addressable * drr_timing->h_total * 1000000), 450 + (((uint64_t)drr_timing->pix_clk_100hz * 100))); 451 + max_drr_vblank_us = div64_u64((subvp_active_us - prefetch_us - drr_active_us), 2) + drr_active_us; 454 452 max_drr_mallregion_us = subvp_active_us - prefetch_us - mall_region_us; 455 453 max_drr_supported_us = max_drr_vblank_us > max_drr_mallregion_us ? max_drr_vblank_us : max_drr_mallregion_us; 456 - max_vtotal_supported = div64_s64(drr_timing->pix_clk_100hz * 100 * (div64_s64((int64_t)max_drr_supported_us, 1000000)), 457 - (int64_t)drr_timing->h_total); 454 + max_vtotal_supported = div64_u64(((uint64_t)drr_timing->pix_clk_100hz * 100 * max_drr_supported_us), 455 + (((uint64_t)drr_timing->h_total * 1000000))); 458 456 459 457 pipe_data->pipe_config.vblank_data.drr_info.min_vtotal_supported = min_vtotal_supported; 460 458 pipe_data->pipe_config.vblank_data.drr_info.max_vtotal_supported = max_vtotal_supported; ··· 546 548 struct dc_crtc_timing *phantom_timing1 = &subvp_pipes[1]->stream->mall_stream_config.paired_stream->timing; 547 549 struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 *pipe_data = NULL; 548 550 549 - subvp0_prefetch_us = div64_s64((phantom_timing0->v_total - phantom_timing0->v_front_porch) * phantom_timing0->h_total, 550 - (int64_t)(phantom_timing0->pix_clk_100hz * 100) * 1000000 + dc->caps.subvp_prefetch_end_to_mall_start_us); 551 - subvp1_prefetch_us = div64_s64((phantom_timing1->v_total - phantom_timing1->v_front_porch) * phantom_timing1->h_total, 552 - (int64_t)(phantom_timing1->pix_clk_100hz * 100) * 1000000 + dc->caps.subvp_prefetch_end_to_mall_start_us); 551 + subvp0_prefetch_us = div64_u64(((uint64_t)(phantom_timing0->v_total - phantom_timing0->v_front_porch) * 552 + (uint64_t)phantom_timing0->h_total * 1000000), 553 + (((uint64_t)phantom_timing0->pix_clk_100hz * 100) + dc->caps.subvp_prefetch_end_to_mall_start_us)); 554 + subvp1_prefetch_us = div64_u64(((uint64_t)(phantom_timing1->v_total - phantom_timing1->v_front_porch) * 555 + (uint64_t)phantom_timing1->h_total * 1000000), 556 + (((uint64_t)phantom_timing1->pix_clk_100hz * 100) + dc->caps.subvp_prefetch_end_to_mall_start_us)); 553 557 554 558 // Whichever SubVP PIPE has the smaller prefetch (including the prefetch end to mall start time) 555 559 // should increase it's prefetch time to match the other ··· 559 559 pipe_data = &cmd->fw_assisted_mclk_switch_v2.config_data.pipe_data[1]; 560 560 prefetch_delta_us = subvp0_prefetch_us - subvp1_prefetch_us; 561 561 pipe_data->pipe_config.subvp_data.prefetch_to_mall_start_lines = 562 - div64_s64(((div64_s64((int64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us), 1000000)) * 563 - (phantom_timing1->pix_clk_100hz * 100) + phantom_timing1->h_total - 1), 564 - (int64_t)phantom_timing1->h_total); 562 + div64_u64(((uint64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us) * 563 + ((uint64_t)phantom_timing1->pix_clk_100hz * 100) + ((uint64_t)phantom_timing1->h_total * 1000000 - 1)), 564 + ((uint64_t)phantom_timing1->h_total * 1000000)); 565 + 565 566 } else if (subvp1_prefetch_us > subvp0_prefetch_us) { 566 567 pipe_data = &cmd->fw_assisted_mclk_switch_v2.config_data.pipe_data[0]; 567 568 prefetch_delta_us = subvp1_prefetch_us - subvp0_prefetch_us; 568 569 pipe_data->pipe_config.subvp_data.prefetch_to_mall_start_lines = 569 - div64_s64(((div64_s64((int64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us), 1000000)) * 570 - (phantom_timing0->pix_clk_100hz * 100) + phantom_timing0->h_total - 1), 571 - (int64_t)phantom_timing0->h_total); 570 + div64_u64(((uint64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us) * 571 + ((uint64_t)phantom_timing0->pix_clk_100hz * 100) + ((uint64_t)phantom_timing0->h_total * 1000000 - 1)), 572 + ((uint64_t)phantom_timing0->h_total * 1000000)); 572 573 } 573 574 } 574 575 ··· 631 630 632 631 // Round up 633 632 pipe_data->pipe_config.subvp_data.prefetch_to_mall_start_lines = 634 - div64_s64(((div64_s64((int64_t)dc->caps.subvp_prefetch_end_to_mall_start_us, 1000000)) * 635 - (phantom_timing->pix_clk_100hz * 100) + phantom_timing->h_total - 1), 636 - (int64_t)phantom_timing->h_total); 633 + div64_u64(((uint64_t)dc->caps.subvp_prefetch_end_to_mall_start_us * ((uint64_t)phantom_timing->pix_clk_100hz * 100) + 634 + ((uint64_t)phantom_timing->h_total * 1000000 - 1)), ((uint64_t)phantom_timing->h_total * 1000000)); 637 635 pipe_data->pipe_config.subvp_data.processing_delay_lines = 638 - div64_s64(((div64_s64((int64_t)dc->caps.subvp_fw_processing_delay_us, 1000000)) * 639 - (phantom_timing->pix_clk_100hz * 100) + phantom_timing->h_total - 1), 640 - (int64_t)phantom_timing->h_total); 636 + div64_u64(((uint64_t)(dc->caps.subvp_fw_processing_delay_us) * ((uint64_t)phantom_timing->pix_clk_100hz * 100) + 637 + ((uint64_t)phantom_timing->h_total * 1000000 - 1)), ((uint64_t)phantom_timing->h_total * 1000000)); 641 638 // Find phantom pipe index based on phantom stream 642 639 for (j = 0; j < dc->res_pool->pipe_count; j++) { 643 640 struct pipe_ctx *phantom_pipe = &context->res_ctx.pipe_ctx[j];
+4 -2
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
··· 2164 2164 continue; 2165 2165 if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A) 2166 2166 continue; 2167 - if (pipe_ctx->stream_res.audio != NULL) { 2167 + if (pipe_ctx->stream_res.audio != NULL && 2168 + pipe_ctx->stream_res.audio->enabled == false) { 2168 2169 struct audio_output audio_output; 2169 2170 2170 2171 build_audio_output(context, pipe_ctx, &audio_output); ··· 2205 2204 if (!dc_is_dp_signal(pipe_ctx->stream->signal)) 2206 2205 continue; 2207 2206 2208 - if (pipe_ctx->stream_res.audio != NULL) { 2207 + if (pipe_ctx->stream_res.audio != NULL && 2208 + pipe_ctx->stream_res.audio->enabled == false) { 2209 2209 struct audio_output audio_output; 2210 2210 2211 2211 build_audio_output(context, pipe_ctx, &audio_output);
-220
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.h
··· 445 445 type DSCRM_DSC_FORWARD_EN; \ 446 446 type DSCRM_DSC_OPP_PIPE_SOURCE 447 447 448 - #define DSC_REG_LIST_DCN314(id) \ 449 - SRI(DSC_TOP_CONTROL, DSC_TOP, id),\ 450 - SRI(DSC_DEBUG_CONTROL, DSC_TOP, id),\ 451 - SRI(DSCC_CONFIG0, DSCC, id),\ 452 - SRI(DSCC_CONFIG1, DSCC, id),\ 453 - SRI(DSCC_STATUS, DSCC, id),\ 454 - SRI(DSCC_INTERRUPT_CONTROL_STATUS, DSCC, id),\ 455 - SRI(DSCC_PPS_CONFIG0, DSCC, id),\ 456 - SRI(DSCC_PPS_CONFIG1, DSCC, id),\ 457 - SRI(DSCC_PPS_CONFIG2, DSCC, id),\ 458 - SRI(DSCC_PPS_CONFIG3, DSCC, id),\ 459 - SRI(DSCC_PPS_CONFIG4, DSCC, id),\ 460 - SRI(DSCC_PPS_CONFIG5, DSCC, id),\ 461 - SRI(DSCC_PPS_CONFIG6, DSCC, id),\ 462 - SRI(DSCC_PPS_CONFIG7, DSCC, id),\ 463 - SRI(DSCC_PPS_CONFIG8, DSCC, id),\ 464 - SRI(DSCC_PPS_CONFIG9, DSCC, id),\ 465 - SRI(DSCC_PPS_CONFIG10, DSCC, id),\ 466 - SRI(DSCC_PPS_CONFIG11, DSCC, id),\ 467 - SRI(DSCC_PPS_CONFIG12, DSCC, id),\ 468 - SRI(DSCC_PPS_CONFIG13, DSCC, id),\ 469 - SRI(DSCC_PPS_CONFIG14, DSCC, id),\ 470 - SRI(DSCC_PPS_CONFIG15, DSCC, id),\ 471 - SRI(DSCC_PPS_CONFIG16, DSCC, id),\ 472 - SRI(DSCC_PPS_CONFIG17, DSCC, id),\ 473 - SRI(DSCC_PPS_CONFIG18, DSCC, id),\ 474 - SRI(DSCC_PPS_CONFIG19, DSCC, id),\ 475 - SRI(DSCC_PPS_CONFIG20, DSCC, id),\ 476 - SRI(DSCC_PPS_CONFIG21, DSCC, id),\ 477 - SRI(DSCC_PPS_CONFIG22, DSCC, id),\ 478 - SRI(DSCC_MEM_POWER_CONTROL, DSCC, id),\ 479 - SRI(DSCC_R_Y_SQUARED_ERROR_LOWER, DSCC, id),\ 480 - SRI(DSCC_R_Y_SQUARED_ERROR_UPPER, DSCC, id),\ 481 - SRI(DSCC_G_CB_SQUARED_ERROR_LOWER, DSCC, id),\ 482 - SRI(DSCC_G_CB_SQUARED_ERROR_UPPER, DSCC, id),\ 483 - SRI(DSCC_B_CR_SQUARED_ERROR_LOWER, DSCC, id),\ 484 - SRI(DSCC_B_CR_SQUARED_ERROR_UPPER, DSCC, id),\ 485 - SRI(DSCC_MAX_ABS_ERROR0, DSCC, id),\ 486 - SRI(DSCC_MAX_ABS_ERROR1, DSCC, id),\ 487 - SRI(DSCC_RATE_BUFFER0_MAX_FULLNESS_LEVEL, DSCC, id),\ 488 - SRI(DSCC_RATE_BUFFER1_MAX_FULLNESS_LEVEL, DSCC, id),\ 489 - SRI(DSCC_RATE_BUFFER2_MAX_FULLNESS_LEVEL, DSCC, id),\ 490 - SRI(DSCC_RATE_BUFFER3_MAX_FULLNESS_LEVEL, DSCC, id),\ 491 - SRI(DSCC_RATE_CONTROL_BUFFER0_MAX_FULLNESS_LEVEL, DSCC, id),\ 492 - SRI(DSCC_RATE_CONTROL_BUFFER1_MAX_FULLNESS_LEVEL, DSCC, id),\ 493 - SRI(DSCC_RATE_CONTROL_BUFFER2_MAX_FULLNESS_LEVEL, DSCC, id),\ 494 - SRI(DSCC_RATE_CONTROL_BUFFER3_MAX_FULLNESS_LEVEL, DSCC, id),\ 495 - SRI(DSCCIF_CONFIG0, DSCCIF, id),\ 496 - SRI(DSCCIF_CONFIG1, DSCCIF, id),\ 497 - SRI(DSCRM_DSC_FORWARD_CONFIG, DSCRM, id) 498 - 499 - #define DSC_REG_LIST_SH_MASK_DCN314(mask_sh)\ 500 - DSC_SF(DSC_TOP0_DSC_TOP_CONTROL, DSC_CLOCK_EN, mask_sh), \ 501 - DSC_SF(DSC_TOP0_DSC_TOP_CONTROL, DSC_DISPCLK_R_GATE_DIS, mask_sh), \ 502 - DSC_SF(DSC_TOP0_DSC_TOP_CONTROL, DSC_DSCCLK_R_GATE_DIS, mask_sh), \ 503 - DSC_SF(DSC_TOP0_DSC_DEBUG_CONTROL, DSC_DBG_EN, mask_sh), \ 504 - DSC_SF(DSC_TOP0_DSC_DEBUG_CONTROL, DSC_TEST_CLOCK_MUX_SEL, mask_sh), \ 505 - DSC_SF(DSCC0_DSCC_CONFIG0, NUMBER_OF_SLICES_PER_LINE, mask_sh), \ 506 - DSC_SF(DSCC0_DSCC_CONFIG0, ALTERNATE_ICH_ENCODING_EN, mask_sh), \ 507 - DSC_SF(DSCC0_DSCC_CONFIG0, NUMBER_OF_SLICES_IN_VERTICAL_DIRECTION, mask_sh), \ 508 - DSC_SF(DSCC0_DSCC_CONFIG1, DSCC_RATE_CONTROL_BUFFER_MODEL_SIZE, mask_sh), \ 509 - /*DSC_SF(DSCC0_DSCC_CONFIG1, DSCC_DISABLE_ICH, mask_sh),*/ \ 510 - DSC_SF(DSCC0_DSCC_STATUS, DSCC_DOUBLE_BUFFER_REG_UPDATE_PENDING, mask_sh), \ 511 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_OVERFLOW_OCCURRED, mask_sh), \ 512 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_OVERFLOW_OCCURRED, mask_sh), \ 513 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_OVERFLOW_OCCURRED, mask_sh), \ 514 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_OVERFLOW_OCCURRED, mask_sh), \ 515 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_UNDERFLOW_OCCURRED, mask_sh), \ 516 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_UNDERFLOW_OCCURRED, mask_sh), \ 517 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_UNDERFLOW_OCCURRED, mask_sh), \ 518 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_UNDERFLOW_OCCURRED, mask_sh), \ 519 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL0_OVERFLOW_OCCURRED, mask_sh), \ 520 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL1_OVERFLOW_OCCURRED, mask_sh), \ 521 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL2_OVERFLOW_OCCURRED, mask_sh), \ 522 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL3_OVERFLOW_OCCURRED, mask_sh), \ 523 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 524 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 525 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 526 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 527 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \ 528 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \ 529 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \ 530 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \ 531 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL0_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 532 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL1_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 533 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL2_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 534 - DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL3_OVERFLOW_OCCURRED_INT_EN, mask_sh), \ 535 - DSC_SF(DSCC0_DSCC_PPS_CONFIG0, DSC_VERSION_MINOR, mask_sh), \ 536 - DSC_SF(DSCC0_DSCC_PPS_CONFIG0, DSC_VERSION_MAJOR, mask_sh), \ 537 - DSC_SF(DSCC0_DSCC_PPS_CONFIG0, PPS_IDENTIFIER, mask_sh), \ 538 - DSC_SF(DSCC0_DSCC_PPS_CONFIG0, LINEBUF_DEPTH, mask_sh), \ 539 - DSC2_SF(DSCC0, DSCC_PPS_CONFIG0__BITS_PER_COMPONENT, mask_sh), \ 540 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, BITS_PER_PIXEL, mask_sh), \ 541 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, VBR_ENABLE, mask_sh), \ 542 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, SIMPLE_422, mask_sh), \ 543 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, CONVERT_RGB, mask_sh), \ 544 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, BLOCK_PRED_ENABLE, mask_sh), \ 545 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, NATIVE_422, mask_sh), \ 546 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, NATIVE_420, mask_sh), \ 547 - DSC_SF(DSCC0_DSCC_PPS_CONFIG1, CHUNK_SIZE, mask_sh), \ 548 - DSC_SF(DSCC0_DSCC_PPS_CONFIG2, PIC_WIDTH, mask_sh), \ 549 - DSC_SF(DSCC0_DSCC_PPS_CONFIG2, PIC_HEIGHT, mask_sh), \ 550 - DSC_SF(DSCC0_DSCC_PPS_CONFIG3, SLICE_WIDTH, mask_sh), \ 551 - DSC_SF(DSCC0_DSCC_PPS_CONFIG3, SLICE_HEIGHT, mask_sh), \ 552 - DSC_SF(DSCC0_DSCC_PPS_CONFIG4, INITIAL_XMIT_DELAY, mask_sh), \ 553 - DSC_SF(DSCC0_DSCC_PPS_CONFIG4, INITIAL_DEC_DELAY, mask_sh), \ 554 - DSC_SF(DSCC0_DSCC_PPS_CONFIG5, INITIAL_SCALE_VALUE, mask_sh), \ 555 - DSC_SF(DSCC0_DSCC_PPS_CONFIG5, SCALE_INCREMENT_INTERVAL, mask_sh), \ 556 - DSC_SF(DSCC0_DSCC_PPS_CONFIG6, SCALE_DECREMENT_INTERVAL, mask_sh), \ 557 - DSC_SF(DSCC0_DSCC_PPS_CONFIG6, FIRST_LINE_BPG_OFFSET, mask_sh), \ 558 - DSC_SF(DSCC0_DSCC_PPS_CONFIG6, SECOND_LINE_BPG_OFFSET, mask_sh), \ 559 - DSC_SF(DSCC0_DSCC_PPS_CONFIG7, NFL_BPG_OFFSET, mask_sh), \ 560 - DSC_SF(DSCC0_DSCC_PPS_CONFIG7, SLICE_BPG_OFFSET, mask_sh), \ 561 - DSC_SF(DSCC0_DSCC_PPS_CONFIG8, NSL_BPG_OFFSET, mask_sh), \ 562 - DSC_SF(DSCC0_DSCC_PPS_CONFIG8, SECOND_LINE_OFFSET_ADJ, mask_sh), \ 563 - DSC_SF(DSCC0_DSCC_PPS_CONFIG9, INITIAL_OFFSET, mask_sh), \ 564 - DSC_SF(DSCC0_DSCC_PPS_CONFIG9, FINAL_OFFSET, mask_sh), \ 565 - DSC_SF(DSCC0_DSCC_PPS_CONFIG10, FLATNESS_MIN_QP, mask_sh), \ 566 - DSC_SF(DSCC0_DSCC_PPS_CONFIG10, FLATNESS_MAX_QP, mask_sh), \ 567 - DSC_SF(DSCC0_DSCC_PPS_CONFIG10, RC_MODEL_SIZE, mask_sh), \ 568 - DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_EDGE_FACTOR, mask_sh), \ 569 - DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_QUANT_INCR_LIMIT0, mask_sh), \ 570 - DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_QUANT_INCR_LIMIT1, mask_sh), \ 571 - DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_TGT_OFFSET_LO, mask_sh), \ 572 - DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_TGT_OFFSET_HI, mask_sh), \ 573 - DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH0, mask_sh), \ 574 - DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH1, mask_sh), \ 575 - DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH2, mask_sh), \ 576 - DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH3, mask_sh), \ 577 - DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH4, mask_sh), \ 578 - DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH5, mask_sh), \ 579 - DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH6, mask_sh), \ 580 - DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH7, mask_sh), \ 581 - DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH8, mask_sh), \ 582 - DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH9, mask_sh), \ 583 - DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH10, mask_sh), \ 584 - DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH11, mask_sh), \ 585 - DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RC_BUF_THRESH12, mask_sh), \ 586 - DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RC_BUF_THRESH13, mask_sh), \ 587 - DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RANGE_MIN_QP0, mask_sh), \ 588 - DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RANGE_MAX_QP0, mask_sh), \ 589 - DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RANGE_BPG_OFFSET0, mask_sh), \ 590 - DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MIN_QP1, mask_sh), \ 591 - DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MAX_QP1, mask_sh), \ 592 - DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_BPG_OFFSET1, mask_sh), \ 593 - DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MIN_QP2, mask_sh), \ 594 - DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MAX_QP2, mask_sh), \ 595 - DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_BPG_OFFSET2, mask_sh), \ 596 - DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MIN_QP3, mask_sh), \ 597 - DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MAX_QP3, mask_sh), \ 598 - DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_BPG_OFFSET3, mask_sh), \ 599 - DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MIN_QP4, mask_sh), \ 600 - DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MAX_QP4, mask_sh), \ 601 - DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_BPG_OFFSET4, mask_sh), \ 602 - DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MIN_QP5, mask_sh), \ 603 - DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MAX_QP5, mask_sh), \ 604 - DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_BPG_OFFSET5, mask_sh), \ 605 - DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MIN_QP6, mask_sh), \ 606 - DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MAX_QP6, mask_sh), \ 607 - DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_BPG_OFFSET6, mask_sh), \ 608 - DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MIN_QP7, mask_sh), \ 609 - DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MAX_QP7, mask_sh), \ 610 - DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_BPG_OFFSET7, mask_sh), \ 611 - DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MIN_QP8, mask_sh), \ 612 - DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MAX_QP8, mask_sh), \ 613 - DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_BPG_OFFSET8, mask_sh), \ 614 - DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MIN_QP9, mask_sh), \ 615 - DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MAX_QP9, mask_sh), \ 616 - DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_BPG_OFFSET9, mask_sh), \ 617 - DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MIN_QP10, mask_sh), \ 618 - DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MAX_QP10, mask_sh), \ 619 - DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_BPG_OFFSET10, mask_sh), \ 620 - DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MIN_QP11, mask_sh), \ 621 - DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MAX_QP11, mask_sh), \ 622 - DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_BPG_OFFSET11, mask_sh), \ 623 - DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MIN_QP12, mask_sh), \ 624 - DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MAX_QP12, mask_sh), \ 625 - DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_BPG_OFFSET12, mask_sh), \ 626 - DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MIN_QP13, mask_sh), \ 627 - DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MAX_QP13, mask_sh), \ 628 - DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_BPG_OFFSET13, mask_sh), \ 629 - DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MIN_QP14, mask_sh), \ 630 - DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MAX_QP14, mask_sh), \ 631 - DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_BPG_OFFSET14, mask_sh), \ 632 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_DEFAULT_MEM_LOW_POWER_STATE, mask_sh), \ 633 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_MEM_PWR_FORCE, mask_sh), \ 634 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_MEM_PWR_DIS, mask_sh), \ 635 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_MEM_PWR_STATE, mask_sh), \ 636 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_NATIVE_422_MEM_PWR_FORCE, mask_sh), \ 637 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_NATIVE_422_MEM_PWR_DIS, mask_sh), \ 638 - DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_NATIVE_422_MEM_PWR_STATE, mask_sh), \ 639 - DSC_SF(DSCC0_DSCC_R_Y_SQUARED_ERROR_LOWER, DSCC_R_Y_SQUARED_ERROR_LOWER, mask_sh), \ 640 - DSC_SF(DSCC0_DSCC_R_Y_SQUARED_ERROR_UPPER, DSCC_R_Y_SQUARED_ERROR_UPPER, mask_sh), \ 641 - DSC_SF(DSCC0_DSCC_G_CB_SQUARED_ERROR_LOWER, DSCC_G_CB_SQUARED_ERROR_LOWER, mask_sh), \ 642 - DSC_SF(DSCC0_DSCC_G_CB_SQUARED_ERROR_UPPER, DSCC_G_CB_SQUARED_ERROR_UPPER, mask_sh), \ 643 - DSC_SF(DSCC0_DSCC_B_CR_SQUARED_ERROR_LOWER, DSCC_B_CR_SQUARED_ERROR_LOWER, mask_sh), \ 644 - DSC_SF(DSCC0_DSCC_B_CR_SQUARED_ERROR_UPPER, DSCC_B_CR_SQUARED_ERROR_UPPER, mask_sh), \ 645 - DSC_SF(DSCC0_DSCC_MAX_ABS_ERROR0, DSCC_R_Y_MAX_ABS_ERROR, mask_sh), \ 646 - DSC_SF(DSCC0_DSCC_MAX_ABS_ERROR0, DSCC_G_CB_MAX_ABS_ERROR, mask_sh), \ 647 - DSC_SF(DSCC0_DSCC_MAX_ABS_ERROR1, DSCC_B_CR_MAX_ABS_ERROR, mask_sh), \ 648 - DSC_SF(DSCC0_DSCC_RATE_BUFFER0_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER0_MAX_FULLNESS_LEVEL, mask_sh), \ 649 - DSC_SF(DSCC0_DSCC_RATE_BUFFER1_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER1_MAX_FULLNESS_LEVEL, mask_sh), \ 650 - DSC_SF(DSCC0_DSCC_RATE_BUFFER2_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER2_MAX_FULLNESS_LEVEL, mask_sh), \ 651 - DSC_SF(DSCC0_DSCC_RATE_BUFFER3_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER3_MAX_FULLNESS_LEVEL, mask_sh), \ 652 - DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER0_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER0_MAX_FULLNESS_LEVEL, mask_sh), \ 653 - DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER1_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER1_MAX_FULLNESS_LEVEL, mask_sh), \ 654 - DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER2_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER2_MAX_FULLNESS_LEVEL, mask_sh), \ 655 - DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER3_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER3_MAX_FULLNESS_LEVEL, mask_sh), \ 656 - DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_INTERFACE_UNDERFLOW_RECOVERY_EN, mask_sh), \ 657 - DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_INTERFACE_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \ 658 - DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_INTERFACE_UNDERFLOW_OCCURRED_STATUS, mask_sh), \ 659 - DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_PIXEL_FORMAT, mask_sh), \ 660 - DSC2_SF(DSCCIF0, DSCCIF_CONFIG0__BITS_PER_COMPONENT, mask_sh), \ 661 - DSC_SF(DSCCIF0_DSCCIF_CONFIG0, DOUBLE_BUFFER_REG_UPDATE_PENDING, mask_sh), \ 662 - DSC_SF(DSCCIF0_DSCCIF_CONFIG1, PIC_WIDTH, mask_sh), \ 663 - DSC_SF(DSCCIF0_DSCCIF_CONFIG1, PIC_HEIGHT, mask_sh), \ 664 - DSC_SF(DSCRM0_DSCRM_DSC_FORWARD_CONFIG, DSCRM_DSC_FORWARD_EN, mask_sh), \ 665 - DSC_SF(DSCRM0_DSCRM_DSC_FORWARD_CONFIG, DSCRM_DSC_OPP_PIPE_SOURCE, mask_sh) 666 - 667 - 668 448 struct dcn20_dsc_registers { 669 449 uint32_t DSC_TOP_CONTROL; 670 450 uint32_t DSC_DEBUG_CONTROL;
+1
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
··· 1565 1565 /* Any updates are handled in dc interface, just need 1566 1566 * to apply existing for plane enable / opp change */ 1567 1567 if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed 1568 + || pipe_ctx->update_flags.bits.plane_changed 1568 1569 || pipe_ctx->stream->update_flags.bits.gamut_remap 1569 1570 || pipe_ctx->stream->update_flags.bits.out_csc) { 1570 1571 /* dpp/cm gamut remap*/
+1 -2
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c
··· 67 67 { 68 68 struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc); 69 69 70 - REG_UPDATE_2(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, 0, 71 - DIG_FIFO_READ_START_LEVEL, 0); 70 + REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, 0); 72 71 } 73 72 74 73 static void enc314_dp_set_odm_combine(
+2 -14
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c
··· 343 343 { 344 344 struct dc_stream_state *stream = pipe_ctx->stream; 345 345 unsigned int odm_combine_factor = 0; 346 - struct dc *dc = pipe_ctx->stream->ctx->dc; 347 346 bool two_pix_per_container = false; 348 347 349 348 two_pix_per_container = optc2_is_two_pixels_per_containter(&stream->timing); ··· 363 364 } else { 364 365 *k1_div = PIXEL_RATE_DIV_BY_1; 365 366 *k2_div = PIXEL_RATE_DIV_BY_4; 366 - if ((odm_combine_factor == 2) || dc->debug.enable_dp_dig_pixel_rate_div_policy) 367 + if (odm_combine_factor == 2) 367 368 *k2_div = PIXEL_RATE_DIV_BY_2; 368 369 } 369 370 } ··· 383 384 return; 384 385 385 386 odm_combine_factor = get_odm_config(pipe_ctx, NULL); 386 - if (optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing) || odm_combine_factor > 1 387 - || dcn314_is_dp_dig_pixel_rate_div_policy(pipe_ctx)) 387 + if (optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing) || odm_combine_factor > 1) 388 388 pix_per_cycle = 2; 389 389 390 390 if (pipe_ctx->stream_res.stream_enc->funcs->set_input_mode) 391 391 pipe_ctx->stream_res.stream_enc->funcs->set_input_mode(pipe_ctx->stream_res.stream_enc, 392 392 pix_per_cycle); 393 - } 394 - 395 - bool dcn314_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx) 396 - { 397 - struct dc *dc = pipe_ctx->stream->ctx->dc; 398 - 399 - if (dc_is_dp_signal(pipe_ctx->stream->signal) && !is_dp_128b_132b_signal(pipe_ctx) && 400 - dc->debug.enable_dp_dig_pixel_rate_div_policy) 401 - return true; 402 - return false; 403 393 }
-2
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h
··· 41 41 42 42 void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx); 43 43 44 - bool dcn314_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx); 45 - 46 44 #endif /* __DC_HWSS_DCN314_H__ */
-1
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c
··· 146 146 .setup_hpo_hw_control = dcn31_setup_hpo_hw_control, 147 147 .calculate_dccg_k1_k2_values = dcn314_calculate_dccg_k1_k2_values, 148 148 .set_pixels_per_cycle = dcn314_set_pixels_per_cycle, 149 - .is_dp_dig_pixel_rate_div_policy = dcn314_is_dp_dig_pixel_rate_div_policy, 150 149 }; 151 150 152 151 void dcn314_hw_sequencer_construct(struct dc *dc)
+7 -4
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
··· 87 87 #define DCHUBBUB_DEBUG_CTRL_0__DET_DEPTH__SHIFT 0x10 88 88 #define DCHUBBUB_DEBUG_CTRL_0__DET_DEPTH_MASK 0x01FF0000L 89 89 90 + #define DSCC0_DSCC_CONFIG0__ICH_RESET_AT_END_OF_LINE__SHIFT 0x0 91 + #define DSCC0_DSCC_CONFIG0__ICH_RESET_AT_END_OF_LINE_MASK 0x0000000FL 92 + 90 93 #include "reg_helper.h" 91 94 #include "dce/dmub_abm.h" 92 95 #include "dce/dmub_psr.h" ··· 582 579 583 580 #define dsc_regsDCN314(id)\ 584 581 [id] = {\ 585 - DSC_REG_LIST_DCN314(id)\ 582 + DSC_REG_LIST_DCN20(id)\ 586 583 } 587 584 588 585 static const struct dcn20_dsc_registers dsc_regs[] = { ··· 593 590 }; 594 591 595 592 static const struct dcn20_dsc_shift dsc_shift = { 596 - DSC_REG_LIST_SH_MASK_DCN314(__SHIFT) 593 + DSC_REG_LIST_SH_MASK_DCN20(__SHIFT) 597 594 }; 598 595 599 596 static const struct dcn20_dsc_mask dsc_mask = { 600 - DSC_REG_LIST_SH_MASK_DCN314(_MASK) 597 + DSC_REG_LIST_SH_MASK_DCN20(_MASK) 601 598 }; 602 599 603 600 static const struct dcn30_mpc_registers mpc_regs = { ··· 847 844 .num_ddc = 5, 848 845 .num_vmid = 16, 849 846 .num_mpc_3dlut = 2, 850 - .num_dsc = 4, 847 + .num_dsc = 3, 851 848 }; 852 849 853 850 static const struct dc_plane_cap plane_cap = {
+23 -1
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubp.c
··· 103 103 enum cursor_lines_per_chunk lpc = hubp2_get_lines_per_chunk( 104 104 attr->width, attr->color_format); 105 105 106 + //Round cursor width up to next multiple of 64 107 + uint32_t cursor_width = ((attr->width + 63) / 64) * 64; 108 + uint32_t cursor_height = attr->height; 109 + uint32_t cursor_size = cursor_width * cursor_height; 110 + 106 111 hubp->curs_attr = *attr; 107 112 108 113 REG_UPDATE(CURSOR_SURFACE_ADDRESS_HIGH, ··· 131 126 /* used to shift the cursor chunk request deadline */ 132 127 CURSOR0_CHUNK_HDL_ADJUST, 3); 133 128 134 - if (attr->width * attr->height * 4 > 16384) 129 + switch (attr->color_format) { 130 + case CURSOR_MODE_MONO: 131 + cursor_size /= 2; 132 + break; 133 + case CURSOR_MODE_COLOR_1BIT_AND: 134 + case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA: 135 + case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA: 136 + cursor_size *= 4; 137 + break; 138 + 139 + case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED: 140 + case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED: 141 + default: 142 + cursor_size *= 8; 143 + break; 144 + } 145 + 146 + if (cursor_size > 16384) 135 147 REG_UPDATE(DCHUBP_MALL_CONFIG, USE_MALL_FOR_CURSOR, true); 136 148 else 137 149 REG_UPDATE(DCHUBP_MALL_CONFIG, USE_MALL_FOR_CURSOR, false);
+23 -1
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
··· 741 741 struct hubp *hubp = pipe->plane_res.hubp; 742 742 743 743 if (pipe->stream && pipe->plane_state && hubp && hubp->funcs->hubp_update_mall_sel) { 744 - if (hubp->curs_attr.width * hubp->curs_attr.height * 4 > 16384) 744 + //Round cursor width up to next multiple of 64 745 + int cursor_width = ((hubp->curs_attr.width + 63) / 64) * 64; 746 + int cursor_height = hubp->curs_attr.height; 747 + int cursor_size = cursor_width * cursor_height; 748 + 749 + switch (hubp->curs_attr.color_format) { 750 + case CURSOR_MODE_MONO: 751 + cursor_size /= 2; 752 + break; 753 + case CURSOR_MODE_COLOR_1BIT_AND: 754 + case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA: 755 + case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA: 756 + cursor_size *= 4; 757 + break; 758 + 759 + case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED: 760 + case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED: 761 + default: 762 + cursor_size *= 8; 763 + break; 764 + } 765 + 766 + if (cursor_size > 16384) 745 767 cache_cursor = true; 746 768 747 769 if (pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
+3 -1
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
··· 871 871 .exit_idle_opt_for_cursor_updates = true, 872 872 .enable_single_display_2to1_odm_policy = true, 873 873 .enable_dp_dig_pixel_rate_div_policy = 1, 874 + .allow_sw_cursor_fallback = false, 874 875 }; 875 876 876 877 static const struct dc_debug_options debug_defaults_diags = { ··· 2040 2039 dc->caps.max_downscale_ratio = 600; 2041 2040 dc->caps.i2c_speed_in_khz = 100; 2042 2041 dc->caps.i2c_speed_in_khz_hdcp = 100; /*1.4 w/a applied by default*/ 2043 - dc->caps.max_cursor_size = 256; 2042 + /* TODO: Bring max_cursor_size back to 256 after subvp cursor corruption is fixed*/ 2043 + dc->caps.max_cursor_size = 64; 2044 2044 dc->caps.min_horizontal_blanking_period = 80; 2045 2045 dc->caps.dmdata_alloc_size = 2048; 2046 2046 dc->caps.mall_size_per_mem_channel = 0;
+3
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h
··· 30 30 31 31 #define DCN3_2_DET_SEG_SIZE 64 32 32 #define DCN3_2_MALL_MBLK_SIZE_BYTES 65536 // 64 * 1024 33 + #define DCN3_2_MBLK_WIDTH 128 34 + #define DCN3_2_MBLK_HEIGHT_4BPE 128 35 + #define DCN3_2_MBLK_HEIGHT_8BPE 64 33 36 34 37 #define TO_DCN32_RES_POOL(pool)\ 35 38 container_of(pool, struct dcn32_resource_pool, base)
+51 -8
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
··· 46 46 uint32_t dcn32_helper_calculate_num_ways_for_subvp(struct dc *dc, struct dc_state *context) 47 47 { 48 48 uint32_t num_ways = 0; 49 - uint32_t mall_region_pixels = 0; 50 49 uint32_t bytes_per_pixel = 0; 51 50 uint32_t cache_lines_used = 0; 52 51 uint32_t lines_per_way = 0; ··· 53 54 uint32_t bytes_in_mall = 0; 54 55 uint32_t num_mblks = 0; 55 56 uint32_t cache_lines_per_plane = 0; 56 - uint32_t i = 0; 57 + uint32_t i = 0, j = 0; 58 + uint32_t mblk_width = 0; 59 + uint32_t mblk_height = 0; 60 + uint32_t full_vp_width_blk_aligned = 0; 61 + uint32_t full_vp_height_blk_aligned = 0; 62 + uint32_t mall_alloc_width_blk_aligned = 0; 63 + uint32_t mall_alloc_height_blk_aligned = 0; 64 + uint32_t full_vp_height = 0; 57 65 58 66 for (i = 0; i < dc->res_pool->pipe_count; i++) { 59 67 struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; 60 68 61 69 // Find the phantom pipes 62 - if (pipe->stream && pipe->plane_state && !pipe->top_pipe && 70 + if (pipe->stream && pipe->plane_state && !pipe->top_pipe && !pipe->prev_odm_pipe && 63 71 pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) { 64 - bytes_per_pixel = pipe->plane_state->format >= SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4; 65 - mall_region_pixels = pipe->plane_state->plane_size.surface_pitch * pipe->stream->timing.v_addressable; 72 + struct pipe_ctx *main_pipe = NULL; 66 73 67 - // For bytes required in MALL, calculate based on number of MBlks required 68 - num_mblks = (mall_region_pixels * bytes_per_pixel + 69 - DCN3_2_MALL_MBLK_SIZE_BYTES - 1) / DCN3_2_MALL_MBLK_SIZE_BYTES; 74 + /* Get full viewport height from main pipe (required for MBLK calculation) */ 75 + for (j = 0; j < dc->res_pool->pipe_count; j++) { 76 + main_pipe = &context->res_ctx.pipe_ctx[j]; 77 + if (main_pipe->stream == pipe->stream->mall_stream_config.paired_stream) { 78 + full_vp_height = main_pipe->plane_res.scl_data.viewport.height; 79 + break; 80 + } 81 + } 82 + 83 + bytes_per_pixel = pipe->plane_state->format >= SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4; 84 + mblk_width = DCN3_2_MBLK_WIDTH; 85 + mblk_height = bytes_per_pixel == 4 ? DCN3_2_MBLK_HEIGHT_4BPE : DCN3_2_MBLK_HEIGHT_8BPE; 86 + 87 + /* full_vp_width_blk_aligned = FLOOR(vp_x_start + full_vp_width + blk_width - 1, blk_width) - 88 + * FLOOR(vp_x_start, blk_width) 89 + */ 90 + full_vp_width_blk_aligned = ((pipe->plane_res.scl_data.viewport.x + 91 + pipe->plane_res.scl_data.viewport.width + mblk_width - 1) / mblk_width * mblk_width) + 92 + (pipe->plane_res.scl_data.viewport.x / mblk_width * mblk_width); 93 + 94 + /* full_vp_height_blk_aligned = FLOOR(vp_y_start + full_vp_height + blk_height - 1, blk_height) - 95 + * FLOOR(vp_y_start, blk_height) 96 + */ 97 + full_vp_height_blk_aligned = ((pipe->plane_res.scl_data.viewport.y + 98 + full_vp_height + mblk_height - 1) / mblk_height * mblk_height) + 99 + (pipe->plane_res.scl_data.viewport.y / mblk_height * mblk_height); 100 + 101 + /* mall_alloc_width_blk_aligned_l/c = full_vp_width_blk_aligned_l/c */ 102 + mall_alloc_width_blk_aligned = full_vp_width_blk_aligned; 103 + 104 + /* mall_alloc_height_blk_aligned_l/c = CEILING(sub_vp_height_l/c - 1, blk_height_l/c) + blk_height_l/c */ 105 + mall_alloc_height_blk_aligned = (pipe->stream->timing.v_addressable - 1 + mblk_height - 1) / 106 + mblk_height * mblk_height + mblk_height; 107 + 108 + /* full_mblk_width_ub_l/c = mall_alloc_width_blk_aligned_l/c; 109 + * full_mblk_height_ub_l/c = mall_alloc_height_blk_aligned_l/c; 110 + * num_mblk_l/c = (full_mblk_width_ub_l/c / mblk_width_l/c) * (full_mblk_height_ub_l/c / mblk_height_l/c); 111 + * (Should be divisible, but round up if not) 112 + */ 113 + num_mblks = ((mall_alloc_width_blk_aligned + mblk_width - 1) / mblk_width) * 114 + ((mall_alloc_height_blk_aligned + mblk_height - 1) / mblk_height); 70 115 bytes_in_mall = num_mblks * DCN3_2_MALL_MBLK_SIZE_BYTES; 71 116 // cache lines used is total bytes / cache_line size. Add +2 for worst case alignment 72 117 // (MALL is 64-byte aligned)
+3 -1
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c
··· 872 872 .exit_idle_opt_for_cursor_updates = true, 873 873 .enable_single_display_2to1_odm_policy = true, 874 874 .enable_dp_dig_pixel_rate_div_policy = 1, 875 + .allow_sw_cursor_fallback = false, 875 876 }; 876 877 877 878 static const struct dc_debug_options debug_defaults_diags = { ··· 1652 1651 dc->caps.max_downscale_ratio = 600; 1653 1652 dc->caps.i2c_speed_in_khz = 100; 1654 1653 dc->caps.i2c_speed_in_khz_hdcp = 100; /*1.4 w/a applied by default*/ 1655 - dc->caps.max_cursor_size = 256; 1654 + /* TODO: Bring max cursor size back to 256 after subvp cursor corruption is fixed*/ 1655 + dc->caps.max_cursor_size = 64; 1656 1656 dc->caps.min_horizontal_blanking_period = 80; 1657 1657 dc->caps.dmdata_alloc_size = 2048; 1658 1658 dc->caps.mall_size_per_mem_channel = 0;
+3
drivers/gpu/drm/amd/display/dc/dml/Makefile
··· 70 70 CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_rq_dlg_calc_30.o := $(dml_ccflags) 71 71 CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_mode_vba_31.o := $(dml_ccflags) $(frame_warn_flag) 72 72 CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_rq_dlg_calc_31.o := $(dml_ccflags) 73 + CFLAGS_$(AMDDALPATH)/dc/dml/dcn314/display_mode_vba_314.o := $(dml_ccflags) $(frame_warn_flag) 74 + CFLAGS_$(AMDDALPATH)/dc/dml/dcn314/display_rq_dlg_calc_314.o := $(dml_ccflags) 73 75 CFLAGS_$(AMDDALPATH)/dc/dml/dcn314/dcn314_fpu.o := $(dml_ccflags) 74 76 CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/dcn30_fpu.o := $(dml_ccflags) 75 77 CFLAGS_$(AMDDALPATH)/dc/dml/dcn32/dcn32_fpu.o := $(dml_ccflags) ··· 125 123 DML += dcn21/display_rq_dlg_calc_21.o dcn21/display_mode_vba_21.o 126 124 DML += dcn30/dcn30_fpu.o dcn30/display_mode_vba_30.o dcn30/display_rq_dlg_calc_30.o 127 125 DML += dcn31/display_mode_vba_31.o dcn31/display_rq_dlg_calc_31.o 126 + DML += dcn314/display_mode_vba_314.o dcn314/display_rq_dlg_calc_314.o 128 127 DML += dcn32/display_mode_vba_32.o dcn32/display_rq_dlg_calc_32.o dcn32/display_mode_vba_util_32.o 129 128 DML += dcn31/dcn31_fpu.o 130 129 DML += dcn32/dcn32_fpu.o
+1 -2
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
··· 6610 6610 return ret; 6611 6611 } 6612 6612 6613 - 6614 - static void UseMinimumDCFCLK( 6613 + static noinline_for_stack void UseMinimumDCFCLK( 6615 6614 struct display_mode_lib *mode_lib, 6616 6615 int MaxInterDCNTileRepeaters, 6617 6616 int MaxPrefetchMode,
+6 -1
drivers/gpu/drm/amd/display/dc/dml/dcn31/dcn31_fpu.c
··· 291 291 .do_urgent_latency_adjustment = false, 292 292 .urgent_latency_adjustment_fabric_clock_component_us = 0, 293 293 .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, 294 + .num_chans = 4, 294 295 }; 295 296 296 297 struct _vcs_dpi_ip_params_st dcn3_16_ip = { ··· 681 680 682 681 dcn3_15_ip.max_num_otg = dc->res_pool->res_cap->num_timing_generator; 683 682 dcn3_15_ip.max_num_dpp = dc->res_pool->pipe_count; 684 - dcn3_15_soc.num_chans = bw_params->num_channels; 683 + 684 + if (bw_params->num_channels > 0) 685 + dcn3_15_soc.num_chans = bw_params->num_channels; 686 + if (bw_params->dram_channel_width_bytes > 0) 687 + dcn3_15_soc.dram_channel_width_bytes = bw_params->dram_channel_width_bytes; 685 688 686 689 ASSERT(clk_table->num_entries); 687 690
+99 -321
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
··· 251 251 252 252 static void CalculateFlipSchedule( 253 253 struct display_mode_lib *mode_lib, 254 + unsigned int k, 254 255 double HostVMInefficiencyFactor, 255 256 double UrgentExtraLatency, 256 257 double UrgentLatency, 257 - unsigned int GPUVMMaxPageTableLevels, 258 - bool HostVMEnable, 259 - unsigned int HostVMMaxNonCachedPageTableLevels, 260 - bool GPUVMEnable, 261 - double HostVMMinPageSize, 262 258 double PDEAndMetaPTEBytesPerFrame, 263 259 double MetaRowBytes, 264 - double DPTEBytesPerRow, 265 - double BandwidthAvailableForImmediateFlip, 266 - unsigned int TotImmediateFlipBytes, 267 - enum source_format_class SourcePixelFormat, 268 - double LineTime, 269 - double VRatio, 270 - double VRatioChroma, 271 - double Tno_bw, 272 - bool DCCEnable, 273 - unsigned int dpte_row_height, 274 - unsigned int meta_row_height, 275 - unsigned int dpte_row_height_chroma, 276 - unsigned int meta_row_height_chroma, 277 - double *DestinationLinesToRequestVMInImmediateFlip, 278 - double *DestinationLinesToRequestRowInImmediateFlip, 279 - double *final_flip_bw, 280 - bool *ImmediateFlipSupportedForPipe); 260 + double DPTEBytesPerRow); 281 261 static double CalculateWriteBackDelay( 282 262 enum source_format_class WritebackPixelFormat, 283 263 double WritebackHRatio, ··· 291 311 static void CalculateWatermarksAndDRAMSpeedChangeSupport( 292 312 struct display_mode_lib *mode_lib, 293 313 unsigned int PrefetchMode, 294 - unsigned int NumberOfActivePlanes, 295 - unsigned int MaxLineBufferLines, 296 - unsigned int LineBufferSize, 297 - unsigned int WritebackInterfaceBufferSize, 298 314 double DCFCLK, 299 315 double ReturnBW, 300 - bool SynchronizedVBlank, 301 - unsigned int dpte_group_bytes[], 302 - unsigned int MetaChunkSize, 303 316 double UrgentLatency, 304 317 double ExtraLatency, 305 - double WritebackLatency, 306 - double WritebackChunkSize, 307 318 double SOCCLK, 308 - double DRAMClockChangeLatency, 309 - double SRExitTime, 310 - double SREnterPlusExitTime, 311 - double SRExitZ8Time, 312 - double SREnterPlusExitZ8Time, 313 319 double DCFCLKDeepSleep, 314 320 unsigned int DETBufferSizeY[], 315 321 unsigned int DETBufferSizeC[], 316 322 unsigned int SwathHeightY[], 317 323 unsigned int SwathHeightC[], 318 - unsigned int LBBitPerPixel[], 319 324 double SwathWidthY[], 320 325 double SwathWidthC[], 321 - double HRatio[], 322 - double HRatioChroma[], 323 - unsigned int vtaps[], 324 - unsigned int VTAPsChroma[], 325 - double VRatio[], 326 - double VRatioChroma[], 327 - unsigned int HTotal[], 328 - double PixelClock[], 329 - unsigned int BlendingAndTiming[], 330 326 unsigned int DPPPerPlane[], 331 327 double BytePerPixelDETY[], 332 328 double BytePerPixelDETC[], 333 - double DSTXAfterScaler[], 334 - double DSTYAfterScaler[], 335 - bool WritebackEnable[], 336 - enum source_format_class WritebackPixelFormat[], 337 - double WritebackDestinationWidth[], 338 - double WritebackDestinationHeight[], 339 - double WritebackSourceHeight[], 340 329 bool UnboundedRequestEnabled, 341 330 int unsigned CompressedBufferSizeInkByte, 342 331 enum clock_change_support *DRAMClockChangeSupport, 343 - double *UrgentWatermark, 344 - double *WritebackUrgentWatermark, 345 - double *DRAMClockChangeWatermark, 346 - double *WritebackDRAMClockChangeWatermark, 347 332 double *StutterExitWatermark, 348 333 double *StutterEnterPlusExitWatermark, 349 334 double *Z8StutterExitWatermark, 350 - double *Z8StutterEnterPlusExitWatermark, 351 - double *MinActiveDRAMClockChangeLatencySupported); 335 + double *Z8StutterEnterPlusExitWatermark); 352 336 353 337 static void CalculateDCFCLKDeepSleep( 354 338 struct display_mode_lib *mode_lib, ··· 2848 2904 for (k = 0; k < v->NumberOfActivePlanes; ++k) { 2849 2905 CalculateFlipSchedule( 2850 2906 mode_lib, 2907 + k, 2851 2908 HostVMInefficiencyFactor, 2852 2909 v->UrgentExtraLatency, 2853 2910 v->UrgentLatency, 2854 - v->GPUVMMaxPageTableLevels, 2855 - v->HostVMEnable, 2856 - v->HostVMMaxNonCachedPageTableLevels, 2857 - v->GPUVMEnable, 2858 - v->HostVMMinPageSize, 2859 2911 v->PDEAndMetaPTEBytesFrame[k], 2860 2912 v->MetaRowByte[k], 2861 - v->PixelPTEBytesPerRow[k], 2862 - v->BandwidthAvailableForImmediateFlip, 2863 - v->TotImmediateFlipBytes, 2864 - v->SourcePixelFormat[k], 2865 - v->HTotal[k] / v->PixelClock[k], 2866 - v->VRatio[k], 2867 - v->VRatioChroma[k], 2868 - v->Tno_bw[k], 2869 - v->DCCEnable[k], 2870 - v->dpte_row_height[k], 2871 - v->meta_row_height[k], 2872 - v->dpte_row_height_chroma[k], 2873 - v->meta_row_height_chroma[k], 2874 - &v->DestinationLinesToRequestVMInImmediateFlip[k], 2875 - &v->DestinationLinesToRequestRowInImmediateFlip[k], 2876 - &v->final_flip_bw[k], 2877 - &v->ImmediateFlipSupportedForPipe[k]); 2913 + v->PixelPTEBytesPerRow[k]); 2878 2914 } 2879 2915 2880 2916 v->total_dcn_read_bw_with_flip = 0.0; ··· 2941 3017 CalculateWatermarksAndDRAMSpeedChangeSupport( 2942 3018 mode_lib, 2943 3019 PrefetchMode, 2944 - v->NumberOfActivePlanes, 2945 - v->MaxLineBufferLines, 2946 - v->LineBufferSize, 2947 - v->WritebackInterfaceBufferSize, 2948 3020 v->DCFCLK, 2949 3021 v->ReturnBW, 2950 - v->SynchronizedVBlank, 2951 - v->dpte_group_bytes, 2952 - v->MetaChunkSize, 2953 3022 v->UrgentLatency, 2954 3023 v->UrgentExtraLatency, 2955 - v->WritebackLatency, 2956 - v->WritebackChunkSize, 2957 3024 v->SOCCLK, 2958 - v->DRAMClockChangeLatency, 2959 - v->SRExitTime, 2960 - v->SREnterPlusExitTime, 2961 - v->SRExitZ8Time, 2962 - v->SREnterPlusExitZ8Time, 2963 3025 v->DCFCLKDeepSleep, 2964 3026 v->DETBufferSizeY, 2965 3027 v->DETBufferSizeC, 2966 3028 v->SwathHeightY, 2967 3029 v->SwathHeightC, 2968 - v->LBBitPerPixel, 2969 3030 v->SwathWidthY, 2970 3031 v->SwathWidthC, 2971 - v->HRatio, 2972 - v->HRatioChroma, 2973 - v->vtaps, 2974 - v->VTAPsChroma, 2975 - v->VRatio, 2976 - v->VRatioChroma, 2977 - v->HTotal, 2978 - v->PixelClock, 2979 - v->BlendingAndTiming, 2980 3032 v->DPPPerPlane, 2981 3033 v->BytePerPixelDETY, 2982 3034 v->BytePerPixelDETC, 2983 - v->DSTXAfterScaler, 2984 - v->DSTYAfterScaler, 2985 - v->WritebackEnable, 2986 - v->WritebackPixelFormat, 2987 - v->WritebackDestinationWidth, 2988 - v->WritebackDestinationHeight, 2989 - v->WritebackSourceHeight, 2990 3035 v->UnboundedRequestEnabled, 2991 3036 v->CompressedBufferSizeInkByte, 2992 3037 &DRAMClockChangeSupport, 2993 - &v->UrgentWatermark, 2994 - &v->WritebackUrgentWatermark, 2995 - &v->DRAMClockChangeWatermark, 2996 - &v->WritebackDRAMClockChangeWatermark, 2997 3038 &v->StutterExitWatermark, 2998 3039 &v->StutterEnterPlusExitWatermark, 2999 3040 &v->Z8StutterExitWatermark, 3000 - &v->Z8StutterEnterPlusExitWatermark, 3001 - &v->MinActiveDRAMClockChangeLatencySupported); 3041 + &v->Z8StutterEnterPlusExitWatermark); 3002 3042 3003 3043 for (k = 0; k < v->NumberOfActivePlanes; ++k) { 3004 3044 if (v->WritebackEnable[k] == true) { ··· 3486 3598 3487 3599 static void CalculateFlipSchedule( 3488 3600 struct display_mode_lib *mode_lib, 3601 + unsigned int k, 3489 3602 double HostVMInefficiencyFactor, 3490 3603 double UrgentExtraLatency, 3491 3604 double UrgentLatency, 3492 - unsigned int GPUVMMaxPageTableLevels, 3493 - bool HostVMEnable, 3494 - unsigned int HostVMMaxNonCachedPageTableLevels, 3495 - bool GPUVMEnable, 3496 - double HostVMMinPageSize, 3497 3605 double PDEAndMetaPTEBytesPerFrame, 3498 3606 double MetaRowBytes, 3499 - double DPTEBytesPerRow, 3500 - double BandwidthAvailableForImmediateFlip, 3501 - unsigned int TotImmediateFlipBytes, 3502 - enum source_format_class SourcePixelFormat, 3503 - double LineTime, 3504 - double VRatio, 3505 - double VRatioChroma, 3506 - double Tno_bw, 3507 - bool DCCEnable, 3508 - unsigned int dpte_row_height, 3509 - unsigned int meta_row_height, 3510 - unsigned int dpte_row_height_chroma, 3511 - unsigned int meta_row_height_chroma, 3512 - double *DestinationLinesToRequestVMInImmediateFlip, 3513 - double *DestinationLinesToRequestRowInImmediateFlip, 3514 - double *final_flip_bw, 3515 - bool *ImmediateFlipSupportedForPipe) 3607 + double DPTEBytesPerRow) 3516 3608 { 3609 + struct vba_vars_st *v = &mode_lib->vba; 3517 3610 double min_row_time = 0.0; 3518 3611 unsigned int HostVMDynamicLevelsTrips; 3519 3612 double TimeForFetchingMetaPTEImmediateFlip; 3520 3613 double TimeForFetchingRowInVBlankImmediateFlip; 3521 3614 double ImmediateFlipBW; 3615 + double LineTime = v->HTotal[k] / v->PixelClock[k]; 3522 3616 3523 - if (GPUVMEnable == true && HostVMEnable == true) { 3524 - HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels; 3617 + if (v->GPUVMEnable == true && v->HostVMEnable == true) { 3618 + HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels; 3525 3619 } else { 3526 3620 HostVMDynamicLevelsTrips = 0; 3527 3621 } 3528 3622 3529 - if (GPUVMEnable == true || DCCEnable == true) { 3530 - ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes; 3623 + if (v->GPUVMEnable == true || v->DCCEnable[k] == true) { 3624 + ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes; 3531 3625 } 3532 3626 3533 - if (GPUVMEnable == true) { 3627 + if (v->GPUVMEnable == true) { 3534 3628 TimeForFetchingMetaPTEImmediateFlip = dml_max3( 3535 - Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, 3536 - UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), 3629 + v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, 3630 + UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), 3537 3631 LineTime / 4.0); 3538 3632 } else { 3539 3633 TimeForFetchingMetaPTEImmediateFlip = 0; 3540 3634 } 3541 3635 3542 - *DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; 3543 - if ((GPUVMEnable == true || DCCEnable == true)) { 3636 + v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; 3637 + if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) { 3544 3638 TimeForFetchingRowInVBlankImmediateFlip = dml_max3( 3545 3639 (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW, 3546 3640 UrgentLatency * (HostVMDynamicLevelsTrips + 1), ··· 3531 3661 TimeForFetchingRowInVBlankImmediateFlip = 0; 3532 3662 } 3533 3663 3534 - *DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; 3664 + v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; 3535 3665 3536 - if (GPUVMEnable == true) { 3537 - *final_flip_bw = dml_max( 3538 - PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime), 3539 - (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime)); 3540 - } else if ((GPUVMEnable == true || DCCEnable == true)) { 3541 - *final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime); 3666 + if (v->GPUVMEnable == true) { 3667 + v->final_flip_bw[k] = dml_max( 3668 + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime), 3669 + (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime)); 3670 + } else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) { 3671 + v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime); 3542 3672 } else { 3543 - *final_flip_bw = 0; 3673 + v->final_flip_bw[k] = 0; 3544 3674 } 3545 3675 3546 - if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) { 3547 - if (GPUVMEnable == true && DCCEnable != true) { 3548 - min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma); 3549 - } else if (GPUVMEnable != true && DCCEnable == true) { 3550 - min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma); 3676 + if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) { 3677 + if (v->GPUVMEnable == true && v->DCCEnable[k] != true) { 3678 + min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); 3679 + } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) { 3680 + min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); 3551 3681 } else { 3552 3682 min_row_time = dml_min4( 3553 - dpte_row_height * LineTime / VRatio, 3554 - meta_row_height * LineTime / VRatio, 3555 - dpte_row_height_chroma * LineTime / VRatioChroma, 3556 - meta_row_height_chroma * LineTime / VRatioChroma); 3683 + v->dpte_row_height[k] * LineTime / v->VRatio[k], 3684 + v->meta_row_height[k] * LineTime / v->VRatio[k], 3685 + v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k], 3686 + v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); 3557 3687 } 3558 3688 } else { 3559 - if (GPUVMEnable == true && DCCEnable != true) { 3560 - min_row_time = dpte_row_height * LineTime / VRatio; 3561 - } else if (GPUVMEnable != true && DCCEnable == true) { 3562 - min_row_time = meta_row_height * LineTime / VRatio; 3689 + if (v->GPUVMEnable == true && v->DCCEnable[k] != true) { 3690 + min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k]; 3691 + } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) { 3692 + min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k]; 3563 3693 } else { 3564 - min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio); 3694 + min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]); 3565 3695 } 3566 3696 } 3567 3697 3568 - if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16 3698 + if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16 3569 3699 || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) { 3570 - *ImmediateFlipSupportedForPipe = false; 3700 + v->ImmediateFlipSupportedForPipe[k] = false; 3571 3701 } else { 3572 - *ImmediateFlipSupportedForPipe = true; 3702 + v->ImmediateFlipSupportedForPipe[k] = true; 3573 3703 } 3574 3704 3575 3705 #ifdef __DML_VBA_DEBUG__ 3576 - dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip); 3577 - dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip); 3706 + dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]); 3707 + dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]); 3578 3708 dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip); 3579 3709 dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip); 3580 3710 dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time); 3581 - dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe); 3711 + dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]); 3582 3712 #endif 3583 3713 3584 3714 } ··· 5170 5300 for (k = 0; k < v->NumberOfActivePlanes; k++) { 5171 5301 CalculateFlipSchedule( 5172 5302 mode_lib, 5303 + k, 5173 5304 HostVMInefficiencyFactor, 5174 5305 v->ExtraLatency, 5175 5306 v->UrgLatency[i], 5176 - v->GPUVMMaxPageTableLevels, 5177 - v->HostVMEnable, 5178 - v->HostVMMaxNonCachedPageTableLevels, 5179 - v->GPUVMEnable, 5180 - v->HostVMMinPageSize, 5181 5307 v->PDEAndMetaPTEBytesPerFrame[i][j][k], 5182 5308 v->MetaRowBytes[i][j][k], 5183 - v->DPTEBytesPerRow[i][j][k], 5184 - v->BandwidthAvailableForImmediateFlip, 5185 - v->TotImmediateFlipBytes, 5186 - v->SourcePixelFormat[k], 5187 - v->HTotal[k] / v->PixelClock[k], 5188 - v->VRatio[k], 5189 - v->VRatioChroma[k], 5190 - v->Tno_bw[k], 5191 - v->DCCEnable[k], 5192 - v->dpte_row_height[k], 5193 - v->meta_row_height[k], 5194 - v->dpte_row_height_chroma[k], 5195 - v->meta_row_height_chroma[k], 5196 - &v->DestinationLinesToRequestVMInImmediateFlip[k], 5197 - &v->DestinationLinesToRequestRowInImmediateFlip[k], 5198 - &v->final_flip_bw[k], 5199 - &v->ImmediateFlipSupportedForPipe[k]); 5309 + v->DPTEBytesPerRow[i][j][k]); 5200 5310 } 5201 5311 v->total_dcn_read_bw_with_flip = 0.0; 5202 5312 for (k = 0; k < v->NumberOfActivePlanes; k++) { ··· 5234 5384 CalculateWatermarksAndDRAMSpeedChangeSupport( 5235 5385 mode_lib, 5236 5386 v->PrefetchModePerState[i][j], 5237 - v->NumberOfActivePlanes, 5238 - v->MaxLineBufferLines, 5239 - v->LineBufferSize, 5240 - v->WritebackInterfaceBufferSize, 5241 5387 v->DCFCLKState[i][j], 5242 5388 v->ReturnBWPerState[i][j], 5243 - v->SynchronizedVBlank, 5244 - v->dpte_group_bytes, 5245 - v->MetaChunkSize, 5246 5389 v->UrgLatency[i], 5247 5390 v->ExtraLatency, 5248 - v->WritebackLatency, 5249 - v->WritebackChunkSize, 5250 5391 v->SOCCLKPerState[i], 5251 - v->DRAMClockChangeLatency, 5252 - v->SRExitTime, 5253 - v->SREnterPlusExitTime, 5254 - v->SRExitZ8Time, 5255 - v->SREnterPlusExitZ8Time, 5256 5392 v->ProjectedDCFCLKDeepSleep[i][j], 5257 5393 v->DETBufferSizeYThisState, 5258 5394 v->DETBufferSizeCThisState, 5259 5395 v->SwathHeightYThisState, 5260 5396 v->SwathHeightCThisState, 5261 - v->LBBitPerPixel, 5262 5397 v->SwathWidthYThisState, 5263 5398 v->SwathWidthCThisState, 5264 - v->HRatio, 5265 - v->HRatioChroma, 5266 - v->vtaps, 5267 - v->VTAPsChroma, 5268 - v->VRatio, 5269 - v->VRatioChroma, 5270 - v->HTotal, 5271 - v->PixelClock, 5272 - v->BlendingAndTiming, 5273 5399 v->NoOfDPPThisState, 5274 5400 v->BytePerPixelInDETY, 5275 5401 v->BytePerPixelInDETC, 5276 - v->DSTXAfterScaler, 5277 - v->DSTYAfterScaler, 5278 - v->WritebackEnable, 5279 - v->WritebackPixelFormat, 5280 - v->WritebackDestinationWidth, 5281 - v->WritebackDestinationHeight, 5282 - v->WritebackSourceHeight, 5283 5402 UnboundedRequestEnabledThisState, 5284 5403 CompressedBufferSizeInkByteThisState, 5285 5404 &v->DRAMClockChangeSupport[i][j], 5286 - &v->UrgentWatermark, 5287 - &v->WritebackUrgentWatermark, 5288 - &v->DRAMClockChangeWatermark, 5289 - &v->WritebackDRAMClockChangeWatermark, 5290 5405 &dummy, 5291 5406 &dummy, 5292 5407 &dummy, 5293 - &dummy, 5294 - &v->MinActiveDRAMClockChangeLatencySupported); 5408 + &dummy); 5295 5409 } 5296 5410 } 5297 5411 ··· 5380 5566 static void CalculateWatermarksAndDRAMSpeedChangeSupport( 5381 5567 struct display_mode_lib *mode_lib, 5382 5568 unsigned int PrefetchMode, 5383 - unsigned int NumberOfActivePlanes, 5384 - unsigned int MaxLineBufferLines, 5385 - unsigned int LineBufferSize, 5386 - unsigned int WritebackInterfaceBufferSize, 5387 5569 double DCFCLK, 5388 5570 double ReturnBW, 5389 - bool SynchronizedVBlank, 5390 - unsigned int dpte_group_bytes[], 5391 - unsigned int MetaChunkSize, 5392 5571 double UrgentLatency, 5393 5572 double ExtraLatency, 5394 - double WritebackLatency, 5395 - double WritebackChunkSize, 5396 5573 double SOCCLK, 5397 - double DRAMClockChangeLatency, 5398 - double SRExitTime, 5399 - double SREnterPlusExitTime, 5400 - double SRExitZ8Time, 5401 - double SREnterPlusExitZ8Time, 5402 5574 double DCFCLKDeepSleep, 5403 5575 unsigned int DETBufferSizeY[], 5404 5576 unsigned int DETBufferSizeC[], 5405 5577 unsigned int SwathHeightY[], 5406 5578 unsigned int SwathHeightC[], 5407 - unsigned int LBBitPerPixel[], 5408 5579 double SwathWidthY[], 5409 5580 double SwathWidthC[], 5410 - double HRatio[], 5411 - double HRatioChroma[], 5412 - unsigned int vtaps[], 5413 - unsigned int VTAPsChroma[], 5414 - double VRatio[], 5415 - double VRatioChroma[], 5416 - unsigned int HTotal[], 5417 - double PixelClock[], 5418 - unsigned int BlendingAndTiming[], 5419 5581 unsigned int DPPPerPlane[], 5420 5582 double BytePerPixelDETY[], 5421 5583 double BytePerPixelDETC[], 5422 - double DSTXAfterScaler[], 5423 - double DSTYAfterScaler[], 5424 - bool WritebackEnable[], 5425 - enum source_format_class WritebackPixelFormat[], 5426 - double WritebackDestinationWidth[], 5427 - double WritebackDestinationHeight[], 5428 - double WritebackSourceHeight[], 5429 5584 bool UnboundedRequestEnabled, 5430 5585 int unsigned CompressedBufferSizeInkByte, 5431 5586 enum clock_change_support *DRAMClockChangeSupport, 5432 - double *UrgentWatermark, 5433 - double *WritebackUrgentWatermark, 5434 - double *DRAMClockChangeWatermark, 5435 - double *WritebackDRAMClockChangeWatermark, 5436 5587 double *StutterExitWatermark, 5437 5588 double *StutterEnterPlusExitWatermark, 5438 5589 double *Z8StutterExitWatermark, 5439 - double *Z8StutterEnterPlusExitWatermark, 5440 - double *MinActiveDRAMClockChangeLatencySupported) 5590 + double *Z8StutterEnterPlusExitWatermark) 5441 5591 { 5442 5592 struct vba_vars_st *v = &mode_lib->vba; 5443 5593 double EffectiveLBLatencyHidingY; ··· 5421 5643 double TotalPixelBW = 0.0; 5422 5644 int k, j; 5423 5645 5424 - *UrgentWatermark = UrgentLatency + ExtraLatency; 5646 + v->UrgentWatermark = UrgentLatency + ExtraLatency; 5425 5647 5426 5648 #ifdef __DML_VBA_DEBUG__ 5427 5649 dml_print("DML::%s: UrgentLatency = %f\n", __func__, UrgentLatency); 5428 5650 dml_print("DML::%s: ExtraLatency = %f\n", __func__, ExtraLatency); 5429 - dml_print("DML::%s: UrgentWatermark = %f\n", __func__, *UrgentWatermark); 5651 + dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->UrgentWatermark); 5430 5652 #endif 5431 5653 5432 - *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark; 5654 + v->DRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->UrgentWatermark; 5433 5655 5434 5656 #ifdef __DML_VBA_DEBUG__ 5435 - dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, DRAMClockChangeLatency); 5436 - dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, *DRAMClockChangeWatermark); 5657 + dml_print("DML::%s: v->DRAMClockChangeLatency = %f\n", __func__, v->DRAMClockChangeLatency); 5658 + dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->DRAMClockChangeWatermark); 5437 5659 #endif 5438 5660 5439 5661 v->TotalActiveWriteback = 0; 5440 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5441 - if (WritebackEnable[k] == true) { 5662 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5663 + if (v->WritebackEnable[k] == true) { 5442 5664 v->TotalActiveWriteback = v->TotalActiveWriteback + 1; 5443 5665 } 5444 5666 } 5445 5667 5446 5668 if (v->TotalActiveWriteback <= 1) { 5447 - *WritebackUrgentWatermark = WritebackLatency; 5669 + v->WritebackUrgentWatermark = v->WritebackLatency; 5448 5670 } else { 5449 - *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5671 + v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5450 5672 } 5451 5673 5452 5674 if (v->TotalActiveWriteback <= 1) { 5453 - *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency; 5675 + v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency; 5454 5676 } else { 5455 - *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5677 + v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5456 5678 } 5457 5679 5458 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5680 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5459 5681 TotalPixelBW = TotalPixelBW 5460 - + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k]) 5461 - / (HTotal[k] / PixelClock[k]); 5682 + + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k]) 5683 + / (v->HTotal[k] / v->PixelClock[k]); 5462 5684 } 5463 5685 5464 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5686 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5465 5687 double EffectiveDETBufferSizeY = DETBufferSizeY[k]; 5466 5688 5467 5689 v->LBLatencyHidingSourceLinesY = dml_min( 5468 - (double) MaxLineBufferLines, 5469 - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1); 5690 + (double) v->MaxLineBufferLines, 5691 + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1); 5470 5692 5471 5693 v->LBLatencyHidingSourceLinesC = dml_min( 5472 - (double) MaxLineBufferLines, 5473 - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1); 5694 + (double) v->MaxLineBufferLines, 5695 + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1); 5474 5696 5475 - EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]); 5697 + EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]); 5476 5698 5477 - EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]); 5699 + EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]); 5478 5700 5479 5701 if (UnboundedRequestEnabled) { 5480 5702 EffectiveDETBufferSizeY = EffectiveDETBufferSizeY 5481 - + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW; 5703 + + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW; 5482 5704 } 5483 5705 5484 5706 LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k]; 5485 5707 LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]); 5486 - FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k]; 5708 + FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k]; 5487 5709 if (BytePerPixelDETC[k] > 0) { 5488 5710 LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k]; 5489 5711 LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]); 5490 - FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k]; 5712 + FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k]; 5491 5713 } else { 5492 5714 LinesInDETC = 0; 5493 5715 FullDETBufferingTimeC = 999999; 5494 5716 } 5495 5717 5496 5718 ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY 5497 - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; 5719 + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark; 5498 5720 5499 - if (NumberOfActivePlanes > 1) { 5721 + if (v->NumberOfActivePlanes > 1) { 5500 5722 ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY 5501 - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k]; 5723 + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k]; 5502 5724 } 5503 5725 5504 5726 if (BytePerPixelDETC[k] > 0) { 5505 5727 ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC 5506 - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; 5728 + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark; 5507 5729 5508 - if (NumberOfActivePlanes > 1) { 5730 + if (v->NumberOfActivePlanes > 1) { 5509 5731 ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC 5510 - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k]; 5732 + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k]; 5511 5733 } 5512 5734 v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC); 5513 5735 } else { 5514 5736 v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY; 5515 5737 } 5516 5738 5517 - if (WritebackEnable[k] == true) { 5518 - WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024 5519 - / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4); 5520 - if (WritebackPixelFormat[k] == dm_444_64) { 5739 + if (v->WritebackEnable[k] == true) { 5740 + WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024 5741 + / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4); 5742 + if (v->WritebackPixelFormat[k] == dm_444_64) { 5521 5743 WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2; 5522 5744 } 5523 5745 WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark; ··· 5527 5749 5528 5750 v->MinActiveDRAMClockChangeMargin = 999999; 5529 5751 PlaneWithMinActiveDRAMClockChangeMargin = 0; 5530 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5752 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5531 5753 if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) { 5532 5754 v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k]; 5533 - if (BlendingAndTiming[k] == k) { 5755 + if (v->BlendingAndTiming[k] == k) { 5534 5756 PlaneWithMinActiveDRAMClockChangeMargin = k; 5535 5757 } else { 5536 - for (j = 0; j < NumberOfActivePlanes; ++j) { 5537 - if (BlendingAndTiming[k] == j) { 5758 + for (j = 0; j < v->NumberOfActivePlanes; ++j) { 5759 + if (v->BlendingAndTiming[k] == j) { 5538 5760 PlaneWithMinActiveDRAMClockChangeMargin = j; 5539 5761 } 5540 5762 } ··· 5542 5764 } 5543 5765 } 5544 5766 5545 - *MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency; 5767 + v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->DRAMClockChangeLatency ; 5546 5768 5547 5769 SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999; 5548 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5549 - if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) 5770 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5771 + if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) 5550 5772 && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) { 5551 5773 SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k]; 5552 5774 } ··· 5554 5776 5555 5777 v->TotalNumberOfActiveOTG = 0; 5556 5778 5557 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5558 - if (BlendingAndTiming[k] == k) { 5779 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5780 + if (v->BlendingAndTiming[k] == k) { 5559 5781 v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1; 5560 5782 } 5561 5783 } 5562 5784 5563 5785 if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) { 5564 5786 *DRAMClockChangeSupport = dm_dram_clock_change_vactive; 5565 - } else if ((SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 5787 + } else if ((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 5566 5788 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0) { 5567 5789 *DRAMClockChangeSupport = dm_dram_clock_change_vblank; 5568 5790 } else { 5569 5791 *DRAMClockChangeSupport = dm_dram_clock_change_unsupported; 5570 5792 } 5571 5793 5572 - *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep; 5573 - *StutterEnterPlusExitWatermark = (SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep); 5574 - *Z8StutterExitWatermark = SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5575 - *Z8StutterEnterPlusExitWatermark = SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5794 + *StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep; 5795 + *StutterEnterPlusExitWatermark = (v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep); 5796 + *Z8StutterExitWatermark = v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5797 + *Z8StutterEnterPlusExitWatermark = v->SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5576 5798 5577 5799 #ifdef __DML_VBA_DEBUG__ 5578 5800 dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, *StutterExitWatermark);
+4 -1
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c
··· 194 194 dcn3_14_ip.max_num_otg = dc->res_pool->res_cap->num_timing_generator; 195 195 dcn3_14_ip.max_num_dpp = dc->res_pool->pipe_count; 196 196 197 + if (bw_params->dram_channel_width_bytes > 0) 198 + dcn3_14_soc.dram_channel_width_bytes = bw_params->dram_channel_width_bytes; 199 + 197 200 if (bw_params->num_channels > 0) 198 201 dcn3_14_soc.num_chans = bw_params->num_channels; 199 202 ··· 265 262 } 266 263 267 264 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) 268 - dml_init_instance(&dc->dml, &dcn3_14_soc, &dcn3_14_ip, DML_PROJECT_DCN31); 265 + dml_init_instance(&dc->dml, &dcn3_14_soc, &dcn3_14_ip, DML_PROJECT_DCN314); 269 266 else 270 267 dml_init_instance(&dc->dml, &dcn3_14_soc, &dcn3_14_ip, DML_PROJECT_DCN31_FPGA); 271 268 }
+105 -328
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
··· 61 61 // fudge factor for min dcfclk calclation 62 62 #define __DML_MIN_DCFCLK_FACTOR__ 1.15 63 63 64 - struct { 64 + typedef struct { 65 65 double DPPCLK; 66 66 double DISPCLK; 67 67 double PixelClock; ··· 265 265 266 266 static void CalculateFlipSchedule( 267 267 struct display_mode_lib *mode_lib, 268 + unsigned int k, 268 269 double HostVMInefficiencyFactor, 269 270 double UrgentExtraLatency, 270 271 double UrgentLatency, 271 - unsigned int GPUVMMaxPageTableLevels, 272 - bool HostVMEnable, 273 - unsigned int HostVMMaxNonCachedPageTableLevels, 274 - bool GPUVMEnable, 275 - double HostVMMinPageSize, 276 272 double PDEAndMetaPTEBytesPerFrame, 277 273 double MetaRowBytes, 278 - double DPTEBytesPerRow, 279 - double BandwidthAvailableForImmediateFlip, 280 - unsigned int TotImmediateFlipBytes, 281 - enum source_format_class SourcePixelFormat, 282 - double LineTime, 283 - double VRatio, 284 - double VRatioChroma, 285 - double Tno_bw, 286 - bool DCCEnable, 287 - unsigned int dpte_row_height, 288 - unsigned int meta_row_height, 289 - unsigned int dpte_row_height_chroma, 290 - unsigned int meta_row_height_chroma, 291 - double *DestinationLinesToRequestVMInImmediateFlip, 292 - double *DestinationLinesToRequestRowInImmediateFlip, 293 - double *final_flip_bw, 294 - bool *ImmediateFlipSupportedForPipe); 274 + double DPTEBytesPerRow); 295 275 static double CalculateWriteBackDelay( 296 276 enum source_format_class WritebackPixelFormat, 297 277 double WritebackHRatio, ··· 305 325 static void CalculateWatermarksAndDRAMSpeedChangeSupport( 306 326 struct display_mode_lib *mode_lib, 307 327 unsigned int PrefetchMode, 308 - unsigned int NumberOfActivePlanes, 309 - unsigned int MaxLineBufferLines, 310 - unsigned int LineBufferSize, 311 - unsigned int WritebackInterfaceBufferSize, 312 328 double DCFCLK, 313 329 double ReturnBW, 314 - bool SynchronizedVBlank, 315 - unsigned int dpte_group_bytes[], 316 - unsigned int MetaChunkSize, 317 330 double UrgentLatency, 318 331 double ExtraLatency, 319 - double WritebackLatency, 320 - double WritebackChunkSize, 321 332 double SOCCLK, 322 - double DRAMClockChangeLatency, 323 - double SRExitTime, 324 - double SREnterPlusExitTime, 325 - double SRExitZ8Time, 326 - double SREnterPlusExitZ8Time, 327 333 double DCFCLKDeepSleep, 328 334 unsigned int DETBufferSizeY[], 329 335 unsigned int DETBufferSizeC[], 330 336 unsigned int SwathHeightY[], 331 337 unsigned int SwathHeightC[], 332 - unsigned int LBBitPerPixel[], 333 338 double SwathWidthY[], 334 339 double SwathWidthC[], 335 - double HRatio[], 336 - double HRatioChroma[], 337 - unsigned int vtaps[], 338 - unsigned int VTAPsChroma[], 339 - double VRatio[], 340 - double VRatioChroma[], 341 - unsigned int HTotal[], 342 - double PixelClock[], 343 - unsigned int BlendingAndTiming[], 344 340 unsigned int DPPPerPlane[], 345 341 double BytePerPixelDETY[], 346 342 double BytePerPixelDETC[], 347 - double DSTXAfterScaler[], 348 - double DSTYAfterScaler[], 349 - bool WritebackEnable[], 350 - enum source_format_class WritebackPixelFormat[], 351 - double WritebackDestinationWidth[], 352 - double WritebackDestinationHeight[], 353 - double WritebackSourceHeight[], 354 343 bool UnboundedRequestEnabled, 355 344 unsigned int CompressedBufferSizeInkByte, 356 345 enum clock_change_support *DRAMClockChangeSupport, 357 - double *UrgentWatermark, 358 - double *WritebackUrgentWatermark, 359 - double *DRAMClockChangeWatermark, 360 - double *WritebackDRAMClockChangeWatermark, 361 346 double *StutterExitWatermark, 362 347 double *StutterEnterPlusExitWatermark, 363 348 double *Z8StutterExitWatermark, 364 - double *Z8StutterEnterPlusExitWatermark, 365 - double *MinActiveDRAMClockChangeLatencySupported); 349 + double *Z8StutterEnterPlusExitWatermark); 366 350 367 351 static void CalculateDCFCLKDeepSleep( 368 352 struct display_mode_lib *mode_lib, ··· 1543 1599 int segment_order_vert_contiguous_luma; 1544 1600 int segment_order_vert_contiguous_chroma; 1545 1601 1546 - enum { 1602 + typedef enum { 1547 1603 REQ_256Bytes, REQ_128BytesNonContiguous, REQ_128BytesContiguous, REQ_NA 1548 1604 } RequestType; 1549 1605 RequestType RequestLuma; ··· 2872 2928 for (k = 0; k < v->NumberOfActivePlanes; ++k) { 2873 2929 CalculateFlipSchedule( 2874 2930 mode_lib, 2931 + k, 2875 2932 HostVMInefficiencyFactor, 2876 2933 v->UrgentExtraLatency, 2877 2934 v->UrgentLatency, 2878 - v->GPUVMMaxPageTableLevels, 2879 - v->HostVMEnable, 2880 - v->HostVMMaxNonCachedPageTableLevels, 2881 - v->GPUVMEnable, 2882 - v->HostVMMinPageSize, 2883 2935 v->PDEAndMetaPTEBytesFrame[k], 2884 2936 v->MetaRowByte[k], 2885 - v->PixelPTEBytesPerRow[k], 2886 - v->BandwidthAvailableForImmediateFlip, 2887 - v->TotImmediateFlipBytes, 2888 - v->SourcePixelFormat[k], 2889 - v->HTotal[k] / v->PixelClock[k], 2890 - v->VRatio[k], 2891 - v->VRatioChroma[k], 2892 - v->Tno_bw[k], 2893 - v->DCCEnable[k], 2894 - v->dpte_row_height[k], 2895 - v->meta_row_height[k], 2896 - v->dpte_row_height_chroma[k], 2897 - v->meta_row_height_chroma[k], 2898 - &v->DestinationLinesToRequestVMInImmediateFlip[k], 2899 - &v->DestinationLinesToRequestRowInImmediateFlip[k], 2900 - &v->final_flip_bw[k], 2901 - &v->ImmediateFlipSupportedForPipe[k]); 2937 + v->PixelPTEBytesPerRow[k]); 2902 2938 } 2903 2939 2904 2940 v->total_dcn_read_bw_with_flip = 0.0; ··· 2965 3041 CalculateWatermarksAndDRAMSpeedChangeSupport( 2966 3042 mode_lib, 2967 3043 PrefetchMode, 2968 - v->NumberOfActivePlanes, 2969 - v->MaxLineBufferLines, 2970 - v->LineBufferSize, 2971 - v->WritebackInterfaceBufferSize, 2972 3044 v->DCFCLK, 2973 3045 v->ReturnBW, 2974 - v->SynchronizedVBlank, 2975 - v->dpte_group_bytes, 2976 - v->MetaChunkSize, 2977 3046 v->UrgentLatency, 2978 3047 v->UrgentExtraLatency, 2979 - v->WritebackLatency, 2980 - v->WritebackChunkSize, 2981 3048 v->SOCCLK, 2982 - v->DRAMClockChangeLatency, 2983 - v->SRExitTime, 2984 - v->SREnterPlusExitTime, 2985 - v->SRExitZ8Time, 2986 - v->SREnterPlusExitZ8Time, 2987 3049 v->DCFCLKDeepSleep, 2988 3050 v->DETBufferSizeY, 2989 3051 v->DETBufferSizeC, 2990 3052 v->SwathHeightY, 2991 3053 v->SwathHeightC, 2992 - v->LBBitPerPixel, 2993 3054 v->SwathWidthY, 2994 3055 v->SwathWidthC, 2995 - v->HRatio, 2996 - v->HRatioChroma, 2997 - v->vtaps, 2998 - v->VTAPsChroma, 2999 - v->VRatio, 3000 - v->VRatioChroma, 3001 - v->HTotal, 3002 - v->PixelClock, 3003 - v->BlendingAndTiming, 3004 3056 v->DPPPerPlane, 3005 3057 v->BytePerPixelDETY, 3006 3058 v->BytePerPixelDETC, 3007 - v->DSTXAfterScaler, 3008 - v->DSTYAfterScaler, 3009 - v->WritebackEnable, 3010 - v->WritebackPixelFormat, 3011 - v->WritebackDestinationWidth, 3012 - v->WritebackDestinationHeight, 3013 - v->WritebackSourceHeight, 3014 3059 v->UnboundedRequestEnabled, 3015 3060 v->CompressedBufferSizeInkByte, 3016 3061 &DRAMClockChangeSupport, 3017 - &v->UrgentWatermark, 3018 - &v->WritebackUrgentWatermark, 3019 - &v->DRAMClockChangeWatermark, 3020 - &v->WritebackDRAMClockChangeWatermark, 3021 3062 &v->StutterExitWatermark, 3022 3063 &v->StutterEnterPlusExitWatermark, 3023 3064 &v->Z8StutterExitWatermark, 3024 - &v->Z8StutterEnterPlusExitWatermark, 3025 - &v->MinActiveDRAMClockChangeLatencySupported); 3065 + &v->Z8StutterEnterPlusExitWatermark); 3026 3066 3027 3067 for (k = 0; k < v->NumberOfActivePlanes; ++k) { 3028 3068 if (v->WritebackEnable[k] == true) { ··· 3598 3710 3599 3711 static void CalculateFlipSchedule( 3600 3712 struct display_mode_lib *mode_lib, 3713 + unsigned int k, 3601 3714 double HostVMInefficiencyFactor, 3602 3715 double UrgentExtraLatency, 3603 3716 double UrgentLatency, 3604 - unsigned int GPUVMMaxPageTableLevels, 3605 - bool HostVMEnable, 3606 - unsigned int HostVMMaxNonCachedPageTableLevels, 3607 - bool GPUVMEnable, 3608 - double HostVMMinPageSize, 3609 3717 double PDEAndMetaPTEBytesPerFrame, 3610 3718 double MetaRowBytes, 3611 - double DPTEBytesPerRow, 3612 - double BandwidthAvailableForImmediateFlip, 3613 - unsigned int TotImmediateFlipBytes, 3614 - enum source_format_class SourcePixelFormat, 3615 - double LineTime, 3616 - double VRatio, 3617 - double VRatioChroma, 3618 - double Tno_bw, 3619 - bool DCCEnable, 3620 - unsigned int dpte_row_height, 3621 - unsigned int meta_row_height, 3622 - unsigned int dpte_row_height_chroma, 3623 - unsigned int meta_row_height_chroma, 3624 - double *DestinationLinesToRequestVMInImmediateFlip, 3625 - double *DestinationLinesToRequestRowInImmediateFlip, 3626 - double *final_flip_bw, 3627 - bool *ImmediateFlipSupportedForPipe) 3719 + double DPTEBytesPerRow) 3628 3720 { 3721 + struct vba_vars_st *v = &mode_lib->vba; 3629 3722 double min_row_time = 0.0; 3630 3723 unsigned int HostVMDynamicLevelsTrips; 3631 3724 double TimeForFetchingMetaPTEImmediateFlip; 3632 3725 double TimeForFetchingRowInVBlankImmediateFlip; 3633 3726 double ImmediateFlipBW; 3727 + double LineTime = v->HTotal[k] / v->PixelClock[k]; 3634 3728 3635 - if (GPUVMEnable == true && HostVMEnable == true) { 3636 - HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels; 3729 + if (v->GPUVMEnable == true && v->HostVMEnable == true) { 3730 + HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels; 3637 3731 } else { 3638 3732 HostVMDynamicLevelsTrips = 0; 3639 3733 } 3640 3734 3641 - if (GPUVMEnable == true || DCCEnable == true) { 3642 - ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes; 3735 + if (v->GPUVMEnable == true || v->DCCEnable[k] == true) { 3736 + ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes; 3643 3737 } 3644 3738 3645 - if (GPUVMEnable == true) { 3739 + if (v->GPUVMEnable == true) { 3646 3740 TimeForFetchingMetaPTEImmediateFlip = dml_max3( 3647 - Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, 3648 - UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), 3741 + v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, 3742 + UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), 3649 3743 LineTime / 4.0); 3650 3744 } else { 3651 3745 TimeForFetchingMetaPTEImmediateFlip = 0; 3652 3746 } 3653 3747 3654 - *DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; 3655 - if ((GPUVMEnable == true || DCCEnable == true)) { 3748 + v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; 3749 + if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) { 3656 3750 TimeForFetchingRowInVBlankImmediateFlip = dml_max3( 3657 3751 (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW, 3658 3752 UrgentLatency * (HostVMDynamicLevelsTrips + 1), ··· 3643 3773 TimeForFetchingRowInVBlankImmediateFlip = 0; 3644 3774 } 3645 3775 3646 - *DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; 3776 + v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; 3647 3777 3648 - if (GPUVMEnable == true) { 3649 - *final_flip_bw = dml_max( 3650 - PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime), 3651 - (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime)); 3652 - } else if ((GPUVMEnable == true || DCCEnable == true)) { 3653 - *final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime); 3778 + if (v->GPUVMEnable == true) { 3779 + v->final_flip_bw[k] = dml_max( 3780 + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime), 3781 + (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime)); 3782 + } else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) { 3783 + v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime); 3654 3784 } else { 3655 - *final_flip_bw = 0; 3785 + v->final_flip_bw[k] = 0; 3656 3786 } 3657 3787 3658 - if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) { 3659 - if (GPUVMEnable == true && DCCEnable != true) { 3660 - min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma); 3661 - } else if (GPUVMEnable != true && DCCEnable == true) { 3662 - min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma); 3788 + if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) { 3789 + if (v->GPUVMEnable == true && v->DCCEnable[k] != true) { 3790 + min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); 3791 + } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) { 3792 + min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); 3663 3793 } else { 3664 3794 min_row_time = dml_min4( 3665 - dpte_row_height * LineTime / VRatio, 3666 - meta_row_height * LineTime / VRatio, 3667 - dpte_row_height_chroma * LineTime / VRatioChroma, 3668 - meta_row_height_chroma * LineTime / VRatioChroma); 3795 + v->dpte_row_height[k] * LineTime / v->VRatio[k], 3796 + v->meta_row_height[k] * LineTime / v->VRatio[k], 3797 + v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k], 3798 + v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]); 3669 3799 } 3670 3800 } else { 3671 - if (GPUVMEnable == true && DCCEnable != true) { 3672 - min_row_time = dpte_row_height * LineTime / VRatio; 3673 - } else if (GPUVMEnable != true && DCCEnable == true) { 3674 - min_row_time = meta_row_height * LineTime / VRatio; 3801 + if (v->GPUVMEnable == true && v->DCCEnable[k] != true) { 3802 + min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k]; 3803 + } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) { 3804 + min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k]; 3675 3805 } else { 3676 - min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio); 3806 + min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]); 3677 3807 } 3678 3808 } 3679 3809 3680 - if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16 3810 + if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16 3681 3811 || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) { 3682 - *ImmediateFlipSupportedForPipe = false; 3812 + v->ImmediateFlipSupportedForPipe[k] = false; 3683 3813 } else { 3684 - *ImmediateFlipSupportedForPipe = true; 3814 + v->ImmediateFlipSupportedForPipe[k] = true; 3685 3815 } 3686 3816 3687 3817 #ifdef __DML_VBA_DEBUG__ 3688 - dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip); 3689 - dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip); 3818 + dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]); 3819 + dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]); 3690 3820 dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip); 3691 3821 dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip); 3692 3822 dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time); 3693 - dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe); 3823 + dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]); 3694 3824 #endif 3695 3825 3696 3826 } ··· 3941 4071 3942 4072 v->SourceFormatPixelAndScanSupport = true; 3943 4073 for (k = 0; k < v->NumberOfActivePlanes; k++) { 3944 - if ((v->SurfaceTiling[k] == dm_sw_linear && (!(v->SourceScan[k] != dm_vert) || v->DCCEnable[k] == true)) 3945 - || ((v->SurfaceTiling[k] == dm_sw_64kb_d || v->SurfaceTiling[k] == dm_sw_64kb_d_t 3946 - || v->SurfaceTiling[k] == dm_sw_64kb_d_x) && !(v->SourcePixelFormat[k] == dm_444_64))) { 4074 + if (v->SurfaceTiling[k] == dm_sw_linear && (!(v->SourceScan[k] != dm_vert) || v->DCCEnable[k] == true)) { 3947 4075 v->SourceFormatPixelAndScanSupport = false; 3948 4076 } 3949 4077 } ··· 5282 5414 for (k = 0; k < v->NumberOfActivePlanes; k++) { 5283 5415 CalculateFlipSchedule( 5284 5416 mode_lib, 5417 + k, 5285 5418 HostVMInefficiencyFactor, 5286 5419 v->ExtraLatency, 5287 5420 v->UrgLatency[i], 5288 - v->GPUVMMaxPageTableLevels, 5289 - v->HostVMEnable, 5290 - v->HostVMMaxNonCachedPageTableLevels, 5291 - v->GPUVMEnable, 5292 - v->HostVMMinPageSize, 5293 5421 v->PDEAndMetaPTEBytesPerFrame[i][j][k], 5294 5422 v->MetaRowBytes[i][j][k], 5295 - v->DPTEBytesPerRow[i][j][k], 5296 - v->BandwidthAvailableForImmediateFlip, 5297 - v->TotImmediateFlipBytes, 5298 - v->SourcePixelFormat[k], 5299 - v->HTotal[k] / v->PixelClock[k], 5300 - v->VRatio[k], 5301 - v->VRatioChroma[k], 5302 - v->Tno_bw[k], 5303 - v->DCCEnable[k], 5304 - v->dpte_row_height[k], 5305 - v->meta_row_height[k], 5306 - v->dpte_row_height_chroma[k], 5307 - v->meta_row_height_chroma[k], 5308 - &v->DestinationLinesToRequestVMInImmediateFlip[k], 5309 - &v->DestinationLinesToRequestRowInImmediateFlip[k], 5310 - &v->final_flip_bw[k], 5311 - &v->ImmediateFlipSupportedForPipe[k]); 5423 + v->DPTEBytesPerRow[i][j][k]); 5312 5424 } 5313 5425 v->total_dcn_read_bw_with_flip = 0.0; 5314 5426 for (k = 0; k < v->NumberOfActivePlanes; k++) { ··· 5346 5498 CalculateWatermarksAndDRAMSpeedChangeSupport( 5347 5499 mode_lib, 5348 5500 v->PrefetchModePerState[i][j], 5349 - v->NumberOfActivePlanes, 5350 - v->MaxLineBufferLines, 5351 - v->LineBufferSize, 5352 - v->WritebackInterfaceBufferSize, 5353 5501 v->DCFCLKState[i][j], 5354 5502 v->ReturnBWPerState[i][j], 5355 - v->SynchronizedVBlank, 5356 - v->dpte_group_bytes, 5357 - v->MetaChunkSize, 5358 5503 v->UrgLatency[i], 5359 5504 v->ExtraLatency, 5360 - v->WritebackLatency, 5361 - v->WritebackChunkSize, 5362 5505 v->SOCCLKPerState[i], 5363 - v->DRAMClockChangeLatency, 5364 - v->SRExitTime, 5365 - v->SREnterPlusExitTime, 5366 - v->SRExitZ8Time, 5367 - v->SREnterPlusExitZ8Time, 5368 5506 v->ProjectedDCFCLKDeepSleep[i][j], 5369 5507 v->DETBufferSizeYThisState, 5370 5508 v->DETBufferSizeCThisState, 5371 5509 v->SwathHeightYThisState, 5372 5510 v->SwathHeightCThisState, 5373 - v->LBBitPerPixel, 5374 5511 v->SwathWidthYThisState, 5375 5512 v->SwathWidthCThisState, 5376 - v->HRatio, 5377 - v->HRatioChroma, 5378 - v->vtaps, 5379 - v->VTAPsChroma, 5380 - v->VRatio, 5381 - v->VRatioChroma, 5382 - v->HTotal, 5383 - v->PixelClock, 5384 - v->BlendingAndTiming, 5385 5513 v->NoOfDPPThisState, 5386 5514 v->BytePerPixelInDETY, 5387 5515 v->BytePerPixelInDETC, 5388 - v->DSTXAfterScaler, 5389 - v->DSTYAfterScaler, 5390 - v->WritebackEnable, 5391 - v->WritebackPixelFormat, 5392 - v->WritebackDestinationWidth, 5393 - v->WritebackDestinationHeight, 5394 - v->WritebackSourceHeight, 5395 5516 UnboundedRequestEnabledThisState, 5396 5517 CompressedBufferSizeInkByteThisState, 5397 5518 &v->DRAMClockChangeSupport[i][j], 5398 - &v->UrgentWatermark, 5399 - &v->WritebackUrgentWatermark, 5400 - &v->DRAMClockChangeWatermark, 5401 - &v->WritebackDRAMClockChangeWatermark, 5402 5519 &dummy, 5403 5520 &dummy, 5404 5521 &dummy, 5405 - &dummy, 5406 - &v->MinActiveDRAMClockChangeLatencySupported); 5522 + &dummy); 5407 5523 } 5408 5524 } 5409 5525 ··· 5493 5681 static void CalculateWatermarksAndDRAMSpeedChangeSupport( 5494 5682 struct display_mode_lib *mode_lib, 5495 5683 unsigned int PrefetchMode, 5496 - unsigned int NumberOfActivePlanes, 5497 - unsigned int MaxLineBufferLines, 5498 - unsigned int LineBufferSize, 5499 - unsigned int WritebackInterfaceBufferSize, 5500 5684 double DCFCLK, 5501 5685 double ReturnBW, 5502 - bool SynchronizedVBlank, 5503 - unsigned int dpte_group_bytes[], 5504 - unsigned int MetaChunkSize, 5505 5686 double UrgentLatency, 5506 5687 double ExtraLatency, 5507 - double WritebackLatency, 5508 - double WritebackChunkSize, 5509 5688 double SOCCLK, 5510 - double DRAMClockChangeLatency, 5511 - double SRExitTime, 5512 - double SREnterPlusExitTime, 5513 - double SRExitZ8Time, 5514 - double SREnterPlusExitZ8Time, 5515 5689 double DCFCLKDeepSleep, 5516 5690 unsigned int DETBufferSizeY[], 5517 5691 unsigned int DETBufferSizeC[], 5518 5692 unsigned int SwathHeightY[], 5519 5693 unsigned int SwathHeightC[], 5520 - unsigned int LBBitPerPixel[], 5521 5694 double SwathWidthY[], 5522 5695 double SwathWidthC[], 5523 - double HRatio[], 5524 - double HRatioChroma[], 5525 - unsigned int vtaps[], 5526 - unsigned int VTAPsChroma[], 5527 - double VRatio[], 5528 - double VRatioChroma[], 5529 - unsigned int HTotal[], 5530 - double PixelClock[], 5531 - unsigned int BlendingAndTiming[], 5532 5696 unsigned int DPPPerPlane[], 5533 5697 double BytePerPixelDETY[], 5534 5698 double BytePerPixelDETC[], 5535 - double DSTXAfterScaler[], 5536 - double DSTYAfterScaler[], 5537 - bool WritebackEnable[], 5538 - enum source_format_class WritebackPixelFormat[], 5539 - double WritebackDestinationWidth[], 5540 - double WritebackDestinationHeight[], 5541 - double WritebackSourceHeight[], 5542 5699 bool UnboundedRequestEnabled, 5543 5700 unsigned int CompressedBufferSizeInkByte, 5544 5701 enum clock_change_support *DRAMClockChangeSupport, 5545 - double *UrgentWatermark, 5546 - double *WritebackUrgentWatermark, 5547 - double *DRAMClockChangeWatermark, 5548 - double *WritebackDRAMClockChangeWatermark, 5549 5702 double *StutterExitWatermark, 5550 5703 double *StutterEnterPlusExitWatermark, 5551 5704 double *Z8StutterExitWatermark, 5552 - double *Z8StutterEnterPlusExitWatermark, 5553 - double *MinActiveDRAMClockChangeLatencySupported) 5705 + double *Z8StutterEnterPlusExitWatermark) 5554 5706 { 5555 5707 struct vba_vars_st *v = &mode_lib->vba; 5556 5708 double EffectiveLBLatencyHidingY; ··· 5534 5758 double TotalPixelBW = 0.0; 5535 5759 int k, j; 5536 5760 5537 - *UrgentWatermark = UrgentLatency + ExtraLatency; 5761 + v->UrgentWatermark = UrgentLatency + ExtraLatency; 5538 5762 5539 5763 #ifdef __DML_VBA_DEBUG__ 5540 5764 dml_print("DML::%s: UrgentLatency = %f\n", __func__, UrgentLatency); 5541 5765 dml_print("DML::%s: ExtraLatency = %f\n", __func__, ExtraLatency); 5542 - dml_print("DML::%s: UrgentWatermark = %f\n", __func__, *UrgentWatermark); 5766 + dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->UrgentWatermark); 5543 5767 #endif 5544 5768 5545 - *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark; 5769 + v->DRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->UrgentWatermark; 5546 5770 5547 5771 #ifdef __DML_VBA_DEBUG__ 5548 - dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, DRAMClockChangeLatency); 5549 - dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, *DRAMClockChangeWatermark); 5772 + dml_print("DML::%s: v->DRAMClockChangeLatency = %f\n", __func__, v->DRAMClockChangeLatency); 5773 + dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->DRAMClockChangeWatermark); 5550 5774 #endif 5551 5775 5552 5776 v->TotalActiveWriteback = 0; 5553 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5554 - if (WritebackEnable[k] == true) { 5777 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5778 + if (v->WritebackEnable[k] == true) { 5555 5779 v->TotalActiveWriteback = v->TotalActiveWriteback + 1; 5556 5780 } 5557 5781 } 5558 5782 5559 5783 if (v->TotalActiveWriteback <= 1) { 5560 - *WritebackUrgentWatermark = WritebackLatency; 5784 + v->WritebackUrgentWatermark = v->WritebackLatency; 5561 5785 } else { 5562 - *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5786 + v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5563 5787 } 5564 5788 5565 5789 if (v->TotalActiveWriteback <= 1) { 5566 - *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency; 5790 + v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency; 5567 5791 } else { 5568 - *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5792 + v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 5569 5793 } 5570 5794 5571 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5795 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5572 5796 TotalPixelBW = TotalPixelBW 5573 - + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k]) 5574 - / (HTotal[k] / PixelClock[k]); 5797 + + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k]) 5798 + / (v->HTotal[k] / v->PixelClock[k]); 5575 5799 } 5576 5800 5577 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5801 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5578 5802 double EffectiveDETBufferSizeY = DETBufferSizeY[k]; 5579 5803 5580 5804 v->LBLatencyHidingSourceLinesY = dml_min( 5581 - (double) MaxLineBufferLines, 5582 - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1); 5805 + (double) v->MaxLineBufferLines, 5806 + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1); 5583 5807 5584 5808 v->LBLatencyHidingSourceLinesC = dml_min( 5585 - (double) MaxLineBufferLines, 5586 - dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1); 5809 + (double) v->MaxLineBufferLines, 5810 + dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1); 5587 5811 5588 - EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]); 5812 + EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]); 5589 5813 5590 - EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]); 5814 + EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]); 5591 5815 5592 5816 if (UnboundedRequestEnabled) { 5593 5817 EffectiveDETBufferSizeY = EffectiveDETBufferSizeY 5594 - + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW; 5818 + + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW; 5595 5819 } 5596 5820 5597 5821 LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k]; 5598 5822 LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]); 5599 - FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k]; 5823 + FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k]; 5600 5824 if (BytePerPixelDETC[k] > 0) { 5601 5825 LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k]; 5602 5826 LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]); 5603 - FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k]; 5827 + FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k]; 5604 5828 } else { 5605 5829 LinesInDETC = 0; 5606 5830 FullDETBufferingTimeC = 999999; 5607 5831 } 5608 5832 5609 5833 ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY 5610 - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; 5834 + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark; 5611 5835 5612 - if (NumberOfActivePlanes > 1) { 5836 + if (v->NumberOfActivePlanes > 1) { 5613 5837 ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY 5614 - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k]; 5838 + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k]; 5615 5839 } 5616 5840 5617 5841 if (BytePerPixelDETC[k] > 0) { 5618 5842 ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC 5619 - - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark; 5843 + - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark; 5620 5844 5621 - if (NumberOfActivePlanes > 1) { 5845 + if (v->NumberOfActivePlanes > 1) { 5622 5846 ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC 5623 - - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k]; 5847 + - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k]; 5624 5848 } 5625 5849 v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC); 5626 5850 } else { 5627 5851 v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY; 5628 5852 } 5629 5853 5630 - if (WritebackEnable[k] == true) { 5631 - WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024 5632 - / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4); 5633 - if (WritebackPixelFormat[k] == dm_444_64) { 5854 + if (v->WritebackEnable[k] == true) { 5855 + WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024 5856 + / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4); 5857 + if (v->WritebackPixelFormat[k] == dm_444_64) { 5634 5858 WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2; 5635 5859 } 5636 5860 WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark; ··· 5640 5864 5641 5865 v->MinActiveDRAMClockChangeMargin = 999999; 5642 5866 PlaneWithMinActiveDRAMClockChangeMargin = 0; 5643 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5867 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5644 5868 if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) { 5645 5869 v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k]; 5646 - if (BlendingAndTiming[k] == k) { 5870 + if (v->BlendingAndTiming[k] == k) { 5647 5871 PlaneWithMinActiveDRAMClockChangeMargin = k; 5648 5872 } else { 5649 - for (j = 0; j < NumberOfActivePlanes; ++j) { 5650 - if (BlendingAndTiming[k] == j) { 5873 + for (j = 0; j < v->NumberOfActivePlanes; ++j) { 5874 + if (v->BlendingAndTiming[k] == j) { 5651 5875 PlaneWithMinActiveDRAMClockChangeMargin = j; 5652 5876 } 5653 5877 } ··· 5655 5879 } 5656 5880 } 5657 5881 5658 - *MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency; 5882 + v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->DRAMClockChangeLatency ; 5659 5883 5660 5884 SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999; 5661 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5662 - if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) 5885 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5886 + if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) 5663 5887 && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) { 5664 5888 SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k]; 5665 5889 } ··· 5667 5891 5668 5892 v->TotalNumberOfActiveOTG = 0; 5669 5893 5670 - for (k = 0; k < NumberOfActivePlanes; ++k) { 5671 - if (BlendingAndTiming[k] == k) { 5894 + for (k = 0; k < v->NumberOfActivePlanes; ++k) { 5895 + if (v->BlendingAndTiming[k] == k) { 5672 5896 v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1; 5673 5897 } 5674 5898 } 5675 5899 5676 5900 if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) { 5677 5901 *DRAMClockChangeSupport = dm_dram_clock_change_vactive; 5678 - } else if ((SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 5902 + } else if ((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 5679 5903 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0) { 5680 5904 *DRAMClockChangeSupport = dm_dram_clock_change_vblank; 5681 5905 } else { 5682 5906 *DRAMClockChangeSupport = dm_dram_clock_change_unsupported; 5683 5907 } 5684 5908 5685 - *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep; 5686 - *StutterEnterPlusExitWatermark = (SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep); 5687 - *Z8StutterExitWatermark = SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5688 - *Z8StutterEnterPlusExitWatermark = SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5909 + *StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep; 5910 + *StutterEnterPlusExitWatermark = (v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep); 5911 + *Z8StutterExitWatermark = v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5912 + *Z8StutterEnterPlusExitWatermark = v->SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep; 5689 5913 5690 5914 #ifdef __DML_VBA_DEBUG__ 5691 5915 dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, *StutterExitWatermark); ··· 6933 7157 HostVMDynamicLevels = dml_max(0, (int) HostVMMaxNonCachedPageTableLevels - 1); 6934 7158 else 6935 7159 HostVMDynamicLevels = dml_max(0, (int) HostVMMaxNonCachedPageTableLevels - 2); 6936 - else 7160 + } else { 6937 7161 HostVMDynamicLevels = 0; 7162 + } 6938 7163 6939 7164 ret = ReorderingBytes + (TotalNumberOfActiveDPP * PixelChunkSizeInKByte + TotalNumberOfDCCActiveDPP * MetaChunkSize) * 1024.0; 6940 7165 6941 - if (GPUVMEnable == true) 7166 + if (GPUVMEnable == true) { 6942 7167 for (k = 0; k < NumberOfActivePlanes; ++k) 6943 7168 ret = ret + NumberOfDPP[k] * dpte_group_bytes[k] * (1 + 8 * HostVMDynamicLevels) * HostVMInefficiencyFactor; 6944 7169 }
+45 -1
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
··· 244 244 } 245 245 246 246 /** 247 + * Finds dummy_latency_index when MCLK switching using firmware based 248 + * vblank stretch is enabled. This function will iterate through the 249 + * table of dummy pstate latencies until the lowest value that allows 250 + * dm_allow_self_refresh_and_mclk_switch to happen is found 251 + */ 252 + int dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc, 253 + struct dc_state *context, 254 + display_e2e_pipe_params_st *pipes, 255 + int pipe_cnt, 256 + int vlevel) 257 + { 258 + const int max_latency_table_entries = 4; 259 + const struct vba_vars_st *vba = &context->bw_ctx.dml.vba; 260 + int dummy_latency_index = 0; 261 + 262 + dc_assert_fp_enabled(); 263 + 264 + while (dummy_latency_index < max_latency_table_entries) { 265 + context->bw_ctx.dml.soc.dram_clock_change_latency_us = 266 + dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dummy_pstate_latency_us; 267 + dcn32_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false); 268 + 269 + if (vlevel < context->bw_ctx.dml.vba.soc.num_states && 270 + vba->DRAMClockChangeSupport[vlevel][vba->maxMpcComb] != dm_dram_clock_change_unsupported) 271 + break; 272 + 273 + dummy_latency_index++; 274 + } 275 + 276 + if (dummy_latency_index == max_latency_table_entries) { 277 + ASSERT(dummy_latency_index != max_latency_table_entries); 278 + /* If the execution gets here, it means dummy p_states are 279 + * not possible. This should never happen and would mean 280 + * something is severely wrong. 281 + * Here we reset dummy_latency_index to 3, because it is 282 + * better to have underflows than system crashes. 283 + */ 284 + dummy_latency_index = max_latency_table_entries - 1; 285 + } 286 + 287 + return dummy_latency_index; 288 + } 289 + 290 + /** 247 291 * dcn32_helper_populate_phantom_dlg_params - Get DLG params for phantom pipes 248 292 * and populate pipe_ctx with those params. 249 293 * ··· 1690 1646 dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(dc, context); 1691 1647 1692 1648 if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { 1693 - dummy_latency_index = dcn30_find_dummy_latency_index_for_fw_based_mclk_switch(dc, 1649 + dummy_latency_index = dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(dc, 1694 1650 context, pipes, pipe_cnt, vlevel); 1695 1651 1696 1652 /* After calling dcn30_find_dummy_latency_index_for_fw_based_mclk_switch
+6
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h
··· 71 71 72 72 void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_params); 73 73 74 + int dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc, 75 + struct dc_state *context, 76 + display_e2e_pipe_params_st *pipes, 77 + int pipe_cnt, 78 + int vlevel); 79 + 74 80 #endif
+88 -174
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
··· 755 755 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BytePerPixelY = v->BytePerPixelY[k]; 756 756 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BytePerPixelC = v->BytePerPixelC[k]; 757 757 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.ProgressiveToInterlaceUnitInOPP = mode_lib->vba.ProgressiveToInterlaceUnitInOPP; 758 - v->ErrorResult[k] = dml32_CalculatePrefetchSchedule(v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor, 759 - &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe, v->DSCDelay[k], 760 - mode_lib->vba.DPPCLKDelaySubtotal + mode_lib->vba.DPPCLKDelayCNVCFormater, 761 - mode_lib->vba.DPPCLKDelaySCL, 762 - mode_lib->vba.DPPCLKDelaySCLLBOnly, 763 - mode_lib->vba.DPPCLKDelayCNVCCursor, 764 - mode_lib->vba.DISPCLKDelaySubtotal, 765 - (unsigned int) (v->SwathWidthY[k] / mode_lib->vba.HRatio[k]), 766 - mode_lib->vba.OutputFormat[k], 767 - mode_lib->vba.MaxInterDCNTileRepeaters, 758 + v->ErrorResult[k] = dml32_CalculatePrefetchSchedule( 759 + v, 760 + k, 761 + v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor, 762 + &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe, 763 + v->DSCDelay[k], 764 + (unsigned int) (v->SwathWidthY[k] / v->HRatio[k]), 768 765 dml_min(v->VStartupLines, v->MaxVStartupLines[k]), 769 766 v->MaxVStartupLines[k], 770 - mode_lib->vba.GPUVMMaxPageTableLevels, 771 - mode_lib->vba.GPUVMEnable, 772 - mode_lib->vba.HostVMEnable, 773 - mode_lib->vba.HostVMMaxNonCachedPageTableLevels, 774 - mode_lib->vba.HostVMMinPageSize, 775 - mode_lib->vba.DynamicMetadataEnable[k], 776 - mode_lib->vba.DynamicMetadataVMEnabled, 777 - mode_lib->vba.DynamicMetadataLinesBeforeActiveRequired[k], 778 - mode_lib->vba.DynamicMetadataTransmittedBytes[k], 779 767 v->UrgentLatency, 780 768 v->UrgentExtraLatency, 781 - mode_lib->vba.TCalc, 769 + v->TCalc, 782 770 v->PDEAndMetaPTEBytesFrame[k], 783 771 v->MetaRowByte[k], 784 772 v->PixelPTEBytesPerRow[k], ··· 780 792 v->MaxNumSwathC[k], 781 793 v->swath_width_luma_ub[k], 782 794 v->swath_width_chroma_ub[k], 783 - mode_lib->vba.SwathHeightY[k], 784 - mode_lib->vba.SwathHeightC[k], 795 + v->SwathHeightY[k], 796 + v->SwathHeightC[k], 785 797 TWait, 786 798 /* Output */ 787 799 &v->DSTXAfterScaler[k], ··· 1151 1163 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SMNLatency = mode_lib->vba.SMNLatency; 1152 1164 1153 1165 dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport( 1154 - mode_lib->vba.USRRetrainingRequiredFinal, 1155 - mode_lib->vba.UsesMALLForPStateChange, 1156 - mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb], 1157 - mode_lib->vba.NumberOfActiveSurfaces, 1158 - mode_lib->vba.MaxLineBufferLines, 1159 - mode_lib->vba.LineBufferSizeFinal, 1160 - mode_lib->vba.WritebackInterfaceBufferSize, 1161 - mode_lib->vba.DCFCLK, 1162 - mode_lib->vba.ReturnBW, 1163 - mode_lib->vba.SynchronizeTimingsFinal, 1164 - mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal, 1165 - mode_lib->vba.DRRDisplay, 1166 - v->dpte_group_bytes, 1167 - v->meta_row_height, 1168 - v->meta_row_height_chroma, 1166 + v, 1167 + v->PrefetchModePerState[v->VoltageLevel][v->maxMpcComb], 1168 + v->DCFCLK, 1169 + v->ReturnBW, 1169 1170 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters, 1170 - mode_lib->vba.WritebackChunkSize, 1171 - mode_lib->vba.SOCCLK, 1171 + v->SOCCLK, 1172 1172 v->DCFCLKDeepSleep, 1173 - mode_lib->vba.DETBufferSizeY, 1174 - mode_lib->vba.DETBufferSizeC, 1175 - mode_lib->vba.SwathHeightY, 1176 - mode_lib->vba.SwathHeightC, 1177 - mode_lib->vba.LBBitPerPixel, 1173 + v->DETBufferSizeY, 1174 + v->DETBufferSizeC, 1175 + v->SwathHeightY, 1176 + v->SwathHeightC, 1178 1177 v->SwathWidthY, 1179 1178 v->SwathWidthC, 1180 - mode_lib->vba.HRatio, 1181 - mode_lib->vba.HRatioChroma, 1182 - mode_lib->vba.vtaps, 1183 - mode_lib->vba.VTAPsChroma, 1184 - mode_lib->vba.VRatio, 1185 - mode_lib->vba.VRatioChroma, 1186 - mode_lib->vba.HTotal, 1187 - mode_lib->vba.VTotal, 1188 - mode_lib->vba.VActive, 1189 - mode_lib->vba.PixelClock, 1190 - mode_lib->vba.BlendingAndTiming, 1191 - mode_lib->vba.DPPPerPlane, 1179 + v->DPPPerPlane, 1192 1180 v->BytePerPixelDETY, 1193 1181 v->BytePerPixelDETC, 1194 1182 v->DSTXAfterScaler, 1195 1183 v->DSTYAfterScaler, 1196 - mode_lib->vba.WritebackEnable, 1197 - mode_lib->vba.WritebackPixelFormat, 1198 - mode_lib->vba.WritebackDestinationWidth, 1199 - mode_lib->vba.WritebackDestinationHeight, 1200 - mode_lib->vba.WritebackSourceHeight, 1201 1184 v->UnboundedRequestEnabled, 1202 1185 v->CompressedBufferSizeInkByte, 1203 1186 1204 1187 /* Output */ 1205 - &v->Watermark, 1206 1188 &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_dramchange_support, 1207 1189 v->MaxActiveDRAMClockChangeLatencySupported, 1208 1190 v->SubViewportLinesNeededInMALL, ··· 1764 1806 &mode_lib->vba.Read256BlockHeightC[k], 1765 1807 &mode_lib->vba.Read256BlockWidthY[k], 1766 1808 &mode_lib->vba.Read256BlockWidthC[k], 1767 - &mode_lib->vba.MicroTileHeightY[k], 1768 - &mode_lib->vba.MicroTileHeightC[k], 1769 - &mode_lib->vba.MicroTileWidthY[k], 1770 - &mode_lib->vba.MicroTileWidthC[k]); 1809 + &mode_lib->vba.MacroTileHeightY[k], 1810 + &mode_lib->vba.MacroTileHeightC[k], 1811 + &mode_lib->vba.MacroTileWidthY[k], 1812 + &mode_lib->vba.MacroTileWidthC[k]); 1771 1813 } 1772 1814 1773 1815 /*Bandwidth Support Check*/ ··· 1992 2034 dml32_CalculateODMMode( 1993 2035 mode_lib->vba.MaximumPixelsPerLinePerDSCUnit, 1994 2036 mode_lib->vba.HActive[k], 2037 + mode_lib->vba.OutputFormat[k], 1995 2038 mode_lib->vba.Output[k], 1996 2039 mode_lib->vba.ODMUse[k], 1997 2040 mode_lib->vba.MaxDispclk[i], ··· 2014 2055 dml32_CalculateODMMode( 2015 2056 mode_lib->vba.MaximumPixelsPerLinePerDSCUnit, 2016 2057 mode_lib->vba.HActive[k], 2058 + mode_lib->vba.OutputFormat[k], 2017 2059 mode_lib->vba.Output[k], 2018 2060 mode_lib->vba.ODMUse[k], 2019 2061 mode_lib->vba.MaxDispclk[i], ··· 2619 2659 mode_lib->vba.Read256BlockWidthC, 2620 2660 mode_lib->vba.Read256BlockHeightY, 2621 2661 mode_lib->vba.Read256BlockHeightC, 2622 - mode_lib->vba.MicroTileWidthY, 2623 - mode_lib->vba.MicroTileWidthC, 2624 - mode_lib->vba.MicroTileHeightY, 2625 - mode_lib->vba.MicroTileHeightC, 2662 + mode_lib->vba.MacroTileWidthY, 2663 + mode_lib->vba.MacroTileWidthC, 2664 + mode_lib->vba.MacroTileHeightY, 2665 + mode_lib->vba.MacroTileHeightC, 2626 2666 2627 2667 /* Output */ 2628 2668 mode_lib->vba.SurfaceSizeInMALL, ··· 2669 2709 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesY = mode_lib->vba.Read256BlockHeightY[k]; 2670 2710 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidth256BytesC = mode_lib->vba.Read256BlockWidthC[k]; 2671 2711 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesC = mode_lib->vba.Read256BlockHeightC[k]; 2672 - v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MicroTileWidthY[k]; 2673 - v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MicroTileHeightY[k]; 2674 - v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MicroTileWidthC[k]; 2675 - v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MicroTileHeightC[k]; 2712 + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MacroTileWidthY[k]; 2713 + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MacroTileHeightY[k]; 2714 + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MacroTileWidthC[k]; 2715 + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MacroTileHeightC[k]; 2676 2716 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].InterlaceEnable = mode_lib->vba.Interlace[k]; 2677 2717 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].HTotal = mode_lib->vba.HTotal[k]; 2678 2718 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DCCEnable = mode_lib->vba.DCCEnable[k]; ··· 3218 3258 3219 3259 mode_lib->vba.NoTimeForPrefetch[i][j][k] = 3220 3260 dml32_CalculatePrefetchSchedule( 3261 + v, 3262 + k, 3221 3263 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor, 3222 3264 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe, 3223 - mode_lib->vba.DSCDelayPerState[i][k], 3224 - mode_lib->vba.DPPCLKDelaySubtotal + 3225 - mode_lib->vba.DPPCLKDelayCNVCFormater, 3226 - mode_lib->vba.DPPCLKDelaySCL, 3227 - mode_lib->vba.DPPCLKDelaySCLLBOnly, 3228 - mode_lib->vba.DPPCLKDelayCNVCCursor, 3229 - mode_lib->vba.DISPCLKDelaySubtotal, 3230 - mode_lib->vba.SwathWidthYThisState[k] / 3231 - mode_lib->vba.HRatio[k], 3232 - mode_lib->vba.OutputFormat[k], 3233 - mode_lib->vba.MaxInterDCNTileRepeaters, 3234 - dml_min(mode_lib->vba.MaxVStartup, 3235 - mode_lib->vba.MaximumVStartup[i][j][k]), 3236 - mode_lib->vba.MaximumVStartup[i][j][k], 3237 - mode_lib->vba.GPUVMMaxPageTableLevels, 3238 - mode_lib->vba.GPUVMEnable, mode_lib->vba.HostVMEnable, 3239 - mode_lib->vba.HostVMMaxNonCachedPageTableLevels, 3240 - mode_lib->vba.HostVMMinPageSize, 3241 - mode_lib->vba.DynamicMetadataEnable[k], 3242 - mode_lib->vba.DynamicMetadataVMEnabled, 3243 - mode_lib->vba.DynamicMetadataLinesBeforeActiveRequired[k], 3244 - mode_lib->vba.DynamicMetadataTransmittedBytes[k], 3245 - mode_lib->vba.UrgLatency[i], 3246 - mode_lib->vba.ExtraLatency, 3247 - mode_lib->vba.TimeCalc, 3248 - mode_lib->vba.PDEAndMetaPTEBytesPerFrame[i][j][k], 3249 - mode_lib->vba.MetaRowBytes[i][j][k], 3250 - mode_lib->vba.DPTEBytesPerRow[i][j][k], 3251 - mode_lib->vba.PrefetchLinesY[i][j][k], 3252 - mode_lib->vba.SwathWidthYThisState[k], 3253 - mode_lib->vba.PrefillY[k], 3254 - mode_lib->vba.MaxNumSwY[k], 3255 - mode_lib->vba.PrefetchLinesC[i][j][k], 3256 - mode_lib->vba.SwathWidthCThisState[k], 3257 - mode_lib->vba.PrefillC[k], 3258 - mode_lib->vba.MaxNumSwC[k], 3259 - mode_lib->vba.swath_width_luma_ub_this_state[k], 3260 - mode_lib->vba.swath_width_chroma_ub_this_state[k], 3261 - mode_lib->vba.SwathHeightYThisState[k], 3262 - mode_lib->vba.SwathHeightCThisState[k], mode_lib->vba.TWait, 3265 + v->DSCDelayPerState[i][k], 3266 + v->SwathWidthYThisState[k] / v->HRatio[k], 3267 + dml_min(v->MaxVStartup, v->MaximumVStartup[i][j][k]), 3268 + v->MaximumVStartup[i][j][k], 3269 + v->UrgLatency[i], 3270 + v->ExtraLatency, 3271 + v->TimeCalc, 3272 + v->PDEAndMetaPTEBytesPerFrame[i][j][k], 3273 + v->MetaRowBytes[i][j][k], 3274 + v->DPTEBytesPerRow[i][j][k], 3275 + v->PrefetchLinesY[i][j][k], 3276 + v->SwathWidthYThisState[k], 3277 + v->PrefillY[k], 3278 + v->MaxNumSwY[k], 3279 + v->PrefetchLinesC[i][j][k], 3280 + v->SwathWidthCThisState[k], 3281 + v->PrefillC[k], 3282 + v->MaxNumSwC[k], 3283 + v->swath_width_luma_ub_this_state[k], 3284 + v->swath_width_chroma_ub_this_state[k], 3285 + v->SwathHeightYThisState[k], 3286 + v->SwathHeightCThisState[k], v->TWait, 3263 3287 3264 3288 /* Output */ 3265 3289 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k], 3266 3290 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler[k], 3267 - &mode_lib->vba.LineTimesForPrefetch[k], 3268 - &mode_lib->vba.PrefetchBW[k], 3269 - &mode_lib->vba.LinesForMetaPTE[k], 3270 - &mode_lib->vba.LinesForMetaAndDPTERow[k], 3271 - &mode_lib->vba.VRatioPreY[i][j][k], 3272 - &mode_lib->vba.VRatioPreC[i][j][k], 3273 - &mode_lib->vba.RequiredPrefetchPixelDataBWLuma[0][0][k], 3274 - &mode_lib->vba.RequiredPrefetchPixelDataBWChroma[0][0][k], 3275 - &mode_lib->vba.NoTimeForDynamicMetadata[i][j][k], 3276 - &mode_lib->vba.Tno_bw[k], 3277 - &mode_lib->vba.prefetch_vmrow_bw[k], 3291 + &v->LineTimesForPrefetch[k], 3292 + &v->PrefetchBW[k], 3293 + &v->LinesForMetaPTE[k], 3294 + &v->LinesForMetaAndDPTERow[k], 3295 + &v->VRatioPreY[i][j][k], 3296 + &v->VRatioPreC[i][j][k], 3297 + &v->RequiredPrefetchPixelDataBWLuma[0][0][k], 3298 + &v->RequiredPrefetchPixelDataBWChroma[0][0][k], 3299 + &v->NoTimeForDynamicMetadata[i][j][k], 3300 + &v->Tno_bw[k], 3301 + &v->prefetch_vmrow_bw[k], 3278 3302 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[0], // double *Tdmdl_vm 3279 3303 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[1], // double *Tdmdl 3280 3304 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[2], // double *TSetup ··· 3501 3557 3502 3558 { 3503 3559 dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport( 3504 - mode_lib->vba.USRRetrainingRequiredFinal, 3505 - mode_lib->vba.UsesMALLForPStateChange, 3506 - mode_lib->vba.PrefetchModePerState[i][j], 3507 - mode_lib->vba.NumberOfActiveSurfaces, 3508 - mode_lib->vba.MaxLineBufferLines, 3509 - mode_lib->vba.LineBufferSizeFinal, 3510 - mode_lib->vba.WritebackInterfaceBufferSize, 3511 - mode_lib->vba.DCFCLKState[i][j], 3512 - mode_lib->vba.ReturnBWPerState[i][j], 3513 - mode_lib->vba.SynchronizeTimingsFinal, 3514 - mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal, 3515 - mode_lib->vba.DRRDisplay, 3516 - mode_lib->vba.dpte_group_bytes, 3517 - mode_lib->vba.meta_row_height, 3518 - mode_lib->vba.meta_row_height_chroma, 3560 + v, 3561 + v->PrefetchModePerState[i][j], 3562 + v->DCFCLKState[i][j], 3563 + v->ReturnBWPerState[i][j], 3519 3564 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters, 3520 - mode_lib->vba.WritebackChunkSize, 3521 - mode_lib->vba.SOCCLKPerState[i], 3522 - mode_lib->vba.ProjectedDCFCLKDeepSleep[i][j], 3523 - mode_lib->vba.DETBufferSizeYThisState, 3524 - mode_lib->vba.DETBufferSizeCThisState, 3525 - mode_lib->vba.SwathHeightYThisState, 3526 - mode_lib->vba.SwathHeightCThisState, 3527 - mode_lib->vba.LBBitPerPixel, 3528 - mode_lib->vba.SwathWidthYThisState, // 24 3529 - mode_lib->vba.SwathWidthCThisState, 3530 - mode_lib->vba.HRatio, 3531 - mode_lib->vba.HRatioChroma, 3532 - mode_lib->vba.vtaps, 3533 - mode_lib->vba.VTAPsChroma, 3534 - mode_lib->vba.VRatio, 3535 - mode_lib->vba.VRatioChroma, 3536 - mode_lib->vba.HTotal, 3537 - mode_lib->vba.VTotal, 3538 - mode_lib->vba.VActive, 3539 - mode_lib->vba.PixelClock, 3540 - mode_lib->vba.BlendingAndTiming, 3541 - mode_lib->vba.NoOfDPPThisState, 3542 - mode_lib->vba.BytePerPixelInDETY, 3543 - mode_lib->vba.BytePerPixelInDETC, 3565 + v->SOCCLKPerState[i], 3566 + v->ProjectedDCFCLKDeepSleep[i][j], 3567 + v->DETBufferSizeYThisState, 3568 + v->DETBufferSizeCThisState, 3569 + v->SwathHeightYThisState, 3570 + v->SwathHeightCThisState, 3571 + v->SwathWidthYThisState, // 24 3572 + v->SwathWidthCThisState, 3573 + v->NoOfDPPThisState, 3574 + v->BytePerPixelInDETY, 3575 + v->BytePerPixelInDETC, 3544 3576 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler, 3545 3577 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler, 3546 - mode_lib->vba.WritebackEnable, 3547 - mode_lib->vba.WritebackPixelFormat, 3548 - mode_lib->vba.WritebackDestinationWidth, 3549 - mode_lib->vba.WritebackDestinationHeight, 3550 - mode_lib->vba.WritebackSourceHeight, 3551 - mode_lib->vba.UnboundedRequestEnabledThisState, 3552 - mode_lib->vba.CompressedBufferSizeInkByteThisState, 3578 + v->UnboundedRequestEnabledThisState, 3579 + v->CompressedBufferSizeInkByteThisState, 3553 3580 3554 3581 /* Output */ 3555 - &mode_lib->vba.Watermark, // Store the values in vba 3556 - &mode_lib->vba.DRAMClockChangeSupport[i][j], 3582 + &v->DRAMClockChangeSupport[i][j], 3557 3583 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[0], // double *MaxActiveDRAMClockChangeLatencySupported 3558 3584 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer[0], // Long SubViewportLinesNeededInMALL[] 3559 - &mode_lib->vba.FCLKChangeSupport[i][j], 3585 + &v->FCLKChangeSupport[i][j], 3560 3586 &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[1], // double *MinActiveFCLKChangeLatencySupported 3561 3587 &mode_lib->vba.USRRetrainingSupport[i][j], 3562 3588 mode_lib->vba.ActiveDRAMClockChangeLatencyMargin);
+165 -182
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
··· 27 27 #include "display_mode_vba_32.h" 28 28 #include "../display_mode_lib.h" 29 29 30 + #define DCN32_MAX_FMT_420_BUFFER_WIDTH 4096 31 + 30 32 unsigned int dml32_dscceComputeDelay( 31 33 unsigned int bpc, 32 34 double BPP, ··· 1184 1182 void dml32_CalculateODMMode( 1185 1183 unsigned int MaximumPixelsPerLinePerDSCUnit, 1186 1184 unsigned int HActive, 1185 + enum output_format_class OutFormat, 1187 1186 enum output_encoder_class Output, 1188 1187 enum odm_combine_policy ODMUse, 1189 1188 double StateDispclk, ··· 1255 1252 *NumberOfDPP = 1; 1256 1253 else 1257 1254 *TotalAvailablePipesSupport = false; 1255 + } 1256 + if (OutFormat == dm_420 && HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH && 1257 + ODMUse != dm_odm_combine_policy_4to1) { 1258 + if (HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH * 4) { 1259 + *ODMMode = dm_odm_combine_mode_disabled; 1260 + *NumberOfDPP = 0; 1261 + *TotalAvailablePipesSupport = false; 1262 + } else if (HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH * 2 || 1263 + *ODMMode == dm_odm_combine_mode_4to1) { 1264 + *ODMMode = dm_odm_combine_mode_4to1; 1265 + *RequiredDISPCLKPerSurface = SurfaceRequiredDISPCLKWithODMCombineFourToOne; 1266 + *NumberOfDPP = 4; 1267 + } else { 1268 + *ODMMode = dm_odm_combine_mode_2to1; 1269 + *RequiredDISPCLKPerSurface = SurfaceRequiredDISPCLKWithODMCombineTwoToOne; 1270 + *NumberOfDPP = 2; 1271 + } 1272 + } 1273 + if (Output == dm_hdmi && OutFormat == dm_420 && 1274 + HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH) { 1275 + *ODMMode = dm_odm_combine_mode_disabled; 1276 + *NumberOfDPP = 0; 1277 + *TotalAvailablePipesSupport = false; 1258 1278 } 1259 1279 } 1260 1280 ··· 3389 3363 } // CalculateExtraLatency 3390 3364 3391 3365 bool dml32_CalculatePrefetchSchedule( 3366 + struct vba_vars_st *v, 3367 + unsigned int k, 3392 3368 double HostVMInefficiencyFactor, 3393 3369 DmlPipe *myPipe, 3394 3370 unsigned int DSCDelay, 3395 - double DPPCLKDelaySubtotalPlusCNVCFormater, 3396 - double DPPCLKDelaySCL, 3397 - double DPPCLKDelaySCLLBOnly, 3398 - double DPPCLKDelayCNVCCursor, 3399 - double DISPCLKDelaySubtotal, 3400 3371 unsigned int DPP_RECOUT_WIDTH, 3401 - enum output_format_class OutputFormat, 3402 - unsigned int MaxInterDCNTileRepeaters, 3403 3372 unsigned int VStartup, 3404 3373 unsigned int MaxVStartup, 3405 - unsigned int GPUVMPageTableLevels, 3406 - bool GPUVMEnable, 3407 - bool HostVMEnable, 3408 - unsigned int HostVMMaxNonCachedPageTableLevels, 3409 - double HostVMMinPageSize, 3410 - bool DynamicMetadataEnable, 3411 - bool DynamicMetadataVMEnabled, 3412 - int DynamicMetadataLinesBeforeActiveRequired, 3413 - unsigned int DynamicMetadataTransmittedBytes, 3414 3374 double UrgentLatency, 3415 3375 double UrgentExtraLatency, 3416 3376 double TCalc, ··· 3437 3425 double *VUpdateWidthPix, 3438 3426 double *VReadyOffsetPix) 3439 3427 { 3428 + double DPPCLKDelaySubtotalPlusCNVCFormater = v->DPPCLKDelaySubtotal + v->DPPCLKDelayCNVCFormater; 3440 3429 bool MyError = false; 3441 3430 unsigned int DPPCycles, DISPCLKCycles; 3442 3431 double DSTTotalPixelsAfterScaler; ··· 3474 3461 double Tsw_est1 = 0; 3475 3462 double Tsw_est3 = 0; 3476 3463 3477 - if (GPUVMEnable == true && HostVMEnable == true) 3478 - HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels; 3464 + if (v->GPUVMEnable == true && v->HostVMEnable == true) 3465 + HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels; 3479 3466 else 3480 3467 HostVMDynamicLevelsTrips = 0; 3481 3468 #ifdef __DML_VBA_DEBUG__ 3482 - dml_print("DML::%s: GPUVMEnable = %d\n", __func__, GPUVMEnable); 3483 - dml_print("DML::%s: GPUVMPageTableLevels = %d\n", __func__, GPUVMPageTableLevels); 3469 + dml_print("DML::%s: v->GPUVMEnable = %d\n", __func__, v->GPUVMEnable); 3470 + dml_print("DML::%s: v->GPUVMMaxPageTableLevels = %d\n", __func__, v->GPUVMMaxPageTableLevels); 3484 3471 dml_print("DML::%s: DCCEnable = %d\n", __func__, myPipe->DCCEnable); 3485 - dml_print("DML::%s: HostVMEnable=%d HostVMInefficiencyFactor=%f\n", 3486 - __func__, HostVMEnable, HostVMInefficiencyFactor); 3472 + dml_print("DML::%s: v->HostVMEnable=%d HostVMInefficiencyFactor=%f\n", 3473 + __func__, v->HostVMEnable, HostVMInefficiencyFactor); 3487 3474 #endif 3488 3475 dml32_CalculateVUpdateAndDynamicMetadataParameters( 3489 - MaxInterDCNTileRepeaters, 3476 + v->MaxInterDCNTileRepeaters, 3490 3477 myPipe->Dppclk, 3491 3478 myPipe->Dispclk, 3492 3479 myPipe->DCFClkDeepSleep, 3493 3480 myPipe->PixelClock, 3494 3481 myPipe->HTotal, 3495 3482 myPipe->VBlank, 3496 - DynamicMetadataTransmittedBytes, 3497 - DynamicMetadataLinesBeforeActiveRequired, 3483 + v->DynamicMetadataTransmittedBytes[k], 3484 + v->DynamicMetadataLinesBeforeActiveRequired[k], 3498 3485 myPipe->InterlaceEnable, 3499 3486 myPipe->ProgressiveToInterlaceUnitInOPP, 3500 3487 TSetup, ··· 3509 3496 3510 3497 LineTime = myPipe->HTotal / myPipe->PixelClock; 3511 3498 trip_to_mem = UrgentLatency; 3512 - Tvm_trips = UrgentExtraLatency + trip_to_mem * (GPUVMPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1); 3499 + Tvm_trips = UrgentExtraLatency + trip_to_mem * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1); 3513 3500 3514 - if (DynamicMetadataVMEnabled == true) 3501 + if (v->DynamicMetadataVMEnabled == true) 3515 3502 *Tdmdl = TWait + Tvm_trips + trip_to_mem; 3516 3503 else 3517 3504 *Tdmdl = TWait + UrgentExtraLatency; 3518 3505 3519 3506 #ifdef __DML_VBA_ALLOW_DELTA__ 3520 - if (DynamicMetadataEnable == false) 3507 + if (v->DynamicMetadataEnable[k] == false) 3521 3508 *Tdmdl = 0.0; 3522 3509 #endif 3523 3510 3524 - if (DynamicMetadataEnable == true) { 3511 + if (v->DynamicMetadataEnable[k] == true) { 3525 3512 if (VStartup * LineTime < *TSetup + *Tdmdl + Tdmbf + Tdmec + Tdmsks) { 3526 3513 *NotEnoughTimeForDynamicMetadata = true; 3527 3514 #ifdef __DML_VBA_DEBUG__ ··· 3541 3528 *NotEnoughTimeForDynamicMetadata = false; 3542 3529 } 3543 3530 3544 - *Tdmdl_vm = (DynamicMetadataEnable == true && DynamicMetadataVMEnabled == true && 3545 - GPUVMEnable == true ? TWait + Tvm_trips : 0); 3531 + *Tdmdl_vm = (v->DynamicMetadataEnable[k] == true && v->DynamicMetadataVMEnabled == true && 3532 + v->GPUVMEnable == true ? TWait + Tvm_trips : 0); 3546 3533 3547 3534 if (myPipe->ScalerEnabled) 3548 - DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCL; 3535 + DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + v->DPPCLKDelaySCL; 3549 3536 else 3550 - DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCLLBOnly; 3537 + DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + v->DPPCLKDelaySCLLBOnly; 3551 3538 3552 - DPPCycles = DPPCycles + myPipe->NumberOfCursors * DPPCLKDelayCNVCCursor; 3539 + DPPCycles = DPPCycles + myPipe->NumberOfCursors * v->DPPCLKDelayCNVCCursor; 3553 3540 3554 - DISPCLKCycles = DISPCLKDelaySubtotal; 3541 + DISPCLKCycles = v->DISPCLKDelaySubtotal; 3555 3542 3556 3543 if (myPipe->Dppclk == 0.0 || myPipe->Dispclk == 0.0) 3557 3544 return true; ··· 3577 3564 dml_print("DML::%s: DSTXAfterScaler: %d\n", __func__, *DSTXAfterScaler); 3578 3565 #endif 3579 3566 3580 - if (OutputFormat == dm_420 || (myPipe->InterlaceEnable && myPipe->ProgressiveToInterlaceUnitInOPP)) 3567 + if (v->OutputFormat[k] == dm_420 || (myPipe->InterlaceEnable && myPipe->ProgressiveToInterlaceUnitInOPP)) 3581 3568 *DSTYAfterScaler = 1; 3582 3569 else 3583 3570 *DSTYAfterScaler = 0; ··· 3594 3581 3595 3582 Tr0_trips = trip_to_mem * (HostVMDynamicLevelsTrips + 1); 3596 3583 3597 - if (GPUVMEnable == true) { 3584 + if (v->GPUVMEnable == true) { 3598 3585 Tvm_trips_rounded = dml_ceil(4.0 * Tvm_trips / LineTime, 1.0) / 4.0 * LineTime; 3599 3586 Tr0_trips_rounded = dml_ceil(4.0 * Tr0_trips / LineTime, 1.0) / 4.0 * LineTime; 3600 - if (GPUVMPageTableLevels >= 3) { 3587 + if (v->GPUVMMaxPageTableLevels >= 3) { 3601 3588 *Tno_bw = UrgentExtraLatency + trip_to_mem * 3602 - (double) ((GPUVMPageTableLevels - 2) * (HostVMDynamicLevelsTrips + 1) - 1); 3603 - } else if (GPUVMPageTableLevels == 1 && myPipe->DCCEnable != true) { 3589 + (double) ((v->GPUVMMaxPageTableLevels - 2) * (HostVMDynamicLevelsTrips + 1) - 1); 3590 + } else if (v->GPUVMMaxPageTableLevels == 1 && myPipe->DCCEnable != true) { 3604 3591 Tr0_trips_rounded = dml_ceil(4.0 * UrgentExtraLatency / LineTime, 1.0) / 3605 3592 4.0 * LineTime; // VBA_ERROR 3606 3593 *Tno_bw = UrgentExtraLatency; ··· 3635 3622 min_Lsw = dml_max(min_Lsw, 1.0); 3636 3623 Lsw_oto = dml_ceil(4.0 * dml_max(prefetch_sw_bytes / prefetch_bw_oto / LineTime, min_Lsw), 1.0) / 4.0; 3637 3624 3638 - if (GPUVMEnable == true) { 3625 + if (v->GPUVMEnable == true) { 3639 3626 Tvm_oto = dml_max3( 3640 3627 Tvm_trips, 3641 3628 *Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_oto, ··· 3643 3630 } else 3644 3631 Tvm_oto = LineTime / 4.0; 3645 3632 3646 - if ((GPUVMEnable == true || myPipe->DCCEnable == true)) { 3633 + if ((v->GPUVMEnable == true || myPipe->DCCEnable == true)) { 3647 3634 Tr0_oto = dml_max4( 3648 3635 Tr0_trips, 3649 3636 (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_oto, ··· 3846 3833 #endif 3847 3834 3848 3835 if (prefetch_bw_equ > 0) { 3849 - if (GPUVMEnable == true) { 3836 + if (v->GPUVMEnable == true) { 3850 3837 Tvm_equ = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame * 3851 3838 HostVMInefficiencyFactor / prefetch_bw_equ, 3852 3839 Tvm_trips, LineTime / 4); ··· 3854 3841 Tvm_equ = LineTime / 4; 3855 3842 } 3856 3843 3857 - if ((GPUVMEnable == true || myPipe->DCCEnable == true)) { 3844 + if ((v->GPUVMEnable == true || myPipe->DCCEnable == true)) { 3858 3845 Tr0_equ = dml_max4((MetaRowByte + PixelPTEBytesPerRow * 3859 3846 HostVMInefficiencyFactor) / prefetch_bw_equ, Tr0_trips, 3860 3847 (LineTime - Tvm_equ) / 2, LineTime / 4); ··· 4219 4206 } // CalculateFlipSchedule 4220 4207 4221 4208 void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport( 4222 - bool USRRetrainingRequiredFinal, 4223 - enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[], 4209 + struct vba_vars_st *v, 4224 4210 unsigned int PrefetchMode, 4225 - unsigned int NumberOfActiveSurfaces, 4226 - unsigned int MaxLineBufferLines, 4227 - unsigned int LineBufferSize, 4228 - unsigned int WritebackInterfaceBufferSize, 4229 4211 double DCFCLK, 4230 4212 double ReturnBW, 4231 - bool SynchronizeTimingsFinal, 4232 - bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal, 4233 - bool DRRDisplay[], 4234 - unsigned int dpte_group_bytes[], 4235 - unsigned int meta_row_height[], 4236 - unsigned int meta_row_height_chroma[], 4237 4213 SOCParametersList mmSOCParameters, 4238 - unsigned int WritebackChunkSize, 4239 4214 double SOCCLK, 4240 4215 double DCFClkDeepSleep, 4241 4216 unsigned int DETBufferSizeY[], 4242 4217 unsigned int DETBufferSizeC[], 4243 4218 unsigned int SwathHeightY[], 4244 4219 unsigned int SwathHeightC[], 4245 - unsigned int LBBitPerPixel[], 4246 4220 double SwathWidthY[], 4247 4221 double SwathWidthC[], 4248 - double HRatio[], 4249 - double HRatioChroma[], 4250 - unsigned int VTaps[], 4251 - unsigned int VTapsChroma[], 4252 - double VRatio[], 4253 - double VRatioChroma[], 4254 - unsigned int HTotal[], 4255 - unsigned int VTotal[], 4256 - unsigned int VActive[], 4257 - double PixelClock[], 4258 - unsigned int BlendingAndTiming[], 4259 4222 unsigned int DPPPerSurface[], 4260 4223 double BytePerPixelDETY[], 4261 4224 double BytePerPixelDETC[], 4262 4225 double DSTXAfterScaler[], 4263 4226 double DSTYAfterScaler[], 4264 - bool WritebackEnable[], 4265 - enum source_format_class WritebackPixelFormat[], 4266 - double WritebackDestinationWidth[], 4267 - double WritebackDestinationHeight[], 4268 - double WritebackSourceHeight[], 4269 4227 bool UnboundedRequestEnabled, 4270 4228 unsigned int CompressedBufferSizeInkByte, 4271 4229 4272 4230 /* Output */ 4273 - Watermarks *Watermark, 4274 4231 enum clock_change_support *DRAMClockChangeSupport, 4275 4232 double MaxActiveDRAMClockChangeLatencySupported[], 4276 4233 unsigned int SubViewportLinesNeededInMALL[], ··· 4282 4299 unsigned int LBLatencyHidingSourceLinesY[DC__NUM_DPP__MAX]; 4283 4300 unsigned int LBLatencyHidingSourceLinesC[DC__NUM_DPP__MAX]; 4284 4301 4285 - Watermark->UrgentWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency; 4286 - Watermark->USRRetrainingWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency 4302 + v->Watermark.UrgentWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency; 4303 + v->Watermark.USRRetrainingWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency 4287 4304 + mmSOCParameters.USRRetrainingLatency + mmSOCParameters.SMNLatency; 4288 - Watermark->DRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency + Watermark->UrgentWatermark; 4289 - Watermark->FCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency + Watermark->UrgentWatermark; 4290 - Watermark->StutterExitWatermark = mmSOCParameters.SRExitTime + mmSOCParameters.ExtraLatency 4305 + v->Watermark.DRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency + v->Watermark.UrgentWatermark; 4306 + v->Watermark.FCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency + v->Watermark.UrgentWatermark; 4307 + v->Watermark.StutterExitWatermark = mmSOCParameters.SRExitTime + mmSOCParameters.ExtraLatency 4291 4308 + 10 / DCFClkDeepSleep; 4292 - Watermark->StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitTime + mmSOCParameters.ExtraLatency 4309 + v->Watermark.StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitTime + mmSOCParameters.ExtraLatency 4293 4310 + 10 / DCFClkDeepSleep; 4294 - Watermark->Z8StutterExitWatermark = mmSOCParameters.SRExitZ8Time + mmSOCParameters.ExtraLatency 4311 + v->Watermark.Z8StutterExitWatermark = mmSOCParameters.SRExitZ8Time + mmSOCParameters.ExtraLatency 4295 4312 + 10 / DCFClkDeepSleep; 4296 - Watermark->Z8StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitZ8Time 4313 + v->Watermark.Z8StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitZ8Time 4297 4314 + mmSOCParameters.ExtraLatency + 10 / DCFClkDeepSleep; 4298 4315 4299 4316 #ifdef __DML_VBA_DEBUG__ 4300 4317 dml_print("DML::%s: UrgentLatency = %f\n", __func__, mmSOCParameters.UrgentLatency); 4301 4318 dml_print("DML::%s: ExtraLatency = %f\n", __func__, mmSOCParameters.ExtraLatency); 4302 4319 dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, mmSOCParameters.DRAMClockChangeLatency); 4303 - dml_print("DML::%s: UrgentWatermark = %f\n", __func__, Watermark->UrgentWatermark); 4304 - dml_print("DML::%s: USRRetrainingWatermark = %f\n", __func__, Watermark->USRRetrainingWatermark); 4305 - dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, Watermark->DRAMClockChangeWatermark); 4306 - dml_print("DML::%s: FCLKChangeWatermark = %f\n", __func__, Watermark->FCLKChangeWatermark); 4307 - dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, Watermark->StutterExitWatermark); 4308 - dml_print("DML::%s: StutterEnterPlusExitWatermark = %f\n", __func__, Watermark->StutterEnterPlusExitWatermark); 4309 - dml_print("DML::%s: Z8StutterExitWatermark = %f\n", __func__, Watermark->Z8StutterExitWatermark); 4320 + dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->Watermark.UrgentWatermark); 4321 + dml_print("DML::%s: USRRetrainingWatermark = %f\n", __func__, v->Watermark.USRRetrainingWatermark); 4322 + dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->Watermark.DRAMClockChangeWatermark); 4323 + dml_print("DML::%s: FCLKChangeWatermark = %f\n", __func__, v->Watermark.FCLKChangeWatermark); 4324 + dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, v->Watermark.StutterExitWatermark); 4325 + dml_print("DML::%s: StutterEnterPlusExitWatermark = %f\n", __func__, v->Watermark.StutterEnterPlusExitWatermark); 4326 + dml_print("DML::%s: Z8StutterExitWatermark = %f\n", __func__, v->Watermark.Z8StutterExitWatermark); 4310 4327 dml_print("DML::%s: Z8StutterEnterPlusExitWatermark = %f\n", 4311 - __func__, Watermark->Z8StutterEnterPlusExitWatermark); 4328 + __func__, v->Watermark.Z8StutterEnterPlusExitWatermark); 4312 4329 #endif 4313 4330 4314 4331 4315 4332 TotalActiveWriteback = 0; 4316 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4317 - if (WritebackEnable[k] == true) 4333 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4334 + if (v->WritebackEnable[k] == true) 4318 4335 TotalActiveWriteback = TotalActiveWriteback + 1; 4319 4336 } 4320 4337 4321 4338 if (TotalActiveWriteback <= 1) { 4322 - Watermark->WritebackUrgentWatermark = mmSOCParameters.WritebackLatency; 4339 + v->Watermark.WritebackUrgentWatermark = mmSOCParameters.WritebackLatency; 4323 4340 } else { 4324 - Watermark->WritebackUrgentWatermark = mmSOCParameters.WritebackLatency 4325 - + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 4341 + v->Watermark.WritebackUrgentWatermark = mmSOCParameters.WritebackLatency 4342 + + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 4326 4343 } 4327 - if (USRRetrainingRequiredFinal) 4328 - Watermark->WritebackUrgentWatermark = Watermark->WritebackUrgentWatermark 4344 + if (v->USRRetrainingRequiredFinal) 4345 + v->Watermark.WritebackUrgentWatermark = v->Watermark.WritebackUrgentWatermark 4329 4346 + mmSOCParameters.USRRetrainingLatency; 4330 4347 4331 4348 if (TotalActiveWriteback <= 1) { 4332 - Watermark->WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency 4349 + v->Watermark.WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency 4333 4350 + mmSOCParameters.WritebackLatency; 4334 - Watermark->WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency 4351 + v->Watermark.WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency 4335 4352 + mmSOCParameters.WritebackLatency; 4336 4353 } else { 4337 - Watermark->WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency 4338 - + mmSOCParameters.WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 4339 - Watermark->WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency 4340 - + mmSOCParameters.WritebackLatency + WritebackChunkSize * 1024 / 32 / SOCCLK; 4354 + v->Watermark.WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency 4355 + + mmSOCParameters.WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK; 4356 + v->Watermark.WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency 4357 + + mmSOCParameters.WritebackLatency + v->WritebackChunkSize * 1024 / 32 / SOCCLK; 4341 4358 } 4342 4359 4343 - if (USRRetrainingRequiredFinal) 4344 - Watermark->WritebackDRAMClockChangeWatermark = Watermark->WritebackDRAMClockChangeWatermark 4360 + if (v->USRRetrainingRequiredFinal) 4361 + v->Watermark.WritebackDRAMClockChangeWatermark = v->Watermark.WritebackDRAMClockChangeWatermark 4345 4362 + mmSOCParameters.USRRetrainingLatency; 4346 4363 4347 - if (USRRetrainingRequiredFinal) 4348 - Watermark->WritebackFCLKChangeWatermark = Watermark->WritebackFCLKChangeWatermark 4364 + if (v->USRRetrainingRequiredFinal) 4365 + v->Watermark.WritebackFCLKChangeWatermark = v->Watermark.WritebackFCLKChangeWatermark 4349 4366 + mmSOCParameters.USRRetrainingLatency; 4350 4367 4351 4368 #ifdef __DML_VBA_DEBUG__ 4352 4369 dml_print("DML::%s: WritebackDRAMClockChangeWatermark = %f\n", 4353 - __func__, Watermark->WritebackDRAMClockChangeWatermark); 4354 - dml_print("DML::%s: WritebackFCLKChangeWatermark = %f\n", __func__, Watermark->WritebackFCLKChangeWatermark); 4355 - dml_print("DML::%s: WritebackUrgentWatermark = %f\n", __func__, Watermark->WritebackUrgentWatermark); 4356 - dml_print("DML::%s: USRRetrainingRequiredFinal = %d\n", __func__, USRRetrainingRequiredFinal); 4370 + __func__, v->Watermark.WritebackDRAMClockChangeWatermark); 4371 + dml_print("DML::%s: WritebackFCLKChangeWatermark = %f\n", __func__, v->Watermark.WritebackFCLKChangeWatermark); 4372 + dml_print("DML::%s: WritebackUrgentWatermark = %f\n", __func__, v->Watermark.WritebackUrgentWatermark); 4373 + dml_print("DML::%s: v->USRRetrainingRequiredFinal = %d\n", __func__, v->USRRetrainingRequiredFinal); 4357 4374 dml_print("DML::%s: USRRetrainingLatency = %f\n", __func__, mmSOCParameters.USRRetrainingLatency); 4358 4375 #endif 4359 4376 4360 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4361 - TotalPixelBW = TotalPixelBW + DPPPerSurface[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + 4362 - SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k]) / (HTotal[k] / PixelClock[k]); 4377 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4378 + TotalPixelBW = TotalPixelBW + DPPPerSurface[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + 4379 + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k]) / (v->HTotal[k] / v->PixelClock[k]); 4363 4380 } 4364 4381 4365 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4382 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4366 4383 4367 - LBLatencyHidingSourceLinesY[k] = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (VTaps[k] - 1); 4368 - LBLatencyHidingSourceLinesC[k] = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTapsChroma[k] - 1); 4384 + LBLatencyHidingSourceLinesY[k] = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSizeFinal / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1); 4385 + LBLatencyHidingSourceLinesC[k] = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSizeFinal / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1); 4369 4386 4370 4387 4371 4388 #ifdef __DML_VBA_DEBUG__ 4372 - dml_print("DML::%s: k=%d, MaxLineBufferLines = %d\n", __func__, k, MaxLineBufferLines); 4373 - dml_print("DML::%s: k=%d, LineBufferSize = %d\n", __func__, k, LineBufferSize); 4374 - dml_print("DML::%s: k=%d, LBBitPerPixel = %d\n", __func__, k, LBBitPerPixel[k]); 4375 - dml_print("DML::%s: k=%d, HRatio = %f\n", __func__, k, HRatio[k]); 4376 - dml_print("DML::%s: k=%d, VTaps = %d\n", __func__, k, VTaps[k]); 4389 + dml_print("DML::%s: k=%d, v->MaxLineBufferLines = %d\n", __func__, k, v->MaxLineBufferLines); 4390 + dml_print("DML::%s: k=%d, v->LineBufferSizeFinal = %d\n", __func__, k, v->LineBufferSizeFinal); 4391 + dml_print("DML::%s: k=%d, v->LBBitPerPixel = %d\n", __func__, k, v->LBBitPerPixel[k]); 4392 + dml_print("DML::%s: k=%d, v->HRatio = %f\n", __func__, k, v->HRatio[k]); 4393 + dml_print("DML::%s: k=%d, v->vtaps = %d\n", __func__, k, v->vtaps[k]); 4377 4394 #endif 4378 4395 4379 - EffectiveLBLatencyHidingY = LBLatencyHidingSourceLinesY[k] / VRatio[k] * (HTotal[k] / PixelClock[k]); 4380 - EffectiveLBLatencyHidingC = LBLatencyHidingSourceLinesC[k] / VRatioChroma[k] * (HTotal[k] / PixelClock[k]); 4396 + EffectiveLBLatencyHidingY = LBLatencyHidingSourceLinesY[k] / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]); 4397 + EffectiveLBLatencyHidingC = LBLatencyHidingSourceLinesC[k] / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]); 4381 4398 EffectiveDETBufferSizeY = DETBufferSizeY[k]; 4382 4399 4383 4400 if (UnboundedRequestEnabled) { 4384 4401 EffectiveDETBufferSizeY = EffectiveDETBufferSizeY 4385 4402 + CompressedBufferSizeInkByte * 1024 4386 - * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k]) 4387 - / (HTotal[k] / PixelClock[k]) / TotalPixelBW; 4403 + * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k]) 4404 + / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW; 4388 4405 } 4389 4406 4390 4407 LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k]; 4391 4408 LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]); 4392 - FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k]; 4409 + FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k]; 4393 4410 4394 4411 ActiveClockChangeLatencyHidingY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY 4395 - - (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k]; 4412 + - (DSTXAfterScaler[k] / v->HTotal[k] + DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k]; 4396 4413 4397 - if (NumberOfActiveSurfaces > 1) { 4414 + if (v->NumberOfActiveSurfaces > 1) { 4398 4415 ActiveClockChangeLatencyHidingY = ActiveClockChangeLatencyHidingY 4399 - - (1 - 1 / NumberOfActiveSurfaces) * SwathHeightY[k] * HTotal[k] 4400 - / PixelClock[k] / VRatio[k]; 4416 + - (1 - 1 / v->NumberOfActiveSurfaces) * SwathHeightY[k] * v->HTotal[k] 4417 + / v->PixelClock[k] / v->VRatio[k]; 4401 4418 } 4402 4419 4403 4420 if (BytePerPixelDETC[k] > 0) { 4404 4421 LinesInDETC[k] = DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k]; 4405 4422 LinesInDETCRoundedDownToSwath[k] = dml_floor(LinesInDETC[k], SwathHeightC[k]); 4406 - FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) 4407 - / VRatioChroma[k]; 4423 + FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) 4424 + / v->VRatioChroma[k]; 4408 4425 ActiveClockChangeLatencyHidingC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC 4409 - - (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] 4410 - / PixelClock[k]; 4411 - if (NumberOfActiveSurfaces > 1) { 4426 + - (DSTXAfterScaler[k] / v->HTotal[k] + DSTYAfterScaler[k]) * v->HTotal[k] 4427 + / v->PixelClock[k]; 4428 + if (v->NumberOfActiveSurfaces > 1) { 4412 4429 ActiveClockChangeLatencyHidingC = ActiveClockChangeLatencyHidingC 4413 - - (1 - 1 / NumberOfActiveSurfaces) * SwathHeightC[k] * HTotal[k] 4414 - / PixelClock[k] / VRatioChroma[k]; 4430 + - (1 - 1 / v->NumberOfActiveSurfaces) * SwathHeightC[k] * v->HTotal[k] 4431 + / v->PixelClock[k] / v->VRatioChroma[k]; 4415 4432 } 4416 4433 ActiveClockChangeLatencyHiding = dml_min(ActiveClockChangeLatencyHidingY, 4417 4434 ActiveClockChangeLatencyHidingC); ··· 4419 4436 ActiveClockChangeLatencyHiding = ActiveClockChangeLatencyHidingY; 4420 4437 } 4421 4438 4422 - ActiveDRAMClockChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - Watermark->UrgentWatermark 4423 - - Watermark->DRAMClockChangeWatermark; 4424 - ActiveFCLKChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - Watermark->UrgentWatermark 4425 - - Watermark->FCLKChangeWatermark; 4426 - USRRetrainingLatencyMargin[k] = ActiveClockChangeLatencyHiding - Watermark->USRRetrainingWatermark; 4439 + ActiveDRAMClockChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - v->Watermark.UrgentWatermark 4440 + - v->Watermark.DRAMClockChangeWatermark; 4441 + ActiveFCLKChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - v->Watermark.UrgentWatermark 4442 + - v->Watermark.FCLKChangeWatermark; 4443 + USRRetrainingLatencyMargin[k] = ActiveClockChangeLatencyHiding - v->Watermark.USRRetrainingWatermark; 4427 4444 4428 - if (WritebackEnable[k]) { 4429 - WritebackLatencyHiding = WritebackInterfaceBufferSize * 1024 4430 - / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] 4431 - / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4); 4432 - if (WritebackPixelFormat[k] == dm_444_64) 4445 + if (v->WritebackEnable[k]) { 4446 + WritebackLatencyHiding = v->WritebackInterfaceBufferSize * 1024 4447 + / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] 4448 + / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4); 4449 + if (v->WritebackPixelFormat[k] == dm_444_64) 4433 4450 WritebackLatencyHiding = WritebackLatencyHiding / 2; 4434 4451 4435 4452 WritebackDRAMClockChangeLatencyMargin = WritebackLatencyHiding 4436 - - Watermark->WritebackDRAMClockChangeWatermark; 4453 + - v->Watermark.WritebackDRAMClockChangeWatermark; 4437 4454 4438 4455 WritebackFCLKChangeLatencyMargin = WritebackLatencyHiding 4439 - - Watermark->WritebackFCLKChangeWatermark; 4456 + - v->Watermark.WritebackFCLKChangeWatermark; 4440 4457 4441 4458 ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMargin[k], 4442 4459 WritebackFCLKChangeLatencyMargin); ··· 4444 4461 WritebackDRAMClockChangeLatencyMargin); 4445 4462 } 4446 4463 MaxActiveDRAMClockChangeLatencySupported[k] = 4447 - (UseMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe) ? 4464 + (v->UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe) ? 4448 4465 0 : 4449 4466 (ActiveDRAMClockChangeLatencyMargin[k] 4450 4467 + mmSOCParameters.DRAMClockChangeLatency); 4451 4468 } 4452 4469 4453 - for (i = 0; i < NumberOfActiveSurfaces; ++i) { 4454 - for (j = 0; j < NumberOfActiveSurfaces; ++j) { 4470 + for (i = 0; i < v->NumberOfActiveSurfaces; ++i) { 4471 + for (j = 0; j < v->NumberOfActiveSurfaces; ++j) { 4455 4472 if (i == j || 4456 - (BlendingAndTiming[i] == i && BlendingAndTiming[j] == i) || 4457 - (BlendingAndTiming[j] == j && BlendingAndTiming[i] == j) || 4458 - (BlendingAndTiming[i] == BlendingAndTiming[j] && BlendingAndTiming[i] != i) || 4459 - (SynchronizeTimingsFinal && PixelClock[i] == PixelClock[j] && 4460 - HTotal[i] == HTotal[j] && VTotal[i] == VTotal[j] && 4461 - VActive[i] == VActive[j]) || (SynchronizeDRRDisplaysForUCLKPStateChangeFinal && 4462 - (DRRDisplay[i] || DRRDisplay[j]))) { 4473 + (v->BlendingAndTiming[i] == i && v->BlendingAndTiming[j] == i) || 4474 + (v->BlendingAndTiming[j] == j && v->BlendingAndTiming[i] == j) || 4475 + (v->BlendingAndTiming[i] == v->BlendingAndTiming[j] && v->BlendingAndTiming[i] != i) || 4476 + (v->SynchronizeTimingsFinal && v->PixelClock[i] == v->PixelClock[j] && 4477 + v->HTotal[i] == v->HTotal[j] && v->VTotal[i] == v->VTotal[j] && 4478 + v->VActive[i] == v->VActive[j]) || (v->SynchronizeDRRDisplaysForUCLKPStateChangeFinal && 4479 + (v->DRRDisplay[i] || v->DRRDisplay[j]))) { 4463 4480 SynchronizedSurfaces[i][j] = true; 4464 4481 } else { 4465 4482 SynchronizedSurfaces[i][j] = false; ··· 4467 4484 } 4468 4485 } 4469 4486 4470 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4471 - if ((UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) && 4487 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4488 + if ((v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) && 4472 4489 (!FoundFirstSurfaceWithMinActiveFCLKChangeMargin || 4473 4490 ActiveFCLKChangeLatencyMargin[k] < MinActiveFCLKChangeMargin)) { 4474 4491 FoundFirstSurfaceWithMinActiveFCLKChangeMargin = true; ··· 4480 4497 *MinActiveFCLKChangeLatencySupported = MinActiveFCLKChangeMargin + mmSOCParameters.FCLKChangeLatency; 4481 4498 4482 4499 SameTimingForFCLKChange = true; 4483 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4500 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4484 4501 if (!SynchronizedSurfaces[k][SurfaceWithMinActiveFCLKChangeMargin]) { 4485 - if ((UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) && 4502 + if ((v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) && 4486 4503 (SameTimingForFCLKChange || 4487 4504 ActiveFCLKChangeLatencyMargin[k] < 4488 4505 SecondMinActiveFCLKChangeMarginOneDisplayInVBLank)) { ··· 4502 4519 } 4503 4520 4504 4521 *USRRetrainingSupport = true; 4505 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4506 - if ((UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) && 4522 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4523 + if ((v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) && 4507 4524 (USRRetrainingLatencyMargin[k] < 0)) { 4508 4525 *USRRetrainingSupport = false; 4509 4526 } 4510 4527 } 4511 4528 4512 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4513 - if (UseMALLForPStateChange[k] != dm_use_mall_pstate_change_full_frame && 4514 - UseMALLForPStateChange[k] != dm_use_mall_pstate_change_sub_viewport && 4515 - UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe && 4529 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4530 + if (v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_full_frame && 4531 + v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_sub_viewport && 4532 + v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe && 4516 4533 ActiveDRAMClockChangeLatencyMargin[k] < 0) { 4517 4534 if (PrefetchMode > 0) { 4518 4535 DRAMClockChangeSupportNumber = 2; ··· 4526 4543 } 4527 4544 } 4528 4545 4529 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4530 - if (UseMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame) 4546 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4547 + if (v->UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame) 4531 4548 DRAMClockChangeMethod = 1; 4532 - else if (UseMALLForPStateChange[k] == dm_use_mall_pstate_change_sub_viewport) 4549 + else if (v->UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_sub_viewport) 4533 4550 DRAMClockChangeMethod = 2; 4534 4551 } 4535 4552 ··· 4556 4573 *DRAMClockChangeSupport = dm_dram_clock_change_unsupported; 4557 4574 } 4558 4575 4559 - for (k = 0; k < NumberOfActiveSurfaces; ++k) { 4576 + for (k = 0; k < v->NumberOfActiveSurfaces; ++k) { 4560 4577 unsigned int dst_y_pstate; 4561 4578 unsigned int src_y_pstate_l; 4562 4579 unsigned int src_y_pstate_c; 4563 4580 unsigned int src_y_ahead_l, src_y_ahead_c, sub_vp_lines_l, sub_vp_lines_c; 4564 4581 4565 - dst_y_pstate = dml_ceil((mmSOCParameters.DRAMClockChangeLatency + mmSOCParameters.UrgentLatency) / (HTotal[k] / PixelClock[k]), 1); 4566 - src_y_pstate_l = dml_ceil(dst_y_pstate * VRatio[k], SwathHeightY[k]); 4582 + dst_y_pstate = dml_ceil((mmSOCParameters.DRAMClockChangeLatency + mmSOCParameters.UrgentLatency) / (v->HTotal[k] / v->PixelClock[k]), 1); 4583 + src_y_pstate_l = dml_ceil(dst_y_pstate * v->VRatio[k], SwathHeightY[k]); 4567 4584 src_y_ahead_l = dml_floor(DETBufferSizeY[k] / BytePerPixelDETY[k] / SwathWidthY[k], SwathHeightY[k]) + LBLatencyHidingSourceLinesY[k]; 4568 - sub_vp_lines_l = src_y_pstate_l + src_y_ahead_l + meta_row_height[k]; 4585 + sub_vp_lines_l = src_y_pstate_l + src_y_ahead_l + v->meta_row_height[k]; 4569 4586 4570 4587 #ifdef __DML_VBA_DEBUG__ 4571 4588 dml_print("DML::%s: k=%d, DETBufferSizeY = %d\n", __func__, k, DETBufferSizeY[k]); ··· 4576 4593 dml_print("DML::%s: k=%d, dst_y_pstate = %d\n", __func__, k, dst_y_pstate); 4577 4594 dml_print("DML::%s: k=%d, src_y_pstate_l = %d\n", __func__, k, src_y_pstate_l); 4578 4595 dml_print("DML::%s: k=%d, src_y_ahead_l = %d\n", __func__, k, src_y_ahead_l); 4579 - dml_print("DML::%s: k=%d, meta_row_height = %d\n", __func__, k, meta_row_height[k]); 4596 + dml_print("DML::%s: k=%d, v->meta_row_height = %d\n", __func__, k, v->meta_row_height[k]); 4580 4597 dml_print("DML::%s: k=%d, sub_vp_lines_l = %d\n", __func__, k, sub_vp_lines_l); 4581 4598 #endif 4582 4599 SubViewportLinesNeededInMALL[k] = sub_vp_lines_l; 4583 4600 4584 4601 if (BytePerPixelDETC[k] > 0) { 4585 - src_y_pstate_c = dml_ceil(dst_y_pstate * VRatioChroma[k], SwathHeightC[k]); 4602 + src_y_pstate_c = dml_ceil(dst_y_pstate * v->VRatioChroma[k], SwathHeightC[k]); 4586 4603 src_y_ahead_c = dml_floor(DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k], SwathHeightC[k]) + LBLatencyHidingSourceLinesC[k]; 4587 - sub_vp_lines_c = src_y_pstate_c + src_y_ahead_c + meta_row_height_chroma[k]; 4604 + sub_vp_lines_c = src_y_pstate_c + src_y_ahead_c + v->meta_row_height_chroma[k]; 4588 4605 SubViewportLinesNeededInMALL[k] = dml_max(sub_vp_lines_l, sub_vp_lines_c); 4589 4606 4590 4607 #ifdef __DML_VBA_DEBUG__ 4591 4608 dml_print("DML::%s: k=%d, src_y_pstate_c = %d\n", __func__, k, src_y_pstate_c); 4592 4609 dml_print("DML::%s: k=%d, src_y_ahead_c = %d\n", __func__, k, src_y_ahead_c); 4593 - dml_print("DML::%s: k=%d, meta_row_height_chroma = %d\n", __func__, k, meta_row_height_chroma[k]); 4610 + dml_print("DML::%s: k=%d, v->meta_row_height_chroma = %d\n", __func__, k, v->meta_row_height_chroma[k]); 4594 4611 dml_print("DML::%s: k=%d, sub_vp_lines_c = %d\n", __func__, k, sub_vp_lines_c); 4595 4612 #endif 4596 4613 }
+5 -47
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
··· 30 30 #include "os_types.h" 31 31 #include "../dc_features.h" 32 32 #include "../display_mode_structs.h" 33 + #include "dml/display_mode_vba.h" 33 34 34 35 unsigned int dml32_dscceComputeDelay( 35 36 unsigned int bpc, ··· 216 215 void dml32_CalculateODMMode( 217 216 unsigned int MaximumPixelsPerLinePerDSCUnit, 218 217 unsigned int HActive, 218 + enum output_format_class OutFormat, 219 219 enum output_encoder_class Output, 220 220 enum odm_combine_policy ODMUse, 221 221 double StateDispclk, ··· 714 712 unsigned int HostVMMaxNonCachedPageTableLevels); 715 713 716 714 bool dml32_CalculatePrefetchSchedule( 715 + struct vba_vars_st *v, 716 + unsigned int k, 717 717 double HostVMInefficiencyFactor, 718 718 DmlPipe *myPipe, 719 719 unsigned int DSCDelay, 720 - double DPPCLKDelaySubtotalPlusCNVCFormater, 721 - double DPPCLKDelaySCL, 722 - double DPPCLKDelaySCLLBOnly, 723 - double DPPCLKDelayCNVCCursor, 724 - double DISPCLKDelaySubtotal, 725 720 unsigned int DPP_RECOUT_WIDTH, 726 - enum output_format_class OutputFormat, 727 - unsigned int MaxInterDCNTileRepeaters, 728 721 unsigned int VStartup, 729 722 unsigned int MaxVStartup, 730 - unsigned int GPUVMPageTableLevels, 731 - bool GPUVMEnable, 732 - bool HostVMEnable, 733 - unsigned int HostVMMaxNonCachedPageTableLevels, 734 - double HostVMMinPageSize, 735 - bool DynamicMetadataEnable, 736 - bool DynamicMetadataVMEnabled, 737 - int DynamicMetadataLinesBeforeActiveRequired, 738 - unsigned int DynamicMetadataTransmittedBytes, 739 723 double UrgentLatency, 740 724 double UrgentExtraLatency, 741 725 double TCalc, ··· 795 807 bool *ImmediateFlipSupportedForPipe); 796 808 797 809 void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport( 798 - bool USRRetrainingRequiredFinal, 799 - enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[], 810 + struct vba_vars_st *v, 800 811 unsigned int PrefetchMode, 801 - unsigned int NumberOfActiveSurfaces, 802 - unsigned int MaxLineBufferLines, 803 - unsigned int LineBufferSize, 804 - unsigned int WritebackInterfaceBufferSize, 805 812 double DCFCLK, 806 813 double ReturnBW, 807 - bool SynchronizeTimingsFinal, 808 - bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal, 809 - bool DRRDisplay[], 810 - unsigned int dpte_group_bytes[], 811 - unsigned int meta_row_height[], 812 - unsigned int meta_row_height_chroma[], 813 814 SOCParametersList mmSOCParameters, 814 - unsigned int WritebackChunkSize, 815 815 double SOCCLK, 816 816 double DCFClkDeepSleep, 817 817 unsigned int DETBufferSizeY[], 818 818 unsigned int DETBufferSizeC[], 819 819 unsigned int SwathHeightY[], 820 820 unsigned int SwathHeightC[], 821 - unsigned int LBBitPerPixel[], 822 821 double SwathWidthY[], 823 822 double SwathWidthC[], 824 - double HRatio[], 825 - double HRatioChroma[], 826 - unsigned int VTaps[], 827 - unsigned int VTapsChroma[], 828 - double VRatio[], 829 - double VRatioChroma[], 830 - unsigned int HTotal[], 831 - unsigned int VTotal[], 832 - unsigned int VActive[], 833 - double PixelClock[], 834 - unsigned int BlendingAndTiming[], 835 823 unsigned int DPPPerSurface[], 836 824 double BytePerPixelDETY[], 837 825 double BytePerPixelDETC[], 838 826 double DSTXAfterScaler[], 839 827 double DSTYAfterScaler[], 840 - bool WritebackEnable[], 841 - enum source_format_class WritebackPixelFormat[], 842 - double WritebackDestinationWidth[], 843 - double WritebackDestinationHeight[], 844 - double WritebackSourceHeight[], 845 828 bool UnboundedRequestEnabled, 846 829 unsigned int CompressedBufferSizeInkByte, 847 830 848 831 /* Output */ 849 - Watermarks *Watermark, 850 832 enum clock_change_support *DRAMClockChangeSupport, 851 833 double MaxActiveDRAMClockChangeLatencySupported[], 852 834 unsigned int SubViewportLinesNeededInMALL[],
+12
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c
··· 35 35 #include "dcn30/display_rq_dlg_calc_30.h" 36 36 #include "dcn31/display_mode_vba_31.h" 37 37 #include "dcn31/display_rq_dlg_calc_31.h" 38 + #include "dcn314/display_mode_vba_314.h" 39 + #include "dcn314/display_rq_dlg_calc_314.h" 38 40 #include "dcn32/display_mode_vba_32.h" 39 41 #include "dcn32/display_rq_dlg_calc_32.h" 40 42 #include "dml_logger.h" ··· 76 74 .rq_dlg_get_rq_reg = dml31_rq_dlg_get_rq_reg 77 75 }; 78 76 77 + const struct dml_funcs dml314_funcs = { 78 + .validate = dml314_ModeSupportAndSystemConfigurationFull, 79 + .recalculate = dml314_recalculate, 80 + .rq_dlg_get_dlg_reg = dml314_rq_dlg_get_dlg_reg, 81 + .rq_dlg_get_rq_reg = dml314_rq_dlg_get_rq_reg 82 + }; 83 + 79 84 const struct dml_funcs dml32_funcs = { 80 85 .validate = dml32_ModeSupportAndSystemConfigurationFull, 81 86 .recalculate = dml32_recalculate, ··· 115 106 case DML_PROJECT_DCN31: 116 107 case DML_PROJECT_DCN31_FPGA: 117 108 lib->funcs = dml31_funcs; 109 + break; 110 + case DML_PROJECT_DCN314: 111 + lib->funcs = dml314_funcs; 118 112 break; 119 113 case DML_PROJECT_DCN32: 120 114 lib->funcs = dml32_funcs;
+1
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h
··· 41 41 DML_PROJECT_DCN30, 42 42 DML_PROJECT_DCN31, 43 43 DML_PROJECT_DCN31_FPGA, 44 + DML_PROJECT_DCN314, 44 45 DML_PROJECT_DCN32, 45 46 }; 46 47
+4 -6
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
··· 651 651 652 652 unsigned int OutputTypeAndRatePerState[DC__VOLTAGE_STATES][DC__NUM_DPP__MAX]; 653 653 double RequiredDISPCLKPerSurface[DC__VOLTAGE_STATES][2][DC__NUM_DPP__MAX]; 654 - unsigned int MicroTileHeightY[DC__NUM_DPP__MAX]; 655 - unsigned int MicroTileHeightC[DC__NUM_DPP__MAX]; 656 - unsigned int MicroTileWidthY[DC__NUM_DPP__MAX]; 657 - unsigned int MicroTileWidthC[DC__NUM_DPP__MAX]; 654 + unsigned int MacroTileHeightY[DC__NUM_DPP__MAX]; 655 + unsigned int MacroTileHeightC[DC__NUM_DPP__MAX]; 656 + unsigned int MacroTileWidthY[DC__NUM_DPP__MAX]; 657 + unsigned int MacroTileWidthC[DC__NUM_DPP__MAX]; 658 658 bool ImmediateFlipRequiredFinal; 659 659 bool DCCProgrammingAssumesScanDirectionUnknownFinal; 660 660 bool EnoughWritebackUnits; ··· 800 800 double PSCL_FACTOR[DC__NUM_DPP__MAX]; 801 801 double PSCL_FACTOR_CHROMA[DC__NUM_DPP__MAX]; 802 802 double MaximumVStartup[DC__VOLTAGE_STATES][2][DC__NUM_DPP__MAX]; 803 - unsigned int MacroTileWidthY[DC__NUM_DPP__MAX]; 804 - unsigned int MacroTileWidthC[DC__NUM_DPP__MAX]; 805 803 double AlignedDCCMetaPitch[DC__NUM_DPP__MAX]; 806 804 double AlignedYPitch[DC__NUM_DPP__MAX]; 807 805 double AlignedCPitch[DC__NUM_DPP__MAX];
+1
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h
··· 214 214 struct clk_bw_params { 215 215 unsigned int vram_type; 216 216 unsigned int num_channels; 217 + unsigned int dram_channel_width_bytes; 217 218 unsigned int dispclk_vco_khz; 218 219 unsigned int dc_mode_softmax_memclk; 219 220 struct clk_limit_table clk_table;
+4
drivers/gpu/drm/amd/display/dc/inc/resource.h
··· 219 219 struct dc_state *context, 220 220 uint8_t disabled_master_pipe_idx); 221 221 222 + void reset_sync_context_for_pipe(const struct dc *dc, 223 + struct dc_state *context, 224 + uint8_t pipe_idx); 225 + 222 226 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter); 223 227 224 228 const struct link_hwss *get_link_hwss(const struct dc_link *link,
+4
drivers/gpu/drm/amd/display/modules/color/color_gamma.c
··· 1600 1600 struct fixed31_32 lut2; 1601 1601 struct fixed31_32 delta_lut; 1602 1602 struct fixed31_32 delta_index; 1603 + const struct fixed31_32 one = dc_fixpt_from_int(1); 1603 1604 1604 1605 i = 0; 1605 1606 /* fixed_pt library has problems handling too small values */ ··· 1628 1627 hw_x = coordinates_x[i].regamma_y_blue; 1629 1628 } else 1630 1629 hw_x = coordinates_x[i].x; 1630 + 1631 + if (dc_fixpt_le(one, hw_x)) 1632 + hw_x = one; 1631 1633 1632 1634 norm_x = dc_fixpt_mul(norm_factor, hw_x); 1633 1635 index = dc_fixpt_floor(norm_x);
+11
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
··· 368 368 smu_baco->platform_support = 369 369 (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : 370 370 false; 371 + 372 + /* 373 + * Disable BACO entry/exit completely on below SKUs to 374 + * avoid hardware intermittent failures. 375 + */ 376 + if (((adev->pdev->device == 0x73A1) && 377 + (adev->pdev->revision == 0x00)) || 378 + ((adev->pdev->device == 0x73BF) && 379 + (adev->pdev->revision == 0xCF))) 380 + smu_baco->platform_support = false; 381 + 371 382 } 372 383 } 373 384
+2 -42
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 209 209 if (!adev->scpm_enabled) 210 210 return 0; 211 211 212 - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) 212 + if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) || 213 + (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0))) 213 214 return 0; 214 215 215 216 /* override pptable_id from driver parameter */ ··· 219 218 dev_info(adev->dev, "override pptable id %d\n", pptable_id); 220 219 } else { 221 220 pptable_id = smu->smu_table.boot_values.pp_table_id; 222 - 223 - /* 224 - * Temporary solution for SMU V13.0.0 with SCPM enabled: 225 - * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795 226 - * - use 36831 soft pptable when pptable_id is 3683 227 - */ 228 - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) { 229 - switch (pptable_id) { 230 - case 3664: 231 - case 3715: 232 - case 3795: 233 - pptable_id = 0; 234 - break; 235 - case 3683: 236 - pptable_id = 36831; 237 - break; 238 - default: 239 - dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id); 240 - return -EINVAL; 241 - } 242 - } 243 221 } 244 222 245 223 /* "pptable_id == 0" means vbios carries the pptable. */ ··· 451 471 } else { 452 472 pptable_id = smu->smu_table.boot_values.pp_table_id; 453 473 454 - /* 455 - * Temporary solution for SMU V13.0.0 with SCPM disabled: 456 - * - use 3664, 3683 or 3715 on request 457 - * - use 3664 when pptable_id is 0 458 - * TODO: drop these when the pptable carried in vbios is ready. 459 - */ 460 - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) { 461 - switch (pptable_id) { 462 - case 0: 463 - pptable_id = 3664; 464 - break; 465 - case 3664: 466 - case 3683: 467 - case 3715: 468 - break; 469 - default: 470 - dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id); 471 - return -EINVAL; 472 - } 473 - } 474 474 } 475 475 476 476 /* force using vbios pptable in sriov mode */
+3 -50
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 410 410 { 411 411 struct smu_table_context *smu_table = &smu->smu_table; 412 412 struct amdgpu_device *adev = smu->adev; 413 - uint32_t pptable_id; 414 413 int ret = 0; 415 414 416 - /* 417 - * With SCPM enabled, the pptable used will be signed. It cannot 418 - * be used directly by driver. To get the raw pptable, we need to 419 - * rely on the combo pptable(and its revelant SMU message). 420 - */ 421 - if (adev->scpm_enabled) { 422 - ret = smu_v13_0_0_get_pptable_from_pmfw(smu, 423 - &smu_table->power_play_table, 424 - &smu_table->power_play_table_size); 425 - } else { 426 - /* override pptable_id from driver parameter */ 427 - if (amdgpu_smu_pptable_id >= 0) { 428 - pptable_id = amdgpu_smu_pptable_id; 429 - dev_info(adev->dev, "override pptable id %d\n", pptable_id); 430 - } else { 431 - pptable_id = smu_table->boot_values.pp_table_id; 432 - } 433 - 434 - /* 435 - * Temporary solution for SMU V13.0.0 with SCPM disabled: 436 - * - use vbios carried pptable when pptable_id is 3664, 3715 or 3795 437 - * - use soft pptable when pptable_id is 3683 438 - */ 439 - if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) { 440 - switch (pptable_id) { 441 - case 3664: 442 - case 3715: 443 - case 3795: 444 - pptable_id = 0; 445 - break; 446 - case 3683: 447 - break; 448 - default: 449 - dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id); 450 - return -EINVAL; 451 - } 452 - } 453 - 454 - /* force using vbios pptable in sriov mode */ 455 - if ((amdgpu_sriov_vf(adev) || !pptable_id) && (amdgpu_emu_mode != 1)) 456 - ret = smu_v13_0_0_get_pptable_from_pmfw(smu, 457 - &smu_table->power_play_table, 458 - &smu_table->power_play_table_size); 459 - else 460 - ret = smu_v13_0_get_pptable_from_firmware(smu, 461 - &smu_table->power_play_table, 462 - &smu_table->power_play_table_size, 463 - pptable_id); 464 - } 415 + ret = smu_v13_0_0_get_pptable_from_pmfw(smu, 416 + &smu_table->power_play_table, 417 + &smu_table->power_play_table_size); 465 418 if (ret) 466 419 return ret; 467 420
+1 -3
drivers/gpu/drm/gma500/cdv_device.c
··· 581 581 static int cdv_chip_setup(struct drm_device *dev) 582 582 { 583 583 struct drm_psb_private *dev_priv = to_drm_psb_private(dev); 584 - struct pci_dev *pdev = to_pci_dev(dev->dev); 585 584 INIT_WORK(&dev_priv->hotplug_work, cdv_hotplug_work_func); 586 585 587 - if (pci_enable_msi(pdev)) 588 - dev_warn(dev->dev, "Enabling MSI failed!\n"); 586 + dev_priv->use_msi = true; 589 587 dev_priv->regmap = cdv_regmap; 590 588 gma_get_core_freq(dev); 591 589 psb_intel_opregion_init(dev);
+2 -2
drivers/gpu/drm/gma500/gem.c
··· 112 112 { 113 113 struct psb_gem_object *pobj = to_psb_gem_object(obj); 114 114 115 - drm_gem_object_release(obj); 116 - 117 115 /* Undo the mmap pin if we are destroying the object */ 118 116 if (pobj->mmapping) 119 117 psb_gem_unpin(pobj); 118 + 119 + drm_gem_object_release(obj); 120 120 121 121 WARN_ON(pobj->in_gart && !pobj->stolen); 122 122
+7 -4
drivers/gpu/drm/gma500/gma_display.c
··· 532 532 WARN_ON(drm_crtc_vblank_get(crtc) != 0); 533 533 534 534 gma_crtc->page_flip_event = event; 535 + spin_unlock_irqrestore(&dev->event_lock, flags); 535 536 536 537 /* Call this locked if we want an event at vblank interrupt. */ 537 538 ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); 538 539 if (ret) { 539 - gma_crtc->page_flip_event = NULL; 540 - drm_crtc_vblank_put(crtc); 540 + spin_lock_irqsave(&dev->event_lock, flags); 541 + if (gma_crtc->page_flip_event) { 542 + gma_crtc->page_flip_event = NULL; 543 + drm_crtc_vblank_put(crtc); 544 + } 545 + spin_unlock_irqrestore(&dev->event_lock, flags); 541 546 } 542 - 543 - spin_unlock_irqrestore(&dev->event_lock, flags); 544 547 } else { 545 548 ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb); 546 549 }
+1 -4
drivers/gpu/drm/gma500/oaktrail_device.c
··· 501 501 static int oaktrail_chip_setup(struct drm_device *dev) 502 502 { 503 503 struct drm_psb_private *dev_priv = to_drm_psb_private(dev); 504 - struct pci_dev *pdev = to_pci_dev(dev->dev); 505 504 int ret; 506 505 507 - if (pci_enable_msi(pdev)) 508 - dev_warn(dev->dev, "Enabling MSI failed!\n"); 509 - 506 + dev_priv->use_msi = true; 510 507 dev_priv->regmap = oaktrail_regmap; 511 508 512 509 ret = mid_chip_setup(dev);
+1 -7
drivers/gpu/drm/gma500/power.c
··· 139 139 dev_priv->regs.saveBSM = bsm; 140 140 pci_read_config_dword(pdev, 0xFC, &vbt); 141 141 dev_priv->regs.saveVBT = vbt; 142 - pci_read_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, &dev_priv->msi_addr); 143 - pci_read_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, &dev_priv->msi_data); 144 142 145 143 pci_disable_device(pdev); 146 144 pci_set_power_state(pdev, PCI_D3hot); ··· 166 168 pci_restore_state(pdev); 167 169 pci_write_config_dword(pdev, 0x5c, dev_priv->regs.saveBSM); 168 170 pci_write_config_dword(pdev, 0xFC, dev_priv->regs.saveVBT); 169 - /* restoring MSI address and data in PCIx space */ 170 - pci_write_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, dev_priv->msi_addr); 171 - pci_write_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, dev_priv->msi_data); 172 171 ret = pci_enable_device(pdev); 173 172 174 173 if (ret != 0) ··· 218 223 mutex_lock(&power_mutex); 219 224 gma_resume_pci(pdev); 220 225 gma_resume_display(pdev); 221 - gma_irq_preinstall(dev); 222 - gma_irq_postinstall(dev); 226 + gma_irq_install(dev); 223 227 mutex_unlock(&power_mutex); 224 228 return 0; 225 229 }
+1 -1
drivers/gpu/drm/gma500/psb_drv.c
··· 383 383 PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); 384 384 spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); 385 385 386 - gma_irq_install(dev, pdev->irq); 386 + gma_irq_install(dev); 387 387 388 388 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ 389 389
+1 -4
drivers/gpu/drm/gma500/psb_drv.h
··· 490 490 int rpm_enabled; 491 491 492 492 /* MID specific */ 493 + bool use_msi; 493 494 bool has_gct; 494 495 struct oaktrail_gct_data gct_data; 495 496 ··· 499 498 500 499 /* Register state */ 501 500 struct psb_save_area regs; 502 - 503 - /* MSI reg save */ 504 - uint32_t msi_addr; 505 - uint32_t msi_data; 506 501 507 502 /* Hotplug handling */ 508 503 struct work_struct hotplug_work;
+12 -3
drivers/gpu/drm/gma500/psb_irq.c
··· 316 316 spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); 317 317 } 318 318 319 - int gma_irq_install(struct drm_device *dev, unsigned int irq) 319 + int gma_irq_install(struct drm_device *dev) 320 320 { 321 + struct drm_psb_private *dev_priv = to_drm_psb_private(dev); 322 + struct pci_dev *pdev = to_pci_dev(dev->dev); 321 323 int ret; 322 324 323 - if (irq == IRQ_NOTCONNECTED) 325 + if (dev_priv->use_msi && pci_enable_msi(pdev)) { 326 + dev_warn(dev->dev, "Enabling MSI failed!\n"); 327 + dev_priv->use_msi = false; 328 + } 329 + 330 + if (pdev->irq == IRQ_NOTCONNECTED) 324 331 return -ENOTCONN; 325 332 326 333 gma_irq_preinstall(dev); 327 334 328 335 /* PCI devices require shared interrupts. */ 329 - ret = request_irq(irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev); 336 + ret = request_irq(pdev->irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev); 330 337 if (ret) 331 338 return ret; 332 339 ··· 376 369 spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); 377 370 378 371 free_irq(pdev->irq, dev); 372 + if (dev_priv->use_msi) 373 + pci_disable_msi(pdev); 379 374 } 380 375 381 376 int gma_crtc_enable_vblank(struct drm_crtc *crtc)
+1 -1
drivers/gpu/drm/gma500/psb_irq.h
··· 17 17 18 18 void gma_irq_preinstall(struct drm_device *dev); 19 19 void gma_irq_postinstall(struct drm_device *dev); 20 - int gma_irq_install(struct drm_device *dev, unsigned int irq); 20 + int gma_irq_install(struct drm_device *dev); 21 21 void gma_irq_uninstall(struct drm_device *dev); 22 22 23 23 int gma_crtc_enable_vblank(struct drm_crtc *crtc);
+1
drivers/gpu/drm/hisilicon/hibmc/Kconfig
··· 2 2 config DRM_HISI_HIBMC 3 3 tristate "DRM Support for Hisilicon Hibmc" 4 4 depends on DRM && PCI && (ARM64 || COMPILE_TEST) 5 + depends on MMU 5 6 select DRM_KMS_HELPER 6 7 select DRM_VRAM_HELPER 7 8 select DRM_TTM
+4 -6
drivers/gpu/drm/hyperv/hyperv_drm_drv.c
··· 23 23 #define DRIVER_MAJOR 1 24 24 #define DRIVER_MINOR 0 25 25 26 - #define PCI_VENDOR_ID_MICROSOFT 0x1414 27 - #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353 28 - 29 26 DEFINE_DRM_GEM_FOPS(hv_fops); 30 27 31 28 static struct drm_driver hyperv_driver = { ··· 130 133 } 131 134 132 135 ret = hyperv_setup_vram(hv, hdev); 133 - 134 136 if (ret) 135 137 goto err_vmbus_close; 136 138 ··· 146 150 147 151 ret = hyperv_mode_config_init(hv); 148 152 if (ret) 149 - goto err_vmbus_close; 153 + goto err_free_mmio; 150 154 151 155 ret = drm_dev_register(dev, 0); 152 156 if (ret) { 153 157 drm_err(dev, "Failed to register drm driver.\n"); 154 - goto err_vmbus_close; 158 + goto err_free_mmio; 155 159 } 156 160 157 161 drm_fbdev_generic_setup(dev, 0); 158 162 159 163 return 0; 160 164 165 + err_free_mmio: 166 + vmbus_free_mmio(hv->mem->start, hv->fb_size); 161 167 err_vmbus_close: 162 168 vmbus_close(hdev->channel); 163 169 err_hv_set_drv_data:
+2
drivers/gpu/drm/i915/display/icl_dsi.c
··· 1629 1629 /* FIXME: initialize from VBT */ 1630 1630 vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST; 1631 1631 1632 + vdsc_cfg->pic_height = crtc_state->hw.adjusted_mode.crtc_vdisplay; 1633 + 1632 1634 ret = intel_dsc_compute_params(crtc_state); 1633 1635 if (ret) 1634 1636 return ret;
+4 -29
drivers/gpu/drm/i915/display/intel_dp.c
··· 389 389 return intel_dp_is_edp(intel_dp) ? 810000 : 1350000; 390 390 } 391 391 392 - static bool is_low_voltage_sku(struct drm_i915_private *i915, enum phy phy) 393 - { 394 - u32 voltage; 395 - 396 - voltage = intel_de_read(i915, ICL_PORT_COMP_DW3(phy)) & VOLTAGE_INFO_MASK; 397 - 398 - return voltage == VOLTAGE_INFO_0_85V; 399 - } 400 - 401 392 static int icl_max_source_rate(struct intel_dp *intel_dp) 402 393 { 403 394 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); 404 395 struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev); 405 396 enum phy phy = intel_port_to_phy(dev_priv, dig_port->base.port); 406 397 407 - if (intel_phy_is_combo(dev_priv, phy) && 408 - (is_low_voltage_sku(dev_priv, phy) || !intel_dp_is_edp(intel_dp))) 398 + if (intel_phy_is_combo(dev_priv, phy) && !intel_dp_is_edp(intel_dp)) 409 399 return 540000; 410 400 411 401 return 810000; ··· 403 413 404 414 static int ehl_max_source_rate(struct intel_dp *intel_dp) 405 415 { 406 - struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); 407 - struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev); 408 - enum phy phy = intel_port_to_phy(dev_priv, dig_port->base.port); 409 - 410 - if (intel_dp_is_edp(intel_dp) || is_low_voltage_sku(dev_priv, phy)) 411 - return 540000; 412 - 413 - return 810000; 414 - } 415 - 416 - static int dg1_max_source_rate(struct intel_dp *intel_dp) 417 - { 418 - struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); 419 - struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); 420 - enum phy phy = intel_port_to_phy(i915, dig_port->base.port); 421 - 422 - if (intel_phy_is_combo(i915, phy) && is_low_voltage_sku(i915, phy)) 416 + if (intel_dp_is_edp(intel_dp)) 423 417 return 540000; 424 418 425 419 return 810000; ··· 465 491 max_rate = dg2_max_source_rate(intel_dp); 466 492 else if (IS_ALDERLAKE_P(dev_priv) || IS_ALDERLAKE_S(dev_priv) || 467 493 IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv)) 468 - max_rate = dg1_max_source_rate(intel_dp); 494 + max_rate = 810000; 469 495 else if (IS_JSL_EHL(dev_priv)) 470 496 max_rate = ehl_max_source_rate(intel_dp); 471 497 else ··· 1369 1395 * DP_DSC_RC_BUF_SIZE for this. 1370 1396 */ 1371 1397 vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST; 1398 + vdsc_cfg->pic_height = crtc_state->hw.adjusted_mode.crtc_vdisplay; 1372 1399 1373 1400 /* 1374 1401 * Slice Height of 8 works for all currently available panels. So start
-1
drivers/gpu/drm/i915/display/intel_vdsc.c
··· 460 460 u8 i = 0; 461 461 462 462 vdsc_cfg->pic_width = pipe_config->hw.adjusted_mode.crtc_hdisplay; 463 - vdsc_cfg->pic_height = pipe_config->hw.adjusted_mode.crtc_vdisplay; 464 463 vdsc_cfg->slice_width = DIV_ROUND_UP(vdsc_cfg->pic_width, 465 464 pipe_config->dsc.slice_count); 466 465
+4 -4
drivers/gpu/drm/i915/gem/i915_gem_context.c
··· 1269 1269 trace_i915_context_free(ctx); 1270 1270 GEM_BUG_ON(!i915_gem_context_is_closed(ctx)); 1271 1271 1272 + spin_lock(&ctx->i915->gem.contexts.lock); 1273 + list_del(&ctx->link); 1274 + spin_unlock(&ctx->i915->gem.contexts.lock); 1275 + 1272 1276 if (ctx->syncobj) 1273 1277 drm_syncobj_put(ctx->syncobj); 1274 1278 ··· 1524 1520 lut_close(ctx); 1525 1521 1526 1522 ctx->file_priv = ERR_PTR(-EBADF); 1527 - 1528 - spin_lock(&ctx->i915->gem.contexts.lock); 1529 - list_del(&ctx->link); 1530 - spin_unlock(&ctx->i915->gem.contexts.lock); 1531 1523 1532 1524 client = ctx->client; 1533 1525 if (client) {
+6 -1
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 1438 1438 if (!guc_submission_initialized(guc)) 1439 1439 return; 1440 1440 1441 - cancel_delayed_work(&guc->timestamp.work); 1441 + /* 1442 + * There is a race with suspend flow where the worker runs after suspend 1443 + * and causes an unclaimed register access warning. Cancel the worker 1444 + * synchronously here. 1445 + */ 1446 + cancel_delayed_work_sync(&guc->timestamp.work); 1442 1447 1443 1448 /* 1444 1449 * Before parking, we should sample engine busyness stats if we need to.
+2 -1
drivers/gpu/drm/i915/i915_gem.c
··· 1191 1191 1192 1192 intel_uc_cleanup_firmwares(&to_gt(dev_priv)->uc); 1193 1193 1194 - i915_gem_drain_freed_objects(dev_priv); 1194 + /* Flush any outstanding work, including i915_gem_context.release_work. */ 1195 + i915_gem_drain_workqueue(dev_priv); 1195 1196 1196 1197 drm_WARN_ON(&dev_priv->drm, !list_empty(&dev_priv->gem.contexts.list)); 1197 1198 }
+8 -8
drivers/gpu/drm/i915/i915_reg.h
··· 1857 1857 1858 1858 #define GT0_PERF_LIMIT_REASONS _MMIO(0x1381a8) 1859 1859 #define GT0_PERF_LIMIT_REASONS_MASK 0xde3 1860 - #define PROCHOT_MASK REG_BIT(1) 1861 - #define THERMAL_LIMIT_MASK REG_BIT(2) 1862 - #define RATL_MASK REG_BIT(6) 1863 - #define VR_THERMALERT_MASK REG_BIT(7) 1864 - #define VR_TDC_MASK REG_BIT(8) 1865 - #define POWER_LIMIT_4_MASK REG_BIT(9) 1866 - #define POWER_LIMIT_1_MASK REG_BIT(11) 1867 - #define POWER_LIMIT_2_MASK REG_BIT(12) 1860 + #define PROCHOT_MASK REG_BIT(0) 1861 + #define THERMAL_LIMIT_MASK REG_BIT(1) 1862 + #define RATL_MASK REG_BIT(5) 1863 + #define VR_THERMALERT_MASK REG_BIT(6) 1864 + #define VR_TDC_MASK REG_BIT(7) 1865 + #define POWER_LIMIT_4_MASK REG_BIT(8) 1866 + #define POWER_LIMIT_1_MASK REG_BIT(10) 1867 + #define POWER_LIMIT_2_MASK REG_BIT(11) 1868 1868 1869 1869 #define CHV_CLK_CTL1 _MMIO(0x101100) 1870 1870 #define VLV_CLK_CTL2 _MMIO(0x101104)
+2 -1
drivers/gpu/drm/i915/i915_vma.c
··· 1882 1882 enum dma_resv_usage usage; 1883 1883 int idx; 1884 1884 1885 - obj->read_domains = 0; 1886 1885 if (flags & EXEC_OBJECT_WRITE) { 1887 1886 usage = DMA_RESV_USAGE_WRITE; 1888 1887 obj->write_domain = I915_GEM_DOMAIN_RENDER; 1888 + obj->read_domains = 0; 1889 1889 } else { 1890 1890 usage = DMA_RESV_USAGE_READ; 1891 + obj->write_domain = 0; 1891 1892 } 1892 1893 1893 1894 dma_fence_array_for_each(curr, idx, fence)
+1 -1
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
··· 157 157 { 158 158 struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev); 159 159 160 - mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE); 160 + mtk_ddp_write(cmdq_pkt, w << 16 | h, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE); 161 161 mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs, 162 162 DISP_REG_DITHER_CFG); 163 163 mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, DISP_REG_DITHER_CFG,
+13 -11
drivers/gpu/drm/mediatek/mtk_dsi.c
··· 685 685 if (--dsi->refcount != 0) 686 686 return; 687 687 688 + /* 689 + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since 690 + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), 691 + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. 692 + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), 693 + * after dsi is fully set. 694 + */ 695 + mtk_dsi_stop(dsi); 696 + 697 + mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); 688 698 mtk_dsi_reset_engine(dsi); 689 699 mtk_dsi_lane0_ulp_mode_enter(dsi); 690 700 mtk_dsi_clk_ulp_mode_enter(dsi); ··· 744 734 { 745 735 if (!dsi->enabled) 746 736 return; 747 - 748 - /* 749 - * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since 750 - * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), 751 - * which needs irq for vblank, and mtk_dsi_stop() will disable irq. 752 - * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), 753 - * after dsi is fully set. 754 - */ 755 - mtk_dsi_stop(dsi); 756 - 757 - mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); 758 737 759 738 dsi->enabled = false; 760 739 } ··· 807 808 808 809 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { 809 810 .attach = mtk_dsi_bridge_attach, 811 + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, 810 812 .atomic_disable = mtk_dsi_bridge_atomic_disable, 813 + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, 811 814 .atomic_enable = mtk_dsi_bridge_atomic_enable, 812 815 .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable, 813 816 .atomic_post_disable = mtk_dsi_bridge_atomic_post_disable, 817 + .atomic_reset = drm_atomic_helper_bridge_reset, 814 818 .mode_set = mtk_dsi_bridge_mode_set, 815 819 }; 816 820
+1 -1
drivers/gpu/drm/meson/meson_plane.c
··· 170 170 171 171 /* Enable OSD and BLK0, set max global alpha */ 172 172 priv->viu.osd1_ctrl_stat = OSD_ENABLE | 173 - (0xFF << OSD_GLOBAL_ALPHA_SHIFT) | 173 + (0x100 << OSD_GLOBAL_ALPHA_SHIFT) | 174 174 OSD_BLK0_ENABLE; 175 175 176 176 priv->viu.osd1_ctrl_stat2 = readl(priv->io_base +
+1 -1
drivers/gpu/drm/meson/meson_viu.c
··· 94 94 priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12)); 95 95 writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff), 96 96 priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21)); 97 - writel((m[11] & 0x1fff) << 16, 97 + writel((m[11] & 0x1fff), 98 98 priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22)); 99 99 100 100 writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff),
+5 -1
drivers/gpu/drm/mgag200/mgag200_drv.c
··· 262 262 if (ret) 263 263 return ret; 264 264 265 - drm_fbdev_generic_setup(dev, 0); 265 + /* 266 + * FIXME: A 24-bit color depth does not work with 24 bpp on 267 + * G200ER. Force 32 bpp. 268 + */ 269 + drm_fbdev_generic_setup(dev, 32); 266 270 267 271 return 0; 268 272 }
+2 -1
drivers/gpu/drm/panel/panel-edp.c
··· 1295 1295 }, 1296 1296 .delay = { 1297 1297 .hpd_absent = 200, 1298 - .prepare_to_enable = 80, 1298 + .enable = 80, 1299 + .disable = 50, 1299 1300 .unprepare = 500, 1300 1301 }, 1301 1302 };
+1 -1
drivers/gpu/drm/panel/panel-simple.c
··· 2257 2257 .enable = 200, 2258 2258 .disable = 20, 2259 2259 }, 2260 - .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 2260 + .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, 2261 2261 .connector_type = DRM_MODE_CONNECTOR_LVDS, 2262 2262 }; 2263 2263
+3 -2
drivers/gpu/drm/rockchip/cdn-dp-core.c
··· 283 283 return ret; 284 284 } 285 285 286 - static int cdn_dp_connector_mode_valid(struct drm_connector *connector, 287 - struct drm_display_mode *mode) 286 + static enum drm_mode_status 287 + cdn_dp_connector_mode_valid(struct drm_connector *connector, 288 + struct drm_display_mode *mode) 288 289 { 289 290 struct cdn_dp_device *dp = connector_to_dp(connector); 290 291 struct drm_display_info *display_info = &dp->connector.display_info;
+4
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
··· 1439 1439 die &= ~RK3568_SYS_DSP_INFACE_EN_HDMI_MUX; 1440 1440 die |= RK3568_SYS_DSP_INFACE_EN_HDMI | 1441 1441 FIELD_PREP(RK3568_SYS_DSP_INFACE_EN_HDMI_MUX, vp->id); 1442 + dip &= ~RK3568_DSP_IF_POL__HDMI_PIN_POL; 1443 + dip |= FIELD_PREP(RK3568_DSP_IF_POL__HDMI_PIN_POL, polflags); 1442 1444 break; 1443 1445 case ROCKCHIP_VOP2_EP_EDP0: 1444 1446 die &= ~RK3568_SYS_DSP_INFACE_EN_EDP_MUX; 1445 1447 die |= RK3568_SYS_DSP_INFACE_EN_EDP | 1446 1448 FIELD_PREP(RK3568_SYS_DSP_INFACE_EN_EDP_MUX, vp->id); 1449 + dip &= ~RK3568_DSP_IF_POL__EDP_PIN_POL; 1450 + dip |= FIELD_PREP(RK3568_DSP_IF_POL__EDP_PIN_POL, polflags); 1447 1451 break; 1448 1452 case ROCKCHIP_VOP2_EP_MIPI0: 1449 1453 die &= ~RK3568_SYS_DSP_INFACE_EN_MIPI0_MUX;
+1 -1
drivers/hv/hv_fcopy.c
··· 129 129 130 130 /* 131 131 * The strings sent from the host are encoded in 132 - * in utf16; convert it to utf8 strings. 132 + * utf16; convert it to utf8 strings. 133 133 * The host assures us that the utf16 strings will not exceed 134 134 * the max lengths specified. We will however, reserve room 135 135 * for the string terminating character - in the utf16s_utf8s()
+41 -15
drivers/hv/vmbus_drv.c
··· 35 35 #include <linux/kernel.h> 36 36 #include <linux/syscore_ops.h> 37 37 #include <linux/dma-map-ops.h> 38 + #include <linux/pci.h> 38 39 #include <clocksource/hyperv_timer.h> 39 40 #include "hyperv_vmbus.h" 40 41 ··· 2263 2262 2264 2263 static void vmbus_reserve_fb(void) 2265 2264 { 2266 - int size; 2265 + resource_size_t start = 0, size; 2266 + struct pci_dev *pdev; 2267 + 2268 + if (efi_enabled(EFI_BOOT)) { 2269 + /* Gen2 VM: get FB base from EFI framebuffer */ 2270 + start = screen_info.lfb_base; 2271 + size = max_t(__u32, screen_info.lfb_size, 0x800000); 2272 + } else { 2273 + /* Gen1 VM: get FB base from PCI */ 2274 + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, 2275 + PCI_DEVICE_ID_HYPERV_VIDEO, NULL); 2276 + if (!pdev) 2277 + return; 2278 + 2279 + if (pdev->resource[0].flags & IORESOURCE_MEM) { 2280 + start = pci_resource_start(pdev, 0); 2281 + size = pci_resource_len(pdev, 0); 2282 + } 2283 + 2284 + /* 2285 + * Release the PCI device so hyperv_drm or hyperv_fb driver can 2286 + * grab it later. 2287 + */ 2288 + pci_dev_put(pdev); 2289 + } 2290 + 2291 + if (!start) 2292 + return; 2293 + 2267 2294 /* 2268 2295 * Make a claim for the frame buffer in the resource tree under the 2269 2296 * first node, which will be the one below 4GB. The length seems to 2270 2297 * be underreported, particularly in a Generation 1 VM. So start out 2271 2298 * reserving a larger area and make it smaller until it succeeds. 2272 2299 */ 2273 - 2274 - if (screen_info.lfb_base) { 2275 - if (efi_enabled(EFI_BOOT)) 2276 - size = max_t(__u32, screen_info.lfb_size, 0x800000); 2277 - else 2278 - size = max_t(__u32, screen_info.lfb_size, 0x4000000); 2279 - 2280 - for (; !fb_mmio && (size >= 0x100000); size >>= 1) { 2281 - fb_mmio = __request_region(hyperv_mmio, 2282 - screen_info.lfb_base, size, 2283 - fb_mmio_name, 0); 2284 - } 2285 - } 2300 + for (; !fb_mmio && (size >= 0x100000); size >>= 1) 2301 + fb_mmio = __request_region(hyperv_mmio, start, size, fb_mmio_name, 0); 2286 2302 } 2287 2303 2288 2304 /** ··· 2331 2313 bool fb_overlap_ok) 2332 2314 { 2333 2315 struct resource *iter, *shadow; 2334 - resource_size_t range_min, range_max, start; 2316 + resource_size_t range_min, range_max, start, end; 2335 2317 const char *dev_n = dev_name(&device_obj->device); 2336 2318 int retval; 2337 2319 ··· 2366 2348 range_max = iter->end; 2367 2349 start = (range_min + align - 1) & ~(align - 1); 2368 2350 for (; start + size - 1 <= range_max; start += align) { 2351 + end = start + size - 1; 2352 + 2353 + /* Skip the whole fb_mmio region if not fb_overlap_ok */ 2354 + if (!fb_overlap_ok && fb_mmio && 2355 + (((start >= fb_mmio->start) && (start <= fb_mmio->end)) || 2356 + ((end >= fb_mmio->start) && (end <= fb_mmio->end)))) 2357 + continue; 2358 + 2369 2359 shadow = __request_region(iter, start, size, NULL, 2370 2360 IORESOURCE_BUSY); 2371 2361 if (!shadow)
+1 -1
drivers/i2c/busses/i2c-imx.c
··· 1583 1583 if (i2c_imx->dma) 1584 1584 i2c_imx_dma_free(i2c_imx); 1585 1585 1586 - if (ret == 0) { 1586 + if (ret >= 0) { 1587 1587 /* setup chip registers to defaults */ 1588 1588 imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); 1589 1589 imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
+27 -41
drivers/i2c/busses/i2c-mlxbf.c
··· 6 6 */ 7 7 8 8 #include <linux/acpi.h> 9 + #include <linux/bitfield.h> 9 10 #include <linux/delay.h> 10 11 #include <linux/err.h> 11 12 #include <linux/interrupt.h> ··· 64 63 */ 65 64 #define MLXBF_I2C_TYU_PLL_OUT_FREQ (400 * 1000 * 1000) 66 65 /* Reference clock for Bluefield - 156 MHz. */ 67 - #define MLXBF_I2C_PLL_IN_FREQ (156 * 1000 * 1000) 66 + #define MLXBF_I2C_PLL_IN_FREQ 156250000ULL 68 67 69 68 /* Constant used to determine the PLL frequency. */ 70 - #define MLNXBF_I2C_COREPLL_CONST 16384 69 + #define MLNXBF_I2C_COREPLL_CONST 16384ULL 70 + 71 + #define MLXBF_I2C_FREQUENCY_1GHZ 1000000000ULL 71 72 72 73 /* PLL registers. */ 73 - #define MLXBF_I2C_CORE_PLL_REG0 0x0 74 74 #define MLXBF_I2C_CORE_PLL_REG1 0x4 75 75 #define MLXBF_I2C_CORE_PLL_REG2 0x8 76 76 ··· 183 181 #define MLXBF_I2C_COREPLL_FREQ MLXBF_I2C_TYU_PLL_OUT_FREQ 184 182 185 183 /* Core PLL TYU configuration. */ 186 - #define MLXBF_I2C_COREPLL_CORE_F_TYU_MASK GENMASK(12, 0) 187 - #define MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK GENMASK(3, 0) 188 - #define MLXBF_I2C_COREPLL_CORE_R_TYU_MASK GENMASK(5, 0) 189 - 190 - #define MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT 3 191 - #define MLXBF_I2C_COREPLL_CORE_OD_TYU_SHIFT 16 192 - #define MLXBF_I2C_COREPLL_CORE_R_TYU_SHIFT 20 184 + #define MLXBF_I2C_COREPLL_CORE_F_TYU_MASK GENMASK(15, 3) 185 + #define MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK GENMASK(19, 16) 186 + #define MLXBF_I2C_COREPLL_CORE_R_TYU_MASK GENMASK(25, 20) 193 187 194 188 /* Core PLL YU configuration. */ 195 189 #define MLXBF_I2C_COREPLL_CORE_F_YU_MASK GENMASK(25, 0) 196 190 #define MLXBF_I2C_COREPLL_CORE_OD_YU_MASK GENMASK(3, 0) 197 - #define MLXBF_I2C_COREPLL_CORE_R_YU_MASK GENMASK(5, 0) 191 + #define MLXBF_I2C_COREPLL_CORE_R_YU_MASK GENMASK(31, 26) 198 192 199 - #define MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT 0 200 - #define MLXBF_I2C_COREPLL_CORE_OD_YU_SHIFT 1 201 - #define MLXBF_I2C_COREPLL_CORE_R_YU_SHIFT 26 202 193 203 194 /* Core PLL frequency. */ 204 195 static u64 mlxbf_i2c_corepll_frequency; ··· 474 479 #define MLXBF_I2C_MASK_8 GENMASK(7, 0) 475 480 #define MLXBF_I2C_MASK_16 GENMASK(15, 0) 476 481 477 - #define MLXBF_I2C_FREQUENCY_1GHZ 1000000000 478 - 479 482 /* 480 483 * Function to poll a set of bits at a specific address; it checks whether 481 484 * the bits are equal to zero when eq_zero is set to 'true', and not equal ··· 662 669 /* Clear status bits. */ 663 670 writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS); 664 671 /* Set the cause data. */ 665 - writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR); 672 + writel(~0x0, priv->mst_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR); 666 673 /* Zero PEC byte. */ 667 674 writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC); 668 675 /* Zero byte count. */ ··· 731 738 if (flags & MLXBF_I2C_F_WRITE) { 732 739 write_en = 1; 733 740 write_len += operation->length; 741 + if (data_idx + operation->length > 742 + MLXBF_I2C_MASTER_DATA_DESC_SIZE) 743 + return -ENOBUFS; 734 744 memcpy(data_desc + data_idx, 735 745 operation->buffer, operation->length); 736 746 data_idx += operation->length; ··· 1403 1407 return 0; 1404 1408 } 1405 1409 1406 - static u64 mlxbf_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res) 1410 + static u64 mlxbf_i2c_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res) 1407 1411 { 1408 - u64 core_frequency, pad_frequency; 1412 + u64 core_frequency; 1409 1413 u8 core_od, core_r; 1410 1414 u32 corepll_val; 1411 1415 u16 core_f; 1412 1416 1413 - pad_frequency = MLXBF_I2C_PLL_IN_FREQ; 1414 - 1415 1417 corepll_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); 1416 1418 1417 1419 /* Get Core PLL configuration bits. */ 1418 - core_f = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) & 1419 - MLXBF_I2C_COREPLL_CORE_F_TYU_MASK; 1420 - core_od = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_OD_TYU_SHIFT) & 1421 - MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK; 1422 - core_r = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_R_TYU_SHIFT) & 1423 - MLXBF_I2C_COREPLL_CORE_R_TYU_MASK; 1420 + core_f = FIELD_GET(MLXBF_I2C_COREPLL_CORE_F_TYU_MASK, corepll_val); 1421 + core_od = FIELD_GET(MLXBF_I2C_COREPLL_CORE_OD_TYU_MASK, corepll_val); 1422 + core_r = FIELD_GET(MLXBF_I2C_COREPLL_CORE_R_TYU_MASK, corepll_val); 1424 1423 1425 1424 /* 1426 1425 * Compute PLL output frequency as follow: ··· 1427 1436 * Where PLL_OUT_FREQ and PLL_IN_FREQ refer to CoreFrequency 1428 1437 * and PadFrequency, respectively. 1429 1438 */ 1430 - core_frequency = pad_frequency * (++core_f); 1439 + core_frequency = MLXBF_I2C_PLL_IN_FREQ * (++core_f); 1431 1440 core_frequency /= (++core_r) * (++core_od); 1432 1441 1433 1442 return core_frequency; 1434 1443 } 1435 1444 1436 - static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res) 1445 + static u64 mlxbf_i2c_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res) 1437 1446 { 1438 1447 u32 corepll_reg1_val, corepll_reg2_val; 1439 - u64 corepll_frequency, pad_frequency; 1448 + u64 corepll_frequency; 1440 1449 u8 core_od, core_r; 1441 1450 u32 core_f; 1442 - 1443 - pad_frequency = MLXBF_I2C_PLL_IN_FREQ; 1444 1451 1445 1452 corepll_reg1_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1); 1446 1453 corepll_reg2_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG2); 1447 1454 1448 1455 /* Get Core PLL configuration bits */ 1449 - core_f = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) & 1450 - MLXBF_I2C_COREPLL_CORE_F_YU_MASK; 1451 - core_r = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_R_YU_SHIFT) & 1452 - MLXBF_I2C_COREPLL_CORE_R_YU_MASK; 1453 - core_od = rol32(corepll_reg2_val, MLXBF_I2C_COREPLL_CORE_OD_YU_SHIFT) & 1454 - MLXBF_I2C_COREPLL_CORE_OD_YU_MASK; 1456 + core_f = FIELD_GET(MLXBF_I2C_COREPLL_CORE_F_YU_MASK, corepll_reg1_val); 1457 + core_r = FIELD_GET(MLXBF_I2C_COREPLL_CORE_R_YU_MASK, corepll_reg1_val); 1458 + core_od = FIELD_GET(MLXBF_I2C_COREPLL_CORE_OD_YU_MASK, corepll_reg2_val); 1455 1459 1456 1460 /* 1457 1461 * Compute PLL output frequency as follow: ··· 1458 1472 * Where PLL_OUT_FREQ and PLL_IN_FREQ refer to CoreFrequency 1459 1473 * and PadFrequency, respectively. 1460 1474 */ 1461 - corepll_frequency = (pad_frequency * core_f) / MLNXBF_I2C_COREPLL_CONST; 1475 + corepll_frequency = (MLXBF_I2C_PLL_IN_FREQ * core_f) / MLNXBF_I2C_COREPLL_CONST; 1462 1476 corepll_frequency /= (++core_r) * (++core_od); 1463 1477 1464 1478 return corepll_frequency; ··· 2166 2180 [1] = &mlxbf_i2c_corepll_res[MLXBF_I2C_CHIP_TYPE_1], 2167 2181 [2] = &mlxbf_i2c_gpio_res[MLXBF_I2C_CHIP_TYPE_1] 2168 2182 }, 2169 - .calculate_freq = mlxbf_calculate_freq_from_tyu 2183 + .calculate_freq = mlxbf_i2c_calculate_freq_from_tyu 2170 2184 }, 2171 2185 [MLXBF_I2C_CHIP_TYPE_2] = { 2172 2186 .type = MLXBF_I2C_CHIP_TYPE_2, 2173 2187 .shared_res = { 2174 2188 [0] = &mlxbf_i2c_corepll_res[MLXBF_I2C_CHIP_TYPE_2] 2175 2189 }, 2176 - .calculate_freq = mlxbf_calculate_freq_from_yu 2190 + .calculate_freq = mlxbf_i2c_calculate_freq_from_yu 2177 2191 } 2178 2192 }; 2179 2193
+3 -2
drivers/i2c/i2c-mux.c
··· 243 243 int (*deselect)(struct i2c_mux_core *, u32)) 244 244 { 245 245 struct i2c_mux_core *muxc; 246 + size_t mux_size; 246 247 247 - muxc = devm_kzalloc(dev, struct_size(muxc, adapter, max_adapters) 248 - + sizeof_priv, GFP_KERNEL); 248 + mux_size = struct_size(muxc, adapter, max_adapters); 249 + muxc = devm_kzalloc(dev, size_add(mux_size, sizeof_priv), GFP_KERNEL); 249 250 if (!muxc) 250 251 return NULL; 251 252 if (sizeof_priv)
-7
drivers/iommu/intel/dmar.c
··· 2349 2349 if (!dmar_in_use()) 2350 2350 return 0; 2351 2351 2352 - /* 2353 - * It's unlikely that any I/O board is hot added before the IOMMU 2354 - * subsystem is initialized. 2355 - */ 2356 - if (IS_ENABLED(CONFIG_INTEL_IOMMU) && !intel_iommu_enabled) 2357 - return -EOPNOTSUPP; 2358 - 2359 2352 if (dmar_detect_dsm(handle, DMAR_DSM_FUNC_DRHD)) { 2360 2353 tmp = handle; 2361 2354 } else {
+26 -3
drivers/iommu/intel/iommu.c
··· 399 399 { 400 400 unsigned long fl_sagaw, sl_sagaw; 401 401 402 - fl_sagaw = BIT(2) | (cap_fl1gp_support(iommu->cap) ? BIT(3) : 0); 402 + fl_sagaw = BIT(2) | (cap_5lp_support(iommu->cap) ? BIT(3) : 0); 403 403 sl_sagaw = cap_sagaw(iommu->cap); 404 404 405 405 /* Second level only. */ ··· 3019 3019 3020 3020 #ifdef CONFIG_INTEL_IOMMU_SVM 3021 3021 if (pasid_supported(iommu) && ecap_prs(iommu->ecap)) { 3022 + /* 3023 + * Call dmar_alloc_hwirq() with dmar_global_lock held, 3024 + * could cause possible lock race condition. 3025 + */ 3026 + up_write(&dmar_global_lock); 3022 3027 ret = intel_svm_enable_prq(iommu); 3028 + down_write(&dmar_global_lock); 3023 3029 if (ret) 3024 3030 goto free_iommu; 3025 3031 } ··· 3938 3932 force_on = (!intel_iommu_tboot_noforce && tboot_force_iommu()) || 3939 3933 platform_optin_force_iommu(); 3940 3934 3935 + down_write(&dmar_global_lock); 3941 3936 if (dmar_table_init()) { 3942 3937 if (force_on) 3943 3938 panic("tboot: Failed to initialize DMAR table\n"); ··· 3950 3943 panic("tboot: Failed to initialize DMAR device scope\n"); 3951 3944 goto out_free_dmar; 3952 3945 } 3946 + 3947 + up_write(&dmar_global_lock); 3948 + 3949 + /* 3950 + * The bus notifier takes the dmar_global_lock, so lockdep will 3951 + * complain later when we register it under the lock. 3952 + */ 3953 + dmar_register_bus_notifier(); 3954 + 3955 + down_write(&dmar_global_lock); 3953 3956 3954 3957 if (!no_iommu) 3955 3958 intel_iommu_debugfs_init(); ··· 4005 3988 pr_err("Initialization failed\n"); 4006 3989 goto out_free_dmar; 4007 3990 } 3991 + up_write(&dmar_global_lock); 4008 3992 4009 3993 init_iommu_pm_ops(); 4010 3994 3995 + down_read(&dmar_global_lock); 4011 3996 for_each_active_iommu(iommu, drhd) { 4012 3997 /* 4013 3998 * The flush queue implementation does not perform ··· 4027 4008 "%s", iommu->name); 4028 4009 iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL); 4029 4010 } 4011 + up_read(&dmar_global_lock); 4030 4012 4031 4013 bus_set_iommu(&pci_bus_type, &intel_iommu_ops); 4032 4014 if (si_domain && !hw_pass_through) 4033 4015 register_memory_notifier(&intel_iommu_memory_nb); 4034 4016 4017 + down_read(&dmar_global_lock); 4035 4018 if (probe_acpi_namespace_devices()) 4036 4019 pr_warn("ACPI name space devices didn't probe correctly\n"); 4037 4020 ··· 4044 4023 4045 4024 iommu_disable_protect_mem_regions(iommu); 4046 4025 } 4026 + up_read(&dmar_global_lock); 4027 + 4028 + pr_info("Intel(R) Virtualization Technology for Directed I/O\n"); 4047 4029 4048 4030 intel_iommu_enabled = 1; 4049 - dmar_register_bus_notifier(); 4050 - pr_info("Intel(R) Virtualization Technology for Directed I/O\n"); 4051 4031 4052 4032 return 0; 4053 4033 4054 4034 out_free_dmar: 4055 4035 intel_iommu_free_dmars(); 4036 + up_write(&dmar_global_lock); 4056 4037 return ret; 4057 4038 } 4058 4039
+1 -1
drivers/media/usb/b2c2/flexcop-usb.c
··· 511 511 512 512 if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) 513 513 return -ENODEV; 514 - if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc)) 514 + if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].desc)) 515 515 return -ENODEV; 516 516 517 517 switch (fc_usb->udev->speed) {
+3 -2
drivers/net/bonding/bond_3ad.c
··· 88 88 static const u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL; 89 89 static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; 90 90 91 - static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = 92 - MULTICAST_LACPDU_ADDR; 91 + const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = { 92 + 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 93 + }; 93 94 94 95 /* ================= main 802.3ad protocol functions ================== */ 95 96 static int ad_lacpdu_send(struct port *port);
+42 -30
drivers/net/bonding/bond_main.c
··· 865 865 dev_uc_unsync(slave_dev, bond_dev); 866 866 dev_mc_unsync(slave_dev, bond_dev); 867 867 868 - if (BOND_MODE(bond) == BOND_MODE_8023AD) { 869 - /* del lacpdu mc addr from mc list */ 870 - u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; 871 - 872 - dev_mc_del(slave_dev, lacpdu_multicast); 873 - } 868 + if (BOND_MODE(bond) == BOND_MODE_8023AD) 869 + dev_mc_del(slave_dev, lacpdu_mcast_addr); 874 870 } 875 871 876 872 /*--------------------------- Active slave change ---------------------------*/ ··· 886 890 if (bond->dev->flags & IFF_ALLMULTI) 887 891 dev_set_allmulti(old_active->dev, -1); 888 892 889 - bond_hw_addr_flush(bond->dev, old_active->dev); 893 + if (bond->dev->flags & IFF_UP) 894 + bond_hw_addr_flush(bond->dev, old_active->dev); 890 895 } 891 896 892 897 if (new_active) { ··· 898 901 if (bond->dev->flags & IFF_ALLMULTI) 899 902 dev_set_allmulti(new_active->dev, 1); 900 903 901 - netif_addr_lock_bh(bond->dev); 902 - dev_uc_sync(new_active->dev, bond->dev); 903 - dev_mc_sync(new_active->dev, bond->dev); 904 - netif_addr_unlock_bh(bond->dev); 904 + if (bond->dev->flags & IFF_UP) { 905 + netif_addr_lock_bh(bond->dev); 906 + dev_uc_sync(new_active->dev, bond->dev); 907 + dev_mc_sync(new_active->dev, bond->dev); 908 + netif_addr_unlock_bh(bond->dev); 909 + } 905 910 } 906 911 } 907 912 ··· 2165 2166 } 2166 2167 } 2167 2168 2168 - netif_addr_lock_bh(bond_dev); 2169 - dev_mc_sync_multiple(slave_dev, bond_dev); 2170 - dev_uc_sync_multiple(slave_dev, bond_dev); 2171 - netif_addr_unlock_bh(bond_dev); 2169 + if (bond_dev->flags & IFF_UP) { 2170 + netif_addr_lock_bh(bond_dev); 2171 + dev_mc_sync_multiple(slave_dev, bond_dev); 2172 + dev_uc_sync_multiple(slave_dev, bond_dev); 2173 + netif_addr_unlock_bh(bond_dev); 2172 2174 2173 - if (BOND_MODE(bond) == BOND_MODE_8023AD) { 2174 - /* add lacpdu mc addr to mc list */ 2175 - u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR; 2176 - 2177 - dev_mc_add(slave_dev, lacpdu_multicast); 2175 + if (BOND_MODE(bond) == BOND_MODE_8023AD) 2176 + dev_mc_add(slave_dev, lacpdu_mcast_addr); 2178 2177 } 2179 2178 } 2180 2179 ··· 2444 2447 if (old_flags & IFF_ALLMULTI) 2445 2448 dev_set_allmulti(slave_dev, -1); 2446 2449 2447 - bond_hw_addr_flush(bond_dev, slave_dev); 2450 + if (old_flags & IFF_UP) 2451 + bond_hw_addr_flush(bond_dev, slave_dev); 2448 2452 } 2449 2453 2450 2454 slave_disable_netpoll(slave); ··· 4182 4184 struct list_head *iter; 4183 4185 struct slave *slave; 4184 4186 4187 + if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN && !bond->rr_tx_counter) { 4188 + bond->rr_tx_counter = alloc_percpu(u32); 4189 + if (!bond->rr_tx_counter) 4190 + return -ENOMEM; 4191 + } 4192 + 4185 4193 /* reset slave->backup and slave->inactive */ 4186 4194 if (bond_has_slaves(bond)) { 4187 4195 bond_for_each_slave(bond, slave, iter) { ··· 4225 4221 /* register to receive LACPDUs */ 4226 4222 bond->recv_probe = bond_3ad_lacpdu_recv; 4227 4223 bond_3ad_initiate_agg_selection(bond, 1); 4224 + 4225 + bond_for_each_slave(bond, slave, iter) 4226 + dev_mc_add(slave->dev, lacpdu_mcast_addr); 4228 4227 } 4229 4228 4230 4229 if (bond_mode_can_use_xmit_hash(bond)) ··· 4239 4232 static int bond_close(struct net_device *bond_dev) 4240 4233 { 4241 4234 struct bonding *bond = netdev_priv(bond_dev); 4235 + struct slave *slave; 4242 4236 4243 4237 bond_work_cancel_all(bond); 4244 4238 bond->send_peer_notif = 0; 4245 4239 if (bond_is_lb(bond)) 4246 4240 bond_alb_deinitialize(bond); 4247 4241 bond->recv_probe = NULL; 4242 + 4243 + if (bond_uses_primary(bond)) { 4244 + rcu_read_lock(); 4245 + slave = rcu_dereference(bond->curr_active_slave); 4246 + if (slave) 4247 + bond_hw_addr_flush(bond_dev, slave->dev); 4248 + rcu_read_unlock(); 4249 + } else { 4250 + struct list_head *iter; 4251 + 4252 + bond_for_each_slave(bond, slave, iter) 4253 + bond_hw_addr_flush(bond_dev, slave->dev); 4254 + } 4248 4255 4249 4256 return 0; 4250 4257 } ··· 6248 6227 bond->wq = alloc_ordered_workqueue(bond_dev->name, WQ_MEM_RECLAIM); 6249 6228 if (!bond->wq) 6250 6229 return -ENOMEM; 6251 - 6252 - if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN) { 6253 - bond->rr_tx_counter = alloc_percpu(u32); 6254 - if (!bond->rr_tx_counter) { 6255 - destroy_workqueue(bond->wq); 6256 - bond->wq = NULL; 6257 - return -ENOMEM; 6258 - } 6259 - } 6260 6230 6261 6231 spin_lock_init(&bond->stats_lock); 6262 6232 netdev_lockdep_set_classes(bond_dev);
+5 -5
drivers/net/can/flexcan/flexcan-core.c
··· 941 941 u32 reg_ctrl, reg_id, reg_iflag1; 942 942 int i; 943 943 944 - if (unlikely(drop)) { 945 - skb = ERR_PTR(-ENOBUFS); 946 - goto mark_as_read; 947 - } 948 - 949 944 mb = flexcan_get_mb(priv, n); 950 945 951 946 if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) { ··· 967 972 return NULL; 968 973 969 974 reg_ctrl = priv->read(&mb->can_ctrl); 975 + } 976 + 977 + if (unlikely(drop)) { 978 + skb = ERR_PTR(-ENOBUFS); 979 + goto mark_as_read; 970 980 } 971 981 972 982 if (reg_ctrl & FLEXCAN_MB_CNT_EDL)
+13 -8
drivers/net/can/usb/gs_usb.c
··· 824 824 flags |= GS_CAN_MODE_TRIPLE_SAMPLE; 825 825 826 826 /* finally start device */ 827 + dev->can.state = CAN_STATE_ERROR_ACTIVE; 827 828 dm->mode = cpu_to_le32(GS_CAN_MODE_START); 828 829 dm->flags = cpu_to_le32(flags); 829 830 rc = usb_control_msg(interface_to_usbdev(dev->iface), ··· 836 835 if (rc < 0) { 837 836 netdev_err(netdev, "Couldn't start device (err=%d)\n", rc); 838 837 kfree(dm); 838 + dev->can.state = CAN_STATE_STOPPED; 839 839 return rc; 840 840 } 841 841 842 842 kfree(dm); 843 - 844 - dev->can.state = CAN_STATE_ERROR_ACTIVE; 845 843 846 844 parent->active_channels++; 847 845 if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) ··· 925 925 } 926 926 927 927 /* blink LED's for finding the this interface */ 928 - static int gs_usb_set_phys_id(struct net_device *dev, 928 + static int gs_usb_set_phys_id(struct net_device *netdev, 929 929 enum ethtool_phys_id_state state) 930 930 { 931 + const struct gs_can *dev = netdev_priv(netdev); 931 932 int rc = 0; 933 + 934 + if (!(dev->feature & GS_CAN_FEATURE_IDENTIFY)) 935 + return -EOPNOTSUPP; 932 936 933 937 switch (state) { 934 938 case ETHTOOL_ID_ACTIVE: 935 - rc = gs_usb_set_identify(dev, GS_CAN_IDENTIFY_ON); 939 + rc = gs_usb_set_identify(netdev, GS_CAN_IDENTIFY_ON); 936 940 break; 937 941 case ETHTOOL_ID_INACTIVE: 938 - rc = gs_usb_set_identify(dev, GS_CAN_IDENTIFY_OFF); 942 + rc = gs_usb_set_identify(netdev, GS_CAN_IDENTIFY_OFF); 939 943 break; 940 944 default: 941 945 break; ··· 1076 1072 dev->feature |= GS_CAN_FEATURE_REQ_USB_QUIRK_LPC546XX | 1077 1073 GS_CAN_FEATURE_QUIRK_BREQ_CANTACT_PRO; 1078 1074 1079 - if (le32_to_cpu(dconf->sw_version) > 1) 1080 - if (feature & GS_CAN_FEATURE_IDENTIFY) 1081 - netdev->ethtool_ops = &gs_usb_ethtool_ops; 1075 + /* GS_CAN_FEATURE_IDENTIFY is only supported for sw_version > 1 */ 1076 + if (!(le32_to_cpu(dconf->sw_version) > 1 && 1077 + feature & GS_CAN_FEATURE_IDENTIFY)) 1078 + dev->feature &= ~GS_CAN_FEATURE_IDENTIFY; 1082 1079 1083 1080 kfree(bt_const); 1084 1081
-4
drivers/net/dsa/microchip/lan937x_main.c
··· 244 244 lan937x_port_cfg(dev, port, REG_PORT_CTRL_0, 245 245 PORT_TAIL_TAG_ENABLE, true); 246 246 247 - /* disable frame check length field */ 248 - lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_0, PORT_CHECK_LENGTH, 249 - false); 250 - 251 247 /* set back pressure for half duplex */ 252 248 lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_1, PORT_BACK_PRESSURE, 253 249 true);
-3
drivers/net/ethernet/aquantia/atlantic/aq_main.c
··· 94 94 int err = 0; 95 95 96 96 err = aq_nic_stop(aq_nic); 97 - if (err < 0) 98 - goto err_exit; 99 97 aq_nic_deinit(aq_nic, true); 100 98 101 - err_exit: 102 99 return err; 103 100 } 104 101
+5 -5
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 659 659 660 660 for (i = 0; i < nr_pkts; i++) { 661 661 struct bnxt_sw_tx_bd *tx_buf; 662 - bool compl_deferred = false; 663 662 struct sk_buff *skb; 664 663 int j, last; 665 664 ··· 666 667 cons = NEXT_TX(cons); 667 668 skb = tx_buf->skb; 668 669 tx_buf->skb = NULL; 670 + 671 + tx_bytes += skb->len; 669 672 670 673 if (tx_buf->is_push) { 671 674 tx_buf->is_push = 0; ··· 689 688 } 690 689 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) { 691 690 if (bp->flags & BNXT_FLAG_CHIP_P5) { 691 + /* PTP worker takes ownership of the skb */ 692 692 if (!bnxt_get_tx_ts_p5(bp, skb)) 693 - compl_deferred = true; 693 + skb = NULL; 694 694 else 695 695 atomic_inc(&bp->ptp_cfg->tx_avail); 696 696 } ··· 700 698 next_tx_int: 701 699 cons = NEXT_TX(cons); 702 700 703 - tx_bytes += skb->len; 704 - if (!compl_deferred) 705 - dev_kfree_skb_any(skb); 701 + dev_kfree_skb_any(skb); 706 702 } 707 703 708 704 netdev_tx_completed_queue(txq, nr_pkts, tx_bytes);
+2 -2
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
··· 317 317 318 318 if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters & 319 319 (PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE | 320 - PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE))) { 320 + PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE))) { 321 321 ptp->tstamp_filters &= ~(PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE | 322 - PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE); 322 + PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE); 323 323 netdev_warn(bp->dev, "Unsupported FW for all RX pkts timestamp filter\n"); 324 324 } 325 325
-1
drivers/net/ethernet/freescale/enetc/Makefile
··· 9 9 10 10 obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o 11 11 fsl-enetc-vf-y := enetc_vf.o $(common-objs) 12 - fsl-enetc-vf-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o 13 12 14 13 obj-$(CONFIG_FSL_ENETC_IERB) += fsl-enetc-ierb.o 15 14 fsl-enetc-ierb-y := enetc_ierb.o
+2 -51
drivers/net/ethernet/freescale/enetc/enetc.c
··· 2432 2432 return 0; 2433 2433 } 2434 2434 2435 - static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) 2435 + int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) 2436 2436 { 2437 2437 struct enetc_ndev_priv *priv = netdev_priv(ndev); 2438 2438 struct tc_mqprio_qopt *mqprio = type_data; ··· 2484 2484 netdev_set_tc_queue(ndev, i, 1, i); 2485 2485 2486 2486 return 0; 2487 - } 2488 - 2489 - int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, 2490 - void *type_data) 2491 - { 2492 - switch (type) { 2493 - case TC_SETUP_QDISC_MQPRIO: 2494 - return enetc_setup_tc_mqprio(ndev, type_data); 2495 - case TC_SETUP_QDISC_TAPRIO: 2496 - return enetc_setup_tc_taprio(ndev, type_data); 2497 - case TC_SETUP_QDISC_CBS: 2498 - return enetc_setup_tc_cbs(ndev, type_data); 2499 - case TC_SETUP_QDISC_ETF: 2500 - return enetc_setup_tc_txtime(ndev, type_data); 2501 - case TC_SETUP_BLOCK: 2502 - return enetc_setup_tc_psfp(ndev, type_data); 2503 - default: 2504 - return -EOPNOTSUPP; 2505 - } 2506 2487 } 2507 2488 2508 2489 static int enetc_setup_xdp_prog(struct net_device *dev, struct bpf_prog *prog, ··· 2581 2600 return 0; 2582 2601 } 2583 2602 2584 - static int enetc_set_psfp(struct net_device *ndev, int en) 2585 - { 2586 - struct enetc_ndev_priv *priv = netdev_priv(ndev); 2587 - int err; 2588 - 2589 - if (en) { 2590 - err = enetc_psfp_enable(priv); 2591 - if (err) 2592 - return err; 2593 - 2594 - priv->active_offloads |= ENETC_F_QCI; 2595 - return 0; 2596 - } 2597 - 2598 - err = enetc_psfp_disable(priv); 2599 - if (err) 2600 - return err; 2601 - 2602 - priv->active_offloads &= ~ENETC_F_QCI; 2603 - 2604 - return 0; 2605 - } 2606 - 2607 2603 static void enetc_enable_rxvlan(struct net_device *ndev, bool en) 2608 2604 { 2609 2605 struct enetc_ndev_priv *priv = netdev_priv(ndev); ··· 2599 2641 enetc_bdr_enable_txvlan(&priv->si->hw, i, en); 2600 2642 } 2601 2643 2602 - int enetc_set_features(struct net_device *ndev, 2603 - netdev_features_t features) 2644 + void enetc_set_features(struct net_device *ndev, netdev_features_t features) 2604 2645 { 2605 2646 netdev_features_t changed = ndev->features ^ features; 2606 - int err = 0; 2607 2647 2608 2648 if (changed & NETIF_F_RXHASH) 2609 2649 enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH)); ··· 2613 2657 if (changed & NETIF_F_HW_VLAN_CTAG_TX) 2614 2658 enetc_enable_txvlan(ndev, 2615 2659 !!(features & NETIF_F_HW_VLAN_CTAG_TX)); 2616 - 2617 - if (changed & NETIF_F_HW_TC) 2618 - err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); 2619 - 2620 - return err; 2621 2660 } 2622 2661 2623 2662 #ifdef CONFIG_FSL_ENETC_PTP_CLOCK
+8 -4
drivers/net/ethernet/freescale/enetc/enetc.h
··· 393 393 void enetc_stop(struct net_device *ndev); 394 394 netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev); 395 395 struct net_device_stats *enetc_get_stats(struct net_device *ndev); 396 - int enetc_set_features(struct net_device *ndev, 397 - netdev_features_t features); 396 + void enetc_set_features(struct net_device *ndev, netdev_features_t features); 398 397 int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd); 399 - int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, 400 - void *type_data); 398 + int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data); 401 399 int enetc_setup_bpf(struct net_device *dev, struct netdev_bpf *xdp); 402 400 int enetc_xdp_xmit(struct net_device *ndev, int num_frames, 403 401 struct xdp_frame **frames, u32 flags); ··· 463 465 int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data); 464 466 int enetc_psfp_init(struct enetc_ndev_priv *priv); 465 467 int enetc_psfp_clean(struct enetc_ndev_priv *priv); 468 + int enetc_set_psfp(struct net_device *ndev, bool en); 466 469 467 470 static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv) 468 471 { ··· 536 537 } 537 538 538 539 static inline int enetc_psfp_disable(struct enetc_ndev_priv *priv) 540 + { 541 + return 0; 542 + } 543 + 544 + static inline int enetc_set_psfp(struct net_device *ndev, bool en) 539 545 { 540 546 return 0; 541 547 }
+30 -2
drivers/net/ethernet/freescale/enetc/enetc_pf.c
··· 709 709 { 710 710 netdev_features_t changed = ndev->features ^ features; 711 711 struct enetc_ndev_priv *priv = netdev_priv(ndev); 712 + int err; 713 + 714 + if (changed & NETIF_F_HW_TC) { 715 + err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC)); 716 + if (err) 717 + return err; 718 + } 712 719 713 720 if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) { 714 721 struct enetc_pf *pf = enetc_si_priv(priv->si); ··· 729 722 if (changed & NETIF_F_LOOPBACK) 730 723 enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK)); 731 724 732 - return enetc_set_features(ndev, features); 725 + enetc_set_features(ndev, features); 726 + 727 + return 0; 728 + } 729 + 730 + static int enetc_pf_setup_tc(struct net_device *ndev, enum tc_setup_type type, 731 + void *type_data) 732 + { 733 + switch (type) { 734 + case TC_SETUP_QDISC_MQPRIO: 735 + return enetc_setup_tc_mqprio(ndev, type_data); 736 + case TC_SETUP_QDISC_TAPRIO: 737 + return enetc_setup_tc_taprio(ndev, type_data); 738 + case TC_SETUP_QDISC_CBS: 739 + return enetc_setup_tc_cbs(ndev, type_data); 740 + case TC_SETUP_QDISC_ETF: 741 + return enetc_setup_tc_txtime(ndev, type_data); 742 + case TC_SETUP_BLOCK: 743 + return enetc_setup_tc_psfp(ndev, type_data); 744 + default: 745 + return -EOPNOTSUPP; 746 + } 733 747 } 734 748 735 749 static const struct net_device_ops enetc_ndev_ops = { ··· 767 739 .ndo_set_vf_spoofchk = enetc_pf_set_vf_spoofchk, 768 740 .ndo_set_features = enetc_pf_set_features, 769 741 .ndo_eth_ioctl = enetc_ioctl, 770 - .ndo_setup_tc = enetc_setup_tc, 742 + .ndo_setup_tc = enetc_pf_setup_tc, 771 743 .ndo_bpf = enetc_setup_bpf, 772 744 .ndo_xdp_xmit = enetc_xdp_xmit, 773 745 };
+23
drivers/net/ethernet/freescale/enetc/enetc_qos.c
··· 1517 1517 } 1518 1518 } 1519 1519 1520 + int enetc_set_psfp(struct net_device *ndev, bool en) 1521 + { 1522 + struct enetc_ndev_priv *priv = netdev_priv(ndev); 1523 + int err; 1524 + 1525 + if (en) { 1526 + err = enetc_psfp_enable(priv); 1527 + if (err) 1528 + return err; 1529 + 1530 + priv->active_offloads |= ENETC_F_QCI; 1531 + return 0; 1532 + } 1533 + 1534 + err = enetc_psfp_disable(priv); 1535 + if (err) 1536 + return err; 1537 + 1538 + priv->active_offloads &= ~ENETC_F_QCI; 1539 + 1540 + return 0; 1541 + } 1542 + 1520 1543 int enetc_psfp_init(struct enetc_ndev_priv *priv) 1521 1544 { 1522 1545 if (epsfp.psfp_sfi_bitmap)
+15 -2
drivers/net/ethernet/freescale/enetc/enetc_vf.c
··· 88 88 static int enetc_vf_set_features(struct net_device *ndev, 89 89 netdev_features_t features) 90 90 { 91 - return enetc_set_features(ndev, features); 91 + enetc_set_features(ndev, features); 92 + 93 + return 0; 94 + } 95 + 96 + static int enetc_vf_setup_tc(struct net_device *ndev, enum tc_setup_type type, 97 + void *type_data) 98 + { 99 + switch (type) { 100 + case TC_SETUP_QDISC_MQPRIO: 101 + return enetc_setup_tc_mqprio(ndev, type_data); 102 + default: 103 + return -EOPNOTSUPP; 104 + } 92 105 } 93 106 94 107 /* Probing/ Init */ ··· 113 100 .ndo_set_mac_address = enetc_vf_set_mac_addr, 114 101 .ndo_set_features = enetc_vf_set_features, 115 102 .ndo_eth_ioctl = enetc_ioctl, 116 - .ndo_setup_tc = enetc_setup_tc, 103 + .ndo_setup_tc = enetc_vf_setup_tc, 117 104 }; 118 105 119 106 static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
+1 -10
drivers/net/ethernet/freescale/fec.h
··· 561 561 struct clk *clk_2x_txclk; 562 562 563 563 bool ptp_clk_on; 564 + struct mutex ptp_clk_mutex; 564 565 unsigned int num_tx_queues; 565 566 unsigned int num_rx_queues; 566 567 ··· 639 638 int pps_enable; 640 639 unsigned int next_counter; 641 640 642 - struct { 643 - struct timespec64 ts_phc; 644 - u64 ns_sys; 645 - u32 at_corr; 646 - u8 at_inc_corr; 647 - } ptp_saved_state; 648 - 649 641 u64 ethtool_stats[]; 650 642 }; 651 643 ··· 648 654 void fec_ptp_disable_hwts(struct net_device *ndev); 649 655 int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr); 650 656 int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr); 651 - 652 - void fec_ptp_save_state(struct fec_enet_private *fep); 653 - int fec_ptp_restore_state(struct fec_enet_private *fep); 654 657 655 658 /****************************************************************************/ 656 659 #endif /* FEC_H */
+12 -47
drivers/net/ethernet/freescale/fec_main.c
··· 286 286 #define FEC_MMFR_TA (2 << 16) 287 287 #define FEC_MMFR_DATA(v) (v & 0xffff) 288 288 /* FEC ECR bits definition */ 289 - #define FEC_ECR_RESET BIT(0) 290 - #define FEC_ECR_ETHEREN BIT(1) 291 - #define FEC_ECR_MAGICEN BIT(2) 292 - #define FEC_ECR_SLEEP BIT(3) 293 - #define FEC_ECR_EN1588 BIT(4) 289 + #define FEC_ECR_MAGICEN (1 << 2) 290 + #define FEC_ECR_SLEEP (1 << 3) 294 291 295 292 #define FEC_MII_TIMEOUT 30000 /* us */ 296 293 ··· 983 986 u32 temp_mac[2]; 984 987 u32 rcntl = OPT_FRAME_SIZE | 0x04; 985 988 u32 ecntl = 0x2; /* ETHEREN */ 986 - struct ptp_clock_request ptp_rq = { .type = PTP_CLK_REQ_PPS }; 987 - 988 - fec_ptp_save_state(fep); 989 989 990 990 /* Whack a reset. We should wait for this. 991 991 * For i.MX6SX SOC, enet use AXI bus, we use disable MAC ··· 1136 1142 } 1137 1143 1138 1144 if (fep->bufdesc_ex) 1139 - ecntl |= FEC_ECR_EN1588; 1145 + ecntl |= (1 << 4); 1140 1146 1141 1147 if (fep->quirks & FEC_QUIRK_DELAYED_CLKS_SUPPORT && 1142 1148 fep->rgmii_txc_dly) ··· 1156 1162 1157 1163 if (fep->bufdesc_ex) 1158 1164 fec_ptp_start_cyclecounter(ndev); 1159 - 1160 - /* Restart PPS if needed */ 1161 - if (fep->pps_enable) { 1162 - /* Clear flag so fec_ptp_enable_pps() doesn't return immediately */ 1163 - fep->pps_enable = 0; 1164 - fec_ptp_restore_state(fep); 1165 - fep->ptp_caps.enable(&fep->ptp_caps, &ptp_rq, 1); 1166 - } 1167 1165 1168 1166 /* Enable interrupts we wish to service */ 1169 1167 if (fep->link) ··· 1207 1221 struct fec_enet_private *fep = netdev_priv(ndev); 1208 1222 u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8); 1209 1223 u32 val; 1210 - struct ptp_clock_request ptp_rq = { .type = PTP_CLK_REQ_PPS }; 1211 - u32 ecntl = 0; 1212 1224 1213 1225 /* We cannot expect a graceful transmit stop without link !!! */ 1214 1226 if (fep->link) { ··· 1215 1231 if (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_GRA)) 1216 1232 netdev_err(ndev, "Graceful transmit stop did not complete!\n"); 1217 1233 } 1218 - 1219 - fec_ptp_save_state(fep); 1220 1234 1221 1235 /* Whack a reset. We should wait for this. 1222 1236 * For i.MX6SX SOC, enet use AXI bus, we use disable MAC ··· 1235 1253 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); 1236 1254 writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); 1237 1255 1238 - if (fep->bufdesc_ex) 1239 - ecntl |= FEC_ECR_EN1588; 1240 - 1241 1256 /* We have to keep ENET enabled to have MII interrupt stay working */ 1242 1257 if (fep->quirks & FEC_QUIRK_ENET_MAC && 1243 1258 !(fep->wol_flag & FEC_WOL_FLAG_SLEEP_ON)) { 1244 - ecntl |= FEC_ECR_ETHEREN; 1259 + writel(2, fep->hwp + FEC_ECNTRL); 1245 1260 writel(rmii_mode, fep->hwp + FEC_R_CNTRL); 1246 - } 1247 - 1248 - writel(ecntl, fep->hwp + FEC_ECNTRL); 1249 - 1250 - if (fep->bufdesc_ex) 1251 - fec_ptp_start_cyclecounter(ndev); 1252 - 1253 - /* Restart PPS if needed */ 1254 - if (fep->pps_enable) { 1255 - /* Clear flag so fec_ptp_enable_pps() doesn't return immediately */ 1256 - fep->pps_enable = 0; 1257 - fec_ptp_restore_state(fep); 1258 - fep->ptp_caps.enable(&fep->ptp_caps, &ptp_rq, 1); 1259 1261 } 1260 1262 } 1261 1263 ··· 1995 2029 static int fec_enet_clk_enable(struct net_device *ndev, bool enable) 1996 2030 { 1997 2031 struct fec_enet_private *fep = netdev_priv(ndev); 1998 - unsigned long flags; 1999 2032 int ret; 2000 2033 2001 2034 if (enable) { ··· 2003 2038 return ret; 2004 2039 2005 2040 if (fep->clk_ptp) { 2006 - spin_lock_irqsave(&fep->tmreg_lock, flags); 2041 + mutex_lock(&fep->ptp_clk_mutex); 2007 2042 ret = clk_prepare_enable(fep->clk_ptp); 2008 2043 if (ret) { 2009 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2044 + mutex_unlock(&fep->ptp_clk_mutex); 2010 2045 goto failed_clk_ptp; 2011 2046 } else { 2012 2047 fep->ptp_clk_on = true; 2013 2048 } 2014 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2049 + mutex_unlock(&fep->ptp_clk_mutex); 2015 2050 } 2016 2051 2017 2052 ret = clk_prepare_enable(fep->clk_ref); ··· 2026 2061 } else { 2027 2062 clk_disable_unprepare(fep->clk_enet_out); 2028 2063 if (fep->clk_ptp) { 2029 - spin_lock_irqsave(&fep->tmreg_lock, flags); 2064 + mutex_lock(&fep->ptp_clk_mutex); 2030 2065 clk_disable_unprepare(fep->clk_ptp); 2031 2066 fep->ptp_clk_on = false; 2032 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2067 + mutex_unlock(&fep->ptp_clk_mutex); 2033 2068 } 2034 2069 clk_disable_unprepare(fep->clk_ref); 2035 2070 clk_disable_unprepare(fep->clk_2x_txclk); ··· 2042 2077 clk_disable_unprepare(fep->clk_ref); 2043 2078 failed_clk_ref: 2044 2079 if (fep->clk_ptp) { 2045 - spin_lock_irqsave(&fep->tmreg_lock, flags); 2080 + mutex_lock(&fep->ptp_clk_mutex); 2046 2081 clk_disable_unprepare(fep->clk_ptp); 2047 2082 fep->ptp_clk_on = false; 2048 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 2083 + mutex_unlock(&fep->ptp_clk_mutex); 2049 2084 } 2050 2085 failed_clk_ptp: 2051 2086 clk_disable_unprepare(fep->clk_enet_out); ··· 3880 3915 } 3881 3916 3882 3917 fep->ptp_clk_on = false; 3883 - spin_lock_init(&fep->tmreg_lock); 3918 + mutex_init(&fep->ptp_clk_mutex); 3884 3919 3885 3920 /* clk_ref is optional, depends on board */ 3886 3921 fep->clk_ref = devm_clk_get_optional(&pdev->dev, "enet_clk_ref");
+18 -39
drivers/net/ethernet/freescale/fec_ptp.c
··· 365 365 */ 366 366 static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) 367 367 { 368 - struct fec_enet_private *fep = 368 + struct fec_enet_private *adapter = 369 369 container_of(ptp, struct fec_enet_private, ptp_caps); 370 370 u64 ns; 371 371 unsigned long flags; 372 372 373 - spin_lock_irqsave(&fep->tmreg_lock, flags); 373 + mutex_lock(&adapter->ptp_clk_mutex); 374 374 /* Check the ptp clock */ 375 - if (!fep->ptp_clk_on) { 376 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 375 + if (!adapter->ptp_clk_on) { 376 + mutex_unlock(&adapter->ptp_clk_mutex); 377 377 return -EINVAL; 378 378 } 379 - ns = timecounter_read(&fep->tc); 380 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 379 + spin_lock_irqsave(&adapter->tmreg_lock, flags); 380 + ns = timecounter_read(&adapter->tc); 381 + spin_unlock_irqrestore(&adapter->tmreg_lock, flags); 382 + mutex_unlock(&adapter->ptp_clk_mutex); 381 383 382 384 *ts = ns_to_timespec64(ns); 383 385 ··· 404 402 unsigned long flags; 405 403 u32 counter; 406 404 407 - spin_lock_irqsave(&fep->tmreg_lock, flags); 405 + mutex_lock(&fep->ptp_clk_mutex); 408 406 /* Check the ptp clock */ 409 407 if (!fep->ptp_clk_on) { 410 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 408 + mutex_unlock(&fep->ptp_clk_mutex); 411 409 return -EINVAL; 412 410 } 413 411 ··· 417 415 */ 418 416 counter = ns & fep->cc.mask; 419 417 418 + spin_lock_irqsave(&fep->tmreg_lock, flags); 420 419 writel(counter, fep->hwp + FEC_ATIME); 421 420 timecounter_init(&fep->tc, &fep->cc, ns); 422 421 spin_unlock_irqrestore(&fep->tmreg_lock, flags); 422 + mutex_unlock(&fep->ptp_clk_mutex); 423 423 return 0; 424 424 } 425 425 ··· 518 514 struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep); 519 515 unsigned long flags; 520 516 521 - spin_lock_irqsave(&fep->tmreg_lock, flags); 517 + mutex_lock(&fep->ptp_clk_mutex); 522 518 if (fep->ptp_clk_on) { 519 + spin_lock_irqsave(&fep->tmreg_lock, flags); 523 520 timecounter_read(&fep->tc); 521 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 524 522 } 525 - spin_unlock_irqrestore(&fep->tmreg_lock, flags); 523 + mutex_unlock(&fep->ptp_clk_mutex); 526 524 527 525 schedule_delayed_work(&fep->time_keep, HZ); 528 526 } ··· 599 593 } 600 594 fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed; 601 595 596 + spin_lock_init(&fep->tmreg_lock); 597 + 602 598 fec_ptp_start_cyclecounter(ndev); 603 599 604 600 INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep); ··· 633 625 struct net_device *ndev = platform_get_drvdata(pdev); 634 626 struct fec_enet_private *fep = netdev_priv(ndev); 635 627 636 - if (fep->pps_enable) 637 - fec_ptp_enable_pps(fep, 0); 638 - 639 628 cancel_delayed_work_sync(&fep->time_keep); 640 629 if (fep->ptp_clock) 641 630 ptp_clock_unregister(fep->ptp_clock); 642 - } 643 - 644 - void fec_ptp_save_state(struct fec_enet_private *fep) 645 - { 646 - u32 atime_inc_corr; 647 - 648 - fec_ptp_gettime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc); 649 - fep->ptp_saved_state.ns_sys = ktime_get_ns(); 650 - 651 - fep->ptp_saved_state.at_corr = readl(fep->hwp + FEC_ATIME_CORR); 652 - atime_inc_corr = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_CORR_MASK; 653 - fep->ptp_saved_state.at_inc_corr = (u8)(atime_inc_corr >> FEC_T_INC_CORR_OFFSET); 654 - } 655 - 656 - int fec_ptp_restore_state(struct fec_enet_private *fep) 657 - { 658 - u32 atime_inc = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_MASK; 659 - u64 ns_sys; 660 - 661 - writel(fep->ptp_saved_state.at_corr, fep->hwp + FEC_ATIME_CORR); 662 - atime_inc |= ((u32)fep->ptp_saved_state.at_inc_corr) << FEC_T_INC_CORR_OFFSET; 663 - writel(atime_inc, fep->hwp + FEC_ATIME_INC); 664 - 665 - ns_sys = ktime_get_ns() - fep->ptp_saved_state.ns_sys; 666 - timespec64_add_ns(&fep->ptp_saved_state.ts_phc, ns_sys); 667 - return fec_ptp_settime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc); 668 631 }
+1 -1
drivers/net/ethernet/google/gve/gve_rx_dqo.c
··· 157 157 int err; 158 158 159 159 err = gve_alloc_page(priv, &priv->pdev->dev, &buf_state->page_info.page, 160 - &buf_state->addr, DMA_FROM_DEVICE, GFP_KERNEL); 160 + &buf_state->addr, DMA_FROM_DEVICE, GFP_ATOMIC); 161 161 if (err) 162 162 return err; 163 163
+26 -6
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 5909 5909 } 5910 5910 5911 5911 /** 5912 + * i40e_bw_bytes_to_mbits - Convert max_tx_rate from bytes to mbits 5913 + * @vsi: Pointer to vsi structure 5914 + * @max_tx_rate: max TX rate in bytes to be converted into Mbits 5915 + * 5916 + * Helper function to convert units before send to set BW limit 5917 + **/ 5918 + static u64 i40e_bw_bytes_to_mbits(struct i40e_vsi *vsi, u64 max_tx_rate) 5919 + { 5920 + if (max_tx_rate < I40E_BW_MBPS_DIVISOR) { 5921 + dev_warn(&vsi->back->pdev->dev, 5922 + "Setting max tx rate to minimum usable value of 50Mbps.\n"); 5923 + max_tx_rate = I40E_BW_CREDIT_DIVISOR; 5924 + } else { 5925 + do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); 5926 + } 5927 + 5928 + return max_tx_rate; 5929 + } 5930 + 5931 + /** 5912 5932 * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate 5913 5933 * @vsi: VSI to be configured 5914 5934 * @seid: seid of the channel/VSI ··· 5950 5930 max_tx_rate, seid); 5951 5931 return -EINVAL; 5952 5932 } 5953 - if (max_tx_rate && max_tx_rate < 50) { 5933 + if (max_tx_rate && max_tx_rate < I40E_BW_CREDIT_DIVISOR) { 5954 5934 dev_warn(&pf->pdev->dev, 5955 5935 "Setting max tx rate to minimum usable value of 50Mbps.\n"); 5956 - max_tx_rate = 50; 5936 + max_tx_rate = I40E_BW_CREDIT_DIVISOR; 5957 5937 } 5958 5938 5959 5939 /* Tx rate credits are in values of 50Mbps, 0 is disabled */ ··· 8244 8224 8245 8225 if (i40e_is_tc_mqprio_enabled(pf)) { 8246 8226 if (vsi->mqprio_qopt.max_rate[0]) { 8247 - u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0]; 8227 + u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi, 8228 + vsi->mqprio_qopt.max_rate[0]); 8248 8229 8249 - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); 8250 8230 ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); 8251 8231 if (!ret) { 8252 8232 u64 credits = max_tx_rate; ··· 10991 10971 } 10992 10972 10993 10973 if (vsi->mqprio_qopt.max_rate[0]) { 10994 - u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0]; 10974 + u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi, 10975 + vsi->mqprio_qopt.max_rate[0]); 10995 10976 u64 credits = 0; 10996 10977 10997 - do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR); 10998 10978 ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate); 10999 10979 if (ret) 11000 10980 goto end_unlock;
+20
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 2039 2039 } 2040 2040 2041 2041 /** 2042 + * i40e_vc_get_max_frame_size 2043 + * @vf: pointer to the VF 2044 + * 2045 + * Max frame size is determined based on the current port's max frame size and 2046 + * whether a port VLAN is configured on this VF. The VF is not aware whether 2047 + * it's in a port VLAN so the PF needs to account for this in max frame size 2048 + * checks and sending the max frame size to the VF. 2049 + **/ 2050 + static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf) 2051 + { 2052 + u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size; 2053 + 2054 + if (vf->port_vlan_id) 2055 + max_frame_size -= VLAN_HLEN; 2056 + 2057 + return max_frame_size; 2058 + } 2059 + 2060 + /** 2042 2061 * i40e_vc_get_vf_resources_msg 2043 2062 * @vf: pointer to the VF info 2044 2063 * @msg: pointer to the msg buffer ··· 2158 2139 vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf; 2159 2140 vfres->rss_key_size = I40E_HKEY_ARRAY_SIZE; 2160 2141 vfres->rss_lut_size = I40E_VF_HLUT_ARRAY_SIZE; 2142 + vfres->max_mtu = i40e_vc_get_max_frame_size(vf); 2161 2143 2162 2144 if (vf->lan_vsi_idx) { 2163 2145 vfres->vsi_res[0].vsi_id = vf->lan_vsi_id;
+3 -6
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 1077 1077 { 1078 1078 struct iavf_adapter *adapter = netdev_priv(netdev); 1079 1079 struct sockaddr *addr = p; 1080 - bool handle_mac = iavf_is_mac_set_handled(netdev, addr->sa_data); 1081 1080 int ret; 1082 1081 1083 1082 if (!is_valid_ether_addr(addr->sa_data)) ··· 1093 1094 return 0; 1094 1095 } 1095 1096 1096 - if (handle_mac) 1097 - goto done; 1098 - 1099 - ret = wait_event_interruptible_timeout(adapter->vc_waitqueue, false, msecs_to_jiffies(2500)); 1097 + ret = wait_event_interruptible_timeout(adapter->vc_waitqueue, 1098 + iavf_is_mac_set_handled(netdev, addr->sa_data), 1099 + msecs_to_jiffies(2500)); 1100 1100 1101 1101 /* If ret < 0 then it means wait was interrupted. 1102 1102 * If ret == 0 then it means we got a timeout. ··· 1109 1111 if (!ret) 1110 1112 return -EAGAIN; 1111 1113 1112 - done: 1113 1114 if (!ether_addr_equal(netdev->dev_addr, addr->sa_data)) 1114 1115 return -EACCES; 1115 1116
+6 -3
drivers/net/ethernet/intel/iavf/iavf_txrx.c
··· 114 114 { 115 115 u32 head, tail; 116 116 117 + /* underlying hardware might not allow access and/or always return 118 + * 0 for the head/tail registers so just use the cached values 119 + */ 117 120 head = ring->next_to_clean; 118 - tail = readl(ring->tail); 121 + tail = ring->next_to_use; 119 122 120 123 if (head != tail) 121 124 return (head < tail) ? ··· 1393 1390 #endif 1394 1391 struct sk_buff *skb; 1395 1392 1396 - if (!rx_buffer) 1393 + if (!rx_buffer || !size) 1397 1394 return NULL; 1398 1395 /* prefetch first cache line of first page */ 1399 1396 va = page_address(rx_buffer->page) + rx_buffer->page_offset; ··· 1551 1548 /* exit if we failed to retrieve a buffer */ 1552 1549 if (!skb) { 1553 1550 rx_ring->rx_stats.alloc_buff_failed++; 1554 - if (rx_buffer) 1551 + if (rx_buffer && size) 1555 1552 rx_buffer->pagecnt_bias++; 1556 1553 break; 1557 1554 }
+5 -2
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
··· 269 269 void iavf_configure_queues(struct iavf_adapter *adapter) 270 270 { 271 271 struct virtchnl_vsi_queue_config_info *vqci; 272 - struct virtchnl_queue_pair_info *vqpi; 272 + int i, max_frame = adapter->vf_res->max_mtu; 273 273 int pairs = adapter->num_active_queues; 274 - int i, max_frame = IAVF_MAX_RXBUFFER; 274 + struct virtchnl_queue_pair_info *vqpi; 275 275 size_t len; 276 + 277 + if (max_frame > IAVF_MAX_RXBUFFER || !max_frame) 278 + max_frame = IAVF_MAX_RXBUFFER; 276 279 277 280 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { 278 281 /* bail because we already have a command pending */
+28 -18
drivers/net/ethernet/intel/ice/ice_lib.c
··· 914 914 */ 915 915 static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) 916 916 { 917 - u16 offset = 0, qmap = 0, tx_count = 0, pow = 0; 917 + u16 offset = 0, qmap = 0, tx_count = 0, rx_count = 0, pow = 0; 918 918 u16 num_txq_per_tc, num_rxq_per_tc; 919 919 u16 qcount_tx = vsi->alloc_txq; 920 920 u16 qcount_rx = vsi->alloc_rxq; ··· 981 981 * at least 1) 982 982 */ 983 983 if (offset) 984 - vsi->num_rxq = offset; 984 + rx_count = offset; 985 985 else 986 - vsi->num_rxq = num_rxq_per_tc; 986 + rx_count = num_rxq_per_tc; 987 987 988 - if (vsi->num_rxq > vsi->alloc_rxq) { 988 + if (rx_count > vsi->alloc_rxq) { 989 989 dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n", 990 - vsi->num_rxq, vsi->alloc_rxq); 990 + rx_count, vsi->alloc_rxq); 991 + return -EINVAL; 992 + } 993 + 994 + if (tx_count > vsi->alloc_txq) { 995 + dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n", 996 + tx_count, vsi->alloc_txq); 991 997 return -EINVAL; 992 998 } 993 999 994 1000 vsi->num_txq = tx_count; 995 - if (vsi->num_txq > vsi->alloc_txq) { 996 - dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n", 997 - vsi->num_txq, vsi->alloc_txq); 998 - return -EINVAL; 999 - } 1001 + vsi->num_rxq = rx_count; 1000 1002 1001 1003 if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) { 1002 1004 dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n"); ··· 3492 3490 u16 pow, offset = 0, qcount_tx = 0, qcount_rx = 0, qmap; 3493 3491 u16 tc0_offset = vsi->mqprio_qopt.qopt.offset[0]; 3494 3492 int tc0_qcount = vsi->mqprio_qopt.qopt.count[0]; 3493 + u16 new_txq, new_rxq; 3495 3494 u8 netdev_tc = 0; 3496 3495 int i; 3497 3496 ··· 3533 3530 } 3534 3531 } 3535 3532 3536 - /* Set actual Tx/Rx queue pairs */ 3537 - vsi->num_txq = offset + qcount_tx; 3538 - if (vsi->num_txq > vsi->alloc_txq) { 3533 + new_txq = offset + qcount_tx; 3534 + if (new_txq > vsi->alloc_txq) { 3539 3535 dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n", 3540 - vsi->num_txq, vsi->alloc_txq); 3536 + new_txq, vsi->alloc_txq); 3541 3537 return -EINVAL; 3542 3538 } 3543 3539 3544 - vsi->num_rxq = offset + qcount_rx; 3545 - if (vsi->num_rxq > vsi->alloc_rxq) { 3540 + new_rxq = offset + qcount_rx; 3541 + if (new_rxq > vsi->alloc_rxq) { 3546 3542 dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n", 3547 - vsi->num_rxq, vsi->alloc_rxq); 3543 + new_rxq, vsi->alloc_rxq); 3548 3544 return -EINVAL; 3549 3545 } 3546 + 3547 + /* Set actual Tx/Rx queue pairs */ 3548 + vsi->num_txq = new_txq; 3549 + vsi->num_rxq = new_rxq; 3550 3550 3551 3551 /* Setup queue TC[0].qmap for given VSI context */ 3552 3552 ctxt->info.tc_mapping[0] = cpu_to_le16(qmap); ··· 3582 3576 { 3583 3577 u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 3584 3578 struct ice_pf *pf = vsi->back; 3579 + struct ice_tc_cfg old_tc_cfg; 3585 3580 struct ice_vsi_ctx *ctx; 3586 3581 struct device *dev; 3587 3582 int i, ret = 0; ··· 3607 3600 max_txqs[i] = vsi->num_txq; 3608 3601 } 3609 3602 3603 + memcpy(&old_tc_cfg, &vsi->tc_cfg, sizeof(old_tc_cfg)); 3610 3604 vsi->tc_cfg.ena_tc = ena_tc; 3611 3605 vsi->tc_cfg.numtc = num_tc; 3612 3606 ··· 3624 3616 else 3625 3617 ret = ice_vsi_setup_q_map(vsi, ctx); 3626 3618 3627 - if (ret) 3619 + if (ret) { 3620 + memcpy(&vsi->tc_cfg, &old_tc_cfg, sizeof(vsi->tc_cfg)); 3628 3621 goto out; 3622 + } 3629 3623 3630 3624 /* must to indicate which section of VSI context are being modified */ 3631 3625 ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
+14 -11
drivers/net/ethernet/intel/ice/ice_main.c
··· 2399 2399 return -EBUSY; 2400 2400 } 2401 2401 2402 - ice_unplug_aux_dev(pf); 2403 - 2404 2402 switch (reset) { 2405 2403 case ICE_RESET_PFR: 2406 2404 set_bit(ICE_PFR_REQ, pf->state); ··· 6649 6651 */ 6650 6652 int ice_down(struct ice_vsi *vsi) 6651 6653 { 6652 - int i, tx_err, rx_err, link_err = 0, vlan_err = 0; 6654 + int i, tx_err, rx_err, vlan_err = 0; 6653 6655 6654 6656 WARN_ON(!test_bit(ICE_VSI_DOWN, vsi->state)); 6655 6657 ··· 6683 6685 6684 6686 ice_napi_disable_all(vsi); 6685 6687 6686 - if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) { 6687 - link_err = ice_force_phys_link_state(vsi, false); 6688 - if (link_err) 6689 - netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n", 6690 - vsi->vsi_num, link_err); 6691 - } 6692 - 6693 6688 ice_for_each_txq(vsi, i) 6694 6689 ice_clean_tx_ring(vsi->tx_rings[i]); 6695 6690 6696 6691 ice_for_each_rxq(vsi, i) 6697 6692 ice_clean_rx_ring(vsi->rx_rings[i]); 6698 6693 6699 - if (tx_err || rx_err || link_err || vlan_err) { 6694 + if (tx_err || rx_err || vlan_err) { 6700 6695 netdev_err(vsi->netdev, "Failed to close VSI 0x%04X on switch 0x%04X\n", 6701 6696 vsi->vsi_num, vsi->vsw->sw_id); 6702 6697 return -EIO; ··· 6850 6859 err = ice_vsi_req_irq_msix(vsi, int_name); 6851 6860 if (err) 6852 6861 goto err_setup_rx; 6862 + 6863 + ice_vsi_cfg_netdev_tc(vsi, vsi->tc_cfg.ena_tc); 6853 6864 6854 6865 if (vsi->type == ICE_VSI_PF) { 6855 6866 /* Notify the stack of the actual queue counts. */ ··· 8883 8890 if (ice_is_reset_in_progress(pf->state)) { 8884 8891 netdev_err(netdev, "can't stop net device while reset is in progress"); 8885 8892 return -EBUSY; 8893 + } 8894 + 8895 + if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) { 8896 + int link_err = ice_force_phys_link_state(vsi, false); 8897 + 8898 + if (link_err) { 8899 + netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n", 8900 + vsi->vsi_num, link_err); 8901 + return -EIO; 8902 + } 8886 8903 } 8887 8904 8888 8905 ice_vsi_close(vsi);
+4 -1
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 610 610 if (test_bit(ICE_VSI_DOWN, vsi->state)) 611 611 return -ENETDOWN; 612 612 613 - if (!ice_is_xdp_ena_vsi(vsi) || queue_index >= vsi->num_xdp_txq) 613 + if (!ice_is_xdp_ena_vsi(vsi)) 614 614 return -ENXIO; 615 615 616 616 if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) ··· 621 621 xdp_ring = vsi->xdp_rings[queue_index]; 622 622 spin_lock(&xdp_ring->tx_lock); 623 623 } else { 624 + /* Generally, should not happen */ 625 + if (unlikely(queue_index >= vsi->num_xdp_txq)) 626 + return -ENXIO; 624 627 xdp_ring = vsi->xdp_rings[queue_index]; 625 628 } 626 629
+2
drivers/net/ethernet/marvell/prestera/prestera_main.c
··· 368 368 if (!sw->np) 369 369 return 0; 370 370 371 + of_node_get(sw->np); 371 372 ports = of_find_node_by_name(sw->np, "ports"); 372 373 373 374 for_each_child_of_node(ports, node) { ··· 418 417 } 419 418 420 419 out: 420 + of_node_put(node); 421 421 of_node_put(ports); 422 422 return err; 423 423 }
+1
drivers/net/ethernet/marvell/prestera/prestera_pci.c
··· 872 872 static const struct pci_device_id prestera_pci_devices[] = { 873 873 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC804) }, 874 874 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC80C) }, 875 + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xCC1E) }, 875 876 { } 876 877 }; 877 878 MODULE_DEVICE_TABLE(pci, prestera_pci_devices);
+1 -1
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 1458 1458 1459 1459 static bool mtk_page_pool_enabled(struct mtk_eth *eth) 1460 1460 { 1461 - return !eth->hwlro; 1461 + return MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2); 1462 1462 } 1463 1463 1464 1464 static struct page_pool *mtk_create_page_pool(struct mtk_eth *eth,
+6
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c
··· 179 179 /* Only return ad bits of the gw register */ 180 180 ret &= MLXBF_GIGE_MDIO_GW_AD_MASK; 181 181 182 + /* The MDIO lock is set on read. To release it, clear gw register */ 183 + writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET); 184 + 182 185 return ret; 183 186 } 184 187 ··· 205 202 ret = readl_poll_timeout_atomic(priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET, 206 203 temp, !(temp & MLXBF_GIGE_MDIO_GW_BUSY_MASK), 207 204 5, 1000000); 205 + 206 + /* The MDIO lock is set on read. To release it, clear gw register */ 207 + writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET); 208 208 209 209 return ret; 210 210 }
+10 -4
drivers/net/ethernet/microsoft/mana/gdma_main.c
··· 397 397 break; 398 398 } 399 399 400 + /* Per GDMA spec, rmb is necessary after checking owner_bits, before 401 + * reading eqe. 402 + */ 403 + rmb(); 404 + 400 405 mana_gd_process_eqe(eq); 401 406 402 407 eq->head++; ··· 1139 1134 if (WARN_ON_ONCE(owner_bits != new_bits)) 1140 1135 return -1; 1141 1136 1137 + /* Per GDMA spec, rmb is necessary after checking owner_bits, before 1138 + * reading completion info 1139 + */ 1140 + rmb(); 1141 + 1142 1142 comp->wq_num = cqe->cqe_info.wq_num; 1143 1143 comp->is_sq = cqe->cqe_info.is_sq; 1144 1144 memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE); ··· 1474 1464 1475 1465 pci_disable_device(pdev); 1476 1466 } 1477 - 1478 - #ifndef PCI_VENDOR_ID_MICROSOFT 1479 - #define PCI_VENDOR_ID_MICROSOFT 0x1414 1480 - #endif 1481 1467 1482 1468 static const struct pci_device_id mana_id_table[] = { 1483 1469 { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) },
+2
drivers/net/ethernet/renesas/ravb_main.c
··· 1449 1449 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); 1450 1450 } 1451 1451 1452 + /* Indicate that the MAC is responsible for managing PHY PM */ 1453 + phydev->mac_managed_pm = true; 1452 1454 phy_attached_info(phydev); 1453 1455 1454 1456 return 0;
+2
drivers/net/ethernet/renesas/sh_eth.c
··· 2029 2029 if (mdp->cd->register_type != SH_ETH_REG_GIGABIT) 2030 2030 phy_set_max_speed(phydev, SPEED_100); 2031 2031 2032 + /* Indicate that the MAC is responsible for managing PHY PM */ 2033 + phydev->mac_managed_pm = true; 2032 2034 phy_attached_info(phydev); 2033 2035 2034 2036 return 0;
+1 -1
drivers/net/ethernet/sfc/efx_channels.c
··· 319 319 efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); 320 320 efx->n_rx_channels = 1; 321 321 efx->n_tx_channels = 1; 322 - efx->tx_channel_offset = 1; 322 + efx->tx_channel_offset = efx_separate_tx_channels ? 1 : 0; 323 323 efx->n_xdp_channels = 0; 324 324 efx->xdp_channel_offset = efx->n_channels; 325 325 efx->legacy_irq = efx->pci_dev->irq;
+1 -1
drivers/net/ethernet/sfc/siena/efx_channels.c
··· 320 320 efx->n_channels = 1 + (efx_siena_separate_tx_channels ? 1 : 0); 321 321 efx->n_rx_channels = 1; 322 322 efx->n_tx_channels = 1; 323 - efx->tx_channel_offset = 1; 323 + efx->tx_channel_offset = efx_siena_separate_tx_channels ? 1 : 0; 324 324 efx->n_xdp_channels = 0; 325 325 efx->xdp_channel_offset = efx->n_channels; 326 326 efx->legacy_irq = efx->pci_dev->irq;
+1 -1
drivers/net/ethernet/sfc/siena/tx.c
··· 336 336 * previous packets out. 337 337 */ 338 338 if (!netdev_xmit_more()) 339 - efx_tx_send_pending(tx_queue->channel); 339 + efx_tx_send_pending(efx_get_tx_channel(efx, index)); 340 340 return NETDEV_TX_OK; 341 341 } 342 342
+1 -1
drivers/net/ethernet/sfc/tx.c
··· 549 549 * previous packets out. 550 550 */ 551 551 if (!netdev_xmit_more()) 552 - efx_tx_send_pending(tx_queue->channel); 552 + efx_tx_send_pending(efx_get_tx_channel(efx, index)); 553 553 return NETDEV_TX_OK; 554 554 } 555 555
+2 -2
drivers/net/ethernet/sun/sunhme.c
··· 2020 2020 2021 2021 skb_reserve(copy_skb, 2); 2022 2022 skb_put(copy_skb, len); 2023 - dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); 2023 + dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE); 2024 2024 skb_copy_from_linear_data(skb, copy_skb->data, len); 2025 - dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE); 2025 + dma_sync_single_for_device(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE); 2026 2026 /* Reuse original ring buffer. */ 2027 2027 hme_write_rxd(hp, this, 2028 2028 (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)),
+4 -4
drivers/net/ipa/ipa_qmi.c
··· 308 308 mem = ipa_mem_find(ipa, IPA_MEM_V4_ROUTE); 309 309 req.v4_route_tbl_info_valid = 1; 310 310 req.v4_route_tbl_info.start = ipa->mem_offset + mem->offset; 311 - req.v4_route_tbl_info.count = mem->size / sizeof(__le64); 311 + req.v4_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; 312 312 313 313 mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE); 314 314 req.v6_route_tbl_info_valid = 1; 315 315 req.v6_route_tbl_info.start = ipa->mem_offset + mem->offset; 316 - req.v6_route_tbl_info.count = mem->size / sizeof(__le64); 316 + req.v6_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; 317 317 318 318 mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER); 319 319 req.v4_filter_tbl_start_valid = 1; ··· 352 352 req.v4_hash_route_tbl_info_valid = 1; 353 353 req.v4_hash_route_tbl_info.start = 354 354 ipa->mem_offset + mem->offset; 355 - req.v4_hash_route_tbl_info.count = mem->size / sizeof(__le64); 355 + req.v4_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; 356 356 } 357 357 358 358 mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE_HASHED); ··· 360 360 req.v6_hash_route_tbl_info_valid = 1; 361 361 req.v6_hash_route_tbl_info.start = 362 362 ipa->mem_offset + mem->offset; 363 - req.v6_hash_route_tbl_info.count = mem->size / sizeof(__le64); 363 + req.v6_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1; 364 364 } 365 365 366 366 mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED);
+4 -4
drivers/net/ipa/ipa_qmi_msg.c
··· 311 311 .tlv_type = 0x12, 312 312 .offset = offsetof(struct ipa_init_modem_driver_req, 313 313 v4_route_tbl_info), 314 - .ei_array = ipa_mem_array_ei, 314 + .ei_array = ipa_mem_bounds_ei, 315 315 }, 316 316 { 317 317 .data_type = QMI_OPT_FLAG, ··· 332 332 .tlv_type = 0x13, 333 333 .offset = offsetof(struct ipa_init_modem_driver_req, 334 334 v6_route_tbl_info), 335 - .ei_array = ipa_mem_array_ei, 335 + .ei_array = ipa_mem_bounds_ei, 336 336 }, 337 337 { 338 338 .data_type = QMI_OPT_FLAG, ··· 496 496 .tlv_type = 0x1b, 497 497 .offset = offsetof(struct ipa_init_modem_driver_req, 498 498 v4_hash_route_tbl_info), 499 - .ei_array = ipa_mem_array_ei, 499 + .ei_array = ipa_mem_bounds_ei, 500 500 }, 501 501 { 502 502 .data_type = QMI_OPT_FLAG, ··· 517 517 .tlv_type = 0x1c, 518 518 .offset = offsetof(struct ipa_init_modem_driver_req, 519 519 v6_hash_route_tbl_info), 520 - .ei_array = ipa_mem_array_ei, 520 + .ei_array = ipa_mem_bounds_ei, 521 521 }, 522 522 { 523 523 .data_type = QMI_OPT_FLAG,
+21 -16
drivers/net/ipa/ipa_qmi_msg.h
··· 86 86 IPA_QMI_PLATFORM_TYPE_MSM_QNX_V01 = 0x5, /* QNX MSM */ 87 87 }; 88 88 89 - /* This defines the start and end offset of a range of memory. Both 90 - * fields are offsets relative to the start of IPA shared memory. 91 - * The end value is the last addressable byte *within* the range. 89 + /* This defines the start and end offset of a range of memory. The start 90 + * value is a byte offset relative to the start of IPA shared memory. The 91 + * end value is the last addressable unit *within* the range. Typically 92 + * the end value is in units of bytes, however it can also be a maximum 93 + * array index value. 92 94 */ 93 95 struct ipa_mem_bounds { 94 96 u32 start; ··· 131 129 u8 hdr_tbl_info_valid; 132 130 struct ipa_mem_bounds hdr_tbl_info; 133 131 134 - /* Routing table information. These define the location and size of 135 - * non-hashable IPv4 and IPv6 filter tables. The start values are 136 - * offsets relative to the start of IPA shared memory. 132 + /* Routing table information. These define the location and maximum 133 + * *index* (not byte) for the modem portion of non-hashable IPv4 and 134 + * IPv6 routing tables. The start values are byte offsets relative 135 + * to the start of IPA shared memory. 137 136 */ 138 137 u8 v4_route_tbl_info_valid; 139 - struct ipa_mem_array v4_route_tbl_info; 138 + struct ipa_mem_bounds v4_route_tbl_info; 140 139 u8 v6_route_tbl_info_valid; 141 - struct ipa_mem_array v6_route_tbl_info; 140 + struct ipa_mem_bounds v6_route_tbl_info; 142 141 143 142 /* Filter table information. These define the location of the 144 143 * non-hashable IPv4 and IPv6 filter tables. The start values are 145 - * offsets relative to the start of IPA shared memory. 144 + * byte offsets relative to the start of IPA shared memory. 146 145 */ 147 146 u8 v4_filter_tbl_start_valid; 148 147 u32 v4_filter_tbl_start; ··· 184 181 u8 zip_tbl_info_valid; 185 182 struct ipa_mem_bounds zip_tbl_info; 186 183 187 - /* Routing table information. These define the location and size 188 - * of hashable IPv4 and IPv6 filter tables. The start values are 189 - * offsets relative to the start of IPA shared memory. 184 + /* Routing table information. These define the location and maximum 185 + * *index* (not byte) for the modem portion of hashable IPv4 and IPv6 186 + * routing tables (if supported by hardware). The start values are 187 + * byte offsets relative to the start of IPA shared memory. 190 188 */ 191 189 u8 v4_hash_route_tbl_info_valid; 192 - struct ipa_mem_array v4_hash_route_tbl_info; 190 + struct ipa_mem_bounds v4_hash_route_tbl_info; 193 191 u8 v6_hash_route_tbl_info_valid; 194 - struct ipa_mem_array v6_hash_route_tbl_info; 192 + struct ipa_mem_bounds v6_hash_route_tbl_info; 195 193 196 194 /* Filter table information. These define the location and size 197 - * of hashable IPv4 and IPv6 filter tables. The start values are 198 - * offsets relative to the start of IPA shared memory. 195 + * of hashable IPv4 and IPv6 filter tables (if supported by hardware). 196 + * The start values are byte offsets relative to the start of IPA 197 + * shared memory. 199 198 */ 200 199 u8 v4_hash_filter_tbl_start_valid; 201 200 u32 v4_hash_filter_tbl_start;
-2
drivers/net/ipa/ipa_table.c
··· 108 108 109 109 /* Assignment of route table entries to the modem and AP */ 110 110 #define IPA_ROUTE_MODEM_MIN 0 111 - #define IPA_ROUTE_MODEM_COUNT 8 112 - 113 111 #define IPA_ROUTE_AP_MIN IPA_ROUTE_MODEM_COUNT 114 112 #define IPA_ROUTE_AP_COUNT \ 115 113 (IPA_ROUTE_COUNT_MAX - IPA_ROUTE_MODEM_COUNT)
+3
drivers/net/ipa/ipa_table.h
··· 13 13 /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) */ 14 14 #define IPA_FILTER_COUNT_MAX 14 15 15 16 + /* The number of route table entries allotted to the modem */ 17 + #define IPA_ROUTE_MODEM_COUNT 8 18 + 16 19 /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */ 17 20 #define IPA_ROUTE_COUNT_MAX 15 18 21
+4 -2
drivers/net/ipvlan/ipvlan_core.c
··· 495 495 496 496 static int ipvlan_process_outbound(struct sk_buff *skb) 497 497 { 498 - struct ethhdr *ethh = eth_hdr(skb); 499 498 int ret = NET_XMIT_DROP; 500 499 501 500 /* The ipvlan is a pseudo-L2 device, so the packets that we receive ··· 504 505 if (skb_mac_header_was_set(skb)) { 505 506 /* In this mode we dont care about 506 507 * multicast and broadcast traffic */ 508 + struct ethhdr *ethh = eth_hdr(skb); 509 + 507 510 if (is_multicast_ether_addr(ethh->h_dest)) { 508 511 pr_debug_ratelimited( 509 512 "Dropped {multi|broad}cast of type=[%x]\n", ··· 590 589 static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) 591 590 { 592 591 const struct ipvl_dev *ipvlan = netdev_priv(dev); 593 - struct ethhdr *eth = eth_hdr(skb); 592 + struct ethhdr *eth = skb_eth_hdr(skb); 594 593 struct ipvl_addr *addr; 595 594 void *lyr3h; 596 595 int addr_type; ··· 620 619 return dev_forward_skb(ipvlan->phy_dev, skb); 621 620 622 621 } else if (is_multicast_ether_addr(eth->h_dest)) { 622 + skb_reset_mac_header(skb); 623 623 ipvlan_skb_crossing_ns(skb, NULL); 624 624 ipvlan_multicast_enqueue(ipvlan->port, skb, true); 625 625 return NET_XMIT_SUCCESS;
+1
drivers/net/mdio/of_mdio.c
··· 231 231 return 0; 232 232 233 233 unregister: 234 + of_node_put(child); 234 235 mdiobus_unregister(mdio); 235 236 return rc; 236 237 }
+3 -3
drivers/net/netdevsim/hwstats.c
··· 433 433 goto err_remove_hwstats_recursive; 434 434 } 435 435 436 - debugfs_create_file("enable_ifindex", 0600, hwstats->l3_ddir, hwstats, 436 + debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats, 437 437 &nsim_dev_hwstats_l3_enable_fops.fops); 438 - debugfs_create_file("disable_ifindex", 0600, hwstats->l3_ddir, hwstats, 438 + debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats, 439 439 &nsim_dev_hwstats_l3_disable_fops.fops); 440 - debugfs_create_file("fail_next_enable", 0600, hwstats->l3_ddir, hwstats, 440 + debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats, 441 441 &nsim_dev_hwstats_l3_fail_fops.fops); 442 442 443 443 INIT_DELAYED_WORK(&hwstats->traffic_dw,
+49 -4
drivers/net/phy/aquantia_main.c
··· 91 91 #define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) 92 92 #define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) 93 93 94 + #define VEND1_GLOBAL_GEN_STAT2 0xc831 95 + #define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG BIT(15) 96 + 94 97 #define VEND1_GLOBAL_RSVD_STAT1 0xc885 95 98 #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) 96 99 #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) ··· 127 124 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL1 BIT(2) 128 125 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1) 129 126 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0) 127 + 128 + /* Sleep and timeout for checking if the Processor-Intensive 129 + * MDIO operation is finished 130 + */ 131 + #define AQR107_OP_IN_PROG_SLEEP 1000 132 + #define AQR107_OP_IN_PROG_TIMEOUT 100000 130 133 131 134 struct aqr107_hw_stat { 132 135 const char *name; ··· 606 597 phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); 607 598 } 608 599 600 + static int aqr107_wait_processor_intensive_op(struct phy_device *phydev) 601 + { 602 + int val, err; 603 + 604 + /* The datasheet notes to wait at least 1ms after issuing a 605 + * processor intensive operation before checking. 606 + * We cannot use the 'sleep_before_read' parameter of read_poll_timeout 607 + * because that just determines the maximum time slept, not the minimum. 608 + */ 609 + usleep_range(1000, 5000); 610 + 611 + err = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, 612 + VEND1_GLOBAL_GEN_STAT2, val, 613 + !(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG), 614 + AQR107_OP_IN_PROG_SLEEP, 615 + AQR107_OP_IN_PROG_TIMEOUT, false); 616 + if (err) { 617 + phydev_err(phydev, "timeout: processor-intensive MDIO operation\n"); 618 + return err; 619 + } 620 + 621 + return 0; 622 + } 623 + 609 624 static int aqr107_suspend(struct phy_device *phydev) 610 625 { 611 - return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, 612 - MDIO_CTRL1_LPOWER); 626 + int err; 627 + 628 + err = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, 629 + MDIO_CTRL1_LPOWER); 630 + if (err) 631 + return err; 632 + 633 + return aqr107_wait_processor_intensive_op(phydev); 613 634 } 614 635 615 636 static int aqr107_resume(struct phy_device *phydev) 616 637 { 617 - return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, 618 - MDIO_CTRL1_LPOWER); 638 + int err; 639 + 640 + err = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, 641 + MDIO_CTRL1_LPOWER); 642 + if (err) 643 + return err; 644 + 645 + return aqr107_wait_processor_intensive_op(phydev); 619 646 } 620 647 621 648 static int aqr107_probe(struct phy_device *phydev)
+12 -6
drivers/net/phy/micrel.c
··· 2679 2679 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev) 2680 2680 { 2681 2681 int irq_status, tsu_irq_status; 2682 + int ret = IRQ_NONE; 2682 2683 2683 2684 irq_status = phy_read(phydev, LAN8814_INTS); 2684 - if (irq_status > 0 && (irq_status & LAN8814_INT_LINK)) 2685 - phy_trigger_machine(phydev); 2686 - 2687 2685 if (irq_status < 0) { 2688 2686 phy_error(phydev); 2689 2687 return IRQ_NONE; 2688 + } 2689 + 2690 + if (irq_status & LAN8814_INT_LINK) { 2691 + phy_trigger_machine(phydev); 2692 + ret = IRQ_HANDLED; 2690 2693 } 2691 2694 2692 2695 while (1) { ··· 2700 2697 (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ | 2701 2698 LAN8814_INTR_STS_REG_1588_TSU1_ | 2702 2699 LAN8814_INTR_STS_REG_1588_TSU2_ | 2703 - LAN8814_INTR_STS_REG_1588_TSU3_))) 2700 + LAN8814_INTR_STS_REG_1588_TSU3_))) { 2704 2701 lan8814_handle_ptp_interrupt(phydev); 2705 - else 2702 + ret = IRQ_HANDLED; 2703 + } else { 2706 2704 break; 2705 + } 2707 2706 } 2708 - return IRQ_HANDLED; 2707 + 2708 + return ret; 2709 2709 } 2710 2710 2711 2711 static int lan8814_ack_interrupt(struct phy_device *phydev)
+18 -6
drivers/net/team/team.c
··· 1275 1275 } 1276 1276 } 1277 1277 1278 - netif_addr_lock_bh(dev); 1279 - dev_uc_sync_multiple(port_dev, dev); 1280 - dev_mc_sync_multiple(port_dev, dev); 1281 - netif_addr_unlock_bh(dev); 1278 + if (dev->flags & IFF_UP) { 1279 + netif_addr_lock_bh(dev); 1280 + dev_uc_sync_multiple(port_dev, dev); 1281 + dev_mc_sync_multiple(port_dev, dev); 1282 + netif_addr_unlock_bh(dev); 1283 + } 1282 1284 1283 1285 port->index = -1; 1284 1286 list_add_tail_rcu(&port->list, &team->port_list); ··· 1351 1349 netdev_rx_handler_unregister(port_dev); 1352 1350 team_port_disable_netpoll(port); 1353 1351 vlan_vids_del_by_dev(port_dev, dev); 1354 - dev_uc_unsync(port_dev, dev); 1355 - dev_mc_unsync(port_dev, dev); 1352 + if (dev->flags & IFF_UP) { 1353 + dev_uc_unsync(port_dev, dev); 1354 + dev_mc_unsync(port_dev, dev); 1355 + } 1356 1356 dev_close(port_dev); 1357 1357 team_port_leave(team, port); 1358 1358 ··· 1704 1700 1705 1701 static int team_close(struct net_device *dev) 1706 1702 { 1703 + struct team *team = netdev_priv(dev); 1704 + struct team_port *port; 1705 + 1706 + list_for_each_entry(port, &team->port_list, list) { 1707 + dev_uc_unsync(port->dev, dev); 1708 + dev_mc_unsync(port->dev, dev); 1709 + } 1710 + 1707 1711 return 0; 1708 1712 } 1709 1713
+6 -7
drivers/net/wireguard/netlink.c
··· 436 436 if (attrs[WGPEER_A_ENDPOINT]) { 437 437 struct sockaddr *addr = nla_data(attrs[WGPEER_A_ENDPOINT]); 438 438 size_t len = nla_len(attrs[WGPEER_A_ENDPOINT]); 439 + struct endpoint endpoint = { { { 0 } } }; 439 440 440 - if ((len == sizeof(struct sockaddr_in) && 441 - addr->sa_family == AF_INET) || 442 - (len == sizeof(struct sockaddr_in6) && 443 - addr->sa_family == AF_INET6)) { 444 - struct endpoint endpoint = { { { 0 } } }; 445 - 446 - memcpy(&endpoint.addr, addr, len); 441 + if (len == sizeof(struct sockaddr_in) && addr->sa_family == AF_INET) { 442 + endpoint.addr4 = *(struct sockaddr_in *)addr; 443 + wg_socket_set_peer_endpoint(peer, &endpoint); 444 + } else if (len == sizeof(struct sockaddr_in6) && addr->sa_family == AF_INET6) { 445 + endpoint.addr6 = *(struct sockaddr_in6 *)addr; 447 446 wg_socket_set_peer_endpoint(peer, &endpoint); 448 447 } 449 448 }
+10 -15
drivers/net/wireguard/selftest/ratelimiter.c
··· 6 6 #ifdef DEBUG 7 7 8 8 #include <linux/jiffies.h> 9 - #include <linux/hrtimer.h> 10 9 11 10 static const struct { 12 11 bool result; 13 - u64 nsec_to_sleep_before; 12 + unsigned int msec_to_sleep_before; 14 13 } expected_results[] __initconst = { 15 14 [0 ... PACKETS_BURSTABLE - 1] = { true, 0 }, 16 15 [PACKETS_BURSTABLE] = { false, 0 }, 17 - [PACKETS_BURSTABLE + 1] = { true, NSEC_PER_SEC / PACKETS_PER_SECOND }, 16 + [PACKETS_BURSTABLE + 1] = { true, MSEC_PER_SEC / PACKETS_PER_SECOND }, 18 17 [PACKETS_BURSTABLE + 2] = { false, 0 }, 19 - [PACKETS_BURSTABLE + 3] = { true, (NSEC_PER_SEC / PACKETS_PER_SECOND) * 2 }, 18 + [PACKETS_BURSTABLE + 3] = { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) * 2 }, 20 19 [PACKETS_BURSTABLE + 4] = { true, 0 }, 21 20 [PACKETS_BURSTABLE + 5] = { false, 0 } 22 21 }; 23 22 24 23 static __init unsigned int maximum_jiffies_at_index(int index) 25 24 { 26 - u64 total_nsecs = 2 * NSEC_PER_SEC / PACKETS_PER_SECOND / 3; 25 + unsigned int total_msecs = 2 * MSEC_PER_SEC / PACKETS_PER_SECOND / 3; 27 26 int i; 28 27 29 28 for (i = 0; i <= index; ++i) 30 - total_nsecs += expected_results[i].nsec_to_sleep_before; 31 - return nsecs_to_jiffies(total_nsecs); 29 + total_msecs += expected_results[i].msec_to_sleep_before; 30 + return msecs_to_jiffies(total_msecs); 32 31 } 33 32 34 33 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, ··· 42 43 loop_start_time = jiffies; 43 44 44 45 for (i = 0; i < ARRAY_SIZE(expected_results); ++i) { 45 - if (expected_results[i].nsec_to_sleep_before) { 46 - ktime_t timeout = ktime_add(ktime_add_ns(ktime_get_coarse_boottime(), TICK_NSEC * 4 / 3), 47 - ns_to_ktime(expected_results[i].nsec_to_sleep_before)); 48 - set_current_state(TASK_UNINTERRUPTIBLE); 49 - schedule_hrtimeout_range_clock(&timeout, 0, HRTIMER_MODE_ABS, CLOCK_BOOTTIME); 50 - } 46 + if (expected_results[i].msec_to_sleep_before) 47 + msleep(expected_results[i].msec_to_sleep_before); 51 48 52 49 if (time_is_before_jiffies(loop_start_time + 53 50 maximum_jiffies_at_index(i))) ··· 127 132 if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN)) 128 133 return true; 129 134 130 - BUILD_BUG_ON(NSEC_PER_SEC % PACKETS_PER_SECOND != 0); 135 + BUILD_BUG_ON(MSEC_PER_SEC % PACKETS_PER_SECOND != 0); 131 136 132 137 if (wg_ratelimiter_init()) 133 138 goto out; ··· 167 172 ++test; 168 173 #endif 169 174 170 - for (trials = TRIALS_BEFORE_GIVING_UP;;) { 175 + for (trials = TRIALS_BEFORE_GIVING_UP; IS_ENABLED(DEBUG_RATELIMITER_TIMINGS);) { 171 176 int test_count = 0, ret; 172 177 173 178 ret = timings_test(skb4, hdr4, skb6, hdr6, &test_count);
+1
drivers/net/wireless/intel/iwlwifi/Kconfig
··· 140 140 depends on INTEL_MEI 141 141 depends on PM 142 142 depends on CFG80211 143 + depends on BROKEN 143 144 help 144 145 Enables the iwlmei kernel module. 145 146
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 1833 1833 * If nss < MAX: we can set zeros in other streams 1834 1834 */ 1835 1835 if (nss > MAX_HE_SUPP_NSS) { 1836 - IWL_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, 1837 - MAX_HE_SUPP_NSS); 1836 + IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, 1837 + MAX_HE_SUPP_NSS); 1838 1838 nss = MAX_HE_SUPP_NSS; 1839 1839 } 1840 1840
+2 -1
drivers/net/wireless/mediatek/mt76/mac80211.c
··· 267 267 } 268 268 vht_cap->vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); 269 269 vht_cap->vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); 270 - vht_cap->vht_mcs.tx_highest |= 270 + if (ieee80211_hw_check(phy->hw, SUPPORTS_VHT_EXT_NSS_BW)) 271 + vht_cap->vht_mcs.tx_highest |= 271 272 cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE); 272 273 } 273 274
+1 -1
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
··· 1088 1088 offset %= 32; 1089 1089 1090 1090 val = mt76_rr(dev, addr); 1091 - val >>= (tid % 32); 1091 + val >>= offset; 1092 1092 1093 1093 if (offset > 20) { 1094 1094 addr += 4;
-2
drivers/nvdimm/namespace_devs.c
··· 1712 1712 res->flags = IORESOURCE_MEM; 1713 1713 1714 1714 for (i = 0; i < nd_region->ndr_mappings; i++) { 1715 - uuid_t uuid; 1716 - 1717 1715 nsl_get_uuid(ndd, nd_label, &uuid); 1718 1716 if (has_uuid_at_pos(nd_region, &uuid, cookie, i)) 1719 1717 continue;
+3 -3
drivers/nvdimm/pmem.c
··· 45 45 return to_nd_region(to_dev(pmem)->parent); 46 46 } 47 47 48 - static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset) 48 + static phys_addr_t pmem_to_phys(struct pmem_device *pmem, phys_addr_t offset) 49 49 { 50 50 return pmem->phys_addr + offset; 51 51 } ··· 63 63 static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset, 64 64 unsigned int len) 65 65 { 66 - phys_addr_t phys = to_phys(pmem, offset); 66 + phys_addr_t phys = pmem_to_phys(pmem, offset); 67 67 unsigned long pfn_start, pfn_end, pfn; 68 68 69 69 /* only pmem in the linear map supports HWPoison */ ··· 97 97 static long __pmem_clear_poison(struct pmem_device *pmem, 98 98 phys_addr_t offset, unsigned int len) 99 99 { 100 - phys_addr_t phys = to_phys(pmem, offset); 100 + phys_addr_t phys = pmem_to_phys(pmem, offset); 101 101 long cleared = nvdimm_clear_poison(to_dev(pmem), phys, len); 102 102 103 103 if (cleared > 0) {
+1 -1
drivers/of/fdt.c
··· 314 314 for (offset = 0; 315 315 offset >= 0 && depth >= initial_depth; 316 316 offset = fdt_next_node(blob, offset, &depth)) { 317 - if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) 317 + if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH - 1)) 318 318 continue; 319 319 320 320 if (!IS_ENABLED(CONFIG_OF_KOBJ) &&
+1 -1
drivers/opp/core.c
··· 873 873 } 874 874 } 875 875 876 - return ret; 876 + return 0; 877 877 } 878 878 EXPORT_SYMBOL_GPL(dev_pm_opp_config_clks_simple); 879 879
+1
drivers/parisc/ccio-dma.c
··· 1546 1546 } 1547 1547 ccio_ioc_init(ioc); 1548 1548 if (ccio_init_resources(ioc)) { 1549 + iounmap(ioc->ioc_regs); 1549 1550 kfree(ioc); 1550 1551 return -ENOMEM; 1551 1552 }
+1 -10
drivers/parisc/iosapic.c
··· 221 221 222 222 static struct irt_entry *iosapic_alloc_irt(int num_entries) 223 223 { 224 - unsigned long a; 225 - 226 - /* The IRT needs to be 8-byte aligned for the PDC call. 227 - * Normally kmalloc would guarantee larger alignment, but 228 - * if CONFIG_DEBUG_SLAB is enabled, then we can get only 229 - * 4-byte alignment on 32-bit kernels 230 - */ 231 - a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL); 232 - a = (a + 7UL) & ~7UL; 233 - return (struct irt_entry *)a; 224 + return kcalloc(num_entries, sizeof(struct irt_entry), GFP_KERNEL); 234 225 } 235 226 236 227 /**
+1 -1
drivers/perf/arm-cmn.c
··· 36 36 #define CMN_CI_CHILD_COUNT GENMASK_ULL(15, 0) 37 37 #define CMN_CI_CHILD_PTR_OFFSET GENMASK_ULL(31, 16) 38 38 39 - #define CMN_CHILD_NODE_ADDR GENMASK(27, 0) 39 + #define CMN_CHILD_NODE_ADDR GENMASK(29, 0) 40 40 #define CMN_CHILD_NODE_EXTERNAL BIT(31) 41 41 42 42 #define CMN_MAX_DIMENSION 12
+17 -70
drivers/phy/marvell/phy-mvebu-a3700-comphy.c
··· 274 274 int submode; 275 275 bool invert_tx; 276 276 bool invert_rx; 277 - bool needs_reset; 278 277 }; 279 278 280 279 struct gbe_phy_init_data_fix { ··· 1096 1097 0x0, PU_PLL_BIT | PU_RX_BIT | PU_TX_BIT); 1097 1098 } 1098 1099 1099 - static int mvebu_a3700_comphy_reset(struct phy *phy) 1100 + static void mvebu_a3700_comphy_usb3_power_off(struct mvebu_a3700_comphy_lane *lane) 1100 1101 { 1101 - struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); 1102 - u16 mask, data; 1103 - 1104 - dev_dbg(lane->dev, "resetting lane %d\n", lane->id); 1105 - 1106 - /* COMPHY reset for internal logic */ 1107 - comphy_lane_reg_set(lane, COMPHY_SFT_RESET, 1108 - SFT_RST_NO_REG, SFT_RST_NO_REG); 1109 - 1110 - /* COMPHY register reset (cleared automatically) */ 1111 - comphy_lane_reg_set(lane, COMPHY_SFT_RESET, SFT_RST, SFT_RST); 1112 - 1113 - /* PIPE soft and register reset */ 1114 - data = PIPE_SOFT_RESET | PIPE_REG_RESET; 1115 - mask = data; 1116 - comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, data, mask); 1117 - 1118 - /* Release PIPE register reset */ 1119 - comphy_lane_reg_set(lane, COMPHY_PIPE_RST_CLK_CTRL, 1120 - 0x0, PIPE_REG_RESET); 1121 - 1122 - /* Reset SB configuration register (only for lanes 0 and 1) */ 1123 - if (lane->id == 0 || lane->id == 1) { 1124 - u32 mask, data; 1125 - 1126 - data = PIN_RESET_CORE_BIT | PIN_RESET_COMPHY_BIT | 1127 - PIN_PU_PLL_BIT | PIN_PU_RX_BIT | PIN_PU_TX_BIT; 1128 - mask = data | PIN_PU_IVREF_BIT | PIN_TX_IDLE_BIT; 1129 - comphy_periph_reg_set(lane, COMPHY_PHY_CFG1, data, mask); 1130 - } 1131 - 1132 - return 0; 1102 + /* 1103 + * The USB3 MAC sets the USB3 PHY to low state, so we do not 1104 + * need to power off USB3 PHY again. 1105 + */ 1133 1106 } 1134 1107 1135 1108 static bool mvebu_a3700_comphy_check_mode(int lane, ··· 1142 1171 (lane->mode != mode || lane->submode != submode)) 1143 1172 return -EBUSY; 1144 1173 1145 - /* If changing mode, ensure reset is called */ 1146 - if (lane->mode != PHY_MODE_INVALID && lane->mode != mode) 1147 - lane->needs_reset = true; 1148 - 1149 1174 /* Just remember the mode, ->power_on() will do the real setup */ 1150 1175 lane->mode = mode; 1151 1176 lane->submode = submode; ··· 1152 1185 static int mvebu_a3700_comphy_power_on(struct phy *phy) 1153 1186 { 1154 1187 struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); 1155 - int ret; 1156 1188 1157 1189 if (!mvebu_a3700_comphy_check_mode(lane->id, lane->mode, 1158 1190 lane->submode)) { 1159 1191 dev_err(lane->dev, "invalid COMPHY mode\n"); 1160 1192 return -EINVAL; 1161 - } 1162 - 1163 - if (lane->needs_reset) { 1164 - ret = mvebu_a3700_comphy_reset(phy); 1165 - if (ret) 1166 - return ret; 1167 - 1168 - lane->needs_reset = false; 1169 1193 } 1170 1194 1171 1195 switch (lane->mode) { ··· 1182 1224 { 1183 1225 struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy); 1184 1226 1185 - switch (lane->mode) { 1186 - case PHY_MODE_USB_HOST_SS: 1187 - /* 1188 - * The USB3 MAC sets the USB3 PHY to low state, so we do not 1189 - * need to power off USB3 PHY again. 1190 - */ 1191 - break; 1192 - 1193 - case PHY_MODE_SATA: 1194 - mvebu_a3700_comphy_sata_power_off(lane); 1195 - break; 1196 - 1197 - case PHY_MODE_ETHERNET: 1227 + switch (lane->id) { 1228 + case 0: 1229 + mvebu_a3700_comphy_usb3_power_off(lane); 1198 1230 mvebu_a3700_comphy_ethernet_power_off(lane); 1199 - break; 1200 - 1201 - case PHY_MODE_PCIE: 1231 + return 0; 1232 + case 1: 1202 1233 mvebu_a3700_comphy_pcie_power_off(lane); 1203 - break; 1204 - 1234 + mvebu_a3700_comphy_ethernet_power_off(lane); 1235 + return 0; 1236 + case 2: 1237 + mvebu_a3700_comphy_usb3_power_off(lane); 1238 + mvebu_a3700_comphy_sata_power_off(lane); 1239 + return 0; 1205 1240 default: 1206 1241 dev_err(lane->dev, "invalid COMPHY mode\n"); 1207 1242 return -EINVAL; 1208 1243 } 1209 - 1210 - return 0; 1211 1244 } 1212 1245 1213 1246 static const struct phy_ops mvebu_a3700_comphy_ops = { 1214 1247 .power_on = mvebu_a3700_comphy_power_on, 1215 1248 .power_off = mvebu_a3700_comphy_power_off, 1216 - .reset = mvebu_a3700_comphy_reset, 1217 1249 .set_mode = mvebu_a3700_comphy_set_mode, 1218 1250 .owner = THIS_MODULE, 1219 1251 }; ··· 1341 1393 * To avoid relying on the bootloader/firmware configuration, 1342 1394 * power off all comphys. 1343 1395 */ 1344 - mvebu_a3700_comphy_reset(phy); 1345 - lane->needs_reset = false; 1396 + mvebu_a3700_comphy_power_off(phy); 1346 1397 } 1347 1398 1348 1399 provider = devm_of_phy_provider_register(&pdev->dev,
+97 -14
drivers/pinctrl/pinctrl-ocelot.c
··· 331 331 const struct ocelot_pincfg_data *pincfg_data; 332 332 struct ocelot_pmx_func func[FUNC_MAX]; 333 333 u8 stride; 334 + struct workqueue_struct *wq; 334 335 }; 335 336 336 337 struct ocelot_match_data { 337 338 struct pinctrl_desc desc; 338 339 struct ocelot_pincfg_data pincfg_data; 340 + }; 341 + 342 + struct ocelot_irq_work { 343 + struct work_struct irq_work; 344 + struct irq_desc *irq_desc; 339 345 }; 340 346 341 347 #define LUTON_P(p, f0, f1) \ ··· 1819 1813 gpiochip_disable_irq(chip, gpio); 1820 1814 } 1821 1815 1816 + static void ocelot_irq_work(struct work_struct *work) 1817 + { 1818 + struct ocelot_irq_work *w = container_of(work, struct ocelot_irq_work, irq_work); 1819 + struct irq_chip *parent_chip = irq_desc_get_chip(w->irq_desc); 1820 + struct gpio_chip *chip = irq_desc_get_chip_data(w->irq_desc); 1821 + struct irq_data *data = irq_desc_get_irq_data(w->irq_desc); 1822 + unsigned int gpio = irqd_to_hwirq(data); 1823 + 1824 + local_irq_disable(); 1825 + chained_irq_enter(parent_chip, w->irq_desc); 1826 + generic_handle_domain_irq(chip->irq.domain, gpio); 1827 + chained_irq_exit(parent_chip, w->irq_desc); 1828 + local_irq_enable(); 1829 + 1830 + kfree(w); 1831 + } 1832 + 1833 + static void ocelot_irq_unmask_level(struct irq_data *data) 1834 + { 1835 + struct gpio_chip *chip = irq_data_get_irq_chip_data(data); 1836 + struct ocelot_pinctrl *info = gpiochip_get_data(chip); 1837 + struct irq_desc *desc = irq_data_to_desc(data); 1838 + unsigned int gpio = irqd_to_hwirq(data); 1839 + unsigned int bit = BIT(gpio % 32); 1840 + bool ack = false, active = false; 1841 + u8 trigger_level; 1842 + int val; 1843 + 1844 + trigger_level = irqd_get_trigger_type(data); 1845 + 1846 + /* Check if the interrupt line is still active. */ 1847 + regmap_read(info->map, REG(OCELOT_GPIO_IN, info, gpio), &val); 1848 + if ((!(val & bit) && trigger_level == IRQ_TYPE_LEVEL_LOW) || 1849 + (val & bit && trigger_level == IRQ_TYPE_LEVEL_HIGH)) 1850 + active = true; 1851 + 1852 + /* 1853 + * Check if the interrupt controller has seen any changes in the 1854 + * interrupt line. 1855 + */ 1856 + regmap_read(info->map, REG(OCELOT_GPIO_INTR, info, gpio), &val); 1857 + if (val & bit) 1858 + ack = true; 1859 + 1860 + /* Enable the interrupt now */ 1861 + gpiochip_enable_irq(chip, gpio); 1862 + regmap_update_bits(info->map, REG(OCELOT_GPIO_INTR_ENA, info, gpio), 1863 + bit, bit); 1864 + 1865 + /* 1866 + * In case the interrupt line is still active and the interrupt 1867 + * controller has not seen any changes in the interrupt line, then it 1868 + * means that there happen another interrupt while the line was active. 1869 + * So we missed that one, so we need to kick the interrupt again 1870 + * handler. 1871 + */ 1872 + if (active && !ack) { 1873 + struct ocelot_irq_work *work; 1874 + 1875 + work = kmalloc(sizeof(*work), GFP_ATOMIC); 1876 + if (!work) 1877 + return; 1878 + 1879 + work->irq_desc = desc; 1880 + INIT_WORK(&work->irq_work, ocelot_irq_work); 1881 + queue_work(info->wq, &work->irq_work); 1882 + } 1883 + } 1884 + 1822 1885 static void ocelot_irq_unmask(struct irq_data *data) 1823 1886 { 1824 1887 struct gpio_chip *chip = irq_data_get_irq_chip_data(data); ··· 1911 1836 1912 1837 static int ocelot_irq_set_type(struct irq_data *data, unsigned int type); 1913 1838 1914 - static struct irq_chip ocelot_eoi_irqchip = { 1839 + static struct irq_chip ocelot_level_irqchip = { 1915 1840 .name = "gpio", 1916 1841 .irq_mask = ocelot_irq_mask, 1917 - .irq_eoi = ocelot_irq_ack, 1918 - .irq_unmask = ocelot_irq_unmask, 1919 - .flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED | 1920 - IRQCHIP_IMMUTABLE, 1842 + .irq_ack = ocelot_irq_ack, 1843 + .irq_unmask = ocelot_irq_unmask_level, 1844 + .flags = IRQCHIP_IMMUTABLE, 1921 1845 .irq_set_type = ocelot_irq_set_type, 1922 1846 GPIOCHIP_IRQ_RESOURCE_HELPERS 1923 1847 }; ··· 1933 1859 1934 1860 static int ocelot_irq_set_type(struct irq_data *data, unsigned int type) 1935 1861 { 1936 - type &= IRQ_TYPE_SENSE_MASK; 1937 - 1938 - if (!(type & (IRQ_TYPE_EDGE_BOTH | IRQ_TYPE_LEVEL_HIGH))) 1939 - return -EINVAL; 1940 - 1941 - if (type & IRQ_TYPE_LEVEL_HIGH) 1942 - irq_set_chip_handler_name_locked(data, &ocelot_eoi_irqchip, 1943 - handle_fasteoi_irq, NULL); 1862 + if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) 1863 + irq_set_chip_handler_name_locked(data, &ocelot_level_irqchip, 1864 + handle_level_irq, NULL); 1944 1865 if (type & IRQ_TYPE_EDGE_BOTH) 1945 1866 irq_set_chip_handler_name_locked(data, &ocelot_irqchip, 1946 1867 handle_edge_irq, NULL); ··· 2065 1996 if (!info->desc) 2066 1997 return -ENOMEM; 2067 1998 1999 + info->wq = alloc_ordered_workqueue("ocelot_ordered", 0); 2000 + if (!info->wq) 2001 + return -ENOMEM; 2002 + 2068 2003 info->pincfg_data = &data->pincfg_data; 2069 2004 2070 2005 reset = devm_reset_control_get_optional_shared(dev, "switch"); ··· 2091 2018 dev_err(dev, "Failed to create regmap\n"); 2092 2019 return PTR_ERR(info->map); 2093 2020 } 2094 - dev_set_drvdata(dev, info->map); 2021 + dev_set_drvdata(dev, info); 2095 2022 info->dev = dev; 2096 2023 2097 2024 /* Pinconf registers */ ··· 2116 2043 return 0; 2117 2044 } 2118 2045 2046 + static int ocelot_pinctrl_remove(struct platform_device *pdev) 2047 + { 2048 + struct ocelot_pinctrl *info = platform_get_drvdata(pdev); 2049 + 2050 + destroy_workqueue(info->wq); 2051 + 2052 + return 0; 2053 + } 2054 + 2119 2055 static struct platform_driver ocelot_pinctrl_driver = { 2120 2056 .driver = { 2121 2057 .name = "pinctrl-ocelot", ··· 2132 2050 .suppress_bind_attrs = true, 2133 2051 }, 2134 2052 .probe = ocelot_pinctrl_probe, 2053 + .remove = ocelot_pinctrl_remove, 2135 2054 }; 2136 2055 module_platform_driver(ocelot_pinctrl_driver); 2137 2056 MODULE_LICENSE("Dual MIT/GPL");
+5 -5
drivers/pinctrl/qcom/pinctrl-sc8180x.c
··· 530 530 DECLARE_MSM_GPIO_PINS(188); 531 531 DECLARE_MSM_GPIO_PINS(189); 532 532 533 - static const unsigned int sdc2_clk_pins[] = { 190 }; 534 - static const unsigned int sdc2_cmd_pins[] = { 191 }; 535 - static const unsigned int sdc2_data_pins[] = { 192 }; 536 - static const unsigned int ufs_reset_pins[] = { 193 }; 533 + static const unsigned int ufs_reset_pins[] = { 190 }; 534 + static const unsigned int sdc2_clk_pins[] = { 191 }; 535 + static const unsigned int sdc2_cmd_pins[] = { 192 }; 536 + static const unsigned int sdc2_data_pins[] = { 193 }; 537 537 538 538 enum sc8180x_functions { 539 539 msm_mux_adsp_ext, ··· 1582 1582 static const struct msm_gpio_wakeirq_map sc8180x_pdc_map[] = { 1583 1583 { 3, 31 }, { 5, 32 }, { 8, 33 }, { 9, 34 }, { 10, 100 }, { 12, 104 }, 1584 1584 { 24, 37 }, { 26, 38 }, { 27, 41 }, { 28, 42 }, { 30, 39 }, { 36, 43 }, 1585 - { 37, 43 }, { 38, 45 }, { 39, 118 }, { 39, 125 }, { 41, 47 }, 1585 + { 37, 44 }, { 38, 45 }, { 39, 118 }, { 39, 125 }, { 41, 47 }, 1586 1586 { 42, 48 }, { 46, 50 }, { 47, 49 }, { 48, 51 }, { 49, 53 }, { 50, 52 }, 1587 1587 { 51, 116 }, { 51, 123 }, { 53, 54 }, { 54, 55 }, { 55, 56 }, 1588 1588 { 56, 57 }, { 58, 58 }, { 60, 60 }, { 68, 62 }, { 70, 63 }, { 76, 86 },
+1 -1
drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c
··· 99 99 static struct platform_driver a100_r_pinctrl_driver = { 100 100 .probe = a100_r_pinctrl_probe, 101 101 .driver = { 102 - .name = "sun50iw10p1-r-pinctrl", 102 + .name = "sun50i-a100-r-pinctrl", 103 103 .of_match_table = a100_r_pinctrl_match, 104 104 }, 105 105 };
+7 -2
drivers/s390/block/dasd_alias.c
··· 675 675 struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device) 676 676 { 677 677 struct dasd_eckd_private *alias_priv, *private = base_device->private; 678 - struct alias_pav_group *group = private->pavgroup; 679 678 struct alias_lcu *lcu = private->lcu; 680 679 struct dasd_device *alias_device; 680 + struct alias_pav_group *group; 681 681 unsigned long flags; 682 682 683 - if (!group || !lcu) 683 + if (!lcu) 684 684 return NULL; 685 685 if (lcu->pav == NO_PAV || 686 686 lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) ··· 697 697 } 698 698 699 699 spin_lock_irqsave(&lcu->lock, flags); 700 + group = private->pavgroup; 701 + if (!group) { 702 + spin_unlock_irqrestore(&lcu->lock, flags); 703 + return NULL; 704 + } 700 705 alias_device = group->next; 701 706 if (!alias_device) { 702 707 if (list_empty(&group->aliaslist)) {
+30
drivers/s390/crypto/vfio_ap_ops.c
··· 984 984 goto done; 985 985 } 986 986 987 + if (test_bit_inv(apid, matrix_mdev->matrix.apm)) { 988 + ret = count; 989 + goto done; 990 + } 991 + 987 992 set_bit_inv(apid, matrix_mdev->matrix.apm); 988 993 989 994 ret = vfio_ap_mdev_validate_masks(matrix_mdev); ··· 1114 1109 goto done; 1115 1110 } 1116 1111 1112 + if (!test_bit_inv(apid, matrix_mdev->matrix.apm)) { 1113 + ret = count; 1114 + goto done; 1115 + } 1116 + 1117 1117 clear_bit_inv((unsigned long)apid, matrix_mdev->matrix.apm); 1118 1118 vfio_ap_mdev_hot_unplug_adapter(matrix_mdev, apid); 1119 1119 ret = count; ··· 1190 1180 1191 1181 if (apqi > matrix_mdev->matrix.aqm_max) { 1192 1182 ret = -ENODEV; 1183 + goto done; 1184 + } 1185 + 1186 + if (test_bit_inv(apqi, matrix_mdev->matrix.aqm)) { 1187 + ret = count; 1193 1188 goto done; 1194 1189 } 1195 1190 ··· 1301 1286 goto done; 1302 1287 } 1303 1288 1289 + if (!test_bit_inv(apqi, matrix_mdev->matrix.aqm)) { 1290 + ret = count; 1291 + goto done; 1292 + } 1293 + 1304 1294 clear_bit_inv((unsigned long)apqi, matrix_mdev->matrix.aqm); 1305 1295 vfio_ap_mdev_hot_unplug_domain(matrix_mdev, apqi); 1306 1296 ret = count; ··· 1346 1326 1347 1327 if (id > matrix_mdev->matrix.adm_max) { 1348 1328 ret = -ENODEV; 1329 + goto done; 1330 + } 1331 + 1332 + if (test_bit_inv(id, matrix_mdev->matrix.adm)) { 1333 + ret = count; 1349 1334 goto done; 1350 1335 } 1351 1336 ··· 1400 1375 1401 1376 if (domid > matrix_mdev->matrix.adm_max) { 1402 1377 ret = -ENODEV; 1378 + goto done; 1379 + } 1380 + 1381 + if (!test_bit_inv(domid, matrix_mdev->matrix.adm)) { 1382 + ret = count; 1403 1383 goto done; 1404 1384 } 1405 1385
+1 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 2993 2993 2994 2994 if (ioc->is_mcpu_endpoint || 2995 2995 sizeof(dma_addr_t) == 4 || ioc->use_32bit_dma || 2996 - dma_get_required_mask(&pdev->dev) <= 32) 2996 + dma_get_required_mask(&pdev->dev) <= DMA_BIT_MASK(32)) 2997 2997 ioc->dma_mask = 32; 2998 2998 /* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */ 2999 2999 else if (ioc->hba_mpi_version_belonged > MPI2_VERSION)
-5
drivers/scsi/qedf/qedf_main.c
··· 3686 3686 err1: 3687 3687 scsi_host_put(lport->host); 3688 3688 err0: 3689 - if (qedf) { 3690 - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); 3691 - 3692 - clear_bit(QEDF_PROBING, &qedf->flags); 3693 - } 3694 3689 return rc; 3695 3690 } 3696 3691
+3 -1
drivers/scsi/qla2xxx/qla_target.c
··· 2151 2151 2152 2152 abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess, 2153 2153 le32_to_cpu(abts->exchange_addr_to_abort)); 2154 - if (!abort_cmd) 2154 + if (!abort_cmd) { 2155 + mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); 2155 2156 return -EIO; 2157 + } 2156 2158 mcmd->unpacked_lun = abort_cmd->se_cmd.orig_fe_lun; 2157 2159 2158 2160 if (abort_cmd->qpair) {
+1
drivers/thunderbolt/icm.c
··· 2529 2529 tb->cm_ops = &icm_icl_ops; 2530 2530 break; 2531 2531 2532 + case PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_2C_NHI: 2532 2533 case PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_4C_NHI: 2533 2534 icm->is_supported = icm_tgl_is_supported; 2534 2535 icm->get_mode = icm_ar_get_mode;
+1
drivers/thunderbolt/nhi.h
··· 55 55 * need for the PCI quirk anymore as we will use ICM also on Apple 56 56 * hardware. 57 57 */ 58 + #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_2C_NHI 0x1134 58 59 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_4C_NHI 0x1137 59 60 #define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_NHI 0x157d 60 61 #define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_BRIDGE 0x157e
+1
drivers/tty/serial/8250/8250_omap.c
··· 1334 1334 up.port.throttle = omap_8250_throttle; 1335 1335 up.port.unthrottle = omap_8250_unthrottle; 1336 1336 up.port.rs485_config = serial8250_em485_config; 1337 + up.port.rs485_supported = serial8250_em485_supported; 1337 1338 up.rs485_start_tx = serial8250_em485_start_tx; 1338 1339 up.rs485_stop_tx = serial8250_em485_stop_tx; 1339 1340 up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
+5 -4
drivers/tty/serial/fsl_lpuart.c
··· 2724 2724 lpuart_reg.cons = LPUART_CONSOLE; 2725 2725 handler = lpuart_int; 2726 2726 } 2727 - ret = uart_add_one_port(&lpuart_reg, &sport->port); 2728 - if (ret) 2729 - goto failed_attach_port; 2730 2727 2731 2728 ret = lpuart_global_reset(sport); 2732 2729 if (ret) 2733 2730 goto failed_reset; 2731 + 2732 + ret = uart_add_one_port(&lpuart_reg, &sport->port); 2733 + if (ret) 2734 + goto failed_attach_port; 2734 2735 2735 2736 ret = uart_get_rs485_mode(&sport->port); 2736 2737 if (ret) ··· 2748 2747 2749 2748 failed_irq_request: 2750 2749 failed_get_rs485: 2751 - failed_reset: 2752 2750 uart_remove_one_port(&lpuart_reg, &sport->port); 2753 2751 failed_attach_port: 2752 + failed_reset: 2754 2753 lpuart_disable_clks(sport); 2755 2754 return ret; 2756 2755 }
+2 -3
drivers/tty/serial/serial-tegra.c
··· 525 525 count = tup->tx_bytes_requested - state.residue; 526 526 async_tx_ack(tup->tx_dma_desc); 527 527 spin_lock_irqsave(&tup->uport.lock, flags); 528 - xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); 528 + uart_xmit_advance(&tup->uport, count); 529 529 tup->tx_in_progress = 0; 530 530 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 531 531 uart_write_wakeup(&tup->uport); ··· 613 613 static void tegra_uart_stop_tx(struct uart_port *u) 614 614 { 615 615 struct tegra_uart_port *tup = to_tegra_uport(u); 616 - struct circ_buf *xmit = &tup->uport.state->xmit; 617 616 struct dma_tx_state state; 618 617 unsigned int count; 619 618 ··· 623 624 dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); 624 625 count = tup->tx_bytes_requested - state.residue; 625 626 async_tx_ack(tup->tx_dma_desc); 626 - xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); 627 + uart_xmit_advance(&tup->uport, count); 627 628 tup->tx_in_progress = 0; 628 629 } 629 630
+1 -1
drivers/tty/serial/sifive.c
··· 945 945 return PTR_ERR(base); 946 946 } 947 947 948 - clk = devm_clk_get(&pdev->dev, NULL); 948 + clk = devm_clk_get_enabled(&pdev->dev, NULL); 949 949 if (IS_ERR(clk)) { 950 950 dev_err(&pdev->dev, "unable to find controller clock\n"); 951 951 return PTR_ERR(clk);
+1 -1
drivers/tty/serial/tegra-tcu.c
··· 101 101 break; 102 102 103 103 tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); 104 - xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); 104 + uart_xmit_advance(port, count); 105 105 } 106 106 107 107 uart_write_wakeup(port);
+1 -1
drivers/usb/core/hub.c
··· 6039 6039 * 6040 6040 * Return: The same as for usb_reset_and_verify_device(). 6041 6041 * However, if a reset is already in progress (for instance, if a 6042 - * driver doesn't have pre_ or post_reset() callbacks, and while 6042 + * driver doesn't have pre_reset() or post_reset() callbacks, and while 6043 6043 * being unbound or re-bound during the ongoing reset its disconnect() 6044 6044 * or probe() routine tries to perform a second, nested reset), the 6045 6045 * routine returns -EINPROGRESS.
+7 -6
drivers/usb/dwc3/core.c
··· 1752 1752 1753 1753 dwc3_get_properties(dwc); 1754 1754 1755 - if (!dwc->sysdev_is_parent) { 1756 - ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); 1757 - if (ret) 1758 - return ret; 1759 - } 1760 - 1761 1755 dwc->reset = devm_reset_control_array_get_optional_shared(dev); 1762 1756 if (IS_ERR(dwc->reset)) 1763 1757 return PTR_ERR(dwc->reset); ··· 1816 1822 1817 1823 platform_set_drvdata(pdev, dwc); 1818 1824 dwc3_cache_hwparams(dwc); 1825 + 1826 + if (!dwc->sysdev_is_parent && 1827 + DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) { 1828 + ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); 1829 + if (ret) 1830 + goto disable_clks; 1831 + } 1819 1832 1820 1833 spin_lock_init(&dwc->lock); 1821 1834 mutex_init(&dwc->mutex);
+6
drivers/usb/serial/option.c
··· 256 256 #define QUECTEL_PRODUCT_EM060K 0x030b 257 257 #define QUECTEL_PRODUCT_EM12 0x0512 258 258 #define QUECTEL_PRODUCT_RM500Q 0x0800 259 + #define QUECTEL_PRODUCT_RM520N 0x0801 259 260 #define QUECTEL_PRODUCT_EC200S_CN 0x6002 260 261 #define QUECTEL_PRODUCT_EC200T 0x6026 261 262 #define QUECTEL_PRODUCT_RM500K 0x7001 ··· 1139 1138 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), 1140 1139 .driver_info = NUMEP2 }, 1141 1140 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, 1141 + { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0203, 0xff), /* BG95-M3 */ 1142 + .driver_info = ZLP }, 1142 1143 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), 1143 1144 .driver_info = RSVD(4) }, 1144 1145 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), ··· 1162 1159 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, 1163 1160 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), 1164 1161 .driver_info = ZLP }, 1162 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0xff, 0x30) }, 1163 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0x40) }, 1164 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM520N, 0xff, 0, 0) }, 1165 1165 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, 1166 1166 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, 1167 1167 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) },
+1
drivers/usb/typec/Kconfig
··· 56 56 tristate "Analogix ANX7411 Type-C DRP Port controller driver" 57 57 depends on I2C 58 58 depends on USB_ROLE_SWITCH 59 + depends on POWER_SUPPLY 59 60 help 60 61 Say Y or M here if your system has Analogix ANX7411 Type-C DRP Port 61 62 controller driver.
-4
drivers/video/fbdev/hyperv_fb.c
··· 74 74 #define SYNTHVID_DEPTH_WIN8 32 75 75 #define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024) 76 76 77 - #define PCI_VENDOR_ID_MICROSOFT 0x1414 78 - #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353 79 - 80 - 81 77 enum pipe_msg_type { 82 78 PIPE_MSG_INVALID, 83 79 PIPE_MSG_DATA,
+6 -3
drivers/xen/xenbus/xenbus_client.c
··· 382 382 unsigned long ring_size = nr_pages * XEN_PAGE_SIZE; 383 383 grant_ref_t gref_head; 384 384 unsigned int i; 385 + void *addr; 385 386 int ret; 386 387 387 - *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO); 388 + addr = *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO); 388 389 if (!*vaddr) { 389 390 ret = -ENOMEM; 390 391 goto err; ··· 402 401 unsigned long gfn; 403 402 404 403 if (is_vmalloc_addr(*vaddr)) 405 - gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr[i])); 404 + gfn = pfn_to_gfn(vmalloc_to_pfn(addr)); 406 405 else 407 - gfn = virt_to_gfn(vaddr[i]); 406 + gfn = virt_to_gfn(addr); 408 407 409 408 grefs[i] = gnttab_claim_grant_reference(&gref_head); 410 409 gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id, 411 410 gfn, 0); 411 + 412 + addr += XEN_PAGE_SIZE; 412 413 } 413 414 414 415 return 0;
+36 -6
fs/btrfs/disk-io.c
··· 4475 4475 set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags); 4476 4476 4477 4477 /* 4478 + * If we had UNFINISHED_DROPS we could still be processing them, so 4479 + * clear that bit and wake up relocation so it can stop. 4480 + * We must do this before stopping the block group reclaim task, because 4481 + * at btrfs_relocate_block_group() we wait for this bit, and after the 4482 + * wait we stop with -EINTR if btrfs_fs_closing() returns non-zero - we 4483 + * have just set BTRFS_FS_CLOSING_START, so btrfs_fs_closing() will 4484 + * return 1. 4485 + */ 4486 + btrfs_wake_unfinished_drop(fs_info); 4487 + 4488 + /* 4478 4489 * We may have the reclaim task running and relocating a data block group, 4479 4490 * in which case it may create delayed iputs. So stop it before we park 4480 4491 * the cleaner kthread otherwise we can get new delayed iputs after ··· 4502 4491 * still try to wake up the cleaner. 4503 4492 */ 4504 4493 kthread_park(fs_info->cleaner_kthread); 4505 - 4506 - /* 4507 - * If we had UNFINISHED_DROPS we could still be processing them, so 4508 - * clear that bit and wake up relocation so it can stop. 4509 - */ 4510 - btrfs_wake_unfinished_drop(fs_info); 4511 4494 4512 4495 /* wait for the qgroup rescan worker to stop */ 4513 4496 btrfs_qgroup_wait_for_completion(fs_info, false); ··· 4524 4519 4525 4520 /* clear out the rbtree of defraggable inodes */ 4526 4521 btrfs_cleanup_defrag_inodes(fs_info); 4522 + 4523 + /* 4524 + * After we parked the cleaner kthread, ordered extents may have 4525 + * completed and created new delayed iputs. If one of the async reclaim 4526 + * tasks is running and in the RUN_DELAYED_IPUTS flush state, then we 4527 + * can hang forever trying to stop it, because if a delayed iput is 4528 + * added after it ran btrfs_run_delayed_iputs() and before it called 4529 + * btrfs_wait_on_delayed_iputs(), it will hang forever since there is 4530 + * no one else to run iputs. 4531 + * 4532 + * So wait for all ongoing ordered extents to complete and then run 4533 + * delayed iputs. This works because once we reach this point no one 4534 + * can either create new ordered extents nor create delayed iputs 4535 + * through some other means. 4536 + * 4537 + * Also note that btrfs_wait_ordered_roots() is not safe here, because 4538 + * it waits for BTRFS_ORDERED_COMPLETE to be set on an ordered extent, 4539 + * but the delayed iput for the respective inode is made only when doing 4540 + * the final btrfs_put_ordered_extent() (which must happen at 4541 + * btrfs_finish_ordered_io() when we are unmounting). 4542 + */ 4543 + btrfs_flush_workqueue(fs_info->endio_write_workers); 4544 + /* Ordered extents for free space inodes. */ 4545 + btrfs_flush_workqueue(fs_info->endio_freespace_worker); 4546 + btrfs_run_delayed_iputs(fs_info); 4527 4547 4528 4548 cancel_work_sync(&fs_info->async_reclaim_work); 4529 4549 cancel_work_sync(&fs_info->async_data_reclaim_work);
+38 -2
fs/btrfs/zoned.c
··· 1918 1918 return ret; 1919 1919 } 1920 1920 1921 + static void wait_eb_writebacks(struct btrfs_block_group *block_group) 1922 + { 1923 + struct btrfs_fs_info *fs_info = block_group->fs_info; 1924 + const u64 end = block_group->start + block_group->length; 1925 + struct radix_tree_iter iter; 1926 + struct extent_buffer *eb; 1927 + void __rcu **slot; 1928 + 1929 + rcu_read_lock(); 1930 + radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter, 1931 + block_group->start >> fs_info->sectorsize_bits) { 1932 + eb = radix_tree_deref_slot(slot); 1933 + if (!eb) 1934 + continue; 1935 + if (radix_tree_deref_retry(eb)) { 1936 + slot = radix_tree_iter_retry(&iter); 1937 + continue; 1938 + } 1939 + 1940 + if (eb->start < block_group->start) 1941 + continue; 1942 + if (eb->start >= end) 1943 + break; 1944 + 1945 + slot = radix_tree_iter_resume(slot, &iter); 1946 + rcu_read_unlock(); 1947 + wait_on_extent_buffer_writeback(eb); 1948 + rcu_read_lock(); 1949 + } 1950 + rcu_read_unlock(); 1951 + } 1952 + 1921 1953 static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_written) 1922 1954 { 1923 1955 struct btrfs_fs_info *fs_info = block_group->fs_info; 1924 1956 struct map_lookup *map; 1957 + const bool is_metadata = (block_group->flags & 1958 + (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)); 1925 1959 int ret = 0; 1926 1960 int i; 1927 1961 ··· 1966 1932 } 1967 1933 1968 1934 /* Check if we have unwritten allocated space */ 1969 - if ((block_group->flags & 1970 - (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) && 1935 + if (is_metadata && 1971 1936 block_group->start + block_group->alloc_offset > block_group->meta_write_pointer) { 1972 1937 spin_unlock(&block_group->lock); 1973 1938 return -EAGAIN; ··· 1991 1958 /* No need to wait for NOCOW writers. Zoned mode does not allow that */ 1992 1959 btrfs_wait_ordered_roots(fs_info, U64_MAX, block_group->start, 1993 1960 block_group->length); 1961 + /* Wait for extent buffers to be written. */ 1962 + if (is_metadata) 1963 + wait_eb_writebacks(block_group); 1994 1964 1995 1965 spin_lock(&block_group->lock); 1996 1966
+2 -2
fs/cifs/cifsfs.h
··· 153 153 #endif /* CONFIG_CIFS_NFSD_EXPORT */ 154 154 155 155 /* when changing internal version - update following two lines at same time */ 156 - #define SMB3_PRODUCT_BUILD 38 157 - #define CIFS_VERSION "2.38" 156 + #define SMB3_PRODUCT_BUILD 39 157 + #define CIFS_VERSION "2.39" 158 158 #endif /* _CIFSFS_H */
+6 -8
fs/cifs/connect.c
··· 702 702 int length = 0; 703 703 int total_read; 704 704 705 - smb_msg->msg_control = NULL; 706 - smb_msg->msg_controllen = 0; 707 - 708 705 for (total_read = 0; msg_data_left(smb_msg); total_read += length) { 709 706 try_to_freeze(); 710 707 ··· 757 760 cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, 758 761 unsigned int to_read) 759 762 { 760 - struct msghdr smb_msg; 763 + struct msghdr smb_msg = {}; 761 764 struct kvec iov = {.iov_base = buf, .iov_len = to_read}; 762 765 iov_iter_kvec(&smb_msg.msg_iter, READ, &iov, 1, to_read); 763 766 ··· 767 770 ssize_t 768 771 cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read) 769 772 { 770 - struct msghdr smb_msg; 773 + struct msghdr smb_msg = {}; 771 774 772 775 /* 773 776 * iov_iter_discard already sets smb_msg.type and count and iov_offset 774 777 * and cifs_readv_from_socket sets msg_control and msg_controllen 775 778 * so little to initialize in struct msghdr 776 779 */ 777 - smb_msg.msg_name = NULL; 778 - smb_msg.msg_namelen = 0; 779 780 iov_iter_discard(&smb_msg.msg_iter, READ, to_read); 780 781 781 782 return cifs_readv_from_socket(server, &smb_msg); ··· 783 788 cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, 784 789 unsigned int page_offset, unsigned int to_read) 785 790 { 786 - struct msghdr smb_msg; 791 + struct msghdr smb_msg = {}; 787 792 struct bio_vec bv = { 788 793 .bv_page = page, .bv_len = to_read, .bv_offset = page_offset}; 789 794 iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read); ··· 2345 2350 ses = tcon->ses; 2346 2351 cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); 2347 2352 spin_lock(&cifs_tcp_ses_lock); 2353 + spin_lock(&tcon->tc_lock); 2348 2354 if (--tcon->tc_count > 0) { 2355 + spin_unlock(&tcon->tc_lock); 2349 2356 spin_unlock(&cifs_tcp_ses_lock); 2350 2357 return; 2351 2358 } ··· 2356 2359 WARN_ON(tcon->tc_count < 0); 2357 2360 2358 2361 list_del_init(&tcon->tcon_list); 2362 + spin_unlock(&tcon->tc_lock); 2359 2363 spin_unlock(&cifs_tcp_ses_lock); 2360 2364 2361 2365 /* cancel polling of interfaces */
+3
fs/cifs/file.c
··· 3575 3575 3576 3576 ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from) 3577 3577 { 3578 + struct file *file = iocb->ki_filp; 3579 + 3580 + cifs_revalidate_mapping(file->f_inode); 3578 3581 return __cifs_writev(iocb, from, true); 3579 3582 } 3580 3583
+1 -5
fs/cifs/transport.c
··· 194 194 195 195 *sent = 0; 196 196 197 - smb_msg->msg_name = (struct sockaddr *) &server->dstaddr; 198 - smb_msg->msg_namelen = sizeof(struct sockaddr); 199 - smb_msg->msg_control = NULL; 200 - smb_msg->msg_controllen = 0; 201 197 if (server->noblocksnd) 202 198 smb_msg->msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; 203 199 else ··· 305 309 sigset_t mask, oldmask; 306 310 size_t total_len = 0, sent, size; 307 311 struct socket *ssocket = server->ssocket; 308 - struct msghdr smb_msg; 312 + struct msghdr smb_msg = {}; 309 313 __be32 rfc1002_marker; 310 314 311 315 if (cifs_rdma_enabled(server)) {
+3
fs/dax.c
··· 1445 1445 loff_t done = 0; 1446 1446 int ret; 1447 1447 1448 + if (!iomi.len) 1449 + return 0; 1450 + 1448 1451 if (iov_iter_rw(iter) == WRITE) { 1449 1452 lockdep_assert_held_write(&iomi.inode->i_rwsem); 1450 1453 iomi.flags |= IOMAP_WRITE;
-7
fs/exec.c
··· 65 65 #include <linux/io_uring.h> 66 66 #include <linux/syscall_user_dispatch.h> 67 67 #include <linux/coredump.h> 68 - #include <linux/time_namespace.h> 69 68 70 69 #include <linux/uaccess.h> 71 70 #include <asm/mmu_context.h> ··· 978 979 { 979 980 struct task_struct *tsk; 980 981 struct mm_struct *old_mm, *active_mm; 981 - bool vfork; 982 982 int ret; 983 983 984 984 /* Notify parent that we're no longer interested in the old VM */ 985 985 tsk = current; 986 - vfork = !!tsk->vfork_done; 987 986 old_mm = current->mm; 988 987 exec_mm_release(tsk, old_mm); 989 988 if (old_mm) ··· 1026 1029 tsk->mm->vmacache_seqnum = 0; 1027 1030 vmacache_flush(tsk); 1028 1031 task_unlock(tsk); 1029 - 1030 - if (vfork) 1031 - timens_on_fork(tsk->nsproxy, tsk); 1032 - 1033 1032 if (old_mm) { 1034 1033 mmap_read_unlock(old_mm); 1035 1034 BUG_ON(active_mm != old_mm);
+1 -2
fs/exfat/fatent.c
··· 270 270 struct super_block *sb = dir->i_sb; 271 271 struct exfat_sb_info *sbi = EXFAT_SB(sb); 272 272 struct buffer_head *bh; 273 - sector_t blknr, last_blknr; 274 - int i; 273 + sector_t blknr, last_blknr, i; 275 274 276 275 blknr = exfat_cluster_to_sector(sbi, clu); 277 276 last_blknr = blknr + sbi->sect_per_clus;
+5 -5
fs/ext4/ext4.h
··· 167 167 #define EXT4_MB_CR0_OPTIMIZED 0x8000 168 168 /* Avg fragment size rb tree lookup succeeded at least once for cr = 1 */ 169 169 #define EXT4_MB_CR1_OPTIMIZED 0x00010000 170 - /* Perform linear traversal for one group */ 171 - #define EXT4_MB_SEARCH_NEXT_LINEAR 0x00020000 172 170 struct ext4_allocation_request { 173 171 /* target inode for block we're allocating */ 174 172 struct inode *inode; ··· 1598 1600 struct list_head s_discard_list; 1599 1601 struct work_struct s_discard_work; 1600 1602 atomic_t s_retry_alloc_pending; 1601 - struct rb_root s_mb_avg_fragment_size_root; 1602 - rwlock_t s_mb_rb_lock; 1603 + struct list_head *s_mb_avg_fragment_size; 1604 + rwlock_t *s_mb_avg_fragment_size_locks; 1603 1605 struct list_head *s_mb_largest_free_orders; 1604 1606 rwlock_t *s_mb_largest_free_orders_locks; 1605 1607 ··· 3411 3413 ext4_grpblk_t bb_first_free; /* first free block */ 3412 3414 ext4_grpblk_t bb_free; /* total free blocks */ 3413 3415 ext4_grpblk_t bb_fragments; /* nr of freespace fragments */ 3416 + int bb_avg_fragment_size_order; /* order of average 3417 + fragment in BG */ 3414 3418 ext4_grpblk_t bb_largest_free_order;/* order of largest frag in BG */ 3415 3419 ext4_group_t bb_group; /* Group number */ 3416 3420 struct list_head bb_prealloc_list; ··· 3420 3420 void *bb_bitmap; 3421 3421 #endif 3422 3422 struct rw_semaphore alloc_sem; 3423 - struct rb_node bb_avg_fragment_size_rb; 3423 + struct list_head bb_avg_fragment_size_node; 3424 3424 struct list_head bb_largest_free_order_node; 3425 3425 ext4_grpblk_t bb_counters[]; /* Nr of free power-of-two-block 3426 3426 * regions, index is order.
+4
fs/ext4/extents.c
··· 460 460 error_msg = "invalid eh_entries"; 461 461 goto corrupted; 462 462 } 463 + if (unlikely((eh->eh_entries == 0) && (depth > 0))) { 464 + error_msg = "eh_entries is 0 but eh_depth is > 0"; 465 + goto corrupted; 466 + } 463 467 if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) { 464 468 error_msg = "invalid extent entries"; 465 469 goto corrupted;
+1 -1
fs/ext4/ialloc.c
··· 510 510 goto fallback; 511 511 } 512 512 513 - max_dirs = ndirs / ngroups + inodes_per_group / 16; 513 + max_dirs = ndirs / ngroups + inodes_per_group*flex_size / 16; 514 514 min_inodes = avefreei - inodes_per_group*flex_size / 4; 515 515 if (min_inodes < 1) 516 516 min_inodes = 1;
+144 -174
fs/ext4/mballoc.c
··· 140 140 * number of buddy bitmap orders possible) number of lists. Group-infos are 141 141 * placed in appropriate lists. 142 142 * 143 - * 2) Average fragment size rb tree (sbi->s_mb_avg_fragment_size_root) 143 + * 2) Average fragment size lists (sbi->s_mb_avg_fragment_size) 144 144 * 145 - * Locking: sbi->s_mb_rb_lock (rwlock) 145 + * Locking: sbi->s_mb_avg_fragment_size_locks(array of rw locks) 146 146 * 147 - * This is a red black tree consisting of group infos and the tree is sorted 148 - * by average fragment sizes (which is calculated as ext4_group_info->bb_free 149 - * / ext4_group_info->bb_fragments). 147 + * This is an array of lists where in the i-th list there are groups with 148 + * average fragment size >= 2^i and < 2^(i+1). The average fragment size 149 + * is computed as ext4_group_info->bb_free / ext4_group_info->bb_fragments. 150 + * Note that we don't bother with a special list for completely empty groups 151 + * so we only have MB_NUM_ORDERS(sb) lists. 150 152 * 151 153 * When "mb_optimize_scan" mount option is set, mballoc consults the above data 152 154 * structures to decide the order in which groups are to be traversed for ··· 162 160 * 163 161 * At CR = 1, we only consider groups where average fragment size > request 164 162 * size. So, we lookup a group which has average fragment size just above or 165 - * equal to request size using our rb tree (data structure 2) in O(log N) time. 163 + * equal to request size using our average fragment size group lists (data 164 + * structure 2) in O(1) time. 166 165 * 167 166 * If "mb_optimize_scan" mount option is not set, mballoc traverses groups in 168 167 * linear order which requires O(N) search time for each CR 0 and CR 1 phase. ··· 805 802 } 806 803 } 807 804 808 - static void ext4_mb_rb_insert(struct rb_root *root, struct rb_node *new, 809 - int (*cmp)(struct rb_node *, struct rb_node *)) 805 + static int mb_avg_fragment_size_order(struct super_block *sb, ext4_grpblk_t len) 810 806 { 811 - struct rb_node **iter = &root->rb_node, *parent = NULL; 807 + int order; 812 808 813 - while (*iter) { 814 - parent = *iter; 815 - if (cmp(new, *iter) > 0) 816 - iter = &((*iter)->rb_left); 817 - else 818 - iter = &((*iter)->rb_right); 819 - } 820 - 821 - rb_link_node(new, parent, iter); 822 - rb_insert_color(new, root); 809 + /* 810 + * We don't bother with a special lists groups with only 1 block free 811 + * extents and for completely empty groups. 812 + */ 813 + order = fls(len) - 2; 814 + if (order < 0) 815 + return 0; 816 + if (order == MB_NUM_ORDERS(sb)) 817 + order--; 818 + return order; 823 819 } 824 820 825 - static int 826 - ext4_mb_avg_fragment_size_cmp(struct rb_node *rb1, struct rb_node *rb2) 827 - { 828 - struct ext4_group_info *grp1 = rb_entry(rb1, 829 - struct ext4_group_info, 830 - bb_avg_fragment_size_rb); 831 - struct ext4_group_info *grp2 = rb_entry(rb2, 832 - struct ext4_group_info, 833 - bb_avg_fragment_size_rb); 834 - int num_frags_1, num_frags_2; 835 - 836 - num_frags_1 = grp1->bb_fragments ? 837 - grp1->bb_free / grp1->bb_fragments : 0; 838 - num_frags_2 = grp2->bb_fragments ? 839 - grp2->bb_free / grp2->bb_fragments : 0; 840 - 841 - return (num_frags_2 - num_frags_1); 842 - } 843 - 844 - /* 845 - * Reinsert grpinfo into the avg_fragment_size tree with new average 846 - * fragment size. 847 - */ 821 + /* Move group to appropriate avg_fragment_size list */ 848 822 static void 849 823 mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp) 850 824 { 851 825 struct ext4_sb_info *sbi = EXT4_SB(sb); 826 + int new_order; 852 827 853 828 if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_free == 0) 854 829 return; 855 830 856 - write_lock(&sbi->s_mb_rb_lock); 857 - if (!RB_EMPTY_NODE(&grp->bb_avg_fragment_size_rb)) { 858 - rb_erase(&grp->bb_avg_fragment_size_rb, 859 - &sbi->s_mb_avg_fragment_size_root); 860 - RB_CLEAR_NODE(&grp->bb_avg_fragment_size_rb); 861 - } 831 + new_order = mb_avg_fragment_size_order(sb, 832 + grp->bb_free / grp->bb_fragments); 833 + if (new_order == grp->bb_avg_fragment_size_order) 834 + return; 862 835 863 - ext4_mb_rb_insert(&sbi->s_mb_avg_fragment_size_root, 864 - &grp->bb_avg_fragment_size_rb, 865 - ext4_mb_avg_fragment_size_cmp); 866 - write_unlock(&sbi->s_mb_rb_lock); 836 + if (grp->bb_avg_fragment_size_order != -1) { 837 + write_lock(&sbi->s_mb_avg_fragment_size_locks[ 838 + grp->bb_avg_fragment_size_order]); 839 + list_del(&grp->bb_avg_fragment_size_node); 840 + write_unlock(&sbi->s_mb_avg_fragment_size_locks[ 841 + grp->bb_avg_fragment_size_order]); 842 + } 843 + grp->bb_avg_fragment_size_order = new_order; 844 + write_lock(&sbi->s_mb_avg_fragment_size_locks[ 845 + grp->bb_avg_fragment_size_order]); 846 + list_add_tail(&grp->bb_avg_fragment_size_node, 847 + &sbi->s_mb_avg_fragment_size[grp->bb_avg_fragment_size_order]); 848 + write_unlock(&sbi->s_mb_avg_fragment_size_locks[ 849 + grp->bb_avg_fragment_size_order]); 867 850 } 868 851 869 852 /* ··· 898 909 *new_cr = 1; 899 910 } else { 900 911 *group = grp->bb_group; 901 - ac->ac_last_optimal_group = *group; 902 912 ac->ac_flags |= EXT4_MB_CR0_OPTIMIZED; 903 913 } 904 914 } 905 915 906 916 /* 907 - * Choose next group by traversing average fragment size tree. Updates *new_cr 908 - * if cr lvel needs an update. Sets EXT4_MB_SEARCH_NEXT_LINEAR to indicate that 909 - * the linear search should continue for one iteration since there's lock 910 - * contention on the rb tree lock. 917 + * Choose next group by traversing average fragment size list of suitable 918 + * order. Updates *new_cr if cr level needs an update. 911 919 */ 912 920 static void ext4_mb_choose_next_group_cr1(struct ext4_allocation_context *ac, 913 921 int *new_cr, ext4_group_t *group, ext4_group_t ngroups) 914 922 { 915 923 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); 916 - int avg_fragment_size, best_so_far; 917 - struct rb_node *node, *found; 918 - struct ext4_group_info *grp; 919 - 920 - /* 921 - * If there is contention on the lock, instead of waiting for the lock 922 - * to become available, just continue searching lineraly. We'll resume 923 - * our rb tree search later starting at ac->ac_last_optimal_group. 924 - */ 925 - if (!read_trylock(&sbi->s_mb_rb_lock)) { 926 - ac->ac_flags |= EXT4_MB_SEARCH_NEXT_LINEAR; 927 - return; 928 - } 924 + struct ext4_group_info *grp, *iter; 925 + int i; 929 926 930 927 if (unlikely(ac->ac_flags & EXT4_MB_CR1_OPTIMIZED)) { 931 928 if (sbi->s_mb_stats) 932 929 atomic_inc(&sbi->s_bal_cr1_bad_suggestions); 933 - /* We have found something at CR 1 in the past */ 934 - grp = ext4_get_group_info(ac->ac_sb, ac->ac_last_optimal_group); 935 - for (found = rb_next(&grp->bb_avg_fragment_size_rb); found != NULL; 936 - found = rb_next(found)) { 937 - grp = rb_entry(found, struct ext4_group_info, 938 - bb_avg_fragment_size_rb); 930 + } 931 + 932 + for (i = mb_avg_fragment_size_order(ac->ac_sb, ac->ac_g_ex.fe_len); 933 + i < MB_NUM_ORDERS(ac->ac_sb); i++) { 934 + if (list_empty(&sbi->s_mb_avg_fragment_size[i])) 935 + continue; 936 + read_lock(&sbi->s_mb_avg_fragment_size_locks[i]); 937 + if (list_empty(&sbi->s_mb_avg_fragment_size[i])) { 938 + read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); 939 + continue; 940 + } 941 + grp = NULL; 942 + list_for_each_entry(iter, &sbi->s_mb_avg_fragment_size[i], 943 + bb_avg_fragment_size_node) { 939 944 if (sbi->s_mb_stats) 940 945 atomic64_inc(&sbi->s_bal_cX_groups_considered[1]); 941 - if (likely(ext4_mb_good_group(ac, grp->bb_group, 1))) 946 + if (likely(ext4_mb_good_group(ac, iter->bb_group, 1))) { 947 + grp = iter; 942 948 break; 943 - } 944 - goto done; 945 - } 946 - 947 - node = sbi->s_mb_avg_fragment_size_root.rb_node; 948 - best_so_far = 0; 949 - found = NULL; 950 - 951 - while (node) { 952 - grp = rb_entry(node, struct ext4_group_info, 953 - bb_avg_fragment_size_rb); 954 - avg_fragment_size = 0; 955 - if (ext4_mb_good_group(ac, grp->bb_group, 1)) { 956 - avg_fragment_size = grp->bb_fragments ? 957 - grp->bb_free / grp->bb_fragments : 0; 958 - if (!best_so_far || avg_fragment_size < best_so_far) { 959 - best_so_far = avg_fragment_size; 960 - found = node; 961 949 } 962 950 } 963 - if (avg_fragment_size > ac->ac_g_ex.fe_len) 964 - node = node->rb_right; 965 - else 966 - node = node->rb_left; 951 + read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]); 952 + if (grp) 953 + break; 967 954 } 968 955 969 - done: 970 - if (found) { 971 - grp = rb_entry(found, struct ext4_group_info, 972 - bb_avg_fragment_size_rb); 956 + if (grp) { 973 957 *group = grp->bb_group; 974 958 ac->ac_flags |= EXT4_MB_CR1_OPTIMIZED; 975 959 } else { 976 960 *new_cr = 2; 977 961 } 978 - 979 - read_unlock(&sbi->s_mb_rb_lock); 980 - ac->ac_last_optimal_group = *group; 981 962 } 982 963 983 964 static inline int should_optimize_scan(struct ext4_allocation_context *ac) ··· 973 1014 974 1015 if (ac->ac_groups_linear_remaining) { 975 1016 ac->ac_groups_linear_remaining--; 976 - goto inc_and_return; 977 - } 978 - 979 - if (ac->ac_flags & EXT4_MB_SEARCH_NEXT_LINEAR) { 980 - ac->ac_flags &= ~EXT4_MB_SEARCH_NEXT_LINEAR; 981 1017 goto inc_and_return; 982 1018 } 983 1019 ··· 1003 1049 { 1004 1050 *new_cr = ac->ac_criteria; 1005 1051 1006 - if (!should_optimize_scan(ac) || ac->ac_groups_linear_remaining) 1052 + if (!should_optimize_scan(ac) || ac->ac_groups_linear_remaining) { 1053 + *group = next_linear_group(ac, *group, ngroups); 1007 1054 return; 1055 + } 1008 1056 1009 1057 if (*new_cr == 0) { 1010 1058 ext4_mb_choose_next_group_cr0(ac, new_cr, group, ngroups); ··· 1031 1075 struct ext4_sb_info *sbi = EXT4_SB(sb); 1032 1076 int i; 1033 1077 1034 - if (test_opt2(sb, MB_OPTIMIZE_SCAN) && grp->bb_largest_free_order >= 0) { 1078 + for (i = MB_NUM_ORDERS(sb) - 1; i >= 0; i--) 1079 + if (grp->bb_counters[i] > 0) 1080 + break; 1081 + /* No need to move between order lists? */ 1082 + if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || 1083 + i == grp->bb_largest_free_order) { 1084 + grp->bb_largest_free_order = i; 1085 + return; 1086 + } 1087 + 1088 + if (grp->bb_largest_free_order >= 0) { 1035 1089 write_lock(&sbi->s_mb_largest_free_orders_locks[ 1036 1090 grp->bb_largest_free_order]); 1037 1091 list_del_init(&grp->bb_largest_free_order_node); 1038 1092 write_unlock(&sbi->s_mb_largest_free_orders_locks[ 1039 1093 grp->bb_largest_free_order]); 1040 1094 } 1041 - grp->bb_largest_free_order = -1; /* uninit */ 1042 - 1043 - for (i = MB_NUM_ORDERS(sb) - 1; i >= 0; i--) { 1044 - if (grp->bb_counters[i] > 0) { 1045 - grp->bb_largest_free_order = i; 1046 - break; 1047 - } 1048 - } 1049 - if (test_opt2(sb, MB_OPTIMIZE_SCAN) && 1050 - grp->bb_largest_free_order >= 0 && grp->bb_free) { 1095 + grp->bb_largest_free_order = i; 1096 + if (grp->bb_largest_free_order >= 0 && grp->bb_free) { 1051 1097 write_lock(&sbi->s_mb_largest_free_orders_locks[ 1052 1098 grp->bb_largest_free_order]); 1053 1099 list_add_tail(&grp->bb_largest_free_order_node, ··· 1106 1148 EXT4_GROUP_INFO_BBITMAP_CORRUPT); 1107 1149 } 1108 1150 mb_set_largest_free_order(sb, grp); 1151 + mb_update_avg_fragment_size(sb, grp); 1109 1152 1110 1153 clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state)); 1111 1154 1112 1155 period = get_cycles() - period; 1113 1156 atomic_inc(&sbi->s_mb_buddies_generated); 1114 1157 atomic64_add(period, &sbi->s_mb_generation_time); 1115 - mb_update_avg_fragment_size(sb, grp); 1116 1158 } 1117 1159 1118 1160 /* The buddy information is attached the buddy cache inode ··· 2594 2636 ext4_mb_regular_allocator(struct ext4_allocation_context *ac) 2595 2637 { 2596 2638 ext4_group_t prefetch_grp = 0, ngroups, group, i; 2597 - int cr = -1; 2639 + int cr = -1, new_cr; 2598 2640 int err = 0, first_err = 0; 2599 2641 unsigned int nr = 0, prefetch_ios = 0; 2600 2642 struct ext4_sb_info *sbi; ··· 2665 2707 * from the goal value specified 2666 2708 */ 2667 2709 group = ac->ac_g_ex.fe_group; 2668 - ac->ac_last_optimal_group = group; 2669 2710 ac->ac_groups_linear_remaining = sbi->s_mb_max_linear_groups; 2670 2711 prefetch_grp = group; 2671 2712 2672 - for (i = 0; i < ngroups; group = next_linear_group(ac, group, ngroups), 2673 - i++) { 2674 - int ret = 0, new_cr; 2713 + for (i = 0, new_cr = cr; i < ngroups; i++, 2714 + ext4_mb_choose_next_group(ac, &new_cr, &group, ngroups)) { 2715 + int ret = 0; 2675 2716 2676 2717 cond_resched(); 2677 - 2678 - ext4_mb_choose_next_group(ac, &new_cr, &group, ngroups); 2679 2718 if (new_cr != cr) { 2680 2719 cr = new_cr; 2681 2720 goto repeat; ··· 2946 2991 struct super_block *sb = pde_data(file_inode(seq->file)); 2947 2992 unsigned long position; 2948 2993 2949 - read_lock(&EXT4_SB(sb)->s_mb_rb_lock); 2950 - 2951 - if (*pos < 0 || *pos >= MB_NUM_ORDERS(sb) + 1) 2994 + if (*pos < 0 || *pos >= 2*MB_NUM_ORDERS(sb)) 2952 2995 return NULL; 2953 2996 position = *pos + 1; 2954 2997 return (void *) ((unsigned long) position); ··· 2958 3005 unsigned long position; 2959 3006 2960 3007 ++*pos; 2961 - if (*pos < 0 || *pos >= MB_NUM_ORDERS(sb) + 1) 3008 + if (*pos < 0 || *pos >= 2*MB_NUM_ORDERS(sb)) 2962 3009 return NULL; 2963 3010 position = *pos + 1; 2964 3011 return (void *) ((unsigned long) position); ··· 2970 3017 struct ext4_sb_info *sbi = EXT4_SB(sb); 2971 3018 unsigned long position = ((unsigned long) v); 2972 3019 struct ext4_group_info *grp; 2973 - struct rb_node *n; 2974 - unsigned int count, min, max; 3020 + unsigned int count; 2975 3021 2976 3022 position--; 2977 3023 if (position >= MB_NUM_ORDERS(sb)) { 2978 - seq_puts(seq, "fragment_size_tree:\n"); 2979 - n = rb_first(&sbi->s_mb_avg_fragment_size_root); 2980 - if (!n) { 2981 - seq_puts(seq, "\ttree_min: 0\n\ttree_max: 0\n\ttree_nodes: 0\n"); 2982 - return 0; 2983 - } 2984 - grp = rb_entry(n, struct ext4_group_info, bb_avg_fragment_size_rb); 2985 - min = grp->bb_fragments ? grp->bb_free / grp->bb_fragments : 0; 2986 - count = 1; 2987 - while (rb_next(n)) { 2988 - count++; 2989 - n = rb_next(n); 2990 - } 2991 - grp = rb_entry(n, struct ext4_group_info, bb_avg_fragment_size_rb); 2992 - max = grp->bb_fragments ? grp->bb_free / grp->bb_fragments : 0; 3024 + position -= MB_NUM_ORDERS(sb); 3025 + if (position == 0) 3026 + seq_puts(seq, "avg_fragment_size_lists:\n"); 2993 3027 2994 - seq_printf(seq, "\ttree_min: %u\n\ttree_max: %u\n\ttree_nodes: %u\n", 2995 - min, max, count); 3028 + count = 0; 3029 + read_lock(&sbi->s_mb_avg_fragment_size_locks[position]); 3030 + list_for_each_entry(grp, &sbi->s_mb_avg_fragment_size[position], 3031 + bb_avg_fragment_size_node) 3032 + count++; 3033 + read_unlock(&sbi->s_mb_avg_fragment_size_locks[position]); 3034 + seq_printf(seq, "\tlist_order_%u_groups: %u\n", 3035 + (unsigned int)position, count); 2996 3036 return 0; 2997 3037 } 2998 3038 ··· 2995 3049 seq_puts(seq, "max_free_order_lists:\n"); 2996 3050 } 2997 3051 count = 0; 3052 + read_lock(&sbi->s_mb_largest_free_orders_locks[position]); 2998 3053 list_for_each_entry(grp, &sbi->s_mb_largest_free_orders[position], 2999 3054 bb_largest_free_order_node) 3000 3055 count++; 3056 + read_unlock(&sbi->s_mb_largest_free_orders_locks[position]); 3001 3057 seq_printf(seq, "\tlist_order_%u_groups: %u\n", 3002 3058 (unsigned int)position, count); 3003 3059 ··· 3007 3059 } 3008 3060 3009 3061 static void ext4_mb_seq_structs_summary_stop(struct seq_file *seq, void *v) 3010 - __releases(&EXT4_SB(sb)->s_mb_rb_lock) 3011 3062 { 3012 - struct super_block *sb = pde_data(file_inode(seq->file)); 3013 - 3014 - read_unlock(&EXT4_SB(sb)->s_mb_rb_lock); 3015 3063 } 3016 3064 3017 3065 const struct seq_operations ext4_mb_seq_structs_summary_ops = { ··· 3120 3176 init_rwsem(&meta_group_info[i]->alloc_sem); 3121 3177 meta_group_info[i]->bb_free_root = RB_ROOT; 3122 3178 INIT_LIST_HEAD(&meta_group_info[i]->bb_largest_free_order_node); 3123 - RB_CLEAR_NODE(&meta_group_info[i]->bb_avg_fragment_size_rb); 3179 + INIT_LIST_HEAD(&meta_group_info[i]->bb_avg_fragment_size_node); 3124 3180 meta_group_info[i]->bb_largest_free_order = -1; /* uninit */ 3181 + meta_group_info[i]->bb_avg_fragment_size_order = -1; /* uninit */ 3125 3182 meta_group_info[i]->bb_group = group; 3126 3183 3127 3184 mb_group_bb_bitmap_alloc(sb, meta_group_info[i], group); ··· 3371 3426 i++; 3372 3427 } while (i < MB_NUM_ORDERS(sb)); 3373 3428 3374 - sbi->s_mb_avg_fragment_size_root = RB_ROOT; 3429 + sbi->s_mb_avg_fragment_size = 3430 + kmalloc_array(MB_NUM_ORDERS(sb), sizeof(struct list_head), 3431 + GFP_KERNEL); 3432 + if (!sbi->s_mb_avg_fragment_size) { 3433 + ret = -ENOMEM; 3434 + goto out; 3435 + } 3436 + sbi->s_mb_avg_fragment_size_locks = 3437 + kmalloc_array(MB_NUM_ORDERS(sb), sizeof(rwlock_t), 3438 + GFP_KERNEL); 3439 + if (!sbi->s_mb_avg_fragment_size_locks) { 3440 + ret = -ENOMEM; 3441 + goto out; 3442 + } 3443 + for (i = 0; i < MB_NUM_ORDERS(sb); i++) { 3444 + INIT_LIST_HEAD(&sbi->s_mb_avg_fragment_size[i]); 3445 + rwlock_init(&sbi->s_mb_avg_fragment_size_locks[i]); 3446 + } 3375 3447 sbi->s_mb_largest_free_orders = 3376 3448 kmalloc_array(MB_NUM_ORDERS(sb), sizeof(struct list_head), 3377 3449 GFP_KERNEL); ··· 3407 3445 INIT_LIST_HEAD(&sbi->s_mb_largest_free_orders[i]); 3408 3446 rwlock_init(&sbi->s_mb_largest_free_orders_locks[i]); 3409 3447 } 3410 - rwlock_init(&sbi->s_mb_rb_lock); 3411 3448 3412 3449 spin_lock_init(&sbi->s_md_lock); 3413 3450 sbi->s_mb_free_pending = 0; ··· 3477 3516 free_percpu(sbi->s_locality_groups); 3478 3517 sbi->s_locality_groups = NULL; 3479 3518 out: 3519 + kfree(sbi->s_mb_avg_fragment_size); 3520 + kfree(sbi->s_mb_avg_fragment_size_locks); 3480 3521 kfree(sbi->s_mb_largest_free_orders); 3481 3522 kfree(sbi->s_mb_largest_free_orders_locks); 3482 3523 kfree(sbi->s_mb_offsets); ··· 3545 3582 kvfree(group_info); 3546 3583 rcu_read_unlock(); 3547 3584 } 3585 + kfree(sbi->s_mb_avg_fragment_size); 3586 + kfree(sbi->s_mb_avg_fragment_size_locks); 3548 3587 kfree(sbi->s_mb_largest_free_orders); 3549 3588 kfree(sbi->s_mb_largest_free_orders_locks); 3550 3589 kfree(sbi->s_mb_offsets); ··· 5158 5193 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb); 5159 5194 int bsbits = ac->ac_sb->s_blocksize_bits; 5160 5195 loff_t size, isize; 5196 + bool inode_pa_eligible, group_pa_eligible; 5161 5197 5162 5198 if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) 5163 5199 return; ··· 5166 5200 if (unlikely(ac->ac_flags & EXT4_MB_HINT_GOAL_ONLY)) 5167 5201 return; 5168 5202 5203 + group_pa_eligible = sbi->s_mb_group_prealloc > 0; 5204 + inode_pa_eligible = true; 5169 5205 size = ac->ac_o_ex.fe_logical + EXT4_C2B(sbi, ac->ac_o_ex.fe_len); 5170 5206 isize = (i_size_read(ac->ac_inode) + ac->ac_sb->s_blocksize - 1) 5171 5207 >> bsbits; 5172 5208 5209 + /* No point in using inode preallocation for closed files */ 5173 5210 if ((size == isize) && !ext4_fs_is_busy(sbi) && 5174 - !inode_is_open_for_write(ac->ac_inode)) { 5175 - ac->ac_flags |= EXT4_MB_HINT_NOPREALLOC; 5176 - return; 5177 - } 5211 + !inode_is_open_for_write(ac->ac_inode)) 5212 + inode_pa_eligible = false; 5178 5213 5179 - if (sbi->s_mb_group_prealloc <= 0) { 5180 - ac->ac_flags |= EXT4_MB_STREAM_ALLOC; 5181 - return; 5182 - } 5183 - 5184 - /* don't use group allocation for large files */ 5185 5214 size = max(size, isize); 5186 - if (size > sbi->s_mb_stream_request) { 5187 - ac->ac_flags |= EXT4_MB_STREAM_ALLOC; 5215 + /* Don't use group allocation for large files */ 5216 + if (size > sbi->s_mb_stream_request) 5217 + group_pa_eligible = false; 5218 + 5219 + if (!group_pa_eligible) { 5220 + if (inode_pa_eligible) 5221 + ac->ac_flags |= EXT4_MB_STREAM_ALLOC; 5222 + else 5223 + ac->ac_flags |= EXT4_MB_HINT_NOPREALLOC; 5188 5224 return; 5189 5225 } 5190 5226 ··· 5533 5565 ext4_fsblk_t block = 0; 5534 5566 unsigned int inquota = 0; 5535 5567 unsigned int reserv_clstrs = 0; 5568 + int retries = 0; 5536 5569 u64 seq; 5537 5570 5538 5571 might_sleep(); ··· 5636 5667 ar->len = ac->ac_b_ex.fe_len; 5637 5668 } 5638 5669 } else { 5639 - if (ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) 5670 + if (++retries < 3 && 5671 + ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)) 5640 5672 goto repeat; 5641 5673 /* 5642 5674 * If block allocation fails then the pa allocated above
-1
fs/ext4/mballoc.h
··· 178 178 /* copy of the best found extent taken before preallocation efforts */ 179 179 struct ext4_free_extent ac_f_ex; 180 180 181 - ext4_group_t ac_last_optimal_group; 182 181 __u32 ac_groups_considered; 183 182 __u32 ac_flags; /* allocation hints */ 184 183 __u16 ac_groups_scanned;
+25
fs/nfs/internal.h
··· 606 606 return GFP_KERNEL; 607 607 } 608 608 609 + /* 610 + * Special version of should_remove_suid() that ignores capabilities. 611 + */ 612 + static inline int nfs_should_remove_suid(const struct inode *inode) 613 + { 614 + umode_t mode = inode->i_mode; 615 + int kill = 0; 616 + 617 + /* suid always must be killed */ 618 + if (unlikely(mode & S_ISUID)) 619 + kill = ATTR_KILL_SUID; 620 + 621 + /* 622 + * sgid without any exec bits is just a mandatory locking mark; leave 623 + * it alone. If some exec bits are set, it's a real sgid; kill it. 624 + */ 625 + if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) 626 + kill |= ATTR_KILL_SGID; 627 + 628 + if (unlikely(kill && S_ISREG(mode))) 629 + return kill; 630 + 631 + return 0; 632 + } 633 + 609 634 /* unlink.c */ 610 635 extern struct rpc_task * 611 636 nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
+7 -2
fs/nfs/nfs42proc.c
··· 78 78 79 79 status = nfs4_call_sync(server->client, server, msg, 80 80 &args.seq_args, &res.seq_res, 0); 81 - if (status == 0) 81 + if (status == 0) { 82 + if (nfs_should_remove_suid(inode)) { 83 + spin_lock(&inode->i_lock); 84 + nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE); 85 + spin_unlock(&inode->i_lock); 86 + } 82 87 status = nfs_post_op_update_inode_force_wcc(inode, 83 88 res.falloc_fattr); 84 - 89 + } 85 90 if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE]) 86 91 trace_nfs4_fallocate(inode, &args, status); 87 92 else
+18 -9
fs/nfs/super.c
··· 1051 1051 if (ctx->bsize) 1052 1052 sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits); 1053 1053 1054 - if (server->nfs_client->rpc_ops->version != 2) { 1055 - /* The VFS shouldn't apply the umask to mode bits. We will do 1056 - * so ourselves when necessary. 1054 + switch (server->nfs_client->rpc_ops->version) { 1055 + case 2: 1056 + sb->s_time_gran = 1000; 1057 + sb->s_time_min = 0; 1058 + sb->s_time_max = U32_MAX; 1059 + break; 1060 + case 3: 1061 + /* 1062 + * The VFS shouldn't apply the umask to mode bits. 1063 + * We will do so ourselves when necessary. 1057 1064 */ 1058 1065 sb->s_flags |= SB_POSIXACL; 1059 1066 sb->s_time_gran = 1; 1060 - sb->s_export_op = &nfs_export_ops; 1061 - } else 1062 - sb->s_time_gran = 1000; 1063 - 1064 - if (server->nfs_client->rpc_ops->version != 4) { 1065 1067 sb->s_time_min = 0; 1066 1068 sb->s_time_max = U32_MAX; 1067 - } else { 1069 + sb->s_export_op = &nfs_export_ops; 1070 + break; 1071 + case 4: 1072 + sb->s_flags |= SB_POSIXACL; 1073 + sb->s_time_gran = 1; 1068 1074 sb->s_time_min = S64_MIN; 1069 1075 sb->s_time_max = S64_MAX; 1076 + if (server->caps & NFS_CAP_ATOMIC_OPEN_V1) 1077 + sb->s_export_op = &nfs_export_ops; 1078 + break; 1070 1079 } 1071 1080 1072 1081 sb->s_magic = NFS_SUPER_MAGIC;
-25
fs/nfs/write.c
··· 1496 1496 NFS_PROTO(data->inode)->commit_rpc_prepare(task, data); 1497 1497 } 1498 1498 1499 - /* 1500 - * Special version of should_remove_suid() that ignores capabilities. 1501 - */ 1502 - static int nfs_should_remove_suid(const struct inode *inode) 1503 - { 1504 - umode_t mode = inode->i_mode; 1505 - int kill = 0; 1506 - 1507 - /* suid always must be killed */ 1508 - if (unlikely(mode & S_ISUID)) 1509 - kill = ATTR_KILL_SUID; 1510 - 1511 - /* 1512 - * sgid without any exec bits is just a mandatory locking mark; leave 1513 - * it alone. If some exec bits are set, it's a real sgid; kill it. 1514 - */ 1515 - if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) 1516 - kill |= ATTR_KILL_SGID; 1517 - 1518 - if (unlikely(kill && S_ISREG(mode))) 1519 - return kill; 1520 - 1521 - return 0; 1522 - } 1523 - 1524 1499 static void nfs_writeback_check_extend(struct nfs_pgio_header *hdr, 1525 1500 struct nfs_fattr *fattr) 1526 1501 {
+16 -13
fs/nfsd/vfs.c
··· 300 300 static void 301 301 nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap) 302 302 { 303 + /* Ignore mode updates on symlinks */ 304 + if (S_ISLNK(inode->i_mode)) 305 + iap->ia_valid &= ~ATTR_MODE; 306 + 303 307 /* sanitize the mode change */ 304 308 if (iap->ia_valid & ATTR_MODE) { 305 309 iap->ia_mode &= S_IALLUGO; ··· 357 353 int accmode = NFSD_MAY_SATTR; 358 354 umode_t ftype = 0; 359 355 __be32 err; 360 - int host_err; 356 + int host_err = 0; 361 357 bool get_write_count; 362 358 bool size_change = (iap->ia_valid & ATTR_SIZE); 363 359 ··· 394 390 395 391 dentry = fhp->fh_dentry; 396 392 inode = d_inode(dentry); 397 - 398 - /* Ignore any mode updates on symlinks */ 399 - if (S_ISLNK(inode->i_mode)) 400 - iap->ia_valid &= ~ATTR_MODE; 401 - 402 - if (!iap->ia_valid) 403 - return 0; 404 393 405 394 nfsd_sanitize_attrs(inode, iap); 406 395 ··· 445 448 goto out_unlock; 446 449 } 447 450 448 - iap->ia_valid |= ATTR_CTIME; 449 - host_err = notify_change(&init_user_ns, dentry, iap, NULL); 451 + if (iap->ia_valid) { 452 + iap->ia_valid |= ATTR_CTIME; 453 + host_err = notify_change(&init_user_ns, dentry, iap, NULL); 454 + } 450 455 451 456 out_unlock: 452 457 if (attr->na_seclabel && attr->na_seclabel->len) ··· 845 846 struct splice_desc *sd) 846 847 { 847 848 struct svc_rqst *rqstp = sd->u.data; 849 + struct page *page = buf->page; // may be a compound one 850 + unsigned offset = buf->offset; 848 851 849 - svc_rqst_replace_page(rqstp, buf->page); 850 - if (rqstp->rq_res.page_len == 0) 851 - rqstp->rq_res.page_base = buf->offset; 852 + page += offset / PAGE_SIZE; 853 + for (int i = sd->len; i > 0; i -= PAGE_SIZE) 854 + svc_rqst_replace_page(rqstp, page++); 855 + if (rqstp->rq_res.page_len == 0) // first call 856 + rqstp->rq_res.page_base = offset % PAGE_SIZE; 852 857 rqstp->rq_res.page_len += sd->len; 853 858 return sd->len; 854 859 }
+2
fs/open.c
··· 716 716 fs_userns = i_user_ns(inode); 717 717 718 718 retry_deleg: 719 + newattrs.ia_vfsuid = INVALID_VFSUID; 720 + newattrs.ia_vfsgid = INVALID_VFSGID; 719 721 newattrs.ia_valid = ATTR_CTIME; 720 722 if ((user != (uid_t)-1) && !setattr_vfsuid(&newattrs, uid)) 721 723 return -EINVAL;
+1 -2
include/asm-generic/vmlinux.lds.h
··· 543 543 */ 544 544 #ifdef CONFIG_CFI_CLANG 545 545 #define TEXT_CFI_JT \ 546 - . = ALIGN(PMD_SIZE); \ 546 + ALIGN_FUNCTION(); \ 547 547 __cfi_jt_start = .; \ 548 548 *(.text..L.cfi.jumptable .text..L.cfi.jumptable.*) \ 549 - . = ALIGN(PMD_SIZE); \ 550 549 __cfi_jt_end = .; 551 550 #else 552 551 #define TEXT_CFI_JT
+3 -2
include/linux/cpumask.h
··· 1127 1127 * cover a worst-case of every other cpu being on one of two nodes for a 1128 1128 * very large NR_CPUS. 1129 1129 * 1130 - * Use PAGE_SIZE as a minimum for smaller configurations. 1130 + * Use PAGE_SIZE as a minimum for smaller configurations while avoiding 1131 + * unsigned comparison to -1. 1131 1132 */ 1132 - #define CPUMAP_FILE_MAX_BYTES ((((NR_CPUS * 9)/32 - 1) > PAGE_SIZE) \ 1133 + #define CPUMAP_FILE_MAX_BYTES (((NR_CPUS * 9)/32 > PAGE_SIZE) \ 1133 1134 ? (NR_CPUS * 9)/32 - 1 : PAGE_SIZE) 1134 1135 #define CPULIST_FILE_MAX_BYTES (((NR_CPUS * 7)/2 > PAGE_SIZE) ? (NR_CPUS * 7)/2 : PAGE_SIZE) 1135 1136
+1 -3
include/linux/dmar.h
··· 65 65 66 66 extern struct rw_semaphore dmar_global_lock; 67 67 extern struct list_head dmar_drhd_units; 68 - extern int intel_iommu_enabled; 69 68 70 69 #define for_each_drhd_unit(drhd) \ 71 70 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ ··· 88 89 static inline bool dmar_rcu_check(void) 89 90 { 90 91 return rwsem_is_locked(&dmar_global_lock) || 91 - system_state == SYSTEM_BOOTING || 92 - (IS_ENABLED(CONFIG_INTEL_IOMMU) && !intel_iommu_enabled); 92 + system_state == SYSTEM_BOOTING; 93 93 } 94 94 95 95 #define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check())
+1 -1
include/linux/hp_sdc.h
··· 180 180 181 181 #define HP_SDC_CMD_SET_IM 0x40 /* 010xxxxx == set irq mask */ 182 182 183 - /* The documents provided do not explicitly state that all registers betweem 183 + /* The documents provided do not explicitly state that all registers between 184 184 * 0x01 and 0x1f inclusive can be read by sending their register index as a 185 185 * command, but this is implied and appears to be the case. 186 186 */
+3 -2
include/linux/of_device.h
··· 101 101 } 102 102 103 103 static inline int of_dma_configure_id(struct device *dev, 104 - struct device_node *np, 105 - bool force_dma) 104 + struct device_node *np, 105 + bool force_dma, 106 + const u32 *id) 106 107 { 107 108 return 0; 108 109 }
+3
include/linux/pci_ids.h
··· 2079 2079 #define PCI_DEVICE_ID_ICE_1712 0x1712 2080 2080 #define PCI_DEVICE_ID_VT1724 0x1724 2081 2081 2082 + #define PCI_VENDOR_ID_MICROSOFT 0x1414 2083 + #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353 2084 + 2082 2085 #define PCI_VENDOR_ID_OXSEMI 0x1415 2083 2086 #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 2084 2087 #define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000
+2 -2
include/linux/scmi_protocol.h
··· 84 84 struct scmi_clk_proto_ops { 85 85 int (*count_get)(const struct scmi_protocol_handle *ph); 86 86 87 - const struct scmi_clock_info *(*info_get) 87 + const struct scmi_clock_info __must_check *(*info_get) 88 88 (const struct scmi_protocol_handle *ph, u32 clk_id); 89 89 int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id, 90 90 u64 *rate); ··· 466 466 */ 467 467 struct scmi_sensor_proto_ops { 468 468 int (*count_get)(const struct scmi_protocol_handle *ph); 469 - const struct scmi_sensor_info *(*info_get) 469 + const struct scmi_sensor_info __must_check *(*info_get) 470 470 (const struct scmi_protocol_handle *ph, u32 sensor_id); 471 471 int (*trip_point_config)(const struct scmi_protocol_handle *ph, 472 472 u32 sensor_id, u8 trip_id, u64 trip_value);
+17
include/linux/serial_core.h
··· 624 624 /* number of characters left in xmit buffer before we ask for more */ 625 625 #define WAKEUP_CHARS 256 626 626 627 + /** 628 + * uart_xmit_advance - Advance xmit buffer and account Tx'ed chars 629 + * @up: uart_port structure describing the port 630 + * @chars: number of characters sent 631 + * 632 + * This function advances the tail of circular xmit buffer by the number of 633 + * @chars transmitted and handles accounting of transmitted bytes (into 634 + * @up's icount.tx). 635 + */ 636 + static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars) 637 + { 638 + struct circ_buf *xmit = &up->state->xmit; 639 + 640 + xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1); 641 + up->icount.tx += chars; 642 + } 643 + 627 644 struct module; 628 645 struct tty_driver; 629 646
-2
include/net/bluetooth/hci_sock.h
··· 124 124 __u16 acl_pkts; 125 125 __u16 sco_mtu; 126 126 __u16 sco_pkts; 127 - __u16 iso_mtu; 128 - __u16 iso_pkts; 129 127 130 128 struct hci_dev_stats stat; 131 129 };
-2
include/net/bond_3ad.h
··· 15 15 #define PKT_TYPE_LACPDU cpu_to_be16(ETH_P_SLOW) 16 16 #define AD_TIMER_INTERVAL 100 /*msec*/ 17 17 18 - #define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} 19 - 20 18 #define AD_LACP_SLOW 0 21 19 #define AD_LACP_FAST 1 22 20
+3
include/net/bonding.h
··· 786 786 /* exported from bond_sysfs_slave.c */ 787 787 extern const struct sysfs_ops slave_sysfs_ops; 788 788 789 + /* exported from bond_3ad.c */ 790 + extern const u8 lacpdu_mcast_addr[]; 791 + 789 792 static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *skb) 790 793 { 791 794 dev_core_stats_tx_dropped_inc(dev);
+37
include/net/ieee802154_netdev.h
··· 15 15 #ifndef IEEE802154_NETDEVICE_H 16 16 #define IEEE802154_NETDEVICE_H 17 17 18 + #define IEEE802154_REQUIRED_SIZE(struct_type, member) \ 19 + (offsetof(typeof(struct_type), member) + \ 20 + sizeof(((typeof(struct_type) *)(NULL))->member)) 21 + 22 + #define IEEE802154_ADDR_OFFSET \ 23 + offsetof(typeof(struct sockaddr_ieee802154), addr) 24 + 25 + #define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \ 26 + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type)) 27 + 28 + #define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \ 29 + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr)) 30 + 31 + #define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \ 32 + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr)) 33 + 18 34 #include <net/af_ieee802154.h> 19 35 #include <linux/netdevice.h> 20 36 #include <linux/skbuff.h> ··· 179 163 u64 temp = swab64((__force u64)addr); 180 164 181 165 memcpy(raw, &temp, IEEE802154_ADDR_LEN); 166 + } 167 + 168 + static inline int 169 + ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) 170 + { 171 + struct ieee802154_addr_sa *sa; 172 + 173 + sa = &daddr->addr; 174 + if (len < IEEE802154_MIN_NAMELEN) 175 + return -EINVAL; 176 + switch (sa->addr_type) { 177 + case IEEE802154_ADDR_SHORT: 178 + if (len < IEEE802154_NAMELEN_SHORT) 179 + return -EINVAL; 180 + break; 181 + case IEEE802154_ADDR_LONG: 182 + if (len < IEEE802154_NAMELEN_LONG) 183 + return -EINVAL; 184 + break; 185 + } 186 + return 0; 182 187 } 183 188 184 189 static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a,
+15 -15
include/trace/events/scmi.h
··· 27 27 __entry->val2 = val2; 28 28 ), 29 29 30 - TP_printk("[0x%02X]:[0x%02X]:[%08X]:%u:%u", 31 - __entry->protocol_id, __entry->msg_id, 32 - __entry->res_id, __entry->val1, __entry->val2) 30 + TP_printk("pt=%02X msg_id=%02X res_id:%u vals=%u:%u", 31 + __entry->protocol_id, __entry->msg_id, 32 + __entry->res_id, __entry->val1, __entry->val2) 33 33 ); 34 34 35 35 TRACE_EVENT(scmi_xfer_begin, ··· 53 53 __entry->poll = poll; 54 54 ), 55 55 56 - TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u poll=%u", 57 - __entry->transfer_id, __entry->msg_id, __entry->protocol_id, 58 - __entry->seq, __entry->poll) 56 + TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X poll=%u", 57 + __entry->protocol_id, __entry->msg_id, __entry->seq, 58 + __entry->transfer_id, __entry->poll) 59 59 ); 60 60 61 61 TRACE_EVENT(scmi_xfer_response_wait, ··· 81 81 __entry->poll = poll; 82 82 ), 83 83 84 - TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u tmo_ms=%u poll=%u", 85 - __entry->transfer_id, __entry->msg_id, __entry->protocol_id, 86 - __entry->seq, __entry->timeout, __entry->poll) 84 + TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X tmo_ms=%u poll=%u", 85 + __entry->protocol_id, __entry->msg_id, __entry->seq, 86 + __entry->transfer_id, __entry->timeout, __entry->poll) 87 87 ); 88 88 89 89 TRACE_EVENT(scmi_xfer_end, ··· 107 107 __entry->status = status; 108 108 ), 109 109 110 - TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u status=%d", 111 - __entry->transfer_id, __entry->msg_id, __entry->protocol_id, 112 - __entry->seq, __entry->status) 110 + TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X s=%d", 111 + __entry->protocol_id, __entry->msg_id, __entry->seq, 112 + __entry->transfer_id, __entry->status) 113 113 ); 114 114 115 115 TRACE_EVENT(scmi_rx_done, ··· 133 133 __entry->msg_type = msg_type; 134 134 ), 135 135 136 - TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u msg_type=%u", 137 - __entry->transfer_id, __entry->msg_id, __entry->protocol_id, 138 - __entry->seq, __entry->msg_type) 136 + TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X msg_type=%u", 137 + __entry->protocol_id, __entry->msg_id, __entry->seq, 138 + __entry->transfer_id, __entry->msg_type) 139 139 ); 140 140 141 141 TRACE_EVENT(scmi_msg_dump,
+3
io_uring/io_uring.c
··· 2648 2648 io_kill_timeouts(ctx, NULL, true); 2649 2649 /* if we failed setting up the ctx, we might not have any rings */ 2650 2650 io_iopoll_try_reap_events(ctx); 2651 + /* drop cached put refs after potentially doing completions */ 2652 + if (current->io_uring) 2653 + io_uring_drop_tctx_refs(current); 2651 2654 } 2652 2655 2653 2656 INIT_WORK(&ctx->exit_work, io_ring_exit_work);
+2 -1
io_uring/msg_ring.c
··· 165 165 req_set_fail(req); 166 166 io_req_set_res(req, ret, 0); 167 167 /* put file to avoid an attempt to IOPOLL the req */ 168 - io_put_file(req->file); 168 + if (!(req->flags & REQ_F_FIXED_FILE)) 169 + io_put_file(req->file); 169 170 req->file = NULL; 170 171 return IOU_OK; 171 172 }
+9 -9
io_uring/net.c
··· 905 905 if (zc->flags & ~(IORING_RECVSEND_POLL_FIRST | 906 906 IORING_RECVSEND_FIXED_BUF)) 907 907 return -EINVAL; 908 - if (zc->flags & IORING_RECVSEND_FIXED_BUF) { 909 - unsigned idx = READ_ONCE(sqe->buf_index); 910 - 911 - if (unlikely(idx >= ctx->nr_user_bufs)) 912 - return -EFAULT; 913 - idx = array_index_nospec(idx, ctx->nr_user_bufs); 914 - req->imu = READ_ONCE(ctx->user_bufs[idx]); 915 - io_req_set_rsrc_node(req, ctx, 0); 916 - } 917 908 notif = zc->notif = io_alloc_notif(ctx); 918 909 if (!notif) 919 910 return -ENOMEM; ··· 912 921 notif->cqe.res = 0; 913 922 notif->cqe.flags = IORING_CQE_F_NOTIF; 914 923 req->flags |= REQ_F_NEED_CLEANUP; 924 + if (zc->flags & IORING_RECVSEND_FIXED_BUF) { 925 + unsigned idx = READ_ONCE(sqe->buf_index); 926 + 927 + if (unlikely(idx >= ctx->nr_user_bufs)) 928 + return -EFAULT; 929 + idx = array_index_nospec(idx, ctx->nr_user_bufs); 930 + req->imu = READ_ONCE(ctx->user_bufs[idx]); 931 + io_req_set_rsrc_node(notif, ctx, 0); 932 + } 915 933 916 934 zc->buf = u64_to_user_ptr(READ_ONCE(sqe->addr)); 917 935 zc->len = READ_ONCE(sqe->len);
+1 -1
io_uring/opdef.c
··· 471 471 .prep_async = io_uring_cmd_prep_async, 472 472 }, 473 473 [IORING_OP_SEND_ZC] = { 474 - .name = "SENDZC_NOTIF", 474 + .name = "SEND_ZC", 475 475 .needs_file = 1, 476 476 .unbound_nonreg_file = 1, 477 477 .pollout = 1,
+1 -1
io_uring/rw.c
··· 206 206 return false; 207 207 } 208 208 209 - static inline unsigned io_fixup_rw_res(struct io_kiocb *req, unsigned res) 209 + static inline int io_fixup_rw_res(struct io_kiocb *req, long res) 210 210 { 211 211 struct io_async_rw *io = req->async_data; 212 212
+4 -1
kernel/cgroup/cgroup.c
··· 6049 6049 if (!kn) 6050 6050 goto out; 6051 6051 6052 + if (kernfs_type(kn) != KERNFS_DIR) 6053 + goto put; 6054 + 6052 6055 rcu_read_lock(); 6053 6056 6054 6057 cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv); ··· 6059 6056 cgrp = NULL; 6060 6057 6061 6058 rcu_read_unlock(); 6062 - 6059 + put: 6063 6060 kernfs_put(kn); 6064 6061 out: 6065 6062 return cgrp;
+1 -4
kernel/fork.c
··· 2047 2047 /* 2048 2048 * If the new process will be in a different time namespace 2049 2049 * do not allow it to share VM or a thread group with the forking task. 2050 - * 2051 - * On vfork, the child process enters the target time namespace only 2052 - * after exec. 2053 2050 */ 2054 - if ((clone_flags & (CLONE_VM | CLONE_VFORK)) == CLONE_VM) { 2051 + if (clone_flags & (CLONE_THREAD | CLONE_VM)) { 2055 2052 if (nsp->time_ns != nsp->time_ns_for_children) 2056 2053 return ERR_PTR(-EINVAL); 2057 2054 }
+1 -2
kernel/nsproxy.c
··· 179 179 if (IS_ERR(new_ns)) 180 180 return PTR_ERR(new_ns); 181 181 182 - if ((flags & CLONE_VM) == 0) 183 - timens_on_fork(new_ns, tsk); 182 + timens_on_fork(new_ns, tsk); 184 183 185 184 tsk->nsproxy = new_ns; 186 185 return 0;
+2 -4
kernel/workqueue.c
··· 3066 3066 if (WARN_ON(!work->func)) 3067 3067 return false; 3068 3068 3069 - if (!from_cancel) { 3070 - lock_map_acquire(&work->lockdep_map); 3071 - lock_map_release(&work->lockdep_map); 3072 - } 3069 + lock_map_acquire(&work->lockdep_map); 3070 + lock_map_release(&work->lockdep_map); 3073 3071 3074 3072 if (start_flush_work(work, &barr, from_cancel)) { 3075 3073 wait_for_completion(&barr.done);
+3 -1
lib/Kconfig.debug
··· 264 264 config DEBUG_INFO_DWARF4 265 265 bool "Generate DWARF Version 4 debuginfo" 266 266 select DEBUG_INFO 267 + depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) 267 268 help 268 - Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+. 269 + Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 270 + if using clang without clang's integrated assembler, and gdb 7.0+. 269 271 270 272 If you have consumers of DWARF debug info that are not ready for 271 273 newer revisions of DWARF, you may wish to choose this or have your
+4 -1
mm/slab_common.c
··· 475 475 void kmem_cache_destroy(struct kmem_cache *s) 476 476 { 477 477 int refcnt; 478 + bool rcu_set; 478 479 479 480 if (unlikely(!s) || !kasan_check_byte(s)) 480 481 return; 481 482 482 483 cpus_read_lock(); 483 484 mutex_lock(&slab_mutex); 485 + 486 + rcu_set = s->flags & SLAB_TYPESAFE_BY_RCU; 484 487 485 488 refcnt = --s->refcount; 486 489 if (refcnt) ··· 495 492 out_unlock: 496 493 mutex_unlock(&slab_mutex); 497 494 cpus_read_unlock(); 498 - if (!refcnt && !(s->flags & SLAB_TYPESAFE_BY_RCU)) 495 + if (!refcnt && !rcu_set) 499 496 kmem_cache_release(s); 500 497 } 501 498 EXPORT_SYMBOL(kmem_cache_destroy);
+16 -2
mm/slub.c
··· 310 310 */ 311 311 static nodemask_t slab_nodes; 312 312 313 + /* 314 + * Workqueue used for flush_cpu_slab(). 315 + */ 316 + static struct workqueue_struct *flushwq; 317 + 313 318 /******************************************************************** 314 319 * Core slab cache functions 315 320 *******************************************************************/ ··· 2735 2730 INIT_WORK(&sfw->work, flush_cpu_slab); 2736 2731 sfw->skip = false; 2737 2732 sfw->s = s; 2738 - schedule_work_on(cpu, &sfw->work); 2733 + queue_work_on(cpu, flushwq, &sfw->work); 2739 2734 } 2740 2735 2741 2736 for_each_online_cpu(cpu) { ··· 4863 4858 4864 4859 void __init kmem_cache_init_late(void) 4865 4860 { 4861 + flushwq = alloc_workqueue("slub_flushwq", WQ_MEM_RECLAIM, 0); 4862 + WARN_ON(!flushwq); 4866 4863 } 4867 4864 4868 4865 struct kmem_cache * ··· 4933 4926 /* Honor the call site pointer we received. */ 4934 4927 trace_kmalloc(caller, ret, s, size, s->size, gfpflags); 4935 4928 4929 + ret = kasan_kmalloc(s, ret, size, gfpflags); 4930 + 4936 4931 return ret; 4937 4932 } 4938 4933 EXPORT_SYMBOL(__kmalloc_track_caller); ··· 4965 4956 4966 4957 /* Honor the call site pointer we received. */ 4967 4958 trace_kmalloc_node(caller, ret, s, size, s->size, gfpflags, node); 4959 + 4960 + ret = kasan_kmalloc(s, ret, size, gfpflags); 4968 4961 4969 4962 return ret; 4970 4963 } ··· 5901 5890 char *name = kmalloc(ID_STR_LENGTH, GFP_KERNEL); 5902 5891 char *p = name; 5903 5892 5904 - BUG_ON(!name); 5893 + if (!name) 5894 + return ERR_PTR(-ENOMEM); 5905 5895 5906 5896 *p++ = ':'; 5907 5897 /* ··· 5960 5948 * for the symlinks. 5961 5949 */ 5962 5950 name = create_unique_id(s); 5951 + if (IS_ERR(name)) 5952 + return PTR_ERR(name); 5963 5953 } 5964 5954 5965 5955 s->kobj.kset = kset;
+4
net/batman-adv/hard-interface.c
··· 10 10 #include <linux/atomic.h> 11 11 #include <linux/byteorder/generic.h> 12 12 #include <linux/container_of.h> 13 + #include <linux/errno.h> 13 14 #include <linux/gfp.h> 14 15 #include <linux/if.h> 15 16 #include <linux/if_arp.h> ··· 700 699 __be16 ethertype = htons(ETH_P_BATMAN); 701 700 int max_header_len = batadv_max_header_len(); 702 701 int ret; 702 + 703 + if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len) 704 + return -EINVAL; 703 705 704 706 if (hard_iface->if_status != BATADV_IF_NOT_IN_USE) 705 707 goto out;
+3 -1
net/bridge/netfilter/ebtables.c
··· 1040 1040 goto free_iterate; 1041 1041 } 1042 1042 1043 - if (repl->valid_hooks != t->valid_hooks) 1043 + if (repl->valid_hooks != t->valid_hooks) { 1044 + ret = -EINVAL; 1044 1045 goto free_unlock; 1046 + } 1045 1047 1046 1048 if (repl->num_counters && repl->num_counters != t->private->nentries) { 1047 1049 ret = -EINVAL;
+1
net/compat.c
··· 52 52 kmsg->msg_namelen = sizeof(struct sockaddr_storage); 53 53 54 54 kmsg->msg_control_is_user = true; 55 + kmsg->msg_get_inq = 0; 55 56 kmsg->msg_control_user = compat_ptr(msg->msg_control); 56 57 kmsg->msg_controllen = msg->msg_controllen; 57 58
+2 -3
net/core/flow_dissector.c
··· 1611 1611 1612 1612 switch (keys->control.addr_type) { 1613 1613 case FLOW_DISSECTOR_KEY_IPV4_ADDRS: 1614 - addr_diff = (__force u32)keys->addrs.v4addrs.dst - 1615 - (__force u32)keys->addrs.v4addrs.src; 1616 - if (addr_diff < 0) 1614 + if ((__force u32)keys->addrs.v4addrs.dst < 1615 + (__force u32)keys->addrs.v4addrs.src) 1617 1616 swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst); 1618 1617 1619 1618 if ((__force u16)keys->ports.dst <
+23 -19
net/ieee802154/socket.c
··· 200 200 int err = 0; 201 201 struct net_device *dev = NULL; 202 202 203 - if (len < sizeof(*uaddr)) 204 - return -EINVAL; 203 + err = ieee802154_sockaddr_check_size(uaddr, len); 204 + if (err < 0) 205 + return err; 205 206 206 207 uaddr = (struct sockaddr_ieee802154 *)_uaddr; 207 208 if (uaddr->family != AF_IEEE802154) ··· 494 493 495 494 ro->bound = 0; 496 495 497 - if (len < sizeof(*addr)) 496 + err = ieee802154_sockaddr_check_size(addr, len); 497 + if (err < 0) 498 498 goto out; 499 499 500 500 if (addr->family != AF_IEEE802154) ··· 566 564 struct dgram_sock *ro = dgram_sk(sk); 567 565 int err = 0; 568 566 569 - if (len < sizeof(*addr)) 570 - return -EINVAL; 567 + err = ieee802154_sockaddr_check_size(addr, len); 568 + if (err < 0) 569 + return err; 571 570 572 571 if (addr->family != AF_IEEE802154) 573 572 return -EINVAL; ··· 607 604 struct ieee802154_mac_cb *cb; 608 605 struct dgram_sock *ro = dgram_sk(sk); 609 606 struct ieee802154_addr dst_addr; 607 + DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); 610 608 int hlen, tlen; 611 609 int err; 612 610 ··· 616 612 return -EOPNOTSUPP; 617 613 } 618 614 619 - if (!ro->connected && !msg->msg_name) 620 - return -EDESTADDRREQ; 621 - else if (ro->connected && msg->msg_name) 622 - return -EISCONN; 615 + if (msg->msg_name) { 616 + if (ro->connected) 617 + return -EISCONN; 618 + if (msg->msg_namelen < IEEE802154_MIN_NAMELEN) 619 + return -EINVAL; 620 + err = ieee802154_sockaddr_check_size(daddr, msg->msg_namelen); 621 + if (err < 0) 622 + return err; 623 + ieee802154_addr_from_sa(&dst_addr, &daddr->addr); 624 + } else { 625 + if (!ro->connected) 626 + return -EDESTADDRREQ; 627 + dst_addr = ro->dst_addr; 628 + } 623 629 624 630 if (!ro->bound) 625 631 dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); ··· 665 651 cb = mac_cb_init(skb); 666 652 cb->type = IEEE802154_FC_TYPE_DATA; 667 653 cb->ackreq = ro->want_ack; 668 - 669 - if (msg->msg_name) { 670 - DECLARE_SOCKADDR(struct sockaddr_ieee802154*, 671 - daddr, msg->msg_name); 672 - 673 - ieee802154_addr_from_sa(&dst_addr, &daddr->addr); 674 - } else { 675 - dst_addr = ro->dst_addr; 676 - } 677 - 678 654 cb->secen = ro->secen; 679 655 cb->secen_override = ro->secen_override; 680 656 cb->seclevel = ro->seclevel;
+2
net/ipv4/ipmr.c
··· 1004 1004 1005 1005 rtnl_unicast(skb, net, NETLINK_CB(skb).portid); 1006 1006 } else { 1007 + rcu_read_lock(); 1007 1008 ip_mr_forward(net, mrt, skb->dev, skb, c, 0); 1009 + rcu_read_unlock(); 1008 1010 } 1009 1011 } 1010 1012 }
+19 -10
net/ipv4/tcp.c
··· 1761 1761 if (sk->sk_state == TCP_LISTEN) 1762 1762 return -ENOTCONN; 1763 1763 1764 - skb = tcp_recv_skb(sk, seq, &offset); 1765 - if (!skb) 1766 - return 0; 1764 + while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) { 1765 + u8 tcp_flags; 1766 + int used; 1767 1767 1768 - __skb_unlink(skb, &sk->sk_receive_queue); 1769 - WARN_ON(!skb_set_owner_sk_safe(skb, sk)); 1770 - copied = recv_actor(sk, skb); 1771 - if (copied >= 0) { 1772 - seq += copied; 1773 - if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 1768 + __skb_unlink(skb, &sk->sk_receive_queue); 1769 + WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk)); 1770 + tcp_flags = TCP_SKB_CB(skb)->tcp_flags; 1771 + used = recv_actor(sk, skb); 1772 + consume_skb(skb); 1773 + if (used < 0) { 1774 + if (!copied) 1775 + copied = used; 1776 + break; 1777 + } 1778 + seq += used; 1779 + copied += used; 1780 + 1781 + if (tcp_flags & TCPHDR_FIN) { 1774 1782 ++seq; 1783 + break; 1784 + } 1775 1785 } 1776 - consume_skb(skb); 1777 1786 WRITE_ONCE(tp->copied_seq, seq); 1778 1787 1779 1788 tcp_rcv_space_adjust(sk);
+1 -1
net/ipv4/udp.c
··· 1821 1821 continue; 1822 1822 } 1823 1823 1824 - WARN_ON(!skb_set_owner_sk_safe(skb, sk)); 1824 + WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk)); 1825 1825 used = recv_actor(sk, skb); 1826 1826 if (used <= 0) { 1827 1827 if (!copied)
+2 -2
net/ipv6/af_inet6.c
··· 1070 1070 for (r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) 1071 1071 INIT_LIST_HEAD(r); 1072 1072 1073 + raw_hashinfo_init(&raw_v6_hashinfo); 1074 + 1073 1075 if (disable_ipv6_mod) { 1074 1076 pr_info("Loaded, but administratively disabled, reboot required to enable\n"); 1075 1077 goto out; 1076 1078 } 1077 - 1078 - raw_hashinfo_init(&raw_v6_hashinfo); 1079 1079 1080 1080 err = proto_register(&tcpv6_prot, 1); 1081 1081 if (err)
+4 -1
net/ipv6/ip6mr.c
··· 1028 1028 ((struct nlmsgerr *)nlmsg_data(nlh))->error = -EMSGSIZE; 1029 1029 } 1030 1030 rtnl_unicast(skb, net, NETLINK_CB(skb).portid); 1031 - } else 1031 + } else { 1032 + rcu_read_lock(); 1032 1033 ip6_mr_forward(net, mrt, skb->dev, skb, c); 1034 + rcu_read_unlock(); 1035 + } 1033 1036 } 1034 1037 } 1035 1038
+7 -1
net/mptcp/protocol.c
··· 150 150 MPTCP_SKB_CB(from)->map_seq, MPTCP_SKB_CB(to)->map_seq, 151 151 to->len, MPTCP_SKB_CB(from)->end_seq); 152 152 MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; 153 - kfree_skb_partial(from, fragstolen); 153 + 154 + /* note the fwd memory can reach a negative value after accounting 155 + * for the delta, but the later skb free will restore a non 156 + * negative one 157 + */ 154 158 atomic_add(delta, &sk->sk_rmem_alloc); 155 159 mptcp_rmem_charge(sk, delta); 160 + kfree_skb_partial(from, fragstolen); 161 + 156 162 return true; 157 163 } 158 164
+4 -2
net/netfilter/nf_conntrack_ftp.c
··· 33 33 MODULE_DESCRIPTION("ftp connection tracking helper"); 34 34 MODULE_ALIAS("ip_conntrack_ftp"); 35 35 MODULE_ALIAS_NFCT_HELPER(HELPER_NAME); 36 + static DEFINE_SPINLOCK(nf_ftp_lock); 36 37 37 38 #define MAX_PORTS 8 38 39 static u_int16_t ports[MAX_PORTS]; ··· 410 409 } 411 410 datalen = skb->len - dataoff; 412 411 413 - spin_lock_bh(&ct->lock); 412 + /* seqadj (nat) uses ct->lock internally, nf_nat_ftp would cause deadlock */ 413 + spin_lock_bh(&nf_ftp_lock); 414 414 fb_ptr = skb->data + dataoff; 415 415 416 416 ends_in_nl = (fb_ptr[datalen - 1] == '\n'); ··· 540 538 if (ends_in_nl) 541 539 update_nl_seq(ct, seq, ct_ftp_info, dir, skb); 542 540 out: 543 - spin_unlock_bh(&ct->lock); 541 + spin_unlock_bh(&nf_ftp_lock); 544 542 return ret; 545 543 } 546 544
+28 -6
net/netfilter/nf_conntrack_irc.c
··· 157 157 data = ib_ptr; 158 158 data_limit = ib_ptr + datalen; 159 159 160 - /* strlen("\1DCC SENT t AAAAAAAA P\1\n")=24 161 - * 5+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=14 */ 162 - while (data < data_limit - (19 + MINMATCHLEN)) { 163 - if (memcmp(data, "\1DCC ", 5)) { 160 + /* Skip any whitespace */ 161 + while (data < data_limit - 10) { 162 + if (*data == ' ' || *data == '\r' || *data == '\n') 163 + data++; 164 + else 165 + break; 166 + } 167 + 168 + /* strlen("PRIVMSG x ")=10 */ 169 + if (data < data_limit - 10) { 170 + if (strncasecmp("PRIVMSG ", data, 8)) 171 + goto out; 172 + data += 8; 173 + } 174 + 175 + /* strlen(" :\1DCC SENT t AAAAAAAA P\1\n")=26 176 + * 7+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=26 177 + */ 178 + while (data < data_limit - (21 + MINMATCHLEN)) { 179 + /* Find first " :", the start of message */ 180 + if (memcmp(data, " :", 2)) { 164 181 data++; 165 182 continue; 166 183 } 184 + data += 2; 185 + 186 + /* then check that place only for the DCC command */ 187 + if (memcmp(data, "\1DCC ", 5)) 188 + goto out; 167 189 data += 5; 168 - /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ 190 + /* we have at least (21+MINMATCHLEN)-(2+5) bytes valid data left */ 169 191 170 192 iph = ip_hdr(skb); 171 193 pr_debug("DCC found in master %pI4:%u %pI4:%u\n", ··· 203 181 pr_debug("DCC %s detected\n", dccprotos[i]); 204 182 205 183 /* we have at least 206 - * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid 184 + * (21+MINMATCHLEN)-7-dccprotos[i].matchlen bytes valid 207 185 * data left (== 14/13 bytes) */ 208 186 if (parse_dcc(data, data_limit, &dcc_ip, 209 187 &dcc_port, &addr_beg_p, &addr_end_p)) {
+2 -2
net/netfilter/nf_conntrack_sip.c
··· 477 477 return ret; 478 478 if (ret == 0) 479 479 break; 480 - dataoff += *matchoff; 480 + dataoff = *matchoff; 481 481 } 482 482 *in_header = 0; 483 483 } ··· 489 489 break; 490 490 if (ret == 0) 491 491 return ret; 492 - dataoff += *matchoff; 492 + dataoff = *matchoff; 493 493 } 494 494 495 495 if (in_header)
+4 -4
net/netfilter/nf_tables_api.c
··· 2197 2197 struct netlink_ext_ack *extack) 2198 2198 { 2199 2199 const struct nlattr * const *nla = ctx->nla; 2200 - struct nft_stats __percpu *stats = NULL; 2201 2200 struct nft_table *table = ctx->table; 2202 2201 struct nft_base_chain *basechain; 2203 2202 struct net *net = ctx->net; ··· 2211 2212 return -EOVERFLOW; 2212 2213 2213 2214 if (nla[NFTA_CHAIN_HOOK]) { 2215 + struct nft_stats __percpu *stats = NULL; 2214 2216 struct nft_chain_hook hook; 2215 2217 2216 2218 if (flags & NFT_CHAIN_BINDING) ··· 2243 2243 if (err < 0) { 2244 2244 nft_chain_release_hook(&hook); 2245 2245 kfree(basechain); 2246 + free_percpu(stats); 2246 2247 return err; 2247 2248 } 2249 + if (stats) 2250 + static_branch_inc(&nft_counters_enabled); 2248 2251 } else { 2249 2252 if (flags & NFT_CHAIN_BASE) 2250 2253 return -EINVAL; ··· 2321 2318 nft_trans_destroy(trans); 2322 2319 goto err_unregister_hook; 2323 2320 } 2324 - 2325 - if (stats) 2326 - static_branch_inc(&nft_counters_enabled); 2327 2321 2328 2322 table->use++; 2329 2323
+1
net/sched/cls_api.c
··· 2137 2137 } 2138 2138 2139 2139 if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { 2140 + tfilter_put(tp, fh); 2140 2141 NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); 2141 2142 err = -EINVAL; 2142 2143 goto errout;
+11 -7
net/sched/sch_taprio.c
··· 67 67 u32 flags; 68 68 enum tk_offsets tk_offset; 69 69 int clockid; 70 + bool offloaded; 70 71 atomic64_t picos_per_byte; /* Using picoseconds because for 10Gbps+ 71 72 * speeds it's sub-nanoseconds per byte 72 73 */ ··· 1280 1279 goto done; 1281 1280 } 1282 1281 1282 + q->offloaded = true; 1283 + 1283 1284 done: 1284 1285 taprio_offload_free(offload); 1285 1286 ··· 1296 1293 struct tc_taprio_qopt_offload *offload; 1297 1294 int err; 1298 1295 1299 - if (!FULL_OFFLOAD_IS_ENABLED(q->flags)) 1296 + if (!q->offloaded) 1300 1297 return 0; 1301 - 1302 - if (!ops->ndo_setup_tc) 1303 - return -EOPNOTSUPP; 1304 1298 1305 1299 offload = taprio_offload_alloc(0); 1306 1300 if (!offload) { ··· 1313 1313 "Device failed to disable offload"); 1314 1314 goto out; 1315 1315 } 1316 + 1317 + q->offloaded = false; 1316 1318 1317 1319 out: 1318 1320 taprio_offload_free(offload); ··· 1951 1949 1952 1950 static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl) 1953 1951 { 1954 - struct netdev_queue *dev_queue = taprio_queue_get(sch, cl); 1952 + struct taprio_sched *q = qdisc_priv(sch); 1953 + struct net_device *dev = qdisc_dev(sch); 1954 + unsigned int ntx = cl - 1; 1955 1955 1956 - if (!dev_queue) 1956 + if (ntx >= dev->num_tx_queues) 1957 1957 return NULL; 1958 1958 1959 - return dev_queue->qdisc_sleeping; 1959 + return q->qdiscs[ntx]; 1960 1960 } 1961 1961 1962 1962 static unsigned long taprio_find(struct Qdisc *sch, u32 classid)
+4 -1
net/smc/smc_core.c
··· 2239 2239 static int smcr_buf_map_usable_links(struct smc_link_group *lgr, 2240 2240 struct smc_buf_desc *buf_desc, bool is_rmb) 2241 2241 { 2242 - int i, rc = 0; 2242 + int i, rc = 0, cnt = 0; 2243 2243 2244 2244 /* protect against parallel link reconfiguration */ 2245 2245 mutex_lock(&lgr->llc_conf_mutex); ··· 2252 2252 rc = -ENOMEM; 2253 2253 goto out; 2254 2254 } 2255 + cnt++; 2255 2256 } 2256 2257 out: 2257 2258 mutex_unlock(&lgr->llc_conf_mutex); 2259 + if (!rc && !cnt) 2260 + rc = -EINVAL; 2258 2261 return rc; 2259 2262 } 2260 2263
+3
net/sunrpc/clnt.c
··· 2873 2873 2874 2874 task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC, 2875 2875 &rpc_cb_add_xprt_call_ops, data); 2876 + if (IS_ERR(task)) 2877 + return PTR_ERR(task); 2878 + 2876 2879 data->xps->xps_nunique_destaddr_xprts++; 2877 2880 rpc_put_task(task); 2878 2881 success:
+4 -4
net/sunrpc/xprt.c
··· 1179 1179 { 1180 1180 struct rpc_rqst *req = task->tk_rqstp; 1181 1181 1182 - if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) { 1182 + if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) 1183 1183 xprt_request_rb_remove(req->rq_xprt, req); 1184 - xdr_free_bvec(&req->rq_rcv_buf); 1185 - req->rq_private_buf.bvec = NULL; 1186 - } 1187 1184 } 1188 1185 1189 1186 /** ··· 1218 1221 1219 1222 xprt->stat.recvs++; 1220 1223 1224 + xdr_free_bvec(&req->rq_rcv_buf); 1225 + req->rq_private_buf.bvec = NULL; 1221 1226 req->rq_private_buf.len = copied; 1222 1227 /* Ensure all writes are done before we update */ 1223 1228 /* req->rq_reply_bytes_recvd */ ··· 1452 1453 xprt_request_dequeue_transmit_locked(task); 1453 1454 xprt_request_dequeue_receive_locked(task); 1454 1455 spin_unlock(&xprt->queue_lock); 1456 + xdr_free_bvec(&req->rq_rcv_buf); 1455 1457 } 1456 1458 } 1457 1459
+10 -11
scripts/Makefile.debug
··· 1 1 DEBUG_CFLAGS := 2 + debug-flags-y := -g 2 3 3 4 ifdef CONFIG_DEBUG_INFO_SPLIT 4 5 DEBUG_CFLAGS += -gsplit-dwarf 5 - else 6 - DEBUG_CFLAGS += -g 7 6 endif 8 7 9 - ifndef CONFIG_AS_IS_LLVM 10 - KBUILD_AFLAGS += -Wa,-gdwarf-2 8 + debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4 9 + debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5 10 + ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) 11 + # Clang does not pass -g or -gdwarf-* option down to GAS. 12 + # Add -Wa, prefix to explicitly specify the flags. 13 + KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y)) 11 14 endif 12 - 13 - ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT 14 - dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 15 - dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5 16 - DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) 17 - endif 15 + DEBUG_CFLAGS += $(debug-flags-y) 16 + KBUILD_AFLAGS += $(debug-flags-y) 18 17 19 18 ifdef CONFIG_DEBUG_INFO_REDUCED 20 19 DEBUG_CFLAGS += -fno-var-tracking ··· 28 29 KBUILD_LDFLAGS += --compress-debug-sections=zlib 29 30 endif 30 31 31 - KBUILD_CFLAGS += $(DEBUG_CFLAGS) 32 + KBUILD_CFLAGS += $(DEBUG_CFLAGS) 32 33 export DEBUG_CFLAGS
-1
scripts/clang-tools/run-clang-tools.py
··· 12 12 import argparse 13 13 import json 14 14 import multiprocessing 15 - import os 16 15 import subprocess 17 16 import sys 18 17
-1
scripts/kconfig/lkc.h
··· 98 98 bool menu_is_visible(struct menu *menu); 99 99 bool menu_has_prompt(struct menu *menu); 100 100 const char *menu_get_prompt(struct menu *menu); 101 - struct menu *menu_get_root_menu(struct menu *menu); 102 101 struct menu *menu_get_parent_menu(struct menu *menu); 103 102 bool menu_has_help(struct menu *menu); 104 103 const char *menu_get_help(struct menu *menu);
-5
scripts/kconfig/menu.c
··· 661 661 return NULL; 662 662 } 663 663 664 - struct menu *menu_get_root_menu(struct menu *menu) 665 - { 666 - return &rootmenu; 667 - } 668 - 669 664 struct menu *menu_get_parent_menu(struct menu *menu) 670 665 { 671 666 enum prop_type type;
+5 -5
sound/core/init.c
··· 178 178 return -ENOMEM; 179 179 180 180 err = snd_card_init(card, parent, idx, xid, module, extra_size); 181 - if (err < 0) { 182 - kfree(card); 183 - return err; 184 - } 181 + if (err < 0) 182 + return err; /* card is freed by error handler */ 185 183 186 184 *card_ret = card; 187 185 return 0; ··· 231 233 card->managed = true; 232 234 err = snd_card_init(card, parent, idx, xid, module, extra_size); 233 235 if (err < 0) { 234 - devres_free(card); 236 + devres_free(card); /* in managed mode, we need to free manually */ 235 237 return err; 236 238 } 237 239 ··· 295 297 mutex_unlock(&snd_card_mutex); 296 298 dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n", 297 299 idx, snd_ecards_limit - 1, err); 300 + if (!card->managed) 301 + kfree(card); /* manually free here, as no destructor called */ 298 302 return err; 299 303 } 300 304 set_bit(idx, snd_cards_lock); /* lock it */
+2 -2
sound/pci/hda/hda_bind.c
··· 157 157 return codec->bus->core.ext_ops->hdev_detach(&codec->core); 158 158 } 159 159 160 - refcount_dec(&codec->pcm_ref); 161 160 snd_hda_codec_disconnect_pcms(codec); 162 161 snd_hda_jack_tbl_disconnect(codec); 163 - wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); 162 + if (!refcount_dec_and_test(&codec->pcm_ref)) 163 + wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); 164 164 snd_power_sync_ref(codec->bus->card); 165 165 166 166 if (codec->patch_ops.free)
+2
sound/pci/hda/hda_intel.c
··· 2550 2550 /* 5 Series/3400 */ 2551 2551 { PCI_DEVICE(0x8086, 0x3b56), 2552 2552 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, 2553 + { PCI_DEVICE(0x8086, 0x3b57), 2554 + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, 2553 2555 /* Poulsbo */ 2554 2556 { PCI_DEVICE(0x8086, 0x811b), 2555 2557 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE },
+21 -4
sound/pci/hda/patch_hdmi.c
··· 170 170 bool dyn_pcm_no_legacy; 171 171 /* hdmi interrupt trigger control flag for Nvidia codec */ 172 172 bool hdmi_intr_trig_ctrl; 173 + bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */ 174 + 173 175 bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ 174 176 /* 175 177 * Non-generic VIA/NVIDIA specific ··· 681 679 int ca, int active_channels, 682 680 int conn_type) 683 681 { 682 + struct hdmi_spec *spec = codec->spec; 684 683 union audio_infoframe ai; 685 684 686 685 memset(&ai, 0, sizeof(ai)); 687 - if (conn_type == 0) { /* HDMI */ 686 + if ((conn_type == 0) || /* HDMI */ 687 + /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */ 688 + (conn_type == 1 && spec->nv_dp_workaround)) { 688 689 struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi; 689 690 690 - hdmi_ai->type = 0x84; 691 - hdmi_ai->ver = 0x01; 692 - hdmi_ai->len = 0x0a; 691 + if (conn_type == 0) { /* HDMI */ 692 + hdmi_ai->type = 0x84; 693 + hdmi_ai->ver = 0x01; 694 + hdmi_ai->len = 0x0a; 695 + } else {/* Nvidia DP */ 696 + hdmi_ai->type = 0x84; 697 + hdmi_ai->ver = 0x1b; 698 + hdmi_ai->len = 0x11 << 2; 699 + } 693 700 hdmi_ai->CC02_CT47 = active_channels - 1; 694 701 hdmi_ai->CA = ca; 695 702 hdmi_checksum_audio_infoframe(hdmi_ai); ··· 1278 1267 set_bit(pcm_idx, &spec->pcm_in_use); 1279 1268 per_pin = get_pin(spec, pin_idx); 1280 1269 per_pin->cvt_nid = per_cvt->cvt_nid; 1270 + per_pin->silent_stream = false; 1281 1271 hinfo->nid = per_cvt->cvt_nid; 1282 1272 1283 1273 /* flip stripe flag for the assigned stream if supported */ ··· 3629 3617 spec->pcm_playback.rates = SUPPORTED_RATES; 3630 3618 spec->pcm_playback.maxbps = SUPPORTED_MAXBPS; 3631 3619 spec->pcm_playback.formats = SUPPORTED_FORMATS; 3620 + spec->nv_dp_workaround = true; 3632 3621 return 0; 3633 3622 } 3634 3623 ··· 3769 3756 spec->chmap.ops.chmap_cea_alloc_validate_get_type = 3770 3757 nvhdmi_chmap_cea_alloc_validate_get_type; 3771 3758 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; 3759 + spec->nv_dp_workaround = true; 3772 3760 3773 3761 codec->link_down_at_suspend = 1; 3774 3762 ··· 3793 3779 spec->chmap.ops.chmap_cea_alloc_validate_get_type = 3794 3780 nvhdmi_chmap_cea_alloc_validate_get_type; 3795 3781 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; 3782 + spec->nv_dp_workaround = true; 3796 3783 3797 3784 codec->link_down_at_suspend = 1; 3798 3785 ··· 3999 3984 4000 3985 generic_hdmi_init_per_pins(codec); 4001 3986 3987 + codec->depop_delay = 10; 4002 3988 codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; 4003 3989 spec->chmap.ops.chmap_cea_alloc_validate_get_type = 4004 3990 nvhdmi_chmap_cea_alloc_validate_get_type; ··· 4008 3992 spec->chmap.ops.chmap_cea_alloc_validate_get_type = 4009 3993 nvhdmi_chmap_cea_alloc_validate_get_type; 4010 3994 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; 3995 + spec->nv_dp_workaround = true; 4011 3996 4012 3997 return 0; 4013 3998 }
+30 -3
sound/pci/hda/patch_realtek.c
··· 7067 7067 ALC294_FIXUP_ASUS_GU502_HP, 7068 7068 ALC294_FIXUP_ASUS_GU502_PINS, 7069 7069 ALC294_FIXUP_ASUS_GU502_VERBS, 7070 + ALC294_FIXUP_ASUS_G513_PINS, 7071 + ALC285_FIXUP_ASUS_G533Z_PINS, 7070 7072 ALC285_FIXUP_HP_GPIO_LED, 7071 7073 ALC285_FIXUP_HP_MUTE_LED, 7072 7074 ALC236_FIXUP_HP_GPIO_LED, ··· 8408 8406 .type = HDA_FIXUP_FUNC, 8409 8407 .v.func = alc294_fixup_gu502_hp, 8410 8408 }, 8409 + [ALC294_FIXUP_ASUS_G513_PINS] = { 8410 + .type = HDA_FIXUP_PINS, 8411 + .v.pins = (const struct hda_pintbl[]) { 8412 + { 0x19, 0x03a11050 }, /* front HP mic */ 8413 + { 0x1a, 0x03a11c30 }, /* rear external mic */ 8414 + { 0x21, 0x03211420 }, /* front HP out */ 8415 + { } 8416 + }, 8417 + }, 8418 + [ALC285_FIXUP_ASUS_G533Z_PINS] = { 8419 + .type = HDA_FIXUP_PINS, 8420 + .v.pins = (const struct hda_pintbl[]) { 8421 + { 0x14, 0x90170120 }, 8422 + { } 8423 + }, 8424 + .chained = true, 8425 + .chain_id = ALC294_FIXUP_ASUS_G513_PINS, 8426 + }, 8411 8427 [ALC294_FIXUP_ASUS_COEF_1B] = { 8412 8428 .type = HDA_FIXUP_VERBS, 8413 8429 .v.verbs = (const struct hda_verb[]) { ··· 9169 9149 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), 9170 9150 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), 9171 9151 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), 9152 + SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK), 9172 9153 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), 9173 9154 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), 9174 9155 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), ··· 9186 9165 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), 9187 9166 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), 9188 9167 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), 9168 + SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK), 9189 9169 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 9190 9170 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 9191 9171 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), ··· 9314 9292 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED), 9315 9293 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), 9316 9294 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), 9295 + SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED), 9317 9296 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), 9318 9297 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), 9319 9298 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), ··· 9362 9339 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), 9363 9340 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), 9364 9341 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), 9342 + SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), 9343 + SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), 9365 9344 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), 9366 9345 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), 9367 9346 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), 9368 - SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK), 9369 9347 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), 9370 9348 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), 9371 9349 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), ··· 9382 9358 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), 9383 9359 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 9384 9360 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 9361 + SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS), 9385 9362 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), 9363 + SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), 9386 9364 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), 9387 9365 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), 9388 9366 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), 9367 + SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS), 9389 9368 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), 9369 + SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401), 9390 9370 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), 9391 - SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), 9392 - SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), 9393 9371 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 9394 9372 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), 9395 9373 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), ··· 9595 9569 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 9596 9570 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK), 9597 9571 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS), 9572 + SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), 9598 9573 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20), 9599 9574 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI), 9600 9575 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
+14 -9
sound/usb/endpoint.c
··· 758 758 * The endpoint needs to be closed via snd_usb_endpoint_close() later. 759 759 * 760 760 * Note that this function doesn't configure the endpoint. The substream 761 - * needs to set it up later via snd_usb_endpoint_set_params() and 762 - * snd_usb_endpoint_prepare(). 761 + * needs to set it up later via snd_usb_endpoint_configure(). 763 762 */ 764 763 struct snd_usb_endpoint * 765 764 snd_usb_endpoint_open(struct snd_usb_audio *chip, ··· 1292 1293 /* 1293 1294 * snd_usb_endpoint_set_params: configure an snd_usb_endpoint 1294 1295 * 1295 - * It's called either from hw_params callback. 1296 1296 * Determine the number of URBs to be used on this endpoint. 1297 1297 * An endpoint must be configured before it can be started. 1298 1298 * An endpoint that is already running can not be reconfigured. 1299 1299 */ 1300 - int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, 1301 - struct snd_usb_endpoint *ep) 1300 + static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, 1301 + struct snd_usb_endpoint *ep) 1302 1302 { 1303 1303 const struct audioformat *fmt = ep->cur_audiofmt; 1304 1304 int err; ··· 1380 1382 } 1381 1383 1382 1384 /* 1383 - * snd_usb_endpoint_prepare: Prepare the endpoint 1385 + * snd_usb_endpoint_configure: Configure the endpoint 1384 1386 * 1385 1387 * This function sets up the EP to be fully usable state. 1386 - * It's called either from prepare callback. 1388 + * It's called either from hw_params or prepare callback. 1387 1389 * The function checks need_setup flag, and performs nothing unless needed, 1388 1390 * so it's safe to call this multiple times. 1389 1391 * 1390 1392 * This returns zero if unchanged, 1 if the configuration has changed, 1391 1393 * or a negative error code. 1392 1394 */ 1393 - int snd_usb_endpoint_prepare(struct snd_usb_audio *chip, 1394 - struct snd_usb_endpoint *ep) 1395 + int snd_usb_endpoint_configure(struct snd_usb_audio *chip, 1396 + struct snd_usb_endpoint *ep) 1395 1397 { 1396 1398 bool iface_first; 1397 1399 int err = 0; ··· 1412 1414 if (err < 0) 1413 1415 goto unlock; 1414 1416 } 1417 + err = snd_usb_endpoint_set_params(chip, ep); 1418 + if (err < 0) 1419 + goto unlock; 1415 1420 goto done; 1416 1421 } 1417 1422 ··· 1439 1438 goto unlock; 1440 1439 1441 1440 err = init_sample_rate(chip, ep); 1441 + if (err < 0) 1442 + goto unlock; 1443 + 1444 + err = snd_usb_endpoint_set_params(chip, ep); 1442 1445 if (err < 0) 1443 1446 goto unlock; 1444 1447
+2 -4
sound/usb/endpoint.h
··· 17 17 bool is_sync_ep); 18 18 void snd_usb_endpoint_close(struct snd_usb_audio *chip, 19 19 struct snd_usb_endpoint *ep); 20 - int snd_usb_endpoint_set_params(struct snd_usb_audio *chip, 21 - struct snd_usb_endpoint *ep); 22 - int snd_usb_endpoint_prepare(struct snd_usb_audio *chip, 23 - struct snd_usb_endpoint *ep); 20 + int snd_usb_endpoint_configure(struct snd_usb_audio *chip, 21 + struct snd_usb_endpoint *ep); 24 22 int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock); 25 23 26 24 bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
+4 -10
sound/usb/pcm.c
··· 443 443 if (stop_endpoints(subs, false)) 444 444 sync_pending_stops(subs); 445 445 if (subs->sync_endpoint) { 446 - err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint); 446 + err = snd_usb_endpoint_configure(chip, subs->sync_endpoint); 447 447 if (err < 0) 448 448 return err; 449 449 } 450 - err = snd_usb_endpoint_prepare(chip, subs->data_endpoint); 450 + err = snd_usb_endpoint_configure(chip, subs->data_endpoint); 451 451 if (err < 0) 452 452 return err; 453 453 snd_usb_set_format_quirk(subs, subs->cur_audiofmt); 454 454 } else { 455 455 if (subs->sync_endpoint) { 456 - err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint); 456 + err = snd_usb_endpoint_configure(chip, subs->sync_endpoint); 457 457 if (err < 0) 458 458 return err; 459 459 } ··· 551 551 subs->cur_audiofmt = fmt; 552 552 mutex_unlock(&chip->mutex); 553 553 554 - if (subs->sync_endpoint) { 555 - ret = snd_usb_endpoint_set_params(chip, subs->sync_endpoint); 556 - if (ret < 0) 557 - goto unlock; 558 - } 559 - 560 - ret = snd_usb_endpoint_set_params(chip, subs->data_endpoint); 554 + ret = configure_endpoints(chip, subs); 561 555 562 556 unlock: 563 557 if (ret < 0)
+3 -2
tools/arch/x86/include/asm/cpufeatures.h
··· 457 457 #define X86_BUG_ITLB_MULTIHIT X86_BUG(23) /* CPU may incur MCE during certain page attribute changes */ 458 458 #define X86_BUG_SRBDS X86_BUG(24) /* CPU may leak RNG bits if not mitigated */ 459 459 #define X86_BUG_MMIO_STALE_DATA X86_BUG(25) /* CPU is affected by Processor MMIO Stale Data vulnerabilities */ 460 - #define X86_BUG_RETBLEED X86_BUG(26) /* CPU is affected by RETBleed */ 461 - #define X86_BUG_EIBRS_PBRSB X86_BUG(27) /* EIBRS is vulnerable to Post Barrier RSB Predictions */ 460 + #define X86_BUG_MMIO_UNKNOWN X86_BUG(26) /* CPU is too old and its MMIO Stale Data status is unknown */ 461 + #define X86_BUG_RETBLEED X86_BUG(27) /* CPU is affected by RETBleed */ 462 + #define X86_BUG_EIBRS_PBRSB X86_BUG(28) /* EIBRS is vulnerable to Post Barrier RSB Predictions */ 462 463 463 464 #endif /* _ASM_X86_CPUFEATURES_H */
+3 -3
tools/hv/hv_kvp_daemon.c
··· 44 44 45 45 /* 46 46 * KVP protocol: The user mode component first registers with the 47 - * the kernel component. Subsequently, the kernel component requests, data 47 + * kernel component. Subsequently, the kernel component requests, data 48 48 * for the specified keys. In response to this message the user mode component 49 49 * fills in the value corresponding to the specified key. We overload the 50 50 * sequence field in the cn_msg header to define our KVP message types. ··· 772 772 const char *str; 773 773 774 774 if (family == AF_INET) { 775 - addr = (struct sockaddr_in *)addrp; 775 + addr = addrp; 776 776 str = inet_ntop(family, &addr->sin_addr, tmp, 50); 777 777 addr_length = INET_ADDRSTRLEN; 778 778 } else { 779 - addr6 = (struct sockaddr_in6 *)addrp; 779 + addr6 = addrp; 780 780 str = inet_ntop(family, &addr6->sin6_addr.s6_addr, tmp, 50); 781 781 addr_length = INET6_ADDRSTRLEN; 782 782 }
+2 -2
tools/include/uapi/asm/errno.h
··· 9 9 #include "../../../arch/alpha/include/uapi/asm/errno.h" 10 10 #elif defined(__mips__) 11 11 #include "../../../arch/mips/include/uapi/asm/errno.h" 12 - #elif defined(__xtensa__) 13 - #include "../../../arch/xtensa/include/uapi/asm/errno.h" 12 + #elif defined(__hppa__) 13 + #include "../../../arch/parisc/include/uapi/asm/errno.h" 14 14 #else 15 15 #include <asm-generic/errno.h> 16 16 #endif
+3 -2
tools/lib/perf/evlist.c
··· 441 441 442 442 perf_evlist__for_each_entry(evlist, evsel) { 443 443 bool overwrite = evsel->attr.write_backward; 444 + enum fdarray_flags flgs; 444 445 struct perf_mmap *map; 445 446 int *output, fd, cpu; 446 447 ··· 505 504 506 505 revent = !overwrite ? POLLIN : 0; 507 506 508 - if (!evsel->system_wide && 509 - perf_evlist__add_pollfd(evlist, fd, map, revent, fdarray_flag__default) < 0) { 507 + flgs = evsel->system_wide ? fdarray_flag__nonfilterable : fdarray_flag__default; 508 + if (perf_evlist__add_pollfd(evlist, fd, map, revent, flgs) < 0) { 510 509 perf_mmap__put(map); 511 510 return -1; 512 511 }
+2
tools/perf/builtin-record.c
··· 3371 3371 return 0; 3372 3372 3373 3373 perf_cpu_map__for_each_cpu(cpu, idx, cpus) { 3374 + if (cpu.cpu == -1) 3375 + continue; 3374 3376 /* Return ENODEV is input cpu is greater than max cpu */ 3375 3377 if ((unsigned long)cpu.cpu > mask->nbits) 3376 3378 return -ENODEV;
+83
tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
··· 1 + #!/bin/sh 2 + # perf stat --bpf-counters --for-each-cgroup test 3 + # SPDX-License-Identifier: GPL-2.0 4 + 5 + set -e 6 + 7 + test_cgroups= 8 + if [ "$1" = "-v" ]; then 9 + verbose="1" 10 + fi 11 + 12 + # skip if --bpf-counters --for-each-cgroup is not supported 13 + check_bpf_counter() 14 + { 15 + if ! perf stat -a --bpf-counters --for-each-cgroup / true > /dev/null 2>&1; then 16 + if [ "${verbose}" = "1" ]; then 17 + echo "Skipping: --bpf-counters --for-each-cgroup not supported" 18 + perf --no-pager stat -a --bpf-counters --for-each-cgroup / true || true 19 + fi 20 + exit 2 21 + fi 22 + } 23 + 24 + # find two cgroups to measure 25 + find_cgroups() 26 + { 27 + # try usual systemd slices first 28 + if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; then 29 + test_cgroups="system.slice,user.slice" 30 + return 31 + fi 32 + 33 + # try root and self cgroups 34 + local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3) 35 + if [ -z ${self_cgrp} ]; then 36 + # cgroup v2 doesn't specify perf_event 37 + self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3) 38 + fi 39 + 40 + if [ -z ${self_cgrp} ]; then 41 + test_cgroups="/" 42 + else 43 + test_cgroups="/,${self_cgrp}" 44 + fi 45 + } 46 + 47 + # As cgroup events are cpu-wide, we cannot simply compare the result. 48 + # Just check if it runs without failure and has non-zero results. 49 + check_system_wide_counted() 50 + { 51 + local output 52 + 53 + output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, sleep 1 2>&1) 54 + if echo ${output} | grep -q -F "<not "; then 55 + echo "Some system-wide events are not counted" 56 + if [ "${verbose}" = "1" ]; then 57 + echo ${output} 58 + fi 59 + exit 1 60 + fi 61 + } 62 + 63 + check_cpu_list_counted() 64 + { 65 + local output 66 + 67 + output=$(perf stat -C 1 --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, taskset -c 1 sleep 1 2>&1) 68 + if echo ${output} | grep -q -F "<not "; then 69 + echo "Some CPU events are not counted" 70 + if [ "${verbose}" = "1" ]; then 71 + echo ${output} 72 + fi 73 + exit 1 74 + fi 75 + } 76 + 77 + check_bpf_counter 78 + find_cgroups 79 + 80 + check_system_wide_counted 81 + check_cpu_list_counted 82 + 83 + exit 0
+8 -2
tools/perf/tests/wp.c
··· 2 2 #include <stdlib.h> 3 3 #include <string.h> 4 4 #include <unistd.h> 5 + #include <errno.h> 5 6 #include <sys/ioctl.h> 7 + #include <linux/compiler.h> 6 8 #include <linux/hw_breakpoint.h> 7 9 #include <linux/kernel.h> 8 10 #include "tests.h" ··· 139 137 #endif 140 138 } 141 139 142 - static int test__wp_modify(struct test_suite *test __maybe_unused, 143 - int subtest __maybe_unused) 140 + static int test__wp_modify(struct test_suite *test __maybe_unused, int subtest __maybe_unused) 144 141 { 145 142 #if defined(__s390x__) 146 143 return TEST_SKIP; ··· 161 160 new_attr.disabled = 1; 162 161 ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr); 163 162 if (ret < 0) { 163 + if (errno == ENOTTY) { 164 + test->test_cases[subtest].skip_reason = "missing kernel support"; 165 + ret = TEST_SKIP; 166 + } 167 + 164 168 pr_debug("ioctl(PERF_EVENT_IOC_MODIFY_ATTRIBUTES) failed\n"); 165 169 close(fd); 166 170 return ret;
+5 -5
tools/perf/util/bpf_counter_cgroup.c
··· 95 95 96 96 perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) { 97 97 link = bpf_program__attach_perf_event(skel->progs.on_cgrp_switch, 98 - FD(cgrp_switch, cpu.cpu)); 98 + FD(cgrp_switch, i)); 99 99 if (IS_ERR(link)) { 100 100 pr_err("Failed to attach cgroup program\n"); 101 101 err = PTR_ERR(link); ··· 115 115 evsel->cgrp = NULL; 116 116 117 117 /* open single copy of the events w/o cgroup */ 118 - err = evsel__open_per_cpu(evsel, evlist->core.all_cpus, -1); 118 + err = evsel__open_per_cpu(evsel, evsel->core.cpus, -1); 119 119 if (err) { 120 120 pr_err("Failed to open first cgroup events\n"); 121 121 goto out; 122 122 } 123 123 124 124 map_fd = bpf_map__fd(skel->maps.events); 125 - perf_cpu_map__for_each_cpu(cpu, j, evlist->core.all_cpus) { 126 - int fd = FD(evsel, cpu.cpu); 125 + perf_cpu_map__for_each_cpu(cpu, j, evsel->core.cpus) { 126 + int fd = FD(evsel, j); 127 127 __u32 idx = evsel->core.idx * total_cpus + cpu.cpu; 128 128 129 129 err = bpf_map_update_elem(map_fd, &idx, &fd, ··· 269 269 goto out; 270 270 } 271 271 272 - perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) { 272 + perf_cpu_map__for_each_cpu(cpu, i, evsel->core.cpus) { 273 273 counts = perf_counts(evsel->counts, i, 0); 274 274 counts->val = values[cpu.cpu].counter; 275 275 counts->ena = values[cpu.cpu].enabled;
+1 -1
tools/perf/util/bpf_skel/bperf_cgroup.bpf.c
··· 176 176 } 177 177 178 178 // This will be attached to cgroup-switches event for each cpu 179 - SEC("perf_events") 179 + SEC("perf_event") 180 180 int BPF_PROG(on_cgrp_switch) 181 181 { 182 182 return bperf_cgroup_count();
+14
tools/perf/util/genelf.c
··· 253 253 Elf_Data *d; 254 254 Elf_Scn *scn; 255 255 Elf_Ehdr *ehdr; 256 + Elf_Phdr *phdr; 256 257 Elf_Shdr *shdr; 257 258 uint64_t eh_frame_base_offset; 258 259 char *strsym = NULL; ··· 287 286 ehdr->e_entry = GEN_ELF_TEXT_OFFSET; 288 287 ehdr->e_version = EV_CURRENT; 289 288 ehdr->e_shstrndx= unwinding ? 4 : 2; /* shdr index for section name */ 289 + 290 + /* 291 + * setup program header 292 + */ 293 + phdr = elf_newphdr(e, 1); 294 + phdr[0].p_type = PT_LOAD; 295 + phdr[0].p_offset = 0; 296 + phdr[0].p_vaddr = 0; 297 + phdr[0].p_paddr = 0; 298 + phdr[0].p_filesz = csize; 299 + phdr[0].p_memsz = csize; 300 + phdr[0].p_flags = PF_X | PF_R; 301 + phdr[0].p_align = 8; 290 302 291 303 /* 292 304 * setup text section
+4
tools/perf/util/genelf.h
··· 53 53 54 54 #if GEN_ELF_CLASS == ELFCLASS64 55 55 #define elf_newehdr elf64_newehdr 56 + #define elf_newphdr elf64_newphdr 56 57 #define elf_getshdr elf64_getshdr 57 58 #define Elf_Ehdr Elf64_Ehdr 59 + #define Elf_Phdr Elf64_Phdr 58 60 #define Elf_Shdr Elf64_Shdr 59 61 #define Elf_Sym Elf64_Sym 60 62 #define ELF_ST_TYPE(a) ELF64_ST_TYPE(a) ··· 64 62 #define ELF_ST_VIS(a) ELF64_ST_VISIBILITY(a) 65 63 #else 66 64 #define elf_newehdr elf32_newehdr 65 + #define elf_newphdr elf32_newphdr 67 66 #define elf_getshdr elf32_getshdr 68 67 #define Elf_Ehdr Elf32_Ehdr 68 + #define Elf_Phdr Elf32_Phdr 69 69 #define Elf_Shdr Elf32_Shdr 70 70 #define Elf_Sym Elf32_Sym 71 71 #define ELF_ST_TYPE(a) ELF32_ST_TYPE(a)
+2 -5
tools/perf/util/symbol-elf.c
··· 2102 2102 * unusual. One significant peculiarity is that the mapping (start -> pgoff) 2103 2103 * is not the same for the kernel map and the modules map. That happens because 2104 2104 * the data is copied adjacently whereas the original kcore has gaps. Finally, 2105 - * kallsyms and modules files are compared with their copies to check that 2106 - * modules have not been loaded or unloaded while the copies were taking place. 2105 + * kallsyms file is compared with its copy to check that modules have not been 2106 + * loaded or unloaded while the copies were taking place. 2107 2107 * 2108 2108 * Return: %0 on success, %-1 on failure. 2109 2109 */ ··· 2165 2165 if (copy_bytes(kcore.fd, p->offset, extract.fd, offs, p->len)) 2166 2166 goto out_extract_close; 2167 2167 } 2168 - 2169 - if (kcore_copy__compare_file(from_dir, to_dir, "modules")) 2170 - goto out_extract_close; 2171 2168 2172 2169 if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms")) 2173 2170 goto out_extract_close;
+14 -3
tools/perf/util/synthetic-events.c
··· 367 367 bool is_kernel) 368 368 { 369 369 struct build_id bid; 370 + struct nsinfo *nsi; 371 + struct nscookie nc; 370 372 int rc; 371 373 372 - if (is_kernel) 374 + if (is_kernel) { 373 375 rc = sysfs__read_build_id("/sys/kernel/notes", &bid); 374 - else 375 - rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; 376 + goto out; 377 + } 376 378 379 + nsi = nsinfo__new(event->pid); 380 + nsinfo__mountns_enter(nsi, &nc); 381 + 382 + rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; 383 + 384 + nsinfo__mountns_exit(&nc); 385 + nsinfo__put(nsi); 386 + 387 + out: 377 388 if (rc == 0) { 378 389 memcpy(event->build_id, bid.data, sizeof(bid.data)); 379 390 event->build_id_size = (u8) bid.size;
-77
tools/testing/nvdimm/test/ndtest.c
··· 134 134 }, 135 135 }; 136 136 137 - static struct ndtest_mapping region2_mapping[] = { 138 - { 139 - .dimm = 0, 140 - .position = 0, 141 - .start = 0, 142 - .size = DIMM_SIZE, 143 - }, 144 - }; 145 - 146 - static struct ndtest_mapping region3_mapping[] = { 147 - { 148 - .dimm = 1, 149 - .start = 0, 150 - .size = DIMM_SIZE, 151 - } 152 - }; 153 - 154 - static struct ndtest_mapping region4_mapping[] = { 155 - { 156 - .dimm = 2, 157 - .start = 0, 158 - .size = DIMM_SIZE, 159 - } 160 - }; 161 - 162 - static struct ndtest_mapping region5_mapping[] = { 163 - { 164 - .dimm = 3, 165 - .start = 0, 166 - .size = DIMM_SIZE, 167 - } 168 - }; 169 - 170 137 static struct ndtest_region bus0_regions[] = { 171 138 { 172 139 .type = ND_DEVICE_NAMESPACE_PMEM, ··· 148 181 .mapping = region1_mapping, 149 182 .size = DIMM_SIZE * 2, 150 183 .range_index = 2, 151 - }, 152 - { 153 - .type = ND_DEVICE_NAMESPACE_BLK, 154 - .num_mappings = ARRAY_SIZE(region2_mapping), 155 - .mapping = region2_mapping, 156 - .size = DIMM_SIZE, 157 - .range_index = 3, 158 - }, 159 - { 160 - .type = ND_DEVICE_NAMESPACE_BLK, 161 - .num_mappings = ARRAY_SIZE(region3_mapping), 162 - .mapping = region3_mapping, 163 - .size = DIMM_SIZE, 164 - .range_index = 4, 165 - }, 166 - { 167 - .type = ND_DEVICE_NAMESPACE_BLK, 168 - .num_mappings = ARRAY_SIZE(region4_mapping), 169 - .mapping = region4_mapping, 170 - .size = DIMM_SIZE, 171 - .range_index = 5, 172 - }, 173 - { 174 - .type = ND_DEVICE_NAMESPACE_BLK, 175 - .num_mappings = ARRAY_SIZE(region5_mapping), 176 - .mapping = region5_mapping, 177 - .size = DIMM_SIZE, 178 - .range_index = 6, 179 184 }, 180 185 }; 181 186 ··· 440 501 nd_set->altcookie = nd_set->cookie1; 441 502 ndr_desc->nd_set = nd_set; 442 503 443 - if (region->type == ND_DEVICE_NAMESPACE_BLK) { 444 - mappings[0].start = 0; 445 - mappings[0].size = DIMM_SIZE; 446 - mappings[0].nvdimm = p->config->dimms[ndimm].nvdimm; 447 - 448 - ndr_desc->mapping = &mappings[0]; 449 - ndr_desc->num_mappings = 1; 450 - ndr_desc->num_lanes = 1; 451 - ndbr_desc.enable = ndtest_blk_region_enable; 452 - ndbr_desc.do_io = ndtest_blk_do_io; 453 - region->region = nvdimm_blk_region_create(p->bus, ndr_desc); 454 - 455 - goto done; 456 - } 457 - 458 504 for (i = 0; i < region->num_mappings; i++) { 459 505 ndimm = region->mapping[i].dimm; 460 506 mappings[i].start = region->mapping[i].start; ··· 451 527 ndr_desc->num_mappings = region->num_mappings; 452 528 region->region = nvdimm_pmem_region_create(p->bus, ndr_desc); 453 529 454 - done: 455 530 if (!region->region) { 456 531 dev_err(&p->pdev.dev, "Error registering region %pR\n", 457 532 ndr_desc->res);
+1
tools/testing/selftests/Makefile
··· 13 13 TARGETS += drivers/dma-buf 14 14 TARGETS += drivers/s390x/uvdevice 15 15 TARGETS += drivers/net/bonding 16 + TARGETS += drivers/net/team 16 17 TARGETS += efivarfs 17 18 TARGETS += exec 18 19 TARGETS += filesystems
+5 -1
tools/testing/selftests/drivers/net/bonding/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Makefile for net selftests 3 3 4 - TEST_PROGS := bond-break-lacpdu-tx.sh 4 + TEST_PROGS := bond-break-lacpdu-tx.sh \ 5 + dev_addr_lists.sh \ 6 + bond-arp-interval-causes-panic.sh 7 + 8 + TEST_FILES := lag_lib.sh 5 9 6 10 include ../../../lib.mk
+49
tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # cause kernel oops in bond_rr_gen_slave_id 5 + DEBUG=${DEBUG:-0} 6 + 7 + set -e 8 + test ${DEBUG} -ne 0 && set -x 9 + 10 + finish() 11 + { 12 + ip netns delete server || true 13 + ip netns delete client || true 14 + ip link del link1_1 || true 15 + } 16 + 17 + trap finish EXIT 18 + 19 + client_ip4=192.168.1.198 20 + server_ip4=192.168.1.254 21 + 22 + # setup kernel so it reboots after causing the panic 23 + echo 180 >/proc/sys/kernel/panic 24 + 25 + # build namespaces 26 + ip link add dev link1_1 type veth peer name link1_2 27 + 28 + ip netns add "server" 29 + ip link set dev link1_2 netns server up name eth0 30 + ip netns exec server ip addr add ${server_ip4}/24 dev eth0 31 + 32 + ip netns add "client" 33 + ip link set dev link1_1 netns client down name eth0 34 + ip netns exec client ip link add dev bond0 down type bond mode 1 \ 35 + miimon 100 all_slaves_active 1 36 + ip netns exec client ip link set dev eth0 down master bond0 37 + ip netns exec client ip link set dev bond0 up 38 + ip netns exec client ip addr add ${client_ip4}/24 dev bond0 39 + ip netns exec client ping -c 5 $server_ip4 >/dev/null 40 + 41 + ip netns exec client ip link set dev eth0 down nomaster 42 + ip netns exec client ip link set dev bond0 down 43 + ip netns exec client ip link set dev bond0 type bond mode 0 \ 44 + arp_interval 1000 arp_ip_target "+${server_ip4}" 45 + ip netns exec client ip link set dev eth0 down master bond0 46 + ip netns exec client ip link set dev bond0 up 47 + ip netns exec client ping -c 5 $server_ip4 >/dev/null 48 + 49 + exit 0
+1
tools/testing/selftests/drivers/net/bonding/config
··· 1 1 CONFIG_BONDING=y 2 + CONFIG_MACVLAN=y
+109
tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Test bond device handling of addr lists (dev->uc, mc) 5 + # 6 + 7 + ALL_TESTS=" 8 + bond_cleanup_mode1 9 + bond_cleanup_mode4 10 + bond_listen_lacpdu_multicast_case_down 11 + bond_listen_lacpdu_multicast_case_up 12 + " 13 + 14 + REQUIRE_MZ=no 15 + NUM_NETIFS=0 16 + lib_dir=$(dirname "$0") 17 + source "$lib_dir"/../../../net/forwarding/lib.sh 18 + 19 + source "$lib_dir"/lag_lib.sh 20 + 21 + 22 + destroy() 23 + { 24 + local ifnames=(dummy1 dummy2 bond1 mv0) 25 + local ifname 26 + 27 + for ifname in "${ifnames[@]}"; do 28 + ip link del "$ifname" &>/dev/null 29 + done 30 + } 31 + 32 + cleanup() 33 + { 34 + pre_cleanup 35 + 36 + destroy 37 + } 38 + 39 + 40 + # bond driver control paths vary between modes that have a primary slave 41 + # (bond_uses_primary()) and others. Test both kinds of modes. 42 + 43 + bond_cleanup_mode1() 44 + { 45 + RET=0 46 + 47 + test_LAG_cleanup "bonding" "active-backup" 48 + } 49 + 50 + bond_cleanup_mode4() { 51 + RET=0 52 + 53 + test_LAG_cleanup "bonding" "802.3ad" 54 + } 55 + 56 + bond_listen_lacpdu_multicast() 57 + { 58 + # Initial state of bond device, up | down 59 + local init_state=$1 60 + local lacpdu_mc="01:80:c2:00:00:02" 61 + 62 + ip link add dummy1 type dummy 63 + ip link add bond1 "$init_state" type bond mode 802.3ad 64 + ip link set dev dummy1 master bond1 65 + if [ "$init_state" = "down" ]; then 66 + ip link set dev bond1 up 67 + fi 68 + 69 + grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null 70 + check_err $? "LACPDU multicast address not present on slave (1)" 71 + 72 + ip link set dev bond1 down 73 + 74 + not grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null 75 + check_err $? "LACPDU multicast address still present on slave" 76 + 77 + ip link set dev bond1 up 78 + 79 + grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null 80 + check_err $? "LACPDU multicast address not present on slave (2)" 81 + 82 + cleanup 83 + 84 + log_test "bonding LACPDU multicast address to slave (from bond $init_state)" 85 + } 86 + 87 + # The LACPDU mc addr is added by different paths depending on the initial state 88 + # of the bond when enslaving a device. Test both cases. 89 + 90 + bond_listen_lacpdu_multicast_case_down() 91 + { 92 + RET=0 93 + 94 + bond_listen_lacpdu_multicast "down" 95 + } 96 + 97 + bond_listen_lacpdu_multicast_case_up() 98 + { 99 + RET=0 100 + 101 + bond_listen_lacpdu_multicast "up" 102 + } 103 + 104 + 105 + trap cleanup EXIT 106 + 107 + tests_run 108 + 109 + exit "$EXIT_STATUS"
+61
tools/testing/selftests/drivers/net/bonding/lag_lib.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + # Test that a link aggregation device (bonding, team) removes the hardware 5 + # addresses that it adds on its underlying devices. 6 + test_LAG_cleanup() 7 + { 8 + local driver=$1 9 + local mode=$2 10 + local ucaddr="02:00:00:12:34:56" 11 + local addr6="fe80::78:9abc/64" 12 + local mcaddr="33:33:ff:78:9a:bc" 13 + local name 14 + 15 + ip link add dummy1 type dummy 16 + ip link add dummy2 type dummy 17 + if [ "$driver" = "bonding" ]; then 18 + name="bond1" 19 + ip link add "$name" up type bond mode "$mode" 20 + ip link set dev dummy1 master "$name" 21 + ip link set dev dummy2 master "$name" 22 + elif [ "$driver" = "team" ]; then 23 + name="team0" 24 + teamd -d -c ' 25 + { 26 + "device": "'"$name"'", 27 + "runner": { 28 + "name": "'"$mode"'" 29 + }, 30 + "ports": { 31 + "dummy1": 32 + {}, 33 + "dummy2": 34 + {} 35 + } 36 + } 37 + ' 38 + ip link set dev "$name" up 39 + else 40 + check_err 1 41 + log_test test_LAG_cleanup ": unknown driver \"$driver\"" 42 + return 43 + fi 44 + 45 + # Used to test dev->uc handling 46 + ip link add mv0 link "$name" up address "$ucaddr" type macvlan 47 + # Used to test dev->mc handling 48 + ip address add "$addr6" dev "$name" 49 + ip link set dev "$name" down 50 + ip link del "$name" 51 + 52 + not grep_bridge_fdb "$ucaddr" bridge fdb show >/dev/null 53 + check_err $? "macvlan unicast address still present on a slave" 54 + 55 + not grep_bridge_fdb "$mcaddr" bridge fdb show >/dev/null 56 + check_err $? "IPv6 solicited-node multicast mac address still present on a slave" 57 + 58 + cleanup 59 + 60 + log_test "$driver cleanup mode $mode" 61 + }
+6
tools/testing/selftests/drivers/net/team/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Makefile for net selftests 3 + 4 + TEST_PROGS := dev_addr_lists.sh 5 + 6 + include ../../../lib.mk
+3
tools/testing/selftests/drivers/net/team/config
··· 1 + CONFIG_NET_TEAM=y 2 + CONFIG_NET_TEAM_MODE_LOADBALANCE=y 3 + CONFIG_MACVLAN=y
+51
tools/testing/selftests/drivers/net/team/dev_addr_lists.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Test team device handling of addr lists (dev->uc, mc) 5 + # 6 + 7 + ALL_TESTS=" 8 + team_cleanup 9 + " 10 + 11 + REQUIRE_MZ=no 12 + NUM_NETIFS=0 13 + lib_dir=$(dirname "$0") 14 + source "$lib_dir"/../../../net/forwarding/lib.sh 15 + 16 + source "$lib_dir"/../bonding/lag_lib.sh 17 + 18 + 19 + destroy() 20 + { 21 + local ifnames=(dummy0 dummy1 team0 mv0) 22 + local ifname 23 + 24 + for ifname in "${ifnames[@]}"; do 25 + ip link del "$ifname" &>/dev/null 26 + done 27 + } 28 + 29 + cleanup() 30 + { 31 + pre_cleanup 32 + 33 + destroy 34 + } 35 + 36 + 37 + team_cleanup() 38 + { 39 + RET=0 40 + 41 + test_LAG_cleanup "team" "lacp" 42 + } 43 + 44 + 45 + require_command teamd 46 + 47 + trap cleanup EXIT 48 + 49 + tests_run 50 + 51 + exit "$EXIT_STATUS"
+1 -1
tools/testing/selftests/kvm/rseq_test.c
··· 227 227 ucall_init(vm, NULL); 228 228 229 229 pthread_create(&migration_thread, NULL, migration_worker, 230 - (void *)(unsigned long)gettid()); 230 + (void *)(unsigned long)syscall(SYS_gettid)); 231 231 232 232 for (i = 0; !done; i++) { 233 233 vcpu_run(vcpu);
+10 -9
tools/testing/selftests/landlock/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # First run: make -C ../../../.. headers_install 2 4 3 5 CFLAGS += -Wall -O2 $(KHDR_INCLUDES) 6 + LDLIBS += -lcap 7 + 8 + LOCAL_HDRS += common.h 4 9 5 10 src_test := $(wildcard *_test.c) 6 11 ··· 13 8 14 9 TEST_GEN_PROGS_EXTENDED := true 15 10 16 - OVERRIDE_TARGETS := 1 17 - top_srcdir := ../../../.. 11 + # Static linking for short targets: 12 + $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static 13 + 18 14 include ../lib.mk 19 15 20 - khdr_dir = $(top_srcdir)/usr/include 21 - 22 - $(OUTPUT)/true: true.c 23 - $(LINK.c) $< $(LDLIBS) -o $@ -static 24 - 25 - $(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h 26 - $(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir) 16 + # Static linking for targets with $(OUTPUT)/ prefix: 17 + $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
+4
tools/testing/selftests/lib.mk
··· 42 42 selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) 43 43 top_srcdir = $(selfdir)/../../.. 44 44 45 + ifeq ($(KHDR_INCLUDES),) 46 + KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include 47 + endif 48 + 45 49 # The following are built by lib.mk common compile rules. 46 50 # TEST_CUSTOM_PROGS should be used by tests that require 47 51 # custom build rule and prevent common build rule use.
+91 -1
tools/testing/selftests/net/forwarding/router_multicast.sh
··· 28 28 # +------------------+ +------------------+ 29 29 # 30 30 31 - ALL_TESTS="mcast_v4 mcast_v6 rpf_v4 rpf_v6" 31 + ALL_TESTS="mcast_v4 mcast_v6 rpf_v4 rpf_v6 unres_v4 unres_v6" 32 32 NUM_NETIFS=6 33 33 source lib.sh 34 34 source tc_common.sh ··· 404 404 tc filter del dev $h1 ingress protocol ipv6 pref 1 handle 1 flower 405 405 406 406 log_test "RPF IPv6" 407 + } 408 + 409 + unres_v4() 410 + { 411 + # Send a multicast packet not corresponding to an installed route, 412 + # causing the kernel to queue the packet for resolution and emit an 413 + # IGMPMSG_NOCACHE notification. smcrouted will react to this 414 + # notification by consulting its (*, G) list and installing an (S, G) 415 + # route, which will be used to forward the queued packet. 416 + 417 + RET=0 418 + 419 + tc filter add dev $h2 ingress protocol ip pref 1 handle 1 flower \ 420 + dst_ip 225.1.2.3 ip_proto udp dst_port 12345 action drop 421 + tc filter add dev $h3 ingress protocol ip pref 1 handle 1 flower \ 422 + dst_ip 225.1.2.3 ip_proto udp dst_port 12345 action drop 423 + 424 + # Forwarding should fail before installing a matching (*, G). 425 + $MZ $h1 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \ 426 + -a 00:11:22:33:44:55 -b 01:00:5e:01:02:03 \ 427 + -A 198.51.100.2 -B 225.1.2.3 -q 428 + 429 + tc_check_packets "dev $h2 ingress" 1 0 430 + check_err $? "Multicast received on first host when should not" 431 + tc_check_packets "dev $h3 ingress" 1 0 432 + check_err $? "Multicast received on second host when should not" 433 + 434 + # Create (*, G). Will not be installed in the kernel. 435 + create_mcast_sg $rp1 0.0.0.0 225.1.2.3 $rp2 $rp3 436 + 437 + $MZ $h1 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \ 438 + -a 00:11:22:33:44:55 -b 01:00:5e:01:02:03 \ 439 + -A 198.51.100.2 -B 225.1.2.3 -q 440 + 441 + tc_check_packets "dev $h2 ingress" 1 1 442 + check_err $? "Multicast not received on first host" 443 + tc_check_packets "dev $h3 ingress" 1 1 444 + check_err $? "Multicast not received on second host" 445 + 446 + delete_mcast_sg $rp1 0.0.0.0 225.1.2.3 $rp2 $rp3 447 + 448 + tc filter del dev $h3 ingress protocol ip pref 1 handle 1 flower 449 + tc filter del dev $h2 ingress protocol ip pref 1 handle 1 flower 450 + 451 + log_test "Unresolved queue IPv4" 452 + } 453 + 454 + unres_v6() 455 + { 456 + # Send a multicast packet not corresponding to an installed route, 457 + # causing the kernel to queue the packet for resolution and emit an 458 + # MRT6MSG_NOCACHE notification. smcrouted will react to this 459 + # notification by consulting its (*, G) list and installing an (S, G) 460 + # route, which will be used to forward the queued packet. 461 + 462 + RET=0 463 + 464 + tc filter add dev $h2 ingress protocol ipv6 pref 1 handle 1 flower \ 465 + dst_ip ff0e::3 ip_proto udp dst_port 12345 action drop 466 + tc filter add dev $h3 ingress protocol ipv6 pref 1 handle 1 flower \ 467 + dst_ip ff0e::3 ip_proto udp dst_port 12345 action drop 468 + 469 + # Forwarding should fail before installing a matching (*, G). 470 + $MZ $h1 -6 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \ 471 + -a 00:11:22:33:44:55 -b 33:33:00:00:00:03 \ 472 + -A 2001:db8:1::2 -B ff0e::3 -q 473 + 474 + tc_check_packets "dev $h2 ingress" 1 0 475 + check_err $? "Multicast received on first host when should not" 476 + tc_check_packets "dev $h3 ingress" 1 0 477 + check_err $? "Multicast received on second host when should not" 478 + 479 + # Create (*, G). Will not be installed in the kernel. 480 + create_mcast_sg $rp1 :: ff0e::3 $rp2 $rp3 481 + 482 + $MZ $h1 -6 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \ 483 + -a 00:11:22:33:44:55 -b 33:33:00:00:00:03 \ 484 + -A 2001:db8:1::2 -B ff0e::3 -q 485 + 486 + tc_check_packets "dev $h2 ingress" 1 1 487 + check_err $? "Multicast not received on first host" 488 + tc_check_packets "dev $h3 ingress" 1 1 489 + check_err $? "Multicast not received on second host" 490 + 491 + delete_mcast_sg $rp1 :: ff0e::3 $rp2 $rp3 492 + 493 + tc filter del dev $h3 ingress protocol ipv6 pref 1 handle 1 flower 494 + tc filter del dev $h2 ingress protocol ipv6 pref 1 handle 1 flower 495 + 496 + log_test "Unresolved queue IPv6" 407 497 } 408 498 409 499 trap cleanup EXIT
+1
tools/testing/selftests/net/forwarding/sch_red.sh
··· 1 + #!/bin/bash 1 2 # SPDX-License-Identifier: GPL-2.0 2 3 3 4 # This test sends one stream of traffic from H1 through a TBF shaper, to a RED
+53 -12
tools/testing/selftests/netfilter/nft_concat_range.sh
··· 91 91 start 1 92 92 count 5 93 93 src_delta 2000 94 - tools sendip nc bash 94 + tools sendip socat nc bash 95 95 proto udp 96 96 97 97 race_repeat 3 ··· 116 116 start 10 117 117 count 5 118 118 src_delta 2000 119 - tools sendip nc bash 119 + tools sendip socat nc bash 120 120 proto udp6 121 121 122 122 race_repeat 3 ··· 141 141 start 1 142 142 count 5 143 143 src_delta 2000 144 - tools sendip nc bash 144 + tools sendip socat nc bash 145 145 proto udp 146 146 147 147 race_repeat 0 ··· 163 163 start 10 164 164 count 5 165 165 src_delta 2000 166 - tools sendip nc bash 166 + tools sendip socat nc bash 167 167 proto udp6 168 168 169 169 race_repeat 0 ··· 185 185 start 10 186 186 count 5 187 187 src_delta 2000 188 - tools sendip nc bash 188 + tools sendip socat nc bash 189 189 proto udp6 190 190 191 191 race_repeat 0 ··· 207 207 start 1 208 208 count 5 209 209 src_delta 2000 210 - tools sendip nc bash 210 + tools sendip socat nc bash 211 211 proto udp 212 212 213 213 race_repeat 3 ··· 227 227 start 10 228 228 count 5 229 229 src_delta 2000 230 - tools sendip nc 230 + tools sendip socat nc 231 231 proto udp6 232 232 233 233 race_repeat 3 ··· 247 247 start 1 248 248 count 5 249 249 src_delta 2000 250 - tools sendip nc bash 250 + tools sendip socat nc bash 251 251 proto udp 252 252 253 253 race_repeat 0 ··· 264 264 start 1 265 265 count 5 266 266 src_delta 2000 267 - tools sendip nc bash 267 + tools sendip socat nc bash 268 268 proto udp 269 269 270 270 race_repeat 0 ··· 286 286 start 1 287 287 count 5 288 288 src_delta 2000 289 - tools sendip nc bash 289 + tools sendip socat nc bash 290 290 proto udp 291 291 292 292 race_repeat 0 ··· 337 337 start 1 338 338 count 5 339 339 src_delta 2000 340 - tools sendip nc 340 + tools sendip socat nc 341 341 proto udp 342 342 343 343 race_repeat 3 ··· 363 363 start 1 364 364 count 1 365 365 src_delta 2000 366 - tools sendip nc bash 366 + tools sendip socat nc bash 367 367 proto udp 368 368 369 369 race_repeat 0 ··· 541 541 dst_port= 542 542 src_addr4= 543 543 } 544 + elif command -v socat -v >/dev/null; then 545 + send_udp() { 546 + if [ -n "${src_addr4}" ]; then 547 + B ip addr add "${src_addr4}" dev veth_b 548 + __socatbind=",bind=${src_addr4}" 549 + if [ -n "${src_port}" ];then 550 + __socatbind="${__socatbind}:${src_port}" 551 + fi 552 + fi 553 + 554 + ip addr add "${dst_addr4}" dev veth_a 2>/dev/null 555 + [ -z "${dst_port}" ] && dst_port=12345 556 + 557 + echo "test4" | B socat -t 0.01 STDIN UDP4-DATAGRAM:${dst_addr4}:${dst_port}"${__socatbind}" 558 + 559 + src_addr4= 560 + src_port= 561 + } 544 562 elif command -v nc >/dev/null; then 545 563 if nc -u -w0 1.1.1.1 1 2>/dev/null; then 546 564 # OpenBSD netcat ··· 623 605 src_port= 624 606 dst_port= 625 607 src_addr6= 608 + } 609 + elif command -v socat -v >/dev/null; then 610 + send_udp6() { 611 + ip -6 addr add "${dst_addr6}" dev veth_a nodad \ 612 + 2>/dev/null 613 + 614 + __socatbind6= 615 + 616 + if [ -n "${src_addr6}" ]; then 617 + if [ -n "${src_addr6} != "${src_addr6_added} ]; then 618 + B ip addr add "${src_addr6}" dev veth_b nodad 619 + 620 + src_addr6_added=${src_addr6} 621 + fi 622 + 623 + __socatbind6=",bind=[${src_addr6}]" 624 + 625 + if [ -n "${src_port}" ] ;then 626 + __socatbind6="${__socatbind6}:${src_port}" 627 + fi 628 + fi 629 + 630 + echo "test6" | B socat -t 0.01 STDIN UDP6-DATAGRAM:[${dst_addr6}]:${dst_port}"${__socatbind6}" 626 631 } 627 632 elif command -v nc >/dev/null && nc -u -w0 1.1.1.1 1 2>/dev/null; then 628 633 # GNU netcat might not work with IPv6, try next tool
+1 -1
tools/testing/selftests/timens/Makefile
··· 1 - TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec futex vfork_exec 1 + TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec futex 2 2 TEST_GEN_PROGS_EXTENDED := gettime_perf 3 3 4 4 CFLAGS := -Wall -Werror -pthread
-90
tools/testing/selftests/timens/vfork_exec.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #define _GNU_SOURCE 3 - #include <errno.h> 4 - #include <fcntl.h> 5 - #include <sched.h> 6 - #include <stdio.h> 7 - #include <stdbool.h> 8 - #include <sys/stat.h> 9 - #include <sys/syscall.h> 10 - #include <sys/types.h> 11 - #include <sys/wait.h> 12 - #include <time.h> 13 - #include <unistd.h> 14 - #include <string.h> 15 - 16 - #include "log.h" 17 - #include "timens.h" 18 - 19 - #define OFFSET (36000) 20 - 21 - int main(int argc, char *argv[]) 22 - { 23 - struct timespec now, tst; 24 - int status, i; 25 - pid_t pid; 26 - 27 - if (argc > 1) { 28 - if (sscanf(argv[1], "%ld", &now.tv_sec) != 1) 29 - return pr_perror("sscanf"); 30 - 31 - for (i = 0; i < 2; i++) { 32 - _gettime(CLOCK_MONOTONIC, &tst, i); 33 - if (abs(tst.tv_sec - now.tv_sec) > 5) 34 - return pr_fail("%ld %ld\n", now.tv_sec, tst.tv_sec); 35 - } 36 - return 0; 37 - } 38 - 39 - nscheck(); 40 - 41 - ksft_set_plan(1); 42 - 43 - clock_gettime(CLOCK_MONOTONIC, &now); 44 - 45 - if (unshare_timens()) 46 - return 1; 47 - 48 - if (_settime(CLOCK_MONOTONIC, OFFSET)) 49 - return 1; 50 - 51 - for (i = 0; i < 2; i++) { 52 - _gettime(CLOCK_MONOTONIC, &tst, i); 53 - if (abs(tst.tv_sec - now.tv_sec) > 5) 54 - return pr_fail("%ld %ld\n", 55 - now.tv_sec, tst.tv_sec); 56 - } 57 - 58 - pid = vfork(); 59 - if (pid < 0) 60 - return pr_perror("fork"); 61 - 62 - if (pid == 0) { 63 - char now_str[64]; 64 - char *cargv[] = {"exec", now_str, NULL}; 65 - char *cenv[] = {NULL}; 66 - 67 - // Check that we are still in the source timens. 68 - for (i = 0; i < 2; i++) { 69 - _gettime(CLOCK_MONOTONIC, &tst, i); 70 - if (abs(tst.tv_sec - now.tv_sec) > 5) 71 - return pr_fail("%ld %ld\n", 72 - now.tv_sec, tst.tv_sec); 73 - } 74 - 75 - /* Check for proper vvar offsets after execve. */ 76 - snprintf(now_str, sizeof(now_str), "%ld", now.tv_sec + OFFSET); 77 - execve("/proc/self/exe", cargv, cenv); 78 - return pr_perror("execve"); 79 - } 80 - 81 - if (waitpid(pid, &status, 0) != pid) 82 - return pr_perror("waitpid"); 83 - 84 - if (status) 85 - ksft_exit_fail(); 86 - 87 - ksft_test_result_pass("exec\n"); 88 - ksft_exit_pass(); 89 - return 0; 90 - }
+2
tools/testing/selftests/wireguard/qemu/Makefile
··· 343 343 .PHONY: $(KERNEL_BZIMAGE) 344 344 345 345 $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed: | $(KERNEL_BUILD_PATH)/.config $(TOOLCHAIN_PATH)/.installed 346 + ifneq ($(ARCH),um) 346 347 rm -rf $(TOOLCHAIN_PATH)/$(CHOST)/include/linux 347 348 $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) INSTALL_HDR_PATH=$(TOOLCHAIN_PATH)/$(CHOST) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) headers_install 349 + endif 348 350 touch $@ 349 351 350 352 $(TOOLCHAIN_PATH)/.installed: $(TOOLCHAIN_TAR)