Skip to contentSkip to conversation

drm/i915: Drop stealing of bits from i915_sw_fence function pointer

PATCH In review Matthew Brost 3 participants 4 messages Sep 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Drop stealing of bits from i915_sw_fence function pointer

Rather than stealing bits from i915_sw_fence function pointer use seperate fields for function pointer and flags. If using two different fields, the 4 byte alignment for the i915_sw_fence function pointer can also be dropped.

---
 drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |  2 +-
 drivers/gpu/drm/i915/i915_request.c           |  4 ++--
 drivers/gpu/drm/i915/i915_sw_fence.c          |  9 +++-----
 drivers/gpu/drm/i915/i915_sw_fence.h          | 21 +++++++++----------
 drivers/gpu/drm/i915/i915_sw_fence_work.c     |  2 +-
 .../gpu/drm/i915/selftests/i915_sw_fence.c    |  2 +-
 drivers/gpu/drm/i915/selftests/lib_sw_fence.c |  4 ++--
 8 files changed, 21 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index a7ca38613f89..6d5bb55ffc82 100644
@@ -10323,7 +10323,7 @@ static void intel_atomic_commit_work(struct work_struct *work)
 	intel_atomic_commit_tail(state);
 }
 
-static int __i915_sw_fence_call
+static int
 intel_atomic_commit_ready(struct i915_sw_fence *fence,
 			  enum i915_sw_fence_notify notify)
 {
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -1
index c2ab0e22db0a..df5fec5c3da8 100644
@@ -800,7 +800,7 @@ static void free_engines_rcu(struct rcu_head *rcu)
 	free_engines(engines);
 }
 
-static int __i915_sw_fence_call
+static int
 engines_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct i915_gem_engines *engines =
drivers/gpu/drm/i915/i915_request.c +2 -2
index ce446716d092..945d3025a0b6 100644
@@ -719,7 +719,7 @@ void i915_request_cancel(struct i915_request *rq, int error)
 	intel_context_cancel_request(rq->context, rq);
 }
 
-static int __i915_sw_fence_call
+static int
 submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct i915_request *request =
@@ -755,7 +755,7 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 	return NOTIFY_DONE;
 }
 
-static int __i915_sw_fence_call
+static int
 semaphore_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct i915_request *rq = container_of(fence, typeof(*rq), semaphore);
drivers/gpu/drm/i915/i915_sw_fence.c +3 -6
index c589a681da77..5cf101cf06d2 100644
@@ -34,7 +34,7 @@ enum {
 
 static void *i915_sw_fence_debug_hint(void *addr)
 {
-	return (void *)(((struct i915_sw_fence *)addr)->flags & I915_SW_FENCE_MASK);
+	return (void *)(((struct i915_sw_fence *)addr)->fn);
 }
 
 #ifdef CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS
@@ -126,10 +126,7 @@ static inline void debug_fence_assert(struct i915_sw_fence *fence)
 static int __i915_sw_fence_notify(struct i915_sw_fence *fence,
 				  enum i915_sw_fence_notify state)
 {
-	i915_sw_fence_notify_t fn;
-
-	fn = (i915_sw_fence_notify_t)(fence->flags & I915_SW_FENCE_MASK);
-	return fn(fence, state);
+	return fence->fn(fence, state);
 }
 
 #ifdef CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS
@@ -242,7 +239,7 @@ void __i915_sw_fence_init(struct i915_sw_fence *fence,
 			  const char *name,
 			  struct lock_class_key *key)
 {
-	BUG_ON(!fn || (unsigned long)fn & ~I915_SW_FENCE_MASK);
+	BUG_ON(!fn);
 
 	__init_waitqueue_head(&fence->wait, name, key);
 	fence->flags = (unsigned long)fn;
drivers/gpu/drm/i915/i915_sw_fence.h +10 -11
index 30a863353ee6..70ba1789aa89 100644
@@ -17,26 +17,25 @@
 
 struct completion;
 struct dma_resv;
+struct i915_sw_fence;
+
+enum i915_sw_fence_notify {
+	FENCE_COMPLETE,
+	FENCE_FREE
+};
+
+typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *,
+				      enum i915_sw_fence_notify state);
 
 struct i915_sw_fence {
 	wait_queue_head_t wait;
+	i915_sw_fence_notify_t fn;
 	unsigned long flags;
 	atomic_t pending;
 	int error;
 };
 
 #define I915_SW_FENCE_CHECKED_BIT	0 /* used internally for DAG checking */
-#define I915_SW_FENCE_PRIVATE_BIT	1 /* available for use by owner */
-#define I915_SW_FENCE_MASK		(~3)
-
-enum i915_sw_fence_notify {
-	FENCE_COMPLETE,
-	FENCE_FREE
-};
-
-typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *,
-				      enum i915_sw_fence_notify state);
-#define __i915_sw_fence_call __aligned(4)
 
 void __i915_sw_fence_init(struct i915_sw_fence *fence,
 			  i915_sw_fence_notify_t fn,
drivers/gpu/drm/i915/i915_sw_fence_work.c +1 -1
index 5b33ef23d54c..d2e56b387993 100644
@@ -23,7 +23,7 @@ static void fence_work(struct work_struct *work)
 	dma_fence_put(&f->dma);
 }
 
-static int __i915_sw_fence_call
+static int
 fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct dma_fence_work *f = container_of(fence, typeof(*f), chain);
drivers/gpu/drm/i915/selftests/i915_sw_fence.c +1 -1
index cbf45d85cbff..daa985e5a19b 100644
@@ -28,7 +28,7 @@
 
 #include "../i915_selftest.h"
 
-static int __i915_sw_fence_call
+static int
 fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	switch (state) {
drivers/gpu/drm/i915/selftests/lib_sw_fence.c +2 -2
index 080b90b63d16..eb59a41bdb79 100644
@@ -26,7 +26,7 @@
 
 /* Small library of different fence types useful for writing tests */
 
-static int __i915_sw_fence_call
+static int
 nop_fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	return NOTIFY_DONE;
@@ -89,7 +89,7 @@ struct heap_fence {
 	};
 };
 
-static int __i915_sw_fence_call
+static int
 heap_fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct heap_fence *h = container_of(fence, typeof(*h), fence);
Signature · 1 line
2.32.0
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Drop stealing of bits from i915_sw_fence function pointer

== Series Details ==

== Series Details ==

Series: drm/i915: Drop stealing of bits from i915_sw_fence function pointer
URL : https://patchwork.freedesktop.org/series/94924/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
b71f1b1135e9 drm/i915: Drop stealing of bits from i915_sw_fence function pointer
-:8: WARNING:TYPO_SPELLING: 'seperate' may be misspelled - perhaps 'separate'?
#8: 
seperate fields for function pointer and flags. If using two different
^^^^^^^^

-:92: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #92: FILE: drivers/gpu/drm/i915/i915_sw_fence.c:242:
+ BUG_ON(!fn);

total: 0 errors, 2 warnings, 0 checks, 127 lines checked

#2 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Drop stealing of bits from i915_sw_fence function pointer

In reply to Matthew Brost
== Series Details ==

== Series Details ==

Series: drm/i915: Drop stealing of bits from i915_sw_fence function pointer
URL : https://patchwork.freedesktop.org/series/94924/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10622 -> Patchwork_21123
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_21123 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_21123, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_21123:

### CI changes ###

#### Possible regressions ####

* boot:
- fi-apl-guc: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-apl-guc/boot.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-apl-guc/boot.html
- fi-kbl-8809g: [PASS][3] -> [FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-kbl-8809g/boot.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-kbl-8809g/boot.html
- fi-snb-2520m: [PASS][5] -> [FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-snb-2520m/boot.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-snb-2520m/boot.html
- fi-elk-e7500: [PASS][7] -> [FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-elk-e7500/boot.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-elk-e7500/boot.html
- fi-bsw-nick: [PASS][9] -> [FAIL][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-bsw-nick/boot.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-bsw-nick/boot.html
- fi-tgl-1115g4: NOTRUN -> [FAIL][11]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-tgl-1115g4/boot.html
- fi-glk-dsi: [PASS][12] -> [FAIL][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-glk-dsi/boot.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-glk-dsi/boot.html
- fi-cfl-8109u: [PASS][14] -> [FAIL][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-cfl-8109u/boot.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-cfl-8109u/boot.html
- fi-ivb-3770: [PASS][16] -> [FAIL][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-ivb-3770/boot.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-ivb-3770/boot.html
- fi-rkl-guc: [PASS][18] -> [FAIL][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-rkl-guc/boot.html
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-rkl-guc/boot.html
- fi-cfl-8700k: [PASS][20] -> [FAIL][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-cfl-8700k/boot.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-cfl-8700k/boot.html
- fi-bxt-dsi: [PASS][22] -> [FAIL][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-bxt-dsi/boot.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-bxt-dsi/boot.html
- fi-snb-2600: [PASS][24] -> [FAIL][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-snb-2600/boot.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-snb-2600/boot.html
- fi-cml-u2: [PASS][26] -> [FAIL][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-cml-u2/boot.html
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-cml-u2/boot.html
- fi-kbl-guc: NOTRUN -> [FAIL][28]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-kbl-guc/boot.html
- fi-pnv-d510: [PASS][29] -> [FAIL][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-pnv-d510/boot.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-pnv-d510/boot.html
- fi-bsw-kefka: [PASS][31] -> [FAIL][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-bsw-kefka/boot.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-bsw-kefka/boot.html
- fi-bdw-gvtdvm: [PASS][33] -> [FAIL][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-bdw-gvtdvm/boot.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-bdw-gvtdvm/boot.html
- fi-kbl-7500u: [PASS][35] -> [FAIL][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-kbl-7500u/boot.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-kbl-7500u/boot.html
- fi-hsw-4770: [PASS][37] -> [FAIL][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-hsw-4770/boot.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-hsw-4770/boot.html
- fi-cfl-guc: [PASS][39] -> [FAIL][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-cfl-guc/boot.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-cfl-guc/boot.html
- fi-bwr-2160: [PASS][41] -> [FAIL][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-bwr-2160/boot.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-bwr-2160/boot.html
- fi-kbl-r: [PASS][43] -> [FAIL][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-kbl-r/boot.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-kbl-r/boot.html
- fi-kbl-7567u: [PASS][45] -> [FAIL][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-kbl-7567u/boot.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-kbl-7567u/boot.html

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* boot:
- {fi-tgl-dsi}: [PASS][47] -> [FAIL][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-tgl-dsi/boot.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-tgl-dsi/boot.html
- {fi-jsl-1}: [PASS][49] -> [FAIL][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-jsl-1/boot.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-jsl-1/boot.html
- {fi-ehl-2}: [PASS][51] -> [FAIL][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-ehl-2/boot.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-ehl-2/boot.html

Known issues
------------

Here are the changes found in Patchwork_21123 that come from known issues:

### CI changes ###

#### Issues hit ####

* boot:
- fi-icl-y: [PASS][53] -> [FAIL][54] ([i915#3521])
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-icl-y/boot.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-icl-y/boot.html
- fi-icl-u2: [PASS][55] -> [FAIL][56] ([i915#3521])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-icl-u2/boot.html
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-icl-u2/boot.html
- fi-skl-6600u: [PASS][57] -> [FAIL][58] ([i915#3174])
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-skl-6600u/boot.html
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-skl-6600u/boot.html
- fi-skl-6700k2: NOTRUN -> [FAIL][59] ([i915#3174])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-skl-6700k2/boot.html
- fi-kbl-soraka: [PASS][60] -> [FAIL][61] ([i915#3895])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10622/fi-kbl-soraka/boot.html
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-kbl-soraka/boot.html
- fi-skl-guc: NOTRUN -> [FAIL][62] ([i915#3174])
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/fi-skl-guc/boot.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#3174]: https://gitlab.freedesktop.org/drm/intel/issues/3174
[i915#3521]: https://gitlab.freedesktop.org/drm/intel/issues/3521
[i915#3895]: https://gitlab.freedesktop.org/drm/intel/issues/3895

Participating hosts (33 -> 33)
------------------------------

Additional (4): fi-skl-guc fi-kbl-guc fi-tgl-1115g4 fi-skl-6700k2
Missing (4): fi-bsw-cyan fi-bdw-samus fi-bdw-5557u bat-dg1-6

Build changes
-------------

* IGT: IGT_6214 -> None
* Linux: CI_DRM_10622 -> Patchwork_21123

CI-20190529: 20190529
CI_DRM_10622: 525a2117194d1c06200adb49678fe56fd1641591 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6214: 13550e92c6c7bd825abb6c9b087d12a524b4674c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21123: b71f1b1135e95359e6e2f3a9094118b3aac5ea6f @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

b71f1b1135e9 drm/i915: Drop stealing of bits from i915_sw_fence function pointer

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21123/index.html

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Matthew Brost
Quoted 4 lines · Matthew Brost

Rather than stealing bits from i915_sw_fence function pointer use seperate fields for function pointer and flags. If using two different fields, the 4 byte alignment for the i915_sw_fence function pointer can also be dropped.

Yes, please, thank you.

BR,
Jani.

Quoted 184 lines
---
 drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |  2 +-
 drivers/gpu/drm/i915/i915_request.c           |  4 ++--
 drivers/gpu/drm/i915/i915_sw_fence.c          |  9 +++-----
 drivers/gpu/drm/i915/i915_sw_fence.h          | 21 +++++++++----------
 drivers/gpu/drm/i915/i915_sw_fence_work.c     |  2 +-
 .../gpu/drm/i915/selftests/i915_sw_fence.c    |  2 +-
 drivers/gpu/drm/i915/selftests/lib_sw_fence.c |  4 ++--
 8 files changed, 21 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index a7ca38613f89..6d5bb55ffc82 100644
@@ -10323,7 +10323,7 @@ static void intel_atomic_commit_work(struct work_struct *work)
 	intel_atomic_commit_tail(state);
 }
 
-static int __i915_sw_fence_call
+static int
 intel_atomic_commit_ready(struct i915_sw_fence *fence,
 			  enum i915_sw_fence_notify notify)
 {
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -1
index c2ab0e22db0a..df5fec5c3da8 100644
@@ -800,7 +800,7 @@ static void free_engines_rcu(struct rcu_head *rcu)
 	free_engines(engines);
 }
 
-static int __i915_sw_fence_call
+static int
 engines_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct i915_gem_engines *engines =
drivers/gpu/drm/i915/i915_request.c +2 -2
index ce446716d092..945d3025a0b6 100644
@@ -719,7 +719,7 @@ void i915_request_cancel(struct i915_request *rq, int error)
 	intel_context_cancel_request(rq->context, rq);
 }
 
-static int __i915_sw_fence_call
+static int
 submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct i915_request *request =
@@ -755,7 +755,7 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 	return NOTIFY_DONE;
 }
 
-static int __i915_sw_fence_call
+static int
 semaphore_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct i915_request *rq = container_of(fence, typeof(*rq), semaphore);
drivers/gpu/drm/i915/i915_sw_fence.c +3 -6
index c589a681da77..5cf101cf06d2 100644
@@ -34,7 +34,7 @@ enum {
 
 static void *i915_sw_fence_debug_hint(void *addr)
 {
-	return (void *)(((struct i915_sw_fence *)addr)->flags & I915_SW_FENCE_MASK);
+	return (void *)(((struct i915_sw_fence *)addr)->fn);
 }
 
 #ifdef CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS
@@ -126,10 +126,7 @@ static inline void debug_fence_assert(struct i915_sw_fence *fence)
 static int __i915_sw_fence_notify(struct i915_sw_fence *fence,
 				  enum i915_sw_fence_notify state)
 {
-	i915_sw_fence_notify_t fn;
-
-	fn = (i915_sw_fence_notify_t)(fence->flags & I915_SW_FENCE_MASK);
-	return fn(fence, state);
+	return fence->fn(fence, state);
 }
 
 #ifdef CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS
@@ -242,7 +239,7 @@ void __i915_sw_fence_init(struct i915_sw_fence *fence,
 			  const char *name,
 			  struct lock_class_key *key)
 {
-	BUG_ON(!fn || (unsigned long)fn & ~I915_SW_FENCE_MASK);
+	BUG_ON(!fn);
 
 	__init_waitqueue_head(&fence->wait, name, key);
 	fence->flags = (unsigned long)fn;
drivers/gpu/drm/i915/i915_sw_fence.h +10 -11
index 30a863353ee6..70ba1789aa89 100644
@@ -17,26 +17,25 @@
 
 struct completion;
 struct dma_resv;
+struct i915_sw_fence;
+
+enum i915_sw_fence_notify {
+	FENCE_COMPLETE,
+	FENCE_FREE
+};
+
+typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *,
+				      enum i915_sw_fence_notify state);
 
 struct i915_sw_fence {
 	wait_queue_head_t wait;
+	i915_sw_fence_notify_t fn;
 	unsigned long flags;
 	atomic_t pending;
 	int error;
 };
 
 #define I915_SW_FENCE_CHECKED_BIT	0 /* used internally for DAG checking */
-#define I915_SW_FENCE_PRIVATE_BIT	1 /* available for use by owner */
-#define I915_SW_FENCE_MASK		(~3)
-
-enum i915_sw_fence_notify {
-	FENCE_COMPLETE,
-	FENCE_FREE
-};
-
-typedef int (*i915_sw_fence_notify_t)(struct i915_sw_fence *,
-				      enum i915_sw_fence_notify state);
-#define __i915_sw_fence_call __aligned(4)
 
 void __i915_sw_fence_init(struct i915_sw_fence *fence,
 			  i915_sw_fence_notify_t fn,
drivers/gpu/drm/i915/i915_sw_fence_work.c +1 -1
index 5b33ef23d54c..d2e56b387993 100644
@@ -23,7 +23,7 @@ static void fence_work(struct work_struct *work)
 	dma_fence_put(&f->dma);
 }
 
-static int __i915_sw_fence_call
+static int
 fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct dma_fence_work *f = container_of(fence, typeof(*f), chain);
drivers/gpu/drm/i915/selftests/i915_sw_fence.c +1 -1
index cbf45d85cbff..daa985e5a19b 100644
@@ -28,7 +28,7 @@
 
 #include "../i915_selftest.h"
 
-static int __i915_sw_fence_call
+static int
 fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	switch (state) {
drivers/gpu/drm/i915/selftests/lib_sw_fence.c +2 -2
index 080b90b63d16..eb59a41bdb79 100644
@@ -26,7 +26,7 @@
 
 /* Small library of different fence types useful for writing tests */
 
-static int __i915_sw_fence_call
+static int
 nop_fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	return NOTIFY_DONE;
@@ -89,7 +89,7 @@ struct heap_fence {
 	};
 };
 
-static int __i915_sw_fence_call
+static int
 heap_fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
 {
 	struct heap_fence *h = container_of(fence, typeof(*h), fence);
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center