[PATCH] drm/amdgpu: add coreboot workaround for KV/KB

Christian König ckoenig.leichtzumerken at gmail.com
Fri Jan 17 09:49:44 UTC 2020


Am 17.01.20 um 09:17 schrieb Christian König:
> Am 17.01.20 um 03:01 schrieb Felix Kuehling:
>> On 2020-01-16 8:09, Christian König wrote:
>>> Coreboot seems to have a problem correctly setting up access to the 
>>> stolen VRAM
>>> on KV/KB. Use the direct access only when necessary.
>>
>> I'm not sure what you mean by "necessary".
>
> Necessary for better performance.
>
>>
>>>
>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c 
>>> b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>> index 19d5b133e1d7..9da9596a3638 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>> @@ -381,7 +381,8 @@ static int gmc_v7_0_mc_init(struct amdgpu_device 
>>> *adev)
>>>       adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
>>>     #ifdef CONFIG_X86_64
>>> -    if (adev->flags & AMD_IS_APU) {
>>> +    if (adev->flags & AMD_IS_APU &&
>>> +        adev->gmc.real_vram_size > adev->gmc.aper_size) {
>>
>> CPU access to the whole VRAM isn't really necessary. I thought the 
>> main motivation for accessing FB directly on APUs was better 
>> performance. You're disabling that optimization on all APUs where the 
>> FB is smaller than the aperture size.
>
> Correct, yes. For some reason coreboot seems to explicitly setup the 
> memory used for the FB as write-protected.
>
> The GPU can still read/write it normally cause it ignores that 
> protection, but the CPU can't change the FB memory any more with that 
> setup.
>
> No idea why they do this, most likely just an over conservative 
> protection of a reserved area of memory.

And what I forgot: If anybody has a good contact from the coreboot guys 
then please speak up.

Would be nice to have a better solution for this.

Christian.

>
> Regards,
> Christian.
>
>>
>> Regards,
>>   Felix
>>
>>
>>>           adev->gmc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22;
>>>           adev->gmc.aper_size = adev->gmc.real_vram_size;
>>>       }
>> _______________________________________________
>> 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