sim-card
/
qemu
Archived
10
0
Fork 0
Commit Graph

18025 Commits

Author SHA1 Message Date
Michael Ellerman 9fc380d3ed pseries: Check for duplicate addresses on the spapr-vio bus
Check that devices on the spapr vio bus aren't given duplicate
addresses. Currently we will not run with duplicate devices, the
fdt code will spot it, but the error reporting is not great. With
this patch we can report the error nicely in terms of the device
names given by the user.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-03 15:49:12 +01:00
David Gibson 68f3a94c64 pseries: Populate "/chosen/linux,stdout-path" in the FDT
There is a device tree property "/chosen/linux,stdout-path" which indicates
which device should be used as stdout - ie. "the console".

Currently we don't specify anything, which means both firmware and Linux
choose something arbitrarily. Use the routine we added in the last patch
to pick a default vty and specify it as stdout.

Currently SLOF doesn't use the property, but we are hoping to update it
to do so.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-03 15:49:12 +01:00
David Gibson 98331f8ad6 pseries: Add a routine to find a stable "default" vty and use it
In vty_lookup() we have a special case for supporting early debug in
the kernel. This accepts reg == 0 as a special case to mean "any vty".

We implement this by searching the vtys on the bus and returning the
first we find. This means that the vty we chose depends on the order
the vtys are specified on the QEMU command line - because that determines
the order of the vtys on the bus.

We'd rather the command line order was irrelevant, so instead return
the vty with the lowest reg value. This is still a guess as to what the
user really means, but it is at least stable WRT command line ordering.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>

[agraf] fix braces
2012-01-03 15:49:11 +01:00
David Gibson 05c194384f pseries: Emit device tree nodes in reg order
Although in theory the device tree has no inherent ordering, in practice
the order of nodes in the device tree does effect the order that devices
are detected by software.

Currently the ordering is determined by the order the devices appear on
the QEMU command line. Although that does give the user control over the
ordering, it is fragile, especially when the user does not generate the
command line manually - eg. when using libvirt etc.

So order the device tree based on the reg value, ie. the address of on
the VIO bus of the devices. This gives us a sane and stable ordering.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>

[agraf] add braces
2012-01-03 15:49:11 +01:00
Bharata B Rao 6e806cc38b pseries: FDT NUMA extensions to support multi-node guests
Add NUMA specific properties to guest's device tree to boot a multi-node
guests. This patch adds the following properties:

ibm,associativity
ibm,architecture-vec-5
ibm,associativity-reference-points

With this, it becomes possible to use -numa option on pseries targets.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-03 15:49:11 +01:00
David Gibson 1fc02533e7 pseries: Remove hcalls callback
For forgotten historical reasons, PAPR hypercalls for specific virtual IO
devices (oh which there are quite a number) are registered via a callback
in the VIOsPAPRDeviceInfo structure.

This is kind of ugly, so this patch instead registers hypercalls from
device_init() functions for each device type.  This works just as well,
and is cleaner.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-03 15:49:11 +01:00
Liu Yu-B13201 157feeadba kvm-ppc: halt secondary cpus when guest reset
When guest reset, we need to halt secondary cpus until guest kick them.
This already works for tcg. The patch add the support for kvm.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
[agraf: remove in-kernel irqchip code]
2012-01-03 15:48:20 +01:00
Alexander Graf 33bcd98c4e console: Fix segfault on screendump without VGA adapter
When trying to create a screen dump without having any VGA adapter
inside the guest, QEMU segfaults.

This is because it's trying to switch back to the "previous" screen
it was on before dumping the VGA screen. Unfortunately, in my case
there simply is no previous screen so it accesses a NULL pointer.

Fix it by checking if previous_active_console is actually available.

This is 1.0 material.

Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-03 02:49:25 +01:00
Nishanth Aravamudan 4e9200a0a0 PPC: monitor: add ability to dump SLB entries
When run with a PPC Book3S (server) CPU Currently 'info tlb' in the
qemu monitor reports "dump_mmu: unimplemented".  However, during
bringup work, it can be quite handy to have the SLB entries, which are
available in the CPUPPCState.  This patch adds an implementation of
info tlb for book3s, which dumps the SLB.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-03 02:49:25 +01:00
Christian Borntraeger ed8e5a85a1 virtio-console: Fix failure on unconnected pty
when I tried qemu with -virtio-console pty the guest hangs and attaching
on /dev/pts/<x> does not return anything if the attachment is too late.

This results in pty_chr_write() returning 0, which causes the port to
get throttled. This results in the guest getting frozen as the
guest->host virtio_console writes don't return until the host releases
the vq element back to the guest.

For the virtio-serial use case we don't want to lose data but for the
console case we better drop data instead of "killing" the guest
console. If we get chardev->frontend notification and a better behaving
virtio-console we can revert this fix.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-12-30 11:10:10 +05:30
Avi Kivity 8d3bc5178f Fix qapi code generation wrt parallel build
Make's multiple output syntax

  x.c x.h: x.template
       gen < x.template

actually invokes the command once for x.c and once for x.h (with differing $@
in each invocation).  During a parallel build, the two commands may be invoked
in parallel; this opens up a race, where the second invocation trashes a file
supposedly produced during the first, and now in use by a dependent command.

The various qapi code generators are susceptible to this; fix by making them
generate just one file per invocation.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-27 09:28:58 -06:00
Anthony Liguori 4e1ea514f9 Merge remote-tracking branch 'aneesh/for-upstream' into staging
* aneesh/for-upstream:
  scripts/analyse-9p-simpletrace.py:	Add symbolic names for 9p operations.
  hw/9pfs: iattr_valid flags are kernel internal flags map them to 9p values.
  hw/9pfs: Use the correct signed type for different variables
  hw/9pfs: replace iovec manipulation with QEMUIOVector
2011-12-27 08:53:35 -06:00
Anthony Liguori ebdfc3c83c Merge remote-tracking branch 'bonzini/nbd-for-anthony' into staging
* bonzini/nbd-for-anthony: (26 commits)
  nbd: add myself as maintainer
  qemu-nbd: throttle requests
  qemu-nbd: asynchronous operation
  qemu-nbd: add client pointer to NBDRequest
  qemu-nbd: move client handling to nbd.c
  qemu-nbd: use common main loop
  link the main loop and its dependencies into the tools
  qemu-nbd: introduce NBDRequest
  qemu-nbd: introduce NBDExport
  qemu-nbd: introduce nbd_do_receive_request
  qemu-nbd: more robust handling of invalid requests
  qemu-nbd: introduce nbd_do_send_reply
  qemu-nbd: simplify nbd_trip
  move corking functions to osdep.c
  qemu-nbd: remove data_size argument to nbd_trip
  qemu-nbd: remove offset argument to nbd_trip
  Update ioctl order in nbd_init() to detect EBUSY
  nbd: add support for NBD_CMD_TRIM
  nbd: add support for NBD_CMD_FLUSH
  nbd: add support for NBD_CMD_FLAG_FUA
  ...
2011-12-27 08:52:42 -06:00
Gleb Natapov a0fa82085e enable architectural PMU cpuid leaf for kvm
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22 14:53:01 -02:00
Vasilis Liaskovitis 991dfefdee Set numa topology for max_cpus
qemu-kvm passes numa/SRAT topology information for smp_cpus to SeaBIOS. However
SeaBIOS always expects to setup max_cpus number of SRAT cpu entries
(MaxCountCPUs variable in build_srat function of Seabios). When qemu-kvm runs
with smp_cpus != max_cpus (e.g. -smp 2,maxcpus=4), Seabios will mistakenly use
memory SRAT info for setting up CPU SRAT entries for the offline CPUs. Wrong
SRAT memory entries are also created. This breaks NUMA in a guest.
Fix by setting up SRAT info for max_cpus in qemu-kvm.

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22 14:53:01 -02:00
Jan Kiszka cce47516cd kvm: x86: Drop redundant apic base and tpr update from kvm_get_sregs
The latter was already commented out, the former is redundant as well.
We always get the latest changes after return from the guest via
kvm_arch_post_run.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22 14:53:01 -02:00
Jan Kiszka fabacc0f79 kvm: x86: Avoid runtime allocation of xsave buffer
Keep a per-VCPU xsave buffer for kvm_put/get_xsave instead of
continuously allocating and freeing it on state sync.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22 14:53:01 -02:00
Jan Kiszka 6b42494b21 kvm: x86: Use symbols for all xsave field
Field 0 (FCW+FSW) and 1 (FTW+FOP) were hard-coded so far.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-12-22 14:53:00 -02:00
Paolo Bonzini 44f76b289a nbd: add myself as maintainer
Not planning to do much else, hence listing it as "Odd Fixes".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:59 +01:00
Paolo Bonzini 41996e3803 qemu-nbd: throttle requests
Limiting the number of in-flight requests is implemented very simply
with a can_read callback.  It does not require a semaphore, unlike the
client side in block/nbd.c, because we can throttle directly the creation
of coroutines.  The client side can have a coroutine created at any time
when an I/O request is made.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:59 +01:00
Paolo Bonzini 262db38871 qemu-nbd: asynchronous operation
Using coroutines enable asynchronous operation on both the network and
the block side.  Network can be owned by two coroutines at the same time,
one writing and one reading.  On the send side, mutual exclusion is
guaranteed by a CoMutex.  On the receive side, mutual exclusion is
guaranteed because new coroutines immediately start receiving data,
and no new coroutines are created as long as the previous one is receiving.

Between receive and send, qemu-nbd can have an arbitrary number of
in-flight block transfers.  Throttling is implemented by the next
patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:59 +01:00
Paolo Bonzini 72deddc5e6 qemu-nbd: add client pointer to NBDRequest
By attaching a client to an NBDRequest, we can avoid passing around the
socket descriptor and data buffer.

Also, we can now manage the reference count for the client in
nbd_request_get/put request instead of having to do it ourselved in
nbd_read.  This simplifies things when coroutines are used.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:59 +01:00
Paolo Bonzini 1743b51586 qemu-nbd: move client handling to nbd.c
This patch sets up the fd handler in nbd.c instead of qemu-nbd.c.  It
introduces NBDClient, which wraps the arguments to nbd_trip in a single
structure, so that we can add a notifier to it.  This way, qemu-nbd can
know about disconnections.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:59 +01:00
Paolo Bonzini a61c67828d qemu-nbd: use common main loop
Using a single main loop for sockets will help yielding from the socket
coroutine back to the main loop, and later reentering it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:59 +01:00
Paolo Bonzini cbcfa0418f link the main loop and its dependencies into the tools
Using the main loop code from QEMU enables tools to operate fully
asynchronously.  Advantages include better Windows portability (for some
definition of portability) over glib's.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini d9a7380658 qemu-nbd: introduce NBDRequest
Move the buffer from NBDExport to a new structure, so that it will be
possible to have multiple in-flight requests for the same export
(and for the same client too---we get that for free).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini af49bbbe78 qemu-nbd: introduce NBDExport
Wrap the common parameters of nbd_trip and nbd_negotiate in a
single opaque struct.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini a030b347aa qemu-nbd: introduce nbd_do_receive_request
Group the receiving of a response and the associated data into a new function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini fae6941629 qemu-nbd: more robust handling of invalid requests
Fail invalid requests with EINVAL instead of dropping them into
the void.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini 2204559203 qemu-nbd: introduce nbd_do_send_reply
Group the sending of a reply and the associated data into a new function.
Without corking, the caller would be forced to leave 12 free bytes at the
beginning of the data pointer.  Not too ugly, but still ugly. :)

Using nbd_do_send_reply everywhere will help when the routine will set up
the write handler that re-enters the send coroutine.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini a478f6e595 qemu-nbd: simplify nbd_trip
Use TCP_CORK to remove a violation of encapsulation, that would later
require nbd_trip to know too much about an NBD reply.

We could also switch to sendmsg (qemu_co_sendv) later, it is even
easier once coroutines are in.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini 128aa58947 move corking functions to osdep.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini 3777b09fd7 qemu-nbd: remove data_size argument to nbd_trip
The size of the buffer is in practice part of the protocol.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini 94607e7a77 qemu-nbd: remove offset argument to nbd_trip
The argument is write-only.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Chunyan Liu 3e05c78551 Update ioctl order in nbd_init() to detect EBUSY
Update ioctl(s) in nbd_init() to detect device busy early.

Current nbd_init() issues NBD_CLEAR_SOCKET before NBD_SET_SOCKET, if issuing
"qemu-nbd -c /dev/nbd0 disk.img" twice, the second time won't detect EBUSY in
nbd_init(), but in nbd_client will report EBUSY and do clear socket (the 1st
time command will be affacted too because of no socket any more.)

No change to previous version.

Signed-off-by: Chunyan Liu <cyliu@suse.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:58 +01:00
Paolo Bonzini 7a706633e9 nbd: add support for NBD_CMD_TRIM
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini 1486d04a1b nbd: add support for NBD_CMD_FLUSH
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini 2c7989a9b1 nbd: add support for NBD_CMD_FLAG_FUA
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini adcf6302de nbd: fix error handling in the server
bdrv_read and bdrv_write return negative errno values, not -1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini ecda3447d1 nbd: allow multiple in-flight requests
Allow sending up to 16 requests, and drive the replies to the coroutine
that did the request.  The code is written to be exactly the same as
before this patch when MAX_NBD_REQUESTS == 1 (modulo the extra mutex
and state).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini d9b09f13ca nbd: split requests
qemu-nbd has a limit of slightly less than 1M per request.  Work
around this in the nbd block driver.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini ae255e523c nbd: switch to asynchronous operation
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:57 +01:00
Paolo Bonzini 8c5135f90e sheepdog: move coroutine send/recv function to generic code
Outside coroutines, avoid busy waiting on EAGAIN by temporarily
making the socket blocking.

The API of qemu_recvv/qemu_sendv is slightly different from
do_readv/do_writev because they do not handle coroutines.  It
returns the number of bytes written before encountering an
EAGAIN.  The specificity of yielding on EAGAIN is entirely in
qemu-coroutine.c.

Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-22 11:53:53 +01:00
Amit Shah 03ecd2c80a virtio-serial-bus: Ports are expected to implement 'have_data' callback
There's no need to check if ports can accept any incoming data from the
guest each time the guest sends data.  Check if the port implements such
functionality during port initialisation.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-21 15:00:29 -06:00
Amit Shah 05e7af694c virtio-console: Properly initialise class methods
The earlier code really was a hack: initialising class methods in an
object init function as noted by Anthony.

The motivation for that was to not have the virtio-serial-bus call into
the callback functions if there was no chardev backend registered.
However, that really wasn't a worthwhile optimisation, and definitely
not one that was well-implemented.  Get rid of it.

Reported-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-21 15:00:29 -06:00
Amit Shah 6640422c17 virtio-console: Check if chardev backends available before calling into them
For the callback functions invoked by the virtio-serial-bus code, check
if we have chardev backends registered before we call into the chardev
functions.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-21 15:00:29 -06:00
Paolo Bonzini 993295fedc add qemu_send_full and qemu_recv_full
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-12-21 15:00:24 +01:00
Harsh Prateek Bora 058a96ed50 scripts/analyse-9p-simpletrace.py: Add symbolic names for 9p operations.
Currently, we just print the numerical value of 9p operation identifier in
case of RERROR which is less meaningful for readability. Mapping 9p
operation ids to symbolic names provides a better tracelog:

	RERROR (tag = 1 , id = TWALK , err = " No such file or directory ")
	RERROR (tag = 1 , id = TUNLINKAT , err = " Directory not empty ")

This patch provides a dictionary of all possible 9p operation symbols mapped
to their numerical identifiers which are likely to be used in future at
various places in this script.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-12-21 12:37:23 +05:30
Aneesh Kumar K.V e4027caf93 hw/9pfs: iattr_valid flags are kernel internal flags map them to 9p values.
Kernel internal values can change, add protocol values for these constant and
use them.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-12-21 12:37:23 +05:30
Aneesh Kumar K.V 2f008a8c97 hw/9pfs: Use the correct signed type for different variables
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-12-21 12:37:23 +05:30