diff options
Diffstat (limited to 'arch/powerpc/include/asm/ppc_asm.h')
-rw-r--r-- | arch/powerpc/include/asm/ppc_asm.h | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 498fe09263d3..98210067c1cc 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/asm-compat.h> | 9 | #include <asm/asm-compat.h> |
10 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
11 | #include <asm/ppc-opcode.h> | 11 | #include <asm/ppc-opcode.h> |
12 | #include <asm/firmware.h> | ||
12 | 13 | ||
13 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
14 | #error __FILE__ should only be used in assembler files | 15 | #error __FILE__ should only be used in assembler files |
@@ -26,17 +27,13 @@ | |||
26 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 27 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING |
27 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) | 28 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) |
28 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) | 29 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) |
30 | #define ACCOUNT_STOLEN_TIME | ||
29 | #else | 31 | #else |
30 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) \ | 32 | #define ACCOUNT_CPU_USER_ENTRY(ra, rb) \ |
31 | beq 2f; /* if from kernel mode */ \ | 33 | beq 2f; /* if from kernel mode */ \ |
32 | BEGIN_FTR_SECTION; \ | 34 | MFTB(ra); /* get timebase */ \ |
33 | mfspr ra,SPRN_PURR; /* get processor util. reg */ \ | 35 | ld rb,PACA_STARTTIME_USER(r13); \ |
34 | END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ | 36 | std ra,PACA_STARTTIME(r13); \ |
35 | BEGIN_FTR_SECTION; \ | ||
36 | MFTB(ra); /* or get TB if no PURR */ \ | ||
37 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | ||
38 | ld rb,PACA_STARTPURR(r13); \ | ||
39 | std ra,PACA_STARTPURR(r13); \ | ||
40 | subf rb,rb,ra; /* subtract start value */ \ | 37 | subf rb,rb,ra; /* subtract start value */ \ |
41 | ld ra,PACA_USER_TIME(r13); \ | 38 | ld ra,PACA_USER_TIME(r13); \ |
42 | add ra,ra,rb; /* add on to user time */ \ | 39 | add ra,ra,rb; /* add on to user time */ \ |
@@ -44,19 +41,34 @@ END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | |||
44 | 2: | 41 | 2: |
45 | 42 | ||
46 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) \ | 43 | #define ACCOUNT_CPU_USER_EXIT(ra, rb) \ |
47 | BEGIN_FTR_SECTION; \ | 44 | MFTB(ra); /* get timebase */ \ |
48 | mfspr ra,SPRN_PURR; /* get processor util. reg */ \ | 45 | ld rb,PACA_STARTTIME(r13); \ |
49 | END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ | 46 | std ra,PACA_STARTTIME_USER(r13); \ |
50 | BEGIN_FTR_SECTION; \ | ||
51 | MFTB(ra); /* or get TB if no PURR */ \ | ||
52 | END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | ||
53 | ld rb,PACA_STARTPURR(r13); \ | ||
54 | std ra,PACA_STARTPURR(r13); \ | ||
55 | subf rb,rb,ra; /* subtract start value */ \ | 47 | subf rb,rb,ra; /* subtract start value */ \ |
56 | ld ra,PACA_SYSTEM_TIME(r13); \ | 48 | ld ra,PACA_SYSTEM_TIME(r13); \ |
57 | add ra,ra,rb; /* add on to user time */ \ | 49 | add ra,ra,rb; /* add on to system time */ \ |
58 | std ra,PACA_SYSTEM_TIME(r13); | 50 | std ra,PACA_SYSTEM_TIME(r13) |
59 | #endif | 51 | |
52 | #ifdef CONFIG_PPC_SPLPAR | ||
53 | #define ACCOUNT_STOLEN_TIME \ | ||
54 | BEGIN_FW_FTR_SECTION; \ | ||
55 | beq 33f; \ | ||
56 | /* from user - see if there are any DTL entries to process */ \ | ||
57 | ld r10,PACALPPACAPTR(r13); /* get ptr to VPA */ \ | ||
58 | ld r11,PACA_DTL_RIDX(r13); /* get log read index */ \ | ||
59 | ld r10,LPPACA_DTLIDX(r10); /* get log write index */ \ | ||
60 | cmpd cr1,r11,r10; \ | ||
61 | beq+ cr1,33f; \ | ||
62 | bl .accumulate_stolen_time; \ | ||
63 | 33: \ | ||
64 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) | ||
65 | |||
66 | #else /* CONFIG_PPC_SPLPAR */ | ||
67 | #define ACCOUNT_STOLEN_TIME | ||
68 | |||
69 | #endif /* CONFIG_PPC_SPLPAR */ | ||
70 | |||
71 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | ||
60 | 72 | ||
61 | /* | 73 | /* |
62 | * Macros for storing registers into and loading registers from | 74 | * Macros for storing registers into and loading registers from |