Commit 7900e004 authored by Sarah Walker's avatar Sarah Walker Committed by Maxime Ripard

drm/imagination: Add firmware and MMU related headers

Changes since v8:
- Corrected license identifiers

Changes since v5:
- Split up header commit due to size
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/23ee233dfbe6f2239328f8201fd6d8c1017cea58.1700668843.git.donald.robson@imgtec.comSigned-off-by: default avatarMaxime Ripard <mripard@kernel.org>
parent b41ae495
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
#ifndef PVR_ROGUE_HEAP_CONFIG_H
#define PVR_ROGUE_HEAP_CONFIG_H
#include <linux/sizes.h>
/*
* ROGUE Device Virtual Address Space Definitions
*
* This file defines the ROGUE virtual address heaps that are used in
* application memory contexts. It also shows where the Firmware memory heap
* fits into this, but the firmware heap is only ever created in the
* kernel driver and never exposed to userspace.
*
* ROGUE_PDSCODEDATA_HEAP_BASE and ROGUE_USCCODE_HEAP_BASE will be programmed,
* on a global basis, into ROGUE_CR_PDS_EXEC_BASE and ROGUE_CR_USC_CODE_BASE_*
* respectively. Therefore if client drivers use multiple configs they must
* still be consistent with their definitions for these heaps.
*
* Base addresses have to be a multiple of 4MiB.
* Heaps must not start at 0x0000000000, as this is reserved for internal
* use within the driver.
* Range comments, those starting in column 0 below are a section heading of
* sorts and are above the heaps in that range. Often this is the reserved
* size of the heap within the range.
*/
/* 0x00_0000_0000 ************************************************************/
/* 0x00_0000_0000 - 0x00_0040_0000 */
/* 0 MiB to 4 MiB, size of 4 MiB : RESERVED */
/* 0x00_0040_0000 - 0x7F_FFC0_0000 **/
/* 4 MiB to 512 GiB, size of 512 GiB less 4 MiB : RESERVED **/
/* 0x80_0000_0000 ************************************************************/
/* 0x80_0000_0000 - 0x9F_FFFF_FFFF **/
/* 512 GiB to 640 GiB, size of 128 GiB : GENERAL_HEAP **/
#define ROGUE_GENERAL_HEAP_BASE 0x8000000000ull
#define ROGUE_GENERAL_HEAP_SIZE SZ_128G
/* 0xA0_0000_0000 - 0xAF_FFFF_FFFF */
/* 640 GiB to 704 GiB, size of 64 GiB : FREE */
/* B0_0000_0000 - 0xB7_FFFF_FFFF */
/* 704 GiB to 736 GiB, size of 32 GiB : FREE */
/* 0xB8_0000_0000 - 0xBF_FFFF_FFFF */
/* 736 GiB to 768 GiB, size of 32 GiB : RESERVED */
/* 0xC0_0000_0000 ************************************************************/
/* 0xC0_0000_0000 - 0xD9_FFFF_FFFF */
/* 768 GiB to 872 GiB, size of 104 GiB : FREE */
/* 0xDA_0000_0000 - 0xDA_FFFF_FFFF */
/* 872 GiB to 876 GiB, size of 4 GiB : PDSCODEDATA_HEAP */
#define ROGUE_PDSCODEDATA_HEAP_BASE 0xDA00000000ull
#define ROGUE_PDSCODEDATA_HEAP_SIZE SZ_4G
/* 0xDB_0000_0000 - 0xDB_FFFF_FFFF */
/* 876 GiB to 880 GiB, size of 256 MiB (reserved 4GiB) : BRN **/
/*
* The BRN63142 quirk workaround requires Region Header memory to be at the top
* of a 16GiB aligned range. This is so when masked with 0x03FFFFFFFF the
* address will avoid aliasing PB addresses. Start at 879.75GiB. Size of 256MiB.
*/
#define ROGUE_RGNHDR_HEAP_BASE 0xDBF0000000ull
#define ROGUE_RGNHDR_HEAP_SIZE SZ_256M
/* 0xDC_0000_0000 - 0xDF_FFFF_FFFF */
/* 880 GiB to 896 GiB, size of 16 GiB : FREE */
/* 0xE0_0000_0000 - 0xE0_FFFF_FFFF */
/* 896 GiB to 900 GiB, size of 4 GiB : USCCODE_HEAP */
#define ROGUE_USCCODE_HEAP_BASE 0xE000000000ull
#define ROGUE_USCCODE_HEAP_SIZE SZ_4G
/* 0xE1_0000_0000 - 0xE1_BFFF_FFFF */
/* 900 GiB to 903 GiB, size of 3 GiB : RESERVED */
/* 0xE1_C000_000 - 0xE1_FFFF_FFFF */
/* 903 GiB to 904 GiB, reserved 1 GiB, : FIRMWARE_HEAP */
#define ROGUE_FW_HEAP_BASE 0xE1C0000000ull
/* 0xE2_0000_0000 - 0xE3_FFFF_FFFF */
/* 904 GiB to 912 GiB, size of 8 GiB : FREE */
/* 0xE4_0000_0000 - 0xE7_FFFF_FFFF */
/* 912 GiB to 968 GiB, size of 16 GiB : TRANSFER_FRAG */
#define ROGUE_TRANSFER_FRAG_HEAP_BASE 0xE400000000ull
#define ROGUE_TRANSFER_FRAG_HEAP_SIZE SZ_16G
/* 0xE8_0000_0000 - 0xF1_FFFF_FFFF */
/* 928 GiB to 968 GiB, size of 40 GiB : RESERVED */
/* 0xF2_0000_0000 - 0xF2_001F_FFFF **/
/* 968 GiB to 969 GiB, size of 2 MiB : VISTEST_HEAP */
#define ROGUE_VISTEST_HEAP_BASE 0xF200000000ull
#define ROGUE_VISTEST_HEAP_SIZE SZ_2M
/* 0xF2_4000_0000 - 0xF2_FFFF_FFFF */
/* 969 GiB to 972 GiB, size of 3 GiB : FREE */
/* 0xF3_0000_0000 - 0xFF_FFFF_FFFF */
/* 972 GiB to 1024 GiB, size of 52 GiB : FREE */
/* 0xFF_FFFF_FFFF ************************************************************/
#endif /* PVR_ROGUE_HEAP_CONFIG_H */
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_MIPS_CHECK_H
#define PVR_ROGUE_MIPS_CHECK_H
#include <linux/build_bug.h>
static_assert(offsetof(struct rogue_mips_tlb_entry, tlb_page_mask) == 0,
"offsetof(struct rogue_mips_tlb_entry, tlb_page_mask) incorrect");
static_assert(offsetof(struct rogue_mips_tlb_entry, tlb_hi) == 4,
"offsetof(struct rogue_mips_tlb_entry, tlb_hi) incorrect");
static_assert(offsetof(struct rogue_mips_tlb_entry, tlb_lo0) == 8,
"offsetof(struct rogue_mips_tlb_entry, tlb_lo0) incorrect");
static_assert(offsetof(struct rogue_mips_tlb_entry, tlb_lo1) == 12,
"offsetof(struct rogue_mips_tlb_entry, tlb_lo1) incorrect");
static_assert(sizeof(struct rogue_mips_tlb_entry) == 16,
"struct rogue_mips_tlb_entry is incorrect size");
static_assert(offsetof(struct rogue_mips_remap_entry, remap_addr_in) == 0,
"offsetof(struct rogue_mips_remap_entry, remap_addr_in) incorrect");
static_assert(offsetof(struct rogue_mips_remap_entry, remap_addr_out) == 4,
"offsetof(struct rogue_mips_remap_entry, remap_addr_out) incorrect");
static_assert(offsetof(struct rogue_mips_remap_entry, remap_region_size) == 8,
"offsetof(struct rogue_mips_remap_entry, remap_region_size) incorrect");
static_assert(sizeof(struct rogue_mips_remap_entry) == 12,
"struct rogue_mips_remap_entry is incorrect size");
static_assert(offsetof(struct rogue_mips_state, error_state) == 0,
"offsetof(struct rogue_mips_state, error_state) incorrect");
static_assert(offsetof(struct rogue_mips_state, error_epc) == 4,
"offsetof(struct rogue_mips_state, error_epc) incorrect");
static_assert(offsetof(struct rogue_mips_state, status_register) == 8,
"offsetof(struct rogue_mips_state, status_register) incorrect");
static_assert(offsetof(struct rogue_mips_state, cause_register) == 12,
"offsetof(struct rogue_mips_state, cause_register) incorrect");
static_assert(offsetof(struct rogue_mips_state, bad_register) == 16,
"offsetof(struct rogue_mips_state, bad_register) incorrect");
static_assert(offsetof(struct rogue_mips_state, epc) == 20,
"offsetof(struct rogue_mips_state, epc) incorrect");
static_assert(offsetof(struct rogue_mips_state, sp) == 24,
"offsetof(struct rogue_mips_state, sp) incorrect");
static_assert(offsetof(struct rogue_mips_state, debug) == 28,
"offsetof(struct rogue_mips_state, debug) incorrect");
static_assert(offsetof(struct rogue_mips_state, depc) == 32,
"offsetof(struct rogue_mips_state, depc) incorrect");
static_assert(offsetof(struct rogue_mips_state, bad_instr) == 36,
"offsetof(struct rogue_mips_state, bad_instr) incorrect");
static_assert(offsetof(struct rogue_mips_state, unmapped_address) == 40,
"offsetof(struct rogue_mips_state, unmapped_address) incorrect");
static_assert(offsetof(struct rogue_mips_state, tlb) == 44,
"offsetof(struct rogue_mips_state, tlb) incorrect");
static_assert(offsetof(struct rogue_mips_state, remap) == 300,
"offsetof(struct rogue_mips_state, remap) incorrect");
static_assert(sizeof(struct rogue_mips_state) == 684,
"struct rogue_mips_state is incorrect size");
#endif /* PVR_ROGUE_MIPS_CHECK_H */
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/* Copyright (c) 2023 Imagination Technologies Ltd. */
/* *** Autogenerated C -- do not edit *** */
#ifndef PVR_ROGUE_MMU_DEFS_H
#define PVR_ROGUE_MMU_DEFS_H
#define ROGUE_MMU_DEFS_REVISION 0
#define ROGUE_BIF_DM_ENCODING_VERTEX (0x00000000U)
#define ROGUE_BIF_DM_ENCODING_PIXEL (0x00000001U)
#define ROGUE_BIF_DM_ENCODING_COMPUTE (0x00000002U)
#define ROGUE_BIF_DM_ENCODING_TLA (0x00000003U)
#define ROGUE_BIF_DM_ENCODING_PB_VCE (0x00000004U)
#define ROGUE_BIF_DM_ENCODING_PB_TE (0x00000005U)
#define ROGUE_BIF_DM_ENCODING_META (0x00000007U)
#define ROGUE_BIF_DM_ENCODING_HOST (0x00000008U)
#define ROGUE_BIF_DM_ENCODING_PM_ALIST (0x00000009U)
#define ROGUE_MMUCTRL_VADDR_PC_INDEX_SHIFT (30U)
#define ROGUE_MMUCTRL_VADDR_PC_INDEX_CLRMSK (0xFFFFFF003FFFFFFFULL)
#define ROGUE_MMUCTRL_VADDR_PD_INDEX_SHIFT (21U)
#define ROGUE_MMUCTRL_VADDR_PD_INDEX_CLRMSK (0xFFFFFFFFC01FFFFFULL)
#define ROGUE_MMUCTRL_VADDR_PT_INDEX_SHIFT (12U)
#define ROGUE_MMUCTRL_VADDR_PT_INDEX_CLRMSK (0xFFFFFFFFFFE00FFFULL)
#define ROGUE_MMUCTRL_ENTRIES_PC_VALUE (0x00000400U)
#define ROGUE_MMUCTRL_ENTRIES_PD_VALUE (0x00000200U)
#define ROGUE_MMUCTRL_ENTRIES_PT_VALUE (0x00000200U)
#define ROGUE_MMUCTRL_ENTRY_SIZE_PC_VALUE (0x00000020U)
#define ROGUE_MMUCTRL_ENTRY_SIZE_PD_VALUE (0x00000040U)
#define ROGUE_MMUCTRL_ENTRY_SIZE_PT_VALUE (0x00000040U)
#define ROGUE_MMUCTRL_PAGE_SIZE_MASK (0x00000007U)
#define ROGUE_MMUCTRL_PAGE_SIZE_4KB (0x00000000U)
#define ROGUE_MMUCTRL_PAGE_SIZE_16KB (0x00000001U)
#define ROGUE_MMUCTRL_PAGE_SIZE_64KB (0x00000002U)
#define ROGUE_MMUCTRL_PAGE_SIZE_256KB (0x00000003U)
#define ROGUE_MMUCTRL_PAGE_SIZE_1MB (0x00000004U)
#define ROGUE_MMUCTRL_PAGE_SIZE_2MB (0x00000005U)
#define ROGUE_MMUCTRL_PAGE_4KB_RANGE_SHIFT (12U)
#define ROGUE_MMUCTRL_PAGE_4KB_RANGE_CLRMSK (0xFFFFFF0000000FFFULL)
#define ROGUE_MMUCTRL_PAGE_16KB_RANGE_SHIFT (14U)
#define ROGUE_MMUCTRL_PAGE_16KB_RANGE_CLRMSK (0xFFFFFF0000003FFFULL)
#define ROGUE_MMUCTRL_PAGE_64KB_RANGE_SHIFT (16U)
#define ROGUE_MMUCTRL_PAGE_64KB_RANGE_CLRMSK (0xFFFFFF000000FFFFULL)
#define ROGUE_MMUCTRL_PAGE_256KB_RANGE_SHIFT (18U)
#define ROGUE_MMUCTRL_PAGE_256KB_RANGE_CLRMSK (0xFFFFFF000003FFFFULL)
#define ROGUE_MMUCTRL_PAGE_1MB_RANGE_SHIFT (20U)
#define ROGUE_MMUCTRL_PAGE_1MB_RANGE_CLRMSK (0xFFFFFF00000FFFFFULL)
#define ROGUE_MMUCTRL_PAGE_2MB_RANGE_SHIFT (21U)
#define ROGUE_MMUCTRL_PAGE_2MB_RANGE_CLRMSK (0xFFFFFF00001FFFFFULL)
#define ROGUE_MMUCTRL_PT_BASE_4KB_RANGE_SHIFT (12U)
#define ROGUE_MMUCTRL_PT_BASE_4KB_RANGE_CLRMSK (0xFFFFFF0000000FFFULL)
#define ROGUE_MMUCTRL_PT_BASE_16KB_RANGE_SHIFT (10U)
#define ROGUE_MMUCTRL_PT_BASE_16KB_RANGE_CLRMSK (0xFFFFFF00000003FFULL)
#define ROGUE_MMUCTRL_PT_BASE_64KB_RANGE_SHIFT (8U)
#define ROGUE_MMUCTRL_PT_BASE_64KB_RANGE_CLRMSK (0xFFFFFF00000000FFULL)
#define ROGUE_MMUCTRL_PT_BASE_256KB_RANGE_SHIFT (6U)
#define ROGUE_MMUCTRL_PT_BASE_256KB_RANGE_CLRMSK (0xFFFFFF000000003FULL)
#define ROGUE_MMUCTRL_PT_BASE_1MB_RANGE_SHIFT (5U)
#define ROGUE_MMUCTRL_PT_BASE_1MB_RANGE_CLRMSK (0xFFFFFF000000001FULL)
#define ROGUE_MMUCTRL_PT_BASE_2MB_RANGE_SHIFT (5U)
#define ROGUE_MMUCTRL_PT_BASE_2MB_RANGE_CLRMSK (0xFFFFFF000000001FULL)
#define ROGUE_MMUCTRL_PT_DATA_PM_META_PROTECT_SHIFT (62U)
#define ROGUE_MMUCTRL_PT_DATA_PM_META_PROTECT_CLRMSK (0xBFFFFFFFFFFFFFFFULL)
#define ROGUE_MMUCTRL_PT_DATA_PM_META_PROTECT_EN (0x4000000000000000ULL)
#define ROGUE_MMUCTRL_PT_DATA_VP_PAGE_HI_SHIFT (40U)
#define ROGUE_MMUCTRL_PT_DATA_VP_PAGE_HI_CLRMSK (0xC00000FFFFFFFFFFULL)
#define ROGUE_MMUCTRL_PT_DATA_PAGE_SHIFT (12U)
#define ROGUE_MMUCTRL_PT_DATA_PAGE_CLRMSK (0xFFFFFF0000000FFFULL)
#define ROGUE_MMUCTRL_PT_DATA_VP_PAGE_LO_SHIFT (6U)
#define ROGUE_MMUCTRL_PT_DATA_VP_PAGE_LO_CLRMSK (0xFFFFFFFFFFFFF03FULL)
#define ROGUE_MMUCTRL_PT_DATA_ENTRY_PENDING_SHIFT (5U)
#define ROGUE_MMUCTRL_PT_DATA_ENTRY_PENDING_CLRMSK (0xFFFFFFFFFFFFFFDFULL)
#define ROGUE_MMUCTRL_PT_DATA_ENTRY_PENDING_EN (0x0000000000000020ULL)
#define ROGUE_MMUCTRL_PT_DATA_PM_SRC_SHIFT (4U)
#define ROGUE_MMUCTRL_PT_DATA_PM_SRC_CLRMSK (0xFFFFFFFFFFFFFFEFULL)
#define ROGUE_MMUCTRL_PT_DATA_PM_SRC_EN (0x0000000000000010ULL)
#define ROGUE_MMUCTRL_PT_DATA_SLC_BYPASS_CTRL_SHIFT (3U)
#define ROGUE_MMUCTRL_PT_DATA_SLC_BYPASS_CTRL_CLRMSK (0xFFFFFFFFFFFFFFF7ULL)
#define ROGUE_MMUCTRL_PT_DATA_SLC_BYPASS_CTRL_EN (0x0000000000000008ULL)
#define ROGUE_MMUCTRL_PT_DATA_CC_SHIFT (2U)
#define ROGUE_MMUCTRL_PT_DATA_CC_CLRMSK (0xFFFFFFFFFFFFFFFBULL)
#define ROGUE_MMUCTRL_PT_DATA_CC_EN (0x0000000000000004ULL)
#define ROGUE_MMUCTRL_PT_DATA_READ_ONLY_SHIFT (1U)
#define ROGUE_MMUCTRL_PT_DATA_READ_ONLY_CLRMSK (0xFFFFFFFFFFFFFFFDULL)
#define ROGUE_MMUCTRL_PT_DATA_READ_ONLY_EN (0x0000000000000002ULL)
#define ROGUE_MMUCTRL_PT_DATA_VALID_SHIFT (0U)
#define ROGUE_MMUCTRL_PT_DATA_VALID_CLRMSK (0xFFFFFFFFFFFFFFFEULL)
#define ROGUE_MMUCTRL_PT_DATA_VALID_EN (0x0000000000000001ULL)
#define ROGUE_MMUCTRL_PD_DATA_ENTRY_PENDING_SHIFT (40U)
#define ROGUE_MMUCTRL_PD_DATA_ENTRY_PENDING_CLRMSK (0xFFFFFEFFFFFFFFFFULL)
#define ROGUE_MMUCTRL_PD_DATA_ENTRY_PENDING_EN (0x0000010000000000ULL)
#define ROGUE_MMUCTRL_PD_DATA_PT_BASE_SHIFT (5U)
#define ROGUE_MMUCTRL_PD_DATA_PT_BASE_CLRMSK (0xFFFFFF000000001FULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_SHIFT (1U)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_CLRMSK (0xFFFFFFFFFFFFFFF1ULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_4KB (0x0000000000000000ULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_16KB (0x0000000000000002ULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_64KB (0x0000000000000004ULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_256KB (0x0000000000000006ULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_1MB (0x0000000000000008ULL)
#define ROGUE_MMUCTRL_PD_DATA_PAGE_SIZE_2MB (0x000000000000000aULL)
#define ROGUE_MMUCTRL_PD_DATA_VALID_SHIFT (0U)
#define ROGUE_MMUCTRL_PD_DATA_VALID_CLRMSK (0xFFFFFFFFFFFFFFFEULL)
#define ROGUE_MMUCTRL_PD_DATA_VALID_EN (0x0000000000000001ULL)
#define ROGUE_MMUCTRL_PC_DATA_PD_BASE_SHIFT (4U)
#define ROGUE_MMUCTRL_PC_DATA_PD_BASE_CLRMSK (0x0000000FU)
#define ROGUE_MMUCTRL_PC_DATA_PD_BASE_ALIGNSHIFT (12U)
#define ROGUE_MMUCTRL_PC_DATA_PD_BASE_ALIGNSIZE (4096U)
#define ROGUE_MMUCTRL_PC_DATA_ENTRY_PENDING_SHIFT (1U)
#define ROGUE_MMUCTRL_PC_DATA_ENTRY_PENDING_CLRMSK (0xFFFFFFFDU)
#define ROGUE_MMUCTRL_PC_DATA_ENTRY_PENDING_EN (0x00000002U)
#define ROGUE_MMUCTRL_PC_DATA_VALID_SHIFT (0U)
#define ROGUE_MMUCTRL_PC_DATA_VALID_CLRMSK (0xFFFFFFFEU)
#define ROGUE_MMUCTRL_PC_DATA_VALID_EN (0x00000001U)
#endif /* PVR_ROGUE_MMU_DEFS_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