aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2010-11-07 13:22:29 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-01-20 22:08:33 -0500
commitc0337288ab165be17081d61d4ef13b79d3ac55d4 (patch)
tree0ed7766bae30e2a0ce70772a95840808421ea778 /arch
parent50f4df4e6a7ae111fd9b8fada4155675a4410e99 (diff)
powerpc: Ensure the else case of feature sections will fit
When we create an alternative feature section, the else case must be the same size or smaller than the body. This is because when we patch the else case in we just overwrite the body, so there must be room. Up to now we just did this by inspection, but it's quite easy to enforce it in the assembler, so we should. The only change is to add the ifgt block, but that effects the alignment of the tabs and so the whole macro is modified. Also add a test, but #if 0 it because we don't want to break the build. Anyone who's modifying the feature macros should enable the test. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/feature-fixups.h27
-rw-r--r--arch/powerpc/lib/feature-fixups-test.S19
2 files changed, 34 insertions, 12 deletions
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
index 96a7d067fbb..921a8470e18 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -37,18 +37,21 @@ label##2: \
37 .align 2; \ 37 .align 2; \
38label##3: 38label##3:
39 39
40#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ 40#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
41label##4: \ 41label##4: \
42 .popsection; \ 42 .popsection; \
43 .pushsection sect,"a"; \ 43 .pushsection sect,"a"; \
44 .align 3; \ 44 .align 3; \
45label##5: \ 45label##5: \
46 FTR_ENTRY_LONG msk; \ 46 FTR_ENTRY_LONG msk; \
47 FTR_ENTRY_LONG val; \ 47 FTR_ENTRY_LONG val; \
48 FTR_ENTRY_OFFSET label##1b-label##5b; \ 48 FTR_ENTRY_OFFSET label##1b-label##5b; \
49 FTR_ENTRY_OFFSET label##2b-label##5b; \ 49 FTR_ENTRY_OFFSET label##2b-label##5b; \
50 FTR_ENTRY_OFFSET label##3b-label##5b; \ 50 FTR_ENTRY_OFFSET label##3b-label##5b; \
51 FTR_ENTRY_OFFSET label##4b-label##5b; \ 51 FTR_ENTRY_OFFSET label##4b-label##5b; \
52 .ifgt (label##4b-label##3b)-(label##2b-label##1b); \
53 .error "Feature section else case larger than body"; \
54 .endif; \
52 .popsection; 55 .popsection;
53 56
54 57
diff --git a/arch/powerpc/lib/feature-fixups-test.S b/arch/powerpc/lib/feature-fixups-test.S
index cb737484c5a..f4613118132 100644
--- a/arch/powerpc/lib/feature-fixups-test.S
+++ b/arch/powerpc/lib/feature-fixups-test.S
@@ -172,6 +172,25 @@ globl(ftr_fixup_test6_expected)
1723: or 3,3,3 1723: or 3,3,3
173 173
174 174
175#if 0
176/* Test that if we have a larger else case the assembler spots it and
177 * reports an error. #if 0'ed so as not to break the build normally.
178 */
179ftr_fixup_test7:
180 or 1,1,1
181BEGIN_FTR_SECTION
182 or 2,2,2
183 or 2,2,2
184 or 2,2,2
185FTR_SECTION_ELSE
186 or 3,3,3
187 or 3,3,3
188 or 3,3,3
189 or 3,3,3
190ALT_FTR_SECTION_END(0, 1)
191 or 1,1,1
192#endif
193
175#define MAKE_MACRO_TEST(TYPE) \ 194#define MAKE_MACRO_TEST(TYPE) \
176globl(ftr_fixup_test_ ##TYPE##_macros) \ 195globl(ftr_fixup_test_ ##TYPE##_macros) \
177 or 1,1,1; \ 196 or 1,1,1; \