[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] livepatch: apply_alternatives() is only used for livepatch
- To: xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- Date: Tue, 6 Jun 2023 19:23:07 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=St7pZT571GTRV9ofAWN9hsWuPg375eC1313V2qCL3+I=; b=aqtouEBxeDfyQmmR8Qzv+E8wDRmifPfm4y7awydGjum3ULWdl9SNgbJpQjX1cCzUb0cPeNAXifx1+pYXD01J/VuYOShJ6U/E6HkZhsNsvVYpMxm3WqgCvEi8pTyzFgRB7q6jR/xGRi9Q9HsmHj2HSPCtR7d3HlpwmX69eXidqF4xsOD3nlb8UNM09H7FQs0uvjrZQT+05MY2t7M+zEFnH5DAKpviZiKI3G+fV0LLVWuekbYP6eA0g+f7GtbY3X7rZLAYwF/rrekH1//QbmOYZdoASor0JX5uRqac3Uwxd91bcy4EFCbZ1BZafdvdfSvT2Iu64GAcb9Vc2qpl+qVCSw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WZ0F4tVnTemy/nLdLvmUHrQ5cjxzY8uB8VFWNOUdSVougXxDZtl9vUubO7jB9DZq4lXUB5WyzxJDc65fS1Nl8aIFHiJ3eOyjFm+mUQQBNTiJyPUd6F1hm/VV6ko8RDRC8Pk7ZAGHGhoAfLRsahCNc1vBZ/T8Ir4BYwxpz4TebOcyD9HiX3xxzaU0Tl46Y1jmOmo/txL0kBleqVR/iTD+Y4k8swmLkOUNz4hPp2keDuwYDqywmqRXBJZyA/wMeHiJdUCP4u6z/rUtzeH2yPc90Vq8KzJ0oH9LrYpV6eL2A5WQUtlbl+kqY8+gLWmyqS0ORXEUxscBqJ7wz2zXpf9ajw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Tue, 06 Jun 2023 17:23:45 +0000
- Ironport-data: A9a23:PhsjE6O94mAME9XvrR0hlsFynXyQoLVcMsEvi/4bfWQNrUp03mQGn WsfWmqAM/ncYmD9ctFwOt+x8RwFsZOByoU2Tgto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGjxSs/rrRC9H5qyo42tG5gJmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0rhML0VW7 +EgFAAqQDnenP2r6aLmdNA506zPLOGzVG8ekldJ6GiBSNwAHtXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+vJxujCJpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+tqyv11rWXxH2qMG4UPLKf+t0y21/J/HdQJT4GWVblkPaGkUHrDrqzL GRRoELCt5Ma5EGtC9XwQRC8iHqFpQIHHcpdFfUg7wOAwbaS5ByWbkAfVSJIYtEisM4wRBQp2 0WPktevAiZg2JWXVHac+7G8vT60fy8PIgcqbyIeUREM5dWlpYgplw/OVf5qCqvzhdrwcRnOx DSNoDk7lq8kp8cB3KWm/njKmzup4JPOS2Yd5A/aQ2ak5QNRf5O+asqj7l2zxelEBJaUSB+Gp ndspiSFxOUHDJXInirSRuwIRemt/6zcaGeahkNzFZ488Tjr42SkYY1b/DB5IgFuL9oAfjjqJ kTUvGu9+aNuAZdjVocvC6rZNijg5fGI+QjNPhwMUudzXw==
- Ironport-hdrordr: A9a23:UDX0VKzAbfeXwy3GUIGvKrPwKL1zdoMgy1knxilNoEpuA6ilfq GV/MjzuiWetN98YhsdcLO7WZVoI0myyXcv2/h1AV7KZmCPhILPFuxfBODZrQEIdReTygbzv5 0QFJSXpLfLfDtHZWeR2njbL+od
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Guard it with CONFIG_LIVEPATCH. Note alternatives are applied at boot
using _apply_alternatives().
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
xen/arch/arm/alternative.c | 2 ++
xen/arch/arm/include/asm/alternative.h | 2 ++
xen/arch/x86/alternative.c | 5 +++--
xen/arch/x86/include/asm/alternative.h | 2 ++
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index 7366af4ea646..016e66978b6d 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -223,6 +223,7 @@ void __init apply_alternatives_all(void)
vunmap(xenmap);
}
+#ifdef CONFIG_LIVEPATCH
int apply_alternatives(const struct alt_instr *start, const struct alt_instr
*end)
{
const struct alt_region region = {
@@ -232,6 +233,7 @@ int apply_alternatives(const struct alt_instr *start, const
struct alt_instr *en
return __apply_alternatives(®ion, 0);
}
+#endif
/*
* Local variables:
diff --git a/xen/arch/arm/include/asm/alternative.h
b/xen/arch/arm/include/asm/alternative.h
index d3210e82f9e5..ce82dc1ca0d2 100644
--- a/xen/arch/arm/include/asm/alternative.h
+++ b/xen/arch/arm/include/asm/alternative.h
@@ -29,7 +29,9 @@ typedef void (*alternative_cb_t)(const struct alt_instr *alt,
int nr_inst);
void apply_alternatives_all(void);
+#ifdef CONFIG_LIVEPATCH
int apply_alternatives(const struct alt_instr *start, const struct alt_instr
*end);
+#endif
#define ALTINSTR_ENTRY(feature, cb) \
" .word 661b - .\n" /* label */ \
diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 99482766b51f..21af0e825822 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -358,11 +358,12 @@ static void init_or_livepatch _apply_alternatives(struct
alt_instr *start,
}
}
-void init_or_livepatch apply_alternatives(struct alt_instr *start,
- struct alt_instr *end)
+#ifdef CONFIG_LIVEPATCH
+void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
{
_apply_alternatives(start, end, true);
}
+#endif
static unsigned int __initdata alt_todo;
static unsigned int __initdata alt_done;
diff --git a/xen/arch/x86/include/asm/alternative.h
b/xen/arch/x86/include/asm/alternative.h
index a1cd6a9fe5b8..688b554099b3 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -24,7 +24,9 @@ struct __packed alt_instr {
extern void add_nops(void *insns, unsigned int len);
/* Similar to alternative_instructions except it can be run with IRQs enabled.
*/
+#ifdef CONFIG_LIVEPATCH
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
+#endif
extern void alternative_instructions(void);
extern void alternative_branches(void);
--
2.40.0
|