My Project
Classes | Macros | Typedefs | Enumerations
User-side Base Job Dispatcher APIs

Classes

struct  base_stream
 
struct  base_fence
 
struct  base_jd_udata
 Per-job data. More...
 
struct  base_mem_aliasing_info
 Memory aliasing info. More...
 
struct  base_jit_alloc_info
 
struct  base_dependency
 
struct  base_jd_atom_v2
 
struct  base_jd_atom_v2_uk6
 
struct  base_external_resource
 
struct  base_external_resource_list
 
struct  base_jd_debug_copy_buffer
 
struct  base_jd_event_v2
 Event reporting structure. More...
 
struct  base_dump_cpu_gpu_counters
 Structure for BASE_JD_REQ_SOFT_DUMP_CPU_GPU_COUNTERS jobs. More...
 

Macros

#define INVALID_PLATFORM_FENCE   ((platform_fence_type)-1)
 
#define BASE_JD_DEP_TYPE_INVALID   (0)
 
#define BASE_JD_DEP_TYPE_DATA   (1U << 0)
 
#define BASE_JD_DEP_TYPE_ORDER   (1U << 1)
 
#define BASE_JD_REQ_DEP   ((base_jd_core_req)0)
 
#define BASE_JD_REQ_FS   ((base_jd_core_req)1 << 0)
 
#define BASE_JD_REQ_CS   ((base_jd_core_req)1 << 1)
 
#define BASE_JD_REQ_T   ((base_jd_core_req)1 << 2)
 
#define BASE_JD_REQ_CF   ((base_jd_core_req)1 << 3)
 
#define BASE_JD_REQ_V   ((base_jd_core_req)1 << 4)
 
#define BASE_JD_REQ_FS_AFBC   ((base_jd_core_req)1 << 13)
 
#define BASE_JD_REQ_EVENT_COALESCE   ((base_jd_core_req)1 << 5)
 
#define BASE_JD_REQ_COHERENT_GROUP   ((base_jd_core_req)1 << 6)
 
#define BASE_JD_REQ_PERMON   ((base_jd_core_req)1 << 7)
 
#define BASE_JD_REQ_EXTERNAL_RESOURCES   ((base_jd_core_req)1 << 8)
 
#define BASE_JD_REQ_SOFT_JOB   ((base_jd_core_req)1 << 9)
 
#define BASE_JD_REQ_SOFT_DUMP_CPU_GPU_TIME   (BASE_JD_REQ_SOFT_JOB | 0x1)
 
#define BASE_JD_REQ_SOFT_FENCE_TRIGGER   (BASE_JD_REQ_SOFT_JOB | 0x2)
 
#define BASE_JD_REQ_SOFT_FENCE_WAIT   (BASE_JD_REQ_SOFT_JOB | 0x3)
 
#define BASE_JD_REQ_SOFT_REPLAY   (BASE_JD_REQ_SOFT_JOB | 0x4)
 
#define BASE_JD_REQ_SOFT_EVENT_WAIT   (BASE_JD_REQ_SOFT_JOB | 0x5)
 
#define BASE_JD_REQ_SOFT_EVENT_SET   (BASE_JD_REQ_SOFT_JOB | 0x6)
 
#define BASE_JD_REQ_SOFT_EVENT_RESET   (BASE_JD_REQ_SOFT_JOB | 0x7)
 
#define BASE_JD_REQ_SOFT_DEBUG_COPY   (BASE_JD_REQ_SOFT_JOB | 0x8)
 
#define BASE_JD_REQ_SOFT_JIT_ALLOC   (BASE_JD_REQ_SOFT_JOB | 0x9)
 
#define BASE_JD_REQ_SOFT_JIT_FREE   (BASE_JD_REQ_SOFT_JOB | 0xa)
 
#define BASE_JD_REQ_SOFT_EXT_RES_MAP   (BASE_JD_REQ_SOFT_JOB | 0xb)
 
#define BASE_JD_REQ_SOFT_EXT_RES_UNMAP   (BASE_JD_REQ_SOFT_JOB | 0xc)
 
#define BASE_JD_REQ_ONLY_COMPUTE   ((base_jd_core_req)1 << 10)
 
#define BASE_JD_REQ_SPECIFIC_COHERENT_GROUP   ((base_jd_core_req)1 << 11)
 
#define BASE_JD_REQ_EVENT_ONLY_ON_FAILURE   ((base_jd_core_req)1 << 12)
 
#define BASEP_JD_REQ_EVENT_NEVER   ((base_jd_core_req)1 << 14)
 
#define BASE_JD_REQ_SKIP_CACHE_START   ((base_jd_core_req)1 << 15)
 
#define BASE_JD_REQ_SKIP_CACHE_END   ((base_jd_core_req)1 << 16)
 
#define BASEP_JD_REQ_RESERVED
 
#define BASE_JD_REQ_ATOM_TYPE
 
#define BASE_JD_REQ_SOFT_JOB_TYPE   (BASE_JD_REQ_SOFT_JOB | 0x1f)
 
#define BASE_JD_REQ_SOFT_JOB_OR_DEP(core_req)
 
#define BASE_JD_PRIO_MEDIUM   ((base_jd_prio)0)
 
#define BASE_JD_PRIO_HIGH   ((base_jd_prio)1)
 
#define BASE_JD_PRIO_LOW   ((base_jd_prio)2)
 
#define BASE_JD_NR_PRIO_LEVELS   3
 
#define BASE_EXT_RES_COUNT_MAX   10
 
#define BASE_CPU_GPU_CACHE_LINE_PADDING   (36)
 

Typedefs

typedef int platform_fence_type
 
typedef struct base_stream base_stream
 
typedef struct base_fence base_fence
 
typedef struct base_jd_udata base_jd_udata
 Per-job data. More...
 
typedef u8 base_jd_dep_type
 Job dependency type. More...
 
typedef u32 base_jd_core_req
 Job chain hardware requirements. More...
 
typedef u8 base_jd_prio
 
typedef u8 base_atom_id
 
typedef struct base_jd_atom_v2 base_jd_atom_v2
 
typedef enum base_external_resource_access base_external_resource_access
 
typedef struct base_external_resource base_external_resource
 
typedef enum base_jd_event_code base_jd_event_code
 Job chain event codes. More...
 
typedef struct base_jd_event_v2 base_jd_event_v2
 Event reporting structure. More...
 
typedef struct base_dump_cpu_gpu_counters base_dump_cpu_gpu_counters
 Structure for BASE_JD_REQ_SOFT_DUMP_CPU_GPU_COUNTERS jobs. More...
 

Enumerations

enum  kbase_atom_coreref_state {
  KBASE_ATOM_COREREF_STATE_NO_CORES_REQUESTED, KBASE_ATOM_COREREF_STATE_WAITING_FOR_REQUESTED_CORES, KBASE_ATOM_COREREF_STATE_RECHECK_AFFINITY, KBASE_ATOM_COREREF_STATE_CHECK_AFFINITY_VIOLATIONS,
  KBASE_ATOM_COREREF_STATE_READY
}
 States to model state machine processed by kbasep_js_job_check_ref_cores(), which handles retaining cores for power management and affinity management. More...
 
enum  kbase_jd_atom_state {
  KBASE_JD_ATOM_STATE_UNUSED, KBASE_JD_ATOM_STATE_QUEUED, KBASE_JD_ATOM_STATE_IN_JS, KBASE_JD_ATOM_STATE_HW_COMPLETED,
  KBASE_JD_ATOM_STATE_COMPLETED
}
 
enum  base_external_resource_access { BASE_EXT_RES_ACCESS_SHARED, BASE_EXT_RES_ACCESS_EXCLUSIVE }
 
enum  {
  BASE_JD_SW_EVENT_KERNEL = (1u << 15), BASE_JD_SW_EVENT = (1u << 14), BASE_JD_SW_EVENT_SUCCESS = (1u << 13), BASE_JD_SW_EVENT_JOB = (0u << 11),
  BASE_JD_SW_EVENT_BAG = (1u << 11), BASE_JD_SW_EVENT_INFO = (2u << 11), BASE_JD_SW_EVENT_RESERVED = (3u << 11), BASE_JD_SW_EVENT_TYPE_MASK = (3u << 11)
}
 Job chain event code bits Defines the bits used to create base_jd_event_code. More...
 
enum  base_jd_event_code {
  BASE_JD_EVENT_RANGE_HW_NONFAULT_START = 0, BASE_JD_EVENT_NOT_STARTED = 0x00, BASE_JD_EVENT_DONE = 0x01, BASE_JD_EVENT_STOPPED = 0x03,
  BASE_JD_EVENT_TERMINATED = 0x04, BASE_JD_EVENT_ACTIVE = 0x08, BASE_JD_EVENT_RANGE_HW_NONFAULT_END = 0x40, BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_START = 0x40,
  BASE_JD_EVENT_JOB_CONFIG_FAULT = 0x40, BASE_JD_EVENT_JOB_POWER_FAULT = 0x41, BASE_JD_EVENT_JOB_READ_FAULT = 0x42, BASE_JD_EVENT_JOB_WRITE_FAULT = 0x43,
  BASE_JD_EVENT_JOB_AFFINITY_FAULT = 0x44, BASE_JD_EVENT_JOB_BUS_FAULT = 0x48, BASE_JD_EVENT_INSTR_INVALID_PC = 0x50, BASE_JD_EVENT_INSTR_INVALID_ENC = 0x51,
  BASE_JD_EVENT_INSTR_TYPE_MISMATCH = 0x52, BASE_JD_EVENT_INSTR_OPERAND_FAULT = 0x53, BASE_JD_EVENT_INSTR_TLS_FAULT = 0x54, BASE_JD_EVENT_INSTR_BARRIER_FAULT = 0x55,
  BASE_JD_EVENT_INSTR_ALIGN_FAULT = 0x56, BASE_JD_EVENT_DATA_INVALID_FAULT = 0x58, BASE_JD_EVENT_TILE_RANGE_FAULT = 0x59, BASE_JD_EVENT_STATE_FAULT = 0x5A,
  BASE_JD_EVENT_OUT_OF_MEMORY = 0x60, BASE_JD_EVENT_UNKNOWN = 0x7F, BASE_JD_EVENT_DELAYED_BUS_FAULT = 0x80, BASE_JD_EVENT_SHAREABILITY_FAULT = 0x88,
  BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL1 = 0xC1, BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL2 = 0xC2, BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL3 = 0xC3, BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL4 = 0xC4,
  BASE_JD_EVENT_PERMISSION_FAULT = 0xC8, BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL1 = 0xD1, BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL2 = 0xD2, BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL3 = 0xD3,
  BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL4 = 0xD4, BASE_JD_EVENT_ACCESS_FLAG = 0xD8, BASE_JD_EVENT_MEM_GROWTH_FAILED = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x000, BASE_JD_EVENT_TIMED_OUT = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x001,
  BASE_JD_EVENT_JOB_CANCELLED = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x002, BASE_JD_EVENT_JOB_INVALID = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x003, BASE_JD_EVENT_PM_EVENT = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x004, BASE_JD_EVENT_FORCE_REPLAY = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x005,
  BASE_JD_EVENT_BAG_INVALID = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_BAG | 0x003, BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_END = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_RESERVED | 0x3FF, BASE_JD_EVENT_RANGE_SW_SUCCESS_START = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_SUCCESS | 0x000, BASE_JD_EVENT_PROGRESS_REPORT = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_JOB | 0x000,
  BASE_JD_EVENT_BAG_DONE = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_BAG | 0x000, BASE_JD_EVENT_DRV_TERMINATED = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_INFO | 0x000, BASE_JD_EVENT_RANGE_SW_SUCCESS_END = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_RESERVED | 0x3FF, BASE_JD_EVENT_RANGE_KERNEL_ONLY_START = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_KERNEL | 0x000,
  BASE_JD_EVENT_REMOVED_FROM_NEXT = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_KERNEL | BASE_JD_SW_EVENT_JOB | 0x000, BASE_JD_EVENT_RANGE_KERNEL_ONLY_END = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_KERNEL | BASE_JD_SW_EVENT_RESERVED | 0x3FF
}
 Job chain event codes. More...
 

Detailed Description

Macro Definition Documentation

◆ BASE_CPU_GPU_CACHE_LINE_PADDING

#define BASE_CPU_GPU_CACHE_LINE_PADDING   (36)

Padding required to ensure that the struct base_dump_cpu_gpu_counters structure fills a full cache line.

◆ BASE_EXT_RES_COUNT_MAX

#define BASE_EXT_RES_COUNT_MAX   10

The maximum number of external resources which can be mapped/unmapped in a single request.

◆ BASE_JD_DEP_TYPE_DATA

#define BASE_JD_DEP_TYPE_DATA   (1U << 0)

Data dependency

◆ BASE_JD_DEP_TYPE_INVALID

#define BASE_JD_DEP_TYPE_INVALID   (0)

Invalid dependency

◆ BASE_JD_DEP_TYPE_ORDER

#define BASE_JD_DEP_TYPE_ORDER   (1U << 1)

Order dependency

◆ BASE_JD_REQ_ATOM_TYPE

#define BASE_JD_REQ_ATOM_TYPE
Value:
#define BASE_JD_REQ_ONLY_COMPUTE
Definition: mali_base_kernel.h:637
#define BASE_JD_REQ_FS
Definition: mali_base_kernel.h:464
#define BASE_JD_REQ_T
Definition: mali_base_kernel.h:478
#define BASE_JD_REQ_CF
Definition: mali_base_kernel.h:479
#define BASE_JD_REQ_SOFT_JOB
Definition: mali_base_kernel.h:525
#define BASE_JD_REQ_CS
Definition: mali_base_kernel.h:477

Mask of all bits in base_jd_core_req that control the type of the atom.

This allows dependency only atoms to have flags set

◆ BASE_JD_REQ_CF

#define BASE_JD_REQ_CF   ((base_jd_core_req)1 << 3)

Requires cache flushes

◆ BASE_JD_REQ_COHERENT_GROUP

#define BASE_JD_REQ_COHERENT_GROUP   ((base_jd_core_req)1 << 6)

SW Only requirement: the job chain requires a coherent core group. We don't mind which coherent core group is used.

◆ BASE_JD_REQ_CS

#define BASE_JD_REQ_CS   ((base_jd_core_req)1 << 1)

Requires compute shaders This covers any of the following Midgard Job types:

  • Vertex Shader Job
  • Geometry Shader Job
  • An actual Compute Shader Job

Compare this with BASE_JD_REQ_ONLY_COMPUTE, which specifies that the job is specifically just the "Compute Shader" job type, and not the "Vertex Shader" nor the "Geometry Shader" job type.

◆ BASE_JD_REQ_DEP

#define BASE_JD_REQ_DEP   ((base_jd_core_req)0)

No requirement, dependency only

◆ BASE_JD_REQ_EVENT_COALESCE

#define BASE_JD_REQ_EVENT_COALESCE   ((base_jd_core_req)1 << 5)

SW-only requirement: coalesce completion events. If this bit is set then completion of this atom will not cause an event to be sent to userspace, whether successful or not; completion events will be deferred until an atom completes which does not have this bit set.

This bit may not be used in combination with BASE_JD_REQ_EXTERNAL_RESOURCES.

◆ BASE_JD_REQ_EVENT_ONLY_ON_FAILURE

#define BASE_JD_REQ_EVENT_ONLY_ON_FAILURE   ((base_jd_core_req)1 << 12)

SW Flag: If this bit is set then the successful completion of this atom will not cause an event to be sent to userspace

◆ BASE_JD_REQ_EXTERNAL_RESOURCES

#define BASE_JD_REQ_EXTERNAL_RESOURCES   ((base_jd_core_req)1 << 8)

SW Only requirement: External resources are referenced by this atom. When external resources are referenced no syncsets can be bundled with the atom but should instead be part of a NULL jobs inserted into the dependency tree. The first pre_dep object must be configured for the external resouces to use, the second pre_dep object can be used to create other dependencies.

This bit may not be used in combination with BASE_JD_REQ_EVENT_COALESCE.

◆ BASE_JD_REQ_FS

#define BASE_JD_REQ_FS   ((base_jd_core_req)1 << 0)

Requires fragment shaders

◆ BASE_JD_REQ_ONLY_COMPUTE

#define BASE_JD_REQ_ONLY_COMPUTE   ((base_jd_core_req)1 << 10)

HW Requirement: Requires Compute shaders (but not Vertex or Geometry Shaders)

This indicates that the Job Chain contains Midgard Jobs of the 'Compute Shaders' type.

In contrast to BASE_JD_REQ_CS, this does not indicate that the Job Chain contains 'Geometry Shader' or 'Vertex Shader' jobs.

◆ BASE_JD_REQ_PERMON

#define BASE_JD_REQ_PERMON   ((base_jd_core_req)1 << 7)

SW Only requirement: The performance counters should be enabled only when they are needed, to reduce power consumption.

◆ BASE_JD_REQ_SKIP_CACHE_END

#define BASE_JD_REQ_SKIP_CACHE_END   ((base_jd_core_req)1 << 16)

SW Flag: Skip GPU cache clean and invalidation after a GPU job completes.

If this bit is set then the GPU's cache will not be cleaned and invalidated until a GPU job completes which does not have this bit set or a job starts which does not have the BASE_JD_REQ_SKIP_CACHE_START bti set. Do not use if the CPU may read from or partially overwrite memory addressed by the job before the next job without this bit set completes.

◆ BASE_JD_REQ_SKIP_CACHE_START

#define BASE_JD_REQ_SKIP_CACHE_START   ((base_jd_core_req)1 << 15)

SW Flag: Skip GPU cache clean and invalidation before starting a GPU job.

If this bit is set then the GPU's cache will not be cleaned and invalidated until a GPU job starts which does not have this bit set or a job completes which does not have the BASE_JD_REQ_SKIP_CACHE_END bit set. Do not use if the CPU may have written to memory addressed by the job since the last job without this bit set was submitted.

◆ BASE_JD_REQ_SOFT_EVENT_WAIT

#define BASE_JD_REQ_SOFT_EVENT_WAIT   (BASE_JD_REQ_SOFT_JOB | 0x5)

SW only requirement: event wait/trigger job.

  • BASE_JD_REQ_SOFT_EVENT_WAIT: this job will block until the event is set.
  • BASE_JD_REQ_SOFT_EVENT_SET: this job sets the event, thus unblocks the other waiting jobs. It completes immediately.
  • BASE_JD_REQ_SOFT_EVENT_RESET: this job resets the event, making it possible for other jobs to wait upon. It completes immediately.

◆ BASE_JD_REQ_SOFT_EXT_RES_MAP

#define BASE_JD_REQ_SOFT_EXT_RES_MAP   (BASE_JD_REQ_SOFT_JOB | 0xb)

SW only requirement: Map external resource

This job requests external resource(s) are mapped once the dependencies of the job have been satisfied. The list of external resources are passed via the jc element of the atom which is a pointer to a .

◆ BASE_JD_REQ_SOFT_EXT_RES_UNMAP

#define BASE_JD_REQ_SOFT_EXT_RES_UNMAP   (BASE_JD_REQ_SOFT_JOB | 0xc)

SW only requirement: Unmap external resource

This job requests external resource(s) are unmapped once the dependencies of the job has been satisfied. The list of external resources are passed via the jc element of the atom which is a pointer to a .

◆ BASE_JD_REQ_SOFT_JIT_ALLOC

#define BASE_JD_REQ_SOFT_JIT_ALLOC   (BASE_JD_REQ_SOFT_JOB | 0x9)

SW only requirement: Just In Time allocation

This job requests a JIT allocation based on the request in the structure which is passed via the jc element of the atom.

It should be noted that the id entry in must not be reused until it has been released via .

Should this soft job fail it is expected that a soft job to free the JIT allocation is still made.

The job will complete immediately.

◆ BASE_JD_REQ_SOFT_JIT_FREE

#define BASE_JD_REQ_SOFT_JIT_FREE   (BASE_JD_REQ_SOFT_JOB | 0xa)

SW only requirement: Just In Time free

This job requests a JIT allocation created by to be freed. The ID of the JIT allocation is passed via the jc element of the atom.

The job will complete immediately.

◆ BASE_JD_REQ_SOFT_JOB

#define BASE_JD_REQ_SOFT_JOB   ((base_jd_core_req)1 << 9)

SW Only requirement: Software defined job. Jobs with this bit set will not be submitted to the hardware but will cause some action to happen within the driver

◆ BASE_JD_REQ_SOFT_JOB_OR_DEP

#define BASE_JD_REQ_SOFT_JOB_OR_DEP (   core_req)
Value:
((core_req & BASE_JD_REQ_SOFT_JOB) || \
#define BASE_JD_REQ_SOFT_JOB
Definition: mali_base_kernel.h:525
#define BASE_JD_REQ_DEP
Definition: mali_base_kernel.h:459
#define BASE_JD_REQ_ATOM_TYPE
Definition: mali_base_kernel.h:702

◆ BASE_JD_REQ_SOFT_JOB_TYPE

#define BASE_JD_REQ_SOFT_JOB_TYPE   (BASE_JD_REQ_SOFT_JOB | 0x1f)

Mask of all bits in base_jd_core_req that control the type of a soft job.

◆ BASE_JD_REQ_SOFT_REPLAY

#define BASE_JD_REQ_SOFT_REPLAY   (BASE_JD_REQ_SOFT_JOB | 0x4)

SW Only requirement : Replay job.

If the preceding job fails, the replay job will cause the jobs specified in the list of base_jd_replay_payload pointed to by the jc pointer to be replayed.

A replay job will only cause jobs to be replayed up to BASEP_JD_REPLAY_LIMIT times. If a job fails more than BASEP_JD_REPLAY_LIMIT times then the replay job is failed, as well as any following dependencies.

The replayed jobs will require a number of atom IDs. If there are not enough free atom IDs then the replay job will fail.

If the preceding job does not fail, then the replay job is returned as completed.

The replayed jobs will never be returned to userspace. The preceding failed job will be returned to userspace as failed; the status of this job should be ignored. Completion should be determined by the status of the replay soft job.

In order for the jobs to be replayed, the job headers will have to be modified. The Status field will be reset to NOT_STARTED. If the Job Type field indicates a Vertex Shader Job then it will be changed to Null Job.

The replayed jobs have the following assumptions :

  • No external resources. Any required external resources will be held by the replay atom.
  • Pre-dependencies are created based on job order.
  • Atom numbers are automatically assigned.
  • device_nr is set to 0. This is not relevant as BASE_JD_REQ_SPECIFIC_COHERENT_GROUP should not be set.
  • Priority is inherited from the replay job.

◆ BASE_JD_REQ_SPECIFIC_COHERENT_GROUP

#define BASE_JD_REQ_SPECIFIC_COHERENT_GROUP   ((base_jd_core_req)1 << 11)

HW Requirement: Use the base_jd_atom::device_nr field to specify a particular core group

If both BASE_JD_REQ_COHERENT_GROUP and this flag are set, this flag takes priority

This is only guaranteed to work for BASE_JD_REQ_ONLY_COMPUTE atoms.

If the core availability policy is keeping the required core group turned off, then the job will fail with a BASE_JD_EVENT_PM_EVENT error code.

◆ BASE_JD_REQ_T

#define BASE_JD_REQ_T   ((base_jd_core_req)1 << 2)

Requires tiling

◆ BASE_JD_REQ_V

#define BASE_JD_REQ_V   ((base_jd_core_req)1 << 4)

Requires value writeback

◆ BASEP_JD_REQ_EVENT_NEVER

#define BASEP_JD_REQ_EVENT_NEVER   ((base_jd_core_req)1 << 14)

SW Flag: If this bit is set then completion of this atom will not cause an event to be sent to userspace, whether successful or not.

◆ BASEP_JD_REQ_RESERVED

#define BASEP_JD_REQ_RESERVED
Value:
BASE_JD_REQ_EVENT_ONLY_ON_FAILURE | BASEP_JD_REQ_EVENT_NEVER | \
BASE_JD_REQ_EVENT_COALESCE | \
BASE_JD_REQ_COHERENT_GROUP | BASE_JD_REQ_SPECIFIC_COHERENT_GROUP | \
BASE_JD_REQ_FS_AFBC | BASE_JD_REQ_PERMON | \
BASE_JD_REQ_SKIP_CACHE_START | BASE_JD_REQ_SKIP_CACHE_END))
#define BASE_JD_REQ_SPECIFIC_COHERENT_GROUP
Definition: mali_base_kernel.h:650
#define BASE_JD_REQ_EXTERNAL_RESOURCES
Definition: mali_base_kernel.h:519
#define BASE_JD_REQ_SKIP_CACHE_END
Definition: mali_base_kernel.h:684
#define BASEP_JD_REQ_EVENT_NEVER
Definition: mali_base_kernel.h:662
#define BASE_JD_REQ_PERMON
Definition: mali_base_kernel.h:508
#define BASE_JD_REQ_ATOM_TYPE
Definition: mali_base_kernel.h:702

These requirement bits are currently unused in base_jd_core_req

Typedef Documentation

◆ base_atom_id

typedef u8 base_atom_id

Type big enough to store an atom number in

◆ base_dump_cpu_gpu_counters

Structure for BASE_JD_REQ_SOFT_DUMP_CPU_GPU_COUNTERS jobs.

This structure is stored into the memory pointed to by the jc field of base_jd_atom.

This structure must be padded to ensure that it will occupy whole cache lines. This is to avoid cases where access to pages containing the structure is shared between cached and un-cached memory regions, which would cause memory corruption. Here we set the structure size to be 64 bytes which is the cache line for ARM A15 processors.

◆ base_fence

typedef struct base_fence base_fence

Base fence handle.

References an underlying base fence object.

◆ base_jd_core_req

typedef u32 base_jd_core_req

Job chain hardware requirements.

A job chain must specify what GPU features it needs to allow the driver to schedule the job correctly. By not specifying the correct settings can/will cause an early job termination. Multiple values can be ORed together to specify multiple requirements. Special case is BASE_JD_REQ_DEP, which is used to express complex dependencies, and that doesn't execute anything on the hardware.

◆ base_jd_dep_type

typedef u8 base_jd_dep_type

Job dependency type.

A flags field will be inserted into the atom structure to specify whether a dependency is a data or ordering dependency (by putting it before/after 'core_req' in the structure it should be possible to add without changing the structure size). When the flag is set for a particular dependency to signal that it is an ordering only dependency then errors will not be propagated.

◆ base_jd_event_code

Job chain event codes.

HW and low-level SW events are represented by event codes. The status of jobs which succeeded are also represented by an event code (see ::BASE_JD_EVENT_DONE). Events are usually reported as part of a ::base_jd_event.

The event codes are encoded in the following way:

  • 10:0 - subtype
  • 12:11 - type
  • 13 - SW success (only valid if the SW bit is set)
  • 14 - SW event (HW event if not set)
  • 15 - Kernel event (should never be seen in userspace)

Events are split up into ranges as follows:

  • BASE_JD_EVENT_RANGE_<description>_START
  • BASE_JD_EVENT_RANGE_<description>_END

code is in <description>'s range when:

  • BASE_JD_EVENT_RANGE_<description>_START <= code < BASE_JD_EVENT_RANGE_<description>_END

Ranges can be asserted for adjacency by testing that the END of the previous is equal to the START of the next. This is useful for optimizing some tests for range.

A limitation is that the last member of this enum must explicitly be handled (with an assert-unreachable statement) in switch statements that use variables of this type. Otherwise, the compiler warns that we have not handled that enum value.

◆ base_jd_event_v2

Event reporting structure.

This structure is used by the kernel driver to report information about GPU events. The can either be HW-specific events or low-level SW events, such as job-chain completion.

The event code contains an event type field which can be extracted by ANDing with BASE_JD_SW_EVENT_TYPE_MASK.

Based on the event type base_jd_event::data holds:

◆ base_jd_udata

typedef struct base_jd_udata base_jd_udata

Per-job data.

This structure is used to store per-job data, and is completely unused by the Base driver. It can be used to store things such as callback function pointer, data to handle job completion. It is guaranteed to be untouched by the Base driver.

◆ base_stream

typedef struct base_stream base_stream

Base stream handle.

References an underlying base stream object.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Job chain event code bits Defines the bits used to create base_jd_event_code.

Enumerator
BASE_JD_SW_EVENT_KERNEL 

Kernel side event

BASE_JD_SW_EVENT 

SW defined event

BASE_JD_SW_EVENT_SUCCESS 

Event idicates success (SW events only)

BASE_JD_SW_EVENT_JOB 

Job related event

BASE_JD_SW_EVENT_BAG 

Bag related event

BASE_JD_SW_EVENT_INFO 

Misc/info event

BASE_JD_SW_EVENT_RESERVED 

Reserved event type

BASE_JD_SW_EVENT_TYPE_MASK 

Mask to extract the type from an event code

◆ base_jd_event_code

Job chain event codes.

HW and low-level SW events are represented by event codes. The status of jobs which succeeded are also represented by an event code (see ::BASE_JD_EVENT_DONE). Events are usually reported as part of a ::base_jd_event.

The event codes are encoded in the following way:

  • 10:0 - subtype
  • 12:11 - type
  • 13 - SW success (only valid if the SW bit is set)
  • 14 - SW event (HW event if not set)
  • 15 - Kernel event (should never be seen in userspace)

Events are split up into ranges as follows:

  • BASE_JD_EVENT_RANGE_<description>_START
  • BASE_JD_EVENT_RANGE_<description>_END

code is in <description>'s range when:

  • BASE_JD_EVENT_RANGE_<description>_START <= code < BASE_JD_EVENT_RANGE_<description>_END

Ranges can be asserted for adjacency by testing that the END of the previous is equal to the START of the next. This is useful for optimizing some tests for range.

A limitation is that the last member of this enum must explicitly be handled (with an assert-unreachable statement) in switch statements that use variables of this type. Otherwise, the compiler warns that we have not handled that enum value.

Enumerator
BASE_JD_EVENT_RANGE_HW_NONFAULT_START 

Start of HW Non-fault status codes

Note
Obscurely, BASE_JD_EVENT_TERMINATED indicates a real fault, because the job was hard-stopped
BASE_JD_EVENT_NOT_STARTED 

Can't be seen by userspace, treated as 'previous job done'

BASE_JD_EVENT_STOPPED 

Can't be seen by userspace, becomes TERMINATED, DONE or JOB_CANCELLED

BASE_JD_EVENT_TERMINATED 

This is actually a fault status code - the job was hard stopped

BASE_JD_EVENT_ACTIVE 

Can't be seen by userspace, jobs only returned on complete/fail/cancel

BASE_JD_EVENT_RANGE_HW_NONFAULT_END 

End of HW Non-fault status codes

Note
Obscurely, BASE_JD_EVENT_TERMINATED indicates a real fault, because the job was hard-stopped
BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_START 

Start of HW fault and SW Error status codes

BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_END 

End of HW fault and SW Error status codes

BASE_JD_EVENT_RANGE_SW_SUCCESS_START 

Start of SW Success status codes

BASE_JD_EVENT_RANGE_SW_SUCCESS_END 

End of SW Success status codes

BASE_JD_EVENT_RANGE_KERNEL_ONLY_START 

Start of Kernel-only status codes. Such codes are never returned to user-space

BASE_JD_EVENT_RANGE_KERNEL_ONLY_END 

End of Kernel-only status codes.

◆ kbase_atom_coreref_state

States to model state machine processed by kbasep_js_job_check_ref_cores(), which handles retaining cores for power management and affinity management.

The state KBASE_ATOM_COREREF_STATE_RECHECK_AFFINITY prevents an attack where lots of atoms could be submitted before powerup, and each has an affinity chosen that causes other atoms to have an affinity violation. Whilst the affinity was not causing violations at the time it was chosen, it could cause violations thereafter. For example, 1000 jobs could have had their affinity chosen during the powerup time, so any of those 1000 jobs could cause an affinity violation later on.

The attack would otherwise occur because other atoms/contexts have to wait for:

  1. the currently running atoms (which are causing the violation) to finish
  2. and, the atoms that had their affinity chosen during powerup to finish. These are run preferentially because they don't cause a violation, but instead continue to cause the violation in others.
  3. or, the attacker is scheduled out (which might not happen for just 2 contexts)

By re-choosing the affinity (which is designed to avoid violations at the time it's chosen), we break condition (2) of the wait, which minimizes the problem to just waiting for current jobs to finish (which can be bounded if the Job Scheduling Policy has a timer).

Enumerator
KBASE_ATOM_COREREF_STATE_NO_CORES_REQUESTED 

Starting state: No affinity chosen, and cores must be requested. kbase_jd_atom::affinity==0

KBASE_ATOM_COREREF_STATE_WAITING_FOR_REQUESTED_CORES 

Cores requested, but waiting for them to be powered. Requested cores given by kbase_jd_atom::affinity

KBASE_ATOM_COREREF_STATE_RECHECK_AFFINITY 

Cores given by kbase_jd_atom::affinity are powered, but affinity might be out-of-date, so must recheck

KBASE_ATOM_COREREF_STATE_CHECK_AFFINITY_VIOLATIONS 

Cores given by kbase_jd_atom::affinity are powered, and affinity is up-to-date, but must check for violations

KBASE_ATOM_COREREF_STATE_READY 

Cores are powered, kbase_jd_atom::affinity up-to-date, no affinity violations: atom can be submitted to HW

◆ kbase_jd_atom_state

Enumerator
KBASE_JD_ATOM_STATE_UNUSED 

Atom is not used

KBASE_JD_ATOM_STATE_QUEUED 

Atom is queued in JD

KBASE_JD_ATOM_STATE_IN_JS 

Atom has been given to JS (is runnable/running)

KBASE_JD_ATOM_STATE_HW_COMPLETED 

Atom has been completed, but not yet handed back to job dispatcher for dependency resolution

KBASE_JD_ATOM_STATE_COMPLETED 

Atom has been completed, but not yet handed back to userspace