]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
11 years agoiscsi: Pick default initiator-name based on the name of the VM
Ronnie Sahlberg [Mon, 6 Aug 2012 08:24:55 +0000 (18:24 +1000)]
iscsi: Pick default initiator-name based on the name of the VM

This patch updates the iscsi layer to automatically pick a 'unique'
initiator-name based on the name of the vm in case the user has not set
an explicit iqn-name to use.

Create a new function qemu_get_vm_name() that returns the name of the VM,
if specified.

This way we can thus create default names to use as the initiator name
based on the guest session.

If the VM is not named via the '-name' command line argument, the iscsi
initiator-name used wiull simply be

    iqn.2008-11.org.linux-kvm

If a name for the VM was specified with the '-name' option, iscsi will
use a default initiatorname of

    iqn.2008-11.org.linux-kvm:<name>

These names are just the default iscsi initiator name that qemu will
generate/use only when the user has not set an explicit initiator name
via the commandlines or config files.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
11 years agoiscsi: reorganize code for parse_initiator_name
Paolo Bonzini [Mon, 6 Aug 2012 08:54:41 +0000 (10:54 +0200)]
iscsi: reorganize code for parse_initiator_name

Merge the occurrences of the "iqn.2008-11.org.linux-kvm" string
to avoid duplication.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiscsi: do not leak initiator_name
Paolo Bonzini [Mon, 6 Aug 2012 08:52:22 +0000 (10:52 +0200)]
iscsi: do not leak initiator_name

The argument of iscsi_create_context is never freed by libiscsi,
which in fact calls strdup on it.  Avoid a leak.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoslirp: fix build on mingw32
Anthony Liguori [Tue, 7 Aug 2012 00:31:55 +0000 (19:31 -0500)]
slirp: fix build on mingw32

in_addr_t isn't available on mingw32.  Just use an unsigned long instead.  I
considered typedef'ing in_addr_t on mingw32 but this would potentially be
brittle if mingw32 did introduce the type.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: fix vhost handling
Paolo Bonzini [Mon, 6 Aug 2012 13:26:14 +0000 (15:26 +0200)]
virtio: fix vhost handling

Commit b1f416aa8d870fab71030abc9401cfc77b948e8e breaks vhost_net
because it always registers the virtio_pci_host_notifier_read() handler
function on the ioeventfd, even when vhost_net.ko is using the ioeventfd.
The result is both QEMU and vhost_net.ko polling on the same eventfd
and the virtio_net.ko guest driver seeing inconsistent results:

  # ifconfig eth0 192.168.0.1 netmask 255.255.255.0
  virtio_net virtio0: output:id 0 is not a head!

To fix this, proceed the same as we do for irqfd: add a parameter to
virtio_queue_set_host_notifier_fd_handler and in that case only set
the notifier, not the handler.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Mon, 6 Aug 2012 18:59:59 +0000 (13:59 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  slirp: Handle whole 127.0.0.0/8 network as local addresses.

11 years agoMerge branch 'axp-next' of git://repo.or.cz/qemu/rth
Blue Swirl [Sat, 4 Aug 2012 17:58:23 +0000 (17:58 +0000)]
Merge branch 'axp-next' of git://repo.or.cz/qemu/rth

* 'axp-next' of git://repo.or.cz/qemu/rth:
  alpha-linux-user: Fix the getpriority syscall
  alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
  alpha-linux-user: Fix a3 error return with v0 error bypass.
  linux-user: Translate pipe2 flags; add to strace
  linux-user: Allocate the right amount of space for non-fixed file maps
  linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
  linux-user: Sync fcntl.h bits with the kernel
  alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
  alpha-linux-user: Work around hosted mmap allocation problems
  alpha-linux-user: Fix signal handling

11 years agoalpha-linux-user: Fix the getpriority syscall
Richard Henderson [Thu, 7 Jun 2012 22:14:50 +0000 (15:14 -0700)]
alpha-linux-user: Fix the getpriority syscall

Alpha uses unbiased priority values in the syscall, with the a3
return value signaling error conditions.  Therefore, properly
interpret the libc getpriority as needed for the guest rather
than passing the host value through unchanged.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoalpha-linux-user: Properly handle the non-rt sigprocmask syscall.
Richard Henderson [Thu, 7 Jun 2012 22:02:49 +0000 (15:02 -0700)]
alpha-linux-user: Properly handle the non-rt sigprocmask syscall.

Name the syscall properly for QEMU, kernel source notwithstanding.
Fix syntax errors in the code thus enabled within do_syscall.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoalpha-linux-user: Fix a3 error return with v0 error bypass.
Richard Henderson [Thu, 7 Jun 2012 21:47:41 +0000 (14:47 -0700)]
alpha-linux-user: Fix a3 error return with v0 error bypass.

We were failing to initialize a3 for syscalls that bypass the
negative return value error check.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agolinux-user: Translate pipe2 flags; add to strace
Richard Henderson [Sat, 2 Jun 2012 01:48:39 +0000 (18:48 -0700)]
linux-user: Translate pipe2 flags; add to strace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agolinux-user: Allocate the right amount of space for non-fixed file maps
Richard Henderson [Fri, 1 Jun 2012 23:07:52 +0000 (16:07 -0700)]
linux-user: Allocate the right amount of space for non-fixed file maps

If we let the kernel handle the implementation of mmap_find_vma,
via an anon mmap, we must use the size as indicated by the user
and not the size truncated to the filesize.

This happens often in ld.so, where we initially mmap the file to
the size of the text+data+bss to reserve an area, then mmap+fixed
over the top to properly handle data and bss.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agolinux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
Richard Henderson [Wed, 25 Jul 2012 21:30:34 +0000 (14:30 -0700)]
linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agolinux-user: Sync fcntl.h bits with the kernel
Richard Henderson [Wed, 25 Jul 2012 21:29:31 +0000 (14:29 -0700)]
linux-user: Sync fcntl.h bits with the kernel

For each target, only define the bits that appear in
arch/target/include/asm/fcntl.h.  Mirror the kernel's
asm-generic layout by handling anything undefined afterward.

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoalpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
Richard Henderson [Fri, 1 Jun 2012 16:08:21 +0000 (09:08 -0700)]
alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly

We weren't aggregating the exceptions, nor raising signals properly.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoalpha-linux-user: Work around hosted mmap allocation problems
Richard Henderson [Thu, 31 May 2012 23:09:39 +0000 (16:09 -0700)]
alpha-linux-user: Work around hosted mmap allocation problems

Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoalpha-linux-user: Fix signal handling
Richard Henderson [Thu, 31 May 2012 19:05:23 +0000 (12:05 -0700)]
alpha-linux-user: Fix signal handling

Proper signal numbers were not defined, and EXCP_INTERRUPT
was unhandled, leading to all sorts of subtle confusion.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agobitops: drop volatile qualifier
Blue Swirl [Sun, 8 Jul 2012 19:03:33 +0000 (19:03 +0000)]
bitops: drop volatile qualifier

Qualifier 'volatile' is not useful for applications, it's too strict
for single threaded code but does not give the real atomicity guarantees
needed for multithreaded code.

Drop them and now useless casts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix set-but-not-used warning in Xen 4.1 probe
Peter Maydell [Thu, 2 Aug 2012 17:30:27 +0000 (18:30 +0100)]
configure: Fix set-but-not-used warning in Xen 4.1 probe

The Xen 4.1 probe never uses the return value from xc_interface_open(),
so was provoking a compiler warning on newer gcc. Fix by not bothering
to put the return value anywhere.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Don't run Xen compile checks in subshells
Peter Maydell [Thu, 2 Aug 2012 17:30:26 +0000 (18:30 +0100)]
configure: Don't run Xen compile checks in subshells

The Xen compile checks are currently run inside subshells. This
is unnecessary and has the effect that if do_cc() exits with
an error message then this only causes the subshell to exit,
not the whole of configure, which is confusing. Remove the
subshells, changing:
  if ( cat ; compile_prog ) ; then ...
to
  if cat && compile_prog ; then ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoFixes related to processing of qemu's -numa option
Chegu Vinod [Tue, 17 Jul 2012 04:31:30 +0000 (21:31 -0700)]
Fixes related to processing of qemu's -numa option

The -numa option to qemu is used to create [fake] numa nodes
and expose them to the guest OS instance.

There are a couple of issues with the -numa option:

a) Max VCPU's that can be specified for a guest while using
   the qemu's -numa option is 64. Due to a typecasting issue
   when the number of VCPUs is > 32 the VCPUs don't show up
   under the specified [fake] numa nodes.

b) KVM currently has support for 160VCPUs per guest. The
   qemu's -numa option has only support for upto 64VCPUs
   per guest.
This patch addresses these two issues.

Below are examples of (a) and (b)

a) >32 VCPUs are specified with the -numa option:

/usr/local/bin/qemu-system-x86_64 \
-enable-kvm \
71:01:01 \
-net tap,ifname=tap0,script=no,downscript=no \
-vnc :4

...
Upstream qemu :
--------------

QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
6 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 32 33 34 35 36 37 38 39 40 41
node 0 size: 131072 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19 42 43 44 45 46 47 48 49 50 51
node 1 size: 131072 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29 52 53 54 55 56 57 58 59
node 2 size: 131072 MB
node 3 cpus: 30
node 3 size: 131072 MB
node 4 cpus:
node 4 size: 131072 MB
node 5 cpus: 31
node 5 size: 131072 MB

With the patch applied :
-----------------------

QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
6 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8 9
node 0 size: 131072 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19
node 1 size: 131072 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29
node 2 size: 131072 MB
node 3 cpus: 30 31 32 33 34 35 36 37 38 39
node 3 size: 131072 MB
node 4 cpus: 40 41 42 43 44 45 46 47 48 49
node 4 size: 131072 MB
node 5 cpus: 50 51 52 53 54 55 56 57 58 59
node 5 size: 131072 MB

b) >64 VCPUs specified with -numa option:

/usr/local/bin/qemu-system-x86_64 \
-enable-kvm \
-cpu Westmere,+rdtscp,+pdpe1gb,+dca,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+d-vnc :4

...

Upstream qemu :
--------------

only 63 CPUs in NUMA mode supported.
only 64 CPUs in NUMA mode supported.
QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
8 nodes
node 0 cpus: 6 7 8 9 38 39 40 41 70 71 72 73
node 0 size: 65536 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19 42 43 44 45 46 47 48 49 50 51 74 75 76 77 78 79
node 1 size: 65536 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29 52 53 54 55 56 57 58 59 60 61
node 2 size: 65536 MB
node 3 cpus: 30 62
node 3 size: 65536 MB
node 4 cpus:
node 4 size: 65536 MB
node 5 cpus:
node 5 size: 65536 MB
node 6 cpus: 31 63
node 6 size: 65536 MB
node 7 cpus: 0 1 2 3 4 5 32 33 34 35 36 37 64 65 66 67 68 69
node 7 size: 65536 MB

With the patch applied :
-----------------------

QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
8 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8 9
node 0 size: 65536 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19
node 1 size: 65536 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29
node 2 size: 65536 MB
node 3 cpus: 30 31 32 33 34 35 36 37 38 39
node 3 size: 65536 MB
node 4 cpus: 40 41 42 43 44 45 46 47 48 49
node 4 size: 65536 MB
node 5 cpus: 50 51 52 53 54 55 56 57 58 59
node 5 size: 65536 MB
node 6 cpus: 60 61 62 63 64 65 66 67 68 69
node 6 size: 65536 MB
node 7 cpus: 70 71 72 73 74 75 76 77 78 79

Signed-off-by: Chegu Vinod <chegu_vinod@hp.com>, Jim Hull <jim.hull@hp.com>, Craig Hada <craig.hada@hp.com>
Tested-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agobuild: Fix build breakage detected by buildbot
Dunrong Huang [Sat, 4 Aug 2012 11:29:55 +0000 (19:29 +0800)]
build: Fix build breakage detected by buildbot

More details:
http://buildbot.b1-systems.de/qemu/builders/xen_unstable/builds/83/steps/compile/logs/stdio

VLANState has been removed since commit a005d07, so "vlan id" should be
fetched using net_hub_id_for_client().

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agofips: fix build on !Linux
Anthony Liguori [Fri, 3 Aug 2012 23:28:37 +0000 (18:28 -0500)]
fips: fix build on !Linux

Commit 0f66998 makes -enable-fips conditional on Linux hosts but then uses it
unconditionally in vl.c.

Fix this by moving the fips handling to os-posix.c and adding a condition.

Cc: Paul Moore <pmoore@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoslirp: Handle whole 127.0.0.0/8 network as local addresses.
Anders Waldenborg [Fri, 13 Jul 2012 20:54:17 +0000 (22:54 +0200)]
slirp: Handle whole 127.0.0.0/8 network as local addresses.

Changes so translation of remote address to the host's ip address in
the virtual network happens for all addresses in the 127.0.0.0/8
network, not just 127.0.0.1.

This fixes so that hostfwd bound to addresses such as 127.0.0.2 works.

Signed-off-by: Anders Waldenborg <anders@0x63.nu>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Fri, 3 Aug 2012 20:46:17 +0000 (15:46 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi: add support for ATA_PASSTHROUGH_xx scsi command
  esp: add missing const on TypeInfo structures
  esp: enable for all PCI machines
  Revert "megasas: disable due to build breakage"
  megasas: static SAS addresses
  scsi-disk: fix compilation with DEBUG_SCSI
  megasas: Update function megasys_scsi_uninit
  SCSI: STARTSTOPUNIT only eject/load media if powercondition is 0
  SCSI: Update the sense code for PREVENT REMOVAL errors

11 years agoscsi: add support for ATA_PASSTHROUGH_xx scsi command
Cong Meng [Fri, 3 Aug 2012 04:02:19 +0000 (12:02 +0800)]
scsi: add support for ATA_PASSTHROUGH_xx scsi command

Correct the command names of opcode 0x85 and 0xa1, and calculate
their xfer size from CDB.

Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agovnc: disable VNC password authentication (security type 2) when in FIPS mode
Paul Moore [Fri, 3 Aug 2012 18:39:21 +0000 (14:39 -0400)]
vnc: disable VNC password authentication (security type 2) when in FIPS mode

FIPS 140-2 requires disabling certain ciphers, including DES, which is used
by VNC to obscure passwords when they are sent over the network.  The
solution for FIPS users is to disable the use of VNC password auth when the
host system is operating in FIPS compliance mode and the user has specified
'-enable-fips' on the QEMU command line.

This patch causes QEMU to emit a message to stderr when the host system is
running in FIPS mode and a VNC password was specified on the commend line.
If the system is not running in FIPS mode, or is running in FIPS mode but
VNC password authentication was not requested, QEMU operates normally.

Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Fri, 3 Aug 2012 19:28:26 +0000 (14:28 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  hmp: show the backing file depth
  block: Use bdrv_get_backing_file_depth()
  block: create bdrv_get_backing_file_depth()
  qapi: qapi.py: allow the "'" character to be escaped

11 years agoMerge remote-tracking branch 'afaerber-or/qom-cpu-4' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:56:39 +0000 (13:56 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-cpu-4' into staging

* afaerber-or/qom-cpu-4:
  cpu: Move thread_kicked to CPUState
  cpu: Move thread field into CPUState
  cpu: Move CPU_COMMON_THREAD into CPUState
  qemu-thread: Let qemu_thread_is_self() return bool

11 years agoMerge remote-tracking branch 'sstabellini/xen-fixes-20120801' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:54:35 +0000 (13:54 -0500)]
Merge remote-tracking branch 'sstabellini/xen-fixes-20120801' into staging

* sstabellini/xen-fixes-20120801:
  fix Xen compilation
  configure: Fix xen probe with Xen 4.2 and later

11 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:54:05 +0000 (13:54 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

* stefanha/net:
  net: add the support for -netdev socket, listen
  net: fix the coding style
  hub: add the support for hub own flow control
  net: determine if packets can be sent before net queue deliver packets
  net: cleanup deliver/deliver_iov func pointers
  net: Make "info network" output more readable info
  net: Rename qemu_del_vlan_client() to qemu_del_net_client()
  net: Rename vc local variables to nc
  net: Rename VLANClientState to NetClientState
  net: Rename non_vlan_clients to net_clients
  net: Remove VLANState
  net: Remove vlan code from net.c
  net: Convert qdev_prop_vlan to peer with hub
  net: Drop vlan argument to qemu_new_net_client()
  hub: Check that hubs are configured correctly
  net: Look up 'vlan' net clients using hubs
  net: Use hubs for the vlan feature
  net: Add a hub net client
  net: Add interface to bridge when SIOCBRADDIF isn't available

11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:51:19 +0000 (13:51 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  exec.c: Remove out of date comment
  exec.c: Use subpages for large unaligned mappings
  exec.c: Fix off-by-one error in register_subpage
  socket: clean up redundant assignment
  qom: Clean libuser object and dependency files
  usb: Clean common object and dependency files

11 years agoMerge remote-tracking branch 'aneesh/for-upstream' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:50:41 +0000 (13:50 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream' into staging

* aneesh/for-upstream:
  hw/9pfs: Fix assert when disabling migration
  configure: Fix build with capabilities

11 years agoexec.c: Remove out of date comment
Peter Maydell [Wed, 1 Aug 2012 13:35:47 +0000 (14:35 +0100)]
exec.c: Remove out of date comment

Remove an out of date comment: this comment used to be attached to
cpu_register_physical_memory_log(), before commit 0f0cb164 accidentally
inserted a couple of other functions between the comment and its function.
It is in any case obsolete since (a) the function arguments it refers
to have been replaced with a single MemoryRegionSection* argument and
(b) the inability to handle regions whose offset_within_address_space
and offset_within_region aren't equally aligned was fixed as part of
the rewrite of this code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoexec.c: Use subpages for large unaligned mappings
Tyler Hall [Wed, 25 Jul 2012 22:45:04 +0000 (18:45 -0400)]
exec.c: Use subpages for large unaligned mappings

Registering a multi-page memory region that is non-page-aligned results
in a subpage from the start to the page boundary, some number of full
pages, and possibly another subpage from the last page boundary to the
end. The full pages will have a value for offset_within_region that is
not a multiple of TARGET_PAGE_SIZE. Accesses through softmmu are unable
to handle this and will segfault.

Handling full pages through subpages is not optimal, but only
non-page-aligned mappings take the penalty.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoexec.c: Fix off-by-one error in register_subpage
Tyler Hall [Wed, 25 Jul 2012 22:45:03 +0000 (18:45 -0400)]
exec.c: Fix off-by-one error in register_subpage

subpage_register() expects "end" to be the last byte in the mapping.
Registering a non-page-aligned memory region that extends up to or
beyond a page boundary causes subpage_register() to silently fail
through the (end >= PAGE_SIZE) check.

This bug does not cause noticeable problems for mappings that do not
extend to a page boundary, though they do register an extra byte.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agosocket: clean up redundant assignment
Amos Kong [Fri, 3 Aug 2012 03:06:22 +0000 (11:06 +0800)]
socket: clean up redundant assignment

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agohmp: show the backing file depth
Benoît Canet [Thu, 2 Aug 2012 08:22:49 +0000 (10:22 +0200)]
hmp: show the backing file depth

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoblock: Use bdrv_get_backing_file_depth()
Benoît Canet [Thu, 2 Aug 2012 08:22:48 +0000 (10:22 +0200)]
block: Use bdrv_get_backing_file_depth()

Use the dedicated counting function in qmp_query_block in order to
propagate the backing file depth to HMP and add backing_file_depth
to qmp-commands.hx

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoblock: create bdrv_get_backing_file_depth()
Benoît Canet [Thu, 2 Aug 2012 08:22:47 +0000 (10:22 +0200)]
block: create bdrv_get_backing_file_depth()

Create bdrv_get_backing_file_depth() in order to be able to show
in QMP and HMP how many ancestors backing an image a block device
have.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqom: Clean libuser object and dependency files
Jan Kiszka [Mon, 23 Jul 2012 11:45:01 +0000 (13:45 +0200)]
qom: Clean libuser object and dependency files

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agousb: Clean common object and dependency files
Jan Kiszka [Mon, 23 Jul 2012 11:44:35 +0000 (13:44 +0200)]
usb: Clean common object and dependency files

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoesp: add missing const on TypeInfo structures
Hervé Poussineau [Thu, 2 Aug 2012 08:40:30 +0000 (10:40 +0200)]
esp: add missing const on TypeInfo structures

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoesp: enable for all PCI machines
Paolo Bonzini [Thu, 2 Aug 2012 13:41:47 +0000 (15:41 +0200)]
esp: enable for all PCI machines

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoRevert "megasas: disable due to build breakage"
Paolo Bonzini [Wed, 1 Aug 2012 10:56:17 +0000 (12:56 +0200)]
Revert "megasas: disable due to build breakage"

This reverts commit 92336855975805d88c7979f53bc05c2d47abab04.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomegasas: static SAS addresses
Hannes Reinecke [Wed, 1 Aug 2012 10:46:50 +0000 (12:46 +0200)]
megasas: static SAS addresses

This patch introduces a new property 'sas_address' which
allows the user to specify the SAS address for the HBA.
The default address is following the NAA locally assigned
identifier format with the locally assigned address
0x525400 as used eg for the MAC addresses.
The lower bytes are set to the pci address which
will ensure uniqueness for the local machine.

The port addresses are now calculated based on the magic
number 0x1221 (which is found in real hardware, too) plus
the device number.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andreas Faerber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi-disk: fix compilation with DEBUG_SCSI
Paolo Bonzini [Tue, 31 Jul 2012 14:10:23 +0000 (16:10 +0200)]
scsi-disk: fix compilation with DEBUG_SCSI

Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomegasas: Update function megasys_scsi_uninit
Stefan Weil [Tue, 31 Jul 2012 05:54:57 +0000 (07:54 +0200)]
megasas: Update function megasys_scsi_uninit

Commit f90c2bcdbc69e41e575f868b984c3e2de8f51bac changed
PCIUnregisterFunc, therefore the function prototype
needs an update.

megasas.o is currently not linked, so this bug was not
detected by the buildbots.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoSCSI: STARTSTOPUNIT only eject/load media if powercondition is 0
Ronnie Sahlberg [Sat, 28 Jul 2012 01:14:53 +0000 (11:14 +1000)]
SCSI: STARTSTOPUNIT only eject/load media if powercondition is 0

The START STOP UNIT command will only eject/load media if
power condition is zero.

If power condition is !0 then LOEJ and START will be ignored.

From MMC (sbc contains similar wordings too)
  The Power Conditions field requests the block device to be placed
  in the power condition defined in
  Table 558. If this field has a value other than 0h then the Start
  and LoEj bits shall be ignored.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoSCSI: Update the sense code for PREVENT REMOVAL errors
Ronnie Sahlberg [Sun, 29 Jul 2012 21:52:03 +0000 (07:52 +1000)]
SCSI: Update the sense code for PREVENT REMOVAL errors

Change the sense codes for failures to eject a device that is locked
by PREVENT_ALLOW_MEDIUM_REMOVAL from
the generic MEDIA_LOAD_OR_EJECT_FAILED to the more specific
MEDIUM_REMOVAL_PREVENTED.

The second sense code is more accurate, and is also listed in MMC annex F
for the recommended sense codes for MMC devices while the first sense code is not.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoSupport 'help' as a synonym for '?' in command line options
Peter Maydell [Thu, 2 Aug 2012 12:45:54 +0000 (13:45 +0100)]
Support 'help' as a synonym for '?' in command line options

For command line options which permit '?' meaning 'please list the
permitted values', add support for 'help' as a synonym, by abstracting
the check out into a helper function.

This change means that in some cases where we were being lazy in
our string parsing, "?junk" will now be rejected as an invalid option
rather than being (undocumentedly) treated the same way as "?".

Update the documentation to use 'help' rather than '?', since '?'
is a shell metacharacter and thus prone to fail confusingly if there
is a single character filename in the current working directory and
the '?' has not been escaped. It's therefore better to steer users
towards 'help', though '?' is retained for backwards compatibility.

We do not, however, update the output of the system emulator's -help
(or any documentation autogenerated from the qemu-options.hx which
is the source of the -help text) because libvirt parses our -help
output and will break. At a later date when QEMU provides a better
interface so libvirt can avoid having to do this, we can update the
-help text too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocpu: Move thread_kicked to CPUState
Andreas Färber [Wed, 2 May 2012 15:49:49 +0000 (17:49 +0200)]
cpu: Move thread_kicked to CPUState

Change field type to bool.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agocpu: Move thread field into CPUState
Andreas Färber [Wed, 2 May 2012 15:00:37 +0000 (17:00 +0200)]
cpu: Move thread field into CPUState

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agocpu: Move CPU_COMMON_THREAD into CPUState
Andreas Färber [Wed, 2 May 2012 13:24:40 +0000 (15:24 +0200)]
cpu: Move CPU_COMMON_THREAD into CPUState

CPU_COMMON_THREAD was only used for Windows, adding an hThread field
to CPU_COMMON.

Move the field into QOM CPUState and change its type to HANDLE,
which it is assigned from. This requires Windows headers, pulled in
through qemu-thread.h.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqemu-thread: Let qemu_thread_is_self() return bool
Andreas Färber [Wed, 2 May 2012 15:21:31 +0000 (17:21 +0200)]
qemu-thread: Let qemu_thread_is_self() return bool

qemu_cpu_is_self(), passing the return value through, will later be
adapted to return bool as well.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
11 years agoqapi: qapi.py: allow the "'" character to be escaped
Luiz Capitulino [Fri, 29 Jun 2012 23:53:37 +0000 (20:53 -0300)]
qapi: qapi.py: allow the "'" character to be escaped

Support escaping the escape character, and make more robust (don't die
for '', handle ' without matching '.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoReplace 'struct siginfo' with 'siginfo_t'.
Richard W.M. Jones [Thu, 5 Jul 2012 03:32:44 +0000 (03:32 +0000)]
Replace 'struct siginfo' with 'siginfo_t'.

glibc 2.16 will remove the undocumented definition of 'struct siginfo'
from <bits/siginfo.h>.

This change is already present in glibc 2.15.90, so qemu compilation
of certain targets (eg. cris-user) breaks.

This struct was always typedef'd to be the same as 'siginfo_t' which
is what POSIX documents, so use that instead.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-i386: move cpu_reset and reset callback to cpu.c
Igor Mammedov [Mon, 23 Jul 2012 13:22:28 +0000 (15:22 +0200)]
target-i386: move cpu_reset and reset callback to cpu.c

Moving reset callback into cpu object from board level and
resetting cpu at the end of x86_cpu_realize() will allow properly
create cpu object during run-time (hotplug) without calling reset externaly.

When reset over QOM hierarchy is implemented, reset callback
should be removed.

v2:
  - leave cpu_reset in pc_new_cpu() for now, it's to be cleaned up when APIC
    init is moved in cpu.c

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-i386: move cpu halted decision into x86_cpu_reset
Igor Mammedov [Mon, 23 Jul 2012 13:22:27 +0000 (15:22 +0200)]
target-i386: move cpu halted decision into x86_cpu_reset

MP initialization protocol differs between cpu families, and for P6 and
onward models it is up to CPU to decide if it will be BSP using this
protocol, so try to model this. However there is no point in implementing
MP initialization protocol in qemu. Thus first CPU is always marked as BSP.

This patch:
 - moves decision to designate BSP from board into cpu, making cpu
self-sufficient in this regard. Later it will allow to cleanup hw/pc.c
and remove cpu_reset and wrappers from there.
 - stores flag that CPU is BSP in IA32_APIC_BASE to model behavior
described in Inted SDM vol 3a part 1 chapter 8.4.1
 - uses MSR_IA32_APICBASE_BSP flag in apic_base for checking if cpu is BSP

patch is based on Jan Kiszka's proposal:
    http://thread.gmane.org/gmane.comp.emulators.qemu/100806

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agofix Xen compilation
Stefano Stabellini [Wed, 1 Aug 2012 13:44:11 +0000 (13:44 +0000)]
fix Xen compilation

xen_pt_unregister_device is used as PCIUnregisterFunc, so it should
match the type.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Andreas Färber <afaerber@suse.de>
11 years agofix Xen compilation
Stefano Stabellini [Wed, 1 Aug 2012 10:19:09 +0000 (11:19 +0100)]
fix Xen compilation

xen_pt_unregister_device is used as PCIUnregisterFunc, so it should
match the type.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Fix xen probe with Xen 4.2 and later
Anthony PERARD [Wed, 1 Aug 2012 13:42:44 +0000 (13:42 +0000)]
configure: Fix xen probe with Xen 4.2 and later

The xs.h header is now deprecated and produces a warning. This prevents the
configure script from enabling Xen with xen-unstable whom will become 4.2. As
this header is not anymore common to every version of Xen, we just remove it
from the early probe for Xen.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agonet: add the support for -netdev socket, listen
Zhi Yong Wu [Fri, 20 Jul 2012 13:25:53 +0000 (14:25 +0100)]
net: add the support for -netdev socket, listen

The -net socket,listen option does not work with the newer -netdev
syntax:
 http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01508.html

This patch makes it work now.

For the case where one vlan has multiple listenning sockets,
the patch will also provide the support.

Supported syntax:
 1.) -net socket,listen=127.0.0.1:1234,vlan=0
 2.) -net socket,listen=127.0.0.1:1234,vlan=0 -net socket,listen=127.0.0.1:1235,vlan=0
 3.) -netdev socket,listen=127.0.0.1:1234,id=socket0

 Drop the NetSocketListenState struct and add a listen_fd field
to NetSocketState.  When a -netdev socket,listen= instance is created
there will be a NetSocketState with fd=-1 and a valid listen_fd.  The
net_socket_accept() handler waits for listen_fd to become readable and
then accepts the connection.  When this state transition happens, we no
longer monitor listen_fd for incoming connections...until the client
disconnects again.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: fix the coding style
Zhi Yong Wu [Fri, 20 Jul 2012 13:25:52 +0000 (14:25 +0100)]
net: fix the coding style

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agohub: add the support for hub own flow control
Zhi Yong Wu [Tue, 24 Jul 2012 15:35:19 +0000 (16:35 +0100)]
hub: add the support for hub own flow control

Only when all other hub port's *peer* .can_receive() all return 1,
the source hub port .can_receive() return 1.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: determine if packets can be sent before net queue deliver packets
Zhi Yong Wu [Tue, 24 Jul 2012 15:35:18 +0000 (16:35 +0100)]
net: determine if packets can be sent before net queue deliver packets

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: cleanup deliver/deliver_iov func pointers
Zhi Yong Wu [Tue, 24 Jul 2012 15:35:17 +0000 (16:35 +0100)]
net: cleanup deliver/deliver_iov func pointers

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Make "info network" output more readable info
Zhi Yong Wu [Tue, 24 Jul 2012 15:35:16 +0000 (16:35 +0100)]
net: Make "info network" output more readable info

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Rename qemu_del_vlan_client() to qemu_del_net_client()
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:15 +0000 (16:35 +0100)]
net: Rename qemu_del_vlan_client() to qemu_del_net_client()

Another step in moving the vlan feature out of net core.  Users only
deal with NetClientState and therefore qemu_del_vlan_client() should be
named qemu_del_net_client().

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Rename vc local variables to nc
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:14 +0000 (16:35 +0100)]
net: Rename vc local variables to nc

Now that VLANClientState has been renamed to NetClientState all 'vc'
local variables should be 'nc'.  Much of the code already used 'nc' but
there are places where 'vc' needs to be renamed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Rename VLANClientState to NetClientState
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:13 +0000 (16:35 +0100)]
net: Rename VLANClientState to NetClientState

The vlan feature is no longer part of net core.  Rename VLANClientState
to NetClientState because net clients are not explicitly associated with
a vlan at all, instead they have a peer net client to which they are
connected.

This patch is a mechanical search-and-replace except for a few
whitespace fixups where changing VLANClientState to NetClientState
misaligned whitespace.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Rename non_vlan_clients to net_clients
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:12 +0000 (16:35 +0100)]
net: Rename non_vlan_clients to net_clients

There is no longer a distinction between vlan clients and non-vlan
clients in the net core.  The net core only knows about point-to-point
clients which are connected to a peer.  It's time to rename the global
list of net clients since it no longer refers to vlans at all.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Remove VLANState
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:11 +0000 (16:35 +0100)]
net: Remove VLANState

VLANState is no longer used and can be removed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Remove vlan code from net.c
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:10 +0000 (16:35 +0100)]
net: Remove vlan code from net.c

The vlan implementation in net.c has been replaced by hubs so we can
remove the code.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Convert qdev_prop_vlan to peer with hub
Zhi Yong Wu [Tue, 24 Jul 2012 15:35:09 +0000 (16:35 +0100)]
net: Convert qdev_prop_vlan to peer with hub

Instead of using VLANState use net/hub.h to support the vlan qdev
property.  The vlan qdev property becomes an alias for the peer qdev
property but is represented as a VLAN ID number.  When a VLAN ID is
selected the device will really peer with a hub port.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Drop vlan argument to qemu_new_net_client()
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:08 +0000 (16:35 +0100)]
net: Drop vlan argument to qemu_new_net_client()

Since hubs are now used to implement the 'vlan' feature and the vlan
argument is always NULL, remove the argument entirely and update all net
clients that use qemu_new_net_client().

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agohub: Check that hubs are configured correctly
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:07 +0000 (16:35 +0100)]
hub: Check that hubs are configured correctly

Checks can be performed to make sure that hubs have at least one NIC and
one host device, warning the user if this is not the case.
Configurations which do not meet this rule tend to be broken but just
emit a warning.  This patch preserves compatibility with the checks
performed by net core on vlans.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Look up 'vlan' net clients using hubs
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:06 +0000 (16:35 +0100)]
net: Look up 'vlan' net clients using hubs

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Use hubs for the vlan feature
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:05 +0000 (16:35 +0100)]
net: Use hubs for the vlan feature

Stop using the special-case vlan code in net.c.  Instead use the hub net
client to implement the vlan feature.  The next patch will remove vlan
code from net.c completely.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Add a hub net client
Stefan Hajnoczi [Tue, 24 Jul 2012 15:35:04 +0000 (16:35 +0100)]
net: Add a hub net client

The vlan feature can be implemented in terms of hubs.  By introducing a
hub net client it becomes possible to remove the special case vlan code
from net.c and push the vlan feature out of generic networking code.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
11 years agonet: Add interface to bridge when SIOCBRADDIF isn't available
Corey Bryant [Thu, 12 Jul 2012 13:24:31 +0000 (09:24 -0400)]
net: Add interface to bridge when SIOCBRADDIF isn't available

The bridge helper uses the SIOCBRADDIF ioctl to add an inteface to
a bridge.  SIOCBRADDIF is not available on old Linux versions.  This
patch adds support to use the SIOCDEVPRIVATE ioctl with BRCTL_ADD_IF
if SIOCBRADDIF is not available.

Reported-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
11 years agoconfigure: -I\$(SRC_PATH) goes in QEMU_INCLUDES not QEMU_CFLAGS
Peter Maydell [Wed, 18 Jul 2012 14:10:27 +0000 (15:10 +0100)]
configure: -I\$(SRC_PATH) goes in QEMU_INCLUDES not QEMU_CFLAGS

If the smartcard configure check passes, add '-I\$(SRC_PATH)/libcacard'
to QEMU_INCLUDES, not QEMU_CFLAGS. Otherwise the unexpanded SRC_PATH
will cause a warning in every following configure test.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix compile warning in utimensat/futimens test
Peter Maydell [Wed, 18 Jul 2012 14:10:26 +0000 (15:10 +0100)]
configure: Fix compile warning in utimensat/futimens test

Fix compile warning in the utimensat/futimens test ("implicit
declaration of function 'utimensat'", ditto futimens) by
adding a missing include.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix warnings in VDE library probe
Peter Maydell [Wed, 18 Jul 2012 14:10:25 +0000 (15:10 +0100)]
configure: Fix warnings in VDE library probe

Fix compile warnings in the VDE library probe ("passing argument 1 of
'vde_open_real' discards 'const' qualifier from pointer target type",
ditto argument 2).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix compile warning in PNG test
Peter Maydell [Wed, 18 Jul 2012 14:10:24 +0000 (15:10 +0100)]
configure: Fix compile warning in PNG test

Fix compile warning (variable 'png_ptr' set but not used) in the
PNG detection test code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix errors in test for__sync_fetch_and_and
Stefan Weil [Wed, 18 Jul 2012 14:10:23 +0000 (15:10 +0100)]
configure: Fix errors in test for__sync_fetch_and_and

The old test code raises two compiler warnings which are errors since
commit 417c9d72d48275d19c60861896efd4962d21aca2.

These errors could result in compilations with compiler flag
-march486 (so all nice features of newer processors got lost).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: -march=i486 belongs in QEMU_CFLAGS, not CFLAGS
Peter Maydell [Wed, 18 Jul 2012 14:10:22 +0000 (15:10 +0100)]
configure: -march=i486 belongs in QEMU_CFLAGS, not CFLAGS

The distinction between QEMU_CFLAGS and CFLAGS is that the
former is for flags without which QEMU can't compile, whereas
the latter is for flags like "-g -O2" which the user can
safely override. "-march=i486" is in the former category, and
so belongs in QEMU_CFLAGS.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Replace bash code by standard shell code
Stefan Weil [Wed, 18 Jul 2012 14:10:21 +0000 (15:10 +0100)]
configure: Replace bash code by standard shell code

"+=" does not work with dash and other simple /bin/sh implementations.

The new code prepends the flag while the old code either did not work
(it continued after an error message which typically was not read) or
appended the flag. That difference should not matter here.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix build with capabilities
Stefan Weil [Wed, 18 Jul 2012 14:10:20 +0000 (15:10 +0100)]
configure: Fix build with capabilities

Since commit 417c9d72d48275d19c60861896efd4962d21aca2 all configure tests
normally run with -Werror. Some of these tests now fail because they
raised a compiler warning.

This patch fixes support for capabilities.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Fix build with ALSA audio driver
Stefan Weil [Wed, 18 Jul 2012 14:10:19 +0000 (15:10 +0100)]
configure: Fix build with ALSA audio driver

Since commit 417c9d72d48275d19c60861896efd4962d21aca2,
all configure tests normally run with -Werror.

Some of these tests now fail because they raised a compiler warning.

Here a build breakage for ALSA (configure --audio-drv-list=alsa) is fixed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Don't run configure tests with -Werror enabled
Peter Maydell [Wed, 18 Jul 2012 14:10:18 +0000 (15:10 +0100)]
configure: Don't run configure tests with -Werror enabled

Don't run configure tests with -Werror in the compiler flags. The idea
of -Werror is that it makes problems very obvious to developers, so
they get fixed quickly. However, when running configure tests, failures
due to -Werror are far from obvious -- they simply result in the test
quietly failing when it should have passed. Not using -Werror is in
line with recommended practice in the Autoconf world.

This commit is essentially backing out the changes in commit 417c9d72.
Instead we fix the problem that commit was trying to address in a
different way: we add -Werror only for the test of the nss headers,
with a comment that this is specifically intended to detect a bug
in some releases of nss.

We also have to clean up a bug in the smartcard test where it was
trying to include smartcard_cflags in the test compile flags: this
would always result in a failure with -Werror, because they include
an escaped "$(SRC_PATH)" which is only valid when used in the final
makefile.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoconfigure: Split valgrind test into pragma test and valgrind.h test
Peter Maydell [Mon, 30 Jul 2012 15:13:07 +0000 (16:13 +0100)]
configure: Split valgrind test into pragma test and valgrind.h test

Split the configure test that checks for valgrind into two, one
part checking whether we have the gcc pragma to disable unused-but-set
variables, and the other part checking for the existence of valgrind.h.
The first of these has to be compiled with -Werror and the second
does not and shouldn't generate any warnings.

This (a) allows us to enable "make errors in configure tests be
build failures" and (b) enables use of valgrind on systems with
a gcc which doesn't know about -Wunused-but-set-varibale, like
Debian squeeze.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agohw/9pfs: Fix assert when disabling migration
Aneesh Kumar K.V [Tue, 31 Jul 2012 07:23:18 +0000 (12:53 +0530)]
hw/9pfs: Fix assert when disabling migration

For 9p we can get the attach request multiple times for the
same export. So don't adding migration blocker for every
attach request.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
11 years agoconfigure: Fix build with capabilities
Stefan Weil [Wed, 18 Jul 2012 14:10:20 +0000 (15:10 +0100)]
configure: Fix build with capabilities

Since commit 417c9d72d48275d19c60861896efd4962d21aca2 all configure tests
normally run with -Werror. Some of these tests now fail because they
raised a compiler warning.

This patch fixes support for capabilities.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 30 Jul 2012 15:00:48 +0000 (10:00 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  msi/msix: added API to set MSI message address and data
  pci: Add INTx routing notifier
  pci: Add pci_device_route_intx_to_irq
  pci: Unregister BARs before device exit
  pci: convert PCIUnregisterFunc to void
  msix: Switch msix_uninit to return void
  msix: Allow full specification of MSIX layout
  msix: Split PBA into it's own MemoryRegion
  msix: Note endian TODO item
  msix: Move msix_mmio_read
  virtio: Convert to msix_init_exclusive_bar() interface
  ivshmem: Convert to msix_init_exclusive_bar() interface
  msix: Add simple BAR allocation MSIX setup functions
  msix: fix PCIDevice naming inconsistency
  msix: drop unused msix_bar_size, require valid bar_size

11 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Mon, 30 Jul 2012 14:59:38 +0000 (09:59 -0500)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

* bonzini/nbd-next:
  qemu-nbd: add --cache and --aio options
  qemu-nbd: reorganize help message

11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Mon, 30 Jul 2012 14:59:23 +0000 (09:59 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next: (32 commits)
  virtio-scsi: enable MSI-X support
  virtio-scsi: add ioeventfd support
  virtio-scsi: report parameter change events
  virtio-scsi: do not report dropped events after reset
  virtio-scsi: Report missed events
  virtio-scsi: Implement hotplug support for virtio-scsi
  scsi: report parameter changes to HBA drivers
  scsi-disk: report resized disk via sense codes
  scsi: establish precedence levels for unit attention
  scsi: introduce hotplug() and hot_unplug() interfaces for SCSI bus
  scsi: add tracepoint for scsi_req_cancel
  scsi-disk: removable hard disks support load/eject
  scsi-disk: Fail medium writes with proper sense for readonly LUNs
  scsi-disk: improve the lba-out-of-range tests for read/write/verify
  scsi-disk: rd/wr/vr-protect !=0 is an error
  scsi-disk: support toggling the write cache
  scsi-disk: parse MODE SELECT commands and parameters
  scsi-disk: fix changeable values for MODE_PAGE_R_W_ERROR
  scsi-disk: adjust offsets in MODE SENSE by 2
  scsi-disk: support emulated TO_DEV requests
  ...

11 years agoMerge commit 'quintela/migration-next-v5' into staging
Anthony Liguori [Mon, 30 Jul 2012 14:58:41 +0000 (09:58 -0500)]
Merge commit 'quintela/migration-next-v5' into staging

* commit '6c779f22a93cc6e4565b940ef616e3efc5b50ba5':
  Change ram_save_block to return -1 if there are no more changes
  ram: save_live_setup() we don't need to synchronize the dirty bitmap.
  ram: iterate phase
  ram: save_live_complete() only do one loop
  ram: save_live_setup() don't need to sent pages
  savevm: split save_live into stage2 and stage3
  savevm: split save_live_setup from save_live_state
  savevm: introduce is_active method
  savevm: Refactor cancel operation in its own operation
  savevm: remove SaveLiveStateHandler
  savevm: remove SaveSetParamsHandler
  savevm: Live migration handlers register the struct directly
  savevm: Use a struct to pass all handlers

11 years agoMerge branch pci into master
Michael S. Tsirkin [Sun, 29 Jul 2012 14:03:19 +0000 (17:03 +0300)]
Merge branch pci into master

Merge master and pci branch, resolve build breakage in hw/esp.c
introduced by f90c2bcd.

Conflicts:
hw/esp.c

11 years agox86: Fixed incorrect segment base address addition in 64-bits mode
Vitaly Chipounov [Mon, 2 Jul 2012 22:20:49 +0000 (00:20 +0200)]
x86: Fixed incorrect segment base address addition in 64-bits mode

According to the Intel manual
"Intel® 64 and IA-32 Architectures Software Developer’s Manual
Volume 3", "3.4.4 Segment Loading Instructions in IA-32e Mode":

"When in compatibility mode, FS and GS overrides operate as defined by
32-bit mode behavior regardless of the value loaded into the upper 32
linear-address bits of the hidden descriptor register base field.
Compatibility mode ignores the upper 32 bits when calculating an effective address."

However, the code misses the 64-bit mode case, where an instruction with
address and segment size override would be translated incorrectly. For example,
inc dword ptr gs:260h[ebx*4] gets incorrectly translated to:

(uint32_t)(gs.base + ebx * 4 + 0x260)
instead of
gs.base + (uint32_t)(ebx * 4 + 0x260)

Signed-off-by: Vitaly Chipounov <vitaly.chipounov@epfl.ch>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>