diff options
author | Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> | 2018-03-05 17:21:21 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-03-06 04:34:40 -0500 |
commit | 53b725c7db127d16d1a83ed5dfd601d65fe976fb (patch) | |
tree | d8c5493b411714e9e66f957016c9d9863e537a45 | |
parent | 618d87d783adc86db5989c25eab54780f21314d9 (diff) |
drm/i915/error: standardize function style in error capture
some of the static functions used from capture() have the "i915_"
prefix while other don't; most of them take i915 as a parameter, but one
of them derives it internally from error->i915. Let's be consistent by
avoiding prefix for static functions and by getting i915 from
error->i915. While at it, s/dev_priv/i915 in functions that don't
perform register reads.
v2: take i915 from error->i915 (Michal), s/dev_priv/i915,
update commit message
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180305222122.3547-2-daniele.ceraolospurio@intel.com
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gpu_error.c | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index ef29fb48d6d9..9afb1b9674c0 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c | |||
@@ -1084,9 +1084,9 @@ static uint32_t i915_error_generate_code(struct drm_i915_private *dev_priv, | |||
1084 | return error_code; | 1084 | return error_code; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | static void i915_gem_record_fences(struct drm_i915_private *dev_priv, | 1087 | static void gem_record_fences(struct i915_gpu_state *error) |
1088 | struct i915_gpu_state *error) | ||
1089 | { | 1088 | { |
1089 | struct drm_i915_private *dev_priv = error->i915; | ||
1090 | int i; | 1090 | int i; |
1091 | 1091 | ||
1092 | if (INTEL_GEN(dev_priv) >= 6) { | 1092 | if (INTEL_GEN(dev_priv) >= 6) { |
@@ -1424,14 +1424,14 @@ capture_object(struct drm_i915_private *dev_priv, | |||
1424 | } | 1424 | } |
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | static void i915_gem_record_rings(struct drm_i915_private *dev_priv, | 1427 | static void gem_record_rings(struct i915_gpu_state *error) |
1428 | struct i915_gpu_state *error) | ||
1429 | { | 1428 | { |
1430 | struct i915_ggtt *ggtt = &dev_priv->ggtt; | 1429 | struct drm_i915_private *i915 = error->i915; |
1430 | struct i915_ggtt *ggtt = &i915->ggtt; | ||
1431 | int i; | 1431 | int i; |
1432 | 1432 | ||
1433 | for (i = 0; i < I915_NUM_ENGINES; i++) { | 1433 | for (i = 0; i < I915_NUM_ENGINES; i++) { |
1434 | struct intel_engine_cs *engine = dev_priv->engine[i]; | 1434 | struct intel_engine_cs *engine = i915->engine[i]; |
1435 | struct drm_i915_error_engine *ee = &error->engine[i]; | 1435 | struct drm_i915_error_engine *ee = &error->engine[i]; |
1436 | struct i915_request *request; | 1436 | struct i915_request *request; |
1437 | 1437 | ||
@@ -1460,17 +1460,16 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, | |||
1460 | * by userspace. | 1460 | * by userspace. |
1461 | */ | 1461 | */ |
1462 | ee->batchbuffer = | 1462 | ee->batchbuffer = |
1463 | i915_error_object_create(dev_priv, | 1463 | i915_error_object_create(i915, request->batch); |
1464 | request->batch); | ||
1465 | 1464 | ||
1466 | if (HAS_BROKEN_CS_TLB(dev_priv)) | 1465 | if (HAS_BROKEN_CS_TLB(i915)) |
1467 | ee->wa_batchbuffer = | 1466 | ee->wa_batchbuffer = |
1468 | i915_error_object_create(dev_priv, | 1467 | i915_error_object_create(i915, |
1469 | engine->scratch); | 1468 | engine->scratch); |
1470 | request_record_user_bo(request, ee); | 1469 | request_record_user_bo(request, ee); |
1471 | 1470 | ||
1472 | ee->ctx = | 1471 | ee->ctx = |
1473 | i915_error_object_create(dev_priv, | 1472 | i915_error_object_create(i915, |
1474 | request->ctx->engine[i].state); | 1473 | request->ctx->engine[i].state); |
1475 | 1474 | ||
1476 | error->simulated |= | 1475 | error->simulated |= |
@@ -1484,27 +1483,24 @@ static void i915_gem_record_rings(struct drm_i915_private *dev_priv, | |||
1484 | ee->cpu_ring_head = ring->head; | 1483 | ee->cpu_ring_head = ring->head; |
1485 | ee->cpu_ring_tail = ring->tail; | 1484 | ee->cpu_ring_tail = ring->tail; |
1486 | ee->ringbuffer = | 1485 | ee->ringbuffer = |
1487 | i915_error_object_create(dev_priv, ring->vma); | 1486 | i915_error_object_create(i915, ring->vma); |
1488 | 1487 | ||
1489 | engine_record_requests(engine, request, ee); | 1488 | engine_record_requests(engine, request, ee); |
1490 | } | 1489 | } |
1491 | 1490 | ||
1492 | ee->hws_page = | 1491 | ee->hws_page = |
1493 | i915_error_object_create(dev_priv, | 1492 | i915_error_object_create(i915, |
1494 | engine->status_page.vma); | 1493 | engine->status_page.vma); |
1495 | 1494 | ||
1496 | ee->wa_ctx = | 1495 | ee->wa_ctx = i915_error_object_create(i915, engine->wa_ctx.vma); |
1497 | i915_error_object_create(dev_priv, engine->wa_ctx.vma); | ||
1498 | 1496 | ||
1499 | ee->default_state = | 1497 | ee->default_state = capture_object(i915, engine->default_state); |
1500 | capture_object(dev_priv, engine->default_state); | ||
1501 | } | 1498 | } |
1502 | } | 1499 | } |
1503 | 1500 | ||
1504 | static void i915_gem_capture_vm(struct drm_i915_private *dev_priv, | 1501 | static void gem_capture_vm(struct i915_gpu_state *error, |
1505 | struct i915_gpu_state *error, | 1502 | struct i915_address_space *vm, |
1506 | struct i915_address_space *vm, | 1503 | int idx) |
1507 | int idx) | ||
1508 | { | 1504 | { |
1509 | struct drm_i915_error_buffer *active_bo; | 1505 | struct drm_i915_error_buffer *active_bo; |
1510 | struct i915_vma *vma; | 1506 | struct i915_vma *vma; |
@@ -1527,8 +1523,7 @@ static void i915_gem_capture_vm(struct drm_i915_private *dev_priv, | |||
1527 | error->active_bo_count[idx] = count; | 1523 | error->active_bo_count[idx] = count; |
1528 | } | 1524 | } |
1529 | 1525 | ||
1530 | static void i915_capture_active_buffers(struct drm_i915_private *dev_priv, | 1526 | static void capture_active_buffers(struct i915_gpu_state *error) |
1531 | struct i915_gpu_state *error) | ||
1532 | { | 1527 | { |
1533 | int cnt = 0, i, j; | 1528 | int cnt = 0, i, j; |
1534 | 1529 | ||
@@ -1548,14 +1543,13 @@ static void i915_capture_active_buffers(struct drm_i915_private *dev_priv, | |||
1548 | for (j = 0; j < i && !found; j++) | 1543 | for (j = 0; j < i && !found; j++) |
1549 | found = error->engine[j].vm == ee->vm; | 1544 | found = error->engine[j].vm == ee->vm; |
1550 | if (!found) | 1545 | if (!found) |
1551 | i915_gem_capture_vm(dev_priv, error, ee->vm, cnt++); | 1546 | gem_capture_vm(error, ee->vm, cnt++); |
1552 | } | 1547 | } |
1553 | } | 1548 | } |
1554 | 1549 | ||
1555 | static void i915_capture_pinned_buffers(struct drm_i915_private *dev_priv, | 1550 | static void capture_pinned_buffers(struct i915_gpu_state *error) |
1556 | struct i915_gpu_state *error) | ||
1557 | { | 1551 | { |
1558 | struct i915_address_space *vm = &dev_priv->ggtt.base; | 1552 | struct i915_address_space *vm = &error->i915->ggtt.base; |
1559 | struct drm_i915_error_buffer *bo; | 1553 | struct drm_i915_error_buffer *bo; |
1560 | struct i915_vma *vma; | 1554 | struct i915_vma *vma; |
1561 | int count_inactive, count_active; | 1555 | int count_inactive, count_active; |
@@ -1605,9 +1599,9 @@ static void capture_uc_state(struct i915_gpu_state *error) | |||
1605 | } | 1599 | } |
1606 | 1600 | ||
1607 | /* Capture all registers which don't fit into another category. */ | 1601 | /* Capture all registers which don't fit into another category. */ |
1608 | static void i915_capture_reg_state(struct drm_i915_private *dev_priv, | 1602 | static void capture_reg_state(struct i915_gpu_state *error) |
1609 | struct i915_gpu_state *error) | ||
1610 | { | 1603 | { |
1604 | struct drm_i915_private *dev_priv = error->i915; | ||
1611 | int i; | 1605 | int i; |
1612 | 1606 | ||
1613 | /* General organization | 1607 | /* General organization |
@@ -1704,24 +1698,25 @@ static void i915_error_capture_msg(struct drm_i915_private *dev_priv, | |||
1704 | engine_mask ? "reset" : "continue"); | 1698 | engine_mask ? "reset" : "continue"); |
1705 | } | 1699 | } |
1706 | 1700 | ||
1707 | static void i915_capture_gen_state(struct drm_i915_private *dev_priv, | 1701 | static void capture_gen_state(struct i915_gpu_state *error) |
1708 | struct i915_gpu_state *error) | ||
1709 | { | 1702 | { |
1710 | error->awake = dev_priv->gt.awake; | 1703 | struct drm_i915_private *i915 = error->i915; |
1711 | error->wakelock = atomic_read(&dev_priv->runtime_pm.wakeref_count); | 1704 | |
1712 | error->suspended = dev_priv->runtime_pm.suspended; | 1705 | error->awake = i915->gt.awake; |
1706 | error->wakelock = atomic_read(&i915->runtime_pm.wakeref_count); | ||
1707 | error->suspended = i915->runtime_pm.suspended; | ||
1713 | 1708 | ||
1714 | error->iommu = -1; | 1709 | error->iommu = -1; |
1715 | #ifdef CONFIG_INTEL_IOMMU | 1710 | #ifdef CONFIG_INTEL_IOMMU |
1716 | error->iommu = intel_iommu_gfx_mapped; | 1711 | error->iommu = intel_iommu_gfx_mapped; |
1717 | #endif | 1712 | #endif |
1718 | error->reset_count = i915_reset_count(&dev_priv->gpu_error); | 1713 | error->reset_count = i915_reset_count(&i915->gpu_error); |
1719 | error->suspend_count = dev_priv->suspend_count; | 1714 | error->suspend_count = i915->suspend_count; |
1720 | 1715 | ||
1721 | memcpy(&error->device_info, | 1716 | memcpy(&error->device_info, |
1722 | INTEL_INFO(dev_priv), | 1717 | INTEL_INFO(i915), |
1723 | sizeof(error->device_info)); | 1718 | sizeof(error->device_info)); |
1724 | error->driver_caps = dev_priv->caps; | 1719 | error->driver_caps = i915->caps; |
1725 | } | 1720 | } |
1726 | 1721 | ||
1727 | static __always_inline void dup_param(const char *type, void *x) | 1722 | static __always_inline void dup_param(const char *type, void *x) |
@@ -1749,13 +1744,12 @@ static int capture(void *data) | |||
1749 | 1744 | ||
1750 | capture_params(error); | 1745 | capture_params(error); |
1751 | capture_uc_state(error); | 1746 | capture_uc_state(error); |
1752 | 1747 | capture_gen_state(error); | |
1753 | i915_capture_gen_state(error->i915, error); | 1748 | capture_reg_state(error); |
1754 | i915_capture_reg_state(error->i915, error); | 1749 | gem_record_fences(error); |
1755 | i915_gem_record_fences(error->i915, error); | 1750 | gem_record_rings(error); |
1756 | i915_gem_record_rings(error->i915, error); | 1751 | capture_active_buffers(error); |
1757 | i915_capture_active_buffers(error->i915, error); | 1752 | capture_pinned_buffers(error); |
1758 | i915_capture_pinned_buffers(error->i915, error); | ||
1759 | 1753 | ||
1760 | error->overlay = intel_overlay_capture_error_state(error->i915); | 1754 | error->overlay = intel_overlay_capture_error_state(error->i915); |
1761 | error->display = intel_display_capture_error_state(error->i915); | 1755 | error->display = intel_display_capture_error_state(error->i915); |