diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2014-07-10 05:34:31 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2014-12-28 23:45:55 -0500 |
commit | 9a4fc4eaf111ca960c9f524b850598e9dbc9697f (patch) | |
tree | 0c34f91c32c3fb06161a3fadc30858ccd743d634 /arch | |
parent | 803d57de2b27000ed4400d16561c75821efe8333 (diff) |
powerpc/kvm: Create proper names for the kvm_host_state PMU fields
We have two arrays in kvm_host_state that contain register values for
the PMU. Currently we only create an asm-offsets symbol for the base of
the arrays, and do the array offset in the assembly code.
Creating an asm-offsets symbol for each field individually makes the
code much nicer to read, particularly for the MMCRx/SIxR/SDAR fields, and
might have helped us notice the recent double restore bug we had in this
code.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 15 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_interrupts.S | 26 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 28 |
3 files changed, 40 insertions, 29 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index e624f9646350..4717859fdd04 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -644,8 +644,19 @@ int main(void) | |||
644 | HSTATE_FIELD(HSTATE_SAVED_XIRR, saved_xirr); | 644 | HSTATE_FIELD(HSTATE_SAVED_XIRR, saved_xirr); |
645 | HSTATE_FIELD(HSTATE_HOST_IPI, host_ipi); | 645 | HSTATE_FIELD(HSTATE_HOST_IPI, host_ipi); |
646 | HSTATE_FIELD(HSTATE_PTID, ptid); | 646 | HSTATE_FIELD(HSTATE_PTID, ptid); |
647 | HSTATE_FIELD(HSTATE_MMCR, host_mmcr); | 647 | HSTATE_FIELD(HSTATE_MMCR0, host_mmcr[0]); |
648 | HSTATE_FIELD(HSTATE_PMC, host_pmc); | 648 | HSTATE_FIELD(HSTATE_MMCR1, host_mmcr[1]); |
649 | HSTATE_FIELD(HSTATE_MMCRA, host_mmcr[2]); | ||
650 | HSTATE_FIELD(HSTATE_SIAR, host_mmcr[3]); | ||
651 | HSTATE_FIELD(HSTATE_SDAR, host_mmcr[4]); | ||
652 | HSTATE_FIELD(HSTATE_MMCR2, host_mmcr[5]); | ||
653 | HSTATE_FIELD(HSTATE_SIER, host_mmcr[6]); | ||
654 | HSTATE_FIELD(HSTATE_PMC1, host_pmc[0]); | ||
655 | HSTATE_FIELD(HSTATE_PMC2, host_pmc[1]); | ||
656 | HSTATE_FIELD(HSTATE_PMC3, host_pmc[2]); | ||
657 | HSTATE_FIELD(HSTATE_PMC4, host_pmc[3]); | ||
658 | HSTATE_FIELD(HSTATE_PMC5, host_pmc[4]); | ||
659 | HSTATE_FIELD(HSTATE_PMC6, host_pmc[5]); | ||
649 | HSTATE_FIELD(HSTATE_PURR, host_purr); | 660 | HSTATE_FIELD(HSTATE_PURR, host_purr); |
650 | HSTATE_FIELD(HSTATE_SPURR, host_spurr); | 661 | HSTATE_FIELD(HSTATE_SPURR, host_spurr); |
651 | HSTATE_FIELD(HSTATE_DSCR, host_dscr); | 662 | HSTATE_FIELD(HSTATE_DSCR, host_dscr); |
diff --git a/arch/powerpc/kvm/book3s_hv_interrupts.S b/arch/powerpc/kvm/book3s_hv_interrupts.S index 36540a99d178..0fdc4a28970b 100644 --- a/arch/powerpc/kvm/book3s_hv_interrupts.S +++ b/arch/powerpc/kvm/book3s_hv_interrupts.S | |||
@@ -93,15 +93,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |||
93 | mfspr r5, SPRN_MMCR1 | 93 | mfspr r5, SPRN_MMCR1 |
94 | mfspr r9, SPRN_SIAR | 94 | mfspr r9, SPRN_SIAR |
95 | mfspr r10, SPRN_SDAR | 95 | mfspr r10, SPRN_SDAR |
96 | std r7, HSTATE_MMCR(r13) | 96 | std r7, HSTATE_MMCR0(r13) |
97 | std r5, HSTATE_MMCR + 8(r13) | 97 | std r5, HSTATE_MMCR1(r13) |
98 | std r6, HSTATE_MMCR + 16(r13) | 98 | std r6, HSTATE_MMCRA(r13) |
99 | std r9, HSTATE_MMCR + 24(r13) | 99 | std r9, HSTATE_SIAR(r13) |
100 | std r10, HSTATE_MMCR + 32(r13) | 100 | std r10, HSTATE_SDAR(r13) |
101 | BEGIN_FTR_SECTION | 101 | BEGIN_FTR_SECTION |
102 | mfspr r9, SPRN_SIER | 102 | mfspr r9, SPRN_SIER |
103 | std r8, HSTATE_MMCR + 40(r13) | 103 | std r8, HSTATE_MMCR2(r13) |
104 | std r9, HSTATE_MMCR + 48(r13) | 104 | std r9, HSTATE_SIER(r13) |
105 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | 105 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |
106 | mfspr r3, SPRN_PMC1 | 106 | mfspr r3, SPRN_PMC1 |
107 | mfspr r5, SPRN_PMC2 | 107 | mfspr r5, SPRN_PMC2 |
@@ -109,12 +109,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |||
109 | mfspr r7, SPRN_PMC4 | 109 | mfspr r7, SPRN_PMC4 |
110 | mfspr r8, SPRN_PMC5 | 110 | mfspr r8, SPRN_PMC5 |
111 | mfspr r9, SPRN_PMC6 | 111 | mfspr r9, SPRN_PMC6 |
112 | stw r3, HSTATE_PMC(r13) | 112 | stw r3, HSTATE_PMC1(r13) |
113 | stw r5, HSTATE_PMC + 4(r13) | 113 | stw r5, HSTATE_PMC2(r13) |
114 | stw r6, HSTATE_PMC + 8(r13) | 114 | stw r6, HSTATE_PMC3(r13) |
115 | stw r7, HSTATE_PMC + 12(r13) | 115 | stw r7, HSTATE_PMC4(r13) |
116 | stw r8, HSTATE_PMC + 16(r13) | 116 | stw r8, HSTATE_PMC5(r13) |
117 | stw r9, HSTATE_PMC + 20(r13) | 117 | stw r9, HSTATE_PMC6(r13) |
118 | 31: | 118 | 31: |
119 | 119 | ||
120 | /* | 120 | /* |
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 10554df13852..bb94e6f20c81 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -83,35 +83,35 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) | |||
83 | cmpwi r4, 0 | 83 | cmpwi r4, 0 |
84 | beq 23f /* skip if not */ | 84 | beq 23f /* skip if not */ |
85 | BEGIN_FTR_SECTION | 85 | BEGIN_FTR_SECTION |
86 | ld r3, HSTATE_MMCR(r13) | 86 | ld r3, HSTATE_MMCR0(r13) |
87 | andi. r4, r3, MMCR0_PMAO_SYNC | MMCR0_PMAO | 87 | andi. r4, r3, MMCR0_PMAO_SYNC | MMCR0_PMAO |
88 | cmpwi r4, MMCR0_PMAO | 88 | cmpwi r4, MMCR0_PMAO |
89 | beql kvmppc_fix_pmao | 89 | beql kvmppc_fix_pmao |
90 | END_FTR_SECTION_IFSET(CPU_FTR_PMAO_BUG) | 90 | END_FTR_SECTION_IFSET(CPU_FTR_PMAO_BUG) |
91 | lwz r3, HSTATE_PMC(r13) | 91 | lwz r3, HSTATE_PMC1(r13) |
92 | lwz r4, HSTATE_PMC + 4(r13) | 92 | lwz r4, HSTATE_PMC2(r13) |
93 | lwz r5, HSTATE_PMC + 8(r13) | 93 | lwz r5, HSTATE_PMC3(r13) |
94 | lwz r6, HSTATE_PMC + 12(r13) | 94 | lwz r6, HSTATE_PMC4(r13) |
95 | lwz r8, HSTATE_PMC + 16(r13) | 95 | lwz r8, HSTATE_PMC5(r13) |
96 | lwz r9, HSTATE_PMC + 20(r13) | 96 | lwz r9, HSTATE_PMC6(r13) |
97 | mtspr SPRN_PMC1, r3 | 97 | mtspr SPRN_PMC1, r3 |
98 | mtspr SPRN_PMC2, r4 | 98 | mtspr SPRN_PMC2, r4 |
99 | mtspr SPRN_PMC3, r5 | 99 | mtspr SPRN_PMC3, r5 |
100 | mtspr SPRN_PMC4, r6 | 100 | mtspr SPRN_PMC4, r6 |
101 | mtspr SPRN_PMC5, r8 | 101 | mtspr SPRN_PMC5, r8 |
102 | mtspr SPRN_PMC6, r9 | 102 | mtspr SPRN_PMC6, r9 |
103 | ld r3, HSTATE_MMCR(r13) | 103 | ld r3, HSTATE_MMCR0(r13) |
104 | ld r4, HSTATE_MMCR + 8(r13) | 104 | ld r4, HSTATE_MMCR1(r13) |
105 | ld r5, HSTATE_MMCR + 16(r13) | 105 | ld r5, HSTATE_MMCRA(r13) |
106 | ld r6, HSTATE_MMCR + 24(r13) | 106 | ld r6, HSTATE_SIAR(r13) |
107 | ld r7, HSTATE_MMCR + 32(r13) | 107 | ld r7, HSTATE_SDAR(r13) |
108 | mtspr SPRN_MMCR1, r4 | 108 | mtspr SPRN_MMCR1, r4 |
109 | mtspr SPRN_MMCRA, r5 | 109 | mtspr SPRN_MMCRA, r5 |
110 | mtspr SPRN_SIAR, r6 | 110 | mtspr SPRN_SIAR, r6 |
111 | mtspr SPRN_SDAR, r7 | 111 | mtspr SPRN_SDAR, r7 |
112 | BEGIN_FTR_SECTION | 112 | BEGIN_FTR_SECTION |
113 | ld r8, HSTATE_MMCR + 40(r13) | 113 | ld r8, HSTATE_MMCR2(r13) |
114 | ld r9, HSTATE_MMCR + 48(r13) | 114 | ld r9, HSTATE_SIER(r13) |
115 | mtspr SPRN_MMCR2, r8 | 115 | mtspr SPRN_MMCR2, r8 |
116 | mtspr SPRN_SIER, r9 | 116 | mtspr SPRN_SIER, r9 |
117 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | 117 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |