Patchwork Fix fallouts from Linux header inclusion

login
register
mail settings
Submitter Jan Kiszka
Date June 23, 2011, 8:05 a.m.
Message ID <4E02F3B8.2060004@web.de>
Download mbox | patch
Permalink /patch/101598/
State New
Headers show

Comments

Jan Kiszka - June 23, 2011, 8:05 a.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

This is an all-in-one fix for the smaller and bigger mistakes of the
build system changes for accompanied Linux headers:
 - only enable KVM and vhost on Linux hosts
 - fix powerpc asm header symlink
 - do not use Linux headers on non-Linux hosts
 - fix kvmclock for !CONFIG_KVM
 - fix s390 build on non-Linux hosts

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Let me know if separate patches are preferred for this.

 Makefile.target          |    8 ++++++--
 configure                |   34 +++++++++++++++++++---------------
 hw/kvmclock.h            |   10 ++++++++++
 target-s390x/op_helper.c |    6 +++++-
 4 files changed, 40 insertions(+), 18 deletions(-)
Andreas Färber - June 23, 2011, 10:59 a.m.
Am 23.06.2011 um 10:05 schrieb Jan Kiszka:

> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This is an all-in-one fix for the smaller and bigger mistakes of the
> build system changes for accompanied Linux headers:
> - only enable KVM and vhost on Linux hosts
> - fix powerpc asm header symlink
> - do not use Linux headers on non-Linux hosts
> - fix kvmclock for !CONFIG_KVM
> - fix s390 build on non-Linux hosts
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Tested-by: Andreas Färber <andreas.faerber@web.de>

Builds okay on Darwin/ppc64.

Andreas

> ---
>
> Let me know if separate patches are preferred for this.
>
> Makefile.target          |    8 ++++++--
> configure                |   34 +++++++++++++++++++---------------
> hw/kvmclock.h            |   10 ++++++++++
> target-s390x/op_helper.c |    6 +++++-
> 4 files changed, 40 insertions(+), 18 deletions(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 03d3646..d3971a6 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -14,7 +14,10 @@ endif
>
> TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
> $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
> -QEMU_CFLAGS+= -I.. -I../linux-headers -I$(TARGET_PATH) -DNEED_CPU_H
> +ifdef CONFIG_LINUX
> +QEMU_CFLAGS += -I../linux-headers
> +endif
> +QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
>
> include $(SRC_PATH)/Makefile.objs
>
> @@ -234,7 +237,8 @@ obj-i386-y += cirrus_vga.o sga.o apic.o ioapic.o  
> piix_pci.o
> obj-i386-y += vmport.o
> obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
> obj-i386-y += debugcon.o multiboot.o
> -obj-i386-y += pc_piix.o kvmclock.o
> +obj-i386-y += pc_piix.o
> +obj-i386-$(CONFIG_KVM) += kvmclock.o
> obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
>
> # shared objects
> diff --git a/configure b/configure
> index 856b41e..e523976 100755
> --- a/configure
> +++ b/configure
> @@ -113,7 +113,7 @@ curl=""
> curses=""
> docs=""
> fdt=""
> -kvm="yes"
> +kvm=""
> nptl=""
> sdl=""
> vnc="yes"
> @@ -129,7 +129,7 @@ xen=""
> xen_ctrl_version=""
> linux_aio=""
> attr=""
> -vhost_net="yes"
> +vhost_net=""
> xfs=""
>
> gprof="no"
> @@ -457,6 +457,8 @@ Haiku)
>   linux="yes"
>   linux_user="yes"
>   usb="linux"
> +  kvm="yes"
> +  vhost_net="yes"
>   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
>     audio_possible_drivers="$audio_possible_drivers fmod"
>   fi
> @@ -3444,19 +3446,21 @@ if test "$target_linux_user" = "yes" -o  
> "$target_bsd_user" = "yes" ; then
> fi
>
> # use included Linux headers
> -includes="-I\$(SRC_PATH)/linux-headers $includes"
> -mkdir -p linux-headers
> -case "$cpu" in
> -i386|x86_64)
> -  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
> -  ;;
> -ppcemb|ppc|ppc64)
> -  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
> -  ;;
> -s390x)
> -  symlink $source_path/linux-headers/asm-s390 linux-headers/asm
> -  ;;
> -esac
> +if test "$linux" = "yes" ; then
> +  includes="-I\$(SRC_PATH)/linux-headers $includes"
> +  mkdir -p linux-headers
> +  case "$cpu" in
> +  i386|x86_64)
> +    symlink $source_path/linux-headers/asm-x86 linux-headers/asm
> +    ;;
> +  ppcemb|ppc|ppc64)
> +    symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
> +    ;;
> +  s390x)
> +    symlink $source_path/linux-headers/asm-s390 linux-headers/asm
> +    ;;
> +  esac
> +fi
>
> echo "LDFLAGS+=$ldflags" >> $config_target_mak
> echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
> diff --git a/hw/kvmclock.h b/hw/kvmclock.h
> index 7a83cbe..252ea13 100644
> --- a/hw/kvmclock.h
> +++ b/hw/kvmclock.h
> @@ -11,4 +11,14 @@
>  *
>  */
>
> +#ifdef CONFIG_KVM
> +
> void kvmclock_create(void);
> +
> +#else /* CONFIG_KVM */
> +
> +static inline void kvmclock_create(void)
> +{
> +}
> +
> +#endif /* !CONFIG_KVM */
> diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
> index 9429698..6a3c1f6 100644
> --- a/target-s390x/op_helper.c
> +++ b/target-s390x/op_helper.c
> @@ -23,8 +23,10 @@
> #include "helpers.h"
> #include <string.h>
> #include "kvm.h"
> -#include <linux/kvm.h>
> #include "qemu-timer.h"
> +#ifdef CONFIG_KVM
> +#include <linux/kvm.h>
> +#endif
>
> / 
> *****************************************************************************/
> /* Softmmu support */
> @@ -2332,7 +2334,9 @@ static void program_interrupt(CPUState *env,  
> uint32_t code, int ilc)
>     qemu_log("program interrupt at %#" PRIx64 "\n", env->psw.addr);
>
>     if (kvm_enabled()) {
> +#ifdef CONFIG_KVM
>         kvm_s390_interrupt(env, KVM_S390_PROGRAM_INT, code);
> +#endif
>     } else {
>         env->int_pgm_code = code;
>         env->int_pgm_ilc = ilc;
>
Stefan Weil - June 23, 2011, 3:14 p.m.
Am 23.06.2011 10:05, schrieb Jan Kiszka:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This is an all-in-one fix for the smaller and bigger mistakes of the
> build system changes for accompanied Linux headers:
> - only enable KVM and vhost on Linux hosts
> - fix powerpc asm header symlink
> - do not use Linux headers on non-Linux hosts
> - fix kvmclock for !CONFIG_KVM
> - fix s390 build on non-Linux hosts
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>

Tested-by: Stefan Weil <weil@mail.berlios.de>

The patch fixes the kvm related build errors for mingw32.

Stefan
Blue Swirl - June 26, 2011, 6:01 p.m.
Thanks, applied.

On Thu, Jun 23, 2011 at 11:05 AM, Jan Kiszka <jan.kiszka@web.de> wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> This is an all-in-one fix for the smaller and bigger mistakes of the
> build system changes for accompanied Linux headers:
>  - only enable KVM and vhost on Linux hosts
>  - fix powerpc asm header symlink
>  - do not use Linux headers on non-Linux hosts
>  - fix kvmclock for !CONFIG_KVM
>  - fix s390 build on non-Linux hosts
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> Let me know if separate patches are preferred for this.
>
>  Makefile.target          |    8 ++++++--
>  configure                |   34 +++++++++++++++++++---------------
>  hw/kvmclock.h            |   10 ++++++++++
>  target-s390x/op_helper.c |    6 +++++-
>  4 files changed, 40 insertions(+), 18 deletions(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 03d3646..d3971a6 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -14,7 +14,10 @@ endif
>
>  TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
>  $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
> -QEMU_CFLAGS+= -I.. -I../linux-headers -I$(TARGET_PATH) -DNEED_CPU_H
> +ifdef CONFIG_LINUX
> +QEMU_CFLAGS += -I../linux-headers
> +endif
> +QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
>
>  include $(SRC_PATH)/Makefile.objs
>
> @@ -234,7 +237,8 @@ obj-i386-y += cirrus_vga.o sga.o apic.o ioapic.o piix_pci.o
>  obj-i386-y += vmport.o
>  obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
>  obj-i386-y += debugcon.o multiboot.o
> -obj-i386-y += pc_piix.o kvmclock.o
> +obj-i386-y += pc_piix.o
> +obj-i386-$(CONFIG_KVM) += kvmclock.o
>  obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
>
>  # shared objects
> diff --git a/configure b/configure
> index 856b41e..e523976 100755
> --- a/configure
> +++ b/configure
> @@ -113,7 +113,7 @@ curl=""
>  curses=""
>  docs=""
>  fdt=""
> -kvm="yes"
> +kvm=""
>  nptl=""
>  sdl=""
>  vnc="yes"
> @@ -129,7 +129,7 @@ xen=""
>  xen_ctrl_version=""
>  linux_aio=""
>  attr=""
> -vhost_net="yes"
> +vhost_net=""
>  xfs=""
>
>  gprof="no"
> @@ -457,6 +457,8 @@ Haiku)
>   linux="yes"
>   linux_user="yes"
>   usb="linux"
> +  kvm="yes"
> +  vhost_net="yes"
>   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
>     audio_possible_drivers="$audio_possible_drivers fmod"
>   fi
> @@ -3444,19 +3446,21 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
>  fi
>
>  # use included Linux headers
> -includes="-I\$(SRC_PATH)/linux-headers $includes"
> -mkdir -p linux-headers
> -case "$cpu" in
> -i386|x86_64)
> -  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
> -  ;;
> -ppcemb|ppc|ppc64)
> -  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
> -  ;;
> -s390x)
> -  symlink $source_path/linux-headers/asm-s390 linux-headers/asm
> -  ;;
> -esac
> +if test "$linux" = "yes" ; then
> +  includes="-I\$(SRC_PATH)/linux-headers $includes"
> +  mkdir -p linux-headers
> +  case "$cpu" in
> +  i386|x86_64)
> +    symlink $source_path/linux-headers/asm-x86 linux-headers/asm
> +    ;;
> +  ppcemb|ppc|ppc64)
> +    symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
> +    ;;
> +  s390x)
> +    symlink $source_path/linux-headers/asm-s390 linux-headers/asm
> +    ;;
> +  esac
> +fi
>
>  echo "LDFLAGS+=$ldflags" >> $config_target_mak
>  echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
> diff --git a/hw/kvmclock.h b/hw/kvmclock.h
> index 7a83cbe..252ea13 100644
> --- a/hw/kvmclock.h
> +++ b/hw/kvmclock.h
> @@ -11,4 +11,14 @@
>  *
>  */
>
> +#ifdef CONFIG_KVM
> +
>  void kvmclock_create(void);
> +
> +#else /* CONFIG_KVM */
> +
> +static inline void kvmclock_create(void)
> +{
> +}
> +
> +#endif /* !CONFIG_KVM */
> diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
> index 9429698..6a3c1f6 100644
> --- a/target-s390x/op_helper.c
> +++ b/target-s390x/op_helper.c
> @@ -23,8 +23,10 @@
>  #include "helpers.h"
>  #include <string.h>
>  #include "kvm.h"
> -#include <linux/kvm.h>
>  #include "qemu-timer.h"
> +#ifdef CONFIG_KVM
> +#include <linux/kvm.h>
> +#endif
>
>  /*****************************************************************************/
>  /* Softmmu support */
> @@ -2332,7 +2334,9 @@ static void program_interrupt(CPUState *env, uint32_t code, int ilc)
>     qemu_log("program interrupt at %#" PRIx64 "\n", env->psw.addr);
>
>     if (kvm_enabled()) {
> +#ifdef CONFIG_KVM
>         kvm_s390_interrupt(env, KVM_S390_PROGRAM_INT, code);
> +#endif
>     } else {
>         env->int_pgm_code = code;
>         env->int_pgm_ilc = ilc;
>
>

Patch

diff --git a/Makefile.target b/Makefile.target
index 03d3646..d3971a6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -14,7 +14,10 @@  endif
 
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
-QEMU_CFLAGS+= -I.. -I../linux-headers -I$(TARGET_PATH) -DNEED_CPU_H
+ifdef CONFIG_LINUX
+QEMU_CFLAGS += -I../linux-headers
+endif
+QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H
 
 include $(SRC_PATH)/Makefile.objs
 
@@ -234,7 +237,8 @@  obj-i386-y += cirrus_vga.o sga.o apic.o ioapic.o piix_pci.o
 obj-i386-y += vmport.o
 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
 obj-i386-y += debugcon.o multiboot.o
-obj-i386-y += pc_piix.o kvmclock.o
+obj-i386-y += pc_piix.o
+obj-i386-$(CONFIG_KVM) += kvmclock.o
 obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
 
 # shared objects
diff --git a/configure b/configure
index 856b41e..e523976 100755
--- a/configure
+++ b/configure
@@ -113,7 +113,7 @@  curl=""
 curses=""
 docs=""
 fdt=""
-kvm="yes"
+kvm=""
 nptl=""
 sdl=""
 vnc="yes"
@@ -129,7 +129,7 @@  xen=""
 xen_ctrl_version=""
 linux_aio=""
 attr=""
-vhost_net="yes"
+vhost_net=""
 xfs=""
 
 gprof="no"
@@ -457,6 +457,8 @@  Haiku)
   linux="yes"
   linux_user="yes"
   usb="linux"
+  kvm="yes"
+  vhost_net="yes"
   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     audio_possible_drivers="$audio_possible_drivers fmod"
   fi
@@ -3444,19 +3446,21 @@  if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
 fi
 
 # use included Linux headers
-includes="-I\$(SRC_PATH)/linux-headers $includes"
-mkdir -p linux-headers
-case "$cpu" in
-i386|x86_64)
-  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
-  ;;
-ppcemb|ppc|ppc64)
-  symlink $source_path/linux-headers/asm-x86 linux-headers/asm
-  ;;
-s390x)
-  symlink $source_path/linux-headers/asm-s390 linux-headers/asm
-  ;;
-esac
+if test "$linux" = "yes" ; then
+  includes="-I\$(SRC_PATH)/linux-headers $includes"
+  mkdir -p linux-headers
+  case "$cpu" in
+  i386|x86_64)
+    symlink $source_path/linux-headers/asm-x86 linux-headers/asm
+    ;;
+  ppcemb|ppc|ppc64)
+    symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
+    ;;
+  s390x)
+    symlink $source_path/linux-headers/asm-s390 linux-headers/asm
+    ;;
+  esac
+fi
 
 echo "LDFLAGS+=$ldflags" >> $config_target_mak
 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
diff --git a/hw/kvmclock.h b/hw/kvmclock.h
index 7a83cbe..252ea13 100644
--- a/hw/kvmclock.h
+++ b/hw/kvmclock.h
@@ -11,4 +11,14 @@ 
  *
  */
 
+#ifdef CONFIG_KVM
+
 void kvmclock_create(void);
+
+#else /* CONFIG_KVM */
+
+static inline void kvmclock_create(void)
+{
+}
+
+#endif /* !CONFIG_KVM */
diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
index 9429698..6a3c1f6 100644
--- a/target-s390x/op_helper.c
+++ b/target-s390x/op_helper.c
@@ -23,8 +23,10 @@ 
 #include "helpers.h"
 #include <string.h>
 #include "kvm.h"
-#include <linux/kvm.h>
 #include "qemu-timer.h"
+#ifdef CONFIG_KVM
+#include <linux/kvm.h>
+#endif
 
 /*****************************************************************************/
 /* Softmmu support */
@@ -2332,7 +2334,9 @@  static void program_interrupt(CPUState *env, uint32_t code, int ilc)
     qemu_log("program interrupt at %#" PRIx64 "\n", env->psw.addr);
 
     if (kvm_enabled()) {
+#ifdef CONFIG_KVM
         kvm_s390_interrupt(env, KVM_S390_PROGRAM_INT, code);
+#endif
     } else {
         env->int_pgm_code = code;
         env->int_pgm_ilc = ilc;