]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/gpu/drm/i915/i915_drv.h
drm/i915: Move dev_priv->mm.[un]bound_list to its own lock
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / i915 / i915_drv.h
index 5d322cf490c4c0fec745beefe5e54230af6d69d1..4704cfe93279cffb4d3aea84b12bc4c1518c0c99 100644 (file)
@@ -80,8 +80,8 @@
 
 #define DRIVER_NAME            "i915"
 #define DRIVER_DESC            "Intel Graphics"
-#define DRIVER_DATE            "20170929"
-#define DRIVER_TIMESTAMP       1506682238
+#define DRIVER_DATE            "20171012"
+#define DRIVER_TIMESTAMP       1507831511
 
 /* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and
  * WARN_ON()) for hw state sanity checks to check for unexpected conditions
@@ -609,7 +609,7 @@ struct drm_i915_file_private {
 
        struct intel_rps_client {
                atomic_t boosts;
-       } rps;
+       } rps_client;
 
        unsigned int bsd_engine;
 
@@ -1317,7 +1317,7 @@ struct intel_rps_ei {
        u32 media_c0;
 };
 
-struct intel_gen6_power_mgmt {
+struct intel_rps {
        /*
         * work, interrupts_enabled and pm_iir are protected by
         * dev_priv->irq_lock
@@ -1358,20 +1358,26 @@ struct intel_gen6_power_mgmt {
        enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
 
        bool enabled;
-       struct delayed_work autoenable_work;
        atomic_t num_waiters;
        atomic_t boosts;
 
        /* manual wa residency calculations */
        struct intel_rps_ei ei;
+};
 
-       /*
-        * Protects RPS/RC6 register access and PCU communication.
-        * Must be taken after struct_mutex if nested. Note that
-        * this lock may be held for long periods of time when
-        * talking to hw - so only take it when talking to hw!
-        */
-       struct mutex hw_lock;
+struct intel_rc6 {
+       bool enabled;
+};
+
+struct intel_llc_pstate {
+       bool enabled;
+};
+
+struct intel_gen6_power_mgmt {
+       struct intel_rps rps;
+       struct intel_rc6 rc6;
+       struct intel_llc_pstate llc_pstate;
+       struct delayed_work autoenable_work;
 };
 
 /* defined intel_pm.c */
@@ -1484,6 +1490,9 @@ struct i915_gem_mm {
         * always the inner lock when overlapping with struct_mutex. */
        struct mutex stolen_lock;
 
+       /* Protects bound_list/unbound_list and #drm_i915_gem_object.mm.link */
+       spinlock_t obj_lock;
+
        /** List of all objects in gtt_space. Used to restore gtt
         * mappings on resume */
        struct list_head bound_list;
@@ -2421,8 +2430,16 @@ struct drm_i915_private {
        /* Cannot be determined by PCIID. You must always read a register. */
        u32 edram_cap;
 
-       /* gen6+ rps state */
-       struct intel_gen6_power_mgmt rps;
+       /*
+        * Protects RPS/RC6 register access and PCU communication.
+        * Must be taken after struct_mutex if nested. Note that
+        * this lock may be held for long periods of time when
+        * talking to hw - so only take it when talking to hw!
+        */
+       struct mutex pcu_lock;
+
+       /* gen6+ GT PM state */
+       struct intel_gen6_power_mgmt gt_pm;
 
        /* ilk-only ips/rps state. Everything in here is protected by the global
         * mchdev_lock in intel_pm.c */
@@ -2533,7 +2550,7 @@ struct drm_i915_private {
                bool distrust_bios_wm;
        } wm;
 
-       struct i915_runtime_pm pm;
+       struct i915_runtime_pm runtime_pm;
 
        struct {
                bool initialized;
@@ -3063,6 +3080,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 
 #define CNL_REVID_A0           0x0
 #define CNL_REVID_B0           0x1
+#define CNL_REVID_C0           0x2
 
 #define IS_CNL_REVID(p, since, until) \
        (IS_CANNONLAKE(p) && IS_REVID(p, since, until))
@@ -3537,7 +3555,7 @@ i915_gem_object_get_dma_address(struct drm_i915_gem_object *obj,
 
 void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
                                 struct sg_table *pages,
-                                unsigned int sg_mask);
+                                unsigned int sg_page_sizes);
 int __i915_gem_object_get_pages(struct drm_i915_gem_object *obj);
 
 static inline int __must_check
@@ -3551,10 +3569,16 @@ i915_gem_object_pin_pages(struct drm_i915_gem_object *obj)
        return __i915_gem_object_get_pages(obj);
 }
 
+static inline bool
+i915_gem_object_has_pages(struct drm_i915_gem_object *obj)
+{
+       return !IS_ERR_OR_NULL(READ_ONCE(obj->mm.pages));
+}
+
 static inline void
 __i915_gem_object_pin_pages(struct drm_i915_gem_object *obj)
 {
-       GEM_BUG_ON(!obj->mm.pages);
+       GEM_BUG_ON(!i915_gem_object_has_pages(obj));
 
        atomic_inc(&obj->mm.pages_pin_count);
 }
@@ -3568,8 +3592,8 @@ i915_gem_object_has_pinned_pages(struct drm_i915_gem_object *obj)
 static inline void
 __i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
 {
+       GEM_BUG_ON(!i915_gem_object_has_pages(obj));
        GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
-       GEM_BUG_ON(!obj->mm.pages);
 
        atomic_dec(&obj->mm.pages_pin_count);
 }