drm/amdgpu: replace readq/writeq with atomic64 operations
Koenig, Christian
Christian.Koenig at amd.com
Fri Aug 9 09:04:17 UTC 2019
Am 08.08.19 um 21:33 schrieb Alex Deucher:
> On Thu, Aug 8, 2019 at 3:31 PM Guenter Roeck <linux at roeck-us.net> wrote:
>> On Wed, Aug 07, 2019 at 10:56:40AM +0800, Tao Zhou wrote:
>>> readq/writeq are not supported on all architectures
>>>
>>> Signed-off-by: Tao Zhou <tao.zhou1 at amd.com>
>>> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
>> Regarding the claim that this would work for 32-bit x86 builds:
> I wasn't talking about readq/writeq, I was talking about the atomic64
> interfaces.
On quite a bunch of architectures atomic64 operations are actually
implemented with spinlocks or other architecture depended special handling.
So the approach of casting an iomem pointer to an atomic64 and then hope
for the best is actually completely nonsense.
If the hardware really needs a single 64bit write for doorbells or
registers, then we absolutely need to limit the driver to 64bit
architectures.
If the hardware doesn't need 64bit writes we should actually always use
two 32bit writes to not run into random and hard to debug problems
because of this.
Christian.
>
> Alex
>
>> make ARCH=i386 allmodconfig
>> make ARCH=i386 drivers/gpu/drm/amd/amdgpu/amdgpu_device.o
>>
>> results in:
>>
>> ...
>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_device.o
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c: In function ‘amdgpu_mm_rreg64’:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:279:9: error: implicit declaration of function ‘readq’;
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c: In function ‘amdgpu_mm_wreg64’:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:298:3: error: implicit declaration of function ‘writeq’
>>
>> This is with next-20190808.
>>
>> Guenter
>> _______________________________________________
>> 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