On 2022-02-28 13:25, Harish Kasiviswanathan wrote:
Aldebaran has 48-bit physical address support
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 412e44af1608..0765c163b355 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1675,12 +1675,17 @@ static int gmc_v9_0_sw_init(void *handle)
*/
adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
- r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
+ if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) {
+ r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(48));
+ adev->need_swiotlb = drm_need_swiotlb(48);
+ } else {
+ r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
+ adev->need_swiotlb = drm_need_swiotlb(44);
+ }
Instead of duplicating the code, I'd prefer a variable to hold the
number of address bits. E.g.
int dma_addr_bits =
(adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) ? 48 : 44;
...
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(dma_addr_bits));
...
adev->need_swiotlb = drm_need_swiotlb(dma_addr_bits);
With that fixed, the patch is
Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>
if (r) {
printk(KERN_WARNING "amdgpu: No suitable DMA available.\n");
return r;
}
- adev->need_swiotlb = drm_need_swiotlb(44);
r = gmc_v9_0_mc_init(adev);
if (r)