Skip to contentSkip to conversation

Revert "drm/amdgpu: add param to specify fw bo location for front-door loading"

PATCH In review Le Ma 3 participants 5 messages Jan 9, 2024 – Jan 10, 2024

Subsystems (2)
lore
Share & tools
lore

Le Ma

author
#0 lore raw

PATCH 1/3 Revert "drm/amdgpu: add param to specify fw bo location for front-door loading"

This reverts commit 1797d97a977280ac2cec95b1b59acc5856fea11e.

Will use debug module param instead of independent module param.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 5 -----
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +--
 4 files changed, 2 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index 9da14436a373..616b6c911767 100644
@@ -254,8 +254,6 @@ extern int amdgpu_agp;
 
 extern int amdgpu_wbrf;
 
-extern int fw_bo_location;
-
 #define AMDGPU_VM_MAX_NUM_CTX			4096
 #define AMDGPU_SG_THRESHOLD			(256*1024*1024)
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -5
index 852cec98ff26..880137774b4e 100644
@@ -210,7 +210,6 @@ int amdgpu_seamless = -1; /* auto */
 uint amdgpu_debug_mask;
 int amdgpu_agp = -1; /* auto */
 int amdgpu_wbrf = -1;
-int fw_bo_location = -1;
 
 static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);
 
@@ -990,10 +989,6 @@ MODULE_PARM_DESC(wbrf,
 	"Enable Wifi RFI interference mitigation (0 = disabled, 1 = enabled, -1 = auto(default)");
 module_param_named(wbrf, amdgpu_wbrf, int, 0444);
 
-MODULE_PARM_DESC(fw_bo_location,
-	"location to put firmware bo for frontdoor loading (-1 = auto (default), 0 = on ram, 1 = on vram");
-module_param(fw_bo_location, int, 0644);
-
 /* These devices are not supported by amdgpu.
  * They are supported by the mach64, r128, radeon drivers
  */
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
index 0993ba4a4476..51bfe3757c89 100644
@@ -467,7 +467,7 @@ static int psp_sw_init(void *handle)
 	}
 
 	ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
-				      (amdgpu_sriov_vf(adev) || fw_bo_location == 1) ?
+				      amdgpu_sriov_vf(adev) ?
 				      AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
 				      &psp->fw_pri_bo,
 				      &psp->fw_pri_mc_addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -2
index d334e42fe0eb..0efb2568cb65 100644
@@ -1062,8 +1062,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
 {
 	if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
 		amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
-			(amdgpu_sriov_vf(adev) || fw_bo_location == 1) ?
-			AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
+			amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
 			&adev->firmware.fw_buf,
 			&adev->firmware.fw_buf_mc,
 			&adev->firmware.fw_buf_ptr);
Signature · 1 line
2.38.1
author
#1 lore raw

PATCH 2/3 drm/amdgpu: add debug flag to change fw bo placement for frontdoor loading

se debug_mask=0x8 param to help isolating data path issues on new systems in early phase.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 ++-
 4 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 616b6c911767..c740825cf5dc 100644
@@ -1144,6 +1144,7 @@ struct amdgpu_device {
 	bool                            debug_vm;
 	bool                            debug_largebar;
 	bool                            debug_disable_soft_recovery;
+	bool                            debug_change_fw_placement;
 };
 
 static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6 -0
index 880137774b4e..3e0e39a1b5ba 100644
@@ -128,6 +128,7 @@ enum AMDGPU_DEBUG_MASK {
 	AMDGPU_DEBUG_VM = BIT(0),
 	AMDGPU_DEBUG_LARGEBAR = BIT(1),
 	AMDGPU_DEBUG_DISABLE_GPU_SOFT_RECOVERY = BIT(2),
+	AMDGPU_DEBUG_CHANGE_FW_PLACEMENT = BIT(3),
 };
 
 unsigned int amdgpu_vram_limit = UINT_MAX;
@@ -2117,6 +2118,11 @@ static void amdgpu_init_debug_options(struct amdgpu_device *adev)
 		pr_info("debug: soft reset for GPU recovery disabled\n");
 		adev->debug_disable_soft_recovery = true;
 	}
+
+	if (amdgpu_debug_mask & AMDGPU_DEBUG_CHANGE_FW_PLACEMENT) {
+		pr_info("debug: place fw in vram for frontdoor loading\n");
+		adev->debug_change_fw_placement = true;
+	}
 }
 
 static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long flags)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
index 51bfe3757c89..a9f2d33fa54b 100644
@@ -467,7 +467,7 @@ static int psp_sw_init(void *handle)
 	}
 
 	ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
-				      amdgpu_sriov_vf(adev) ?
+				      (amdgpu_sriov_vf(adev) || adev->debug_change_fw_placement) ?
 				      AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
 				      &psp->fw_pri_bo,
 				      &psp->fw_pri_mc_addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +2 -1
index 0efb2568cb65..8d36a7c1c789 100644
@@ -1062,7 +1062,8 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
 {
 	if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
 		amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
-			amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
+			(amdgpu_sriov_vf(adev) || adev->debug_change_fw_placement) ?
+			AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
 			&adev->firmware.fw_buf,
 			&adev->firmware.fw_buf_mc,
 			&adev->firmware.fw_buf_ptr);
Signature · 1 line
2.38.1
#2 lore raw

Re: [PATCH 2/3] drm/amdgpu: add debug flag to change fw bo placement for frontdoor loading

Quoted 28 lines · On 1/9/2024 3:43 PM, Le Ma wrote:

se debug_mask=0x8 param to help isolating data path issues on new systems in early phase.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h       | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c   | 2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 ++-
  4 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 616b6c911767..c740825cf5dc 100644
@@ -1144,6 +1144,7 @@ struct amdgpu_device {
  	bool                            debug_vm;
  	bool                            debug_largebar;
  	bool                            debug_disable_soft_recovery;
+	bool                            debug_change_fw_placement;
  };
 
  static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 880137774b4e..3e0e39a1b5ba 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c enum AMDGPU_DEBUG_MASK { · line 131

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
@@ -128,6 +128,7 @@ enum AMDGPU_DEBUG_MASK {
  	AMDGPU_DEBUG_VM = BIT(0),
  	AMDGPU_DEBUG_LARGEBAR = BIT(1),
  	AMDGPU_DEBUG_DISABLE_GPU_SOFT_RECOVERY = BIT(2),
+	AMDGPU_DEBUG_CHANGE_FW_PLACEMENT = BIT(3),

Instead of a generic "change", better to explicitly mention the placement location of FW intended by this flag - like AMDGPU_DEBUG_USE_VRAM_FW_BUF or similar.

Thanks,
Lijo

Quoted 42 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
  };
 
  unsigned int amdgpu_vram_limit = UINT_MAX;
@@ -2117,6 +2118,11 @@ static void amdgpu_init_debug_options(struct amdgpu_device *adev)
  		pr_info("debug: soft reset for GPU recovery disabled\n");
  		adev->debug_disable_soft_recovery = true;
  	}
+
+	if (amdgpu_debug_mask & AMDGPU_DEBUG_CHANGE_FW_PLACEMENT) {
+		pr_info("debug: place fw in vram for frontdoor loading\n");
+		adev->debug_change_fw_placement = true;
+	}
  }
 
  static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long flags)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
index 51bfe3757c89..a9f2d33fa54b 100644
@@ -467,7 +467,7 @@ static int psp_sw_init(void *handle)
  	}
 
  	ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
-				      amdgpu_sriov_vf(adev) ?
+				      (amdgpu_sriov_vf(adev) || adev->debug_change_fw_placement) ?
  				      AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
  				      &psp->fw_pri_bo,
  				      &psp->fw_pri_mc_addr,
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +2 -1
index 0efb2568cb65..8d36a7c1c789 100644
@@ -1062,7 +1062,8 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
  {
  	if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
  		amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
-			amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
+			(amdgpu_sriov_vf(adev) || adev->debug_change_fw_placement) ?
+			AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
  			&adev->firmware.fw_buf,
  			&adev->firmware.fw_buf_mc,
  			&adev->firmware.fw_buf_ptr);
author
#3 lore raw

PATCH 3/3 drm/amdgpu: move debug options init prior to amdgpu device init

In reply to Le Ma

To bring debug options into effect in early initialization phase

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -2
index 3e0e39a1b5ba..b67ffc3a9a3f 100644
@@ -2234,6 +2234,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 
 	pci_set_drvdata(pdev, ddev);
 
+	amdgpu_init_debug_options(adev);
+
 	ret = amdgpu_driver_load_kms(adev, flags);
 	if (ret)
 		goto err_pci;
@@ -2314,8 +2316,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 			amdgpu_get_secondary_funcs(adev);
 	}
 
-	amdgpu_init_debug_options(adev);
-
 	return 0;
 
 err_pci:
Signature · 1 line
2.38.1
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/amdgpu: move debug options init prior to amdgpu device init

Am 09.01.24 um 11:13 schrieb Le Ma:

Quoted 3 lines

To bring debug options into effect in early initialization phase

Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -2
index 3e0e39a1b5ba..b67ffc3a9a3f 100644
@@ -2234,6 +2234,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 
  	pci_set_drvdata(pdev, ddev);
 
+	amdgpu_init_debug_options(adev);
+
  	ret = amdgpu_driver_load_kms(adev, flags);
  	if (ret)
  		goto err_pci;
@@ -2314,8 +2316,6 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
  			amdgpu_get_secondary_funcs(adev);
  	}
 
-	amdgpu_init_debug_options(adev);
-
  	return 0;
 
  err_pci: