]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
livepatch: x86, ARM, alternative: Expose FEATURE_LIVEPATCH
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 19 Sep 2016 16:41:28 +0000 (12:41 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 28 Sep 2016 02:06:54 +0000 (22:06 -0400)
To use as a common way of testing alternative patching for
livepatches. Both architectures have this FEATURE and the
test-cases can piggyback on that.

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Suggested-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/arch/arm/livepatch.c
xen/include/asm-arm/cpufeature.h
xen/include/asm-x86/livepatch.h
xen/test/livepatch/xen_hello_world_func.c

index f467d9db4a7d7228b4159f0930dff9a4efa07c9d..b8dbee22e8cade3b1568ba47e9e5615d2792f3dd 100644 (file)
@@ -8,6 +8,7 @@
 #include <xen/livepatch.h>
 #include <xen/vmap.h>
 
+#include <asm/cpufeature.h>
 #include <asm/livepatch.h>
 #include <asm/mm.h>
 
@@ -161,6 +162,8 @@ void __init arch_livepatch_init(void)
     end = (void *)LIVEPATCH_VMAP_END;
 
     vm_init_type(VMAP_XEN, start, end);
+
+    cpus_set_cap(LIVEPATCH_FEATURE);
 }
 
 /*
index 66e930ffa09caca30ae7535d7d1233c800ddb8b1..af60fe3362369d238d3ab9f066c2fc6ae2eb9298 100644 (file)
@@ -39,8 +39,9 @@
 #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE    1
 #define ARM32_WORKAROUND_766422 2
 #define ARM64_WORKAROUND_834220 3
+#define LIVEPATCH_FEATURE   4
 
-#define ARM_NCAPS           4
+#define ARM_NCAPS           5
 
 #ifndef __ASSEMBLY__
 
index 7dfc2e706afe01be046622ee4b832bde8240c1ea..00aefd2d6389b2333139da3c1ef0d0187067405f 100644 (file)
@@ -10,6 +10,7 @@
 
 #define ARCH_PATCH_INSN_SIZE 5
 #define ARCH_LIVEPATCH_RANGE SZ_2G
+#define LIVEPATCH_FEATURE    X86_FEATURE_ALWAYS
 
 #endif /* __XEN_X86_LIVEPATCH_H__ */
 
index 03d6b8466b60913bb5abe459d32016a525727d95..0321f3ece2edce8922a9378e5d74af142cf4fda4 100644 (file)
@@ -6,6 +6,7 @@
 #include <xen/types.h>
 
 #include <asm/alternative.h>
+#include <asm/livepatch.h>
 #include <asm/nops.h>
 #include <asm/uaccess.h>
 
@@ -17,7 +18,7 @@ const char *xen_hello_world(void)
     unsigned long tmp;
     int rc;
 
-    alternative(ASM_NOP8, ASM_NOP1, X86_FEATURE_LM);
+    alternative(ASM_NOP8, ASM_NOP1, LIVEPATCH_FEATURE);
     /*
      * Any BUG, or WARN_ON will contain symbol and payload name. Furthermore
      * exceptions will be caught and processed properly.