230 Commits

Author SHA1 Message Date
Nathan Chancellor
44902e73a4 Merge 4.4.238 into android-msm-wahoo-4.4
Changes in 4.4.238: (86 commits)
        af_key: pfkey_dump needs parameter validation
        KVM: fix memory leak in kvm_io_bus_unregister_dev()
        kprobes: fix kill kprobe which has been marked as gone
        ftrace: Setup correct FTRACE_FL_REGS flags for module
        RDMA/ucma: ucma_context reference leak in error path
        mtd: Fix comparison in map_word_andequal()
        hdlc_ppp: add range checks in ppp_cp_parse_cr()
        tipc: use skb_unshare() instead in tipc_buf_append()
        net: add __must_check to skb_put_padto()
        ip: fix tos reflection in ack and reset packets
        serial: 8250: Avoid error message on reprobe
        scsi: aacraid: fix illegal IO beyond last LBA
        m68k: q40: Fix info-leak in rtc_ioctl
        gma/gma500: fix a memory disclosure bug due to uninitialized bytes
        ASoC: kirkwood: fix IRQ error handling
        PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out
        mtd: cfi_cmdset_0002: don't free cfi->cfiq in error path of cfi_amdstd_setup()
        mfd: mfd-core: Protect against NULL call-back function pointer
        tracing: Adding NULL checks for trace_array descriptor pointer
        bcache: fix a lost wake-up problem caused by mca_cannibalize_lock
        xfs: fix attr leaf header freemap.size underflow
        kernel/sys.c: avoid copying possible padding bytes in copy_to_user
        neigh_stat_seq_next() should increase position index
        rt_cpu_seq_next should increase position index
        seqlock: Require WRITE_ONCE surrounding raw_seqcount_barrier
        ACPI: EC: Reference count query handlers under lock
        tracing: Set kernel_stack's caller size properly
        ar5523: Add USB ID of SMCWUSBT-G2 wireless adapter
        Bluetooth: Fix refcount use-after-free issue
        mm: pagewalk: fix termination condition in walk_pte_range()
        Bluetooth: prefetch channel before killing sock
        skbuff: fix a data race in skb_queue_len()
        audit: CONFIG_CHANGE don't log internal bookkeeping as an event
        selinux: sel_avc_get_stat_idx should increase position index
        scsi: lpfc: Fix RQ buffer leakage when no IOCBs available
        drm/omap: fix possible object reference leak
        dmaengine: tegra-apb: Prevent race conditions on channel's freeing
        media: go7007: Fix URB type for interrupt handling
        Bluetooth: guard against controllers sending zero'd events
        drm/amdgpu: increase atombios cmd timeout
        Bluetooth: L2CAP: handle l2cap config request during open state
        media: tda10071: fix unsigned sign extension overflow
        tpm: ibmvtpm: Wait for buffer to be set before proceeding
        tracing: Use address-of operator on section symbols
        serial: 8250_omap: Fix sleeping function called from invalid context during probe
        SUNRPC: Fix a potential buffer overflow in 'svc_print_xprts()'
        ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len
        ALSA: usb-audio: Fix case when USB MIDI interface has more than one extra endpoint descriptor
        mm/filemap.c: clear page error before actual read
        mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area
        KVM: Remove CREATE_IRQCHIP/SET_PIT2 race
        bdev: Reduce time holding bd_mutex in sync in blkdev_close()
        drivers: char: tlclk.c: Avoid data race between init and interrupt handler
        dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion
        atm: fix a memory leak of vcc->user_back
        phy: samsung: s5pv210-usb2: Add delay after reset
        Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
        USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()
        tty: serial: samsung: Correct clock selection logic
        ALSA: hda: Fix potential race in unsol event handler
        fuse: don't check refcount after stealing page
        USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
        e1000: Do not perform reset in reset_task if we are already down
        printk: handle blank console arguments passed in.
        vfio/pci: fix memory leaks of eventfd ctx
        perf kcore_copy: Fix module map when there are no modules loaded
        mtd: rawnand: omap_elm: Fix runtime PM imbalance on error
        ceph: fix potential race in ceph_check_caps
        mtd: parser: cmdline: Support MTD names containing one or more colons
        x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline
        vfio/pci: Clear error and request eventfd ctx after releasing
        vfio/pci: fix racy on error and request eventfd ctx
        s390/init: add missing __init annotations
        mwifiex: Increase AES key storage size to 256 bits
        batman-adv: bla: fix type misuse for backbone_gw hash indexing
        atm: eni: fix the missed pci_disable_device() for eni_init_one()
        batman-adv: mcast/TT: fix wrongly dropped or rerouted packets
        ALSA: asihpi: fix iounmap in error handler
        MIPS: Add the missing 'CPU_1074K' into __get_cpu_type()
        tty: vt, consw->con_scrolldelta cleanup
        kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()
        lib/string.c: implement stpcpy
        ata: define AC_ERR_OK
        ata: make qc_prep return ata_completion_errors
        ata: sata_mv, avoid trigerrable BUG_ON
        Linux 4.4.238

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2020-10-01 10:14:23 -07:00
Dmitry Osipenko
9fa1b9fed8 PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out
[ Upstream commit 53b4b2aeee26f42cde5ff2a16dd0d8590c51a55a ]

There is another kHz-conversion bug in the code, resulting in integer
overflow. Although, this time the resulting value is 4294966296 and it's
close to ULONG_MAX, which is okay in this case.

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-01 11:11:50 +02:00
Nathan Chancellor
4747b04527 Merge 4.9.209 into android-msm-bluecross-4.9
Changes in 4.9.209: (90 commits)
        PM / devfreq: Don't fail devfreq_dev_release if not in list
        RDMA/cma: add missed unregister_pernet_subsys in init failure
        scsi: lpfc: Fix memory leak on lpfc_bsg_write_ebuf_set func
        scsi: qla2xxx: Don't call qlt_async_event twice
        scsi: iscsi: qla4xxx: fix double free in probe
        scsi: libsas: stop discovering if oob mode is disconnected
        usb: gadget: fix wrong endpoint desc
        md: raid1: check rdev before reference in raid1_sync_request func
        s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits
        s390/cpum_sf: Avoid SBD overflow condition in irq handler
        IB/mlx4: Follow mirror sequence of device add during device removal
        xen-blkback: prevent premature module unload
        xen/balloon: fix ballooned page accounting without hotplug enabled
        PM / hibernate: memory_bm_find_bit(): Tighten node optimisation
        xfs: fix mount failure crash on invalid iclog memory access
        taskstats: fix data-race
        drm: limit to INT_MAX in create_blob ioctl
        Revert "perf report: Add warning when libunwind not compiled in"
        ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
        MIPS: Avoid VDSO ABI breakage due to global register variable
        mm/zsmalloc.c: fix the migrated zspage statistics.
        memcg: account security cred as well to kmemcg
        locks: print unsigned ino in /proc/locks
        dmaengine: Fix access to uninitialized dma_slave_caps
        compat_ioctl: block: handle Persistent Reservations
        ata: libahci_platform: Export again ahci_platform_<en/dis>able_phys()
        ata: ahci_brcm: Allow optional reset controller to be used
        ata: ahci_brcm: Fix AHCI resources management
        gpiolib: fix up emulated open drain outputs
        tracing: Have the histogram compare functions convert to u64 first
        ALSA: cs4236: fix error return comparison of an unsigned integer
        ftrace: Avoid potential division by zero in function profiler
        arm64: Revert support for execute-only user mappings
        PM / devfreq: Check NULL governor in available_governors_show
        nfsd4: fix up replay_matches_cache()
        xfs: don't check for AG deadlock for realtime files in bunmapi
        Bluetooth: btusb: fix PM leak in error case of setup
        Bluetooth: delete a stray unlock
        Bluetooth: Fix memory leak in hci_connect_le_scan
        media: flexcop-usb: ensure -EIO is returned on error condition
        regulator: ab8500: Remove AB8505 USB regulator
        media: usb: fix memory leak in af9005_identify_state
        tty: serial: msm_serial: Fix lockup for sysrq and oops
        fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP
        drm/mst: Fix MST sideband up-reply failure handling
        powerpc/pseries/hvconsole: Fix stack overread via udbg
        rxrpc: Fix possible NULL pointer access in ICMP handling
        ath9k_htc: Modify byte order for an error message
        ath9k_htc: Discard undersized packets
        net: add annotations on hh->hh_len lockless accesses
        s390/smp: fix physical to logical CPU map for SMT
        xen/blkback: Avoid unmapping unmapped grant pages
        locking/x86: Remove the unused atomic_inc_short() methd
        pstore/ram: Write new dumps to start of recycled zones
        locking/spinlock/debug: Fix various data races
        netfilter: ctnetlink: netns exit must wait for callbacks
        efi/gop: Return EFI_NOT_FOUND if there are no usable GOPs
        efi/gop: Return EFI_SUCCESS if a usable GOP was found
        efi/gop: Fix memory leak in __gop_query32/64()
        ARM: vexpress: Set-up shared OPP table instead of individual for each CPU
        netfilter: uapi: Avoid undefined left-shift in xt_sctp.h
        spi: spi-cavium-thunderx: Add missing pci_release_regions()
        ARM: dts: am437x-gp/epos-evm: fix panel compatible
        samples: bpf: Replace symbol compare of trace_event
        powerpc: Ensure that swiotlb buffer is allocated from low memory
        bnx2x: Do not handle requests from VFs after parity
        bnx2x: Fix logic to get total no. of PFs per engine
        net: usb: lan78xx: Fix error message format specifier
        rfkill: Fix incorrect check to avoid NULL pointer dereference
        ASoC: wm8962: fix lambda value
        regulator: rn5t618: fix module aliases
        kconfig: don't crash on NULL expressions in expr_eq()
        perf/x86/intel: Fix PT PMI handling
        net: stmmac: RX buffer size must be 16 byte aligned
        block: fix memleak when __blk_rq_map_user_iov() is failed
        parisc: Fix compiler warnings in debug_core.c
        llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c)
        macvlan: do not assume mac_header is set in macvlan_broadcast()
        net: stmmac: dwmac-sunxi: Allow all RGMII modes
        net: usb: lan78xx: fix possible skb leak
        pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
        sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY
        tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK
        vxlan: fix tos value before xmit
        vlan: vlan_changelink() should propagate errors
        net: sch_prio: When ungrafting, replace with FIFO
        vlan: fix memory leak in vlan_dev_set_egress_priority
        USB: core: fix check for duplicate endpoints
        USB: serial: option: add Telit ME910G1 0x110a composition
        Linux 4.9.209

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Conflicts:
	arch/arm64/mm/fault.c
	drivers/gpu/drm/drm_property.c
	kernel/locking/spinlock_debug.c
2020-01-12 11:10:25 -07:00
Leonard Crestez
c7afc27fd9 PM / devfreq: Don't fail devfreq_dev_release if not in list
[ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]

Right now devfreq_dev_release will print a warning and abort the rest of
the cleanup if the devfreq instance is not part of the global
devfreq_list. But this is a valid scenario, for example it can happen if
the governor can't be found or on any other init error that happens
after device_register.

Initialize devfreq->node to an empty list head in devfreq_add_device so
that list_del becomes a safe noop inside devfreq_dev_release and we can
continue the rest of the cleanup.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 11:22:37 +01:00
Nathan Chancellor
20037a92ca Merge 4.4.163 into android-msm-wahoo-4.4
Changes in 4.4.163: (116 commits)
        xfrm: Validate address prefix lengths in the xfrm selector.
        xfrm6: call kfree_skb when skb is toobig
        mac80211: Always report TX status
        cfg80211: reg: Init wiphy_idx in regulatory_hint_core()
        ARM: 8799/1: mm: fix pci_ioremap_io() offset check
        xfrm: validate template mode
        mac80211_hwsim: do not omit multicast announce of first added radio
        Bluetooth: SMP: fix crash in unpairing
        pxa168fb: prepare the clock
        asix: Check for supported Wake-on-LAN modes
        ax88179_178a: Check for supported Wake-on-LAN modes
        lan78xx: Check for supported Wake-on-LAN modes
        sr9800: Check for supported Wake-on-LAN modes
        r8152: Check for supported Wake-on-LAN Modes
        smsc75xx: Check for Wake-on-LAN modes
        smsc95xx: Check for Wake-on-LAN modes
        perf/ring_buffer: Prevent concurent ring buffer access
        net: cxgb3_main: fix a missing-check bug
        KEYS: put keyring if install_session_keyring_to_cred() fails
        ipv6: suppress sparse warnings in IP6_ECN_set_ce()
        net: drop write-only stack variable
        ser_gigaset: use container_of() instead of detour
        tracing: Skip more functions when doing stack tracing of events
        ARM: dts: apq8064: add ahci ports-implemented mask
        x86/mm/pat: Prevent hang during boot when mapping pages
        radix-tree: fix radix_tree_iter_retry() for tagged iterators.
        af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers
        net/mlx4_en: Resolve dividing by zero in 32-bit system
        ipv6: orphan skbs in reassembly unit
        um: Avoid longjmp/setjmp symbol clashes with libpthread.a
        sched/cgroup: Fix cgroup entity load tracking tear-down
        btrfs: don't create or leak aliased root while cleaning up orphans
        thermal: allow spear-thermal driver to be a module
        thermal: allow u8500-thermal driver to be a module
        tpm: fix: return rc when devm_add_action() fails
        x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs
        aacraid: Start adapter after updating number of MSIX vectors
        perf/core: Don't leak event in the syscall error path
        usbvision: revert commit 588afcc1
        MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue
        ASoC: ak4613: Enable cache usage to fix crashes on resume
        ASoC: wm8940: Enable cache usage to fix crashes on resume
        CIFS: handle guest access errors to Windows shares
        arm64: Fix potential race with hardware DBM in ptep_set_access_flags()
        xfrm: Clear sk_dst_cache when applying per-socket policy.
        scsi: Add STARGET_CREATED_REMOVE state to scsi_target_state
        sparc/pci: Refactor dev_archdata initialization into pci_init_dev_archdata
        sch_red: update backlog as well
        usb-storage: fix bogus hardware error messages for ATA pass-thru devices
        bpf: generally move prog destruction to RCU deferral
        drm/nouveau/fbcon: fix oops without fbdev emulation
        fuse: Dont call set_page_dirty_lock() for ITER_BVEC pages for async_dio
        ixgbevf: Fix handling of NAPI budget when multiple queues are enabled per vector
        net/mlx5e: Fix LRO modify
        net/mlx5e: Correctly handle RSS indirection table when changing number of channels
        ixgbe: fix RSS limit for X550
        ixgbe: Correct X550EM_x revision check
        ALSA: timer: Fix zero-division by continue of uninitialized instance
        vti6: flush x-netns xfrm cache when vti interface is removed
        gro: Allow tunnel stacking in the case of FOU/GUE
        brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain
        l2tp: hold socket before dropping lock in l2tp_ip{, 6}_recv()
        tty: serial: sprd: fix error return code in sprd_probe()
        video: fbdev: pxa3xx_gcu: fix error return code in pxa3xx_gcu_probe()
        sparc64 mm: Fix more TSB sizing issues
        gpu: host1x: fix error return code in host1x_probe()
        sparc64: Fix exception handling in UltraSPARC-III memcpy.
        gpio: msic: fix error return code in platform_msic_gpio_probe()
        usb: imx21-hcd: fix error return code in imx21_probe()
        usb: ehci-omap: fix error return code in ehci_hcd_omap_probe()
        usb: dwc3: omap: fix error return code in dwc3_omap_probe()
        spi/bcm63xx-hspi: fix error return code in bcm63xx_hsspi_probe()
        MIPS: Handle non word sized instructions when examining frame
        spi/bcm63xx: fix error return code in bcm63xx_spi_probe()
        spi: xlp: fix error return code in xlp_spi_probe()
        ASoC: spear: fix error return code in spdif_in_probe()
        PM / devfreq: tegra: fix error return code in tegra_devfreq_probe()
        bonding: avoid defaulting hard_header_len to ETH_HLEN on slave removal
        scsi: aacraid: Fix typo in blink status
        MIPS: microMIPS: Fix decoding of swsp16 instruction
        igb: Remove superfluous reset to PHY and page 0 selection
        MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression
        ARM: dts: imx53-qsb: disable 1.2GHz OPP
        fs/fat/fatent.c: add cond_resched() to fat_count_free_clusters()
        mtd: spi-nor: Add support for is25wp series chips
        perf tools: Disable parallelism for 'make clean'
        bridge: do not add port to router list when receives query with source 0.0.0.0
        net: bridge: remove ipv6 zero address check in mcast queries
        ipv6: mcast: fix a use-after-free in inet6_mc_check
        ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called
        net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs
        net: sched: gred: pass the right attribute to gred_change_table_def()
        net: socket: fix a missing-check bug
        net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules
        r8169: fix NAPI handling under high load
        sctp: fix race on sctp_id2asoc
        net: drop skb on failure in ip_check_defrag()
        vhost: Fix Spectre V1 vulnerability
        rtnetlink: Disallow FDB configuration for non-Ethernet device
        mremap: properly flush TLB before releasing the page
        crypto: shash - Fix a sleep-in-atomic bug in shash_setkey_unaligned
        ahci: don't ignore result code of ahci_reset_controller()
        cachefiles: fix the race between cachefiles_bury_object() and rmdir(2)
        ptp: fix Spectre v1 vulnerability
        RDMA/ucma: Fix Spectre v1 vulnerability
        IB/ucm: Fix Spectre v1 vulnerability
        cdc-acm: correct counting of UART states in serial state notification
        usb: gadget: storage: Fix Spectre v1 vulnerability
        USB: fix the usbfs flag sanitization for control transfers
        Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15IGM
        sched/fair: Fix throttle_list starvation with low CFS quota
        x86/percpu: Fix this_cpu_read()
        cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
        l2tp: hold tunnel socket when handling control frames in l2tp_ip and l2tp_ip6
        x86/time: Correct the attribute on jiffies' definition
        Linux 4.4.163

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2018-11-10 10:32:23 -07:00
Gustavo A. R. Silva
1bd2b909fd PM / devfreq: tegra: fix error return code in tegra_devfreq_probe()
[ Upstream commit 9e578b37505018622dfafc40eed7cd78ff2af221 ]

platform_get_irq() returns an error code, but the tegra-devfreq
driver ignores it and always returns -ENODEV. This is not correct,
and prevents -EPROBE_DEFER from being propagated properly.

Notice that platform_get_irq() no longer returns 0 on error:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af

Print and propagate the return value of platform_get_irq on failure.

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-10 07:41:40 -08:00
Nathan Chancellor
697251a20c Merge 4.4.117 into android-msm-wahoo-4.4-oreo-mr1
Changes in 4.4.117: (34 commits)
        IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports
        PM / devfreq: Propagate error from devfreq_add_device()
        s390: fix handling of -1 in set{,fs}[gu]id16 syscalls
        ARM: dts: STi: Add gpio polarity for "hdmi,hpd-gpio" property
        arm: spear600: Add missing interrupt-parent of rtc
        arm: spear13xx: Fix dmas cells
        arm: spear13xx: Fix spics gpio controller's warning
        ALSA: seq: Fix regression by incorrect ioctl_mutex usages
        KVM/x86: Reduce retpoline performance impact in slot_handle_level_range(), by always inlining iterator helper methods
        x86/cpu: Change type of x86_cache_size variable to unsigned int
        drm/radeon: adjust tested variable
        rtc-opal: Fix handling of firmware error codes, prevent busy loops
        ext4: save error to disk in __ext4_grp_locked_error()
        ext4: correct documentation for grpid mount option
        mm: hide a #warning for COMPILE_TEST
        video: fbdev: atmel_lcdfb: fix display-timings lookup
        console/dummy: leave .con_font_get set to NULL
        rtlwifi: rtl8821ae: Fix connection lost problem correctly
        Btrfs: fix deadlock in run_delalloc_nocow
        Btrfs: fix crash due to not cleaning up tree log block's dirty bits
        Btrfs: fix unexpected -EEXIST when creating new inode
        ALSA: hda - Fix headset mic detection problem for two Dell machines
        ALSA: usb-audio: Fix UAC2 get_ctl request with a RANGE attribute
        ALSA: hda/realtek: PCI quirk for Fujitsu U7x7
        ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204
        ALSA: seq: Fix racy pool initializations
        mvpp2: fix multicast address filter
        dm: correctly handle chained bios in dec_pending()
        x86: fix build warnign with 32-bit PAE
        vfs: don't do RCU lookup of empty pathnames
        ARM: pxa/tosa-bt: add MODULE_LICENSE tag
        ARM: dts: s5pv210: add interrupt-parent for ohci
        media: r820t: fix r820t_write_reg for KASAN
        Linux 4.4.117

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2018-02-22 09:34:39 -07:00
Bjorn Andersson
8bb3fe364f PM / devfreq: Propagate error from devfreq_add_device()
commit d1bf2d30728f310f72296b54f0651ecdb09cbb12 upstream.

Propagate the error of devfreq_add_device() in devm_devfreq_add_device()
rather than statically returning ENOMEM. This makes it slightly faster
to pinpoint the cause of a returned error.

Fixes: 8cd84092d3 ("PM / devfreq: Add resource-managed function for devfreq device")
Cc: stable@vger.kernel.org
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:44:58 +01:00
Dilip Kota
d30e4d4e54 devfreq_spdm: Handle spurious interrupts during bootup
Terminate the interrupts triggered before the intitalisation
itself.

Change-Id: I7c005134ecbdae38b58e4312f9e294f5b59c2510
Signed-off-by: Dilip Kota <dkota@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2017-03-22 02:47:41 -07:00
Deepak Kumar
26c2644b34 adreno_tz: Correct tz_buf pointer type to correct pointer arithmetic
Current tz_buf pointer type is causing the end address calcultion
of tz_buf to go wrong. "end_addr = tz_buf + PAGE_ALIGN(size)" is
resulting in an end address way beyond the allocated range because
tz_buf is of type unsigned int. This change changes the tz_buf
pointer type to u8 to fix this issue.

Change-Id: I16db09c565801b56c0c0ee8a8184f6e276512fa3
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2017-01-25 19:17:55 +05:30
Sudeep Yedalapure
6c6a15fc06 adreno_tz: Fix divide by zero problem in gpu_load_show()
If the acc_total value is zero then kernel would crash on
div-by-zero. Add better input validation in gpu_load_show()
to avoid divide by zero problem.

CRs-Fixed: 1092584
Change-Id: I7affbd797bf4b0025f718c757043b36f392dae5b
Signed-off-by: Sudeep Yedalapure <sudeepy@codeaurora.org>
2016-11-24 12:45:39 +05:30
Saravana Kannan
5d1169198d PM / devfreq: Restart previous governor if new governor fails to start
If the new governor fails to start, switch back to old governor so that the
devfreq state is not left in some weird limbo.

Change-Id: I7cf1e6ceb63d27ce08b2d17b97a9844d257464ce
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-11-09 09:55:27 -08:00
Linux Build Service Account
dac0f016e7 Merge "msm: kgsl: Remove use of uninitialized variable" 2016-10-22 11:26:53 -07:00
David Keitel
626da03683 PM / devfreq: memlat: add device attribute to show core to device bw map
This adds the freq_map device attribute to the mem_latency governor in
order to display a given device's core frequency to device bandwidth.
The output should be printed in the formatted in the same way as the
example:

Core freq (MHz) Device BW
            300      1525
            480      3143
            900      4173
           1017      7759
           1296      9887
           1555     11863
           1804     13763

Change-Id: I6bef33a1239329f0687ee3983c2c02d84e984284
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2016-10-11 15:05:27 -07:00
Oleg Perelet
237cd9fbf6 msm: kgsl: Remove use of uninitialized variable
During certain code execution paths dev_ab can be assigned
not initialized value.

CRs-Fixed: 1074208
Change-Id: I330a50f6d171497e5b6d3e44e8ce2b09f2d644e3
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
2016-10-11 12:32:09 -07:00
Rohit Gupta
55ec973fd9 PM / devfreq: bimc-bwmon: Fix rounding error
Fix rounding error that occurs when converting from byte to MB.

Change-Id: Id507e0ae73c42ad5995af0153c3255ad69fde9df
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-09-21 15:26:10 -07:00
Rohit Gupta
e549f7bdb0 PM / devfreq: bimc-bwmon: Add support for version 4
The version 4 of the BIMC BWMON hardware now has provisions for
counting bytes transferred at a high sampling rate.

Modify the existing driver and governor algorithm to
take advantage of that.

Change-Id: I5080297aef7e310d5c1a19098c177ddecb729c25
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2016-09-14 15:46:48 -07:00
Saravana Kannan
5599e9a931 PM / devfreq: bw_hwmon: Add HW offload support to governor
Some HW monitors can do a better job of the sampling and the threshold
checking than the SW implementation in the governor.  Update the governor's
API to add support for them.

Change-Id: Id4b5593a5ed3290684ba43ebebe2466ba0b730b6
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2016-09-01 15:21:03 -07:00
Rohit Gupta
3087c5f20d PM / devfreq: memlat: Add a core to memory frequency mapping table
Add a core to memory frequency mapping table, which establishes
a relationship between the core frequency and its corresponding
bandwidth vote.

The governor expects a "qcom,core-dev-table" table as part of a given
memlat hardware monitor's device tree node.

This table is read upon registration of the memlat governor. The table
is then used to determine the memory bandwidth vote corresponding to the
maximum of the core frequencies.

CRs-Fixed: 1054146
Change-Id: I9df118da1433125b02c937bf1799a0944b110fac
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Suggested-by: Saravana Kannan <skannan@codeaurora.org>
2016-08-17 16:37:23 -07:00
Rohit Gupta
10824a8806 PM / devfreq: memlat: Remove kfree() on probe fails
Memory allocated with devm_kzalloc() is automatically freed if
the probe function fails and returns an error code. So there
is no need to free cpu_grp explicitly for the failure cases
that might come up after it is allocated. Additionally calls to
devm_kzalloc() must be accompanied by devm_kfree() if memory
deallocation is necessary.
For these reasons remove the kfree(cpu_grp) from the probe
function.

Change-Id: Ic4838fd58d40d283ac301facc64b06813eb3bd7d
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-08-08 12:00:33 -07:00
David Dai
47335704fb dev_freq: devfreq_spdm: make cci_clk optional indicator
Enable dev_freq SPDM support in order to increase BIMC
vote based on bus rejection rate. Make cci_clk an optional
property as it's not always a relevant indicator of cpu performance.

CRs-Fixed: 1025515
Change-Id: I713cc396c8d563735981547e0dc18a63f6f15180
Signed-off-by: David Dai <daidavid1@codeaurora.org>
2016-06-29 15:12:37 -07:00
Rohit Gupta
7668a3726f PM / devfreq: memlat: Prevent deadlock with hotplug in start_hwmon
When start_hwmon() runs with another thread trying to hotplug a
CPU the two threads can enter a deadlock situation as follows:

Thread A (start_hwmon())		Thread B (CPU down)
get_online_cpus()
	|
atomic_inc(&cpu_hotplug.refcount)
					     CPU down
						|
				     mutex_lock(&cpu_add_remove_lock)
						|
				     cpu_hotplug_begin() waits on
				     cpu_hotplug.refcount to reset
register_cpu_notifier()
	|
mutex_lock(&cpu_add_remove_lock)

With this change the notifers are registered and unregistered per
device rather than having a common notifier block for all the memlat
devices and unregistration only happens on stop_hwmon. This makes it
possible to move the registration outside the hotplug lock without
any race between multiple memlat devices.

Change-Id: I6ad561fe4967042e45190aea2c9b7fcfe05bafdd
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-06-01 15:27:34 -07:00
Rohit Gupta
db19421224 PM / devfreq: Change the 'MSM' in devfreq device names to 'QCOM'
Substitute 'MSM' in the devfreq device/config names to 'QCOM' to
comply with the current standards.

Change-Id: I156ba6e2b5f8e06a28540ca5def5b178c3604512
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-05-20 19:23:45 -07:00
Oleg Perelet
8df0f9ec1d msm: kgsl: Port GPU bus dcvs to kernel 4.4
Port GPU dcvs from kernel 3.18 to kernel 4.4.

CRs-Fixed: 1013343
Change-Id: Ide662b12aa59effa541febcd758426e72b4a1b12
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
2016-05-18 13:37:38 -07:00
Saravana Kannan
d274d4f317 PM / devfreq: bw_hwmon: Fix race condition in polling interval update
When the polling interval is updated, the delayed workqueue is cancelled
and requeued with the new polling interval. However, the bw_hwmon IRQ can
come at the same time and try to stop and restart the delayed work (in the
IRQ thread). This can cause a race where the work might be queued twice or
canceled twice and cause a crash.

Fix this race condition by suspending and resuming the HW monitor when we
are updating the polling interval. This entirely avoids the race because
suspending the HW monitor also avoid the possibility of the IRQ coming
during the polling interval update.

CRs-Fixed: 954082
Change-Id: Ic7baf2a3da4ed8f8a9023617059e22fd81c3ba45
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-04-07 16:00:11 -07:00
Deepak Kumar
e22d001089 adreno_tz: Use context aware dcvs calls, if available
Add support to use context aware dcvs, if it is supported
by TZ. Context aware dcvs helps in handling sudden workload
scenarios.

Change-Id: I5e6e6003a5c61eacb4f5af91910994919a5a7684
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Signed-off-by: Divya Ponnusamy <pdivya@codeaurora.org>
2016-03-25 16:04:07 -07:00
Divya Ponnusamy
aab7ab1e09 msm: kgsl: Add disable-busy-time-burst to disable ceiling threshold
Add a devicetree property disable-busy-time-burst to
disable ceiling threshold in the governor. The ceiling threshold
cause busy time burst that switch power level for
large frames based on busy time.

Change-Id: I44f8a51e0aa49bb0b2210703f57874fd5f219c18
Signed-off-by: Divya Ponnusamy <pdivya@codeaurora.org>
2016-03-23 21:20:29 -07:00
Rohit Vaswani
91a1dd684f drivers: iommu, leds, input, clk, devfreq: fix warnings
Fix some variable initializations which would otherwise cause
forbidden warnings.

Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2016-03-23 20:57:40 -07:00
Junjie Wu
ee74d929b8 PM / devfreq: Kconfig: Replace ARCH_MSM with ARCH_QCOM
ARCH_MSM has been replaced by ARCH_QCOM. Fix Kconfig for various
devfreq governors and devices.

Change-Id: Ifa85494785cea7eb03be6c02d5664ee6bb2110c6
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:45 -07:00
Rohit Gupta
9c9b504f06 PM / devfreq: Fix the return value check in memlat governor
The return value of kstrtouint is erroneously checked while setting
the tunables for mem_latency governor due to which the tunables
cannot be changed from their default values.
This change rectifies that behavior.

Change-Id: Ief7dda4638ede2c97b26229f1188a1559b238920
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-03-23 20:04:44 -07:00
Rohit Gupta
44cac5da6a PM / devfreq: Fix perf event initialization to avoid memory leaks
Currently stop_hwmon only releases the perf events for each CPU
in the memlat device group. This leaves out the perf_event_attrs
that are not needed anymore leading to memory leaks.
This patch frees perf_event_attrs right after the perf events are
created because they are copied into the perf_event structure
when it is created for a particular event and hence do not need
to exist beyond that point.

Change-Id: If0871739ef477dfbcbbfc6ab2a631ce25deaf71c
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-03-23 20:04:43 -07:00
Rohit Gupta
6f55f08b06 PM / devfreq: Handle offline CPUs while creating events
If any of the CPUs monitored by a memlat device is offline while
trying to register for perf events, the registration fails
returning an error code to the governor's start_monitor function
which then fails the setting of governor and leaves the system in
a bad state.
To avoid this scenario, this patch allows for initialization errors
while registering for perf events and remembers the failing offline
CPUs. Perf event registration is tried for the failing CPUs when they
come back online. Once all the CPUs have registered for perf events
hotplug notifiers callbacks are unregistered.

Change-Id: I36c33d9dc627f60ab9d7db41913661927938e850
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-03-23 20:04:42 -07:00
Hanumath Prasad
69d2c9fae6 devfreq: devfreq_simple_dev: call clk_round_rate in dev_target
clk_set_rate is failing for some of the frequencies due to higher
precision introduced in clock driver. Hence call the clk_round_rate
again in dev_target to make sure we send the correct frequency to
clk_set_rate.

Change-Id: I3e40690bf794d99debbcecdcaf05aaac3363caa8
Signed-off-by: Hanumath Prasad <hpprasad@codeaurora.org>
2016-03-23 20:04:42 -07:00
Saravana Kannan
4b5b233f04 PM / devfreq: governor_cpufreq: Fix incorrect refcounting of OF node
The of_node_put(of_child) call was put in to balance the of_node_get()
that's done inside for_each_child_of_node(). But that's not the right thing
to do because for_each_child_of_node() already takes care of doing
of_node_put(). So, delete the unnecessary of_node_put(of_child) call. We
still need the of_node_put(of_par) though.

Change-Id: Iff7744839cfcf01d5a472449f74859e9030b7e16
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23 20:04:41 -07:00
Rohit Gupta
e0bb9942b4 PM / devfreq: memlat: Get complete CPU list during the probe
Currently arm-memlat-mon driver uses cpu_coregroup_mask to get
the sibling CPUs for the first CPU specified during the probe.
However if any of the CPUs in a cluster isn't hotplugged in
even once before the probe runs then the call to cpu_coregroup_mask
might not give the updated list of all the sibling CPUs for the
specified CPU.
With this change the initialization of the cpumask for the memlat
device is obtained from the list of CPU phandles specified in the
dtsi file.

Change-Id: Ide97d60d9eecbbe1d33deda72a13951059822896
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[junjiew@codeaurora.org: dropped changes in dtsi files.]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:40 -07:00
Rohit Gupta
43f61ed8aa PM / devfreq : Introduce a memory-latency governor
Use performance counters to detect the memory latency sensitivity
of CPU workloads and vote for higher DDR frequency if required.

Change-Id: Ie77a3523bc5713fc0315bd0abc3913f485a96e0e
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
Suggested-by: Saravana Kannan <skannan@codeaurora.org>
[junjiew@codeaurora.org: dropped changes in arch/arm64/Kconfig]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:39 -07:00
Rohit Gupta
c36f6302dc PM / devfreq: bw_hwmon: Expose a throttle adjust tunable
Newer versions of bimc-bwmon counters have the capability to fake
higher byte count than what's actually transferred between a bus
master and DDR if the bus master is being throttled by QoS hardware
logic. Add support to set the throttle adjust field that comes with
this newer version of bimc-bwmon.

Change-Id: I33376c825fb11ab2e378f828b1d2ae46dd582836
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
[junjiew@codeaurora.org: dropped changes in dtsi.]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:38 -07:00
Saravana Kannan
e006885fd2 PM / devfreq: bw_hwmon: Fix handling of max_mbps
When doing over-voting due to an UP_WAKE event, the governor
pre-initialized the max_mbps value for the next decision window. This was
done to prevent a dropping the vote below the original measurement in case
a DOWN_WAKE event comes before the decision window is complete. This has
the undesirable side-effect of keeping the votes high for two decision
windows following an UP_WAKE event.

Also, DOWN_WAKE event is currently disabled for any decision windows that
didn't do over-voting because doing so had significant performance impacts.

However, with historic max tracking, pattern detection and hysteresis, and
mbps zones awareness that were added later on, the above concerns aren't
really valid anymore.  So, simply delete the pre-initialization of the
max_mbps so that one decision window isn't unnecessarily voting higher than
necessary. As part of the change, also fix down_cnt logic to allow it to
work for all decision windows if enabled.

Change-Id: I600e3783da617ed4efef5b05156016d88c301cea
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23 20:04:37 -07:00
Rohit Gupta
f82a7ca96a PM / devfreq: bw_hwmon: Allow up_scale to be set to zero
Currently the lower limit for setting up_scale is 100. Change it
to 0 so that over-voting for spikes in measured bandwidth can be
disabled by setting up_scale to 0.

Change-Id: I1e5e3d51c625163b38074fb1eda26763455ea6c5
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
2016-03-23 20:04:37 -07:00
Saravana Kannan
022033e9e8 PM / devfreq: bw_hwmon: Remove debug logs from high frequency code path
Using debug logs for the short samples would result in excessive logging
and also have an impact on CPU power and performance. The tracepoint that's
already there is a much better alternative. So, delete the debug logs.

Change-Id: Idd1d634f510381d14637f3b84588a118572f3f16
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23 20:04:36 -07:00
Saravana Kannan
67e12b02ec PM / devfreq: bimc-bwmon: Fix IRQ registration in resume path
The IRQ registration on the resume path was not updated properly when the
high sampling rate algorithm was implemented. Update it so that the IRQ
registration is done correctly.

Change-Id: I17a016dd9c0b50c7b415beda21368cb4586d203c
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23 20:04:35 -07:00
Junjie Wu
aab1e601de PM / devfreq: governor_cache_hwmon: Add mrps and freq vote traces
Replace measured mrps and frequency vote debug prints with trace
events.

Change-Id: I78370b068e3819a57635cbabaf5cdd053ebabce4
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:34 -07:00
Hanumath Prasad
ee4630d01e PM / devfreq: bimc-bwmon: Update irq handling in suspend/resume
Change the sequence of registering and freeing the interrupt
handler in suspend/resume. Freeirq needs a guarantee that the
IRQ can't come anymore before we call it. So, we disable the IRQ
before calling freeirq.And register the handler before enabling
the irq to avoid the interrupt getting unhandled.

Change-Id: I3945202d049e16f64a16e456f914f7602b763c89
Signed-off-by: Hanumath Prasad <hpprasad@codeaurora.org>
2016-03-23 20:04:33 -07:00
Saravana Kannan
3dfc05409f PM / devfreq: bw_hwmon: Take at least one sample per decision window
Due to the way the short samples are triggered, when the traffic is very
low, we could have a decision window where no sample is taken. Fix this by
forcing a sample at the end of every decision window as long as that is the
first sample for that decision window or the sample window won't be smaller
than the sample_ms tunable.

Change-Id: Ia33b59fbff9ff4058c06e24208d1e037d6e9eda9
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23 20:04:32 -07:00
Saravana Kannan
1610191072 PM / devfreq: bw_hwmon: Remove unused tunables and disable some by default
With the rewrite of the algorithm, some tunables are not used. Remove those
tunables. Other tunables don't make a lot of sense to be turned on by
default. Change their default state to be disabled.

Change-Id: I228d275a21765986a7117b335a669deebf590f29
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
2016-03-23 20:04:32 -07:00
Saravana Kannan
ee91d88179 PM / devfreq: bw_hwmon: Fix AB vote less than measurement when freq at max
When the decision window is terminated early by an IRQ and the frequency
voted by the governor is the max_freq allowed for that device, the AB vote
can be lower than the measured value. This really shouldn't affect power or
performance since the device frequency is already maxed out, but fix it
anyway so that the logs don't look suspicious.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Change-Id: I1788cbb1af026f1c54f9acc4806cb29cd6069e04
2016-03-23 20:04:31 -07:00
Junjie Wu
3c83b5f06c PM / devfreq: m4m-hwmon: Fix counter limit calculation
M4M counters are only 28-bit instead of 32-bit. Fix limit calculation
to use the right max value.

Change-Id: I91078842b72da80f6b6755bf8d808ff4b4142f10
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:30 -07:00
Junjie Wu
6b034b3c5f PM / devfreq: m4m_hwmon: Enable cycle counter when m4m_hwmon starts
Enable cycle counter along with other counters when m4m_hwmon is
started.

Change-Id: Idd86b99c21e21f64bb91db9b1e64597fbfb2306a
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:29 -07:00
Hanumath Prasad
9e61a51f6a PM / devfreq: msmcci-hwmon: Add support for handling shared irq
Some targets have a single irq line which is shared among all
the cci hwmon counters. Enhance the driver to support shared interrupt
handling.

Change-Id: I5fdaecfaa14fa47e8f393fe51c538e5000e6ad5b
Signed-off-by: Arun KS <arunks@codeaurora.org>
Signed-off-by: Hanumath Prasad <hpprasad@codeaurora.org>
2016-03-23 20:04:28 -07:00
Junjie Wu
708a8f999e devfreq: devfreq_simple_dev: Add support for preparing device clock
For certain implementation, device clock needs to be prepared before
rate voting taking effect. Add support for preparing device clock
during initialization.

Change-Id: Ib22e83952187118342ff2546d4c79d3970a288f9
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
2016-03-23 20:04:27 -07:00