OSDN Git Service

qmiga/qemu.git
14 years agopci: remove bus_num member from struct PCIBus.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:12 +0000 (21:21 +0900)]
pci: remove bus_num member from struct PCIBus.

Since It can be retrieved from pci configuration space,
the member is unnecessary.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: 64bit bar support.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:11 +0000 (21:21 +0900)]
pci: 64bit bar support.

implemented pci 64bit bar support.
The tricky bit is pci_update_mapping().
An OS is allowed to set the BAR such that OS can't address the area
pointed by BAR. It doesn't make sense, though.
In that case, don't map the BAR.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: typedef pcibus_t as uint64_t instead of uint32_t.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:10 +0000 (21:21 +0900)]
pci: typedef pcibus_t as uint64_t instead of uint32_t.

This patch is preliminary for 64bit bar.
For 64bit bar support, change pcibus_t which represents
pci bus addr/size from uint32_t to uint64_t.
And also change FMT_pcibus for printf.

In pci_update_mapping() checks 32bit overflow.
So the check must be updated too.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: introduce FMT_PCIBUS for printf format for pcibus_t.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:09 +0000 (21:21 +0900)]
pci: introduce FMT_PCIBUS for printf format for pcibus_t.

This patch is preliminary for 64bit BAR.
Later pcibus_t will be changed from uint32_t to uint64_t.
Introduce FMT_PCIBUS for printf format for pcibus_t.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: introduce pcibus_t to represent pci bus address/size instead of uint32_t
Isaku Yamahata [Fri, 30 Oct 2009 12:21:08 +0000 (21:21 +0900)]
pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t

This patch is preliminary for 64 bit BAR support.
Introduce dedicated type, pcibus_t, to represent pci bus address/size
instead of uint32_t.
Later this type will be changed to uint64_t.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci_host: consolidate pci config address access.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:07 +0000 (21:21 +0900)]
pci_host: consolidate pci config address access.

consolidate pci_config address access into pci_host.c

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci_host.h: move functions in pci_host.h into .c file.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:06 +0000 (21:21 +0900)]
pci_host.h: move functions in pci_host.h into .c file.

split static functions in pci_host.h into pci_host.c and
pci_host_template.h.
Later a structures declared in pci_host.h, PCIHostState, will be used.
However pci_host.h doesn't allow to include itself easily. This patches
addresses it.

pci_host.h includes functions which are instantiated in .c by including
pci_host.h with typedefing pci_addr_t.
pci_addr_t is per pci host bridge and is typedef'ed to uint32_t for ioio
or target_phys_addr_t for mmio in .c file.
That prevents from including pci_host.h to use PCIHostState because of
requiring type, pci_addr_t.

Its purpose to include is to instantiate io function for mmio or ioio
depending on which pci host bridge requires ioio or mmio.
To avoid including code, we always instantiate both version.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: make pci_bar() aware of header type 1.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:05 +0000 (21:21 +0900)]
pci: make pci_bar() aware of header type 1.

make pci_bar() aware of header type 1. When PCI_ROM_SLOT
it should return PCI_ROM_ADDRESS1 (!= PCI_ROM_ADDRESS)

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: clean up of pci_default_read_config.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:04 +0000 (21:21 +0900)]
pci: clean up of pci_default_read_config.

This patch cleans up pci_default_read_config() removing
ugly length and range check.

Suggested by "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h
Isaku Yamahata [Fri, 30 Oct 2009 12:21:03 +0000 (21:21 +0900)]
pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h

make constants for pci base address match pci_regs.h by
renaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: clean up pci_init_wmask()
Isaku Yamahata [Fri, 30 Oct 2009 12:21:02 +0000 (21:21 +0900)]
pci: clean up pci_init_wmask()

use pci_set_word() for pci command register.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci/bridge: clean up of pci_bridge_initfn()
Isaku Yamahata [Fri, 30 Oct 2009 12:21:01 +0000 (21:21 +0900)]
pci/bridge: clean up of pci_bridge_initfn()

- use symbolic constant
- use helper function pci_set_xxx()
- removed lines which initializes to 0.
  It is unnecessary because it is already zeroed.
- add some comments on command registers.

Some initial values are suspicious because they seems to
be specific to apb_pci.c which is the only user of pci bridge right now.
For now don't touch those values to avoid breakage.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: use helper functions to access pci config space.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:00 +0000 (21:21 +0900)]
pci: use helper functions to access pci config space.

use pci_[gs]et_{byte, word, long}() to access pci configuration
space.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: helper functions to access PCIDevice::config
Isaku Yamahata [Fri, 30 Oct 2009 12:20:59 +0000 (21:20 +0900)]
pci: helper functions to access PCIDevice::config

add helper functions to get/set PCIDevice::config
Those will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: define a constant to represent a unmapped bar and use it.
Isaku Yamahata [Fri, 30 Oct 2009 12:20:58 +0000 (21:20 +0900)]
pci: define a constant to represent a unmapped bar and use it.

define a constant to represent a unmapped bar instead of -1 and use it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: use PCI_SLOT() and PCI_FUNC().
Isaku Yamahata [Fri, 30 Oct 2009 12:20:57 +0000 (21:20 +0900)]
pci: use PCI_SLOT() and PCI_FUNC().

use PCI_SLOT() and PCI_FUNC() where appropriate instead of
direct use of bit operation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
Isaku Yamahata [Fri, 30 Oct 2009 12:20:56 +0000 (21:20 +0900)]
pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.

introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
and use it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: fix PCI_DPRINTF() wrt variadic macro.
Isaku Yamahata [Fri, 30 Oct 2009 12:20:55 +0000 (21:20 +0900)]
pci: fix PCI_DPRINTF() wrt variadic macro.

add missing ## in PCI_DPRINTF() to compile.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMakefile: make qemu-io dependent on config-host.h
Paolo Bonzini [Thu, 29 Oct 2009 18:46:35 +0000 (19:46 +0100)]
Makefile: make qemu-io dependent on config-host.h

This is needed also for qemu-io, but not for qemu-nbd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move scsi-disk.h -> scsi.h
Gerd Hoffmann [Fri, 30 Oct 2009 08:54:00 +0000 (09:54 +0100)]
scsi: move scsi-disk.h -> scsi.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move scsi.h -> esp.h
Gerd Hoffmann [Fri, 30 Oct 2009 08:53:59 +0000 (09:53 +0100)]
scsi: move scsi.h -> esp.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMakefile: make qemu-img dependant on config-host.h
Uri Lublin [Thu, 29 Oct 2009 18:40:01 +0000 (14:40 -0400)]
Makefile: make qemu-img dependant on config-host.h

Since config-host.h is generated by the Makefile (1215c6e76),
building (only) qemu-img fails:

[user@f12-uri qemu]$ make distclean (or git clone qemu)
[user@f12-uri qemu]$ ./configure ...
[user@f12-uri qemu]$ make qemu-img
GEN  config-all-devices.mak
GEN   qemu-img-cmds.h
CC    qemu-img.o
In file included from qemu-img.c:24:
qemu-common.h:32:25: error: config-host.h: No such file or directory

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agowhitelist host virtio networking features
Dustin Kirkland [Thu, 29 Oct 2009 15:34:15 +0000 (10:34 -0500)]
whitelist host virtio networking features

This patch is a followup to 8eca6b1bc770982595db2f7207c65051572436cb,
fixing crashes when guests with 2.6.25 virtio drivers have saturated
virtio network connections.

https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/458521

That patch should have been whitelisting *_HOST_* rather than the the
*_GUEST_* features.

I tested this by running an Ubuntu 8.04 Hardy guest (2.6.24 kernel +
2.6.25-virtio driver).  I saturated both the incoming, and outgoing
network connection with nc, seeing sustained 6MB/s up and 6MB/s down
bitrates for ~20 minutes.  Previously, this crashed immediately.  Now,
the guest does not crash and maintains network connectivity throughout
the test.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-img: Allow creating zero sized images
Kevin Wolf [Wed, 28 Oct 2009 10:36:07 +0000 (11:36 +0100)]
qemu-img: Allow creating zero sized images

A size of 0 should be valid and cannot be treated as "missing value". Use -1
for this purpose instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotap: drain queue in tap_send()
Mark McLoughlin [Tue, 27 Oct 2009 18:16:39 +0000 (18:16 +0000)]
tap: drain queue in tap_send()

Okay, let's try re-enabling the drain-entire-queue behaviour, with a
difference - before each subsequent packet, use qemu_can_send_packet()
to check that we can send it. This is similar to how we check before
polling the tap fd and avoids having to drop a packet if the receiver
cannot handle it.

This patch should be a performance improvement since we no longer have
to go through the mainloop for each packet.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-net: split the has_buffers() logic from can_receive()
Mark McLoughlin [Tue, 27 Oct 2009 18:16:38 +0000 (18:16 +0000)]
virtio-net: split the has_buffers() logic from can_receive()

We should only return zero from receive() for a condition which we'll
get notification of when it changes. Currently, we're returning zero
if the guest driver is not ready, but we won't ever flush our queue
when that status changes.

Also, don't check buffer space in can_receive(), but instead just allow
receive() to return zero when this condition occurs and have the caller
handle queueing the packet.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet/queue: queue packets even if sender doesn't supply a callback
Mark McLoughlin [Tue, 27 Oct 2009 18:16:37 +0000 (18:16 +0000)]
net/queue: queue packets even if sender doesn't supply a callback

Now that we disable any receiver whose queue is full, we do not require
senders to handle a zero return by supplying a sent callback.

This is a second step towards allowing can_receive() handlers to return
true even if no buffer space is available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: disable receiving if client returns zero
Mark McLoughlin [Tue, 27 Oct 2009 18:16:36 +0000 (18:16 +0000)]
net: disable receiving if client returns zero

If a receiver returns zero, that means its queue is full and it will
notify us when room is available using qemu_flush_queued_packets().

Take note of that and disable that receiver until it flushes its queue.

This is a first step towards allowing can_receive() handlers to return
true even if no buffer space is available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotap: disable draining queue in one go
Mark McLoughlin [Tue, 27 Oct 2009 18:16:35 +0000 (18:16 +0000)]
tap: disable draining queue in one go

If qemu_send_packet_async() returns zero, it means the packet has been
queued and the sent callback will be invoked once it has been flushed.

This is only possible where the NIC's receive() handler returns zero
and promises to notify the networking core that room is available in its
queue again.

In the case where the receive handler does not have this capability
(and its queue fills up) it returns -1 and the networking core does not
queue up the packet. This condition is indicated by a -1 return from
qemu_send_packet_async().

Currently, tap handles this condition simply by dropping the packet. It
should do its best to avoid getting into this situation by checking such
NIC's have room for a packet before copying the packet from the tap
interface.

tap_send() used to achieve this by only reading a single packet before
returning to the mainloop. That way, tap_can_send() is called before
reading each packet.

tap_send() was changed to completely drain the tap interface queue
without taking into account the situation where the NIC returns an
error and the packet is not queued. Let's start fixing this by
reverting to the previous behaviour of reading one packet at a time.

Reported-by: Scott Tsai <scottt.tw@gmail.com>
Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoConfigurable block format whitelist
Markus Armbruster [Tue, 27 Oct 2009 17:41:44 +0000 (18:41 +0100)]
Configurable block format whitelist

We have code for a quite a few block formats.  While I trust that all
of these formats are useful at least for some people in some
circumstances, some of them are of a kind that friends don't let
friends use in production.

This patch provides an optional block format whitelist, default off.
If a whitelist is configured with --block-drv-whitelist, QEMU proper
can use only whitelisted formats.  Other programs, like qemu-img, are
not affected.

Drivers for formats off the whitelist still participate in format
probing, to ensure all programs probe exactly the same.  Without that,
QEMU proper would be prone to treat images with a format off the
whitelist as raw when the image's format is probed.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user
Markus Armbruster [Tue, 27 Oct 2009 12:52:13 +0000 (13:52 +0100)]
qdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user

These devices are created automatically, and attempting to create
another one with -device fails with "qemu: hardware error:
register_ioport_write: invalid opaque".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoPass the drive's readonly attribute to the guest OS
Naphtali Sprei [Thu, 29 Oct 2009 09:42:11 +0000 (11:42 +0200)]
Pass the drive's readonly attribute to the guest OS

Implemented for virtio-blk and for scsi

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdded readonly flag to -drive command
Naphtali Sprei [Mon, 26 Oct 2009 14:25:16 +0000 (16:25 +0200)]
Added readonly flag to -drive command

This is a slightly revised patch for adding readonly flag to the -drive command.
Even though this patch is "stand-alone", it assumes a previous related patch (in Anthony staging tree), that passes
the readonly attribute of the drive to the guest OS, applied first.

This enables sharing same image between guests, with readonly access.
Implementaion mark the drive as read_only and changes the flags when actually opening the file.
The readonly attribute of a qcow also passed to it's base file.
For ide that cannot pass the readonly attribute to the guest OS, disallow the readonly flag.

Also, return error code from bdrv_truncate for readonly drive.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Allow qcow2 disk images with size zero
Stefan Weil [Mon, 26 Oct 2009 15:11:16 +0000 (16:11 +0100)]
qcow2: Allow qcow2 disk images with size zero

Images with disk size 0 may be used for
VM snapshots, but not to save normal block data.

It is possible to create such images using
qemu-img, but opening them later fails.

So even "qemu-img info image.qcow2" is not
possible for an image created with
"qemu-img create -f qcow2 image.qcow2 0".

This is fixed here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years ago(x86/Sparc/PPC)-user: fix cpu_copy
Blue Swirl [Sat, 7 Nov 2009 16:34:12 +0000 (16:34 +0000)]
(x86/Sparc/PPC)-user: fix cpu_copy

b55a37c981914aa8ecd21b9a2a2fb37f39b917c5 moved the call to cpu_reset
to user emulators. But cpu_copy also initializes a CPU structure, so add the
call also there.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoIDE: Fix reset handling
Blue Swirl [Sat, 7 Nov 2009 14:13:05 +0000 (14:13 +0000)]
IDE: Fix reset handling

Problem: x86 systems could not survive a few system_resets.

Clear most of IDE state when reset. Implement the missing reset handlers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agouser: move CPU reset call to main.c for x86/PPC/Sparc
Blue Swirl [Sat, 7 Nov 2009 10:37:06 +0000 (10:37 +0000)]
user: move CPU reset call to main.c for x86/PPC/Sparc

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPPC: rename cpu_ppc_reset to cpu_reset for consistency
Blue Swirl [Sat, 7 Nov 2009 10:36:04 +0000 (10:36 +0000)]
PPC: rename cpu_ppc_reset to cpu_reset for consistency

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc64/x86: remove unneeded calls to device reset
Blue Swirl [Sat, 7 Nov 2009 10:05:03 +0000 (10:05 +0000)]
Sparc64/x86: remove unneeded calls to device reset

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPPC: remove unneeded calls to device reset
Blue Swirl [Sat, 7 Nov 2009 09:32:21 +0000 (09:32 +0000)]
PPC: remove unneeded calls to device reset

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc32 (mostly): remove unneeded calls to device reset
Blue Swirl [Sat, 7 Nov 2009 08:55:24 +0000 (08:55 +0000)]
sparc32 (mostly): remove unneeded calls to device reset

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agov3: don't call reset functions on cpu initialization
Glauber Costa [Thu, 5 Nov 2009 18:05:15 +0000 (16:05 -0200)]
v3: don't call reset functions on cpu initialization

There is absolutely no need to call reset functions when initializing
devices. Since we are already registering them, calling qemu_system_reset()
should suffice. Actually, it is what happens when we reboot the machine,
and using the same process instead of a special case semantics will even
allow us to find bugs easier.

Furthermore, the fact that we initialize things like the cpu quite early,
leads to the need to introduce synchronization stuff like qemu_system_cond.
This patch removes it entirely. All we need to do is call qemu_system_reset()
only when we're already sure the system is up and running

I tested it with qemu (with and without io-thread) and qemu-kvm, and it
seems to be doing okay - although qemu-kvm uses a slightly different patch.

[ v2: user mode still needs cpu_reset, so put it in ifdef. ]
[ v3: leave qemu_system_cond for now. ]

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovga: fix line comparison
malc [Fri, 6 Nov 2009 13:08:26 +0000 (16:08 +0300)]
vga: fix line comparison

Line counter doesn't wrap.

Signed-off-by: malc <av1474@comtv.ru>
14 years agovga: Respect Line Compare Register in text modes
malc [Fri, 6 Nov 2009 00:46:12 +0000 (03:46 +0300)]
vga: Respect Line Compare Register in text modes

Unbreaks setup screen of Act1/PL

Signed-off-by: malc <av1474@comtv.ru>
14 years agoSparc: fix carry flag handling (Solaris bootblk fix)
Artyom Tarasenko [Wed, 4 Nov 2009 19:38:26 +0000 (19:38 +0000)]
Sparc: fix carry flag handling (Solaris bootblk fix)

The page 108 of the SPARC Version 8 Architecture Manual describes
that addcc and addxcc shall compute carry flag the same way.
The page 110 claims the same about subcc and subxcc instructions.
This patch fixes carry computation in corner cases and removes redundant code.
The most visible effect of the patch is enabling Solaris boot when using OBP.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
[blauwirbel@gmail.com: cleaned up formatting]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohw/sd: Support SDHC size cards
Andrzej Zaborowski [Tue, 3 Nov 2009 14:28:19 +0000 (15:28 +0100)]
hw/sd: Support SDHC size cards

This patch adds SHDC support (-sd sd.img, where sd.img is
larger than 1GB) to qemu.

Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agoFix the build when srcdir == objdir
Anthony Liguori [Mon, 2 Nov 2009 21:50:27 +0000 (15:50 -0600)]
Fix the build when srcdir == objdir

You would only see this error on a fresh clone when srcdir == objdir.  configure
will fail because roms/pcbios doesn't exist.

git submodule integration doesn't cleanup very well when switching between
branches so you'll get an roms/pcbios directory from normal operations if you
switch between old branches.

Thanks to a mistake in configure, if you build outside of srcdir, you'll also
get a valid roms/pcbios.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoUnbreak Linux build
Anthony Liguori [Fri, 30 Oct 2009 21:45:20 +0000 (16:45 -0500)]
Unbreak Linux build

  commit 71f4effce79ec0485586963ea764f2c212c72f26
  Author: Alexander Graf <agraf@suse.de>
  Date:   Fri Oct 30 22:27:00 2009 +0100

      Unbreak tap compilation on OS X

Broke the build on Linux due to a bad #if guard

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoUpdate gpxe roms to have BANNER_TIMEOUT=0
Anthony Liguori [Fri, 30 Oct 2009 21:44:26 +0000 (16:44 -0500)]
Update gpxe roms to have BANNER_TIMEOUT=0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoUnbreak tap compilation on OS X
Alexander Graf [Fri, 30 Oct 2009 21:27:00 +0000 (22:27 +0100)]
Unbreak tap compilation on OS X

Currently compiling the tap sources breaks on Mac OS X. This is because of:

  1) tap-linux.h requiring Linux includes
  2) typos
  3) missing #includes

This patch adds what's necessary to compile tap happily on Mac OS X.
I haven't tested if using tap actually works, but I don't think that's a
major issue as that code was probably seriously untested before already.

I didn't split the patch, because it's only a few lines of code and
splitting is probably not worth the effort here.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "Fall back to network boot as the last possible boot option"
Anthony Liguori [Fri, 30 Oct 2009 17:42:29 +0000 (12:42 -0500)]
Revert "Fall back to network boot as the last possible boot option"

This reverts commit 94ca5a985919cca312c505bbb0c824d175cc6bb8.

14 years agoFall back to network boot as the last possible boot option
Anthony Liguori [Fri, 30 Oct 2009 14:35:38 +0000 (09:35 -0500)]
Fall back to network boot as the last possible boot option

This is similiar to the default with most bare metal systems.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRemove e1000 rom loading hack
Anthony Liguori [Fri, 30 Oct 2009 14:28:36 +0000 (09:28 -0500)]
Remove e1000 rom loading hack

The gPXE rom supports BEV properly.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoSwitch from etherboot to gPXE
Anthony Liguori [Fri, 30 Oct 2009 14:23:27 +0000 (09:23 -0500)]
Switch from etherboot to gPXE

etherboot is deprecated and not under active development anymore.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoSwitch pc bios from pc-bios to seabios
Anthony Liguori [Fri, 30 Oct 2009 14:06:09 +0000 (09:06 -0500)]
Switch pc bios from pc-bios to seabios

SeaBIOS is a port of pc-bios to GCC.  Besides using a more modern tool chain,
SeaBIOS introduces a number of new features including PMM support, better
BEV and BCV support, and better PnP support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoUpdate SeaBIOS to latest upstream
Anthony Liguori [Fri, 30 Oct 2009 14:02:27 +0000 (09:02 -0500)]
Update SeaBIOS to latest upstream

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-net: fix macaddr config regression
Mark McLoughlin [Wed, 28 Oct 2009 14:07:23 +0000 (14:07 +0000)]
virtio-net: fix macaddr config regression

This commit:

    commit 97b15621
    virtio: use qdev properties for configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
makes a guest using virtio-net see an empty macaddr because we never
copy the macaddr into the location that virtio_net_get_config() uses.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/msix: fix table access issues
Michael S. Tsirkin [Mon, 26 Oct 2009 14:22:44 +0000 (16:22 +0200)]
qemu/msix: fix table access issues

Fixes a couple of issues with msix table access:
- With misbehaving guests, misaligned 4 byte access could overflow
  msix table and cause qemu to segfault. Since PCI spec requires
  host to only issue dword-aligned accesses, as a fix,
  it's enough to mask the address low bits.
- Tables use pci format, not native format, and so
  we must use pci_[sg]et_long on read/write.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu/virtio: make wmb compiler barrier + comments
Michael S. Tsirkin [Mon, 26 Oct 2009 13:17:15 +0000 (15:17 +0200)]
qemu/virtio: make wmb compiler barrier + comments

wmb must be at least a compiler barrier, even without SMP.
Further, we likely need some rmb()/mb() as well:
I have not audited the code but lguest has mb(),
add a comment for now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRemove aio_ctx from paio_* interface
Kevin Wolf [Mon, 26 Oct 2009 12:03:08 +0000 (13:03 +0100)]
Remove aio_ctx from paio_* interface

The context parameter in paio_submit isn't used anyway, so there is no reason
why block drivers should need to remember it. This also avoids passing a Linux
AIO context to paio_submit (which doesn't do any harm as long as the parameter
is unused, but it is highly confusing).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd *CFLAGS to LINK in rules.mak
Peter Hjalmarsson [Sat, 24 Oct 2009 09:34:02 +0000 (11:34 +0200)]
Add *CFLAGS to LINK in rules.mak

Sometimes when linking with gcc to get a predictable result you are suggested to also apply the compiler flags to the linker command.

For reference, please read:
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Link-Options.html

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoserial: Add missing bit
Stefan Weil [Mon, 26 Oct 2009 20:51:41 +0000 (21:51 +0100)]
serial: Add missing bit

Serial frames always start with a start bit.
This bit was missing in frame size calculation.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoserial: Support additional serial speed values
Stefan Weil [Mon, 26 Oct 2009 15:10:10 +0000 (16:10 +0100)]
serial: Support additional serial speed values

* Allow any speed value which is defined for Linux
  (and possibly other systems).
* Compare int values instead of double values.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb: print attached status in info qtree
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:51 +0000 (15:56 +0100)]
usb: print attached status in info qtree

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-host: use qdev for -usbdevice + rework.
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:50 +0000 (15:56 +0100)]
usb-host: use qdev for -usbdevice + rework.

Changes:

 * We don't create/delete devices, we attach/detach them instead.
 * The separate autofilter list is gone, we simply walk the list
   of devices directly instead.
 * Autofiltering is done unconditionally now.  Non-auto device scan
   code got dropped.
 * Autofiltering turns off the timer if there is nothing to do, it
   runs only in case there are unattached host devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-storage: use qdev for -usbdevice
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:49 +0000 (15:56 +0100)]
usb-storage: use qdev for -usbdevice

Hook up usb_msd_init.

Also rework handling of encrypted block devices,
move the code out vl.c.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb: make attach optional.
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:48 +0000 (15:56 +0100)]
usb: make attach optional.

Add a auto_attach field to USBDevice, which is enabled by default.
USB drivers can clear this field in case they do *not* want the device
being attached (i.e. plugged into a usb port) automatically after
successfull init().

Use cases (see next patches):
 * attaching encrypted mass storage devices.
 * -usbdevice host:...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-serial and braille: use qdev for -usbdevice
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:47 +0000 (15:56 +0100)]
usb-serial and braille: use qdev for -usbdevice

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-hid: use qdev for -usbdevice
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:46 +0000 (15:56 +0100)]
usb-hid: use qdev for -usbdevice

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb core: use qdev for -usbdevice
Gerd Hoffmann [Mon, 26 Oct 2009 14:56:45 +0000 (15:56 +0100)]
usb core: use qdev for -usbdevice

This patchs adds infrastructure to handle -usbdevice via qdev callbacks.
USBDeviceInfo gets a name field (for the -usbdevice driver name) and a
callback for -usbdevice parameter parsing.

The new usbdevice_create() function walks the qdev driver list and looks
for a usb driver with a matching name.  When a parameter parsing
callback is present it is called, otherwise the device is created via
usb_create_simple().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agouse rom loader for pc bios.
Gerd Hoffmann [Mon, 26 Oct 2009 11:18:27 +0000 (12:18 +0100)]
use rom loader for pc bios.

The pc bios shows up in 'info roms' now.

Note that the BIOS is mapped to two places: The complete rom at the top
of the memory, and the first 128k at 0xe0000.  Only the first place is
listed in 'info roms'.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovga roms: move loading from pc.c to vga drivers.
Gerd Hoffmann [Mon, 26 Oct 2009 11:18:26 +0000 (12:18 +0100)]
vga roms: move loading from pc.c to vga drivers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agorom loader: make vga+rom loading configurable.
Gerd Hoffmann [Mon, 26 Oct 2009 11:18:25 +0000 (12:18 +0100)]
rom loader: make vga+rom loading configurable.

The rom_add_vga() and rom_add_option() macros are transformed into
functions.  They look at the new rom_enable_driver_roms variable
and only do something if it is set to non-zero, making vga+option rom
loading runtime option.  pc_init() sets rom_enable_driver_roms to 1.

With this in place we can move the rom loading calls from pc.c to the
individual drivers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agorom loader: use qemu_strdup.
Gerd Hoffmann [Mon, 26 Oct 2009 11:18:24 +0000 (12:18 +0100)]
rom loader: use qemu_strdup.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move UFO support detection to tap-linux.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:16 +0000 (17:49 +0100)]
net: move UFO support detection to tap-linux.c

Only supported on Linux

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move tap_set_offload() code into tap-linux.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:15 +0000 (17:49 +0100)]
net: move tap_set_offload() code into tap-linux.c

TUNSETOFFLOAD is only available on Linux

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move tap_probe_vnet_hdr() to tap-linux.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:14 +0000 (17:49 +0100)]
net: move tap_probe_vnet_hdr() to tap-linux.c

Only Linux has support for IFF_VNET_HDR

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move tap_set_sndbuf() to tap-linux.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:13 +0000 (17:49 +0100)]
net: move tap_set_sndbuf() to tap-linux.c

TUNSETSNDBUF is only available on linux

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move linux code into net/tap-linux.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:12 +0000 (17:49 +0100)]
net: move linux code into net/tap-linux.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agobuild: add CONFIG_LINUX
Mark McLoughlin [Thu, 22 Oct 2009 16:49:11 +0000 (17:49 +0100)]
build: add CONFIG_LINUX

So I can add a tap-linux.c and use CONFIG_LINUX to pull it in
in Makefile

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move AIX code into net/tap-aix.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:10 +0000 (17:49 +0100)]
net: move AIX code into net/tap-aix.c

Okay, this makes the tap options available on AIX even though there's
no support, but if we want to do it right we should have not compile
the tap code at all on AIX using e.g. CONFIG_TAP.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move solaris code to net/tap-solaris.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:09 +0000 (17:49 +0100)]
net: move solaris code to net/tap-solaris.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: split BSD tap_open() out into net/tap-bsd.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:08 +0000 (17:49 +0100)]
net: split BSD tap_open() out into net/tap-bsd.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: split all the tap code out into net/tap.c
Mark McLoughlin [Thu, 22 Oct 2009 16:49:07 +0000 (17:49 +0100)]
net: split all the tap code out into net/tap.c

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move tap-linux.h under net/
Mark McLoughlin [Thu, 22 Oct 2009 16:49:06 +0000 (17:49 +0100)]
net: move tap-linux.h under net/

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move more stuff into net/tap-win32.c, add net/tap.h
Mark McLoughlin [Thu, 22 Oct 2009 16:49:05 +0000 (17:49 +0100)]
net: move more stuff into net/tap-win32.c, add net/tap.h

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move tap-win32.c under net/
Mark McLoughlin [Thu, 22 Oct 2009 16:49:04 +0000 (17:49 +0100)]
net: move tap-win32.c under net/

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move net-checksum.c under net/
Mark McLoughlin [Thu, 22 Oct 2009 16:49:03 +0000 (17:49 +0100)]
net: move net-checksum.c under net/

Also add a new net/checksum.h header

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: move net-queue.[ch] under net/
Mark McLoughlin [Fri, 23 Oct 2009 16:52:16 +0000 (17:52 +0100)]
net: move net-queue.[ch] under net/

[v2: handle building in a separate dir]

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "char: emit the OPENED event only when a new char connection is opened"
Anthony Liguori [Tue, 27 Oct 2009 15:14:50 +0000 (10:14 -0500)]
Revert "char: emit the OPENED event only when a new char connection is opened"

This reverts commit 6cfa64de908d67fb6f6b6e3ae4888dd863f69e44.

This breaks the monitor prompt.  Proper fix will come from Amit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoreally fix net.h
Anthony Liguori [Thu, 22 Oct 2009 20:29:03 +0000 (15:29 -0500)]
really fix net.h

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix signature of new_vlan_client
Anthony Liguori [Thu, 22 Oct 2009 20:27:24 +0000 (15:27 -0500)]
Fix signature of new_vlan_client

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-net: add tap_has_ufo flag to saved state
Mark McLoughlin [Thu, 22 Oct 2009 16:43:50 +0000 (17:43 +0100)]
virtio-net: add tap_has_ufo flag to saved state

If we tell the guest we support UFO and then migrate to host which
doesn't support it, we will find ourselves in grave difficulties.

Prevent this scenario by adding a flag to virtio-net's savevm format
which indicates whether the device requires host UFO support.

[v2:
  - add has_ufo uint8_t field for ease of vmstate conversion
  - use qemu_error()
]

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoEnable UFO on virtio-net and tap devices
Sridhar Samudrala [Thu, 22 Oct 2009 16:43:49 +0000 (17:43 +0100)]
Enable UFO on virtio-net and tap devices

Enable UFO on the host tap device if supported and allow setting UFO
on virtio-net in the guest.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoWork around dhclient brokenness
Anthony Liguori [Thu, 22 Oct 2009 16:43:48 +0000 (17:43 +0100)]
Work around dhclient brokenness

With the latest GSO/csum offload patches, any guest using an unpatched version
of dhclient (any Ubuntu guest, for instance), will no longer be able to get
a DHCP address.

dhclient is actually at fault here.  It uses AF_PACKET to receive DHCP responses
but does not check auxdata to see if the packet has a valid csum.  This causes
it to throw out the DHCP responses it gets from the virtio interface as there
is not a valid checksum.

Fedora has carried a patch to fix their dhclient (it's needed for Xen too) but
this patch has not made it into a release of dhclient.  AFAIK, the patch is in
the dhclient CVS but I cannot confirm since their CVS is not public.

This patch, suggested by Rusty, looks for UDP packets (of a normal MTU) and
explicitly adds a checksum to them if they are missing one.

This allows unpatched dhclients to continue to work without needing to update
the guest kernels.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-net: enable tap offload if guest supports it
Mark McLoughlin [Thu, 22 Oct 2009 16:43:47 +0000 (17:43 +0100)]
virtio-net: enable tap offload if guest supports it

We query the guest's feature set to see if it supports offload and,
if so, we enable those features on the tap interface.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: add tap_set_offload()
Mark McLoughlin [Thu, 22 Oct 2009 16:43:46 +0000 (17:43 +0100)]
net: add tap_set_offload()

This API allows virtio-net to enable various offload features on a
tap interface - e.g. to tell the host kernel it can pass up partial
checksums to userspace.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-net: add vnet_hdr support
Mark McLoughlin [Thu, 22 Oct 2009 16:43:45 +0000 (17:43 +0100)]
virtio-net: add vnet_hdr support

With '-netdev tap,id=foo -nic model=virtio,netdev=foo' virtio-net can
detect that its peer (i.e. the tap backend) supports vnet headers
and advertise to the guest that it can send packets with partial
checksums and/or TSO packets.

One complication is that if we're migrating and the source host
supports IFF_VNET_HDR but the destination host doesn't, we can't then
stop the guest from using those features. In this scenario, we just
fail the migration.

[v2:
 - add has_vnet_hdr uint32_t field for ease of vmstate conversion
 - use qemu_error()
]

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: implement tap support for receive_raw()
Mark McLoughlin [Thu, 22 Oct 2009 16:43:44 +0000 (17:43 +0100)]
net: implement tap support for receive_raw()

tap_receive_raw() always prepends a vnet header if IFF_VNET_HDR is
enabled.

tap_receive() only prepends when the a header is required but the NIC
doesn't supply one.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: use qemu_send_packet_raw() in qemu_announce_self()
Gleb Natapov [Thu, 22 Oct 2009 16:43:43 +0000 (17:43 +0100)]
net: use qemu_send_packet_raw() in qemu_announce_self()

Use qemu_send_packet_raw to send gratuitous arp. This will ensure that
vnet header is handled properly.

Also, avoid sending the gratuitous packet to the guest. There doesn't
appear to be any reason for doing that and the code will currently just
crash if the NIC is not associated with a vlan.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>