notifier: event notifier implementation
event notifiers are slightly generalized eventfd descriptors. Currentimplementation depends on eventfd because vhost is the only user, andvhost depends on eventfd anyway, but a stub is provided for non-eventfdcase....
virtio: notifier support + APIs for queue fields
vhost needs physical addresses for ring and other queue fields,so add APIs for these. In particular, add binding API to sethost/guest notifiers. Will be used by vhost.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
virtio: add set_status callback
vhost net backend needs to be notified whenfrontend status changes. Add a callback,similar to set_features.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio: move typedef to qemu-common
make it possible to use type without header include,simplifying header dependencies.
virtio-pci: fill in notifier support
Support host/guest notifiers in virtio-pci.The last one only with kvm, that's okaybecause vhost relies on kvm anyway.
Note on kvm usage: kvm ioeventfd APIis implemented on non-kvm systems as well,this is the reason we don't need if (kvm_enabled())...
Fix -enable-kvm
Make vl.o compiled per target and fix a thinko in hw/acpi.c. It's not trivialto make kvm.h consumable by compiled-once files.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb: class specific interface requests
Mass Storage Reset and Get Max LUN are class specific requests, butthey were not marked as such in hw/usb-msd.c, moved thereforeClassInterfaceRequest and ClassInterfaceOutRequest from hw/usb-net.cto hw/usb.h.Furthermore there was a problem in hw/usb-ohci.c when using DEBUG...
Don't check for bus master for old guests
Older Linux guests don't activate the bus master enable bit. So for those wecan just try to be clever and track if they set the DEVICE_OK bit even thoughbus mastering is still disabled.
Under that condition we can disable the windows safety check. With that logic...
Compile most PPC devices only once
Make byte swapping unconditional since PPC is big endian.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Compile prep_pci only once
Compile openpic only once
Replace TARGET_PAGE_SIZE with 4096. Make byte swapping unconditionalsince PPC is big endian.
Compile ide/macio only once
Compile pflash_cfi01 only once
Push TARGET_WORDS_BIGENDIAN dependency to board level.
Compile pflash_cfi02 only once
Compile acpi only once
Use qemu_irqs to trigger CMOS S3 and SMI events.
Avoid using kvm.h, which uses CPUState.
Move KVM and Xen global flags to vl.c
pflash_cfi02: fix incorrect TARGET_FMT_lx/d use
Also use target_phys_addr_t for addresses.
error: Trim includes after "Move qemu_error & friends..."
Missed in commit 2f792016.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
balloon: Fix overflow when reporting actual memory size
Beginning with its introduction, the virtio balloon has had an overflow errorthat causes 'info balloon' to misreport the actual memory size when the balloonitself becomes larger than 4G. Use a cast when converting dev->actual from...
Compile some MIPS devices only once
Move CPU specific declarations to a separate file.
Fix build
Actually some systems don't define PAGE_SIZE. Fixes build breakageby f7736b91c40a617e93505e32dcbd2cb56aad8a23.
Compile ide/core only once
Make win2k install hack unconditional as it is still restricted tox86 only in vl.c.
Replace TARGET_PAGE_SIZE and 4096 with PAGE_SIZE.
Fix recent pxa270 serial breakage
This fixes a copy/paste bug introduced in commit2d48377a8531de63ec1d0c4b9b1959dc4b78356c that pushed TARGET_WORDS_BIGENDIANdependency to board level.
Signed-off-by: Lars Munch <lars@segv.dk>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
pci_host: fix breakage
This has been broken by commit 952760bb7bce7fbfe0afcf04fee268745f297b87
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix Sparc64 build
952760bb7bce7fbfe0afcf04fee268745f297b87 missed one change.
Compile pci_host only once
Convert pci_host_conf_register_mmio_noswap(x) topci_host_conf_register_mmio(x, 0).
Convert pci_host_conf_register_mmio(x) topci_host_conf_register_mmio(x, 1) for big endian hosts, all caseshappen to be BE.
Compile usb-ohci only once
Compile serial only once
Compile isa_mmio only once
Move x86 specific PC declarations to a separate file
x86 definitions (especially CPUState uses) prevent many files frombeing compiled within libhw.
Move x86 specific declarations (APIC stuff) to a separate file.
Revert "Convert atexit users to exit_notifier"
This reverts commit d7234f4d7e373a708e1df9ab565a71b71b189025.
Conflicts:
hw/xen_machine_pv.c
This should have never been committed.
Fix a typo
Fix a typo which broke Xen build
Rewrite mouse handlers to use QTAILQ and to have an activation function
And convert usb-hid to use it (to avoid regression with bisection)
Right now, when we do info mice and we've added a usb tablet, we don't see ituntil the guest starts using the tablet. We implement this behavior in order...
Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit fromexit_notifier. However, using exit_notifier means that there's one lessjustification for having global state in the first place.
Replace assert(0) with abort() or cpu_abort()
When building with -DNDEBUG, assert(0) will not stop executionso it must not be used for abnormal termination.
Use cpu_abort() when in CPU context, abort() otherwise.
scsi-disk: fix buffer overflow
In case s->version is shorter than 4 bytes we overflow the memcpy srcbuffer. Fix it by clearing the target buffer, then copy only theamount of bytes we actually have.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/usb-msd: fix some usb requests
The usb-msd device emulation needs some small tweaks in the requestsemulations. For instance, the reset/maxlun requests are class/interfacespecific so requests for them with the type class and recipient interfacebits sets have to be handled....
read-only: Another minor cleanup
Don't rely on CDROM hint for read_only attribute
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
disentangle tcg and deadline calculation
Just tell main_loop_wait whether to be blocking or nonblocking, so thatthere is no need to call qemu_cpus_have_work from the timer subsystem.Instead, tcg_cpu_exec can say "we want the main loop not to block because...
balloon: Do not save VM state wrt asynchronous virtio operations
When working with the VM state (for loadvm/savevm and migration), it is notvalid to load and store pointers since the validity of those pointers cannot beassured in the new qemu address space. Therefore, virtio_balloon_save() and...
block: add logical_block_size property
Add a logical block size attribute as various guest side tools onlyincrease the filesystem sector size based on it, not the advisoryphysical block size.
For scsi we already have support for a different logical block size...
Avoid crash on '-usbdevice <device>' without parameters
Many usbdevice_init implementors assume params is non-NULL.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote branch 'markus/qerror' into staging
Merge remote branch 'mst/pci' into staging
Large page TLB flush
QEMU uses a fixed page size for the CPU TLB. If the guest uses largepages then we effectively split these into multiple smaller pages, andpopulate the corresponding TLB entries on demand.
When the guest invalidates the TLB by virtual address we must invalidate...
monitor: Use argument type 'O' for device_add
While there, improve the params help text.
monitor: convert do_device_add() to QObject
qdev: Relax parsing of bus option
Treat multiple successive slashes as a one slash. Ignore trailingslashes. This is how POSIX pathnames work.
qdev: Convert qbus_find() to QError
Revert "qdev: Use QError for 'device not found' error"
This reverts commit 3ced9f7a36189aed94d8bf86f3f5087a53012455.
The next commit will convert all of qdev_device_add() to QError, andit'll be clearer with this partial conversion reverted.
error: Convert do_device_add() to QError
Conversion to QObject is still missing.
qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example-device foo is short for -device driver=foo. The name to use("driver" in the example) is passed as argument to qemu_opts_parse()....
qdev: convert setting device properties to QError
qdev: Hide "ptr" properties from users
Users can't set them, so qdev_device_help() shouldn't list them. Fixthat. Also make qdev_prop_parse() hide them instead of printing ameaningless "has no parser" error message.
Their value means nothing to users, so qdev_print_props() shouldn't...
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
error: Rename qemu_error_new() to qerror_report()
qdev: Fix -device and device_add to handle unsuitable bus gracefully
"device_add isa-serial,bus=pci.0" kills QEMU. Not good.
qdev: Factor qdev_create_from_info() out of qdev_create()
To make it obvious that -device and device_add can't die inhw_error().
qdev: Hide "no_user" devices from users
Users can't create them, so qdev_device_help() shouldn't list them.Fix that.
Also make qdev_device_add() pretend they don't exist. Before, itrejected them with a "can't be added via command line" message, which...
error: Don't abuse qemu_error() for non-error in scsi_hot_add()
Commit 30d335d6 converted an informational message frommonitor_printf() to qemu_error(), probably because the latter doesn'tneed a mon argument. A later commit will make qemu_error() print...
pc: Fix error reporting for -boot once
Commit 0ecdffbb created pc_boot_set() for use from monitor command"boot_set", via qemu_boot_set(). pc_boot_set() reports errors tocur_mon, which works fine for monitor code.
Commit e0f084bf reused the function int reset handler...
pc: Factor common code out of pc_boot_set() and cmos_init()
Code duplicated in commit 0ecdffbb. The two versions are similar, butnot identical:
block: Simplify usb_msd_initfn() test for "can read bdrv key"
The old test assumes that "hotplugged" implies "we have a currentmonitor for reading the key". This is in fact true, but it's notobviously true.
Aside: if it were false, we could pass a null pointer to...
error: Move qemu_error & friends into their own header
error: Don't abuse qemu_error() for non-error in qdev_device_help()
qdev_device_help() prints device information with qemu_error(). Alater commit will make qemu_error() print additional stuff that isonly appropriate for proper errors, and then this will break. Use...
error: Don't abuse qemu_error() for non-error in qbus_find()
qbus_find() adds an informational line to error messages, and printsboth lines with one qemu_error(). Use error_printf() for theinformational line instead.
While there, simplify: instead of printing buffers filled by...
load_elf: replace the address addend by a translation function
A few machines need to translate the ELF header addresses into physicaladdresses. Currently the only possibility is to add a value to theaddresses.
This patch replaces the addend argument by and a translation function...
pcnet: make subsystem vendor id match hardware
Real pcnet device (AT2450) apparently has subsystemdevice and vendor id set to 0, this is out of spec(which requires that vendor id is obtained from PCI SIG)but windows xp driver seems to need this in order...
eepro100: address pci todo's, use pci_set_xx
eepro100 uses macros which rely on a specificlocal variable name (pci_conf) which is scary.Some of the uses are wrong or unnecessary,remove them. The rest are small in number, open-codethem using pci_set_xx functions....
mips: add header to mips_int.c and mips_timer.c
spelling typo (compatibilty) in hw/fw_cfg.c
here's a trivial patch to fix the spelling of "compatibility":
Signed-off-by: Vagrant Cascadian <vagrant@freegeek.org>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
fdc: fix drive property handling.
Fix the floppy controller init wrappers to set the drive propertiesonly in case the DriveInfo pointers passed in are non NULL. This allowsto set the properties using -global.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
QMP: Introduce WATCHDOG event
It's emitted whenever the watchdog device's timer expires. The actiontaken is provided in the 'data' member.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Catch attempt to attach more than one device to a netdev
Guest device and host netdev are peers, i.e. it's a 1:1 relation.However, we fail to enforce that:
$ qemu -nodefaults --nographic -netdev user,id=net0 -device e1000,netdev=net0 -device virtio-net-pci,netdev=net0 -monitor stdio...
scsi: Make device scsi-disk reject /dev/sg*
You're supposed to use scsi-generic for that. Which rejects anythingbut /dev/sg*.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
kbd leds: ps/2 kbd
Add led status notification support to the ps/2 kbd driver.
kbd leds: usb kbd
Add led status notification support to the usb kbd driver.
qdev: Improve diagnostics for bad property values
Property "vlan" reports "failed to parse" even when the value parsesjust fine, but the result doesn't name an existing VLAN.
Similarly, properties "drive", "chr" and "netdev" misleadingly report"failed to parse" when the value doesn't name an existing host device....
QMP: Introduce RTC_CHANGE event
Emitted whenever the RTC time changes.
adding helper pci functions
Signed-off-by: Izik Eidus <ieidus@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pcnet APROMWE bit location (retry)
According to AMD document 21485D pp.141, APROMWE is bit 8 of BCR2.
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
net.c used a constant to signify no MSI vectors were specified. Extendthat to all qdev devices.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reported-by: "Michael S. Tsirkin" <mst@redhat.com>...
virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial
Use the named constant instead of -1.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reported-by: "Michael S. Tsirkin" <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block: Emit BLOCK_IO_ERROR before vm_stop() call
The next commit will move the STOP event into do_vm_stop(), tohave the expected event sequence we need to emit the I/O errorevent before calling vm_stop().
The expected sequence is:
{ "event": "BLOCK_IO_ERROR" [...] }...
ppc: don't define bamboo-0.13 as the default machine
It has been broken by commit 977b6b91cee1132f8c7b12d22f4b273091598e44.
Update to a hopefully more future proof FSF address
See also 8167ee883931cb20c6264fc19d040ce2dc6ceaaa,530e7615ce3c01882e582c84dc6304ab98a3d5c5 andfad6cb1a565bb73f83fc0e2654489457b489e436.
scsi: update comment on the standards revision
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ppc440_bamboo: Disable new virtio-serial features for 0.12 machine type
Disable the MULTIPORT feature and MSI vectors for the 0.12 machinetypes; those features are added only for 0.13 onwards.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ppc440_bamboo: Add 0.12 and 0.13 machine types for backward compat
Add a 0.12 machine type for compatibility with older versions. Mark thedefault one as 0.13.
s390-virtio: Fix compile error for virtio-block init
Commit 428c149b0be790b440e1cbee185b152cdb22feec modified the argumentthat virtio_blk_init takes. Update the s390 bus code that calls thisfunction.
Signed-off-by: Amit Shah <amit.shah@redhat.com>CC: Christoph Hellwig <hch@lst.de>...
hw/serial.c: fix THRE interrupt clearing
UART_IIR_THRI is not a mask, but a possible value for the IIR ID.Use UART_IIR_ID to extract this value.
Broken by commit 71e605f80313a632cc6714cde7bd240042dbdd95.
hw/serial.c: fix indentation
Merge remote branch 'qemu-kvm/uq/master' into pulls
x86: Extend validity of bsp_to_cpu
As we hard-wire the BSP to CPU 0 anyway and cpuid_apic_id equalscpu_index, bsp_to_cpu can also be based on the latter directly. Thiswill help an early user of it: KVM while initializing mp_state.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
KVM: Rework VCPU state writeback API
This grand cleanup drops all reset and vmsave/load relatedsynchronization points in favor of four(!) generic hooks:
- cpu_synchronize_all_states in qemu_savevm_state_complete (initial sync from kernel before vmsave)...
Allocate memory below 4GB as one chunk
Instead of allocating a separate chunk for the first 640KB and anotherfor 1MB+, allocate one large chunk. This plays well in terms of alignmentand size with large pages.
Signed-off-by: Avi Kivity <avi@redhat.com>...
eepro100: Keep includes sorted
I always try to keep standard includes sortedand add a comment why they are there (so theycan be removed when they are no longer needed).
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
eepro100: Remove C++ comments
C++ comments are unwanted, so this is fixed here.
eepro100: Add diagnose command
Real hardware would run an internal self-test.The emulation just returns a passed status.
Original patch was from Reimar Döffinger, thanks.