Преглед изворни кода

xen: make xen_enabled even more clever

When using xen_enabled() we're currently only checking if xen is enabled
at all during the build. But what if you want to build multiple targets
out of which only one can potentially run xen code?

That means that for generic code we'll still have to fall back to the
variable and potentially slow the code down, but it's not as important as
that is mostly xen device emulation which is not touched for non-xen targets.

The target specific code however can with this patch see that it's unable to
ever execute xen code. We can thus always return 0 on xen_enabled(), giving
gcc enough hints to evict the mapcache code from the target memory management
code.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Alexander Graf пре 14 година
родитељ
комит
59d21e537b
2 измењених фајлова са 6 додато и 1 уклоњено
  1. 5 0
      configure
  2. 1 1
      hw/xen.h

+ 5 - 0
configure

@@ -3290,7 +3290,12 @@ case "$target_arch2" in
     if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
     if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
       target_phys_bits=64
       target_phys_bits=64
       echo "CONFIG_XEN=y" >> $config_target_mak
       echo "CONFIG_XEN=y" >> $config_target_mak
+    else
+      echo "CONFIG_NO_XEN=y" >> $config_target_mak
     fi
     fi
+    ;;
+  *)
+    echo "CONFIG_NO_XEN=y" >> $config_target_mak
 esac
 esac
 case "$target_arch2" in
 case "$target_arch2" in
   i386|x86_64|ppcemb|ppc|ppc64|s390x)
   i386|x86_64|ppcemb|ppc|ppc64|s390x)

+ 1 - 1
hw/xen.h

@@ -24,7 +24,7 @@ extern int xen_allowed;
 
 
 static inline int xen_enabled(void)
 static inline int xen_enabled(void)
 {
 {
-#ifdef CONFIG_XEN_BACKEND
+#if defined(CONFIG_XEN_BACKEND) && !defined(CONFIG_NO_XEN)
     return xen_allowed;
     return xen_allowed;
 #else
 #else
     return 0;
     return 0;