Remove libhw
The entries for libhw* are no longer needed in .gitignore.
There is also no longer a difference between common-obj-y andhw-obj-y, so one of those two macros is sufficient.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
rtc: map CMOS index 0x37 to 0x32 on read and writes
QEMU's attempt to implement the century byte cover two possible placesfor the byte. A common one on modern chipsets is 0x32, but QEMU alsostores the value in 0x37 (apparently for IBM PS/2 compatibility---it's...
rtc: implement century byte
Implement the century byte in the RTC emulation, and test that it works.This leads to some annoying compatibility code because we need to treata value of 2000 for the base_year property as "use the century byteproperly" (which would be a value of 0)....
acpi: remove strzcpy (strncpy-identical) function; just use strncpy
Adjust all uses s/strzcpy/strncpy/ and mark these usesof strncpy as "ok".
Signed-off-by: Jim Meyering <meyering@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/r2d: add comment: this strncpy use is ok
hw/9pfs: avoid buffer overrun
v9fs_add_dir_node and qemu_v9fs_synth_add_file used strncpyto form node->name, which requires NUL-termination, butstrncpy does not ensure NUL-termination.Use pstrcpy, which does.
Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>...
lm32: avoid buffer overrun
Actually do what the comment says, using pstrcpy NUL-terminate:strncpy does not always do that.
bt: replace fragile snprintf use and unwarranted strncpy
In bt_hci_name_req a failed snprintf could return len larger thansizeof(params.name), which means the following memset call wouldhave a "length" value of (size_t)-1, -2, etc... Sounds scary.But currently, one can deduce that there is no problem:...
virtio-9p: avoid unwarranted uses of strncpy
In all of these cases, the uses of strncpy were unnecessary, sinceat each point of use we know that the NUL-terminated source bytesfit in the destination buffer. Use memcpy in place of strncpy.
vscsi: avoid unwarranted strncpy
Don't use strncpy when the source string is known to fitin the destination buffer. Use equivalent memcpy.We could even use strcpy, here, but some static analyzerswarn about that, so don't add new uses.
Acked-by: David Gibson <david@gibson.dropbear.id.au>...
scsi, pci, qdev, isa-bus, sysbus: don't let *_get_fw_dev_path return NULL
Use g_strdup rather than strdup, because the sole caller(qdev_get_fw_dev_path_helper) assumes it gets non-NULL, and dereferencesit. Besides, in that caller, the allocated buffer is already freed with...
Merge remote-tracking branch 'sstabellini/xen-2012-10-03' into staging
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Merge remote-tracking branch 'qmp/queue/qmp' into staging
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
Merge remote-tracking branch 'kraxel/usb.66' into staging
Make target_phys_addr_t 64 bits unconditionally
The hassle and compile time overhead of maintaining both 32-bit and 64-bitcapable source isn't worth the tiny performance advantage which is seen ona minority of configurations. Switch to compiling libhw only once, with...
xen: Introduce xen_modified_memory.
This function is to be used during live migration. Every write access to theguest memory should call this funcion so the Xen tools knows which pages aredirty.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>...
qemu/xen: Add 64 bits big bar support on qemu
Currently it is assumed PCI device BAR access < 4G memory. If there is such adevice whose BAR size is larger than 4G, it must access > 4G memory address.This patch enable the 64bits big BAR support on qemu....
xen: Fix, no unplug of pt device by platform device.
The Xen platform device will unplug any NICs if requested by the guest (PVonHVM)including a NIC that would have been passthrough. This patch makes sure that apassthrough device will not be unplug.
Reported-by: "Zhang, Yang Z" <yang.z.zhang@intel.com>...
vfio_pci: fix build on 32-bit systems
We cannot cast directly from pointer to uint64.
Cc: Alex Williamson <alex.williamson@redhat.com>Cc: Alex Barcelo <abarcelo@ac.upc.edu>Reported-by: Alex Barcelo <abarcelo@ac.upc.edu>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vfio: vfio-pci device assignment driver
This adds the core of the QEMU VFIO-based PCI device assignment driver.To make use of this driver, enable CONFIG_VFIO, CONFIG_VFIO_IOMMU_TYPE1,and CONFIG_VFIO_PCI in your host Linux kernel config. Load the vfio-pci...
vfio: Enable vfio-pci and mark supported
Enabled for all softmmu guests supporting PCI on Linux hosts. Notethat currently only x86 hosts have the kernel side VFIO IOMMU supportfor this. PPC (g3beige) is the only non-x86 guest known to work.ARM (veratile) hangs in firmware, others untested....
iostatus: change is_read to a bool
Do this while we are touching this part of the code, before introducingmore uses of "int is_read".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
iostatus: reorganize io error code
Move the common part of IDE/SCSI/virtio error handling to the blocklayer. The new function bdrv_error_action subsumes all three ofbdrv_emit_qmp_error_event, vm_stop, bdrv_iostatus_set_err.
The same scheme will be used for errors in block jobs....
iostatus: move BlockdevOnError declaration to QAPI
This will let block-stream reuse the enum. Places that used the enumsare renamed accordingly.
iostatus: rename BlockErrorAction, BlockQMPEventAction
We want to remove knowledge of BLOCK_ERR_STOP_ENOSPC from drivers;drivers should only be told whether to stop/report/ignore the error.On the other hand, we want to keep using the nicer BlockErrorAction...
virtio: don't mark unaccessed memory as dirty
offset of accessed buffer is calculated using iov_length, so itcan exceed accessed len. If that happensmath in len - offset wraps around, and size becomes wrong.As real value is 0, so this is harmless but unnecessary....
virtio-net: fix used len for tx
There is no out sg for TX, so used buf length for txshould always be 0.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio: use unsigned int for counting bytes in vq
The virtqueue_avail_bytes() function counts bytes in an int. Use anunsigned int instead.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio: Introduce virtqueue_get_avail_bytes()
The current virtqueue_avail_bytes() is oddly named, and checks if aparticular number of bytes are available in a vq. A better API is tofetch the number of bytes available in the vq, and let the caller dowhat's interesting with the numbers....
virtio-serial-bus: let chardev know the exact number of bytes requested
Using the virtqueue_avail_bytes() function had an unnecessarilycrippling effect on the number of bytes needed by the guest as reportedto the chardev layer in the can_read() callback....
Versatile Express: Add modelling of NOR flash
This patch adds modelling of the two NOR flash banks found on theVersatile Express motherboard. Tested with U-Boot running on an emulatedVersatile Express, with either A9 or A15 CoreTile.
Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>...
Versatile Express: Fix NOR flash 0 address and remove flash alias
In the A series memory map (implemented in the Cortex A15 CoreTile), thefirst NOR flash bank (flash 0) is mapped to address 0x08000000, whileaddress 0x00000000 can be configured as alias to either the first or the...
pl190: fix read of VECTADDR
Reading VECTADDR was causing us to set the current priority tothe wrong value, the most obvious effect of which was that wewould return the vector for the wrong interrupt as the resultof the read.
Signed-off-by: Brendan Fennell <bfennell@skynet.ie>...
hw/armv7m_nvic: Correctly register GIC region when setting up NVIC
When setting up the NVIC memory regions the memory range0x100..0xcff is aliased to an IO memory region that belongsto the ARM GIC. This aliased region should be added to theNVIC memory container, but the actual GIC IO memory region...
pci-assign: use monitor_handle_fd_param
There is no need to open-code the choice between a file descriptornumber or a named one. Just use monitor_handle_fd_param, whichalso takes care of printing the error message.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
usb: Fix usb_packet_map() in the presence of IOMMUs
With the IOMMU infrastructure introduced before 1.2, we need to usedma_memory_map() to obtain a qemu pointer to memory from an IO bus address.However, dma_memory_map() alters the given length to reflect the length...
add pc-1.3 machine type
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
compat: turn off msi/msix on xhci for old machine types
xhci: tweak limits
Set maxports to 15. This is what the usb3 route string can handle.
Set maxslots to 64. This is more than the number of root ports wecan have, but with additional hubs you can end up with more devices.
Set maxintrs (aka msi vectors) to 16. Should be enougth, especially...
xhci: route string & usb hub support
Parse route string in slot contexts andsupport devices connected via hub.
xhci: create a memory region for each port
ehci: Fix interrupt packet MULT handling
There are several issues with our handling of the MULT epcap fieldof interrupt qhs, which this patch fixes.
1) When we don't execute a transaction because of the transaction counterbeing 0, p->async stays EHCI_ASYNC_NONE, and the next time we process the...
add a boot parameter to set reboot timeout
Added an option to let qemu transfer a configuration file to bios,"etc/boot-fail-wait", which could be specified by command -boot reboot-timeout=TT have a max value of 0xffff, unit is ms.
With this option, guest will wait for a given time if not find...
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ivshmem: add 64bit option
This patch adds a "use64" property which will make the ivshmem driverregister a 64bit memory bar when set, so you have something to play withwhen testing 64bit pci bits. It also allows to have quite big sharedmemory regions, like this:...
acpi: use notifier for signaling guest system_powerdown command
In addition, there is no need to allocate an extra irq just forrising SCI in irq handler. Just rise SCI right from notifierhandler instead.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>...
target-arm: use notifier for signaling guest system_powerdown command
Acked-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
target-sparc: use notifier for signaling guest system_powerdown command
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote-tracking branch 'bonzini/scsi-next' into staging
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
cadence_uart: Fix buffer overflow
Report from smatch:hw/cadence_uart.c:413 uart_read(13) error: buffer overflow 's->r' 18 <= 18
This fixes read access to s->r[R_MAX] which is behind the limits of s->r.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
lm4549: Fix buffer overflow
Report from smatch:lm4549.c:234 lm4549_write_samples(14) error: buffer overflow 's->buffer' 1024 <= 1024
There must be enough space to add two entries starting with indexs->buffer_level, therefore the old check was wrong....
ioh3420: Remove unreachable code
Report from smatch:hw/ioh3420.c:128 ioh3420_initfn(35) info: ignoring unreachable code.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
pflash_cfi01: Fix warning caused by unreachable code
Report from smatch:hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code.
Instead of removing the return statement after the switch statement,the patch replaces the return statements in the switch statement by...
Merge branch 'usb.65' of git://git.kraxel.org/qemu
scsi-disk: use scsi_data_cdb_length
This simplifies and unifies the parsing of READ, WRITE and WRITE SAMEcommands.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
SCSI: Standard INQUIRY data should report HiSup flag as set.
QEMU as far as I know only reports LUN numbers using the modes thatare described in SAM4.As such, since all LUN numbers generated by the SCSI emulation in QEMUfollow SAM4, we should set the HiSup bit in the standard INQUIRY data...
scsi: introduce scsi_cdb_length and scsi_data_cdb_length
scsi-disk: introduce check_lba_range
Abstract the test for an out-of-range (starting block, block count)pair.
scsi-disk: fix check for out-of-range LBA
This fix is needed to correctly handle 0-block read and writes.Without it, a 0-block access at LBA 0 would underflow.
pflash_cfi01: fix vendor specific extended query
pflash_cfi01 announces a version number of 1.1, which implies"Protection Register Information" and "Burst Read information" sections, which are not provided.
Decrease the version number to 1.0 so that only the "Protection...
hw/pflash_cfi012: Use host-utils.h ctz32()
Drop the private reimplementation of ctz32() from pflash_cfi012in favour of using the standard version from host-utils.h.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Stefan Weil <sw@weilnetz.de>...
xilinx_timer: Fix a compile error if debug enabled
There was a missing include of qemu-log and a variable name in a printf was outof date.
Signed-off-by: Chris Wulff <crwulff@gmail.com>Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
xilinx_timer: Removed comma in device name
Fixes an error in a61e4b07a30c062260d2d01771773f14820d1eb7
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
xilinx_timer: Send dbg msgs to stderr not stdout
xilinx_timer: Fixed "frequency" prop name
The "frequency" qdev prop matches the "clock-frequency" property in Xilinx EDK.Renamed "frequency" -> "clock-frequency" accordingly.
xilinx.h: Error check when setting links
Assert that the ethernet and dma controller are sucessfully linked to theirpeers.
xilinx: fix names of ethernet and dma links.
These names were incorrect. Fixed to match to actual link names
Merge remote-tracking branch 'spice/spice.v60' into staging
Merge remote-tracking branch 'stefanha/net' into staging
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
pc: Drop practically unused BOCHS BIOS debug ports
We have debugcon these days to listen on those ports that receive debugmessages. Also drop the others that have no effect anymore.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove unused CONFIG_TCG_PASS_AREG0 and dead code
Now that CONFIG_TCG_PASS_AREG0 is enabled for all targets,remove dead code and support for !CONFIG_TCG_PASS_AREG0 case.
Remove dyngen-exec.h and all references to it. Although included byhw/spapr_hcall.c, it does not seem to use it....
net: clean up usbnet_receive()
The USB network interface has two code paths depending on whether or notRNDIS mode is enabled. Refactor usbnet_receive() so that there is acommon path throughout the function instead of duplicating everythingacross if (is_rndis(s)) ... else ... code paths....
net: fix usbnet_receive() packet drops
The USB network interface has a single buffer which the guest readsfrom. This patch prevents multiple calls to usbnet_receive() fromclobbering the input buffer. Instead we queue packets until bufferspace becomes available again....
net: notify iothread after flushing queue
virtio-net has code to flush the queue and notify the iothreadwhenever new receive buffers are added by the guest. That isfine, and indeed we need to do the same in all other drivers.However, notifying the iothread should be work for the network...
e1000: flush queue whenever can_receive can go from false to true
When the guests replenish the receive ring buffer, the network deviceshould flush its queue of pending packets. This is done withqemu_flush_queued_packets.
e1000's can_receive can go from false to true when RCTL or RDT are...
xen: flush queue when getting an event
xen does not have a register that, when written, will cause can_receiveto go from false to true. However, flushing the queue can be attemptedwhenever the front-end raises its side of the Xen event channel. There...
eepro100: Fix network hang when rx buffers run out
This is reported by QA. When installing os with pxe, after the initialkernel and initrd are loaded, the procedure tries to copy files from installserver to local harddisk, the network becomes stall because of running out of...
Spelling fixes in comments and documentation
These wrong spellings were detected by codespell:
["also is" -> "is also" and "ressources" -> "resources" suggested by...
Fix spelling (licenced -> licensed) in GPL
The patch also fixes the case of "written".
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Spelling fixes in comments and macro names (ressource -> resource)
Macro XEN_HOST_PCI_RESOURCE_BUFFER_SIZE is only used locally,so the change should be safe.
srp: Don't use QEMU_PACKED for single elements of a structured type
QEMU_PACKED results in a MinGW compiler warning when it isused for single structure elements:
warning: 'gcc_struct' attribute ignored
Using QEMU_PACKED for the whole structure avoids the compiler warning...
usb-redir: Add support for migration
Signed-off-by: Hans de Goede <hdegoede@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-redir: Add chardev open / close debug logging
usb-redir: Revert usb-redir part of commit 93bfef4c
Commit 93bfef4c6e4b23caea9d51e1099d06433d8835a4 makes qemu-deviceswhich report the qemu version string to the guest in some way use aqemu_get_version function which reports a machine-specific version string....
uhci: Don't queue up packets after one with the SPD flag set
Don't queue up packets after a packet with the SPD (short packet detect)flag set. Since we won't know if the packet will actually be short until ithas completed, and if it is short we should stop the queue....
ehci: Don't set seen to 0 when removing unseen queue-heads
When removing unseen queue-heads from the async queue list, we should notset the seen flag to 0, as this may cause them to be removed byehci_queues_rip_unused() during the next call to ehci_advance_async_state()...
ehci: Walk async schedule before and after migration
usb-redir: Change cancelled packet code into a generic packet-id queue
usb-redir: Add an already_in_flight packet-id queue
After a live migration, the usb-hcd will re-queue all packets bywalking over the schedule in the guest memory again, but requests whichwere encountered on the migration source before will already be in flight,...
usb-redir: Store max_packet_size in endp_data
So that we've a place to migrate it to / from to allow restoring it aftermigration.
hw/qxl: support client monitor configuration via device
Until now we used only the agent to change the monitor count and eachmonitor resolution. This patch introduces the qemu part of using thedevice as the mediator instead of the agent via virtio-serial....
hw/qxl: tracing fixes
Add two new trace events:qxl_send_events(int qid, uint32_t events) "%d %d" qxl_set_guest_bug(int qid) "%d"
Change qxl_io_unexpected_vga_mode parameters to be equivalent to thoseof qxl_io_write for easier grouping under a single systemtap probe....
qxl: add trace-event for QXL_IO_LOG
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>