]> xenbits.xensource.com Git - xen.git/commitdiff
x86/guest: finish conversion to altcall
authorJan Beulich <jbeulich@suse.com>
Mon, 5 Feb 2024 09:45:31 +0000 (10:45 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 9 Apr 2024 15:45:01 +0000 (16:45 +0100)
While .setup() and .e820_fixup() don't need fiddling with for being run
only very early, both .ap_setup() and .resume() want converting too:
This way both pre-filled struct hypervisor_ops instances can become
__initconst_cf_clobber, thus allowing to eliminate up to 5 more ENDBR
(configuration dependent) during the 2nd phase of alternatives patching.

While fiddling with section annotations here, also move "ops" itself to
.data.ro_after_init.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Paul Durrant <paul@xen.org>
(cherry picked from commit e931edccc53c9dd6e9a505ad0ff3a03d985669bc)

xen/arch/x86/guest/hyperv/hyperv.c
xen/arch/x86/guest/hypervisor.c
xen/arch/x86/guest/xen/xen.c

index 912099564ec404b84569fea3a14217182b6c5cda..6989af38f18034c97c65d2a8b0cbe6ad3b04462f 100644 (file)
@@ -207,7 +207,7 @@ static int cf_check flush_tlb(
     return hyperv_flush_tlb(mask, va, flags);
 }
 
-static const struct hypervisor_ops __initconstrel ops = {
+static const struct hypervisor_ops __initconst_cf_clobber ops = {
     .name = "Hyper-V",
     .setup = setup,
     .ap_setup = ap_setup,
index e0b046cc6c89344f596e5425dd26f5ddc15eca3c..ac80e83245990d617d9d6273d8079ec4ae37f1ec 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/cache.h>
 #include <asm/guest.h>
 
-static struct hypervisor_ops __read_mostly ops;
+static struct hypervisor_ops __ro_after_init ops;
 
 const char *__init hypervisor_probe(void)
 {
@@ -49,7 +49,7 @@ void __init hypervisor_setup(void)
 int hypervisor_ap_setup(void)
 {
     if ( ops.ap_setup )
-        return ops.ap_setup();
+        return alternative_call(ops.ap_setup);
 
     return 0;
 }
@@ -57,7 +57,7 @@ int hypervisor_ap_setup(void)
 void hypervisor_resume(void)
 {
     if ( ops.resume )
-        ops.resume();
+        alternative_vcall(ops.resume);
 }
 
 void __init hypervisor_e820_fixup(void)
index 2eed32fe46c7b710a1f5da98b17dfa41b2b69498..44a689d4394b2a9fed5c4a35a642068f8305f4c1 100644 (file)
@@ -318,7 +318,7 @@ static int cf_check flush_tlb(
     return xen_hypercall_hvm_op(HVMOP_flush_tlbs, NULL);
 }
 
-static const struct hypervisor_ops __initconstrel ops = {
+static const struct hypervisor_ops __initconst_cf_clobber ops = {
     .name = "Xen",
     .setup = setup,
     .ap_setup = ap_setup,