summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-19 10:30:40 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-19 10:30:40 +0000
commita2c566dbc7e7a51b3f285958b869758f3f51850c (patch)
tree4887c4d47cc9ba7b47d9a77f183349f407604479 /sys/dev
parent96242d8b4558309023b4f41392ba3ef83cab80a0 (diff)
drm/amdgpu: fix bad address translation for sienna_cichlid
From Stanley.Yang a2122e07920456e5d43f32e61d52be59634ddcab in linux 5.10.y/5.10.51 6ec598cc9dfbf40433e94a2ed1a622e3ef80268b in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_umc.h5
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/umc_v8_7.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_umc.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu_umc.h
index 18381449365..bda4438c392 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_umc.h
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_umc.h
@@ -22,6 +22,11 @@
#define __AMDGPU_UMC_H__
/*
+ * (addr / 256) * 4096, the higher 26 bits in ErrorAddr
+ * is the index of 4KB block
+ */
+#define ADDR_OF_4KB_BLOCK(addr) (((addr) & ~0xffULL) << 4)
+/*
* (addr / 256) * 8192, the higher 26 bits in ErrorAddr
* is the index of 8KB block
*/
diff --git a/sys/dev/pci/drm/amd/amdgpu/umc_v8_7.c b/sys/dev/pci/drm/amd/amdgpu/umc_v8_7.c
index 5665c77a9d5..afbbe9f05d5 100644
--- a/sys/dev/pci/drm/amd/amdgpu/umc_v8_7.c
+++ b/sys/dev/pci/drm/amd/amdgpu/umc_v8_7.c
@@ -233,7 +233,7 @@ static void umc_v8_7_query_error_address(struct amdgpu_device *adev,
err_addr &= ~((0x1ULL << lsb) - 1);
/* translate umc channel address to soc pa, 3 parts are included */
- retired_page = ADDR_OF_8KB_BLOCK(err_addr) |
+ retired_page = ADDR_OF_4KB_BLOCK(err_addr) |
ADDR_OF_256B_BLOCK(channel_index) |
OFFSET_IN_256B_BLOCK(err_addr);