Skip to contentSkip to conversation

drm/amd/pm: Remove redundant and incorrect multi-vf check

PATCH In review Asad Kamal 3 participants 6 messages Feb 4

Subsystems (3)
lore
Share & tools
lore

Asad Kamal

author
#0 lore raw

PATCH v2 1/1 drm/amd/pm: Remove redundant and incorrect multi-vf check

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

v2: Update patch title, Remove the check (Kevin)

Fixes 166a3c735c95 ("drm/amd/pm: centralize all pp_dpm_xxx attribute nodes update cb")
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -6
index 07641c9413d2..81bef5c5aae9 100644
@@ -2057,12 +2057,6 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
 		break;
 	}
 
-	/* setting should not be allowed from VF if not in one VF mode */
-	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_is_pp_one_vf(adev)) {
-		dev_attr->attr.mode &= ~S_IWUGO;
-		dev_attr->store = NULL;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.46.0
#1 lore raw
Quoted 8 lines · Asad Kamal

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

v2: Update patch title, Remove the check (Kevin)

Fixes 166a3c735c95 ("drm/amd/pm: centralize all pp_dpm_xxx attribute nodes update cb")

You may drop any redundant multivf check in other attr_update calls also.

Thanks,
Lijo

Quoted 21 lines
---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -6
index 07641c9413d2..81bef5c5aae9 100644
@@ -2057,12 +2057,6 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
  		break;
  	}
 
-	/* setting should not be allowed from VF if not in one VF mode */
-	if (amdgpu_sriov_vf(adev) && amdgpu_sriov_is_pp_one_vf(adev)) {
-		dev_attr->attr.mode &= ~S_IWUGO;
-		dev_attr->store = NULL;
-	}
-
  	return 0;
  }
 
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 2 lines

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

I suspect there might be a misunderstanding of the code logic here. This is not redundant code. Currently, AMDGPU does not support the multi-vf case, so no sysfs node will be created for it. However, in one-vf mode, for security reasons, setting frequency information from the vf side is not allowed. Therefore, the .store interface is removed and the node permissions are configured as read-only. In conclusion, this segment of code serves a clear purpose and is by no means redundant.

Best Regards,
Kevin
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, February 4, 2026 5:31 PM
To: Kamal, Asad <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH v2] drm/amd/pm: Remove redundant and incorrect multi-vf check

Quoted 9 lines · Asad Kamal

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

v2: Update patch title, Remove the check (Kevin)

Fixes 166a3c735c95 ("drm/amd/pm: centralize all pp_dpm_xxx attribute

nodes update cb")

You may drop any redundant multivf check in other attr_update calls also.

Thanks,
Lijo

Quoted 22 lines
---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -6
index 07641c9413d2..81bef5c5aae9 100644
@@ -2057,12 +2057,6 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
              break;
      }
 
-     /* setting should not be allowed from VF if not in one VF mode */
-     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_is_pp_one_vf(adev)) {
-             dev_attr->attr.mode &= ~S_IWUGO;
-             dev_attr->store = NULL;
-     }
-
      return 0;
  }
 
#3 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Kevin,

So, you say setting should not be allowed in 1VF mode as well? Comment says otherwise

- /* setting should not be allowed from VF if not in one VF mode */

Thanks & Regards
Asad

-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, February 4, 2026 3:35 PM
To: Lazar, Lijo <[email protected]>; Kamal, Asad <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH v2] drm/amd/pm: Remove redundant and incorrect multi-vf check

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 2 lines

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

I suspect there might be a misunderstanding of the code logic here. This is not redundant code. Currently, AMDGPU does not support the multi-vf case, so no sysfs node will be created for it. However, in one-vf mode, for security reasons, setting frequency information from the vf side is not allowed. Therefore, the .store interface is removed and the node permissions are configured as read-only. In conclusion, this segment of code serves a clear purpose and is by no means redundant.

Best Regards,
Kevin
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, February 4, 2026 5:31 PM
To: Kamal, Asad <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH v2] drm/amd/pm: Remove redundant and incorrect multi-vf check

Quoted 9 lines · Asad Kamal

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

v2: Update patch title, Remove the check (Kevin)

Fixes 166a3c735c95 ("drm/amd/pm: centralize all pp_dpm_xxx attribute

nodes update cb")

You may drop any redundant multivf check in other attr_update calls also.

Thanks,
Lijo

Quoted 22 lines
---
  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -6
index 07641c9413d2..81bef5c5aae9 100644
@@ -2057,12 +2057,6 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
              break;
      }
 
-     /* setting should not be allowed from VF if not in one VF mode */
-     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_is_pp_one_vf(adev)) {
-             dev_attr->attr.mode &= ~S_IWUGO;
-             dev_attr->store = NULL;
-     }
-
      return 0;
  }
 
#4 lore raw
In reply to Wang, Yang(Kevin)
Quoted 8 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 2 lines

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

I suspect there might be a misunderstanding of the code logic here. This is not redundant code. Currently, AMDGPU does not support the multi-vf case, so no sysfs node will be created for it. However, in one-vf mode, for security reasons, setting frequency information from the vf side is not allowed.

/* setting should not be allowed from VF if not in one VF mode */

This comment is not inline to this.

The logic before this change "drm/amd/pm: centralize all pp_dpm_xxx attribute nodes update cb") also supported set frequency in 1VF mode.

- /* setting should not be allowed from VF if not in one VF mode */
- if (amdgpu_sriov_vf(adev) && (!amdgpu_sriov_is_pp_one_vf(adev) ||

-               DEVICE_ATTR_IS(pp_dpm_sclk) ||
-               DEVICE_ATTR_IS(pp_dpm_mclk) ||
-               DEVICE_ATTR_IS(pp_dpm_socclk) ||
-               DEVICE_ATTR_IS(pp_dpm_fclk) ||
-               DEVICE_ATTR_IS(pp_dpm_vclk) ||
-               DEVICE_ATTR_IS(pp_dpm_vclk1) ||
-               DEVICE_ATTR_IS(pp_dpm_dclk) ||
-               DEVICE_ATTR_IS(pp_dpm_dclk1))) {
-               dev_attr->attr.mode &= ~S_IWUGO;
-               dev_attr->store = NULL;

Thanks,
Lijo

Quoted 53 lines

Therefore, the .store interface is removed and the node permissions are configured as read-only. In conclusion, this segment of code serves a clear purpose and is by no means redundant.

Best Regards,
Kevin
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, February 4, 2026 5:31 PM
To: Kamal, Asad <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH v2] drm/amd/pm: Remove redundant and incorrect multi-vf check

Quoted 9 lines · Asad Kamal

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

v2: Update patch title, Remove the check (Kevin)

Fixes 166a3c735c95 ("drm/amd/pm: centralize all pp_dpm_xxx attribute

nodes update cb")

You may drop any redundant multivf check in other attr_update calls also.

Thanks,
Lijo

Quoted 22 lines
---
   drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ------
   1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -6
index 07641c9413d2..81bef5c5aae9 100644
@@ -2057,12 +2057,6 @@ static int pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd
               break;
       }
 
-     /* setting should not be allowed from VF if not in one VF mode */
-     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_is_pp_one_vf(adev)) {
-             dev_attr->attr.mode &= ~S_IWUGO;
-             dev_attr->store = NULL;
-     }
-
       return 0;
   }
 
#5 lore raw
Quoted 28 lines · Lijo
Quoted 8 lines · Yang(Kevin)

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 2 lines

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

I suspect there might be a misunderstanding of the code logic here. This is not redundant code. Currently, AMDGPU does not support the multi-vf case, so no sysfs node will be created for it. However, in one-vf mode, for security reasons, setting frequency information from the vf side is not allowed.

/* setting should not be allowed from VF if not in one VF mode */

This comment is not inline to this.

The logic before this change "drm/amd/pm: centralize all pp_dpm_xxx attribute nodes update cb") also supported set frequency  in 1VF mode.

-       /* setting should not be allowed from VF if not in one VF mode */ -       if (amdgpu_sriov_vf(adev) && (!amdgpu_sriov_is_pp_one_vf(adev) ||

-               DEVICE_ATTR_IS(pp_dpm_sclk) ||
-               DEVICE_ATTR_IS(pp_dpm_mclk) ||
-               DEVICE_ATTR_IS(pp_dpm_socclk) ||
-               DEVICE_ATTR_IS(pp_dpm_fclk) ||
-               DEVICE_ATTR_IS(pp_dpm_vclk) ||
-               DEVICE_ATTR_IS(pp_dpm_vclk1) ||
-               DEVICE_ATTR_IS(pp_dpm_dclk) ||
Quoted 4 lines

-               DEVICE_ATTR_IS(pp_dpm_dclk1))) {
-               dev_attr->attr.mode &= ~S_IWUGO;
-               dev_attr->store = NULL;

Ignore this. It is "(!amdgpu_sriov_is_pp_one_vf(adev) ||". Set is not allowed for these clocks in VF mode.

Thanks,
Lijo

Quoted 59 lines

Thanks,
Lijo

Quoted 54 lines

Therefore, the .store interface is removed and the node permissions are configured as read-only. In conclusion, this segment of code serves a clear purpose and is by no means redundant.

Best Regards,
Kevin
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, February 4, 2026 5:31 PM
To: Kamal, Asad <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH v2] drm/amd/pm: Remove redundant and incorrect multi-vf check

Quoted 9 lines · Asad Kamal

Remove redundant and incorrect multi-vf check for pp clock setting, as the code path will never be taken. Mask check take care of same.

v2: Update patch title, Remove the check (Kevin)

Fixes 166a3c735c95 ("drm/amd/pm: centralize all pp_dpm_xxx attribute

nodes update cb")

You may drop any redundant multivf check in other attr_update calls also.

Thanks,
Lijo

Quoted 23 lines

---
   drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ------

   1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +0 -0
index 07641c9413d2..81bef5c5aae9 100644
@@ -2057,12 +2057,6 @@ static int 

pp_dpm_clk_default_attr_update(struct amdgpu_device *adev, struct amd break;
       }

-     /* setting should not be allowed from VF if not in one VF mode */ -     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_is_pp_one_vf(adev)) { -             dev_attr->attr.mode &= ~S_IWUGO;
-             dev_attr->store = NULL;
-     }
-
       return 0;
   }