drm/amdgpu: Fix missing comment for mb() in 'amdgpu_device_aper_access'
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Wed, 9 Aug 2023 05:29:40 +0000 (10:59 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Aug 2023 21:40:44 +0000 (17:40 -0400)
This patch adds the missing code comment for memory barrier

WARNING: memory barrier without comment
+                       mb();

WARNING: memory barrier without comment
+                       mb();

Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 91d7f9e..97d202d 100644 (file)
@@ -305,10 +305,16 @@ size_t amdgpu_device_aper_access(struct amdgpu_device *adev, loff_t pos,
 
                if (write) {
                        memcpy_toio(addr, buf, count);
+                       /* Make sure HDP write cache flush happens without any reordering
+                        * after the system memory contents are sent over PCIe device
+                        */
                        mb();
                        amdgpu_device_flush_hdp(adev, NULL);
                } else {
                        amdgpu_device_invalidate_hdp(adev, NULL);
+                       /* Make sure HDP read cache is invalidated before issuing a read
+                        * to the PCIe device
+                        */
                        mb();
                        memcpy_fromio(buf, addr, count);
                }