Re: [Xen-devel] [PATCH 0.5/5] arm/alternatives: Drop the !HAS_ALTERNATIVE infrastructure
On Tue, Jan 30, 2018 at 11:31:27AM +, Andrew Cooper wrote: > On 30/01/18 11:29, Julien Grall wrote: > > Hi Andrew, > > > > Thank you for doing the clean-up. > > > > On 30/01/18 11:16, Andrew Cooper wrote: > >> 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 > >> --- > >> CC: Stefano Stabellini > >> CC: Julien Grall > >> CC: Konrad Rzeszutek Wilk > >> > >> N.B. Only compile tested > >> --- > >> xen/arch/arm/xen.lds.S | 2 -- > >> xen/include/asm-arm/alternative.h | 15 --- > >> xen/test/livepatch/xen_hello_world_func.c | 2 +- > > > > You forgot on in include/asm-arm/cpuerrata.h :). > > Oops - so I did. Folded this incremental diff. Reviewed-by: Konrad Rzeszutek Wilk ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 0.5/5] arm/alternatives: Drop the !HAS_ALTERNATIVE infrastructure
Hi, On 30/01/18 11:31, Andrew Cooper wrote: On 30/01/18 11:29, Julien Grall wrote: Hi Andrew, Thank you for doing the clean-up. On 30/01/18 11:16, Andrew Cooper wrote: 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 --- CC: Stefano Stabellini CC: Julien Grall CC: Konrad Rzeszutek Wilk N.B. Only compile tested --- xen/arch/arm/xen.lds.S | 2 -- xen/include/asm-arm/alternative.h | 15 --- xen/test/livepatch/xen_hello_world_func.c | 2 +- You forgot on in include/asm-arm/cpuerrata.h :). Oops - so I did. Folded this incremental diff. With that folded: Acked-by: Julien Grall Cheers, ~Andrew diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h index 7de6836..4e45b23 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) ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 0.5/5] arm/alternatives: Drop the !HAS_ALTERNATIVE infrastructure
On 30/01/18 11:29, Julien Grall wrote: > Hi Andrew, > > Thank you for doing the clean-up. > > On 30/01/18 11:16, Andrew Cooper wrote: >> 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 >> --- >> CC: Stefano Stabellini >> CC: Julien Grall >> CC: Konrad Rzeszutek Wilk >> >> N.B. Only compile tested >> --- >> xen/arch/arm/xen.lds.S | 2 -- >> xen/include/asm-arm/alternative.h | 15 --- >> xen/test/livepatch/xen_hello_world_func.c | 2 +- > > You forgot on in include/asm-arm/cpuerrata.h :). Oops - so I did. Folded this incremental diff. ~Andrew diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h index 7de6836..4e45b23 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) ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 0.5/5] arm/alternatives: Drop the !HAS_ALTERNATIVE infrastructure
Hi Andrew, Thank you for doing the clean-up. On 30/01/18 11:16, Andrew Cooper wrote: 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 --- CC: Stefano Stabellini CC: Julien Grall CC: Konrad Rzeszutek Wilk N.B. Only compile tested --- xen/arch/arm/xen.lds.S| 2 -- xen/include/asm-arm/alternative.h | 15 --- xen/test/livepatch/xen_hello_world_func.c | 2 +- You forgot on in include/asm-arm/cpuerrata.h :). 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index c9b9546..b039018 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 6cc9d0d..4e33d1c 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/test/livepatch/xen_hello_world_func.c b/xen/test/livepatch/xen_hello_world_func.c index 1518f71..b358224 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 Cheers, -- Julien Grall ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 0.5/5] 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 --- CC: Stefano Stabellini CC: Julien Grall CC: Konrad Rzeszutek Wilk N.B. Only compile tested --- xen/arch/arm/xen.lds.S| 2 -- xen/include/asm-arm/alternative.h | 15 --- xen/test/livepatch/xen_hello_world_func.c | 2 +- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index c9b9546..b039018 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 6cc9d0d..4e33d1c 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/test/livepatch/xen_hello_world_func.c b/xen/test/livepatch/xen_hello_world_func.c index 1518f71..b358224 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.1.4 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel