diff --git a/Documentation/devicetree/bindings/gpu/adreno.txt b/Documentation/devicetree/bindings/gpu/adreno.txt index 337a72c8fe6d..80813dd1b3e5 100644 --- a/Documentation/devicetree/bindings/gpu/adreno.txt +++ b/Documentation/devicetree/bindings/gpu/adreno.txt @@ -142,6 +142,9 @@ Optional Properties: rendering thread is running on masked CPUs. Bit 0 is for CPU-0, bit 1 is for CPU-1... +- qcom,l2pc-update-queue: + Disables L2PC on masked CPUs at queue time when it's true. + - qcom,snapshot-size: Specify the size of snapshot in bytes. This will override snapshot size defined in the driver code. diff --git a/Documentation/devicetree/bindings/soc/qcom/op_rf_cable_monitor.txt b/Documentation/devicetree/bindings/soc/qcom/op_rf_cable_monitor.txt deleted file mode 100644 index 3da1370476f6..000000000000 --- a/Documentation/devicetree/bindings/soc/qcom/op_rf_cable_monitor.txt +++ /dev/null @@ -1,9 +0,0 @@ -Op_rf_cable_monitor - -Required properties: -- compatible : should be "oem,rf_cable" - -Example: - oem_rf_cable { - compatible = "oem,rf_cable"; - }; \ No newline at end of file diff --git a/arch/arm64/configs/weebcustom_defconfig b/arch/arm64/configs/weebcustom_defconfig index f1635c485528..af588385bf42 100644 --- a/arch/arm64/configs/weebcustom_defconfig +++ b/arch/arm64/configs/weebcustom_defconfig @@ -125,7 +125,7 @@ CONFIG_RCU_NOCB_CPU_ALL=y CONFIG_BUILD_BIN2C=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_BUF_SHIFT=17 # CONFIG_CONSOLE_FLUSH_ON_HOTPLUG is not set CONFIG_LOG_CPU_MAX_BUF_SHIFT=17 CONFIG_GENERIC_SCHED_CLOCK=y @@ -133,8 +133,8 @@ CONFIG_GENERIC_SCHED_CLOCK=y # # FAIR Scheuler tunables # -# CONFIG_PELT_UTIL_HALFLIFE_32 is not set -CONFIG_PELT_UTIL_HALFLIFE_16=y +CONFIG_PELT_UTIL_HALFLIFE_32=y +# CONFIG_PELT_UTIL_HALFLIFE_16 is not set # CONFIG_PELT_UTIL_HALFLIFE_8 is not set CONFIG_CGROUPS=y # CONFIG_CGROUP_DEBUG is not set @@ -184,7 +184,7 @@ CONFIG_EXPERT=y CONFIG_UID16=y CONFIG_MULTIUSER=y # CONFIG_SGETMASK_SYSCALL is not set -# CONFIG_SYSFS_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y # CONFIG_SYSCTL_SYSCALL is not set CONFIG_KALLSYMS=y CONFIG_PRINTK=y @@ -336,7 +336,7 @@ CONFIG_FREEZER=y CONFIG_ARCH_QCOM=y # CONFIG_ARCH_MSM8996 is not set CONFIG_ARCH_MSM8998=y -CONFIG_ARCH_MSMHAMSTER=y +# CONFIG_ARCH_MSMHAMSTER is not set # CONFIG_ARCH_SDM660 is not set # CONFIG_ARCH_SDM630 is not set # CONFIG_ARCH_ROCKCHIP is not set @@ -410,7 +410,7 @@ CONFIG_HOTPLUG_CPU=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y CONFIG_ARCH_NR_GPIO=1024 -CONFIG_QCOM_TLB_EL2_HANDLER=y +# CONFIG_QCOM_TLB_EL2_HANDLER is not set # CONFIG_PREEMPT_NONE is not set # CONFIG_PREEMPT_VOLUNTARY is not set CONFIG_PREEMPT=y @@ -473,7 +473,7 @@ CONFIG_SPECULATIVE_PAGE_FAULT=y CONFIG_SECCOMP=y # CONFIG_XEN is not set CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_UNMAP_KERNEL_AT_EL0=y +# CONFIG_UNMAP_KERNEL_AT_EL0 is not set CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_ARMV8_DEPRECATED=y CONFIG_SWP_EMULATION=y @@ -551,7 +551,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y # CONFIG_CPU_IDLE_GOV_LADDER is not set -CONFIG_CPU_IDLE_GOV_MENU=y +# CONFIG_CPU_IDLE_GOV_MENU is not set # # ARM CPU Idle Drivers @@ -1103,16 +1103,7 @@ CONFIG_RFKILL_LEDS=y # CONFIG_NET_9P is not set # CONFIG_CAIF is not set # CONFIG_CEPH_LIB is not set -CONFIG_NFC=y -# CONFIG_NFC_DIGITAL is not set -# CONFIG_NFC_NCI is not set -# CONFIG_NFC_HCI is not set - -# -# Near Field Communication (NFC) devices -# -# CONFIG_NFC_PN533 is not set -# CONFIG_NFC_SIM is not set +# CONFIG_NFC is not set # CONFIG_NFC_NQ is not set CONFIG_NFC_PN5XX=y CONFIG_NFC_PN80T=y @@ -1137,7 +1128,7 @@ CONFIG_ARM_AMBA=y CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y +# CONFIG_FIRMWARE_IN_KERNEL is not set CONFIG_EXTRA_FIRMWARE="" CONFIG_FW_LOADER_USER_HELPER=y CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y @@ -1207,9 +1198,7 @@ CONFIG_BLK_DEV_LOOP_MIN_COUNT=16 # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_SKD is not set # CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=8192 +# CONFIG_BLK_DEV_RAM is not set # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_BLK_DEV_RBD is not set @@ -1247,7 +1236,7 @@ CONFIG_BLK_DEV_RAM_SIZE=8192 CONFIG_QSEECOM=y CONFIG_HDCP_QSEECOM=y # CONFIG_PROFILER is not set -CONFIG_BOOTLOADER_LOG=y +# CONFIG_BOOTLOADER_LOG is not set CONFIG_QPNP_MISC=y # CONFIG_C2PORT is not set @@ -1849,10 +1838,7 @@ CONFIG_JOYSTICK_XPAD=y # CONFIG_JOYSTICK_XPAD_LEDS is not set # CONFIG_INPUT_TABLET is not set CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_v21=y -CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_I2C_v21=y -# CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_SPI_v21 is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE_v21 is not set +# CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_v21 is not set CONFIG_OF_TOUCHSCREEN=y # CONFIG_TOUCHSCREEN_ADS7846 is not set # CONFIG_TOUCHSCREEN_AD7877 is not set @@ -1904,7 +1890,6 @@ CONFIG_OF_TOUCHSCREEN=y # CONFIG_TOUCHSCREEN_ZFORCE is not set # CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set # CONFIG_TOUCHSCREEN_MAXIM_STI is not set -CONFIG_SECURE_TOUCH=y # CONFIG_TOUCHSCREEN_GEN_VKEYS is not set # CONFIG_TOUCHSCREEN_FT5X06 is not set # CONFIG_TOUCHSCREEN_IT7260_I2C is not set @@ -1920,7 +1905,7 @@ CONFIG_INPUT_MISC=y # CONFIG_INPUT_AD714X is not set # CONFIG_INPUT_BMA150 is not set # CONFIG_INPUT_E3X0_BUTTON is not set -CONFIG_INPUT_HBTP_INPUT=y +# CONFIG_INPUT_HBTP_INPUT is not set # CONFIG_INPUT_PM8941_PWRKEY is not set CONFIG_INPUT_QPNP_POWER_ON=y # CONFIG_INPUT_MMA8450 is not set @@ -2711,15 +2696,15 @@ CONFIG_MSM_EEPROM=y CONFIG_MSM_ISPIF=y # CONFIG_MSM_ISPIF_V1 is not set # CONFIG_MSM_ISPIF_V2 is not set -CONFIG_IMX134=y -CONFIG_IMX132=y -CONFIG_OV9724=y -CONFIG_OV5648=y -CONFIG_GC0339=y -CONFIG_OV8825=y -CONFIG_OV8865=y -CONFIG_s5k4e1=y -CONFIG_OV12830=y +# CONFIG_IMX134 is not set +# CONFIG_IMX132 is not set +# CONFIG_OV9724 is not set +# CONFIG_OV5648 is not set +# CONFIG_GC0339 is not set +# CONFIG_OV8825 is not set +# CONFIG_OV8865 is not set +# CONFIG_s5k4e1 is not set +# CONFIG_OV12830 is not set CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE=y CONFIG_MSMB_JPEG=y CONFIG_MSM_FD=y @@ -2824,7 +2809,7 @@ CONFIG_FB_CFB_IMAGEBLIT=y # CONFIG_FB_SVGALIB is not set # CONFIG_FB_MACMODES is not set # CONFIG_FB_BACKLIGHT is not set -CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_MODE_HELPERS is not set # CONFIG_FB_TILEBLITTING is not set # @@ -2832,7 +2817,7 @@ CONFIG_FB_MODE_HELPERS=y # # CONFIG_FB_CIRRUS is not set # CONFIG_FB_PM2 is not set -CONFIG_FB_ARMCLCD=y +# CONFIG_FB_ARMCLCD is not set # CONFIG_FB_CYBER2000 is not set # CONFIG_FB_ASILIANT is not set # CONFIG_FB_IMSTT is not set @@ -2896,7 +2881,6 @@ CONFIG_FB_MSM_MDSS_KCAL_CTRL=y # CONFIG_BACKLIGHT_LCD_SUPPORT is not set # CONFIG_ADF is not set # CONFIG_VGASTATE is not set -CONFIG_VIDEOMODE_HELPERS=y # CONFIG_LOGO is not set CONFIG_KLAPSE=y CONFIG_SOUND=y @@ -3258,20 +3242,13 @@ CONFIG_USB_DEFAULT_PERSIST=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PCI=y CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_ROOT_HUB_TT is not set -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_MSM is not set -CONFIG_USB_EHCI_HCD_PLATFORM=y +# CONFIG_USB_EHCI_HCD is not set # CONFIG_USB_OXU210HP_HCD is not set # CONFIG_USB_ISP116X_HCD is not set # CONFIG_USB_ISP1362_HCD is not set # CONFIG_USB_FOTG210_HCD is not set # CONFIG_USB_MAX3421_HCD is not set -CONFIG_USB_OHCI_HCD=y -CONFIG_USB_OHCI_HCD_PCI=y -CONFIG_USB_OHCI_HCD_PLATFORM=y +# CONFIG_USB_OHCI_HCD is not set # CONFIG_USB_UHCI_HCD is not set # CONFIG_USB_SL811_HCD is not set # CONFIG_USB_R8A66597_HCD is not set @@ -3363,12 +3340,11 @@ CONFIG_QPNP_USB_PDPHY=y # CONFIG_USB_IDMOUSE is not set # CONFIG_USB_FTDI_ELAN is not set # CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set # CONFIG_USB_LD is not set # CONFIG_USB_TRANCEVIBRATOR is not set # CONFIG_USB_IOWARRIOR is not set # CONFIG_USB_TEST is not set -CONFIG_USB_EHSET_TEST_FIXTURE=y +# CONFIG_USB_EHSET_TEST_FIXTURE is not set # CONFIG_USB_ISIGHTFW is not set # CONFIG_USB_YUREX is not set # CONFIG_USB_EZUSB_FX2 is not set @@ -3830,6 +3806,7 @@ CONFIG_ION_MSM=y # CONFIG_QCA_CLD_WLAN=y CONFIG_QCACLD_WLAN_LFR3=y +# CONFIG_WLAN_FEATURE_FILS is not set CONFIG_PRIMA_WLAN_OKC=y CONFIG_PRIMA_WLAN_11AC_HIGH_TP=y CONFIG_WLAN_FEATURE_11W=y @@ -3838,6 +3815,7 @@ CONFIG_QCOM_VOWIFI_11R=y CONFIG_QCACLD_FEATURE_NAN=y CONFIG_WLAN_FEATURE_NAN_DATAPATH=y # CONFIG_QCACLD_FEATURE_GREEN_AP is not set +CONFIG_QCACLD_FEATURE_METERING=y CONFIG_HELIUMPLUS=y CONFIG_64BIT_PADDR=y CONFIG_QCOM_TDLS=y @@ -3879,7 +3857,7 @@ CONFIG_GPIO_USB_DETECT=y CONFIG_MSM_MHI=y CONFIG_MSM_MHI_UCI=y # CONFIG_MSM_MHI_DEBUG is not set -CONFIG_MSM_11AD=y +# CONFIG_MSM_11AD is not set # CONFIG_SEEMP_CORE is not set CONFIG_USB_BAM=y CONFIG_MSM_EXT_DISPLAY=y @@ -3998,8 +3976,7 @@ CONFIG_MSM_SECURE_BUFFER=y # CONFIG_MSM_CORE_HANG_DETECT is not set CONFIG_MSM_RUN_QUEUE_STATS=y # CONFIG_MSM_JTAGV8 is not set -CONFIG_MSM_BOOT_STATS=y -# CONFIG_MSM_BOOT_TIME_MARKER is not set +# CONFIG_MSM_BOOT_STATS is not set # CONFIG_QCOM_CPUSS_DUMP is not set # CONFIG_MSM_QDSP6_APRV2 is not set # CONFIG_MSM_QDSP6_APRV3 is not set @@ -4011,8 +3988,7 @@ CONFIG_MSM_QDSP6_NOTIFIER=y CONFIG_MSM_ADSP_LOADER=y # CONFIG_MSM_CDSP_LOADER is not set # CONFIG_MSM_LPASS_RESOURCE_MANAGER is not set -CONFIG_MSM_PERFORMANCE=y -# CONFIG_MSM_PERFORMANCE_HOTPLUG_ON is not set +# CONFIG_MSM_PERFORMANCE is not set CONFIG_MSM_SUBSYSTEM_RESTART=y # CONFIG_MSM_SYSMON_COMM is not set CONFIG_MSM_PIL=y @@ -4025,13 +4001,12 @@ CONFIG_MSM_EVENT_TIMER=y CONFIG_MSM_AVTIMER=y # CONFIG_MSM_KERNEL_PROTECT is not set CONFIG_MSM_SERVICE_NOTIFIER=y -CONFIG_MSM_QBT1000=y -CONFIG_MSM_RPM_STATS_LOG=y +# CONFIG_MSM_QBT1000 is not set +# CONFIG_MSM_RPM_STATS_LOG is not set CONFIG_QSEE_IPC_IRQ_BRIDGE=y CONFIG_WCD_DSP_GLINK=y CONFIG_QCOM_SMCINVOKE=y CONFIG_QCOM_EARLY_RANDOM=y -# CONFIG_RF_CABLE_DETECT is not set # CONFIG_QCOM_CX_IPEAK is not set # CONFIG_MSM_CACHE_M4M_ERP64_PANIC_ON_CE is not set # CONFIG_MSM_CACHE_M4M_ERP64_PANIC_ON_UE is not set @@ -4377,7 +4352,7 @@ CONFIG_DCACHE_WORD_ACCESS=y # CONFIG_EXT2_FS is not set # CONFIG_EXT3_FS is not set CONFIG_EXT4_FS=y -# CONFIG_EXT4_USE_FOR_EXT2 is not set +CONFIG_EXT4_USE_FOR_EXT2=y # CONFIG_EXT4_FS_POSIX_ACL is not set CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y @@ -4437,13 +4412,11 @@ CONFIG_FUSE_FS=y # DOS/FAT/NT Filesystems # CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y +# CONFIG_MSDOS_FS is not set CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -CONFIG_NTFS_FS=y -# CONFIG_NTFS_DEBUG is not set -CONFIG_NTFS_RW=y +# CONFIG_NTFS_FS is not set CONFIG_EXFAT_FS=y CONFIG_EXFAT_DISCARD=y # CONFIG_EXFAT_DELAYED_SYNC is not set @@ -4493,18 +4466,10 @@ CONFIG_SDCARD_FS=y CONFIG_PSTORE=y CONFIG_PSTORE_CONSOLE=y CONFIG_PSTORE_PMSG=y -CONFIG_PSTORE_DEVICE_INFO=y CONFIG_PSTORE_RAM=y # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NFS_FS is not set -# CONFIG_NFSD is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set CONFIG_NLS=y CONFIG_NLS_DEFAULT="iso8859-1" CONFIG_NLS_CODEPAGE_437=y @@ -4652,6 +4617,7 @@ CONFIG_TRACING_SUPPORT=y # CONFIG_MEMTEST is not set # CONFIG_PANIC_ON_DATA_CORRUPTION is not set # CONFIG_BUG_ON_DATA_CORRUPTION is not set +# CONFIG_CC_WERROR is not set # CONFIG_SAMPLES is not set CONFIG_HAVE_ARCH_KGDB=y CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y @@ -4819,9 +4785,9 @@ CONFIG_CRYPTO_DEFLATE=y # CONFIG_CRYPTO_ZLIB is not set CONFIG_CRYPTO_LZO=y # CONFIG_CRYPTO_842 is not set -CONFIG_CRYPTO_LZ4=y +# CONFIG_CRYPTO_LZ4 is not set # CONFIG_CRYPTO_LZ4HC is not set -CONFIG_CRYPTO_ZSTD=y +# CONFIG_CRYPTO_ZSTD is not set # # Random Number Generation @@ -4899,17 +4865,12 @@ CONFIG_CRC32_SLICEBY8=y # CONFIG_CRC7 is not set CONFIG_LIBCRC32C=y # CONFIG_CRC8 is not set -CONFIG_XXHASH=y CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y # CONFIG_RANDOM32_SELFTEST is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_COMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_ZSTD_COMPRESS=y -CONFIG_ZSTD_DECOMPRESS=y # CONFIG_XZ_DEC is not set # CONFIG_XZ_DEC_BCJ is not set CONFIG_DECOMPRESS_GZIP=y diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 5295ea9b9730..c1093c0d4dea 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -312,7 +312,6 @@ static const char * const fw_path[] = { "/lib/firmware/updates", "/lib/firmware/" UTS_RELEASE, "/lib/firmware", - "/vendor/etc/firmware", "/lib64/firmware" }; diff --git a/drivers/cpufreq/cpu_input_boost.c b/drivers/cpufreq/cpu_input_boost.c index c6fe316c6e20..7497ffad0d06 100644 --- a/drivers/cpufreq/cpu_input_boost.c +++ b/drivers/cpufreq/cpu_input_boost.c @@ -169,6 +169,7 @@ void cpu_input_boost_kick_max(unsigned int duration_ms) { struct boost_drv *b = &boost_drv_g; + energy_aware_enable = false; __cpu_input_boost_kick_max(b, duration_ms); } @@ -186,6 +187,8 @@ static void max_unboost_worker(struct work_struct *work) struct boost_drv *b = container_of(to_delayed_work(work), typeof(*b), max_unboost); + energy_aware_enable = true; + clear_bit(MAX_BOOST, &b->state); wake_up(&b->boost_waitq); } diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index 8c7930b5a65f..5ad10b23f74d 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -3,8 +3,6 @@ menu "CPU Idle" config CPU_IDLE bool "CPU idle PM support" default y if ACPI || PPC_PSERIES - select CPU_IDLE_GOV_LADDER if (!NO_HZ && !NO_HZ_IDLE) - select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE) help CPU idle is a generic framework for supporting software-controlled idle processor power management. It includes modular cross-platform diff --git a/drivers/crypto/msm/ice.c b/drivers/crypto/msm/ice.c index 90b4df15d5c3..6a604204ed08 100644 --- a/drivers/crypto/msm/ice.c +++ b/drivers/crypto/msm/ice.c @@ -125,6 +125,9 @@ static int qti_ice_setting_config(struct request *req, return -EPERM; } + if (!setting) + return -EINVAL; + if ((short)(crypto_data->key_index) >= 0) { memcpy(&setting->crypto_data, crypto_data, @@ -215,8 +218,6 @@ static int qcom_ice_bus_register(struct ice_device *ice_dev) } err = 0; - /* register again only if we didn't register previously */ - if (!ice_dev->bus_vote.client_handle) { ice_dev->bus_vote.client_handle = msm_bus_scale_register_client(bus_pdata); if (!ice_dev->bus_vote.client_handle) { @@ -224,7 +225,6 @@ static int qcom_ice_bus_register(struct ice_device *ice_dev) __func__); err = -EFAULT; goto out; - } } /* cache the vote index for minimum and maximum bandwidth */ @@ -1615,6 +1615,8 @@ static struct ice_device *get_ice_device_from_storage_type list_for_each_entry(ice_dev, &ice_devices, list) { if (!strcmp(ice_dev->ice_instance_type, storage_type)) { + pr_debug("%s: found ice device %pK\n", + __func__, ice_dev); return ice_dev; } } diff --git a/drivers/crypto/msm/qce50.c b/drivers/crypto/msm/qce50.c index c7b66a241580..79fc18d10362 100644 --- a/drivers/crypto/msm/qce50.c +++ b/drivers/crypto/msm/qce50.c @@ -227,10 +227,8 @@ static int qce_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, { int i; - for (i = 0; i < nents; ++i) { + for_each_sg(sg, sg, nents, i) dma_map_sg(dev, sg, 1, direction); - sg = sg_next(sg); - } return nents; } @@ -240,10 +238,8 @@ static int qce_dma_unmap_sg(struct device *dev, struct scatterlist *sg, { int i; - for (i = 0; i < nents; ++i) { + for_each_sg(sg, sg, nents, i) dma_unmap_sg(dev, sg, 1, direction); - sg = sg_next(sg); - } return nents; } diff --git a/drivers/crypto/msm/qcrypto.c b/drivers/crypto/msm/qcrypto.c index 7ddda8b6248e..ff4277265b39 100644 --- a/drivers/crypto/msm/qcrypto.c +++ b/drivers/crypto/msm/qcrypto.c @@ -742,14 +742,13 @@ static size_t qcrypto_sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen) { int i; - size_t offset, len; + size_t offset = 0, len; - for (i = 0, offset = 0; i < nents; ++i) { + for_each_sg(sgl, sgl, nents, i) { len = sg_copy_from_buffer(sgl, 1, buf, buflen); buf += len; buflen -= len; offset += len; - sgl = sg_next(sgl); } return offset; @@ -759,14 +758,13 @@ static size_t qcrypto_sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, size_t buflen) { int i; - size_t offset, len; + size_t offset = 0, len; - for (i = 0, offset = 0; i < nents; ++i) { + for_each_sg(sgl, sgl, nents, i) { len = sg_copy_to_buffer(sgl, 1, buf, buflen); buf += len; buflen -= len; offset += len; - sgl = sg_next(sgl); } return offset; diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index e674d536f74d..db8f0eeca7c9 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -273,10 +273,8 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) unsigned long flags; bool attached; - if (!edev) { - dev_err(&edev->dev, "enval err\n"); + if (!edev) return -EINVAL; - } spin_lock_irqsave(&edev->lock, flags); @@ -286,7 +284,6 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) if (check_mutually_exclusive(edev, (edev->state & ~mask) | (state & mask))) { spin_unlock_irqrestore(&edev->lock, flags); - dev_err(&edev->dev, "out because of mutually_exclusive\n"); return -EPERM; } @@ -296,12 +293,9 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) for (index = 0; index < edev->max_supported; index++) { if (is_extcon_changed(old_state, edev->state, index, - &attached)) { - dev_err(&edev->dev, "index=%d,attached=%d\n", - index, attached); + &attached)) raw_notifier_call_chain(&edev->nh[index], attached, edev); - } } /* This could be in interrupt handler */ @@ -418,21 +412,15 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, u32 state; int index; - if (!edev) { - dev_err(&edev->dev, "dev enval err\n"); + if (!edev) return -EINVAL; - } index = find_cable_index_by_id(edev, id); - if (index < 0) { - dev_err(&edev->dev, "index is valid\n"); + if (index < 0) return index; - } - if (edev->max_supported && edev->max_supported <= index) { - dev_err(&edev->dev, "index is larger than max_supported\n"); + if (edev->max_supported && edev->max_supported <= index) return -EINVAL; - } state = cable_state ? (1 << index) : 0; return extcon_update_state(edev, 1 << index, state); @@ -604,7 +592,6 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id, return -EINVAL; idx = find_cable_index_by_id(edev, id); - dev_err(&edev->dev, "register nt id:%d(%d)\n", id, idx); spin_lock_irqsave(&edev->lock, flags); ret = raw_notifier_chain_register(&edev->nh[idx], nb); diff --git a/drivers/firmware/qcom/tz_log.c b/drivers/firmware/qcom/tz_log.c index 8243ee013d69..323e32c3345a 100644 --- a/drivers/firmware/qcom/tz_log.c +++ b/drivers/firmware/qcom/tz_log.c @@ -24,8 +24,6 @@ #include #include -#include - #include #include @@ -555,7 +553,6 @@ static int _disp_tz_interrupt_stats(void) tzdbg.stat[TZDBG_INTERRUPT].data = tzdbg.disp_buf; return len; } -#endif static int _disp_tz_log_stats_legacy(void) { @@ -641,7 +638,6 @@ static int _disp_log_stats(struct tzdbg_log_t *log, return len; } -#ifdef CONFIG_DEBUG_FS static int __disp_hyp_log_stats(uint8_t *log, struct hypdbg_log_pos_t *log_start, uint32_t log_len, size_t count, uint32_t buf_idx) @@ -713,7 +709,6 @@ static int __disp_hyp_log_stats(uint8_t *log, tzdbg.stat[buf_idx].data = tzdbg.disp_buf; return len; } -#endif static int _disp_tz_log_stats(size_t count) { @@ -727,7 +722,6 @@ static int _disp_tz_log_stats(size_t count) tzdbg.diag_buf->ring_len, count, TZDBG_LOG); } -#ifdef CONFIG_DEBUG_FS static int _disp_hyp_log_stats(size_t count) { static struct hypdbg_log_pos_t log_start = {0}; @@ -739,7 +733,6 @@ static int _disp_hyp_log_stats(size_t count) return __disp_hyp_log_stats(log_ptr, &log_start, tzdbg.hyp_debug_rw_buf_size, count, TZDBG_HYP_LOG); } -#endif static int _disp_qsee_log_stats(size_t count) { @@ -750,7 +743,6 @@ static int _disp_qsee_log_stats(size_t count) count, TZDBG_QSEE_LOG); } -#ifdef CONFIG_DEBUG_FS static int _disp_hyp_general_stats(size_t count) { int len = 0; @@ -952,95 +944,6 @@ static void tzdbg_register_qsee_log_buf(void) g_ion_clnt = NULL; } -static ssize_t proc_qsee_log_func(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) -{ - int len = 0; - memcpy_fromio((void *)tzdbg.diag_buf, tzdbg.virt_iobase, - debug_rw_buf_size); - memcpy_fromio((void *)tzdbg.hyp_diag_buf, tzdbg.hyp_virt_iobase, - tzdbg.hyp_debug_rw_buf_size); - len = _disp_qsee_log_stats(count); - *ppos = 0; - - if (len > count) - len = count; - - return simple_read_from_buffer(user_buf, len, ppos, tzdbg.stat[6].data, len); -} - - -static const struct file_operations proc_qsee_log_fops = { - .read = proc_qsee_log_func, - .open = simple_open, - .owner = THIS_MODULE, -}; - -static ssize_t proc_tz_log_func(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) -{ - int len = 0; - memcpy_fromio((void *)tzdbg.diag_buf, tzdbg.virt_iobase, - debug_rw_buf_size); - memcpy_fromio((void *)tzdbg.hyp_diag_buf, tzdbg.hyp_virt_iobase, - tzdbg.hyp_debug_rw_buf_size); - - if (TZBSP_DIAG_MAJOR_VERSION_LEGACY < - (tzdbg.diag_buf->version >> 16)) { - len = _disp_tz_log_stats(count); - *ppos = 0; - } else { - len = _disp_tz_log_stats_legacy(); - } - - if (len > count) - len = count; - - return simple_read_from_buffer(user_buf, len, ppos, tzdbg.stat[5].data, len); -} - -static const struct file_operations proc_tz_log_fops = { - .read = proc_tz_log_func, - .open = simple_open, - .owner = THIS_MODULE, -}; - -static int tzprocfs_init(struct platform_device *pdev) -{ - - int rc = 0; - struct proc_dir_entry *prEntry_tmp = NULL; - struct proc_dir_entry *prEntry_dir = NULL; - - prEntry_dir = proc_mkdir("tzdbg", NULL); - - if (prEntry_dir == NULL) { - dev_err(&pdev->dev, "tzdbg procfs_create_dir failed\n"); - return -ENOMEM; - } - - prEntry_tmp = proc_create("qsee_log", 0666, prEntry_dir, &proc_qsee_log_fops); - - if (prEntry_tmp == NULL) { - dev_err(&pdev->dev, "TZ procfs_create_file qsee_log failed\n"); - rc = -ENOMEM; - goto err; - } - - prEntry_tmp = proc_create("tz_log", 0666, prEntry_dir, &proc_tz_log_fops); - - if (prEntry_tmp == NULL) { - dev_err(&pdev->dev, "TZ procfs_create_file tz_log failed\n"); - rc = -ENOMEM; - goto err; - } - - return 0; -err: - proc_remove(prEntry_dir); - - return rc; -} - - static int tzdbgfs_init(struct platform_device *pdev) { int rc = 0; @@ -1258,9 +1161,6 @@ static int tz_log_probe(struct platform_device *pdev) if (tzdbgfs_init(pdev)) goto err; - if (tzprocfs_init(pdev)) - goto err; - tzdbg_register_qsee_log_buf(); tzdbg_get_tz_version(); diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 005a869c94ca..8519d09846a6 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1162,6 +1162,10 @@ static int _adreno_start(struct adreno_device *adreno_dev) /* make sure ADRENO_DEVICE_STARTED is not set here */ BUG_ON(test_bit(ADRENO_DEVICE_STARTED, &adreno_dev->priv)); + /* disallow l2pc during wake up to improve GPU wake up time */ + kgsl_pwrctrl_update_l2pc(&adreno_dev->dev, + KGSL_L2PC_WAKEUP_TIMEOUT); + pm_qos_update_request(&device->pwrctrl.pm_qos_req_dma, pmqos_wakeup_vote); @@ -2559,6 +2563,9 @@ static void adreno_iommu_sync(struct kgsl_device *device, bool sync) struct scm_desc desc = {0}; int ret; + if (!ADRENO_QUIRK(ADRENO_DEVICE(device), ADRENO_QUIRK_IOMMU_SYNC)) + return; + if (sync == true) { mutex_lock(&kgsl_mmu_sync); desc.args[0] = true; @@ -2575,25 +2582,29 @@ static void adreno_iommu_sync(struct kgsl_device *device, bool sync) } } -static void _regulator_disable(struct kgsl_regulator *regulator, bool poll) +static void +_regulator_disable(struct kgsl_regulator *regulator, unsigned int timeout) { - unsigned long wait_time = jiffies + msecs_to_jiffies(200); + unsigned long wait_time; if (IS_ERR_OR_NULL(regulator->reg)) return; regulator_disable(regulator->reg); - if (poll == false) - return; + wait_time = jiffies + msecs_to_jiffies(timeout); + /* Poll for regulator status to ensure it's OFF */ while (!time_after(jiffies, wait_time)) { if (!regulator_is_enabled(regulator->reg)) return; - cpu_relax(); + usleep_range(10, 100); } - KGSL_CORE_ERR("regulator '%s' still on after 200ms\n", regulator->name); + if (!regulator_is_enabled(regulator->reg)) + return; + + KGSL_CORE_ERR("regulator '%s' disable timed out\n", regulator->name); } static void adreno_regulator_disable_poll(struct kgsl_device *device) @@ -2601,18 +2612,13 @@ static void adreno_regulator_disable_poll(struct kgsl_device *device) struct adreno_device *adreno_dev = ADRENO_DEVICE(device); struct kgsl_pwrctrl *pwr = &device->pwrctrl; int i; - - /* Fast path - hopefully we don't need this quirk */ - if (!ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_IOMMU_SYNC)) { - for (i = KGSL_MAX_REGULATORS - 1; i >= 0; i--) - _regulator_disable(&pwr->regulators[i], false); - return; - } + unsigned int timeout = + ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_IOMMU_SYNC) ? 200 : 5000; adreno_iommu_sync(device, true); - for (i = 0; i < KGSL_MAX_REGULATORS; i++) - _regulator_disable(&pwr->regulators[i], true); + for (i = KGSL_MAX_REGULATORS - 1; i >= 0; i--) + _regulator_disable(&pwr->regulators[i], timeout); adreno_iommu_sync(device, false); } @@ -2705,6 +2711,7 @@ static struct platform_driver adreno_platform_driver = { .name = DEVICE_3D_NAME, .pm = &kgsl_pm_ops, .of_match_table = adreno_match_table, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, } }; diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c index 26fec5bd6d74..e73fe71d3067 100644 --- a/drivers/gpu/msm/adreno_dispatch.c +++ b/drivers/gpu/msm/adreno_dispatch.c @@ -648,6 +648,17 @@ static int sendcmd(struct adreno_device *adreno_dev, secs = time.ktime; nsecs = do_div(secs, 1000000000); + /* + * For the first submission in any given command queue update the + * expected expire time - this won't actually be used / updated until + * the command queue in question goes current, but universally setting + * it here avoids the possibilty of some race conditions with preempt + */ + + if (dispatch_q->inflight == 1) + dispatch_q->expires = jiffies + + msecs_to_jiffies(adreno_drawobj_timeout); + trace_adreno_cmdbatch_submitted(drawobj, (int) dispatcher->inflight, time.ticks, (unsigned long) secs, nsecs / 1000, drawctxt->rb, adreno_get_rptr(drawctxt->rb)); @@ -660,17 +671,6 @@ static int sendcmd(struct adreno_device *adreno_dev, dispatch_q->tail = (dispatch_q->tail + 1) % ADRENO_DISPATCH_DRAWQUEUE_SIZE; - /* - * For the first submission in any given command queue update the - * expected expire time - this won't actually be used / updated until - * the command queue in question goes current, but universally setting - * it here avoids the possibilty of some race conditions with preempt - */ - - if (dispatch_q->inflight == 1) - dispatch_q->expires = jiffies + - msecs_to_jiffies(adreno_drawobj_timeout); - /* * If we believe ourselves to be current and preemption isn't a thing, * then set up the timer. If this misses, then preemption is indeed a @@ -1368,6 +1368,22 @@ int adreno_dispatcher_queue_cmds(struct kgsl_device_private *dev_priv, user_ts = *timestamp; + /* + * If there is only one drawobj in the array and it is of + * type SYNCOBJ_TYPE, skip comparing user_ts as it can be 0 + */ + if (!(count == 1 && drawobj[0]->type == SYNCOBJ_TYPE) && + (drawctxt->base.flags & KGSL_CONTEXT_USER_GENERATED_TS)) { + /* + * User specified timestamps need to be greater than the last + * issued timestamp in the context + */ + if (timestamp_cmp(drawctxt->timestamp, user_ts) >= 0) { + spin_unlock(&drawctxt->lock); + return -ERANGE; + } + } + for (i = 0; i < count; i++) { switch (drawobj[i]->type) { @@ -1423,7 +1439,9 @@ int adreno_dispatcher_queue_cmds(struct kgsl_device_private *dev_priv, spin_unlock(&drawctxt->lock); - kgsl_pwrctrl_update_l2pc(&adreno_dev->dev); + if (device->pwrctrl.l2pc_update_queue) + kgsl_pwrctrl_update_l2pc(&adreno_dev->dev, + KGSL_L2PC_QUEUE_TIMEOUT); /* Add the context to the dispatcher pending list */ dispatcher_queue_context(adreno_dev, drawctxt); diff --git a/drivers/gpu/msm/adreno_trace.h b/drivers/gpu/msm/adreno_trace.h index 05250fa7c9a3..ea6239541fcc 100644 --- a/drivers/gpu/msm/adreno_trace.h +++ b/drivers/gpu/msm/adreno_trace.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2019, 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 @@ -600,15 +600,15 @@ TRACE_EVENT(adreno_preempt_trigger, TP_PROTO(struct adreno_ringbuffer *cur, struct adreno_ringbuffer *next), TP_ARGS(cur, next), TP_STRUCT__entry( - __field(struct adreno_ringbuffer *, cur) - __field(struct adreno_ringbuffer *, next) + __field(unsigned int, cur) + __field(unsigned int, next) ), TP_fast_assign( - __entry->cur = cur; - __entry->next = next; + __entry->cur = cur->id; + __entry->next = next->id; ), TP_printk("trigger from id=%d to id=%d", - __entry->cur->id, __entry->next->id + __entry->cur, __entry->next ) ); @@ -616,15 +616,15 @@ TRACE_EVENT(adreno_preempt_done, TP_PROTO(struct adreno_ringbuffer *cur, struct adreno_ringbuffer *next), TP_ARGS(cur, next), TP_STRUCT__entry( - __field(struct adreno_ringbuffer *, cur) - __field(struct adreno_ringbuffer *, next) + __field(unsigned int, cur) + __field(unsigned int, next) ), TP_fast_assign( - __entry->cur = cur; - __entry->next = next; + __entry->cur = cur->id; + __entry->next = next->id; ), TP_printk("done switch to id=%d from id=%d", - __entry->next->id, __entry->cur->id + __entry->next, __entry->cur ) ); #endif /* _ADRENO_TRACE_H */ diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index 7faa82131a3f..9867c518aea0 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -1913,7 +1913,7 @@ static long gpumem_free_entry_on_timestamp(struct kgsl_device *device, kgsl_readtimestamp(device, context, KGSL_TIMESTAMP_RETIRED, &temp); trace_kgsl_mem_timestamp_queue(device, entry, context->id, temp, timestamp); - ret = kgsl_add_event(device, &context->events, + ret = kgsl_add_low_prio_event(device, &context->events, timestamp, gpumem_free_func, entry); if (ret) @@ -2563,7 +2563,7 @@ static int kgsl_setup_dma_buf(struct kgsl_device *device, struct kgsl_mem_entry *entry, struct dma_buf *dmabuf) { - int ret = 0; + int i, ret = 0; struct scatterlist *s; struct sg_table *sg_table; struct dma_buf_attachment *attach = NULL; @@ -2603,7 +2603,7 @@ static int kgsl_setup_dma_buf(struct kgsl_device *device, entry->memdesc.sgt = sg_table; /* Calculate the size of the memdesc from the sglist */ - for (s = entry->memdesc.sgt->sgl; s != NULL; s = sg_next(s)) { + for_each_sg(sg_table->sgl, s, sg_table->nents, i) { int priv = (entry->memdesc.priv & KGSL_MEMDESC_SECURE) ? 1 : 0; /* @@ -4968,6 +4968,18 @@ static void kgsl_core_exit(void) unregister_chrdev_region(kgsl_driver.major, KGSL_DEVICE_MAX); } +static long kgsl_run_one_worker(struct kthread_worker *worker, + struct task_struct **thread, const char *name) +{ + init_kthread_worker(worker); + *thread = kthread_run(kthread_worker_fn, worker, name); + if (IS_ERR(*thread)) { + pr_err("unable to start %s\n", name); + return PTR_ERR(thread); + } + return 0; +} + static int __init kgsl_core_init(void) { int result = 0; @@ -5038,17 +5050,16 @@ static int __init kgsl_core_init(void) kgsl_driver.mem_workqueue = alloc_workqueue("kgsl-mementry", WQ_UNBOUND | WQ_MEM_RECLAIM, 0); - init_kthread_worker(&kgsl_driver.worker); - - kgsl_driver.worker_thread = kthread_run(kthread_worker_fn, - &kgsl_driver.worker, "kgsl_worker_thread"); - - if (IS_ERR(kgsl_driver.worker_thread)) { - pr_err("unable to start kgsl thread\n"); + if (IS_ERR_VALUE(kgsl_run_one_worker(&kgsl_driver.worker, + &kgsl_driver.worker_thread, + "kgsl_worker_thread")) || + IS_ERR_VALUE(kgsl_run_one_worker(&kgsl_driver.low_prio_worker, + &kgsl_driver.low_prio_worker_thread, + "kgsl_low_prio_worker_thread"))) goto err; - } sched_setscheduler(kgsl_driver.worker_thread, SCHED_FIFO, ¶m); + /* kgsl_driver.low_prio_worker_thread should not be SCHED_FIFO */ kgsl_events_init(); diff --git a/drivers/gpu/msm/kgsl.h b/drivers/gpu/msm/kgsl.h index 6b8ef82d340f..2ffbb92b9d56 100644 --- a/drivers/gpu/msm/kgsl.h +++ b/drivers/gpu/msm/kgsl.h @@ -155,7 +155,9 @@ struct kgsl_driver { struct workqueue_struct *workqueue; struct workqueue_struct *mem_workqueue; struct kthread_worker worker; + struct kthread_worker low_prio_worker; struct task_struct *worker_thread; + struct task_struct *low_prio_worker_thread; }; extern struct kgsl_driver kgsl_driver; @@ -286,6 +288,14 @@ struct kgsl_event_group; typedef void (*kgsl_event_func)(struct kgsl_device *, struct kgsl_event_group *, void *, int); +enum kgsl_priority { + KGSL_EVENT_REGULAR_PRIORITY = 0, + KGSL_EVENT_LOW_PRIORITY, + KGSL_EVENT_NUM_PRIORITIES +}; + +const char *prio_to_string(enum kgsl_priority prio); + /** * struct kgsl_event - KGSL GPU timestamp event * @device: Pointer to the KGSL device that owns the event @@ -309,6 +319,7 @@ struct kgsl_event { unsigned int created; struct kthread_work work; int result; + enum kgsl_priority prio; struct kgsl_event_group *group; }; diff --git a/drivers/gpu/msm/kgsl_device.h b/drivers/gpu/msm/kgsl_device.h index db7ba5c9d589..348fc12c7df5 100644 --- a/drivers/gpu/msm/kgsl_device.h +++ b/drivers/gpu/msm/kgsl_device.h @@ -644,8 +644,11 @@ bool kgsl_event_pending(struct kgsl_device *device, kgsl_event_func func, void *priv); int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, unsigned int timestamp, kgsl_event_func func, void *priv); +int kgsl_add_low_prio_event(struct kgsl_device *device, + struct kgsl_event_group *group, unsigned int timestamp, + kgsl_event_func func, void *priv); void kgsl_process_event_group(struct kgsl_device *device, - struct kgsl_event_group *group); + struct kgsl_event_group *group); void kgsl_flush_event_group(struct kgsl_device *device, struct kgsl_event_group *group); void kgsl_process_event_groups(struct kgsl_device *device); diff --git a/drivers/gpu/msm/kgsl_events.c b/drivers/gpu/msm/kgsl_events.c index 64c38fe1b6d3..9683b9d1d28d 100644 --- a/drivers/gpu/msm/kgsl_events.c +++ b/drivers/gpu/msm/kgsl_events.c @@ -32,7 +32,23 @@ static inline void signal_event(struct kgsl_device *device, { list_del(&event->node); event->result = result; - queue_kthread_work(&kgsl_driver.worker, &event->work); + if (event->prio == KGSL_EVENT_LOW_PRIORITY) + queue_kthread_work(&kgsl_driver.low_prio_worker, &event->work); + else + queue_kthread_work(&kgsl_driver.worker, &event->work); +} + +static const char *priorities[KGSL_EVENT_NUM_PRIORITIES] = { + "KGSL_EVENT_REGULAR_PRIORITY", + "KGSL_EVENT_LOW_PRIORITY" +}; + +const char *prio_to_string(enum kgsl_priority prio) +{ + if (prio < KGSL_EVENT_NUM_PRIORITIES) + return priorities[prio]; + else + return ""; } /** @@ -47,7 +63,7 @@ static void _kgsl_event_worker(struct kthread_work *work) struct kgsl_event *event = container_of(work, struct kgsl_event, work); trace_kgsl_fire_event(id, event->timestamp, event->result, - jiffies - event->created, event->func); + jiffies - event->created, event->func, event->prio); event->func(event->device, event->group, event->priv, event->result); @@ -231,16 +247,10 @@ bool kgsl_event_pending(struct kgsl_device *device, spin_unlock(&group->lock); return result; } -/** - * kgsl_add_event() - Add a new GPU event to a group - * @device: Pointer to a KGSL device - * @group: Pointer to the group to add the event to - * @timestamp: Timestamp that the event will expire on - * @func: Callback function for the event - * @priv: Private data to send to the callback function - */ -int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, - unsigned int timestamp, kgsl_event_func func, void *priv) + +static int kgsl_add_event_common(struct kgsl_device *device, + struct kgsl_event_group *group, unsigned int timestamp, + kgsl_event_func func, void *priv, enum kgsl_priority prio) { unsigned int queued; struct kgsl_context *context = group->context; @@ -280,10 +290,12 @@ int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, event->func = func; event->created = jiffies; event->group = group; + event->prio = prio; init_kthread_work(&event->work, _kgsl_event_worker); - trace_kgsl_register_event(KGSL_CONTEXT_ID(context), timestamp, func); + trace_kgsl_register_event( + KGSL_CONTEXT_ID(context), timestamp, func, prio); spin_lock(&group->lock); @@ -296,7 +308,11 @@ int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, if (timestamp_cmp(retired, timestamp) >= 0) { event->result = KGSL_EVENT_RETIRED; - queue_kthread_work(&kgsl_driver.worker, &event->work); + if (prio == KGSL_EVENT_LOW_PRIORITY) + queue_kthread_work( + &kgsl_driver.low_prio_worker, &event->work); + else + queue_kthread_work(&kgsl_driver.worker, &event->work); spin_unlock(&group->lock); return 0; } @@ -308,8 +324,32 @@ int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, return 0; } + +/** + * kgsl_add_event() - Add a new GPU event to a group + * @device: Pointer to a KGSL device + * @group: Pointer to the group to add the event to + * @timestamp: Timestamp that the event will expire on + * @func: Callback function for the event + * @priv: Private data to send to the callback function + */ +int kgsl_add_event(struct kgsl_device *device, struct kgsl_event_group *group, + unsigned int timestamp, kgsl_event_func func, void *priv) +{ + return kgsl_add_event_common(device, group, timestamp, func, priv, + KGSL_EVENT_REGULAR_PRIORITY); +} EXPORT_SYMBOL(kgsl_add_event); +int kgsl_add_low_prio_event( + struct kgsl_device *device, struct kgsl_event_group *group, + unsigned int timestamp, kgsl_event_func func, void *priv) +{ + return kgsl_add_event_common(device, group, timestamp, func, priv, + KGSL_EVENT_LOW_PRIORITY); +} +EXPORT_SYMBOL(kgsl_add_low_prio_event); + static DEFINE_RWLOCK(group_lock); static LIST_HEAD(group_list); @@ -385,11 +425,11 @@ static void events_debugfs_print_group(struct seq_file *s, group->readtimestamp(event->device, group->priv, KGSL_TIMESTAMP_RETIRED, &retired); - seq_printf(s, "\t%d:%d age=%lu func=%ps [retired=%d]\n", + seq_printf(s, "\t%u:%u age=%lu func=%ps [retired=%d] prio=%s\n", group->context ? group->context->id : - KGSL_MEMSTORE_GLOBAL, + KGSL_MEMSTORE_GLOBAL, event->timestamp, jiffies - event->created, - event->func, retired); + event->func, retired, prio_to_string(event->prio)); } spin_unlock(&group->lock); } diff --git a/drivers/gpu/msm/kgsl_pwrctrl.c b/drivers/gpu/msm/kgsl_pwrctrl.c index 25cd47af163f..1a0e372abb54 100644 --- a/drivers/gpu/msm/kgsl_pwrctrl.c +++ b/drivers/gpu/msm/kgsl_pwrctrl.c @@ -43,13 +43,6 @@ #define DEFAULT_BUS_P 25 -/* - * The effective duration of qos request in usecs. After - * timeout, qos request is cancelled automatically. - * Kept 64ms default, inline with default GPU idle time. - */ -#define KGSL_L2PC_CPU_TIMEOUT (64 * 1000) - /* Order deeply matters here because reasons. New entries go on the end */ static const char * const clocks[] = { "src_clk", @@ -521,12 +514,14 @@ EXPORT_SYMBOL(kgsl_pwrctrl_set_constraint); /** * kgsl_pwrctrl_update_l2pc() - Update existing qos request * @device: Pointer to the kgsl_device struct + * @timeout_us: the effective duration of qos request in usecs. * * Updates an existing qos request to avoid L2PC on the * CPUs (which are selected through dtsi) on which GPU * thread is running. This would help for performance. */ -void kgsl_pwrctrl_update_l2pc(struct kgsl_device *device) +void kgsl_pwrctrl_update_l2pc(struct kgsl_device *device, + unsigned long timeout_us) { int cpu; @@ -540,7 +535,7 @@ void kgsl_pwrctrl_update_l2pc(struct kgsl_device *device) pm_qos_update_request_timeout( &device->pwrctrl.l2pc_cpus_qos, device->pwrctrl.pm_qos_cpu_mask_latency, - KGSL_L2PC_CPU_TIMEOUT); + timeout_us); } } EXPORT_SYMBOL(kgsl_pwrctrl_update_l2pc); @@ -2203,6 +2198,10 @@ int kgsl_pwrctrl_init(struct kgsl_device *device) kgsl_property_read_u32(device, "qcom,l2pc-cpu-mask", &pwr->l2pc_cpus_mask); + pwr->l2pc_update_queue = of_property_read_bool( + device->pdev->dev.of_node, + "qcom,l2pc-update-queue"); + pm_runtime_enable(&pdev->dev); ocmem_bus_node = of_find_node_by_name( diff --git a/drivers/gpu/msm/kgsl_pwrctrl.h b/drivers/gpu/msm/kgsl_pwrctrl.h index d7674e6849f4..99944edcc8f7 100644 --- a/drivers/gpu/msm/kgsl_pwrctrl.h +++ b/drivers/gpu/msm/kgsl_pwrctrl.h @@ -51,6 +51,19 @@ #define KGSL_PWR_DEL_LIMIT 1 #define KGSL_PWR_SET_LIMIT 2 +/* + * The effective duration of qos request in usecs at queue time. + * After timeout, qos request is cancelled automatically. + * Kept 64ms default, inline with default GPU idle time. + */ +#define KGSL_L2PC_QUEUE_TIMEOUT (64 * 1000) + +/* + * The effective duration of qos request in usecs at wakeup time. + * After timeout, qos request is cancelled automatically. + */ +#define KGSL_L2PC_WAKEUP_TIMEOUT (10 * 1000) + enum kgsl_pwrctrl_timer_type { KGSL_PWR_IDLE_TIMER, }; @@ -128,6 +141,7 @@ struct kgsl_regulator { * @irq_name - resource name for the IRQ * @clk_stats - structure of clock statistics * @l2pc_cpus_mask - mask to avoid L2PC on masked CPUs + * @l2pc_update_queue - Boolean flag to avoid L2PC on masked CPUs at queue time * @l2pc_cpus_qos - qos structure to avoid L2PC on CPUs * @pm_qos_req_dma - the power management quality of service structure * @pm_qos_active_latency - allowed CPU latency in microseconds when active @@ -184,6 +198,7 @@ struct kgsl_pwrctrl { const char *irq_name; struct kgsl_clk_stats clk_stats; unsigned int l2pc_cpus_mask; + bool l2pc_update_queue; struct pm_qos_request l2pc_cpus_qos; struct pm_qos_request pm_qos_req_dma; unsigned int pm_qos_active_latency; @@ -251,5 +266,6 @@ int kgsl_active_count_wait(struct kgsl_device *device, int count); void kgsl_pwrctrl_busy_time(struct kgsl_device *device, u64 time, u64 busy); void kgsl_pwrctrl_set_constraint(struct kgsl_device *device, struct kgsl_pwr_constraint *pwrc, uint32_t id); -void kgsl_pwrctrl_update_l2pc(struct kgsl_device *device); +void kgsl_pwrctrl_update_l2pc(struct kgsl_device *device, + unsigned long timeout_us); #endif /* __KGSL_PWRCTRL_H */ diff --git a/drivers/gpu/msm/kgsl_trace.h b/drivers/gpu/msm/kgsl_trace.h index d6bd62afcb5a..5761e72a20ce 100644 --- a/drivers/gpu/msm/kgsl_trace.h +++ b/drivers/gpu/msm/kgsl_trace.h @@ -1001,33 +1001,39 @@ TRACE_EVENT(kgsl_popp_nap, ); TRACE_EVENT(kgsl_register_event, - TP_PROTO(unsigned int id, unsigned int timestamp, void *func), - TP_ARGS(id, timestamp, func), + TP_PROTO(unsigned int id, unsigned int timestamp, void *func, + enum kgsl_priority prio), + TP_ARGS(id, timestamp, func, prio), TP_STRUCT__entry( __field(unsigned int, id) __field(unsigned int, timestamp) __field(void *, func) + __field(enum kgsl_priority, prio) ), TP_fast_assign( __entry->id = id; __entry->timestamp = timestamp; __entry->func = func; + __entry->prio = prio; ), TP_printk( - "ctx=%u ts=%u cb=%pF", - __entry->id, __entry->timestamp, __entry->func) + "ctx=%u ts=%u cb=%pF prio=%s", + __entry->id, __entry->timestamp, __entry->func, + prio_to_string(__entry->prio)) ); TRACE_EVENT(kgsl_fire_event, TP_PROTO(unsigned int id, unsigned int ts, - unsigned int type, unsigned int age, void *func), - TP_ARGS(id, ts, type, age, func), + unsigned int type, unsigned int age, void *func, + enum kgsl_priority prio), + TP_ARGS(id, ts, type, age, func, prio), TP_STRUCT__entry( __field(unsigned int, id) __field(unsigned int, ts) __field(unsigned int, type) __field(unsigned int, age) __field(void *, func) + __field(enum kgsl_priority, prio) ), TP_fast_assign( __entry->id = id; @@ -1035,12 +1041,14 @@ TRACE_EVENT(kgsl_fire_event, __entry->type = type; __entry->age = age; __entry->func = func; + __entry->prio = prio; ), TP_printk( - "ctx=%u ts=%u type=%s age=%u cb=%pF", + "ctx=%u ts=%u type=%s age=%u cb=%pF prio=%s", __entry->id, __entry->ts, __print_symbolic(__entry->type, KGSL_EVENT_TYPES), - __entry->age, __entry->func) + __entry->age, __entry->func, + prio_to_string(__entry->prio)) ); TRACE_EVENT(kgsl_active_count, diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 183334d4c650..93543475023b 100755 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -98,6 +98,5 @@ obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_S3320_I2C_RMI) += synaptics_driver_s3320.o -obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_S3320_I2C_RMI) += synaptics_s3320_redremote.o obj-$(CONFIG_TOUCHSCREEN_ST) += st/ obj-$(CONFIG_SWEEP2SLEEP) += sweep2sleep.o diff --git a/drivers/input/touchscreen/fw_update_v7.if b/drivers/input/touchscreen/fw_update_v7.if index 41cc8d7ee3c3..edb29820f892 100755 --- a/drivers/input/touchscreen/fw_update_v7.if +++ b/drivers/input/touchscreen/fw_update_v7.if @@ -1688,7 +1688,7 @@ static int scan_pdt(void) fwu->f34_fd.query_base_addr = add_buf[0]; fwu->f34_fd.ctrl_base_addr = add_buf[2]; fwu->f34_fd.data_base_addr = add_buf[3]; - if (add_buf[4]>>5 && 0x2) + if (add_buf[4]>>5 & 0x2) fwu->bl_version = BL_V7; TPD_ERR("F34_query_base_addr[0x%x],F34_ctrl_base_addr[0x%x],F34_data_base_addr[0x%x]\n",\ add_buf[0],add_buf[2],add_buf[3]); diff --git a/drivers/input/touchscreen/synaptics_driver_s3320.c b/drivers/input/touchscreen/synaptics_driver_s3320.c index 950ffc6771a9..045a00e91fe8 100644 --- a/drivers/input/touchscreen/synaptics_driver_s3320.c +++ b/drivers/input/touchscreen/synaptics_driver_s3320.c @@ -55,7 +55,6 @@ #include -#include "synaptics_redremote.h" #include #include "synaptics_baseline.h" @@ -103,9 +102,6 @@ struct test_header { unsigned int array_limitcbc_size; }; -/******************for Red function*****************/ -#define CONFIG_SYNAPTIC_RED - /*********************for gesture*******************/ #ifdef SUPPORT_GESTURE #define ENABLE_UNICODE 0x40 @@ -4558,9 +4554,6 @@ static int synaptics_ts_init_virtual_key(struct synaptics_ts_data *ts) static int synaptics_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { -#ifdef CONFIG_SYNAPTIC_RED - struct remotepanel_data *premote_data = NULL; -#endif struct synaptics_ts_data *ts = NULL; int ret = -1; uint8_t buf[4]; @@ -4786,19 +4779,6 @@ static int synaptics_ts_probe(struct i2c_client *client, } #ifdef SUPPORT_VIRTUAL_KEY synaptics_ts_init_virtual_key(ts); -#endif -#ifdef CONFIG_SYNAPTIC_RED - premote_data = remote_alloc_panel_data(); - if (premote_data) { - premote_data->client = client; - premote_data->input_dev = ts->input_dev; - premote_data->pmutex = &ts->mutex; - premote_data->irq_gpio = ts->irq_gpio; - premote_data->irq = client->irq; - premote_data->enable_remote = &(ts->enable_remote); - register_remote_device(premote_data); - - } #endif init_synaptics_proc(ts); @@ -4831,9 +4811,6 @@ static int synaptics_ts_remove(struct i2c_client *client) struct synaptics_ts_data *ts = i2c_get_clientdata(client); TPD_ERR("%s is called\n", __func__); -#ifdef CONFIG_SYNAPTIC_RED - unregister_remote_device(); -#endif #if defined(CONFIG_FB) if (fb_unregister_client(&ts->fb_notif)) diff --git a/drivers/input/touchscreen/synaptics_redremote.h b/drivers/input/touchscreen/synaptics_redremote.h deleted file mode 100755 index dfbb72df83dc..000000000000 --- a/drivers/input/touchscreen/synaptics_redremote.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _SYNAPTICS_REDREMOTE_H_ -#define _SYNAPTICS_REDREMOTE_H_ -struct remotepanel_data { - struct i2c_client *client; - struct input_dev *input_dev; - struct input_dev *kpd; - struct mutex *pmutex; - int irq_gpio; - unsigned int irq; - int *enable_remote; -}; -struct remotepanel_data *remote_alloc_panel_data(void); -int register_remote_device(struct remotepanel_data *pdata); -void unregister_remote_device(void); -#endif diff --git a/drivers/input/touchscreen/synaptics_s3320_redremote.c b/drivers/input/touchscreen/synaptics_s3320_redremote.c deleted file mode 100755 index fe683caef383..000000000000 --- a/drivers/input/touchscreen/synaptics_s3320_redremote.c +++ /dev/null @@ -1,938 +0,0 @@ -/* - * Synaptics DSX touchscreen driver - * - * Copyright (C) 2012 Synaptics Incorporated - * - * Copyright (C) 2012 Alexandra Chin - * Copyright (C) 2012 Scott Lin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "synaptics_redremote.h" - - -#define CHAR_DEVICE_NAME "rmi" -#define DEVICE_CLASS_NAME "rmidev" -#define DEV_NUMBER 1 -#define REG_ADDR_LIMIT 0xFFFF - - -static ssize_t rmidev_sysfs_data_show(struct file *data_file, - struct kobject *kobj, struct bin_attribute *attributes, - char *buf, loff_t pos, size_t count); - -static ssize_t rmidev_sysfs_data_store(struct file *data_file, - struct kobject *kobj, struct bin_attribute *attributes, - char *buf, loff_t pos, size_t count); - -static ssize_t rmidev_sysfs_open_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); - -static ssize_t rmidev_sysfs_release_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); - -static ssize_t rmidev_sysfs_address_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); - -static ssize_t rmidev_sysfs_length_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count); - -static ssize_t rmidev_sysfs_attn_state_show(struct device *dev, - struct device_attribute *attr, char *buf); - -static int remote_rmi4_i2c_read(unsigned short addr, - unsigned char *data, unsigned short length); -static int remote_rmi4_i2c_write(unsigned short addr, - unsigned char *data, unsigned short length); -static int remote_rmi4_i2c_enable(bool enable); -static int remote_rmi4_get_irq_gpio(void); -static int remote_rmit_set_page(unsigned int address); -static int remote_rmit_put_page(void); - - -static struct input_dev *remote_rmi4_get_input(void); -static struct i2c_client *remote_rmi4_get_i2c_client(void); -static void remote_rmi4_delay_work(struct work_struct *work); -static struct remotepanel_data *remote_free_panel_data - (struct remotepanel_data *pdata); - - -#define MASK_8BIT 0xFF -#define SYN_I2C_RETRY_TIMES 3 -#define BUFFER_SIZE 252 -struct rmidev_handle { - dev_t dev_no; - unsigned short address; - unsigned int length; - struct device dev; - struct kobject *sysfs_dir; - void *data; -}; - -struct rmidev_data { - int ref_count; - struct cdev main_dev; - struct class *device_class; - struct mutex file_mutex; - struct rmidev_handle *rmi_dev; - struct remotepanel_data *pdata; -}; - -static struct bin_attribute attr_data = { - .attr = { - .name = "data", - .mode = (S_IRUSR | S_IWUSR), - }, - .size = 0, - .read = rmidev_sysfs_data_show, - .write = rmidev_sysfs_data_store, -}; - -static struct device_attribute attrs[] = { - __ATTR(open, S_IRUSR | S_IWUSR, - NULL, - rmidev_sysfs_open_store), - __ATTR(release, S_IRUSR | S_IWUSR, - NULL, - rmidev_sysfs_release_store), - __ATTR(address, S_IRUSR | S_IWUSR, - NULL, - rmidev_sysfs_address_store), - __ATTR(length, S_IRUSR | S_IWUSR, - NULL, - rmidev_sysfs_length_store), - __ATTR(attn_state, S_IRUSR | S_IWUSR, - rmidev_sysfs_attn_state_show, - NULL), -}; - -static int rmidev_major_num; - -static struct class *rmidev_device_class; - -static struct rmidev_handle *rmidev; - - -static struct device *device_ptr; -static struct delayed_work delay_work; - - -static ssize_t rmidev_sysfs_data_show(struct file *data_file, - struct kobject *kobj, struct bin_attribute *attributes, - char *buf, loff_t pos, size_t count) -{ - int retval; - unsigned int data_length = rmidev->length; - - if (data_length > (REG_ADDR_LIMIT - rmidev->address)) - data_length = REG_ADDR_LIMIT - rmidev->address; - - if (count < data_length) { - dev_err(device_ptr, - "%s: Not enough space (%zd bytes) in buffer\n", - __func__, count); - return -EINVAL; - } - - if (data_length) { - retval = remote_rmi4_i2c_read( - rmidev->address, - (unsigned char *)buf, - data_length); - if (retval < 0) { - dev_err(device_ptr, - "%s: Failed to read data\n", - __func__); - return retval; - } - } else { - return -EINVAL; - } - - return data_length; -} - -static ssize_t rmidev_sysfs_data_store(struct file *data_file, - struct kobject *kobj, struct bin_attribute *attributes, - char *buf, loff_t pos, size_t count) -{ - int retval; - unsigned int data_length = rmidev->length; - - if (data_length > (REG_ADDR_LIMIT - rmidev->address)) - data_length = REG_ADDR_LIMIT - rmidev->address; - - if (data_length) { - retval = remote_rmi4_i2c_write( - rmidev->address, - (unsigned char *)buf, - data_length); - if (retval < 0) { - dev_err(device_ptr, - "%s: Failed to write data\n", - __func__); - return retval; - } - } else { - return -EINVAL; - } - - return count; -} - -static ssize_t rmidev_sysfs_open_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned int input; - - if (kstrtouint(buf, 10, &input) != 1) - return -EINVAL; - - if (input != 1) - return -EINVAL; - - remote_rmi4_i2c_enable(false); - dev_dbg(device_ptr, - "%s: Attention interrupt disabled\n", - __func__); - - return count; -} - -static ssize_t rmidev_sysfs_release_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned int input; - - if (kstrtouint(buf, 10, &input) != 1) - return -EINVAL; - - if (input != 1) - return -EINVAL; - - remote_rmi4_i2c_enable(true); - dev_dbg(device_ptr, - "%s: Attention interrupt enabled\n", - __func__); - - return count; -} - -static ssize_t rmidev_sysfs_address_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned int input; - - if (kstrtouint(buf, 10, &input) != 1) - return -EINVAL; - - if (input > REG_ADDR_LIMIT) - return -EINVAL; - - rmidev->address = (unsigned short)input; - - return count; -} - -static ssize_t rmidev_sysfs_length_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned int input; - - if (kstrtouint(buf, 10, &input) != 1) - return -EINVAL; - - if (input > REG_ADDR_LIMIT) - return -EINVAL; - - rmidev->length = input; - - return count; -} - -static ssize_t rmidev_sysfs_attn_state_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - int attn_state; - - attn_state = gpio_get_value(remote_rmi4_get_irq_gpio()); - - return snprintf(buf, PAGE_SIZE, "%d\n", attn_state); -} - -static int remote_rmi4_get_irq_gpio(void) -{ - struct rmidev_data *dev_data = (struct rmidev_data *)rmidev->data; - - return dev_data->pdata->irq_gpio; -} - -static struct input_dev *remote_rmi4_get_input(void) -{ - struct rmidev_data *dev_data = (struct rmidev_data *)rmidev->data; - - return dev_data->pdata->input_dev; -} - -static struct i2c_client *remote_rmi4_get_i2c_client(void) -{ - struct rmidev_data *dev_data = (struct rmidev_data *)rmidev->data; - - return dev_data->pdata->client; -} - -static int remote_rmit_set_page(unsigned int address) -{ - struct i2c_client *i2c_client = remote_rmi4_get_i2c_client(); - unsigned char retry; - unsigned char buf[2]; - struct i2c_msg msg[] = { - { - .addr = i2c_client->addr, - .flags = 0, - .len = 2, - .buf = buf, - } - }; - buf[0] = 0xff; - buf[1] = ((address >> 8) & 0xFF); - - for (retry = 0; retry < 2; retry++) { - if (i2c_transfer(i2c_client->adapter, msg, 1) == 1) - break; - msleep(20); - } - - if (retry == 2) - return -EIO; - - return 0; -} - -static int remote_rmit_put_page(void) -{ - struct i2c_client *i2c_client = remote_rmi4_get_i2c_client(); - unsigned char retry; - unsigned char buf[2]; - struct i2c_msg msg[] = { - { - .addr = i2c_client->addr, - .flags = 0, - .len = 2, - .buf = buf, - } - }; - buf[0] = 0xff; - buf[1] = 0x00; - - for (retry = 0; retry < 2; retry++) { - if (i2c_transfer(i2c_client->adapter, msg, 1) == 1) - break; - msleep(20); - } - - if (retry == 2) - return -EIO; - - return 0; -} - - -int remote_rmi4_i2c_read(unsigned short addr, - unsigned char *data, unsigned short length) -{ - int retval; - unsigned char retry; - unsigned char buf; - struct i2c_client *i2c_client = remote_rmi4_get_i2c_client(); - struct i2c_msg msg[] = { - { - .addr = i2c_client->addr, - .flags = 0, - .len = 1, - .buf = &buf, - }, - { - .addr = i2c_client->addr, - .flags = I2C_M_RD, - .len = length, - .buf = data, - }, - }; - - buf = addr & 0xff; - - retval = remote_rmit_set_page(addr); - if (retval < 0) - goto exit; - - for (retry = 0; retry < 2; retry++) { - if (i2c_transfer(i2c_client->adapter, msg, 2) == 2) { - retval = length; - break; - } - msleep(20); - } - - if (retry == 2) - retval = -EIO; - -exit: - remote_rmit_put_page(); - - return retval; -} - -int remote_rmi4_i2c_write(unsigned short addr, - unsigned char *data, unsigned short length) -{ - int retval; - unsigned char retry; - unsigned char buf[length + 1]; - struct i2c_client *i2c_client = remote_rmi4_get_i2c_client(); - struct i2c_msg msg[] = { - { - .addr = i2c_client->addr, - .flags = 0, - .len = length + 1, - .buf = buf, - } - }; - - - retval = remote_rmit_set_page(addr); - if (retval < 0) - goto exit; - - buf[0] = addr & 0xff; - memcpy(&buf[1], &data[0], length); - - for (retry = 0; retry < 2; retry++) { - if (i2c_transfer(i2c_client->adapter, msg, 1) == 1) { - retval = length; - break; - } - msleep(20); - } - msleep(20); - if (retry == 2) - retval = -EIO; - -exit: - remote_rmit_put_page(); - - return retval; -} - -int remote_rmi4_i2c_enable(bool enable) -{ - struct rmidev_data *dev_data = (struct rmidev_data *)rmidev->data; - - if (enable) - *(dev_data->pdata->enable_remote) = 0; - else - *(dev_data->pdata->enable_remote) = 1; - - return 0; -} - - -/* - * rmidev_llseek - used to set up register address - * - * @filp: file structure for seek - * @off: offset - * if whence == SEEK_SET, - * high 16 bits: page address - * low 16 bits: register address - * if whence == SEEK_CUR, - * offset from current position - * if whence == SEEK_END, - * offset from end position (0xFFFF) - * @whence: SEEK_SET, SEEK_CUR, or SEEK_END - */ -static loff_t rmidev_llseek(struct file *filp, loff_t off, int whence) -{ - loff_t newpos; - struct rmidev_data *dev_data = filp->private_data; - - if (IS_ERR(dev_data)) { - pr_err("%s: Pointer of char device data is invalid", __func__); - return -EBADF; - } - - - mutex_lock(&(dev_data->file_mutex)); - - switch (whence) { - case SEEK_SET: - newpos = off; - break; - case SEEK_CUR: - newpos = filp->f_pos + off; - break; - case SEEK_END: - newpos = REG_ADDR_LIMIT + off; - break; - default: - newpos = -EINVAL; - goto clean_up; - } - - if (newpos < 0 || newpos > REG_ADDR_LIMIT) { - dev_err(device_ptr, - "%s: New position 0x%04x is invalid\n", - __func__, (unsigned int)newpos); - newpos = -EINVAL; - goto clean_up; - } - - filp->f_pos = newpos; - -clean_up: - mutex_unlock(&(dev_data->file_mutex)); - - return newpos; -} - -/* - * rmidev_read: - use to read data from rmi device - * - * @filp: file structure for read - * @buf: user space buffer pointer - * @count: number of bytes to read - * @f_pos: offset (starting register address) - */ -static ssize_t rmidev_read(struct file *filp, char __user *buf, - size_t count, loff_t *f_pos) -{ - ssize_t retval; - unsigned char tmpbuf[count + 1]; - struct rmidev_data *dev_data = filp->private_data; - - if (IS_ERR(dev_data)) { - pr_err("%s: Pointer of char device data is invalid", __func__); - return -EBADF; - } - - - if (count == 0) - return 0; - - if (count > (REG_ADDR_LIMIT - *f_pos)) - count = REG_ADDR_LIMIT - *f_pos; - - mutex_lock(dev_data->pdata->pmutex); - mutex_lock(&(dev_data->file_mutex)); - - retval = remote_rmi4_i2c_read( - *f_pos, - tmpbuf, - count); - if (retval < 0) - goto clean_up; - - if (copy_to_user(buf, tmpbuf, count)) - retval = -EFAULT; - else - *f_pos += retval; - -clean_up: - mutex_unlock(&(dev_data->file_mutex)); - mutex_unlock(dev_data->pdata->pmutex); - - return retval; -} - -/* - * rmidev_write: - used to write data to rmi device - * - * @filep: file structure for write - * @buf: user space buffer pointer - * @count: number of bytes to write - * @f_pos: offset (starting register address) - */ -static ssize_t rmidev_write(struct file *filp, const char __user *buf, - size_t count, loff_t *f_pos) -{ - ssize_t retval; - unsigned char tmpbuf[count + 1]; - struct rmidev_data *dev_data = filp->private_data; - - pr_err("synap %s\n", __func__); - - if (IS_ERR(dev_data)) { - pr_err("%s: Pointer of char device data is invalid", __func__); - return -EBADF; - } - - - if (count == 0) - return 0; - - if (count > (REG_ADDR_LIMIT - *f_pos)) - count = REG_ADDR_LIMIT - *f_pos; - - if (copy_from_user(tmpbuf, buf, count)) - return -EFAULT; - - mutex_lock(dev_data->pdata->pmutex); - mutex_lock(&(dev_data->file_mutex)); - - retval = remote_rmi4_i2c_write( - *f_pos, - tmpbuf, - count); - if (retval >= 0) - *f_pos += retval; - - - mutex_unlock(&(dev_data->file_mutex)); - mutex_unlock(dev_data->pdata->pmutex); - - return retval; -} - -static int rmidev_create_attr(bool create) -{ - int retval = 0; - unsigned char attr_count; - struct input_dev *input_dev = remote_rmi4_get_input(); - - pr_err("synap %s\n", __func__); - if (!create) - goto err_sysfs_attrs; - - if (rmidev->sysfs_dir) - return 0; - - if (!input_dev) - return -ENOMEM; - - rmidev->sysfs_dir = kobject_create_and_add("rmidev", - &input_dev->dev.kobj); - if (!rmidev->sysfs_dir) { - dev_err(device_ptr, - "%s: Failed to create sysfs directory\n", - __func__); - return -ENOMEM; - } - - - retval = sysfs_create_bin_file(rmidev->sysfs_dir, - &attr_data); - if (retval < 0) { - dev_err(device_ptr, - "%s: Failed to create sysfs bin file\n", - __func__); - goto err_sysfs_bin; - } - - - for (attr_count = 0; attr_count < ARRAY_SIZE(attrs); attr_count++) { - retval = sysfs_create_file(rmidev->sysfs_dir, - &attrs[attr_count].attr); - if (retval < 0) { - dev_err(device_ptr, - "%s: Failed to create sysfs attributes\n", - __func__); - retval = -ENODEV; - goto err_sysfs_attrs; - } - } - - return 0; - -err_sysfs_attrs: - if (!rmidev->sysfs_dir) - return 0; - for (attr_count = 0; attr_count < ARRAY_SIZE(attrs); attr_count++) - sysfs_remove_file(rmidev->sysfs_dir, &attrs[attr_count].attr); - - sysfs_remove_bin_file(rmidev->sysfs_dir, &attr_data); - -err_sysfs_bin: - kobject_put(rmidev->sysfs_dir); - rmidev->sysfs_dir = NULL; - - return retval; -} - -/* - * rmidev_open: enable access to rmi device - * @inp: inode struture - * @filp: file structure - */ -static int rmidev_open(struct inode *inp, struct file *filp) -{ - int retval = 0; - struct rmidev_data *dev_data = - container_of(inp->i_cdev, struct rmidev_data, main_dev); - pr_err("synap %s\n", __func__); - - if (!dev_data) - return -EACCES; - - - rmidev_create_attr(true); - - filp->private_data = dev_data; - - mutex_lock(&(dev_data->file_mutex)); - *(dev_data->pdata->enable_remote) = 1; - /*remote_rmi4_i2c_enable(false);*/ - dev_dbg(device_ptr, - "%s: Attention interrupt disabled\n", - __func__); - - if (dev_data->ref_count < 1) - dev_data->ref_count++; - else - retval = -EACCES; - - mutex_unlock(&(dev_data->file_mutex)); - - return retval; -} - -/* - * rmidev_release: - release access to rmi device - * @inp: inode structure - * @filp: file structure - */ -static int rmidev_release(struct inode *inp, struct file *filp) -{ - struct rmidev_data *dev_data = - container_of(inp->i_cdev, struct rmidev_data, main_dev); - - if (!dev_data) - return -EACCES; - - rmidev_create_attr(false); - - mutex_lock(&(dev_data->file_mutex)); - - dev_data->ref_count--; - if (dev_data->ref_count < 0) - dev_data->ref_count = 0; - - remote_rmi4_i2c_enable(true); - dev_dbg(device_ptr, - "%s: Attention interrupt enabled\n", - __func__); - - mutex_unlock(&(dev_data->file_mutex)); - - return 0; -} - -static const struct file_operations rmidev_fops = { - .owner = THIS_MODULE, - .llseek = rmidev_llseek, - .read = rmidev_read, - .write = rmidev_write, - .open = rmidev_open, - .release = rmidev_release, -}; - -static void rmidev_device_cleanup(struct rmidev_data *dev_data) -{ - dev_t devno; - - if (dev_data) { - devno = dev_data->main_dev.dev; - - if (dev_data->device_class) - device_destroy(dev_data->device_class, devno); - - cdev_del(&dev_data->main_dev); - - unregister_chrdev_region(devno, 1); - - remote_free_panel_data(dev_data->pdata); - - dev_dbg(device_ptr, - "%s: rmidev device removed\n", - __func__); - } -} - -static char *rmi_char_devnode(struct device *dev, umode_t *mode) -{ - if (!mode) - return NULL; - - *mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - - return kasprintf(GFP_KERNEL, "rmi/%s", dev_name(dev)); -} - -static int rmidev_create_device_class(void) -{ - rmidev_device_class = class_create(THIS_MODULE, DEVICE_CLASS_NAME); - - if (IS_ERR(rmidev_device_class)) { - pr_err("%s: Failed to create /dev/%s\n", - __func__, CHAR_DEVICE_NAME); - return -ENODEV; - } - - rmidev_device_class->devnode = rmi_char_devnode; - - return 0; -} - -static void remote_rmi4_delay_work(struct work_struct *work) -{ - rmidev_create_attr(true); -} - -struct remotepanel_data *remote_alloc_panel_data(void) -{ - if (rmidev) { - pr_err("%s:remote panel data has alloc already null\n", - __func__); - return NULL; - } - - return kzalloc(sizeof(struct remotepanel_data), GFP_KERNEL); -} - -static struct remotepanel_data *remote_free_panel_data - (struct remotepanel_data *pdata) -{ - pdata = NULL; - return NULL; -} - - - -/*int rmidev_init_device(void)*/ -int register_remote_device(struct remotepanel_data *pdata) -{ - int retval; - dev_t dev_no; - struct rmidev_data *dev_data = NULL; - - if (pdata == NULL) { - pr_err("%s:pdata is null\n", __func__); - return -ENOMEM; - } - if (rmidev) { - pr_err("%s:remote device has register already null\n", - __func__); - return -ENOMEM; - } - rmidev = kzalloc(sizeof(*rmidev), GFP_KERNEL); - if (!rmidev) { - retval = -ENOMEM; - goto err_rmidev; - } - - retval = rmidev_create_device_class(); - if (retval < 0) - goto err_device_class; - - if (rmidev_major_num) { - dev_no = MKDEV(rmidev_major_num, DEV_NUMBER); - retval = register_chrdev_region(dev_no, 1, CHAR_DEVICE_NAME); - } else { - retval = alloc_chrdev_region(&dev_no, 1, 1, CHAR_DEVICE_NAME); - if (retval < 0) - goto err_device_region; - - rmidev_major_num = MAJOR(dev_no); - } - - - dev_data = kzalloc(sizeof(*dev_data), GFP_KERNEL); - if (!dev_data) { - retval = -ENOMEM; - goto err_dev_data; - } - - dev_data->pdata = pdata; - - mutex_init(&dev_data->file_mutex); - dev_data->rmi_dev = rmidev; - rmidev->data = dev_data; - - cdev_init(&dev_data->main_dev, &rmidev_fops); - - retval = cdev_add(&dev_data->main_dev, dev_no, 1); - if (retval < 0) - goto err_char_device; - - dev_set_name(&rmidev->dev, "rmidev%d", MINOR(dev_no)); - dev_data->device_class = rmidev_device_class; - - device_ptr = device_create(dev_data->device_class, NULL, dev_no, - NULL, CHAR_DEVICE_NAME"%d", MINOR(dev_no)); - if (IS_ERR(device_ptr)) { - pr_err("%s: Failed to create rmi char device\n", __func__); - retval = -ENODEV; - goto err_char_device; - } - - INIT_DELAYED_WORK(&delay_work, remote_rmi4_delay_work); - schedule_delayed_work(&delay_work, msecs_to_jiffies(8*1000)); - - return 0; - -err_char_device: - remote_free_panel_data(dev_data->pdata); - rmidev_device_cleanup(dev_data); - kfree(dev_data); - -err_dev_data: - unregister_chrdev_region(dev_no, 1); - -err_device_region: - class_destroy(rmidev_device_class); - -err_device_class: - kfree(rmidev); - rmidev = NULL; -err_rmidev: - return retval; -} - -/*void rmidev_remove_device(void)*/ -void unregister_remote_device(void) -{ - struct rmidev_data *dev_data; - - if (!rmidev) - return; - - dev_data = rmidev->data; - if (dev_data) { - rmidev_device_cleanup(dev_data); - kfree(dev_data); - } - - unregister_chrdev_region(rmidev->dev_no, 1); - - class_destroy(rmidev_device_class); - - kfree(rmidev); -} diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 0271f78742b8..a82f5d17fdfe 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -3597,7 +3597,7 @@ static int __qseecom_update_cmd_buf(void *msg, bool cleanup, data->client.app_arch == ELFCLASS64)) || (data->type == QSEECOM_LISTENER_SERVICE)) { update = (struct qseecom_sg_entry *)field; - for (j = 0; j < sg_ptr->nents; j++) { + for_each_sg(sg, sg, sg_ptr->nents, j) { /* * Check if sg list PA is under 4GB */ @@ -3617,7 +3617,6 @@ static int __qseecom_update_cmd_buf(void *msg, bool cleanup, update->len = cleanup ? 0 : sg->length; update++; len += sg->length; - sg = sg_next(sg); } } else { pr_err("QSEE app arch %u is not supported\n", @@ -3707,11 +3706,10 @@ static int __qseecom_allocate_sg_list_buffer(struct qseecom_dev_handle *data, buf_hdr->nents_total = sg_ptr->nents; /* save the left sg entries into new allocated buf */ sg_entry = (struct qseecom_sg_entry_64bit *)buf; - for (i = 0; i < sg_ptr->nents; i++) { + for_each_sg(sg, sg, sg_ptr->nents, i) { sg_entry->phys_addr = (uint64_t)sg_dma_address(sg); sg_entry->len = sg->length; sg_entry++; - sg = sg_next(sg); } data->client.sec_buf_fd[fd_idx].is_sec_buf_fd = true; @@ -3854,14 +3852,13 @@ static int __qseecom_update_cmd_buf_64(void *msg, bool cleanup, } /* 64bit app uses 64bit address */ update_64bit = (struct qseecom_sg_entry_64bit *)field; - for (j = 0; j < sg_ptr->nents; j++) { + for_each_sg(sg, sg, sg_ptr->nents, j) { update_64bit->phys_addr = cleanup ? 0 : (uint64_t)sg_dma_address(sg); update_64bit->len = cleanup ? 0 : (uint32_t)sg->length; update_64bit++; len += sg->length; - sg = sg_next(sg); } } cleanup: @@ -6606,11 +6603,10 @@ static int __qseecom_qteec_handle_pre_alc_fd(struct qseecom_dev_handle *data, } *(uint32_t *)buf = sg_ptr->nents; sg_entry = (struct qseecom_sg_entry *) (buf + sizeof(uint32_t)); - for (i = 0; i < sg_ptr->nents; i++) { + for_each_sg(sg, sg, sg_ptr->nents, i) { sg_entry->phys_addr = (uint32_t)sg_dma_address(sg); sg_entry->len = sg->length; sg_entry++; - sg = sg_next(sg); } data->client.sec_buf_fd[fd_idx].is_sec_buf_fd = true; data->client.sec_buf_fd[fd_idx].vbase = buf; diff --git a/drivers/nfc/pn5xx.c b/drivers/nfc/pn5xx.c index 9d854b5e7474..4290134c52ba 100755 --- a/drivers/nfc/pn5xx.c +++ b/drivers/nfc/pn5xx.c @@ -320,7 +320,7 @@ static void p61_access_unlock(struct pn544_dev *pn544_dev) pr_info("%s: Exit\n", __func__); } -static int signal_handler(p61_access_state_t state, long nfc_pid) +static int signal_handler(unsigned long state, long nfc_pid) { struct siginfo sinfo; pid_t pid; diff --git a/drivers/pci/host/pci-msm.c b/drivers/pci/host/pci-msm.c index 3cea8d494c26..b4e5ab13297c 100644 --- a/drivers/pci/host/pci-msm.c +++ b/drivers/pci/host/pci-msm.c @@ -6945,6 +6945,27 @@ void msm_pcie_fixup_resume(struct pci_dev *dev) DECLARE_PCI_FIXUP_RESUME(PCIE_VENDOR_ID_RCP, PCIE_DEVICE_ID_RCP, msm_pcie_fixup_resume); +void msm_pcie_fixup_resume_early(struct pci_dev *dev) +{ + int ret; + struct msm_pcie_dev_t *pcie_dev = PCIE_BUS_PRIV_DATA(dev->bus); + + PCIE_DBG(pcie_dev, "RC%d\n", pcie_dev->rc_idx); + + if ((pcie_dev->link_status != MSM_PCIE_LINK_DISABLED) || + pcie_dev->user_suspend) + return; + + mutex_lock(&pcie_dev->recovery_lock); + ret = msm_pcie_pm_resume(dev, NULL, NULL, 0); + if (ret) + PCIE_ERR(pcie_dev, "PCIe: RC%d got failure in resume:%d.\n", + pcie_dev->rc_idx, ret); + + mutex_unlock(&pcie_dev->recovery_lock); +} +DECLARE_PCI_FIXUP_RESUME_EARLY(PCIE_VENDOR_ID_RCP, PCIE_DEVICE_ID_RCP, + msm_pcie_fixup_resume_early); int msm_pcie_pm_control(enum msm_pcie_pm_opt pm_opt, u32 busnr, void *user, void *data, u32 options) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 0cf2a2ad87fb..82b0c2cc2fd3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -637,9 +637,12 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) break; } - if ((pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr) - != PCIBIOS_DEVICE_NOT_FOUND) && - (state == PCI_D3hot || dev->current_state == PCI_D3hot)) + /* enter specified state */ + pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); + + /* Mandatory power management transition delays */ + /* see PCI PM 1.1 5.6.1 table 18 */ + if (state == PCI_D3hot || dev->current_state == PCI_D3hot) pci_dev_d3_sleep(dev); else if (state == PCI_D2 || dev->current_state == PCI_D2) udelay(PCI_PM_D2_DELAY); diff --git a/drivers/platform/msm/ipa/ipa_rm.c b/drivers/platform/msm/ipa/ipa_rm.c index bcdd99deae1f..9ea1f07eaea5 100644 --- a/drivers/platform/msm/ipa/ipa_rm.c +++ b/drivers/platform/msm/ipa/ipa_rm.c @@ -509,7 +509,7 @@ int ipa_rm_request_resource_with_timer(enum ipa_rm_resource_name resource_name) release_work->needed_bw = 0; release_work->dec_usage_count = false; INIT_DELAYED_WORK(&release_work->work, delayed_release_work_func); - schedule_delayed_work(&release_work->work, + queue_delayed_work(system_power_efficient_wq, &release_work->work, msecs_to_jiffies(IPA_RM_RELEASE_DELAY_IN_MSEC)); result = 0; bail: diff --git a/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c index 6236c9385d91..ec67d77806a4 100644 --- a/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v2/rmnet_ipa.c @@ -2554,7 +2554,8 @@ static void tethering_stats_poll_queue(struct work_struct *work) /* Schedule again only if there's an active polling interval */ if (0 != ipa_rmnet_ctx.polling_interval) - schedule_delayed_work(&ipa_tether_stats_poll_wakequeue_work, + queue_delayed_work(system_power_efficient_wq, + &ipa_tether_stats_poll_wakequeue_work, msecs_to_jiffies(ipa_rmnet_ctx.polling_interval*1000)); } @@ -2648,7 +2649,8 @@ int rmnet_ipa_poll_tethering_stats(struct wan_ioctl_poll_tethering_stats *data) return 0; } - schedule_delayed_work(&ipa_tether_stats_poll_wakequeue_work, 0); + queue_delayed_work(system_power_efficient_wq, + &ipa_tether_stats_poll_wakequeue_work, 0); return 0; } diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c index 460ea9124511..dd64e9f9c3b8 100644 --- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c @@ -2668,7 +2668,8 @@ static void tethering_stats_poll_queue(struct work_struct *work) /* Schedule again only if there's an active polling interval */ if (0 != ipa3_rmnet_ctx.polling_interval) - schedule_delayed_work(&ipa_tether_stats_poll_wakequeue_work, + queue_delayed_work(system_power_efficient_wq, + &ipa_tether_stats_poll_wakequeue_work, msecs_to_jiffies(ipa3_rmnet_ctx.polling_interval*1000)); } @@ -2762,7 +2763,8 @@ int rmnet_ipa3_poll_tethering_stats(struct wan_ioctl_poll_tethering_stats *data) return 0; } - schedule_delayed_work(&ipa_tether_stats_poll_wakequeue_work, 0); + queue_delayed_work(system_power_efficient_wq, + &ipa_tether_stats_poll_wakequeue_work, 0); return 0; } diff --git a/drivers/power/supply/qcom/fg-core.h b/drivers/power/supply/qcom/fg-core.h index 3ca06872605c..305d9dbdee94 100644 --- a/drivers/power/supply/qcom/fg-core.h +++ b/drivers/power/supply/qcom/fg-core.h @@ -384,11 +384,6 @@ static const struct fg_pt fg_tsmc_osc_table[] = { { 90, 444992 }, }; -struct fg_saved_data { - union power_supply_propval val; - unsigned long last_req_expires; -}; - struct fg_chip { struct device *dev; struct pmic_revid_data *pmic_rev_id; @@ -469,7 +464,6 @@ struct fg_chip { struct work_struct esr_filter_work; struct alarm esr_filter_alarm; ktime_t last_delta_temp_time; - struct fg_saved_data saved_data[POWER_SUPPLY_PROP_MAX]; }; /* Debugfs data structures are below */ diff --git a/drivers/power/supply/qcom/qpnp-fg-gen3.c b/drivers/power/supply/qcom/qpnp-fg-gen3.c index 47a4ad525804..50d1a67d8665 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen3.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen3.c @@ -429,8 +429,6 @@ module_param_named( static int fg_restart; static bool fg_sram_dump; -#define FG_RATE_LIM_MS (2 * MSEC_PER_SEC) - /* All getters HERE */ #define VOLTAGE_15BIT_MASK GENMASK(14, 0) @@ -1265,7 +1263,10 @@ static bool usb_psy_initialized(struct fg_chip *chip) return true; chip->usb_psy = power_supply_get_by_name("usb"); - return chip->usb_psy; + if (!chip->usb_psy) + return false; + + return true; } static bool pc_port_psy_initialized(struct fg_chip *chip) @@ -3757,36 +3758,8 @@ static int fg_psy_get_property(struct power_supply *psy, union power_supply_propval *pval) { struct fg_chip *chip = power_supply_get_drvdata(psy); - struct fg_saved_data *sd = chip->saved_data + psp; - union power_supply_propval typec_sts = { .intval = -1 }; int rc = 0; - switch (psp) { - case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: - case POWER_SUPPLY_PROP_RESISTANCE_ID: - case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: - case POWER_SUPPLY_PROP_CYCLE_COUNT_ID: - case POWER_SUPPLY_PROP_CHARGE_NOW: - case POWER_SUPPLY_PROP_CHARGE_FULL: - case POWER_SUPPLY_PROP_SOC_REPORTING_READY: - /* These props don't require a fg query; don't ratelimit them */ - break; - default: - if (!sd->last_req_expires) - break; - - if (usb_psy_initialized(chip)) - power_supply_get_property(chip->usb_psy, - POWER_SUPPLY_PROP_TYPEC_MODE, &typec_sts); - - if (typec_sts.intval == POWER_SUPPLY_TYPEC_NONE && - time_before(jiffies, sd->last_req_expires)) { - *pval = sd->val; - return 0; - } - break; - } - switch (psp) { case POWER_SUPPLY_PROP_CAPACITY: if (!get_extern_fg_regist_done()) @@ -3957,9 +3930,6 @@ static int fg_psy_get_property(struct power_supply *psy, if (rc < 0) return -ENODATA; - sd->val = *pval; - sd->last_req_expires = jiffies + msecs_to_jiffies(FG_RATE_LIM_MS); - return 0; } diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index e5502ebe7fc6..736096a5aa87 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -3949,8 +3949,8 @@ static void smblib_force_legacy_icl(struct smb_charger *chg, int pst) vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 3000000); break; default: - smblib_err(chg, "Unknown APSD %d; forcing 500mA\n", pst); - vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 500000); + smblib_err(chg, "Unknown APSD %d; forcing suspend\n", pst); + vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 0); break; } } @@ -4368,7 +4368,7 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) cancel_delayed_work_sync(&chg->hvdcp_detect_work); /* reset input current limit voters */ - vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 100000); + vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 0); vote(chg->usb_icl_votable, PD_VOTER, false, 0); vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0); vote(chg->usb_icl_votable, DCP_VOTER, false, 0); diff --git a/drivers/scsi/ufs/ufs-qcom-ice.c b/drivers/scsi/ufs/ufs-qcom-ice.c index 0c862639fa3e..1f6e7afaa1c5 100644 --- a/drivers/scsi/ufs/ufs-qcom-ice.c +++ b/drivers/scsi/ufs/ufs-qcom-ice.c @@ -27,6 +27,8 @@ #define UFS_QCOM_ICE_DEFAULT_DBG_PRINT_EN 0 +static struct workqueue_struct *ice_workqueue; + static void ufs_qcom_ice_dump_regs(struct ufs_qcom_host *qcom_host, int offset, int len, char *prefix) { @@ -170,17 +172,15 @@ int ufs_qcom_ice_get_dev(struct ufs_qcom_host *qcom_host) static void ufs_qcom_ice_cfg_work(struct work_struct *work) { unsigned long flags; - struct ice_data_setting ice_set; struct ufs_qcom_host *qcom_host = container_of(work, struct ufs_qcom_host, ice_cfg_work); - struct request *req_pending = NULL; if (!qcom_host->ice.vops->config_start) return; spin_lock_irqsave(&qcom_host->ice_work_lock, flags); - req_pending = qcom_host->req_pending; - if (!req_pending) { + if (!qcom_host->req_pending) { + qcom_host->work_pending = false; spin_unlock_irqrestore(&qcom_host->ice_work_lock, flags); return; } @@ -188,25 +188,15 @@ static void ufs_qcom_ice_cfg_work(struct work_struct *work) /* * config_start is called again as previous attempt returned -EAGAIN, - * this call shall now take care of the necessary key setup. - * 'ice_set' will not actually be used, instead the next call to - * config_start() for this request, in the normal call flow, will - * succeed as the key has now been setup. */ qcom_host->ice.vops->config_start(qcom_host->ice.pdev, - qcom_host->req_pending, &ice_set, false); + qcom_host->req_pending, NULL, false); spin_lock_irqsave(&qcom_host->ice_work_lock, flags); qcom_host->req_pending = NULL; + qcom_host->work_pending = false; spin_unlock_irqrestore(&qcom_host->ice_work_lock, flags); - /* - * Resume with requests processing. We assume config_start has been - * successful, but even if it wasn't we still must resume in order to - * allow for the request to be retried. - */ - ufshcd_scsi_unblock_requests(qcom_host->hba); - } /** @@ -235,6 +225,13 @@ int ufs_qcom_ice_init(struct ufs_qcom_host *qcom_host) } qcom_host->dbg_print_en |= UFS_QCOM_ICE_DEFAULT_DBG_PRINT_EN; + ice_workqueue = alloc_workqueue("ice-set-key", + WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); + if (!ice_workqueue) { + dev_err(ufs_dev, "%s: workqueue allocation failed.\n", + __func__); + goto out; + } INIT_WORK(&qcom_host->ice_cfg_work, ufs_qcom_ice_cfg_work); out: @@ -285,21 +282,17 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host, * requires a non-atomic context, this means we should * call the function again from the worker thread to do * the configuration. For this request the error will - * propagate so it will be re-queued and until the - * configuration is is completed we block further - * request processing. + * propagate so it will be re-queued. */ if (err == -EAGAIN) { dev_dbg(qcom_host->hba->dev, "%s: scheduling task for ice setup\n", __func__); - if (!qcom_host->req_pending) { - ufshcd_scsi_block_requests( - qcom_host->hba); + if (!qcom_host->work_pending) { qcom_host->req_pending = cmd->request; - if (!schedule_work( + if (!queue_work(ice_workqueue, &qcom_host->ice_cfg_work)) { qcom_host->req_pending = NULL; @@ -307,10 +300,9 @@ int ufs_qcom_ice_req_setup(struct ufs_qcom_host *qcom_host, &qcom_host->ice_work_lock, flags); - ufshcd_scsi_unblock_requests( - qcom_host->hba); return err; } + qcom_host->work_pending = true; } } else { @@ -409,9 +401,7 @@ int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host, * requires a non-atomic context, this means we should * call the function again from the worker thread to do * the configuration. For this request the error will - * propagate so it will be re-queued and until the - * configuration is is completed we block further - * request processing. + * propagate so it will be re-queued. */ if (err == -EAGAIN) { @@ -419,11 +409,9 @@ int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host, "%s: scheduling task for ice setup\n", __func__); - if (!qcom_host->req_pending) { - ufshcd_scsi_block_requests( - qcom_host->hba); + if (!qcom_host->work_pending) { qcom_host->req_pending = cmd->request; - if (!schedule_work( + if (!queue_work(ice_workqueue, &qcom_host->ice_cfg_work)) { qcom_host->req_pending = NULL; @@ -431,10 +419,9 @@ int ufs_qcom_ice_cfg_start(struct ufs_qcom_host *qcom_host, &qcom_host->ice_work_lock, flags); - ufshcd_scsi_unblock_requests( - qcom_host->hba); return err; } + qcom_host->work_pending = true; } } else { diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5858ae06fe04..2394e7ac4096 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1516,7 +1516,6 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba) if (!host->disable_lpm) { hba->caps |= UFSHCD_CAP_CLK_GATING; hba->caps |= UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; - hba->caps |= UFSHCD_CAP_CLK_SCALING; } hba->caps |= UFSHCD_CAP_AUTO_BKOPS_SUSPEND; diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h index 8fd8cd7c89c6..fd98a3381d61 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/scsi/ufs/ufs-qcom.h @@ -375,6 +375,7 @@ struct ufs_qcom_host { struct work_struct ice_cfg_work; struct request *req_pending; struct ufs_vreg *vddp_ref_clk; + bool work_pending; }; static inline u32 diff --git a/drivers/scsi/ufs/ufs_quirks.c b/drivers/scsi/ufs/ufs_quirks.c index 4beb2b2dc094..8076f5d20790 100644 --- a/drivers/scsi/ufs/ufs_quirks.c +++ b/drivers/scsi/ufs/ufs_quirks.c @@ -14,8 +14,6 @@ #include "ufshcd.h" #include "ufs_quirks.h" -#include - static struct ufs_card_fix ufs_fixups[] = { /* UFS cards deviations table */ UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ), @@ -49,105 +47,6 @@ static struct ufs_card_fix ufs_fixups[] = { END_FIX }; -static int ufs_get_capacity_info(struct ufs_hba *hba, u64 *pcapacity) -{ - int err; - u8 geometry_buf[QUERY_DESC_GEOMETRY_MAZ_SIZE]; - - err = ufshcd_read_geometry_desc(hba, geometry_buf, - QUERY_DESC_GEOMETRY_MAZ_SIZE); - if (err) - goto out; - - *pcapacity = (u64)geometry_buf[0x04] << 56 | - (u64)geometry_buf[0x04 + 1] << 48 | - (u64)geometry_buf[0x04 + 2] << 40 | - (u64)geometry_buf[0x04 + 3] << 32 | - (u64)geometry_buf[0x04 + 4] << 24 | - (u64)geometry_buf[0x04 + 5] << 16 | - (u64)geometry_buf[0x04 + 6] << 8 | - (u64)geometry_buf[0x04 + 7]; - - printk("ufs_get_capacity_info size = 0x%llx", *pcapacity); - -out: - return err; -} - -static char* ufs_get_capacity_size(u64 capacity) -{ - if (capacity == 0x1D62000)/*16G*/ - return "16G"; - else if (capacity == 0x3B9E000)/*32G*/ - return "32G"; - else if (capacity == 0x7734000)/*64G*/ - return "64G"; - else if (capacity == 0xEE60000)/*128G*/ - return "128G"; - else if (capacity == 0xEE64000)/*128G V4*/ - return "128G"; - else - return "0G"; -} - -char ufs_vendor_and_rev[32] = {'\0'}; -char ufs_product_id[32] = {'\0'}; -int ufs_fill_info(struct ufs_hba *hba) -{ - int err=0; - u64 ufs_capacity = 0; - char ufs_vendor[9]={'\0'}; - char ufs_rev[7]={'\0'}; - - /* Error Handle: Before filling ufs info, we must confirm sdev_ufs_device structure is not NULL*/ - if(!hba->sdev_ufs_device) { - dev_err(hba->dev, "%s:hba->sdev_ufs_device is NULL!\n", __func__); - goto out; - } - - /* Copy UFS info from host controller structure (ex:vendor name, firmware revision) */ - if(!hba->sdev_ufs_device->vendor) { - dev_err(hba->dev, "%s: UFS vendor info is NULL\n", __func__); - strlcpy(ufs_vendor, "UNKNOWN", 7); - } else { - strlcpy(ufs_vendor, hba->sdev_ufs_device->vendor, - sizeof(ufs_vendor)-1); - } - - if(!hba->sdev_ufs_device->rev) { - dev_err(hba->dev, "%s: UFS firmware info is NULL\n", __func__); - strncpy(ufs_rev, "UNKNOWN", 7); - } else { - strncpy(ufs_rev, hba->sdev_ufs_device->rev, sizeof(ufs_rev)-1); - } - - if(!hba->sdev_ufs_device->model) { - dev_err(hba->dev, "%s: UFS product id info is NULL\n", __func__); - strlcpy(ufs_product_id, "UNKNOWN", 7); - } else { - strlcpy(ufs_product_id, hba->sdev_ufs_device->model, 16); - } - - /* Get UFS storage size*/ - err = ufs_get_capacity_info(hba, &ufs_capacity); - if (err) { - dev_err(hba->dev, "%s: Failed getting capacity info\n", __func__); - goto out; - } - - /* Combine vendor name with firmware revision */ - strcat(ufs_vendor_and_rev, ufs_vendor); - strcat(ufs_vendor_and_rev, " "); - strcat(ufs_vendor_and_rev, ufs_get_capacity_size(ufs_capacity)); - strcat(ufs_vendor_and_rev, " "); - strcat(ufs_vendor_and_rev, ufs_rev); - - push_component_info(UFS, ufs_product_id, ufs_vendor_and_rev); -out: - return err; - -} - static int ufs_get_device_info(struct ufs_hba *hba, struct ufs_card_info *card_data) { diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h index 8266eaa574a0..3102517e841c 100644 --- a/drivers/scsi/ufs/ufs_quirks.h +++ b/drivers/scsi/ufs/ufs_quirks.h @@ -149,6 +149,4 @@ struct ufs_card_fix { struct ufs_hba; void ufs_advertise_fixup_device(struct ufs_hba *hba); - -int ufs_fill_info(struct ufs_hba *hba); #endif /* UFS_QUIRKS_H_ */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 48335473a639..d918dad95527 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -615,7 +615,7 @@ static void ufshcd_print_cmd_log(struct ufs_hba *hba) p = &hba->cmd_log.entries[pos]; pos = (pos + 1) % UFSHCD_MAX_CMD_LOGGING; - /*if (ktime_to_us(p->tstamp)) { + if (ktime_to_us(p->tstamp)) { pr_err("%s: %s: seq_no=%u lun=0x%x cmd_id=0x%02x lba=0x%llx txfer_len=%d tag=%u, doorbell=0x%x outstanding=0x%x idn=%d time=%lld us\n", p->cmd_type, p->str, p->seq_num, p->lun, p->cmd_id, (unsigned long long)p->lba, @@ -624,7 +624,6 @@ static void ufshcd_print_cmd_log(struct ufs_hba *hba) ktime_to_us(p->tstamp)); usleep_range(1000, 1100); } - */ } } #else @@ -1433,6 +1432,8 @@ static void ufshcd_ungate_work(struct work_struct *work) ufshcd_hba_vreg_set_hpm(hba); ufshcd_enable_clocks(hba); + ufshcd_enable_irq(hba); + /* Exit from hibern8 */ if (ufshcd_can_hibern8_during_gating(hba)) { /* Prevent gating in this path */ @@ -1590,6 +1591,8 @@ static void ufshcd_gate_work(struct work_struct *work) ufshcd_set_link_hibern8(hba); } + ufshcd_disable_irq(hba); + /* * If auto hibern8 is supported then the link will already * be in hibern8 state and the ref clock can be gated. @@ -3824,11 +3827,6 @@ int ufshcd_read_device_desc(struct ufs_hba *hba, u8 *buf, u32 size) } -int ufshcd_read_geometry_desc(struct ufs_hba *hba, u8 *buf, u32 size) -{ - return ufshcd_read_desc(hba, QUERY_DESC_IDN_GEOMETRY, 0, buf, size); -} - /** * ufshcd_read_string_desc - read string descriptor * @hba: pointer to adapter instance @@ -5424,14 +5422,12 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) result = DID_ERROR << 16; dev_err(hba->dev, "Reject UPIU not fully implemented\n"); - WARN_ON(1); break; default: result = DID_ERROR << 16; dev_err(hba->dev, "Unexpected request response code = %x\n", result); - WARN_ON(1); break; } break; @@ -5462,7 +5458,6 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) */ __ufshcd_print_host_regs(hba, true); ufshcd_print_host_state(hba); - WARN_ON(1); break; } /* end of switch */ @@ -7603,8 +7598,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) hba->clk_scaling.is_allowed = true; } - ufs_fill_info(hba); - scsi_scan_host(hba->host); pm_runtime_put_sync(hba->dev); } diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index c213ed53b048..dff287951035 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1160,9 +1160,6 @@ static inline int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask, int ufshcd_read_device_desc(struct ufs_hba *hba, u8 *buf, u32 size); -/*qiuchangping@BSP 2015-11-17 add for ufs info display*/ -int ufshcd_read_geometry_desc(struct ufs_hba *hba, u8 *buf, u32 size); - static inline bool ufshcd_is_hs_mode(struct ufs_pa_layer_attr *pwr_info) { return (pwr_info->pwr_rx == FAST_MODE || diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 90d28212ddd8..1bc7ae4d5768 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -958,14 +958,6 @@ config QCOM_EARLY_RANDOM may not be truly random. Select this option to make an early call to get some random data to put in the pool. If unsure, say N. -config RF_CABLE_DETECT - bool "detect RF cable connection" - help - detect RF cable connection for different RF configuration - To compile this driver as a module, choose M here: the module - will be called RF cable. - If unsure, say N. - config QCOM_CX_IPEAK bool "Common driver to handle Cx iPeak limitation" help diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index f9dd8aa3e636..b8225eebf97b 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -108,7 +108,6 @@ obj-$(CONFIG_QSEE_IPC_IRQ_BRIDGE) += qsee_ipc_irq_bridge.o obj-$(CONFIG_WCD_DSP_GLINK) += wcd-dsp-glink.o obj-$(CONFIG_QCOM_SMCINVOKE) += smcinvoke.o obj-y += project_info.o -obj-$(CONFIG_RF_CABLE_DETECT) += op_rf_cable_monitor.o obj-$(CONFIG_QCOM_EARLY_RANDOM) += early_random.o obj-$(CONFIG_QCOM_CX_IPEAK) += cx_ipeak.o obj-$(CONFIG_MSM_CACHE_M4M_ERP64) += cache_m4m_erp64.o diff --git a/drivers/soc/qcom/icnss.c b/drivers/soc/qcom/icnss.c index a63001d5a22c..a0ec4b13c81f 100755 --- a/drivers/soc/qcom/icnss.c +++ b/drivers/soc/qcom/icnss.c @@ -48,8 +48,6 @@ #include #include #include -#include -static u32 fw_version; #include "wlan_firmware_service_v01.h" @@ -4639,24 +4637,6 @@ static int icnss_get_vbatt_info(struct icnss_priv *priv) return 0; } -/* Initial and show wlan firmware build version */ -void cnss_set_fw_version(u32 version) { - fw_version = version; -} -EXPORT_SYMBOL(cnss_set_fw_version); - -static ssize_t cnss_version_information_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - if (!penv) - return -ENODEV; - return scnprintf(buf, PAGE_SIZE, "%u.%u.%u.%u\n", (fw_version & 0xf0000000) >> 28, - (fw_version & 0xf000000) >> 24, (fw_version & 0xf00000) >> 20, fw_version & 0x7fff); -} - -static DEVICE_ATTR(cnss_version_information, 0444, - cnss_version_information_show, NULL); - static int icnss_probe(struct platform_device *pdev) { int ret = 0; @@ -4855,10 +4835,6 @@ static int icnss_probe(struct platform_device *pdev) init_completion(&priv->unblock_shutdown); - /* Create device file */ - device_create_file(&penv->pdev->dev, &dev_attr_cnss_version_information); - push_component_info(WCN, "WCN3990", "QualComm"); - icnss_pr_info("Platform driver probed successfully\n"); return 0; @@ -4881,8 +4857,6 @@ static int icnss_remove(struct platform_device *pdev) icnss_debugfs_destroy(penv); - device_remove_file(&penv->pdev->dev, &dev_attr_cnss_version_information); - complete_all(&penv->unblock_shutdown); icnss_modem_ssr_unregister_notifier(penv); @@ -5048,6 +5022,7 @@ static struct platform_driver icnss_driver = { .pm = &icnss_pm_ops, .owner = THIS_MODULE, .of_match_table = icnss_dt_match, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, }; diff --git a/drivers/soc/qcom/op_rf_cable_monitor.c b/drivers/soc/qcom/op_rf_cable_monitor.c deleted file mode 100644 index 9c3aa9b72acb..000000000000 --- a/drivers/soc/qcom/op_rf_cable_monitor.c +++ /dev/null @@ -1,296 +0,0 @@ -/*For OEM project monitor RF cable connection status, -*and config different RF configuration -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static struct project_info *project_info_desc; - -struct cable_data { - int irq; - int cable_gpio; - struct delayed_work work; - struct workqueue_struct *wqueue; - struct device *dev; - struct wake_lock wl; - atomic_t running; - atomic_t pre_state; - spinlock_t lock; - int enable; -}; -static struct cable_data *_cdata; -static DEFINE_MUTEX(sem); - -static char *cmdline_find_option(char *str) -{ - return strnstr(saved_command_line, str, strlen(saved_command_line)); -} - -int modify_rf_cable_smem_info(uint32 status) -{ - project_info_desc = smem_find(SMEM_PROJECT_INFO, - sizeof(struct project_info), 0, - SMEM_ANY_HOST_FLAG); - - if (IS_ERR_OR_NULL(project_info_desc)) - pr_err("%s: get project_info failure\n", __func__); - else { - project_info_desc->rf_v3 = status; - pr_err("%s: rf_cable: %d\n", - __func__, project_info_desc->rf_v3); - } - return 0; -} - -static void rf_cable_work(struct work_struct *work) -{ - unsigned long flags; - - spin_lock_irqsave(&_cdata->lock, flags); - disable_irq_nosync(_cdata->irq); - spin_unlock_irqrestore(&_cdata->lock, flags); - if (atomic_read(&_cdata->running) == 0) { - atomic_set(&_cdata->running, 1); - msleep(300); - if (atomic_read(&_cdata->pre_state) != - gpio_get_value(_cdata->cable_gpio)) { - atomic_set(&_cdata->pre_state, - gpio_get_value(_cdata->cable_gpio)); - modify_rf_cable_smem_info( - gpio_get_value(_cdata->cable_gpio)); - op_restart_modem(); - } - } - spin_lock_irqsave(&_cdata->lock, flags); - enable_irq(_cdata->irq); - atomic_set(&_cdata->running, 0); - spin_unlock_irqrestore(&_cdata->lock, flags); -} - -irqreturn_t cable_interrupt(int irq, void *_dev) -{ - wake_lock_timeout(&_cdata->wl, - msecs_to_jiffies(CABLE_WAKELOCK_HOLD_TIME)); - queue_delayed_work(_cdata->wqueue, - &_cdata->work, msecs_to_jiffies(1)); - return IRQ_HANDLED; -} - -static ssize_t rf_cable_proc_read_func(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - int ret = 0; - char page[PAGESIZE]; - - ret = snprintf(page, sizeof(page[PAGESIZE]), "%d\n", _cdata->enable); - ret = simple_read_from_buffer(user_buf, - count, ppos, page, strlen(page)); - return ret; -} - -static ssize_t rf_cable_proc_write_func(struct file *file, - const char __user *buffer, size_t count, loff_t *ppos) -{ - unsigned long flags; - int enable = 0; - int rc; - - rc = kstrtoint(buffer, 0, &enable); - if (rc != 0) - return -EINVAL; - - pr_err("%s: cable_enable (%d)\n", __func__, enable); - if (enable != _cdata->enable) { - _cdata->enable = enable; - if (!_cdata->enable) { - spin_lock_irqsave(&_cdata->lock, flags); - disable_irq_nosync(_cdata->irq); - spin_unlock_irqrestore(&_cdata->lock, flags); - pr_err("%s: pre_state (%d)\n", - __func__, atomic_read(&_cdata->pre_state)); - if (atomic_read(&_cdata->pre_state) != 1) { - atomic_set(&_cdata->pre_state, 1); - modify_rf_cable_smem_info(1); - op_restart_modem(); - } - } else { - spin_lock_irqsave(&_cdata->lock, flags); - enable_irq(_cdata->irq); - spin_unlock_irqrestore(&_cdata->lock, flags); - pr_err("%s: pre_state (%d)\n", - __func__, atomic_read(&_cdata->pre_state)); - if (atomic_read(&_cdata->pre_state) != - gpio_get_value(_cdata->cable_gpio)) { - atomic_set(&_cdata->pre_state, - gpio_get_value(_cdata->cable_gpio)); - modify_rf_cable_smem_info( - gpio_get_value(_cdata->cable_gpio)); - op_restart_modem(); - } - } - } - return count; -} - -static const struct file_operations rf_enable_proc_fops = { - .write = rf_cable_proc_write_func, - .read = rf_cable_proc_read_func, - .open = simple_open, - .owner = THIS_MODULE, -}; - -int create_rf_cable_procfs(void) -{ - int ret = 0; - - if (!proc_create("rf_cable_config", - 0666, NULL, &rf_enable_proc_fops)) { - pr_err("%s: proc_create enable fail!\n", __func__); - ret = -1; - } - _cdata->enable = 1; - return ret; -} - -static int op_rf_request_named_gpio(const char *label, int *gpio) -{ - struct device *dev = _cdata->dev; - struct device_node *np = dev->of_node; - int rc = of_get_named_gpio(np, label, 0); - - if (rc < 0) { - dev_err(dev, "failed to get '%s'\n", label); - *gpio = rc; - return rc; - } - *gpio = rc; - rc = devm_gpio_request(dev, *gpio, label); - if (rc) { - dev_err(dev, "failed to request gpio %d\n", *gpio); - return rc; - } - dev_info(dev, "%s - gpio: %d\n", label, *gpio); - return 0; -} - -static int op_rf_cable_probe(struct platform_device *pdev) -{ - int rc = 0; - struct device *dev = &pdev->dev; - - if (cmdline_find_option("ftm_mode")) { - pr_err("%s: ftm_mode FOUND! use 1 always\n", __func__); - modify_rf_cable_smem_info(1); - } else { - _cdata = kzalloc(sizeof(struct cable_data), GFP_KERNEL); - if (!_cdata) { - pr_err("%s: failed to allocate memory\n", __func__); - rc = -ENOMEM; - goto exit; - } - - _cdata->dev = dev; - dev_set_drvdata(dev, _cdata); - - rc = op_rf_request_named_gpio("rf,cable-gpio", - &_cdata->cable_gpio); - if (rc) { - pr_err("%s: op_rf_request_named_gpio fail\n", __func__); - goto exit_gpio; - } - gpio_direction_input(_cdata->cable_gpio); - - _cdata->wqueue = create_singlethread_workqueue( - "op_rf_cable_wqueue"); - INIT_DELAYED_WORK(&_cdata->work, rf_cable_work); - _cdata->irq = gpio_to_irq(_cdata->cable_gpio); - if (_cdata->irq < 0) { - pr_err("Unable to get irq number for GPIO %d, error %d\n", - _cdata->cable_gpio, _cdata->irq); - rc = _cdata->irq; - goto exit_gpio; - } - - rc = request_irq(_cdata->irq, cable_interrupt, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, - "op_rf_cable", _cdata); - if (rc) { - pr_err("could not request irq %d\n", _cdata->irq); - goto exit_gpio; - } - pr_err("requested irq %d\n", _cdata->irq); - enable_irq_wake(_cdata->irq); - - wake_lock_init(&_cdata->wl, WAKE_LOCK_SUSPEND, - "rf_cable_wake_lock"); - spin_lock_init(&_cdata->lock); - atomic_set(&_cdata->running, 0); - atomic_set(&_cdata->pre_state, - gpio_get_value(_cdata->cable_gpio)); - - modify_rf_cable_smem_info( - gpio_get_value(_cdata->cable_gpio)); - create_rf_cable_procfs(); - } - pr_err("%s: probe ok!\n", __func__); - return 0; - -exit_gpio: - kfree(_cdata); -exit: - pr_err("%s: probe Fail!\n", __func__); - - return rc; -} - -static const struct of_device_id rf_of_match[] = { - { .compatible = "oem,rf_cable", }, - {} -}; -MODULE_DEVICE_TABLE(of, rf_of_match); - -static struct platform_driver op_rf_cable_driver = { - .driver = { - .name = "op_rf_cable", - .owner = THIS_MODULE, - .of_match_table = rf_of_match, - }, - .probe = op_rf_cable_probe, -}; - -static int __init op_rf_cable_init(void) -{ - int ret; - - ret = platform_driver_register(&op_rf_cable_driver); - if (ret) - pr_err("rf_cable_driver register failed: %d\n", ret); - - return ret; -} - -MODULE_LICENSE("GPL v2"); -subsys_initcall(op_rf_cable_init); diff --git a/drivers/soc/qcom/project_info.c b/drivers/soc/qcom/project_info.c index dbe2eb4f162c..5ecfc4632d8c 100644 --- a/drivers/soc/qcom/project_info.c +++ b/drivers/soc/qcom/project_info.c @@ -103,9 +103,6 @@ static ssize_t project_info_get(struct device *dev, if (attr == &dev_attr_platform_id) return snprintf(buf, BUF_SIZE, "%d\n", project_info_desc->platform_id); - if (attr == &dev_attr_serialno) - return snprintf(buf, BUF_SIZE, "0x%x\n", - chip_serial_num); if (attr == &dev_attr_feature_id) return snprintf(buf, BUF_SIZE, "%d\n", project_info_desc->feature_id); @@ -403,7 +400,7 @@ void get_ddr_manufacture_name(void) for (i = 0; i < length; i++) { if (ddr_manufacture_list[i].id == project_info_desc->ddr_manufacture_info) { - snprintf(ddr_manufacture, BUF_SIZE, "%s", + snprintf(ddr_manufacture, sizeof(ddr_manufacture), "%s", ddr_manufacture_list[i].name); break; } @@ -420,7 +417,7 @@ void get_cpu_type(void) for (i = 0; i < length; i++) { if (cpu_list_msm[i].id == project_info_desc->platform_id) { - snprintf(cpu_type, BUF_SIZE, + snprintf(cpu_type, sizeof(cpu_type), "%s", cpu_list_msm[i].name); break; } diff --git a/drivers/soc/qcom/qpnp-haptic.c b/drivers/soc/qcom/qpnp-haptic.c index 977a9d90ccad..a606ea970120 100755 --- a/drivers/soc/qcom/qpnp-haptic.c +++ b/drivers/soc/qcom/qpnp-haptic.c @@ -1529,10 +1529,7 @@ static void update_lra_frequency(struct qpnp_hap *hap) lra_init_freq = 200000/temp; - if ((abs(lra_init_freq-235)*100/235) < 5) { - lra_auto_res_lo = lra_auto_res_lo; - lra_auto_res_hi = lra_auto_res_hi; - } else{ + if ((abs(lra_init_freq-235)*100/235) >= 5) { lra_auto_res_lo = 0x53; lra_auto_res_hi = 0x3; } diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 8ebd24485457..3e08b23c817d 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -583,8 +583,6 @@ static enum msm_cpu cur_cpu; static int current_image; static uint32_t socinfo_format; -uint32_t chip_serial_num; - static struct socinfo_v0_1 dummy_socinfo = { .format = SOCINFO_VERSION(0, 1), .version = 1, @@ -1609,8 +1607,6 @@ int __init socinfo_init(void) socinfo_print(); arch_read_hardware_id = msm_read_hardware_id; - /*read serial number*/ - chip_serial_num = socinfo_get_serial_number(); socinfo_init_done = true; return 0; diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 2d7f5b0e83c4..f66f68f9ac25 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -344,7 +344,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, struct list_head pages; struct list_head pages_from_pool; struct page_info *info, *tmp_info; - int i = 0; + int i = 0, j; unsigned int nents_sync = 0; unsigned long size_remaining = PAGE_ALIGN(size); unsigned int max_order = orders[0]; @@ -424,7 +424,6 @@ static int ion_system_heap_allocate(struct ion_heap *heap, } i = 0; - sg = table->sgl; /* * We now have two separate lists. One list contains pages from the @@ -432,7 +431,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, * together while preserving the ordering of the pages (higher order * first). */ - do { + for_each_sg(table->sgl, sg, table->nents, j) { info = list_first_entry_or_null(&pages, struct page_info, list); tmp_info = list_first_entry_or_null(&pages_from_pool, struct page_info, list); @@ -460,9 +459,7 @@ static int ion_system_heap_allocate(struct ion_heap *heap, } else { BUG(); } - sg = sg_next(sg); - - } while (sg); + } ret = msm_ion_heap_pages_zero(data.pages, data.size >> PAGE_SHIFT); if (ret) { diff --git a/drivers/staging/android/ion/msm/msm_ion.c b/drivers/staging/android/ion/msm/msm_ion.c index bae48d4d069c..55960c6eb8c9 100644 --- a/drivers/staging/android/ion/msm/msm_ion.c +++ b/drivers/staging/android/ion/msm/msm_ion.c @@ -1078,6 +1078,7 @@ static struct platform_driver msm_ion_driver = { .driver = { .name = "ion-msm", .of_match_table = msm_ion_match_table, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, }; diff --git a/drivers/staging/qcacld-3.0/Kconfig b/drivers/staging/qcacld-3.0/Kconfig index bed09cd17422..ae7733dabde5 100644 --- a/drivers/staging/qcacld-3.0/Kconfig +++ b/drivers/staging/qcacld-3.0/Kconfig @@ -13,6 +13,10 @@ config QCACLD_WLAN_LFR3 bool "Enable the WLAN Legacy Fast Roaming feature Version 3" default n +config WLAN_FEATURE_FILS + bool "Enable FILS Feature (11ai)" + default n + config PRIMA_WLAN_OKC bool "Enable the Prima WLAN Opportunistic Key Caching feature" default n @@ -46,6 +50,10 @@ config QCACLD_FEATURE_GREEN_AP bool "Enable Green AP feature" default n +config QCACLD_FEATURE_METERING + bool "Enable feature metering" + default y + config HELIUMPLUS bool "Enable Beeliner based descriptor structures for Helium" default n diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 04cf31c119ef..552ffc40aa17 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -798,10 +798,12 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, int delay) { if (delay > 1000) - mod_delayed_work(system_freezable_wq, &tz->poll_queue, + mod_delayed_work(system_freezable_power_efficient_wq, + &tz->poll_queue, round_jiffies(msecs_to_jiffies(delay))); else if (delay) - mod_delayed_work(system_freezable_wq, &tz->poll_queue, + mod_delayed_work(system_freezable_power_efficient_wq, + &tz->poll_queue, msecs_to_jiffies(delay)); else cancel_delayed_work(&tz->poll_queue); diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 7df529dffda8..766fc7752a71 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -39,7 +39,6 @@ #include #include #include -#include #define UART_MR1 0x0000 @@ -162,22 +161,6 @@ #define UARTDM_TX_MAX 256 /* in bytes, valid for <= 1p3 */ #define UARTDM_RX_SIZE (UART_XMIT_SIZE / 4) -/*zyh we use dynamic add console , so we can't use __init __exit, -*this will cause can't find func -*/ -#ifdef __init -#undef __init -#endif - -#ifdef __exit -#undef __exit -#endif - -#define __init -#define __exit - - - enum { UARTDM_1P1 = 1, UARTDM_1P2, @@ -1753,29 +1736,6 @@ msm_serial_early_console_setup_dm(struct earlycon_device *device, OF_EARLYCON_DECLARE(msm_serial_dm, "qcom,msm-uartdm", msm_serial_early_console_setup_dm); - -struct oemconsole { - bool default_console; - bool force_console; - bool console_initialized; -}; - -static struct oemconsole oem_console = { - .default_console = false, - .force_console = false, - .console_initialized = false, -}; - - -static int __init parse_console_config(char *str) -{ - if(str != NULL){ - oem_console.default_console = true; - } - return 0; -} -early_param("console", parse_console_config); - static struct uart_driver msm_uart_driver; static struct console msm_console = { @@ -1819,8 +1779,6 @@ static int msm_serial_probe(struct platform_device *pdev) struct uart_port *port; const struct of_device_id *id; int irq, line; - struct pinctrl *pinctrl = NULL; - struct pinctrl_state *set_state = NULL; if (pdev->dev.of_node) line = of_alias_get_id(pdev->dev.of_node, "serial"); @@ -1839,22 +1797,6 @@ static int msm_serial_probe(struct platform_device *pdev) port->dev = &pdev->dev; msm_port = UART_TO_MSM(port); - pinctrl = devm_pinctrl_get(port->dev); - if (pinctrl != NULL) { - if (!oem_console.default_console && - !oem_console.force_console) { - set_state = pinctrl_lookup_state(pinctrl, - "uart_deactive"); - if(set_state != NULL) - pinctrl_select_state(pinctrl, set_state); - } else { - set_state = pinctrl_lookup_state(pinctrl, - "uart_active"); - if (set_state != NULL) - pinctrl_select_state(pinctrl, set_state); - } - } - id = of_match_device(msm_uartdm_table, &pdev->dev); if (id) msm_port->is_uartdm = (unsigned long)id->data; @@ -1893,7 +1835,6 @@ static int msm_serial_remove(struct platform_device *pdev) { struct uart_port *port = platform_get_drvdata(pdev); - msm_power(port, 3, 0); uart_remove_one_port(&msm_uart_driver, port); return 0; @@ -1939,29 +1880,10 @@ static struct platform_driver msm_platform_driver = { .pm = &msm_serial_pm_ops, }, }; -static int msm_serial_pinctrl_init(void); static int __init msm_serial_init(void) { - int ret = 0; - - pr_err("%s\n", __func__); - if (oem_console.console_initialized == 1) { - pr_err("%s int=%d\n", __func__, - oem_console.console_initialized); - return 0; - } + int ret; - if (!oem_console.default_console && !oem_console.force_console) { - pr_err("don'tinit serial %s force_console=%d default_console=%d\n", - __func__, oem_console.force_console, - oem_console.default_console); - /* - *zyh we set serial gpio pown down, - *use register unregister will cause boot up slow - */ - msm_serial_pinctrl_init(); - return 0; - } ret = uart_register_driver(&msm_uart_driver); if (unlikely(ret)) return ret; @@ -1969,189 +1891,18 @@ static int __init msm_serial_init(void) ret = platform_driver_register(&msm_platform_driver); if (unlikely(ret)) uart_unregister_driver(&msm_uart_driver); - if (!oem_console.default_console && !oem_console.force_console) { - platform_driver_unregister(&msm_platform_driver); - uart_unregister_driver(&msm_uart_driver); - pr_info("msm_platform_driver and msm_uart_driver unregister\n"); - } else { - oem_console.console_initialized = 1; - pr_info("msm_serial: driver initialized\n"); - } + + pr_info("msm_serial: driver initialized\n"); return ret; } static void __exit msm_serial_exit(void) { - pr_err("%s\n", __func__); - - if (oem_console.console_initialized == 0) { - pr_err("msm_serial: driver already exit %s int=%d\n", - __func__, oem_console.console_initialized); - return; - } - oem_console.console_initialized = 0; platform_driver_unregister(&msm_platform_driver); uart_unregister_driver(&msm_uart_driver); } -static int msm_serial_pinctrl_probe(struct platform_device *pdev) -{ - - struct pinctrl *pinctrl = NULL; - struct pinctrl_state *set_state = NULL; - struct device *dev = &pdev->dev; - - pr_err("%s\n", __func__); - pinctrl = devm_pinctrl_get(dev); - - if (pinctrl != NULL) { - - set_state = pinctrl_lookup_state( - pinctrl, "uart_pinctrl_deactive"); - - if (set_state != NULL) - pinctrl_select_state(pinctrl, set_state); - - devm_pinctrl_put(pinctrl); - } - return 0; -} - -static int msm_serial_pinctrl_remove(struct platform_device *pdev) -{ - return 0; -} - - -static const struct of_device_id oem_serial_pinctrl_of_match[] = { - { .compatible = "oem,oem_serial_pinctrl" }, - {} -}; - - -static struct platform_driver msm_platform_serial_pinctrl_driver = { - .remove = msm_serial_pinctrl_remove, - .probe = msm_serial_pinctrl_probe, - .driver = { - .name = "oem_serial_pinctrl", - .of_match_table = oem_serial_pinctrl_of_match, - }, -}; - -static int msm_serial_pinctrl_init(void) -{ - int ret = 0; - - pr_err("%s\n", __func__); - - ret = platform_driver_register(&msm_platform_serial_pinctrl_driver); - - return ret; -} - -#define OEM_SERIAL_MAGIC 0xEA -#define OEM_FORCE_SERIAL_OPEN _IOW(OEM_SERIAL_MAGIC, 0x01, int) -#define OEM_FORCE_SERIAL_CLOSE _IOW(OEM_SERIAL_MAGIC, 0x02, int) -#define SERIAL_CMDLINE "ttyMSM0,115200,n8" - -struct miscdevice fore_serial_device; -char oem_force_cmdline_str[60]; - -int msm_serial_oem_init(void) -{ - int ret = 0; - - pr_err("%s\n", __func__); - oem_console.force_console = true; - memcpy(oem_force_cmdline_str, SERIAL_CMDLINE, sizeof(SERIAL_CMDLINE)); - force_oem_console_setup(&oem_force_cmdline_str[0]); - msm_serial_init(); - return ret; -} -EXPORT_SYMBOL(msm_serial_oem_init); - -void msm_serial_oem_exit(void) -{ - pr_err("%s\n", __func__); - msm_serial_exit(); - oem_console.force_console = false; -} -EXPORT_SYMBOL(msm_serial_oem_exit); - -static ssize_t oem_force_serial_dev_read -(struct file *filp, char __user *buf, size_t count, loff_t *offset) -{ - return 0; -} - -static ssize_t oem_force_serial_dev_write -(struct file *filp, const char __user *buf, size_t count, loff_t *offset) -{ - return 0; -} - -static int oem_force_serial_dev_open -(struct inode *inode, struct file *filp) -{ - return 0; -} - -static long oem_force_serial_dev_ioctl -(struct file *filp, unsigned int cmd, unsigned long arg) -{ - pr_info("%s : cmd = %d, arg = %ld\n", __func__, _IOC_NR(cmd), arg); - switch (cmd) { - case OEM_FORCE_SERIAL_OPEN: - msm_serial_oem_init(); - break; - case OEM_FORCE_SERIAL_CLOSE: - msm_serial_oem_exit(); - break; - } - return 0; -} - -static const struct file_operations oem_force_serial_dev_fops = { - .owner = THIS_MODULE, - .read = oem_force_serial_dev_read, - .write = oem_force_serial_dev_write, - .open = oem_force_serial_dev_open, - .unlocked_ioctl = oem_force_serial_dev_ioctl, -}; - -static int oem_force_serial_probe(struct platform_device *pdev) -{ - int ret = 0; - - pr_err("%s\n", __func__); - fore_serial_device.minor = MISC_DYNAMIC_MINOR; - fore_serial_device.name = "oem_force_serial"; - fore_serial_device.fops = &oem_force_serial_dev_fops; - - ret = misc_register(&fore_serial_device); - - if (ret) - pr_err("%s : misc_register failed\n", __func__); - - return ret; -} - -static const struct of_device_id oem_force_serial_of_match[] = { - {.compatible = "oem,force_serial" }, - {} -}; -MODULE_DEVICE_TABLE(of, oem_force_serial_of_match); - -static struct platform_driver oem_force_serial_driver = { - .driver = { - .name = "force_serial", - .owner = THIS_MODULE, - .of_match_table = oem_force_serial_of_match, - }, - .probe = oem_force_serial_probe, -}; -module_platform_driver(oem_force_serial_driver); module_init(msm_serial_init); module_exit(msm_serial_exit); diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index f10cf40d6662..1ccad338f4bd 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -756,6 +756,8 @@ static void kick_sm(struct usbpd *pd, int ms) static void phy_sig_received(struct usbpd *pd, enum pd_sig_type sig) { union power_supply_propval val = {1}; + usbpd_info(&pd->dev, "%s return by oem\n", __func__); + return; if (sig != HARD_RESET_SIG) { usbpd_err(&pd->dev, "invalid signal (%d) received\n", sig); @@ -1060,7 +1062,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) */ } - dual_role_instance_changed(pd->dual_role); /* Set CC back to DRP toggle for the next disconnect */ val.intval = POWER_SUPPLY_TYPEC_PR_DUAL; @@ -1220,11 +1221,12 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) if (pd->psy_type == POWER_SUPPLY_TYPE_USB || pd->psy_type == POWER_SUPPLY_TYPE_USB_CDP || pd->psy_type == POWER_SUPPLY_TYPE_USB_FLOAT || - usb_compliance_mode) + usb_compliance_mode){ + usbpd_err(&pd->dev, "sink start:pd start peripheral\n"); start_usb_peripheral(pd); + } } - dual_role_instance_changed(pd->dual_role); ret = power_supply_get_property(pd->usb_psy, POWER_SUPPLY_PROP_PD_ALLOWED, &val); @@ -1334,6 +1336,7 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) case PE_SNK_TRANSITION_TO_DEFAULT: if (pd->current_dr != DR_UFP) { + usbpd_err(&pd->dev, "to default:pd start peripheral\n"); stop_usb_host(pd); start_usb_peripheral(pd); pd->current_dr = DR_UFP; @@ -1835,21 +1838,6 @@ static int enable_vbus(struct usbpd *pd) else pd->vbus_enabled = true; - count = 10; - /* - * Check to make sure VBUS voltage reaches above Vsafe5Vmin (4.75v) - * before proceeding. - */ - while (count--) { - ret = power_supply_get_property(pd->usb_psy, - POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); - if (ret || val.intval >= 4750000) /*vsafe5Vmin*/ - break; - usleep_range(10000, 12000); /* Delay between two reads */ - } - - if (ret) - msleep(100); /* Delay to wait for VBUS ramp up if read fails */ return ret; } @@ -2062,41 +2050,23 @@ static void usbpd_sm(struct work_struct *w) break; case PE_SRC_SEND_CAPABILITIES: - ret = pd_send_msg(pd, MSG_SOURCE_CAPABILITIES, default_src_caps, - ARRAY_SIZE(default_src_caps), SOP_MSG); + ret = pd_send_msg(pd, MSG_PS_RDY, NULL, 0, SOP_MSG); if (ret) { pd->caps_count++; - if (pd->caps_count == 10 && pd->current_dr == DR_DFP) { - /* Likely not PD-capable, start host now */ + if (pd->caps_count < 10 && pd->current_dr == DR_DFP) { start_usb_host(pd, true); - } else if (pd->caps_count >= PD_CAPS_COUNT) { - usbpd_dbg(&pd->dev, "Src CapsCounter exceeded, disabling PD\n"); + } else if (pd->caps_count >= 10) { usbpd_set_state(pd, PE_SRC_DISABLED); - - val.intval = 0; - power_supply_set_property(pd->usb_psy, - POWER_SUPPLY_PROP_PD_ACTIVE, - &val); break; } - kick_sm(pd, SRC_CAP_TIME); break; } - /* transmit was successful if GoodCRC was received */ - pd->caps_count = 0; - pd->hard_reset_count = 0; - pd->pd_connected = true; /* we know peer is PD capable */ - - /* wait for REQUEST */ - pd->current_state = PE_SRC_SEND_CAPABILITIES_WAIT; - kick_sm(pd, SENDER_RESPONSE_TIME); - - val.intval = 1; - power_supply_set_property(pd->usb_psy, - POWER_SUPPLY_PROP_PD_ACTIVE, &val); + usbpd_info(&pd->dev, "Start host snd msg ok\n"); + if (pd->current_dr == DR_DFP) + start_usb_host(pd, true); break; case PE_SRC_SEND_CAPABILITIES_WAIT: @@ -2626,6 +2596,7 @@ static void usbpd_sm(struct work_struct *w) break; case PE_SNK_TRANSITION_TO_DEFAULT: + usbpd_err(&pd->dev, "default: sink startup\n"); usbpd_set_state(pd, PE_SNK_STARTUP); break; @@ -2906,20 +2877,18 @@ static int psy_changed(struct notifier_block *nb, unsigned long evt, void *ptr) if (pd->typec_mode == typec_mode) return 0; - if ((typec_mode == POWER_SUPPLY_TYPEC_SOURCE_DEFAULT) || - (typec_mode == POWER_SUPPLY_TYPEC_SOURCE_MEDIUM) || - (typec_mode == POWER_SUPPLY_TYPEC_SOURCE_HIGH)) { - if (pd->psy_type == POWER_SUPPLY_TYPE_UNKNOWN) { - usbpd_err(&pd->dev, "typec_mode:%d, psy_type:%d\n", - typec_mode, pd->psy_type); - return 0; - } - } - - + if ((typec_mode == POWER_SUPPLY_TYPEC_SOURCE_DEFAULT) || + (typec_mode == POWER_SUPPLY_TYPEC_SOURCE_MEDIUM) || + (typec_mode == POWER_SUPPLY_TYPEC_SOURCE_HIGH)) { + if (pd->psy_type == POWER_SUPPLY_TYPE_UNKNOWN) { + usbpd_err(&pd->dev, "typec_mode:%d, psy_type:%d\n", + typec_mode, pd->psy_type); + return 0; + } + } pd->typec_mode = typec_mode; - usbpd_dbg(&pd->dev, "typec mode:%d present:%d type:%d orientation:%d\n", + usbpd_err(&pd->dev, "typec mode:%d present:%d type:%d orientation:%d\n", typec_mode, pd->vbus_present, pd->psy_type, usbpd_get_plug_orientation(pd)); diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index 929632daa4eb..ed8fcc6860f5 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -2019,6 +2019,7 @@ static struct platform_driver mdss_fb_driver = { .name = "mdss_fb", .of_match_table = mdss_fb_dt_match, .pm = &mdss_fb_pm_ops, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, }; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d10bce6ec278..b9ca03394005 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1022,6 +1022,7 @@ static void f2fs_umount_end(struct super_block *sb, int flags) struct cp_control cpc = { .reason = CP_UMOUNT, }; + f2fs_quota_off_umount(sb); f2fs_write_checkpoint(F2FS_SB(sb), &cpc); } } diff --git a/fs/namespace.c b/fs/namespace.c index 9b6ee7d6af35..4fa637cc1122 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1747,8 +1747,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) } if (!retval || (flags & MNT_FORCE)) { /* filesystem needs to handle unclosed namespaces */ - if (mnt->mnt.mnt_sb->s_op->umount_end) - mnt->mnt.mnt_sb->s_op->umount_end(mnt->mnt.mnt_sb, flags); + if (!mnt->mnt.mnt_sb->s_op->umount_end) + goto out; + mnt->mnt.mnt_sb->s_op->umount_end(mnt->mnt.mnt_sb, flags); } out: return retval; diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig index 6122e141c697..360ae43f590c 100644 --- a/fs/pstore/Kconfig +++ b/fs/pstore/Kconfig @@ -44,13 +44,6 @@ config PSTORE_FTRACE If unsure, say N. -config PSTORE_DEVICE_INFO - bool "Log user space messages" - depends on PSTORE - help - add device_info.txt for ramdump. - If unsure, say N. - config PSTORE_RAM tristate "Log panic/oops to a RAM buffer" depends on PSTORE diff --git a/fs/pstore/Makefile b/fs/pstore/Makefile index c9033b4c2e5d..b8803cc07fce 100644 --- a/fs/pstore/Makefile +++ b/fs/pstore/Makefile @@ -7,8 +7,6 @@ obj-$(CONFIG_PSTORE) += pstore.o pstore-objs += inode.o platform.o pstore-$(CONFIG_PSTORE_FTRACE) += ftrace.o -pstore-$(CONFIG_PSTORE_DEVICE_INFO) += device_info.o - pstore-$(CONFIG_PSTORE_PMSG) += pmsg.o ramoops-objs += ram.o ram_core.o diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index b92e6d1a6c44..d8c439d813ce 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -348,10 +348,6 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, case PSTORE_TYPE_FTRACE: scnprintf(name, sizeof(name), "ftrace-%s-%lld", psname, id); break; - case PSTORE_TYPE_DEVICE_INFO: - scnprintf(name, sizeof(name), - "device-info-%s-%lld", psname, id); - break; case PSTORE_TYPE_MCE: scnprintf(name, sizeof(name), "mce-%s-%lld", psname, id); break; diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 533f4b11d5e4..664c778b7401 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -45,7 +45,7 @@ module_param(record_size, ulong, 0400); MODULE_PARM_DESC(record_size, "size of each dump done on oops/panic"); -static ulong ramoops_console_size = 256*1024UL; +static ulong ramoops_console_size = MIN_MEM_SIZE; module_param_named(console_size, ramoops_console_size, ulong, 0400); MODULE_PARM_DESC(console_size, "size of kernel console log"); @@ -53,10 +53,6 @@ static ulong ramoops_ftrace_size = MIN_MEM_SIZE; module_param_named(ftrace_size, ramoops_ftrace_size, ulong, 0400); MODULE_PARM_DESC(ftrace_size, "size of ftrace log"); -static ulong ramoops_device_info_size = MIN_MEM_SIZE; -module_param_named(device_info_size, ramoops_device_info_size, ulong, 0400); -MODULE_PARM_DESC(device_info_size, "size of device info"); - static ulong ramoops_pmsg_size = 256*1024UL; module_param_named(pmsg_size, ramoops_pmsg_size, ulong, 0400); @@ -93,7 +89,6 @@ struct ramoops_context { struct persistent_ram_zone **przs; struct persistent_ram_zone *cprz; struct persistent_ram_zone *fprz; - struct persistent_ram_zone *dprz; struct persistent_ram_zone *mprz; phys_addr_t phys_addr; unsigned long size; @@ -101,7 +96,6 @@ struct ramoops_context { size_t record_size; size_t console_size; size_t ftrace_size; - size_t device_info_size; size_t pmsg_size; int dump_oops; struct persistent_ram_ecc_info ecc_info; @@ -111,7 +105,6 @@ struct ramoops_context { unsigned int dump_read_cnt; unsigned int console_read_cnt; unsigned int ftrace_read_cnt; - unsigned int device_info_read_cnt; unsigned int pmsg_read_cnt; struct pstore_info pstore; }; @@ -126,7 +119,6 @@ static int ramoops_pstore_open(struct pstore_info *psi) cxt->dump_read_cnt = 0; cxt->console_read_cnt = 0; cxt->ftrace_read_cnt = 0; - cxt->device_info_read_cnt = 0; cxt->pmsg_read_cnt = 0; return 0; } @@ -226,21 +218,14 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, } if (!prz_ok(prz)) - prz = ramoops_get_next_prz(&cxt->cprz, - &cxt->console_read_cnt, - 1, id, type, PSTORE_TYPE_CONSOLE, 0); - if (!prz_ok(prz)) - prz = ramoops_get_next_prz(&cxt->fprz, - &cxt->ftrace_read_cnt, - 1, id, type, PSTORE_TYPE_FTRACE, 0); + prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt, + 1, id, type, PSTORE_TYPE_CONSOLE, 0); if (!prz_ok(prz)) - prz = ramoops_get_next_prz(&cxt->dprz, - &cxt->device_info_read_cnt, - 1, id, type, PSTORE_TYPE_DEVICE_INFO, 0); + prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt, + 1, id, type, PSTORE_TYPE_FTRACE, 0); if (!prz_ok(prz)) - prz = ramoops_get_next_prz(&cxt->mprz, - &cxt->pmsg_read_cnt, - 1, id, type, PSTORE_TYPE_PMSG, 0); + prz = ramoops_get_next_prz(&cxt->mprz, &cxt->pmsg_read_cnt, + 1, id, type, PSTORE_TYPE_PMSG, 0); if (!prz_ok(prz)) return 0; @@ -303,11 +288,6 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, return -ENOMEM; persistent_ram_write(cxt->fprz, buf, size); return 0; - } else if (type == PSTORE_TYPE_DEVICE_INFO) { - if (!cxt->dprz) - return -ENOMEM; - persistent_ram_write(cxt->dprz, buf, size); - return 0; } else if (type == PSTORE_TYPE_PMSG) { if (!cxt->mprz) return -ENOMEM; @@ -388,9 +368,6 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, int count, case PSTORE_TYPE_FTRACE: prz = cxt->fprz; break; - case PSTORE_TYPE_DEVICE_INFO: - prz = cxt->dprz; - break; case PSTORE_TYPE_PMSG: prz = cxt->mprz; break; @@ -518,6 +495,30 @@ void notrace ramoops_console_write_buf(const char *buf, size_t size) persistent_ram_write(cxt->cprz, buf, size); } +static int ramoops_parse_dt_size(struct platform_device *pdev, + const char *propname, unsigned long *val) +{ + u64 val64; + int ret; + + ret = of_property_read_u64(pdev->dev.of_node, propname, &val64); + if (ret == -EINVAL) { + *val = 0; + return 0; + } else if (ret != 0) { + dev_err(&pdev->dev, "failed to parse property %s: %d\n", + propname, ret); + return ret; + } + + if (val64 > ULONG_MAX) { + dev_err(&pdev->dev, "invalid %s %llu\n", propname, val64); + return -EOVERFLOW; + } + + *val = val64; + return 0; +} static int ramoops_parse_dt(struct platform_device *pdev, struct ramoops_platform_data *pdata) @@ -549,13 +550,32 @@ static int ramoops_parse_dt(struct platform_device *pdev, pdata->mem_type = of_property_read_bool(of_node, "unbuffered"); pdata->dump_oops = !of_property_read_bool(of_node, "no-dump-oops"); - pdata->record_size = record_size; - pdata->console_size = ramoops_console_size; - pdata->ftrace_size = ramoops_ftrace_size; - pdata->device_info_size = ramoops_device_info_size; - pdata->pmsg_size = ramoops_pmsg_size; - pdata->dump_oops = dump_oops; - pdata->ecc_info.ecc_size = ecc_size = 0; + ret = ramoops_parse_dt_size(pdev, "record-size", &pdata->record_size); + if (ret < 0) + return ret; + + ret = ramoops_parse_dt_size(pdev, "console-size", &pdata->console_size); + if (ret < 0) + return ret; + + ret = ramoops_parse_dt_size(pdev, "ftrace-size", &pdata->ftrace_size); + if (ret < 0) + return ret; + + ret = ramoops_parse_dt_size(pdev, "pmsg-size", &pdata->pmsg_size); + if (ret < 0) + return ret; + + ret = of_property_read_u32(of_node, "ecc-size", &ecc_size); + if (ret == 0) { + if (ecc_size > INT_MAX) { + dev_err(&pdev->dev, "invalid ecc-size %u\n", ecc_size); + return -EOVERFLOW; + } + pdata->ecc_info.ecc_size = ecc_size; + } else if (ret != -EINVAL) { + return ret; + } return 0; } @@ -587,11 +607,8 @@ static int ramoops_probe(struct platform_device *pdev) if (cxt->max_dump_cnt) goto fail_out; - if (!pdata->mem_size || (!pdata->record_size - && !pdata->console_size - && !pdata->ftrace_size - && !pdata->device_info_size - && !pdata->pmsg_size)) { + if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size && + !pdata->ftrace_size && !pdata->pmsg_size)) { pr_err("The memory size and the record/console size must be " "non-zero\n"); goto fail_out; @@ -603,9 +620,6 @@ static int ramoops_probe(struct platform_device *pdev) pdata->console_size = rounddown_pow_of_two(pdata->console_size); if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size)) pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); - if (pdata->device_info_size && !is_power_of_2(pdata->device_info_size)) - pdata->device_info_size - = rounddown_pow_of_two(pdata->device_info_size); if (pdata->pmsg_size && !is_power_of_2(pdata->pmsg_size)) pdata->pmsg_size = rounddown_pow_of_two(pdata->pmsg_size); @@ -615,18 +629,14 @@ static int ramoops_probe(struct platform_device *pdev) cxt->record_size = pdata->record_size; cxt->console_size = pdata->console_size; cxt->ftrace_size = pdata->ftrace_size; - cxt->device_info_size = pdata->device_info_size; cxt->pmsg_size = pdata->pmsg_size; cxt->dump_oops = pdata->dump_oops; cxt->ecc_info = pdata->ecc_info; paddr = cxt->phys_addr; - dump_mem_sz = cxt->size - - cxt->console_size - - cxt->ftrace_size - - cxt->device_info_size - - cxt->pmsg_size; + dump_mem_sz = cxt->size - cxt->console_size - cxt->ftrace_size + - cxt->pmsg_size; err = ramoops_init_przs(dev, cxt, &paddr, dump_mem_sz); if (err) goto fail_out; @@ -645,16 +655,6 @@ static int ramoops_probe(struct platform_device *pdev) if (err) goto fail_init_mprz; - /*paddr = pdata->mem_address - * + pdata->mem_size - cxt->device_info_size; - */ - err = ramoops_init_prz(dev, cxt, &cxt->dprz, &paddr, - cxt->device_info_size, 0); - if (err) - goto fail_init_dprz; - - memset(cxt->dprz->buffer->data, 0, cxt->dprz->buffer_size); - cxt->pstore.data = cxt; /* * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we @@ -690,7 +690,6 @@ static int ramoops_probe(struct platform_device *pdev) ramoops_console_size = pdata->console_size; ramoops_pmsg_size = pdata->pmsg_size; ramoops_ftrace_size = pdata->ftrace_size; - ramoops_device_info_size = pdata->device_info_size; pr_info("attached 0x%lx@0x%llx, ecc: %d/%d\n", cxt->size, (unsigned long long)cxt->phys_addr, @@ -702,8 +701,6 @@ static int ramoops_probe(struct platform_device *pdev) kfree(cxt->pstore.buf); fail_clear: cxt->pstore.bufsize = 0; - kfree(cxt->dprz); -fail_init_dprz: kfree(cxt->mprz); fail_init_mprz: kfree(cxt->fprz); @@ -720,14 +717,12 @@ static int ramoops_remove(struct platform_device *pdev) struct ramoops_context *cxt = &oops_cxt; pstore_unregister(&cxt->pstore); - cxt->max_dump_cnt = 0; kfree(cxt->pstore.buf); cxt->pstore.bufsize = 0; persistent_ram_free(cxt->mprz); persistent_ram_free(cxt->fprz); - persistent_ram_free(cxt->dprz); persistent_ram_free(cxt->cprz); ramoops_free_przs(cxt); @@ -767,7 +762,6 @@ static void ramoops_register_dummy(void) dummy_data->record_size = record_size; dummy_data->console_size = ramoops_console_size; dummy_data->ftrace_size = ramoops_ftrace_size; - dummy_data->device_info_size = ramoops_device_info_size; dummy_data->pmsg_size = ramoops_pmsg_size; dummy_data->dump_oops = dump_oops; /* diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index ad13362de0d8..11e558efd61e 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -29,7 +29,12 @@ #include #include - +struct persistent_ram_buffer { + uint32_t sig; + atomic_t start; + atomic_t size; + uint8_t data[0]; +}; #define PERSISTENT_RAM_SIG (0x43474244) /* DBGC */ diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 7a5c454fd303..4787a2566e95 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -292,7 +292,6 @@ enum power_supply_property { POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_BATTERY_TYPE, - POWER_SUPPLY_PROP_MAX }; enum power_supply_type { diff --git a/include/linux/project_info.h b/include/linux/project_info.h index 5ed67d1c3621..3035a11b4615 100644 --- a/include/linux/project_info.h +++ b/include/linux/project_info.h @@ -8,8 +8,7 @@ typedef __u8 uint8; #define SECURE_BOOT1 (SECURE_BOOT_BASE + 0x4*1) #define BUF_SIZE 64 -extern uint32_t chip_serial_num; -extern unsigned long totalram_pages __read_mostly; +extern unsigned long totalram_pages; struct project_info { diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 991bd8943e77..7097a45dbc25 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -31,16 +31,9 @@ */ #define PRZ_FLAG_NO_LOCK BIT(0) -/*struct persistent_ram_buffer;*/ +struct persistent_ram_buffer; struct rs_control; -struct persistent_ram_buffer { - uint32_t sig; - atomic_t start; - atomic_t size; - uint8_t data[0]; -}; - struct persistent_ram_ecc_info { int block_size; int ecc_size; @@ -102,7 +95,6 @@ struct ramoops_platform_data { unsigned long record_size; unsigned long console_size; unsigned long ftrace_size; - unsigned long device_info_size; unsigned long pmsg_size; int dump_oops; struct persistent_ram_ecc_info ecc_info; diff --git a/include/linux/sched.h b/include/linux/sched.h index 243709cd2aed..b72590f16386 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -63,6 +63,8 @@ struct sched_param { #include +extern bool energy_aware_enable; + #if defined(CONFIG_SCHED_TUNE) && defined(CONFIG_CGROUP_SCHEDTUNE) void disable_schedtune_boost(int disable); #else @@ -176,6 +178,7 @@ extern int nr_threads; DECLARE_PER_CPU(unsigned long, process_counts); extern int nr_processes(void); extern unsigned long nr_running(void); +extern bool cpu_has_rt_task(int cpu); extern bool single_task_running(void); extern unsigned long nr_iowait(void); extern unsigned long nr_iowait_cpu(int cpu); @@ -1603,11 +1606,6 @@ struct task_struct { atomic_t usage; unsigned int flags; /* per process flags, defined below */ unsigned int ptrace; - unsigned int kill_flag; - struct timespec ttu; - - /* add for fd leak debug */ - bool dump_fd_leak; #ifdef CONFIG_SMP struct llist_node wake_entry; @@ -2533,7 +2531,6 @@ extern void do_set_cpus_allowed(struct task_struct *p, extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); -extern bool cpupri_check_rt(void); static inline void set_wake_up_idle(bool enabled) { /* do nothing for now */ @@ -2550,10 +2547,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, return -EINVAL; return 0; } -static inline bool cpupri_check_rt(void) -{ - return false; -} #endif #ifdef CONFIG_NO_HZ_COMMON diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h index 863577697dac..03835522dfcb 100644 --- a/include/linux/uidgid.h +++ b/include/linux/uidgid.h @@ -53,7 +53,6 @@ static inline gid_t __kgid_val(kgid_t gid) #define GLOBAL_ROOT_UID KUIDT_INIT(0) #define GLOBAL_ROOT_GID KGIDT_INIT(0) -#define GLOBAL_SYSTEM_UID KUIDT_INIT(1000) #define INVALID_UID KUIDT_INIT(-1) #define INVALID_GID KGIDT_INIT(-1) diff --git a/include/soc/qcom/icnss.h b/include/soc/qcom/icnss.h index f9789176815b..3d15f4f592dc 100644 --- a/include/soc/qcom/icnss.h +++ b/include/soc/qcom/icnss.h @@ -163,6 +163,5 @@ extern void icnss_block_shutdown(bool status); extern bool icnss_is_pdr(void); extern int icnss_idle_restart(struct device *dev); extern int icnss_idle_shutdown(struct device *dev); -extern void cnss_set_fw_version(u32 version); #endif /* _ICNSS_WLAN_H_ */ diff --git a/init/Kconfig b/init/Kconfig index b4c96a95fc50..c03aca7b753f 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -829,7 +829,7 @@ config IKCONFIG_PROC config LOG_BUF_SHIFT int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" range 12 25 - default 18 + default 17 depends on PRINTK help Select the minimal kernel log buffer size as a power of 2. diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 8513f6287654..deebefcad3d7 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -60,23 +59,6 @@ extern void printascii(char *); #endif -/* -*zyh we use dynamic add console , -*so we can't use __init __exit, this will cause can't find func -*/ -#ifdef __init -#undef __init -#endif - -#ifdef __exit -#undef __exit -#endif - -#define __init -#define __exit - - - int console_printk[4] = { CONSOLE_LOGLEVEL_DEFAULT, /* console_loglevel */ MESSAGE_LOGLEVEL_DEFAULT, /* default_message_loglevel */ @@ -897,7 +879,7 @@ void log_buf_kexec_setup(void) #endif /* requested log_buf_len from kernel cmdline */ -static unsigned long __init new_log_buf_len; +static unsigned long __initdata new_log_buf_len; /* we practice scaling the ring buffer by powers of 2 */ static void __init log_buf_len_update(unsigned size) @@ -956,13 +938,6 @@ static void __init log_buf_add_cpu(void) #else /* !CONFIG_SMP */ static inline void log_buf_add_cpu(void) {} #endif /* CONFIG_SMP */ -static int __init ftm_console_silent_setup(char *str) -{ - pr_info("ftm_silent_log \n"); - console_silent(); - return 0; -} -early_param("ftm_console_silent", ftm_console_silent_setup); void __init setup_log_buf(int early) { @@ -1079,9 +1054,21 @@ static inline void boot_delay_msec(int level) static bool printk_time = IS_ENABLED(CONFIG_PRINTK_TIME); module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); -static bool print_wall_time = 1; -module_param_named(print_wall_time, print_wall_time, bool, S_IRUGO | S_IWUSR); +static size_t print_time(u64 ts, char *buf) +{ + unsigned long rem_nsec; + + if (!printk_time) + return 0; + + rem_nsec = do_div(ts, 1000000000); + + if (!buf) + return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts); + return sprintf(buf, "[%5lu.%06lu] ", + (unsigned long)ts, rem_nsec / 1000); +} static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf) { @@ -1101,6 +1088,8 @@ static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf) len++; } } + + len += print_time(msg->ts_nsec, buf ? buf + len : NULL); return len; } @@ -1662,6 +1651,8 @@ static size_t cont_print_text(char *text, size_t size) size_t len; if (cont.cons == 0 && (console_prev & LOG_NEWLINE)) { + textlen += print_time(cont.ts_nsec, text); + size -= textlen; } len = cont.len - cont.cons; @@ -1682,15 +1673,11 @@ static size_t cont_print_text(char *text, size_t size) return textlen; } -void getnstimeofday64(struct timespec64 *ts); - asmlinkage int vprintk_emit(int facility, int level, const char *dict, size_t dictlen, const char *fmt, va_list args) { static int recursion_bug; - static char texttmp[LOG_LINE_MAX]; - static bool last_new_line = true; static char textbuf[LOG_LINE_MAX]; char *text = textbuf; size_t text_len = 0; @@ -1701,10 +1688,6 @@ asmlinkage int vprintk_emit(int facility, int level, bool in_sched = false; /* cpu currently holding logbuf_lock in this function */ static unsigned int logbuf_cpu = UINT_MAX; - u64 ts_sec = local_clock(); - unsigned long rem_nsec; - - rem_nsec = do_div(ts_sec, 1000000000); if (level == LOGLEVEL_SCHED) { level = LOGLEVEL_DEFAULT; @@ -1788,45 +1771,6 @@ asmlinkage int vprintk_emit(int facility, int level, } } - if (last_new_line) { - if (print_wall_time && ts_sec >= 20) { - struct timespec64 tspec; - struct rtc_time tm; - extern struct timezone sys_tz; - - __getnstimeofday64(&tspec); - /*utc + timezone add by huoyinghui@160425*/ - if (sys_tz.tz_minuteswest < 0 || (tspec.tv_sec - sys_tz.tz_minuteswest*60) >= 0) - tspec.tv_sec -= sys_tz.tz_minuteswest * 60; - rtc_time_to_tm(tspec.tv_sec, &tm); - - text_len = scnprintf(texttmp, sizeof(texttmp), "[%02d%02d%02d_%02d:%02d:%02d.%06ld]@%d %s", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,tm.tm_hour, tm.tm_min, tm.tm_sec, - tspec.tv_nsec / 1000, this_cpu, text); - } - else { - - text_len = scnprintf(texttmp, sizeof(texttmp), "[%5lu.%06lu]@%d %s", - (unsigned long)ts_sec, rem_nsec / 1000, this_cpu, text); - } - - text = texttmp; - - /* mark and strip a trailing newline */ - if (text_len && text[text_len-1] == '\n') { - text_len--; - lflags |= LOG_NEWLINE; - } - } - - if (lflags & LOG_NEWLINE) { - last_new_line = true; - } - else { - last_new_line = false; - } - - #ifdef CONFIG_EARLY_PRINTK_DIRECT printascii(text); #endif @@ -2132,13 +2076,6 @@ static int __init console_setup(char *str) } __setup("console=", console_setup); -int force_oem_console_setup(char *str) -{ - console_setup(str); - return 1; -} -EXPORT_SYMBOL(force_oem_console_setup); - /** * add_preferred_console - add a device to the list of preferred consoles. * @name: device name diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 622328e6c95c..837f2cb48a6d 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -363,8 +363,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, * Do not reduce the frequency if the CPU has not been idle * recently, as the reduction is likely to be premature then. */ - if (busy && next_f < sg_policy->next_freq && - sg_policy->next_freq != UINT_MAX) { + if (busy && next_f < sg_policy->next_freq) { next_f = sg_policy->next_freq; /* Reset cached freq as next_freq has changed */ diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c index 14225d5d8617..1d00cf8c00fa 100644 --- a/kernel/sched/cpupri.c +++ b/kernel/sched/cpupri.c @@ -279,14 +279,3 @@ void cpupri_cleanup(struct cpupri *cp) for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) free_cpumask_var(cp->pri_to_cpu[i].mask); } - -/* - * cpupri_check_rt - check if CPU has a RT task - * should be called from rcu-sched read section. - */ -bool cpupri_check_rt(void) -{ - int cpu = raw_smp_processor_id(); - - return cpu_rq(cpu)->rd->cpupri.cpu_to_pri[cpu] > CPUPRI_NORMAL; -} diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 67f4ec1d374e..bf3eff83cdef 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3519,16 +3519,6 @@ static inline unsigned long cfs_rq_load_avg(struct cfs_rq *cfs_rq) static int idle_balance(struct rq *this_rq, struct rq_flags *rf); -static inline unsigned long task_util(struct task_struct *p) -{ -#ifdef CONFIG_SCHED_WALT - if (likely(!walt_disabled && sysctl_sched_use_walt_task_util)) - return (p->ravg.demand / - (walt_ravg_window >> SCHED_CAPACITY_SHIFT)); -#endif - return READ_ONCE(p->se.avg.util_avg); -} - static inline unsigned long _task_util_est(struct task_struct *p) { struct util_est ue = READ_ONCE(p->se.avg.util_est); @@ -3598,11 +3588,22 @@ util_est_dequeue(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep) if (ue.enqueued & UTIL_AVG_UNCHANGED) return; + /* + * Reset EWMA on utilization increases, the moving average is used only + * to smooth utilization decreases. + */ + ue.enqueued = (task_util(p) | UTIL_AVG_UNCHANGED); + if (sched_feat(UTIL_EST_FASTUP)) { + if (ue.ewma < ue.enqueued) { + ue.ewma = ue.enqueued; + goto done; + } + } + /* * Skip update of task's estimated utilization when its EWMA is * already ~1% close to its last activation value. */ - ue.enqueued = (task_util(p) | UTIL_AVG_UNCHANGED); last_ewma_diff = ue.enqueued - ue.ewma; if (within_margin(last_ewma_diff, (SCHED_CAPACITY_SCALE / 100))) return; @@ -3635,6 +3636,7 @@ util_est_dequeue(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep) ue.ewma <<= UTIL_EST_WEIGHT_SHIFT; ue.ewma += last_ewma_diff; ue.ewma >>= UTIL_EST_WEIGHT_SHIFT; +done: WRITE_ONCE(p->se.avg.util_est, ue); } @@ -4217,23 +4219,16 @@ static inline u64 sched_cfs_bandwidth_slice(void) } /* - * Replenish runtime according to assigned quota and update expiration time. - * We use sched_clock_cpu directly instead of rq->clock to avoid adding - * additional synchronization around rq->lock. + * Replenish runtime according to assigned quota. We use sched_clock_cpu + * directly instead of rq->clock to avoid adding additional synchronization + * around rq->lock. * * requires cfs_b->lock */ void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b) { - u64 now; - - if (cfs_b->quota == RUNTIME_INF) - return; - - now = sched_clock_cpu(smp_processor_id()); - cfs_b->runtime = cfs_b->quota; - cfs_b->runtime_expires = now + ktime_to_ns(cfs_b->period); - cfs_b->expires_seq++; + if (cfs_b->quota != RUNTIME_INF) + cfs_b->runtime = cfs_b->quota; } static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg) @@ -4255,8 +4250,7 @@ static int assign_cfs_rq_runtime(struct cfs_rq *cfs_rq) { struct task_group *tg = cfs_rq->tg; struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(tg); - u64 amount = 0, min_amount, expires; - int expires_seq; + u64 amount = 0, min_amount; /* note: this is a positive sum as runtime_remaining <= 0 */ min_amount = sched_cfs_bandwidth_slice() - cfs_rq->runtime_remaining; @@ -4273,61 +4267,17 @@ static int assign_cfs_rq_runtime(struct cfs_rq *cfs_rq) cfs_b->idle = 0; } } - expires_seq = cfs_b->expires_seq; - expires = cfs_b->runtime_expires; raw_spin_unlock(&cfs_b->lock); cfs_rq->runtime_remaining += amount; - /* - * we may have advanced our local expiration to account for allowed - * spread between our sched_clock and the one on which runtime was - * issued. - */ - if (cfs_rq->expires_seq != expires_seq) { - cfs_rq->expires_seq = expires_seq; - cfs_rq->runtime_expires = expires; - } return cfs_rq->runtime_remaining > 0; } -/* - * Note: This depends on the synchronization provided by sched_clock and the - * fact that rq->clock snapshots this value. - */ -static void expire_cfs_rq_runtime(struct cfs_rq *cfs_rq) -{ - struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg); - - /* if the deadline is ahead of our clock, nothing to do */ - if (likely((s64)(rq_clock(rq_of(cfs_rq)) - cfs_rq->runtime_expires) < 0)) - return; - - if (cfs_rq->runtime_remaining < 0) - return; - - /* - * If the local deadline has passed we have to consider the - * possibility that our sched_clock is 'fast' and the global deadline - * has not truly expired. - * - * Fortunately we can check determine whether this the case by checking - * whether the global deadline(cfs_b->expires_seq) has advanced. - */ - if (cfs_rq->expires_seq == cfs_b->expires_seq) { - /* extend local deadline, drift is bounded above by 2 ticks */ - cfs_rq->runtime_expires += TICK_NSEC; - } else { - /* global deadline is ahead, expiration has passed */ - cfs_rq->runtime_remaining = 0; - } -} - static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) { /* dock delta_exec before expiring quota (as it could span periods) */ cfs_rq->runtime_remaining -= delta_exec; - expire_cfs_rq_runtime(cfs_rq); if (likely(cfs_rq->runtime_remaining > 0)) return; @@ -4523,8 +4473,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) resched_curr(rq); } -static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b, - u64 remaining, u64 expires) +static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b, u64 remaining) { struct cfs_rq *cfs_rq; u64 runtime; @@ -4549,7 +4498,6 @@ static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b, remaining -= runtime; cfs_rq->runtime_remaining += runtime; - cfs_rq->runtime_expires = expires; /* we check whether we're throttled above */ if (cfs_rq->runtime_remaining > 0) @@ -4574,7 +4522,7 @@ static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b, */ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun) { - u64 runtime, runtime_expires; + u64 runtime; int throttled; /* no need to continue the timer with no bandwidth constraint */ @@ -4602,8 +4550,6 @@ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun) /* account preceding periods in which throttling occurred */ cfs_b->nr_throttled += overrun; - runtime_expires = cfs_b->runtime_expires; - /* * This check is repeated as we are holding onto the new bandwidth while * we unthrottle. This can potentially race with an unthrottled group @@ -4616,8 +4562,7 @@ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun) cfs_b->distribute_running = 1; raw_spin_unlock(&cfs_b->lock); /* we can't nest cfs_b->lock while distributing bandwidth */ - runtime = distribute_cfs_runtime(cfs_b, runtime, - runtime_expires); + runtime = distribute_cfs_runtime(cfs_b, runtime); raw_spin_lock(&cfs_b->lock); cfs_b->distribute_running = 0; @@ -4699,8 +4644,7 @@ static void __return_cfs_rq_runtime(struct cfs_rq *cfs_rq) return; raw_spin_lock(&cfs_b->lock); - if (cfs_b->quota != RUNTIME_INF && - cfs_rq->runtime_expires == cfs_b->runtime_expires) { + if (cfs_b->quota != RUNTIME_INF) { cfs_b->runtime += slack_runtime; /* we are under rq->lock, defer unthrottling using a timer */ @@ -4732,7 +4676,6 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b) { u64 runtime = 0, slice = sched_cfs_bandwidth_slice(); - u64 expires; /* confirm we're still not at a refresh boundary */ raw_spin_lock(&cfs_b->lock); @@ -4750,7 +4693,6 @@ static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b) if (cfs_b->quota != RUNTIME_INF && cfs_b->runtime > slice) runtime = cfs_b->runtime; - expires = cfs_b->runtime_expires; if (runtime) cfs_b->distribute_running = 1; @@ -4759,11 +4701,10 @@ static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b) if (!runtime) return; - runtime = distribute_cfs_runtime(cfs_b, runtime, expires); + runtime = distribute_cfs_runtime(cfs_b, runtime); raw_spin_lock(&cfs_b->lock); - if (expires == cfs_b->runtime_expires) - cfs_b->runtime -= min(runtime, cfs_b->runtime); + lsub_positive(&cfs_b->runtime, runtime); cfs_b->distribute_running = 0; raw_spin_unlock(&cfs_b->lock); } @@ -4930,17 +4871,13 @@ static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b) { - u64 overrun; - lockdep_assert_held(&cfs_b->lock); if (cfs_b->period_active) return; cfs_b->period_active = 1; - overrun = hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period); - cfs_b->runtime_expires += (overrun + 1) * ktime_to_ns(cfs_b->period); - cfs_b->expires_seq++; + hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period); hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED); } @@ -5092,8 +5029,6 @@ static inline void hrtick_update(struct rq *rq) #endif #ifdef CONFIG_SMP -static inline unsigned long cpu_util(int cpu); - static bool __cpu_overutilized(int cpu, int delta); static bool cpu_overutilized(int cpu); unsigned long boosted_cpu_util(int cpu); @@ -5711,10 +5646,11 @@ unsigned long capacity_min_of(int cpu) >> SCHED_CAPACITY_SHIFT; } +bool energy_aware_enable = false; static inline bool energy_aware(void) { - return sched_feat(ENERGY_AWARE); + return energy_aware_enable; } struct energy_env { @@ -7001,67 +6937,6 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) return select_idle_sibling_cstate_aware(p, prev, target); } -/** - * Amount of capacity of a CPU that is (estimated to be) used by CFS tasks - * @cpu: the CPU to get the utilization of - * - * The unit of the return value must be the one of capacity so we can compare - * the utilization with the capacity of the CPU that is available for CFS task - * (ie cpu_capacity). - * - * cfs_rq.avg.util_avg is the sum of running time of runnable tasks plus the - * recent utilization of currently non-runnable tasks on a CPU. It represents - * the amount of utilization of a CPU in the range [0..capacity_orig] where - * capacity_orig is the cpu_capacity available at the highest frequency - * (arch_scale_freq_capacity()). - * The utilization of a CPU converges towards a sum equal to or less than the - * current capacity (capacity_curr <= capacity_orig) of the CPU because it is - * the running time on this CPU scaled by capacity_curr. - * - * The estimated utilization of a CPU is defined to be the maximum between its - * cfs_rq.avg.util_avg and the sum of the estimated utilization of the tasks - * currently RUNNABLE on that CPU. - * This allows to properly represent the expected utilization of a CPU which - * has just got a big task running since a long sleep period. At the same time - * however it preserves the benefits of the "blocked utilization" in - * describing the potential for other tasks waking up on the same CPU. - * - * Nevertheless, cfs_rq.avg.util_avg can be higher than capacity_curr or even - * higher than capacity_orig because of unfortunate rounding in - * cfs.avg.util_avg or just after migrating tasks and new task wakeups until - * the average stabilizes with the new running time. We need to check that the - * utilization stays within the range of [0..capacity_orig] and cap it if - * necessary. Without utilization capping, a group could be seen as overloaded - * (CPU0 utilization at 121% + CPU1 utilization at 80%) whereas CPU1 has 20% of - * available capacity. We allow utilization to overshoot capacity_curr (but not - * capacity_orig) as it useful for predicting the capacity required after task - * migrations (scheduler-driven DVFS). - * - * Return: the (estimated) utilization for the specified CPU - */ -static inline unsigned long cpu_util(int cpu) -{ - struct cfs_rq *cfs_rq; - unsigned int util; - -#ifdef CONFIG_SCHED_WALT - if (likely(!walt_disabled && sysctl_sched_use_walt_cpu_util)) { - util = div64_u64(cpu_rq(cpu)->cfs->cumulative_runnable_avg, - walt_ravg_window >> SCHED_LOAD_SHIFT); - - return min_t(unsigned long, util, capacity_orig_of(cpu)); - } -#endif - - cfs_rq = &cpu_rq(cpu)->cfs; - util = READ_ONCE(cfs_rq->avg.util_avg); - - if (sched_feat(UTIL_EST)) - util = max(util, READ_ONCE(cfs_rq->avg.util_est.enqueued)); - - return min_t(unsigned long, util, capacity_orig_of(cpu)); -} - /* * cpu_util_without: compute cpu utilization without any contributions from *p * @cpu: the CPU which utilization is requested @@ -7214,6 +7089,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, int best_idle_cpu = -1; int target_cpu = -1; int cpu, i; + struct task_struct *curr_tsk; *backup_cpu = -1; @@ -7517,6 +7393,13 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, * a) ACTIVE CPU: target_cpu * b) IDLE CPU: best_idle_cpu */ + if (target_cpu != -1 && !idle_cpu(target_cpu) && + best_idle_cpu != -1) { + curr_tsk = READ_ONCE(cpu_rq(target_cpu)->curr); + if (curr_tsk && schedtune_task_boost_rcu_locked(curr_tsk)) { + target_cpu = best_idle_cpu; + } + } if (prefer_idle && (best_idle_cpu != -1)) { trace_sched_find_best_target(p, prefer_idle, min_util, cpu, @@ -7706,14 +7589,11 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f if (sd_flag & SD_BALANCE_WAKE) { int _wake_cap = wake_cap(p, cpu, prev_cpu); - if (cpumask_test_cpu(cpu, tsk_cpus_allowed(p))) { - bool about_to_idle = (cpu_rq(cpu)->nr_running < 2); - - if (sysctl_sched_sync_hint_enable && sync && - !_wake_cap && about_to_idle && - cpu_is_in_target_set(p, cpu)) + if (sysctl_sched_sync_hint_enable && sync && + cpumask_test_cpu(cpu, tsk_cpus_allowed(p)) && + !_wake_cap && (cpu_rq(cpu)->nr_running < 2) && + cpu_is_in_target_set(p, cpu)) return cpu; - } record_wakee(p); want_affine = !wake_wide(p, sibling_count_hint) && @@ -11668,7 +11548,7 @@ void online_fair_sched_group(struct task_group *tg) se = tg->se[i]; raw_spin_lock_irq(&rq->lock); - post_init_entity_util_avg(se); + attach_entity_cfs_rq(se); sync_throttle(tg, i); raw_spin_unlock_irq(&rq->lock); } diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 063de85be6de..cdc47e66a044 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -86,6 +86,7 @@ SCHED_FEAT(ATTACH_AGE_LOAD, true) * UtilEstimation. Use estimated CPU utilization. */ SCHED_FEAT(UTIL_EST, true) +SCHED_FEAT(UTIL_EST_FASTUP, true) /* * Energy aware scheduling. Use platform energy model to guide scheduling diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 9114f14041ec..3149b1982199 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1003,6 +1003,8 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq) #define RT_SCHEDTUNE_INTERVAL 50000000ULL +static void sched_rt_update_capacity_req(struct rq *rq); + static enum hrtimer_restart rt_schedtune_timer(struct hrtimer *timer) { struct sched_rt_entity *rt_se = container_of(timer, @@ -1036,6 +1038,7 @@ static enum hrtimer_restart rt_schedtune_timer(struct hrtimer *timer) */ rt_se->schedtune_enqueued = false; schedtune_dequeue_task(p, cpu_of(rq)); + sched_rt_update_capacity_req(rq); cpufreq_update_util(rq, SCHED_CPUFREQ_RT); out: raw_spin_unlock(&rq->lock); @@ -1421,6 +1424,25 @@ static void dequeue_rt_entity(struct sched_rt_entity *rt_se, unsigned int flags) enqueue_top_rt_rq(&rq->rt); } +/* + * Keep track of whether each cpu has an RT task that will + * soon schedule on that core. The problem this is intended + * to address is that we want to avoid entering a non-preemptible + * softirq handler if we are about to schedule a real-time + * task on that core. Ideally, we could just check whether + * the RT runqueue on that core had a runnable task, but the + * window between choosing to schedule a real-time task + * on a core and actually enqueueing it on that run-queue + * is large enough to lose races at an unacceptably high rate. + * + * This variable attempts to reduce that window by indicating + * when we have decided to schedule an RT task on a core + * but not yet enqueued it. + * This variable is a heuristic only: it is not guaranteed + * to be correct and may be updated without synchronization. + */ +DEFINE_PER_CPU(bool, incoming_rt_task); + /* * Adding/removing a task to/from a priority array: */ @@ -1438,6 +1460,8 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags) if (!task_current(rq, p) && p->nr_cpus_allowed > 1) enqueue_pushable_task(rq, p); + *per_cpu_ptr(&incoming_rt_task, cpu_of(rq)) = false; + if (!schedtune_task_boost(p)) return; @@ -1463,6 +1487,7 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags) rt_se->schedtune_enqueued = true; schedtune_enqueue_task(p, cpu_of(rq)); + sched_rt_update_capacity_req(rq); cpufreq_update_util(rq, SCHED_CPUFREQ_RT); } @@ -1487,6 +1512,7 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags) rt_se->schedtune_enqueued = false; schedtune_dequeue_task(p, cpu_of(rq)); + sched_rt_update_capacity_req(rq); cpufreq_update_util(rq, SCHED_CPUFREQ_RT); } @@ -1524,8 +1550,19 @@ static void yield_task_rt(struct rq *rq) requeue_task_rt(rq, rq->curr, 0); } +/* + * Return whether the given cpu has (or will shortly have) an RT task + * ready to run. NB: This is a heuristic and is subject to races. + */ +bool +cpu_has_rt_task(int cpu) +{ + struct rq *rq = cpu_rq(cpu); + return rq->rt.rt_nr_running > 0 || per_cpu(incoming_rt_task, cpu); +} + #ifdef CONFIG_SMP -static int find_lowest_rq(struct task_struct *task); +static int find_lowest_rq(struct task_struct *task, int sync); /* * Return whether the task on the given cpu is currently non-preemptible @@ -1541,8 +1578,9 @@ task_may_not_preempt(struct task_struct *task, int cpu) struct task_struct *cpu_ksoftirqd = per_cpu(ksoftirqd, cpu); return ((softirqs & LONG_SOFTIRQ_MASK) && - (task == cpu_ksoftirqd || - task_thread_info(task)->preempt_count & SOFTIRQ_MASK)); + (task == cpu_ksoftirqd || is_idle_task(task) || + (task_thread_info(task)->preempt_count + & (HARDIRQ_MASK | SOFTIRQ_MASK)))); } /* @@ -1568,6 +1606,7 @@ static void schedtune_dequeue_rt(struct rq *rq, struct task_struct *p) /* schedtune_enqueued is true, deboost it */ rt_se->schedtune_enqueued = false; schedtune_dequeue_task(p, task_cpu(p)); + sched_rt_update_capacity_req(rq); cpufreq_update_util(rq, SCHED_CPUFREQ_RT); } @@ -1575,9 +1614,11 @@ static int select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags, int sibling_count_hint) { - struct task_struct *curr; + struct task_struct *curr, *tgt_task; struct rq *rq; bool may_not_preempt; + int target; + int sync = flags & WF_SYNC; /* For anything but wake ups, just return the task_cpu */ if (sd_flag != SD_BALANCE_WAKE && sd_flag != SD_BALANCE_FORK) @@ -1588,58 +1629,29 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags, rcu_read_lock(); curr = READ_ONCE(rq->curr); /* unlocked access */ - /* - * If the current task on @p's runqueue is a softirq task, - * it may run without preemption for a time that is - * ill-suited for a waiting RT task. Therefore, try to - * wake this RT task on another runqueue. - * - * Also, if the current task on @p's runqueue is an RT task, then - * it may run without preemption for a time that is - * ill-suited for a waiting RT task. Therefore, try to - * wake this RT task on another runqueue. - * - * Also, if the current task on @p's runqueue is an RT task, then - * try to see if we can wake this RT task up on another - * runqueue. Otherwise simply start this RT task - * on its current runqueue. - * - * We want to avoid overloading runqueues. If the woken - * task is a higher priority, then it will stay on this CPU - * and the lower prio task should be moved to another CPU. - * Even though this will probably make the lower prio task - * lose its cache, we do not want to bounce a higher task - * around just because it gave up its CPU, perhaps for a - * lock? - * - * For equal prio tasks, we just let the scheduler sort it out. - * - * Otherwise, just let it ride on the affined RQ and the - * post-schedule router will push the preempted task away - * - * This test is optimistic, if we get it wrong the load-balancer - * will have to sort it out. - */ may_not_preempt = task_may_not_preempt(curr, cpu); - if (may_not_preempt || - (unlikely(rt_task(curr)) && - (curr->nr_cpus_allowed < 2 || - curr->prio <= p->prio))) { - int target = find_lowest_rq(p); + target = find_lowest_rq(p, sync); - /* - * If cpu is non-preemptible, prefer remote cpu - * even if it's running a higher-prio task. - * Otherwise: Don't bother moving it if the - * destination CPU is not running a lower priority task. - */ - if (target != -1 && - (may_not_preempt || - p->prio < cpu_rq(target)->rt.highest_prio.curr)) - cpu = target; + /* + * Check once for losing a race with the other core's irq handler. + * This does not happen frequently, but it can avoid delaying + * the execution of the RT task in those cases. + */ + if (target != -1) { + tgt_task = READ_ONCE(cpu_rq(target)->curr); + if (task_may_not_preempt(tgt_task, target)) + target = find_lowest_rq(p, sync); } - rcu_read_unlock(); + /* + * Possible race. Don't bother moving it if the + * destination CPU is not running a lower priority task. + */ + if (target != -1 && + (may_not_preempt || p->prio < cpu_rq(target)->rt.highest_prio.curr)) + cpu = target; + *per_cpu_ptr(&incoming_rt_task, cpu) = true; + rcu_read_unlock(); out: /* * If previous CPU was different, make sure to cancel any active @@ -1714,6 +1726,9 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int flag #endif } +static inline void sched_rt_update_capacity_req(struct rq *rq) +{ } + static inline void set_next_task(struct rq *rq, struct task_struct *p) { p->se.exec_start = rq_clock_task(rq); @@ -1786,8 +1801,17 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) if (prev->sched_class == &rt_sched_class) update_curr_rt(rq); - if (!rt_rq->rt_queued) + if (!rt_rq->rt_queued) { + /* + * The next task to be picked on this rq will have a lower + * priority than rt tasks so we can spend some time to update + * the capacity used by rt tasks based on the last activity. + * This value will be the used as an estimation of the next + * activity. + */ + sched_rt_update_capacity_req(rq); return NULL; + } put_prev_task(rq, prev); @@ -1847,12 +1871,108 @@ static struct task_struct *pick_highest_pushable_task(struct rq *rq, int cpu) static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask); -static int find_lowest_rq(struct task_struct *task) +static int find_best_rt_target(struct task_struct* task, int cpu, + struct cpumask* lowest_mask, + bool boosted, bool prefer_idle) { + int iter_cpu; + int target_cpu = -1; + int boosted_cpu = -1; + int backup_cpu = -1; + int boosted_orig_capacity = capacity_orig_of(0); + int backup_capacity = 0; + int best_idle_cpu = -1; + unsigned long target_util = 0; + unsigned long new_util; + /* We want to elect the best one based on task class, + * idleness, and utilization. + */ + for (iter_cpu = 0; iter_cpu < NR_CPUS; iter_cpu++) { + int cur_capacity; + /* + * Iterate from higher cpus for boosted tasks. + */ + int i = boosted ? NR_CPUS-iter_cpu-1 : iter_cpu; + if (!cpu_online(i) || !cpumask_test_cpu(i, tsk_cpus_allowed(task))) + continue; + + new_util = cpu_util(i) + task_util(task); + + if (new_util > capacity_orig_of(i)) + continue; + + /* + * Unconditionally favoring tasks that prefer idle cpus to + * improve latency. + */ + if (idle_cpu(i) && prefer_idle + && cpumask_test_cpu(i, lowest_mask) && best_idle_cpu < 0) { + best_idle_cpu = i; + continue; + } + + if (cpumask_test_cpu(i, lowest_mask)) { + /* Bias cpu selection towards cpu with higher original + * capacity if task is boosted. + * Assumption: Higher cpus are exclusively alloted for + * boosted tasks. + */ + if (boosted && boosted_cpu < 0 + && boosted_orig_capacity < capacity_orig_of(i)) { + boosted_cpu = i; + boosted_orig_capacity = capacity_orig_of(i); + } + cur_capacity = capacity_curr_of(i); + if (new_util < cur_capacity && cpu_rq(i)->nr_running) { + if(!boosted) { + /* Find a target cpu with highest utilization.*/ + if (target_util < new_util) { + target_cpu = i; + target_util = new_util; + } + } else { + if (target_util == 0 || target_util > new_util) { + /* Find a target cpu with lowest utilization.*/ + target_cpu = i; + target_util = new_util; + } + } + } else if (backup_capacity == 0 || backup_capacity < cur_capacity) { + /* Select a backup CPU with highest capacity.*/ + backup_capacity = cur_capacity; + backup_cpu = i; + } + } + } + + if (boosted && boosted_cpu >=0 && boosted_cpu > best_idle_cpu) + target_cpu = boosted_cpu; + else if (prefer_idle && best_idle_cpu >= 0) + target_cpu = best_idle_cpu; + + if (target_cpu < 0) { + if (backup_cpu >= 0) + return backup_cpu; + + /* Select current cpu if it is present in the mask.*/ + if (cpumask_test_cpu(cpu, lowest_mask)) + return cpu; + + /* Pick a random cpu from lowest_mask */ + target_cpu = cpumask_any(lowest_mask); + if (target_cpu < nr_cpu_ids) + return target_cpu; + return -1; + } + return target_cpu; +} + +static int find_lowest_rq(struct task_struct *task, int sync) { struct sched_domain *sd; struct cpumask *lowest_mask = this_cpu_cpumask_var_ptr(local_cpu_mask); int this_cpu = smp_processor_id(); int cpu = task_cpu(task); + bool boosted, prefer_idle; /* Make sure the mask is initialized first */ if (unlikely(!lowest_mask)) @@ -1861,64 +1981,88 @@ static int find_lowest_rq(struct task_struct *task) if (task->nr_cpus_allowed == 1) return -1; /* No other targets possible */ + /* Constructing cpumask of lowest priorities */ if (!cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask)) return -1; /* No targets found */ - /* - * At this point we have built a mask of cpus representing the - * lowest priority tasks in the system. Now we want to elect - * the best one based on our affinity and topology. - * - * We prioritize the last cpu that the task executed on since - * it is most likely cache-hot in that location. + /* Return current cpu if WF_SYNC hint is set and present in + * lowest_mask. Improves data locality. */ - if (cpumask_test_cpu(cpu, lowest_mask)) - return cpu; + if (sysctl_sched_sync_hint_enable && sync) { + cpumask_t search_cpus; + cpumask_and(&search_cpus, tsk_cpus_allowed(task), lowest_mask); + if (cpumask_test_cpu(cpu, &search_cpus)) + return cpu; + } /* - * Otherwise, we consult the sched_domains span maps to figure - * out which cpu is logically closest to our hot cache data. + * At this point we have built a mask of cpus representing the + * lowest priority tasks in the system. */ - if (!cpumask_test_cpu(this_cpu, lowest_mask)) - this_cpu = -1; /* Skip this_cpu opt if not among lowest */ - - rcu_read_lock(); - for_each_domain(cpu, sd) { - if (sd->flags & SD_WAKE_AFFINE) { - int best_cpu; - /* - * "this_cpu" is cheaper to preempt than a - * remote processor. - */ - if (this_cpu != -1 && - cpumask_test_cpu(this_cpu, sched_domain_span(sd))) { - rcu_read_unlock(); - return this_cpu; - } - - best_cpu = cpumask_first_and(lowest_mask, - sched_domain_span(sd)); - if (best_cpu < nr_cpu_ids) { - rcu_read_unlock(); - return best_cpu; + boosted = schedtune_task_boost(task) > 0; + prefer_idle = schedtune_prefer_idle(task) > 0; + if(boosted || prefer_idle) { + return find_best_rt_target(task, cpu, lowest_mask, boosted, prefer_idle); + } else { + /* Now we want to elect the best one based on on our affinity + * and topology. + * We prioritize the last cpu that the task executed on since + * it is most likely cache-hot in that location. + */ + struct task_struct* curr; + if (!cpumask_test_cpu(this_cpu, lowest_mask)) + this_cpu = -1; /* Skip this_cpu opt if not among lowest */ + rcu_read_lock(); + for_each_domain(cpu, sd) { + if (sd->flags & SD_WAKE_AFFINE) { + int best_cpu; + /* + * "this_cpu" is cheaper to preempt than a + * remote processor. + */ + if (this_cpu != -1 && + cpumask_test_cpu(this_cpu, sched_domain_span(sd))) { + curr = cpu_rq(this_cpu)->curr; + /* Ensuring that boosted/prefer idle + * tasks are not pre-empted even if low + * priority*/ + if (!curr || (schedtune_task_boost(curr) == 0 + && schedtune_prefer_idle(curr) == 0)) { + rcu_read_unlock(); + return this_cpu; + } + } + + best_cpu = cpumask_first_and(lowest_mask, + sched_domain_span(sd)); + if (best_cpu < nr_cpu_ids) { + curr = cpu_rq(best_cpu)->curr; + /* Ensuring that boosted/prefer idle + * tasks are not pre-empted even if low + * priority*/ + if(!curr || (schedtune_task_boost(curr) == 0 + && schedtune_prefer_idle(curr) == 0)) { + rcu_read_unlock(); + return best_cpu; + } + } } } - } - rcu_read_unlock(); + rcu_read_unlock(); - /* - * And finally, if there were no matches within the domains - * just give the caller *something* to work with from the compatible - * locations. - */ - if (this_cpu != -1) - return this_cpu; + /* And finally, if there were no matches within the domains just + * give the caller *something* to work with from the compatible + * locations. + */ + if (this_cpu != -1) + return this_cpu; - cpu = cpumask_any(lowest_mask); - if (cpu < nr_cpu_ids) - return cpu; - return -1; + cpu = cpumask_any(lowest_mask); + if (cpu < nr_cpu_ids) + return cpu; + return -1; + } } /* Will lock the rq it finds */ @@ -1929,7 +2073,7 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq) int cpu; for (tries = 0; tries < RT_MAX_TRIES; tries++) { - cpu = find_lowest_rq(task); + cpu = find_lowest_rq(task, 0); if ((cpu == -1) || (cpu == rq->cpu)) break; @@ -2529,6 +2673,9 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued) update_curr_rt(rq); + if (rq->rt.rt_nr_running) + sched_rt_update_capacity_req(rq); + watchdog(rq, p); /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4291dae30c82..482cc5dac537 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -240,8 +240,6 @@ struct cfs_bandwidth { ktime_t period; u64 quota, runtime; s64 hierarchical_quota; - u64 runtime_expires; - int expires_seq; u8 idle; u8 period_active; @@ -459,8 +457,6 @@ struct cfs_rq { int runtime_enabled; int expires_seq; - u64 runtime_expires; - s64 runtime_remaining; u64 throttled_clock, throttled_clock_task; u64 throttled_clock_task_time; @@ -1760,6 +1756,78 @@ static inline unsigned long capacity_orig_of(int cpu) extern unsigned int sysctl_sched_use_walt_cpu_util; extern unsigned int walt_ravg_window; extern bool walt_disabled; + +static inline unsigned long task_util(struct task_struct *p) +{ +#ifdef CONFIG_SCHED_WALT + if (!walt_disabled && sysctl_sched_use_walt_task_util) { + unsigned long demand = p->ravg.demand; + return (demand << 10) / walt_ravg_window; + } +#endif + return READ_ONCE(p->se.avg.util_avg); +} + +/* + * Amount of capacity of a CPU that is (estimated to be) used by CFS tasks + * @cpu: the CPU to get the utilization of + * + * The unit of the return value must be the one of capacity so we can compare + * the utilization with the capacity of the CPU that is available for CFS task + * (ie cpu_capacity). + * + * cfs_rq.avg.util_avg is the sum of running time of runnable tasks plus the + * recent utilization of currently non-runnable tasks on a CPU. It represents + * the amount of utilization of a CPU in the range [0..capacity_orig] where + * capacity_orig is the cpu_capacity available at the highest frequency + * (arch_scale_freq_capacity()). + * The utilization of a CPU converges towards a sum equal to or less than the + * current capacity (capacity_curr <= capacity_orig) of the CPU because it is + * the running time on this CPU scaled by capacity_curr. + * + * The estimated utilization of a CPU is defined to be the maximum between its + * cfs_rq.avg.util_avg and the sum of the estimated utilization of the tasks + * currently RUNNABLE on that CPU. + * This allows to properly represent the expected utilization of a CPU which + * has just got a big task running since a long sleep period. At the same time + * however it preserves the benefits of the "blocked utilization" in + * describing the potential for other tasks waking up on the same CPU. + * + * Nevertheless, cfs_rq.avg.util_avg can be higher than capacity_curr or even + * higher than capacity_orig because of unfortunate rounding in + * cfs.avg.util_avg or just after migrating tasks and new task wakeups until + * the average stabilizes with the new running time. We need to check that the + * utilization stays within the range of [0..capacity_orig] and cap it if + * necessary. Without utilization capping, a group could be seen as overloaded + * (CPU0 utilization at 121% + CPU1 utilization at 80%) whereas CPU1 has 20% of + * available capacity. We allow utilization to overshoot capacity_curr (but not + * capacity_orig) as it useful for predicting the capacity required after task + * migrations (scheduler-driven DVFS). + * + * Return: the (estimated) utilization for the specified CPU + */ +static inline unsigned long cpu_util(int cpu) +{ + struct cfs_rq *cfs_rq; + unsigned int util; + +#ifdef CONFIG_SCHED_WALT + if (likely(!walt_disabled && sysctl_sched_use_walt_cpu_util)) { + util = div64_u64(cpu_rq(cpu)->cfs->cumulative_runnable_avg, + walt_ravg_window >> SCHED_LOAD_SHIFT); + + return min_t(unsigned long, util, capacity_orig_of(cpu)); + } +#endif + + cfs_rq = &cpu_rq(cpu)->cfs; + util = READ_ONCE(cfs_rq->avg.util_avg); + + if (sched_feat(UTIL_EST)) + util = max(util, READ_ONCE(cfs_rq->avg.util_est.enqueued)); + + return min_t(unsigned long, util, capacity_orig_of(cpu)); +} #endif static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta) diff --git a/kernel/sched/tune.c b/kernel/sched/tune.c index f18c9c7940ae..75ba63bcbb73 100644 --- a/kernel/sched/tune.c +++ b/kernel/sched/tune.c @@ -544,6 +544,24 @@ int schedtune_task_boost(struct task_struct *p) return task_boost; } +/* The same as schedtune_task_boost except assuming the caller has the rcu read + * lock. + */ +int schedtune_task_boost_rcu_locked(struct task_struct *p) +{ + struct schedtune *st; + int task_boost; + + if (unlikely(!schedtune_initialized)) + return 0; + + /* Get task boost value */ + st = task_schedtune(p); + task_boost = st->boost; + + return task_boost; +} + int schedtune_prefer_idle(struct task_struct *p) { struct schedtune *st; diff --git a/kernel/sched/tune.h b/kernel/sched/tune.h index 4f6441771e4c..62549d159dc3 100644 --- a/kernel/sched/tune.h +++ b/kernel/sched/tune.h @@ -16,6 +16,7 @@ struct target_nrg { int schedtune_cpu_boost(int cpu); int schedtune_task_boost(struct task_struct *tsk); +int schedtune_task_boost_rcu_locked(struct task_struct *tsk); int schedtune_prefer_idle(struct task_struct *tsk); diff --git a/kernel/softirq.c b/kernel/softirq.c index d69b77fc7cc1..9d16ef03fcb4 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -234,16 +234,6 @@ static inline bool lockdep_softirq_start(void) { return false; } static inline void lockdep_softirq_end(bool in_hardirq) { } #endif -#define softirq_deferred_for_rt(pending) \ -({ \ - __u32 deferred = 0; \ - if (cpupri_check_rt()) { \ - deferred = pending & LONG_SOFTIRQ_MASK; \ - pending &= ~LONG_SOFTIRQ_MASK; \ - } \ - deferred; \ -}) - asmlinkage __visible void __softirq_entry __do_softirq(void) { unsigned long end = jiffies + MAX_SOFTIRQ_TIME; @@ -251,8 +241,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) int max_restart = MAX_SOFTIRQ_RESTART; struct softirq_action *h; bool in_hardirq; - __u32 deferred; - __u32 pending; + __u32 pending, pending_now, pending_delay, pending_mask; int softirq_bit; /* @@ -262,22 +251,35 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) */ current->flags &= ~PF_MEMALLOC; + /* + * If this is not the ksoftirqd thread, + * and there is an RT task that is running or is waiting to run, + * delay handling the long-running softirq handlers by leaving + * them for the ksoftirqd thread. + */ + if (current != __this_cpu_read(ksoftirqd) && + cpu_has_rt_task(smp_processor_id())) + pending_mask = LONG_SOFTIRQ_MASK; + else + pending_mask = 0; pending = local_softirq_pending(); - deferred = softirq_deferred_for_rt(pending); + pending_delay = pending & pending_mask; + pending_now = pending & ~pending_mask; account_irq_enter_time(current); + __local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET); in_hardirq = lockdep_softirq_start(); restart: /* Reset the pending bitmask before enabling irqs */ - set_softirq_pending(deferred); - __this_cpu_write(active_softirqs, pending); + __this_cpu_write(active_softirqs, pending_now); + set_softirq_pending(pending_delay); local_irq_enable(); h = softirq_vec; - while ((softirq_bit = ffs(pending))) { + while ((softirq_bit = ffs(pending_now))) { unsigned int vec_nr; int prev_count; @@ -298,7 +300,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) preempt_count_set(prev_count); } h++; - pending >>= softirq_bit; + pending_now >>= softirq_bit; } __this_cpu_write(active_softirqs, 0); @@ -306,16 +308,22 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) local_irq_disable(); pending = local_softirq_pending(); - deferred = softirq_deferred_for_rt(pending); - + pending_delay = pending & pending_mask; + pending_now = pending & ~pending_mask; if (pending) { - if (time_before(jiffies, end) && !need_resched() && - --max_restart) + if (pending_now && time_before(jiffies, end) && + !need_resched() && --max_restart) goto restart; - } - if (pending | deferred) + /* + * Wake up ksoftirqd to handle remaining softirq's, either + * because we are delaying a subset (pending_delayed) + * to avoid interrupting an RT task, or because we have + * exhausted the time limit. + */ wakeup_softirqd(); + } + lockdep_softirq_end(in_hardirq); account_irq_exit_time(current); __local_bh_enable(SOFTIRQ_OFFSET); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c6c2396a2adb..c771b2bed779 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1344,7 +1344,7 @@ static struct ctl_table vm_table[] = { .extra1 = &zero, }, { - .procname = "dirty_background_ratio", + .procname = "dirty_background_ratio_nosys", .data = &dirty_background_ratio, .maxlen = sizeof(dirty_background_ratio), .mode = 0644, diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 27e480180fd5..c31b8d610abe 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -71,10 +71,6 @@ struct clock_data { static struct hrtimer sched_clock_timer; static int irqtime = -1; static int initialized; -static u64 suspend_ns; -static u64 suspend_cycles; -static u64 resume_cycles; - core_param(irqtime, irqtime, int, 0400); @@ -291,11 +287,6 @@ static int sched_clock_suspend(void) struct clock_read_data *rd = &cd.read_data[0]; update_sched_clock(); - - suspend_ns = rd->epoch_ns; - suspend_cycles = rd->epoch_cyc; - pr_debug("suspend ns:%17llu suspend cycles:%17llu\n", - rd->epoch_ns, rd->epoch_cyc); hrtimer_cancel(&sched_clock_timer); rd->read_sched_clock = suspended_sched_clock_read; @@ -307,8 +298,6 @@ static void sched_clock_resume(void) struct clock_read_data *rd = &cd.read_data[0]; rd->epoch_cyc = cd.actual_read_sched_clock(); - resume_cycles = rd->epoch_cyc; - pr_debug("resume cycles:%17llu\n", rd->epoch_cyc); hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL); rd->read_sched_clock = cd.actual_read_sched_clock; } diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index f2087061da36..12f8bf9bf85d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2144,6 +2144,22 @@ void trace_printk_init_buffers(void) return; /* trace_printk() is for debug use only. Don't use it in production. */ + + pr_warning("\n"); + pr_warning("**********************************************************\n"); + pr_warning("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); + pr_warning("** **\n"); + pr_warning("** trace_printk() being used. Allocating extra memory. **\n"); + pr_warning("** **\n"); + pr_warning("** This means that this is a DEBUG kernel and it is **\n"); + pr_warning("** unsafe for production use. **\n"); + pr_warning("** **\n"); + pr_warning("** If you see this message and you are not debugging **\n"); + pr_warning("** the kernel, report this immediately to your vendor! **\n"); + pr_warning("** **\n"); + pr_warning("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); + pr_warning("**********************************************************\n"); + /* Expand the buffers to set size */ tracing_update_buffers(); diff --git a/net/netfilter/xt_quota2.c b/net/netfilter/xt_quota2.c index 94663440d160..8c481e359d94 100644 --- a/net/netfilter/xt_quota2.c +++ b/net/netfilter/xt_quota2.c @@ -273,8 +273,8 @@ static void quota_mt2_destroy(const struct xt_mtdtor_param *par) } list_del(&e->list); - remove_proc_entry(e->name, proc_xt_quota); spin_unlock_bh(&counter_list_lock); + remove_proc_entry(e->name, proc_xt_quota); kfree(e); } diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d527fee6496d..1ec53c7dd190 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2556,15 +2556,15 @@ sub process { } # Check for added, moved or deleted files -## if (!$reported_maintainer_file && !$in_commit_log && -## ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || -## $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || -## ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && -## (defined($1) || defined($2))))) { -## $reported_maintainer_file = 1; -## WARN("FILE_PATH_CHANGES", -## "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr); -## } + if (!$reported_maintainer_file && !$in_commit_log && + ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ || + $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ || + ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ && + (defined($1) || defined($2))))) { + $reported_maintainer_file = 1; + WARN("FILE_PATH_CHANGES", + "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr); + } #check the patch for invalid author credentials if ($chk_author && !($line =~ /^From:.*qca\.qualcomm\.com/) && @@ -3658,10 +3658,10 @@ sub process { } # avoid LINUX_VERSION_CODE -# if ($line =~ /\bLINUX_VERSION_CODE\b/) { -# WARN("LINUX_VERSION_CODE", -# "LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr); -# } + if ($line =~ /\bLINUX_VERSION_CODE\b/) { + WARN("LINUX_VERSION_CODE", + "LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr); + } # avoid VENDOR_EDIT if ($line =~ /\bVENDOR_EDIT\b/) { diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index fd8fdb91581d..5c723833ec54 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -76,7 +76,11 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\" echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" + if [ -z "$KBUILD_COMPILER_STRING" ]; then + echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" + else + echo \#define LINUX_COMPILER \"$KBUILD_COMPILER_STRING\" + fi; ) > .tmpcompile # Only replace the real compile.h if the new one is different, diff --git a/sound/soc/codecs/tfa9891/tfa.h b/sound/soc/codecs/tfa9891/tfa.h index 02ee52c0d3eb..31ad7faa6128 100755 --- a/sound/soc/codecs/tfa9891/tfa.h +++ b/sound/soc/codecs/tfa9891/tfa.h @@ -78,9 +78,9 @@ tfa_probe(unsigned char slave_address, int *pDevice); * @param profile the profile to load, if -1 then don't change profile * @param vsteps the volume step selections for each channel, if -1 then softmute * 0 sets the maximum volume - * @return enum tfa_error + * @return enum Tfa98xx_Error */ -enum tfa_error tfa_start(int profile, int *vstep); +enum Tfa98xx_Error tfa_start(int profile, int *vstep); /** * Stop SpeakerBoost on all devices/channels. @@ -90,9 +90,9 @@ enum tfa_error tfa_start(int profile, int *vstep); * Note that the function will block until the amplifiers are actually switched * off unless timed-out. * - * @return enum tfa_error + * @return enum Tfa98xx_Error */ -enum tfa_error tfa_stop(void); +enum Tfa98xx_Error tfa_stop(void); /** * discard container buffer and free all resources.\n @@ -110,7 +110,7 @@ void tfa_deinit(void); * - tfa_error_device channel error * - tfa_error_noclock only register level init could be preformed */ -enum tfa_error tfa_reset(void); +enum Tfa98xx_Error tfa_reset(void); enum Tfa98xx_Error tfa_write_filters(int dev_idx, int prof_idx); diff --git a/sound/soc/codecs/tfa9891/tfa9897_init.c b/sound/soc/codecs/tfa9891/tfa9897_init.c index 3d5e78d0afc9..4fbbcceb335d 100755 --- a/sound/soc/codecs/tfa9891/tfa9897_init.c +++ b/sound/soc/codecs/tfa9891/tfa9897_init.c @@ -107,7 +107,7 @@ static enum Tfa98xx_Error tfa9897_tfa_dsp_write_tables(Tfa98xx_handle_t dev_idx, enum Tfa98xx_Error error; /* Not used for max1! */ - sample_rate=sample_rate; + sample_rate = (int)sample_rate; error = tfa9897_dsp_write_vsfwdelay_table(dev_idx); if (error == Tfa98xx_Error_Ok) { diff --git a/sound/soc/codecs/tfa9891/tfa98xx.c b/sound/soc/codecs/tfa9891/tfa98xx.c index 5f39136d751c..e8a34e8c6eed 100644 --- a/sound/soc/codecs/tfa9891/tfa98xx.c +++ b/sound/soc/codecs/tfa9891/tfa98xx.c @@ -282,9 +282,9 @@ static struct device_attribute tfa98xx_Log_state_attr = /* Wrapper for tfa start */ -static enum tfa_error tfa98xx_tfa_start(struct tfa98xx *tfa98xx, int next_profile, int *vstep) +static enum Tfa98xx_Error tfa98xx_tfa_start(struct tfa98xx *tfa98xx, int next_profile, int *vstep) { - enum tfa_error err; + enum Tfa98xx_Error err; err = tfa_start(next_profile, vstep); diff --git a/sound/soc/codecs/tfa9891/tfa_dsp.c b/sound/soc/codecs/tfa9891/tfa_dsp.c index 113eb7d76686..789c58fc869e 100755 --- a/sound/soc/codecs/tfa9891/tfa_dsp.c +++ b/sound/soc/codecs/tfa9891/tfa_dsp.c @@ -2560,7 +2560,7 @@ enum Tfa98xx_Error tfaRunSpeakerCalibration(Tfa98xx_handle_t handle, int profile enum Tfa98xx_Error err = Tfa98xx_Error_Ok; int calibrateDone, spkr_count = 0; /* Avoid warning in user-space */ - profile=profile; + profile = (int)profile; #ifdef __KERNEL__ /* Necessary otherwise we are thrown out of operating mode in kernel (because of internal clock) */ if((strstr(tfaContProfileName(handle, profile), ".cal") == NULL) && (tfa98xx_dev_family(handle) == 2)) @@ -2929,7 +2929,7 @@ enum Tfa98xx_Error tfaRunWaitCalibration(Tfa98xx_handle_t handle, int *calibrate return err; } -enum tfa_error tfa_start(int next_profile, int *vstep) +enum Tfa98xx_Error tfa_start(int next_profile, int *vstep) { enum Tfa98xx_Error err = Tfa98xx_Error_Ok; int dev, devcount = tfa98xx_cnt_max_device(); @@ -2940,7 +2940,7 @@ enum tfa_error tfa_start(int next_profile, int *vstep) if ( devcount < 1 ) { pr_err("No or wrong container file loaded\n"); - return tfa_error_bad_param; + return Tfa98xx_Error_Bad_Parameter; } for( dev=0; dev < devcount; dev++) { @@ -3075,14 +3075,14 @@ enum tfa_error tfa_start(int next_profile, int *vstep) return err; } -enum tfa_error tfa_stop(void) +enum Tfa98xx_Error tfa_stop(void) { enum Tfa98xx_Error err = Tfa98xx_Error_Ok; int dev, devcount = tfa98xx_cnt_max_device(); if ( devcount == 0 ) { pr_err("No or wrong container file loaded\n"); - return tfa_error_bad_param; + return Tfa98xx_Error_Bad_Parameter; } for( dev=0; dev < devcount; dev++) { @@ -3139,7 +3139,7 @@ int tfa98xx_reset(Tfa98xx_handle_t handle) return err; } -enum tfa_error tfa_reset(void) +enum Tfa98xx_Error tfa_reset(void) { enum Tfa98xx_Error err = Tfa98xx_Error_Ok; int dev, devcount = tfa98xx_cnt_max_device();