Skip to contentSkip to conversation

accel/ivpu: Replace profiling frequency debugfs with test mode bit

PATCH Applied Andrzej Kacprowski 3 participants 4 messages Nov 3 – Nov 5

Subsystems (2)
lore
Share & tools
lore

Andrzej Kacprowski

author maintainer
#0 lore raw

PATCH 1/1 accel/ivpu: Replace profiling frequency debugfs with test mode bit

Remove the profiling frequency debugfs control. Add IVPU_TEST_MODE_PROF_FREQ_HIGH to select PLL_PROFILING_FREQ_HIGH during driver initialization. High frequency profiling is for debugging purposes and it can be set at initialization time - there is no need to control it via debugfs.

---
 drivers/accel/ivpu/ivpu_debugfs.c | 29 -----------------------------
 drivers/accel/ivpu/ivpu_drv.h     |  1 +
 drivers/accel/ivpu/ivpu_hw.c      | 13 -------------
 drivers/accel/ivpu/ivpu_hw.h      |  1 -
 drivers/accel/ivpu/ivpu_hw_btrs.c |  7 ++++++-
 5 files changed, 7 insertions(+), 44 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +0 -29
index dc20bc73c6ed..ae535fe49274 100644
@@ -226,33 +226,6 @@ static const struct file_operations fw_log_fops = {
 	.release = single_release,
 };
 
-static ssize_t
-fw_profiling_freq_fops_write(struct file *file, const char __user *user_buf,
-			     size_t size, loff_t *pos)
-{
-	struct ivpu_device *vdev = file->private_data;
-	bool enable;
-	int ret;
-
-	ret = kstrtobool_from_user(user_buf, size, &enable);
-	if (ret < 0)
-		return ret;
-
-	ivpu_hw_profiling_freq_drive(vdev, enable);
-
-	ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
-	if (ret)
-		return ret;
-
-	return size;
-}
-
-static const struct file_operations fw_profiling_freq_fops = {
-	.owner = THIS_MODULE,
-	.open = simple_open,
-	.write = fw_profiling_freq_fops_write,
-};
-
 static ssize_t
 fw_trace_destination_mask_fops_write(struct file *file, const char __user *user_buf,
 				     size_t size, loff_t *pos)
@@ -513,8 +486,6 @@ void ivpu_debugfs_init(struct ivpu_device *vdev)
 			    &ivpu_resume_engine_fops);
 
 	if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX) {
-		debugfs_create_file("fw_profiling_freq_drive", 0200,
-				    debugfs_root, vdev, &fw_profiling_freq_fops);
 		debugfs_create_file("dct", 0644, debugfs_root, vdev, &ivpu_dct_fops);
 	}
 
drivers/accel/ivpu/ivpu_drv.h +1 -0
index ea5b8dc612d1..b33a53101894 100644
@@ -238,6 +238,7 @@ extern bool ivpu_force_snoop;
 #define IVPU_TEST_MODE_CLK_RELINQ_DISABLE BIT(11)
 #define IVPU_TEST_MODE_CLK_RELINQ_ENABLE  BIT(12)
 #define IVPU_TEST_MODE_D0I2_DISABLE       BIT(13)
+#define IVPU_TEST_MODE_PROF_FREQ_HIGH     BIT(14)
 extern int ivpu_test_mode;
 
 struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
drivers/accel/ivpu/ivpu_hw.c +0 -13
index 86679d64fc14..2cc2915ab5c5 100644
@@ -359,19 +359,6 @@ int ivpu_hw_boot_fw(struct ivpu_device *vdev)
 	return ret;
 }
 
-void ivpu_hw_profiling_freq_drive(struct ivpu_device *vdev, bool enable)
-{
-	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
-		vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
-		return;
-	}
-
-	if (enable)
-		vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_HIGH;
-	else
-		vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
-}
-
 void ivpu_irq_handlers_init(struct ivpu_device *vdev)
 {
 	if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL)
drivers/accel/ivpu/ivpu_hw.h +0 -1
index 8c1b61df6cd4..de3dcb8e6173 100644
@@ -61,7 +61,6 @@ int ivpu_hw_power_up(struct ivpu_device *vdev);
 int ivpu_hw_power_down(struct ivpu_device *vdev);
 int ivpu_hw_reset(struct ivpu_device *vdev);
 int ivpu_hw_boot_fw(struct ivpu_device *vdev);
-void ivpu_hw_profiling_freq_drive(struct ivpu_device *vdev, bool enable);
 void ivpu_irq_handlers_init(struct ivpu_device *vdev);
 void ivpu_hw_irq_enable(struct ivpu_device *vdev);
 void ivpu_hw_irq_disable(struct ivpu_device *vdev);
drivers/accel/ivpu/ivpu_hw_btrs.c +6 -1
index 840983a618ca..602d09e511e5 100644
@@ -153,7 +153,12 @@ static int info_init_lnl(struct ivpu_device *vdev)
 		return ret;
 
 	hw->tile_fuse = tile_fuse_config;
-	hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
+
+	if (ivpu_test_mode & IVPU_TEST_MODE_PROF_FREQ_HIGH)
+		hw->pll.profiling_freq = PLL_PROFILING_FREQ_HIGH;
+	else
+		hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
+
 	hw->btrs_irq_mask = BTRS_LNL_IRQ_MASK;
 
 	if (ivpu_test_mode & IVPU_TEST_MODE_FREQ_CHANGE_ENABLE)
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andrzej Kacprowski

Remove the profiling frequency debugfs control. Add IVPU_TEST_MODE_PROF_FREQ_HIGH to select PLL_PROFILING_FREQ_HIGH during driver initialization. High frequency profiling is for debugging purposes and it can be set at initialization time - there is no need to control it via debugfs.

---

Quoted 120 lines
  drivers/accel/ivpu/ivpu_debugfs.c | 29 -----------------------------
  drivers/accel/ivpu/ivpu_drv.h     |  1 +
  drivers/accel/ivpu/ivpu_hw.c      | 13 -------------
  drivers/accel/ivpu/ivpu_hw.h      |  1 -
  drivers/accel/ivpu/ivpu_hw_btrs.c |  7 ++++++-
  5 files changed, 7 insertions(+), 44 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +0 -29
index dc20bc73c6ed..ae535fe49274 100644
@@ -226,33 +226,6 @@ static const struct file_operations fw_log_fops = {
  	.release = single_release,
  };
 
-static ssize_t
-fw_profiling_freq_fops_write(struct file *file, const char __user *user_buf,
-			     size_t size, loff_t *pos)
-{
-	struct ivpu_device *vdev = file->private_data;
-	bool enable;
-	int ret;
-
-	ret = kstrtobool_from_user(user_buf, size, &enable);
-	if (ret < 0)
-		return ret;
-
-	ivpu_hw_profiling_freq_drive(vdev, enable);
-
-	ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
-	if (ret)
-		return ret;
-
-	return size;
-}
-
-static const struct file_operations fw_profiling_freq_fops = {
-	.owner = THIS_MODULE,
-	.open = simple_open,
-	.write = fw_profiling_freq_fops_write,
-};
-
  static ssize_t
  fw_trace_destination_mask_fops_write(struct file *file, const char __user *user_buf,
  				     size_t size, loff_t *pos)
@@ -513,8 +486,6 @@ void ivpu_debugfs_init(struct ivpu_device *vdev)
  			    &ivpu_resume_engine_fops);
 
  	if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX) {
-		debugfs_create_file("fw_profiling_freq_drive", 0200,
-				    debugfs_root, vdev, &fw_profiling_freq_fops);
  		debugfs_create_file("dct", 0644, debugfs_root, vdev, &ivpu_dct_fops);
  	}
 
drivers/accel/ivpu/ivpu_drv.h +1 -0
index ea5b8dc612d1..b33a53101894 100644
@@ -238,6 +238,7 @@ extern bool ivpu_force_snoop;
  #define IVPU_TEST_MODE_CLK_RELINQ_DISABLE BIT(11)
  #define IVPU_TEST_MODE_CLK_RELINQ_ENABLE  BIT(12)
  #define IVPU_TEST_MODE_D0I2_DISABLE       BIT(13)
+#define IVPU_TEST_MODE_PROF_FREQ_HIGH     BIT(14)
  extern int ivpu_test_mode;
 
  struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
drivers/accel/ivpu/ivpu_hw.c +0 -13
index 86679d64fc14..2cc2915ab5c5 100644
@@ -359,19 +359,6 @@ int ivpu_hw_boot_fw(struct ivpu_device *vdev)
  	return ret;
  }
 
-void ivpu_hw_profiling_freq_drive(struct ivpu_device *vdev, bool enable)
-{
-	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
-		vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
-		return;
-	}
-
-	if (enable)
-		vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_HIGH;
-	else
-		vdev->hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
-}
-
  void ivpu_irq_handlers_init(struct ivpu_device *vdev)
  {
  	if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL)
drivers/accel/ivpu/ivpu_hw.h +0 -1
index 8c1b61df6cd4..de3dcb8e6173 100644
@@ -61,7 +61,6 @@ int ivpu_hw_power_up(struct ivpu_device *vdev);
  int ivpu_hw_power_down(struct ivpu_device *vdev);
  int ivpu_hw_reset(struct ivpu_device *vdev);
  int ivpu_hw_boot_fw(struct ivpu_device *vdev);
-void ivpu_hw_profiling_freq_drive(struct ivpu_device *vdev, bool enable);
  void ivpu_irq_handlers_init(struct ivpu_device *vdev);
  void ivpu_hw_irq_enable(struct ivpu_device *vdev);
  void ivpu_hw_irq_disable(struct ivpu_device *vdev);
drivers/accel/ivpu/ivpu_hw_btrs.c +6 -1
index 840983a618ca..602d09e511e5 100644
@@ -153,7 +153,12 @@ static int info_init_lnl(struct ivpu_device *vdev)
  		return ret;
 
  	hw->tile_fuse = tile_fuse_config;
-	hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
+
+	if (ivpu_test_mode & IVPU_TEST_MODE_PROF_FREQ_HIGH)
+		hw->pll.profiling_freq = PLL_PROFILING_FREQ_HIGH;
+	else
+		hw->pll.profiling_freq = PLL_PROFILING_FREQ_DEFAULT;
+
  	hw->btrs_irq_mask = BTRS_LNL_IRQ_MASK;
 
  	if (ivpu_test_mode & IVPU_TEST_MODE_FREQ_CHANGE_ENABLE)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrzej Kacprowski
Quoted 8 lines · Andrzej Kacprowski

Remove the profiling frequency debugfs control. Add IVPU_TEST_MODE_PROF_FREQ_HIGH to select PLL_PROFILING_FREQ_HIGH during driver initialization. High frequency profiling is for debugging purposes and it can be set at initialization time - there is no need to control it via debugfs.

maintainer Applied
#3 lore raw
Quoted 10 lines · Jeff Hugo
Quoted 8 lines · Andrzej Kacprowski

Remove the profiling frequency debugfs control. Add IVPU_TEST_MODE_PROF_FREQ_HIGH to select PLL_PROFILING_FREQ_HIGH during driver initialization. High frequency profiling is for debugging purposes and it can be set at initialization time - there is no need to control it via debugfs.

Thanks, applied to drm-misc-next.