From 081ecc8f542be5301cb3ed41a57e9b0ed006d1c6 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Jun 29 2009 16:04:48 +0000 Subject: More linux-user build issues on ppc --- diff --git a/qemu-fix-linux-user-build-on-ppc.patch b/qemu-fix-linux-user-build-on-ppc.patch new file mode 100644 index 0000000..a464dbf --- /dev/null +++ b/qemu-fix-linux-user-build-on-ppc.patch @@ -0,0 +1,138 @@ +From 8da41d2477abdafbbc484a12fd74f2d54336188b Mon Sep 17 00:00:00 2001 +From: Mark McLoughlin +Date: Mon, 29 Jun 2009 14:49:03 +0100 +Subject: [PATCH] Fix linux-user build on ppc + +kvm-87 build fails on ppc: + + https://koji.fedoraproject.org/koji/getfile?taskID=1441042&name=build.log + + gcc -I. -I.. -I/builddir/build/BUILD/qemu-kvm-devel-87/target-i386 + -I/builddir/build/BUILD/qemu-kvm-devel-87 -MMD -MT elfload.o -MP + -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + -D__user= -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg + -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg/ppc64 + -I/builddir/build/BUILD/qemu-kvm-devel-87/fpu + -I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user + -I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/i386 -O2 -g -pipe + -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector + --param=ssp-buffer-size=4 -m64 -mminimal-toc -g -fno-strict-aliasing + -O2 -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes + -Wstrict-prototypes -Wredundant-decls -c -o elfload.o + /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c + /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:214: error: conflicting types for 'elf_greg_t' + /usr/include/asm/elf.h:123: note: previous declaration of 'elf_greg_t' was here + /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:220: error: conflicting types for 'elf_gregset_t' + /usr/include/asm/elf.h:124: note: previous declaration of 'elf_gregset_t' was here + In file included from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:697: + ../elf.h:457:1: warning: "R_PPC_NUM" redefined + In file included from /usr/include/asm/sigcontext.h:13, + from /usr/include/bits/sigcontext.h:28, + from /usr/include/signal.h:339, + from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/qemu.h:4, + from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:16: + /usr/include/asm/elf.h:81:1: warning: this is the location of the previous definition + +Problem seems to be that signal.h is pulling in a bunch of ppc +headers which expose elf_greg_t, R_PPC_* and PPC_FEATURE_*. + +Signed-off-by: Mark McLoughlin + +More linux-user on ppc build fixes + +Signed-off-by: Mark McLoughlin +--- + elf.h | 2 ++ + linux-user/elfload.c | 10 ++++++++++ + 2 files changed, 12 insertions(+), 0 deletions(-) + +diff --git a/elf.h b/elf.h +index b042002..14f8aa1 100644 +--- a/elf.h ++++ b/elf.h +@@ -454,7 +454,9 @@ typedef struct { + #define R_PPC_SECTOFF_HI 35 + #define R_PPC_SECTOFF_HA 36 + /* Keep this the last entry. */ ++#ifndef R_PPC_NUM + #define R_PPC_NUM 37 ++#endif /* R_PPC_NUM */ + + /* ARM specific declarations */ + +diff --git a/linux-user/elfload.c b/linux-user/elfload.c +index d31cca7..3ccfdda 100644 +--- a/linux-user/elfload.c ++++ b/linux-user/elfload.c +@@ -134,6 +134,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + regs->rip = infop->entry; + } + ++#ifdef FIX_BROKEN_PPC_BUILD + typedef target_ulong elf_greg_t; + typedef uint32_t target_uid_t; + typedef uint32_t target_gid_t; +@@ -179,6 +180,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env) + (*regs)[25] = env->segs[R_FS].selector & 0xffff; + (*regs)[26] = env->segs[R_GS].selector & 0xffff; + } ++#endif /* FIX_BROKEN_PPC_BUILD */ + + #else + +@@ -211,6 +213,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + regs->edx = 0; + } + ++#ifdef FIX_BROKEN_PPC_BUILD + typedef target_ulong elf_greg_t; + typedef uint16_t target_uid_t; + typedef uint16_t target_gid_t; +@@ -246,9 +249,12 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env) + (*regs)[15] = env->regs[R_ESP]; + (*regs)[16] = env->segs[R_SS].selector & 0xffff; + } ++#endif /* FIX_BROKEN_PPC_BUILD */ + #endif + ++#ifdef FIX_BROKEN_PPC_BUILD + #define USE_ELF_CORE_DUMP ++#endif /* FIX_BROKEN_PPC_BUILD */ + #define ELF_EXEC_PAGESIZE 4096 + + #endif +@@ -286,6 +292,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + regs->ARM_r10 = infop->start_data; + } + ++#ifdef FIX_BROKEN_PPC_BUILD + typedef uint32_t elf_greg_t; + typedef uint16_t target_uid_t; + typedef uint16_t target_gid_t; +@@ -318,6 +325,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env) + } + + #define USE_ELF_CORE_DUMP ++#endif /* FIX_BROKEN_PPC_BUILD */ + #define ELF_EXEC_PAGESIZE 4096 + + enum +@@ -421,6 +429,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i + + /* Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP). + See arch/powerpc/include/asm/cputable.h. */ ++#ifndef PPC_FEATURE_32 + enum { + PPC_FEATURE_32 = 0x80000000, + PPC_FEATURE_64 = 0x40000000, +@@ -452,6 +461,7 @@ enum { + PPC_FEATURE_TRUE_LE = 0x00000002, + PPC_FEATURE_PPC_LE = 0x00000001, + }; ++#endif /* !defined(PPC_FEATURE_32) */ + + #define ELF_HWCAP get_elf_hwcap() + +-- +1.6.2.5 + diff --git a/qemu-fix-pcspk-build-with-kvm-disabled.patch b/qemu-fix-pcspk-build-with-kvm-disabled.patch index ccf0317..454bae9 100644 --- a/qemu-fix-pcspk-build-with-kvm-disabled.patch +++ b/qemu-fix-pcspk-build-with-kvm-disabled.patch @@ -1,4 +1,4 @@ -From 71f761fc6f6289c47fb31ed1ba192f813fb39c58 Mon Sep 17 00:00:00 2001 +From 85da3db92e4b25275426e252974db7eae18e2bb1 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 29 Jun 2009 16:09:45 +0100 Subject: [PATCH] Fix pcspk build with kvm disabled diff --git a/qemu-fix-ppc-softmmu-kvm-disabled-build.patch b/qemu-fix-ppc-softmmu-kvm-disabled-build.patch deleted file mode 100644 index 314488f..0000000 --- a/qemu-fix-ppc-softmmu-kvm-disabled-build.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 398e45e57ee98e9d1a7387816b53d7038d1c3283 Mon Sep 17 00:00:00 2001 -From: Anthony Liguori -Date: Wed, 24 Jun 2009 14:25:15 -0500 -Subject: [PATCH] Fix ppc-softmmu kvm-disabled build - -This gets ppc-softmmu building when KVM is not enabled. It may be enough to get -it working with KVM enabled but I haven't checked. - -(cherry picked from commit 9011bae8e2101095aae53f1f1553ca3e72919f9b) - -Signed-off-by: Anthony Liguori -Signed-off-by: Avi Kivity -Signed-off-by: Mark McLoughlin ---- - hw/ppc440.c | 1 + - hw/ppc440_bamboo.c | 1 + - hw/ppce500_mpc8544ds.c | 1 + - qemu-kvm.h | 1 + - target-ppc/helper.c | 1 + - target-ppc/machine.c | 1 + - 6 files changed, 6 insertions(+), 0 deletions(-) - -diff --git a/hw/ppc440.c b/hw/ppc440.c -index 00d82e4..c2c9e65 100644 ---- a/hw/ppc440.c -+++ b/hw/ppc440.c -@@ -19,6 +19,7 @@ - #include "ppc405.h" - #include "sysemu.h" - #include "kvm.h" -+#include "qemu-kvm.h" - - #define PPC440EP_PCI_CONFIG 0xeec00000 - #define PPC440EP_PCI_INTACK 0xeed00000 -diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c -index 00aa2c7..e4aad39 100644 ---- a/hw/ppc440_bamboo.c -+++ b/hw/ppc440_bamboo.c -@@ -22,6 +22,7 @@ - #include "kvm.h" - #include "kvm_ppc.h" - #include "device_tree.h" -+#include "qemu-kvm.h" - - #define BINARY_DEVICE_TREE_FILE "bamboo.dtb" - -diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c -index d9ed36c..1099b99 100644 ---- a/hw/ppce500_mpc8544ds.c -+++ b/hw/ppce500_mpc8544ds.c -@@ -29,6 +29,7 @@ - #include "device_tree.h" - #include "openpic.h" - #include "ppce500.h" -+#include "qemu-kvm.h" - - #define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb" - #define UIMAGE_LOAD_BASE 0 -diff --git a/qemu-kvm.h b/qemu-kvm.h -index 68a5b40..9341d0c 100644 ---- a/qemu-kvm.h -+++ b/qemu-kvm.h -@@ -169,6 +169,7 @@ int kvm_has_sync_mmu(void); - void kvm_init_vcpu(CPUState *env); - void kvm_load_tsc(CPUState *env); - #else -+#define kvm_has_sync_mmu() (0) - #define kvm_enabled() (0) - #define kvm_nested 0 - #define qemu_kvm_irqchip_in_kernel() (0) -diff --git a/target-ppc/helper.c b/target-ppc/helper.c -index 5a7a935..3629c99 100644 ---- a/target-ppc/helper.c -+++ b/target-ppc/helper.c -@@ -29,6 +29,7 @@ - #include "helper_regs.h" - #include "qemu-common.h" - #include "kvm.h" -+#include "qemu-kvm.h" - - //#define DEBUG_MMU - //#define DEBUG_BATS -diff --git a/target-ppc/machine.c b/target-ppc/machine.c -index 99ba3eb..ec8e197 100644 ---- a/target-ppc/machine.c -+++ b/target-ppc/machine.c -@@ -1,6 +1,7 @@ - #include "hw/hw.h" - #include "hw/boards.h" - #include "kvm.h" -+#include "qemu-kvm.h" - - void cpu_save(QEMUFile *f, void *opaque) - { --- -1.6.2.5 - diff --git a/qemu.spec b/qemu.spec index b77e0dc..03211cf 100644 --- a/qemu.spec +++ b/qemu.spec @@ -19,8 +19,8 @@ Source2: kvm.modules # Not upstream, why? Patch01: qemu-bios-bigger-roms.patch -# Fixes ppc-softmmu target build, cherry-picked from upstream -Patch02: qemu-fix-ppc-softmmu-kvm-disabled-build.patch +# Fixes linux-user build on ppc +Patch02: qemu-fix-linux-user-build-on-ppc.patch # Works around broken linux-user build on ppc Patch03: qemu-fix-broken-elf-coredump-build-on-ppc.patch