pci: simplify (pci_/pcie_mmcfg_)data_read()
Remove switch on length: we don't care abouthigh bits for value, so just return all onesif no device. And add one assert().
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
pci: move pci_data_{read, write}() declaration from pci.h to pci_host.h
Now pci host stuff has been moved from pci.[hc] to pci_host.[hc]so the declaration of pci_data_{read, write}() should be inpci_host.hThis patch moves them from pci.h to pci_host.h for consistency....
pci: fix pci_info_device().
It printed wrong limit value of bridge.This patch fixes it.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: pci.h cleanup: move out stuff not in pci.c
pci.h declares some functions which aren'tdefined in pci.h. Clean up moving thingsto appropriate headers, and update all users.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Revert "vga: do not resize the screen on hw_invalidate"
This causes ctrl+alt+u or ctrl+alt+f to not work when windows hasn't beenresized first. Other graphic emulators do resize the screen onhw_invalidate.
This reverts commit 0bd8246bfec1dfb2eb959f52db535572c0260f4c.
BCD cleanup
Combine multiple BCD implementations.
Signed-off-by: Paul Brook <paul@codesourcery.com>
DS1338 RTC
Implement MAXIM SD1338 RTC+NVRAM.
GPIO I2C rework
Reqrite bitbanging I2C implementation. New code improves stop/startcondition handling, and gives more accurate input line level.
Introduce intermediate abstraction layer for I2C bitbanging thatis not connected via a GPIO port.
ARM RealView I2C
Add ARM Realview I2C host emulation.
ARM PBX-A9 board support
Implement ARM RealView PBX-A9 board support.
sb16: remove highspeed reset code
It was never enabled in any of the public builds anyway.
Noticed by Steve Grubb.
Signed-off-by: malc <av1474@comtv.ru>
Convert linux bootrom to external rom and fw_cfg
We already have a working multiboot implementation that uses fw_cfg to getits kernel module etc. data in int19 runtime now.
So what's missing is a working linux boot option rom. While at it I figured itwould be a good idea to take the opcode generator out of pc.c and instead use...
Convert multiboot to fw_cfg backed data storage
Right now we load the guest kernel to RAM, fire off the BIOS, hope itdoesn't clobber memory and run an option rom that jumps into the kernel.
That breaks with SeaBIOS, as that clears memory. So let's read all...
Introduce rom_copy
We have several rom helpers currently, but none of them can get uscode that spans several roms into a pointer.
This patch introduces a function that copies over rom contents.
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fw_cfg: change cur_offset to 32 bits
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Block live migration
This patch introduces block migration called during live migration. Blockare being copied to the destination in an async way. First the code willtransfer the whole disk and then transfer all dirty blocks accumulted duringthe migration....
char: rename qemu_chr_reset to qemu_chr_generic_open
This function sends out the OPENED event to backends thathave drive the chardevs. The 'reset' is now a historicalartifact and we can now just call the function for what itis.
Signed-off-by: Amit Shah <amit.shah@redhat.com>...
LAN9118 emulation
Add SMSC LAN9118 ethernet emulation.
ARM PB-A8 support
Add ARM Realview PB-A8 board support.
mips_r4k: fix reset
(broken by 45a50b1668822c23afc2a89f724654e176518bc4)
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
PPC64: map Uni-North AGP bus aka fix Linux boot
Uni-North AGP device mapping was accidentally dropped in2e29bd04786003561303dcad940b38afe790fb9b.
Map the device.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
PPC64: Partial fix to Linux crash: revert to old devfn
Before 2e29bd04786003561303dcad940b38afe790fb9b, Uni-North host and AGPbridge were using the same devfn, 11 << 3. The net effect was that onlyAGP bridge was visible. This was changed in the commit to 13 << 3 for AGP....
PCI: make duplicate devfn allocation fatal
Only two callers of pci_create_simple/pci_register_device botheredto check the return value. Other cases were prone to crashing withspurious NULL pointer dereferences.
Make QEMU exit with an error message when devfn is attempted to...
mips malta: fix indentation
mips-malta: fix reset
pci: Fix function pci_default_write_config
Change 260c0cd3d985e51b15870ff47e17b7b930efbda1(pci: use range helper functions) introduced abug which made pci cirrus vga on mips malta(and maybe other pci devices) fail.
Don't change addr - its original value is needed...
mips: fix CPU reset
Don't load the kernel twice during reset.See f2d74978764f62d832d61ac17bb5d934ade58816.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix PPC crash
Because of a typo, structure field vga_bios_size was not initializedproperly and a bogus BAR6 for the nonexistent VGA BIOS appeared.
The bug was uncovered by c169998802505c244b8bcad562633f29de7d74a4.
ARM MPCore tweaks
Allow the user to specify the number of cores present on theRealView EB + ARM11MPCore board. Also split into its own configrather than guessing from the CPU name.
Realview/EB procid hacks
Guess core tile ID based on CPU type.
pci: fix the conversion of config field from array to pointer
e1000 fix: read access to some registers is missing.
While writing working on an e1000 driver for my university's OS Inoticed that some registers aren't readable in QEMU, but they shouldbe readable as stated in Intels Driver Developer Manual (and alsoverified on real hardware)....
fdc: fix vmstate variable passed
When code was transformed to use qdev_reset/vmstate registration, vmstatewas passed a variable of the wrong type
virtio-blk: Pass read errors to the guest
We need to signal not only write errors, but also read errors to the guestdriver. This fixes a regression introduced by 869a5c6d.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
eepro100: Fix boot ROM support
eepro100: Add missing .exit initialisation
Some devices did not have an initialisation valuefor entry ".exit". This is fixed here.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Check if unplug handler exists before calling it
A bus may have hotplugging enabled but not have the 'unplug'callback defined, which would lead to a crash on trying tounplug a device on the bus.
Fix by introducing an assert to check if the callback is valid....
serial: Add interface to set reference oscillator frequency
Many (most?) serial interfaces have a programmableclock which provides the reference frequency ("baudbase").So a fixed baudbase which is only set once can be wrong.
omap1.c is an example which could use the new interface...
microblaze: Move the kcmdline out of the way.
Avoids rom overlap conflicts.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Fix ARM MCore secondary cpu boot
Make MPCore secondary cpu initialization work with the new resethandling. Also change the inital FLAG value from 3 to zero to matchrecent kenrels.
Reject late rom loading
rom_+add_file/rom_add_blob only work correctly if called beforeload_all_roms. Enforce this rather than silently accepting and puttingthe rom in the wrong place at reset.
Fix ARM system emulation
Since 45a50b1 load_image_targphys should only be called once.ARM boards incorrectly call it every time the system is reset.
eepro100: Improve support for different devices
pci: use range helper functions.
clean up pci_default_write_config() by the range helper functions.
Suggested by Michael S. Tsirkin <mst@redhat.com>Cc: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: teach pci_default_config_write() ROM bar for normal/bridge device .
When updated ROM expantion address of header type 0, it missedto update mappings.Add PCI_ROM_ADDRESS check whether to call pci_update_mappings()Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1....
pci: initialize pci config headers depending it pci header type.
- Only sets default subsystem id for header type 00.(normal header type) because header type 01 doesn't have subsystem id, and uses the register for other purpose. So setting default subsystem id doesn't make sense....
pci: cosmetic on pci_upadte_mappings()
Remove one indentation of pci_update_mappings.Just for cosmetics, no logic change.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: factor out pci_for_each_device().
split out device iteration logic from pci_for_each_device().factored out function, pci_for_each_device_under_bus() will be used later.
pci: implement pci bridge filtering.
This patch implements pci bridge filtering.
TODO: currently almost all the map funcions assumesfiltered_size size and addr & ~(size - 1) addr.However with bridge filtering, they aren't always true.Teach them such cases, such that filtered_size < size and...
pci/monitor: print out bridge's filtering values and so on.
make pci_info_device() print out bridge's filtering value likeio base/limit, subbus and subordinate bus.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Acked-by: Michael S. Tsirkin <mst@redhat.com>...
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 areapointed 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>...
pci: remove bus_num member from struct PCIBus.
Since It can be retrieved from pci configuration space,the member is unnecessary.
pci: make pci configuration transaction more accurate.
This patch sorts out/enhances pci code to track pci bus topologymore accurately.- Track host bus bridge with pci domain number. Although the current qemu implementation supports only pci domian 0 yet....
pci: factor out the conversion logic from io port address into pci device.
factor out the logic which converts io port address into pci deviceand offset in PCI configuration space.
pci: move pci host stuff from pci.c to pci_host.c
Move pci host stuff from pci.c to pci_host.c.And add some comments.Later pcie host bridge functions will be defined in pcie_host.cnot to bloat pci.c.
pci_host: change the signature of pci_data_{read, write}.
change the first argument, void opaque to PCIBus *sof the pci_data_{read, write}.They aren't used as direct callback so the argument typedon't have to be void. So change it to the right type....
vmstate: introduce VMSTATE_BUFFER_UNSAFE_INFO.
VMSTATE_BUFFER_UNSAFE_INFO for as a buffer with specified VMStateInfo.It will be used later.
pci: pcie host and mmcfg support.
This patch adds common routines for pcie host bridge and pcie mmcfg.This will be used by q35 based chipset emulation.
pci: add helper functions to check ranges overlap.
add helper function to check ranges overlap suggested byMichael S. Tsirkin <mst@redhat.com>.His original suggestion was to use [first, last], however I chosento use offset, length pair, i.e. [offset, offset + length)...
pci_host: consolidate pci config address access.
consolidate pci_config address access into pci_host.c
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/sizeinstead of uint32_t.Later this type will be changed to uint64_t....
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.
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 representspci bus addr/size from uint32_t to uint64_t.And also change FMT_pcibus for printf.
In pci_update_mapping() checks 32bit overflow....
pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h
make constants for pci base address match pci_regs.h byrenaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx.
pci: clean up of pci_default_read_config.
This patch cleans up pci_default_read_config() removingugly 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>...
pci: make pci_bar() aware of header type 1.
make pci_bar() aware of header type 1. When PCI_ROM_SLOTit should return PCI_ROM_ADDRESS1 (!= PCI_ROM_ADDRESS)
pci_host.h: move functions in pci_host.h into .c file.
split static functions in pci_host.h into pci_host.c andpci_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...
pci: use helper functions to access pci config space.
use pci_[gs]et_{byte, word, long}() to access pci configurationspace.
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>
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...
pci: clean up pci_init_wmask()
use pci_set_word() for pci command register.
pci: fix PCI_DPRINTF() wrt variadic macro.
add missing ## in PCI_DPRINTF() to compile.
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.
pci: use PCI_SLOT() and PCI_FUNC().
use PCI_SLOT() and PCI_FUNC() where appropriate instead ofdirect use of bit operation.
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.
pci: helper functions to access PCIDevice::config
add helper functions to get/set PCIDevice::configThose will be used later.
whitelist host virtio networking features
This patch is a followup to 8eca6b1bc770982595db2f7207c65051572436cb,fixing crashes when guests with 2.6.25 virtio drivers have saturatedvirtio network connections.
https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/458521...
scsi: move scsi.h -> esp.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
scsi: move scsi-disk.h -> scsi.h
qdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user
These devices are created automatically, and attempting to createanother one with -device fails with "qemu: hardware error:register_ioport_write: invalid opaque".
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
Configurable block format whitelist
We have code for a quite a few block formats. While I trust that allof these formats are useful at least for some people in somecircumstances, some of them are of a kind that friends don't letfriends use in production....
virtio-net: split the has_buffers() logic from can_receive()
We should only return zero from receive() for a condition which we'llget notification of when it changes. Currently, we're returning zeroif the guest driver is not ready, but we won't ever flush our queue...
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>
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.
PPC: rename cpu_ppc_reset to cpu_reset for consistency
Sparc64/x86: remove unneeded calls to device reset
PPC: remove unneeded calls to device reset
sparc32 (mostly): remove unneeded calls to device reset
v3: don't call reset functions on cpu initialization
There is absolutely no need to call reset functions when initializingdevices. Since we are already registering them, calling qemu_system_reset()should suffice. Actually, it is what happens when we reboot the machine,...
vga: fix line comparison
Line counter doesn't wrap.
vga: Respect Line Compare Register in text modes
Unbreaks setup screen of Act1/PL
hw/sd: Support SDHC size cards
This patch adds SHDC support (-sd sd.img, where sd.img islarger than 1GB) to qemu.
Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Remove e1000 rom loading hack
The gPXE rom supports BEV properly.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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...
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>...
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,...
usb: print attached status in info qtree
serial: Add missing bit
Serial frames always start with a start bit.This bit was missing in frame size calculation.
usb-serial and braille: use qdev for -usbdevice
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 devicebeing attached (i.e. plugged into a usb port) automatically aftersuccessfull init().
Use cases (see next patches):...
usb-storage: use qdev for -usbdevice
Hook up usb_msd_init.
Also rework handling of encrypted block devices,move the code out vl.c.