Random xen patches
cover Random xen patches
While applying some of the outstanding patches from the masses of Xen patches on the mailing list, I stumbled over a few things and wrote up patches to fix them.
Functionally, nothing should change with these applied, but I want to give people the chance to review them before pushing them :).
Alexander Graf (3):
xen: add mapcache stubs
xen: remove CONFIG_XEN_MAPCACHE
xen: make xen_enabled even more clever
configure | 8 +++++--- hw/xen.h | 2 +- xen-stub.c | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-)
PATCH 1/3 xen: add mapcache stubs
During the transition to get rid of CONFIG_XEN_MAPCACHE we lost the mapcache stubs along the way. Nobody realized it because the commands were guarded by if (xen_enabled()) clauses that made gcc optimize out the respective calls.
This patch adds the stubs again - this time in the generic xen-stubs.c
--- xen-stub.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
xen-stub.c +26 -0
@@ -8,6 +8,7 @@#include "qemu-common.h" #include "hw/xen.h" +#include "xen-mapcache.h" void xenstore_store_pv_console_info (int i,CharDriverState *chr) {
@@ -43,3 +44,28 @@ int xen_init(void) {return -ENOSYS ; } + +/******* mapcache stubs *******/ + +void xen_map_cache_init (void ) +{ +} + +uint8_t *xen_map_cache (target_phys_addr_t phys_addr,target_phys_addr_t size, +uint8_t lock) +{ +return qemu_get_ram_ptr (phys_addr); +} + +ram_addr_t xen_ram_addr_from_mapcache (void *ptr) +{ +return -1 ; +} + +void xen_invalidate_map_cache (void ) +{ +} + +void xen_invalidate_map_cache_entry (uint8_t *buffer) +{ +}
Signature · 1 line
1.6.0.2
PATCH 2/3 xen: remove CONFIG_XEN_MAPCACHE
In reply to Alexander GrafWe were still exporting CONFIG_XEN_MAPCACHE, even though it's completely unused by now. Remove it.
--- configure | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
configure +0 -3
@@ -3235,9 +3235,6 @@ case "$target_arch2" in if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then target_phys_bits=64 echo "CONFIG_XEN=y" >> $config_target_mak - if test "$cpu" = "i386" -o "$cpu" = "x86_64"; then - echo "CONFIG_XEN_MAPCACHE=y" >> $config_target_mak - fi fi esac case "$target_arch2" in
Signature · 1 line
1.6.0.2
PATCH 3/3 xen: make xen_enabled even more clever
In reply to Alexander GrafWhen 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.
--- configure | 5 +++++ hw/xen.h | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-)
configure +5 -0
@@ -3235,7 +3235,12 @@ case "$target_arch2" in if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then target_phys_bits=64 echo "CONFIG_XEN=y" >> $config_target_mak + else + echo "CONFIG_NO_XEN=y" >> $config_target_mak fi + ;; + *) + echo "CONFIG_NO_XEN=y" >> $config_target_mak esac case "$target_arch2" in i386|x86_64|ppcemb|ppc|ppc64|s390x)
hw/xen.h +1 -1
@@ -24,7 +24,7 @@ extern int xen_allowed;static inline int xen_enabled (void ) { -#ifdef CONFIG_XEN_BACKEND +#if defined(CONFIG_XEN_BACKEND ) && !defined(CONFIG_NO_XEN )return xen_allowed;#else return 0 ;
Signature · 1 line
1.6.0.2
Re: [Qemu-devel] [PATCH 3/3] xen: make xen_enabled even more clever
Quoted 41 lines · Alexander Graf
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 <[email protected]>---
configure | 5 +++++
hw/xen.h | 2 +-2 files changed, 6 insertions(+), 1 deletions(-)configure +0
-0@@ -3235,7 +3235,12 @@ case "$target_arch2" inif test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then target_phys_bits=64
echo "CONFIG_XEN=y" >> $config_target_mak
+ else
+ echo "CONFIG_NO_XEN=y" >> $config_target_mak fi
+ ;;
+ *)
+ echo "CONFIG_NO_XEN=y" >> $config_target_mak esac
case "$target_arch2" in i386|x86_64|ppcemb|ppc|ppc64|s390x)hw/xen.h +0
-0
hw/xen.h extern int xen_allowed; · line 30
Quoted 8 lines
hw/xen.h +1
-1@@ -24,7 +24,7 @@ extern int xen_allowed; static inline int xen_enabled(void) { -#ifdef CONFIG_XEN_BACKEND +#if defined(CONFIG_XEN_BACKEND ) && !defined(CONFIG_NO_XEN ) return xen_allowed; #else return 0;
Cool, better than my fix.
Signature · 1 line
Anthony PERARD
Quoted 6 lines · Alexander Graf
While applying some of the outstanding patches from the masses of Xen patches on the mailing list, I stumbled over a few things and wrote up patches to fix them.
Functionally, nothing should change with these applied, but I want to give people the chance to review them before pushing them :).
They all look all right to me, thanks.