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.

Dependency Surface

Detected Declarations

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

Implementation Notes