All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: Add ReadSerial defines for Arcturus
@ 2020-06-02 12:53 Kent Russell
  2020-06-02 12:53 ` [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for Arcturus v2 Kent Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Kent Russell @ 2020-06-02 12:53 UTC (permalink / raw)
  To: amd-gfx; +Cc: Kent Russell

Add the ReadSerial definitions for Arcturus to the arcturus_ppsmc.h
header for use with unique_id

Unrevert: Supported in SMU 54.23, update values to match SMU spec

Signed-off-by: Kent Russell <kent.russell@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Change-Id: I9a70368ea65b898b3c26f0d57dc088f21dab9c53
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c       | 2 ++
 drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 302b7e9cb5ba..d66ac7457574 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -129,6 +129,8 @@ static struct smu_11_0_msg_mapping arcturus_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(SetMemoryChannelEnable,		     PPSMC_MSG_SetMemoryChannelEnable,		0),
 	MSG_MAP(DFCstateControl,		     PPSMC_MSG_DFCstateControl,			0),
 	MSG_MAP(GmiPwrDnControl,		     PPSMC_MSG_GmiPwrDnControl,			0),
+	MSG_MAP(ReadSerialNumTop32,		     PPSMC_MSG_ReadSerialNumTop32,		1),
+	MSG_MAP(ReadSerialNumBottom32,		     PPSMC_MSG_ReadSerialNumBottom32,		1),
 };
 
 static struct smu_11_0_cmn2aisc_mapping arcturus_clk_map[SMU_CLK_COUNT] = {
diff --git a/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
index e07478b6ac04..79afb132164e 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/arcturus_ppsmc.h
@@ -117,6 +117,9 @@
 #define PPSMC_MSG_GmiPwrDnControl                0x3D
 #define PPSMC_Message_Count                      0x3E
 
+#define PPSMC_MSG_ReadSerialNumTop32		 0x40
+#define PPSMC_MSG_ReadSerialNumBottom32		 0x41
+
 typedef uint32_t PPSMC_Result;
 typedef uint32_t PPSMC_Msg;
 #pragma pack(pop)
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for Arcturus v2
  2020-06-02 12:53 [PATCH 1/2] drm/amdgpu: Add ReadSerial defines for Arcturus Kent Russell
@ 2020-06-02 12:53 ` Kent Russell
  2020-06-02 14:45   ` Alex Deucher
  0 siblings, 1 reply; 4+ messages in thread
From: Kent Russell @ 2020-06-02 12:53 UTC (permalink / raw)
  To: amd-gfx; +Cc: Kent Russell

Add support for unique_id and serial_number, as these are now
the same value, and will be for future ASICs as well.

v2: Explicitly create unique_id only for VG10/20/ARC

Signed-off-by: Kent Russell <kent.russell@amd.com>
Change-Id: I3b036a38b19cd84025399b0706b2dad9b7aff713
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  4 ++-
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  2 ++
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 32 +++++++++++++++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
 drivers/gpu/drm/amd/powerplay/smu_internal.h  |  2 ++
 5 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index b0dff9ecfb88..b2cdc8a1268f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1940,7 +1940,9 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
 		if (adev->flags & AMD_IS_APU)
 			*states = ATTR_STATE_UNSUPPORTED;
 	} else if (DEVICE_ATTR_IS(unique_id)) {
-		if (!adev->unique_id)
+		if (asic_type != CHIP_VEGA10 &&
+		    asic_type != CHIP_VEGA20 &&
+		    asic_type != CHIP_ARCTURUS)
 			*states = ATTR_STATE_UNSUPPORTED;
 	} else if (DEVICE_ATTR_IS(pp_features)) {
 		if (adev->flags & AMD_IS_APU || asic_type < CHIP_VEGA10)
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 5294aa7cdde1..7946fd8444a3 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -793,6 +793,8 @@ static int smu_late_init(void *handle)
 	if (!smu->pm_enabled)
 		return 0;
 
+	smu_set_unique_id(smu);
+
 	smu_handle_task(&adev->smu,
 			smu->smu_dpm.dpm_level,
 			AMD_PP_TASK_COMPLETE_INIT,
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index d66ac7457574..855e609650d9 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2262,6 +2262,37 @@ static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)
 	i2c_del_adapter(control);
 }
 
+static void arcturus_set_unique_id(struct smu_context *smu)
+{
+	struct amdgpu_device *adev = smu->adev;
+	uint32_t top32, bottom32, smu_version, size;
+	char sn[16];
+	uint64_t id;
+
+	if (smu_get_smc_version(smu, NULL, &smu_version)) {
+		pr_warn("Failed to get smu version, cannot get unique_id or serial_number\n");
+		return;
+	}
+
+	/* PPSMC_MSG_ReadSerial* is supported by 54.23.0 and onwards */
+	if (smu_version < 0x361700) {
+		pr_warn("ReadSerial is only supported by PMFW 54.23.0 and onwards\n");
+		return;
+	}
+
+	/* Get the SN to turn into a Unique ID */
+	smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32, &top32);
+	smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumBottom32, &bottom32);
+
+	id = ((uint64_t)bottom32 << 32) | top32;
+	adev->unique_id = id;
+	/* For Arcturus-and-later, unique_id == serial_number, so convert it to a
+	 * 16-digit HEX string for convenience and backwards-compatibility
+	 */
+	size = sprintf(sn, "%llx", id);
+	memcpy(adev->serial, &sn, size);
+}
+
 static bool arcturus_is_baco_supported(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
@@ -2416,6 +2447,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
 	.dpm_set_uvd_enable = arcturus_dpm_set_uvd_enable,
 	.i2c_eeprom_init = arcturus_i2c_eeprom_control_init,
 	.i2c_eeprom_fini = arcturus_i2c_eeprom_control_fini,
+	.set_unique_id = arcturus_set_unique_id,
 	.init_microcode = smu_v11_0_init_microcode,
 	.load_microcode = smu_v11_0_load_microcode,
 	.init_smc_tables = smu_v11_0_init_smc_tables,
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 5bb1ac821aeb..bfa5211de079 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -495,6 +495,7 @@ struct pptable_funcs {
 	int (*update_pcie_parameters)(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap);
 	int (*i2c_eeprom_init)(struct i2c_adapter *control);
 	void (*i2c_eeprom_fini)(struct i2c_adapter *control);
+	void (*set_unique_id)(struct smu_context *smu);
 	int (*get_dpm_clock_table)(struct smu_context *smu, struct dpm_clocks *clock_table);
 	int (*init_microcode)(struct smu_context *smu);
 	int (*load_microcode)(struct smu_context *smu);
diff --git a/drivers/gpu/drm/amd/powerplay/smu_internal.h b/drivers/gpu/drm/amd/powerplay/smu_internal.h
index 6c59eeef2590..125d976215a6 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_internal.h
+++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h
@@ -218,6 +218,8 @@ static inline int smu_send_smc_msg(struct smu_context *smu, enum smu_message_typ
 		((smu)->ppt_funcs->i2c_eeprom_init ? (smu)->ppt_funcs->i2c_eeprom_init((control)) : 0)
 #define smu_i2c_eeprom_fini(smu, control) \
 		((smu)->ppt_funcs->i2c_eeprom_fini ? (smu)->ppt_funcs->i2c_eeprom_fini((control)) : 0)
+#define smu_set_unique_id(smu) \
+		((smu)->ppt_funcs->set_unique_id ? (smu)->ppt_funcs->set_unique_id((smu)) : 0)
 
 #define smu_log_thermal_throttling(smu) \
 		((smu)->ppt_funcs->log_thermal_throttling_event ? (smu)->ppt_funcs->log_thermal_throttling_event((smu)) : 0)
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for Arcturus v2
  2020-06-02 12:53 ` [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for Arcturus v2 Kent Russell
@ 2020-06-02 14:45   ` Alex Deucher
  2020-06-02 15:49     ` Russell, Kent
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2020-06-02 14:45 UTC (permalink / raw)
  To: Kent Russell; +Cc: amd-gfx list

On Tue, Jun 2, 2020 at 8:53 AM Kent Russell <kent.russell@amd.com> wrote:
>
> Add support for unique_id and serial_number, as these are now
> the same value, and will be for future ASICs as well.
>
> v2: Explicitly create unique_id only for VG10/20/ARC
>
> Signed-off-by: Kent Russell <kent.russell@amd.com>
> Change-Id: I3b036a38b19cd84025399b0706b2dad9b7aff713
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  4 ++-
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  2 ++
>  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 32 +++++++++++++++++++
>  .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
>  drivers/gpu/drm/amd/powerplay/smu_internal.h  |  2 ++
>  5 files changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index b0dff9ecfb88..b2cdc8a1268f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -1940,7 +1940,9 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
>                 if (adev->flags & AMD_IS_APU)
>                         *states = ATTR_STATE_UNSUPPORTED;
>         } else if (DEVICE_ATTR_IS(unique_id)) {
> -               if (!adev->unique_id)
> +               if (asic_type != CHIP_VEGA10 &&
> +                   asic_type != CHIP_VEGA20 &&
> +                   asic_type != CHIP_ARCTURUS)
>                         *states = ATTR_STATE_UNSUPPORTED;
>         } else if (DEVICE_ATTR_IS(pp_features)) {
>                 if (adev->flags & AMD_IS_APU || asic_type < CHIP_VEGA10)
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 5294aa7cdde1..7946fd8444a3 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -793,6 +793,8 @@ static int smu_late_init(void *handle)
>         if (!smu->pm_enabled)
>                 return 0;
>
> +       smu_set_unique_id(smu);
> +
>         smu_handle_task(&adev->smu,
>                         smu->smu_dpm.dpm_level,
>                         AMD_PP_TASK_COMPLETE_INIT,
> diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> index d66ac7457574..855e609650d9 100644
> --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> @@ -2262,6 +2262,37 @@ static void arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)
>         i2c_del_adapter(control);
>  }
>
> +static void arcturus_set_unique_id(struct smu_context *smu)
> +{
> +       struct amdgpu_device *adev = smu->adev;
> +       uint32_t top32, bottom32, smu_version, size;
> +       char sn[16];
> +       uint64_t id;
> +
> +       if (smu_get_smc_version(smu, NULL, &smu_version)) {
> +               pr_warn("Failed to get smu version, cannot get unique_id or serial_number\n");
> +               return;
> +       }
> +
> +       /* PPSMC_MSG_ReadSerial* is supported by 54.23.0 and onwards */
> +       if (smu_version < 0x361700) {
> +               pr_warn("ReadSerial is only supported by PMFW 54.23.0 and onwards\n");
> +               return;
> +       }
> +
> +       /* Get the SN to turn into a Unique ID */
> +       smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32, &top32);
> +       smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumBottom32, &bottom32);
> +
> +       id = ((uint64_t)bottom32 << 32) | top32;
> +       adev->unique_id = id;
> +       /* For Arcturus-and-later, unique_id == serial_number, so convert it to a
> +        * 16-digit HEX string for convenience and backwards-compatibility
> +        */
> +       size = sprintf(sn, "%llx", id);
> +       memcpy(adev->serial, &sn, size);
> +}
> +
>  static bool arcturus_is_baco_supported(struct smu_context *smu)
>  {
>         struct amdgpu_device *adev = smu->adev;
> @@ -2416,6 +2447,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
>         .dpm_set_uvd_enable = arcturus_dpm_set_uvd_enable,
>         .i2c_eeprom_init = arcturus_i2c_eeprom_control_init,
>         .i2c_eeprom_fini = arcturus_i2c_eeprom_control_fini,
> +       .set_unique_id = arcturus_set_unique_id,
>         .init_microcode = smu_v11_0_init_microcode,
>         .load_microcode = smu_v11_0_load_microcode,
>         .init_smc_tables = smu_v11_0_init_smc_tables,
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> index 5bb1ac821aeb..bfa5211de079 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> @@ -495,6 +495,7 @@ struct pptable_funcs {
>         int (*update_pcie_parameters)(struct smu_context *smu, uint32_t pcie_gen_cap, uint32_t pcie_width_cap);
>         int (*i2c_eeprom_init)(struct i2c_adapter *control);
>         void (*i2c_eeprom_fini)(struct i2c_adapter *control);
> +       void (*set_unique_id)(struct smu_context *smu);

As I mentioned in my previous email, I think these functions would be
better worded as "get_unique_id" since we are fetching it from the
hardware not storing it to the hardware.

Alex

>         int (*get_dpm_clock_table)(struct smu_context *smu, struct dpm_clocks *clock_table);
>         int (*init_microcode)(struct smu_context *smu);
>         int (*load_microcode)(struct smu_context *smu);
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_internal.h b/drivers/gpu/drm/amd/powerplay/smu_internal.h
> index 6c59eeef2590..125d976215a6 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_internal.h
> +++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h
> @@ -218,6 +218,8 @@ static inline int smu_send_smc_msg(struct smu_context *smu, enum smu_message_typ
>                 ((smu)->ppt_funcs->i2c_eeprom_init ? (smu)->ppt_funcs->i2c_eeprom_init((control)) : 0)
>  #define smu_i2c_eeprom_fini(smu, control) \
>                 ((smu)->ppt_funcs->i2c_eeprom_fini ? (smu)->ppt_funcs->i2c_eeprom_fini((control)) : 0)
> +#define smu_set_unique_id(smu) \
> +               ((smu)->ppt_funcs->set_unique_id ? (smu)->ppt_funcs->set_unique_id((smu)) : 0)
>
>  #define smu_log_thermal_throttling(smu) \
>                 ((smu)->ppt_funcs->log_thermal_throttling_event ? (smu)->ppt_funcs->log_thermal_throttling_event((smu)) : 0)
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for Arcturus v2
  2020-06-02 14:45   ` Alex Deucher
@ 2020-06-02 15:49     ` Russell, Kent
  0 siblings, 0 replies; 4+ messages in thread
From: Russell, Kent @ 2020-06-02 15:49 UTC (permalink / raw)
  To: Alex Deucher; +Cc: amd-gfx list

[AMD Public Use]



> -----Original Message-----
> From: Alex Deucher <alexdeucher@gmail.com>
> Sent: Tuesday, June 2, 2020 10:45 AM
> To: Russell, Kent <Kent.Russell@amd.com>
> Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>
> Subject: Re: [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for
> Arcturus v2
> 
> On Tue, Jun 2, 2020 at 8:53 AM Kent Russell <kent.russell@amd.com> wrote:
> >
> > Add support for unique_id and serial_number, as these are now the same
> > value, and will be for future ASICs as well.
> >
> > v2: Explicitly create unique_id only for VG10/20/ARC
> >
> > Signed-off-by: Kent Russell <kent.russell@amd.com>
> > Change-Id: I3b036a38b19cd84025399b0706b2dad9b7aff713
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  4 ++-
> >  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    |  2 ++
> >  drivers/gpu/drm/amd/powerplay/arcturus_ppt.c  | 32
> +++++++++++++++++++
> >  .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
> >  drivers/gpu/drm/amd/powerplay/smu_internal.h  |  2 ++
> >  5 files changed, 40 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> > index b0dff9ecfb88..b2cdc8a1268f 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> > @@ -1940,7 +1940,9 @@ static int default_attr_update(struct
> amdgpu_device *adev, struct amdgpu_device_
> >                 if (adev->flags & AMD_IS_APU)
> >                         *states = ATTR_STATE_UNSUPPORTED;
> >         } else if (DEVICE_ATTR_IS(unique_id)) {
> > -               if (!adev->unique_id)
> > +               if (asic_type != CHIP_VEGA10 &&
> > +                   asic_type != CHIP_VEGA20 &&
> > +                   asic_type != CHIP_ARCTURUS)
> >                         *states = ATTR_STATE_UNSUPPORTED;
> >         } else if (DEVICE_ATTR_IS(pp_features)) {
> >                 if (adev->flags & AMD_IS_APU || asic_type <
> > CHIP_VEGA10) diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> > index 5294aa7cdde1..7946fd8444a3 100644
> > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> > @@ -793,6 +793,8 @@ static int smu_late_init(void *handle)
> >         if (!smu->pm_enabled)
> >                 return 0;
> >
> > +       smu_set_unique_id(smu);
> > +
> >         smu_handle_task(&adev->smu,
> >                         smu->smu_dpm.dpm_level,
> >                         AMD_PP_TASK_COMPLETE_INIT, diff --git
> > a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> > b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> > index d66ac7457574..855e609650d9 100644
> > --- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> > +++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
> > @@ -2262,6 +2262,37 @@ static void
> arcturus_i2c_eeprom_control_fini(struct i2c_adapter *control)
> >         i2c_del_adapter(control);
> >  }
> >
> > +static void arcturus_set_unique_id(struct smu_context *smu) {
> > +       struct amdgpu_device *adev = smu->adev;
> > +       uint32_t top32, bottom32, smu_version, size;
> > +       char sn[16];
> > +       uint64_t id;
> > +
> > +       if (smu_get_smc_version(smu, NULL, &smu_version)) {
> > +               pr_warn("Failed to get smu version, cannot get unique_id or
> serial_number\n");
> > +               return;
> > +       }
> > +
> > +       /* PPSMC_MSG_ReadSerial* is supported by 54.23.0 and onwards */
> > +       if (smu_version < 0x361700) {
> > +               pr_warn("ReadSerial is only supported by PMFW 54.23.0 and
> onwards\n");
> > +               return;
> > +       }
> > +
> > +       /* Get the SN to turn into a Unique ID */
> > +       smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumTop32, &top32);
> > +       smu_send_smc_msg(smu, SMU_MSG_ReadSerialNumBottom32,
> > + &bottom32);
> > +
> > +       id = ((uint64_t)bottom32 << 32) | top32;
> > +       adev->unique_id = id;
> > +       /* For Arcturus-and-later, unique_id == serial_number, so convert it to a
> > +        * 16-digit HEX string for convenience and backwards-compatibility
> > +        */
> > +       size = sprintf(sn, "%llx", id);
> > +       memcpy(adev->serial, &sn, size); }
> > +
> >  static bool arcturus_is_baco_supported(struct smu_context *smu)  {
> >         struct amdgpu_device *adev = smu->adev; @@ -2416,6 +2447,7 @@
> > static const struct pptable_funcs arcturus_ppt_funcs = {
> >         .dpm_set_uvd_enable = arcturus_dpm_set_uvd_enable,
> >         .i2c_eeprom_init = arcturus_i2c_eeprom_control_init,
> >         .i2c_eeprom_fini = arcturus_i2c_eeprom_control_fini,
> > +       .set_unique_id = arcturus_set_unique_id,
> >         .init_microcode = smu_v11_0_init_microcode,
> >         .load_microcode = smu_v11_0_load_microcode,
> >         .init_smc_tables = smu_v11_0_init_smc_tables, diff --git
> > a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> > b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> > index 5bb1ac821aeb..bfa5211de079 100644
> > --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> > +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> > @@ -495,6 +495,7 @@ struct pptable_funcs {
> >         int (*update_pcie_parameters)(struct smu_context *smu, uint32_t
> pcie_gen_cap, uint32_t pcie_width_cap);
> >         int (*i2c_eeprom_init)(struct i2c_adapter *control);
> >         void (*i2c_eeprom_fini)(struct i2c_adapter *control);
> > +       void (*set_unique_id)(struct smu_context *smu);
> 
> As I mentioned in my previous email, I think these functions would be better
> worded as "get_unique_id" since we are fetching it from the hardware not
> storing it to the hardware.

Sorry, I missed that in the previous e-mail. I'll do that now. I was torn between get and set, since it gets it from the SMU, but it sets the variable, so that decision helps for clarity. Thanks!

 Kent 
> 
> Alex
> 
> >         int (*get_dpm_clock_table)(struct smu_context *smu, struct dpm_clocks
> *clock_table);
> >         int (*init_microcode)(struct smu_context *smu);
> >         int (*load_microcode)(struct smu_context *smu); diff --git
> > a/drivers/gpu/drm/amd/powerplay/smu_internal.h
> > b/drivers/gpu/drm/amd/powerplay/smu_internal.h
> > index 6c59eeef2590..125d976215a6 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smu_internal.h
> > +++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h
> > @@ -218,6 +218,8 @@ static inline int smu_send_smc_msg(struct
> smu_context *smu, enum smu_message_typ
> >                 ((smu)->ppt_funcs->i2c_eeprom_init ?
> > (smu)->ppt_funcs->i2c_eeprom_init((control)) : 0)  #define
> smu_i2c_eeprom_fini(smu, control) \
> >                 ((smu)->ppt_funcs->i2c_eeprom_fini ?
> > (smu)->ppt_funcs->i2c_eeprom_fini((control)) : 0)
> > +#define smu_set_unique_id(smu) \
> > +               ((smu)->ppt_funcs->set_unique_id ?
> > +(smu)->ppt_funcs->set_unique_id((smu)) : 0)
> >
> >  #define smu_log_thermal_throttling(smu) \
> >                 ((smu)->ppt_funcs->log_thermal_throttling_event ?
> > (smu)->ppt_funcs->log_thermal_throttling_event((smu)) : 0)
> > --
> > 2.17.1
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> > s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&amp;data=02%7C01%7Cke
> >
> nt.russell%40amd.com%7C06d9eed695b04346a48408d8070397ef%7C3dd896
> 1fe488
> >
> 4e608e11a82d994e183d%7C0%7C0%7C637267059312215967&amp;sdata=Se
> XIr7DB5A
> > Vc%2Fk%2B6bFd448Ydvt%2F%2BKKWJHMd6MkQLL1I%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-02 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 12:53 [PATCH 1/2] drm/amdgpu: Add ReadSerial defines for Arcturus Kent Russell
2020-06-02 12:53 ` [PATCH 2/2] drm/amdgpu: Add unique_id and serial_number for Arcturus v2 Kent Russell
2020-06-02 14:45   ` Alex Deucher
2020-06-02 15:49     ` Russell, Kent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.