[Qemu-devel] [PATCH 00/11] configure: Fix compiler warnings in config.log

2011-12-17 Thread Stefan Weil
Recently some patches were sent from Peter Maydell to improve
the output in config.log.

This new patch series also improves that output by eliminating
some compiler warnings.

Here is the result of a typical QEMU configuration:

without patch series
296 lines in config.log with 78 compilations, 69 errors and 107 warnings

with patch series applied
152 lines in config.log with 75 compilations, 24 errors and 30 warnings

It is possible to apply only some of the patches (they don't depend
on each other).

Regards,
Stefan Weil

[PATCH 01/11] configure: Fix compiler warnings in config.log (always return a 
value from main)
[PATCH 02/11] configure: Fix compiler warnings in config.log (old-style 
function definition)
[PATCH 03/11] configure: Fix compiler warning in config.log (integer from 
pointer)
[PATCH 04/11] configure: Fix compiler warnings in config.log (null arguments)
[PATCH 05/11] configure: Fix compiler warning in config.log (unused variable)
[PATCH 06/11] configure: Fix compiler warning in config.log (macro redefined)
[PATCH 07/11] configure: Fix compiler warnings in config.log (uninitialized 
variable)
[PATCH 08/11] configure: Fix compiler warning in config.log (undefined NULL)
[PATCH 09/11] configure: Fix compiler warning in config.log (value was never 
used)
[PATCH 10/11] configure: Fix compiler warnings in config.log (statement without 
effect)
[PATCH 11/11] configure: Improve Xen autodetection for hosts without Xen



[Qemu-devel] [PATCH 02/11] configure: Fix compiler warnings in config.log (old-style function definition)

2011-12-17 Thread Stefan Weil
warning: function declaration isn’t a prototype
In function ‘foo’:
warning: old-style function definition

The function name was changed, too, to avoid an additional warning.

Signed-off-by: Stefan Weil 
---
 configure |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 03b8f35..93c6cbe 100755
--- a/configure
+++ b/configure
@@ -1274,11 +1274,11 @@ if test "$nptl" != "no" ; then
   cat > $TMPC <
 #include 
-void foo()
-{
+int main(void) {
 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
 #error bork
 #endif
+  return 0;
 }
 EOF
 
-- 
1.7.2.5




[Qemu-devel] [PATCH 09/11] configure: Fix compiler warning in config.log (value was never used)

2011-12-17 Thread Stefan Weil
Signed-off-by: Stefan Weil 
---
 configure |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 31ea3ff..0c791b5 100755
--- a/configure
+++ b/configure
@@ -2269,8 +2269,7 @@ cat > $TMPC << EOF
 
 int main(void)
 {
-int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
-return 0;
+return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 }
 EOF
 if compile_prog "" "" ; then
-- 
1.7.2.5




[Qemu-devel] [PATCH 08/11] configure: Fix compiler warning in config.log (undefined NULL)

2011-12-17 Thread Stefan Weil
Avoid the warning when probing for xfs.

Signed-off-by: Stefan Weil 
---
 configure |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index b755ad1..31ea3ff 100755
--- a/configure
+++ b/configure
@@ -1670,6 +1670,7 @@ fi
 # xfsctl() probe, used for raw-posix
 if test "$xfs" != "no" ; then
   cat > $TMPC << EOF
+#include   /* NULL */
 #include 
 int main(void)
 {
-- 
1.7.2.5




Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0 (was: Re: git-bisect results

2011-12-17 Thread Richard W.M. Jones
On Fri, Dec 16, 2011 at 07:44:10PM -0600, Anthony Liguori wrote:
> On 12/16/2011 06:53 PM, Max Filippov wrote:
> >>>git bisect says this.  I didn't believe it first time, so I ran it
> >>>twice with a few modifications, and it pointed to the same commit both
> >>>times ...
> >>
> >>Richard,
> >>could you please elaborate on your testcase and configuration
> >>(host/target architecture, command lines, etc).
> >
> >Ok, I've found most of details, what's not clear to me is how you
> >decide whether the build is good or bad.
> >
> >I mean, you need to rebuild qemu on every bisection step, but neither
> >this commit nor the previous or the next one
> >change anything that would compile for x86 targets.
> 
> Fairly certain this bisect is a red herring.
> 
> tglx reported this the other day in IRC.  He narrowed it down to
> virtio-serial.  He was able to reproduce it both with kvm tools and
> QEMU.

Yes, we do use virtio-serial.  The command line is:

/home/rjones/d/qemu/qemu.wrapper \
-drive 
file=/tmp/libguestfs-test-tool-sda-b4hesH,cache=off,format=raw,if=virtio \
-nodefconfig \
-machine accel=kvm:tcg \
-nodefaults \
-nographic \
-m 500 \
-no-reboot \
-no-hpet \
-device virtio-serial \
-serial stdio \
-chardev socket,path=/tmp/libguestfsQQ187c/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-kernel /var/tmp/.guestfs-500/kernel.24171 \
-initrd /var/tmp/.guestfs-500/initrd.24171 \
-append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off 
printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \
-drive 
file=/var/tmp/.guestfs-500/root.24171,snapshot=on,if=virtio,cache=unsafe

which comes from this libguestfs test case:

LIBGUESTFS_QEMU=~/d/qemu/qemu.wrapper libguestfs-test-tool -t 60

where qemu.wrapper is:

#!/bin/sh -
qemudir=/home/rjones/d/qemu
exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "$@"

I'll try it with/without virtio-serial.

git bisect red herring is pretty strange?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v



[Qemu-devel] [PATCH 10/11] configure: Fix compiler warnings in config.log (statement without effect)

2011-12-17 Thread Stefan Weil
Signed-off-by: Stefan Weil 
---
 configure |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 0c791b5..1ae380f 100755
--- a/configure
+++ b/configure
@@ -2074,7 +2074,7 @@ cat > $TMPC <
 #include 
 #include 
-int main(void) { preadv; }
+int main(void) { return preadv == preadv; }
 EOF
 preadv=no
 if compile_prog "" "" ; then
@@ -2107,7 +2107,7 @@ if test "$opengl" != "no" ; then
 #include 
 #include 
 #include 
-int main(void) { GL_VERSION; return 0; }
+int main(void) { return GL_VERSION != 0; }
 EOF
   if compile_prog "" "-lGL" ; then
 opengl=yes
@@ -2369,8 +2369,7 @@ int main(void)
  * warning but not an error, and will proceed to fail the
  * qemu compile where we compile with -Werror.)
  */
-epoll_create1;
-return 0;
+return epoll_create1 == epoll_create1;
 }
 EOF
 if compile_prog "$ARCH_CFLAGS" "" ; then
-- 
1.7.2.5




[Qemu-devel] [PATCH 07/11] configure: Fix compiler warnings in config.log (uninitialized variable)

2011-12-17 Thread Stefan Weil
warning: ‘fd’ is used uninitialized in this function
warning: ‘id’ is used uninitialized in this function

Signed-off-by: Stefan Weil 
---
 configure |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index b799212..b755ad1 100755
--- a/configure
+++ b/configure
@@ -2237,7 +2237,7 @@ cat > $TMPC << EOF
 
 int main(void)
 {
-int len, fd;
+int len, fd = 0;
 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
 return 0;
@@ -2449,7 +2449,7 @@ fi
 cat > $TMPC <
 #include 
-int main(void) { clockid_t id; return clock_gettime(id, NULL); }
+int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
 EOF
 
 if compile_prog "" "" ; then
-- 
1.7.2.5




[Qemu-devel] [PATCH 06/11] configure: Fix compiler warning in config.log (macro redefined)

2011-12-17 Thread Stefan Weil
warning: "_GNU_SOURCE" redefined

The macro is already defined on the command line.

Signed-off-by: Stefan Weil 
---
 configure |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index efc7b6b..b799212 100755
--- a/configure
+++ b/configure
@@ -2251,7 +2251,6 @@ fi
 # signalfd probe
 signalfd="no"
 cat > $TMPC << EOF
-#define _GNU_SOURCE
 #include 
 #include 
 #include 
-- 
1.7.2.5




[Qemu-devel] [PATCH 05/11] configure: Fix compiler warning in config.log (unused variable)

2011-12-17 Thread Stefan Weil
warning: unused variable ‘iov’

Signed-off-by: Stefan Weil 
---
 configure |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 5d860a7..efc7b6b 100755
--- a/configure
+++ b/configure
@@ -2060,7 +2060,7 @@ cat > $TMPC <
 #include 
 #include 
-int main(void) { struct iovec iov; return 0; }
+int main(void) { return sizeof(struct iovec); }
 EOF
 iovec=no
 if compile_prog "" "" ; then
-- 
1.7.2.5




[Qemu-devel] [PATCH 11/11] configure: Improve Xen autodetection for hosts without Xen

2011-12-17 Thread Stefan Weil
With this patch, it only takes one test (instead of four)
to detect that there is no Xen support at all.

For most build hosts, this will reduce the time configure needs.
It will also reduce noisy output in config.log.

Build hosts with Xen now need up to five (instead of up to four)
tests. They get improved diagnostics when Xen support fails.

Cc: Stefano Stabellini 
Signed-off-by: Stefan Weil 
---
 configure |   29 +
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 1ae380f..b8ec19a 100755
--- a/configure
+++ b/configure
@@ -1317,10 +1317,30 @@ fi
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
 
-  # Xen unstable
+  # First we test whether Xen headers and libraries are available.
+  # If no, we are done and there is no Xen support.
+  # If yes, more tests are run to detect the Xen version.
+
+  # Xen (any)
   cat > $TMPC <
 #include 
+int main(void) {
+  return 0;
+}
+EOF
+  if ! compile_prog "" "$xen_libs" ; then
+# Xen not found
+if test "$xen" = "yes" ; then
+  feature_not_found "xen"
+fi
+xen=no
+
+  # Xen unstable
+  elif (
+  cat > $TMPC <
+#include 
 #include 
 #include 
 #if !defined(HVM_MAX_VCPUS)
@@ -1336,7 +1356,8 @@ int main(void) {
   return 0;
 }
 EOF
-  if compile_prog "" "$xen_libs" ; then
+  compile_prog "" "$xen_libs"
+) ; then
 xen_ctrl_version=410
 xen=yes
 
@@ -1407,10 +1428,10 @@ EOF
 xen_ctrl_version=330
 xen=yes
 
-  # Xen not found or unsupported
+  # Xen version unsupported
   else
 if test "$xen" = "yes" ; then
-  feature_not_found "xen"
+  feature_not_found "xen (unsupported version)"
 fi
 xen=no
   fi
-- 
1.7.2.5




[Qemu-devel] [PATCH 04/11] configure: Fix compiler warnings in config.log (null arguments)

2011-12-17 Thread Stefan Weil
warning: null argument where non-null required (argument 1)
warning: null argument where non-null required (argument 3)

Signed-off-by: Stefan Weil 
---
 configure |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 8dee237..5d860a7 100755
--- a/configure
+++ b/configure
@@ -1951,7 +1951,12 @@ PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
 pthread=no
 cat > $TMPC << EOF
 #include 
-int main(void) { pthread_create(0,0,0,0); return 0; }
+static void *f(void *p) { return NULL; }
+int main(void) {
+  pthread_t thread;
+  pthread_create(&thread, 0, f, 0);
+  return 0;
+}
 EOF
 if compile_prog "" "" ; then
   pthread=yes
-- 
1.7.2.5




[Qemu-devel] [PATCH 01/11] configure: Fix compiler warnings in config.log (always return a value from main)

2011-12-17 Thread Stefan Weil
Fix several "warning: control reaches end of non-void function".

Signed-off-by: Stefan Weil 
---
 configure |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 6fd580e..03b8f35 100755
--- a/configure
+++ b/configure
@@ -1082,7 +1082,7 @@ fi
 
 # check that the C compiler works.
 cat > $TMPC < $TMPC << EOF
 #include 
-int main(void) { makecontext(0, 0, 0); }
+int main(void) { makecontext(0, 0, 0); return 0; }
 EOF
   if compile_prog "" "" ; then
   ucontext_coroutine=yes
@@ -2664,7 +2664,7 @@ fi
 open_by_hande_at=no
 cat > $TMPC << EOF
 #include 
-int main(void) { struct file_handle fh; open_by_handle_at(0, &fh, 0); }
+int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
 EOF
 if compile_prog "" "" ; then
 open_by_handle_at=yes
@@ -2677,6 +2677,7 @@ linux_magic_h=no
 cat > $TMPC << EOF
 #include 
 int main(void) {
+  return 0;
 }
 EOF
 if compile_prog "" "" ; then
-- 
1.7.2.5




[Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Stefan Weil
warning: return makes integer from pointer without a cast

Signed-off-by: Stefan Weil 
---
 configure |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 93c6cbe..8dee237 100755
--- a/configure
+++ b/configure
@@ -1841,7 +1841,11 @@ if test "$curses" != "no" ; then
 #ifdef __OpenBSD__
 #define resize_term resizeterm
 #endif
-int main(void) { resize_term(0, 0); return curses_version(); }
+int main(void) {
+  const char *s = curses_version();
+  resize_term(0, 0);
+  return s != (const char *)0;
+}
 EOF
   for curses_lib in $curses_list; do
 if compile_prog "" "$curses_lib" ; then
-- 
1.7.2.5




[Qemu-devel] [PATCH] slirp: Fix typo in net_slirp_hostfwd_remove

2011-12-17 Thread Geoffrey Thomas

Report an error when err is nonzero, not when it is zero.

Signed-off-by: Geoffrey Thomas 
---
 net/slirp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/slirp.c b/net/slirp.c
index 6646ecb..18e07ba 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -351,7 +351,7 @@ void net_slirp_hostfwd_remove(Monitor *mon, const QDict 
*qdict)
host_addr, host_port);

 monitor_printf(mon, "host forwarding rule for %s %s\n", src_str,
-   err ? "removed" : "not found");
+   err ? "not found" : "removed");
 return;

  fail_syntax:
--
1.7.7.3



Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Peter Maydell
On 17 December 2011 08:27, Stefan Weil  wrote:
> warning: return makes integer from pointer without a cast
>
> Signed-off-by: Stefan Weil 
> ---
>  configure |    6 +-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/configure b/configure
> index 93c6cbe..8dee237 100755
> --- a/configure
> +++ b/configure
> @@ -1841,7 +1841,11 @@ if test "$curses" != "no" ; then
>  #ifdef __OpenBSD__
>  #define resize_term resizeterm
>  #endif
> -int main(void) { resize_term(0, 0); return curses_version(); }
> +int main(void) {
> +  const char *s = curses_version();
> +  resize_term(0, 0);
> +  return s != (const char *)0;

You don't need this cast, I think.

> +}
>  EOF
>   for curses_lib in $curses_list; do
>     if compile_prog "" "$curses_lib" ; then
> --
> 1.7.2.5

-- PMM



Re: [Qemu-devel] [PATCH 00/11] configure: Fix compiler warnings in config.log

2011-12-17 Thread Peter Maydell
On 17 December 2011 08:27, Stefan Weil  wrote:
> Recently some patches were sent from Peter Maydell to improve
> the output in config.log.
>
> This new patch series also improves that output by eliminating
> some compiler warnings.

All except 03/11:
Reviewed-by: Peter Maydell 

-- PMM



Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Stefan Weil

Am 17.12.2011 12:29, schrieb Peter Maydell:

On 17 December 2011 08:27, Stefan Weil  wrote:

warning: return makes integer from pointer without a cast

Signed-off-by: Stefan Weil 
---
 configure |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 93c6cbe..8dee237 100755
--- a/configure
+++ b/configure
@@ -1841,7 +1841,11 @@ if test "$curses" != "no" ; then
 #ifdef __OpenBSD__
 #define resize_term resizeterm
 #endif
-int main(void) { resize_term(0, 0); return curses_version(); }
+int main(void) {
+  const char *s = curses_version();
+  resize_term(0, 0);
+  return s != (const char *)0;


You don't need this cast, I think.


Indeed, a quick test with gcc-4.4.5 shows no new warning when
I remove the type cast. Are you sure that this works with all
supported versions of gcc and any set of warning options?

Normally NULL is used for this kind of code, but it needs
stddef.h. Typically NULL is defined to be ((void *)0 for C
(that's the reason why I used a type cast, too). Only for
C++ it is defined without a type cast.

The type cast won't harm and is not in "normal" code,
so it can be committed as it is. I also don't mind if it is
removed by whoever commits it. If it is preferred that
I send an updated patch, I'd use NULL with stddef.h
(just to be safe).

Regards,
Stefan Weil




Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0 (was: Re: git-bisect results

2011-12-17 Thread Richard W.M. Jones
On Fri, Dec 16, 2011 at 07:44:10PM -0600, Anthony Liguori wrote:
> Fairly certain this bisect is a red herring.
> 
> tglx reported this the other day in IRC.  He narrowed it down to
> virtio-serial.  He was able to reproduce it both with kvm tools and
> QEMU.

I looked at this a bit more closely, and what fails is the loading in
the guest of the virtio_blk.ko driver.  virtio_console is not loaded
when the failure happens.

Disabling virtio-serial on the qemu side makes no difference.

Switching to IDE works, but only if I prevent virtio_blk from being
loaded during boot.  In other words, it's the act of loading
virtio_blk which causes the strange hang, even if there are no virtio
block devices exported to the guest.

Not sure what any of this means, since I can't honestly believe that
no one has tried a virtio guest on qemu 1.0.

Guest kernel is vmlinuz-3.2.0-0.rc1.git2.1.fc17.x86_64 (from Fedora).

If you want me to try patches or take a look at any particular qemu
git commits, I'm all ears.  I don't know where to go from here ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org



[Qemu-devel] [PULL] VirtFS update

2011-12-17 Thread Aneesh Kumar K.V

Hi Anthony,

This include a signed pull request. I guess you would require a recent
git to use the gpg info.

The following changes since commit 774d5c5b1604b8443a8e42048b370b6c95dbfc40:

  cris: Handle conditional stores on CRISv10 (2011-12-12 11:38:31 +0100)

are available in the git repository at:

  git://repo.or.cz/qemu/v9fs.git tag for-anthony

for you to fetch changes up to db6e84e6cbe728ea5dcecc62d40e4835ef2b1a4b:

  hw/9pfs: Use the correct signed type for different variables (2011-12-13 
18:59:17 +0530)


Bug fix series. This should also be merged to 1.0 stable.


Aneesh Kumar K.V (1):
  hw/9pfs: Use the correct signed type for different variables

Stefan Hajnoczi (1):
  hw/9pfs: replace iovec manipulation with QEMUIOVector

 fsdev/file-op-9p.h  |2 +-
 hw/9pfs/virtio-9p.c |  183 ---
 hw/9pfs/virtio-9p.h |2 +-
 trace-events|8 +-
 4 files changed, 77 insertions(+), 118 deletions(-)

-aneesh




Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Peter Maydell
On 17 December 2011 12:11, Stefan Weil  wrote:
> Am 17.12.2011 12:29, schrieb Peter Maydell:
>>> +  return s != (const char *)0;
>>
>> You don't need this cast, I think.
>
> Indeed, a quick test with gcc-4.4.5 shows no new warning when
> I remove the type cast. Are you sure that this works with all
> supported versions of gcc and any set of warning options?

Yes. Both 0 and (void*)0 are null pointer constants;
comparing explicitly for "if (ptr != 0)" is equivalent to
"if (ptr)"; qemu style prefers the latter but there are
a few of the former in the codebase, so practically speaking
we know it compiles fine.

> Normally NULL is used for this kind of code, but it needs
> stddef.h.

Only in some coding styles. NULL is just a convenience
macro if you like that kind of thing.

> Typically NULL is defined to be ((void *)0 for C
> (that's the reason why I used a type cast, too). Only for
> C++ it is defined without a type cast.

The C standard permits plain "0" as a definition of NULL.

> The type cast won't harm and is not in "normal" code,
> so it can be committed as it is. I also don't mind if it is
> removed by whoever commits it. If it is preferred that
> I send an updated patch, I'd use NULL with stddef.h
> (just to be safe).

We use plain 0 for a null pointer constant in various
existing tests in configure; this is simpler and avoids
dragging in stddef.h. I would prefer that.

-- PMM



Re: [Qemu-devel] [PATCH 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Eric Blake
On 12/17/2011 07:09 AM, Peter Maydell wrote:
>> Typically NULL is defined to be ((void *)0 for C
>> (that's the reason why I used a type cast, too). Only for
>> C++ it is defined without a type cast.
> 
> The C standard permits plain "0" as a definition of NULL.

POSIX concurs with the C standard that a plain "0" can be used for
representing a null pointer, but requires that the macro NULL be defined
as ((void*)0) as a tighter requirement than C.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_244
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html#tag_13_47

> We use plain 0 for a null pointer constant in various
> existing tests in configure; this is simpler and avoids
> dragging in stddef.h. I would prefer that.

I agree that configure tests should be as small as possible while still
being correct, and use of a 0 constant without a cast, rather than NULL,
is appropriate in that context.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] Changing vmexit behavior for a running guest

2011-12-17 Thread panda23
For sandboxing some forms of untrusted code, the risk of a red pill
could be greatly reduced if qemu had "seccomp" mode, i.e., a way for a
guest OS to request that qemu drop any future unwhitelisted vmexit
calls.  How complicated would it be to add this functionality to qemu
and which parts of qemu would I need to modify?

Jason



Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Anthony Liguori

On 12/17/2011 02:33 AM, Richard W.M. Jones wrote:

On Fri, Dec 16, 2011 at 07:44:10PM -0600, Anthony Liguori wrote:

On 12/16/2011 06:53 PM, Max Filippov wrote:

git bisect says this.  I didn't believe it first time, so I ran it
twice with a few modifications, and it pointed to the same commit both
times ...


Richard,
could you please elaborate on your testcase and configuration
(host/target architecture, command lines, etc).


Ok, I've found most of details, what's not clear to me is how you
decide whether the build is good or bad.

I mean, you need to rebuild qemu on every bisection step, but neither
this commit nor the previous or the next one
change anything that would compile for x86 targets.


Fairly certain this bisect is a red herring.

tglx reported this the other day in IRC.  He narrowed it down to
virtio-serial.  He was able to reproduce it both with kvm tools and
QEMU.


Yes, we do use virtio-serial.  The command line is:

/home/rjones/d/qemu/qemu.wrapper \
 -drive 
file=/tmp/libguestfs-test-tool-sda-b4hesH,cache=off,format=raw,if=virtio \
 -nodefconfig \
 -machine accel=kvm:tcg \
 -nodefaults \
 -nographic \
 -m 500 \
 -no-reboot \
 -no-hpet \
 -device virtio-serial \
 -serial stdio \


Okay, I can reproduce this now with a F15 guest.

I've narrowed it down to '-nodefaults -serial stdio'.  Can you confirm that if 
you remove those options it works for you?


Regards,

Anthony Liguori



 -chardev socket,path=/tmp/libguestfsQQ187c/guestfsd.sock,id=channel0 \
 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
 -kernel /var/tmp/.guestfs-500/kernel.24171 \
 -initrd /var/tmp/.guestfs-500/initrd.24171 \
 -append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off 
printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \
 -drive 
file=/var/tmp/.guestfs-500/root.24171,snapshot=on,if=virtio,cache=unsafe

which comes from this libguestfs test case:

LIBGUESTFS_QEMU=~/d/qemu/qemu.wrapper libguestfs-test-tool -t 60

where qemu.wrapper is:

#!/bin/sh -
qemudir=/home/rjones/d/qemu
exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "$@"

I'll try it with/without virtio-serial.

git bisect red herring is pretty strange?

Rich.






Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Richard W.M. Jones
On Sat, Dec 17, 2011 at 09:13:52AM -0600, Anthony Liguori wrote:
> Okay, I can reproduce this now with a F15 guest.
> 
> I've narrowed it down to '-nodefaults -serial stdio'.  Can you
> confirm that if you remove those options it works for you?

Confirmed: removing those options allows it to boot normally.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/



Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Anthony Liguori

On 12/17/2011 09:13 AM, Anthony Liguori wrote:

On 12/17/2011 02:33 AM, Richard W.M. Jones wrote:

On Fri, Dec 16, 2011 at 07:44:10PM -0600, Anthony Liguori wrote:

On 12/16/2011 06:53 PM, Max Filippov wrote:

git bisect says this. I didn't believe it first time, so I ran it
twice with a few modifications, and it pointed to the same commit both
times ...


Richard,
could you please elaborate on your testcase and configuration
(host/target architecture, command lines, etc).


Ok, I've found most of details, what's not clear to me is how you
decide whether the build is good or bad.

I mean, you need to rebuild qemu on every bisection step, but neither
this commit nor the previous or the next one
change anything that would compile for x86 targets.


Fairly certain this bisect is a red herring.

tglx reported this the other day in IRC. He narrowed it down to
virtio-serial. He was able to reproduce it both with kvm tools and
QEMU.


Yes, we do use virtio-serial. The command line is:

/home/rjones/d/qemu/qemu.wrapper \
-drive file=/tmp/libguestfs-test-tool-sda-b4hesH,cache=off,format=raw,if=virtio 
\
-nodefconfig \
-machine accel=kvm:tcg \
-nodefaults \
-nographic \
-m 500 \
-no-reboot \
-no-hpet \
-device virtio-serial \
-serial stdio \


Okay, I can reproduce this now with a F15 guest.

I've narrowed it down to '-nodefaults -serial stdio'. Can you confirm that if
you remove those options it works for you?


I've even further narrowed it down to the presents or lack of '-vga cirrus'.  If 
you add '-vga cirrus' to the above command line, the guest will boot successfully.


Regards,

Anthony Liguori



Regards,

Anthony Liguori



-chardev socket,path=/tmp/libguestfsQQ187c/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-kernel /var/tmp/.guestfs-500/kernel.24171 \
-initrd /var/tmp/.guestfs-500/initrd.24171 \
-append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off
printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \
-drive file=/var/tmp/.guestfs-500/root.24171,snapshot=on,if=virtio,cache=unsafe

which comes from this libguestfs test case:

LIBGUESTFS_QEMU=~/d/qemu/qemu.wrapper libguestfs-test-tool -t 60

where qemu.wrapper is:

#!/bin/sh -
qemudir=/home/rjones/d/qemu
exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "$@"

I'll try it with/without virtio-serial.

git bisect red herring is pretty strange?

Rich.








Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Richard W.M. Jones
On Sat, Dec 17, 2011 at 09:22:45AM -0600, Anthony Liguori wrote:
> I've even further narrowed it down to the presents or lack of '-vga
> cirrus'.  If you add '-vga cirrus' to the above command line, the
> guest will boot successfully.

Confirmed: Adding -vga cirrus to the command line cures it too.

That's a strange one :-)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/



Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Anthony Liguori

On 12/17/2011 09:25 AM, Richard W.M. Jones wrote:

On Sat, Dec 17, 2011 at 09:22:45AM -0600, Anthony Liguori wrote:

I've even further narrowed it down to the presents or lack of '-vga
cirrus'.  If you add '-vga cirrus' to the above command line, the
guest will boot successfully.


Confirmed: Adding -vga cirrus to the command line cures it too.

That's a strange one :-)


vga sticks out a bit because it's one of the few places where we treat device 
memory as ram as a performance optimization.


The only time vga has been touched in between v0.15 and v1.0 was during the 
introduction of the memory API.


It's this commit:

commit d67c3f2cd92aed2247bfa8a9da61a902b7b2ff09
Author: Gerd Hoffmann 
Date:   Wed Aug 10 17:34:13 2011 +0200

seabios: update to master

commit 8e301472e324b6d6496d8b4ffc66863e99d7a505

user visible changes in seabios:
  * ahci is enabled by default (and thus in this build).
  * bootorder support for ahci.
  * two-pass pci allocator (orders bars by size for better packing).

Signed-off-by: Gerd Hoffmann 

:04 04 76eb0c81b76563b55cb2bb5c484ccd48b8cfcded 
5ec0d65d3a763a5566fe1f4c86269cad6d671020 M	pc-bios
:04 04 a5a7ea6e297c1e7490b0a2c28a06ce56e5be9449 
78adb664d3ea82f1a4dd5ec239887ac5b0168a7f M	roms


It can be reproduced by using virtio and -vga none with a number of PCI devices. 
 The line below is what I used to bisect and reproduce 100% of the time.  It's 
a 64-bit Fedora 15 guest.


$ qemu-system-x86_64 -drive 
file=/home/anthony/images/fedora.img,if=none,snapshot=on,id=hd0 -device 
virtio-balloon-pci,addr=03.0 -device virtio-blk-pci,addr=04.0,drive=hd0 -kernel 
~/vmlinuz-2.6.38.6-26.rc1.fc15.x86_64 -initrd 
~/initramfs-2.6.38.6-26.rc1.fc15.x86_64.img -append 
"root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root 
rd_LVM_LV=VolGroup/lv_swap ro console=ttyS0 selinux=0" -nographic -nodefconfig 
-m 1G -no-reboot -no-hpet -device virtio-serial -chardev 
socket,path=/tmp/foo.sock,id=channel0,server,nowait -device 
virtserialport,chardev=channel0,name=org.libguestfs.channel.0 -nodefaults 
-serial stdio -enable-kvm


My guess it that it has something to do with the changes to the PCI allocator. 
I've confirmed reverting this commit fixes the problem.


Regards,

Anthony Liguori



Rich.






Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Richard W.M. Jones
On Sat, Dec 17, 2011 at 10:24:07AM -0600, Anthony Liguori wrote:
> On 12/17/2011 09:25 AM, Richard W.M. Jones wrote:
> >On Sat, Dec 17, 2011 at 09:22:45AM -0600, Anthony Liguori wrote:
> >>I've even further narrowed it down to the presents or lack of '-vga
> >>cirrus'.  If you add '-vga cirrus' to the above command line, the
> >>guest will boot successfully.
> >
> >Confirmed: Adding -vga cirrus to the command line cures it too.
> >
> >That's a strange one :-)
> 
> vga sticks out a bit because it's one of the few places where we
> treat device memory as ram as a performance optimization.
> 
> The only time vga has been touched in between v0.15 and v1.0 was
> during the introduction of the memory API.
> 
> It's this commit:
> 
> commit d67c3f2cd92aed2247bfa8a9da61a902b7b2ff09
> Author: Gerd Hoffmann 
> Date:   Wed Aug 10 17:34:13 2011 +0200
> 
> seabios: update to master
> 
> commit 8e301472e324b6d6496d8b4ffc66863e99d7a505
> 
> user visible changes in seabios:
>   * ahci is enabled by default (and thus in this build).
>   * bootorder support for ahci.
>   * two-pass pci allocator (orders bars by size for better packing).
> 
> Signed-off-by: Gerd Hoffmann 
> 
> :04 04 76eb0c81b76563b55cb2bb5c484ccd48b8cfcded
> 5ec0d65d3a763a5566fe1f4c86269cad6d671020 Mpc-bios
> :04 04 a5a7ea6e297c1e7490b0a2c28a06ce56e5be9449
> 78adb664d3ea82f1a4dd5ec239887ac5b0168a7f Mroms
> 
> It can be reproduced by using virtio and -vga none with a number of
> PCI devices.  The line below is what I used to bisect and reproduce
> 100% of the time.  It's a 64-bit Fedora 15 guest.
> 
> $ qemu-system-x86_64 -drive
> file=/home/anthony/images/fedora.img,if=none,snapshot=on,id=hd0
> -device virtio-balloon-pci,addr=03.0 -device
> virtio-blk-pci,addr=04.0,drive=hd0 -kernel
> ~/vmlinuz-2.6.38.6-26.rc1.fc15.x86_64 -initrd
> ~/initramfs-2.6.38.6-26.rc1.fc15.x86_64.img -append
> "root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root
> rd_LVM_LV=VolGroup/lv_swap ro console=ttyS0 selinux=0" -nographic
> -nodefconfig -m 1G -no-reboot -no-hpet -device virtio-serial
> -chardev socket,path=/tmp/foo.sock,id=channel0,server,nowait -device
> virtserialport,chardev=channel0,name=org.libguestfs.channel.0
> -nodefaults -serial stdio -enable-kvm
> 
> My guess it that it has something to do with the changes to the PCI
> allocator. I've confirmed reverting this commit fixes the problem.

Confirmed: reverting this patch fixes it for me.

Note that we suspected this patch before, way back in September:
https://lists.gnu.org/archive/html/qemu-devel/2011-09/msg03830.html

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/



[Qemu-devel] [PATCH v2 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Stefan Weil
warning: return makes integer from pointer without a cast

v2: Removed type cast.

Signed-off-by: Stefan Weil 
---
 configure |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 93c6cbe..773df6a 100755
--- a/configure
+++ b/configure
@@ -1841,7 +1841,11 @@ if test "$curses" != "no" ; then
 #ifdef __OpenBSD__
 #define resize_term resizeterm
 #endif
-int main(void) { resize_term(0, 0); return curses_version(); }
+int main(void) {
+  const char *s = curses_version();
+  resize_term(0, 0);
+  return s != 0;
+}
 EOF
   for curses_lib in $curses_list; do
 if compile_prog "" "$curses_lib" ; then
-- 
1.7.2.5




Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Kevin O'Connor
On Sat, Dec 17, 2011 at 10:24:07AM -0600, Anthony Liguori wrote:
> On 12/17/2011 09:25 AM, Richard W.M. Jones wrote:
> >On Sat, Dec 17, 2011 at 09:22:45AM -0600, Anthony Liguori wrote:
> >>I've even further narrowed it down to the presents or lack of '-vga
> >>cirrus'.  If you add '-vga cirrus' to the above command line, the
> >>guest will boot successfully.
> >
> >Confirmed: Adding -vga cirrus to the command line cures it too.
> >
> >That's a strange one :-)
> 
> vga sticks out a bit because it's one of the few places where we
> treat device memory as ram as a performance optimization.
> 
> The only time vga has been touched in between v0.15 and v1.0 was
> during the introduction of the memory API.
> 
> It's this commit:
> 
> commit d67c3f2cd92aed2247bfa8a9da61a902b7b2ff09
> Author: Gerd Hoffmann 
> Date:   Wed Aug 10 17:34:13 2011 +0200
> 
> seabios: update to master

This looks like the same issue reported at:

http://lists.nongnu.org/archive/html/qemu-devel/2011-10/msg00029.html

The SeaBIOS fix for this was in rel-1.6.3.1 - but that didn't make
QEmu 1.0.  Does the problem go away if you upgrade to the newer
SeaBIOS version?

-Kevin



Re: [Qemu-devel] [PATCH v2 03/11] configure: Fix compiler warning in config.log (integer from pointer)

2011-12-17 Thread Peter Maydell
On 17 December 2011 16:46, Stefan Weil  wrote:
> warning: return makes integer from pointer without a cast
>
> v2: Removed type cast.
>
> Signed-off-by: Stefan Weil 

Reviewed-by: Peter Maydell 

> ---
>  configure |    6 +-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/configure b/configure
> index 93c6cbe..773df6a 100755
> --- a/configure
> +++ b/configure
> @@ -1841,7 +1841,11 @@ if test "$curses" != "no" ; then
>  #ifdef __OpenBSD__
>  #define resize_term resizeterm
>  #endif
> -int main(void) { resize_term(0, 0); return curses_version(); }
> +int main(void) {
> +  const char *s = curses_version();
> +  resize_term(0, 0);
> +  return s != 0;
> +}
>  EOF
>   for curses_lib in $curses_list; do
>     if compile_prog "" "$curses_lib" ; then
> --
> 1.7.2.5
>
>



-- 
12345678901234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6         7         8



Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Anthony Liguori

On 12/17/2011 10:49 AM, Kevin O'Connor wrote:

On Sat, Dec 17, 2011 at 10:24:07AM -0600, Anthony Liguori wrote:

On 12/17/2011 09:25 AM, Richard W.M. Jones wrote:

On Sat, Dec 17, 2011 at 09:22:45AM -0600, Anthony Liguori wrote:

I've even further narrowed it down to the presents or lack of '-vga
cirrus'.  If you add '-vga cirrus' to the above command line, the
guest will boot successfully.


Confirmed: Adding -vga cirrus to the command line cures it too.

That's a strange one :-)


vga sticks out a bit because it's one of the few places where we
treat device memory as ram as a performance optimization.

The only time vga has been touched in between v0.15 and v1.0 was
during the introduction of the memory API.

It's this commit:

commit d67c3f2cd92aed2247bfa8a9da61a902b7b2ff09
Author: Gerd Hoffmann
Date:   Wed Aug 10 17:34:13 2011 +0200

 seabios: update to master


This looks like the same issue reported at:

http://lists.nongnu.org/archive/html/qemu-devel/2011-10/msg00029.html

The SeaBIOS fix for this was in rel-1.6.3.1 - but that didn't make
QEmu 1.0.  Does the problem go away if you upgrade to the newer
SeaBIOS version?


Er, I can't actually build SeaBIOS anymore...

The version of LD on this system does not properly handle
alignments.  As a result, this project can not be built.

The problem may be the result of this LD bug report:
 http://sourceware.org/bugzilla/show_bug.cgi?id=12726

Please update to a working version of binutils and retry.
Makefile:75: *** "Please upgrade GCC and/or binutils".  Stop.

Let me find a box with a newer binutils...

Regards,

Anthony Liguori



-Kevin






Re: [Qemu-devel] insmod virtio-blk is broken in qemu 1.0

2011-12-17 Thread Richard W.M. Jones
On Sat, Dec 17, 2011 at 11:49:56AM -0500, Kevin O'Connor wrote:
> On Sat, Dec 17, 2011 at 10:24:07AM -0600, Anthony Liguori wrote:
> > On 12/17/2011 09:25 AM, Richard W.M. Jones wrote:
> > >On Sat, Dec 17, 2011 at 09:22:45AM -0600, Anthony Liguori wrote:
> > >>I've even further narrowed it down to the presents or lack of '-vga
> > >>cirrus'.  If you add '-vga cirrus' to the above command line, the
> > >>guest will boot successfully.
> > >
> > >Confirmed: Adding -vga cirrus to the command line cures it too.
> > >
> > >That's a strange one :-)
> > 
> > vga sticks out a bit because it's one of the few places where we
> > treat device memory as ram as a performance optimization.
> > 
> > The only time vga has been touched in between v0.15 and v1.0 was
> > during the introduction of the memory API.
> > 
> > It's this commit:
> > 
> > commit d67c3f2cd92aed2247bfa8a9da61a902b7b2ff09
> > Author: Gerd Hoffmann 
> > Date:   Wed Aug 10 17:34:13 2011 +0200
> > 
> > seabios: update to master
> 
> This looks like the same issue reported at:
> 
> http://lists.nongnu.org/archive/html/qemu-devel/2011-10/msg00029.html
> 
> The SeaBIOS fix for this was in rel-1.6.3.1 - but that didn't make
> QEmu 1.0.  Does the problem go away if you upgrade to the newer
> SeaBIOS version?

Yes, SeaBIOS upstream + qemu 1.0 does fix the problem.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v



Re: [Qemu-devel] [PATCH] slirp: Fix typo in net_slirp_hostfwd_remove

2011-12-17 Thread Jan Kiszka
On 2011-12-17 10:23, Geoffrey Thomas wrote:
> Report an error when err is nonzero, not when it is zero.
> 
> Signed-off-by: Geoffrey Thomas 
> ---
>  net/slirp.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/slirp.c b/net/slirp.c
> index 6646ecb..18e07ba 100644
> --- a/net/slirp.c
> +++ b/net/slirp.c
> @@ -351,7 +351,7 @@ void net_slirp_hostfwd_remove(Monitor *mon, const
> QDict *qdict)
> host_addr, host_port);
> 
>  monitor_printf(mon, "host forwarding rule for %s %s\n", src_str,
> -   err ? "removed" : "not found");
> +   err ? "not found" : "removed");
>  return;
> 
>   fail_syntax:

Oops, obviously. Stefan, should be another trivial one for you.

Thanks,
Jan



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH 0/3] target-mips improvements

2011-12-17 Thread Richard Henderson
I was interested in testing some Loongson vectorization code for GCC.
These, plus a handfull of other hacks on top of Khansa Butt's
mips64-linux-user patches, does a fair job of it.

I'll post the hacks under separate cover, as I don't know what the real
fix ought to be; I just forced the cpu flags to be the way I needed.


r~


Richard Henderson (3):
  target-mips: Streamline indexed cp1 memory addressing.
  mips-linux-user: Always support rdhwr.
  target-mips: Implement Loongson Multimedia Instructions

 Makefile.target  |3 +
 target-mips/helper.h |   59 
 target-mips/lmi_helper.c |  744 ++
 target-mips/translate.c  |  379 +++-
 4 files changed, 1181 insertions(+), 4 deletions(-)
 create mode 100644 target-mips/lmi_helper.c

-- 
1.7.7.4




[Qemu-devel] [PATCH 1/3] target-mips: Streamline indexed cp1 memory addressing.

2011-12-17 Thread Richard Henderson
We've already eliminated both base and index being zero.

Signed-off-by: Richard Henderson 
---
 target-mips/translate.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index d5b1c76..b20a817 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -7749,8 +7749,7 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t 
opc,
 } else if (index == 0) {
 gen_load_gpr(t0, base);
 } else {
-gen_load_gpr(t0, index);
-gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
+gen_op_addr_add(ctx, t0, cpu_gpr[base], cpu_gpr[index]);
 }
 /* Don't do NOP if destination is zero: we must perform the actual
memory access. */
-- 
1.7.7.4




[Qemu-devel] [PATCH 3/3] target-mips: Implement Loongson Multimedia Instructions

2011-12-17 Thread Richard Henderson
Implements all of the COP2 instructions except for the S
family of comparisons.  The documentation is unclear for those.

Signed-off-by: Richard Henderson 
---
 Makefile.target  |3 +
 target-mips/helper.h |   59 
 target-mips/lmi_helper.c |  744 ++
 target-mips/translate.c  |  372 +++-
 4 files changed, 1176 insertions(+), 2 deletions(-)
 create mode 100644 target-mips/lmi_helper.c

diff --git a/Makefile.target b/Makefile.target
index 8be9b9a..280af79 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -84,6 +84,9 @@ libobj-y += cpu_init.o
 endif
 libobj-$(TARGET_SPARC) += int32_helper.o
 libobj-$(TARGET_SPARC64) += int64_helper.o
+ifeq ($(TARGET_BASE_ARCH), mips)
+libobj-y += lmi_helper.o
+endif
 
 libobj-y += disas.o
 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
diff --git a/target-mips/helper.h b/target-mips/helper.h
index 442f684..3ef8fdc 100644
--- a/target-mips/helper.h
+++ b/target-mips/helper.h
@@ -297,4 +297,63 @@ DEF_HELPER_0(rdhwr_ccres, tl)
 DEF_HELPER_1(pmon, void, int)
 DEF_HELPER_0(wait, void)
 
+/* Loongson multimedia functions.  */
+DEF_HELPER_FLAGS_2(paddsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(paddush, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(paddh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(paddw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(paddsb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(paddusb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(paddb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(psubsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psubush, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psubh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psubw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psubsb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psubusb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psubb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(pshufh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(packsswh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(packsshb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(packushb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(punpcklhw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(punpckhhw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(punpcklbh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(punpckhbh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(punpcklwd, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(punpckhwd, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(pavgh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pavgb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pmaxsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pminsh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pmaxub, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pminub, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(pcmpeqw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pcmpgtw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pcmpeqh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pcmpgth, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pcmpeqb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pcmpgtb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(psllw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psllh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psrlw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psrlh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psraw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(psrah, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(pmullh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pmulhh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pmulhuh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_2(pmaddhw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+
+DEF_HELPER_FLAGS_2(pasubub, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
+DEF_HELPER_FLAGS_1(biadd, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64)
+DEF_HELPER_FLAGS_1(pmovmskb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64)
+
 #include "def-helper.h"
diff --git a/target-mips/lmi_helper.c b/target-mips/lmi_helper.c
new file mode 100644
index 000..1b24353
--- /dev/null

[Qemu-devel] [PATCH 2/3] mips-linux-user: Always support rdhwr.

2011-12-17 Thread Richard Henderson
The kernel will emulate this instruction if it's not supported
natively.  This insn is used for TLS, among other things, and
so is required by modern glibc.

Signed-off-by: Richard Henderson 
---
 target-mips/translate.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index b20a817..e2ee763 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -8118,7 +8118,11 @@ gen_rdhwr (CPUState *env, DisasContext *ctx, int rt, int 
rd)
 {
 TCGv t0;
 
+#if !defined(CONFIG_USER_ONLY)
+/* The Linux kernel will emulate rdhwr if it's not supported natively.
+   Therefore only check the ISA in system mode.  */
 check_insn(env, ctx, ISA_MIPS32R2);
+#endif
 t0 = tcg_temp_new();
 
 switch (rd) {
-- 
1.7.7.4




[Qemu-devel] [Bug 241119] Re: usb_add of a Creative ZEN unrecognized in guest

2011-12-17 Thread Launchpad Bug Tracker
[Expired for qemu-kvm (Ubuntu) because there has been no activity for 60
days.]

** Changed in: qemu-kvm (Ubuntu)
   Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/241119

Title:
  usb_add of a Creative ZEN unrecognized in guest

Status in QEMU:
  Incomplete
Status in “qemu-kvm” package in Ubuntu:
  Expired

Bug description:
  Binary package hint: kvm

  This happens when I add my Creative ZEN to a virtual machine running XP. The 
device is recognised well at first and drivers are installed correctly. But 
when trying to connect windows crashes with the classic blue screen It 
complains about something like usbohci.sys, I can't read well because it 
crashes too fast.
  I have also tried with another virtual machine running Vista, same results.
  Any help would be really appreciated!

  I'm using the module kvm-amd with Ubuntu 8.04

  The USB device has the following ID: 041e:4157 Creative Technology,
  Ltd

  kvm:
Installed: 1:62+dfsg-0ubuntu7
Candidate: 1:62+dfsg-0ubuntu7
Version table:
   *** 1:62+dfsg-0ubuntu7 0
  500 http://archive.ubuntu.com hardy/main Packages
  100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/241119/+subscriptions



[Qemu-devel] Patch to add iSCSI configuration optionsi. Version 2

2011-12-17 Thread Ronnie Sahlberg
List,

Please find attached a patch that adds configuration variables for iSCSI to
set CHAP username/password, header-digest settings and the iqn to use when 
logging in to the target.

The patch is updated to produce an error if the username is set but no password 
was given.


regards
ronnie sahlberg




[Qemu-devel] [PATCH] iSCSI: add configuration variables for iSCSI

2011-12-17 Thread Ronnie Sahlberg
This patch adds configuration variables for iSCSI to set
initiator-name to use when logging in to the target,
which type of header-digest to negotiate with the target
and username and password for CHAP authentication.

This allows specifying a initiator-name either from the command line
-iscsi initiator-name=iqn.2004-01.com.example:test
or from a configuration file included with -readconfig
[iscsi]
  initiator-name = iqn.2004-01.com.example:test
  header-digest = CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
  user = CHAP username
  password = CHAP password

The patch also updates the manpage and qemu-doc

Signed-off-by: Ronnie Sahlberg 
---
 block/iscsi.c   |  114 ++-
 qemu-config.c   |   27 +
 qemu-doc.texi   |   28 +-
 qemu-options.hx |   16 ++--
 vl.c|8 
 5 files changed, 186 insertions(+), 7 deletions(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 938c568..92c6e79 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -455,6 +455,100 @@ iscsi_connect_cb(struct iscsi_context *iscsi, int status, 
void *command_data,
 }
 }
 
+static int parse_chap(struct iscsi_context *iscsi)
+{
+QemuOptsList *list;
+QemuOpts *opts;
+const char *user = NULL;
+const char *password = NULL;
+
+list = qemu_find_opts("iscsi");
+if (!list) {
+return 0;
+}
+
+opts = QTAILQ_FIRST(&list->head);
+if (!opts) {
+return 0;
+}
+
+user = qemu_opt_get(opts, "user");
+if (!user) {
+return 0;
+}
+
+password = qemu_opt_get(opts, "password");
+if (!password) {
+error_report("CHAP username specified but no password was given");
+return -1;
+}
+
+if (iscsi_set_initiator_username_pwd(iscsi, user, password)) {
+error_report("Failed to set initiator username and password");
+return -1;
+}
+
+return 0;
+}
+
+static void parse_header_digest(struct iscsi_context *iscsi)
+{
+QemuOptsList *list;
+QemuOpts *opts;
+const char *digest = NULL;
+
+list = qemu_find_opts("iscsi");
+if (!list) {
+return;
+}
+
+opts = QTAILQ_FIRST(&list->head);
+if (!opts) {
+return;
+}
+
+digest = qemu_opt_get(opts, "header-digest");
+if (!digest) {
+return;
+}
+
+if (!strcmp(digest, "CRC32C")) {
+iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_CRC32C);
+} else if (!strcmp(digest, "NONE")) {
+iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE);
+} else if (!strcmp(digest, "CRC32C-NONE")) {
+iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_CRC32C_NONE);
+} else if (!strcmp(digest, "NONE-CRC32C")) {
+iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
+} else {
+error_report("Invalid header-digest setting : %s", digest);
+}
+}
+
+static char *parse_initiator_name(void)
+{
+QemuOptsList *list;
+QemuOpts *opts;
+const char *name = NULL;
+
+list = qemu_find_opts("iscsi");
+if (!list) {
+return g_strdup("iqn.2008-11.org.linux-kvm");
+}
+
+opts = QTAILQ_FIRST(&list->head);
+if (!opts) {
+return g_strdup("iqn.2008-11.org.linux-kvm");
+}
+
+name = qemu_opt_get(opts, "initiator-name");
+if (!name) {
+return g_strdup("iqn.2008-11.org.linux-kvm");
+}
+
+return g_strdup(name);
+}
+
 /*
  * We support iscsi url's on the form
  * iscsi://[%@][:]//
@@ -465,6 +559,7 @@ static int iscsi_open(BlockDriverState *bs, const char 
*filename, int flags)
 struct iscsi_context *iscsi = NULL;
 struct iscsi_url *iscsi_url = NULL;
 struct IscsiTask task;
+char *initiator_name = NULL;
 int ret;
 
 if ((BDRV_SECTOR_SIZE % 512) != 0) {
@@ -476,8 +571,9 @@ static int iscsi_open(BlockDriverState *bs, const char 
*filename, int flags)
 
 memset(iscsilun, 0, sizeof(IscsiLun));
 
-/* Should really append the KVM name after the ':' here */
-iscsi = iscsi_create_context("iqn.2008-11.org.linux-kvm:");
+initiator_name = parse_initiator_name();
+
+iscsi = iscsi_create_context(initiator_name);
 if (iscsi == NULL) {
 error_report("iSCSI: Failed to create iSCSI context.");
 ret = -ENOMEM;
@@ -507,6 +603,14 @@ static int iscsi_open(BlockDriverState *bs, const char 
*filename, int flags)
 goto failed;
 }
 }
+
+/* check if we got CHAP username/password via the options */
+if (parse_chap(iscsi) != 0) {
+error_report("iSCSI: Failed to set CHAP user/password");
+ret = -EINVAL;
+goto failed;
+}
+
 if (iscsi_set_session_type(iscsi, ISCSI_SESSION_NORMAL) != 0) {
 error_report("iSCSI: Failed to set session type to normal.");
 ret = -EINVAL;
@@ -515,6 +619,9 @@ static int iscsi_open(BlockDriverState *bs, const char 
*filename, int flags)
 
 iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
 
+/* check if we got HE