[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 01/18] arm/x86: Add HAS_[ALTERNATIVE|EX_TABLE]



x86 implements all of them by default - and we just
add two extra HAS_ variables to be declared in autoconf.h.

ARM 64 only has alternative while ARM 32 has none of them.
The ARM64 is going to be a bit funny as there is an
ALTERNATIVE already and we end up selecting the HAS_ALTERNATIVE
whenever the ALTERNATIVE is selected.

And while at it change the livepatch common code that
would benefit from this.

Suggested-by: Julien Grall <julien.grall@xxxxxxx>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Doug Goldstein <cardoe@xxxxxxxxxx>

v2: First submission
v3: Move the config options to common code
    Don't include <xen/config.h> in the file.
    Don't even include <xen/kconfig.h> in the file as xen/Rules.mk automatically
    includes the config.h for every GCC invocation.
---
 xen/arch/arm/Kconfig   | 4 ++++
 xen/arch/x86/Kconfig   | 3 +++
 xen/common/Kconfig     | 6 ++++++
 xen/common/livepatch.c | 4 +++-
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 797c91f..bf640c5 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -45,8 +45,12 @@ config ACPI
 config HAS_GICV3
        bool
 
+config HAS_ALTERNATIVE
+       bool
+
 config ALTERNATIVE
        bool
+       select HAS_ALTERNATIVE
 
 endmenu
 
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 265fd79..056a77f 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -7,8 +7,10 @@ config X86
        select ACPI_LEGACY_TABLES_LOOKUP
        select COMPAT
        select CORE_PARKING
+       select HAS_ALTERNATIVE
        select HAS_CPUFREQ
        select HAS_EHCI
+       select HAS_EX_TABLE
        select HAS_GDBSX
        select HAS_IOPORTS
        select HAS_KEXEC
@@ -22,6 +24,7 @@ config X86
        select NUMA
        select VGA
 
+
 config ARCH_DEFCONFIG
        string
        default "arch/x86/configs/x86_64_defconfig"
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 4331874..81e0017 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -11,9 +11,15 @@ config COMPAT
 config CORE_PARKING
        bool
 
+config HAS_ALTERNATIVE
+       bool
+
 config HAS_DEVICE_TREE
        bool
 
+config HAS_EX_TABLE
+       bool
+
 config HAS_MEM_ACCESS
        bool
 
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index f75171b..a2ddb61 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -628,7 +628,7 @@ static int prepare_payload(struct payload *payload,
                                   sizeof(*region->frame[i].bugs);
     }
 
-#ifndef CONFIG_ARM
+#ifdef CONFIG_HAS_ALTERNATIVE
     sec = livepatch_elf_sec_by_name(elf, ".altinstructions");
     if ( sec )
     {
@@ -659,7 +659,9 @@ static int prepare_payload(struct payload *payload,
         }
         apply_alternatives(start, end);
     }
+#endif
 
+#ifdef CONFIG_HAS_EX_TABLE
     sec = livepatch_elf_sec_by_name(elf, ".ex_table");
     if ( sec )
     {
-- 
2.4.11


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.