Commit graph

4098 commits

Author SHA1 Message Date
Alex Williamson 8ca209ad90 pc: Fix e820 fw_cfg for big endian
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Alex Williamson 67d4b0c190 pc: e820 qemu_cfg tables need to be packed
We can't let the compiler define the alignment for qemu_cfg data.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Jes Sorensen 43ad7e3e98 Add missing braces
This patch adds missing braces around if/else statements that call
macros which are likely to result in errors if the macro is
changed. It also makes the code comply better with CODING_STYLE.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Gleb Natapov d59f8ba938 Out off array access in usb-net
Properly check array bounds before accessing array element.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Adam Lackorzynski 9696846600 multiboot: Prevent loading of x86_64 images
A via -kernel supplied x86_64 ELF image is being started in 32bit mode.
Detect and exit if a 64bit image has been supplied.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 09:31:18 -06:00
Alex Williamson b538e53ee7 apic: Don't iterate past last used apic
local_apics are allocated sequentially and never removed, so
we can stop any iterations that go to MAX_APICS as soon as we
hit the first NULL.  Looking at a small guest running a virtio-net
workload with oprofile, this drops apic_get_delivery_bitmask()
from #3 in the profile to down in the noise.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 09:31:18 -06:00
Michael S. Tsirkin 4cff0a5994 pci: allow hotplug removal of cold-plugged devices
This patch fixes hot unplug of cold plugged devices
(those present at system start), which got broken by
5beb8ad503 .

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cam Macdonell <cam@cs.ualberta.ca>
Tested-by: Cam Macdonell <cam@cs.ualberta.ca>
Reported-by: Cam Macdonell <cam@cs.ualberta.ca>.
2010-11-16 08:40:08 -06:00
Alex Williamson a6a9239cd8 PCI: Bus number from the bridge, not the device
pcibus_dev_print() was erroneously retrieving the device bus
number from the secondary bus number offset of the device
instead of the bridge above the device.  This ends of landing
in the 2nd byte of the 3rd BAR for devices, which thankfully
is usually zero.

Note: pcibus_get_dev_path() copied this code,
inheriting the same bug.  pcibus_get_dev_path() is used for
ramblock naming, so changing it can effect migration.  However,
I've only seen this byte be non-zero for an assigned device,
which can't migrate anyway, so hopefully we won't run into
any issues.

This patch does not touch pcibus_get_dev_path, as
bus number is guest assigned for nested buses,
so using it for migration is broken anyway.
Fix it properly later.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-16 08:40:08 -06:00
Alex Williamson 1f892feb37 e1000: Fix TCP checksum overflow with TSO
When adding the length to the pseudo header, we're not properly
accounting for overflow.

From: Mark Wu <dwu@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-16 08:40:08 -06:00
Gerd Hoffmann 788954270d more stdvga cleanups.
video.x is gone now.  It was the only user of the
vga bios_offset + bios_size logic.  Zap it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-16 08:40:07 -06:00
Gerd Hoffmann 4eccfec494 switch vmware_vga to pci vgabios
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-16 08:40:07 -06:00
Gerd Hoffmann 543f8e3468 switch stdvga to pci vgabios
Make stdvga provide the new vgabios binary (with pcibios support)
using the PCI option rom bar.  Seabios will happily load it from
there.  The new vga bios will also lookup the framebuffer address
in pci config space, so the magic bochs lfb @ 0xe0000000 is not
needed any more -> zap it.

Without the patch:

  # dmesg | grep framebuffer
  vesafb: framebuffer at 0xe0000000, mapped to 0xf7e80000, using 1875k, total 8192k
  # lspci -vs2
  00:02.0 VGA compatible controller: Technical Corp. Device 1111 (prog-if 00 [VGA controller])
	Subsystem: Qumranet, Inc. Device 1100
	Physical Slot: 2
	Flags: fast devsel
	Memory at f0000000 (32-bit, prefetchable) [size=8M]
	Expansion ROM at <unassigned> [disabled]

With patch applied:

  # dmesg | grep framebuffer
  vesafb: framebuffer at 0xf0000000, mapped to 0xf7e80000, using 1875k, total 8192k
  # lspci -vs2
  00:02.0 VGA compatible controller: Technical Corp. Device 1111 (prog-if 00 [VGA controller])
	Subsystem: Qumranet, Inc. Device 1100
	Physical Slot: 2
	Flags: fast devsel
	Memory at f0000000 (32-bit, prefetchable) [size=8M]
	Expansion ROM at f0800000 [disabled] [size=64K]

cheers,
  Gerd

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-16 08:40:07 -06:00
Gerd Hoffmann df0db2212d intel-hda: fix codec addressing.
The HDA bus supports up to 15 codecs, with addresses 0 ... 14.
We get that wrong in two places:

 * When handing out addresses we accept address 15 as valid.
 * The bitmasks for two registers (WAKEEN and STATESTS) don't
   have bit 14 set.

This patch fixes it.

[ v2: codestyle: add braces ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 19:32:59 +03:00
malc e2553eb44e Revert "intel-hda: fix codec addressing."
Misses braces

This reverts commit acc086837e.
2010-11-09 19:14:15 +03:00
Gerd Hoffmann acc086837e intel-hda: fix codec addressing.
The HDA bus supports up to 15 codecs, with addresses 0 ... 14.
We get that wrong in two places:

 * When handing out addresses we accept address 15 as valid.
 * The bitmasks for two registers (WAKEEN and STATESTS) don't
   have bit 14 set.

This patch fixes it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
Gerd Hoffmann 17786d52ac intel-hda: add msi support
This patch adds MSI support to the intel hda audio driver.  It is
enabled by default, use '-device intel-hda,msi=0' to disable it.

[ v2: codestyle: add braces ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
Gerd Hoffmann 6a0d02f5be intel-hda: update irq status on WAKEEN changes.
When the guest updates the WAKEEN register we
must re-calculate the IRQ status.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
François Revol af93485cde intel-hda: Honor WAKEEN bits.
HDA: Honor WAKEEN bits when deciding to raise an interrupt on codec
status change.  This prevents an interrupt storm with the Haiku HDA
driver which does not handle codec status changes in the irq handler.

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
Gerd Hoffmann 129dcd2c66 hda-audio: exit cleanup
Add exit callback to the driver.  Unregister the sound card properly
on exit.

[ v2: codestyle: add braces ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
Gerd Hoffmann dc4b9240dc intel-hda: exit cleanup
Add pci exit callback for the intel-hda device and cleanup properly.
Also add an exit callback to the HDA bus implementation and make sure
it is called on qdev_free().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:11 +03:00
Kevin Wolf d33ea50a95 scsi-disk: Fix immediate failure of bdrv_aio_*
Fix scsi-disk to use the usual completion paths that involve rerror/werror
handling instead of directly completing the requests in cases where
bdrv_aio_readv/writev returns NULL.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-04 13:54:37 +01:00
Kevin Wolf 18a8d4214b virtio-blk: Handle immediate flush failure properly
Fix virtio-blk to use the usual completion path that involves werror handling
instead of directly completing the request in cases where bdrv_aio_flush
returns NULL.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-04 13:54:37 +01:00
Kevin Wolf b2df7531f3 ide: Handle immediate bdrv_aio_flush failure
If bdrv_aio_flush returns NULL, this should be treated as an error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-04 13:54:37 +01:00
Kevin Wolf 78ced65e6e scsi-disk: Implement werror for flushes
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-04 12:52:16 +01:00
Kevin Wolf 8af7a3ab51 scsi-disk: Complete failed requests in scsi_disk_emulate_command
This pulls the request completion for error cases from the caller to
scsi_disk_emulate_command. This should not change semantics, but allows to
reuse scsi_handle_write_error() for flushes in the next patch.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-04 12:52:16 +01:00
Kevin Wolf 5dba48a882 scsi-disk: Implement rerror option
This implements the rerror option for SCSI disks.

It also includes minor changes to the write path where the same code is used
that was criticized in the review for the changes to the read path required for
rerror support.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-04 12:52:16 +01:00
Anthony Liguori 4f25ac5f42 Merge remote branch 'mst/for_anthony' into staging 2010-11-01 10:33:45 -05:00
malc 9fe5497c4f hda-audio: Zap tabs
Signed-off-by: malc <av1474@comtv.ru>
2010-11-01 17:57:24 +03:00
Gerd Hoffmann d61a4ce8f0 Add Intel HD Audio support to qemu.
This patch adds three devices to qemu:

intel-hda
	Intel HD Audio Controller, the PCI device.  Provides a HDA bus.
	Emulates ICH6 at the moment.  Adding a ICH9 PCIE
	variant shouldn't be hard.

hda-duplex
	HDA Codec.  Attaches to the HDA bus.  Supports 16bit stereo,
	rates 16k -> 96k, playback, recording and volume control
	(with CONFIG_MIXEMU=y).

hda-output
	HDA Codec without recording support.  Subset of the hda-duplex
	codec.  Use this if you don't want your guests access your mic.

Usage: add '-device intel-hda -device hda-duplex' to your command line.

Tested guests:
 * Linux works.
 * Win7 works.
 * DOS (mpxplay) works.
 * WinXP doesn't work.

[ v2 changes ]
 * Fixed endianess, big endian hosts work now.
 * Fixed some emulation bugs.
 * Added immediate command emulation.
 * Added vmstate support.
 * Make it behave like all other sound card drivers:
   - can be configured via '--audio-card-list=hda'
   - can be added to a VM using '-soundhw hda'
 * Code style fixups.
 * Zapped guest-triggerable asserts.
 * Handle partial reads/writes of audio data correctly.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-01 17:57:22 +03:00
Gerd Hoffmann cdae5cfbd3 add VMSTATE_BOOL
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-01 17:57:12 +03:00
Blue Swirl 97bf4851fe sparc32: convert debug printf statements to tracepoints
Replace debug printf statements with tracepoints.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-31 09:24:14 +00:00
Jes Sorensen ff753bb9a6 Do not redefine reserved key-words TRUE/FALSE
TRUE/FALSE are generally reserved keywords and shouldn't be defined in
a driver like this. Rename the macros to SDP_TRUE and SDP_FALSE
respectively.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-30 08:02:38 +00:00
malc 338b922edd Mov muldiv64 to qemu-common.h (Thus unbreaking gus)
Signed-off-by: malc <av1474@comtv.ru>
2010-10-30 01:41:01 +04:00
Michael S. Tsirkin b907b69dd7 Merge branch 'pci' into for_anthony 2010-10-27 19:07:10 +02:00
Michael S. Tsirkin 804b207170 pcie: update satus on reset
Reset never triggers a new event, so it's enough to
update status.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-27 19:01:59 +02:00
Michael S. Tsirkin b794ec7ce8 msi: minor cleanups
Comment fixup (tell what it does not what it does not do),
typo fix, whitespace fix.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-27 19:01:59 +02:00
Michael S. Tsirkin 531a0b82dd msi: simplify range checks
config write handlers should be idempotent.
So no need for complex range checks: a simple
one checking that we are touching the relevant capability
will do.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-27 19:01:59 +02:00
Michael S. Tsirkin f9aebe2ef5 pci: improve w1c mask handling
- save/restore must not check w1c bits
  since they are in fact guest controlled
- clear w1c bits on reset

Note: for express there are different kinds of
reset, some leave part of config space alone.
We will likely need a sticky bit mask to implement this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-27 19:01:59 +02:00
Michael S. Tsirkin 6bde6aaac6 pcie: clean up hot plug notification
Simplify logic for hotplug notification, by tracking state of the
logical interrupt condition.  We then simply use this variable to make
the interrupt decision, according to spec.

API is made cleaner as we no longer force users to pass in
old slot control value.

Includes fixes by Isaku Yamahata.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-10-27 19:01:59 +02:00
Michael S. Tsirkin ac0cdda347 pcie: simplify range check
Simplify code slighly by reversing the polarity
for the range check

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-10-27 19:01:59 +02:00
Blue Swirl 5afb986917 Introduce range.h
Extract range functions from pci.h. These will be used by later patches
by non-PCI devices. Adjust current users.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit bf1b007123)
2010-10-27 19:01:59 +02:00
Michael S. Tsirkin 258dc7c96b virtio: sanity-check available index
Checking available index upon load instead of
only when vm is running makes is easier to
debug failures.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-10-27 18:54:02 +02:00
Anthony Liguori 21bcc5907f Merge remote branch 'kwolf/for-anthony' into staging 2010-10-26 09:50:58 -05:00
Blue Swirl c57c846a80 qemu-timer: move commonly used timer code to qemu-timer-common
Move timer init functions to a new file, qemu-timer-common.c. Make other
critical timer functions inlined to preserve performance in
qemu-timer.c, also move muldiv64() (used by the inline functions)
to qemu-timer.h.

Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly.
Remove a similar/duplicate definition in qemu-tool.c.

Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used
there.

After this change, tracing can be used also for user code and
simpletrace on Win32.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-23 15:24:07 +00:00
Blue Swirl 5340c8a0f3 mips_fulong2e: fix ram allocation
RAM registration used incorrect offset.

Fix by using the offset obtained previously for this purpose.

Spotted by GCC 4.6.0 20100925 warning, which is also avoided.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-22 18:26:08 +00:00
Kevin Wolf 8c269b542c virtio-blk: Respect werror option for flushes
The werror option now affects not only write requests, but also flush requests.
Previously, it was not possible to stop a VM on a failed flush.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22 14:49:35 +02:00
Kevin Wolf e2bcadadc3 ide: Handle flush failure
Instead of always assuming success for bdrv_aio_flush, actually do something
with the error. This respects the werror option and accordingly ignores the
error, reports it to the guest or stops the VM and retries after cont.

Ignoring the error is trivial, obviously. For stopping the VM and retrying
later old code can be reused, but we need to introduce a new status for "retry
a flush". For reporting to the guest, fortunately the same action is required
as for a failed read/write (status = DRDY | ERR, error = ABRT), so this code
can be reused as well.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22 14:49:35 +02:00
Kevin Wolf 6bcb1a79a3 ide: Factor ide_flush_cache out
The next patch reuses this code, so put it in its own function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22 14:49:35 +02:00
Christoph Hellwig a58b8d5401 ide: set WCACHE supported in IDENTIFY data
ATA does not only have the WCACHE enabled bit in identify word 85, but also
a WCACHE supported bit in word 82.  While the Linux kernel is fine with the
latter at least hdparm also needs the former before correctly displaying
the cache settings.  There's also a non-zero chance other operating systems
are more picky in their volatile write cache detection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-10-22 14:49:35 +02:00
Gleb Natapov 633aa0acfe Fix pci hotplug to generate level triggered interrupt.
SCI is level triggered. pci hotplug should behave appropriately.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-20 17:23:28 -05:00