All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Use the right method to get IP version
@ 2023-12-06 12:41 Lijo Lazar
  2023-12-06 12:50 ` Zhang, Hawking
  2023-12-06 14:10 ` Alex Deucher
  0 siblings, 2 replies; 4+ messages in thread
From: Lijo Lazar @ 2023-12-06 12:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Hawking.Zhang

Replace direct usage of adev->ip_versions with amdgpu_ip_version.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c          | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c             | 2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c    | 6 +++---
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1b73f519cfb8..f9e8341d9449 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1599,7 +1599,7 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
 	if (adev->mman.keep_stolen_vga_memory)
 		return false;
 
-	return adev->ip_versions[DCE_HWIP][0] >= IP_VERSION(3, 0, 0);
+	return amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0);
 }
 
 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 3a632c3b1a2c..0dcff2889e25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -1099,7 +1099,8 @@ bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev)
 {
 	bool xnack_mode = true;
 
-	if (amdgpu_sriov_vf(adev) && adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
+	if (amdgpu_sriov_vf(adev) &&
+	    amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2))
 		xnack_mode = false;
 
 	return xnack_mode;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 2ac5820e9c92..473a774294ce 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -883,7 +883,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
 	 * GRBM interface.
 	 */
 	if ((vmhub == AMDGPU_GFXHUB(0)) &&
-	    (adev->ip_versions[GC_HWIP][0] < IP_VERSION(9, 4, 2)))
+	    (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 4, 2)))
 		RREG32_NO_KIQ(req);
 
 	for (j = 0; j < adev->usec_timeout; j++) {
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index c146dc9cba92..394142cf72bc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9860,7 +9860,8 @@ static bool should_reset_plane(struct drm_atomic_state *state,
 	 * TODO: Remove this hack for all asics once it proves that the
 	 * fast updates works fine on DCN3.2+.
 	 */
-	if (adev->ip_versions[DCE_HWIP][0] < IP_VERSION(3, 2, 0) && state->allow_modeset)
+	if (amdgpu_ip_version(adev, DCE_HWIP, 0) < IP_VERSION(3, 2, 0) &&
+	    state->allow_modeset)
 		return true;
 
 	/* Exit early if we know that we're adding or removing the plane. */
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
index d8f8ad0e7137..4894f7ee737b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
@@ -224,7 +224,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
 	if (smu->is_apu)
 		adev->pm.fw_version = smu_version;
 
-	switch (adev->ip_versions[MP1_HWIP][0]) {
+	switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
 	case IP_VERSION(14, 0, 2):
 		smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_SMU_V14_0_2;
 		break;
@@ -235,7 +235,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
 		break;
 	default:
 		dev_err(adev->dev, "smu unsupported IP version: 0x%x.\n",
-			adev->ip_versions[MP1_HWIP][0]);
+			amdgpu_ip_version(adev, MP1_HWIP, 0));
 		smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_INV;
 		break;
 	}
@@ -733,7 +733,7 @@ int smu_v14_0_gfx_off_control(struct smu_context *smu, bool enable)
 	int ret = 0;
 	struct amdgpu_device *adev = smu->adev;
 
-	switch (adev->ip_versions[MP1_HWIP][0]) {
+	switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
 	case IP_VERSION(14, 0, 2):
 	case IP_VERSION(14, 0, 0):
 		if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
-- 
2.25.1


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

* RE: [PATCH] drm/amdgpu: Use the right method to get IP version
  2023-12-06 12:41 [PATCH] drm/amdgpu: Use the right method to get IP version Lijo Lazar
@ 2023-12-06 12:50 ` Zhang, Hawking
  2023-12-06 14:10 ` Alex Deucher
  1 sibling, 0 replies; 4+ messages in thread
From: Zhang, Hawking @ 2023-12-06 12:50 UTC (permalink / raw)
  To: Lazar, Lijo, amd-gfx; +Cc: Deucher, Alexander

[AMD Official Use Only - General]

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>

Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <Lijo.Lazar@amd.com>
Sent: Wednesday, December 6, 2023 20:41
To: amd-gfx@lists.freedesktop.org
Cc: Zhang, Hawking <Hawking.Zhang@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: [PATCH] drm/amdgpu: Use the right method to get IP version

Replace direct usage of adev->ip_versions with amdgpu_ip_version.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c          | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c             | 2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c    | 6 +++---
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1b73f519cfb8..f9e8341d9449 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1599,7 +1599,7 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
        if (adev->mman.keep_stolen_vga_memory)
                return false;

-       return adev->ip_versions[DCE_HWIP][0] >= IP_VERSION(3, 0, 0);
+       return amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0);
 }

 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 3a632c3b1a2c..0dcff2889e25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -1099,7 +1099,8 @@ bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev)  {
        bool xnack_mode = true;

-       if (amdgpu_sriov_vf(adev) && adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
+       if (amdgpu_sriov_vf(adev) &&
+           amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2))
                xnack_mode = false;

        return xnack_mode;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 2ac5820e9c92..473a774294ce 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -883,7 +883,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
         * GRBM interface.
         */
        if ((vmhub == AMDGPU_GFXHUB(0)) &&
-           (adev->ip_versions[GC_HWIP][0] < IP_VERSION(9, 4, 2)))
+           (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 4, 2)))
                RREG32_NO_KIQ(req);

        for (j = 0; j < adev->usec_timeout; j++) { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index c146dc9cba92..394142cf72bc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9860,7 +9860,8 @@ static bool should_reset_plane(struct drm_atomic_state *state,
         * TODO: Remove this hack for all asics once it proves that the
         * fast updates works fine on DCN3.2+.
         */
-       if (adev->ip_versions[DCE_HWIP][0] < IP_VERSION(3, 2, 0) && state->allow_modeset)
+       if (amdgpu_ip_version(adev, DCE_HWIP, 0) < IP_VERSION(3, 2, 0) &&
+           state->allow_modeset)
                return true;

        /* Exit early if we know that we're adding or removing the plane. */ diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
index d8f8ad0e7137..4894f7ee737b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
@@ -224,7 +224,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
        if (smu->is_apu)
                adev->pm.fw_version = smu_version;

-       switch (adev->ip_versions[MP1_HWIP][0]) {
+       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
        case IP_VERSION(14, 0, 2):
                smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_SMU_V14_0_2;
                break;
@@ -235,7 +235,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
                break;
        default:
                dev_err(adev->dev, "smu unsupported IP version: 0x%x.\n",
-                       adev->ip_versions[MP1_HWIP][0]);
+                       amdgpu_ip_version(adev, MP1_HWIP, 0));
                smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_INV;
                break;
        }
@@ -733,7 +733,7 @@ int smu_v14_0_gfx_off_control(struct smu_context *smu, bool enable)
        int ret = 0;
        struct amdgpu_device *adev = smu->adev;

-       switch (adev->ip_versions[MP1_HWIP][0]) {
+       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
        case IP_VERSION(14, 0, 2):
        case IP_VERSION(14, 0, 0):
                if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
--
2.25.1


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

* Re: [PATCH] drm/amdgpu: Use the right method to get IP version
  2023-12-06 12:41 [PATCH] drm/amdgpu: Use the right method to get IP version Lijo Lazar
  2023-12-06 12:50 ` Zhang, Hawking
@ 2023-12-06 14:10 ` Alex Deucher
  2023-12-06 16:06   ` Lazar, Lijo
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2023-12-06 14:10 UTC (permalink / raw)
  To: Lijo Lazar; +Cc: Alexander.Deucher, amd-gfx, Hawking.Zhang

On Wed, Dec 6, 2023 at 7:57 AM Lijo Lazar <lijo.lazar@amd.com> wrote:
>
> Replace direct usage of adev->ip_versions with amdgpu_ip_version.
>
> Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c          | 3 ++-
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c             | 2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
>  drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c    | 6 +++---
>  5 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 1b73f519cfb8..f9e8341d9449 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1599,7 +1599,7 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
>         if (adev->mman.keep_stolen_vga_memory)
>                 return false;
>
> -       return adev->ip_versions[DCE_HWIP][0] >= IP_VERSION(3, 0, 0);
> +       return amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0);
>  }
>
>  /*
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 3a632c3b1a2c..0dcff2889e25 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -1099,7 +1099,8 @@ bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev)
>  {
>         bool xnack_mode = true;
>
> -       if (amdgpu_sriov_vf(adev) && adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
> +       if (amdgpu_sriov_vf(adev) &&
> +           amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2))
>                 xnack_mode = false;
>
>         return xnack_mode;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 2ac5820e9c92..473a774294ce 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -883,7 +883,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
>          * GRBM interface.
>          */
>         if ((vmhub == AMDGPU_GFXHUB(0)) &&
> -           (adev->ip_versions[GC_HWIP][0] < IP_VERSION(9, 4, 2)))
> +           (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 4, 2)))
>                 RREG32_NO_KIQ(req);
>
>         for (j = 0; j < adev->usec_timeout; j++) {
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index c146dc9cba92..394142cf72bc 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -9860,7 +9860,8 @@ static bool should_reset_plane(struct drm_atomic_state *state,
>          * TODO: Remove this hack for all asics once it proves that the
>          * fast updates works fine on DCN3.2+.
>          */
> -       if (adev->ip_versions[DCE_HWIP][0] < IP_VERSION(3, 2, 0) && state->allow_modeset)
> +       if (amdgpu_ip_version(adev, DCE_HWIP, 0) < IP_VERSION(3, 2, 0) &&
> +           state->allow_modeset)
>                 return true;
>
>         /* Exit early if we know that we're adding or removing the plane. */
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
> index d8f8ad0e7137..4894f7ee737b 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
> @@ -224,7 +224,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
>         if (smu->is_apu)
>                 adev->pm.fw_version = smu_version;
>
> -       switch (adev->ip_versions[MP1_HWIP][0]) {
> +       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
>         case IP_VERSION(14, 0, 2):
>                 smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_SMU_V14_0_2;
>                 break;
> @@ -235,7 +235,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
>                 break;
>         default:
>                 dev_err(adev->dev, "smu unsupported IP version: 0x%x.\n",
> -                       adev->ip_versions[MP1_HWIP][0]);
> +                       amdgpu_ip_version(adev, MP1_HWIP, 0));
>                 smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_INV;
>                 break;
>         }
> @@ -733,7 +733,7 @@ int smu_v14_0_gfx_off_control(struct smu_context *smu, bool enable)
>         int ret = 0;
>         struct amdgpu_device *adev = smu->adev;
>
> -       switch (adev->ip_versions[MP1_HWIP][0]) {
> +       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
>         case IP_VERSION(14, 0, 2):
>         case IP_VERSION(14, 0, 0):
>                 if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
> --
> 2.25.1
>

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

* Re: [PATCH] drm/amdgpu: Use the right method to get IP version
  2023-12-06 14:10 ` Alex Deucher
@ 2023-12-06 16:06   ` Lazar, Lijo
  0 siblings, 0 replies; 4+ messages in thread
From: Lazar, Lijo @ 2023-12-06 16:06 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alexander.Deucher, amd-gfx, Hawking.Zhang



On 12/6/2023 7:40 PM, Alex Deucher wrote:
> On Wed, Dec 6, 2023 at 7:57 AM Lijo Lazar <lijo.lazar@amd.com> wrote:
>>
>> Replace direct usage of adev->ip_versions with amdgpu_ip_version.
>>
>> Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> 

I see two more instances of direct use. Will send a v2.

Thanks,
Lijo

>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        | 2 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c          | 3 ++-
>>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c             | 2 +-
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
>>   drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c    | 6 +++---
>>   5 files changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 1b73f519cfb8..f9e8341d9449 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -1599,7 +1599,7 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
>>          if (adev->mman.keep_stolen_vga_memory)
>>                  return false;
>>
>> -       return adev->ip_versions[DCE_HWIP][0] >= IP_VERSION(3, 0, 0);
>> +       return amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0);
>>   }
>>
>>   /*
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>> index 3a632c3b1a2c..0dcff2889e25 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>> @@ -1099,7 +1099,8 @@ bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev)
>>   {
>>          bool xnack_mode = true;
>>
>> -       if (amdgpu_sriov_vf(adev) && adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
>> +       if (amdgpu_sriov_vf(adev) &&
>> +           amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2))
>>                  xnack_mode = false;
>>
>>          return xnack_mode;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> index 2ac5820e9c92..473a774294ce 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> @@ -883,7 +883,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
>>           * GRBM interface.
>>           */
>>          if ((vmhub == AMDGPU_GFXHUB(0)) &&
>> -           (adev->ip_versions[GC_HWIP][0] < IP_VERSION(9, 4, 2)))
>> +           (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 4, 2)))
>>                  RREG32_NO_KIQ(req);
>>
>>          for (j = 0; j < adev->usec_timeout; j++) {
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index c146dc9cba92..394142cf72bc 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -9860,7 +9860,8 @@ static bool should_reset_plane(struct drm_atomic_state *state,
>>           * TODO: Remove this hack for all asics once it proves that the
>>           * fast updates works fine on DCN3.2+.
>>           */
>> -       if (adev->ip_versions[DCE_HWIP][0] < IP_VERSION(3, 2, 0) && state->allow_modeset)
>> +       if (amdgpu_ip_version(adev, DCE_HWIP, 0) < IP_VERSION(3, 2, 0) &&
>> +           state->allow_modeset)
>>                  return true;
>>
>>          /* Exit early if we know that we're adding or removing the plane. */
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
>> index d8f8ad0e7137..4894f7ee737b 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
>> @@ -224,7 +224,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
>>          if (smu->is_apu)
>>                  adev->pm.fw_version = smu_version;
>>
>> -       switch (adev->ip_versions[MP1_HWIP][0]) {
>> +       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
>>          case IP_VERSION(14, 0, 2):
>>                  smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_SMU_V14_0_2;
>>                  break;
>> @@ -235,7 +235,7 @@ int smu_v14_0_check_fw_version(struct smu_context *smu)
>>                  break;
>>          default:
>>                  dev_err(adev->dev, "smu unsupported IP version: 0x%x.\n",
>> -                       adev->ip_versions[MP1_HWIP][0]);
>> +                       amdgpu_ip_version(adev, MP1_HWIP, 0));
>>                  smu->smc_driver_if_version = SMU14_DRIVER_IF_VERSION_INV;
>>                  break;
>>          }
>> @@ -733,7 +733,7 @@ int smu_v14_0_gfx_off_control(struct smu_context *smu, bool enable)
>>          int ret = 0;
>>          struct amdgpu_device *adev = smu->adev;
>>
>> -       switch (adev->ip_versions[MP1_HWIP][0]) {
>> +       switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
>>          case IP_VERSION(14, 0, 2):
>>          case IP_VERSION(14, 0, 0):
>>                  if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
>> --
>> 2.25.1
>>

-- 
Thanks,
Lijo

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

end of thread, other threads:[~2023-12-06 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 12:41 [PATCH] drm/amdgpu: Use the right method to get IP version Lijo Lazar
2023-12-06 12:50 ` Zhang, Hawking
2023-12-06 14:10 ` Alex Deucher
2023-12-06 16:06   ` Lazar, Lijo

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.