From 351a03aae2352efb5688f7af96c1f3c358d8fb4b Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 30 Jan 2018 11:08:45 +0000 Subject: [PATCH] arm/alternatives: Drop the !HAS_ALTERNATIVE infrastructure ARM now unconditionally selects HAS_ALTERNATIVE, which has caused the !HAS_ALTERNATIVE code in include/asm-arm/alternative.h to bitrot to the point of failing to compile. Expand all the CONFIG_HAS_ALTERNATIVE references in ARM code. Signed-off-by: Andrew Cooper Acked-by: Julien Grall Reviewed-by: Konrad Rzeszutek Wilk --- xen/arch/arm/xen.lds.S | 2 -- xen/include/asm-arm/alternative.h | 15 --------------- xen/include/asm-arm/cpuerrata.h | 15 --------------- xen/test/livepatch/xen_hello_world_func.c | 2 +- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index c9b9546435..b0390180b4 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -154,14 +154,12 @@ SECTIONS *(.initcall1.init) __initcall_end = .; -#ifdef CONFIG_HAS_ALTERNATIVE . = ALIGN(4); __alt_instructions = .; *(.altinstructions) __alt_instructions_end = .; . = ALIGN(4); *(.altinstr_replacement) -#endif *(.init.data) *(.init.data.rel) diff --git a/xen/include/asm-arm/alternative.h b/xen/include/asm-arm/alternative.h index 6cc9d0dc5f..4e33d1cdf7 100644 --- a/xen/include/asm-arm/alternative.h +++ b/xen/include/asm-arm/alternative.h @@ -3,8 +3,6 @@ #include -#ifdef CONFIG_HAS_ALTERNATIVE - #ifndef __ASSEMBLY__ #include @@ -152,17 +150,4 @@ int apply_alternatives(const struct alt_instr *start, const struct alt_instr *en #define ALTERNATIVE(oldinstr, newinstr, ...) \ _ALTERNATIVE_CFG(oldinstr, newinstr, __VA_ARGS__, 1) -#else /* !CONFIG_HAS_ALTERNATIVE */ - -static inline void apply_alternatives_all(void) -{ -} - -static inline int apply_alternatives(void *start, size_t length) -{ - return 0; -} - -#endif - #endif /* __ASM_ALTERNATIVE_H */ diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h index 7de68361ff..4e45b237c8 100644 --- a/xen/include/asm-arm/cpuerrata.h +++ b/xen/include/asm-arm/cpuerrata.h @@ -7,8 +7,6 @@ void check_local_cpu_errata(void); void enable_errata_workarounds(void); -#ifdef CONFIG_HAS_ALTERNATIVE - #define CHECK_WORKAROUND_HELPER(erratum, feature, arch) \ static inline bool check_workaround_##erratum(void) \ { \ @@ -27,19 +25,6 @@ static inline bool check_workaround_##erratum(void) \ } \ } -#else /* CONFIG_HAS_ALTERNATIVE */ - -#define CHECK_WORKAROUND_HELPER(erratum, feature, arch) \ -static inline bool check_workaround_##erratum(void) \ -{ \ - if ( !IS_ENABLED(arch) ) \ - return false; \ - else \ - return unlikely(cpus_have_cap(feature)); \ -} - -#endif - CHECK_WORKAROUND_HELPER(766422, ARM32_WORKAROUND_766422, CONFIG_ARM_32) CHECK_WORKAROUND_HELPER(834220, ARM64_WORKAROUND_834220, CONFIG_ARM_64) diff --git a/xen/test/livepatch/xen_hello_world_func.c b/xen/test/livepatch/xen_hello_world_func.c index 1518f71e3e..b358224e3e 100644 --- a/xen/test/livepatch/xen_hello_world_func.c +++ b/xen/test/livepatch/xen_hello_world_func.c @@ -29,7 +29,7 @@ const char *xen_hello_world(void) rc = __get_user(tmp, non_canonical_addr); BUG_ON(rc != -EFAULT); #endif -#if defined(CONFIG_ARM) && defined(CONFIG_HAS_ALTERNATIVE) +#if defined(CONFIG_ARM) asm(ALTERNATIVE("nop", "nop", LIVEPATCH_FEATURE)); #endif -- 2.39.5