accel/ivpu: Limit DMA address width to 42 bits on 40XX and later
Karol Wachowski
maintainerPATCH 1/1 accel/ivpu: Limit DMA address width to 42 bits on 40XX and later
On 40XX and later the NPU does not treat address bits 42 and above as part of the memory address, as the hardware uses them internally, but ivpu sets a 48-bit DMA mask for these generations.
In practice the IOMMU capabilities already limit the DMA addresses to 42 bits, so this does not fix an observed problem. Set the DMA mask to 42 bits anyway, so the driver does not depend on the IOMMU configuration to stay within the range the NPU can address. 37XX keeps its 38-bit mask.
--- drivers/accel/ivpu/ivpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_drv.c +1 -1
@@ -709,7 +709,7 @@ static int ivpu_pci_init(struct ivpu_device *vdev) }if (ivpu_hw_ip_gen (vdev) >=IVPU_HW_IP_40XX ) - dma_bits =48 ; + dma_bits =42 ;else dma_bits =38 ;
Signature · 1 line
2.43.0
Quoted 10 lines · Karol Wachowski
On 40XX and later the NPU does not treat address bits 42 and above as part of the memory address, as the hardware uses them internally, but ivpu sets a 48-bit DMA mask for these generations.
In practice the IOMMU capabilities already limit the DMA addresses to 42 bits, so this does not fix an observed problem. Set the DMA mask to 42 bits anyway, so the driver does not depend on the IOMMU configuration to stay within the range the NPU can address. 37XX keeps its 38-bit mask.
Quoted 18 lines
Signed-off-by Karol Wachowski <[email protected]>--- drivers/accel/ivpu/ivpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/accel/ivpu/ivpu_drv.c +1
-1@@ -709,7 +709,7 @@ static int ivpu_pci_init(struct ivpu_device *vdev) }if (ivpu_hw_ip_gen (vdev) >=IVPU_HW_IP_40XX ) - dma_bits =48 ; + dma_bits =42 ;else dma_bits =38 ;
Wachowski, Karol
maintainerQuoted 5 lines · Dawid Osuchowski
Quoted 4 lines · Karol Wachowski
On 40XX and later the NPU does not treat address bits 42 and above as part of the memory address, as the hardware uses them internally, but ivpu sets a 48-bit DMA mask for these generations.
Quoted 8 lines
Quoted 6 lines
In practice the IOMMU capabilities already limit the DMA addresses to 42 bits, so this does not fix an observed problem. Set the DMA mask to 42 bits anyway, so the driver does not depend on the IOMMU configuration to stay within the range the NPU can address. 37XX keeps its 38-bit mask.
Reviewed-by Dawid Osuchowski <[email protected]>
Thanks, pushed to drm-misc-next.
Quoted 18 lines
Quoted 17 lines
Signed-off-by Karol Wachowski <[email protected]>---
drivers/accel/ivpu/ivpu_drv.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/accel/ivpu/ivpu_drv.c +1
-1@@ -709,7 +709,7 @@ static int ivpu_pci_init(struct ivpu_device *vdev) } if (ivpu_hw_ip_gen(vdev) >= IVPU_HW_IP_40XX) - dma_bits = 48; + dma_bits = 42;else
dma_bits= 38;