diff --git a/AndroidKernel.mk b/AndroidKernel.mk index f7e26617f635..73a2232be4a2 100644 --- a/AndroidKernel.mk +++ b/AndroidKernel.mk @@ -10,6 +10,8 @@ ifneq ($(TARGET_KERNEL_APPEND_DTB), true) $(info Using DTB Image) INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img endif +MAKE_ARGS := $(strip $(TARGET_KERNEL_MAKE_ARGS)) +KERNEL_DISABLE_DEBUGFS := $(TARGET_KERNEL_DISABLE_DEBUGFS) TARGET_KERNEL_MAKE_ENV := $(strip $(TARGET_KERNEL_MAKE_ENV)) ifeq ($(TARGET_KERNEL_MAKE_ENV),) @@ -138,6 +140,7 @@ $(info Using appended DTB) TARGET_PREBUILT_INT_KERNEL := $(TARGET_PREBUILT_INT_KERNEL)-dtb endif +KERNEL_DEBUGFS := $(KERNEL_OUT)/tmp KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr KERNEL_MODULES_INSTALL ?= system KERNEL_MODULES_OUT ?= $(PRODUCT_OUT)/$(KERNEL_MODULES_INSTALL)/lib/modules @@ -162,6 +165,9 @@ mpath=`dirname $$mdpath`; rm -rf $$mpath;\ fi endef +$(KERNEL_OUT): $(KERNEL_DEBUGFS) + mkdir -p $(KERNEL_OUT) + ifneq ($(KERNEL_LEGACY_DIR),true) $(KERNEL_USR): $(KERNEL_HEADERS_INSTALL) rm -rf $(KERNEL_SYMLINK) @@ -170,9 +176,6 @@ $(KERNEL_USR): $(KERNEL_HEADERS_INSTALL) $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_USR) endif -$(KERNEL_OUT): - mkdir -p $(KERNEL_OUT) - $(KERNEL_CONFIG): $(KERNEL_OUT) $(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG) $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ @@ -206,6 +209,17 @@ $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL) $(clean-module-folder) endif +$(KERNEL_DEBUGFS): + KERNEL_DIR=$(TARGET_KERNEL_SOURCE) \ + DEFCONFIG=$(KERNEL_DEFCONFIG) \ + OUT_DIR=$(KERNEL_OUT) \ + ARCH=$(KERNEL_ARCH) \ + CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) \ + DISABLE_DEBUGFS=$(KERNEL_DISABLE_DEBUGFS) \ + $(TARGET_KERNEL_SOURCE)/disable_dbgfs.sh \ + $(real_cc) \ + $(TARGET_KERNEL_MAKE_ARGS) + $(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \ rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG) && \ diff --git a/Documentation/devicetree/bindings/iio/adc/qcom-rradc.txt b/Documentation/devicetree/bindings/iio/adc/qcom-rradc.txt index 1ab49edfe30c..240c6d82deb0 100644 --- a/Documentation/devicetree/bindings/iio/adc/qcom-rradc.txt +++ b/Documentation/devicetree/bindings/iio/adc/qcom-rradc.txt @@ -45,6 +45,10 @@ Optional property: - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the PMIC fabrication ID for applying the appropriate temperature compensation parameters. +- qcom,batt-id-delay-ms : + Value type: + Definition: Used to specify HW settling time in MS for measuring BATT_ID. + Possible values are: 0, 1, 4, 12, 20, 40, 60, 80. Example: /* RRADC node */ diff --git a/Documentation/devicetree/bindings/media/video/msm-cam-smmu.txt b/Documentation/devicetree/bindings/media/video/msm-cam-smmu.txt index 4b1f08612865..b22615bdafef 100644 --- a/Documentation/devicetree/bindings/media/video/msm-cam-smmu.txt +++ b/Documentation/devicetree/bindings/media/video/msm-cam-smmu.txt @@ -67,6 +67,11 @@ Second Level Node - CAM SMMU context bank device or firmware device Value type: boolean Definition: Specifies if the context bank is a secure context bank. +- qcom,secure-pixel-cb + Usage: optional + Value type: boolean + Definition: Specifies if the context bank is a secure pixel context bank. + ============================================= Third Level Node - CAM SMMU memory map device ============================================= diff --git a/Documentation/devicetree/bindings/net/qrtr-ethernet-dev.txt b/Documentation/devicetree/bindings/net/qrtr-ethernet-dev.txt new file mode 100644 index 000000000000..94b9f9fd3374 --- /dev/null +++ b/Documentation/devicetree/bindings/net/qrtr-ethernet-dev.txt @@ -0,0 +1,30 @@ +QTI QRTR Ethernet Device transport binding + +- compatible: + Usage: required + Value type: + Definition: must be "qcom,qrtr-ethernet-dev" + +- qcom,net-id: + Usage: optional + Value type: + Definition: indicates what subnet this transport belongs to. Should be + passed into the qrtr core logic to determine if forwarding + is needed on this endpoint. + +- qcom,low-latency: + Usage: optional + Value type: + Definition: indicates whether this transport receiving thread needs to + be set to realtime priority for enhanced performance. + += EXAMPLE +The following example represents the qrtr ethernet dev transport node on a +device configured as an ethernet endpoint and needs to forward data from the +host to a modem co-processor. + + qcom,eth_dev_qrtr { + compatible = "qcom,qrtr-ethernet-dev"; + qcom,net-id = <4>; + qcom,low-latency; + }; diff --git a/Documentation/devicetree/bindings/soc/qcom/blocknames.txt b/Documentation/devicetree/bindings/soc/qcom/blocknames.txt new file mode 100644 index 000000000000..a0f4b39b8eda --- /dev/null +++ b/Documentation/devicetree/bindings/soc/qcom/blocknames.txt @@ -0,0 +1,18 @@ +* rename block devices + +Required properties: + +- compatible: "qcom,blkdev-rename" compatibility string +- actual-dev: Name of the disk assigned by generic driver +- rename-dev: Re-name of the disk to set for disks + +Example: + +rename_blk: rename_blk { + compatible = "qcom,blkdev-rename"; + actual-dev = "vda", "vdb", "vdc", + "vdd", "vde", "vdf", + "vdg", "vdh"; + rename-dev = "la_system", "la_userdata", "la_vendor", + "la_persist", "modem", "bluetooth", + "la_misc", "vbmeta"; diff --git a/arch/arm/configs/vendor/sa515m-perf_defconfig b/arch/arm/configs/vendor/sa515m-perf_defconfig index 8b002ff2c108..ba1f7b8d3bca 100644 --- a/arch/arm/configs/vendor/sa515m-perf_defconfig +++ b/arch/arm/configs/vendor/sa515m-perf_defconfig @@ -166,6 +166,7 @@ CONFIG_BRIDGE=y CONFIG_VLAN_8021Q=y CONFIG_NET_SCHED=y CONFIG_NET_SCH_PRIO=y +CONFIG_NET_SWITCHDEV=y CONFIG_QRTR=y CONFIG_QRTR_NODE_ID=2 CONFIG_QRTR_SMD=y @@ -322,7 +323,6 @@ CONFIG_USB_CONFIGFS_RNDIS=y CONFIG_USB_CONFIGFS_MASS_STORAGE=y CONFIG_USB_CONFIGFS_F_FS=y CONFIG_USB_CONFIGFS_UEVENT=y -CONFIG_USB_CONFIGFS_F_UAC1=y CONFIG_USB_CONFIGFS_F_DIAG=y CONFIG_USB_CONFIGFS_F_CDEV=y CONFIG_USB_CONFIGFS_F_GSI=y diff --git a/arch/arm/configs/vendor/sa515m_defconfig b/arch/arm/configs/vendor/sa515m_defconfig index 98c80cfb7720..90b571160d95 100644 --- a/arch/arm/configs/vendor/sa515m_defconfig +++ b/arch/arm/configs/vendor/sa515m_defconfig @@ -166,6 +166,7 @@ CONFIG_BRIDGE=y CONFIG_VLAN_8021Q=y CONFIG_NET_SCHED=y CONFIG_NET_SCH_PRIO=y +CONFIG_NET_SWITCHDEV=y CONFIG_QRTR=y CONFIG_QRTR_NODE_ID=2 CONFIG_QRTR_SMD=y @@ -324,7 +325,6 @@ CONFIG_USB_CONFIGFS_RNDIS=y CONFIG_USB_CONFIGFS_MASS_STORAGE=y CONFIG_USB_CONFIGFS_F_FS=y CONFIG_USB_CONFIGFS_UEVENT=y -CONFIG_USB_CONFIGFS_F_UAC1=y CONFIG_USB_CONFIGFS_F_DIAG=y CONFIG_USB_CONFIGFS_F_CDEV=y CONFIG_USB_CONFIGFS_F_GSI=y diff --git a/arch/arm/configs/vendor/sdm429-bg-perf_defconfig b/arch/arm/configs/vendor/sdm429-bg-perf_defconfig index a78dc6c5c287..d1fdcb58461c 100644 --- a/arch/arm/configs/vendor/sdm429-bg-perf_defconfig +++ b/arch/arm/configs/vendor/sdm429-bg-perf_defconfig @@ -41,7 +41,6 @@ CONFIG_EMBEDDED=y CONFIG_SLAB_FREELIST_RANDOM=y CONFIG_SLAB_FREELIST_HARDENED=y CONFIG_PROFILING=y -CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y @@ -298,7 +297,6 @@ CONFIG_USB_USBNET=y CONFIG_WIL6210=m CONFIG_WCNSS_MEM_PRE_ALLOC=y CONFIG_CLD_LL_CORE=y -CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set diff --git a/arch/arm/configs/vendor/sdm429-bg_defconfig b/arch/arm/configs/vendor/sdm429-bg_defconfig index 725b4396e640..23b7a19357f8 100644 --- a/arch/arm/configs/vendor/sdm429-bg_defconfig +++ b/arch/arm/configs/vendor/sdm429-bg_defconfig @@ -42,7 +42,6 @@ CONFIG_EMBEDDED=y CONFIG_SLAB_FREELIST_RANDOM=y CONFIG_SLAB_FREELIST_HARDENED=y CONFIG_PROFILING=y -CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y @@ -304,7 +303,6 @@ CONFIG_USB_RTL8152=y CONFIG_USB_USBNET=y CONFIG_WCNSS_MEM_PRE_ALLOC=y CONFIG_CLD_LL_CORE=y -CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index d8d90cf65b39..b397cf1e486d 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -18,6 +18,7 @@ #include #include #include +#include #include "proc-macros.S" @@ -547,10 +548,10 @@ __v7_setup_stack_ptr: ENDPROC(__v7_setup) .bss - .align 2 + .align L1_CACHE_SHIFT __v7_setup_stack: .space 4 * 7 @ 7 registers - + .align L1_CACHE_SHIFT __INITDATA .weak cpu_v7_bugs_init diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index b56a18c5aaa9..f80db0c9c571 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -214,6 +214,7 @@ dtb-$(CONFIG_QTI_GVM) += sa8155-vm-la.dtb \ sa8195-vm-la.dtb \ sa8195-vm-la-mt.dtb \ sa8195-vm-lv.dtb \ + sa8195-vm-lv-lxc.dtb \ sa8195-vm-lv-mt.dtb ifeq ($(CONFIG_BUILD_ARM64_DT_OVERLAY),y) diff --git a/arch/arm64/boot/dts/qcom/mdm9607-ion.dtsi b/arch/arm64/boot/dts/qcom/mdm9607-ion.dtsi index b828b3ccf78b..5b8d3bcc2ea1 100644 --- a/arch/arm64/boot/dts/qcom/mdm9607-ion.dtsi +++ b/arch/arm64/boot/dts/qcom/mdm9607-ion.dtsi @@ -32,7 +32,7 @@ reg = <27>; memory-region = <&qseecom_mem>; qcom,ion-heap-type = "DMA"; - status = "disabled"; + status = "ok"; }; }; }; diff --git a/arch/arm64/boot/dts/qcom/mdm9607.dtsi b/arch/arm64/boot/dts/qcom/mdm9607.dtsi index a21deb71ecec..285495da97d7 100644 --- a/arch/arm64/boot/dts/qcom/mdm9607.dtsi +++ b/arch/arm64/boot/dts/qcom/mdm9607.dtsi @@ -1679,7 +1679,7 @@ qcom,ce-opp-freq = <100000000>; }; - qcom_seecom: qseecom@87a80000 { + qcom_seecom: qseecom@88000000 { compatible = "qcom,qseecom"; reg = <0x88000000 0x500000>; reg-names = "secapp-region"; @@ -1687,6 +1687,7 @@ qcom,hlos-num-ce-hw-instances = <1>; qcom,hlos-ce-hw-instance = <0>; qcom,qsee-ce-hw-instance = <0>; + qcom,support-bus-scaling; qcom,msm-bus,name = "qseecom-noc"; qcom,msm-bus,num-cases = <4>; qcom,msm-bus,num-paths = <1>; diff --git a/arch/arm64/boot/dts/qcom/qcs405.dtsi b/arch/arm64/boot/dts/qcom/qcs405.dtsi index dfbb2146b1c9..45574c4891c6 100644 --- a/arch/arm64/boot/dts/qcom/qcs405.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs405.dtsi @@ -962,6 +962,11 @@ qcom,proc-img-to-load = "cdsp"; }; + qcom,eth_dev_qrtr { + compatible = "qcom,qrtr-ethernet-dev"; + qcom,low-latency; + }; + qcom,glink { compatible = "qcom,glink"; #address-cells = <1>; @@ -1718,9 +1723,9 @@ qcom,msm-bus,num-paths = <2>; qcom,msm-bus,vectors-KBps = <98 512 0 0>, <1 781 0 0>, /* No vote */ - <98 512 1250 0>, <1 781 0 40000>, /* 10Mbps vote */ - <98 512 12500 0>, <1 781 0 40000>, /* 100Mbps vote */ - <98 512 125000 0>, <1 781 0 40000>; /* 1000Mbps vote */ + <98 512 2500 0>, <1 781 0 40000>, /* 10Mbps vote */ + <98 512 25000 0>, <1 781 0 40000>, /* 100Mbps vote */ + <98 512 250000 0>, <1 781 0 40000>; /* 1000Mbps vote */ qcom,bus-vector-names = "0", "10", "100", "1000"; clocks = <&clock_gcc GCC_ETH_AXI_CLK>, <&clock_gcc GCC_ETH_PTP_CLK>, diff --git a/arch/arm64/boot/dts/qcom/quin-vm-common.dtsi b/arch/arm64/boot/dts/qcom/quin-vm-common.dtsi index 90aa33ba6541..5c5abef195ae 100644 --- a/arch/arm64/boot/dts/qcom/quin-vm-common.dtsi +++ b/arch/arm64/boot/dts/qcom/quin-vm-common.dtsi @@ -79,6 +79,16 @@ }; }; }; + + rename_blk: rename_blk { + compatible = "qcom,blkdev-rename"; + actual-dev = "vda", "vdb", "vdc", + "vdd", "vde", "vdf", + "vdg", "vdh"; + rename-dev = "la_system", "la_userdata", "la_vendor", + "la_persist", "modem", "bluetooth", + "la_misc", "vbmeta"; + }; }; &soc { diff --git a/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts b/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts index 3a5c5aef5c77..19b33f9f06ba 100644 --- a/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts +++ b/arch/arm64/boot/dts/qcom/sa2145p-ccard-nand-dc.dts @@ -54,3 +54,30 @@ /delete-node/ wlan_msa_region@88E0000; /delete-node/ wlan_fw_mem@86400000; }; + +&tlmm { + wakeup_gpio_default: wakeup_gpio_default { + mux { + pins = "gpio77"; + function = "gpio"; + }; + + config { + pins = "gpio77"; + drive-strength = <2>; + bias-pull-down; + }; + }; +}; + +&sdx_ext_ipc { + qcom,wakeup-gpio-out = <&tlmm 77 0x00>; +}; + +ðqos_hw { + rxc-skew-ps = <720>; + io-macro-info { + rx-prog-swap; + rx-dll-bypass; + }; +}; diff --git a/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts b/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts index fb3ae4f7843d..418d9bb685a5 100644 --- a/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts +++ b/arch/arm64/boot/dts/qcom/sa2150p-ccard-nand-dc.dts @@ -128,3 +128,30 @@ /delete-node/ wlan_msa_region@88E0000; /delete-node/ wlan_fw_mem@86400000; }; + +&tlmm { + wakeup_gpio_default: wakeup_gpio_default { + mux { + pins = "gpio77"; + function = "gpio"; + }; + + config { + pins = "gpio77"; + drive-strength = <2>; + bias-pull-down; + }; + }; +}; + +&sdx_ext_ipc { + qcom,wakeup-gpio-out = <&tlmm 77 0x00>; +}; + +ðqos_hw { + rxc-skew-ps = <720>; + io-macro-info { + rx-prog-swap; + rx-dll-bypass; + }; +}; diff --git a/arch/arm64/boot/dts/qcom/sa6155p-camera.dtsi b/arch/arm64/boot/dts/qcom/sa6155p-camera.dtsi index 3eb01a1b915b..d9b3dd8a4490 100644 --- a/arch/arm64/boot/dts/qcom/sa6155p-camera.dtsi +++ b/arch/arm64/boot/dts/qcom/sa6155p-camera.dtsi @@ -46,6 +46,26 @@ status = "disabled"; }; +&cam_smmu { + msm_cam_smmu_ife_cp { + compatible = "qcom,msm-cam-smmu-cb"; + iommus = <&apps_smmu 0x821 0x1C0>, + <&apps_smmu 0x841 0x0>, + <&apps_smmu 0x861 0x1C0>; + label = "ife-cp"; + qcom,secure-pixel-cb; + ife_cp_iova_mem_map: iova-mem-map { + /* IO region is approximately 2.5 GB */ + iova-mem-region-io { + iova-region-name = "io"; + iova-region-start = <0x7400000>; + iova-region-len = <0x98C00000>; + iova-region-id = <0x3>; + status = "ok"; + }; + }; + }; +}; &soc { /delete-node/ cam_isp_mgr; diff --git a/arch/arm64/boot/dts/qcom/sa6155p-vm-qupv3.dtsi b/arch/arm64/boot/dts/qcom/sa6155p-vm-qupv3.dtsi index a3b8ff0bb9ef..5b77a4412e49 100644 --- a/arch/arm64/boot/dts/qcom/sa6155p-vm-qupv3.dtsi +++ b/arch/arm64/boot/dts/qcom/sa6155p-vm-qupv3.dtsi @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -426,6 +426,7 @@ pinctrl-1 = <&qupv3_se9_spi_sleep>; spi-max-frequency = <50000000>; qcom,wrapper-core = <&qupv3_2>; + qcom,disable-dma; status = "disabled"; }; @@ -445,6 +446,7 @@ pinctrl-1 = <&qupv3_se10_spi_sleep>; spi-max-frequency = <50000000>; qcom,wrapper-core = <&qupv3_2>; + qcom,disable-dma; status = "disabled"; }; }; diff --git a/arch/arm64/boot/dts/qcom/sa8155-camera.dtsi b/arch/arm64/boot/dts/qcom/sa8155-camera.dtsi index 2ded8cd4df2f..708cc284af93 100644 --- a/arch/arm64/boot/dts/qcom/sa8155-camera.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8155-camera.dtsi @@ -62,6 +62,31 @@ status = "disabled"; }; +&cam_smmu { + msm_cam_smmu_ife_cp { + compatible = "qcom,msm-cam-smmu-cb"; + iommus = <&apps_smmu 0x841 0x620>, + <&apps_smmu 0x861 0x620>, + <&apps_smmu 0xA41 0x620>, + <&apps_smmu 0xA61 0x620>, + <&apps_smmu 0xC41 0x620>, + <&apps_smmu 0xC61 0x620>, + <&apps_smmu 0xE41 0x620>, + <&apps_smmu 0xE61 0x620>; + label = "ife-cp"; + qcom,secure-pixel-cb; + ife_cp_iova_mem_map: iova-mem-map { + /* IO region is approximately 2.5 GB */ + iova-mem-region-io { + iova-region-name = "io"; + iova-region-start = <0x7400000>; + iova-region-len = <0x98C00000>; + iova-region-id = <0x3>; + status = "ok"; + }; + }; + }; +}; &soc { /delete-node/ cam_isp_mgr; diff --git a/arch/arm64/boot/dts/qcom/sa8195-vm-lv-lxc.dts b/arch/arm64/boot/dts/qcom/sa8195-vm-lv-lxc.dts new file mode 100644 index 000000000000..99342867dcbb --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sa8195-vm-lv-lxc.dts @@ -0,0 +1,23 @@ +/* Copyright (c) 2020, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +#include "sa8195-vm.dtsi" +#include "sa8195-vm-lv-lxc.dtsi" + +/ { + model = "Qualcomm Technologies, Inc. SA8195 Single LV Virtual Machine"; + compatible = "qcom,sa8195p"; + qcom,pmic-name = "PM8195"; + qcom,board-id = <0x1000002 0>; +}; diff --git a/arch/arm64/boot/dts/qcom/sa8195-vm-lv-lxc.dtsi b/arch/arm64/boot/dts/qcom/sa8195-vm-lv-lxc.dtsi new file mode 100644 index 000000000000..d2eceb74af93 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sa8195-vm-lv-lxc.dtsi @@ -0,0 +1,59 @@ +/* Copyright (c) 2020, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/ { + reserved_memory: reserved-memory { + + pmem_shared: pmem_shared_region@a0000000 { + reg = <0x0 0xa0000000 0x0 0x20000000>; + label = "pmem_shared_mem"; + }; + }; + +}; + +&hab { + vmid = <3>; +}; + +&slpi_tlmm { + status = "ok"; +}; + +&apps_smmu { + status = "ok"; +}; + +&qupv3_se13_4uart { + status = "ok"; +}; + +&usb0 { + status = "ok"; +}; + +&usb2_phy0 { + status = "ok"; +}; + +&pcie0_msi { + status = "ok"; +}; + +&pcie0 { + status = "ok"; +}; + +&sde_kms_hyp { + /delete-property/ qcom,client-id; + qcom,client-id = "7816"; +}; diff --git a/arch/arm64/boot/dts/qcom/sa8195p-camera.dtsi b/arch/arm64/boot/dts/qcom/sa8195p-camera.dtsi index 7a3bd743658a..b869b06b6f97 100644 --- a/arch/arm64/boot/dts/qcom/sa8195p-camera.dtsi +++ b/arch/arm64/boot/dts/qcom/sa8195p-camera.dtsi @@ -532,14 +532,22 @@ msm_cam_smmu_ife { compatible = "qcom,msm-cam-smmu-cb"; - iommus = <&apps_smmu 0xAA0 0x4E0>, - <&apps_smmu 0xA20 0x4E0>, - <&apps_smmu 0xA00 0x4E0>, + iommus = <&apps_smmu 0xA00 0x4E0>, + <&apps_smmu 0xAA0 0x4E0>, + <&apps_smmu 0xA40 0x4E0>, + <&apps_smmu 0xA60 0x4E0>, <&apps_smmu 0xA80 0x4E0>, - <&apps_smmu 0xEA0 0x4E0>, - <&apps_smmu 0xE20 0x4E0>, + <&apps_smmu 0xA20 0x4E0>, + <&apps_smmu 0xAC0 0x4E0>, + <&apps_smmu 0xAE0 0x4E0>, <&apps_smmu 0xE00 0x4E0>, - <&apps_smmu 0xE80 0x4E0>; + <&apps_smmu 0xEA0 0x4E0>, + <&apps_smmu 0xE40 0x4E0>, + <&apps_smmu 0xE60 0x4E0>, + <&apps_smmu 0xE80 0x4E0>, + <&apps_smmu 0xE20 0x4E0>, + <&apps_smmu 0xEC0 0x4E0>, + <&apps_smmu 0xEE0 0x4E0>; label = "ife"; ife_iova_mem_map: iova-mem-map { /* IO region is approximately 3.4 GB */ @@ -553,6 +561,38 @@ }; }; + msm_cam_smmu_ife_cp { + compatible = "qcom,msm-cam-smmu-cb"; + iommus = <&apps_smmu 0xA01 0x5E0>, + <&apps_smmu 0xAA1 0x5E0>, + <&apps_smmu 0xA41 0x5E0>, + <&apps_smmu 0xA61 0x5E0>, + <&apps_smmu 0xA81 0x5E0>, + <&apps_smmu 0xA21 0x5E0>, + <&apps_smmu 0xAC1 0x5E0>, + <&apps_smmu 0xAE1 0x5E0>, + <&apps_smmu 0xE01 0x5E0>, + <&apps_smmu 0xEA1 0x5E0>, + <&apps_smmu 0xE41 0x5E0>, + <&apps_smmu 0xE61 0x5E0>, + <&apps_smmu 0xE81 0x5E0>, + <&apps_smmu 0xE21 0x5E0>, + <&apps_smmu 0xEC1 0x5E0>, + <&apps_smmu 0xEE1 0x5E0>; + label = "ife-cp"; + qcom,secure-pixel-cb; + ife_cp_iova_mem_map: iova-mem-map { + /* IO region is approximately 2.5 GB */ + iova-mem-region-io { + iova-region-name = "io"; + iova-region-start = <0x7400000>; + iova-region-len = <0x98C00000>; + iova-region-id = <0x3>; + status = "ok"; + }; + }; + }; + msm_cam_smmu_jpeg { compatible = "qcom,msm-cam-smmu-cb"; iommus = <&apps_smmu 0x2100 0x20>, diff --git a/arch/arm64/boot/dts/qcom/sda429-bg-dvt2-wtp-overlay.dts b/arch/arm64/boot/dts/qcom/sda429-bg-dvt2-wtp-overlay.dts index 04d3b38f2d42..449691b4c68d 100644 --- a/arch/arm64/boot/dts/qcom/sda429-bg-dvt2-wtp-overlay.dts +++ b/arch/arm64/boot/dts/qcom/sda429-bg-dvt2-wtp-overlay.dts @@ -17,6 +17,7 @@ #include #include "sda429-bg-dvt2-wtp.dtsi" #include "sdm429-mdss-panels.dtsi" +#include "sdm429-spyro-qrd-evt-audio.dtsi" / { model = "Qualcomm Technologies, Inc. SDA429 QRD BG WTP Overlay"; diff --git a/arch/arm64/boot/dts/qcom/sdm429-blsp.dtsi b/arch/arm64/boot/dts/qcom/sdm429-blsp.dtsi index e661a4f1db0b..06f9e76d7983 100644 --- a/arch/arm64/boot/dts/qcom/sdm429-blsp.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm429-blsp.dtsi @@ -198,6 +198,7 @@ interrupts = <0 97 IRQ_TYPE_LEVEL_HIGH>, <0 238 IRQ_TYPE_LEVEL_HIGH>; spi-max-frequency = <50000000>; + qcom,use-bam; qcom,ver-reg-exists; qcom,bam-consumer-pipe-index = <8>; qcom,bam-producer-pipe-index = <9>; diff --git a/arch/arm64/boot/dts/qcom/sdm429w-bg-pm660.dtsi b/arch/arm64/boot/dts/qcom/sdm429w-bg-pm660.dtsi index 5ceebb2c9b30..21004c2dbc1d 100644 --- a/arch/arm64/boot/dts/qcom/sdm429w-bg-pm660.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm429w-bg-pm660.dtsi @@ -29,7 +29,3 @@ &pm660_fg { qcom,fg-disable-in-twm; }; - -&pm660_haptics { - qcom,haptics-ext-pin-twm; -}; diff --git a/arch/arm64/boot/dts/qcom/sdm429w-pm660.dtsi b/arch/arm64/boot/dts/qcom/sdm429w-pm660.dtsi index c670547294ba..eb338f2af52f 100644 --- a/arch/arm64/boot/dts/qcom/sdm429w-pm660.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm429w-pm660.dtsi @@ -131,7 +131,6 @@ /delete-property/ qcom,lra-allow-variable-play; /delete-property/ qcom,lra-allow-variable-play-rate; qcom,actuator-type = "erm"; - qcom,ilim-ma = <400>; qcom,play-rate-us = <10000>; wf_0 { diff --git a/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts b/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts index 661437a49e92..20ec19a543e7 100644 --- a/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts +++ b/arch/arm64/boot/dts/qcom/sdm660-usbc-audio-mtp-overlay.dts @@ -13,6 +13,7 @@ /dts-v1/; /plugin/; #include +#include #include "sdm660-mtp.dtsi" #include "sdm660-external-codec.dtsi" diff --git a/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi b/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi index 86098aa8ccba..2e2abfe4b014 100644 --- a/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmmagpie.dtsi @@ -2633,6 +2633,13 @@ qcom,minidump-id = <3>; qcom,complete-ramdump; + qcom,msm-bus,name = "pil-modem"; + qcom,msm-bus,num-cases = <2>; + qcom,msm-bus,num-paths = <1>; + qcom,msm-bus,vectors-KBps = + <129 512 0 0>, + <129 512 0 7000000>; + /* Inputs from mss */ interrupts-extended = <&pdc GIC_SPI 266 IRQ_TYPE_EDGE_RISING>, <&modem_smp2p_in 0 IRQ_TYPE_NONE>, diff --git a/arch/arm64/boot/dts/qcom/sdmshrike.dtsi b/arch/arm64/boot/dts/qcom/sdmshrike.dtsi index a737a5321d4a..12825eaef049 100644 --- a/arch/arm64/boot/dts/qcom/sdmshrike.dtsi +++ b/arch/arm64/boot/dts/qcom/sdmshrike.dtsi @@ -719,7 +719,7 @@ alloc-ranges = <0x0 0x00000000 0x0 0xffffffff>; reusable; alignment = <0x0 0x400000>; - size = <0x0 0x2800000>; + size = <0x0 0x3c00000>; linux,cma-default; }; }; diff --git a/arch/arm64/boot/dts/qcom/sdxprairie-audio.dtsi b/arch/arm64/boot/dts/qcom/sdxprairie-audio.dtsi index 26204b4f6814..589e790f9e78 100644 --- a/arch/arm64/boot/dts/qcom/sdxprairie-audio.dtsi +++ b/arch/arm64/boot/dts/qcom/sdxprairie-audio.dtsi @@ -38,7 +38,9 @@ <&afe_proxy_tx>, <&incall_record_rx>, <&incall_record_tx>, <&incall_music_rx>, <&dai_pri_tdm_rx_0>, <&dai_pri_tdm_tx_0>, + <&dai_pri_tdm_rx_1>, <&dai_pri_tdm_tx_1>, <&dai_sec_tdm_rx_0>, <&dai_sec_tdm_tx_0>, + <&dai_sec_tdm_rx_1>, <&dai_sec_tdm_tx_1>, <&dai_sec_auxpcm>, <&incall2_record_rx>, <&incall_music_2_rx>, <&incall_music_dl_rx>; asoc-cpu-names = "msm-dai-q6-auxpcm.1", @@ -50,7 +52,9 @@ "msm-dai-q6-dev.240", "msm-dai-q6-dev.32771", "msm-dai-q6-dev.32772", "msm-dai-q6-dev.32773", "msm-dai-q6-tdm.36864", "msm-dai-q6-tdm.36865", + "msm-dai-q6-tdm.36866", "msm-dai-q6-tdm.36867", "msm-dai-q6-tdm.36880", "msm-dai-q6-tdm.36881", + "msm-dai-q6-tdm.36882", "msm-dai-q6-tdm.36883", "msm-dai-q6-auxpcm.2", "msm-dai-q6-dev.32769", "msm-dai-q6-dev.32770", "msm-dai-q6-dev.32774"; }; diff --git a/arch/arm64/boot/dts/qcom/sdxprairie.dtsi b/arch/arm64/boot/dts/qcom/sdxprairie.dtsi index ae83aacc0450..3206654f92a7 100644 --- a/arch/arm64/boot/dts/qcom/sdxprairie.dtsi +++ b/arch/arm64/boot/dts/qcom/sdxprairie.dtsi @@ -704,6 +704,12 @@ qcom,net-id = <3>; }; + eth_dev_qrtr: qcom,eth_dev_qrtr { + compatible = "qcom,qrtr-ethernet-dev"; + qcom,net-id = <4>; + qcom,low-latency; + }; + qcom,glinkpkt { compatible = "qcom,glinkpkt"; diff --git a/arch/arm64/boot/dts/qcom/sm6150-camera.dtsi b/arch/arm64/boot/dts/qcom/sm6150-camera.dtsi index f0acba499904..7ce2aec6b3a8 100644 --- a/arch/arm64/boot/dts/qcom/sm6150-camera.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6150-camera.dtsi @@ -227,7 +227,7 @@ }; }; - qcom,cam_smmu { + cam_smmu: qcom,cam_smmu { compatible = "qcom,msm-cam-smmu"; status = "ok"; diff --git a/arch/arm64/boot/dts/qcom/sm8150-camera.dtsi b/arch/arm64/boot/dts/qcom/sm8150-camera.dtsi index 07aea5e101b8..2c08330b15bc 100644 --- a/arch/arm64/boot/dts/qcom/sm8150-camera.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150-camera.dtsi @@ -316,7 +316,7 @@ }; }; - msm_cam_smmu: qcom,cam_smmu { + cam_smmu: qcom,cam_smmu { compatible = "qcom,msm-cam-smmu"; status = "ok"; diff --git a/arch/arm64/configs/vendor/atoll-perf_defconfig b/arch/arm64/configs/vendor/atoll-perf_defconfig index 7268935d0211..2b5babeda540 100644 --- a/arch/arm64/configs/vendor/atoll-perf_defconfig +++ b/arch/arm64/configs/vendor/atoll-perf_defconfig @@ -17,18 +17,17 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_BPF=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -39,6 +38,7 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_RD_LZ4 is not set CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set @@ -48,7 +48,6 @@ CONFIG_PROFILING=y CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -78,6 +77,7 @@ CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM64_VHE is not set CONFIG_RANDOMIZE_BASE=y # CONFIG_EFI is not set @@ -245,6 +245,7 @@ CONFIG_NET_ACT_MIRRED=y CONFIG_NET_ACT_SKBEDIT=y CONFIG_QRTR=y CONFIG_QRTR_SMD=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -320,6 +321,8 @@ CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ATMEL_MXT=y CONFIG_TOUCHSCREEN_ST=y @@ -457,7 +460,6 @@ CONFIG_HID_NINTENDO=y CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y CONFIG_HID_QVR=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -660,6 +662,7 @@ CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_QCOM_QFPROM=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y @@ -702,6 +705,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_PANIC_TIMEOUT=5 CONFIG_SCHEDSTATS=y # CONFIG_DEBUG_PREEMPT is not set +CONFIG_DEBUG_LIST=y CONFIG_IPC_LOGGING=y CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_CORESIGHT=y @@ -721,6 +725,7 @@ CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/atoll_defconfig b/arch/arm64/configs/vendor/atoll_defconfig index 571da08e467a..38e428ac723f 100644 --- a/arch/arm64/configs/vendor/atoll_defconfig +++ b/arch/arm64/configs/vendor/atoll_defconfig @@ -16,12 +16,12 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y CONFIG_DEBUG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y @@ -29,7 +29,6 @@ CONFIG_CGROUP_BPF=y CONFIG_CGROUP_DEBUG=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -41,6 +40,7 @@ CONFIG_BLK_DEV_INITRD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_COMPAT_BRK is not set CONFIG_SLAB_FREELIST_RANDOM=y @@ -50,7 +50,6 @@ CONFIG_KPROBES=y CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -84,6 +83,7 @@ CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM64_VHE is not set CONFIG_RANDOMIZE_BASE=y CONFIG_KRYO_PMU_WORKAROUND=y @@ -253,6 +253,7 @@ CONFIG_NET_ACT_SKBEDIT=y CONFIG_DNS_RESOLVER=y CONFIG_QRTR=y CONFIG_QRTR_SMD=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -330,6 +331,7 @@ CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ATMEL_MXT=y CONFIG_TOUCHSCREEN_ST=y @@ -472,7 +474,6 @@ CONFIG_HID_NINTENDO=y CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y CONFIG_HID_QVR=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -690,6 +691,7 @@ CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_QCOM_QFPROM=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y @@ -809,6 +811,7 @@ CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_HARDENED_USERCOPY_PAGESPAN=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/qti-quin-gvm-perf_defconfig b/arch/arm64/configs/vendor/qti-quin-gvm-perf_defconfig index 394690495768..c1281e9efb76 100644 --- a/arch/arm64/configs/vendor/qti-quin-gvm-perf_defconfig +++ b/arch/arm64/configs/vendor/qti-quin-gvm-perf_defconfig @@ -463,6 +463,7 @@ CONFIG_MEM_SHARE_QMI_SERVICE=y CONFIG_MSM_HAB=y CONFIG_QCOM_HGSL_TCSR_SIGNAL=y CONFIG_QCOM_HGSL=y +CONFIG_RENAME_BLOCK_DEVICE=y CONFIG_PM_DEVFREQ=y CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y CONFIG_EXTCON_USB_GPIO=y diff --git a/arch/arm64/configs/vendor/qti-quin-gvm_defconfig b/arch/arm64/configs/vendor/qti-quin-gvm_defconfig index aec2c05011ab..22a036e1a74e 100644 --- a/arch/arm64/configs/vendor/qti-quin-gvm_defconfig +++ b/arch/arm64/configs/vendor/qti-quin-gvm_defconfig @@ -474,6 +474,7 @@ CONFIG_MEM_SHARE_QMI_SERVICE=y CONFIG_MSM_HAB=y CONFIG_QCOM_HGSL_TCSR_SIGNAL=y CONFIG_QCOM_HGSL=y +CONFIG_RENAME_BLOCK_DEVICE=y CONFIG_PM_DEVFREQ=y CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y CONFIG_EXTCON_USB_GPIO=y diff --git a/arch/arm64/configs/vendor/sa2150p-nand-perf_defconfig b/arch/arm64/configs/vendor/sa2150p-nand-perf_defconfig index 8949cf9519a0..cd9423f0a52a 100644 --- a/arch/arm64/configs/vendor/sa2150p-nand-perf_defconfig +++ b/arch/arm64/configs/vendor/sa2150p-nand-perf_defconfig @@ -238,6 +238,9 @@ CONFIG_DM_VERITY_FEC=y CONFIG_NETDEVICES=y CONFIG_DUMMY=y CONFIG_TUN=y +CONFIG_STMMAC_ETH=y +# CONFIG_DWMAC_GENERIC is not set +# CONFIG_DWMAC_IPQ806X is not set CONFIG_AT803X_PHY=y CONFIG_MICREL_PHY=y CONFIG_PPP=y @@ -276,11 +279,11 @@ CONFIG_I2C_MUX=y CONFIG_I2C_MSM_V2=y CONFIG_SPI=y CONFIG_SPI_QUP=y +CONFIG_SPI_SPIDEV=y CONFIG_SPMI=y CONFIG_SLIMBUS=y CONFIG_SLIMBUS_MSM_NGD=y CONFIG_PPS_CLIENT_GPIO=y -CONFIG_PTP_1588_CLOCK=y CONFIG_PINCTRL_QCS405=y CONFIG_FRAGMENTED_GPIO_ADDRESS_SPACE=y CONFIG_PINCTRL_QCOM_SPMI_PMIC=y diff --git a/arch/arm64/configs/vendor/sa2150p-nand_defconfig b/arch/arm64/configs/vendor/sa2150p-nand_defconfig index e35d9fe9cf9c..77c30567355a 100644 --- a/arch/arm64/configs/vendor/sa2150p-nand_defconfig +++ b/arch/arm64/configs/vendor/sa2150p-nand_defconfig @@ -238,6 +238,9 @@ CONFIG_DM_VERITY_FEC=y CONFIG_NETDEVICES=y CONFIG_DUMMY=y CONFIG_TUN=y +CONFIG_STMMAC_ETH=y +# CONFIG_DWMAC_GENERIC is not set +# CONFIG_DWMAC_IPQ806X is not set CONFIG_AT803X_PHY=y CONFIG_MICREL_PHY=y CONFIG_PPP=y @@ -282,7 +285,6 @@ CONFIG_SPMI=y CONFIG_SLIMBUS=y CONFIG_SLIMBUS_MSM_NGD=y CONFIG_PPS_CLIENT_GPIO=y -CONFIG_PTP_1588_CLOCK=y CONFIG_PINCTRL_QCS405=y CONFIG_FRAGMENTED_GPIO_ADDRESS_SPACE=y CONFIG_PINCTRL_QCOM_SPMI_PMIC=y diff --git a/arch/arm64/configs/vendor/sa2150p-perf_defconfig b/arch/arm64/configs/vendor/sa2150p-perf_defconfig index c0a089b14414..e1e518583dcf 100644 --- a/arch/arm64/configs/vendor/sa2150p-perf_defconfig +++ b/arch/arm64/configs/vendor/sa2150p-perf_defconfig @@ -290,6 +290,7 @@ CONFIG_I2C_MUX=y CONFIG_I2C_MSM_V2=y CONFIG_SPI=y CONFIG_SPI_QUP=y +CONFIG_SPI_SPIDEV=y CONFIG_SPMI=y CONFIG_SLIMBUS_MSM_NGD=y CONFIG_PPS_CLIENT_GPIO=y diff --git a/arch/arm64/configs/vendor/sa8155-perf_defconfig b/arch/arm64/configs/vendor/sa8155-perf_defconfig index e15c2f8b3418..5032fae84d52 100644 --- a/arch/arm64/configs/vendor/sa8155-perf_defconfig +++ b/arch/arm64/configs/vendor/sa8155-perf_defconfig @@ -318,6 +318,7 @@ CONFIG_CNSS2=y CONFIG_CNSS2_DEBUG=y CONFIG_CNSS2_QMI=y CONFIG_CNSS_ASYNC=y +CONFIG_CNSS_UTILS=y CONFIG_CNSS_GENL=y CONFIG_NVM=y CONFIG_NVM_RRPC=y diff --git a/arch/arm64/configs/vendor/sa8155_defconfig b/arch/arm64/configs/vendor/sa8155_defconfig index 189f980e5bd8..359ae8a3e879 100644 --- a/arch/arm64/configs/vendor/sa8155_defconfig +++ b/arch/arm64/configs/vendor/sa8155_defconfig @@ -329,6 +329,7 @@ CONFIG_CNSS2=y CONFIG_CNSS2_DEBUG=y CONFIG_CNSS2_QMI=y CONFIG_CNSS_ASYNC=y +CONFIG_CNSS_UTILS=y CONFIG_CNSS_GENL=y CONFIG_NVM=y CONFIG_NVM_RRPC=y diff --git a/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig b/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig index 6069cb150ce2..cf2d2fe4c5bc 100644 --- a/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig +++ b/arch/arm64/configs/vendor/sdmsteppe-perf_defconfig @@ -16,18 +16,17 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_BPF=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -38,6 +37,7 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_RD_LZ4 is not set CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set @@ -47,7 +47,6 @@ CONFIG_PROFILING=y CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -73,6 +72,7 @@ CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM64_VHE is not set CONFIG_RANDOMIZE_BASE=y # CONFIG_EFI is not set @@ -241,6 +241,7 @@ CONFIG_NET_ACT_MIRRED=y CONFIG_NET_ACT_SKBEDIT=y CONFIG_QRTR=y CONFIG_QRTR_SMD=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -316,6 +317,8 @@ CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ST=y CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y @@ -442,7 +445,6 @@ CONFIG_HID_NINTENDO=y CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y CONFIG_HID_QVR=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -640,6 +642,7 @@ CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y CONFIG_ESOC=y @@ -681,6 +684,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_PANIC_TIMEOUT=5 CONFIG_SCHEDSTATS=y # CONFIG_DEBUG_PREEMPT is not set +CONFIG_DEBUG_LIST=y CONFIG_IPC_LOGGING=y CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_CORESIGHT=y @@ -700,6 +704,7 @@ CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/sdmsteppe_defconfig b/arch/arm64/configs/vendor/sdmsteppe_defconfig index 2d93f5047063..3c788d2bca17 100644 --- a/arch/arm64/configs/vendor/sdmsteppe_defconfig +++ b/arch/arm64/configs/vendor/sdmsteppe_defconfig @@ -15,12 +15,12 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y CONFIG_DEBUG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y @@ -28,7 +28,6 @@ CONFIG_CGROUP_BPF=y CONFIG_CGROUP_DEBUG=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -40,6 +39,7 @@ CONFIG_BLK_DEV_INITRD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_COMPAT_BRK is not set CONFIG_SLAB_FREELIST_RANDOM=y @@ -48,7 +48,6 @@ CONFIG_PROFILING=y CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -79,6 +78,7 @@ CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM64_VHE is not set CONFIG_RANDOMIZE_BASE=y CONFIG_KRYO_PMU_WORKAROUND=y @@ -249,6 +249,7 @@ CONFIG_NET_ACT_SKBEDIT=y CONFIG_DNS_RESOLVER=y CONFIG_QRTR=y CONFIG_QRTR_SMD=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -326,6 +327,7 @@ CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ST=y CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y @@ -466,7 +468,6 @@ CONFIG_HID_NINTENDO=y CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y CONFIG_HID_QVR=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -677,6 +678,7 @@ CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y CONFIG_ESOC=y @@ -795,6 +797,7 @@ CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_HARDENED_USERCOPY_PAGESPAN=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/sm8150-perf_defconfig b/arch/arm64/configs/vendor/sm8150-perf_defconfig index 084e44000588..6b8a37fc3af9 100644 --- a/arch/arm64/configs/vendor/sm8150-perf_defconfig +++ b/arch/arm64/configs/vendor/sm8150-perf_defconfig @@ -17,18 +17,17 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_BPF=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -39,6 +38,7 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_RD_LZ4 is not set CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set @@ -49,7 +49,6 @@ CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_REFCOUNT_FULL=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -78,6 +77,7 @@ CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM64_VHE is not set CONFIG_RANDOMIZE_BASE=y # CONFIG_EFI is not set @@ -249,6 +249,7 @@ CONFIG_QRTR=y CONFIG_QRTR_SMD=y CONFIG_QRTR_MHI=y CONFIG_QRTR_FIFO=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -325,6 +326,8 @@ CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ST=y CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y @@ -451,7 +454,6 @@ CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y CONFIG_HID_QVR=y CONFIG_USB_HIDDEV=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -647,6 +649,7 @@ CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y CONFIG_ESOC=y @@ -688,6 +691,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_PANIC_TIMEOUT=-1 CONFIG_SCHEDSTATS=y # CONFIG_DEBUG_PREEMPT is not set +CONFIG_DEBUG_LIST=y CONFIG_IPC_LOGGING=y CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_CORESIGHT=y @@ -709,6 +713,7 @@ CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/sm8150_defconfig b/arch/arm64/configs/vendor/sm8150_defconfig index e21d100fa8ad..1f1866b3ebec 100644 --- a/arch/arm64/configs/vendor/sm8150_defconfig +++ b/arch/arm64/configs/vendor/sm8150_defconfig @@ -16,12 +16,12 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y CONFIG_DEBUG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y @@ -29,7 +29,6 @@ CONFIG_CGROUP_BPF=y CONFIG_CGROUP_DEBUG=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -41,6 +40,7 @@ CONFIG_BLK_DEV_INITRD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_COMPAT_BRK is not set CONFIG_SLAB_FREELIST_RANDOM=y @@ -51,7 +51,6 @@ CONFIG_REFCOUNT_FULL=y CONFIG_PANIC_ON_REFCOUNT_ERROR=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -85,6 +84,7 @@ CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y CONFIG_CP15_BARRIER_EMULATION=y CONFIG_SETEND_EMULATION=y +CONFIG_ARM64_SW_TTBR0_PAN=y # CONFIG_ARM64_VHE is not set CONFIG_RANDOMIZE_BASE=y CONFIG_BUILD_ARM64_UNCOMPRESSED_KERNEL=y @@ -258,6 +258,7 @@ CONFIG_QRTR=y CONFIG_QRTR_SMD=y CONFIG_QRTR_MHI=y CONFIG_QRTR_FIFO=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -337,6 +338,7 @@ CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ST=y CONFIG_TOUCHSCREEN_SYNAPTICS_TCM=y @@ -467,7 +469,6 @@ CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y CONFIG_HID_QVR=y CONFIG_USB_HIDDEV=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -677,6 +678,7 @@ CONFIG_QCOM_LLCC_PMU=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y CONFIG_ESOC=y @@ -796,6 +798,7 @@ CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_HARDENED_USERCOPY_PAGESPAN=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/trinket-perf_defconfig b/arch/arm64/configs/vendor/trinket-perf_defconfig index d6b5f618497e..9248468b02eb 100644 --- a/arch/arm64/configs/vendor/trinket-perf_defconfig +++ b/arch/arm64/configs/vendor/trinket-perf_defconfig @@ -17,18 +17,17 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_BPF=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -39,6 +38,7 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_RD_LZ4 is not set CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_COMPAT_BRK is not set CONFIG_SLAB_FREELIST_RANDOM=y @@ -47,7 +47,6 @@ CONFIG_PROFILING=y CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -244,6 +243,7 @@ CONFIG_NET_ACT_MIRRED=y CONFIG_NET_ACT_SKBEDIT=y CONFIG_QRTR=y CONFIG_QRTR_SMD=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -316,6 +316,8 @@ CONFIG_CNSS_GENL=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y CONFIG_TOUCHSCREEN_HIMAX_I2C=y @@ -458,7 +460,6 @@ CONFIG_HID_MULTITOUCH=y CONFIG_HID_NINTENDO=y CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -631,6 +632,7 @@ CONFIG_QTI_MPM=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_QCOM_QFPROM=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y @@ -648,6 +650,7 @@ CONFIG_QUOTA_NETLINK_INTERFACE=y CONFIG_QFMT_V2=y CONFIG_FUSE_FS=y CONFIG_OVERLAY_FS=y +CONFIG_INCREMENTAL_FS=y CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y CONFIG_TMPFS_POSIX_ACL=y @@ -665,6 +668,7 @@ CONFIG_MAGIC_SYSRQ=y CONFIG_PANIC_TIMEOUT=5 CONFIG_SCHEDSTATS=y # CONFIG_DEBUG_PREEMPT is not set +CONFIG_DEBUG_LIST=y CONFIG_IPC_LOGGING=y CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_CORESIGHT=y @@ -684,6 +688,7 @@ CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/arch/arm64/configs/vendor/trinket_defconfig b/arch/arm64/configs/vendor/trinket_defconfig index 5132a6da3b89..cf1f806d7c9b 100644 --- a/arch/arm64/configs/vendor/trinket_defconfig +++ b/arch/arm64/configs/vendor/trinket_defconfig @@ -16,12 +16,12 @@ CONFIG_RCU_FAST_NO_HZ=y CONFIG_RCU_NOCB_CPU=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y +CONFIG_IKHEADERS=y CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_MEMCG=y CONFIG_MEMCG_SWAP=y CONFIG_BLK_CGROUP=y CONFIG_DEBUG_BLK_CGROUP=y -CONFIG_RT_GROUP_SCHED=y CONFIG_CGROUP_FREEZER=y CONFIG_CPUSETS=y CONFIG_CGROUP_CPUACCT=y @@ -29,7 +29,6 @@ CONFIG_CGROUP_BPF=y CONFIG_CGROUP_DEBUG=y CONFIG_SCHED_CORE_CTL=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set # CONFIG_PID_NS is not set CONFIG_SCHED_AUTOGROUP=y CONFIG_SCHED_TUNE=y @@ -41,6 +40,7 @@ CONFIG_BLK_DEV_INITRD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_KALLSYMS_ALL=y CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT_ALWAYS_ON=y CONFIG_EMBEDDED=y # CONFIG_COMPAT_BRK is not set CONFIG_SLAB_FREELIST_RANDOM=y @@ -49,7 +49,6 @@ CONFIG_PROFILING=y CONFIG_CC_STACKPROTECTOR_STRONG=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_FORCE=y @@ -253,6 +252,7 @@ CONFIG_NET_ACT_SKBEDIT=y CONFIG_DNS_RESOLVER=y CONFIG_QRTR=y CONFIG_QRTR_SMD=y +CONFIG_BPF_JIT=y CONFIG_SOCKEV_NLMCAST=y CONFIG_BT=y CONFIG_MSM_BT_POWER=y @@ -328,6 +328,7 @@ CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_HIMAX_CHIPSET=y CONFIG_TOUCHSCREEN_HIMAX_I2C=y @@ -474,7 +475,6 @@ CONFIG_HID_MULTITOUCH=y CONFIG_HID_NINTENDO=y CONFIG_HID_PLANTRONICS=y CONFIG_HID_SONY=y -CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y @@ -663,6 +663,7 @@ CONFIG_PHY_XGENE=y CONFIG_RAS=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y +CONFIG_ANDROID_BINDERFS=y CONFIG_QCOM_QFPROM=y CONFIG_NVMEM_SPMI_SDAM=y CONFIG_SENSORS_SSC=y @@ -680,6 +681,7 @@ CONFIG_QUOTA_NETLINK_INTERFACE=y CONFIG_QFMT_V2=y CONFIG_FUSE_FS=y CONFIG_OVERLAY_FS=y +CONFIG_INCREMENTAL_FS=y CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y CONFIG_TMPFS_POSIX_ACL=y @@ -772,6 +774,7 @@ CONFIG_SECURITY=y CONFIG_HARDENED_USERCOPY=y CONFIG_HARDENED_USERCOPY_PAGESPAN=y CONFIG_FORTIFY_SOURCE=y +CONFIG_STATIC_USERMODEHELPER=y CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SMACK=y CONFIG_CRYPTO_GCM=y diff --git a/disable_dbgfs.sh b/disable_dbgfs.sh new file mode 100755 index 000000000000..fe23680972a5 --- /dev/null +++ b/disable_dbgfs.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# disable debugfs for user builds +export MAKE_ARGS=$@ + +if [ ${DISABLE_DEBUGFS} == "true" ]; then + echo "build variant ${TARGET_BUILD_VARIANT}" + if [ ${TARGET_BUILD_VARIANT} == "user" ] && \ + [ ${ARCH} == "arm64" ]; then + echo "combining fragments for user build" + (cd $KERNEL_DIR && \ + ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE}\ + ./scripts/kconfig/merge_config.sh \ + ./arch/${ARCH}/configs/$DEFCONFIG \ + ./arch/${ARCH}/configs/vendor/debugfs.config + make ${MAKE_ARGS} ARCH=${ARCH} \ + CROSS_COMPILE=${CROSS_COMPILE} savedefconfig + mv defconfig ./arch/${ARCH}/configs/$DEFCONFIG + rm .config) + else + if [[ ${DEFCONFIG} == *"perf_defconfig" ]] && \ + [ ${ARCH} == "arm64" ]; then + echo "resetting perf defconfig" + (cd ${KERNEL_DIR} && \ + git checkout arch/$ARCH/configs/$DEFCONFIG) + fi + fi +fi diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 2fc9f6ade535..7f06ab26a3b8 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -738,9 +738,11 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) } if (map->flags == ADSP_MMAP_HEAP_ADDR || map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) { + spin_lock(&me->hlock); map->refs--; if (!map->refs) hlist_del_init(&map->hn); + spin_unlock(&me->hlock); if (map->refs > 0) return; } else { diff --git a/drivers/char/diag/diagfwd_cntl.c b/drivers/char/diag/diagfwd_cntl.c index 740c62150cbc..be8e57e5c7ed 100644 --- a/drivers/char/diag/diagfwd_cntl.c +++ b/drivers/char/diag/diagfwd_cntl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -886,6 +886,9 @@ void diag_cntl_process_read_data(struct diagfwd_info *p_info, void *buf, while (read_len + header_len < len) { ctrl_pkt = (struct diag_ctrl_pkt_header_t *)ptr; + if (((size_t)read_len + (size_t)ctrl_pkt->len + + header_len) > len) + return; switch (ctrl_pkt->pkt_id) { case DIAG_CTRL_MSG_REG: process_command_registration(ptr, ctrl_pkt->len, diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index b59c3477ded7..6bc708acf0ee 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -104,10 +104,10 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) goto out; } spin_unlock(&dentry->d_lock); - mutex_lock(&dmabuf->lock); + spin_lock(&dmabuf->name_lock); if (dmabuf->name) ret = strlcpy(name, dmabuf->name, DMA_BUF_NAME_LEN); - mutex_unlock(&dmabuf->lock); + spin_unlock(&dmabuf->name_lock); dmabuf_dent_put(dmabuf); out: return dynamic_dname(dentry, buffer, buflen, "/%s:%s", diff --git a/drivers/gpu/msm/kgsl.h b/drivers/gpu/msm/kgsl.h index df8039e42441..57fbf3c2db61 100644 --- a/drivers/gpu/msm/kgsl.h +++ b/drivers/gpu/msm/kgsl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and diff --git a/drivers/iio/adc/qcom-rradc.c b/drivers/iio/adc/qcom-rradc.c index 02dfbf86d6c2..20136383c66b 100644 --- a/drivers/iio/adc/qcom-rradc.c +++ b/drivers/iio/adc/qcom-rradc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, 2019-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -199,6 +199,9 @@ #define FG_RR_TP_REV_VERSION2 29 #define FG_RR_TP_REV_VERSION3 32 +#define BATT_ID_SETTLE_SHIFT 5 +#define RRADC_BATT_ID_DELAY_MAX 8 + /* * The channel number is not a physical index in hardware, * rather it's a list of supported channels and an index to @@ -229,6 +232,7 @@ struct rradc_chip { struct mutex lock; struct regmap *regmap; u16 base; + int batt_id_delay; struct iio_chan_spec *iio_chans; unsigned int nchannels; struct rradc_chan_prop *chan_props; @@ -256,6 +260,8 @@ struct rradc_chan_prop { u16 adc_code, int *result); }; +static const int batt_id_delays[] = {0, 1, 4, 12, 20, 40, 60, 80}; + static int rradc_masked_write(struct rradc_chip *rr_adc, u16 offset, u8 mask, u8 val) { @@ -767,8 +773,7 @@ static int rradc_check_status_ready_with_retry(struct rradc_chip *chip, if (((prop->channel == RR_ADC_CHG_TEMP) || (prop->channel == RR_ADC_SKIN_TEMP) || - (prop->channel == RR_ADC_USBIN_I) || - (prop->channel == RR_ADC_DIE_TEMP)) && + (prop->channel == RR_ADC_USBIN_I)) && ((!rradc_is_usb_present(chip)))) { pr_debug("USB not present for %d\n", prop->channel); rc = -ENODATA; @@ -854,7 +859,7 @@ static int rradc_enable_batt_id_channel(struct rradc_chip *chip, bool enable) static int rradc_do_batt_id_conversion(struct rradc_chip *chip, struct rradc_chan_prop *prop, u16 *data, u8 *buf) { - int rc = 0, ret = 0; + int rc = 0, ret = 0, batt_id_delay; rc = rradc_enable_batt_id_channel(chip, true); if (rc < 0) { @@ -862,6 +867,14 @@ static int rradc_do_batt_id_conversion(struct rradc_chip *chip, return rc; } + if (chip->batt_id_delay != -EINVAL) { + batt_id_delay = chip->batt_id_delay << BATT_ID_SETTLE_SHIFT; + rc = rradc_masked_write(chip, FG_ADC_RR_BATT_ID_CFG, + batt_id_delay, batt_id_delay); + if (rc < 0) + pr_err("BATT_ID settling time config failed:%d\n", rc); + } + rc = rradc_masked_write(chip, FG_ADC_RR_BATT_ID_TRIGGER, FG_ADC_RR_BATT_ID_TRIGGER_CTL, FG_ADC_RR_BATT_ID_TRIGGER_CTL); @@ -938,6 +951,30 @@ static int rradc_do_conversion(struct rradc_chip *chip, goto fail; } break; + case RR_ADC_DIE_TEMP: + /* Force conversion every cycle */ + rc = rradc_masked_write(chip, FG_ADC_RR_PMI_DIE_TEMP_TRIGGER, + FG_ADC_RR_USB_IN_V_EVERY_CYCLE_MASK, + FG_ADC_RR_USB_IN_V_EVERY_CYCLE); + if (rc < 0) { + pr_err("Force every cycle update failed:%d\n", rc); + goto fail; + } + + rc = rradc_read_channel_with_continuous_mode(chip, prop, buf); + if (rc < 0) { + pr_err("Error reading in continuous mode:%d\n", rc); + goto fail; + } + + /* Restore aux_therm trigger */ + rc = rradc_masked_write(chip, FG_ADC_RR_PMI_DIE_TEMP_TRIGGER, + FG_ADC_RR_USB_IN_V_EVERY_CYCLE_MASK, 0); + if (rc < 0) { + pr_err("Restore every cycle update failed:%d\n", rc); + goto fail; + } + break; case RR_ADC_CHG_HOT_TEMP: case RR_ADC_CHG_TOO_HOT_TEMP: case RR_ADC_SKIN_HOT_TEMP: @@ -1106,6 +1143,21 @@ static int rradc_get_dt_data(struct rradc_chip *chip, struct device_node *node) return rc; } + chip->batt_id_delay = -EINVAL; + + rc = of_property_read_u32(node, "qcom,batt-id-delay-ms", + &chip->batt_id_delay); + if (!rc) { + for (i = 0; i < RRADC_BATT_ID_DELAY_MAX; i++) { + if (chip->batt_id_delay == batt_id_delays[i]) + break; + } + if (i == RRADC_BATT_ID_DELAY_MAX) + pr_err("Invalid batt_id_delay, rc=%d\n", rc); + else + chip->batt_id_delay = i; + } + chip->base = base; chip->revid_dev_node = of_parse_phandle(node, "qcom,pmic-revid", 0); if (chip->revid_dev_node) { diff --git a/drivers/input/misc/qti-haptics.c b/drivers/input/misc/qti-haptics.c index d17aebaee166..48797423d658 100644 --- a/drivers/input/misc/qti-haptics.c +++ b/drivers/input/misc/qti-haptics.c @@ -250,6 +250,13 @@ static struct hap_addr_val twm_ext_cfg[] = { {REG_HAP_EN_CTL1, 0x80}, /* Enable haptics driver */ }; +static struct hap_addr_val twm_cfg[] = { + {REG_HAP_PLAY, 0x00}, /* Stop playing haptics waveform */ + {REG_HAP_SEL, 0x00}, /* Configure for cmd mode */ + {REG_HAP_EN_CTL1, 0x00}, /* Enable haptics driver */ + {REG_HAP_PERPH_RESET_CTL3, 0x0D}, /* Disable SHUTDOWN1_RB reset */ +}; + static int wf_repeat[8] = {1, 2, 4, 8, 16, 32, 64, 128}; static int wf_s_repeat[4] = {1, 2, 4, 8}; @@ -1060,20 +1067,30 @@ static void qti_haptics_set_gain(struct input_dev *dev, u16 gain) qti_haptics_config_vmax(chip, play->vmax_mv); } -static int qti_haptics_twm_config(struct qti_hap_chip *chip) +static int qti_haptics_twm_config(struct qti_hap_chip *chip, bool ext_pin) { - int rc, i; + int rc = 0, i; - for (i = 0; i < ARRAY_SIZE(twm_ext_cfg); i++) { - rc = qti_haptics_write(chip, twm_ext_cfg[i].addr, - &twm_ext_cfg[i].value, 1); - if (rc < 0) { - dev_err(chip->dev, "Haptics TWM config failed, rc=%d\n", - rc); - return rc; + if (ext_pin) { + for (i = 0; i < ARRAY_SIZE(twm_ext_cfg); i++) { + rc = qti_haptics_write(chip, twm_ext_cfg[i].addr, + &twm_ext_cfg[i].value, 1); + if (rc < 0) + break; + } + } else { + for (i = 0; i < ARRAY_SIZE(twm_cfg); i++) { + rc = qti_haptics_write(chip, twm_cfg[i].addr, + &twm_cfg[i].value, 1); + if (rc < 0) + break; } } - pr_debug("Enabled haptics for TWM mode\n"); + + if (rc < 0) + pr_err("Failed to write twm_config rc=%d\n", rc); + else + pr_debug("Enabled haptics for TWM mode\n"); return 0; } @@ -2032,7 +2049,6 @@ static void qti_haptics_shutdown(struct platform_device *pdev) { struct qti_hap_chip *chip = dev_get_drvdata(&pdev->dev); int rc; - bool enable_haptics_twm; dev_dbg(chip->dev, "Shutdown!\n"); @@ -2048,10 +2064,8 @@ static void qti_haptics_shutdown(struct platform_device *pdev) chip->vdd_enabled = false; } - enable_haptics_twm = chip->haptics_ext_pin_twm && twm_sys_enable; - - if (chip->twm_state == PMIC_TWM_ENABLE && enable_haptics_twm) { - rc = qti_haptics_twm_config(chip); + if (chip->twm_state == PMIC_TWM_ENABLE && twm_sys_enable) { + rc = qti_haptics_twm_config(chip, chip->haptics_ext_pin_twm); if (rc < 0) pr_err("Haptics TWM config failed rc=%d\n", rc); } diff --git a/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.c b/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.c index 5ff489592c9e..89e378afcebe 100644 --- a/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.c +++ b/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.c @@ -498,7 +498,8 @@ static void ais_ife_dev_iommu_fault_handler( p_ife_dev = (struct ais_ife_dev *)token; - CAM_ERR(CAM_ISP, "IFE%d Pagefault at %lu", p_ife_dev->hw_idx, iova); + CAM_ERR(CAM_ISP, "IFE%d Pagefault at iova 0x%x %s", + p_ife_dev->hw_idx, iova, domain->name); } static int ais_ife_dev_remove(struct platform_device *pdev) @@ -549,7 +550,6 @@ static int ais_ife_dev_probe(struct platform_device *pdev) } mutex_init(&p_ife_dev->mutex); - spin_lock_init(&p_ife_dev->eventq_lock); /* * for now, we only support one iommu handle. later @@ -571,13 +571,19 @@ static int ais_ife_dev_probe(struct platform_device *pdev) goto attach_fail; } - rc = cam_smmu_get_handle("cam-secure", + rc = cam_smmu_get_handle("ife-cp", &p_ife_dev->iommu_hdl_secure); if (rc) { CAM_ERR(CAM_ISP, "Failed to get secure iommu handle %d", rc); goto secure_fail; } + rc = cam_smmu_ops(p_ife_dev->iommu_hdl_secure, CAM_SMMU_ATTACH); + if (rc && rc != -EALREADY) { + CAM_ERR(CAM_ISP, "Attach secure iommu handle failed %d", rc); + goto secure_fail; + } + CAM_DBG(CAM_ISP, "iommu_handles: non-secure[0x%x], secure[0x%x]", p_ife_dev->iommu_hdl, p_ife_dev->iommu_hdl_secure); @@ -585,6 +591,9 @@ static int ais_ife_dev_probe(struct platform_device *pdev) cam_smmu_set_client_page_fault_handler(p_ife_dev->iommu_hdl, ais_ife_dev_iommu_fault_handler, p_ife_dev); + cam_smmu_set_client_page_fault_handler(p_ife_dev->iommu_hdl_secure, + ais_ife_dev_iommu_fault_handler, p_ife_dev); + hw_init.hw_idx = p_ife_dev->hw_idx; hw_init.iommu_hdl = p_ife_dev->iommu_hdl; hw_init.iommu_hdl_secure = p_ife_dev->iommu_hdl_secure; @@ -594,14 +603,14 @@ static int ais_ife_dev_probe(struct platform_device *pdev) rc = ais_ife_csid_hw_init(&p_ife_dev->p_csid_drv, &hw_init); if (rc) { CAM_ERR(CAM_ISP, "IFE%d no CSID dev", p_ife_dev->hw_idx, rc); - goto secure_fail; + goto secure_attach_fail; } rc = ais_vfe_hw_init(&p_ife_dev->p_vfe_drv, &hw_init, p_ife_dev->p_csid_drv); if (rc) { CAM_ERR(CAM_ISP, "IFE%d no VFE dev", p_ife_dev->hw_idx, rc); - goto secure_fail; + goto secure_attach_fail; } CAM_INFO(CAM_ISP, "IFE%d probe complete", p_ife_dev->hw_idx); @@ -610,6 +619,9 @@ static int ais_ife_dev_probe(struct platform_device *pdev) return 0; +secure_attach_fail: + cam_smmu_ops(p_ife_dev->iommu_hdl_secure, + CAM_SMMU_DETACH); secure_fail: cam_smmu_ops(p_ife_dev->iommu_hdl, CAM_SMMU_DETACH); diff --git a/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.h b/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.h index 340b6ee91b43..4273c4c1f7ab 100644 --- a/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.h +++ b/drivers/media/platform/msm/ais/ais_isp/ais_ife_dev.h @@ -40,7 +40,6 @@ struct ais_ife_dev { int iommu_hdl; int iommu_hdl_secure; - spinlock_t eventq_lock; struct mutex mutex; int32_t open_cnt; }; diff --git a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c index 00219b70667a..305120afbf3e 100644 --- a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c +++ b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.c @@ -438,6 +438,8 @@ int ais_vfe_reserve(void *hw_priv, void *reserve_args, uint32_t arg_size) goto EXIT; } + rdi_path->secure_mode = rdi_cfg->out_cfg.secure_mode; + cam_io_w(0xf, core_info->mem_base + client_regs->burst_limit); /*disable pack as it is done in CSID*/ cam_io_w(0x0, core_info->mem_base + client_regs->packer_cfg); @@ -766,8 +768,11 @@ static int ais_vfe_cmd_enq_buf(struct ais_vfe_hw_core_info *core_info, vfe_buf->bufIdx = enq_buf->buffer.idx; vfe_buf->mem_handle = enq_buf->buffer.mem_handle; - mmu_hdl = cam_mem_is_secure_buf(vfe_buf->mem_handle) ? - core_info->iommu_hdl_secure : core_info->iommu_hdl; + mmu_hdl = core_info->iommu_hdl; + + if (cam_mem_is_secure_buf(vfe_buf->mem_handle) || rdi_path->secure_mode) + mmu_hdl = core_info->iommu_hdl_secure; + rc = cam_mem_get_io_buf(vfe_buf->mem_handle, mmu_hdl, &vfe_buf->iova_addr, &src_buf_size); if (rc < 0) { @@ -985,7 +990,7 @@ static void ais_vfe_handle_sof_rdi(struct ais_vfe_hw_core_info *core_info, //enq curr sof.sof_ts = work_data->ts; - sof.cur_sof_hw_ts = prev_sof_hw_ts; + sof.cur_sof_hw_ts = cur_sof_hw_ts; sof.frame_cnt = p_rdi->frame_cnt; ais_vfe_q_sof(core_info, path, &sof); @@ -1098,25 +1103,31 @@ static int ais_vfe_handle_error( continue; p_rdi = &core_info->rdi_out[path]; + if (p_rdi->state != AIS_ISP_RESOURCE_STATE_STREAMING) continue; + CAM_ERR(CAM_ISP, "IFE%d Turn off RDI %d", + core_info->vfe_idx, path); + p_rdi->state = AIS_ISP_RESOURCE_STATE_ERROR; client_regs = &bus_hw_info->bus_client_reg[path]; - /* Disable WM and reg-update */ - cam_io_w_mb(0x0, core_info->mem_base + client_regs->cfg); - cam_io_w_mb(AIS_VFE_REGUP_RDI_ALL, core_info->mem_base + - top_hw_info->common_reg->reg_update_cmd); - cam_io_w_mb((1 << path), core_info->mem_base + - bus_hw_info->common_reg.sw_reset); - core_info->bus_wr_mask1 &= ~(1 << path); cam_io_w_mb(core_info->bus_wr_mask1, core_info->mem_base + bus_hw_irq_regs[1].mask_reg_offset); + /* Disable WM and reg-update */ + cam_io_w_mb(0x0, core_info->mem_base + client_regs->cfg); + cam_io_w_mb(AIS_VFE_REGUP_RDI_ALL, core_info->mem_base + + top_hw_info->common_reg->reg_update_cmd); + + cam_io_w_mb((1 << path), core_info->mem_base + + bus_hw_info->common_reg.sw_reset); + + core_info->event.type = AIS_IFE_MSG_OUTPUT_ERROR; core_info->event.path = path; @@ -1551,9 +1562,10 @@ irqreturn_t ais_vfe_irq(int irq_num, void *data) AIS_VFE_STATUS1_RDI_OVERFLOW_IRQ_SHFT) & AIS_VFE_STATUS1_RDI_OVERFLOW_IRQ_MSK; - CAM_ERR(CAM_ISP, "IFE%d Overflow 0x%x", - core_info->vfe_idx, - work_data.path); + CAM_ERR_RATE_LIMIT(CAM_ISP, + "IFE%d Overflow 0x%x", + core_info->vfe_idx, + work_data.path); work_data.evt_type = AIS_VFE_HW_IRQ_EVENT_ERROR; ais_vfe_dispatch_irq(vfe_hw, &work_data); } diff --git a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h index 3b5ee36182bc..c4bd0648dd27 100644 --- a/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h +++ b/drivers/media/platform/msm/ais/ais_isp/vfe_hw/ais_vfe_core.h @@ -96,6 +96,7 @@ struct ais_vfe_rdi_output { enum ais_isp_resource_state state; uint32_t en_cfg; + uint32_t secure_mode; spinlock_t buffer_lock; struct ais_vfe_buffer_t buffers[AIS_VFE_MAX_BUF]; diff --git a/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index 7c349f66c3de..78e8332729ea 100644 --- a/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/media/platform/msm/ais/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -6337,9 +6337,10 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl) return -EINVAL; } - if (cam_smmu_ops(g_ife_hw_mgr.mgr_common.img_iommu_hdl, - CAM_SMMU_ATTACH)) { - CAM_ERR(CAM_ISP, "Attach iommu handle failed."); + rc = cam_smmu_ops(g_ife_hw_mgr.mgr_common.img_iommu_hdl, + CAM_SMMU_ATTACH); + if (rc && rc != -EALREADY) { + CAM_ERR(CAM_ISP, "Attach iommu handle failed %d", rc); goto attach_fail; } diff --git a/drivers/media/platform/msm/ais/cam_req_mgr/cam_mem_mgr.c b/drivers/media/platform/msm/ais/cam_req_mgr/cam_mem_mgr.c index 33094cd010a1..33949b9161fb 100644 --- a/drivers/media/platform/msm/ais/cam_req_mgr/cam_mem_mgr.c +++ b/drivers/media/platform/msm/ais/cam_req_mgr/cam_mem_mgr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -217,6 +217,7 @@ int cam_mem_get_io_buf(int32_t buf_handle, int32_t mmu_handle, tbl.bufq[idx].fd, iova_ptr, len_ptr); + if (rc) { CAM_ERR(CAM_MEM, "fail to map buf_hdl:0x%x, mmu_hdl: 0x%x for fd:%d", @@ -511,6 +512,9 @@ static int cam_mem_util_ion_alloc(struct cam_mem_mgr_alloc_cmd *cmd, } else if (cmd->flags & CAM_MEM_FLAG_PROTECTED_MODE) { heap_id = ION_HEAP(ION_SECURE_DISPLAY_HEAP_ID); ion_flag |= ION_FLAG_SECURE | ION_FLAG_CP_CAMERA; + } else if (cmd->flags & CAM_MEM_FLAG_CP_PIXEL) { + heap_id = ION_HEAP(ION_SECURE_HEAP_ID); + ion_flag |= ION_FLAG_SECURE | ION_FLAG_CP_PIXEL; } else { heap_id = ION_HEAP(ION_SYSTEM_HEAP_ID) | ION_HEAP(ION_CAMERA_HEAP_ID); @@ -540,8 +544,9 @@ static int cam_mem_util_check_alloc_flags(struct cam_mem_mgr_alloc_cmd *cmd) return -EINVAL; } - if (cmd->flags & CAM_MEM_FLAG_PROTECTED_MODE && - cmd->flags & CAM_MEM_FLAG_KMD_ACCESS) { + if (((cmd->flags & CAM_MEM_FLAG_PROTECTED_MODE) || + (cmd->flags & CAM_MEM_FLAG_CP_PIXEL)) && + (cmd->flags & CAM_MEM_FLAG_KMD_ACCESS)) { CAM_ERR(CAM_MEM, "Kernel mapping in secure mode not allowed"); return -EINVAL; } @@ -562,8 +567,9 @@ static int cam_mem_util_check_map_flags(struct cam_mem_mgr_map_cmd *cmd) return -EINVAL; } - if (cmd->flags & CAM_MEM_FLAG_PROTECTED_MODE && - cmd->flags & CAM_MEM_FLAG_KMD_ACCESS) { + if (((cmd->flags & CAM_MEM_FLAG_PROTECTED_MODE) || + (cmd->flags & CAM_MEM_FLAG_CP_PIXEL)) && + (cmd->flags & CAM_MEM_FLAG_KMD_ACCESS)) { CAM_ERR(CAM_MEM, "Kernel mapping in secure mode not allowed, flags=0x%x", cmd->flags); diff --git a/drivers/media/platform/msm/ais/cam_smmu/cam_smmu_api.c b/drivers/media/platform/msm/ais/cam_smmu/cam_smmu_api.c index 1bc5a8ec640e..70a8ecc8d5a5 100644 --- a/drivers/media/platform/msm/ais/cam_smmu/cam_smmu_api.c +++ b/drivers/media/platform/msm/ais/cam_smmu/cam_smmu_api.c @@ -36,7 +36,7 @@ #define COOKIE_SIZE (BYTE_SIZE*COOKIE_NUM_BYTE) #define COOKIE_MASK ((1<> COOKIE_SIZE) & COOKIE_MASK) @@ -105,7 +105,10 @@ struct cam_context_bank_info { dma_addr_t va_start; size_t va_len; const char *name; + /* stage 2 only */ bool is_secure; + /* stage 1 */ + bool is_secure_pixel; uint8_t scratch_buf_support; uint8_t firmware_support; uint8_t shared_support; @@ -3269,6 +3272,20 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, goto end; } + if (cb->is_secure_pixel) { + int secure_vmid = VMID_CP_PIXEL; + + rc = iommu_domain_set_attr(cb->mapping->domain, + DOMAIN_ATTR_SECURE_VMID, &secure_vmid); + if (rc) { + CAM_ERR(CAM_SMMU, + "programming secure vmid failed: %s %d", + dev_name(dev), rc); + rc = -ENODEV; + goto end; + } + } + return rc; end: if (cb->shared_support) { @@ -3345,6 +3362,10 @@ static int cam_smmu_get_memory_regions_info(struct device_node *of_node, mem_map_node = of_get_child_by_name(of_node, "iova-mem-map"); cb->is_secure = of_property_read_bool(of_node, "qcom,secure-cb"); + if (!cb->is_secure) + cb->is_secure_pixel = of_property_read_bool(of_node, + "qcom,secure-pixel-cb"); + /* * We always expect a memory map node, except when it is a secure * context bank. diff --git a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c index 6bc114c5949b..8d705b0a76d6 100644 --- a/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c +++ b/drivers/media/platform/msm/camera/cam_isp/cam_isp_context.c @@ -228,7 +228,7 @@ static void __cam_isp_ctx_dump_state_monitor_array( ctx_monitor = ctx_isp->cam_isp_ctx_state_monitor; if (log_rate_limit) - CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, + CAM_DBG(CAM_ISP, "Dumping state information for preceding requests"); else CAM_INFO(CAM_ISP, @@ -241,8 +241,8 @@ static void __cam_isp_ctx_dump_state_monitor_array( CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES); if (log_rate_limit) { - CAM_INFO_RATE_LIMIT_CUSTOM(CAM_ISP, 5, 20, - "time[%lld] last reported req_id[%llu] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]", + CAM_DBG(CAM_ISP, + "time[%lld] last reported req_id[%u] frame id[%lld] applied id[%lld] current state[%s] next state[%s] hw_event[%s]", ctx_monitor[index].evt_time_stamp, ctx_monitor[index].last_reported_id, ctx_monitor[index].frame_id, diff --git a/drivers/mtd/devices/msm_qpic_nand.c b/drivers/mtd/devices/msm_qpic_nand.c index 8cb1feb3dcd1..6e84a4b2c54b 100644 --- a/drivers/mtd/devices/msm_qpic_nand.c +++ b/drivers/mtd/devices/msm_qpic_nand.c @@ -26,6 +26,8 @@ #define MAX_DESC 16 #define SMEM_AARM_PARTITION_TABLE 9 #define SMEM_APPS 0 +#define ONE_CODEWORD_SIZE 516 + static bool enable_euclean; static bool enable_perfstats; @@ -1183,10 +1185,16 @@ static int msm_nand_validate_mtd_params(struct mtd_info *mtd, bool read, err = -EINVAL; goto out; } - args->page_count = ops->len / (mtd->writesize + mtd->oobsize); + if (ops->len <= ONE_CODEWORD_SIZE) + args->page_count = 1; + else + args->page_count = ops->len / + (mtd->writesize + mtd->oobsize); } else if (ops->mode == MTD_OPS_AUTO_OOB) { - if (ops->datbuf && (ops->len % mtd->writesize) != 0) { + if (ops->datbuf && (ops->len % + ((ops->len <= ONE_CODEWORD_SIZE) ? + ONE_CODEWORD_SIZE : mtd->writesize)) != 0) { /* when ops->datbuf is NULL, ops->len can be ooblen */ pr_err("unsupported data len %d for AUTO mode\n", ops->len); @@ -1199,7 +1207,10 @@ static int msm_nand_validate_mtd_params(struct mtd_info *mtd, bool read, if ((args->page_count == 0) && (ops->ooblen)) args->page_count = 1; } else if (ops->datbuf) { - args->page_count = ops->len / mtd->writesize; + if (ops->len <= ONE_CODEWORD_SIZE) + args->page_count = 1; + else + args->page_count = ops->len / mtd->writesize; } } @@ -1245,12 +1256,20 @@ static void msm_nand_update_rw_reg_data(struct msm_nand_chip *chip, struct msm_nand_rw_params *args, struct msm_nand_rw_reg_data *data) { + /* + * While reading one codeword, CW_PER_PAGE bits of QPIC_NAND_DEV0_CFG0 + * should be set to 0, which implies 1 codeword per page. 'n' below, + * is used to configure cfg0 for reading one full page or one single + * codeword. + */ + int n = (ops->len <= ONE_CODEWORD_SIZE) ? args->cwperpage : 1; + if (args->read) { if (ops->mode != MTD_OPS_RAW) { data->cmd = MSM_NAND_CMD_PAGE_READ_ECC; data->cfg0 = (chip->cfg0 & ~(7U << CW_PER_PAGE)) | - (((args->cwperpage-1) - args->start_sector) + (((args->cwperpage-n) - args->start_sector) << CW_PER_PAGE); data->cfg1 = chip->cfg1; data->ecc_bch_cfg = chip->ecc_bch_cfg; @@ -1258,7 +1277,7 @@ static void msm_nand_update_rw_reg_data(struct msm_nand_chip *chip, data->cmd = MSM_NAND_CMD_PAGE_READ_ALL; data->cfg0 = (chip->cfg0_raw & ~(7U << CW_PER_PAGE)) | - (((args->cwperpage-1) - args->start_sector) + (((args->cwperpage-n) - args->start_sector) << CW_PER_PAGE); data->cfg1 = chip->cfg1_raw; data->ecc_bch_cfg = chip->ecc_cfg_raw; @@ -1302,6 +1321,11 @@ static void msm_nand_prep_rw_cmd_desc(struct mtd_oob_ops *ops, uint32_t offset, size, last_read; struct sps_command_element *curr_ce, *start_ce; uint32_t *flags_ptr, *num_ce_ptr; + /* + * Variable to configure read_location register parameters + * while reading one codeword or one full page + */ + int n = (ops->len <= ONE_CODEWORD_SIZE) ? args->cwperpage : 1; if (curr_cw == args->start_sector) { curr_ce = start_ce = &cmd_list->setup_desc.ce[0]; @@ -1394,10 +1418,15 @@ static void msm_nand_prep_rw_cmd_desc(struct mtd_oob_ops *ops, if (ops->mode == MTD_OPS_AUTO_OOB) { if (ops->datbuf) { offset = 0; - size = (curr_cw < (args->cwperpage - 1)) ? 516 : - (512 - ((args->cwperpage - 1) << 2)); - last_read = (curr_cw < (args->cwperpage - 1)) ? 1 : - (ops->oobbuf ? 0 : 1); + if (ops->len <= ONE_CODEWORD_SIZE) { + size = ONE_CODEWORD_SIZE; + last_read = 1; + } else { + size = (curr_cw < (args->cwperpage - 1)) ? 516 : + (512 - ((args->cwperpage - 1) << 2)); + last_read = (curr_cw < (args->cwperpage - 1)) ? + 1 : (ops->oobbuf ? 0 : 1); + } rdata = (offset << 0) | (size << 16) | (last_read << 31); @@ -1413,7 +1442,7 @@ static void msm_nand_prep_rw_cmd_desc(struct mtd_oob_ops *ops, curr_ce++; } } - if (curr_cw == (args->cwperpage - 1) && ops->oobbuf) { + if (curr_cw == (args->cwperpage - n) && ops->oobbuf) { offset = 512 - ((args->cwperpage - 1) << 2); size = (args->cwperpage) << 2; if (size > args->oob_len_cmd) @@ -1471,6 +1500,11 @@ static int msm_nand_submit_rw_data_desc(struct mtd_oob_ops *ops, uint32_t sectordatasize, sectoroobsize; uint32_t sps_flags = 0; int err = 0; + /* + * Variable to configure sectordatasize and sectoroobsize + * while reading one codeword or one full page. + */ + int n = (ops->len <= ONE_CODEWORD_SIZE) ? args->cwperpage : 1; if (args->read) data_pipe_handle = info->sps.data_prod.handle; @@ -1479,7 +1513,7 @@ static int msm_nand_submit_rw_data_desc(struct mtd_oob_ops *ops, if (ops->mode == MTD_OPS_RAW) { if (ecc_parity_bytes && args->read) { - if (curr_cw == (args->cwperpage - 1)) + if (curr_cw == (args->cwperpage - n)) sps_flags |= SPS_IOVEC_FLAG_INT; /* read only ecc bytes */ @@ -1494,7 +1528,7 @@ static int msm_nand_submit_rw_data_desc(struct mtd_oob_ops *ops, sectordatasize = chip->cw_size; if (!args->read) sps_flags = SPS_IOVEC_FLAG_EOT; - if (curr_cw == (args->cwperpage - 1)) + if (curr_cw == (args->cwperpage - n)) sps_flags |= SPS_IOVEC_FLAG_INT; err = sps_transfer_one(data_pipe_handle, @@ -1507,8 +1541,13 @@ static int msm_nand_submit_rw_data_desc(struct mtd_oob_ops *ops, } } else if (ops->mode == MTD_OPS_AUTO_OOB) { if (ops->datbuf) { - sectordatasize = (curr_cw < (args->cwperpage - 1)) - ? 516 : (512 - ((args->cwperpage - 1) << 2)); + if (ops->len <= ONE_CODEWORD_SIZE) + sectordatasize = ONE_CODEWORD_SIZE; + else + sectordatasize = + (curr_cw < (args->cwperpage - 1)) + ? 516 : + (512 - ((args->cwperpage - 1) << 2)); if (!args->read) { sps_flags = SPS_IOVEC_FLAG_EOT; @@ -1516,7 +1555,7 @@ static int msm_nand_submit_rw_data_desc(struct mtd_oob_ops *ops, ops->oobbuf) sps_flags = 0; } - if ((curr_cw == (args->cwperpage - 1)) && !ops->oobbuf) + if ((curr_cw == (args->cwperpage - n)) && !ops->oobbuf) sps_flags |= SPS_IOVEC_FLAG_INT; err = sps_transfer_one(data_pipe_handle, @@ -1528,7 +1567,7 @@ static int msm_nand_submit_rw_data_desc(struct mtd_oob_ops *ops, args->data_dma_addr_curr += sectordatasize; } - if (ops->oobbuf && (curr_cw == (args->cwperpage - 1))) { + if (ops->oobbuf && (curr_cw == (args->cwperpage - n))) { sectoroobsize = args->cwperpage << 2; if (sectoroobsize > args->oob_len_data) sectoroobsize = args->oob_len_data; @@ -1984,7 +2023,7 @@ free_dma: total_ecc_byte_cnt, DMA_FROM_DEVICE); /* check for bit flips in ecc data */ ecc_temp = ecc; - for (n = rw_params->start_sector; n < cwperpage; n++) { + for (n = rw_params->start_sector; !err && n < cwperpage; n++) { int last_pos = 0, next_pos = 0; int ecc_bytes_percw_in_bits = (chip->ecc_parity_bytes * 8); @@ -1995,7 +2034,7 @@ free_dma: if (last_pos < ecc_bytes_percw_in_bits) num_zero_bits++; - if (num_zero_bits > MAX_ECC_BIT_FLIPS) { + if (num_zero_bits > info->flash_dev.ecc_capability) { *erased_page = false; goto free_mem; } @@ -2007,7 +2046,8 @@ free_dma: ecc_temp += chip->ecc_parity_bytes; } - if ((n == cwperpage) && (num_zero_bits <= MAX_ECC_BIT_FLIPS)) + if ((n == cwperpage) && + (num_zero_bits <= info->flash_dev.ecc_capability)) *erased_page = true; free_mem: kfree(ecc); @@ -2651,7 +2691,7 @@ free_dma: total_ecc_byte_cnt, DMA_FROM_DEVICE); /* check for bit flips in ecc data */ ecc_temp = ecc; - for (n = rw_params->start_sector; n < cwperpage; n++) { + for (n = rw_params->start_sector; !err && n < cwperpage; n++) { int last_pos = 0, next_pos = 0; int ecc_bytes_percw_in_bits = (chip->ecc_parity_bytes * 8); @@ -2662,7 +2702,7 @@ free_dma: if (last_pos < ecc_bytes_percw_in_bits) num_zero_bits++; - if (num_zero_bits > MAX_ECC_BIT_FLIPS) { + if (num_zero_bits > info->flash_dev.ecc_capability) { *erased_page = false; goto free_mem; } @@ -2674,7 +2714,8 @@ free_dma: ecc_temp += chip->ecc_parity_bytes; } - if ((n == cwperpage) && (num_zero_bits <= MAX_ECC_BIT_FLIPS)) + if ((n == cwperpage) && + (num_zero_bits <= info->flash_dev.ecc_capability)) *erased_page = true; free_mem: kfree(ecc); @@ -2755,6 +2796,9 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, data.addr0 = (rw_params.page << 16) | rw_params.oob_col; data.addr1 = (rw_params.page >> 16) & 0xff; + if (ops->len <= ONE_CODEWORD_SIZE) + cwperpage = 1; + for (n = rw_params.start_sector; n < cwperpage; n++) { struct sps_command_element *curr_ce, *start_ce; @@ -2832,7 +2876,7 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, } else if (ops->mode == MTD_OPS_AUTO_OOB) { if (ops->datbuf) submitted_num_desc = cwperpage - - rw_params.start_sector; + rw_params.start_sector; if (ops->oobbuf) submitted_num_desc++; } @@ -3052,7 +3096,10 @@ free_dma: } validate_mtd_params_failed: if (ops->mode != MTD_OPS_RAW) - ops->retlen = mtd->writesize * pages_read; + if (ops->len <= ONE_CODEWORD_SIZE) + ops->retlen = ONE_CODEWORD_SIZE; + else + ops->retlen = mtd->writesize * pages_read; else ops->retlen = (mtd->writesize + mtd->oobsize) * pages_read; ops->oobretlen = ops->ooblen - rw_params.oob_len_data; @@ -3125,8 +3172,11 @@ static int msm_nand_read_partial_page(struct mtd_info *mtd, ops->datbuf = no_copy ? actual_buf : bounce_buf; if (info->nand_chip.caps & MSM_NAND_CAP_PAGE_SCOPE_READ) err = msm_nand_read_pagescope(mtd, aligned_from, ops); - else + else { + if ((len <= ONE_CODEWORD_SIZE) && (offset == 0)) + ops->len = ONE_CODEWORD_SIZE; err = msm_nand_read_oob(mtd, aligned_from, ops); + } if (err == -EUCLEAN) { is_euclean = 1; err = 0; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 651fd5500151..b6c8996c99b5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -23,15 +23,28 @@ #include #include #include - +#include +#include +#include +#include #include "stmmac.h" #include "stmmac_platform.h" #include "dwmac-qcom-ethqos.h" #include "stmmac_ptp.h" #include "dwmac-qcom-ipa-offload.h" +#define PHY_LOOPBACK_1000 0x4140 +#define PHY_LOOPBACK_100 0x6100 +#define PHY_LOOPBACK_10 0x4100 + static void __iomem *tlmm_central_base_addr; +static void ethqos_rgmii_io_macro_loopback(struct qcom_ethqos *ethqos, + int mode); +static int phy_digital_loopback_config( + struct qcom_ethqos *ethqos, int speed, int config); + bool phy_intr_en; +static char buf[2000]; static struct ethqos_emac_por emac_por[] = { { .offset = RGMII_IO_MACRO_CONFIG, .value = 0x0 }, @@ -77,7 +90,7 @@ static void qcom_ethqos_read_iomacro_por_values(struct qcom_ethqos *ethqos) ethqos->por[i].offset); } -static inline unsigned int dwmac_qcom_get_eth_type(unsigned char *buf) +unsigned int dwmac_qcom_get_eth_type(unsigned char *buf) { return ((((u16)buf[QTAG_ETH_TYPE_OFFSET] << 8) | @@ -926,6 +939,12 @@ static int ethqos_mdio_read(struct stmmac_priv *priv, int phyaddr, int phyreg) u32 v; int data; u32 value = MII_BUSY; + struct qcom_ethqos *ethqos = priv->plat->bsp_priv; + + if (ethqos->phy_state == PHY_IS_OFF) { + ETHQOSINFO("Phy is in off state reading is not possible\n"); + return -EOPNOTSUPP; + } value |= (phyaddr << priv->hw->mii.addr_shift) & priv->hw->mii.addr_mask; @@ -951,6 +970,44 @@ static int ethqos_mdio_read(struct stmmac_priv *priv, int phyaddr, int phyreg) return data; } +static int ethqos_mdio_write(struct stmmac_priv *priv, int phyaddr, int phyreg, + u16 phydata) +{ + unsigned int mii_address = priv->hw->mii.addr; + unsigned int mii_data = priv->hw->mii.data; + u32 v; + u32 value = MII_BUSY; + struct qcom_ethqos *ethqos = priv->plat->bsp_priv; + + if (ethqos->phy_state == PHY_IS_OFF) { + ETHQOSINFO("Phy is in off state writing is not possible\n"); + return -EOPNOTSUPP; + } + value |= (phyaddr << priv->hw->mii.addr_shift) + & priv->hw->mii.addr_mask; + value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask; + + value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift) + & priv->hw->mii.clk_csr_mask; + if (priv->plat->has_gmac4) + value |= MII_GMAC4_WRITE; + else + value |= MII_WRITE; + + /* Wait until any existing MII operation is complete */ + if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY), + 100, 10000)) + return -EBUSY; + + /* Set the MII address register to write */ + writel_relaxed(phydata, priv->ioaddr + mii_data); + writel_relaxed(value, priv->ioaddr + mii_address); + + /* Wait until any existing MII operation is complete */ + return readl_poll_timeout(priv->ioaddr + mii_address, v, + !(v & MII_BUSY), 100, 10000); +} + static int ethqos_phy_intr_config(struct qcom_ethqos *ethqos) { int ret = 0; @@ -1107,6 +1164,10 @@ static ssize_t read_phy_reg_dump(struct file *file, char __user *user_buf, ETHQOSERR("NULL Pointer\n"); return -EINVAL; } + if (ethqos->phy_state == PHY_IS_OFF) { + ETHQOSINFO("Phy is in off state phy dump is not possible\n"); + return -EOPNOTSUPP; + } buf = kzalloc(buf_len, GFP_KERNEL); if (!buf) @@ -1203,6 +1264,458 @@ static ssize_t read_rgmii_reg_dump(struct file *file, return ret_cnt; } +static ssize_t read_phy_off(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + unsigned int len = 0, buf_len = 2000; + struct qcom_ethqos *ethqos = file->private_data; + + if (ethqos->current_phy_mode == DISABLE_PHY_IMMEDIATELY) + len += scnprintf(buf + len, buf_len - len, + "Disable phy immediately enabled\n"); + else if (ethqos->current_phy_mode == ENABLE_PHY_IMMEDIATELY) + len += scnprintf(buf + len, buf_len - len, + "Enable phy immediately enabled\n"); + else if (ethqos->current_phy_mode == DISABLE_PHY_AT_SUSPEND_ONLY) { + len += scnprintf(buf + len, buf_len - len, + "Disable Phy at suspend\n"); + len += scnprintf(buf + len, buf_len - len, + " & do not enable at resume enabled\n"); + } else if (ethqos->current_phy_mode == + DISABLE_PHY_SUSPEND_ENABLE_RESUME) { + len += scnprintf(buf + len, buf_len - len, + "Disable Phy at suspend\n"); + len += scnprintf(buf + len, buf_len - len, + " & enable at resume enabled\n"); + } else if (ethqos->current_phy_mode == DISABLE_PHY_ON_OFF) + len += scnprintf(buf + len, buf_len - len, + "Disable phy on/off disabled\n"); + else + len += scnprintf(buf + len, buf_len - len, + "Invalid Phy State\n"); + + if (len > buf_len) + len = buf_len; + + return simple_read_from_buffer(user_buf, count, ppos, buf, len); +} + +static ssize_t phy_off_config( + struct file *file, const char __user *user_buffer, + size_t count, loff_t *position) +{ + char *in_buf; + int buf_len = 2000; + unsigned long ret; + int config = 0; + struct qcom_ethqos *ethqos = file->private_data; + + in_buf = kzalloc(buf_len, GFP_KERNEL); + if (!in_buf) + return -ENOMEM; + + ret = copy_from_user(in_buf, user_buffer, buf_len); + if (ret) { + ETHQOSERR("unable to copy from user\n"); + return -EFAULT; + } + + ret = sscanf(in_buf, "%d", &config); + if (ret != 1) { + ETHQOSERR("Error in reading option from user"); + return -EINVAL; + } + if (config > DISABLE_PHY_ON_OFF || config < DISABLE_PHY_IMMEDIATELY) { + ETHQOSERR("Invalid option =%d", config); + return -EINVAL; + } + if (config == ethqos->current_phy_mode) { + ETHQOSERR("No effect as duplicate config"); + return -EPERM; + } + if (config == DISABLE_PHY_IMMEDIATELY) { + ethqos->current_phy_mode = DISABLE_PHY_IMMEDIATELY; + //make phy off + if (ethqos->current_loopback == ENABLE_PHY_LOOPBACK) { + /* If Phy loopback is enabled + * Disabled It before phy off + */ + phy_digital_loopback_config(ethqos, + ethqos->loopback_speed, 0); + ETHQOSDBG("Disable phy Loopback"); + ethqos->current_loopback = ENABLE_PHY_LOOPBACK; + } + ethqos_phy_power_off(ethqos); + } else if (config == ENABLE_PHY_IMMEDIATELY) { + ethqos->current_phy_mode = ENABLE_PHY_IMMEDIATELY; + //make phy on + ethqos_phy_power_on(ethqos); + ethqos_reset_phy_enable_interrupt(ethqos); + if (ethqos->current_loopback == ENABLE_PHY_LOOPBACK) { + /*If Phy loopback is enabled , enabled It again*/ + phy_digital_loopback_config(ethqos, + ethqos->loopback_speed, 1); + ETHQOSDBG("Enabling Phy loopback again"); + } + } else if (config == DISABLE_PHY_AT_SUSPEND_ONLY) { + ethqos->current_phy_mode = DISABLE_PHY_AT_SUSPEND_ONLY; + } else if (config == DISABLE_PHY_SUSPEND_ENABLE_RESUME) { + ethqos->current_phy_mode = DISABLE_PHY_SUSPEND_ENABLE_RESUME; + } else if (config == DISABLE_PHY_ON_OFF) { + ethqos->current_phy_mode = DISABLE_PHY_ON_OFF; + } else { + ETHQOSERR("Invalid option\n"); + return -EINVAL; + } + kfree(in_buf); + return count; +} + +static void ethqos_rgmii_io_macro_loopback(struct qcom_ethqos *ethqos, int mode) +{ + /* Set loopback mode */ + if (mode == 1) { + rgmii_updatel(ethqos, RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN, + RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN, + RGMII_IO_MACRO_CONFIG2); + rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, + 0, RGMII_IO_MACRO_CONFIG2); + } else { + rgmii_updatel(ethqos, RGMII_CONFIG2_TX_TO_RX_LOOPBACK_EN, + 0, RGMII_IO_MACRO_CONFIG2); + rgmii_updatel(ethqos, RGMII_CONFIG2_RX_PROG_SWAP, + RGMII_CONFIG2_RX_PROG_SWAP, + RGMII_IO_MACRO_CONFIG2); + } +} + +static void ethqos_mac_loopback(struct qcom_ethqos *ethqos, int mode) +{ + u32 read_value = (u32)readl_relaxed(ethqos->ioaddr + MAC_CONFIGURATION); + /* Set loopback mode */ + if (mode == 1) + read_value |= MAC_LM; + else + read_value &= ~MAC_LM; + writel_relaxed(read_value, ethqos->ioaddr + MAC_CONFIGURATION); +} + +static int phy_digital_loopback_config( + struct qcom_ethqos *ethqos, int speed, int config) +{ + struct platform_device *pdev = ethqos->pdev; + struct net_device *dev = platform_get_drvdata(pdev); + struct stmmac_priv *priv = netdev_priv(dev); + int phydata = 0; + + if (config == 1) { + ETHQOSINFO("Request for phy digital loopback enable\n"); + switch (speed) { + case SPEED_1000: + phydata = PHY_LOOPBACK_1000; + break; + case SPEED_100: + phydata = PHY_LOOPBACK_100; + break; + case SPEED_10: + phydata = PHY_LOOPBACK_10; + break; + default: + ETHQOSERR("Invalid link speed\n"); + break; + } + } else if (config == 0) { + ETHQOSINFO("Request for phy digital loopback disable\n"); + if (ethqos->bmcr_backup) + phydata = ethqos->bmcr_backup; + else + phydata = 0x1140; + } else { + ETHQOSERR("Invalid option\n"); + return -EINVAL; + } + if (phydata != 0) { + ethqos_mdio_write( + priv, priv->plat->phy_addr, MII_BMCR, phydata); + ETHQOSINFO("write done for phy loopback\n"); + } + return 0; +} + +static void print_loopback_detail(enum loopback_mode loopback) +{ + switch (loopback) { + case DISABLE_LOOPBACK: + ETHQOSINFO("Loopback is disabled\n"); + break; + case ENABLE_IO_MACRO_LOOPBACK: + ETHQOSINFO("Loopback is Enabled as IO MACRO LOOPBACK\n"); + break; + case ENABLE_MAC_LOOPBACK: + ETHQOSINFO("Loopback is Enabled as MAC LOOPBACK\n"); + break; + case ENABLE_PHY_LOOPBACK: + ETHQOSINFO("Loopback is Enabled as PHY LOOPBACK\n"); + break; + default: + ETHQOSINFO("Invalid Loopback=%d\n", loopback); + break; + } +} + +static void setup_config_registers(struct qcom_ethqos *ethqos, + int speed, int duplex, int mode) +{ + struct platform_device *pdev = ethqos->pdev; + struct net_device *dev = platform_get_drvdata(pdev); + struct stmmac_priv *priv = netdev_priv(dev); + u32 ctrl = 0; + + ETHQOSDBG("Speed=%d,dupex=%d,mode=%d\n", speed, duplex, mode); + + if (mode > DISABLE_LOOPBACK && !qcom_ethqos_is_phy_link_up(ethqos)) { + /*If Link is Down & need to enable Loopback*/ + ETHQOSDBG("Enable Lower Up Flag & disable phy dev\n"); + ETHQOSDBG("IRQ so that Rx/Tx can happen beforeee Link down\n"); + netif_carrier_on(dev); + /*Disable phy interrupt by Link/Down by cable plug in/out*/ + disable_irq(ethqos->phy_intr); + } else if (mode > DISABLE_LOOPBACK && + qcom_ethqos_is_phy_link_up(ethqos)) { + ETHQOSDBG("Only disable phy irqqq Lin is UP\n"); + /*Since link is up no need to set Lower UP flag*/ + /*Disable phy interrupt by Link/Down by cable plug in/out*/ + disable_irq(ethqos->phy_intr); + } else if (mode == DISABLE_LOOPBACK && + !qcom_ethqos_is_phy_link_up(ethqos)) { + ETHQOSDBG("Disable Lower Up as Link is down\n"); + netif_carrier_off(dev); + enable_irq(ethqos->phy_intr); + } + ETHQOSDBG("Old ctrl=%d dupex full\n", ctrl); + ctrl = readl_relaxed(priv->ioaddr + MAC_CTRL_REG); + ETHQOSDBG("Old ctrl=0x%x with mask with flow control\n", ctrl); + + ctrl |= priv->hw->link.duplex; + priv->dev->phydev->duplex = duplex; + ctrl &= ~priv->hw->link.speed_mask; + switch (speed) { + case SPEED_1000: + ctrl |= priv->hw->link.speed1000; + break; + case SPEED_100: + ctrl |= priv->hw->link.speed100; + break; + case SPEED_10: + ctrl |= priv->hw->link.speed10; + break; + default: + speed = SPEED_UNKNOWN; + ETHQOSDBG("unkwon speed\n"); + break; + } + writel_relaxed(ctrl, priv->ioaddr + MAC_CTRL_REG); + ETHQOSDBG("New ctrl=%x priv hw speeed =%d\n", ctrl, + priv->hw->link.speed1000); + priv->dev->phydev->speed = speed; + priv->speed = speed; + + if (mode > DISABLE_LOOPBACK && !qcom_ethqos_is_phy_link_up(ethqos)) { + /*If Link is Down & need to enable Loopback*/ + ETHQOSDBG("Link is down . manual ipa setting up\n"); + if (priv->tx_queue[IPA_DMA_TX_CH].skip_sw) + ethqos_ipa_offload_event_handler(priv, + EV_PHY_LINK_UP); + } else if (mode == DISABLE_LOOPBACK && + !qcom_ethqos_is_phy_link_up(ethqos)) { + ETHQOSDBG("Disable request since link was down disable ipa\n"); + if (priv->tx_queue[IPA_DMA_TX_CH].skip_sw) + ethqos_ipa_offload_event_handler(priv, + EV_PHY_LINK_DOWN); + } + + if (priv->dev->phydev->speed != SPEED_UNKNOWN) + ethqos_fix_mac_speed(ethqos, speed); + + if (mode > DISABLE_LOOPBACK) { + if (mode == ENABLE_MAC_LOOPBACK || + mode == ENABLE_IO_MACRO_LOOPBACK) + rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, + RGMII_CONFIG_LOOPBACK_EN, + RGMII_IO_MACRO_CONFIG); + } else if (mode == DISABLE_LOOPBACK) { + if (ethqos->emac_ver == EMAC_HW_v2_3_2 || + ethqos->emac_ver == EMAC_HW_v2_1_2) + rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, + 0, RGMII_IO_MACRO_CONFIG); + } + ETHQOSERR("End\n"); +} + +static ssize_t loopback_handling_config( + struct file *file, const char __user *user_buffer, + size_t count, loff_t *position) +{ + char *in_buf; + int buf_len = 2000; + unsigned long ret; + int config = 0; + struct qcom_ethqos *ethqos = file->private_data; + struct platform_device *pdev = ethqos->pdev; + struct net_device *dev = platform_get_drvdata(pdev); + struct stmmac_priv *priv = netdev_priv(dev); + int speed = 0; + + in_buf = kzalloc(buf_len, GFP_KERNEL); + if (!in_buf) + return -ENOMEM; + + ret = copy_from_user(in_buf, user_buffer, buf_len); + if (ret) { + ETHQOSERR("unable to copy from user\n"); + return -EFAULT; + } + + ret = sscanf(in_buf, "%d %d", &config, &speed); + if (config > DISABLE_LOOPBACK && ret != 2) { + ETHQOSERR("Speed is also needed while enabling loopback\n"); + return -EINVAL; + } + if (config < DISABLE_LOOPBACK || config > ENABLE_PHY_LOOPBACK) { + ETHQOSERR("Invalid config =%d\n", config); + return -EINVAL; + } + if ((config == ENABLE_PHY_LOOPBACK || ethqos->current_loopback == + ENABLE_PHY_LOOPBACK) && + ethqos->current_phy_mode == DISABLE_PHY_IMMEDIATELY) { + ETHQOSERR("Can't enabled/disable "); + ETHQOSERR("phy loopback when phy is off\n"); + return -EPERM; + } + + /*Argument validation*/ + if (config == DISABLE_LOOPBACK || config == ENABLE_IO_MACRO_LOOPBACK || + config == ENABLE_MAC_LOOPBACK || config == ENABLE_PHY_LOOPBACK) { + if (speed != SPEED_1000 && speed != SPEED_100 && + speed != SPEED_10) + return -EINVAL; + } else { + return -EINVAL; + } + + if (config == ethqos->current_loopback) { + switch (config) { + case DISABLE_LOOPBACK: + ETHQOSINFO("Loopback is already disabled\n"); + break; + case ENABLE_IO_MACRO_LOOPBACK: + ETHQOSINFO("Loopback is already Enabled as "); + ETHQOSINFO("IO MACRO LOOPBACK\n"); + break; + case ENABLE_MAC_LOOPBACK: + ETHQOSINFO("Loopback is already Enabled as "); + ETHQOSINFO("MAC LOOPBACK\n"); + break; + case ENABLE_PHY_LOOPBACK: + ETHQOSINFO("Loopback is already Enabled as "); + ETHQOSINFO("PHY LOOPBACK\n"); + break; + } + return -EINVAL; + } + /*If request to enable loopback & some other loopback already enabled*/ + if (config != DISABLE_LOOPBACK && + ethqos->current_loopback > DISABLE_LOOPBACK) { + ETHQOSINFO("Loopback is already enabled\n"); + print_loopback_detail(ethqos->current_loopback); + return -EINVAL; + } + ETHQOSINFO("enable loopback = %d with link speed = %d backup now\n", + config, speed); + + /*Backup speed & duplex before Enabling Loopback */ + if (ethqos->current_loopback == DISABLE_LOOPBACK && + config > DISABLE_LOOPBACK) { + /*Backup old speed & duplex*/ + ethqos->backup_speed = priv->speed; + ethqos->backup_duplex = priv->dev->phydev->duplex; + } + /*Backup BMCR before Enabling Phy LoopbackLoopback */ + if (ethqos->current_loopback == DISABLE_LOOPBACK && + config == ENABLE_PHY_LOOPBACK) + ethqos->bmcr_backup = ethqos_mdio_read(priv, + priv->plat->phy_addr, + MII_BMCR); + + if (config == DISABLE_LOOPBACK) + setup_config_registers(ethqos, ethqos->backup_speed, + ethqos->backup_duplex, 0); + else + setup_config_registers(ethqos, speed, DUPLEX_FULL, config); + + switch (config) { + case DISABLE_LOOPBACK: + ETHQOSINFO("Request to Disable Loopback\n"); + if (ethqos->current_loopback == ENABLE_IO_MACRO_LOOPBACK) + ethqos_rgmii_io_macro_loopback(ethqos, 0); + else if (ethqos->current_loopback == ENABLE_MAC_LOOPBACK) + ethqos_mac_loopback(ethqos, 0); + else if (ethqos->current_loopback == ENABLE_PHY_LOOPBACK) + phy_digital_loopback_config(ethqos, + ethqos->backup_speed, 0); + break; + case ENABLE_IO_MACRO_LOOPBACK: + ETHQOSINFO("Request to Enable IO MACRO LOOPBACK\n"); + ethqos_rgmii_io_macro_loopback(ethqos, 1); + break; + case ENABLE_MAC_LOOPBACK: + ETHQOSINFO("Request to Enable MAC LOOPBACK\n"); + ethqos_mac_loopback(ethqos, 1); + break; + case ENABLE_PHY_LOOPBACK: + ETHQOSINFO("Request to Enable PHY LOOPBACK\n"); + ethqos->loopback_speed = speed; + phy_digital_loopback_config(ethqos, speed, 1); + break; + default: + ETHQOSINFO("Invalid Loopback=%d\n", config); + break; + } + + ethqos->current_loopback = config; + kfree(in_buf); + return count; +} + +static ssize_t read_loopback_config(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + unsigned int len = 0, buf_len = 2000; + struct qcom_ethqos *ethqos = file->private_data; + + if (ethqos->current_loopback == DISABLE_LOOPBACK) + len += scnprintf(buf + len, buf_len - len, + "Loopback is Disabled\n"); + else if (ethqos->current_loopback == ENABLE_IO_MACRO_LOOPBACK) + len += scnprintf(buf + len, buf_len - len, + "Current Loopback is IO MACRO LOOPBACK\n"); + else if (ethqos->current_loopback == ENABLE_MAC_LOOPBACK) + len += scnprintf(buf + len, buf_len - len, + "Current Loopback is MAC LOOPBACK\n"); + else if (ethqos->current_loopback == ENABLE_PHY_LOOPBACK) + len += scnprintf(buf + len, buf_len - len, + "Current Loopback is PHY LOOPBACK\n"); + else + len += scnprintf(buf + len, buf_len - len, + "Invalid LOOPBACK Config\n"); + if (len > buf_len) + len = buf_len; + + return simple_read_from_buffer(user_buf, count, ppos, buf, len); +} + static const struct file_operations fops_phy_reg_dump = { .read = read_phy_reg_dump, .open = simple_open, @@ -1254,6 +1767,22 @@ static ssize_t write_ipc_stmmac_log_ctxt_low(struct file *file, return count; } +static const struct file_operations fops_phy_off = { + .read = read_phy_off, + .write = phy_off_config, + .open = simple_open, + .owner = THIS_MODULE, + .llseek = default_llseek, +}; + +static const struct file_operations fops_loopback_config = { + .read = read_loopback_config, + .write = loopback_handling_config, + .open = simple_open, + .owner = THIS_MODULE, + .llseek = default_llseek, +}; + static const struct file_operations fops_ipc_stmmac_log_low = { .write = write_ipc_stmmac_log_ctxt_low, .open = simple_open, @@ -1266,6 +1795,8 @@ static int ethqos_create_debugfs(struct qcom_ethqos *ethqos) static struct dentry *phy_reg_dump; static struct dentry *rgmii_reg_dump; static struct dentry *ipc_stmmac_log_low; + static struct dentry *phy_off; + static struct dentry *loopback_enable_mode; if (!ethqos) { ETHQOSERR("Null Param %s\n", __func__); @@ -1299,11 +1830,26 @@ static int ethqos_create_debugfs(struct qcom_ethqos *ethqos) ethqos->debugfs_dir, ethqos, &fops_ipc_stmmac_log_low); if (!ipc_stmmac_log_low || IS_ERR(ipc_stmmac_log_low)) { - ETHQOSERR("Cannot create debugfs ipc_stmmac_log_low %d\n", - (int)ipc_stmmac_log_low); + ETHQOSERR("Cannot create debugfs ipc_stmmac_log_low %x\n", + ipc_stmmac_log_low); + goto fail; + } + phy_off = debugfs_create_file("phy_off", 0400, + ethqos->debugfs_dir, ethqos, + &fops_phy_off); + if (!phy_off || IS_ERR(phy_off)) { + ETHQOSERR("Can't create phy_off %x\n", phy_off); goto fail; } + loopback_enable_mode = debugfs_create_file("loopback_enable_mode", 0400, + ethqos->debugfs_dir, ethqos, + &fops_loopback_config); + if (!loopback_enable_mode || IS_ERR(loopback_enable_mode)) { + ETHQOSERR("Can't create loopback_enable_mode %d\n", + (int)loopback_enable_mode); + goto fail; + } return 0; fail: @@ -1914,6 +2460,21 @@ static int qcom_ethqos_probe(struct platform_device *pdev) } ETHQOSDBG(": emac_core_version = %d\n", ethqos->emac_ver); + if (of_property_read_bool(pdev->dev.of_node, + "emac-phy-off-suspend")) { + /* Read emac core version value from dtsi */ + ret = of_property_read_u32(pdev->dev.of_node, + "emac-phy-off-suspend", + ðqos->current_phy_mode); + if (ret) { + ETHQOSDBG(":resource emac-phy-off-suspend! "); + ETHQOSDBG("not in dtsi\n"); + ethqos->current_phy_mode = 0; + } + } + ETHQOSINFO("emac-phy-off-suspend = %d\n", + ethqos->current_phy_mode); + ethqos->ioaddr = (&stmmac_res)->addr; ethqos_update_rgmii_tx_drv_strength(ethqos); @@ -2011,6 +2572,8 @@ static int qcom_ethqos_suspend(struct device *dev) struct net_device *ndev = NULL; int ret; int allow_suspend = 0; + struct stmmac_priv *priv; + struct plat_stmmacenet_data *plat; ETHQOSDBG("Suspend Enter\n"); if (of_device_is_compatible(dev->of_node, "qcom,emac-smmu-embedded")) { @@ -2023,6 +2586,8 @@ static int qcom_ethqos_suspend(struct device *dev) return -ENODEV; ndev = dev_get_drvdata(dev); + priv = netdev_priv(ndev); + plat = priv->plat; ethqos_ipa_offload_event_handler(&allow_suspend, EV_DPM_SUSPEND); if (!allow_suspend) { @@ -2032,9 +2597,25 @@ static int qcom_ethqos_suspend(struct device *dev) } if (!ndev || !netif_running(ndev)) return -EINVAL; - + if (ethqos->current_phy_mode == DISABLE_PHY_AT_SUSPEND_ONLY || + ethqos->current_phy_mode == DISABLE_PHY_SUSPEND_ENABLE_RESUME) { + /*Backup phy related data*/ + if (priv->phydev->autoneg == AUTONEG_DISABLE) { + ethqos->backup_autoneg = priv->phydev->autoneg; + ethqos->backup_bmcr = ethqos_mdio_read(priv, + plat->phy_addr, + MII_BMCR); + } else { + ethqos->backup_autoneg = AUTONEG_ENABLE; + } + } ret = stmmac_suspend(dev); qcom_ethqos_phy_suspend_clks(ethqos); + if (ethqos->current_phy_mode == DISABLE_PHY_AT_SUSPEND_ONLY || + ethqos->current_phy_mode == DISABLE_PHY_SUSPEND_ENABLE_RESUME) { + ETHQOSINFO("disable phy at suspend\n"); + ethqos_phy_power_off(ethqos); + } ETHQOSDBG(" ret = %d\n", ret); return ret; @@ -2045,6 +2626,7 @@ static int qcom_ethqos_resume(struct device *dev) struct net_device *ndev = NULL; struct qcom_ethqos *ethqos; int ret; + struct stmmac_priv *priv; ETHQOSDBG("Resume Enter\n"); if (of_device_is_compatible(dev->of_node, "qcom,emac-smmu-embedded")) @@ -2056,6 +2638,7 @@ static int qcom_ethqos_resume(struct device *dev) return -ENODEV; ndev = dev_get_drvdata(dev); + priv = netdev_priv(ndev); if (!ndev || !netif_running(ndev)) { ETHQOSERR(" Resume not possible\n"); @@ -2068,10 +2651,39 @@ static int qcom_ethqos_resume(struct device *dev) return 0; } + if (ethqos->current_phy_mode == DISABLE_PHY_SUSPEND_ENABLE_RESUME) { + ETHQOSINFO("enable phy at resume\n"); + ethqos_phy_power_on(ethqos); + } qcom_ethqos_phy_resume_clks(ethqos); - ret = stmmac_resume(dev); + if (ethqos->current_phy_mode == DISABLE_PHY_SUSPEND_ENABLE_RESUME) { + ETHQOSINFO("reset phy after clock\n"); + ethqos_reset_phy_enable_interrupt(ethqos); + if (ethqos->backup_autoneg == AUTONEG_DISABLE) { + priv->phydev->autoneg = ethqos->backup_autoneg; + ethqos_mdio_write( + priv, priv->plat->phy_addr, + MII_BMCR, ethqos->backup_bmcr); + } + } + if (ethqos->current_phy_mode == DISABLE_PHY_AT_SUSPEND_ONLY) { + /* Temp Enable LOOPBACK_EN. + * TX clock needed for reset As Phy is off + */ + rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, + RGMII_CONFIG_LOOPBACK_EN, + RGMII_IO_MACRO_CONFIG); + ETHQOSINFO("Loopback EN Enabled\n"); + } + ret = stmmac_resume(dev); + if (ethqos->current_phy_mode == DISABLE_PHY_AT_SUSPEND_ONLY) { + //Disable LOOPBACK_EN + rgmii_updatel(ethqos, RGMII_CONFIG_LOOPBACK_EN, + 0, RGMII_IO_MACRO_CONFIG); + ETHQOSINFO("Loopback EN Disabled\n"); + } ethqos_ipa_offload_event_handler(NULL, EV_DPM_RESUME); ETHQOSDBG("<--Resume Exit\n"); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h index 40dbd4392288..e275873aa250 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.h @@ -235,6 +235,10 @@ do {\ #define VOTE_IDX_100MBPS 2 #define VOTE_IDX_1000MBPS 3 +//Mac config +#define MAC_CONFIGURATION 0x0 +#define MAC_LM BIT(12) + #define TLMM_BASE_ADDRESS (tlmm_central_base_addr) #define TLMM_RGMII_HDRV_PULL_CTL1_ADDRESS_OFFSET\ @@ -329,9 +333,29 @@ static inline u32 PPSX_MASK(u32 x) } enum IO_MACRO_PHY_MODE { - RGMII_MODE, - RMII_MODE, - MII_MODE + RGMII_MODE, + RMII_MODE, + MII_MODE +}; + +enum loopback_mode { + DISABLE_LOOPBACK = 0, + ENABLE_IO_MACRO_LOOPBACK, + ENABLE_MAC_LOOPBACK, + ENABLE_PHY_LOOPBACK +}; + +enum phy_power_mode { + DISABLE_PHY_IMMEDIATELY = 1, + ENABLE_PHY_IMMEDIATELY, + DISABLE_PHY_AT_SUSPEND_ONLY, + DISABLE_PHY_SUSPEND_ENABLE_RESUME, + DISABLE_PHY_ON_OFF, +}; + +enum current_phy_state { + PHY_IS_ON = 0, + PHY_IS_OFF, }; #define RGMII_IO_BASE_ADDRESS ethqos->rgmii_base @@ -458,6 +482,19 @@ struct qcom_ethqos { bool ipa_enabled; /* Key Performance Indicators */ bool print_kpi; + unsigned int emac_phy_off_suspend; + int loopback_speed; + enum loopback_mode current_loopback; + enum phy_power_mode current_phy_mode; + enum current_phy_state phy_state; + /*Backup variable for phy loopback*/ + int backup_duplex; + int backup_speed; + u32 bmcr_backup; + /*Backup variable for suspend resume*/ + int backup_suspend_speed; + u32 backup_bmcr; + unsigned backup_autoneg:1; }; struct pps_cfg { @@ -513,6 +550,9 @@ bool qcom_ethqos_is_phy_link_up(struct qcom_ethqos *ethqos); void *qcom_ethqos_get_priv(struct qcom_ethqos *ethqos); int ppsout_config(struct stmmac_priv *priv, struct pps_cfg *eth_pps_cfg); +int ethqos_phy_power_on(struct qcom_ethqos *ethqos); +void ethqos_phy_power_off(struct qcom_ethqos *ethqos); +void ethqos_reset_phy_enable_interrupt(struct qcom_ethqos *ethqos); u16 dwmac_qcom_select_queue( struct net_device *dev, @@ -574,4 +614,6 @@ int dwmac_qcom_program_avb_algorithm( struct stmmac_priv *priv, struct ifr_data_struct *req); unsigned int dwmac_qcom_get_plat_tx_coal_frames( struct sk_buff *skb); + +unsigned int dwmac_qcom_get_eth_type(unsigned char *buf); #endif diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c index 76aafe700851..5ad0eddf9179 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-gpio.c @@ -183,6 +183,63 @@ void ethqos_disable_regulators(struct qcom_ethqos *ethqos) } } +void ethqos_reset_phy_enable_interrupt(struct qcom_ethqos *ethqos) +{ + struct stmmac_priv *priv = qcom_ethqos_get_priv(ethqos); + struct phy_device *phydev = priv->dev->phydev; + + /* reset the phy so that it's ready */ + if (priv->mii) { + ETHQOSERR("do mdio reset\n"); + stmmac_mdio_reset(priv->mii); + } + /*Enable phy interrupt*/ + if (phy_intr_en && phydev) { + ETHQOSDBG("PHY interrupt Mode enabled\n"); + phydev->irq = PHY_IGNORE_INTERRUPT; + phydev->interrupts = PHY_INTERRUPT_ENABLED; + + if (phydev->drv->config_intr && + !phydev->drv->config_intr(phydev)) { + ETHQOSERR("config_phy_intr successful after phy on\n"); + } + qcom_ethqos_request_phy_wol(priv->plat); + } else if (!phy_intr_en) { + phydev->irq = PHY_POLL; + ETHQOSDBG("PHY Polling Mode enabled\n"); + } else { + ETHQOSERR("phydev is null , intr value=%d\n", phy_intr_en); + } +} + +int ethqos_phy_power_on(struct qcom_ethqos *ethqos) +{ + int ret = 0; + + if (ethqos->reg_emac_phy) { + ret = regulator_enable(ethqos->reg_emac_phy); + if (ret) { + ETHQOSERR("Can not enable <%s>\n", + EMAC_VREG_EMAC_PHY_NAME); + return ret; + } + ethqos->phy_state = PHY_IS_ON; + } else { + ETHQOSERR("reg_emac_phy is NULL\n"); + } + return ret; +} + +void ethqos_phy_power_off(struct qcom_ethqos *ethqos) +{ + if (ethqos->reg_emac_phy) { + regulator_disable(ethqos->reg_emac_phy); + ethqos->phy_state = PHY_IS_OFF; + } else { + ETHQOSERR("reg_emac_phy is NULL\n"); + } +} + void ethqos_free_gpios(struct qcom_ethqos *ethqos) { if (gpio_is_valid(ethqos->gpio_phy_intr_redirect)) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c index fc6a346a4b7f..48285bb179a8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ipa.c @@ -1046,6 +1046,7 @@ static void ntn_ipa_notify_cb(void *priv, enum ipa_dp_evt_type evt, int stat = NET_RX_SUCCESS; struct platform_device *pdev; struct net_device *dev; + struct stmmac_priv *pdata; if (!ethqos || !skb) { ETHQOSERR("Null Param pdata %p skb %pK\n", ethqos, skb); @@ -1065,6 +1066,7 @@ static void ntn_ipa_notify_cb(void *priv, enum ipa_dp_evt_type evt, pdev = ethqos->pdev; dev = platform_get_drvdata(pdev); + pdata = netdev_priv(dev); if (evt == IPA_RECEIVE) { /*Exception packets to network stack*/ @@ -1075,6 +1077,8 @@ static void ntn_ipa_notify_cb(void *priv, enum ipa_dp_evt_type evt, skb->protocol = htons(ETH_P_IP); iph = (struct iphdr *)skb->data; } else { + if (ethqos->current_loopback > DISABLE_LOOPBACK) + swap_ip_port(skb, ETH_P_IP); skb->protocol = eth_type_trans(skb, skb->dev); iph = (struct iphdr *)(skb_mac_header(skb) + ETH_HLEN); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 0b2b4cbb26cc..52cdaa9c0c02 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -33,6 +33,10 @@ #include #endif #include "dwmac-qcom-ipa-offload.h" +#include +#include +#include +#include struct stmmac_resources { void __iomem *addr; @@ -149,6 +153,7 @@ struct stmmac_priv { void __iomem *ptpaddr; u32 mss; bool boot_kpi; + int current_loopback; #ifdef CONFIG_DEBUG_FS struct dentry *dbgfs_dir; struct dentry *dbgfs_rings_status; @@ -175,6 +180,8 @@ extern struct stmmac_emb_smmu_cb_ctx stmmac_emb_smmu_ctx; #define MICREL_PHY_ID 0x00221620 +#define MMC_CONFIG 0x24 + int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_init_pps(struct stmmac_priv *priv); @@ -198,5 +205,7 @@ int stmmac_dvr_probe(struct device *device, void stmmac_disable_eee_mode(struct stmmac_priv *priv); bool stmmac_eee_init(struct stmmac_priv *priv); bool qcom_ethqos_ipa_enabled(void); - +u16 icmp_fast_csum(u16 old_csum); +void swap_ip_port(struct sk_buff *skb, unsigned int eth_type); +unsigned int dwmac_qcom_get_eth_type(unsigned char *buf); #endif /* __STMMAC_H__ */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 8875bfcdde16..9057ef572cf6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -544,6 +544,9 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, u32 tx_queues_count = priv->plat->tx_queues_to_use; int i, j = 0; + /* enable reset on read for mmc counter */ + writel_relaxed(MMC_CONFIG, priv->mmcaddr); + /* Update the DMA HW counters for dwmac10/100 */ if (priv->hw->dma->dma_diagnostic_fr) priv->hw->dma->dma_diagnostic_fr(&dev->stats, @@ -647,6 +650,10 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) u32 emac_wol_support = 0; int ret; + if (ethqos->phy_state == PHY_IS_OFF) { + ETHQOSINFO("Phy is in off state Wol set not possible\n"); + return -EOPNOTSUPP; + } /* By default almost all GMAC devices support the WoL via * magic frame but we can disable it if the HW capability * register shows no support for pmt_magic_frame. */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e23cf61e8479..85a4214f8e9c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3519,6 +3519,47 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) rx_q->dirty_rx = entry; } +static u16 csum(u16 old_csum) +{ + u16 new_checksum = 0; + + new_checksum = ~(~old_csum + (-8) + 0); + return new_checksum; +} + +void swap_ip_port(struct sk_buff *skb, unsigned int eth_type) +{ + __be32 temp_addr; + unsigned char *buf = skb->data; + struct icmphdr *icmp_hdr; + unsigned char eth_temp[ETH_ALEN] = {}; + struct ethhdr *eth = (struct ethhdr *)(buf); + struct iphdr *ip_header; + + if (eth_type == ETH_P_IP) { + ip_header = (struct iphdr *)(buf + sizeof(struct ethhdr)); + if (ip_header->protocol == IPPROTO_UDP || + ip_header->protocol == IPPROTO_ICMP) { + //swap mac address + memcpy(eth_temp, eth->h_dest, ETH_ALEN); + memcpy(eth->h_dest, eth->h_source, ETH_ALEN); + memcpy(eth->h_source, eth_temp, ETH_ALEN); + //swap ip address + temp_addr = ip_header->daddr; + ip_header->daddr = ip_header->saddr; + ip_header->saddr = temp_addr; + + icmp_hdr = (struct icmphdr *)(buf + + sizeof(struct ethhdr) + + sizeof(struct iphdr)); + if (icmp_hdr->type == ICMP_ECHO) { + icmp_hdr->type = ICMP_ECHOREPLY; + icmp_hdr->checksum = csum(icmp_hdr->checksum); + } + } + } +} + /** * stmmac_rx - manage the receive process * @priv: driver private structure @@ -3533,6 +3574,9 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) int coe = priv->hw->rx_csum; unsigned int next_entry = rx_q->cur_rx; unsigned int count = 0; +#ifndef CONFIG_ETH_IPA_OFFLOAD + unsigned int eth_type; +#endif if (netif_msg_rx_status(priv)) { void *rx_head; @@ -3707,7 +3751,13 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) stmmac_get_rx_hwtstamp(priv, p, np, skb); stmmac_rx_vlan(priv->dev, skb); +#ifndef CONFIG_ETH_IPA_OFFLOAD + eth_type = dwmac_qcom_get_eth_type(skb->data); + if (priv->current_loopback > 0 && + eth_type == ETH_P_IP) + swap_ip_port(skb, eth_type); +#endif skb->protocol = eth_type_trans(skb, priv->dev); if (unlikely(!coe)) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index a920660a114a..e9017d8894a8 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -8020,6 +8020,20 @@ static const struct ieee80211_iface_limit ath10k_tlv_if_limit_ibss[] = { }, }; +static const struct ieee80211_iface_limit ath10k_tlv_if_vap_limit[] = { + { + .max = 1, + .types = BIT(NL80211_IFTYPE_STATION), + }, + { + .max = 3, + .types = BIT(NL80211_IFTYPE_AP) +#ifdef CONFIG_MAC80211_MESH + | BIT(NL80211_IFTYPE_MESH_POINT) +#endif + }, +}; + /* FIXME: This is not thouroughly tested. These combinations may over- or * underestimate hw/fw capabilities. */ @@ -8036,6 +8050,14 @@ static struct ieee80211_iface_combination ath10k_tlv_if_comb[] = { .max_interfaces = 2, .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit_ibss), }, + { + .limits = ath10k_tlv_if_vap_limit, + .num_different_channels = 1, + .max_interfaces = 4, + .beacon_int_infra_match = true, + .beacon_int_min_gcd = 1, + .n_limits = ARRAY_SIZE(ath10k_tlv_if_vap_limit), + }, }; static struct ieee80211_iface_combination ath10k_tlv_qcs_if_comb[] = { @@ -8057,6 +8079,12 @@ static struct ieee80211_iface_combination ath10k_tlv_qcs_if_comb[] = { .max_interfaces = 2, .n_limits = ARRAY_SIZE(ath10k_tlv_if_limit_ibss), }, + { + .limits = ath10k_tlv_if_vap_limit, + .num_different_channels = 1, + .max_interfaces = 4, + .n_limits = ARRAY_SIZE(ath10k_tlv_if_vap_limit), + }, }; static const struct ieee80211_iface_limit ath10k_10_4_if_limits[] = { diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 39eba6d6db3d..7c104ee0da7f 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -1579,7 +1579,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar) cfg->max_frag_entries = __cpu_to_le32(2); cfg->num_tdls_vdevs = __cpu_to_le32(TARGET_TLV_NUM_TDLS_VDEVS); cfg->num_tdls_conn_table_entries = __cpu_to_le32(0x20); - cfg->beacon_tx_offload_max_vdev = __cpu_to_le32(2); + cfg->beacon_tx_offload_max_vdev = __cpu_to_le32(3); cfg->num_multicast_filter_entries = __cpu_to_le32(5); cfg->num_wow_filters = __cpu_to_le32(ar->wow.max_num_patterns); cfg->num_keep_alive_pattern = __cpu_to_le32(6); diff --git a/drivers/net/wireless/cnss_utils/cnss_utils.c b/drivers/net/wireless/cnss_utils/cnss_utils.c index b3dfbb698019..296e444b63dd 100644 --- a/drivers/net/wireless/cnss_utils/cnss_utils.c +++ b/drivers/net/wireless/cnss_utils/cnss_utils.c @@ -31,7 +31,7 @@ #define LPASS_PMU_INT_EN0 0xC060084 #define LPASS_PMU_INT_CLR 0xC060034 #endif -#define CNSS_MAX_CH_NUM 45 +#define CNSS_MAX_CH_NUM 157 struct cnss_unsafe_channel_list { u16 unsafe_ch_count; u16 unsafe_ch_list[CNSS_MAX_CH_NUM]; diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_com.h b/drivers/platform/msm/ep_pcie/ep_pcie_com.h index 4d3b594b8659..0eb76b2f1b3c 100644 --- a/drivers/platform/msm/ep_pcie/ep_pcie_com.h +++ b/drivers/platform/msm/ep_pcie/ep_pcie_com.h @@ -385,7 +385,6 @@ struct ep_pcie_dev_t { bool config_mmio_init; bool enumerated; enum ep_pcie_link_status link_status; - bool perst_deast; bool power_on; bool suspending; bool l23_ready; @@ -393,6 +392,8 @@ struct ep_pcie_dev_t { struct ep_pcie_msi_config msi_cfg; bool no_notify; bool client_ready; + atomic_t ep_pcie_dev_wake; + atomic_t perst_deast; struct ep_pcie_register_event *event_reg; struct work_struct handle_perst_work; diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_core.c b/drivers/platform/msm/ep_pcie/ep_pcie_core.c index 61c6e12c99e0..a3573189f65e 100644 --- a/drivers/platform/msm/ep_pcie/ep_pcie_core.c +++ b/drivers/platform/msm/ep_pcie/ep_pcie_core.c @@ -1805,7 +1805,7 @@ int ep_pcie_core_enable_endpoint(enum ep_pcie_options opt) ret = EP_PCIE_ERROR; goto link_fail; } else { - dev->perst_deast = true; + atomic_set(&dev->perst_deast, 1); if (opt & EP_PCIE_OPT_AST_WAKE) { /* deassert PCIe WAKE# */ EP_PCIE_DBG(dev, @@ -1969,11 +1969,19 @@ out: int ep_pcie_core_disable_endpoint(void) { int rc = 0; + u32 val = 0; + unsigned long irqsave_flags; struct ep_pcie_dev_t *dev = &ep_pcie_dev; EP_PCIE_DBG(dev, "PCIe V%d\n", dev->rev); mutex_lock(&dev->setup_mtx); + if (atomic_read(&dev->perst_deast)) { + EP_PCIE_DBG(dev, + "PCIe V%d: PERST is de-asserted, exiting disable\n", + dev->rev); + goto out; + } if (!dev->power_on) { EP_PCIE_DBG(dev, @@ -1990,9 +1998,25 @@ int ep_pcie_core_disable_endpoint(void) dev->rev); } + val = readl_relaxed(dev->elbi + PCIE20_ELBI_SYS_STTS); + EP_PCIE_DBG(dev, "PCIe V%d: LTSSM_STATE during disable:0x%x\n", + dev->rev, (val >> 0xC) & 0x3f); ep_pcie_pipe_clk_deinit(dev); ep_pcie_clk_deinit(dev); ep_pcie_vreg_deinit(dev); + + spin_lock_irqsave(&dev->isr_lock, irqsave_flags); + if (atomic_read(&dev->ep_pcie_dev_wake) && + !atomic_read(&dev->perst_deast)) { + EP_PCIE_DBG(dev, "PCIe V%d: Released wakelock\n", dev->rev); + atomic_set(&dev->ep_pcie_dev_wake, 0); + pm_relax(&dev->pdev->dev); + } else { + EP_PCIE_DBG(dev, "PCIe V%d: Bail, Perst-assert:%d wake:%d\n", + dev->rev, atomic_read(&dev->perst_deast), + atomic_read(&dev->ep_pcie_dev_wake)); + } + spin_unlock_irqrestore(&dev->isr_lock, irqsave_flags); out: mutex_unlock(&dev->setup_mtx); return rc; @@ -2249,12 +2273,25 @@ static void handle_d3cold_func(struct work_struct *work) { struct ep_pcie_dev_t *dev = container_of(work, struct ep_pcie_dev_t, handle_d3cold_work); + unsigned long irqsave_flags; EP_PCIE_DBG(dev, "PCIe V%d: shutdown PCIe link due to PERST assertion before BME is set\n", dev->rev); ep_pcie_core_disable_endpoint(); dev->no_notify = false; + spin_lock_irqsave(&dev->isr_lock, irqsave_flags); + if (atomic_read(&dev->ep_pcie_dev_wake) && + !atomic_read(&dev->perst_deast)) { + atomic_set(&dev->ep_pcie_dev_wake, 0); + pm_relax(&dev->pdev->dev); + EP_PCIE_DBG(dev, "PCIe V%d: Released wakelock\n", dev->rev); + } else { + EP_PCIE_DBG(dev, "PCIe V%d: Bail, Perst-assert:%d wake:%d\n", + dev->rev, atomic_read(&dev->perst_deast), + atomic_read(&dev->ep_pcie_dev_wake)); + } + spin_unlock_irqrestore(&dev->isr_lock, irqsave_flags); } static void handle_bme_func(struct work_struct *work) @@ -2292,14 +2329,24 @@ static irqreturn_t ep_pcie_handle_perst_irq(int irq, void *data) } if (perst) { - dev->perst_deast = true; + atomic_set(&dev->perst_deast, 1); dev->perst_deast_counter++; + /* + * Hold a wakelock to avoid missing BME and other + * interrupts if apps goes into suspend before BME is set. + */ + if (!atomic_read(&dev->ep_pcie_dev_wake)) { + pm_stay_awake(&dev->pdev->dev); + atomic_set(&dev->ep_pcie_dev_wake, 1); + EP_PCIE_DBG(dev, "PCIe V%d: Acquired wakelock\n", + dev->rev); + } EP_PCIE_DBG(dev, "PCIe V%d: No. %ld PERST deassertion\n", dev->rev, dev->perst_deast_counter); ep_pcie_notify_event(dev, EP_PCIE_EVENT_PM_RST_DEAST); } else { - dev->perst_deast = false; + atomic_set(&dev->perst_deast, 0); dev->perst_ast_counter++; EP_PCIE_DBG(dev, "PCIe V%d: No. %ld PERST assertion\n", @@ -2550,14 +2597,15 @@ perst_irq: * based on the next expected level of the gpio */ if (gpio_get_value(dev->gpio[EP_PCIE_GPIO_PERST].num) == 1) - dev->perst_deast = true; + atomic_set(&dev->perst_deast, 1); /* register handler for PERST interrupt */ perst_irq = gpio_to_irq(dev->gpio[EP_PCIE_GPIO_PERST].num); ret = devm_request_irq(pdev, perst_irq, ep_pcie_handle_perst_irq, - ((dev->perst_deast ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH) - | IRQF_EARLY_RESUME), + ((atomic_read(&dev->perst_deast) ? + IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH) + | IRQF_EARLY_RESUME), "ep_pcie_perst", dev); if (ret) { EP_PCIE_ERR(dev, @@ -2951,7 +2999,7 @@ static int ep_pcie_core_wakeup_host(enum ep_pcie_event event) if (event == EP_PCIE_EVENT_PM_D3_HOT) ep_pcie_core_issue_inband_pme(); - if (dev->perst_deast && !dev->l23_ready) { + if (atomic_read(&dev->perst_deast) && !dev->l23_ready) { EP_PCIE_ERR(dev, "PCIe V%d: request to assert WAKE# when PERST is de-asserted and D3hot is not received\n", dev->rev); @@ -2962,7 +3010,7 @@ static int ep_pcie_core_wakeup_host(enum ep_pcie_event event) EP_PCIE_DBG(dev, "PCIe V%d: No. %ld to assert PCIe WAKE#; perst is %s de-asserted; D3hot is %s received\n", dev->rev, dev->wake_counter, - dev->perst_deast ? "" : "not", + atomic_read(&dev->perst_deast) ? "" : "not", dev->l23_ready ? "" : "not"); /* * Assert WAKE# GPIO until link is back to L0. @@ -3217,6 +3265,14 @@ static int ep_pcie_probe(struct platform_device *pdev) goto irq_failure; } + /* + * Wakelock is needed to avoid missing BME and other + * interrupts if apps goes into suspend before host + * sets them. + */ + device_init_wakeup(&ep_pcie_dev.pdev->dev, true); + atomic_set(&ep_pcie_dev.ep_pcie_dev_wake, 0); + if (ep_pcie_dev.perst_enum && !gpio_get_value(ep_pcie_dev.gpio[EP_PCIE_GPIO_PERST].num)) { EP_PCIE_DBG2(&ep_pcie_dev, diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_uc_offload.c b/drivers/platform/msm/ipa/ipa_clients/ipa_uc_offload.c index 7090b63f4cc3..67ed1fd76347 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_uc_offload.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_uc_offload.c @@ -540,20 +540,16 @@ int ipa_uc_ntn_conn_pipes(struct ipa_ntn_conn_in_params *inp, goto fail; } - if (ntn_ctx->conn.dl.smmu_enabled) { - result = ipa_uc_ntn_alloc_conn_smmu_info(&ntn_ctx->conn.dl, - &inp->dl); - if (result) { - IPA_UC_OFFLOAD_ERR("alloc failure on TX\n"); - goto fail; - } - result = ipa_uc_ntn_alloc_conn_smmu_info(&ntn_ctx->conn.ul, - &inp->ul); - if (result) { - ipa_uc_ntn_free_conn_smmu_info(&ntn_ctx->conn.dl); - IPA_UC_OFFLOAD_ERR("alloc failure on RX\n"); - goto fail; - } + result = ipa_uc_ntn_alloc_conn_smmu_info(&ntn_ctx->conn.dl, &inp->dl); + if (result) { + IPA_UC_OFFLOAD_ERR("alloc failure on TX\n"); + goto fail; + } + result = ipa_uc_ntn_alloc_conn_smmu_info(&ntn_ctx->conn.ul, &inp->ul); + if (result) { + ipa_uc_ntn_free_conn_smmu_info(&ntn_ctx->conn.dl); + IPA_UC_OFFLOAD_ERR("alloc failure on RX\n"); + goto fail; } fail: diff --git a/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth.c b/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth.c index 8a64c5a6e7b1..71c7c6ffbad7 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth.c +++ b/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth.c @@ -571,9 +571,10 @@ static int ipa_eth_pm_notifier_event_suspend_prepare( * and reverts the device suspension by aborting the system suspend. */ if (ipa_eth_net_check_active(eth_dev)) { - pr_info("%s: %s is active, preventing suspend for some time", - IPA_ETH_SUBSYS, eth_dev->net_dev->name); - ipa_eth_dev_wakeup_event(eth_dev); + pr_info("%s: %s is active, preventing suspend for %u ms", + IPA_ETH_SUBSYS, eth_dev->net_dev->name, + IPA_ETH_WAKE_TIME_MS); + pm_wakeup_dev_event(eth_dev->dev, IPA_ETH_WAKE_TIME_MS, false); return NOTIFY_BAD; } diff --git a/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_i.h b/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_i.h index f92da41cd7aa..2ffc31c27da7 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_i.h @@ -35,8 +35,12 @@ #define IPA_ETH_IPC_LOGDBG_DEFAULT false #endif +/* Time to remain awake after a suspend abort due to NIC activity */ #define IPA_ETH_WAKE_TIME_MS 500 +/* Time for NIC HW to settle down (ex. receive link interrupt) after a resume */ +#define IPA_ETH_RESUME_SETTLE_MS 2000 + #define IPA_ETH_PFDEV (ipa3_ctx ? ipa3_ctx->pdev : NULL) #define IPA_ETH_SUBSYS "ipa_eth" @@ -161,9 +165,31 @@ extern bool ipa_eth_ipc_logdbg; bool ipa_eth_is_ready(void); bool ipa_eth_all_ready(void); -static inline void ipa_eth_dev_wakeup_event(struct ipa_eth_device *eth_dev) +static inline void ipa_eth_dev_assume_active_ms( + struct ipa_eth_device *eth_dev, + unsigned int msec) { - pm_wakeup_dev_event(eth_dev->dev, IPA_ETH_WAKE_TIME_MS, false); + eth_dev_priv(eth_dev)->assume_active += + DIV_ROUND_UP(msec, IPA_ETH_WAKE_TIME_MS); + pm_system_wakeup(); +} + +static inline void ipa_eth_dev_assume_active_inc( + struct ipa_eth_device *eth_dev, + unsigned int count) +{ + eth_dev_priv(eth_dev)->assume_active += count; + pm_system_wakeup(); +} + +static inline void ipa_eth_dev_assume_active_dec( + struct ipa_eth_device *eth_dev, + unsigned int count) +{ + if (eth_dev_priv(eth_dev)->assume_active > count) + eth_dev_priv(eth_dev)->assume_active -= count; + else + eth_dev_priv(eth_dev)->assume_active = 0; } struct ipa_eth_device *ipa_eth_alloc_device( diff --git a/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_pci.c b/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_pci.c index 1095306b009f..80f4a80b7181 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_pci.c +++ b/drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_pci.c @@ -374,7 +374,7 @@ static int ipa_eth_pci_suspend_late_handler(struct device *dev) IPA_ETH_SUBSYS, eth_dev->net_dev->name); /* Have PM_SUSPEND_PREPARE give us one wakeup time quanta */ - eth_dev_priv(eth_dev)->assume_active++; + ipa_eth_dev_assume_active_inc(eth_dev, 1); return -EAGAIN; } @@ -428,8 +428,8 @@ static int ipa_eth_pci_resume_handler(struct device *dev) "Device resume delegated to net driver"); rc = eth_dev_pm_ops(eth_dev)->resume(dev); - /* Give some time after a resume for the device to settle */ - eth_dev_priv(eth_dev)->assume_active++; + /* Give some time for device to settle after a resume */ + ipa_eth_dev_assume_active_ms(eth_dev, IPA_ETH_RESUME_SETTLE_MS); } if (rc) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index d16590839e3c..72386cb1f5d8 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -1003,6 +1003,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) struct ipa_ioc_get_vlan_mode vlan_mode; struct ipa_ioc_wigig_fst_switch fst_switch; struct ipa_nat_in_sram_info nat_in_sram_info; + union ipa_ioc_uc_activation_entry uc_act; size_t sz; int pre_entry; int hdl; @@ -3052,6 +3053,39 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } break; + case IPA_IOC_ADD_UC_ACT_ENTRY: + if (copy_from_user(&uc_act, (const void __user *)arg, + sizeof(union ipa_ioc_uc_activation_entry))) { + IPAERR_RL("copy_from_user fails\n"); + retval = -EFAULT; + break; + } + + /* first field in both structs is cmd id */ + if (uc_act.socks.cmd_id == IPA_SOCKSV5_ADD_COM_ID) { + retval = ipa3_add_socksv5_conn_usr(&uc_act.socks); + } else { + retval = ipa3_add_ipv6_nat_uc_activation_entry( + &uc_act.ipv6_nat); + } + if (retval) { + retval = -EFAULT; + break; + } + if (copy_to_user((void __user *)arg, &uc_act, + sizeof(union ipa_ioc_uc_activation_entry))) { + IPAERR_RL("copy_to_user fails\n"); + retval = -EFAULT; + break; + } + break; + case IPA_IOC_DEL_UC_ACT_ENTRY: + if (ipa3_del_uc_act_entry((uint16_t)arg)) { + retval = -EFAULT; + break; + } + break; + default: IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return -ENOTTY; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c index b09b69f20121..322aaa1c75ff 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c @@ -324,7 +324,7 @@ static ssize_t ipa3_read_ep_reg(struct file *file, char __user *ubuf, *ppos = pos; ret = simple_read_from_buffer(ubuf, count, ppos, dbg_buff, - nbytes); + nbytes); if (ret < 0) { IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return ret; @@ -503,12 +503,12 @@ static int ipa3_attrib_dump(struct ipa_rule_attrib *attrib, if (attrib->attrib_mask & IPA_FLT_SRC_PORT_RANGE) { pr_err("src_port_range:%u %u ", attrib->src_port_lo, - attrib->src_port_hi); + attrib->src_port_hi); } if (attrib->attrib_mask & IPA_FLT_DST_PORT_RANGE) { pr_err("dst_port_range:%u %u ", attrib->dst_port_lo, - attrib->dst_port_hi); + attrib->dst_port_hi); } if (attrib->attrib_mask & IPA_FLT_TYPE) pr_err("type:%d ", attrib->type); @@ -2646,6 +2646,125 @@ static ssize_t ipa3_enable_ipc_low(struct file *file, return count; } +static ssize_t ipa3_read_uc_act_tbl(struct file *file, + char __user *ubuf, size_t count, loff_t *ppos) +{ + int nbytes; + int cnt = 0; + int i; + struct ipa_ipv6_nat_uc_tmpl *uc_entry_nat; + struct ipa_socksv5_uc_tmpl *uc_entry_socks; + struct iphdr_rsv *socks_iphdr; + struct ipv6hdr *socks_ipv6hdr; + + /* IPA version check */ + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN, + "This feature only support on IPA4.5+\n"); + cnt += nbytes; + goto done; + } + + if (!ipa3_ctx->uc_act_tbl_valid) { + IPAERR("uC act tbl wasn't allocated\n"); + return -ENOENT; + } + + if (sizeof(dbg_buff) < count + 1) + return -EFAULT; + + dbg_buff[count] = '\0'; + + mutex_lock(&ipa3_ctx->act_tbl_lock); + + uc_entry_nat = (struct ipa_ipv6_nat_uc_tmpl *) + (ipa3_ctx->uc_act_tbl.base); + nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN, + "uc_act_tbl_total %d, uc_act_tbl_ipv6_nat_total %d uc_act_tbl_socksv5_total %d, uc_act_tbl_next_index %d\n" + "uC activation entries:" + , ipa3_ctx->uc_act_tbl_total, + ipa3_ctx->uc_act_tbl_ipv6_nat_total, + ipa3_ctx->uc_act_tbl_socksv5_total, + ipa3_ctx->uc_act_tbl_next_index); + cnt += nbytes; + for (i = 0; i < IPA_UC_ACT_TBL_SIZE; i++) { + if (uc_entry_nat[i].cmd_id == IPA_IPv6_NAT_COM_ID) { + nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN, + "\nentry %d:\n" + "cmd_id = IPV6_NAT\n" + "private_address_msb 0x%llX\n" + "private_address_lsb 0x%llX\n" + "private_port %u\n" + "public_address_msb 0x%llX\n" + "public_address_lsb 0x%llX\n" + "public_port %u\n", + i, + uc_entry_nat[i].private_address_msb, + uc_entry_nat[i].private_address_lsb, + uc_entry_nat[i].private_port, + uc_entry_nat[i].public_address_msb, + uc_entry_nat[i].public_address_lsb, + uc_entry_nat[i].public_port); + cnt += nbytes; + } else if (uc_entry_nat[i].cmd_id == IPA_SOCKSV5_ADD_COM_ID) { + uc_entry_socks = (struct ipa_socksv5_uc_tmpl *) + (uc_entry_nat); + nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN, + "\nentry %d:\n" + "cmd_id = SOCKSv5\n" + "cmd_param: %u\n" + "source_port: %u\n" + "dest_port: %u\n" + "ipa_socksv5_mask: %x\n", + i, + uc_entry_socks[i].cmd_param, + uc_entry_socks[i].src_port, + uc_entry_socks[i].dst_port, + uc_entry_socks[i].ipa_sockv5_mask); + cnt += nbytes; + + if (uc_entry_socks[i].cmd_param == + IPA_SOCKsv5_ADD_V6_V4_COM_PM) { + socks_iphdr = + &uc_entry_socks[i].ip_hdr.ipv4_rsv; + nbytes = scnprintf(dbg_buff + cnt, + IPA_MAX_MSG_LEN, + "ipv4_src_addr: 0x%X\n" + "ipv4_dst_addr: 0x%X\n", + socks_iphdr->ipv4_temp.saddr, + socks_iphdr->ipv4_temp.daddr); + cnt += nbytes; + } else { + socks_ipv6hdr = + &uc_entry_socks[i].ip_hdr.ipv6_temp; + nbytes = scnprintf(dbg_buff + cnt, + IPA_MAX_MSG_LEN, + "ipv6_src_addr[0]: 0x%X\n" + "ipv6_src_addr[1]: 0x%X\n" + "ipv6_src_addr[2]: 0x%X\n" + "ipv6_src_addr[3]: 0x%X\n" + "ipv6_dts_addr[0]: 0x%X\n" + "ipv6_dts_addr[1]: 0x%X\n" + "ipv6_dts_addr[2]: 0x%X\n" + "ipv6_dts_addr[3]: 0x%X\n", + socks_ipv6hdr->saddr.s6_addr32[0], + socks_ipv6hdr->saddr.s6_addr32[1], + socks_ipv6hdr->saddr.s6_addr32[2], + socks_ipv6hdr->saddr.s6_addr32[3], + socks_ipv6hdr->daddr.s6_addr32[0], + socks_ipv6hdr->daddr.s6_addr32[1], + socks_ipv6hdr->daddr.s6_addr32[2], + socks_ipv6hdr->daddr.s6_addr32[3]); + cnt += nbytes; + } + } + } + mutex_unlock(&ipa3_ctx->act_tbl_lock); +done: + return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt); + +} + static const struct ipa3_debugfs_file debugfs_files[] = { { "gen_reg", IPA_READ_ONLY_MODE, NULL, { @@ -2811,7 +2930,11 @@ static const struct ipa3_debugfs_file debugfs_files[] = { "app_clk_vote_cnt", IPA_READ_ONLY_MODE, NULL, { .read = ipa3_read_app_clk_vote, } - }, + }, { + "uc_act_table", IPA_READ_ONLY_MODE, NULL, { + .read = ipa3_read_uc_act_tbl, + } + } }; void ipa3_debugfs_pre_init(void) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index c2c6aa896859..9ea2adcd2ba3 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -2022,6 +2022,8 @@ struct ipa3_context { bool uc_act_tbl_valid; struct mutex act_tbl_lock; int uc_act_tbl_total; + int uc_act_tbl_socksv5_total; + int uc_act_tbl_ipv6_nat_total; int uc_act_tbl_next_index; bool manual_fw_load; }; @@ -2419,6 +2421,15 @@ int ipa3_add_socksv5_conn(struct ipa_socksv5_info *info); int ipa3_del_socksv5_conn(uint32_t handle); +int ipa3_add_socksv5_conn_usr(struct ipa_kernel_tests_socksv5_uc_tmpl *tmpl); + +int ipa3_add_ipv6_nat_uc_activation_entry( + struct ipa_ioc_ipv6_nat_uc_act_entry *entry); + +int ipa3_del_ipv6_nat_uc_activation_entry(uint16_t index); + +int ipa3_del_uc_act_entry(uint16_t index); + /* * Header removal / addition */ diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_odl.c b/drivers/platform/msm/ipa/ipa_v3/ipa_odl.c index 384a06520911..c0a0d1150060 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_odl.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_odl.c @@ -627,7 +627,9 @@ static long ipa_adpl_ioctl(struct file *filp, switch (cmd) { case IPA_IOC_ODL_GET_AGG_BYTE_LIMIT: odl_pipe_info.agg_byte_limit = - ipa3_odl_ctx->odl_sys_param.ipa_ep_cfg.aggr.aggr_byte_limit; + /*Modem expecting value in bytes. so passing 15 = 15*1024*/ + (ipa3_odl_ctx->odl_sys_param.ipa_ep_cfg.aggr.aggr_byte_limit * + 1024); if (copy_to_user((void __user *)arg, &odl_pipe_info, sizeof(odl_pipe_info))) { retval = -EFAULT; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_odl.h b/drivers/platform/msm/ipa/ipa_v3/ipa_odl.h index 2aedda4d6b28..c8fb2df487c0 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_odl.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_odl.h @@ -13,7 +13,7 @@ #ifndef _IPA3_ODL_H_ #define _IPA3_ODL_H_ -#define IPA_ODL_AGGR_BYTE_LIMIT (15 * 1024) +#define IPA_ODL_AGGR_BYTE_LIMIT 15 #define IPA_ODL_RX_RING_SIZE 192 #define MAX_QUEUE_TO_ODL 1024 #define CONFIG_SUCCESS 1 diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c b/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c index 4490e0cc2db8..849b8cff87e1 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_rt.c @@ -86,14 +86,16 @@ static int ipa_generate_rt_hw_rule(enum ipa_ip_type ip, if (entry->hdr) { hdr_entry = ipa3_id_find(entry->rule.hdr_hdl); - if (!hdr_entry || hdr_entry->cookie != IPA_HDR_COOKIE) { + if (!hdr_entry || (hdr_entry->cookie != IPA_HDR_COOKIE) || + ipa3_check_idr_if_freed(entry->hdr)) { IPAERR_RL("Header entry already deleted\n"); return -EPERM; } } else if (entry->proc_ctx) { hdr_proc_entry = ipa3_id_find(entry->rule.hdr_proc_ctx_hdl); if (!hdr_proc_entry || - hdr_proc_entry->cookie != IPA_PROC_HDR_COOKIE) { + (hdr_proc_entry->cookie != IPA_PROC_HDR_COOKIE) || + ipa3_check_idr_if_freed(entry->proc_ctx)) { IPAERR_RL("Proc header entry already deleted\n"); return -EPERM; } @@ -1767,18 +1769,19 @@ int __ipa3_del_rt_rule(u32 rule_hdl) hdr_entry = ipa3_id_find(entry->rule.hdr_hdl); if (!hdr_entry || hdr_entry->cookie != IPA_HDR_COOKIE) { IPAERR_RL("Header entry already deleted\n"); - return -EINVAL; + entry->hdr = NULL; } } else if (entry->proc_ctx) { hdr_proc_entry = ipa3_id_find(entry->rule.hdr_proc_ctx_hdl); if (!hdr_proc_entry || hdr_proc_entry->cookie != IPA_PROC_HDR_COOKIE) { IPAERR_RL("Proc header entry already deleted\n"); - return -EINVAL; + entry->proc_ctx = NULL; } } - if (entry->hdr) + if (entry->hdr && + (!ipa3_check_idr_if_freed(entry->hdr))) __ipa3_release_hdr(entry->hdr->id); else if (entry->proc_ctx && (!ipa3_check_idr_if_freed(entry->proc_ctx))) @@ -1955,7 +1958,6 @@ int ipa3_reset_rt(enum ipa_ip_type ip, bool user_only) if (!user_only || rule->ipacm_installed) { - list_del(&rule->link); if (rule->hdr) { hdr_entry = ipa3_id_find( rule->rule.hdr_hdl); @@ -1963,8 +1965,7 @@ int ipa3_reset_rt(enum ipa_ip_type ip, bool user_only) hdr_entry->cookie != IPA_HDR_COOKIE) { IPAERR_RL( "Header already deleted\n"); - mutex_unlock(&ipa3_ctx->lock); - return -EINVAL; + rule->hdr = NULL; } } else if (rule->proc_ctx) { hdr_proc_entry = @@ -1975,12 +1976,13 @@ int ipa3_reset_rt(enum ipa_ip_type ip, bool user_only) IPA_PROC_HDR_COOKIE) { IPAERR_RL( "Proc entry already deleted\n"); - mutex_unlock(&ipa3_ctx->lock); - return -EINVAL; + rule->proc_ctx = NULL; } } tbl->rule_cnt--; - if (rule->hdr) + list_del(&rule->link); + if (rule->hdr && + (!ipa3_check_idr_if_freed(rule->hdr))) __ipa3_release_hdr(rule->hdr->id); else if (rule->proc_ctx && (!ipa3_check_idr_if_freed( @@ -2157,20 +2159,8 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy_i *rtrule) struct ipa3_hdr_entry *hdr_entry; struct ipa3_hdr_proc_ctx_entry *hdr_proc_entry; - if (rtrule->rule.hdr_hdl) { - hdr = ipa3_id_find(rtrule->rule.hdr_hdl); - if ((hdr == NULL) || (hdr->cookie != IPA_HDR_COOKIE)) { - IPAERR_RL("rt rule does not point to valid hdr\n"); - goto error; - } - } else if (rtrule->rule.hdr_proc_ctx_hdl) { - proc_ctx = ipa3_id_find(rtrule->rule.hdr_proc_ctx_hdl); - if ((proc_ctx == NULL) || - (proc_ctx->cookie != IPA_PROC_HDR_COOKIE)) { - IPAERR_RL("rt rule does not point to valid proc ctx\n"); - goto error; - } - } + if (__ipa_rt_validate_hndls(&rtrule->rule, &hdr, &proc_ctx)) + goto error; entry = ipa3_id_find(rtrule->rt_rule_hdl); if (entry == NULL) { @@ -2193,14 +2183,16 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy_i *rtrule) if (entry->hdr) { hdr_entry = ipa3_id_find(entry->rule.hdr_hdl); - if (!hdr_entry || hdr_entry->cookie != IPA_HDR_COOKIE) { + if (!hdr_entry || (hdr_entry->cookie != IPA_HDR_COOKIE) || + ipa3_check_idr_if_freed(entry->hdr)) { IPAERR_RL("Header entry already deleted\n"); return -EPERM; } } else if (entry->proc_ctx) { hdr_proc_entry = ipa3_id_find(entry->rule.hdr_proc_ctx_hdl); if (!hdr_proc_entry || - hdr_proc_entry->cookie != IPA_PROC_HDR_COOKIE) { + (hdr_proc_entry->cookie != IPA_PROC_HDR_COOKIE) || + ipa3_check_idr_if_freed(entry->proc_ctx)) { IPAERR_RL("Proc header entry already deleted\n"); return -EPERM; } @@ -2208,7 +2200,7 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy_i *rtrule) if (entry->hdr) entry->hdr->ref_cnt--; - if (entry->proc_ctx) + else if (entry->proc_ctx) entry->proc_ctx->ref_cnt--; entry->rule = rtrule->rule; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 71e8572259dd..8c3b92e19f85 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -9150,6 +9150,213 @@ int ipa3_setup_uc_act_tbl(void) return res; } +static inline bool is_free_socksv5(struct ipa_socksv5_uc_tmpl *socksv5_entry) +{ + if ((!socksv5_entry->cmd_id) || + (socksv5_entry->cmd_id == IPA_SOCKsv5_ADD_COM_ID && + !(socksv5_entry->ipa_sockv5_mask & IPA_SOCKSv5_ENTRY_VALID))) + return true; + return false; +} + +static int ipa3_get_free_uc_act_entry(void) +{ + struct ipa_socksv5_uc_tmpl *entry; + int orig_index = ipa3_ctx->uc_act_tbl_next_index; + int free_index = -1; + + IPADBG("\n"); + /* find a free spot*/ + do { + entry = ipa3_ctx->uc_act_tbl.base + + ipa3_ctx->uc_act_tbl_next_index + * sizeof(struct ipa_socksv5_uc_tmpl); + + /* check if entry is free */ + if (is_free_socksv5(entry)) { + free_index = ipa3_ctx->uc_act_tbl_next_index; + IPADBG("found free index at %d\n", free_index); + break; + } + + ipa3_ctx->uc_act_tbl_next_index++; + ipa3_ctx->uc_act_tbl_next_index %= + IPA_UC_ACT_TBL_SIZE; + } while (orig_index != ipa3_ctx->uc_act_tbl_next_index); + IPADBG("exit free_index %d\n", free_index); + return free_index; +} + +int ipa3_add_ipv6_nat_uc_activation_entry( + struct ipa_ioc_ipv6_nat_uc_act_entry *entry) +{ + int res = 0; + int index; + struct ipa_ipv6_nat_uc_tmpl *uc_entry; + + /* IPA version check */ + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR("Not support !\n"); + return -EPERM; + } + + if (!ipa3_ctx->uc_act_tbl_valid) { + IPAERR("uC act tbl wasn't allocated\n"); + return -ENOENT; + } + + if (!entry) { + IPAERR("Null entry\n"); + return -EIO; + } + if (!entry->private_address_lsb || !entry->private_address_msb + || !entry->public_address_lsb || !entry->public_address_msb + || !entry->private_port || !entry->public_port) { + IPAERR("0 param 0x%llX 0x%llX 0x%llX 0x%llX %d %d\n", + entry->private_address_lsb, entry->private_address_msb, + entry->public_address_lsb, entry->public_address_msb, + entry->private_port, entry->public_port); + return -EFAULT; + } + + mutex_lock(&ipa3_ctx->act_tbl_lock); + /* check the left # of entries */ + if (ipa3_ctx->uc_act_tbl_total + >= IPA_UC_ACT_TBL_SIZE) { + IPAERR("uc act tbl is full!\n"); + res = -EFAULT; + goto error; + } + + index = ipa3_get_free_uc_act_entry(); + + uc_entry = (struct ipa_ipv6_nat_uc_tmpl *)(ipa3_ctx->uc_act_tbl.base + + index * sizeof(struct ipa_ipv6_nat_uc_tmpl)); + + uc_entry->private_address_lsb = entry->private_address_lsb; + uc_entry->private_address_msb = entry->private_address_msb; + uc_entry->public_address_lsb = entry->public_address_lsb; + uc_entry->public_address_msb = entry->public_address_msb; + uc_entry->private_port = entry->private_port; + uc_entry->public_port = entry->public_port; + uc_entry->cmd_id = IPA_IPv6_NAT_COM_ID; + + /* set output index */ + entry->index = (uint16_t)index; + + ipa3_ctx->uc_act_tbl_total++; + ipa3_ctx->uc_act_tbl_ipv6_nat_total++; + + if (ipa3_ctx->uc_act_tbl_total < IPA_UC_ACT_TBL_SIZE) { + /* + * find next free spot, this function shall update + * uc_act_tbl_next_index + */ + index = ipa3_get_free_uc_act_entry(); + + if (index < 0) { + /* set to max tbl size to debug */ + IPAERR("can't find available spot!\n"); + ipa3_ctx->uc_act_tbl_total = IPA_UC_ACT_TBL_SIZE; + res = -EFAULT; + } + } +error: + mutex_unlock(&ipa3_ctx->act_tbl_lock); + return res; +} + +int ipa3_del_uc_act_entry(uint16_t index) +{ + struct ipa_ipv6_nat_uc_tmpl *uc_entry; + uint16_t cmd_id; + + /* IPA version check */ + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR_RL("Not support !\n"); + return -EPERM; + } + + if (!ipa3_ctx->uc_act_tbl_valid) { + IPAERR_RL("uC act tbl haven't allocated\n"); + return -ENOENT; + } + + if (index > IPA_UC_ACT_TBL_SIZE || index < 0) { + IPAERR_RL("invalid index!\n"); + return -EINVAL; + } + + if (!ipa3_ctx->uc_act_tbl_total) { + IPAERR_RL( + "invalid handle, no uc activation entries in table (total %d)\n" + , ipa3_ctx->uc_act_tbl_total); + return -EINVAL; + } + + uc_entry = (struct ipa_ipv6_nat_uc_tmpl *)(ipa3_ctx->uc_act_tbl.base + + index * sizeof(struct ipa_ipv6_nat_uc_tmpl)); + + mutex_lock(&ipa3_ctx->act_tbl_lock); + cmd_id = uc_entry->cmd_id; + mutex_unlock(&ipa3_ctx->act_tbl_lock); + + if (cmd_id == IPA_IPv6_NAT_COM_ID) + return ipa3_del_ipv6_nat_uc_activation_entry(index); + else + return ipa3_del_socksv5_conn(index); +} + +int ipa3_del_ipv6_nat_uc_activation_entry(uint16_t index) +{ + struct ipa_ipv6_nat_uc_tmpl *uc_entry; + int res = 0; + + /* IPA version check */ + if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { + IPAERR_RL("Not support !\n"); + return -EPERM; + } + + if (!ipa3_ctx->uc_act_tbl_valid) { + IPAERR_RL("uC act tbl haven't allocated\n"); + return -ENOENT; + } + + if (index > IPA_UC_ACT_TBL_SIZE || index < 0) { + IPAERR_RL("invalid index!\n"); + return -EINVAL; + } + + if (!ipa3_ctx->uc_act_tbl_ipv6_nat_total) { + IPAERR_RL( + "invalid handle, no IPv6 NAT entries in table (total %d)\n" + , ipa3_ctx->uc_act_tbl_total); + return -EINVAL; + } + + uc_entry = (struct ipa_ipv6_nat_uc_tmpl *)(ipa3_ctx->uc_act_tbl.base + + index * sizeof(struct ipa_ipv6_nat_uc_tmpl)); + + mutex_lock(&ipa3_ctx->act_tbl_lock); + if (uc_entry->cmd_id != IPA_IPv6_NAT_COM_ID) { + IPAERR_RL("entry %d wrong cmd id %d\n", uc_entry->cmd_id); + res = -EFAULT; + goto error; + } + uc_entry->cmd_id = 0; + ipa3_ctx->uc_act_tbl_total--; + ipa3_ctx->uc_act_tbl_ipv6_nat_total--; + + IPADBG("free entry %d, nat total %d, left total %d\n", + index, + ipa3_ctx->uc_act_tbl_ipv6_nat_total, + ipa3_ctx->uc_act_tbl_total); +error: + mutex_unlock(&ipa3_ctx->act_tbl_lock); + return res; +} + static void ipa3_socksv5_msg_free_cb(void *buff, u32 len, u32 type) { if (!buff) { @@ -9167,6 +9374,39 @@ static void ipa3_socksv5_msg_free_cb(void *buff, u32 len, u32 type) kfree(buff); } +static int ipa3_get_free_socksv5_entry(void) +{ + struct ipa_socksv5_uc_tmpl *first; + struct ipa_socksv5_uc_tmpl *next; + int orig_index = ipa3_ctx->uc_act_tbl_next_index; + int free_index = -1; + + IPADBG("\n"); + /* find a free spot with two contiguous entries*/ + do { + first = ipa3_ctx->uc_act_tbl.base + + ipa3_ctx->uc_act_tbl_next_index + * sizeof(struct ipa_socksv5_uc_tmpl); + next = ipa3_ctx->uc_act_tbl.base + + (ipa3_ctx->uc_act_tbl_next_index + 1) + * sizeof(struct ipa_socksv5_uc_tmpl); + + /* check if first entry and next entry are free */ + if (is_free_socksv5(first) && is_free_socksv5(next)) { + free_index = ipa3_ctx->uc_act_tbl_next_index; + IPADBG("found free index at %d\n", free_index); + break; + } + + ipa3_ctx->uc_act_tbl_next_index += 2; + ipa3_ctx->uc_act_tbl_next_index %= + IPA_UC_ACT_TBL_SIZE; + } while (orig_index != ipa3_ctx->uc_act_tbl_next_index); + + IPADBG("exit free_index %d\n", free_index); + return free_index; +} + /** * ipa3_add_socksv5_conn() - IPA add socksv5_conn * @@ -9176,8 +9416,8 @@ static void ipa3_socksv5_msg_free_cb(void *buff, u32 len, u32 type) */ int ipa3_add_socksv5_conn(struct ipa_socksv5_info *info) { - int res = 0; - void *rp_va, *wp_va; + int res = 0, index; + void *wp_va; struct ipa_socksv5_msg *socksv5_msg; struct ipa_msg_meta msg_meta; @@ -9198,18 +9438,24 @@ int ipa3_add_socksv5_conn(struct ipa_socksv5_info *info) } mutex_lock(&ipa3_ctx->act_tbl_lock); - /* check the left # of entries */ + /* check the left # of entries (need at least 2)*/ if (ipa3_ctx->uc_act_tbl_total - >= IPA_UC_ACT_TBL_SIZE) { + >= IPA_UC_ACT_TBL_SIZE - 1) { IPAERR("uc act tbl is full!\n"); res = -EFAULT; goto error; } + index = ipa3_get_free_socksv5_entry(); + if (index < 0) { + IPAERR("couldn't find free socksv5 entry\n"); + res = -EFAULT; + goto error; + } + /* Copied the act-info to tbl */ wp_va = ipa3_ctx->uc_act_tbl.base + - ipa3_ctx->uc_act_tbl_next_index - * sizeof(struct ipa_socksv5_uc_tmpl); + index * sizeof(struct ipa_socksv5_uc_tmpl); /* check entry valid */ if ((info->ul_out.cmd_id != IPA_SOCKsv5_ADD_COM_ID) @@ -9246,9 +9492,10 @@ int ipa3_add_socksv5_conn(struct ipa_socksv5_info *info) &(info->dl_out), sizeof(info->dl_out)); /* set output handle */ - info->handle = (uint16_t) ipa3_ctx->uc_act_tbl_next_index; + info->handle = (uint16_t) index; ipa3_ctx->uc_act_tbl_total += 2; + ipa3_ctx->uc_act_tbl_socksv5_total += 2; /* send msg to ipacm */ socksv5_msg = kzalloc(sizeof(*socksv5_msg), GFP_KERNEL); @@ -9261,9 +9508,9 @@ int ipa3_add_socksv5_conn(struct ipa_socksv5_info *info) memcpy(&(socksv5_msg->dl_in), &(info->dl_in), sizeof(info->dl_in)); socksv5_msg->handle = info->handle; socksv5_msg->ul_in.index = - (uint16_t) ipa3_ctx->uc_act_tbl_next_index; + (uint16_t) index; socksv5_msg->dl_in.index = - (uint16_t) ipa3_ctx->uc_act_tbl_next_index + 1; + (uint16_t) index + 1; memset(&msg_meta, 0, sizeof(struct ipa_msg_meta)); msg_meta.msg_type = IPA_SOCKV5_ADD; @@ -9276,27 +9523,14 @@ int ipa3_add_socksv5_conn(struct ipa_socksv5_info *info) goto error; } - if (ipa3_ctx->uc_act_tbl_total < IPA_UC_ACT_TBL_SIZE) { - /* find next free spot */ - do { - ipa3_ctx->uc_act_tbl_next_index += 2; - ipa3_ctx->uc_act_tbl_next_index %= - IPA_UC_ACT_TBL_SIZE; + if (ipa3_ctx->uc_act_tbl_total < IPA_UC_ACT_TBL_SIZE - 1) { + /* + * find next free spot, this function shall update + * uc_act_tbl_next_index + */ + index = ipa3_get_free_socksv5_entry(); - rp_va = ipa3_ctx->uc_act_tbl.base + - ipa3_ctx->uc_act_tbl_next_index - * sizeof(struct ipa_socksv5_uc_tmpl); - - if (!((((struct ipa_socksv5_uc_tmpl *) rp_va)-> - ipa_sockv5_mask) & IPA_SOCKSv5_ENTRY_VALID)) { - IPADBG("next available entry %d, total %d\n", - ipa3_ctx->uc_act_tbl_next_index, - ipa3_ctx->uc_act_tbl_total); - break; - } - } while (rp_va != wp_va); - - if (rp_va == wp_va) { + if (index < 0) { /* set to max tbl size to debug */ IPAERR("can't find available spot!\n"); ipa3_ctx->uc_act_tbl_total = IPA_UC_ACT_TBL_SIZE; @@ -9308,6 +9542,127 @@ error: mutex_unlock(&ipa3_ctx->act_tbl_lock); return res; } +/* + * ipa3_add_socksv5_conn_usr() - IPA copy and add socksv5 conn + * + * Returns: 0 on success, negative on failure + * + * Note : Should not be called from atomic context + */ +int ipa3_add_socksv5_conn_usr(struct ipa_kernel_tests_socksv5_uc_tmpl *tmpl) +{ + struct ipa_socksv5_info info; + int retval = 0; + + memset(&info, 0, sizeof(struct ipa_socksv5_info)); + + if (tmpl->direction == 0) { /* DL */ + info.dl_out.cmd_id = tmpl->cmd_id; + info.dl_out.cmd_param = tmpl->cmd_param; + info.dl_out.ip_hdr.ipv6_temp.version = 6; + info.dl_out.ip_hdr.ipv6_temp.nexthdr = 6; + info.dl_out.ip_hdr.ipv6_temp.saddr.s6_addr32[0] = + tmpl->ipv6_src_addr[0]; + info.dl_out.ip_hdr.ipv6_temp.saddr.s6_addr32[1] = + tmpl->ipv6_src_addr[1]; + info.dl_out.ip_hdr.ipv6_temp.saddr.s6_addr32[2] = + tmpl->ipv6_src_addr[2]; + info.dl_out.ip_hdr.ipv6_temp.saddr.s6_addr32[3] = + tmpl->ipv6_src_addr[3]; + info.dl_out.ip_hdr.ipv6_temp.daddr.s6_addr32[0] = + tmpl->ipv6_dst_addr[0]; + info.dl_out.ip_hdr.ipv6_temp.daddr.s6_addr32[1] = + tmpl->ipv6_dst_addr[1]; + info.dl_out.ip_hdr.ipv6_temp.daddr.s6_addr32[2] = + tmpl->ipv6_dst_addr[2]; + info.dl_out.ip_hdr.ipv6_temp.daddr.s6_addr32[3] = + tmpl->ipv6_dst_addr[3]; + info.dl_out.src_port = tmpl->src_port; + info.dl_out.dst_port = tmpl->dst_port; + info.dl_out.ipa_sockv5_mask = tmpl->ipa_sockv5_mask; + info.dl_out.out_irs = tmpl->out_irs; + info.dl_out.out_iss = tmpl->out_iss; + info.dl_out.in_irs = tmpl->in_irs; + info.dl_out.in_iss = tmpl->in_iss; + info.dl_out.out_ircv_tsval = tmpl->out_ircv_tsval; + info.dl_out.in_ircv_tsecr = tmpl->in_ircv_tsecr; + info.dl_out.out_ircv_tsecr = tmpl->out_ircv_tsecr; + info.dl_out.in_ircv_tsval = tmpl->in_ircv_tsval; + info.dl_out.in_isnd_wscale = tmpl->in_isnd_wscale; + info.dl_out.out_isnd_wscale = tmpl->out_isnd_wscale; + info.dl_out.in_ircv_wscale = tmpl->in_ircv_wscale; + info.dl_out.out_ircv_wscale = tmpl->out_ircv_wscale; + + /* for UL set default values to pass pair validity check */ + info.ul_out.cmd_id = IPA_SOCKsv5_ADD_COM_ID; + info.ul_out.cmd_param = IPA_SOCKsv5_ADD_V6_V4_COM_PM; + } else if (tmpl->direction == 1) { /* UL */ + info.ul_out.cmd_id = tmpl->cmd_id; + info.ul_out.cmd_param = tmpl->cmd_param; + if (info.ul_out.cmd_param == IPA_SOCKsv5_ADD_V6_V4_COM_PM) { + info.ul_out.ip_hdr.ipv4_rsv.ipv4_temp.version = 4; + info.ul_out.ip_hdr.ipv4_rsv.ipv4_temp.ihl = 5; + info.ul_out.ip_hdr.ipv4_rsv.ipv4_temp.saddr = + tmpl->ip_src_addr; + info.ul_out.ip_hdr.ipv4_rsv.ipv4_temp.daddr = + tmpl->ip_dst_addr; + info.ul_out.ip_hdr.ipv4_rsv.ipv4_temp.protocol = 6; + } + if (info.ul_out.cmd_param == IPA_SOCKsv5_ADD_V6_V6_COM_PM) { + info.ul_out.ip_hdr.ipv6_temp.version = 6; + info.ul_out.ip_hdr.ipv6_temp.nexthdr = 6; + info.ul_out.ip_hdr.ipv6_temp.saddr.s6_addr32[0] = + tmpl->ipv6_src_addr[0]; + info.ul_out.ip_hdr.ipv6_temp.saddr.s6_addr32[1] = + tmpl->ipv6_src_addr[1]; + info.ul_out.ip_hdr.ipv6_temp.saddr.s6_addr32[2] = + tmpl->ipv6_src_addr[2]; + info.ul_out.ip_hdr.ipv6_temp.saddr.s6_addr32[3] = + tmpl->ipv6_src_addr[3]; + info.ul_out.ip_hdr.ipv6_temp.daddr.s6_addr32[0] = + tmpl->ipv6_dst_addr[0]; + info.ul_out.ip_hdr.ipv6_temp.daddr.s6_addr32[1] = + tmpl->ipv6_dst_addr[1]; + info.ul_out.ip_hdr.ipv6_temp.daddr.s6_addr32[2] = + tmpl->ipv6_dst_addr[2]; + info.ul_out.ip_hdr.ipv6_temp.daddr.s6_addr32[3] = + tmpl->ipv6_dst_addr[3]; + } + info.ul_out.src_port = tmpl->src_port; + info.ul_out.dst_port = tmpl->dst_port; + info.ul_out.ipa_sockv5_mask = tmpl->ipa_sockv5_mask; + info.ul_out.out_irs = tmpl->out_irs; + info.ul_out.out_iss = tmpl->out_iss; + info.ul_out.in_irs = tmpl->in_irs; + info.ul_out.in_iss = tmpl->in_iss; + info.ul_out.out_ircv_tsval = tmpl->out_ircv_tsval; + info.ul_out.in_ircv_tsecr = tmpl->in_ircv_tsecr; + info.ul_out.out_ircv_tsecr = tmpl->out_ircv_tsecr; + info.ul_out.in_ircv_tsval = tmpl->in_ircv_tsval; + info.ul_out.in_isnd_wscale = tmpl->in_isnd_wscale; + info.ul_out.out_isnd_wscale = tmpl->out_isnd_wscale; + info.ul_out.in_ircv_wscale = tmpl->in_ircv_wscale; + info.ul_out.out_ircv_wscale = tmpl->out_ircv_wscale; + + /* for DL set default values to pass pair validity check */ + info.dl_out.cmd_param = IPA_SOCKsv5_ADD_V4_V6_COM_PM; + info.dl_out.cmd_id = IPA_SOCKsv5_ADD_COM_ID; + } else { + IPAERR("invalid socksv5 direction: %d\n", tmpl->direction); + return -EINVAL; + } + + retval = ipa3_add_socksv5_conn(&info); + if (retval) { + IPAERR("ipa3_add_socksv5_conn failed retval: %d\n", retval); + return retval; + } + + /* save uc handle */ + tmpl->handle = info.handle; + + return retval; +} /** * ipa3_del_socksv5_conn() - IPA add socksv5_conn @@ -9319,9 +9674,9 @@ error: int ipa3_del_socksv5_conn(uint32_t handle) { int res = 0; - void *rp_va; uint32_t *socksv5_handle; struct ipa_msg_meta msg_meta; + struct ipa_socksv5_uc_tmpl *entry, *next; /* IPA version check */ if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { @@ -9339,43 +9694,44 @@ int ipa3_del_socksv5_conn(uint32_t handle) return -EINVAL; } - if ((handle % 2) != 0) { - IPAERR("invalid handle!\n"); + if (ipa3_ctx->uc_act_tbl_socksv5_total < 2) { + IPAERR("invalid handle, tbl doesn't have socksv5 entries!\n"); return -EINVAL; } - if (ipa3_ctx->uc_act_tbl_total < 2) { - IPAERR("invalid handle, all tbl is empty!\n"); - return -EINVAL; - } - - rp_va = ipa3_ctx->uc_act_tbl.base + - handle * sizeof(struct ipa_socksv5_uc_tmpl); + entry = (struct ipa_socksv5_uc_tmpl *)(ipa3_ctx->uc_act_tbl.base + + handle * sizeof(struct ipa_socksv5_uc_tmpl)); + next = (struct ipa_socksv5_uc_tmpl *)(ipa3_ctx->uc_act_tbl.base + + (handle + 1) * sizeof(struct ipa_socksv5_uc_tmpl)); /* check entry is valid or not */ mutex_lock(&ipa3_ctx->act_tbl_lock); - if (!((((struct ipa_socksv5_uc_tmpl *) rp_va)-> - ipa_sockv5_mask) & IPA_SOCKSv5_ENTRY_VALID)) { - IPADBG(" entry %d already free\n", handle); + if (entry->cmd_id != IPA_SOCKsv5_ADD_COM_ID) { + IPAERR(" entry %d not socksv5\n", handle); + res = -EINVAL; + goto error; } - - if (!((((struct ipa_socksv5_uc_tmpl *) (rp_va + - sizeof(struct ipa_socksv5_uc_tmpl)))-> - ipa_sockv5_mask) & IPA_SOCKSv5_ENTRY_VALID)) { - IPADBG(" entry %d already free\n", handle); + if (next->cmd_id != IPA_SOCKsv5_ADD_COM_ID) { + IPAERR(" entry %d not socksv5\n", handle + 1); + res = -EINVAL; + goto error; } + if (!(entry->ipa_sockv5_mask & IPA_SOCKSv5_ENTRY_VALID)) + IPADBG(" entry %d already free\n", handle); - ((struct ipa_socksv5_uc_tmpl *) rp_va)->ipa_sockv5_mask - &= ~IPA_SOCKSv5_ENTRY_VALID; - ((struct ipa_socksv5_uc_tmpl *) (rp_va + - sizeof(struct ipa_socksv5_uc_tmpl)))->ipa_sockv5_mask - &= ~IPA_SOCKSv5_ENTRY_VALID; + if (!(next->ipa_sockv5_mask & IPA_SOCKSv5_ENTRY_VALID)) + IPADBG(" entry %d already free\n", handle); + + entry->ipa_sockv5_mask &= ~IPA_SOCKSv5_ENTRY_VALID; + next->ipa_sockv5_mask &= ~IPA_SOCKSv5_ENTRY_VALID; ipa3_ctx->uc_act_tbl_total -= 2; + ipa3_ctx->uc_act_tbl_socksv5_total -= 2; - IPADBG("free entry %d and %d, left total %d\n", + IPADBG("free entry %d and %d, left total %d, socksv5 total %d\n", handle, handle + 1, - ipa3_ctx->uc_act_tbl_total); + ipa3_ctx->uc_act_tbl_total, + ipa3_ctx->uc_act_tbl_socksv5_total); /* send msg to ipacm */ socksv5_handle = kzalloc(sizeof(*socksv5_handle), GFP_KERNEL); diff --git a/drivers/platform/msm/qcom-geni-se.c b/drivers/platform/msm/qcom-geni-se.c index a3ca53d4a11a..61190191efed 100644 --- a/drivers/platform/msm/qcom-geni-se.c +++ b/drivers/platform/msm/qcom-geni-se.c @@ -505,9 +505,12 @@ static int geni_se_select_dma_mode(void __iomem *base) geni_write_reg(0xFFFFFFFF, base, SE_IRQ_EN); common_geni_m_irq_en = geni_read_reg(base, SE_GENI_M_IRQ_EN); - if (proto != UART) + if (proto != UART) { common_geni_m_irq_en &= ~(M_TX_FIFO_WATERMARK_EN | M_RX_FIFO_WATERMARK_EN); + if (proto != I3C) + common_geni_m_irq_en &= ~M_CMD_DONE_EN; + } geni_write_reg(common_geni_m_irq_en, base, SE_GENI_M_IRQ_EN); geni_dma_mode = geni_read_reg(base, SE_GENI_DMA_MODE_EN); @@ -626,6 +629,14 @@ EXPORT_SYMBOL(geni_setup_s_cmd); */ void geni_cancel_m_cmd(void __iomem *base) { + unsigned int common_geni_m_irq_en; + int proto = get_se_proto(base); + + if (proto != UART && proto != I3C) { + common_geni_m_irq_en = geni_read_reg(base, SE_GENI_M_IRQ_EN); + common_geni_m_irq_en &= ~M_CMD_DONE_EN; + geni_write_reg(common_geni_m_irq_en, base, SE_GENI_M_IRQ_EN); + } geni_write_reg(M_GENI_CMD_CANCEL, base, SE_GENI_M_CMD_CTRL_REG); } EXPORT_SYMBOL(geni_cancel_m_cmd); diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index 9807c42e572c..d54a2240f75b 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -725,6 +725,7 @@ static void smblib_uusb_removal(struct smb_charger *chg) vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0); vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0); vote(chg->hvdcp_hw_inov_dis_votable, OV_VOTER, false, 0); + vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0); cancel_delayed_work_sync(&chg->hvdcp_detect_work); @@ -1718,6 +1719,8 @@ int smblib_vbus_regulator_enable(struct regulator_dev *rdev) rc = _smblib_vbus_regulator_enable(rdev); if (rc >= 0) chg->otg_en = true; + else + vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0); unlock: mutex_unlock(&chg->otg_oc_lock); @@ -4390,6 +4393,7 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0); vote(chg->awake_votable, PL_DELAY_VOTER, false, 0); + vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0); chg->vconn_attempts = 0; chg->otg_attempts = 0; chg->pulse_cnt = 0; diff --git a/drivers/power/supply/qcom/smb1398-charger.c b/drivers/power/supply/qcom/smb1398-charger.c index d52d1410d7eb..62396c59a32e 100644 --- a/drivers/power/supply/qcom/smb1398-charger.c +++ b/drivers/power/supply/qcom/smb1398-charger.c @@ -1755,7 +1755,7 @@ static void smb1398_taper_work(struct work_struct *work) struct smb1398_chip *chip = container_of(work, struct smb1398_chip, taper_work); union power_supply_propval pval = {0}; - int rc, fcc_ua, fv_uv, stepper_ua, main_fcc_ua, min_ilim_ua; + int rc, fcc_ua, fv_uv, stepper_ua, main_fcc_ua = 0, min_ilim_ua; bool slave_en; if (!is_psy_voter_available(chip)) diff --git a/drivers/rpmsg/rpm-smd.c b/drivers/rpmsg/rpm-smd.c index 42d77077bf01..2584dce47cb3 100644 --- a/drivers/rpmsg/rpm-smd.c +++ b/drivers/rpmsg/rpm-smd.c @@ -707,6 +707,24 @@ static struct msm_rpm_driver_data msm_rpm_data = { .smd_open = COMPLETION_INITIALIZER(msm_rpm_data.smd_open), }; +static int trysend_count = 20; +module_param(trysend_count, int, 0664); +static int msm_rpm_trysend_smd_buffer(char *buf, uint32_t size) +{ + int ret; + int count = 0; + + do { + ret = rpmsg_trysend(rpm->rpm_channel, buf, size); + if (!ret) + break; + udelay(10); + count++; + } while (count < trysend_count); + + return ret; +} + static int msm_rpm_flush_requests(bool print) { struct rb_node *t; @@ -724,7 +742,7 @@ static int msm_rpm_flush_requests(bool print) set_msg_id(s->buf, msm_rpm_get_next_msg_id()); - ret = rpmsg_send(rpm->rpm_channel, s->buf, get_buf_len(s->buf)); + ret = msm_rpm_trysend_smd_buffer(s->buf, get_buf_len(s->buf)); WARN_ON(ret != 0); trace_rpm_smd_send_sleep_set(get_msg_id(s->buf), type, id); diff --git a/drivers/soc/qcom/hgsl/hgsl.c b/drivers/soc/qcom/hgsl/hgsl.c index 80f9b7436ca5..f459774e3911 100644 --- a/drivers/soc/qcom/hgsl/hgsl.c +++ b/drivers/soc/qcom/hgsl/hgsl.c @@ -31,7 +31,9 @@ #define HGSL_DEVICE_NAME "hgsl" #define HGSL_DEV_NUM 1 -#define MAX_DB_QUEUE 4 + +/* Support upto 3 GVMs: 3 DBQs(Low/Medium/High priority) per GVM */ +#define MAX_DB_QUEUE 9 #define IORESOURCE_HWINF "hgsl_reg_hwinf" #define IORESOURCE_GMUCX "hgsl_reg_gmucx" diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 614144927da9..4d44b61fde83 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -2,7 +2,7 @@ * drivers/staging/android/ion/ion_system_heap.c * * Copyright (C) 2011 Google, Inc. - * Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -423,11 +423,13 @@ err_free_sg2: buffer->private_flags |= ION_PRIV_FLAG_SHRINKER_FREE; if (vmid > 0) - ion_hyp_unassign_sg(table, &vmid, 1, true, false); + if (ion_hyp_unassign_sg(table, &vmid, 1, true, false)) + goto err_free_table_sync; for_each_sg(table->sgl, sg, table->nents, i) free_buffer_page(sys_heap, buffer, sg_page(sg), get_order(sg->length)); +err_free_table_sync: if (nents_sync) sg_free_table(&table_sync); err_free_sg: diff --git a/drivers/staging/fw-api/fw/htt.h b/drivers/staging/fw-api/fw/htt.h index da9101e4e106..f92938dfdffe 100644 --- a/drivers/staging/fw-api/fw/htt.h +++ b/drivers/staging/fw-api/fw/htt.h @@ -205,9 +205,10 @@ * 3.81 Add ppdu_start_tsf field in HTT_TX_WBM_COMPLETION_V2. * 3.82 Add WIN_SIZE field to HTT_T2H_MSG_TYPE_RX_DELBA msg. * 3.83 Shrink seq_idx field in HTT PPDU ID from 3 bits to 2. + * 3.84 Add fisa_control_bits_v2 def. */ #define HTT_CURRENT_VERSION_MAJOR 3 -#define HTT_CURRENT_VERSION_MINOR 83 +#define HTT_CURRENT_VERSION_MINOR 84 #define HTT_NUM_TX_FRAG_DESC 1024 @@ -6054,6 +6055,10 @@ PREPACK struct htt_h2t_msg_type_fisa_config_t { * [17:0] */ union { + /* + * fisa_control_bits structure is deprecated. + * Please use fisa_control_bits_v2 going forward. + */ struct { A_UINT32 fisa_enable: 1, ipsec_skip_search: 1, @@ -6072,6 +6077,11 @@ PREPACK struct htt_h2t_msg_type_fisa_config_t { fisa_aggr_limit: 4, reserved: 14; } fisa_control_bits; + struct { + A_UINT32 fisa_enable: 1, + fisa_aggr_limit: 4, + reserved: 27; + } fisa_control_bits_v2; A_UINT32 fisa_control_value; } u_fisa_control; @@ -6277,6 +6287,29 @@ PREPACK struct htt_h2t_msg_type_fisa_config_t { ((_var) |= ((_val) << HTT_RX_FISA_CONFIG_FISA_AGGR_LIMIT_S)); \ } while (0) +/* Dword 1: fisa_control_value fisa config */ +#define HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_M 0x00000001 +#define HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_S 0 +#define HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_GET(_var) \ + (((_var) & HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_M) >> \ + HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_S) +#define HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_SET(_var, _val) \ + do { \ + HTT_CHECK_SET_VAL(HTT_RX_FISA_CONFIG_FISA_V2_ENABLE, _val); \ + ((_var) |= ((_val) << HTT_RX_FISA_CONFIG_FISA_V2_ENABLE_S)); \ + } while (0) + +/* Dword 1: fisa_control_value fisa_aggr_limit */ +#define HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_M 0x0000001e +#define HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_S 1 +#define HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_GET(_var) \ + (((_var) & HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_M) >> \ + HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_S) +#define HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_SET(_var, _val) \ + do { \ + HTT_CHECK_SET_VAL(HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT, _val); \ + ((_var) |= ((_val) << HTT_RX_FISA_CONFIG_FISA_V2_AGGR_LIMIT_S)); \ + } while (0) PREPACK struct htt_h2t_msg_rx_fse_setup_t { A_UINT32 msg_type:8, /* HTT_H2T_MSG_TYPE_RX_FSE_SETUP_CFG */ diff --git a/drivers/staging/fw-api/fw/wmi_unified.h b/drivers/staging/fw-api/fw/wmi_unified.h index d7f1ec7b3946..6bb8e967e5aa 100644 --- a/drivers/staging/fw-api/fw/wmi_unified.h +++ b/drivers/staging/fw-api/fw/wmi_unified.h @@ -8052,8 +8052,14 @@ typedef struct { A_UINT32 center_freq1; /** msecs the radio is awake (32 bits number accruing over time) */ A_UINT32 radio_awake_time; - /** msecs the CCA register is busy (32 bits number accruing over time) */ + /** msecs the CCA register is busy (32 bits number accruing over time) + * Includes rx_time but not tx_time. + */ A_UINT32 cca_busy_time; + /** msecs the radio is transmitting (32 bits number accruing over time) */ + A_UINT32 tx_time; + /** msecs the radio is in active receive (32 bits number accruing over time) */ + A_UINT32 rx_time; } wmi_channel_stats; /* @@ -9638,6 +9644,12 @@ typedef struct { * of assoc request/response */ #define WMI_UNIFIED_VDEV_START_LDPC_RX_ENABLED (1<<3) +/** Indicates HW encryption is disabled, and SW encryption is enabled. + * If This flag is set, indicates that HW encryption will be disabled + * and SW encryption will be enabled. + * If SW encryption is enabled, key plumbing will not happen in FW. + */ +#define WMI_UNIFIED_VDEV_START_HW_ENCRYPTION_DISABLED (1<<4) /* BSS color 0-6 */ #define WMI_HEOPS_COLOR_GET_D2(he_ops) WMI_GET_BITS(he_ops, 0, 6) @@ -14529,6 +14541,30 @@ typedef struct { A_UINT32 btk[ROAM_OFFLOAD_BTK_BYTES>>2]; /* BTK offload. As this 4 byte aligned, we don't declare it as tlv array */ } wmi_roam_ese_offload_tlv_param; +typedef enum { + WMI_BL_REASON_NUD_FAILURE = 1, + WMI_BL_REASON_STA_KICKOUT, + WMI_BL_REASON_ROAM_HO_FAILURE, + /* Assoc resp with status code 71 - POOR RSSI CONDITIONS */ + WMI_BL_REASON_ASSOC_REJECT_POOR_RSSI, + /* Assoc resp with status code 34 - DENIED_POOR_CHANNEL_CONDITIONS */ + WMI_BL_REASON_ASSOC_REJECT_OCE, + WMI_BL_REASON_USERSPACE_BL, + WMI_BL_REASON_USERSPACE_AVOID_LIST, + WMI_BL_REASON_BTM_DIASSOC_IMMINENT, + WMI_BL_REASON_BTM_BSS_TERMINATION, + WMI_BL_REASON_BTM_MBO_RETRY, + /* Reassoc resp with status code 34 - DENIED_POOR_CHANNEL_CONDITIONS */ + WMI_BL_REASON_REASSOC_RSSI_REJECT, + /* Reassoc resp with status code 17 - DENIED_NO_MORE_STAS */ + WMI_BL_REASON_REASSOC_NO_MORE_STAS, +} WMI_BLACKLIST_REASON_ID; + +typedef enum { + WMI_BL_SOURCE_HOST = 1, + WMI_BL_SOURCE_FW, +} WMI_BLACKLIST_SOURCE_ID; + typedef struct { /** TLV tag and len; tag equals WMITLV_TAG_STRUC_wmi_roam_blacklist_with_timeout_tlv_param */ A_UINT32 tlv_header; @@ -14538,6 +14574,18 @@ typedef struct { A_UINT32 timeout; /** rssi (dBm units) when put in blacklist */ A_INT32 rssi; + /* Blacklist reason from WMI_BLACKLIST_REASON_ID */ + A_UINT32 reason; + /* Source of adding AP to BL from WMI_BLACKLIST_SOURCE_ID */ + A_UINT32 source; + /* + * timestamp is the absolute time w.r.t host timer which is synchronized + * between the host and target. + * This timestamp indicates the time when AP added to blacklist. + */ + A_UINT32 timestamp; + /* Original timeout value in milli seconds when AP added to BL */ + A_UINT32 original_timeout; } wmi_roam_blacklist_with_timeout_tlv_param; /** WMI_ROAM_BLACKLIST_EVENT: generated whenever STA needs to move AP to blacklist for a particluar time @@ -28156,6 +28204,18 @@ typedef struct { A_UINT32 remaining_disallow_duration; /** AP will be allowed for candidate, when AP RSSI better than expected RSSI units in dBm */ A_INT32 expected_rssi; + /* Blacklist reason from WMI_BLACKLIST_REASON_ID */ + A_UINT32 reason; + /* Source of adding AP to BL from WMI_BLACKLIST_SOURCE_ID */ + A_UINT32 source; + /* + * timestamp is the absolute time w.r.t host timer which is synchronized + * between the host and target. + * This timestamp indicates the time when AP added to blacklist. + */ + A_UINT32 timestamp; + /* Original timeout value in milli seconds when AP added to BL */ + A_UINT32 original_timeout; } wmi_pdev_bssid_disallow_list_config_param; typedef enum { @@ -28390,6 +28450,10 @@ typedef struct { A_UINT32 vendor_specific1[7]; }; }; + /* BTM BSS termination timeout value in milli seconds */ + A_UINT32 btm_bss_termination_timeout; + /* BTM MBO assoc retry timeout value in milli seconds */ + A_UINT32 btm_mbo_assoc_retry_timeout; } wmi_roam_trigger_reason; typedef struct { @@ -28436,6 +28500,18 @@ typedef struct { A_UINT32 cu_score; /* AP current cu score */ A_UINT32 total_score; /* AP total score */ A_UINT32 etp; /* AP Estimated Throughput (ETP) value in mbps */ + /* Blacklist reason from WMI_BLACKLIST_REASON_ID */ + A_UINT32 bl_reason; + /* Source of adding AP to BL from WMI_BLACKLIST_SOURCE_ID */ + A_UINT32 bl_source; + /* + * timestamp is the absolute time w.r.t host timer which is synchronized + * between the host and target. + * This timestamp indicates the time when AP added to blacklist. + */ + A_UINT32 bl_timestamp; + /* Original timeout value in milli seconds when AP added to BL */ + A_UINT32 bl_original_timeout; } wmi_roam_ap_info; typedef enum { diff --git a/drivers/staging/fw-api/fw/wmi_version.h b/drivers/staging/fw-api/fw/wmi_version.h index 6be23827697f..1c9ece2f85a5 100644 --- a/drivers/staging/fw-api/fw/wmi_version.h +++ b/drivers/staging/fw-api/fw/wmi_version.h @@ -36,7 +36,7 @@ #define __WMI_VER_MINOR_ 0 /** WMI revision number has to be incremented when there is a * change that may or may not break compatibility. */ -#define __WMI_REVISION_ 869 +#define __WMI_REVISION_ 872 /** The Version Namespace should not be normally changed. Only * host and firmware of the same WMI namespace will work diff --git a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services.c b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services.c index f1551c36f80f..1baca29531a2 100644 --- a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services.c +++ b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services.c @@ -1911,6 +1911,11 @@ static uint16_t reg_compute_chan_to_freq(struct wlan_objmgr_pdev *pdev, return 0; } + if (min_chan_range < MIN_CHANNEL || max_chan_range > MAX_CHANNEL) { + reg_err("Channel range is invalid"); + return 0; + } + chan_list = pdev_priv_obj->mas_chan_list; for (count = min_chan_range; count <= max_chan_range; count++) { diff --git a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h index b1de2cf75b62..41bcc03473cb 100644 --- a/drivers/staging/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h +++ b/drivers/staging/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h @@ -167,6 +167,9 @@ enum channel_enum { NUM_CHANNELS, + MIN_CHANNEL = CHAN_ENUM_1, + MAX_CHANNEL = (NUM_CHANNELS - 1), + MIN_24GHZ_CHANNEL = CHAN_ENUM_1, MAX_24GHZ_CHANNEL = CHAN_ENUM_14, NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1), @@ -235,6 +238,9 @@ enum channel_enum { NUM_CHANNELS, + MIN_CHANNEL = CHAN_ENUM_1, + MAX_CHANNEL = (NUM_CHANNELS - 1), + MIN_24GHZ_CHANNEL = CHAN_ENUM_1, MAX_24GHZ_CHANNEL = CHAN_ENUM_14, NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1), diff --git a/drivers/staging/qca-wifi-host-cmn/umac/tdls/core/src/wlan_tdls_cmds_process.c b/drivers/staging/qca-wifi-host-cmn/umac/tdls/core/src/wlan_tdls_cmds_process.c index a39954f01c3b..6ea0df8e2619 100644 --- a/drivers/staging/qca-wifi-host-cmn/umac/tdls/core/src/wlan_tdls_cmds_process.c +++ b/drivers/staging/qca-wifi-host-cmn/umac/tdls/core/src/wlan_tdls_cmds_process.c @@ -1718,12 +1718,23 @@ static QDF_STATUS tdls_config_force_peer( } feature = soc_obj->tdls_configs.tdls_feature_flags; - if (!TDLS_IS_EXTERNAL_CONTROL_ENABLED(feature) || + if (!(TDLS_IS_EXTERNAL_CONTROL_ENABLED(feature) || + TDLS_IS_LIBERAL_EXTERNAL_CONTROL_ENABLED(feature)) || !TDLS_IS_IMPLICIT_TRIG_ENABLED(feature)) { tdls_err("TDLS ext ctrl or Imp Trig not enabled, %x", feature); return QDF_STATUS_E_NOSUPPORT; } + /* + * In case of liberal external mode, supplicant will provide peer mac + * address but driver has to behave similar to implict mode ie. + * establish tdls link with any peer that supports tdls and meets stats. + */ + if (TDLS_IS_LIBERAL_EXTERNAL_CONTROL_ENABLED(feature)) { + tdls_debug("liberal mode set"); + return QDF_STATUS_SUCCESS; + } + peer_update_param = qdf_mem_malloc(sizeof(*peer_update_param)); if (!peer_update_param) { tdls_err("memory allocation failed"); @@ -1860,7 +1871,8 @@ QDF_STATUS tdls_process_remove_force_peer(struct tdls_oper_request *req) } feature = soc_obj->tdls_configs.tdls_feature_flags; - if (!TDLS_IS_EXTERNAL_CONTROL_ENABLED(feature) || + if (!(TDLS_IS_EXTERNAL_CONTROL_ENABLED(feature) || + TDLS_IS_LIBERAL_EXTERNAL_CONTROL_ENABLED(feature)) || !TDLS_IS_IMPLICIT_TRIG_ENABLED(feature)) { tdls_err("TDLS ext ctrl or Imp Trig not enabled, %x", feature); status = QDF_STATUS_E_NOSUPPORT; diff --git a/drivers/staging/qca-wifi-host-cmn/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h b/drivers/staging/qca-wifi-host-cmn/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h index 76d8498392f8..e645f6e1e522 100644 --- a/drivers/staging/qca-wifi-host-cmn/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h +++ b/drivers/staging/qca-wifi-host-cmn/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018, 2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -379,6 +379,11 @@ struct tx_frame { qdf_timer_t tx_timer; }; +enum tdls_configured_external_control { + TDLS_STRICT_EXTERNAL_CONTROL = 1, + TDLS_LIBERAL_EXTERNAL_CONTROL = 2, +}; + /** * enum tdls_feature_bit * @TDLS_FEATURE_OFF_CHANNEL: tdls off channel @@ -388,7 +393,8 @@ struct tx_frame { * @TDLS_FEATURE_SCAN: tdls scan * @TDLS_FEATURE_ENABLE: tdls enabled * @TDLS_FEAUTRE_IMPLICIT_TRIGGER: tdls implicit trigger - * @TDLS_FEATURE_EXTERNAL_CONTROL: tdls external control + * @TDLS_FEATURE_EXTERNAL_CONTROL: enforce strict tdls external control + * @TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL: liberal external tdls control */ enum tdls_feature_bit { TDLS_FEATURE_OFF_CHANNEL, @@ -398,7 +404,8 @@ enum tdls_feature_bit { TDLS_FEATURE_SCAN, TDLS_FEATURE_ENABLE, TDLS_FEAUTRE_IMPLICIT_TRIGGER, - TDLS_FEATURE_EXTERNAL_CONTROL + TDLS_FEATURE_EXTERNAL_CONTROL, + TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL, }; #define TDLS_IS_OFF_CHANNEL_ENABLED(flags) \ @@ -417,6 +424,8 @@ enum tdls_feature_bit { CHECK_BIT(flags, TDLS_FEAUTRE_IMPLICIT_TRIGGER) #define TDLS_IS_EXTERNAL_CONTROL_ENABLED(flags) \ CHECK_BIT(flags, TDLS_FEATURE_EXTERNAL_CONTROL) +#define TDLS_IS_LIBERAL_EXTERNAL_CONTROL_ENABLED(flags) \ + CHECK_BIT(flags, TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL) /** * struct tdls_user_config - TDLS user configuration diff --git a/drivers/staging/qca-wifi-host-cmn/wmi/src/wmi_unified_tlv.c b/drivers/staging/qca-wifi-host-cmn/wmi/src/wmi_unified_tlv.c index 015484e47c06..410fa1cea5cb 100644 --- a/drivers/staging/qca-wifi-host-cmn/wmi/src/wmi_unified_tlv.c +++ b/drivers/staging/qca-wifi-host-cmn/wmi/src/wmi_unified_tlv.c @@ -6465,12 +6465,61 @@ wmi_fill_sae_single_pmk_param(struct roam_offload_scan_params *params, roam_offload_11i->flags |= 1 << WMI_ROAM_OFFLOAD_FLAG_SAE_SAME_PMKID; } + +/** + * fill_roam_offload_11r_params() - Fill roam scan params to send it to fw + * @auth_mode: Authentication mode + * @roam_offload_11r: TLV to be filled with 11r params + * @roam_req: roam request param + */ +static void +fill_roam_offload_11r_params(u32 auth_mode, + wmi_roam_11r_offload_tlv_param *roam_offload_11r, + struct roam_offload_scan_params *roam_req) +{ + u8 *psk_msk, len; + + if (auth_mode == WMI_AUTH_FT_RSNA_FILS_SHA256 || + auth_mode == WMI_AUTH_FT_RSNA_FILS_SHA384) { + psk_msk = roam_req->roam_fils_params.fils_ft; + len = roam_req->roam_fils_params.fils_ft_len; + } else { + psk_msk = roam_req->psk_pmk; + len = roam_req->pmk_len; + } + + /* + * For SHA384 based akm, the pmk length is 48 bytes. So fill + * first 32 bytes in roam_offload_11r->psk_msk and the remaining + * bytes in roam_offload_11r->psk_msk_ext buffer + */ + roam_offload_11r->psk_msk_len = len > ROAM_OFFLOAD_PSK_MSK_BYTES ? + ROAM_OFFLOAD_PSK_MSK_BYTES : len; + qdf_mem_copy(roam_offload_11r->psk_msk, psk_msk, + roam_offload_11r->psk_msk_len); + roam_offload_11r->psk_msk_ext_len = 0; + + if (len > ROAM_OFFLOAD_PSK_MSK_BYTES) { + roam_offload_11r->psk_msk_ext_len = + len - roam_offload_11r->psk_msk_len; + qdf_mem_copy(roam_offload_11r->psk_msk_ext, + &psk_msk[roam_offload_11r->psk_msk_len], + roam_offload_11r->psk_msk_ext_len); + } +} #else static inline void wmi_fill_sae_single_pmk_param(struct roam_offload_scan_params *params, wmi_roam_11i_offload_tlv_param *roam_offload_11i) { } + +static void +fill_roam_offload_11r_params(u32 auth_mode, + wmi_roam_11r_offload_tlv_param *roam_offload_11r, + struct roam_offload_scan_params *roam_req) +{ +} #endif #define ROAM_OFFLOAD_PMK_EXT_BYTES 16 @@ -6486,10 +6535,10 @@ wmi_fill_sae_single_pmk_param(struct roam_offload_scan_params *params, * * Return: QDF status */ -static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, - wmi_start_scan_cmd_fixed_param * - scan_cmd_fp, - struct roam_offload_scan_params *roam_req) +static QDF_STATUS +send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, + wmi_start_scan_cmd_fixed_param *scan_cmd_fp, + struct roam_offload_scan_params *roam_req) { wmi_buf_t buf = NULL; QDF_STATUS status; @@ -6517,58 +6566,61 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, sizeof(wmi_start_scan_cmd_fixed_param); #ifdef WLAN_FEATURE_ROAM_OFFLOAD wmi_debug("auth_mode = %d", auth_mode); - if (roam_req->is_roam_req_valid && - roam_req->roam_offload_enabled) { - len += sizeof(wmi_roam_offload_tlv_param); + if (roam_req->is_roam_req_valid && + roam_req->roam_offload_enabled) { + len += sizeof(wmi_roam_offload_tlv_param); + len += WMI_TLV_HDR_SIZE; + if ((auth_mode != WMI_AUTH_NONE) && + ((auth_mode != WMI_AUTH_OPEN) || + (auth_mode == WMI_AUTH_OPEN && + roam_req->mdid.mdie_present && + roam_req->is_11r_assoc) || + roam_req->is_ese_assoc)) { len += WMI_TLV_HDR_SIZE; - if ((auth_mode != WMI_AUTH_NONE) && - ((auth_mode != WMI_AUTH_OPEN) || + if (roam_req->is_ese_assoc) + len += sizeof(wmi_roam_ese_offload_tlv_param); + else if ((auth_mode == WMI_AUTH_FT_RSNA) || + (auth_mode == WMI_AUTH_FT_RSNA_PSK) || + (auth_mode == WMI_AUTH_FT_RSNA_SAE) || + (auth_mode == + WMI_AUTH_FT_RSNA_SUITE_B_8021X_SHA384) || + (auth_mode == + WMI_AUTH_FT_RSNA_FILS_SHA256) || + (auth_mode == + WMI_AUTH_FT_RSNA_FILS_SHA384) || (auth_mode == WMI_AUTH_OPEN && roam_req->mdid.mdie_present && - roam_req->is_11r_assoc) || - roam_req->is_ese_assoc)) { - len += WMI_TLV_HDR_SIZE; - if (roam_req->is_ese_assoc) - len += - sizeof(wmi_roam_ese_offload_tlv_param); - else if (auth_mode == WMI_AUTH_FT_RSNA || - auth_mode == WMI_AUTH_FT_RSNA_PSK || - (auth_mode == WMI_AUTH_OPEN && - roam_req->mdid.mdie_present && - roam_req->is_11r_assoc)) - len += - sizeof(wmi_roam_11r_offload_tlv_param); - else - len += - sizeof(wmi_roam_11i_offload_tlv_param); - } else { - len += WMI_TLV_HDR_SIZE; - } - - len += (sizeof(*assoc_ies) + (2*WMI_TLV_HDR_SIZE) - + roundup(roam_req->assoc_ie_length, - sizeof(uint32_t))); - - if (roam_req->add_fils_tlv) { - fils_tlv_len = sizeof( - wmi_roam_fils_offload_tlv_param); - len += WMI_TLV_HDR_SIZE + fils_tlv_len; - } + roam_req->is_11r_assoc)) + len += sizeof(wmi_roam_11r_offload_tlv_param); + else + len += sizeof(wmi_roam_11i_offload_tlv_param); } else { - if (roam_req->is_roam_req_valid) - WMI_LOGD("%s : roam offload = %d", - __func__, roam_req->roam_offload_enabled); - len += (4 * WMI_TLV_HDR_SIZE); + len += WMI_TLV_HDR_SIZE; } - if (roam_req->is_roam_req_valid && - roam_req->roam_offload_enabled) { - roam_req->mode = roam_req->mode | - WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; + + len += (sizeof(*assoc_ies) + (2 * WMI_TLV_HDR_SIZE) + + roundup(roam_req->assoc_ie_length, sizeof(uint32_t))); + + if (roam_req->add_fils_tlv) { + fils_tlv_len = sizeof(wmi_roam_fils_offload_tlv_param); + len += WMI_TLV_HDR_SIZE + fils_tlv_len; } + } else { + if (roam_req->is_roam_req_valid) + WMI_LOGD("%s : roam offload = %d", __func__, + roam_req->roam_offload_enabled); + else + WMI_LOGD("%s : roam_req is NULL", __func__); + + len += (4 * WMI_TLV_HDR_SIZE); + } + + if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) + roam_req->mode |= WMI_ROAM_SCAN_MODE_ROAMOFFLOAD; #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ - if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE - |WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) + if (roam_req->mode == + (WMI_ROAM_SCAN_MODE_NONE | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) len = sizeof(wmi_roam_scan_mode_fixed_param); buf = wmi_buf_alloc(wmi_handle, len); @@ -6582,7 +6634,7 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, WMITLV_SET_HDR(&roam_scan_mode_fp->tlv_header, WMITLV_TAG_STRUC_wmi_roam_scan_mode_fixed_param, WMITLV_GET_STRUCT_TLVLEN - (wmi_roam_scan_mode_fixed_param)); + (wmi_roam_scan_mode_fixed_param)); roam_scan_mode_fp->min_delay_roam_trigger_reason_bitmask = roam_req->roam_trigger_reason_bitmask; @@ -6590,8 +6642,8 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, WMI_SEC_TO_MSEC(roam_req->min_delay_btw_roam_scans); roam_scan_mode_fp->roam_scan_mode = roam_req->mode; roam_scan_mode_fp->vdev_id = roam_req->vdev_id; - if (roam_req->mode == (WMI_ROAM_SCAN_MODE_NONE | - WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { + if (roam_req->mode == + (WMI_ROAM_SCAN_MODE_NONE | WMI_ROAM_SCAN_MODE_ROAMOFFLOAD)) { roam_scan_mode_fp->flags |= WMI_ROAM_SCAN_MODE_FLAG_REPORT_STATUS; goto send_roam_scan_mode_cmd; @@ -6607,7 +6659,7 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_STRUC_wmi_start_scan_cmd_fixed_param, WMITLV_GET_STRUCT_TLVLEN - (wmi_start_scan_cmd_fixed_param)); + (wmi_start_scan_cmd_fixed_param)); #ifdef WLAN_FEATURE_ROAM_OFFLOAD buf_ptr += sizeof(wmi_start_scan_cmd_fixed_param); if (roam_req->is_roam_req_valid && roam_req->roam_offload_enabled) { @@ -6688,11 +6740,18 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, (wmi_roam_ese_offload_tlv_param)); buf_ptr += sizeof(wmi_roam_ese_offload_tlv_param); - } else if (auth_mode == WMI_AUTH_FT_RSNA - || auth_mode == WMI_AUTH_FT_RSNA_PSK - || (auth_mode == WMI_AUTH_OPEN - && roam_req->mdid.mdie_present && - roam_req->is_11r_assoc)) { + } else if (auth_mode == WMI_AUTH_FT_RSNA || + auth_mode == WMI_AUTH_FT_RSNA_PSK || + auth_mode == WMI_AUTH_FT_RSNA_SAE || + (auth_mode == + WMI_AUTH_FT_RSNA_SUITE_B_8021X_SHA384) || + (auth_mode == + WMI_AUTH_FT_RSNA_FILS_SHA256) || + (auth_mode == + WMI_AUTH_FT_RSNA_FILS_SHA384) || + (auth_mode == WMI_AUTH_OPEN && + roam_req->mdid.mdie_present && + roam_req->is_11r_assoc)) { WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0); buf_ptr += WMI_TLV_HDR_SIZE; @@ -6706,11 +6765,9 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, qdf_mem_copy(roam_offload_11r->r0kh_id, roam_req->rokh_id, roam_offload_11r->r0kh_id_len); - qdf_mem_copy(roam_offload_11r->psk_msk, - roam_req->psk_pmk, - sizeof(roam_req->psk_pmk)); - roam_offload_11r->psk_msk_len = - roam_req->pmk_len; + fill_roam_offload_11r_params(auth_mode, + roam_offload_11r, + roam_req); roam_offload_11r->mdie_present = roam_req->mdid.mdie_present; roam_offload_11r->mdid = @@ -6732,8 +6789,9 @@ static QDF_STATUS send_roam_scan_offload_mode_cmd_tlv(wmi_unified_t wmi_handle, WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, WMITLV_GET_STRUCT_TLVLEN(0)); buf_ptr += WMI_TLV_HDR_SIZE; - WMI_LOGD("psk_msk_len = %d", - roam_offload_11r->psk_msk_len); + WMI_LOGD("psk_msk_len = %d psk_msk_ext:%d", + roam_offload_11r->psk_msk_len, + roam_offload_11r->psk_msk_ext_len); if (roam_offload_11r->psk_msk_len) QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_DEBUG, @@ -6866,12 +6924,8 @@ send_roam_scan_mode_cmd: wmi_mtrace(WMI_ROAM_SCAN_MODE, NO_SESSION, 0); status = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_ROAM_SCAN_MODE); - if (QDF_IS_STATUS_ERROR(status)) { - WMI_LOGE( - "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d", - status); + if (QDF_IS_STATUS_ERROR(status)) wmi_buf_free(buf); - } return status; } @@ -9815,6 +9869,14 @@ static QDF_STATUS send_stats_ext_req_cmd_tlv(wmi_unified_t wmi_handle, wmi_buf_t buf; size_t len; uint8_t *buf_ptr; + uint16_t max_wmi_msg_size = wmi_get_max_msg_len(wmi_handle); + + if (preq->request_data_len > (max_wmi_msg_size - WMI_TLV_HDR_SIZE - + sizeof(*cmd))) { + wmi_err("Data length=%d is greater than max wmi msg size", + preq->request_data_len); + return QDF_STATUS_E_FAILURE; + } len = sizeof(*cmd) + WMI_TLV_HDR_SIZE + preq->request_data_len; diff --git a/drivers/staging/qcacld-3.0/components/pkt_capture/core/inc/wlan_pkt_capture_mon_thread.h b/drivers/staging/qcacld-3.0/components/pkt_capture/core/inc/wlan_pkt_capture_mon_thread.h index 006fa0a0854e..630d92201d98 100644 --- a/drivers/staging/qcacld-3.0/components/pkt_capture/core/inc/wlan_pkt_capture_mon_thread.h +++ b/drivers/staging/qcacld-3.0/components/pkt_capture/core/inc/wlan_pkt_capture_mon_thread.h @@ -28,6 +28,7 @@ #define PKT_CAPTURE_RX_POST_EVENT 0x01 #define PKT_CAPTURE_RX_SUSPEND_EVENT 0x02 #define PKT_CAPTURE_RX_SHUTDOWN_EVENT 0x04 +#define PKT_CAPTURE_REGISTER_EVENT 0x08 /* * Maximum number of packets to be allocated for @@ -81,6 +82,7 @@ struct pkt_capture_mon_pkt { * @suspend_mon_event: Completion to suspend packet capture MON thread * @resume_mon_event: Completion to resume packet capture MON thread * @mon_shutdown: Completion for packet capture MON thread shutdown + * @mon_register_event: Completion for packet capture register * @mon_wait_queue: Waitq for packet capture MON thread * @mon_event_flag: Mon event flag * @mon_thread_queue: MON buffer queue @@ -97,6 +99,7 @@ struct pkt_capture_mon_context { struct completion suspend_mon_event; struct completion resume_mon_event; struct completion mon_shutdown; + struct completion mon_register_event; wait_queue_head_t mon_wait_queue; unsigned long mon_event_flag; struct list_head mon_thread_queue; diff --git a/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_main.c b/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_main.c index 8bd6de1ed1bf..2f62dcd1628c 100644 --- a/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_main.c +++ b/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_main.c @@ -99,6 +99,13 @@ pkt_capture_register_callbacks(struct wlan_objmgr_vdev *vdev, if (QDF_IS_STATUS_ERROR(status)) goto register_ev_handlers_fail; + /* + * set register event bit so that mon thread will start + * processing packets in queue. + */ + set_bit(PKT_CAPTURE_REGISTER_EVENT, + &vdev_priv->mon_ctx->mon_event_flag); + mode = pkt_capture_get_mode(psoc); status = tgt_pkt_capture_send_mode(vdev, mode); if (QDF_IS_STATUS_ERROR(status)) { @@ -149,6 +156,23 @@ QDF_STATUS pkt_capture_deregister_callbacks(struct wlan_objmgr_vdev *vdev) if (QDF_IS_STATUS_ERROR(status)) pkt_capture_err("Unable to send packet capture mode to fw"); + /* + * Clear packet capture register event so that mon thread will + * stop processing packets in queue. + */ + clear_bit(PKT_CAPTURE_REGISTER_EVENT, + &vdev_priv->mon_ctx->mon_event_flag); + set_bit(PKT_CAPTURE_RX_POST_EVENT, + &vdev_priv->mon_ctx->mon_event_flag); + wake_up_interruptible(&vdev_priv->mon_ctx->mon_wait_queue); + + /* + * Wait till current packet process completes in mon thread and + * flush the remaining packet in queue. + */ + wait_for_completion(&vdev_priv->mon_ctx->mon_register_event); + pkt_capture_drop_monpkt(vdev_priv->mon_ctx); + status = tgt_pkt_capture_unregister_ev_handler(vdev); if (QDF_IS_STATUS_ERROR(status)) pkt_capture_err("Unable to unregister event handlers"); diff --git a/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_mon_thread.c b/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_mon_thread.c index f8c2a62a191e..a37eb1963732 100644 --- a/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_mon_thread.c +++ b/drivers/staging/qcacld-3.0/components/pkt_capture/core/src/wlan_pkt_capture_mon_thread.c @@ -324,7 +324,17 @@ static int pkt_capture_mon_thread(void *arg) shutdown = true; break; } - pkt_capture_process_from_queue(mon_ctx); + + /* + * if packet capture deregistratin happens stop + * processing packets in queue because mon cb will + * be set to NULL. + */ + if (test_bit(PKT_CAPTURE_REGISTER_EVENT, + &mon_ctx->mon_event_flag)) + pkt_capture_process_from_queue(mon_ctx); + else + complete(&mon_ctx->mon_register_event); if (test_bit(PKT_CAPTURE_RX_SUSPEND_EVENT, &mon_ctx->mon_event_flag)) { @@ -351,7 +361,7 @@ void pkt_capture_close_mon_thread(struct pkt_capture_mon_context *mon_ctx) if (!mon_ctx->mon_thread) return; - /* Shut down Tlshim Rx thread */ + /* Shut down mon thread */ set_bit(PKT_CAPTURE_RX_SHUTDOWN_EVENT, &mon_ctx->mon_event_flag); set_bit(PKT_CAPTURE_RX_POST_EVENT, @@ -487,6 +497,7 @@ pkt_capture_alloc_mon_thread(struct pkt_capture_mon_context *mon_ctx) init_completion(&mon_ctx->suspend_mon_event); init_completion(&mon_ctx->resume_mon_event); init_completion(&mon_ctx->mon_shutdown); + init_completion(&mon_ctx->mon_register_event); mon_ctx->mon_event_flag = 0; spin_lock_init(&mon_ctx->mon_queue_lock); spin_lock_init(&mon_ctx->mon_pkt_freeq_lock); diff --git a/drivers/staging/qcacld-3.0/core/hdd/inc/wlan_hdd_cfg.h b/drivers/staging/qcacld-3.0/core/hdd/inc/wlan_hdd_cfg.h index 29aa08e1e0b5..5bdec5d1a6d8 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/inc/wlan_hdd_cfg.h +++ b/drivers/staging/qcacld-3.0/core/hdd/inc/wlan_hdd_cfg.h @@ -6932,7 +6932,7 @@ enum hdd_link_speed_rpt_type { * * gTDLSExternalControl - Enable external TDLS control. * @Min: 0 - * @Max: 1 + * @Max: 2 * @Default: 1 * * This ini is used to enable/disable external TDLS control. @@ -6940,6 +6940,12 @@ enum hdd_link_speed_rpt_type { * control allows a user to add a MAC address of potential TDLS peers so * that the CLD driver can initiate implicit TDLS setup to only those peers * when criteria for TDLS setup (throughput and RSSI threshold) is met. + * There are two flavors of external control supported. If control default + * is set 1 it means strict external control where only for configured + * tdls peer mac address tdls link will be established. If control default + * is set 2 it means liberal tdls external control needed. It means + * tdls link will be established with configured peer mac address as well + * as any other peer which supports tdls. * * Related: gEnableTDLSSupport, gEnableTDLSImplicitTrigger. * @@ -6951,7 +6957,7 @@ enum hdd_link_speed_rpt_type { */ #define CFG_TDLS_EXTERNAL_CONTROL "gTDLSExternalControl" #define CFG_TDLS_EXTERNAL_CONTROL_MIN (0) -#define CFG_TDLS_EXTERNAL_CONTROL_MAX (1) +#define CFG_TDLS_EXTERNAL_CONTROL_MAX (2) #define CFG_TDLS_EXTERNAL_CONTROL_DEFAULT (1) /* @@ -18166,7 +18172,7 @@ struct hdd_config { uint32_t fTDLSRxFrameThreshold; uint32_t fTDLSPuapsdPTIWindow; uint32_t fTDLSPuapsdPTRTimeout; - bool fTDLSExternalControl; + uint8_t fTDLSExternalControl; uint32_t fEnableTDLSOffChannel; uint32_t fEnableTDLSWmmMode; uint8_t fTDLSPrefOffChanNum; diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c index 56b8df7012cd..85fd7885052a 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c +++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_cfg80211.c @@ -21600,7 +21600,7 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, * Check if this is reassoc to same bssid, if reassoc is success, return */ status = wlan_hdd_reassoc_bssid_hint(adapter, req); - if (!status) + if (!status || status == -EPERM) return status; /* Try disconnecting if already in connected state */ diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_driver_ops.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_driver_ops.c index d1df160920cf..d5c658f8091e 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_driver_ops.c +++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_driver_ops.c @@ -1519,12 +1519,10 @@ static void wlan_hdd_set_the_pld_uevent(struct pld_uevent_data *uevent) { switch (uevent->uevent) { case PLD_RECOVERY: - cds_set_target_ready(false); - cds_set_recovery_in_progress(true); - break; case PLD_FW_DOWN: cds_set_target_ready(false); cds_set_recovery_in_progress(true); + qdf_complete_wait_events(); break; case PLD_FW_HANG_EVENT: break; @@ -1565,17 +1563,13 @@ static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent) switch (uevent->uevent) { case PLD_RECOVERY: - cds_set_target_ready(false); hdd_pld_ipa_uc_shutdown_pipes(); - qdf_complete_wait_events(); break; case PLD_FW_DOWN: - cds_set_target_ready(false); wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, NULL); if (pld_is_fw_rejuvenate(hdd_ctx->parent_dev) && ucfg_ipa_is_enabled()) ucfg_ipa_fw_rejuvenate_send_msg(hdd_ctx->pdev); - qdf_complete_wait_events(); break; case PLD_FW_HANG_EVENT: hdd_info("Received fimrware hang event"); @@ -1633,6 +1627,7 @@ static void wlan_hdd_pld_uevent(struct device *dev, wlan_hdd_set_the_pld_uevent(uevent); hdd_psoc_idle_timer_stop(hdd_ctx); + mutex_lock(&hdd_init_deinit_lock); wlan_hdd_handle_the_pld_uevent(uevent); mutex_unlock(&hdd_init_deinit_lock); diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c index 05bab5bf5a2a..98e24282c5c3 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c +++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_ioctl.c @@ -831,6 +831,31 @@ QDF_STATUS hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, } #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) +/** + * hdd_is_fast_reassoc_allowed - check if roam offload is enabled on the given + * vdev else, don't allow roam invoke to be triggered. + * @mac_handle: Opaque mac handle + * @vdev_id: vdev_id + * + * This API should return true if kernel version is less than 4.9, because + * the earlier versions don't have the fix to handle reassociation failure. + * + * Return: true if roaming module initialization is done else false + */ +static bool +hdd_is_fast_reassoc_allowed(mac_handle_t mac_handle, uint8_t vdev_id) +{ + return sme_is_fast_reassoc_allowed(mac_handle, vdev_id); +} +#else +static inline bool +hdd_is_fast_reassoc_allowed(mac_handle_t mac_handle, uint8_t vdev_id) +{ + return true; +} +#endif + /** * hdd_reassoc() - perform a userspace-directed reassoc * @adapter: Adapter upon which the command was received @@ -901,6 +926,13 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, /* Proceed with reassoc */ if (roaming_offload_enabled(hdd_ctx)) { + if (!hdd_is_fast_reassoc_allowed(adapter->hdd_ctx->mac_handle, + adapter->session_id)) { + hdd_err("LFR3: vdev[%d] RSO is not enabled", + adapter->session_id); + ret = -EPERM; + goto exit; + } status = hdd_wma_send_fastreassoc_cmd(adapter, bssid, (int)channel); if (status != QDF_STATUS_SUCCESS) { diff --git a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_main.c b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_main.c index 492ba06ea00a..565a8458f82d 100644 --- a/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_main.c +++ b/drivers/staging/qcacld-3.0/core/hdd/src/wlan_hdd_main.c @@ -1165,8 +1165,10 @@ static int hdd_update_tdls_config(struct hdd_context *hdd_ctx) (cfg->fEnableTDLSSupport ? 1 << TDLS_FEATURE_ENABLE : 0) | (cfg->fEnableTDLSImplicitTrigger ? 1 << TDLS_FEAUTRE_IMPLICIT_TRIGGER : 0) | - (cfg->fTDLSExternalControl ? - 1 << TDLS_FEATURE_EXTERNAL_CONTROL : 0)); + (cfg->fTDLSExternalControl & TDLS_STRICT_EXTERNAL_CONTROL ? + 1 << TDLS_FEATURE_EXTERNAL_CONTROL : 0) | + (cfg->fTDLSExternalControl & TDLS_LIBERAL_EXTERNAL_CONTROL ? + 1 << TDLS_FEATURE_LIBERAL_EXTERNAL_CONTROL : 0 )); config->tdls_vdev_nss_2g = GET_VDEV_NSS_CHAIN(cfg->rx_nss_2g, QDF_TDLS_MODE); config->tdls_vdev_nss_5g = GET_VDEV_NSS_CHAIN(cfg->rx_nss_5g, @@ -7443,8 +7445,20 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx) } hdd_start_station_adapter(adapter); hdd_set_mon_rx_cb(adapter->dev); - wlan_hdd_set_mon_chan(adapter, adapter->mon_chan, - adapter->mon_bandwidth); + + /* + * Do not set channel for monitor mode if monitor iface + * went down during SSR, as for set channels host sends + * vdev start command to FW. For the interfaces went + * down during SSR, host stops those adapters by sending + * vdev stop/down/delete commands to FW. So FW doesn't + * sends response for vdev start and vdev start response + * timer expires and thus host triggers ASSERT. + */ + if (!test_bit(DOWN_DURING_SSR, &adapter->event_flags)) + wlan_hdd_set_mon_chan( + adapter, adapter->mon_chan, + adapter->mon_bandwidth); break; default: break; @@ -14056,6 +14070,17 @@ static int wlan_hdd_state_ctrl_param_open(struct inode *inode, return 0; } +static void hdd_inform_wifi_off(void) +{ + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + + if (!hdd_ctx || !hdd_ctx->mac_handle) { + hdd_err("Invalid hdd/pdev context"); + return; + } + sme_free_blacklist(hdd_ctx->mac_handle); +} + static int hdd_driver_load(void); static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, const char __user *user_buf, @@ -14075,6 +14100,7 @@ static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, if (strncmp(buf, wlan_off_str, strlen(wlan_off_str)) == 0) { pr_debug("Wifi turning off from UI\n"); + hdd_inform_wifi_off(); goto exit; } @@ -16458,7 +16484,6 @@ bool wlan_hdd_check_mon_concurrency(void) void wlan_hdd_del_monitor(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter, bool rtnl_held) { - ucfg_pkt_capture_deregister_callbacks(adapter->vdev); wlan_hdd_release_intf_addr(hdd_ctx, adapter->mac_addr.bytes); hdd_stop_adapter(hdd_ctx, adapter); hdd_close_adapter(hdd_ctx, adapter, true); diff --git a/drivers/staging/qcacld-3.0/core/mac/inc/qwlan_version.h b/drivers/staging/qcacld-3.0/core/mac/inc/qwlan_version.h index cf9473de94f2..0c905b94a313 100644 --- a/drivers/staging/qcacld-3.0/core/mac/inc/qwlan_version.h +++ b/drivers/staging/qcacld-3.0/core/mac/inc/qwlan_version.h @@ -32,9 +32,9 @@ #define QWLAN_VERSION_MAJOR 5 #define QWLAN_VERSION_MINOR 2 #define QWLAN_VERSION_PATCH 03 -#define QWLAN_VERSION_EXTRA "I" +#define QWLAN_VERSION_EXTRA "X" #define QWLAN_VERSION_BUILD 29 -#define QWLAN_VERSIONSTR "5.2.03.29I" +#define QWLAN_VERSIONSTR "5.2.03.29X" #endif /* QWLAN_VERSION_H */ diff --git a/drivers/staging/qcacld-3.0/core/mac/src/cfg/cfgUtil/dot11f.frms b/drivers/staging/qcacld-3.0/core/mac/src/cfg/cfgUtil/dot11f.frms index 2a26f1c2e3e9..45acee437934 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/cfg/cfgUtil/dot11f.frms +++ b/drivers/staging/qcacld-3.0/core/mac/src/cfg/cfgUtil/dot11f.frms @@ -4031,7 +4031,7 @@ FRAME RadioMeasurementRequest FF DialogToken; FF NumOfRepetitions; //Measurement Request IE. - MANDIE MeasurementRequest[1..2]; + MANDIE MeasurementRequest[1..5]; } FRAME RadioMeasurementReport diff --git a/drivers/staging/qcacld-3.0/core/mac/src/include/dot11f.h b/drivers/staging/qcacld-3.0/core/mac/src/include/dot11f.h index 2700c0f6332a..ae403351014c 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/include/dot11f.h +++ b/drivers/staging/qcacld-3.0/core/mac/src/include/dot11f.h @@ -26,7 +26,7 @@ * * * This file was automatically generated by 'framesc' - * Wed Feb 12 20:42:23 2020 from the following file(s): + * Mon Jun 8 09:41:47 2020 from the following file(s): * * dot11f.frms * @@ -10347,7 +10347,7 @@ typedef struct sDot11fRadioMeasurementRequest{ tDot11fFfDialogToken DialogToken; tDot11fFfNumOfRepetitions NumOfRepetitions; uint16_t num_MeasurementRequest; - tDot11fIEMeasurementRequest MeasurementRequest[2]; + tDot11fIEMeasurementRequest MeasurementRequest[5]; } tDot11fRadioMeasurementRequest; #define DOT11F_RADIOMEASUREMENTREQUEST (25) diff --git a/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_api.h b/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_api.h index f154666d42fd..34bd6f0f64c8 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_api.h +++ b/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_api.h @@ -101,4 +101,22 @@ rrm_process_beacon_report_xmit(tpAniSirGlobal pMac, void lim_update_rrm_capability(tpAniSirGlobal mac_ctx, tpSirSmeJoinReq join_req); +/** + * rrm_reject_req - Reject rrm request + * @radiomes_report: radio measurement report + * @rrm_req: Array of Measurement request IEs + * @num_report: Num of report + * @index: Measurement index + * @measurement_type: Measurement Type + * + * Reject the Radio Resource Measurement request, if one is + * already in progress + * + * Return: QDF_STATUS + */ +QDF_STATUS rrm_reject_req(tpSirMacRadioMeasureReport *radiomes_report, + tDot11fRadioMeasurementRequest *rrm_req, + uint8_t *num_report, uint8_t index, + uint8_t measurement_type); + #endif diff --git a/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_global.h b/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_global.h index 057eab251cc6..378f37afe315 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_global.h +++ b/drivers/staging/qcacld-3.0/core/mac/src/pe/include/rrm_global.h @@ -27,7 +27,9 @@ ========================================================================*/ -#define MAX_MEASUREMENT_REQUEST 2 +#define MAX_MEASUREMENT_REQUEST 5 +#define MAX_NUM_CHANNELS 255 + #define DEFAULT_RRM_IDX 0 typedef enum eRrmRetStatus { @@ -218,6 +220,8 @@ typedef struct sRrmPEContext { uint8_t DialogToken; uint16_t prev_rrm_report_seq_num; tpRRMReq pCurrentReq[MAX_MEASUREMENT_REQUEST]; + uint8_t beacon_rpt_chan_list[MAX_NUM_CHANNELS]; + uint8_t beacon_rpt_chan_num; } tRrmPEContext, *tpRrmPEContext; /* 2008 11k spec reference: 18.4.8.5 RCPI Measurement */ diff --git a/drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index 78ab23f5b9b1..5cf505bd1af2 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/drivers/staging/qcacld-3.0/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -1854,7 +1854,7 @@ void lim_process_assoc_cleanup(tpAniSirGlobal mac_ctx, qdf_mem_free(assoc_req); /* to avoid double free */ - if (assoc_req_copied && session->parsedAssocReq) + if (sta_ds && assoc_req_copied && session->parsedAssocReq) session->parsedAssocReq[sta_ds->assocId] = NULL; } diff --git a/drivers/staging/qcacld-3.0/core/mac/src/pe/rrm/rrm_api.c b/drivers/staging/qcacld-3.0/core/mac/src/pe/rrm/rrm_api.c index c24bb529de42..a9a8898ea47e 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/pe/rrm/rrm_api.c +++ b/drivers/staging/qcacld-3.0/core/mac/src/pe/rrm/rrm_api.c @@ -1112,58 +1112,33 @@ QDF_STATUS rrm_process_beacon_req(tpAniSirGlobal mac_ctx, tSirMacAddr peer, tRrmRetStatus rrm_status = eRRM_SUCCESS; tpSirMacRadioMeasureReport report; tpRRMReq curr_req; + QDF_STATUS status = QDF_STATUS_SUCCESS; - if (index >= MAX_MEASUREMENT_REQUEST || - mac_ctx->rrm.rrmPEContext.pCurrentReq[index]) { - if (*radiomes_report == NULL) { - /* - * Allocate memory to send reports for - * any subsequent requests. - */ - *radiomes_report = qdf_mem_malloc(sizeof(*report) * - (rrm_req->num_MeasurementRequest - index)); - if (NULL == *radiomes_report) { - pe_err("Unable to allocate memory during RRM Req processing"); - return QDF_STATUS_E_NOMEM; - } - pe_debug("rrm beacon type refused of %d report in beacon table", - *num_report); - } - report = *radiomes_report; - report[*num_report].refused = 1; - report[*num_report].type = SIR_MAC_RRM_BEACON_TYPE; - report[*num_report].token = - rrm_req->MeasurementRequest[index].measurement_token; - (*num_report)++; - return QDF_STATUS_SUCCESS; - } else { - curr_req = mac_ctx->rrm.rrmPEContext.pCurrentReq[index]; - if (curr_req) { - qdf_mem_free(curr_req); - mac_ctx->rrm.rrmPEContext.pCurrentReq[index] = NULL; - } + if (index >= MAX_MEASUREMENT_REQUEST) { + status = rrm_reject_req(&report, rrm_req, num_report, index, + rrm_req->MeasurementRequest[index]. + measurement_type); + return status; + } - curr_req = qdf_mem_malloc(sizeof(*curr_req)); - if (NULL == curr_req) { - pe_err("Unable to allocate memory during RRM Req processing"); - qdf_mem_free(*radiomes_report); - mac_ctx->rrm.rrmPEContext.pCurrentReq[index] = NULL; - return QDF_STATUS_E_NOMEM; - } - pe_debug("Processing Beacon Report request idx:%d", index); - curr_req->dialog_token = rrm_req->DialogToken.token; - curr_req->token = rrm_req-> - MeasurementRequest[index].measurement_token; - curr_req->sendEmptyBcnRpt = true; - curr_req->measurement_idx = index; - mac_ctx->rrm.rrmPEContext.pCurrentReq[index] = curr_req; - rrm_status = rrm_process_beacon_report_req(mac_ctx, curr_req, - &rrm_req->MeasurementRequest[index], session_entry); - if (eRRM_SUCCESS != rrm_status) { - rrm_process_beacon_request_failure(mac_ctx, - session_entry, peer, rrm_status, index); - rrm_cleanup(mac_ctx, index); - } + curr_req = qdf_mem_malloc(sizeof(*curr_req)); + if (!curr_req) { + mac_ctx->rrm.rrmPEContext.pCurrentReq[index] = NULL; + return QDF_STATUS_E_NOMEM; + } + pe_debug("Processing Beacon Report request %d", index); + curr_req->dialog_token = rrm_req->DialogToken.token; + curr_req->token = + rrm_req->MeasurementRequest[index].measurement_token; + curr_req->sendEmptyBcnRpt = true; + curr_req->measurement_idx = index; + mac_ctx->rrm.rrmPEContext.pCurrentReq[index] = curr_req; + rrm_status = rrm_process_beacon_report_req(mac_ctx, curr_req, + &rrm_req->MeasurementRequest[index], session_entry); + if (eRRM_SUCCESS != rrm_status) { + rrm_process_beacon_request_failure(mac_ctx, + session_entry, peer, rrm_status, index); + rrm_cleanup(mac_ctx, index); } return QDF_STATUS_SUCCESS; @@ -1212,6 +1187,36 @@ QDF_STATUS update_rrm_report(tpAniSirGlobal mac_ctx, return QDF_STATUS_SUCCESS; } +QDF_STATUS rrm_reject_req(tpSirMacRadioMeasureReport *radiomes_report, + tDot11fRadioMeasurementRequest *rrm_req, + uint8_t *num_report, uint8_t index, + uint8_t measurement_type) +{ + tpSirMacRadioMeasureReport report; + + if (!*radiomes_report) { + /* + * Allocate memory to send reports for + * any subsequent requests. + */ + *radiomes_report = qdf_mem_malloc(sizeof(*report) * + (rrm_req->num_MeasurementRequest - index)); + if (!*radiomes_report) + return QDF_STATUS_E_NOMEM; + + pe_debug("rrm beacon refused of %d report, index: %d in beacon table", + *num_report, index); + } + report = *radiomes_report; + report[*num_report].refused = 1; + report[*num_report].type = measurement_type; + report[*num_report].token = + rrm_req->MeasurementRequest[index].measurement_token; + (*num_report)++; + + return QDF_STATUS_SUCCESS; +} + /* -------------------------------------------------------------------- */ /** * rrm_process_radio_measurement_request - Process rrm request @@ -1230,10 +1235,11 @@ rrm_process_radio_measurement_request(tpAniSirGlobal mac_ctx, tDot11fRadioMeasurementRequest *rrm_req, tpPESession session_entry) { - uint8_t i; + uint8_t i, index; QDF_STATUS status = QDF_STATUS_SUCCESS; tpSirMacRadioMeasureReport report = NULL; uint8_t num_report = 0; + bool reject = false; if (!rrm_req->num_MeasurementRequest) { report = qdf_mem_malloc(sizeof(tSirMacRadioMeasureReport)); @@ -1268,6 +1274,39 @@ rrm_process_radio_measurement_request(tpAniSirGlobal mac_ctx, goto end; } + for (index = 0; index < MAX_MEASUREMENT_REQUEST; index++) { + if (mac_ctx->rrm.rrmPEContext.pCurrentReq[index]) { + reject = true; + pe_debug("RRM req for index: %d is already in progress", + index); + break; + } + } + + if (reject == true) { + for (i = 0; i < rrm_req->num_MeasurementRequest; i++) { + status = + rrm_reject_req(&report, rrm_req, &num_report, i, + rrm_req->MeasurementRequest[i]. + measurement_type); + if (QDF_IS_STATUS_ERROR(status)) { + pe_debug("Fail to Reject rrm req for index: %d", + i); + return status; + } + } + + goto end; + } + + /* + * Clear global beacon_rpt_chan_list before processing every new + * beacon report request. + */ + qdf_mem_zero(mac_ctx->rrm.rrmPEContext.beacon_rpt_chan_list, + sizeof(uint8_t) * MAX_NUM_CHANNELS); + mac_ctx->rrm.rrmPEContext.beacon_rpt_chan_num = 0; + for (i = 0; i < rrm_req->num_MeasurementRequest; i++) { switch (rrm_req->MeasurementRequest[i].measurement_type) { case SIR_MAC_RRM_BEACON_TYPE: @@ -1388,9 +1427,10 @@ tpRRMCaps rrm_get_capabilities(tpAniSirGlobal pMac, tpPESession pSessionEntry) QDF_STATUS rrm_initialize(tpAniSirGlobal pMac) { tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; + uint8_t i; - pMac->rrm.rrmPEContext.pCurrentReq[0] = NULL; - pMac->rrm.rrmPEContext.pCurrentReq[1] = NULL; + for (i = 0; i < MAX_MEASUREMENT_REQUEST; i++) + pMac->rrm.rrmPEContext.pCurrentReq[i] = NULL; pMac->rrm.rrmPEContext.txMgmtPower = 0; pMac->rrm.rrmPEContext.DialogToken = 0; diff --git a/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/dot11f.c b/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/dot11f.c index 7de2c0093a1e..638f5ea0c0ff 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/dot11f.c +++ b/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/dot11f.c @@ -24,7 +24,7 @@ * * * This file was automatically generated by 'framesc' - * Wed Feb 12 20:42:23 2020 from the following file(s): + * Mon Jun 8 09:41:47 2020 from the following file(s): * * dot11f.frms * @@ -11281,7 +11281,7 @@ static const tIEDefn IES_RadioMeasurementRequest[] = { { offsetof(tDot11fRadioMeasurementRequest, MeasurementRequest), offsetof(tDot11fIEMeasurementRequest, present), offsetof(tDot11fRadioMeasurementRequest, num_MeasurementRequest), - "MeasurementRequest", 2, 6, 18, SigIeMeasurementRequest, {0, 0, 0, 0, 0}, + "MeasurementRequest", 5, 6, 18, SigIeMeasurementRequest, {0, 0, 0, 0, 0}, 0, DOT11F_EID_MEASUREMENTREQUEST, 0, 1, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; diff --git a/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/parser_api.c index d8cac206e072..72e4c43930aa 100644 --- a/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/drivers/staging/qcacld-3.0/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -3080,12 +3080,16 @@ QDF_STATUS wlan_parse_ftie_sha384(uint8_t *frame, uint32_t frame_len, QDF_STATUS sir_convert_assoc_resp_frame2_struct(tpAniSirGlobal pMac, tpPESession session_entry, - uint8_t *pFrame, uint32_t nFrame, + u8 *frame, u32 frame_len, tpSirAssocRsp pAssocRsp) { tDot11fAssocResponse *ar; - uint32_t status; + enum ani_akm_type auth_type; + u32 status, ie_len; + QDF_STATUS qdf_status; uint8_t cnt = 0; + bool sha384_akm; + u8 *ie_ptr; ar = qdf_mem_malloc(sizeof(*ar)); if (!ar) { @@ -3096,7 +3100,7 @@ sir_convert_assoc_resp_frame2_struct(tpAniSirGlobal pMac, /* decrypt the cipher text using AEAD decryption */ if (lim_is_fils_connection(session_entry)) { status = aead_decrypt_assoc_rsp(pMac, session_entry, - ar, pFrame, &nFrame); + ar, frame, &frame_len); if (!QDF_IS_STATUS_SUCCESS(status)) { pe_err("FILS assoc rsp AEAD decrypt fails"); qdf_mem_free(ar); @@ -3104,13 +3108,12 @@ sir_convert_assoc_resp_frame2_struct(tpAniSirGlobal pMac, } } - status = dot11f_parse_assoc_response(pMac, pFrame, nFrame, ar, false); + status = dot11f_parse_assoc_response(pMac, frame, frame_len, ar, false); if (QDF_STATUS_SUCCESS != status) { qdf_mem_free(ar); return status; } - /* Capabilities */ pAssocRsp->capabilityInfo.ess = ar->Capabilities.ess; pAssocRsp->capabilityInfo.ibss = ar->Capabilities.ibss; @@ -3195,13 +3198,40 @@ sir_convert_assoc_resp_frame2_struct(tpAniSirGlobal pMac, (unsigned int)pAssocRsp->mdie[2]); } - if (ar->FTInfo.present) { - pe_debug("FT Info present %d %d %d", - ar->FTInfo.R0KH_ID.num_PMK_R0_ID, - ar->FTInfo.R0KH_ID.present, ar->FTInfo.R1KH_ID.present); + /* + * If the connection is based on SHA384 AKM suite, + * then the length of MIC is 24 bytes, but frame parser + * has FTIE MIC of 16 bytes only. This results in parsing FTIE + * failure and R0KH and R1KH are not sent to firmware over RSO + * command. Frame parser doesn't have + * info on the connected AKM. So parse the FTIE again if + * AKM is sha384 based and extract the R0KH and R1KH using the new + * parsing logic. + */ + auth_type = session_entry->connected_akm; + sha384_akm = lim_is_sha384_akm(auth_type); + if (sha384_akm) { + ie_ptr = frame + FIXED_PARAM_OFFSET_ASSOC_RSP; + ie_len = frame_len - FIXED_PARAM_OFFSET_ASSOC_RSP; + qdf_status = wlan_parse_ftie_sha384(ie_ptr, ie_len, pAssocRsp); + if (QDF_IS_STATUS_ERROR(qdf_status)) { + pe_err("FT IE parsing failed status:%d", status); + } else { + pe_debug("FT: R0KH present:%d len:%d R1KH present%d", + pAssocRsp->sha384_ft_subelem.r0kh_id.present, + pAssocRsp-> + sha384_ft_subelem.r0kh_id.num_PMK_R0_ID, + pAssocRsp->sha384_ft_subelem.r1kh_id.present); + ar->FTInfo.present = false; + } + } else if (ar->FTInfo.present) { + pe_debug("FT: R0KH present:%d, len:%d R1KH present:%d", + ar->FTInfo.R0KH_ID.present, + ar->FTInfo.R0KH_ID.num_PMK_R0_ID, + ar->FTInfo.R1KH_ID.present); pAssocRsp->ftinfoPresent = 1; qdf_mem_copy(&pAssocRsp->FTInfo, &ar->FTInfo, - sizeof(tDot11fIEFTInfo)); + sizeof(tDot11fIEFTInfo)); } if (ar->num_RICDataDesc && ar->num_RICDataDesc <= 2) { diff --git a/drivers/staging/qcacld-3.0/core/sme/inc/csr_api.h b/drivers/staging/qcacld-3.0/core/sme/inc/csr_api.h index db51bfad0a28..42466639fbba 100644 --- a/drivers/staging/qcacld-3.0/core/sme/inc/csr_api.h +++ b/drivers/staging/qcacld-3.0/core/sme/inc/csr_api.h @@ -1818,6 +1818,7 @@ typedef void (*tCsrTsmStatsCallback)(tAniTrafStrmMetrics tsmMetrics, #endif /* FEATURE_WLAN_ESE */ typedef void (*tCsrSnrCallback)(int8_t snr, uint32_t staId, void *pContext); +void csr_assoc_rej_free_rssi_disallow_list(struct sAniSirGlobal *mac); /** * csr_roam_issue_ft_preauth_req() - Initiate Preauthentication request * @max_ctx: Global MAC context diff --git a/drivers/staging/qcacld-3.0/core/sme/inc/sme_api.h b/drivers/staging/qcacld-3.0/core/sme/inc/sme_api.h index 61add962964c..f73b17ec3fe2 100644 --- a/drivers/staging/qcacld-3.0/core/sme/inc/sme_api.h +++ b/drivers/staging/qcacld-3.0/core/sme/inc/sme_api.h @@ -1058,6 +1058,8 @@ uint8_t sme_get_roam_bmiss_final_bcnt(tHalHandle hHal); QDF_STATUS sme_set_roam_beacon_rssi_weight(tHalHandle hHal, uint8_t sessionId, const uint8_t nRoamBeaconRssiWeight); uint8_t sme_get_roam_beacon_rssi_weight(tHalHandle hHal); +void sme_free_blacklist(tHalHandle mac_handle); + /** * sme_get_roam_rssi_diff() - get Roam rssi diff * @mac_handle: The handle returned by mac_open @@ -2092,6 +2094,18 @@ QDF_STATUS sme_get_beacon_frm(tHalHandle hal, struct csr_roam_profile *profile, int *channel); #ifdef WLAN_FEATURE_ROAM_OFFLOAD + +/** + * sme_is_fast_reassoc_allowed - API to check if roam invoke is + * allowed. Get the roam enabled vdev id and allow roaming only on + * that vdev id. + * @mac_handle: Opaque mac handle + * @vdev_id: vdev id + * + * Return: true if roam invoke is allowed, else return false + */ +bool sme_is_fast_reassoc_allowed(mac_handle_t mac_handle, uint8_t vdev_id); + /** * sme_fast_reassoc() - invokes FAST REASSOC command * @hal: handle returned by mac_open @@ -2106,6 +2120,12 @@ QDF_STATUS sme_get_beacon_frm(tHalHandle hal, struct csr_roam_profile *profile, QDF_STATUS sme_fast_reassoc(tHalHandle hal, struct csr_roam_profile *profile, const tSirMacAddr bssid, int channel, uint8_t vdev_id, const tSirMacAddr connected_bssid); +#else +static inline +bool sme_is_fast_reassoc_allowed(mac_handle_t mac_handle, uint8_t vdev_id) +{ + return true; +} #endif /** * sme_congestion_register_callback() - registers congestion callback diff --git a/drivers/staging/qcacld-3.0/core/sme/src/common/sme_api.c b/drivers/staging/qcacld-3.0/core/sme/src/common/sme_api.c index d1c4ebafab6f..c91453a01103 100644 --- a/drivers/staging/qcacld-3.0/core/sme/src/common/sme_api.c +++ b/drivers/staging/qcacld-3.0/core/sme/src/common/sme_api.c @@ -10572,6 +10572,13 @@ QDF_STATUS sme_set_auto_shutdown_timer(tHalHandle hHal, uint32_t timer_val) } #endif +void sme_free_blacklist(tHalHandle mac_handle) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(mac_handle); + + csr_assoc_rej_free_rssi_disallow_list(mac_ctx); +} + #ifdef FEATURE_WLAN_CH_AVOID /* * sme_ch_avoid_update_req() - @@ -15668,6 +15675,19 @@ free_scan_flter: } #ifdef WLAN_FEATURE_ROAM_OFFLOAD +bool sme_is_fast_reassoc_allowed(mac_handle_t mac_handle, uint8_t vdev_id) +{ + tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); + uint8_t roam_enabled_session_id; + + roam_enabled_session_id = csr_get_roam_enabled_sta_sessionid(mac); + if (roam_enabled_session_id != CSR_SESSION_ID_INVALID && + roam_enabled_session_id != vdev_id) + return false; + + return true; +} + QDF_STATUS sme_fast_reassoc(tHalHandle hal, struct csr_roam_profile *profile, const tSirMacAddr bssid, int channel, uint8_t vdev_id, const tSirMacAddr connected_bssid) @@ -15692,7 +15712,6 @@ QDF_STATUS sme_fast_reassoc(tHalHandle hal, struct csr_roam_profile *profile, return status; } - #endif QDF_STATUS sme_set_del_pmkid_cache(tHalHandle hal, uint8_t session_id, diff --git a/drivers/staging/qcacld-3.0/core/sme/src/csr/csr_api_roam.c b/drivers/staging/qcacld-3.0/core/sme/src/csr/csr_api_roam.c index eb55076d5c07..b12c8e2fc82a 100644 --- a/drivers/staging/qcacld-3.0/core/sme/src/csr/csr_api_roam.c +++ b/drivers/staging/qcacld-3.0/core/sme/src/csr/csr_api_roam.c @@ -584,7 +584,7 @@ static void csr_close_stats_ll(struct sAniSirGlobal *mac_ctx) * * Return: void */ -static void csr_assoc_rej_free_rssi_disallow_list(struct sAniSirGlobal *mac) +void csr_assoc_rej_free_rssi_disallow_list(struct sAniSirGlobal *mac) { QDF_STATUS status; struct sir_rssi_disallow_lst *cur_node; @@ -603,7 +603,6 @@ static void csr_assoc_rej_free_rssi_disallow_list(struct sAniSirGlobal *mac) cur_lst = next_lst; next_lst = NULL; } - qdf_list_destroy(list); qdf_mutex_release(&mac->roam.rssi_disallow_bssid_lock); } @@ -635,6 +634,7 @@ static QDF_STATUS csr_roam_rssi_disallow_bssid_deinit( struct sAniSirGlobal *mac_ctx) { csr_assoc_rej_free_rssi_disallow_list(mac_ctx); + qdf_list_destroy(&mac_ctx->roam.rssi_disallow_bssid); qdf_mutex_destroy(&mac_ctx->roam.rssi_disallow_bssid_lock); return QDF_STATUS_SUCCESS; } diff --git a/drivers/staging/qcacld-3.0/core/sme/src/rrm/sme_rrm.c b/drivers/staging/qcacld-3.0/core/sme/src/rrm/sme_rrm.c index e53ebae4dbf8..02804f6a62c1 100644 --- a/drivers/staging/qcacld-3.0/core/sme/src/rrm/sme_rrm.c +++ b/drivers/staging/qcacld-3.0/core/sme/src/rrm/sme_rrm.c @@ -1072,13 +1072,19 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac, { tpSirBeaconReportReqInd pBeaconReq = (tpSirBeaconReportReqInd) pMsgBuf; tpRrmSMEContext pSmeRrmContext; - uint32_t len = 0, i = 0; + uint32_t len = 0, i = 0, j = 0; uint8_t country[WNI_CFG_COUNTRY_CODE_LEN]; uint32_t session_id; struct csr_roam_session *session; QDF_STATUS status; + uint8_t local_num_channel, local_bcn_chan_freq; + uint8_t *local_rrm_freq_list; + tRrmPEContext rrm_context; + bool chan_valid = true; pSmeRrmContext = &pMac->rrm.rrmSmeContext[pBeaconReq->measurement_idx]; + rrm_context = pMac->rrm.rrmPEContext; + status = csr_roam_get_session_id_from_bssid(pMac, (struct qdf_mac_addr *) pBeaconReq->bssId, &session_id); @@ -1192,6 +1198,50 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac, } } + local_rrm_freq_list = pSmeRrmContext->channelList.ChannelList; + local_num_channel = 0; + for (i = 0; i < pSmeRrmContext->channelList.numOfChannels; i++) { + local_bcn_chan_freq = local_rrm_freq_list[i]; + chan_valid = true; + + if (pBeaconReq->measurement_idx > 0) { + for (j = 0; j < rrm_context.beacon_rpt_chan_num; j++) { + if (rrm_context.beacon_rpt_chan_list[j] == + local_bcn_chan_freq) { + /* + * Ignore this channel, As this is already + * included in previous request + */ + chan_valid = false; + break; + } + } + } + + if (chan_valid) { + rrm_context. + beacon_rpt_chan_list[rrm_context.beacon_rpt_chan_num] = + local_bcn_chan_freq; + rrm_context.beacon_rpt_chan_num++; + + if (rrm_context.beacon_rpt_chan_num >= + MAX_NUM_CHANNELS) { + /* this should never happen */ + sme_err("Reset beacon_rpt_chan_num : %d", + rrm_context.beacon_rpt_chan_num); + rrm_context.beacon_rpt_chan_num = 0; + } + local_rrm_freq_list[local_num_channel] = + local_bcn_chan_freq; + local_num_channel++; + } + } + + if (local_num_channel == 0) + goto cleanup; + + pSmeRrmContext->channelList.numOfChannels = local_num_channel; + /* Copy session bssid */ qdf_mem_copy(pSmeRrmContext->sessionBssId.bytes, pBeaconReq->bssId, sizeof(tSirMacAddr)); diff --git a/drivers/staging/qcacld-3.0/core/wma/src/wma_scan_roam.c b/drivers/staging/qcacld-3.0/core/wma/src/wma_scan_roam.c index dd2ed4495b12..3271058a770f 100644 --- a/drivers/staging/qcacld-3.0/core/wma/src/wma_scan_roam.c +++ b/drivers/staging/qcacld-3.0/core/wma/src/wma_scan_roam.c @@ -1954,7 +1954,8 @@ QDF_STATUS wma_process_roaming_config(tp_wma_handle wma_handle, if (roam_req->reason == REASON_ROAM_STOP_ALL || roam_req->reason == REASON_DISCONNECTED || - roam_req->reason == REASON_ROAM_SYNCH_FAILED) { + roam_req->reason == REASON_ROAM_SYNCH_FAILED || + roam_req->reason == REASON_SUPPLICANT_DISABLED_ROAMING) { mode = WMI_ROAM_SCAN_MODE_NONE; } else { if (csr_roamIsRoamOffloadEnabled(pMac)) @@ -3402,8 +3403,16 @@ wma_get_trigger_detail_str(struct wmi_roam_trigger_info *roam_info, char *buf) return; case WMI_ROAM_TRIGGER_REASON_LOW_RSSI: case WMI_ROAM_TRIGGER_REASON_PERIODIC: - buf_cons = qdf_snprint(temp, buf_left, "Cur_rssi_threshold: %d", - roam_info->rssi_trig_data.threshold); + /* + * Use roam_info->current_rssi get the RSSI of current AP after + * roam scan is triggered. This avoids discrepency with the + * next rssi threshold value printed in roam scan details. + * roam_info->rssi_trig_data.threshold gives the rssi of AP + * before the roam scan was triggered. + */ + buf_cons = qdf_snprint(temp, buf_left, + " Current AP RSSI: %d", + roam_info->current_rssi); temp += buf_cons; buf_left -= buf_cons; return; diff --git a/drivers/staging/qcacld-3.0/core/wma/src/wma_utils.c b/drivers/staging/qcacld-3.0/core/wma/src/wma_utils.c index a9504c7c0360..c484ac3117e4 100644 --- a/drivers/staging/qcacld-3.0/core/wma/src/wma_utils.c +++ b/drivers/staging/qcacld-3.0/core/wma/src/wma_utils.c @@ -4712,7 +4712,8 @@ static void wma_update_roam_offload_flag(tp_wma_handle wma, uint8_t vdev_id, } for (id = 0; id < wma->max_bssid; id++) { - if (wma->interfaces[id].roam_offload_enabled) + if (wma_is_vdev_valid(id) && + wma->interfaces[id].roam_offload_enabled) roam_offload_vdev_id = id; } diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 1ef97d80654d..3d4fb028175c 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -2256,7 +2256,7 @@ static void dwc3_msm_block_reset(struct dwc3_msm *mdwc, bool core_reset) static void dwc3_msm_power_collapse_por(struct dwc3_msm *mdwc) { struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3); - u32 val, val1; + u32 val = 0, val1 = 0; int ret; /* Configure AHB2PHY for one wait state read/write */ diff --git a/drivers/usb/gadget/function/f_cdev.c b/drivers/usb/gadget/function/f_cdev.c index be24a8c83acf..5ccc15fcee5c 100644 --- a/drivers/usb/gadget/function/f_cdev.c +++ b/drivers/usb/gadget/function/f_cdev.c @@ -57,11 +57,8 @@ #define BRIDGE_RX_QUEUE_SIZE 8 #define BRIDGE_RX_BUF_SIZE 2048 #define BRIDGE_TX_QUEUE_SIZE 8 -#if IS_ENABLED(CONFIG_ARCH_SM8150) -#define BRIDGE_TX_BUF_SIZE (50 * 1024) -#else -#define BRIDGE_TX_BUF_SIZE 2048 -#endif +#define BRIDGE_TX_BUF_SIZE 2048 + #define GS_LOG2_NOTIFY_INTERVAL 5 /* 1 << 5 == 32 msec */ #define GS_NOTIFY_MAXPACKET 10 /* notification + 2 bytes */ diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 11dce21b767b..9a604f5ca174 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1258,8 +1258,6 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type) DEFINE_WAIT(wait); for (;;) { - prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE); - if (!get_pages(sbi, type)) break; @@ -1271,6 +1269,8 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type) FS_CP_META_IO); else if (type == F2FS_WB_CP_DATA) f2fs_submit_merged_write(sbi, DATA); + + prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE); io_schedule_timeout(DEFAULT_IO_TIMEOUT); } finish_wait(&sbi->cp_wait, &wait); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index a683ce26c12c..38ceeb007e75 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2661,7 +2661,7 @@ static inline void __mark_inode_dirty_flag(struct inode *inode, static inline void set_inode_flag(struct inode *inode, int flag) { - test_and_set_bit(flag, F2FS_I(inode)->flags); + set_bit(flag, F2FS_I(inode)->flags); __mark_inode_dirty_flag(inode, flag, true); } @@ -2672,7 +2672,7 @@ static inline int is_inode_flag_set(struct inode *inode, int flag) static inline void clear_inode_flag(struct inode *inode, int flag) { - test_and_clear_bit(flag, F2FS_I(inode)->flags); + clear_bit(flag, F2FS_I(inode)->flags); __mark_inode_dirty_flag(inode, flag, false); } diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 2b9002d0d662..dd519d68e064 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3386,14 +3386,14 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) if (ret) goto out; - if (!F2FS_I(inode)->i_compr_blocks) - goto out; - F2FS_I(inode)->i_flags |= F2FS_IMMUTABLE_FL; f2fs_set_inode_flags(inode); inode->i_ctime = current_time(inode); f2fs_mark_inode_dirty_sync(inode, true); + if (!F2FS_I(inode)->i_compr_blocks) + goto out; + down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); down_write(&F2FS_I(inode)->i_mmap_sem); diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 8d2d8726d65f..393ad8be35f4 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -774,6 +774,14 @@ no_delete: else f2fs_inode_synced(inode); + /* + * Make sure evicted inode should not wait for writeback again. + */ + if (!list_empty_careful(&inode->i_io_list)) { + WARN_ON(1); + inode_io_list_del(inode); + } + /* for the case f2fs_new_inode() was failed, .i_ino is zero, skip it */ if (inode->i_ino) invalidate_mapping_pages(NODE_MAPPING(sbi), inode->i_ino, diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 91f39b7f78b0..4feba309911b 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2166,7 +2166,7 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) new_vblocks = se->valid_blocks + del; offset = GET_BLKOFF_FROM_SEG0(sbi, blkaddr); - f2fs_bug_on(sbi, (new_vblocks >> (sizeof(unsigned short) << 3) || + f2fs_bug_on(sbi, (new_vblocks < 0 || (new_vblocks > sbi->blocks_per_seg))); se->valid_blocks = new_vblocks; diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 1d33d0035265..9adb9177a4b4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1045,6 +1045,7 @@ void inode_io_list_del(struct inode *inode) spin_unlock(&inode->i_lock); spin_unlock(&wb->list_lock); } +EXPORT_SYMBOL(inode_io_list_del); /* * mark an inode as under writeback on the sb diff --git a/include/linux/ipa.h b/include/linux/ipa.h index eee92b0cabe2..32e513fbb397 100644 --- a/include/linux/ipa.h +++ b/include/linux/ipa.h @@ -1425,9 +1425,35 @@ struct ipa_socksv5_info { struct ipacm_socksv5_info dl_in; /* output: handle (index) */ - uint32_t handle; + uint16_t handle; }; +struct ipa_ipv6_nat_uc_tmpl { + uint16_t cmd_id; + uint16_t rsv; + uint32_t cmd_param; + uint16_t pkt_count; + uint16_t rsv2; + uint32_t byte_count; + uint64_t private_address_lsb; + uint64_t private_address_msb; + uint64_t public_address_lsb; + uint64_t public_address_msb; + uint16_t private_port; + uint16_t public_port; + uint32_t rsv3; + uint64_t rsv4; + uint64_t rsv5; + uint64_t rsv6; + uint64_t rsv7; + uint64_t rsv8; + uint64_t rsv9; + uint64_t rsv10; + uint64_t rsv11; + uint64_t rsv12; +} __packed; + + #if defined CONFIG_IPA || defined CONFIG_IPA3 diff --git a/include/linux/writeback.h b/include/linux/writeback.h index e12d92808e98..43c702e22e04 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -192,6 +192,7 @@ bool try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, void sync_inodes_sb(struct super_block *); void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); void inode_wait_for_writeback(struct inode *inode); +void inode_io_list_del(struct inode *inode); /* writeback.h requires fs.h; it, too, is not included from here. */ static inline void wait_on_inode(struct inode *inode) diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index 00b293065977..6d86d7357807 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -127,6 +127,8 @@ #define IPA_IOCTL_APP_CLOCK_VOTE 79 #define IPA_IOCTL_PDN_CONFIG 80 #define IPA_IOCTL_SET_MAC_FLT 81 +#define IPA_IOCTL_ADD_UC_ACT_ENTRY 82 +#define IPA_IOCTL_DEL_UC_ACT_ENTRY 83 /** * max size of the header to be inserted @@ -2515,6 +2517,73 @@ struct ipa_wan_msg { uint32_t ipv6_addr_gw[IPA_WAN_MSG_IPv6_ADDR_GW_LEN]; }; +/* uc activation command Ids */ +#define IPA_SOCKSV5_ADD_COM_ID 15 +#define IPA_IPv6_NAT_COM_ID 16 + +/** + * ipa_kernel_tests_socksv5_uc_tmpl - uc activation entry info + * @cmd_id: uc command id + * @cmd_param: uC command param + * @ipa_kernel_tests_ip_hdr_temp: ip header + * @src_port: source port + * @dst_port: destination port + * @ipa_sockv5_mask: uc attribute mask for options/etc + * @out_irs: 4B/4B Seq/Ack/SACK + * @out_iss + * @in_irs + * @in_iss + * @out_ircv_tsval: timestamp attributes + * @in_ircv_tsecr + * @out_ircv_tsecr + * @in_ircv_tsval + * @in_isnd_wscale: window scale attributes + * @out_isnd_wscale + * @in_ircv_wscale + * @out_ircv_wscale + * @direction: 1 for UL 0 for DL + * @handle: uc activation table index + */ +struct ipa_kernel_tests_socksv5_uc_tmpl { + uint16_t cmd_id; + uint32_t cmd_param; + __be32 ip_src_addr; + __be32 ip_dst_addr; + __be32 ipv6_src_addr[4]; + __be32 ipv6_dst_addr[4]; + + /* 2B src/dst port */ + uint16_t src_port; + uint16_t dst_port; + + /* attribute mask */ + uint32_t ipa_sockv5_mask; + + /* required update 4B/4B Seq/Ack/SACK */ + uint32_t out_irs; + uint32_t out_iss; + uint32_t in_irs; + uint32_t in_iss; + + /* option 10B: time-stamp */ + uint32_t out_ircv_tsval; + uint32_t in_ircv_tsecr; + uint32_t out_ircv_tsecr; + uint32_t in_ircv_tsval; + + /* option 2B: window-scaling/dynamic */ + uint16_t in_isnd_wscale : 4; + uint16_t out_isnd_wscale : 4; + uint16_t in_ircv_wscale : 4; + uint16_t out_ircv_wscale : 4; + + /* direction 1 = UL, 0 = DL */ + uint8_t direction; + + /* output: handle (index) */ + uint16_t handle; +}; + /** * struct ipacm_socksv5_info - To hold information about socksv5 connections * @ip_type: ip type @@ -2565,6 +2634,41 @@ struct ipa_socksv5_msg { uint16_t handle; }; +/** + * struct ipa_ioc_ipv6_nat_uc_act_entry - To hold information about IPv6 NAT + * uC entry + * @cmd_id[in]: IPv6 NAT uC CMD ID - used for identifying uc activation type + * @private_address_lsb[in]: client private address lsb + * @private_address_msb[in]: client private address msb + * @public_address_lsb[in]: client public address lsb + * @public_address_msb[in]: client public address msb + * @private_port[in]: client private port + * @public_port[in]: client public port + * @index[out]: uC activation entry index + */ +struct ipa_ioc_ipv6_nat_uc_act_entry { + uint16_t cmd_id; + uint64_t private_address_lsb; + uint64_t private_address_msb; + uint64_t public_address_lsb; + uint64_t public_address_msb; + uint32_t private_port; + uint32_t public_port; + uint16_t index; +}; + +/** + * union ipa_ioc_uc_activation_entry - To hold information about uC activation + * entry + * @socks[in]: fill here if entry is Socksv5 entry + * @ipv6_nat[in]: fill here if entry is IPv6 NAT entry + */ +union ipa_ioc_uc_activation_entry { + struct ipa_kernel_tests_socksv5_uc_tmpl socks; + struct ipa_ioc_ipv6_nat_uc_act_entry ipv6_nat; +}; + + /** * struct ipa_ioc_rm_dependency - parameters for add/delete dependency * @resource_name: name of dependent resource @@ -3084,6 +3188,14 @@ struct ipa_ioc_mac_client_list_type { IPA_IOCTL_SET_MAC_FLT, \ struct ipa_ioc_mac_client_list_type) +#define IPA_IOC_ADD_UC_ACT_ENTRY _IOWR(IPA_IOC_MAGIC, \ + IPA_IOCTL_ADD_UC_ACT_ENTRY, \ + union ipa_ioc_uc_activation_entry) + +#define IPA_IOC_DEL_UC_ACT_ENTRY _IOWR(IPA_IOC_MAGIC, \ + IPA_IOCTL_DEL_UC_ACT_ENTRY, \ + uint16_t) + /* * unique magic number of the Tethering bridge ioctls */ diff --git a/include/uapi/media/cam_req_mgr.h b/include/uapi/media/cam_req_mgr.h index 2bff30d6e7ca..aefb75661bc7 100644 --- a/include/uapi/media/cam_req_mgr.h +++ b/include/uapi/media/cam_req_mgr.h @@ -269,6 +269,7 @@ struct cam_req_mgr_link_control { #define CAM_MEM_FLAG_CACHE (1<<10) #define CAM_MEM_FLAG_HW_SHARED_ACCESS (1<<11) #define CAM_MEM_FLAG_CDSP_OUTPUT (1<<12) +#define CAM_MEM_FLAG_CP_PIXEL (1<<13) #define CAM_MEM_MMU_MAX_HANDLE 16