arch/mips/cavium-octeon/executive/cvmx-l2c.c
Source file repositories/reference/linux-study-clean/arch/mips/cavium-octeon/executive/cvmx-l2c.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/cavium-octeon/executive/cvmx-l2c.c- Extension
.c- Size
- 25987 bytes
- Lines
- 920
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.hlinux/irqflags.hasm/octeon/cvmx.hasm/octeon/cvmx-l2c.hasm/octeon/cvmx-spinlock.h
Detected Declarations
struct cvmx_l2c_tag_cn50xxstruct cvmx_l2c_tag_cn30xxstruct cvmx_l2c_tag_cn31xxstruct cvmx_l2c_tag_cn38xxstruct cvmx_l2c_tag_cn58xxfunction cvmx_l2c_get_core_way_partitionfunction cvmx_l2c_set_core_way_partitionfunction cvmx_l2c_set_hw_way_partitionfunction cvmx_l2c_get_hw_way_partitionfunction cvmx_l2c_config_perffunction cvmx_l2c_read_perffunction fault_infunction cvmx_l2c_lock_linefunction cvmx_l2c_lock_mem_regionfunction cvmx_l2c_flushfunction cvmx_l2c_unlock_linefunction cvmx_l2c_unlock_mem_regionfunction __read_l2_tagfunction cvmx_l2c_get_tagfunction cvmx_l2c_address_to_indexfunction cvmx_l2c_get_cache_size_bytesfunction cvmx_l2c_get_set_bitsfunction cvmx_l2c_get_num_setsfunction cvmx_l2c_get_num_assocfunction cvmx_l2c_flush_line
Annotated Snippet
struct cvmx_l2c_tag_cn50xx {
__BITFIELD_FIELD(uint64_t reserved:40,
__BITFIELD_FIELD(uint64_t V:1, /* Line valid */
__BITFIELD_FIELD(uint64_t D:1, /* Line dirty */
__BITFIELD_FIELD(uint64_t L:1, /* Line locked */
__BITFIELD_FIELD(uint64_t U:1, /* Use, LRU eviction */
__BITFIELD_FIELD(uint64_t addr:20, /* Phys addr (33..14) */
;))))))
} cn50xx;
struct cvmx_l2c_tag_cn30xx {
__BITFIELD_FIELD(uint64_t reserved:41,
__BITFIELD_FIELD(uint64_t V:1, /* Line valid */
__BITFIELD_FIELD(uint64_t D:1, /* Line dirty */
__BITFIELD_FIELD(uint64_t L:1, /* Line locked */
__BITFIELD_FIELD(uint64_t U:1, /* Use, LRU eviction */
__BITFIELD_FIELD(uint64_t addr:19, /* Phys addr (33..15) */
;))))))
} cn30xx;
struct cvmx_l2c_tag_cn31xx {
__BITFIELD_FIELD(uint64_t reserved:42,
__BITFIELD_FIELD(uint64_t V:1, /* Line valid */
__BITFIELD_FIELD(uint64_t D:1, /* Line dirty */
__BITFIELD_FIELD(uint64_t L:1, /* Line locked */
__BITFIELD_FIELD(uint64_t U:1, /* Use, LRU eviction */
__BITFIELD_FIELD(uint64_t addr:18, /* Phys addr (33..16) */
;))))))
} cn31xx;
struct cvmx_l2c_tag_cn38xx {
__BITFIELD_FIELD(uint64_t reserved:43,
__BITFIELD_FIELD(uint64_t V:1, /* Line valid */
__BITFIELD_FIELD(uint64_t D:1, /* Line dirty */
__BITFIELD_FIELD(uint64_t L:1, /* Line locked */
__BITFIELD_FIELD(uint64_t U:1, /* Use, LRU eviction */
__BITFIELD_FIELD(uint64_t addr:17, /* Phys addr (33..17) */
;))))))
} cn38xx;
struct cvmx_l2c_tag_cn58xx {
__BITFIELD_FIELD(uint64_t reserved:44,
__BITFIELD_FIELD(uint64_t V:1, /* Line valid */
__BITFIELD_FIELD(uint64_t D:1, /* Line dirty */
__BITFIELD_FIELD(uint64_t L:1, /* Line locked */
__BITFIELD_FIELD(uint64_t U:1, /* Use, LRU eviction */
__BITFIELD_FIELD(uint64_t addr:16, /* Phys addr (33..18) */
;))))))
} cn58xx;
struct cvmx_l2c_tag_cn58xx cn56xx; /* 2048 sets */
struct cvmx_l2c_tag_cn31xx cn52xx; /* 512 sets */
};
/*
* @INTERNAL
* Function to read a L2C tag. This code make the current core
* the 'debug core' for the L2. This code must only be executed by
* 1 core at a time.
*
* @assoc: Association (way) of the tag to dump
* @index: Index of the cacheline
*
* Returns The Octeon model specific tag structure. This is
* translated by a wrapper function to a generic form that is
* easier for applications to use.
*/
static union __cvmx_l2c_tag __read_l2_tag(uint64_t assoc, uint64_t index)
{
uint64_t debug_tag_addr = CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, (index << 7) + 96);
uint64_t core = cvmx_get_core_num();
union __cvmx_l2c_tag tag_val;
uint64_t dbg_addr = CVMX_L2C_DBG;
unsigned long flags;
union cvmx_l2c_dbg debug_val;
debug_val.u64 = 0;
/*
* For low core count parts, the core number is always small
* enough to stay in the correct field and not set any
* reserved bits.
*/
debug_val.s.ppnum = core;
debug_val.s.l2t = 1;
debug_val.s.set = assoc;
local_irq_save(flags);
/*
* Make sure core is quiet (no prefetches, etc.) before
* entering debug mode.
*/
CVMX_SYNC;
/* Flush L1 to make sure debug load misses L1 */
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/irqflags.h`, `asm/octeon/cvmx.h`, `asm/octeon/cvmx-l2c.h`, `asm/octeon/cvmx-spinlock.h`.
- Detected declarations: `struct cvmx_l2c_tag_cn50xx`, `struct cvmx_l2c_tag_cn30xx`, `struct cvmx_l2c_tag_cn31xx`, `struct cvmx_l2c_tag_cn38xx`, `struct cvmx_l2c_tag_cn58xx`, `function cvmx_l2c_get_core_way_partition`, `function cvmx_l2c_set_core_way_partition`, `function cvmx_l2c_set_hw_way_partition`, `function cvmx_l2c_get_hw_way_partition`, `function cvmx_l2c_config_perf`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.