Skip to content

Commit 8f5ad36

Browse files
jwludziksgruszka
authored andcommitted
accel/ivpu: Extend address range for MMU mmap
Allow to use whole address range in MMU context mmap which is up to 48 bits. Return invalid argument from MMU context mmap in case address is not aligned to MMU page size, address is below MMU page size or address is greater then 47 bits. This fixes problem disallowing to run large models on VPU4 Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231018110113.547208-1-stanislaw.gruszka@linux.intel.com
1 parent 610b5d2 commit 8f5ad36

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/accel/ivpu/ivpu_mmu_context.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "ivpu_mmu.h"
1212
#include "ivpu_mmu_context.h"
1313

14+
#define IVPU_MMU_VPU_ADDRESS_MASK GENMASK(47, 12)
1415
#define IVPU_MMU_PGD_INDEX_MASK GENMASK(47, 39)
1516
#define IVPU_MMU_PUD_INDEX_MASK GENMASK(38, 30)
1617
#define IVPU_MMU_PMD_INDEX_MASK GENMASK(29, 21)
@@ -328,12 +329,8 @@ ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
328329

329330
if (!IS_ALIGNED(vpu_addr, IVPU_MMU_PAGE_SIZE))
330331
return -EINVAL;
331-
/*
332-
* VPU is only 32 bit, but DMA engine is 38 bit
333-
* Ranges < 2 GB are reserved for VPU internal registers
334-
* Limit range to 8 GB
335-
*/
336-
if (vpu_addr < SZ_2G || vpu_addr > SZ_8G)
332+
333+
if (vpu_addr & ~IVPU_MMU_VPU_ADDRESS_MASK)
337334
return -EINVAL;
338335

339336
prot = IVPU_MMU_ENTRY_MAPPED;

0 commit comments

Comments
 (0)