1. 15 8月, 2015 9 次提交
    • M
      drm/i915/gen8: implement alloc/free for 4lvl · 762d9936
      Michel Thierry 提交于
      PML4 has no special attributes, and there will always be a PML4.
      So simply initialize it at creation, and destroy it at the end.
      
      The code for 4lvl is able to call into the existing 3lvl page table code
      to handle all of the lower levels.
      
      v2: Return something at the end of gen8_alloc_va_range_4lvl to keep the
      compiler happy. And define ret only in one place.
      Updated gen8_ppgtt_unmap_pages and gen8_ppgtt_free to handle 4lvl.
      v3: Use i915_dma_unmap_single instead of pci API. Fix a
      couple of incorrect checks when unmapping pdp and pd pages (Akash).
      v4: Call __pdp_fini also for 32b PPGTT. Clean up alloc_pdp param list.
      v5: Prevent (harmless) out of range access in gen8_for_each_pml4e.
      v6: Simplify alloc_vma_range_4lvl and gen8_ppgtt_init_common error
      paths. (Akash)
      v7: Rebase, s/gen8_ppgtt_free_*/gen8_ppgtt_cleanup_*/.
      v8: Change location of pml4_init/fini. It will make next patches
      cleaner.
      v9: Rebase after Mika's ppgtt cleanup / scratch merge patch series, while
      trying to reuse as much as possible for pdp alloc. pml4_init/fini
      replaced by setup/cleanup_px macros.
      v10: Rebase after Mika's merged ppgtt cleanup patch series.
      v11: Rebase after final merged version of Mika's ppgtt/scratch
      patches.
      v12: Fix pdpe start value in trace (Akash)
      v13: Define all 4lvl functions in this patch directly, instead of
      previous patches, add i915_page_directory_pointer_entry_alloc here,
      use test_bit to detect when pdp is already allocated (Akash).
      v14: Move pdp allocation into a new gen8_ppgtt_alloc_page_dirpointers
      funtion, as we do for pds and pts; move pd and pdp setup functions to
      this patch (Akash).
      v15: Added kfree(pdp) from previous patch to this (Akash).
      
      Cc: Akash Goel <akash.goel@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NAkash Goel <akash.goel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      762d9936
    • M
      drm/i915/gen8: Add PML4 structure · 81ba8aef
      Michel Thierry 提交于
      Introduces the Page Map Level 4 (PML4), ie. the new top level structure
      of the page tables.
      
      To facilitate testing, 48b mode will be available on Broadwell and
      GEN9+, when i915.enable_ppgtt = 3.
      
      v2: Remove unnecessary CONFIG_X86_64 checks, ppgtt code is already
      32/64-bit safe (Chris).
      v3: Add goto free_scratch in temp 48-bit mode init code (Akash).
      v4: kfree the pdp until the 4lvl alloc/free patch (Akash).
      v5: Postpone 48-bit code in sanitize_enable_ppgtt (Akash).
      v6: Keep _insert_pte_entries changes outside this patch (Akash).
      
      Cc: Akash Goel <akash.goel@intel.com>
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: NAkash Goel <akash.goel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      81ba8aef
    • M
      drm/i915/gen8: Add dynamic page trace events · 4c06ec8d
      Michel Thierry 提交于
      The dynamic page allocation patch series added it for GEN6, this patch
      adds them for GEN8.
      
      v2: Consolidate pagetable/page_directory events
      v3: Multiple rebases.
      v4: Rebase after s/page_tables/page_table/.
      v5: Rebase after Mika's ppgtt cleanup / scratch merge patch series.
      v6: Rebase after gen8_map_pagetable_range removal.
      v7: Use generic page name (px) in DECLARE_EVENT_CLASS (Akash)
      v8: Defer define of i915_page_directory_pointer_entry_alloc (Akash)
      
      Cc: Akash Goel <akash.goel@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v3+)
      Reviewed-by: NAkash Goel <akash.goel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4c06ec8d
    • M
      drm/i915/gen8: Generalize PTE writing for GEN8 PPGTT · f9b5b782
      Michel Thierry 提交于
      The insert_entries function was the function used to write PTEs. For the
      PPGTT it was "hardcoded" to only understand two level page tables, which
      was the case for GEN7. We can reuse this for 4 level page tables, and
      remove the concept of insert_entries, which was never viable past 2
      level page tables anyway, but it requires a bit of rework to make the
      function a bit more generic.
      
      v2: Rebase after Mika's ppgtt cleanup / scratch merge patch series.
      v3: Rebase after final merged version of Mika's ppgtt/scratch patches.
      v4: Check and warn for NULL value of pdp pointer (Akash).
      
      Cc: Akash Goel <akash.goel@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2)
      Reviewed-by: NAkash Goel <akash.goel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      f9b5b782
    • M
      drm/i915/gen8: Abstract PDP usage · d4ec9da0
      Michel Thierry 提交于
      Up until now, ppgtt->pdp has always been the root of our page tables.
      Legacy 32b addresses acted like it had 1 PDP with 4 PDPEs.
      
      In preparation for 4 level page tables, we need to stop using ppgtt->pdp
      directly unless we know it's what we want. The future structure will use
      ppgtt->pml4 for the top level, and the pdp is just one of the entries
      being pointed to by a pml4e. The temporal pdp local variable will be
      removed once the rest of the 4-level code lands.
      
      Also, start passing the vm pointer to the alloc functions, instead of
      ppgtt.
      
      v2: Updated after dynamic page allocation changes.
      v3: Rebase after s/page_tables/page_table/.
      v4: Rebase after changes in "Dynamic page table allocations" patch.
      v5: Rebase after Mika's ppgtt cleanup / scratch merge patch series.
      v6: Rebase after final merged version of Mika's ppgtt/scratch patches.
      v7: Keep pagetable map in-line (and avoid unnecessary for_each_pde
      loops), remove redundant ppgtt pointer in _alloc_pagetabs (Akash)
      v8: Fix text indentation in _alloc_pagetabs/page_directories (Chris)
      v9: Defer gen8_alloc_va_range_4lvl definition until 4lvl is implemented,
      clean-up gen8_ppgtt_cleanup [pun intended] (Akash).
      v10: Clean-up commit message (Akash).
      
      Cc: Akash Goel <akash.goel@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: N"Akash Goel" <akash.goel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d4ec9da0
    • M
      drm/i915/gen8: Make pdp allocation more dynamic · 6ac18502
      Michel Thierry 提交于
      This transitional patch doesn't do much for the existing code. However,
      it should make upcoming patches to use the full 48b address space a bit
      easier.
      
      32-bit ppgtt uses just 4 PDPs, while 48-bit ppgtt will have up-to 512;
      this patch prepares the existing functions to query the right number of pdps
      at run-time. This also means that used_pdpes should also be allocated during
      ppgtt_init, as the bitmap size will depend on the ppgtt address range
      selected.
      
      v2: Renamed  pdp_free to be similar to  pd/pt (unmap_and_free_pdp).
      v3: To facilitate testing, 48b mode will be available on Broadwell and
      GEN9+, when i915.enable_ppgtt = 3.
      v4: Rebase after s/page_tables/page_table/, added extra information
      about 4-level page table formats and use IS_ENABLED macro.
      v5: Check CONFIG_X86_64 instead of CONFIG_64BIT.
      v6: Rebase after Mika's ppgtt cleanup / scratch merge patch series, and
      follow
      his nomenclature in pdp functions (there is no alloc_pdp yet).
      v7: Rebase after merged version of Mika's ppgtt cleanup patch series.
      v8: Rebase after final merged version of Mika's ppgtt/scratch patches.
      v9: Introduce PML4 (and 48-bit checks) until next patch (Akash).
      v10: Also use test_bit to detect when pd/pt are already allocated (Akash)
      
      Cc: Akash Goel <akash.goel@intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NAkash Goel <akash.goel@intel.com>
      [danvet: Amend commit message as suggested by Michel.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6ac18502
    • M
      drm/i915: Remove unnecessary gen8_clamp_pd · 09120d4e
      Michel Thierry 提交于
      gen8_clamp_pd clamps to the next page directory boundary, but the macro
      gen8_for_each_pde already has a check to stop at the page directory
      boundary.
      
      Furthermore, i915_pte_count also restricts to the next page table
      boundary.
      
      v2: Rebase after Mika's ppgtt cleanup / scratch merge patch series.
      Suggested-by: NAkash Goel <akash.goel@intel.com>
      Signed-off-by: NMichel Thierry <michel.thierry@intel.com>
      Reviewed-by: N"Akash Goel" <akash.goel@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      09120d4e
    • A
      drm/i915: Per-DDI I_boost override · 75067dde
      Antti Koskipaa 提交于
      An OEM may request increased I_boost beyond the recommended values
      by specifying an I_boost value to be applied to all swing entries for
      a port. These override values are specified in VBT.
      
      v2: rebase and remove unused iboost_bit variable
      
      Issue: VIZ-5676
      Signed-off-by: NAntti Koskipaa <antti.koskipaa@linux.intel.com>
      Reviewed-by: NDavid Weinehall <david.weinehall@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      75067dde
    • D
      Merge tag 'drm-intel-fixes-2015-08-14' into drm-intel-next-fixes · 622147fd
      Daniel Vetter 提交于
      Backmerge drm-intel-fixes because a bunch of atomic patch backporting
      we had to do lead to horrible conflicts.
      
      Conflicts:
      	drivers/gpu/drm/drm_crtc.c
      Just a bit of context conflict between -next and -fixes.
      	drivers/gpu/drm/i915/intel_atomic.c
      	drivers/gpu/drm/i915/intel_display.c
      Atomic conflicts, always pick the code from -next.
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      622147fd
  2. 14 8月, 2015 25 次提交
  3. 13 8月, 2015 3 次提交
    • M
      drm/i915: Commit planes on each crtc separately. · d2944cf2
      Maarten Lankhorst 提交于
      This patch is based on the upstream commit 5ac1c4bc and amended
      for v4.2 to make sure it works as intended.
      
      Repeated calls to begin_crtc_commit can cause warnings like this:
      [  169.127746] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:616
      [  169.127835] in_atomic(): 0, irqs_disabled(): 1, pid: 1947, name: kms_flip
      [  169.127840] 3 locks held by kms_flip/1947:
      [  169.127843]  #0:  (&dev->mode_config.mutex){+.+.+.}, at: [<ffffffff814774bc>] __drm_modeset_lock_all+0x9c/0x130
      [  169.127860]  #1:  (crtc_ww_class_acquire){+.+.+.}, at: [<ffffffff814774cd>] __drm_modeset_lock_all+0xad/0x130
      [  169.127870]  #2:  (crtc_ww_class_mutex){+.+.+.}, at: [<ffffffff81477178>] drm_modeset_lock+0x38/0x110
      [  169.127879] irq event stamp: 665690
      [  169.127882] hardirqs last  enabled at (665689): [<ffffffff817ffdb5>] _raw_spin_unlock_irqrestore+0x55/0x70
      [  169.127889] hardirqs last disabled at (665690): [<ffffffffc0197a23>] intel_pipe_update_start+0x113/0x5c0 [i915]
      [  169.127936] softirqs last  enabled at (665470): [<ffffffff8108a766>] __do_softirq+0x236/0x650
      [  169.127942] softirqs last disabled at (665465): [<ffffffff8108ae75>] irq_exit+0xc5/0xd0
      [  169.127951] CPU: 1 PID: 1947 Comm: kms_flip Not tainted 4.1.0-rc4-patser+ #4039
      [  169.127954] Hardware name: LENOVO 2349AV8/2349AV8, BIOS G1ETA5WW (2.65 ) 04/15/2014
      [  169.127957]  ffff8800c49036f0 ffff8800cde5fa28 ffffffff817f6907 0000000080000001
      [  169.127964]  0000000000000000 ffff8800cde5fa58 ffffffff810aebed 0000000000000046
      [  169.127970]  ffffffff81c5d518 0000000000000268 0000000000000000 ffff8800cde5fa88
      [  169.127981] Call Trace:
      [  169.127992]  [<ffffffff817f6907>] dump_stack+0x4f/0x7b
      [  169.128001]  [<ffffffff810aebed>] ___might_sleep+0x16d/0x270
      [  169.128008]  [<ffffffff810aed38>] __might_sleep+0x48/0x90
      [  169.128017]  [<ffffffff817fc359>] mutex_lock_nested+0x29/0x410
      [  169.128073]  [<ffffffffc01635f0>] ? vgpu_write64+0x220/0x220 [i915]
      [  169.128138]  [<ffffffffc017fddf>] ? ironlake_update_primary_plane+0x2ff/0x410 [i915]
      [  169.128198]  [<ffffffffc0190e75>] intel_frontbuffer_flush+0x25/0x70 [i915]
      [  169.128253]  [<ffffffffc01831ac>] intel_finish_crtc_commit+0x4c/0x180 [i915]
      [  169.128279]  [<ffffffffc00784ac>] drm_atomic_helper_commit_planes+0x12c/0x240 [drm_kms_helper]
      [  169.128338]  [<ffffffffc0184264>] __intel_set_mode+0x684/0x830 [i915]
      [  169.128378]  [<ffffffffc018a84a>] intel_crtc_set_config+0x49a/0x620 [i915]
      [  169.128385]  [<ffffffff817fdd39>] ? mutex_unlock+0x9/0x10
      [  169.128391]  [<ffffffff81467b69>] drm_mode_set_config_internal+0x69/0x120
      [  169.128398]  [<ffffffff8119b547>] ? might_fault+0x57/0xb0
      [  169.128403]  [<ffffffff8146bf93>] drm_mode_setcrtc+0x253/0x620
      [  169.128409]  [<ffffffff8145c600>] drm_ioctl+0x1a0/0x6a0
      [  169.128415]  [<ffffffff810b3b41>] ? get_parent_ip+0x11/0x50
      [  169.128424]  [<ffffffff811e9ab8>] do_vfs_ioctl+0x2f8/0x530
      [  169.128429]  [<ffffffff810d0fcd>] ? trace_hardirqs_on+0xd/0x10
      [  169.128435]  [<ffffffff812e7676>] ? selinux_file_ioctl+0x56/0x100
      [  169.128439]  [<ffffffff811e9d71>] SyS_ioctl+0x81/0xa0
      [  169.128445]  [<ffffffff81800697>] system_call_fastpath+0x12/0x6f
      
      Solve it by using the newly introduced drm_atomic_helper_commit_planes_on_crtc.
      
      The problem here was that the drm_atomic_helper_commit_planes() helper
      we were using was basically designed to do
      
          begin_crtc_commit(crtc #1)
          begin_crtc_commit(crtc #2)
          ...
          commit all planes
          finish_crtc_commit(crtc #1)
          finish_crtc_commit(crtc #2)
      
      The problem here is that since our hardware relies on vblank evasion,
      our CRTC 'begin' function waits until we're out of the danger zone in
      which register writes might wind up straddling the vblank, then disables
      interrupts; our 'finish' function re-enables interrupts after the
      registers have been written.  The expectation is that the operations between
      'begin' and 'end' must be performed without sleeping (since interrupts
      are disabled) and should happen as quickly as possible.  By clumping all
      of the 'begin' calls together, we introducing a couple problems:
       * Subsequent 'begin' invocations might sleep (which is illegal)
       * The first 'begin' ensured that we were far enough from the vblank that
         we could write our registers safely and ensure they all fell within
         the same frame.  Adding extra delay waiting for subsequent CRTC's
         wasn't accounted for and could put us back into the 'danger zone' for
         CRTC #1.
      
      This commit solves the problem by using a new helper that allows an
      order of operations like:
      
         for each crtc {
              begin_crtc_commit(crtc)  // sleep (maybe), then disable interrupts
              commit planes for this specific CRTC
              end_crtc_commit(crtc)    // reenable interrupts
         }
      
      so that sleeps will only be performed while interrupts are enabled and
      we can be sure that registers for a CRTC will be written immediately
      once we know we're in the safe zone.
      
      The crtc->config->base.crtc update may seem unrelated, but the helper
      will use it to obtain the crtc for the state. Without the update it
      will dereference NULL and crash.
      
      Changes since v1:
      - Use Matt Roper's commit message.
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      References: https://bugs.freedesktop.org/show_bug.cgi?id=90398Reviewed-by: NAnder Conselvan de Oliveira <conselvan2@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      d2944cf2
    • M
      drm/i915: calculate primary visibility changes instead of calling from set_config · f0fdc55d
      Maarten Lankhorst 提交于
      This should be much cleaner, with the same effects.
      
      (cherry picked for v4.2 from commit fb9d6cf8)
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      References: https://bugs.freedesktop.org/show_bug.cgi?id=90398Reviewed-by: NAnder Conselvan de Oliveira <conselvan2@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      f0fdc55d
    • D
      drm/i915: Only dither on 6bpc panels · e8fa4270
      Daniel Vetter 提交于
      In
      
      commit d328c9d7
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Fri Apr 10 16:22:37 2015 +0200
      
          drm/i915: Select starting pipe bpp irrespective or the primary plane
      
      we started to select the pipe bpp from sink capabilities and not from
      the primary framebuffer - that one might change (and we don't want to
      incur a modeset) and sprites might contain higher bpp content too.
      
      We also selected dithering on a 8 bpc screen displaying a 24bpp rgb
      primary, because pipe_bpp is 24 for such a typical 8 bpc sink, but since
      the commit mentioned above, base_bpp is always the absolute maximum
      supported by the hardware, e.g., 36 bpp on my Ironlake chip. Iow. the
      only way to not get dithering would have been to connect a deep color 12
      bpc display, so pipe_bpp == 36 == base_bpp.
      
      Hence only enable dithering on 6bpc screens where we difinitely and
      always want it.
      
      Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
      Reported-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-and-tested-by: NMario Kleiner <mario.kleiner.de@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      e8fa4270
  4. 10 8月, 2015 1 次提交
  5. 09 8月, 2015 2 次提交
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · a230e95c
      Linus Torvalds 提交于
      Pull input subsystem fixes from Dmitry Torokhov:
       "Just small ALPS and Elan touchpads, and other driver fixups"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: elantech - add special check for fw_version 0x470f01 touchpad
        Input: twl4030-vibra - fix ERROR: Bad of_node_put() warning
        Input: alps - only Dell laptops have separate button bits for v2 dualpoint sticks
        Input: axp20x-pek - add module alias
        Input: turbografx - fix potential out of bound access
      a230e95c
    • L
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · 3fbdc379
      Linus Torvalds 提交于
      Pull MIPS fixes from Ralf Baechle:
       "Another round of MIPS fixes for 4.2.  No area does particularly stand
        out but we have a two unpleasant ones:
      
         - Kernel ptes are marked with a global bit which allows the kernel to
           share kernel TLB entries between all processes.  For this to work
           both entries of an adjacent even/odd pte pair need to have the
           global bit set.  There has been a subtle race in setting the other
           entry's global bit since ~ 2000 but it take particularly
           pathological workloads that essentially do mostly vmalloc/vfree to
           trigger this.
      
           This pull request fixes the 64-bit case but leaves the case of 32
           bit CPUs with 64 bit ptes unsolved for now.  The unfixed cases
           affect hardware that is not available in the field yet.
      
         - Instruction emulation requires loading instructions from user space
           but the current fast but simplistic approach will fail on pages
           that are PROT_EXEC but !PROT_READ.  For this reason we temporarily
           do not permit this permission and will map pages with PROT_EXEC |
           PROT_READ.
      
        The remainder of this pull request is more or less across the field
        and the short log explains them well"
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        MIPS: Make set_pte() SMP safe.
        MIPS: Replace add and sub instructions in relocate_kernel.S with addiu
        MIPS: Flush RPS on kernel entry with EVA
        Revert "MIPS: BCM63xx: Provide a plat_post_dma_flush hook"
        MIPS: BMIPS: Delete unused Kconfig symbol
        MIPS: Export get_c0_perfcount_int()
        MIPS: show_stack: Fix stack trace with EVA
        MIPS: do_mcheck: Fix kernel code dump with EVA
        MIPS: SMP: Don't increment irq_count multiple times for call function IPIs
        MIPS: Partially disable RIXI support.
        MIPS: Handle page faults of executable but unreadable pages correctly.
        MIPS: Malta: Don't reinitialise RTC
        MIPS: unaligned: Fix build error on big endian R6 kernels
        MIPS: Fix sched_getaffinity with MT FPAFF enabled
        MIPS: Fix build with CONFIG_OF=y for non OF-enabled targets
        CPUFREQ: Loongson2: Fix broken build due to incorrect include.
      3fbdc379