[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] Livepatch for ARM 64 and 32.
On Wed, Aug 31, 2016 at 09:54:30AM -0600, Jan Beulich wrote: > >>> On 31.08.16 at 17:24, <andrew.cooper3@xxxxxxxxxx> wrote: > > On 31/08/16 16:09, Julien Grall wrote: > >> On 31/08/16 16:06, Konrad Rzeszutek Wilk wrote: > >>> So you are thinking of exposing this 'xen feature bits' that Andrew > >>> mention > >>> to be on ARM as well. > >> > >> I only chat with Andrew about it and I have not looked at the code, so > >> I can't tell how it is on x86. I was just thinking to add LIVEPATCH > >> bit in cpufeature.h for now and be worry later when cpufeature will be > >> exposed to the toolstack for ARM. > > > > Sorry - I have forgotten what exactly the purpose of this bit needs to > > be, and therefore which bit of x86 I point you at. > > I'm pretty sure talk here is about X86_FEATURE_ALWAYS. Which is X86_FEATURE_LM, which is what we have in the test-case - and that 'lm' part is exposed to the toolstack. Anyhow I believe Julien was thinking something like this: (Would be nice if we could do arch-independent NOPs) diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c index a076982..549f908 100644 --- a/xen/arch/arm/livepatch.c +++ b/xen/arch/arm/livepatch.c @@ -8,6 +8,7 @@ #include <xen/livepatch.h> #include <xen/vmap.h> +#include <asm/cpufeature.h> #include <asm/livepatch.h> #include <asm/mm.h> @@ -167,6 +168,8 @@ void __init arch_livepatch_init(void) end = (void *)LIVEPATCH_VMAP_END; vm_init_type(VMAP_XEN, start, end); + + cpus_set_cap(LIVEPATCH_FEATURE); } /* diff --git a/xen/include/asm-arm/alternative.h b/xen/include/asm-arm/alternative.h index 9f88fd9..074ff63 100644 --- a/xen/include/asm-arm/alternative.h +++ b/xen/include/asm-arm/alternative.h @@ -165,6 +165,8 @@ static inline int apply_alternatives(void *start, size_t lenght) return 0; } +#define ALTERNATIVE(oldinstr, newinstr, ...) "" + #endif #endif /* __ASM_ALTERNATIVE_H */ diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h index 66e930f..19e768b 100644 --- a/xen/include/asm-arm/cpufeature.h +++ b/xen/include/asm-arm/cpufeature.h @@ -40,7 +40,12 @@ #define ARM32_WORKAROUND_766422 2 #define ARM64_WORKAROUND_834220 3 +#ifdef CONFIG_LIVEPATCH +#define LIVEPATCH_FEATURE 4 +#define ARM_NCAPS 5 +#else #define ARM_NCAPS 4 +#endif #ifndef __ASSEMBLY__ diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h index bcdf5d6..404dd91 100644 --- a/xen/include/asm-x86/cpufeature.h +++ b/xen/include/asm-x86/cpufeature.h @@ -34,6 +34,7 @@ XEN_CPUFEATURE(MFENCE_RDTSC, (FSCAPINTS+0)*32+ 9) /* MFENCE synchronizes RDTS /* An alias of a feature we know is always going to be present. */ #define X86_FEATURE_ALWAYS X86_FEATURE_LM +#define LIVEPATCH_FEATURE X86_FEATURE_ALWAYS #if !defined(__ASSEMBLY__) && !defined(X86_FEATURES_ONLY) #include <xen/bitops.h> diff --git a/xen/test/livepatch/xen_hello_world_func.c b/xen/test/livepatch/xen_hello_world_func.c index 6f53ab4..6b41a55 100644 --- a/xen/test/livepatch/xen_hello_world_func.c +++ b/xen/test/livepatch/xen_hello_world_func.c @@ -20,7 +20,6 @@ const char *xen_hello_world(void) unsigned long tmp; int rc; - alternative(ASM_NOP8, ASM_NOP1, X86_FEATURE_LM); /* * Any BUG, or WARN_ON will contain symbol and payload name. Furthermore * exceptions will be caught and processed properly. @@ -28,8 +27,11 @@ const char *xen_hello_world(void) rc = __get_user(tmp, non_canonical_addr); BUG_ON(rc != -EFAULT); #endif -#ifdef CONFIG_ARM_64 - asm(ALTERNATIVE("nop", "nop", ARM64_WORKAROUND_CLEAN_CACHE)); +#ifdef CONFIG_ARM + asm(ALTERNATIVE("nop", "nop", LIVEPATCH_FEATURE)); +#endif +#ifdef CONFIG_X86 + asm(ALTERNATIVE(ASM_NOP8, ASM_NOP1, LIVEPATCH_FEATURE); #endif return "Hello World"; } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |