OSDN Git Service

Merge tag 'drm-intel-next-2016-01-24' of git://anongit.freedesktop.org/drm-intel...
authorDave Airlie <airlied@redhat.com>
Tue, 9 Feb 2016 00:27:41 +0000 (10:27 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 9 Feb 2016 00:27:41 +0000 (10:27 +1000)
- support for v3 vbt dsi blocks (Jani)
- improve mmio debug checks (Mika Kuoppala)
- reorg the ddi port translation table entries and related code (Ville)
- reorg gen8 interrupt handling for future platforms (Tvrtko)
- refactor tile width/height computations for framebuffers (Ville)
- kerneldoc integration for intel_pm.c (Jani)
- move default context from engines to device-global dev_priv (Dave Gordon)
- make seqno/irq ordering coherent with execlist (Chris)
- decouple internal engine number from UABI (Chris&Tvrtko)
- tons of small fixes all over, as usual

* tag 'drm-intel-next-2016-01-24' of git://anongit.freedesktop.org/drm-intel: (148 commits)
  drm/i915: Update DRIVER_DATE to 20160124
  drm/i915: Seal busy-ioctl uABI and prevent leaking of internal ids
  drm/i915: Decouple execbuf uAPI from internal implementation
  drm/i915: Use ordered seqno write interrupt generation on gen8+ execlists
  drm/i915: Limit the auto arming of mmio debugs on vlv/chv
  drm/i915: Tune down "GT register while GT waking disabled" message
  drm/i915: tidy up a few leftovers
  drm/i915: abolish separate per-ring default_context pointers
  drm/i915: simplify allocation of driver-internal requests
  drm/i915: Fix NULL plane->fb oops on SKL
  drm/i915: Do not put big intel_crtc_state on the stack
  Revert "drm/i915: Add two-stage ILK-style watermark programming (v10)"
  drm/i915: add DOC: headline to RC6 kernel-doc
  drm/i915: turn some bogus kernel-doc comments to normal comments
  drm/i915/sdvo: revert bogus kernel-doc comments to normal comments
  drm/i915/gen9: Correct max save/restore register count during gpu reset with GuC
  drm/i915: Demote user facing DMC firmware load failure message
  drm/i915: use hlist_for_each_entry
  drm/i915: skl_update_scaler() wants a rotation bitmask instead of bit number
  drm/i915: Don't reject primary plane windowing with color keying enabled on SKL+
  ...

1  2 
drivers/gpu/drm/i915/i915_drv.c
mm/swapfile.c

@@@ -501,9 -501,7 +501,9 @@@ void intel_detect_pch(struct drm_devic
                                WARN_ON(!IS_SKYLAKE(dev) &&
                                        !IS_KABYLAKE(dev));
                        } else if ((id == INTEL_PCH_P2X_DEVICE_ID_TYPE) ||
 -                                 (id == INTEL_PCH_QEMU_DEVICE_ID_TYPE)) {
 +                                 ((id == INTEL_PCH_QEMU_DEVICE_ID_TYPE) &&
 +                                  pch->subsystem_vendor == 0x1af4 &&
 +                                  pch->subsystem_device == 0x1100)) {
                                dev_priv->pch_type = intel_virt_detect_pch(dev);
                        } else
                                continue;
@@@ -1079,7 -1077,6 +1079,6 @@@ static int bxt_resume_prepare(struct dr
         */
        broxton_init_cdclk(dev);
        broxton_ddi_phy_init(dev);
-       intel_prepare_ddi(dev);
  
        return 0;
  }
@@@ -1338,8 -1335,8 +1337,8 @@@ static int vlv_wait_for_gt_wells(struc
                return 0;
  
        DRM_DEBUG_KMS("waiting for GT wells to go %s (%08x)\n",
-                       wait_for_on ? "on" : "off",
-                       I915_READ(VLV_GTLC_PW_STATUS));
+                     onoff(wait_for_on),
+                     I915_READ(VLV_GTLC_PW_STATUS));
  
        /*
         * RC6 transitioning can be delayed up to 2 msec (see
        err = wait_for(COND, 3);
        if (err)
                DRM_ERROR("timeout waiting for GT wells to go %s\n",
-                         wait_for_on ? "on" : "off");
+                         onoff(wait_for_on));
  
        return err;
  #undef COND
@@@ -1359,7 -1356,7 +1358,7 @@@ static void vlv_check_no_gt_access(stru
        if (!(I915_READ(VLV_GTLC_PW_STATUS) & VLV_GTLC_ALLOWWAKEERR))
                return;
  
-       DRM_ERROR("GT register access while GT waking disabled\n");
+       DRM_DEBUG_DRIVER("GT register access while GT waking disabled\n");
        I915_WRITE(VLV_GTLC_PW_STATUS, VLV_GTLC_ALLOWWAKEERR);
  }
  
@@@ -1503,6 -1500,10 +1502,10 @@@ static int intel_runtime_suspend(struc
  
        enable_rpm_wakeref_asserts(dev_priv);
        WARN_ON_ONCE(atomic_read(&dev_priv->pm.wakeref_count));
+       if (intel_uncore_arm_unclaimed_mmio_detection(dev_priv))
+               DRM_ERROR("Unclaimed access detected prior to suspending\n");
        dev_priv->pm.suspended = true;
  
        /*
@@@ -1551,6 -1552,8 +1554,8 @@@ static int intel_runtime_resume(struct 
  
        intel_opregion_notify_adapter(dev, PCI_D0);
        dev_priv->pm.suspended = false;
+       if (intel_uncore_unclaimed_mmio(dev_priv))
+               DRM_DEBUG_DRIVER("Unclaimed access during suspend, bios?\n");
  
        intel_guc_resume(dev);
  
diff --combined mm/swapfile.c
@@@ -48,6 -48,12 +48,12 @@@ static sector_t map_swap_entry(swp_entr
  DEFINE_SPINLOCK(swap_lock);
  static unsigned int nr_swapfiles;
  atomic_long_t nr_swap_pages;
+ /*
+  * Some modules use swappable objects and may try to swap them out under
+  * memory pressure (via the shrinker). Before doing so, they may wish to
+  * check to see if any swap space is available.
+  */
+ EXPORT_SYMBOL_GPL(nr_swap_pages);
  /* protected with swap_lock. reading in vm_swap_full() doesn't need lock */
  long total_swap_pages;
  static int least_priority;
@@@ -165,6 -171,8 +171,6 @@@ static void discard_swap_cluster(struc
        int found_extent = 0;
  
        while (nr_pages) {
 -              struct list_head *lh;
 -
                if (se->start_page <= start_page &&
                    start_page < se->start_page + se->nr_pages) {
                        pgoff_t offset = start_page - se->start_page;
                                break;
                }
  
 -              lh = se->list.next;
 -              se = list_entry(lh, struct swap_extent, list);
 +              se = list_next_entry(se, list);
        }
  }
  
@@@ -785,12 -794,14 +791,12 @@@ static unsigned char swap_entry_free(st
                        count--;
        }
  
 -      if (!count)
 -              mem_cgroup_uncharge_swap(entry);
 -
        usage = count | has_cache;
        p->swap_map[offset] = usage;
  
        /* free if no reference */
        if (!usage) {
 +              mem_cgroup_uncharge_swap(entry);
                dec_cluster_info_page(p, p->cluster_info, offset);
                if (offset < p->lowest_bit)
                        p->lowest_bit = offset;
@@@ -898,7 -909,7 +904,7 @@@ int swp_swapcount(swp_entry_t entry
        VM_BUG_ON(page_private(page) != SWP_CONTINUED);
  
        do {
 -              page = list_entry(page->lru.next, struct page, lru);
 +              page = list_next_entry(page, lru);
                map = kmap_atomic(page);
                tmp_count = map[offset];
                kunmap_atomic(map);
@@@ -924,9 -935,6 +930,9 @@@ int reuse_swap_page(struct page *page
        VM_BUG_ON_PAGE(!PageLocked(page), page);
        if (unlikely(PageKsm(page)))
                return 0;
 +      /* The page is part of THP and cannot be reused */
 +      if (PageTransCompound(page))
 +              return 0;
        count = page_mapcount(page);
        if (count <= 1 && PageSwapCache(page)) {
                count += page_swapcount(page);
@@@ -1006,7 -1014,7 +1012,7 @@@ int free_swap_and_cache(swp_entry_t ent
                 * Also recheck PageSwapCache now page is locked (above).
                 */
                if (PageSwapCache(page) && !PageWriteback(page) &&
 -                              (!page_mapped(page) || vm_swap_full())) {
 +                  (!page_mapped(page) || mem_cgroup_swap_full(page))) {
                        delete_from_swap_cache(page);
                        SetPageDirty(page);
                }
@@@ -1109,9 -1117,19 +1115,9 @@@ unsigned int count_swap_pages(int type
  }
  #endif /* CONFIG_HIBERNATION */
  
 -static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)
 +static inline int pte_same_as_swp(pte_t pte, pte_t swp_pte)
  {
 -#ifdef CONFIG_MEM_SOFT_DIRTY
 -      /*
 -       * When pte keeps soft dirty bit the pte generated
 -       * from swap entry does not has it, still it's same
 -       * pte from logical point of view.
 -       */
 -      pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte);
 -      return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty);
 -#else
 -      return pte_same(pte, swp_pte);
 -#endif
 +      return pte_same(pte_swp_clear_soft_dirty(pte), swp_pte);
  }
  
  /*
@@@ -1133,15 -1151,14 +1139,15 @@@ static int unuse_pte(struct vm_area_str
        if (unlikely(!page))
                return -ENOMEM;
  
 -      if (mem_cgroup_try_charge(page, vma->vm_mm, GFP_KERNEL, &memcg)) {
 +      if (mem_cgroup_try_charge(page, vma->vm_mm, GFP_KERNEL,
 +                              &memcg, false)) {
                ret = -ENOMEM;
                goto out_nolock;
        }
  
        pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
 -      if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) {
 -              mem_cgroup_cancel_charge(page, memcg);
 +      if (unlikely(!pte_same_as_swp(*pte, swp_entry_to_pte(entry)))) {
 +              mem_cgroup_cancel_charge(page, memcg, false);
                ret = 0;
                goto out;
        }
        set_pte_at(vma->vm_mm, addr, pte,
                   pte_mkold(mk_pte(page, vma->vm_page_prot)));
        if (page == swapcache) {
 -              page_add_anon_rmap(page, vma, addr);
 -              mem_cgroup_commit_charge(page, memcg, true);
 +              page_add_anon_rmap(page, vma, addr, false);
 +              mem_cgroup_commit_charge(page, memcg, true, false);
        } else { /* ksm created a completely new copy */
 -              page_add_new_anon_rmap(page, vma, addr);
 -              mem_cgroup_commit_charge(page, memcg, false);
 +              page_add_new_anon_rmap(page, vma, addr, false);
 +              mem_cgroup_commit_charge(page, memcg, false, false);
                lru_cache_add_active_or_unevictable(page, vma);
        }
        swap_free(entry);
@@@ -1198,7 -1215,7 +1204,7 @@@ static int unuse_pte_range(struct vm_ar
                 * swapoff spends a _lot_ of time in this loop!
                 * Test inline before going to call unuse_pte.
                 */
 -              if (unlikely(maybe_same_pte(*pte, swp_pte))) {
 +              if (unlikely(pte_same_as_swp(*pte, swp_pte))) {
                        pte_unmap(pte);
                        ret = unuse_pte(vma, pmd, addr, entry, page);
                        if (ret)
@@@ -1622,11 -1639,14 +1628,11 @@@ static sector_t map_swap_entry(swp_entr
        se = start_se;
  
        for ( ; ; ) {
 -              struct list_head *lh;
 -
                if (se->start_page <= offset &&
                                offset < (se->start_page + se->nr_pages)) {
                        return se->start_block + (offset - se->start_page);
                }
 -              lh = se->list.next;
 -              se = list_entry(lh, struct swap_extent, list);
 +              se = list_next_entry(se, list);
                sis->curr_swap_extent = se;
                BUG_ON(se == start_se);         /* It *must* be present */
        }
@@@ -1650,7 -1670,7 +1656,7 @@@ static void destroy_swap_extents(struc
        while (!list_empty(&sis->first_swap_extent.list)) {
                struct swap_extent *se;
  
 -              se = list_entry(sis->first_swap_extent.list.next,
 +              se = list_first_entry(&sis->first_swap_extent.list,
                                struct swap_extent, list);
                list_del(&se->list);
                kfree(se);
@@@ -1956,9 -1976,9 +1962,9 @@@ SYSCALL_DEFINE1(swapoff, const char __u
                set_blocksize(bdev, old_block_size);
                blkdev_put(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
        } else {
 -              mutex_lock(&inode->i_mutex);
 +              inode_lock(inode);
                inode->i_flags &= ~S_SWAPFILE;
 -              mutex_unlock(&inode->i_mutex);
 +              inode_unlock(inode);
        }
        filp_close(swap_file, NULL);
  
@@@ -2183,7 -2203,7 +2189,7 @@@ static int claim_swapfile(struct swap_i
                p->flags |= SWP_BLKDEV;
        } else if (S_ISREG(inode->i_mode)) {
                p->bdev = inode->i_sb->s_bdev;
 -              mutex_lock(&inode->i_mutex);
 +              inode_lock(inode);
                if (IS_SWAPFILE(inode))
                        return -EBUSY;
        } else
@@@ -2416,7 -2436,7 +2422,7 @@@ SYSCALL_DEFINE2(swapon, const char __us
        mapping = swap_file->f_mapping;
        inode = mapping->host;
  
 -      /* If S_ISREG(inode->i_mode) will do mutex_lock(&inode->i_mutex); */
 +      /* If S_ISREG(inode->i_mode) will do inode_lock(inode); */
        error = claim_swapfile(p, inode);
        if (unlikely(error))
                goto bad_swap;
@@@ -2561,7 -2581,7 +2567,7 @@@ bad_swap
        vfree(cluster_info);
        if (swap_file) {
                if (inode && S_ISREG(inode->i_mode)) {
 -                      mutex_unlock(&inode->i_mutex);
 +                      inode_unlock(inode);
                        inode = NULL;
                }
                filp_close(swap_file, NULL);
@@@ -2574,7 -2594,7 +2580,7 @@@ out
        if (name)
                putname(name);
        if (inode && S_ISREG(inode->i_mode))
 -              mutex_unlock(&inode->i_mutex);
 +              inode_unlock(inode);
        return error;
  }
  
@@@ -2945,10 -2965,11 +2951,10 @@@ static void free_swap_count_continuatio
                struct page *head;
                head = vmalloc_to_page(si->swap_map + offset);
                if (page_private(head)) {
 -                      struct list_head *this, *next;
 -                      list_for_each_safe(this, next, &head->lru) {
 -                              struct page *page;
 -                              page = list_entry(this, struct page, lru);
 -                              list_del(this);
 +                      struct page *page, *next;
 +
 +                      list_for_each_entry_safe(page, next, &head->lru, lru) {
 +                              list_del(&page->lru);
                                __free_page(page);
                        }
                }