Skip to contentSkip to conversation

drm/i915/uncore: abstract intel_uncore_fw_domains_show()

PATCH In review Jani Nikula 3 participants 8 messages Nov 24 – Nov 25

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

PATCH 1/2 drm/i915/uncore: abstract intel_uncore_fw_domains_show()

The debugfs shouldn't really have to know about uncore implementation details. Add a separate function to log the forcewake domains.

---
 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 14 +-------------
 drivers/gpu/drm/i915/intel_uncore.c           | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_uncore.h           |  2 ++
 3 files changed, 21 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c +1 -13
index adf2512e2ed5..1b39e5f19192 100644
@@ -70,20 +70,8 @@ static int fw_domains_show(struct seq_file *m, void *data)
 {
 	struct intel_gt *gt = m->private;
 	struct intel_uncore *uncore = gt->uncore;
-	struct intel_uncore_forcewake_domain *fw_domain;
-	unsigned int tmp;
 
-	spin_lock_irq(&uncore->lock);
-
-	seq_printf(m, "user.bypass_count = %u\n",
-		   uncore->user_forcewake_count);
-
-	for_each_fw_domain(fw_domain, uncore, tmp)
-		seq_printf(m, "%s.wake_count = %u\n",
-			   intel_uncore_forcewake_domain_to_str(fw_domain->id),
-			   READ_ONCE(fw_domain->wake_count));
-
-	spin_unlock_irq(&uncore->lock);
+	intel_uncore_fw_domains_show(m, uncore);
 
 	return 0;
 }
drivers/gpu/drm/i915/intel_uncore.c +18 -0
index 4e10a02f5750..02f6000b203e 100644
@@ -2691,6 +2691,24 @@ intel_uncore_forcewake_for_reg(struct intel_uncore *uncore,
 	return fw_domains;
 }
 
+void intel_uncore_fw_domains_show(struct seq_file *m, struct intel_uncore *uncore)
+{
+	struct intel_uncore_forcewake_domain *fw_domain;
+	unsigned int tmp;
+
+	spin_lock_irq(&uncore->lock);
+
+	seq_printf(m, "user.bypass_count = %u\n",
+		   uncore->user_forcewake_count);
+
+	for_each_fw_domain(fw_domain, uncore, tmp)
+		seq_printf(m, "%s.wake_count = %u\n",
+			   intel_uncore_forcewake_domain_to_str(fw_domain->id),
+			   READ_ONCE(fw_domain->wake_count));
+
+	spin_unlock_irq(&uncore->lock);
+}
+
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftests/mock_uncore.c"
 #include "selftests/intel_uncore.c"
drivers/gpu/drm/i915/intel_uncore.h +2 -0
index 9047d7d4d855..d5de6a172ff3 100644
@@ -470,6 +470,8 @@ static inline void __iomem *intel_uncore_regs(struct intel_uncore *uncore)
 	return uncore->regs;
 }
 
+void intel_uncore_fw_domains_show(struct seq_file *m, struct intel_uncore *uncore);
+
 struct intel_uncore *to_intel_uncore(struct drm_device *drm);
 
 /*
Signature · 1 line
2.47.3
#1 lore raw

PATCH 2/2 drm/i915/uncore: hide uncore forcewake iterators

There are no users of for_each_fw_domain_masked() and for_each_fw_domain() left outside of intel_uncore.c. Hide them from the rest of the driver.

---
 drivers/gpu/drm/i915/intel_uncore.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_uncore.h | 8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +8 -0
index 02f6000b203e..cefcec468963 100644
@@ -42,6 +42,14 @@
 #define FORCEWAKE_ACK_TIMEOUT_MS 50
 #define GT_FIFO_TIMEOUT_MS	 10
 
+/* Iterate over initialised fw domains */
+#define for_each_fw_domain_masked(domain__, mask__, uncore__, tmp__) \
+	for (tmp__ = (mask__); tmp__ ;) \
+		for_each_if(domain__ = (uncore__)->fw_domain[__mask_next_bit(tmp__)])
+
+#define for_each_fw_domain(domain__, uncore__, tmp__) \
+	for_each_fw_domain_masked(domain__, (uncore__)->fw_domains, uncore__, tmp__)
+
 struct intel_uncore *to_intel_uncore(struct drm_device *drm)
 {
 	return &to_i915(drm)->uncore;
drivers/gpu/drm/i915/intel_uncore.h +0 -8
index d5de6a172ff3..1819c9430181 100644
@@ -175,14 +175,6 @@ struct intel_uncore {
 	unsigned int user_forcewake_count;
 };
 
-/* Iterate over initialised fw domains */
-#define for_each_fw_domain_masked(domain__, mask__, uncore__, tmp__) \
-	for (tmp__ = (mask__); tmp__ ;) \
-		for_each_if(domain__ = (uncore__)->fw_domain[__mask_next_bit(tmp__)])
-
-#define for_each_fw_domain(domain__, uncore__, tmp__) \
-	for_each_fw_domain_masked(domain__, (uncore__)->fw_domains, uncore__, tmp__)
-
 static inline bool
 intel_uncore_has_forcewake(const struct intel_uncore *uncore)
 {
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH 2/2] drm/i915/uncore: hide uncore forcewake iterators

Quoted 16 lines · Jani Nikula

There are no users of for_each_fw_domain_masked() and for_each_fw_domain() left outside of intel_uncore.c. Hide them from the rest of the driver.

---
 drivers/gpu/drm/i915/intel_uncore.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_uncore.h | 8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -0
index 02f6000b203e..cefcec468963 100644
@@ -42,6 +42,14 @@
 #define FORCEWAKE_ACK_TIMEOUT_MS 50

drivers/gpu/drm/i915/intel_uncore.c line 52

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +8 -0
 #define GT_FIFO_TIMEOUT_MS	 10
 
+/* Iterate over initialised fw domains */
+#define for_each_fw_domain_masked(domain__, mask__, uncore__, tmp__) \
+	for (tmp__ = (mask__); tmp__ ;) \
+		for_each_if(domain__ = (uncore__)->fw_domain[__mask_next_bit(tmp__)])
+
+#define for_each_fw_domain(domain__, uncore__, tmp__) \
+	for_each_fw_domain_masked(domain__, (uncore__)->fw_domains, uncore__, tmp__)
+

Selftests use these. Do they include the whole .c file or something?

Quoted 24 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 struct intel_uncore *to_intel_uncore(struct drm_device *drm)
 {
 	return &to_i915(drm)->uncore;
drivers/gpu/drm/i915/intel_uncore.h +0 -8
index d5de6a172ff3..1819c9430181 100644
@@ -175,14 +175,6 @@ struct intel_uncore {
 	unsigned int user_forcewake_count;
 };
 
-/* Iterate over initialised fw domains */
-#define for_each_fw_domain_masked(domain__, mask__, uncore__, tmp__) \
-	for (tmp__ = (mask__); tmp__ ;) \
-		for_each_if(domain__ = (uncore__)->fw_domain[__mask_next_bit(tmp__)])
-
-#define for_each_fw_domain(domain__, uncore__, tmp__) \
-	for_each_fw_domain_masked(domain__, (uncore__)->fw_domains, uncore__, tmp__)
-
 static inline bool
 intel_uncore_has_forcewake(const struct intel_uncore *uncore)
 {
Signature · 1 line
2.47.3
Signature · 2 lines
Ville Syrjälä
Intel
Reviewed-by on v1 1/2
#3 lore raw
In reply to Jani Nikula
Quoted 4 lines · Jani Nikula

The debugfs shouldn't really have to know about uncore implementation details. Add a separate function to log the forcewake domains.

Quoted 76 lines
---
 drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c | 14 +-------------
 drivers/gpu/drm/i915/intel_uncore.c           | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_uncore.h           |  2 ++
 3 files changed, 21 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c +1 -13
index adf2512e2ed5..1b39e5f19192 100644
@@ -70,20 +70,8 @@ static int fw_domains_show(struct seq_file *m, void *data)
 {
 	struct intel_gt *gt = m->private;
 	struct intel_uncore *uncore = gt->uncore;
-	struct intel_uncore_forcewake_domain *fw_domain;
-	unsigned int tmp;
 
-	spin_lock_irq(&uncore->lock);
-
-	seq_printf(m, "user.bypass_count = %u\n",
-		   uncore->user_forcewake_count);
-
-	for_each_fw_domain(fw_domain, uncore, tmp)
-		seq_printf(m, "%s.wake_count = %u\n",
-			   intel_uncore_forcewake_domain_to_str(fw_domain->id),
-			   READ_ONCE(fw_domain->wake_count));
-
-	spin_unlock_irq(&uncore->lock);
+	intel_uncore_fw_domains_show(m, uncore);
 
 	return 0;
 }
drivers/gpu/drm/i915/intel_uncore.c +18 -0
index 4e10a02f5750..02f6000b203e 100644
@@ -2691,6 +2691,24 @@ intel_uncore_forcewake_for_reg(struct intel_uncore *uncore,
 	return fw_domains;
 }
 
+void intel_uncore_fw_domains_show(struct seq_file *m, struct intel_uncore *uncore)
+{
+	struct intel_uncore_forcewake_domain *fw_domain;
+	unsigned int tmp;
+
+	spin_lock_irq(&uncore->lock);
+
+	seq_printf(m, "user.bypass_count = %u\n",
+		   uncore->user_forcewake_count);
+
+	for_each_fw_domain(fw_domain, uncore, tmp)
+		seq_printf(m, "%s.wake_count = %u\n",
+			   intel_uncore_forcewake_domain_to_str(fw_domain->id),
+			   READ_ONCE(fw_domain->wake_count));
+
+	spin_unlock_irq(&uncore->lock);
+}
+
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftests/mock_uncore.c"
 #include "selftests/intel_uncore.c"
drivers/gpu/drm/i915/intel_uncore.h +2 -0
index 9047d7d4d855..d5de6a172ff3 100644
@@ -470,6 +470,8 @@ static inline void __iomem *intel_uncore_regs(struct intel_uncore *uncore)
 	return uncore->regs;
 }
 
+void intel_uncore_fw_domains_show(struct seq_file *m, struct intel_uncore *uncore);
+
 struct intel_uncore *to_intel_uncore(struct drm_device *drm);
 
 /*
Signature · 1 line
2.47.3
Signature · 2 lines
Ville Syrjälä
Intel
#4 lore raw

✓ i915.CI.BAT: success for series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()
URL : https://patchwork.freedesktop.org/series/179546/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19605 -> Patchwork_179546v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (40 -> 39)
------------------------------

Missing (1): bat-dg2-13

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

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

### IGT changes ###

#### Issues hit ####

* igt@core_debugfs@read-all-entries:
- bat-adlp-6: [PASS][1] -> [DMESG-WARN][2] ([i915#15673])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

#### Possible fixes ####

* igt@core_auth@basic-auth:
- bat-adlp-6: [DMESG-WARN][3] ([i915#15673]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673

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

* Linux: CI_DRM_19605 -> Patchwork_179546v1

CI-20190529: 20190529
CI_DRM_19605: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9203: 9203
Patchwork_179546v1: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#5 lore raw

✓ i915.CI.BAT: success for series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()
URL : https://patchwork.freedesktop.org/series/179546/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19605 -> Patchwork_179546v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (40 -> 39)
------------------------------

Missing (1): bat-dg2-13

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

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

### IGT changes ###

#### Issues hit ####

* igt@core_debugfs@read-all-entries:
- bat-adlp-6: [PASS][1] -> [DMESG-WARN][2] ([i915#15673])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

#### Possible fixes ####

* igt@core_auth@basic-auth:
- bat-adlp-6: [DMESG-WARN][3] ([i915#15673]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673

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

* Linux: CI_DRM_19605 -> Patchwork_179546v1

CI-20190529: 20190529
CI_DRM_19605: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9203: 9203
Patchwork_179546v1: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#6 lore raw

✓ i915.CI.BAT: success for series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()
URL : https://patchwork.freedesktop.org/series/179546/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19605 -> Patchwork_179546v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (40 -> 39)
------------------------------

Missing (1): bat-dg2-13

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

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

### IGT changes ###

#### Issues hit ####

* igt@core_debugfs@read-all-entries:
- bat-adlp-6: [PASS][1] -> [DMESG-WARN][2] ([i915#15673])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

#### Possible fixes ####

* igt@core_auth@basic-auth:
- bat-adlp-6: [DMESG-WARN][3] ([i915#15673]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673

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

* Linux: CI_DRM_19605 -> Patchwork_179546v1

CI-20190529: 20190529
CI_DRM_19605: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9203: 9203
Patchwork_179546v1: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#7 lore raw

✓ i915.CI.BAT: success for series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915/uncore: abstract intel_uncore_fw_domains_show()
URL : https://patchwork.freedesktop.org/series/179546/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19605 -> Patchwork_179546v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (40 -> 39)
------------------------------

Missing (1): bat-dg2-13

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

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

### IGT changes ###

#### Issues hit ####

* igt@core_debugfs@read-all-entries:
- bat-adlp-6: [PASS][1] -> [DMESG-WARN][2] ([i915#15673])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

#### Possible fixes ####

* igt@core_auth@basic-auth:
- bat-adlp-6: [DMESG-WARN][3] ([i915#15673]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19605/bat-adlp-6/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179546v1/bat-adlp-6/igt@[email protected]

[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673

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

* Linux: CI_DRM_19605 -> Patchwork_179546v1

CI-20190529: 20190529
CI_DRM_19605: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9203: 9203
Patchwork_179546v1: 28c36332c01de3058d0cb9e350a77e1282c31658 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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