aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_perf.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-23 11:24:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-23 11:31:58 -0400
commit03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch)
treefbaf8738296b2e9dcba81c6daef2d515b6c4948c /drivers/gpu/drm/i915/i915_perf.c
parent6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff)
parentf36b7534b83357cf52e747905de6d65b4f7c2512 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here... For the mac80211 stuff, these were fortunately just parallel adds. Trivially resolved. In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the function phy_disable_interrupts() earlier in the file, whilst in 'net-next' the phy_error() call from this function was removed. In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the 'rt_table_id' member of rtable collided with a bug fix in 'net' that added a new struct member "rt_mtu_locked" which needs to be copied over here. The mlxsw driver conflict consisted of net-next separating the span code and definitions into separate files, whilst a 'net' bug fix made some changes to that moved code. The mlx5 infiniband conflict resolution was quite non-trivial, the RDMA tree's merge commit was used as a guide here, and here are their notes: ==================== Due to bug fixes found by the syzkaller bot and taken into the for-rc branch after development for the 4.17 merge window had already started being taken into the for-next branch, there were fairly non-trivial merge issues that would need to be resolved between the for-rc branch and the for-next branch. This merge resolves those conflicts and provides a unified base upon which ongoing development for 4.17 can be based. Conflicts: drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524 (IB/mlx5: Fix cleanup order on unload) added to for-rc and commit b5ca15ad7e61 (IB/mlx5: Add proper representors support) add as part of the devel cycle both needed to modify the init/de-init functions used by mlx5. To support the new representors, the new functions added by the cleanup patch needed to be made non-static, and the init/de-init list added by the representors patch needed to be modified to match the init/de-init list changes made by the cleanup patch. Updates: drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function prototypes added by representors patch to reflect new function names as changed by cleanup patch drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init stage list to match new order from cleanup patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_perf.c')
-rw-r--r--drivers/gpu/drm/i915/i915_perf.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 0be50e43507d..f8fe5ffcdcff 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -1303,9 +1303,8 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
1303 */ 1303 */
1304 mutex_lock(&dev_priv->drm.struct_mutex); 1304 mutex_lock(&dev_priv->drm.struct_mutex);
1305 dev_priv->perf.oa.exclusive_stream = NULL; 1305 dev_priv->perf.oa.exclusive_stream = NULL;
1306 mutex_unlock(&dev_priv->drm.struct_mutex);
1307
1308 dev_priv->perf.oa.ops.disable_metric_set(dev_priv); 1306 dev_priv->perf.oa.ops.disable_metric_set(dev_priv);
1307 mutex_unlock(&dev_priv->drm.struct_mutex);
1309 1308
1310 free_oa_buffer(dev_priv); 1309 free_oa_buffer(dev_priv);
1311 1310
@@ -1756,22 +1755,13 @@ static int gen8_switch_to_updated_kernel_context(struct drm_i915_private *dev_pr
1756 * Note: it's only the RCS/Render context that has any OA state. 1755 * Note: it's only the RCS/Render context that has any OA state.
1757 */ 1756 */
1758static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv, 1757static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
1759 const struct i915_oa_config *oa_config, 1758 const struct i915_oa_config *oa_config)
1760 bool interruptible)
1761{ 1759{
1762 struct i915_gem_context *ctx; 1760 struct i915_gem_context *ctx;
1763 int ret; 1761 int ret;
1764 unsigned int wait_flags = I915_WAIT_LOCKED; 1762 unsigned int wait_flags = I915_WAIT_LOCKED;
1765 1763
1766 if (interruptible) { 1764 lockdep_assert_held(&dev_priv->drm.struct_mutex);
1767 ret = i915_mutex_lock_interruptible(&dev_priv->drm);
1768 if (ret)
1769 return ret;
1770
1771 wait_flags |= I915_WAIT_INTERRUPTIBLE;
1772 } else {
1773 mutex_lock(&dev_priv->drm.struct_mutex);
1774 }
1775 1765
1776 /* Switch away from any user context. */ 1766 /* Switch away from any user context. */
1777 ret = gen8_switch_to_updated_kernel_context(dev_priv, oa_config); 1767 ret = gen8_switch_to_updated_kernel_context(dev_priv, oa_config);
@@ -1819,8 +1809,6 @@ static int gen8_configure_all_contexts(struct drm_i915_private *dev_priv,
1819 } 1809 }
1820 1810
1821 out: 1811 out:
1822 mutex_unlock(&dev_priv->drm.struct_mutex);
1823
1824 return ret; 1812 return ret;
1825} 1813}
1826 1814
@@ -1863,7 +1851,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
1863 * to make sure all slices/subslices are ON before writing to NOA 1851 * to make sure all slices/subslices are ON before writing to NOA
1864 * registers. 1852 * registers.
1865 */ 1853 */
1866 ret = gen8_configure_all_contexts(dev_priv, oa_config, true); 1854 ret = gen8_configure_all_contexts(dev_priv, oa_config);
1867 if (ret) 1855 if (ret)
1868 return ret; 1856 return ret;
1869 1857
@@ -1878,7 +1866,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
1878static void gen8_disable_metric_set(struct drm_i915_private *dev_priv) 1866static void gen8_disable_metric_set(struct drm_i915_private *dev_priv)
1879{ 1867{
1880 /* Reset all contexts' slices/subslices configurations. */ 1868 /* Reset all contexts' slices/subslices configurations. */
1881 gen8_configure_all_contexts(dev_priv, NULL, false); 1869 gen8_configure_all_contexts(dev_priv, NULL);
1882 1870
1883 I915_WRITE(GDT_CHICKEN_BITS, (I915_READ(GDT_CHICKEN_BITS) & 1871 I915_WRITE(GDT_CHICKEN_BITS, (I915_READ(GDT_CHICKEN_BITS) &
1884 ~GT_NOA_ENABLE)); 1872 ~GT_NOA_ENABLE));
@@ -1888,7 +1876,7 @@ static void gen8_disable_metric_set(struct drm_i915_private *dev_priv)
1888static void gen10_disable_metric_set(struct drm_i915_private *dev_priv) 1876static void gen10_disable_metric_set(struct drm_i915_private *dev_priv)
1889{ 1877{
1890 /* Reset all contexts' slices/subslices configurations. */ 1878 /* Reset all contexts' slices/subslices configurations. */
1891 gen8_configure_all_contexts(dev_priv, NULL, false); 1879 gen8_configure_all_contexts(dev_priv, NULL);
1892 1880
1893 /* Make sure we disable noa to save power. */ 1881 /* Make sure we disable noa to save power. */
1894 I915_WRITE(RPM_CONFIG1, 1882 I915_WRITE(RPM_CONFIG1,
@@ -2138,6 +2126,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
2138 if (ret) 2126 if (ret)
2139 goto err_oa_buf_alloc; 2127 goto err_oa_buf_alloc;
2140 2128
2129 ret = i915_mutex_lock_interruptible(&dev_priv->drm);
2130 if (ret)
2131 goto err_lock;
2132
2141 ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv, 2133 ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv,
2142 stream->oa_config); 2134 stream->oa_config);
2143 if (ret) 2135 if (ret)
@@ -2145,23 +2137,17 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
2145 2137
2146 stream->ops = &i915_oa_stream_ops; 2138 stream->ops = &i915_oa_stream_ops;
2147 2139
2148 /* Lock device for exclusive_stream access late because
2149 * enable_metric_set() might lock as well on gen8+.
2150 */
2151 ret = i915_mutex_lock_interruptible(&dev_priv->drm);
2152 if (ret)
2153 goto err_lock;
2154
2155 dev_priv->perf.oa.exclusive_stream = stream; 2140 dev_priv->perf.oa.exclusive_stream = stream;
2156 2141
2157 mutex_unlock(&dev_priv->drm.struct_mutex); 2142 mutex_unlock(&dev_priv->drm.struct_mutex);
2158 2143
2159 return 0; 2144 return 0;
2160 2145
2161err_lock: 2146err_enable:
2162 dev_priv->perf.oa.ops.disable_metric_set(dev_priv); 2147 dev_priv->perf.oa.ops.disable_metric_set(dev_priv);
2148 mutex_unlock(&dev_priv->drm.struct_mutex);
2163 2149
2164err_enable: 2150err_lock:
2165 free_oa_buffer(dev_priv); 2151 free_oa_buffer(dev_priv);
2166 2152
2167err_oa_buf_alloc: 2153err_oa_buf_alloc: