Introduce range.h
Extract range functions from pci.h. These will be used by later patchesby non-PCI devices. Adjust current users.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>(cherry picked from commit bf1b00712375bea65f2254dea8281fa646eebbd5)
pcie: simplify range check
Simplify code slighly by reversing the polarityfor the range check
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
pcie: clean up hot plug notification
Simplify logic for hotplug notification, by tracking state of thelogical interrupt condition. We then simply use this variable to makethe interrupt decision, according to spec.
API is made cleaner as we no longer force users to pass in...
x3130: pcie downstream port
Implement TI x3130 pcie downstream port switch.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
x3130: pcie upstream port
Implement TI x3130 pcie upstream port switch.
ioh3420: pcie root port in X58 ioh
Implements pcie root port switch in intel X58 iohwhose device id is 0x3420.
pcie port: define struct PCIEPort/PCIESlot and helper functions
define struct PCIEPort which represents common partof pci express port.(root, upstream and downstream.)add a helper function for pcie port which can be used commonly byroot/upstream/downstream port....
pci/bridge: fix pci_bridge_reset()
The lower bits of base/limit registers is RO and shouldn't be zerocleared on reset. This patch fixes it.In fact, the default value of base/limit registers aren't specifiedin the spec. And some bridges disable forwarding on reset instead of...
pcie: comment on hpev_intx
document hpev_intx.
pcie: helper functions for pcie capability and extended capability
This patch implements helper functions for pci express capabilityand pci express extended capability allocation.NOTE: presence detection depends on pci_qdev_init() change.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
pcie: add pcie constants to pcie_regs.h
add pcie constants to pcie_regs.h.Those constants should go to Linux pci_regs.h and then the file shouldgo away eventually.
msi: implements msi
implements msi related functions.
pci: use pci_word_test_and_clear_mask() in pci_device_reset()
use pci_clear_bit_word() in pci_device_reset() where appropriate.
pci: introduce helper function to handle msi-x and msi.
this patch implements helper functions to handle msi-x and msiuniformly.They will be used later.
pci: introduce helper functions to test-and-{clear, set} mask in configuration space
This patch introduces helper functions to test-and-{clear, set} mask in configurationspace. pci_{byte, word, long, quad}_test_and_{clear, set}_mask().They will be used later....
pci: make pci_del_capability() update for w1cmask
Clear w1cmask when deleting a pci capability.
msix: clear not only INTA, but all INTx when MSI-X is enabled.
clear not only INTA, but all INTx when MSI-X is enabled.
pci: implement RW1C register framework.
Implement RW1C register framework.With this patch, it would be easy to implementW1C register by just setting w1cmask.Later RW1C register will be used by pcie.
pci: sorting out type confusion in pci_register_bar().
This patch sorts out invalid use of pcibus_t.
In pci_register_bar(), pcibus_t wmask is used. It should,however, be uint64_t because it is used to setpci configuration space value(PCIDevice::wmask)...
pci: don't ignore invalid parameter for pci_register_bar().
Abort when invalid value for region_num is passed to pci_register_bar.That is caller's bug. Abort instead of silently ignoring invalid value.
pci: improve signature of pci_register_bar().
Make type uint8_t from int because PCIIORegion::type is uint8_t.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
pci_ids.h: add vendor id of Texas Intesruments
add vendor id of Texas Intesruments.
pci: consolidate pci_add_capability_at_offset() into pci_add_capability().
By making pci_add_capability() the special case ofpci_add_capability_at_offset() of offset = 0,consolidate pci_add_capability_at_offset() into pci_add_capability().
Cc: Stefan Weil <weil@mail.berlios.de>...
pci bridge: add helper function for ssvid capability.
helper function to add ssvid capability.
pci: call hotplug callback even when not hotplug case for later use.
call hotplug callback even when not hotplug case for later use.And move hotplug check into hotplug callback.PCIE slot needs this for card presence detection.
pci: make pci_parse_devfn() aware of func.
make pci_parse_devfn() aware of func. With func = NULL it behave as before.This will be used later.
pci_bridge: introduce pci bridge library.
introduce pci bridge library.convert apb bridge and dec p2p bridge to use new pci bridge library.save/restore is supported as a side effect.This is also preparation for pci express root/upstream/downstream port....
pci_bridge: clean up: remove pci_{register, unregister}_secondary_bus()
Remove pci_{register, unregister}_secondary_bus() by open code.They are old stype API and aren't used any more by others. So eliminate it.
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
To avoid confusion of primary bus with secondary bus,rename PCIBridge::bus to PCIBridge::sec_bus.
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
Move pci bridge related code into pci_bridge.c from pci.cfor further enhancement. pci.c is big enough now, so split it out.No code change but exporting some accesser functions.
In fact, few pci bridge functions stays in pci.c....
pci: move out pci internal structures, PCIBus, PCIBridge, and pci_bus_info.
move out pci internal structures, PCIBus, PCIBridge and pci_bus_info intoprivate header file, pci_internals.h.This is a preparation. Later pci bridge implementation will besplit out form pci.c into pci_bridge.c....
vhost: fix miration during device start
We need to know ring layout to allocate log buffer.So init rings first.
Also fixes a theoretical memory-leak-on-error.
https://bugzilla.redhat.com/show_bug.cgi?id=615228
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
e1000: fix access 4 bytes beyond buffer end
We do range check for size, and get size as buffer,but copy size + 4 bytes (4 is for FCS).Let's copy size bytes but put size + 4 in length.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
e1000: secrc support
Add support for secrc field. Reportedly needed by old RHEL guests.
pci hotplug: make pci hotplug return value to caller
make pci hotplug callback return value to caller.And when returning error, allocated resources are freed.
virtio-net: correct packet length math
We were requesting too much when checking bufferlength: size already includes host header length.
Further, we should not exit if we get a packet thatis too long, since this might not be under controlof the guest. Just drop the packet....
pci: fix bridge update
bridge config write should trigger updateson the secondary bus. never on the primary bus.
rtl8139: address TODOs
Make rtl8139 spec compliant, fixing reset valuesfor command register.
vmware_vga: fix reset value for command register
Make init value for this register match the spec.BAR address is 0 at init, so enabling itonly works by chance.
pcnet: address TODOs
pcnet enables memory/io on init, whichdoes not make sense as BAR values are wrong.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
pci hotplug: make pci_device_hot_remove() static
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Acked-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: fix pci_device_reset
Clear interrupt disable bit on reset, according to PCI spec.Fix pci_device_reset() with 64bit BAR.
AppleSMC device emulation
Intel Macs have a chip called the "AppleSMC" which they use to controlcertain Apple specific parts of the hardware, like the keyboard backgroundlight.
That chip is also used to store a key that Mac OS X uses to decrypt binaries....
pci: set PCI multi-function bit appropriately.
Set PCI multi-function bit according to multifunction property.PCI address, devfn ,is exported to users as addr property,so users can populate pci function(PCIDevice in qemu)at arbitrary devfn.It means each function(PCIDevice) don't know whether pci device...
pci: set multifunction property for normal device.
use pci_create_simple_multifunction() for normal device which setsmultifunction bit.At the moment, only pc_piix.c and mips_malta.c uses multifunctiondevices with piix3/4 pci-isa bridge.And other boards don't populate those devices....
pci_bridge: make pci bridge aware of pci multi function bit.
make pci bridge aware of pci multi function property and let pci genericcode to set the bit.
Cc: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
pci: introduce multifunction property.
introduce multifunction property.Also introduce new convenient device creation function whichwill be used later.
For bisectability this patch doesn't do anything, but sets the propertyresulting in no functional changes....
qdev: implement qdev_prop_set_bit().
implement qdev_prop_set_bit().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
pci: remove PCIDeviceInfo::header_type
replace PCIDeviceInfo::header_type with is_bridgeas suggested by Michael S. Tsirkin <mst@redhat.com>
pci: don't overwrite multi functio bit in pci header type.
Don't overwrite pci header type.Otherwise, multi function bit which pci_init_header_type() setsappropriately is lost.Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zerowhich is already zero cleared....
pci: insert assert that auto-assigned-address function is single function device.
Auto-assigned-address pci function (passing devfn = -1) is alwayssingle function.This patch adds assert() to guarantee that auto-assigned-address functionis always single function device at function = 0....
pci: use PCI_DEVFN() where appropriate.
Use PCI_DEVFN() and PCI_FUNC_MAX where appropriate.This patch make it clear that func = 0.
test:The following object files with/without this patch are stripped and compared.They remains same. arm-softmmu/versatile_pci.o...
Merge remote branch 'kwolf/for-anthony' into staging
qdev: Add a get_dev_path() function to BusInfo
This function is meant to provide a stable device path for buseswhich are able to implement it. If a bus has a globally uniqueaddresses scheme, one address level may be sufficient to providea path. Other buses may need to recursively traverse up the...
pci: Implement BusInfo.get_dev_path()
This works great for PCI since a <segment>:<bus>:<dev>.<fn> uniquelydescribes a global address. No need to traverse up the qdev tree.PCI segment support is a placeholder for compatibility once wesupport multiple segments....
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
eepro100: Add a dev field to eeprom new/free functions
This allows us to create a more meaningful savevm string.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-net: Incorporate a DeviceState pointer and let savevm track instances
Stuff a pointer to the DeviceState into the VirtIONet structure so thatwe can easily remove the vmstate entry later. Also, let vmstate trackthe instance number (it should always be zero internally since the...
qemu_ram_alloc: Add DeviceState and name parameters
These will be used to generate unique id strings for ramblocks. The namefield is required, the device pointer is optional as most callers don'thave a device. When there's no device or the device isn't a child of...
pci: Free the space allocated for the option rom on removal
scsi: Fix SCSI bus reset
When the controller raises the SCSI reset line, we have to perform therequested reset on all disks attached to the controller's bus. Moreover,reset is edge triggered, so avoid repeating it if the line was alreadyhigh.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
make rtc alatm work
Convert alarm time from BCD if needed before comparing with currenttime.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pc: Allocate all ram in a single qemu_ram_alloc()
This will benefit us when we migrate based on ramblock name sincewe won't be bouncing between separate blocks.
ide: Reject readonly drives unless CD-ROM
drive_init() doesn't permit option readonly for if=ide, but that'sworthless: we get it via if=none and -device.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ide: Reject invalid CHS geometry
drive_init() doesn't permit invalid CHS for if=ide, but that'sworthless: we get it via if=none and -device.
Add virtio disk identification support
This patch adds the final missing bits for support ofpassing a serial/id string to a virtio-blk guest driver.
The guest-side component already exists in the virtiodriver, and has recently been reworked by Ryan to export...
fdc: Reject unimplemented error actions
drive_init() doesn't permit them for if=floppy, but that's worthless:we get them via if=none and -global.
This can make device initialization fail. Since all callers offdctrl_init_isa() ignore its value, change it to die instead of...
qdev: Don't hw_error() in qdev_init_nofail()
Some of the failures are internal errors, and hw_error() is okay then.But the common way to fail is bad user input, e.g. -globalisa-fdc.driveA=foo where drive foo has an unsupported rerror value.
exit(1) instead....
scsi: Reject unimplemented error actions
drive_init() doesn't permit rerror for if=scsi, but that's worthless:we get it via if=none and -device.
Moreover, scsi-generic doesn't support werror. Since drive_init()doesn't catch that, option werror was silently ignored even with...
scsi: Error locations for -drive if=scsi device initialization
ide: Improve error messages
Use error_report(), because it points to the error location.
Reword "tried to assign twice" messages to make it clear that we'recomplaining about the unit property.
Report invalid unit property instead of failing silently....
ide: Replace IDEState members is_cdrom, is_cf by drive_kind
The two aren't independent variables. Make that obvious.
ide: Make ide_init_drive() return success
It still always succeeds. The next commits will add failures.
remove exec-all.h inclusion from cpu.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qdev: Decouple qdev_prop_drive from DriveInfo
Make the property point to BlockDriverState, cutting out the DriveInfomiddleman. This prepares the ground for block devices that don't havea DriveInfo.
Currently all user-defined ones have a DriveInfo, because the only way...
block: Catch attempt to attach multiple devices to a blockdev
For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foohappily creates two SCSI disks connected to the same block device.It's all downhill from there.
Device usb-storage deliberately attaches twice to the same blockdev,...
block: Fix virtual media change for if=none
BlockDriverState member removable controls whether virtual mediachange (monitor commands change, eject) is allowed. It is set whenthe "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.
The type hint is only set by drive_init(). It sets BDRV_TYPE_FLOPPY...
ide: Make PIIX and ISA IDE init functions return the qdev
pc: Fix CMOS info for drives defined with -device
Drives defined with drive if=ide get get created along with the IDEcontroller, inside machine>init(). That's before cmos_init().Drives defined with -device get created during generic device init.That's after cmos_init(). Because of that, CMOS has no information on...
scsi: scsi_bus_legacy_handle_cmdline() can fail, fix callers
None of its callers checks for failure. scsi_hot_add() can crashbecause of that:
(qemu) drive_add 4 if=scsi,format=host_device,file=/dev/sg1scsi-generic: scsi generic interface too oldSegmentation fault (core dumped)...
ide: Make it explicit that ide_create_drive() can't fail
All callers of ide_create_drive() ignore its value. Currentlyharmless, because it fails only when qdev_init() fails, which failsonly when ide_drive_initfn() fails, which never fails.
Brittle. Change it to die instead of silently ignoring failure....
blockdev: Clean up automatic drive deletion
We automatically delete blockdev host parts on unplug of the guestdevice. Too much magic, but we can't change that now.
The delete happens early in the guest device teardown, before theconnection to the host part is severed. Thus, the guest part's...
qdev-properties: Fix (u)intXX parsers
scanf calls must not use PRI constants, they have probably the wrong size andcorrupt memory. We could replace them by SCN ones, but strtol is simpler thanscanf here anyway. While at it, also fix the parsers to reject garbage after...
usb-uhci: fix commit 8e65b7c04965c8355e4ce43211582b6b83054e3d for vmstate
The commit 8e65b7c04965c8355e4ce43211582b6b83054e3d introducedexpire_time of UHCIState. But expire_time is not in vmstate, thesecond uhci_frame_timer will not be fired immediately after loadvm....
hw/omap : make local function static and remove declaration from header
Signed-off-by: cmchao <cmchao@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/omap1.c : separate interrupt controller module
hw/omap2.c : separate spi module
hw/omap2.c : separate tap module(Test-Chip-level)
hw/omwp2.c : separate l4 interconnect module
hw/omap1.c : separate uart module
hw/omap2.c : separate gpio module
hw/omap2.c : separate gptimer module
hw/omap2.c : separate synctimer module
hw/omap2.c : separate gpmc(general purpose memory controller)
hw/omap2.c : separate sdrc (sdram controller)
hw/omap1.c : separate gpio module
virtio-serial: Simplify virtio_serial_load()
For all i, ports_map[i] is used in and only in the i-th iteration.Replace the dynamic array by a scalar variable.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Acked-by: Amit Shah <amit.shah@redhat.com>...
usb-serial: Fail instead of crash when chardev is missing
Signed-off-by: Markus Armbruster <armbru@redhat.com>Acked-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
MIPS: fix fulong bios loading
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>