Commit graph

4549 commits

Author SHA1 Message Date
Michael S. Tsirkin 89c473fd82 virtio-pci: fix bus master work around on load
Commit c81131db15
detects old guests by comparing virtio and
PCI status. It attempts to do this on load,
as well, but load_config callback in a binding
is invoked too early and so the virtio status
isn't set yet.

We could add yet another callback to the
binding, to invoke after load, but it
seems easier to reuse the existing vmstate
callback.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
2011-03-28 18:34:23 +02:00
Isaku Yamahata 6f3279b5d1 pci: use uint8_t for devfn_min
use uint8_t for devfn_min instead of int.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-03-28 18:34:22 +02:00
Isaku Yamahata 6ff534b678 pci: use PCI_DEVFN in pci_get_bus_devfn()
Replace hardcoded logic by a common macro.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-03-28 18:34:22 +02:00
Isaku Yamahata 5256d8bfad pci: use devfn for pci_find_device() instead of (slot, fn) pair
(slot, fn) pair is somewhat confusing because of ARI.
So use devfn for pci_find_device() instead of (slot, fn).

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-03-28 18:34:22 +02:00
Isaku Yamahata 90a20dbb28 pci: replace the magic, 256, for the maximum of devfn
Introduce symbol PCI_SLOT_MAX for the # of slots,
and replace the magic, 256.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2011-03-28 18:34:22 +02:00
Benjamin Poirier bf6b87a883 rtl8139: add vlan tag insertion
Add support to the emulated hardware to insert vlan tags in packets
going from the guest to the network.

Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-26 11:11:02 +00:00
Benjamin Poirier 18dabfd1e0 rtl8139: add vlan tag extraction
Add support to the emulated hardware to extract vlan tags in packets
going from the network to the guest.

Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>

--

AFAIK, extraction is optional to get vlans working. The driver
requests rx detagging but should not assume that it was done. Under
Linux, the mac layer will catch the vlan ethertype. I only added this
part for completeness (to emulate the hardware more truthfully...)
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-26 11:10:49 +00:00
Benjamin Poirier 2c406b8fc8 rtl8139: cleanup FCS calculation
clean out ifdef's around ethernet checksum calculation

Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Acked-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-26 11:10:34 +00:00
Anthony Liguori 56d7a964a5 Merge remote branch 'amit/for-anthony' into staging 2011-03-24 08:11:58 -05:00
Jan Kiszka ff90d50393 vmmouse: Register vmstate via qdev
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-22 07:44:15 +01:00
Jan Kiszka 43f2019671 vmmouse: Fix initialization
Latest refactorings left vmmouse nonfunctional behind. Fix it by adding
the required device initialization.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-22 07:44:15 +01:00
René Rebe 7f90fa77b8 fix applesmc REV key
Fix applesmc REV key string literal hex encoding.

Signed-off-by: René Rebe <rene@exactcode.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-22 07:42:08 +01:00
Stefan Hajnoczi 735e77ecb1 e1000: Fix multi-descriptor packet checksum offload
The PCI/PCI-X Family of Gigabit Ethernet Controllers Software
Developer’s Manual states the following about the POPTS field:

  Provides a number of options which control the handling of this
  packet.  This field is ignored except on the first data descriptor of
  a packet.

The current implementation always loads the field and its checksum
offload flags.  This patch uses only the first descriptor's POPTS field
in order to comply with the specification.

When Solaris sends multi-descriptor packets it fills in POPTS for the
first descriptor only.  Therefore this patch is necessary in order to
perform checksum offload correctly for multi-descriptor packets.

Reported-by: Daniel Pecka <dpecka@techniservit.cz>
Reported-by: Gabriele A. Trombetti <gabriele.trombetti@itb.cnr.it>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-21 21:43:24 +01:00
Aurelien Jarno aa315f95b7 Merge branch 'for-anthony' of git://github.com/bonzini/qemu
* 'for-anthony' of git://github.com/bonzini/qemu:
  remove qemu_get_clock
  add a generic scaling mechanism for timers
  change all other clock references to use nanosecond resolution accessors
  change all rt_clock references to use millisecond resolution accessors
  add more helper functions with explicit milli/nanosecond resolution
2011-03-21 21:28:38 +01:00
Aurelien Jarno 3246572762 Merge branch 'for-anthony' of git://repo.or.cz/qemu/kevin
* 'for-anthony' of git://repo.or.cz/qemu/kevin:
  Add qcow2 documentation
  hw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0
  Improve error handling in do_snapshot_blkdev()
  Fix ATA SMART and CHECK POWER MODE
  Don't allow multiwrites against a block device without underlying medium
  tools: Use real async.c instead of stubs
  Add error message for loading snapshot without VM state
  block/qcow: Don't ignore immediate read/write and other failures
  block/vdi: Don't ignore immediate read/write failures
2011-03-21 21:28:19 +01:00
Peter Maydell 34933c8c94 hw/arm_sysctl.c: Add the Versatile Express system registers
Add support for the Versatile Express SYS_CFG registers, which provide
a generic means of reading or writing configuration information from
various parts of the board. We only implement shutdown and reset.

Also make the RESETCTL register RAZ/WI on Versatile Express rather
than reset the board. Other system registers are generally the same
as Versatile and Realview.

This includes a VMState version number bump for arm_sysctl,
since we have new register state to preserve. It also adds
sys_mci to the VMState while we're bumping the version number
(an accidental omission from commit b50ff6f5).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-03-21 21:04:46 +01:00
Amit Shah 2d6c1ef40f char: Prevent multiple devices opening same chardev
Prevent:

-chardev socket,path=/tmp/foo,server,nowait,id=c0 \
-device virtserialport,chardev=c0,id=vs0 \
-device virtserialport,chardev=c0,id=vs1

Reported-by: Mike Cao <bcao@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:57:13 +05:30
Amit Shah f9a90f189c virtio-console: Keep chardev open for other users after hot-unplug
After a hot-unplug operation, the previous behaviour was to close the
chardev.  That meant the chardev couldn't be re-used.  Also, since
chardev hot-plug isn't possible so far, this means virtio-console
hot-plug isn't feasible as well.

With this change, the chardev is kept around.  A new virtio-console
channel can then be hot-plugged with the same chardev and things will
continue to work.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:56:55 +05:30
Amit Shah fee063c07f virtio-serial: Don't clear ->have_data() pointer after unplug
After a port unplug operation, the port->info->have_data() pointer was
set to NULL.  The problem is, the ->info struct is shared by all ports,
effectively disabling writes to other ports.

Reported-by: juzhang <juzhang@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:55:12 +05:30
Amit Shah e9b382b017 virtio-serial-bus: Simplify handle_output() function
There's no code change, just re-arrangement to simplify the function
after recent modifications.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:55:12 +05:30
Amit Shah 32059220d0 virtio-serial: Enable ioeventfd
Enable ioeventfd for virtio-serial devices by default.  Commit
25db9ebe15 lists the benefits of using
ioeventfd.

Copying a file from guest to host over a virtio-serial channel didn't
show much difference in time or io_exit rate.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:55:12 +05:30
Amit Shah 0b8b716d6c virtio-serial: Disallow generic ports at id 0
Port 0 is reserved for virtconsole devices for backward compatibility
with the old -virtioconsole (from qemu 0.12) device type.

libvirt prior to commit 8e28c5d40200b4c5d483bd585d237b9d870372e5 used
port 0 for generic ports.  libvirt will no longer do that, but disallow
instantiating generic ports at id 0 from qemu as well.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:55:11 +05:30
Amit Shah 6b331efb73 virtio-serial: Use a struct to pass config information from proxy
Instead of using a single variable to pass to the virtio_serial_init
function, use a struct so that expanding the number of variables to be
passed on later is easier.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
2011-03-21 16:55:11 +05:30
Paolo Bonzini 7447545544 change all other clock references to use nanosecond resolution accessors
This was done with:

    sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \
        $(git grep -l 'qemu_get_clock\>' )
    sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \
        $(git grep -l 'qemu_new_timer\>' )

after checking that get_clock and new_timer never occur twice
on the same line.  There were no missed occurrences; however, even
if there had been, they would have been caught by the compiler.

There was exactly one false positive in qemu_run_timers:

     -    current_time = qemu_get_clock (clock);
     +    current_time = qemu_get_clock_ns (clock);

which is of course not in this patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
Paolo Bonzini 7bd427d801 change all rt_clock references to use millisecond resolution accessors
This was done with:

    sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \
        $(git grep -l 'get_clock\>.*rt_clock' )
    sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \
        $(git grep -l 'new_timer\>.*rt_clock' )

after checking that get_clock and new_timer never occur twice
on the same line.  There were no missed occurrences; however, even
if there had been, they would have been caught by the compiler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
Blue Swirl d81e54de59 petalogix_ml605_mmu: remove unused variable
Remove a write-only variable, spotted by GCC 4.6.0:
/src/qemu/hw/petalogix_ml605_mmu.c: In function 'petalogix_ml605_init':
/src/qemu/hw/petalogix_ml605_mmu.c:153:11: error: variable 'serial' set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-19 08:43:22 +00:00
Jan Kiszka ca22a3a375 i8254: Fix migration from older versions
qdev conversion broke migration as the previous version used vmstate
instance IDs derived from the iobase. Fix it by registering a legacy
alias.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-19 08:29:04 +00:00
Michal Simek 00914b7d97 microblaze: Add PetaLogix ml605 MMU little-endian ref design
Add the first Microblaze little endian platform.
Platform uses uart16550, axi ethernet, timer, intc.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2011-03-16 15:18:58 +01:00
Edgar E. Iglesias 93f1e4016b xilinx: Add AXIENET & DMA models
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2011-03-16 15:18:58 +01:00
Feiran Zheng 209bef3e01 hw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0
In hw/xen_disk.c, async writing ioreq is leaked when
ioreq->req.nr_segments==0, because `aio_inflight` flag is not released
properly (skipped by misplaced "break").

Signed-off-by: Feiran Zheng <famcool@gmail.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-03-15 13:21:14 +01:00
Brian Wheeler b93af93d2b Fix ATA SMART and CHECK POWER MODE
This patch fixes two things:

 1) CHECK POWER MODE

The error return value wasn't always zero, so it would show up as
offline.  Error is now explicitly set to zero.

 2) SMART

The smart values that were returned were invalid and tools like skdump
would not recognize that the smart data was actually valid and would
dump weird output.  The data has been fixed up and raw value support
was added.  Tools like skdump and palimpsest work as expected.

Signed-off-by: Brian Wheeler <bdwheele@indiana.edu>
Acked-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-03-15 13:21:14 +01:00
Paolo Bonzini 94ad5b00a3 always qemu_cpu_kick after unhalting a cpu
This ensures env->halt_cond is broadcast, and the loop in
qemu_tcg_wait_io_event and qemu_kvm_wait_io_event is exited
naturally rather than through a timeout.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-13 14:44:21 +00:00
Stefan Weil 913895ab96 hw/fmopl: Fix buffer access out-of-bounds errors
Index 75 is one too large for AR_TABLE[75], DR_TABLE[75].
This error was reported by cppcheck.

hw/fmopl.c:600: error: Buffer access out-of-bounds: OPL.AR_TABLE
hw/fmopl.c:601: error: Buffer access out-of-bounds: OPL.DR_TABLE

Fix this by limiting the access to the allowed range.
MultiArcadeMachineEmulator has newer versions of fmopl,
but using these requires more efforts.

Cc: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: malc <av1474@comtv.ru>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-13 13:35:21 +00:00
William Dauchy 7165448a91 moving eeprom initialization
The initialization should not be only on reset but also when initializing
the device.
It resolves a bug when hot plugging a pci network device: the mac address
was always null.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-13 13:24:42 +00:00
Blue Swirl e14c8062f4 pc: fix wrong CMOS values for floppy drives
Before commit 63ffb564dc, states for
floppy drives were calculated in fdc.c:fd_revalidate(). There it is
also considered whether a disk is inserted or not. The commit didn't copy
the logic completely to pc.c, which caused a regression.

Fix by adding the same check also to pc.c.

Reported-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-12 09:52:25 +00:00
Michal Simek 73ad9e62a3 microblaze: Fix PetaLogix company name
trivial fix.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2011-03-11 15:24:37 +01:00
Juan Quintela f6317a6ef1 vmstate: move timers to use test instead of version
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 639f49b60c vmstate: be able to store/save a pci device from a pointer
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 6059631c04 vmstate: Add a way to send a partial array
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 1283da7273 vmstate: add VMSTATE_STRUCT_VARRAY_UINT32
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 15c6a56e95 vmstate: add VMSTATE_INT64_ARRAY
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 2a57b6c893 vmstate: add VMSTATE_STRUCT_VARRAY_INT32
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela a624b08663 vmstate: add UINT32 VARRAYS
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 82fa39b751 vmstate: Fix varrays with uint8 indexes
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:26 -06:00
Juan Quintela 9122a8fed7 vmstate: add VMSTATE_UINT32_EQUAL
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-10 16:12:25 -06:00
Edgar E. Iglesias d48751ed4f xilinx-ethlite: Simplify byteswapping to/from brams
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
2011-03-10 09:16:52 +01:00
Dmitry Eremin-Solenikov b651fc6fd8 mainstone: PCMCIA support
Extend mst_fpga and mainstone with logic to support PCMCIA
attachment (IRQs, status regs).

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-03-10 03:38:13 +01:00
Dmitry Eremin-Solenikov 95499a1d28 mainstone: use gpio 0 for connection of FPGA instead of hooking into PIC directly
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-03-10 03:36:18 +01:00
Andrzej Zaborowski 8034ce7d17 pxa2xx_timer: Get rid of .level in PXA2xxTimer0. 2011-03-10 03:31:02 +01:00
Andrzej Zaborowski 7c29d6ce0f pxa2xx_pic: fixup initialisation
This is based on Dmitry Eremin-Solenikov's patch but simplified.
2011-03-10 03:11:47 +01:00