Skip to contentSkip to conversation

drm/amd/powerplay: update cached feature enablement status

PATCH In review Evan Quan 2 participants 4 messages Aug 21, 2019 – Aug 22, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: update cached feature enablement status

Need to update in cache feature enablement status after pp_feature settings. Another fix for the commit below:
drm/amd/powerplay: implment sysfs feature status function in smu

Change-Id I90e29b0d839df26825d5993212f6097c7ad4bebf
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +16 -0
index c663d25db5ab..04867cafb322 100644
@@ -96,11 +96,13 @@ size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
 
 int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask)
 {
+	struct smu_feature *feature = &smu->smu_feature;
 	int ret = 0;
 	uint32_t feature_mask[2] = { 0 };
 	uint64_t feature_2_enabled = 0;
 	uint64_t feature_2_disabled = 0;
 	uint64_t feature_enables = 0;
+	uint64_t feature_id;
 
 	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
 	if (ret)
@@ -115,11 +117,25 @@ int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask)
 		ret = smu_feature_update_enable_state(smu, feature_2_enabled, true);
 		if (ret)
 			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_enabled & (1ULL << feature_id))
+				test_and_set_bit(feature_id, feature->enabled);
+		}
+		mutex_unlock(&feature->mutex);
 	}
 	if (feature_2_disabled) {
 		ret = smu_feature_update_enable_state(smu, feature_2_disabled, false);
 		if (ret)
 			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_disabled & (1ULL << feature_id))
+				test_and_clear_bit(feature_id, feature->enabled);
+		}
+		mutex_unlock(&feature->mutex);
 	}
 
 	return ret;
Signature · 6 lines
2.23.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Evan,

this is know issue for me.
i think we should add update feature mask cached operation into smu_feature_update_enable_state function.

Best Regards,
Kevin

Quoted 44 lines · Evan Quan

Need to update in cache feature enablement status after pp_feature settings. Another fix for the commit below:
drm/amd/powerplay: implment sysfs feature status function in smu

Change-Id I90e29b0d839df26825d5993212f6097c7ad4bebf
---
  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +9 -0
index c663d25db5ab..04867cafb322 100644
@@ -96,11 +96,13 @@ size_t smu_sys_get_pp_feature_mask(struct smu_context *smu, char *buf)
 
  int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask)
  {
+	struct smu_feature *feature = &smu->smu_feature;
  	int ret = 0;
  	uint32_t feature_mask[2] = { 0 };
  	uint64_t feature_2_enabled = 0;
  	uint64_t feature_2_disabled = 0;
  	uint64_t feature_enables = 0;
+	uint64_t feature_id;
 
  	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
  	if (ret)
@@ -115,11 +117,25 @@ int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask)
  		ret = smu_feature_update_enable_state(smu, feature_2_enabled, true);
  		if (ret)
  			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_enabled & (1ULL << feature_id))
+				test_and_set_bit(feature_id, feature->enabled);
+		}
+		mutex_unlock(&feature->mutex);
  	}
  	if (feature_2_disabled) {
  		ret = smu_feature_update_enable_state(smu, feature_2_disabled, false);
  		if (ret)
  			return ret;

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask) · line 141

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_disabled & (1ULL << feature_id))
+				test_and_clear_bit(feature_id, feature->enabled);
+		}
+		mutex_unlock(&feature->mutex);
  	}
 
  	return ret;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 861ead73-5ce2-ea37-746d-bc82b79d9b88-5C7GfCeVMHo@public.gmane.org

author
#4 lore raw

Please check V2.

Quoted 80 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kevin Wang
Sent: Wednesday, August 21, 2019 7:45 PM
To: [email protected]
Subject: Re: [PATCH] drm/amd/powerplay: update cached feature enablement status

Hi Evan,

this is know issue for me.
i think we should add update feature mask cached operation into smu_feature_update_enable_state function.

Best Regards,
Kevin

Quoted 8 lines · Evan Quan

Need to update in cache feature enablement status after pp_feature settings. Another fix for the commit below:
drm/amd/powerplay: implment sysfs feature status function in smu

Change-Id I90e29b0d839df26825d5993212f6097c7ad4bebf
---
  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 16

++++++++++++++++

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c size_t smu_sys_get_pp_feature_mask(struct · line 98

Quoted 11 lines
  1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index c663d25db5ab..04867cafb322 100644
@@ -96,11 +96,13 @@ size_t smu_sys_get_pp_feature_mask(struct
 smu_context *smu, char *buf)
 
  int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t

new_mask)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct

Quoted 12 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
  {
+	struct smu_feature *feature = &smu->smu_feature;
  	int ret = 0;
  	uint32_t feature_mask[2] = { 0 };
  	uint64_t feature_2_enabled = 0;
  	uint64_t feature_2_disabled = 0;
  	uint64_t feature_enables = 0;
+	uint64_t feature_id;
 
  	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);

if (ret)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
@@ -115,11 +117,25 @@ int smu_sys_set_pp_feature_mask(struct

smu_context *smu, uint64_t new_mask)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct · line 117

Quoted 1 line
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
  		ret = smu_feature_update_enable_state(smu,

feature_2_enabled, true);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask)

Quoted 13 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
  		if (ret)
  			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_enabled & (1ULL << feature_id))
+				test_and_set_bit(feature_id, feature-
 enabled);
+		}
+		mutex_unlock(&feature->mutex);
  	}
  	if (feature_2_disabled) {
  		ret = smu_feature_update_enable_state(smu,

feature_2_disabled, false);

Quoted 12 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
  		if (ret)
  			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_disabled & (1ULL << feature_id))
+				test_and_clear_bit(feature_id, feature-
 enabled);
+		}
+		mutex_unlock(&feature->mutex);
  	}
Quoted 5 lines
Quoted 1 line

return ret;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#5 lore raw
In reply to a message not in the archive

Please check V2.

Quoted 80 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kevin Wang
Sent: Wednesday, August 21, 2019 7:45 PM
To: [email protected]
Subject: Re: [PATCH] drm/amd/powerplay: update cached feature enablement status

Hi Evan,

this is know issue for me.
i think we should add update feature mask cached operation into smu_feature_update_enable_state function.

Best Regards,
Kevin

Quoted 8 lines · Evan Quan

Need to update in cache feature enablement status after pp_feature settings. Another fix for the commit below:
drm/amd/powerplay: implment sysfs feature status function in smu

Change-Id I90e29b0d839df26825d5993212f6097c7ad4bebf
---
  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 16

++++++++++++++++

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c size_t smu_sys_get_pp_feature_mask(struct · line 98

Quoted 11 lines
  1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
index c663d25db5ab..04867cafb322 100644
@@ -96,11 +96,13 @@ size_t smu_sys_get_pp_feature_mask(struct
 smu_context *smu, char *buf)
 
  int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t

new_mask)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct

Quoted 12 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
  {
+	struct smu_feature *feature = &smu->smu_feature;
  	int ret = 0;
  	uint32_t feature_mask[2] = { 0 };
  	uint64_t feature_2_enabled = 0;
  	uint64_t feature_2_disabled = 0;
  	uint64_t feature_enables = 0;
+	uint64_t feature_id;
 
  	ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);

if (ret)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
@@ -115,11 +117,25 @@ int smu_sys_set_pp_feature_mask(struct

smu_context *smu, uint64_t new_mask)

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct · line 117

Quoted 1 line
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +0 -0
  		ret = smu_feature_update_enable_state(smu,

feature_2_enabled, true);

drivers/gpu/drm/amd/powerplay/amdgpu_smu.c int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask)

Quoted 13 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
  		if (ret)
  			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_enabled & (1ULL << feature_id))
+				test_and_set_bit(feature_id, feature-
 enabled);
+		}
+		mutex_unlock(&feature->mutex);
  	}
  	if (feature_2_disabled) {
  		ret = smu_feature_update_enable_state(smu,

feature_2_disabled, false);

Quoted 12 lines
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +7 -0
  		if (ret)
  			return ret;
+
+		mutex_lock(&feature->mutex);
+		for (feature_id = 0; feature_id < 64; feature_id++) {
+			if (feature_2_disabled & (1ULL << feature_id))
+				test_and_clear_bit(feature_id, feature-
 enabled);
+		}
+		mutex_unlock(&feature->mutex);
  	}
Quoted 5 lines
Quoted 1 line

return ret;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx