Exemplo n.º 1
0
static NvError Ap15CorePerfMonStop(
    NvU32* pCountListSize,
    NvU32* pCountList,
    NvU32* pTotalCycleCount)
{
    NvU32 ccnt, pmn0, pmn1;

    // Disable monotors and check status
    NvError err = Ap15CorePerfMonCheckStatus();
    Ap15CorePerfMonDisable();
    if (err != NvSuccess)
        return err;

    // Read back cycle and event counters
    MRC(p15, 0, ccnt, c15, c12, 1);
    MRC(p15, 0, pmn0, c15, c12, 2);
    MRC(p15, 0, pmn1, c15, c12, 3);

    // Return total cycle count always, and event counts depending on
    // the room provided by the caller
    *pTotalCycleCount = ccnt;
    if (*pCountListSize == 0)
        return NvSuccess;

    pCountList[0] = pmn1;       // ARM spec Event0 <=> Counter 1 (not a typo)
    if (*pCountListSize >= NVRM_AP15_MONITORED_EVENTS_MAX)
    {
        pCountList[1] = pmn0;   // ARM spec Event1 <=> Counter 0 (not a typo)
        *pCountListSize = NVRM_AP15_MONITORED_EVENTS_MAX;
    }
    return NvSuccess;
}
Exemplo n.º 2
0
void
armv_init_user_access(void)
{
    uint32_t v;
    /* Performance Monitoring Unit */
    MRC(ID_DFR0, v);
    if ((v & ID_DFR0_PMU_MASK) != ID_DFR0_PMU_NONE) {
        check_export_pmu();
    }
    /* Arch timers */
    MRC(ID_PFR1, v);
    if (v & ID_PFR1_GENERIC_TIMER) {
        check_export_arch_timer();
    }
}
Exemplo n.º 3
0
static void
check_export_arch_timer(void)
{
    uint32_t v;
    MRC(CNTKCTL, v);
#ifdef CONFIG_EXPORT_PCNT_USER
    v |= CNTKCTL_PL0PCTEN;
#endif
#ifdef CONFIG_EXPORT_VCNT_USER
    v |= CNTKCTL_PL0VCTEN;
#endif
    MCR(CNTKCTL, v);
}
Exemplo n.º 4
0
static NvError Ap15CorePerfMonCheckStatus(void)
{
    // Check if performance counters are enabled and no overflow has occurred
    NvU32 RegValue;
    MRC(p15, 0, RegValue, c15, c12, 0);
    if ((NV_DRF_VAL(AP15_CP15, PMNC, ENABLE, RegValue) == 0) ||
        (NV_DRF_VAL(AP15_CP15, PMNC, CYCLE_CNT_OV, RegValue) == 1) ||
        (NV_DRF_VAL(AP15_CP15, PMNC, EVENT0_CNT_OV, RegValue) == 1) ||
        (NV_DRF_VAL(AP15_CP15, PMNC, EVENT1_CNT_OV, RegValue) == 1))
        return NvError_InvalidState;
    else
        return NvSuccess;
}
Exemplo n.º 5
0
static void
check_export_pmu(void)
{
#ifdef CONFIG_EXPORT_PMU_USER
    /* Export performance counters */
    uint32_t v;
    v = PMUSERENR_ENABLE;
    MCR(PMUSERENR, v);

    /* enable user-level pmu event counter if we're in secure mode */
    if (!(readDscrCp() & DBGDSCR_SECURE_MODE_DISABLED)) {
        MRC(DBGSDER, v);
        v |= DBGSDER_ENABLE_SECURE_USER_NON_INVASIVE_DEBUG;
        MCR(DBGSDER, v);
    }
#endif
}
Exemplo n.º 6
0
MRC::MRC(const char *filename, const char *mode)
{
	MRC();
	open(filename,mode);
}