[PATCH] drm/amdgpu: new ids flag for tmz

Christian König ckoenig.leichtzumerken at gmail.com
Thu Jul 30 11:48:48 UTC 2020


Am 30.07.20 um 12:59 schrieb Pierre-Eric Pelloux-Prayer:
> Hi Christian,
>
> On 30/07/2020 12:30, Christian König wrote:
>> Am 30.07.20 um 12:25 schrieb Pierre-Eric Pelloux-Prayer:
>>> Allows UMD to know if TMZ is supported and enabled.
>>> This commit also bumps KMS_DRIVER_MINOR so UMD knows if it can rely on
>>> AMDGPU_IDS_FLAGS_TMZ.
>>> ---
>>> Patch for using it in Mesa is at https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049
>>> (ac/gpu_info: add detection of TMZ support).
>>>
>>> Pierre-Eric
>>>
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
>>>    include/uapi/drm/amdgpu_drm.h           | 1 +
>>>    3 files changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> index 6291f5f0d223..6dcab25914cf 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>> @@ -88,9 +88,10 @@
>>>     * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
>>>     * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
>>>     * - 3.39.0 - DMABUF implicit sync does a full pipeline sync
>>> + * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
>>>     */
>>>    #define KMS_DRIVER_MAJOR    3
>>> -#define KMS_DRIVER_MINOR    39
>>> +#define KMS_DRIVER_MINOR    40
>> I don't think we need this. Unused ids_flags should be zero on older kernels.
> If we don't increase KMS_DRIVER_MINOR then:
>
>     ids_flags & AMDGPU_IDS_FLAGS_TMZ == 0
>
> has 2 meanings:
>    - TMZ is not enabled
>    - or TMZ might be enabled but it's not reported by the kernel

Ah! Yeah that's a good argument.

We need to note that in the commit message.

And maybe call the flag TMZ_ENABLED to make clear what this is good for.

Thanks,
Christian.

>
> If you prefer not bumping KMS_DRIVER_MINOR that's fine though. Mesa can check if TMZ is really
> disabled by trying to allocate a TMZ buffer.
>
> Thanks,
> Pierre-Eric
>
>> That's why we have this in the first place.
>>
>> Christian.
>>
>>>    #define KMS_DRIVER_PATCHLEVEL    0
>>>      int amdgpu_vram_limit = 0;
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> index eebbe2103e32..d92ee30bc06c 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>>> @@ -736,6 +736,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>>>                dev_info.ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
>>>            if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
>>>                dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
>>> +        if (adev->gmc.tmz_enabled)
>>> +            dev_info.ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
>>>              vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
>>>            vm_size -= AMDGPU_VA_RESERVED_SIZE;
>>> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
>>> index 765a94ec4420..b826f2d6efe1 100644
>>> --- a/include/uapi/drm/amdgpu_drm.h
>>> +++ b/include/uapi/drm/amdgpu_drm.h
>>> @@ -676,6 +676,7 @@ struct drm_amdgpu_cs_chunk_data {
>>>     */
>>>    #define AMDGPU_IDS_FLAGS_FUSION         0x1
>>>    #define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
>>> +#define AMDGPU_IDS_FLAGS_TMZ            0x4
>>>      /* indicate if acceleration can be working */
>>>    #define AMDGPU_INFO_ACCEL_WORKING        0x00
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx



More information about the amd-gfx mailing list