mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-19 15:14:03 -04:00
Adds two tests. One is a simple test to ensure that the new registers LMRR and LMSER are properly maintained. The other actually uses the existing EBB test infrastructure to test that LMRR and LMSER behave as documented. Signed-off-by: Jack Miller <jack@codezen.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
40 lines
786 B
C
40 lines
786 B
C
#ifndef _SELFTESTS_POWERPC_PMU_EBB_LMR_H
|
|
#define _SELFTESTS_POWERPC_PMU_EBB_LMR_H
|
|
|
|
#include "reg.h"
|
|
|
|
#ifndef PPC_FEATURE2_ARCH_3_00
|
|
#define PPC_FEATURE2_ARCH_3_00 0x00800000
|
|
#endif
|
|
|
|
#define lmr_is_supported() have_hwcap2(PPC_FEATURE2_ARCH_3_00)
|
|
|
|
static inline void ebb_lmr_reset(void)
|
|
{
|
|
unsigned long bescr = mfspr(SPRN_BESCR);
|
|
bescr &= ~(BESCR_LMEO);
|
|
bescr |= BESCR_LME;
|
|
mtspr(SPRN_BESCR, bescr);
|
|
}
|
|
|
|
#define LDMX(t, a, b)\
|
|
(0x7c00026a | \
|
|
(((t) & 0x1f) << 21) | \
|
|
(((a) & 0x1f) << 16) | \
|
|
(((b) & 0x1f) << 11))
|
|
|
|
static inline unsigned long ldmx(unsigned long address)
|
|
{
|
|
unsigned long ret;
|
|
|
|
asm volatile ("mr 9, %1\r\n"
|
|
".long " __stringify(LDMX(9, 0, 9)) "\r\n"
|
|
"mr %0, 9\r\n":"=r"(ret)
|
|
:"r"(address)
|
|
:"r9");
|
|
|
|
return ret;
|
|
}
|
|
|
|
#endif
|