SHA256
1
0
forked from pool/qemu

- compile fixes for ppc64abi32

- fix update_fit.sh script if wc -c is 40
- fix stale tbs after mmap

OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=64
This commit is contained in:
Alexander Graf 2012-05-07 10:08:51 +00:00 committed by Git OBS Bridge
parent 3d5fb0946f
commit c402d17e09
8 changed files with 182 additions and 10 deletions

View File

@ -0,0 +1,30 @@
From f0fd80de8f15efc091751f2e9bf4c2276ba058b3 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 10 Jan 2012 16:25:27 +0100
Subject: [PATCH] PPC: KVM: Ignore SET_ONE_REG failures
The SET_ONE_REG interface didn't make it upstream in the form that is used
in qemu-1.0, so the code won't work. Make the error a warning, so we can
at least use the HV target.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-ppc/kvm.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 0410901..6c6278a 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -759,7 +759,10 @@ void kvmppc_set_papr(CPUState *env)
reg.u.reg64 = env->spr[SPR_HIOR];
ret = kvm_vcpu_ioctl(env, KVM_SET_ONE_REG, &reg);
if (ret) {
- goto fail;
+ fprintf(stderr, "Couldn't set HIOR. Maybe you're running an old \n"
+ "kernel with support for HV KVM but no PAPR PR \n"
+ "KVM in which case things will work. If they don't \n"
+ "please update your host kernel!\n");
}
/* Set SDR1 so kernel space finds the HTAB */

View File

@ -0,0 +1,31 @@
From 9a860d428d123648b31780c238eacf9e606f7ff2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 12 Mar 2012 14:46:06 +0100
Subject: [PATCH] XXX fix prov/self/maps major/minor to read/write hex
---
linux-user/syscall.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index cbd37f6..f064484 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4861,7 +4861,7 @@ static int open_self_maps(void *cpu_env, int fd)
uint64_t min, max, offset;
char flag_r, flag_w, flag_x, flag_p;
char path[512] = "";
- fields = sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %d:%d %d"
+ fields = sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %x:%x %d"
" %512s", &min, &max, &flag_r, &flag_w, &flag_x,
&flag_p, &offset, &dev_maj, &dev_min, &inode, path);
@@ -4873,7 +4873,7 @@ static int open_self_maps(void *cpu_env, int fd)
}
if (h2g_valid(min) && h2g_valid(max)) {
dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx " %c%c%c%c %08" PRIx64
- " %02d:%02d %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
+ " %02x:%02x %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
flag_x, flag_p, offset, dev_maj, dev_min, inode,
path[0] ? " " : "", path);
}

View File

@ -0,0 +1,26 @@
From 4f9265c70768aa4ad8bd13ad744a1a93ed536877 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 12 Mar 2012 16:04:21 +0100
Subject: [PATCH] XXX linux-user: /proc/self/maps: fix compile for ppc64abi32
---
linux-user/syscall.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f064484..980f815 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4872,9 +4872,9 @@ static int open_self_maps(void *cpu_env, int fd)
continue;
}
if (h2g_valid(min) && h2g_valid(max)) {
- dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx " %c%c%c%c %08" PRIx64
- " %02x:%02x %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
- flag_x, flag_p, offset, dev_maj, dev_min, inode,
+ dprintf(fd, TARGET_ABI_FMT_lx "-" TARGET_ABI_FMT_lx " %c%c%c%c %08"
+ PRIx64 " %02x:%02x %d%s%s\n", h2g(min), h2g(max), flag_r,
+ flag_w, flag_x, flag_p, offset, dev_maj, dev_min, inode,
path[0] ? " " : "", path);
}
}

View File

@ -0,0 +1,21 @@
From 9c1b7992362862c2b1f5721664154ddab46acb6f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 May 2012 23:56:03 +0200
Subject: [PATCH] XXX fix syntax error in qemu-binfmt
---
scripts/qemu-binfmt-conf.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index c20fb61..37d03f3 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -66,6 +66,7 @@ fi
if [ $cpu != "sh" ] ; then
echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P' > /proc/sys/fs/binfmt_misc/register
echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P' > /proc/sys/fs/binfmt_misc/register
+fi
if [ $cpu != "s390x" ] ; then
echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x-binfmt:P' > /proc/sys/fs/binfmt_misc/register
fi

View File

@ -0,0 +1,45 @@
From 84512269f8abeb117eb424122eaea4f9a9ccdd07 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 7 May 2012 11:23:02 +0200
Subject: [PATCH] linux-user: Fix stale tbs after mmap
If we execute linux-user code that does the following:
* A = mmap()
* execute code in A
* munmap(A)
* B = mmap(), but mmap returns the same address as A
* execute code in B
we end up executing a stale cached tb that contains translated code
from A, while we want new code from B.
This patch adds a TB flush for mmap'ed regions, before we return them,
avoiding the whole issue.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/mmap.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 2620f88..390e940 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -587,6 +587,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
page_dump(stdout);
printf("\n");
#endif
+ tb_invalidate_phys_page_range(start, start + len, 0);
mmap_unlock();
return start;
fail:
@@ -768,6 +769,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
page_set_flags(old_addr, old_addr + old_size, 0);
page_set_flags(new_addr, new_addr + new_size, prot | PAGE_VALID);
}
+ tb_invalidate_phys_page_range(new_addr, new_addr + new_size, 0);
mmap_unlock();
return new_addr;
}

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon May 7 10:01:52 UTC 2012 - agraf@suse.com
- compile fixes for ppc64abi32
- fix update_fit.sh script if wc -c is 40
- fix stale tbs after mmap
-------------------------------------------------------------------
Wed Mar 7 15:16:16 UTC 2012 - agraf@suse.com

View File

@ -16,7 +16,6 @@
#
Name: qemu
Url: http://fabrice.bellard.free.fr/qemu/
Summary: Universal CPU emulator
@ -60,6 +59,7 @@ Patch0032: 0032-linux-user-reserve-4GB-of-vmem-for-.patch
Patch0033: 0033-PPC-KVM-Disable-mmu-notifier-check..patch
Patch0034: 0034-linux-user-improve-fake-proc-self-s.patch
Patch0035: 0035-linux-user-target_argv-is-placed-on.patch
Patch0036: 0036-PPC-KVM-Ignore-SET_ONE_REG-failures.patch
Patch0037: 0037-PPC-KVM-Ignore-ENABLE_PAPR-to-suppo.patch
Patch0038: 0038-linux-user-fix-segfault-deadlock.pa.patch
Patch0039: 0039-linux-user-implement-device-mapper-.patch
@ -71,6 +71,10 @@ Patch0044: 0044-linux-user-take-RESERVED_VA-into-ac.patch
Patch0045: 0045-linux-user-binfmt-support-host-bina.patch
Patch0046: 0046-linux-user-fix-fallocate.patch.patch
Patch0047: 0047-linux-user-resolve-reserved_va-vma-.patch
Patch0048: 0048-XXX-fix-prov-self-maps-major-minor-.patch
Patch0049: 0049-XXX-linux-user-proc-self-maps-fix-c.patch
Patch0050: 0050-XXX-fix-syntax-error-in-qemu-binfmt.patch
Patch0051: 0051-linux-user-Fix-stale-tbs-after-mmap.patch
# this is to make lint happy
Source300: rpmlintrc
Source400: update_git.sh
@ -173,6 +177,7 @@ run cross architectures builds
%patch0033 -p1
%patch0034 -p1
%patch0035 -p1
%patch0036 -p1
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
@ -184,6 +189,10 @@ run cross architectures builds
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%build
# build QEMU

View File

@ -14,6 +14,7 @@ GIT_TREE=git://repo.or.cz/qemu/agraf.git
GIT_LOCAL_TREE=/suse/agraf/git/qemu
GIT_BRANCH=suse-1.0
GIT_UPSTREAM_TAG=v1.0.1
QEMU_TMP=/dev/shm/qemu-tmp
# clean up
if [ -e 0001-* ]; then
@ -22,28 +23,30 @@ fi
rm -f qemu.spec
# fetch all patches
rm -rf qemu-tmp
rm -rf $QEMU_TMP
OSCDIR="$(pwd)"
if [ -d "$GIT_LOCAL_TREE" ]; then
git clone -ls $GIT_LOCAL_TREE qemu-tmp
cd qemu-tmp
git clone -ls $GIT_LOCAL_TREE $QEMU_TMP
cd $QEMU_TMP
else
git clone $GIT_TREE qemu-tmp
cd qemu-tmp
git clone $GIT_TREE $QEMU_TMP
cd $QEMU_TMP
git remote add upstream git://git.qemu.org/qemu.git
git remote update
fi
git checkout $GIT_BRANCH
git format-patch -N $GIT_UPSTREAM_TAG -o ..
cd ..
rm -rf qemu-tmp
git format-patch -N $GIT_UPSTREAM_TAG -o "$OSCDIR"
cd "$OSCDIR"
rm -rf $QEMU_TMP
# cut off file name after 40 bytes, so we work around git version differences
# while at it, also remove the signature
for i in 0*; do
PATCHNAME=${i%.patch}
PATCHNAME=${i:0:40}.patch
head -n $(expr $(wc -l $i | cut -d ' ' -f 1) - 3) $i > "$PATCHNAME"
head -n $(expr $(wc -l $i | cut -d ' ' -f 1) - 3) $i > "$PATCHNAME.tmp"
rm "$i"
mv "$PATCHNAME.tmp" "$PATCHNAME"
done
# we have all patches as files now - generate the spec file!