Commit a26f067f authored by Sarah Walker's avatar Sarah Walker Committed by Maxime Ripard

drm/imagination: Add FWIF headers

Changes since v8:
- Corrected license identifiers

Changes since v7:
- Add padding to struct rogue_fwif_ccb_ctl to place read and write offsets
  in different cache lines

Changes since v5:
- Split up header commit due to size
- Add BRN 71242 to device info

Changes since v4:
- Add FW header device info
Signed-off-by: default avatarSarah Walker <sarah.walker@imgtec.com>
Signed-off-by: default avatarDonald Robson <donald.robson@imgtec.com>
Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/aa681533a02bd2d46af17a6a6010f4d6048fbb0a.1700668843.git.donald.robson@imgtec.comSigned-off-by: default avatarMaxime Ripard <mripard@kernel.org>
parent 7900e004
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_FWIF_CLIENT_CHECK_H
#define PVR_ROGUE_FWIF_CLIENT_CHECK_H
#include <linux/build_bug.h>
#define OFFSET_CHECK(type, member, offset) \
static_assert(offsetof(type, member) == (offset), \
"offsetof(" #type ", " #member ") incorrect")
#define SIZE_CHECK(type, size) \
static_assert(sizeof(type) == (size), #type " is incorrect size")
OFFSET_CHECK(struct rogue_fwif_geom_regs, vdm_ctrl_stream_base, 0);
OFFSET_CHECK(struct rogue_fwif_geom_regs, tpu_border_colour_table, 8);
OFFSET_CHECK(struct rogue_fwif_geom_regs, vdm_draw_indirect0, 16);
OFFSET_CHECK(struct rogue_fwif_geom_regs, vdm_draw_indirect1, 24);
OFFSET_CHECK(struct rogue_fwif_geom_regs, ppp_ctrl, 28);
OFFSET_CHECK(struct rogue_fwif_geom_regs, te_psg, 32);
OFFSET_CHECK(struct rogue_fwif_geom_regs, tpu, 36);
OFFSET_CHECK(struct rogue_fwif_geom_regs, vdm_context_resume_task0_size, 40);
OFFSET_CHECK(struct rogue_fwif_geom_regs, vdm_context_resume_task3_size, 44);
OFFSET_CHECK(struct rogue_fwif_geom_regs, pds_ctrl, 48);
OFFSET_CHECK(struct rogue_fwif_geom_regs, view_idx, 52);
OFFSET_CHECK(struct rogue_fwif_geom_regs, pds_coeff_free_prog, 56);
SIZE_CHECK(struct rogue_fwif_geom_regs, 64);
OFFSET_CHECK(struct rogue_fwif_dummy_rgnhdr_init_geom_regs, te_psgregion_addr, 0);
SIZE_CHECK(struct rogue_fwif_dummy_rgnhdr_init_geom_regs, 8);
OFFSET_CHECK(struct rogue_fwif_cmd_geom, cmd_shared, 0);
OFFSET_CHECK(struct rogue_fwif_cmd_geom, regs, 16);
OFFSET_CHECK(struct rogue_fwif_cmd_geom, flags, 80);
OFFSET_CHECK(struct rogue_fwif_cmd_geom, partial_render_geom_frag_fence, 84);
OFFSET_CHECK(struct rogue_fwif_cmd_geom, dummy_rgnhdr_init_geom_regs, 96);
OFFSET_CHECK(struct rogue_fwif_cmd_geom, brn61484_66333_live_rt, 104);
SIZE_CHECK(struct rogue_fwif_cmd_geom, 112);
OFFSET_CHECK(struct rogue_fwif_frag_regs, usc_pixel_output_ctrl, 0);
OFFSET_CHECK(struct rogue_fwif_frag_regs, usc_clear_register, 4);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_bgobjdepth, 36);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_bgobjvals, 40);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_aa, 44);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_xtp_pipe_enable, 48);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_ctl, 52);
OFFSET_CHECK(struct rogue_fwif_frag_regs, tpu, 56);
OFFSET_CHECK(struct rogue_fwif_frag_regs, event_pixel_pds_info, 60);
OFFSET_CHECK(struct rogue_fwif_frag_regs, pixel_phantom, 64);
OFFSET_CHECK(struct rogue_fwif_frag_regs, view_idx, 68);
OFFSET_CHECK(struct rogue_fwif_frag_regs, event_pixel_pds_data, 72);
OFFSET_CHECK(struct rogue_fwif_frag_regs, brn65101_event_pixel_pds_data, 76);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_oclqry_stride, 80);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_zls_pixels, 84);
OFFSET_CHECK(struct rogue_fwif_frag_regs, rgx_cr_blackpearl_fix, 88);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_scissor_base, 96);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_dbias_base, 104);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_oclqry_base, 112);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_zlsctl, 120);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_zload_store_base, 128);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_stencil_load_store_base, 136);
OFFSET_CHECK(struct rogue_fwif_frag_regs, fb_cdc_zls, 144);
OFFSET_CHECK(struct rogue_fwif_frag_regs, pbe_word, 152);
OFFSET_CHECK(struct rogue_fwif_frag_regs, tpu_border_colour_table, 344);
OFFSET_CHECK(struct rogue_fwif_frag_regs, pds_bgnd, 352);
OFFSET_CHECK(struct rogue_fwif_frag_regs, pds_bgnd_brn65101, 376);
OFFSET_CHECK(struct rogue_fwif_frag_regs, pds_pr_bgnd, 400);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_dummy_stencil_store_base, 424);
OFFSET_CHECK(struct rogue_fwif_frag_regs, isp_dummy_depth_store_base, 432);
OFFSET_CHECK(struct rogue_fwif_frag_regs, rgnhdr_single_rt_size, 440);
OFFSET_CHECK(struct rogue_fwif_frag_regs, rgnhdr_scratch_offset, 444);
SIZE_CHECK(struct rogue_fwif_frag_regs, 448);
OFFSET_CHECK(struct rogue_fwif_cmd_frag, cmd_shared, 0);
OFFSET_CHECK(struct rogue_fwif_cmd_frag, regs, 16);
OFFSET_CHECK(struct rogue_fwif_cmd_frag, flags, 464);
OFFSET_CHECK(struct rogue_fwif_cmd_frag, zls_stride, 468);
OFFSET_CHECK(struct rogue_fwif_cmd_frag, sls_stride, 472);
OFFSET_CHECK(struct rogue_fwif_cmd_frag, execute_count, 476);
SIZE_CHECK(struct rogue_fwif_cmd_frag, 480);
OFFSET_CHECK(struct rogue_fwif_compute_regs, tpu_border_colour_table, 0);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_cb_queue, 8);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_cb_base, 16);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_cb, 24);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_ctrl_stream_base, 32);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_context_state_base_addr, 40);
OFFSET_CHECK(struct rogue_fwif_compute_regs, tpu, 48);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_resume_pds1, 52);
OFFSET_CHECK(struct rogue_fwif_compute_regs, cdm_item, 56);
OFFSET_CHECK(struct rogue_fwif_compute_regs, compute_cluster, 60);
OFFSET_CHECK(struct rogue_fwif_compute_regs, tpu_tag_cdm_ctrl, 64);
SIZE_CHECK(struct rogue_fwif_compute_regs, 72);
OFFSET_CHECK(struct rogue_fwif_cmd_compute, common, 0);
OFFSET_CHECK(struct rogue_fwif_cmd_compute, regs, 8);
OFFSET_CHECK(struct rogue_fwif_cmd_compute, flags, 80);
OFFSET_CHECK(struct rogue_fwif_cmd_compute, num_temp_regions, 84);
OFFSET_CHECK(struct rogue_fwif_cmd_compute, stream_start_offset, 88);
OFFSET_CHECK(struct rogue_fwif_cmd_compute, execute_count, 92);
SIZE_CHECK(struct rogue_fwif_cmd_compute, 96);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_bgobjvals, 0);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, usc_pixel_output_ctrl, 4);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, usc_clear_register0, 8);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, usc_clear_register1, 12);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, usc_clear_register2, 16);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, usc_clear_register3, 20);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_mtile_size, 24);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_render_origin, 28);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_ctl, 32);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_xtp_pipe_enable, 36);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_aa, 40);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, event_pixel_pds_info, 44);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, event_pixel_pds_code, 48);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, event_pixel_pds_data, 52);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_render, 56);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_rgn, 60);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, frag_screen, 64);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, pds_bgnd0_base, 72);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, pds_bgnd1_base, 80);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, pds_bgnd3_sizeinfo, 88);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, isp_mtile_base, 96);
OFFSET_CHECK(struct rogue_fwif_transfer_regs, pbe_wordx_mrty, 104);
SIZE_CHECK(struct rogue_fwif_transfer_regs, 176);
OFFSET_CHECK(struct rogue_fwif_cmd_transfer, common, 0);
OFFSET_CHECK(struct rogue_fwif_cmd_transfer, regs, 8);
OFFSET_CHECK(struct rogue_fwif_cmd_transfer, flags, 184);
SIZE_CHECK(struct rogue_fwif_cmd_transfer, 192);
#endif /* PVR_ROGUE_FWIF_CLIENT_CHECK_H */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_FWIF_COMMON_H
#define PVR_ROGUE_FWIF_COMMON_H
#include <linux/build_bug.h>
/*
* This macro represents a mask of LSBs that must be zero on data structure
* sizes and offsets to ensure they are 8-byte granular on types shared between
* the FW and host driver.
*/
#define PVR_FW_ALIGNMENT_LSB 7U
/* Macro to test structure size alignment. */
#define PVR_FW_STRUCT_SIZE_ASSERT(_a) \
static_assert((sizeof(_a) & PVR_FW_ALIGNMENT_LSB) == 0U, \
"Size of " #_a " is not properly aligned")
/* The master definition for data masters known to the firmware. */
#define PVR_FWIF_DM_GP (0)
/* Either TDM or 2D DM is present. */
/* When the 'tla' feature is present in the hw (as per @pvr_device_features). */
#define PVR_FWIF_DM_2D (1)
/*
* When the 'fastrender_dm' feature is present in the hw (as per
* @pvr_device_features).
*/
#define PVR_FWIF_DM_TDM (1)
#define PVR_FWIF_DM_GEOM (2)
#define PVR_FWIF_DM_FRAG (3)
#define PVR_FWIF_DM_CDM (4)
#define PVR_FWIF_DM_RAY (5)
#define PVR_FWIF_DM_GEOM2 (6)
#define PVR_FWIF_DM_GEOM3 (7)
#define PVR_FWIF_DM_GEOM4 (8)
#define PVR_FWIF_DM_LAST PVR_FWIF_DM_GEOM4
/* Maximum number of DM in use: GP, 2D/TDM, GEOM, 3D, CDM, RAY, GEOM2, GEOM3, GEOM4 */
#define PVR_FWIF_DM_MAX (PVR_FWIF_DM_LAST + 1U)
/* GPU Utilisation states */
#define PVR_FWIF_GPU_UTIL_STATE_IDLE 0U
#define PVR_FWIF_GPU_UTIL_STATE_ACTIVE 1U
#define PVR_FWIF_GPU_UTIL_STATE_BLOCKED 2U
#define PVR_FWIF_GPU_UTIL_STATE_NUM 3U
#define PVR_FWIF_GPU_UTIL_STATE_MASK 0x3ULL
/*
* Maximum amount of register writes that can be done by the register
* programmer (FW or META DMA). This is not a HW limitation, it is only
* a protection against malformed inputs to the register programmer.
*/
#define PVR_MAX_NUM_REGISTER_PROGRAMMER_WRITES 128U
#endif /* PVR_ROGUE_FWIF_COMMON_H */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef __PVR_ROGUE_FWIF_DEV_INFO_H__
#define __PVR_ROGUE_FWIF_DEV_INFO_H__
enum {
PVR_FW_HAS_BRN_44079 = 0,
PVR_FW_HAS_BRN_47217,
PVR_FW_HAS_BRN_48492,
PVR_FW_HAS_BRN_48545,
PVR_FW_HAS_BRN_49927,
PVR_FW_HAS_BRN_50767,
PVR_FW_HAS_BRN_51764,
PVR_FW_HAS_BRN_62269,
PVR_FW_HAS_BRN_63142,
PVR_FW_HAS_BRN_63553,
PVR_FW_HAS_BRN_66011,
PVR_FW_HAS_BRN_71242,
PVR_FW_HAS_BRN_MAX
};
enum {
PVR_FW_HAS_ERN_35421 = 0,
PVR_FW_HAS_ERN_38020,
PVR_FW_HAS_ERN_38748,
PVR_FW_HAS_ERN_42064,
PVR_FW_HAS_ERN_42290,
PVR_FW_HAS_ERN_42606,
PVR_FW_HAS_ERN_47025,
PVR_FW_HAS_ERN_57596,
PVR_FW_HAS_ERN_MAX
};
enum {
PVR_FW_HAS_FEATURE_AXI_ACELITE = 0,
PVR_FW_HAS_FEATURE_CDM_CONTROL_STREAM_FORMAT,
PVR_FW_HAS_FEATURE_CLUSTER_GROUPING,
PVR_FW_HAS_FEATURE_COMMON_STORE_SIZE_IN_DWORDS,
PVR_FW_HAS_FEATURE_COMPUTE,
PVR_FW_HAS_FEATURE_COMPUTE_MORTON_CAPABLE,
PVR_FW_HAS_FEATURE_COMPUTE_OVERLAP,
PVR_FW_HAS_FEATURE_COREID_PER_OS,
PVR_FW_HAS_FEATURE_DYNAMIC_DUST_POWER,
PVR_FW_HAS_FEATURE_ECC_RAMS,
PVR_FW_HAS_FEATURE_FBCDC,
PVR_FW_HAS_FEATURE_FBCDC_ALGORITHM,
PVR_FW_HAS_FEATURE_FBCDC_ARCHITECTURE,
PVR_FW_HAS_FEATURE_FBC_MAX_DEFAULT_DESCRIPTORS,
PVR_FW_HAS_FEATURE_FBC_MAX_LARGE_DESCRIPTORS,
PVR_FW_HAS_FEATURE_FB_CDC_V4,
PVR_FW_HAS_FEATURE_GPU_MULTICORE_SUPPORT,
PVR_FW_HAS_FEATURE_GPU_VIRTUALISATION,
PVR_FW_HAS_FEATURE_GS_RTA_SUPPORT,
PVR_FW_HAS_FEATURE_IRQ_PER_OS,
PVR_FW_HAS_FEATURE_ISP_MAX_TILES_IN_FLIGHT,
PVR_FW_HAS_FEATURE_ISP_SAMPLES_PER_PIXEL,
PVR_FW_HAS_FEATURE_ISP_ZLS_D24_S8_PACKING_OGL_MODE,
PVR_FW_HAS_FEATURE_LAYOUT_MARS,
PVR_FW_HAS_FEATURE_MAX_PARTITIONS,
PVR_FW_HAS_FEATURE_META,
PVR_FW_HAS_FEATURE_META_COREMEM_SIZE,
PVR_FW_HAS_FEATURE_MIPS,
PVR_FW_HAS_FEATURE_NUM_CLUSTERS,
PVR_FW_HAS_FEATURE_NUM_ISP_IPP_PIPES,
PVR_FW_HAS_FEATURE_NUM_OSIDS,
PVR_FW_HAS_FEATURE_NUM_RASTER_PIPES,
PVR_FW_HAS_FEATURE_PBE2_IN_XE,
PVR_FW_HAS_FEATURE_PBVNC_COREID_REG,
PVR_FW_HAS_FEATURE_PERFBUS,
PVR_FW_HAS_FEATURE_PERF_COUNTER_BATCH,
PVR_FW_HAS_FEATURE_PHYS_BUS_WIDTH,
PVR_FW_HAS_FEATURE_RISCV_FW_PROCESSOR,
PVR_FW_HAS_FEATURE_ROGUEXE,
PVR_FW_HAS_FEATURE_S7_TOP_INFRASTRUCTURE,
PVR_FW_HAS_FEATURE_SIMPLE_INTERNAL_PARAMETER_FORMAT,
PVR_FW_HAS_FEATURE_SIMPLE_INTERNAL_PARAMETER_FORMAT_V2,
PVR_FW_HAS_FEATURE_SIMPLE_PARAMETER_FORMAT_VERSION,
PVR_FW_HAS_FEATURE_SLC_BANKS,
PVR_FW_HAS_FEATURE_SLC_CACHE_LINE_SIZE_BITS,
PVR_FW_HAS_FEATURE_SLC_SIZE_CONFIGURABLE,
PVR_FW_HAS_FEATURE_SLC_SIZE_IN_KILOBYTES,
PVR_FW_HAS_FEATURE_SOC_TIMER,
PVR_FW_HAS_FEATURE_SYS_BUS_SECURE_RESET,
PVR_FW_HAS_FEATURE_TESSELLATION,
PVR_FW_HAS_FEATURE_TILE_REGION_PROTECTION,
PVR_FW_HAS_FEATURE_TILE_SIZE_X,
PVR_FW_HAS_FEATURE_TILE_SIZE_Y,
PVR_FW_HAS_FEATURE_TLA,
PVR_FW_HAS_FEATURE_TPU_CEM_DATAMASTER_GLOBAL_REGISTERS,
PVR_FW_HAS_FEATURE_TPU_DM_GLOBAL_REGISTERS,
PVR_FW_HAS_FEATURE_TPU_FILTERING_MODE_CONTROL,
PVR_FW_HAS_FEATURE_USC_MIN_OUTPUT_REGISTERS_PER_PIX,
PVR_FW_HAS_FEATURE_VDM_DRAWINDIRECT,
PVR_FW_HAS_FEATURE_VDM_OBJECT_LEVEL_LLS,
PVR_FW_HAS_FEATURE_VIRTUAL_ADDRESS_SPACE_BITS,
PVR_FW_HAS_FEATURE_WATCHDOG_TIMER,
PVR_FW_HAS_FEATURE_WORKGROUP_PROTECTION,
PVR_FW_HAS_FEATURE_XE_ARCHITECTURE,
PVR_FW_HAS_FEATURE_XE_MEMORY_HIERARCHY,
PVR_FW_HAS_FEATURE_XE_TPU2,
PVR_FW_HAS_FEATURE_XPU_MAX_REGBANKS_ADDR_WIDTH,
PVR_FW_HAS_FEATURE_XPU_MAX_SLAVES,
PVR_FW_HAS_FEATURE_XPU_REGISTER_BROADCAST,
PVR_FW_HAS_FEATURE_XT_TOP_INFRASTRUCTURE,
PVR_FW_HAS_FEATURE_ZLS_SUBTILE,
PVR_FW_HAS_FEATURE_MAX
};
#endif /* __PVR_ROGUE_FWIF_DEV_INFO_H__ */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_FWIF_RESETFRAMEWORK_H
#define PVR_ROGUE_FWIF_RESETFRAMEWORK_H
#include <linux/bits.h>
#include <linux/types.h>
#include "pvr_rogue_fwif_shared.h"
struct rogue_fwif_rf_registers {
union {
u64 cdmreg_cdm_cb_base;
u64 cdmreg_cdm_ctrl_stream_base;
};
u64 cdmreg_cdm_cb_queue;
u64 cdmreg_cdm_cb;
};
struct rogue_fwif_rf_cmd {
/* THIS MUST BE THE LAST MEMBER OF THE CONTAINING STRUCTURE */
struct rogue_fwif_rf_registers fw_registers __aligned(8);
};
#define ROGUE_FWIF_RF_CMD_SIZE sizeof(struct rogue_fwif_rf_cmd)
#endif /* PVR_ROGUE_FWIF_RESETFRAMEWORK_H */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_FWIF_SHARED_H
#define PVR_ROGUE_FWIF_SHARED_H
#include <linux/compiler.h>
#include <linux/types.h>
#define ROGUE_FWIF_NUM_RTDATAS 2U
#define ROGUE_FWIF_NUM_GEOMDATAS 1U
#define ROGUE_FWIF_NUM_RTDATA_FREELISTS 2U
#define ROGUE_NUM_GEOM_CORES 1U
#define ROGUE_NUM_GEOM_CORES_SIZE 2U
/*
* Maximum number of UFOs in a CCB command.
* The number is based on having 32 sync prims (as originally), plus 32 sync
* checkpoints.
* Once the use of sync prims is no longer supported, we will retain
* the same total (64) as the number of sync checkpoints which may be
* supporting a fence is not visible to the client driver and has to
* allow for the number of different timelines involved in fence merges.
*/
#define ROGUE_FWIF_CCB_CMD_MAX_UFOS (32U + 32U)
/*
* This is a generic limit imposed on any DM (GEOMETRY,FRAGMENT,CDM,TDM,2D,TRANSFER)
* command passed through the bridge.
* Just across the bridge in the server, any incoming kick command size is
* checked against this maximum limit.
* In case the incoming command size is larger than the specified limit,
* the bridge call is retired with error.
*/
#define ROGUE_FWIF_DM_INDEPENDENT_KICK_CMD_SIZE (1024U)
#define ROGUE_FWIF_PRBUFFER_START (0)
#define ROGUE_FWIF_PRBUFFER_ZSBUFFER (0)
#define ROGUE_FWIF_PRBUFFER_MSAABUFFER (1)
#define ROGUE_FWIF_PRBUFFER_MAXSUPPORTED (2)
struct rogue_fwif_dma_addr {
aligned_u64 dev_addr;
u32 fw_addr;
u32 padding;
} __aligned(8);
struct rogue_fwif_ufo {
u32 addr;
u32 value;
};
#define ROGUE_FWIF_UFO_ADDR_IS_SYNC_CHECKPOINT (1)
struct rogue_fwif_sync_checkpoint {
u32 state;
u32 fw_ref_count;
};
struct rogue_fwif_cleanup_ctl {
/* Number of commands received by the FW */
u32 submitted_commands;
/* Number of commands executed by the FW */
u32 executed_commands;
} __aligned(8);
/*
* Used to share frame numbers across UM-KM-FW,
* frame number is set in UM,
* frame number is required in both KM for HTB and FW for FW trace.
*
* May be used to house Kick flags in the future.
*/
struct rogue_fwif_cmd_common {
/* associated frame number */
u32 frame_num;
};
/*
* Geometry and fragment commands require set of firmware addresses that are stored in the Kernel.
* Client has handle(s) to Kernel containers storing these addresses, instead of raw addresses. We
* have to patch/write these addresses in KM to prevent UM from controlling FW addresses directly.
* Typedefs for geometry and fragment commands are shared between Client and Firmware (both
* single-BVNC). Kernel is implemented in a multi-BVNC manner, so it can't use geometry|fragment
* CMD type definitions directly. Therefore we have a SHARED block that is shared between UM-KM-FW
* across all BVNC configurations.
*/
struct rogue_fwif_cmd_geom_frag_shared {
/* Common command attributes */
struct rogue_fwif_cmd_common cmn;
/*
* RTData associated with this command, this is used for context
* selection and for storing out HW-context, when TA is switched out for
* continuing later
*/
u32 hwrt_data_fw_addr;
/* Supported PR Buffers like Z/S/MSAA Scratch */
u32 pr_buffer_fw_addr[ROGUE_FWIF_PRBUFFER_MAXSUPPORTED];
};
/*
* Client Circular Command Buffer (CCCB) control structure.
* This is shared between the Server and the Firmware and holds byte offsets
* into the CCCB as well as the wrapping mask to aid wrap around. A given
* snapshot of this queue with Cmd 1 running on the GPU might be:
*
* Roff Doff Woff
* [..........|-1----------|=2===|=3===|=4===|~5~~~~|~6~~~~|~7~~~~|..........]
* < runnable commands >< !ready to run >
*
* Cmd 1 : Currently executing on the GPU data master.
* Cmd 2,3,4: Fence dependencies met, commands runnable.
* Cmd 5... : Fence dependency not met yet.
*/
struct rogue_fwif_cccb_ctl {
/* Host write offset into CCB. This must be aligned to 16 bytes. */
u32 write_offset;
/*
* Firmware read offset into CCB. Points to the command that is runnable
* on GPU, if R!=W
*/
u32 read_offset;
/*
* Firmware fence dependency offset. Points to commands not ready, i.e.
* fence dependencies are not met.
*/
u32 dep_offset;
/* Offset wrapping mask, total capacity in bytes of the CCB-1 */
u32 wrap_mask;
/* Only used if SUPPORT_AGP is present. */
u32 read_offset2;
/* Only used if SUPPORT_AGP4 is present. */
u32 read_offset3;
/* Only used if SUPPORT_AGP4 is present. */
u32 read_offset4;
u32 padding;
} __aligned(8);
#define ROGUE_FW_LOCAL_FREELIST (0)
#define ROGUE_FW_GLOBAL_FREELIST (1)
#define ROGUE_FW_FREELIST_TYPE_LAST ROGUE_FW_GLOBAL_FREELIST
#define ROGUE_FW_MAX_FREELISTS (ROGUE_FW_FREELIST_TYPE_LAST + 1U)
struct rogue_fwif_geom_registers_caswitch {
u64 geom_reg_vdm_context_state_base_addr;
u64 geom_reg_vdm_context_state_resume_addr;
u64 geom_reg_ta_context_state_base_addr;
struct {
u64 geom_reg_vdm_context_store_task0;
u64 geom_reg_vdm_context_store_task1;
u64 geom_reg_vdm_context_store_task2;
/* VDM resume state update controls */
u64 geom_reg_vdm_context_resume_task0;
u64 geom_reg_vdm_context_resume_task1;
u64 geom_reg_vdm_context_resume_task2;
u64 geom_reg_vdm_context_store_task3;
u64 geom_reg_vdm_context_store_task4;
u64 geom_reg_vdm_context_resume_task3;
u64 geom_reg_vdm_context_resume_task4;
} geom_state[2];
};
#define ROGUE_FWIF_GEOM_REGISTERS_CSWITCH_SIZE \
sizeof(struct rogue_fwif_geom_registers_caswitch)
struct rogue_fwif_cdm_registers_cswitch {
u64 cdmreg_cdm_context_pds0;
u64 cdmreg_cdm_context_pds1;
u64 cdmreg_cdm_terminate_pds;
u64 cdmreg_cdm_terminate_pds1;
/* CDM resume controls */
u64 cdmreg_cdm_resume_pds0;
u64 cdmreg_cdm_context_pds0_b;
u64 cdmreg_cdm_resume_pds0_b;
};
struct rogue_fwif_static_rendercontext_state {
/* Geom registers for ctx switch */
struct rogue_fwif_geom_registers_caswitch ctxswitch_regs[ROGUE_NUM_GEOM_CORES_SIZE]
__aligned(8);
};
#define ROGUE_FWIF_STATIC_RENDERCONTEXT_SIZE \
sizeof(struct rogue_fwif_static_rendercontext_state)
struct rogue_fwif_static_computecontext_state {
/* CDM registers for ctx switch */
struct rogue_fwif_cdm_registers_cswitch ctxswitch_regs __aligned(8);
};
#define ROGUE_FWIF_STATIC_COMPUTECONTEXT_SIZE \
sizeof(struct rogue_fwif_static_computecontext_state)
enum rogue_fwif_prbuffer_state {
ROGUE_FWIF_PRBUFFER_UNBACKED = 0,
ROGUE_FWIF_PRBUFFER_BACKED,
ROGUE_FWIF_PRBUFFER_BACKING_PENDING,
ROGUE_FWIF_PRBUFFER_UNBACKING_PENDING,
};
struct rogue_fwif_prbuffer {
/* Buffer ID*/
u32 buffer_id;
/* Needs On-demand Z/S/MSAA Buffer allocation */
bool on_demand __aligned(4);
/* Z/S/MSAA -Buffer state */
enum rogue_fwif_prbuffer_state state;
/* Cleanup state */
struct rogue_fwif_cleanup_ctl cleanup_sate;
/* Compatibility and other flags */
u32 prbuffer_flags;
} __aligned(8);
/* Last reset reason for a context. */
enum rogue_context_reset_reason {
/* No reset reason recorded */
ROGUE_CONTEXT_RESET_REASON_NONE = 0,
/* Caused a reset due to locking up */
ROGUE_CONTEXT_RESET_REASON_GUILTY_LOCKUP = 1,
/* Affected by another context locking up */
ROGUE_CONTEXT_RESET_REASON_INNOCENT_LOCKUP = 2,
/* Overran the global deadline */
ROGUE_CONTEXT_RESET_REASON_GUILTY_OVERRUNING = 3,
/* Affected by another context overrunning */
ROGUE_CONTEXT_RESET_REASON_INNOCENT_OVERRUNING = 4,
/* Forced reset to ensure scheduling requirements */
ROGUE_CONTEXT_RESET_REASON_HARD_CONTEXT_SWITCH = 5,
/* FW Safety watchdog triggered */
ROGUE_CONTEXT_RESET_REASON_FW_WATCHDOG = 12,
/* FW page fault (no HWR) */
ROGUE_CONTEXT_RESET_REASON_FW_PAGEFAULT = 13,
/* FW execution error (GPU reset requested) */
ROGUE_CONTEXT_RESET_REASON_FW_EXEC_ERR = 14,
/* Host watchdog detected FW error */
ROGUE_CONTEXT_RESET_REASON_HOST_WDG_FW_ERR = 15,
/* Geometry DM OOM event is not allowed */
ROGUE_CONTEXT_GEOM_OOM_DISABLED = 16,
};
struct rogue_context_reset_reason_data {
enum rogue_context_reset_reason reset_reason;
u32 reset_ext_job_ref;
};
#include "pvr_rogue_fwif_shared_check.h"
#endif /* PVR_ROGUE_FWIF_SHARED_H */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_FWIF_SHARED_CHECK_H
#define PVR_ROGUE_FWIF_SHARED_CHECK_H
#include <linux/build_bug.h>
#define OFFSET_CHECK(type, member, offset) \
static_assert(offsetof(type, member) == (offset), \
"offsetof(" #type ", " #member ") incorrect")
#define SIZE_CHECK(type, size) \
static_assert(sizeof(type) == (size), #type " is incorrect size")
OFFSET_CHECK(struct rogue_fwif_dma_addr, dev_addr, 0);
OFFSET_CHECK(struct rogue_fwif_dma_addr, fw_addr, 8);
SIZE_CHECK(struct rogue_fwif_dma_addr, 16);
OFFSET_CHECK(struct rogue_fwif_ufo, addr, 0);
OFFSET_CHECK(struct rogue_fwif_ufo, value, 4);
SIZE_CHECK(struct rogue_fwif_ufo, 8);
OFFSET_CHECK(struct rogue_fwif_cleanup_ctl, submitted_commands, 0);
OFFSET_CHECK(struct rogue_fwif_cleanup_ctl, executed_commands, 4);
SIZE_CHECK(struct rogue_fwif_cleanup_ctl, 8);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, write_offset, 0);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset, 4);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, dep_offset, 8);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, wrap_mask, 12);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset2, 16);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset3, 20);
OFFSET_CHECK(struct rogue_fwif_cccb_ctl, read_offset4, 24);
SIZE_CHECK(struct rogue_fwif_cccb_ctl, 32);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_reg_vdm_context_state_base_addr, 0);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_reg_vdm_context_state_resume_addr, 8);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_reg_ta_context_state_base_addr, 16);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task0, 24);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task1, 32);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task2, 40);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task0, 48);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task1, 56);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task2, 64);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task3, 72);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_store_task4, 80);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task3, 88);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[0].geom_reg_vdm_context_resume_task4, 96);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task0, 104);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task1, 112);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task2, 120);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task0, 128);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task1, 136);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task2, 144);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task3, 152);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_store_task4, 160);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task3, 168);
OFFSET_CHECK(struct rogue_fwif_geom_registers_caswitch,
geom_state[1].geom_reg_vdm_context_resume_task4, 176);
SIZE_CHECK(struct rogue_fwif_geom_registers_caswitch, 184);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds0, 0);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds1, 8);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_terminate_pds, 16);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_terminate_pds1, 24);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_resume_pds0, 32);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_context_pds0_b, 40);
OFFSET_CHECK(struct rogue_fwif_cdm_registers_cswitch, cdmreg_cdm_resume_pds0_b, 48);
SIZE_CHECK(struct rogue_fwif_cdm_registers_cswitch, 56);
OFFSET_CHECK(struct rogue_fwif_static_rendercontext_state, ctxswitch_regs, 0);
SIZE_CHECK(struct rogue_fwif_static_rendercontext_state, 368);
OFFSET_CHECK(struct rogue_fwif_static_computecontext_state, ctxswitch_regs, 0);
SIZE_CHECK(struct rogue_fwif_static_computecontext_state, 56);
OFFSET_CHECK(struct rogue_fwif_cmd_common, frame_num, 0);
SIZE_CHECK(struct rogue_fwif_cmd_common, 4);
OFFSET_CHECK(struct rogue_fwif_cmd_geom_frag_shared, cmn, 0);
OFFSET_CHECK(struct rogue_fwif_cmd_geom_frag_shared, hwrt_data_fw_addr, 4);
OFFSET_CHECK(struct rogue_fwif_cmd_geom_frag_shared, pr_buffer_fw_addr, 8);
SIZE_CHECK(struct rogue_fwif_cmd_geom_frag_shared, 16);
#endif /* PVR_ROGUE_FWIF_SHARED_CHECK_H */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_FWIF_STREAM_H
#define PVR_ROGUE_FWIF_STREAM_H
/**
* DOC: Streams
*
* Commands are submitted to the kernel driver in the form of streams.
*
* A command stream has the following layout :
* - A 64-bit header containing:
* * A u32 containing the length of the main stream inclusive of the length of the header.
* * A u32 for padding.
* - The main stream data.
* - The extension stream (optional), which is composed of:
* * One or more headers.
* * The extension stream data, corresponding to the extension headers.
*
* The main stream provides the base command data. This has a fixed layout based on the features
* supported by a given GPU.
*
* The extension stream provides the command parameters that are required for BRNs & ERNs for the
* current GPU. This stream is comprised of one or more headers, followed by data for each given
* BRN/ERN.
*
* Each header is a u32 containing a bitmask of quirks & enhancements in the extension stream, a
* "type" field determining the set of quirks & enhancements the bitmask represents, and a
* continuation bit determining whether any more headers are present. The headers are then followed
* by command data; this is specific to each quirk/enhancement. All unused / reserved bits in the
* header must be set to 0.
*
* All parameters and headers in the main and extension streams must be naturally aligned.
*
* If a parameter appears in both the main and extension streams, then the extension parameter is
* used.
*/
/*
* Stream extension header definition
*/
#define PVR_STREAM_EXTHDR_TYPE_SHIFT 29U
#define PVR_STREAM_EXTHDR_TYPE_MASK (7U << PVR_STREAM_EXTHDR_TYPE_SHIFT)
#define PVR_STREAM_EXTHDR_TYPE_MAX 8U
#define PVR_STREAM_EXTHDR_CONTINUATION BIT(28U)
#define PVR_STREAM_EXTHDR_DATA_MASK ~(PVR_STREAM_EXTHDR_TYPE_MASK | PVR_STREAM_EXTHDR_CONTINUATION)
/*
* Stream extension header - Geometry 0
*/
#define PVR_STREAM_EXTHDR_TYPE_GEOM0 0U
#define PVR_STREAM_EXTHDR_GEOM0_BRN49927 BIT(0U)
#define PVR_STREAM_EXTHDR_GEOM0_VALID PVR_STREAM_EXTHDR_GEOM0_BRN49927
/*
* Stream extension header - Fragment 0
*/
#define PVR_STREAM_EXTHDR_TYPE_FRAG0 0U
#define PVR_STREAM_EXTHDR_FRAG0_BRN47217 BIT(0U)
#define PVR_STREAM_EXTHDR_FRAG0_BRN49927 BIT(1U)
#define PVR_STREAM_EXTHDR_FRAG0_VALID PVR_STREAM_EXTHDR_FRAG0_BRN49927
/*
* Stream extension header - Compute 0
*/
#define PVR_STREAM_EXTHDR_TYPE_COMPUTE0 0U
#define PVR_STREAM_EXTHDR_COMPUTE0_BRN49927 BIT(0U)
#define PVR_STREAM_EXTHDR_COMPUTE0_VALID PVR_STREAM_EXTHDR_COMPUTE0_BRN49927
#endif /* PVR_ROGUE_FWIF_STREAM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment