mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: Alignment check for compressible fixed-address mappings
Add an alignment check for compressible-kind fixed-address mappings. If we're using page size smaller than the comptag line coverage window, the GPU VA and the physical buffer offset must be aligned in respect to that window. Bug 1995897 Bug 2011640 Bug 2011668 Change-Id: If68043ee2828d54b9398d77553d10d35cc319236 Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1606439 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
86a94230c6
commit
d73ad6c07d
@@ -847,6 +847,29 @@ struct nvgpu_mapped_buf *nvgpu_vm_map(struct vm_gk20a *vm,
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
if ((binfo.compr_kind != NVGPU_KIND_INVALID) &&
|
||||
(flags & NVGPU_VM_MAP_FIXED_OFFSET)) {
|
||||
/*
|
||||
* Fixed-address compressible mapping is
|
||||
* requested. Make sure we're respecting the alignment
|
||||
* requirement for virtual addresses and buffer
|
||||
* offsets.
|
||||
*
|
||||
* This check must be done before we may fall back to
|
||||
* the incompressible kind.
|
||||
*/
|
||||
|
||||
const u64 offset_mask = g->ops.fb.compression_align_mask(g);
|
||||
|
||||
if ((map_addr & offset_mask) != (phys_offset & offset_mask)) {
|
||||
nvgpu_log(g, gpu_dbg_map,
|
||||
"Misaligned compressible-kind fixed-address "
|
||||
"mapping");
|
||||
err = -EINVAL;
|
||||
goto clean_up;
|
||||
}
|
||||
}
|
||||
|
||||
if (binfo.compr_kind != NVGPU_KIND_INVALID) {
|
||||
struct gk20a_comptags comptags = { 0 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user