[PATCH] drm/amdgpu: add a xgmi supported flag
Grodzovsky, Andrey
Andrey.Grodzovsky at amd.com
Fri Nov 30 20:45:13 UTC 2018
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
Andrey
On 11/30/2018 03:36 PM, Alex Deucher wrote:
> On Fri, Nov 30, 2018 at 3:34 PM Grodzovsky, Andrey
> <Andrey.Grodzovsky at amd.com> wrote:
>>
>>
>> On 11/30/2018 03:30 PM, Alex Deucher wrote:
>>> Use this to track whether an asic supports xgmi rather than
>>> checking the asic type everywhere.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
>>> ---
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 +
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 ++--
>>> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
>>> drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +++
>>> 4 files changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>>> index 8c57924c075f..81e6070d255b 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
>>> @@ -99,6 +99,7 @@ struct amdgpu_xgmi {
>>> unsigned num_physical_nodes;
>>> /* gpu list in the same hive */
>>> struct list_head head;
>>> + bool supported;
>>> };
>>>
>>> struct amdgpu_gmc {
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
>>> index fb37e69f1bba..f8c86d0593dd 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
>>> @@ -94,9 +94,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
>>>
>>> int count = 0, ret = -EINVAL;
>>>
>>> - if ((adev->asic_type < CHIP_VEGA20) ||
>>> - (adev->flags & AMD_IS_APU) )
>>> + if (!adev->gmc.xgmi.supported)
>>> return 0;
>> What about the (adev->flags & AMD_IS_APU) part ?
> It's covered by the check. Only vega20 has the flag set.
>
> Alex
>
>> Andrey
>>
>>> +
>>> adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
>>> adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>> index 3a4e5d8d5162..ed3145b2a596 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>>> @@ -934,7 +934,7 @@ static int gmc_v9_0_sw_init(void *handle)
>>> }
>>> adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
>>>
>>> - if (adev->asic_type == CHIP_VEGA20) {
>>> + if (adev->gmc.xgmi.supported) {
>>> r = gfxhub_v1_1_get_xgmi_info(adev);
>>> if (r)
>>> return r;
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
>>> index 83624e150ca7..8849b74078d6 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
>>> @@ -507,6 +507,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
>>> return -EINVAL;
>>> }
>>>
>>> + if (adev->asic_type == CHIP_VEGA20)
>>> + adev->gmc.xgmi.supported = true;
>>> +
>>> if (adev->flags & AMD_IS_APU)
>>> adev->nbio_funcs = &nbio_v7_0_funcs;
>>> else if (adev->asic_type == CHIP_VEGA20)
More information about the amd-gfx
mailing list