1. 10 Apr, 2017 6 commits
    • Dave Airlie's avatar
      Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next · d455937e
      Dave Airlie authored
      Noteworthy changes this time:
      1) 4k support for newer chips (ganging up hwpipes and mixers)
      2) using OPP bindings for gpu
      3) more prep work towards per-process pagetables
      
      * 'msm-next' of git://people.freedesktop.org/~robclark/linux: (47 commits)
        msm/drm: gpu: Dynamically locate the clocks from the device tree
        drm/msm: gpu: Use OPP tables if we can
        drm/msm: Hard code the GPU "slow frequency"
        drm/msm: Add MSM_PARAM_GMEM_BASE
        drm/msm: Reference count address spaces
        drm/msm: Make sure to detach the MMU during GPU cleanup
        drm/msm/mdp5: Enable 3D mux in mdp5_ctl
        drm/msm/mdp5: Reset CTL blend registers before configuring them
        drm/msm/mdp5: Assign 'right' mixer to CRTC state
        drm/msm/mdp5: Stage border out on base stage if CRTC has 2 LMs
        drm/msm/mdp5: Stage right side hwpipes on Right-side Layer Mixer
        drm/msm/mdp5: Prepare Layer Mixers for source split
        drm/msm/mdp5: Configure 'right' hwpipe
        drm/msm/mdp5: Assign a 'right hwpipe' to plane state
        drm/msm/mdp5: Create mdp5_hwpipe_mode_set
        drm/msm/mdp5: Add optional 'right' Layer Mixer in CRTC state
        drm/msm/mdp5: Add a CAP for Source Split
        drm/msm/mdp5: Remove mixer/intf pointers from mdp5_ctl
        drm/msm/mdp5: Start using parameters from CRTC state
        drm/msm/mdp5: Add more stuff to CRTC state
        ...
      d455937e
    • Dave Airlie's avatar
      Merge tag 'drm-misc-next-2017-04-07' of git://anongit.freedesktop.org/git/drm-misc into drm-next · df45eaca
      Dave Airlie authored
      Last drm-misc-next pull req for 4.12
      
      Core changes:
       - fb_helper checkpatch cleanup and simplified _add_one_connector() (Thierry)
       - drm_ioctl and drm_sysfs improved/gained documentation (Daniel)
       - [ABI] Repurpose reserved field in drm_event_vblank for crtc_id (Ander)
       - Plumb acquire ctx through legacy paths to avoid lock_all and legacy_backoff
         (Daniel)
       - Add connector_atomic_check to check conn constraints on modeset (Maarten)
       - Add drm_of_find_panel_or_bridge to remove boilerplate in drivers (Rob)
      
      Driver changes:
       - meson moved to drm-misc (Neil)
       - Added support for Amlogic GX SoCs in dw-hdmi (Neil)
       - Rockchip unbind actually cleans up the things bind initializes (Jeffy)
       - A couple misc fixes in virtio, dw-hdmi
      
      NOTE: this also includes a backmerge of drm-next as well rc5 (we needed vmwgfx
            as well as the new synopsys media formats)
      
      * tag 'drm-misc-next-2017-04-07' of git://anongit.freedesktop.org/git/drm-misc: (77 commits)
        Revert "drm: Don't allow interruptions when opening debugfs/crc"
        drm: Only take cursor locks when the cursor plane exists
        drm/vmwgfx: Fix fbdev emulation using legacy functions
        drm/rockchip: Shutdown all crtcs when unbinding drm
        drm/rockchip: Reorder drm bind/unbind sequence
        drm/rockchip: analogix_dp: Disable clock when unbinding
        drm/rockchip: vop: Unprepare clocks when unbinding
        drm/rockchip: vop: Enable pm domain before vop_initial
        drm/rockchip: cdn-dp: Don't unregister audio dev when unbinding
        drm/rockchip: cdn-dp: Don't try to release firmware when not loaded
        drm: bridge: analogix: Destroy connector & encoder when unbinding
        drm: bridge: analogix: Disable clock when unbinding
        drm: bridge: analogix: Unregister dp aux when unbinding
        drm: bridge: analogix: Detach panel when unbinding analogix dp
        drm: Don't allow interruptions when opening debugfs/crc
        drm/virtio: don't leak bo on drm_gem_object_init failure
        drm: bridge: dw-hdmi: fix input format/encoding from plat_data
        drm: omap: use common OF graph helpers
        drm: convert drivers to use drm_of_find_panel_or_bridge
        drm: convert drivers to use of_graph_get_remote_node
        ...
      df45eaca
    • Dave Airlie's avatar
      Backmerge tag 'v4.11-rc6' into drm-next · b769fefb
      Dave Airlie authored
      Linux 4.11-rc6
      
      drm-misc needs 4.11-rc5, may as well fix conflicts with rc6.
      b769fefb
    • Dave Airlie's avatar
      Merge branch 'drm-next-4.12' of git://people.freedesktop.org/~agd5f/linux into drm-next · 1420f63b
      Dave Airlie authored
      Just some bug fixes and vega10 updates for 4.12.
      
      * 'drm-next-4.12' of git://people.freedesktop.org/~agd5f/linux:
        drm/amdgpu: fix fence memory leak in wait_all_fence V2
        drm/amdgpu: fix "fix 64bit division"
        drm/amd/powerplay: add fan controller table v11 support.
        drm/amd/powerplay: port newest process pptable code for vega10.
        drm/amdgpu: set vm size and block size by individual gmc by default (v3)
        drm/amdgpu: Avoid overflows/divide-by-zero in latency_watermark calculations.
        drm/amdgpu: Make display watermark calculations more accurate
        drm/radeon: fix typo in bandwidth calculation
        drm/radeon: Refuse to migrate a prime BO to VRAM. (v2)
        drm/radeon: Maintain prime import/export refcount for BOs
        drm/amdgpu: Refuse to pin or change acceptable domains of prime BOs to VRAM. (v2)
        drm/amdgpu: Fail fb creation from imported dma-bufs. (v2)
        drm/radeon: Fail fb creation from imported dma-bufs.
      1420f63b
    • Dave Airlie's avatar
      Merge tag 'drm-intel-testing-2017-04-03' of... · 2b2fc72a
      Dave Airlie authored
      Merge tag 'drm-intel-testing-2017-04-03' of git://anongit.freedesktop.org/git/drm-intel into drm-next
      
      Last 4.12 feature pile:
      
      GVT updates:
      - Add mdev attribute group for per-vgpu info
      - Time slice based vGPU scheduling QoS support (Gao Ping)
      - Initial KBL support for E3 server (Han Xu)
      - other misc.
      
      i915:
      - lots and lots of small fixes and improvements all over
      - refactor fw_domain code (Chris Wilson)
      - improve guc code (Oscar Mateo)
      - refactor cursor/sprite code, precompute more for less overhead in
        the critical path (Ville)
      - refactor guc/huc fw loading code a bit (Michal Wajdeczko)
      
      * tag 'drm-intel-testing-2017-04-03' of git://anongit.freedesktop.org/git/drm-intel: (121 commits)
        drm/i915: Update DRIVER_DATE to 20170403
        drm/i915: Clear gt.active_requests before checking idle status
        drm/i915/uc: Drop use of MISSING_CASE on trivial enums
        drm/i915: make a few DDI functions static
        drm/i915: Combine reset_all_global_seqno() loops into one
        drm/i915: Remove redudant wait for each engine to idle from seqno wrap
        drm/i915: Wait for all engines to be idle as part of i915_gem_wait_for_idle()
        drm/i915: Move retire-requests into i915_gem_wait_for_idle()
        drm/i915/uc: Move fw path check to fetch_uc_fw()
        drm/i915/huc: Remove unused intel_huc_fini()
        drm/i915/uc: Add intel_uc_fw_fini()
        drm/i915/uc: Add intel_uc_fw_type_repr()
        drm/i915/uc: Move intel_uc_fw_status_repr() to intel_uc.h
        drivers: gpu: drm: i915L intel_lpe_audio: Fix kerneldoc comments
        drm/i915: Suppress busy status for engines if wedged
        drm/i915: Do request retirement before marking engines as wedged
        drm/i915: Drop verbose and archaic "ring" from our internal engine names
        drm/i915: Use a dummy timeline name for a signaled fence
        drm/i915: Ironlake do_idle_maps w/a may be called w/o struct_mutex
        drm/i915/guc: Take enable_guc_loading check out of GEM core code
        ...
      2b2fc72a
    • Dave Airlie's avatar
      Merge branch 'drm-next-4.12' of https://github.com/ckhu-mediatek/linux.git-tags into drm-next · cdf5316b
      Dave Airlie authored
      This series is MT2701 DRM support.
      
      * 'drm-next-4.12' of https://github.com/ckhu-mediatek/linux.git-tags:
        drm/mediatek: add support for Mediatek SoC MT2701
        drm/mediatek: update DSI sub driver flow for sending commands to panel
        drm/mediatek: add non-continuous clock mode and EOT packet control
        drm/mediatek: add dsi transfer function
        drm/mediatek: add dsi interrupt control
        drm/mediatek: cleaning up and refine
        drm/mediatek: update display module connections
        drm/mediatek: add BLS component
        drm/mediatek: add shadow register support
        drm/mediatek: add *driver_data for different hardware settings
        drm/mediatek: add helpers for coverting from the generic components
        dt-bindings: display: mediatek: update supported chips
      cdf5316b
  2. 09 Apr, 2017 6 commits
    • Linus Torvalds's avatar
      Linux 4.11-rc6 · 39da7c50
      Linus Torvalds authored
      39da7c50
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 · 84ced7fd
      Linus Torvalds authored
      Pull CIFS fixes from Steve French:
       "This is a set of CIFS/SMB3 fixes for stable.
      
        There is another set of four SMB3 reconnect fixes for stable in
        progress but they are still being reviewed/tested, so didn't want to
        wait any longer to send these five below"
      
      * 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
        Reset TreeId to zero on SMB2 TREE_CONNECT
        CIFS: Fix build failure with smb2
        Introduce cifs_copy_file_range()
        SMB3: Rename clone_range to copychunk_range
        Handle mismatched open calls
      84ced7fd
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm · 462e9a35
      Linus Torvalds authored
      Pull ARM fixes from Russell King:
       "A number of ARM fixes:
      
         - prevent oopses caused by dma_get_sgtable() and declared DMA
           coherent memory
      
         - fix boot failure on nommu caused by ID_PFR1 access
      
         - a number of kprobes fixes from Jon Medhurst and Masami Hiramatsu"
      
      * 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 8665/1: nommu: access ID_PFR1 only if CPUID scheme
        ARM: dma-mapping: disallow dma_get_sgtable() for non-kernel managed memory
        arm: kprobes: Align stack to 8-bytes in test code
        arm: kprobes: Fix the return address of multiple kretprobes
        arm: kprobes: Skip single-stepping in recursing path if possible
        arm: kprobes: Allow to handle reentered kprobe on single-stepping
      462e9a35
    • Linus Torvalds's avatar
      Merge tag 'driver-core-4.11-rc6' of... · 5b50be74
      Linus Torvalds authored
      Merge tag 'driver-core-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fixes from Greg KH:
       "Here are 3 small fixes for 4.11-rc6.
      
        One resolves a reported issue with sysfs files that NeilBrown found,
        one is a documenatation fix for the stable kernel rules, and the last
        is a small MAINTAINERS file update for kernfs"
      
      * tag 'driver-core-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        MAINTAINERS: separate out kernfs maintainership
        sysfs: be careful of error returns from ops->show()
        Documentation: stable-kernel-rules: fix stable-tag format
      5b50be74
    • Linus Torvalds's avatar
      Merge tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 62e1fd08
      Linus Torvalds authored
      Pull staging/IIO driver rfixes from Greg KH:
       "Here are a number of small IIO and staging driver fixes for 4.11-rc6.
        Nothing big here, just iio fixes for reported issues, and an ashmem
        fix for a very old bug that has been reported by a number of Android
        vendors"
      
      * tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
        iio: hid-sensor-attributes: Fix sensor property setting failure.
        iio: accel: hid-sensor-accel-3d: Fix duplicate scan index error
        iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values
        iio: st_pressure: initialize lps22hb bootime
        iio: bmg160: reset chip when probing
        iio: cros_ec_sensors: Fix return value to get raw and calibbias data.
      62e1fd08
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 2a610b8a
      Linus Torvalds authored
      Pull VFS fixes from Al Viro:
       "statx followup fixes and a fix for stack-smashing on alpha"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        alpha: fix stack smashing in old_adjtimex(2)
        statx: Include a mask for stx_attributes in struct statx
        statx: Reserve the top bit of the mask for future struct expansion
        xfs: report crtime and attribute flags to statx
        ext4: Add statx support
        statx: optimize copy of struct statx to userspace
        statx: remove incorrect part of vfs_statx() comment
        statx: reject unknown flags when using NULL path
        Documentation/filesystems: fix documentation for ->getattr()
      2a610b8a
  3. 08 Apr, 2017 28 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 78d91a75
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Here's a pull request for 4.11-rc, fixing a set of issues mostly
        centered around the new scheduling framework. These have been brewing
        for a while, but split up into what we absolutely need in 4.11, and
        what we can defer until 4.12. These are well tested, on both single
        queue and multiqueue setups, and with and without shared tags. They
        fix several hangs that have happened in testing.
      
        This is obviously larger than I would have preferred at this point in
        time, but I don't think we can shave much off this and still get the
        desired results.
      
        In detail, this pull request contains:
      
         - a set of five fixes for NVMe, mostly from Christoph and one from
           Roland.
      
         - a series from Bart, fixing issues with dm-mq and SCSI shared tags
           and scheduling. Note that one of those patches commit messages may
           read like an optimization, but it is in fact an important fix for
           queue restarts in particular.
      
         - a series from Omar, most importantly fixing a hang with multiple
           hardware queues when we fail to get a driver tag. Another important
           fix in there is for resizing hardware queues, which nbd does when
           handling multiple sockets for one connection.
      
         - fixing an imbalance in putting the ctx for hctx request allocations
           from Minchan"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        blk-mq: Restart a single queue if tag sets are shared
        dm rq: Avoid that request processing stalls sporadically
        scsi: Avoid that SCSI queues get stuck
        blk-mq: Introduce blk_mq_delay_run_hw_queue()
        blk-mq: remap queues when adding/removing hardware queues
        blk-mq-sched: fix crash in switch error path
        blk-mq-sched: set up scheduler tags when bringing up new queues
        blk-mq-sched: refactor scheduler initialization
        blk-mq: use the right hctx when getting a driver tag fails
        nvmet: fix byte swap in nvmet_parse_io_cmd
        nvmet: fix byte swap in nvmet_execute_write_zeroes
        nvmet: add missing byte swap in nvmet_get_smart_log
        nvme: add missing byte swap in nvme_setup_discard
        nvme: Correct NVMF enum values to match NVMe-oF rev 1.0
        block: do not put mq context in blk_mq_alloc_request_hctx
      78d91a75
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · c3df1c7c
      Linus Torvalds authored
      Pull pin control fix from Linus Walleij:
       "This late fix for pin control is hopefully the last I send this cycle.
      
        The problem was detected early in the v4.11 release cycle and there
        has been some back and forth on how to solve it. Sadly the proper fix
        arrives late, but at least not too late.
      
        An issue was detected with pin control on the Freescale i.MX after the
        refactorings for more general group and function handling.
      
        We now have the proper fix for this"
      
      * tag 'pinctrl-v4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()
      c3df1c7c
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 894ca30c
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Some more powerpc fixes for 4.11:
      
        Headed to stable:
      
         - disable HFSCR[TM] if TM is not supported, fixes a potential host
           kernel crash triggered by a hostile guest, but only in
           configurations that no one uses
      
         - don't try to fix up misaligned load-with-reservation instructions
      
         - fix flush_(d|i)cache_range() called from modules on little endian
           kernels
      
         - add missing global TLB invalidate if cxl is active
      
         - fix missing preempt_disable() in crc32c-vpmsum
      
        And a fix for selftests build changes that went in this release:
      
         - selftests/powerpc: Fix standalone powerpc build
      
        Thanks to: Benjamin Herrenschmidt, Frederic Barrat, Oliver O'Halloran,
        Paul Mackerras"
      
      * tag 'powerpc-4.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/crypto/crc32c-vpmsum: Fix missing preempt_disable()
        powerpc/mm: Add missing global TLB invalidate if cxl is active
        powerpc/64: Fix flush_(d|i)cache_range() called from modules
        powerpc: Don't try to fix up misaligned load-with-reservation instructions
        powerpc: Disable HFSCR[TM] if TM is not supported
        selftests/powerpc: Fix standalone powerpc build
      894ca30c
    • Chris Salls's avatar
      mm/mempolicy.c: fix error handling in set_mempolicy and mbind. · cf01fb99
      Chris Salls authored
      In the case that compat_get_bitmap fails we do not want to copy the
      bitmap to the user as it will contain uninitialized stack data and leak
      sensitive data.
      Signed-off-by: default avatarChris Salls <salls@cs.ucsb.edu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cf01fb99
    • Liping Zhang's avatar
      sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec · 425fffd8
      Liping Zhang authored
      Currently, inputting the following command will succeed but actually the
      value will be truncated:
      
        # echo 0x12ffffffff > /proc/sys/net/ipv4/tcp_notsent_lowat
      
      This is not friendly to the user, so instead, we should report error
      when the value is larger than UINT_MAX.
      
      Fixes: e7d316a0 ("sysctl: handle error writing UINT_MAX to u32 fields")
      Signed-off-by: default avatarLiping Zhang <zlpnobody@gmail.com>
      Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      425fffd8
    • Tejun Heo's avatar
      MAINTAINERS: separate out kernfs maintainership · 27f395b8
      Tejun Heo authored
      Separate out kernfs from driver core and add myself as a
      co-maintainer.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27f395b8
    • NeilBrown's avatar
      sysfs: be careful of error returns from ops->show() · c8a139d0
      NeilBrown authored
      ops->show() can return a negative error code.
      Commit 65da3484 ("sysfs: correctly handle short reads on PREALLOC attrs.")
      (in v4.4) caused this to be stored in an unsigned 'size_t' variable, so errors
      would look like large numbers.
      As a result, if an error is returned, sysfs_kf_read() will return the
      value of 'count', typically 4096.
      
      Commit 17d0774f ("sysfs: correctly handle read offset on PREALLOC attrs")
      (in v4.8) extended this error to use the unsigned large 'len' as a size for
      memmove().
      Consequently, if ->show returns an error, then the first read() on the
      sysfs file will return 4096 and could return uninitialized memory to
      user-space.
      If the application performs a subsequent read, this will trigger a memmove()
      with extremely large count, and is likely to crash the machine is bizarre ways.
      
      This bug can currently only be triggered by reading from an md
      sysfs attribute declared with __ATTR_PREALLOC() during the
      brief period between when mddev_put() deletes an mddev from
      the ->all_mddevs list, and when mddev_delayed_delete() - which is
      scheduled on a workqueue - completes.
      Before this, an error won't be returned by the ->show()
      After this, the ->show() won't be called.
      
      I can reproduce it reliably only by putting delay like
      	usleep_range(500000,700000);
      early in mddev_delayed_delete(). Then after creating an
      md device md0 run
        echo clear > /sys/block/md0/md/array_state; cat /sys/block/md0/md/array_state
      
      The bug can be triggered without the usleep.
      
      Fixes: 65da3484 ("sysfs: correctly handle short reads on PREALLOC attrs.")
      Fixes: 17d0774f ("sysfs: correctly handle read offset on PREALLOC attrs")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Reported-and-tested-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c8a139d0
    • Johan Hovold's avatar
      Documentation: stable-kernel-rules: fix stable-tag format · cf903e9d
      Johan Hovold authored
      A patch documenting how to specify which kernels a particular fix should
      be backported to (seemingly) inadvertently added a minus sign after the
      kernel version. This particular stable-tag format had never been used
      prior to this patch, and was neither present when the patch in question
      was first submitted (it was added in v2 without any comment).
      
      Drop the minus sign to avoid any confusion.
      
      Fixes: fdc81b79 ("stable_kernel_rules: Add clause about specification of kernel versions to patch.")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf903e9d
    • Jordan Crouse's avatar
      msm/drm: gpu: Dynamically locate the clocks from the device tree · 98db803f
      Jordan Crouse authored
      Instead of using a fixed list of clock names use the clock-names
      list in the device tree to discover and get the list of clocks
      that we need.
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      98db803f
    • Jordan Crouse's avatar
      drm/msm: gpu: Use OPP tables if we can · e2af8b6b
      Jordan Crouse authored
      If a OPP table is defined for the GPU device in the device tree use
      that in lieu of the downstream style GPU frequency table. If we do
      use the downstream table convert it to a OPP table so that we can
      take advantage of the OPP lookup facilities later.
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      e2af8b6b
    • Jordan Crouse's avatar
      drm/msm: Hard code the GPU "slow frequency" · bf5af4ae
      Jordan Crouse authored
      Some A3XX and A4XX GPU targets required that the GPU clock be
      programmed to a non zero value when it was disabled so
      27Mhz was chosen as the "invalid" frequency.
      
      Even though newer targets do not have the same clock restrictions
      we still write 27Mhz on clock disable and expect the clock subsystem
      to round down to zero.
      
      For unknown reasons even though the slow clock speed is always
      27Mhz and it isn't actually a functional level the legacy device tree
      frequency tables always defined it and then did gymnastics to work
      around it.
      
      Instead of playing the same silly games just hard code the "slow" clock
      speed in the code as 27MHz and save ourselves a bit of infrastructure.
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      bf5af4ae
    • Jordan Crouse's avatar
      drm/msm: Add MSM_PARAM_GMEM_BASE · e3689e47
      Jordan Crouse authored
      User space needs to know where the GMEM whole starts so that they
      can set up the addressing correctly.
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      e3689e47
    • Jordan Crouse's avatar
      drm/msm: Reference count address spaces · ee546cd3
      Jordan Crouse authored
      There are reasons for a memory object to outlive the file descriptor
      that created it and so the address space that a buffer object is
      attached to must also outlive the file descriptor. Reference count
      the address space so that it can remain viable until all the objects
      have released their addresses.
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      ee546cd3
    • Jordan Crouse's avatar
      drm/msm: Make sure to detach the MMU during GPU cleanup · 9873ef07
      Jordan Crouse authored
      We should be detaching the MMU before destroying the address
      space. To do this cleanly, the detach has to happen in
      adreno_gpu_cleanup() because it needs access to structs
      in adreno_gpu.c.  Plus it is better symmetry to have
      the attach and detach at the same code level.
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      9873ef07
    • Archit Taneja's avatar
      drm/msm/mdp5: Enable 3D mux in mdp5_ctl · 3a882143
      Archit Taneja authored
      3D mux is a small block placed after the DSPPs in MDP5. It can merge
      2 LM/DSPP outputs and feed it to a single interface.
      
      Enable 3D Mux if our mdp5_pipeline has 2 active LMs. This check
      will need to be made more specific later when we add Dual DSI
      support with source split enabled. In that use case, each LM feeds to a
      separae INTF, so the 3D mux isn't needed.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      3a882143
    • Archit Taneja's avatar
      drm/msm/mdp5: Reset CTL blend registers before configuring them · 0d1d3e44
      Archit Taneja authored
      Assigning LMs dynamically to CRTCs results in REG_MDP5_CTL_LAYER_REGs
      and REG_MDP5_CTL_LAYER_EXT_REGs maintaining old values for a LM that
      isn't used by our CTL instance anymore.
      
      Clear the ctl's CTL_LAYER_REG and CTL_LAYER_EXT_REGs for all LM
      instances. The ones that need to be configured are configured later
      in this func.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      0d1d3e44
    • Archit Taneja's avatar
      drm/msm/mdp5: Assign 'right' mixer to CRTC state · 8480adac
      Archit Taneja authored
      Dynamically assign a right mixer to mdp5_crtc_state in the CRTC's
      atomic_check path. Assigning the right mixer has some constraints,
      i.e, only a few LMs can be paired together. Update mdp5_mixer_assign
      to handle these constraints.
      
      Firstly, we need to identify whether we need a right mixer or not.
      At the moment, there are 2 scenarios where a right mixer might be
      needed:
      - If any of the planes connected to this CRTC is too wide (i.e, is
        comprised of 2 hwpipes).
      - If the CRTC's mode itself is too wide (i.e, a 4K mode on HDMI).
      
      We implement both these checks in the mdp5_crtc_atomic_check(), and
      pass 'need_right_mixer' to mdp5_setup_pipeline.
      
      If a CRTC is already assigned a single mixer, and a new atomic commit
      brings in a drm_plane that needs 2 hwpipes, we can successfully commit
      this mode without requiring a full modeset, provided that we still use
      the previously assigned mixer as the left mixer. If such an assignment
      isn't possible, we'd need to do a full modeset. This scenario has been
      ignored for now.
      
      The mixer assignment code is a bit messy, considering we have at most
      4 LM instances in hardware. This can probably be re-visited later with
      simplified logic.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      8480adac
    • Archit Taneja's avatar
      drm/msm/mdp5: Stage border out on base stage if CRTC has 2 LMs · 359ae862
      Archit Taneja authored
      If a CRTC comprises of 2 LMs, it is mandatory to enable border out
      and assign it to the base stage.
      
      We had to enable border out also when the base plane wasn't fullscreen.
      Club these checks and put them in a separate function called
      get_start_stage() that returns the starting stage for assigning planes.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      359ae862
    • Archit Taneja's avatar
      drm/msm/mdp5: Stage right side hwpipes on Right-side Layer Mixer · bf8dc0a0
      Archit Taneja authored
      Now that our mdp5_planes can consist of 2 hwpipes, update the
      blend_setup() code to stage the right hwpipe to the left and
      right LMs
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      bf8dc0a0
    • Archit Taneja's avatar
      drm/msm/mdp5: Prepare Layer Mixers for source split · ed78560d
      Archit Taneja authored
      In order to enable Source Split in HW, we need to add/modify
      a few LM register configurations:
      
      - Configure the LM width to be half the mode width, so that
        each LM manages one half of the scanout.
      - Tell the 'right' LM that it is configured to be the 'right'
        LM in source split mode.
      - Since we now have 2 places where REG_MDP5_LM_BLEND_COLOR_OUT is
        configured, do a read-update-store for the register instead of
        directly writing a value to it.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      ed78560d
    • Archit Taneja's avatar
      drm/msm/mdp5: Configure 'right' hwpipe · c26b4f6c
      Archit Taneja authored
      Now that we have a right hwpipe in mdp5_plane_state, configure it
      mdp5_plane_mode_set(). The only parameters that vary between the
      left and right hwpipes are the src_w, src_img_w, src_x and crtc_x
      as we just even chop the fb into left and right halves.
      
      Add a mdp5_plane_right_pipe() which will be used by the crtc code
      to set up LM stages.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      c26b4f6c
    • Archit Taneja's avatar
      drm/msm/mdp5: Assign a 'right hwpipe' to plane state · 7a10ee9b
      Archit Taneja authored
      If the drm_plane has a source width that's greater than the max width
      supported by a SSPP (2560 pixels on 8x96), then we assign a 'r_hwpipe'
      to it in mdp5_plane_atomic_check().
      
      TODO: There are a few scenarios where the hwpipe assignments aren't
      recommended by HW. For example, an assignment which results in a
      drm_plane to of two different types of hwpipes (say RGB0 on left
      and DMA1 on right) is not recommended.
      Also, hwpipes have a priority mapping, where the higher priority pipe
      needs to be staged on left LM, and the lower priority needs to be
      staged on the right LM. For example, the priority order for VIG pipes
      in decreasing order of priority is VIG0, VIG1, VIG2, and VIG3. So, VIG0
      on left and VIG1 on right is a correct configuration, but VIG1 on left
      and VIG0 on right isn't. These scenarios are ignored for now for the
      sake of simplicity.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      7a10ee9b
    • Archit Taneja's avatar
      drm/msm/mdp5: Create mdp5_hwpipe_mode_set · 821be43f
      Archit Taneja authored
      Refactor mdp5_plane_mode_set to call mdp5_hwpipe_mode_set. The latter
      func takes in only the hwpipe and the parameters that need to be
      programmed into the hwpipe registers. All the code that calculates these
      parameters is left as is in mdp5_plane_mode_set.
      
      In the future, when we let drm_plane be comprised of 2 hwpipes, this func
      allow us to configure each pipe without adding redundant code.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      821be43f
    • Archit Taneja's avatar
      drm/msm/mdp5: Add optional 'right' Layer Mixer in CRTC state · b7621b2a
      Archit Taneja authored
      Add another mdp5_hw_mixer pointer (r_mixer) in mdp5_crtc_state.
      This mixer will be used to generate the right half of the scanout.
      
      With Source Split, a SSPP can now be connected to 2 Layer Mixers, but
      has to be at the same blend level (stage #) on both Layer Mixers.
      
      A drm_plane that has a lesser width than the max width supported, will
      comprise of a single SSPP/hwpipe, staged on both the Layer Mixers at
      the same blend level. A plane that is greater than max width will comprise
      of 2 SSPPs, with the 'left' SSPP staged on the left LM, and the 'right'
      SSPP staged on the right LM at the same blend level.
      
      For now, the drm_plane consists of only one SSPP, therefore, it
      needs to be staged on both the LMs in blend_setup() and mdp5_ctl_blend().
      We'll extend this logic to support 2 hwpipes per plane later.
      
      The crtc cursor ops (using the LM cursors, not SSPP cursors) simply
      return an error if they're called when the right mixer is assigned to
      the CRTC state. With source split is enabled, we're expected to only
      SSPP cursors.
      
      This commit adds code that configures the right mixer, but the r_mixer
      itself isn't assigned at the moment.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      b7621b2a
    • Archit Taneja's avatar
      drm/msm/mdp5: Add a CAP for Source Split · 621da7d9
      Archit Taneja authored
      Some of the newer MDP5 versions support Source Split of SSPPs. It is a
      feature that allows us to route the output of a hwpipe to 2 Layer
      Mixers. This is required to achieve the following use cases:
      
      - Dual DSI: For high res DSI panels (such as 2560x1600 etc), a single
        DSI interface doesn't have the bandwidth to drive the required pixel
        clock. We use 2 DSI interfaces to drive the left and right halves
        of the panel (i.e, 1280x1600 each). The MDP5 pipeline here would look
        like:
      
               LM0 -- DSPP0 -- INTF1 -- DSI1
              /
      hwpipe--
              \
               LM1 -- DSPP1 -- INTF2 -- DSI2
      
        A single hwpipe is used to scan out the left and right halves to DSI1
        and DSI2 respectively. In order to do this, we need to configure the
        2 Layer Mixers in Source Split mode.
      
      - HDMI 4K: In order to support resolutions with width higher than the
        max width supported by a hwpipe, we club 2 hwpipes together:
      
      hwpipe1 --- LM0 -- DSPP0
             -   -             \
               -                -- 3D Mux -- INTF0 -- HDMI
             -   -             /
      hwpipe2 --- LM1 -- DSPP1
      
        hwpipe1 is staged on the 'left' Layer Mixer, and hwpipe2 is staged on
        the 'right' Layer Mixer. An additional block called the '3D Mux' is
        used to merge the output of the 2 DSPPs to a single interface.
        In this use case, it is possible that a 4K surface is downscaled and
        placed completely within one of the halves. In order to support such
        scenarios (and keep the programming simple), Layer Mixers with Source
        Split can be assigned 2 hw pipes per stage. While scanning out, the HW
        takes care of fetching the pixels fom the correct pipe.
      
      Add a MDP cap to tell whether the HW supports source split or not.
      Add a MDP LM cap that tells whether a LM instance can operate in
      source split mode (and generate the 'left' part of the display
      output).
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      621da7d9
    • Archit Taneja's avatar
      drm/msm/mdp5: Remove mixer/intf pointers from mdp5_ctl · f316b25a
      Archit Taneja authored
      These are a part of CRTC state, it doesn't feel nice to leave them
      hanging in mdp5_ctl struct. Pass mdp5_pipeline pointer instead
      wherever it is needed.
      
      We still have some params in mdp5_ctl like start_mask etc which
      are derivative of atomic state, and should be rolled back if
      a commit fails, but it doesn't seem to cause much trouble.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      f316b25a
    • Archit Taneja's avatar
      drm/msm/mdp5: Start using parameters from CRTC state · 0ddc3a63
      Archit Taneja authored
      In the last few commits, we've been adding params to mdp5_crtc_state, and
      assigning them in the atomic_check() funcs. Now it's time to actually
      start using them.
      
      Remove the duplicated params from the mdp5_crtc struct, and start using
      them in the mdp5_crtc code. The majority of the references to these params
      is in code that executes after the atomic swap has occurred, so it's okay
      to use crtc->state in them. There are a couple of legacy LM cursor ops that
      may not use the updated state, but (I think) it's okay to live with that.
      
      Now that we dynamically allocate a mixer to the CRTC, we can also remove
      the static assignment to it in mdp5_crtc_init, and also drop the code that
      skipped init-ing WB bound mixers (those will now be rejected by
      mdp5_mixer_assign()).
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      0ddc3a63
    • Archit Taneja's avatar
      drm/msm/mdp5: Add more stuff to CRTC state · bcb877b7
      Archit Taneja authored
      Things like vblank/err irq masks, mode of operation (command mode or not)
      are derivative of the interface and mixer state. Therefore, they need to
      be a part of the CRTC state too.
      
      Add them to mdp5_crtc_state, and assign them in the CRTC's atomic_check()
      func, so that it can be rolled back to a clean state.
      Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
      Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
      bcb877b7