mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: fix REMAP to support small/big pages
Initially, REMAP only worked with big pages but in some cases only small pages are supported where REMAP functionality is also needed. This cleans up some page size assumptions. In particular, on a remap request, the nvgpu_vm_area is found from the passed in VA, but can only be done from virt_offset_in_pages if we're also told the page size. This now occurs from _PAGESIZE_ flags which are required by both map and unmap operations. Jira NVGPU-6804 Change-Id: I311980a1b5e0e5e1840bdc1123479350a5c9d469 Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2566087 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
359e83b45a
commit
14ed75e857
@@ -454,7 +454,14 @@ struct nvgpu_as_mapping_modify_args {
|
||||
* must be set if the physical memory buffer represented by @mem_handle
|
||||
* is mapped read-only.
|
||||
*
|
||||
* This field must be zero for unmap operations.
|
||||
* %NVGPU_AS_REMAP_OP_FLAGS_PAGESIZE_4K
|
||||
* %NVGPU_AS_REMAP_OP_FLAGS_PAGESIZE_64K
|
||||
* %NVGPU_AS_REMAP_OP_FLAGS_PAGESIZE_128K
|
||||
*
|
||||
* One, and only one, of these flags must be set for both map/unmap
|
||||
* ops and indicates the assumed page size of the mem_offset_in_pages
|
||||
* and virt_offset_in_pages. This value is also verified against the
|
||||
* page size of the address space.
|
||||
*
|
||||
* @compr_kind [IN/OUT]
|
||||
* @incompr_kind [IN/OUT]
|
||||
@@ -479,16 +486,14 @@ struct nvgpu_as_mapping_modify_args {
|
||||
*
|
||||
* @mem_offset_in_pages [IN]
|
||||
*
|
||||
* Specify an offset into the physical buffer associated with mem_handle at
|
||||
* which to start the mapping. This value is in pages and the page size
|
||||
* is the big page size in the associated sparse address space. This value
|
||||
* must be zero for unmap operations.
|
||||
* Specify an offset (in pages) into the physical buffer associated with
|
||||
* mem_handle at which to start the mapping. This value must be zero for
|
||||
* unmap operations.
|
||||
*
|
||||
* @virt_offset_in_pages [IN]
|
||||
*
|
||||
* Specify the virtual memory start offset of the region to map or unmap.
|
||||
* This value is in pages and the page size is the big page size in the
|
||||
* associated sparse address space.
|
||||
* Specify the virtual memory start offset (in pages) of the region to map
|
||||
* or unmap.
|
||||
*
|
||||
* @num_pages [IN]
|
||||
* Specify the number of pages to map or unmap.
|
||||
@@ -496,14 +501,17 @@ struct nvgpu_as_mapping_modify_args {
|
||||
struct nvgpu_as_remap_op {
|
||||
#define NVGPU_AS_REMAP_OP_FLAGS_CACHEABLE (1 << 2)
|
||||
#define NVGPU_AS_REMAP_OP_FLAGS_ACCESS_NO_WRITE (1 << 10)
|
||||
#define NVGPU_AS_REMAP_OP_FLAGS_PAGESIZE_4K (1 << 15)
|
||||
#define NVGPU_AS_REMAP_OP_FLAGS_PAGESIZE_64K (1 << 16)
|
||||
#define NVGPU_AS_REMAP_OP_FLAGS_PAGESIZE_128K (1 << 17)
|
||||
|
||||
/* in: For map operations, this field specifies the mask of
|
||||
* NVGPU_AS_REMAP flags to use for the mapping. For unmap operations
|
||||
* this field must be zero */
|
||||
/* in: For map and unmap (one and only one) of the _PAGESIZE_ flags is
|
||||
* required to interpret the mem_offset_in_pages and virt_offset_in_pages
|
||||
* correctly. The other flags are used only with map operations. */
|
||||
__u32 flags;
|
||||
|
||||
/* in: For map operations, this field specifies the desired
|
||||
* compressible kind. For unmap operations this field must be set
|
||||
* compressible kind. For unmap operations this field must be set
|
||||
* to NV_KIND_INVALID.
|
||||
* out: For map operations this field returns the actual kind used
|
||||
* for the mapping. This can be useful for detecting if a compressed
|
||||
@@ -550,7 +558,7 @@ struct nvgpu_as_remap_op {
|
||||
* that have been allocated with NVGPU_AS_ALLOC_SPACE_FLAGS_SPARSE.
|
||||
* Validation of remap operations is performed before any changes are made
|
||||
* to the associated sparse address space so either all map and/or unmap
|
||||
* operations are performed or none of them area.
|
||||
* operations are performed or none of them are.
|
||||
*/
|
||||
struct nvgpu_as_remap_args {
|
||||
/* in: This field specifies a pointer into the caller's address space
|
||||
|
||||
Reference in New Issue
Block a user