Skip to contentSkip to conversation

drm/amd/pm: correct the gpo control for sienna cichlid

PATCH In review Evan Quan 2 participants 8 messages Dec 8, 2020 – Dec 9, 2020

Subsystems (3)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/6 drm/amd/pm: correct the gpo control for sienna cichlid

New SMC message was introduced for gpo control on sienna cichlid.

Change-Id I6f09ae96e9dd7a290c9975564740f597a08ff2fa
---
 drivers/gpu/drm/amd/pm/inc/smu_types.h        |  1 +
 .../gpu/drm/amd/pm/inc/smu_v11_0_7_ppsmc.h    |  4 +-
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 42 ++++++++++++++-----
 3 files changed, 36 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/pm/inc/smu_types.h +1 -0
index 745b04730428..c79ad184503e 100644
@@ -209,6 +209,7 @@
        __SMU_DUMMY_MAP(SetSoftMinCclk),                     \
        __SMU_DUMMY_MAP(SetSoftMaxCclk),                     \
 	__SMU_DUMMY_MAP(SetGpoFeaturePMask),             \
+	__SMU_DUMMY_MAP(DisallowGpo),                    \
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/inc/smu_v11_0_7_ppsmc.h +3 -1
index 35dd6072cc45..dad2832ff3b1 100644
@@ -134,6 +134,8 @@
 #define PPSMC_MSG_SetGpoFeaturePMask             0x45
 #define PPSMC_MSG_SetSMBUSInterrupt              0x46
 
-#define PPSMC_Message_Count                      0x47
+#define PPSMC_MSG_DisallowGpo                    0x56
+
+#define PPSMC_Message_Count                      0x58
 
 #endif
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +32 -10

57 lines not on this page · raw message

Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 2/6 drm/amd/pm: expose the firmware_capability from firmware_info table

That will help to determine whether 2ND_USB20_PORT workaround is needed for Sienna Cichlid.

Change-Id I3852e7c8cb11c12845ca81e7967e332c499cb470
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h        | 1 +
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1 -0
index 971c7fe4af37..cb96466605d5 100644
@@ -227,6 +227,7 @@ struct smu_bios_boot_up_values
 	uint32_t			content_revision;
 	uint32_t			fclk;
 	uint32_t			lclk;
+	uint32_t			firmware_caps;
 };
 
 enum smu_table_id
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -0
index f2565eed469f..45ecd0386e9f 100644
@@ -554,6 +554,7 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)
 		smu->smu_table.boot_values.vdd_gfx = v_3_1->bootup_vddgfx_mv;
 		smu->smu_table.boot_values.cooling_id = v_3_1->coolingsolution_id;
 		smu->smu_table.boot_values.pp_table_id = 0;
+		smu->smu_table.boot_values.firmware_caps = v_3_1->firmware_capability;
 		break;
 	case 3:
 	default:
@@ -569,6 +570,7 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)
 		smu->smu_table.boot_values.vdd_gfx = v_3_3->bootup_vddgfx_mv;
 		smu->smu_table.boot_values.cooling_id = v_3_3->coolingsolution_id;
 		smu->smu_table.boot_values.pp_table_id = v_3_3->pplib_pptable_id;
+		smu->smu_table.boot_values.firmware_caps = v_3_3->firmware_capability;
 	}
 
 	smu->smu_table.boot_values.format_revision = header->format_revision;
Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#2 lore raw

PATCH 3/6 drm/amdgpu: new macro for determining 2ND_USB20PORT support

In reply to Evan Quan

Used for determining 2ND_USB20PORT support from firmware_capability.

Change-Id I3ff37f0a0dab311566bdd0aba189f2b7fa89ec2c
---
 drivers/gpu/drm/amd/include/atomfirmware.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/atomfirmware.h +1 -0
index c38635992101..3cb8d4c5c1a3 100644
@@ -499,6 +499,7 @@ enum atombios_firmware_capability
 	ATOM_FIRMWARE_CAP_HWEMU_UMC_CFG = 0x00000100,
 	ATOM_FIRMWARE_CAP_SRAM_ECC      = 0x00000200,
 	ATOM_FIRMWARE_CAP_ENABLE_2STAGE_BIST_TRAINING  = 0x00000400,
+	ATOM_FIRMWARE_CAP_ENABLE_2ND_USB20PORT = 0x0008000,
 };
 
 enum atom_cooling_solution_id{
Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 4/6 drm/amd/pm: new SMC message for 2nd usb2.0 port workaround

In reply to Evan Quan

The workaround is needed by sienna cichlid.

Change-Id Ib3d065b53dcb331d085e9bb9eeda99021a212206
---
 drivers/gpu/drm/amd/pm/inc/smu_types.h                  | 1 +
 drivers/gpu/drm/amd/pm/inc/smu_v11_0_7_ppsmc.h          | 2 ++
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 1 +
 3 files changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/inc/smu_types.h +1 -0
index c79ad184503e..13d332a175fd 100644
@@ -210,6 +210,7 @@
        __SMU_DUMMY_MAP(SetSoftMaxCclk),                     \
 	__SMU_DUMMY_MAP(SetGpoFeaturePMask),             \
 	__SMU_DUMMY_MAP(DisallowGpo),                    \
+	__SMU_DUMMY_MAP(Enable2ndUSB20Port),             \
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/inc/smu_v11_0_7_ppsmc.h +2 -0
index dad2832ff3b1..d2e10a724560 100644
@@ -136,6 +136,8 @@
 
 #define PPSMC_MSG_DisallowGpo                    0x56
 
+#define PPSMC_MSG_Enable2ndUSB20Port             0x57
+
 #define PPSMC_Message_Count                      0x58
 
 #endif
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
index 7e8aa5f7c0c9..47d4f92d5ead 100644
@@ -129,6 +129,7 @@ static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
 	MSG_MAP(SetMGpuFanBoostLimitRpm,	PPSMC_MSG_SetMGpuFanBoostLimitRpm,     0),
 	MSG_MAP(SetGpoFeaturePMask,		PPSMC_MSG_SetGpoFeaturePMask,          0),
 	MSG_MAP(DisallowGpo,			PPSMC_MSG_DisallowGpo,                 0),
+	MSG_MAP(Enable2ndUSB20Port,		PPSMC_MSG_Enable2ndUSB20Port,          0),
 };
 
 static struct cmn2asic_mapping sienna_cichlid_clk_map[SMU_CLK_COUNT] = {
Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 5/6 drm/amd/pm: wrapper for applying 2nd usb2.0 port workaround

In reply to Evan Quan

2nd usb2.0 port workaround wrapper.

Change-Id I615d8a568b1f6623a060ba5081c2d2a1235f32b9
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h     | 1 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c   | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1 -0
index cb96466605d5..3d6af881f507 100644
@@ -601,6 +601,7 @@ struct pptable_funcs {
 	int (*gpo_control)(struct smu_context *smu, bool enablement);
 	int (*gfx_state_change_set)(struct smu_context *smu, uint32_t state);
 	int (*set_fine_grain_gfx_freq_parameters)(struct smu_context *smu);
+	int (*notify_2nd_usb20_port)(struct smu_context *smu);
 };
 
 typedef enum {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index e6ae722ca6e6..3515203df2c5 100644
@@ -935,6 +935,12 @@ static int smu_smc_hw_setup(struct smu_context *smu)
 		return ret;
 	}
 
+	ret = smu_notify_2nd_usb20_port(smu);
+	if (ret) {
+		dev_err(adev->dev, "Failed to notify 2nd usb2.0 port!\n");
+		return ret;
+	}
+
 	ret = smu_set_driver_table_location(smu);
 	if (ret) {
 		dev_err(adev->dev, "Failed to SetDriverDramAddr!\n");
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -0
index 68d9464ababc..2eaec41dc808 100644
@@ -91,6 +91,7 @@
 #define smu_post_init(smu)						smu_ppt_funcs(post_init, 0, smu)
 #define smu_gpo_control(smu, enablement)				smu_ppt_funcs(gpo_control, 0, smu, enablement)
 #define smu_set_fine_grain_gfx_freq_parameters(smu)					smu_ppt_funcs(set_fine_grain_gfx_freq_parameters, 0, smu)
+#define smu_notify_2nd_usb20_port(smu)					smu_ppt_funcs(notify_2nd_usb20_port, 0, smu)
 
 #endif
 #endif
Signature · 6 lines
2.29.0

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

RE: [PATCH 5/6] drm/amd/pm: wrapper for applying 2nd usb2.0 port workaround

[AMD Public Use]

Rather than introduce this as a generic step in amdgpu_smu, confine the work around only to sienna cichlid. For ex: this may be done just before enabling dpm with system_features control override.

Thanks,
Lijo

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Tuesday, December 8, 2020 1:58 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 5/6] drm/amd/pm: wrapper for applying 2nd usb2.0 port workaround

[CAUTION: External Email]

2nd usb2.0 port workaround wrapper.

Change-Id I615d8a568b1f6623a060ba5081c2d2a1235f32b9
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h     | 1 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c   | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1 -0
index cb96466605d5..3d6af881f507 100644
@@ -601,6 +601,7 @@ struct pptable_funcs {
        int (*gpo_control)(struct smu_context *smu, bool enablement);
        int (*gfx_state_change_set)(struct smu_context *smu, uint32_t state);
        int (*set_fine_grain_gfx_freq_parameters)(struct smu_context *smu);
+       int (*notify_2nd_usb20_port)(struct smu_context *smu);
 };
 
 typedef enum {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index e6ae722ca6e6..3515203df2c5 100644
@@ -935,6 +935,12 @@ static int smu_smc_hw_setup(struct smu_context *smu)
                return ret;
        }
 
+       ret = smu_notify_2nd_usb20_port(smu);
+       if (ret) {
+               dev_err(adev->dev, "Failed to notify 2nd usb2.0 port!\n");
+               return ret;
+       }
+
        ret = smu_set_driver_table_location(smu);
        if (ret) {
                dev_err(adev->dev, "Failed to SetDriverDramAddr!\n"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h b/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h

index 68d9464ababc..2eaec41dc808 100644

drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -0
@@ -91,6 +91,7 @@
 #define smu_post_init(smu)                                             smu_ppt_funcs(post_init, 0, smu)
 #define smu_gpo_control(smu, enablement)                               smu_ppt_funcs(gpo_control, 0, smu, enablement)
 #define smu_set_fine_grain_gfx_freq_parameters(smu)                                    smu_ppt_funcs(set_fine_grain_gfx_freq_parameters, 0, smu)
+#define smu_notify_2nd_usb20_port(smu)                                 smu_ppt_funcs(notify_2nd_usb20_port, 0, smu)
 
 #endif
 #endif

--
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Clijo.lazar%40amd.com%7C4e916532c7584fc543d808d89b5334b5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637430128956487556%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=BnxEAwGyn7th3u271jiCPfsc03729IfZWvMpzGwhuWY%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#6 lore raw

RE: [PATCH 5/6] drm/amd/pm: wrapper for applying 2nd usb2.0 port workaround

Thanks. Addressed in the new patch series.

BR
Evan
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, December 8, 2020 6:34 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: RE: [PATCH 5/6] drm/amd/pm: wrapper for applying 2nd usb2.0 port workaround

[AMD Public Use]

Rather than introduce this as a generic step in amdgpu_smu, confine the work around only to sienna cichlid. For ex: this may be done just before enabling dpm with system_features control override.

Thanks,
Lijo

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Tuesday, December 8, 2020 1:58 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 5/6] drm/amd/pm: wrapper for applying 2nd usb2.0 port workaround

[CAUTION: External Email]

2nd usb2.0 port workaround wrapper.

Change-Id I615d8a568b1f6623a060ba5081c2d2a1235f32b9
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h     | 1 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c   | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +1 -0
index cb96466605d5..3d6af881f507 100644
@@ -601,6 +601,7 @@ struct pptable_funcs {
        int (*gpo_control)(struct smu_context *smu, bool enablement);
        int (*gfx_state_change_set)(struct smu_context *smu, uint32_t state);
        int (*set_fine_grain_gfx_freq_parameters)(struct smu_context *smu);
+       int (*notify_2nd_usb20_port)(struct smu_context *smu);
 };
 
 typedef enum {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index e6ae722ca6e6..3515203df2c5 100644
@@ -935,6 +935,12 @@ static int smu_smc_hw_setup(struct smu_context *smu)
                return ret;
        }
 
+       ret = smu_notify_2nd_usb20_port(smu);
+       if (ret) {
+               dev_err(adev->dev, "Failed to notify 2nd usb2.0 port!\n");
+               return ret;
+       }
+
        ret = smu_set_driver_table_location(smu);
        if (ret) {
                dev_err(adev->dev, "Failed to SetDriverDramAddr!\n"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h b/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h

index 68d9464ababc..2eaec41dc808 100644

drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -0
@@ -91,6 +91,7 @@
 #define smu_post_init(smu)                                             smu_ppt_funcs(post_init, 0, smu)
 #define smu_gpo_control(smu, enablement)                               smu_ppt_funcs(gpo_control, 0, smu, enablement)
 #define smu_set_fine_grain_gfx_freq_parameters(smu)                                    smu_ppt_funcs(set_fine_grain_gfx_freq_parameters, 0, smu)
+#define smu_notify_2nd_usb20_port(smu)                                 smu_ppt_funcs(notify_2nd_usb20_port, 0, smu)
 
 #endif
 #endif

--
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Clijo.lazar%40amd.com%7C4e916532c7584fc543d808d89b5334b5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637430128956487556%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=BnxEAwGyn7th3u271jiCPfsc03729IfZWvMpzGwhuWY%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#7 lore raw

PATCH 6/6 drm/amd/pm: fulfill sienna cichlid 2nd usb2.0 port workaround

In reply to Evan Quan

Fulfill the 2nd usb2.0 port workaround for sienna cichlid.

Change-Id I912660ee590e9ce352a20bbdf8903a61f88cd59e
---
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +25 -0
index 47d4f92d5ead..48b9787cfb78 100644
@@ -3247,6 +3247,30 @@ static int sienna_cichlid_gpo_control(struct smu_context *smu,
 
 	return ret;
 }
+
+static int sienna_cichlid_notify_2nd_usb20_port(struct smu_context *smu)
+{
+	uint32_t smu_version;
+	int ret = 0;
+
+	ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
+	if (ret)
+		return ret;
+
+	/*
+	 * Message SMU_MSG_Enable2ndUSB20Port is supported by 58.45
+	 * onwards PMFWs.
+	 */
+	if (smu_version < 0x003A2D00)
+		return 0;
+
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_Enable2ndUSB20Port,
+					       smu->smu_table.boot_values.firmware_caps & ATOM_FIRMWARE_CAP_ENABLE_2ND_USB20PORT ?
+					       1 : 0,
+					       NULL);
+}
+
 static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
 	.get_allowed_feature_mask = sienna_cichlid_get_allowed_feature_mask,
 	.set_default_dpm_table = sienna_cichlid_set_default_dpm_table,
@@ -3332,6 +3356,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
 	.get_fan_parameters = sienna_cichlid_get_fan_parameters,
 	.interrupt_work = smu_v11_0_interrupt_work,
 	.gpo_control = sienna_cichlid_gpo_control,
+	.notify_2nd_usb20_port = sienna_cichlid_notify_2nd_usb20_port,
 };
 
 void sienna_cichlid_set_ppt_funcs(struct smu_context *smu)
Signature · 6 lines
2.29.0

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