accel/ivpu: Increase DMA address range
authorKarol Wachowski <karol.wachowski@intel.com>
Thu, 17 Oct 2024 14:58:16 +0000 (16:58 +0200)
committerJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Wed, 30 Oct 2024 09:23:57 +0000 (10:23 +0100)
Increase DMA address range to:
 * 128 GB on 37xx (due to MMU limitations)
 * 256 GB on other generations
Merge User and DMA ranges on 40xx and above as it is possible
to access whole 256 GBs from both FW and DMA.

Increase User range on 37xx from 255MB to 511MB
to allow loading very large models.

Do not set global_alias_pio_base/size on other generations than 37xx
as it's only used on 37xx anyway.

Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241017145817.121590-11-jacek.lawrynowicz@linux.intel.com
drivers/accel/ivpu/ivpu_fw.c
drivers/accel/ivpu/ivpu_hw.c
drivers/accel/ivpu/ivpu_mmu_context.c

index d358cf0b0f97207355e449817a71456ab521ce7a..6037ec0b309689bafaf6d765941dbc2384f78f4d 100644 (file)
@@ -584,8 +584,10 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
        boot_params->ipc_payload_area_start = ipc_mem_rx->vpu_addr + ivpu_bo_size(ipc_mem_rx) / 2;
        boot_params->ipc_payload_area_size = ivpu_bo_size(ipc_mem_rx) / 2;
 
-       boot_params->global_aliased_pio_base = vdev->hw->ranges.user.start;
-       boot_params->global_aliased_pio_size = ivpu_hw_range_size(&vdev->hw->ranges.user);
+       if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
+               boot_params->global_aliased_pio_base = vdev->hw->ranges.user.start;
+               boot_params->global_aliased_pio_size = ivpu_hw_range_size(&vdev->hw->ranges.user);
+       }
 
        /* Allow configuration for L2C_PAGE_TABLE with boot param value */
        boot_params->autoconfig = 1;
index 1c259d7178151bb2b8594bea0b4af2460dc49e0e..09ada8b500b99661679d38ab099b0617ebeeae89 100644 (file)
@@ -114,14 +114,14 @@ static void memory_ranges_init(struct ivpu_device *vdev)
 {
        if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
                ivpu_hw_range_init(&vdev->hw->ranges.global, 0x80000000, SZ_512M);
-               ivpu_hw_range_init(&vdev->hw->ranges.user,   0xc0000000, 255 * SZ_1M);
+               ivpu_hw_range_init(&vdev->hw->ranges.user,   0x88000000, 511 * SZ_1M);
                ivpu_hw_range_init(&vdev->hw->ranges.shave, 0x180000000, SZ_2G);
-               ivpu_hw_range_init(&vdev->hw->ranges.dma,   0x200000000, SZ_8G);
+               ivpu_hw_range_init(&vdev->hw->ranges.dma,   0x200000000, SZ_128G);
        } else {
                ivpu_hw_range_init(&vdev->hw->ranges.global, 0x80000000, SZ_512M);
-               ivpu_hw_range_init(&vdev->hw->ranges.user,   0x80000000, SZ_256M);
-               ivpu_hw_range_init(&vdev->hw->ranges.shave,  0x80000000 + SZ_256M, SZ_2G - SZ_256M);
-               ivpu_hw_range_init(&vdev->hw->ranges.dma,   0x200000000, SZ_8G);
+               ivpu_hw_range_init(&vdev->hw->ranges.shave,  0x80000000, SZ_2G);
+               ivpu_hw_range_init(&vdev->hw->ranges.user,  0x100000000, SZ_256G);
+               vdev->hw->ranges.dma = vdev->hw->ranges.user;
        }
 }
 
index 697b57071d546c42feef345ff76b7de0cdb6f0f4..891967a95bc3c76cb946e3ffd07eb1c767f4c006 100644 (file)
@@ -571,8 +571,8 @@ void ivpu_mmu_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ct
                start = vdev->hw->ranges.global.start;
                end = vdev->hw->ranges.shave.end;
        } else {
-               start = vdev->hw->ranges.user.start;
-               end = vdev->hw->ranges.dma.end;
+               start = min_t(u64, vdev->hw->ranges.user.start, vdev->hw->ranges.shave.start);
+               end = max_t(u64, vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
        }
 
        drm_mm_init(&ctx->mm, start, end - start);