diff options
author | Sidath Senanayake <sidaths@google.com> | 2020-09-22 19:26:46 +0100 |
---|---|---|
committer | Sidath Senanayake <sidaths@google.com> | 2020-09-22 19:31:32 +0100 |
commit | f27a9b87191d243a17350c528037bae6ce6e6da4 (patch) | |
tree | 2477b695cd33283cf31bdd9d357432d9a6290088 /mali_kbase/jm | |
parent | d5e0376a407d7729714f269101c6120f2589af69 (diff) | |
parent | d4ca6eb7268ee2db9deabd1745b505c6e1c162f9 (diff) | |
download | gpu-f27a9b87191d243a17350c528037bae6ce6e6da4.tar.gz |
Merge r26p0 from upstream into android-gs-pixel-5.4
This commit updates the Mali KMD to version r26p0 from
commit d4ca6eb7268ee2db9deabd1745b505c6e1c162f9
Bug: 168298113
Change-Id: Ie8caf2df2ec573a1b458651fa5eb0806efb993f1
Diffstat (limited to 'mali_kbase/jm')
-rw-r--r-- | mali_kbase/jm/mali_base_jm_kernel.h | 81 | ||||
-rw-r--r-- | mali_kbase/jm/mali_kbase_jm_defs.h | 7 | ||||
-rw-r--r-- | mali_kbase/jm/mali_kbase_jm_ioctl.h | 64 |
3 files changed, 144 insertions, 8 deletions
diff --git a/mali_kbase/jm/mali_base_jm_kernel.h b/mali_kbase/jm/mali_base_jm_kernel.h index 879a436..ce36020 100644 --- a/mali_kbase/jm/mali_base_jm_kernel.h +++ b/mali_kbase/jm/mali_base_jm_kernel.h @@ -155,18 +155,23 @@ /* Use the GPU VA chosen by the kernel client */ #define BASE_MEM_FLAG_MAP_FIXED ((base_mem_alloc_flags)1 << 27) +/* Bit 28 reserved for Kernel side cache sync ops flag */ + +/* Force trimming of JIT allocations when creating a new allocation */ +#define BASEP_MEM_PERFORM_JIT_TRIM ((base_mem_alloc_flags)1 << 29) + /* Number of bits used as flags for base memory management * * Must be kept in sync with the base_mem_alloc_flags flags */ -#define BASE_MEM_FLAGS_NR_BITS 28 +#define BASE_MEM_FLAGS_NR_BITS 30 /* A mask of all the flags which are only valid for allocations within kbase, * and may not be passed from user space. */ #define BASEP_MEM_FLAGS_KERNEL_ONLY \ (BASEP_MEM_PERMANENT_KERNEL_MAPPING | BASEP_MEM_NO_USER_FREE | \ - BASE_MEM_FLAG_MAP_FIXED) + BASE_MEM_FLAG_MAP_FIXED | BASEP_MEM_PERFORM_JIT_TRIM) /* A mask for all output bits, excluding IN/OUT bits. */ @@ -192,6 +197,28 @@ #define BASE_MEM_FIRST_FREE_ADDRESS ((BITS_PER_LONG << 12) + \ BASE_MEM_COOKIE_BASE) +/* Similar to BASE_MEM_TILER_ALIGN_TOP, memory starting from the end of the + * initial commit is aligned to 'extent' pages, where 'extent' must be a power + * of 2 and no more than BASE_MEM_TILER_ALIGN_TOP_EXTENT_MAX_PAGES + */ +#define BASE_JIT_ALLOC_MEM_TILER_ALIGN_TOP (1 << 0) + +/** + * If set, the heap info address points to a u32 holding the used size in bytes; + * otherwise it points to a u64 holding the lowest address of unused memory. + */ +#define BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE (1 << 1) + +/** + * Valid set of just-in-time memory allocation flags + * + * Note: BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE cannot be set if heap_info_gpu_addr + * in %base_jit_alloc_info is 0 (atom with BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE set + * and heap_info_gpu_addr being 0 will be rejected). + */ +#define BASE_JIT_ALLOC_VALID_FLAGS \ + (BASE_JIT_ALLOC_MEM_TILER_ALIGN_TOP | BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE) + /** * typedef base_context_create_flags - Flags to pass to ::base_context_init. * @@ -787,6 +814,54 @@ struct base_jd_atom_v2 { u8 padding[7]; }; +/** + * struct base_jd_atom - Same as base_jd_atom_v2, but has an extra seq_nr + * at the beginning. + * + * @seq_nr: Sequence number of logical grouping of atoms. + * @jc: GPU address of a job chain or (if BASE_JD_REQ_END_RENDERPASS + * is set in the base_jd_core_req) the CPU address of a + * base_jd_fragment object. + * @udata: User data. + * @extres_list: List of external resources. + * @nr_extres: Number of external resources or JIT allocations. + * @jit_id: Zero-terminated array of IDs of just-in-time memory + * allocations written to by the atom. When the atom + * completes, the value stored at the + * &struct_base_jit_alloc_info.heap_info_gpu_addr of + * each allocation is read in order to enforce an + * overall physical memory usage limit. + * @pre_dep: Pre-dependencies. One need to use SETTER function to assign + * this field; this is done in order to reduce possibility of + * improper assignment of a dependency field. + * @atom_number: Unique number to identify the atom. + * @prio: Atom priority. Refer to base_jd_prio for more details. + * @device_nr: Core group when BASE_JD_REQ_SPECIFIC_COHERENT_GROUP + * specified. + * @jobslot: Job slot to use when BASE_JD_REQ_JOB_SLOT is specified. + * @core_req: Core requirements. + * @renderpass_id: Renderpass identifier used to associate an atom that has + * BASE_JD_REQ_START_RENDERPASS set in its core requirements + * with an atom that has BASE_JD_REQ_END_RENDERPASS set. + * @padding: Unused. Must be zero. + */ +typedef struct base_jd_atom { + u64 seq_nr; + u64 jc; + struct base_jd_udata udata; + u64 extres_list; + u16 nr_extres; + u8 jit_id[2]; + struct base_dependency pre_dep[2]; + base_atom_id atom_number; + base_jd_prio prio; + u8 device_nr; + u8 jobslot; + base_jd_core_req core_req; + u8 renderpass_id; + u8 padding[7]; +} base_jd_atom; + /* Job chain event code bits * Defines the bits used to create ::base_jd_event_code */ @@ -982,7 +1057,7 @@ struct base_jd_event_v2 { * jobs. * * This structure is stored into the memory pointed to by the @jc field - * of &struct base_jd_atom_v2. + * of &struct base_jd_atom. * * It must not occupy the same CPU cache line(s) as any neighboring data. * This is to avoid cases where access to pages containing the structure diff --git a/mali_kbase/jm/mali_kbase_jm_defs.h b/mali_kbase/jm/mali_kbase_jm_defs.h index eccb432..b2014c7 100644 --- a/mali_kbase/jm/mali_kbase_jm_defs.h +++ b/mali_kbase/jm/mali_kbase_jm_defs.h @@ -504,9 +504,9 @@ struct kbase_jd_atom { struct list_head jd_item; bool in_jd_list; -#if MALI_JIT_PRESSURE_LIMIT +#if MALI_JIT_PRESSURE_LIMIT_BASE u8 jit_ids[2]; -#endif /* MALI_JIT_PRESSURE_LIMIT */ +#endif /* MALI_JIT_PRESSURE_LIMIT_BASE */ u16 nr_extres; struct kbase_ext_res *extres; @@ -616,6 +616,9 @@ struct kbase_jd_atom { atomic_t blocked; + /* user-space sequence number, to order atoms in some temporal order */ + u64 seq_nr; + struct kbase_jd_atom *pre_dep; struct kbase_jd_atom *post_dep; diff --git a/mali_kbase/jm/mali_kbase_jm_ioctl.h b/mali_kbase/jm/mali_kbase_jm_ioctl.h index 408e98e..6dc57d0 100644 --- a/mali_kbase/jm/mali_kbase_jm_ioctl.h +++ b/mali_kbase/jm/mali_kbase_jm_ioctl.h @@ -94,16 +94,32 @@ * - The above changes are checked for safe values in usual builds * 11.21: * - v2.0 of mali_trace debugfs file, which now versions the file separately + * 11.22: + * - Added base_jd_atom (v3), which is seq_nr + base_jd_atom_v2. + * KBASE_IOCTL_JOB_SUBMIT supports both in parallel. + * 11.23: + * - Modified KBASE_IOCTL_MEM_COMMIT behavior to reject requests to modify + * the physical memory backing of JIT allocations. This was not supposed + * to be a valid use case, but it was allowed by the previous implementation. + * 11.24: + * - Added a sysfs file 'serialize_jobs' inside a new sub-directory + * 'scheduling'. + * 11.25: + * - Enabled JIT pressure limit in base/kbase by default + * 11.26 + * - Added kinstr_jm API + * 11.27 + * - Backwards compatible extension to HWC ioctl. */ #define BASE_UK_VERSION_MAJOR 11 -#define BASE_UK_VERSION_MINOR 21 +#define BASE_UK_VERSION_MINOR 27 /** * struct kbase_ioctl_job_submit - Submit jobs/atoms to the kernel * - * @addr: Memory address of an array of struct base_jd_atom_v2 + * @addr: Memory address of an array of struct base_jd_atom_v2 or v3 * @nr_atoms: Number of entries in the array - * @stride: sizeof(struct base_jd_atom_v2) + * @stride: sizeof(struct base_jd_atom_v2) or sizeof(struct base_jd_atom) */ struct kbase_ioctl_job_submit { __u64 addr; @@ -132,5 +148,47 @@ struct kbase_ioctl_soft_event_update { #define KBASE_IOCTL_SOFT_EVENT_UPDATE \ _IOW(KBASE_IOCTL_TYPE, 28, struct kbase_ioctl_soft_event_update) +/** + * struct kbase_kinstr_jm_fd_out - Explains the compatibility information for + * the `struct kbase_kinstr_jm_atom_state_change` structure returned from the + * kernel + * + * @size: The size of the `struct kbase_kinstr_jm_atom_state_change` + * @version: Represents a breaking change in the + * `struct kbase_kinstr_jm_atom_state_change` + * @padding: Explicit padding to get the structure up to 64bits. See + * https://www.kernel.org/doc/Documentation/ioctl/botching-up-ioctls.rst + * + * The `struct kbase_kinstr_jm_atom_state_change` may have extra members at the + * end of the structure that older user space might not understand. If the + * `version` is the same, the structure is still compatible with newer kernels. + * The `size` can be used to cast the opaque memory returned from the kernel. + */ +struct kbase_kinstr_jm_fd_out { + __u16 size; + __u8 version; + __u8 padding[5]; +}; + +/** + * struct kbase_kinstr_jm_fd_in - Options when creating the file descriptor + * + * @count: Number of atom states that can be stored in the kernel circular + * buffer. Must be a power of two + * @padding: Explicit padding to get the structure up to 64bits. See + * https://www.kernel.org/doc/Documentation/ioctl/botching-up-ioctls.rst + */ +struct kbase_kinstr_jm_fd_in { + __u16 count; + __u8 padding[6]; +}; + +union kbase_kinstr_jm_fd { + struct kbase_kinstr_jm_fd_in in; + struct kbase_kinstr_jm_fd_out out; +}; + +#define KBASE_IOCTL_KINSTR_JM_FD \ + _IOWR(KBASE_IOCTL_TYPE, 51, union kbase_kinstr_jm_fd) #endif /* _KBASE_JM_IOCTL_H_ */ |