PCI device entries have to have a default version, not 2, because they are
used in the midle of other structures that can have _any_ version number.
We can't use proper versioning here until we have SubSections support.
Why we didn't noticed before? Because in a PC, the only device ported with
a version less that 2 is piix_pm, and for that one, default pci values are
right. If you use a virtio-console, you will see that its state it is not
loaded back.
Thanks to Amit Shah for reporting the problem and help debug the fix.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Doing this will make the vcpu ioctl be issued from the I/O thread, instead
of cpu thread. The correct behaviour is to call it from within the cpu thread,
as soon as we are ready to go.
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
The RTC emulation does not set the IRQ flags independent of the IRQ enable bits.
The original MC146818A datasheet from 1984 notes:
"flag bits in Register C [...] are set independent of the
state of the corresponding enable bits in Register B"
Similar sections can be found in newer documentation e.g. in rtc82885.
Qemu and Bochs set the IRQ flags only if they are enabled,
which breaks drivers polling on them.
The following patch corrects this for the update-ended-flag in Qemu only.
It does not fix the handling of the other flags.
Signed-off-by: Bernhard Kauer <kauer@tudos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back
to non-accelerated mode
We're seeing segfaults on systems without access to /dev/kvm. It
looks like the global kvm_allowed is being set just a little too late
in vl.c. This patch moves the kvm initialization a bit higher in the
vl.c main, just after options processing, and solves the segfaults.
We're carrying this patch in Ubuntu 9.10 Alpha. Please apply
upstream, or advise if and why this might not be the optimal solution.
Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Move the kvm_init() call a bit higher to fix a segfault when
/dev/kvm is not available. The kvm_allowed global needs
to be set correctly a little earlier.
Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
We should set $linux_aio to 'no' if detection failed, otherwise
its contents will be empty, which is a bug as we test for 'yes'
or 'no'.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
gcc 4.3.2 throws warnings when DEBUG_BUFFERED_FILE is defined, because
we are using the wrong format specifiers to print size_t/ssize_t values.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
When two AIO requests write to the same cluster, and this cluster is
unallocated, currently both requests allocate a new cluster and the second one
merges the first one when it is completed. This means an cluster allocation, a
read and a cluster deallocation which cause some overhead. If we simply let the
second request wait until the first one is done, we improve overall performance
with AIO requests (specifially, qcow2/virtio combinations).
This patch maintains a list of in-flight requests that have allocated new
clusters. A second request touching the same cluster is limited so that it
either doesn't touch the allocation of the first request (so it can have a
non-overlapping allocation) or it waits for the first request to complete.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
The wrong version of the preallocation patch has been applied, so this is the
remaining diff.
We can't use truncate to grow the image file to the right size because we don't
know if metadata has been written after the last data cluster. In this case
truncate would shrink the file and destroy its metadata. Write a zero sector at
the end of the virtual disk instead to ensure that the file is big enough.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
With cc-option we are testing if gcc just accept a particular option, we don't need CFLAGS at all. And this fixes the recursive problem with CFLAGS
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Here's a patch to fix the issue introduced by me, as Reimar Döffinger pointed out,
Reimar Döffinger wrote:
> On Thu, Aug 13, 2009 at 03:01:20PM +0300, Naphtali Sprei wrote:
>> Bug fix for segfault when run as i82551 HW:
>> Use Extended TBD only when HW supports it (i82558 and up).
>>
>> Added assertions to guard from such buffer overflow
>> Introduce the MAX_TCB_BYTE_COUNT macro
>> Allocate buf big enough as HW needs (MAX_ETH_FRAME_SIZE -> MAX_TCB_BYTE_COUNT)
>>
>>
>> I don't feel 100% OK with the "s->device >= i82558B" condition
>> since it relies on the numeric (hex) value of those defines, which currently
>> is correct, but changes (which I don't forsee now) might break it.
>
> It seems this was applied. Unfortunately this breaks things on FreeBSD.
> There seem to be multiple issues.
> First, the intel document says the 82551, 82550, 82559 models are all
> supersets of the 82558. Or in other words: they all support this
> feature.
> Only the 82557 does not.
> But then even for that the FreeBSD driver will fail.
> The reason for that is this line:
> eeprom_contents[0xa] = 0x4000;
> the value here must be 0x01000 for all 82557 models it seems.
Correct the logic of determining devices that supports
extended TxCB: only the 82557 do not support it.
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
one place is using strdup() instead of qemu_strdup
Fix it
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
There are few places in vl.c not using the qemu version of
malloc/free/strdup.
Fix it.
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vl.c will not link if CONFIG_KVM is not defined.
This patch fixes the problem.
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
PATH_MAX is used elsewhere in the qemu source tree without protection.
In addtion the actual code would not compile if PATH_MAX is not defined
Last the free() call is wrong as p is not malloc()ed.
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use function pci_config_set_device_id
* Use new macro PCI_DEVICE_ID_INTEL_82557
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add missing include for struct timeval.
* Replace non-portable strsep by local qemu_strsep.
* Use POSIX basename by including libgen.h.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
The company which made Virtual PC was Connectix.
They use the magic string "conectix" in their disk images.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Full coverage with properties and everything. You can add virtual usb
sticks this way now:
-drive if=none,id=pendrive,path=/some/where
-device usb-storage,drive=pendrive
-usbdevice disk:/path/to/image continues to work.
Other side effects:
usb storage is listed in 'info block' now.
kvm tree should be able to boot from usb via extboot (untested though).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Drop num_ports argument for usb_ohci_init_pci(), everybody
calls it with num_ports == 3, so it is pointless.
Convert ohci pci device into qdev.
TODO: convert non-pci ohci adapters.
You can add a OHCI USB Controller to your virtual pc now using
'-device pci-ohci'. Specifying a id is a good idea, so you can
attach usb devices to it, like this:
-device pci-ohci,id=ohci
-device usb-mouse,bus=ohci.0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Move usb code from vl.c to usb-bus.c and make it use the new data
structures added by qdev conversion. qemu usb core should be able
to handle multiple USB busses just fine now (untested though).
Kill some usb_*_init() legacy functions, use usb_create_simple()
instead.
Kill some FIXMEs added by the first qdev/usb patch.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add USBBus.
* Add USBDeviceInfo, move device callbacks here.
* Add usb-qdev helper functions.
* Switch drivers to qdev.
TODO:
* make the rest of qemu aware of usb busses and kill the FIXMEs
added by this patch.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Simplify the logic to do everything inside the function.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Simplify the logic to do everything inside the function. Return 0xff if index is out of range independetly of DEBUG_CIRRUS
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Simplify the logic to do everything inside the function.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Simplify the logic to do everything inside the function.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Simplify the logic to do everything inside the function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Simplify the logic to do everything inside the function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>