aboutsummaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)Author
2011-12-05xen_disk: remove dead codePaolo Bonzini
Xen_disk.c has support for using synchronous I/O instead of asynchronous, but it is compiled out by default. Remove it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-28ccid: Fix buffer overrun in handling of VSC_ATR messageMarkus Armbruster
ATR size exceeding the limit is diagnosed, but then we merrily use it anyway, overrunning card->atr[]. The message is read from a character device. Obvious security implications unless the other end of the character device is trusted. Spotted by Coverity. CVE-2011-4111. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-289pfs: improve portability to older systemsAneesh Kumar K.V
I guess we can also make sure we don't call local_ioc_getversion at all. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28eepro100: Fix alignment requirement for statistical countersStefan Weil
According to Intel's Open Source Software Developer Manual, the dump counters address must be Dword aligned. The new code enforces this alignment, so s->statsaddr may now be used with stw_le_pci_dma() and stl_le_pci_dma(). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28virtio: add and use virtio_set_featuresPaolo Bonzini
vdev->guest_features is not masking features that are not supported by the guest. Fix this by introducing a common wrapper to be used by all virtio bus implementations. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-289pfs: improve portability to older systemsPaolo Bonzini
Small requirements on "new" features have percolated to virtio-9p-local.c. In particular, the utimensat wrapper actually only supports dirfd = AT_FDCWD and flags = AT_SYMLINK_NOFOLLOW in the fallback code. Remove the arguments so that virtio-9p-local.c will not use AT_* constants. At the same time, fail local_ioc_getversion if the ioctl is not supported by the host. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-28Merge remote-tracking branch 'kwolf/block-stable' into stagingAnthony Liguori
2011-11-28Merge remote-tracking branch 'kraxel/usb.32' into stagingAnthony Liguori
2011-11-23usb-ehci: add register namesGerd Hoffmann
The mmio register name list only had the names for four port status registers. We emulate a EHCI adapter with six ports though, the last two ones are listed as "unknown" in traces. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-23usb-ehci: codestyle fixupsGerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-23usb-hub: implement resetGerd Hoffmann
based on a patch from hkran@linux.vnet.ibm.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-23rtl8139: Fix invalid IO access alignmentJulian Pidancet
This patch makes iPXE work with the rtl8139 emulation. The rtl8139 driver in iPXE issues a 16bit access on the ChipCmd register (offset 0x37) to check the status of the rx buffer. The offset of the ioport access was getting fixed up to 0x36 in qemu, causing the value read in iPXE to be invalid. This fixes an issue with iPXE reporting timeouts during TFTP transfers. Reposting this here because it is trivial enough and the original post on qemu-devel didn't attract much attention. Also, the inw() which was causing the issue has been replaced with an inb() in upstream iPXE: https://git.ipxe.org/ipxe.git/commit/91dd64ad25baa27954a7518e73df4fca8a2d0c93 Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-22usb-hub: wakeup on detach too.Gerd Hoffmann
When detaching devices from the usb hub we must wakeup too, otherwise the host misses the detach event. Commit 4a33a9ea06f6fbb08d8311a7cfed72975344f9ab does the same for device attach. Found by hkran@linux.vnet.ibm.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-22usb: fix usb_qdev_init error handling.Gerd Hoffmann
qdev doesn't call the ->exit callback on ->init failures, so we have to take care ourself that we cleanup property on errors. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-22usb: make usb_create_simple catch and pass up errors.Gerd Hoffmann
Use qdev_init() instead of qdev_init_nofail(), usb device initialization can fail, most common case being port and device speed mismatch. Handle failures correctly and pass up NULL pointers then. Also fixup usb_create_simple() callers (only one was buggy) to properly check for NULL pointers before referncing the usb_create_simple() return value. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-22scsi-generic: add as boot devicePaolo Bonzini
There is no reason why a scsi-generic device cannot boot if it has the right type, and indeed it provides already a bootindex property. So register those devices too. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22scsi: fix fw pathPaolo Bonzini
The pre-1.0 firmware path for SCSI devices already included the LUN using the suffix argument to add_boot_device_path. Avoid that it is included twice, and convert the colons to commas for consistency with other kinds of devices Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22usb-msd: do not register twice in the boot orderPaolo Bonzini
USB mass storage devices are registered twice in the boot order. To avoid having to keep the two paths in sync, pass the bootindex property down to the scsi-disk device and let it register itself. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-22virtio-blk: fix cross-endian config spacePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-21ivshmem: fix PCI BAR2 registration during initializationHongyong Zang
Ivshmem cannot work, and the command lspci cannot show ivshmem BAR2 in the guest. As for pci_register_bar(), parameter MemoryRegion should be s->bar instead of s->ivshmem. Reviewed-by: Avi Kivity <avi@redhat.com> Signed-off-by: Hongyong Zang <zanghongyong@huawei.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21msix: avoid mask updates if mask is unchangedMichael S. Tsirkin
Check pending bit only if vector mask status changed. This is not really important for qemu.git but helps fix a bug in qemu-kvm.git. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21msix: Prevent bogus mask updates on MMIO accessesMichael S. Tsirkin
>From: Jan Kiszka <jan.kiszka@siemens.com> Only accesses to the MSI-X table must trigger a call to msix_handle_mask_update, otherwise the vector value might be out of range. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21msix: track function masked in pci device stateMichael S. Tsirkin
Only go over the table when function is masked. This is not really important for qemu.git but helps fix a bug in qemu-kvm.git. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-219p: pass dotl flags to the unlinkat methodPaolo Bonzini
AT_REMOVEDIR is not defined on all systems. Pass the raw flags from the 9p protocol, which are always there. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-219p: allow compiling the dummy virtio-9p-handle.c code on LinuxPaolo Bonzini
Avoid a conflict on the definition of struct file_handle by using a replacement name. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21ivshmem: use migration blockers to prevent live migration in peer mode (v2)Anthony Liguori
Now when you try to migrate with ivshmem, you get a proper QMP error: (qemu) migrate tcp:localhost:1025 Migration is disabled when using feature 'peer mode' in device 'ivshmem' (qemu) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-21Merge remote-tracking branch 'kraxel/usb.31' into stagingAnthony Liguori
2011-11-21Merge remote-tracking branch 'origin/master' into stagingAnthony Liguori
2011-11-21ehci: add assertGerd Hoffmann
Coverity thinks q could be NULL there and warns. I believe it can't be NULL there. Add assert to prove it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21usb-storage: don't try to send the status early.Gerd Hoffmann
Until recently all scsi commands sent to scsi-disk did either transfer data or finished instantly. The correct implementation of SYNCRONIZE_CACHE changed the picture though, and usb-storage needs a fix to handle that case correctly.
2011-11-21usb-storage: drop result from device state.Gerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21usb-storage: drop tag from device state.Gerd Hoffmann
scsi keeps track of the tag in SCSIRequest, no need to store a separate copy. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21usb-storage: fill status in complete callback.Gerd Hoffmann
Put status word into device state, fill it in command_complete, have usb_msd_send_status just send it out. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-21usb-storage: move status debug message to usb_msd_send_status.Gerd Hoffmann
usb_msd_send_status can be called from different code paths, move the debug message into the function to make sure it is printed unconditionally. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-11-19loader: Fix read_targphys() to behave when read() failsMarkus Armbruster
Happily passes (size_t)-1 to rom_add_blob_fixed(), which promptly dies attempting to malloc that much. Spotted by Coverity. Bonus fix for ROMs larger than INT_MAX bytes: return ssize_t instead of int. Bug can't bite, because the only user load_aout() limits ROM size to an int value. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-11-19Merge branch 's390-1.0' of git://repo.or.cz/qemu/agrafBlue Swirl
* 's390-1.0' of git://repo.or.cz/qemu/agraf: s390x: initialize virtio dev region tcg: Use TCGReg for standard tcg-target entry points. tcg: Standardize on TCGReg as the enum for hard registers s390x: Add shutdown for TCG s390-virtio machine s390: Fix cpu shutdown for KVM s390: fix short kernel command lines s390: fix reset hypercall to reset the status s390x: implement SIGP restart and shutdown s390x: implement rrbe instruction properly s390x: update R and C bits in storage key s390x: make ipte 31-bit aware s390x: add ldeb instruction
2011-11-19Merge branch 'ppc-1.0' of git://repo.or.cz/qemu/agrafBlue Swirl
* 'ppc-1.0' of git://repo.or.cz/qemu/agraf: pseries: Fix qdev.id handling in the VIO bus code pseries: Allow kernel's early debug output to work pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESS pseries: Check we have a chardev in spapr_vty_init() pseries: Fix buggy spapr_vio_find_by_reg() pseries: Correct RAM size check for SLOF PPC: Fix for the gdb single step problem on an rfi instruction tcg-ppc64: Fix compile errors for userspace only builds with gcc 4.6 pseries: Fix initialization of sPAPREnvironment structure
2011-11-18Merge remote-tracking branch 'kwolf/block-stable' into stagingAnthony Liguori
2011-11-18pseries: Fix qdev.id handling in the VIO bus codeMichael Ellerman
When the user creates a device on the command line with -device, they can specify the id, using id=foo. Currently the VIO bus code overwrites this id with it's own value. We should only set qdev.id if it is not already set by the user. The device tree code uses qdev.id for the device tree node name, however we can't rely on the user specifiying the id using proper device tree syntax, ie. device@reg. So separate the device tree node name from the qdev.id, but use the same syntax, so they will match by default. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18pseries: Allow kernel's early debug output to workDavid Gibson
The PAPR specification defines a virtual TTY/console interface for guest OSes to use via the H_PUT_TERM_CHAR and H_GET_TERM_CHAR hypercalls. There can be multiple virtual ttys, so these take a "termno" parameter. This encodes which vty to use as the 'reg' property on the device tree node associated with that vty. However, with the early debug options enabled, the Linux kernel will attempt debugging output through the vty very early, before it has read the device tree. In this case it always uses a termno of 0. This works on the existing PowerVM hypervisor, so we assume there must be a hack / feature in there which interprets termno==0 to mean the default primary console. To help with debugging kernels, including existing distribution kernels, this patch implements a similar feature / hack in qemu. If termno==0 is supplied to H_{GET,PUT}_TERM_CHAR, they use the first available vty device instead. We need to be careful in the case that the user has manually created an spapr-vty at address 0. So first we search for the specified reg and only if that doesn't match do we fall back. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESSMichael Ellerman
In commit b4a78527359a4540d84d4cdf629d01cbb262f698 ("Place pseries vty devices at addresses more similar to existing machines"), we changed the default reg for the vty to 0x30000000, however we didn't update the default value for a user specified vty device. Fix that. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18pseries: Check we have a chardev in spapr_vty_init()Michael Ellerman
If qemu is run like: qemu-system-ppc64 -nodefaults -device spapr-vty We end up in spapr_vty_init() with dev->chardev == NULL. Currently that leads to a segfault because we unconditionally call qemu_chr_add_handlers(). Although we could make that call conditional, I think a spapr-vty without a chardev is basically useless so fail the init. This is similar to what the serial code does for example. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18pseries: Fix buggy spapr_vio_find_by_reg()David Gibson
The spapr_vio_find_by_reg() function in hw/spapr_vio.c is supposed to find the device structure for a PAPR virtual IO device with the given reg value, and return NULL if none exists. It does the first ok, but if no device with that reg exists, it just returns the last device traversed in the list. This patch fixes it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18pseries: Correct RAM size check for SLOFDavid Gibson
The SLOF firmware used on the pseries machine needs a reasonable amount of (guest) RAM in order to run, so we have a check in the machine init function to check that this is available. However, SLOF runs in real mode (MMU off) which means it can only actually access the RMA (Real Mode Area), not all of RAM. In many cases the RMA is the same as all RAM, but when running with Book3S HV KVM on PowerPC 970, the RMA must be especially allocated to be (host) physically contiguous. In this case, the RMA size is determined by what the host admin allocated at boot time, and will usually be less than the whole guest RAM size. This patch corrects the test to see if SLOF has enough memory for this case. In addition, more recent versions of SLOF that were committed earlier don't need quite as much memory as earlier versions. Therefore, this patch also reduces the amount of RAM we require to run SLOF. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-11-18scsi-block: always use SG_IO for MMC devicesPaolo Bonzini
CD burning messes up the state of the host page cache and host block device. Just pass all operations down to the device, even though that might have slightly worse performance. Everything else just is not reliable in combination with burning. Reported-by: Thomas Schmitt <scdbackup@gmx.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18scsi: pass down REQUEST SENSE to the device when there is no stored sensePaolo Bonzini
This will let scsi-block/scsi-generic report progress on long operations. Reported-by: Thomas Schmitt <scdbackup@gmxbackup.net> Tested-by: Thomas Schmitt <scdbackup@gmxbackup.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18scsi: remove block descriptors from CDsPaolo Bonzini
Reported-by: Thomas Schmitt <scdbackup@gmx.net> Tested-by: Thomas Schmitt <scdbackup@gmx.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18scsi: fix parsing of allocation length fieldPaolo Bonzini
- several MMC commands were parsed wrong by QEMU because their allocation length/parameter list length is placed in a non-standard position in the CDB (i.e. it is different from most commands with the same value in bits 5-7). - SEND VOLUME TAG length was multiplied by 40 which is not in SMC. The parameter list length is between 32 and 40 bytes. Same for MEDIUM SCAN (spec found at http://ldkelley.com/SCSI2/SCSI2-16.html but not in any of the PDFs I have here). - READ_POSITION (SSC) conflicts with PRE_FETCH (SBC). READ_POSITION's transfer length is not hardcoded to 20 in SSC; for PRE_FETCH cmd->xfer should be 0. Both fixed. - FORMAT MEDIUM (the SSC name for FORMAT UNIT) was missing. The FORMAT UNIT command is still somewhat broken for block devices because its parameter list length is not in the CDB. However it works for CD/DVD drives, which mandate the length of the payload. - fixed wrong sign-extensions for 32-bit fields (for the LBA field, this affects disks >1 TB). - several other SBC or SSC commands were missing or parsed wrong. - some commands were not in the list of "write" commands. Reported-by: Thomas Schmitt <scdbackup@gmx.net> Tested-by: Thomas Schmitt <scdbackup@gmx.net> (MMC bits only) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18scsi: update list of commandsPaolo Bonzini
Add more commands and their names, and remove SEEK(6) which is obsolete. Instead, use SET_CAPACITY which is still in SSC. Tested-by: Thomas Schmitt <scdbackup@gmx.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-18atapi: kill MODE SENSE(6), fix MODE SENSE(10)Paolo Bonzini
Mode page 2A of emulated ATAPI DVD-ROM should have page length 0x14 like SCSI CD-ROM, rather than 0x12. Mode page length is off by 8, as it should contain the length of the payload after the first two bytes. MODE SENSE(6) should be thrown out of ATAPI DVD-ROM emulation. It is not specified in the ATAPI list of MMC-2, and MMC-5 prescribes to use MODE SENSE(10). Anyway, its implementation is wrong. Reported-by: Thomas Schmitt <scdbackup@gmx.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>