History | View | Annotate | Download (64.6 kB)
pci: Fix memory leak
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
pci: add creation functions that may fail
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
pci: typo in pcibus_get_dev_path()
This patch fixes typo in pcibus_get_dev_path().Without this patch, the result of pcibus_get_dev_path() isn't unique.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: bridge control fixup
PCI_BRIDGE_CTL_DISCARD_STATUS (bit 10 in bridge control register)is W1C so we should not make it writeable, otherwise the assert(!(wmask& w1cmask)) in pci_default_write_config() is hit
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
pci: memory leak of PCIDevice::rom_file
PCIDevice::rom_file is leaked.PCIDevice::rom_file is allocated in pci_qdev_init(), but not freed anywhere.free it in qemu_unregister_device().
pci: use qemu_malloc() in pcibus_get_dev_path()
use qemu_malloc() instead of direct use of malloc().
pci: deassert intx on reset.
deassert intx on device reset.So far pci_device_reset() is used for system reset.In that case, interrupt controller is reset at the same time so thatall irq is are deasserted.But now pci bus reset/flr is supported, and in that case irq needs to be...
pci: fix device paths
Patch a6a7005d14b3c32d4864a718fb1cb19c789f58a5 generatedbroken device paths. We snprintf with a length shorterthan the output, so the last character is discarded and replacedby the null byte. Fix it up by snprintf to a bufferwhich is larger by 1 byte and then memcpy the data (without...
pci: allow devices being tagged as not hotpluggable.
This patch adds a field to PCIDeviceInfo to tag devices as beingnot hotpluggable. Any attempt to plug-in or -out such a devicewill throw an error.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: fix migration path for devices behind bridges
The device path used for migration is currently broken forfor all devices behind a nested bridge.
Replace this by a hierarchical list of slot/function numbers, walkingthe path from root down to device. Add :00 after the domain number...
pci: introduce a helper function to convert qdev id to PCIDevice
This patch introduce a helper function to get PCIDevice from qdev id.This function will be used later.
pcie: add flr support
Support flr: trigger device reset on flr config write.
pci: don't use bus number in migration, stub out
Using bus numbers in migration is clearly wrong asthey are guest assigned. Not really sure what theright thing to do is, for now stick 0 in there so thingskeep working for non-nested setups, add a TODO....
Merge remote branch 'mst/for_anthony' into staging
Add bootindex for option roms.
Extend -option-rom command to have additional parameter ,bootindex=.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Add get_fw_dev_path callback for pci bus.
pci: untangle pci/msi dependency
msi depends on pci but pci should not depend on msi.The only dependency we have is a recent additionof pci_msi_ functions, IMO they add little enough toopen-code in the small number of users.
Follow-up patches add more cleanups....
pci: make command SERR bit writable
pcie aer needs SERR bit to be writable, and the PCI spec requiresthis as well. For compatibility, introduce compat global propertycommand_serr_enable and make this bit readonly for a pre 0.14 pcmachine.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
pci: fix bus walk under secondary bus reset
Take into account secondary bus reset bit forbus walk: devices behind a reset bus should notrespond to configuration cycles.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: Automatically patch PCI vendor id and device id in PCI ROM
PCI devices with different vendor or device ids sometimes sharethe same rom code. Only the ids and the checksumdiffers in a boot rom for such devices.
The i825xx ethernet controller family is a typical example...
pci: use qdev reset framework for pci bus reset
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: add W1C bits to pci status register
This patch adds W1C bit support in the initialization/reset of pcistatus registers.
pci: fix bridge control bit wmask
Bits 12 to 15 in bridge control register are reserver and must beread-only zero, curent mask is 0xffff which makes them writeable. Fixthis up by using symbolic bit names for writeable bits instead of ahardcoded constant....
pci: allow hotplug removal of cold-plugged devices
This patch fixes hot unplug of cold plugged devices(those present at system start), which got broken by5beb8ad503c88a76f2b8106c3b74b4ce485a60e1 .
PCI: Bus number from the bridge, not the device
pcibus_dev_print() was erroneously retrieving the device busnumber from the secondary bus number offset of the deviceinstead of the bridge above the device. This ends of landingin the 2nd byte of the 3rd BAR for devices, which thankfully...
Merge branch 'pci' into for_anthony
pci: improve w1c mask handling
- save/restore must not check w1c bits since they are in fact guest controlled- clear w1c bits on reset
Note: for express there are different kinds ofreset, some leave part of config space alone.We will likely need a sticky bit mask to implement this....
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: make pci_del_capability() update for w1cmask
Clear w1cmask when deleting a pci capability.
Fix spelling in comments
multifuction -> multifunctionsuccessfull -> successful.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
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.
Introduce range.h
Extract range functions from pci.h. These will be used by later patchesby non-PCI devices. Adjust current users.
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: 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: 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: 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....
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.
pci: fix bridge update
bridge config write should trigger updateson the secondary bus. never on the primary bus.
pci: fix pci_device_reset
Clear interrupt disable bit on reset, according to PCI spec.Fix pci_device_reset() with 64bit BAR.
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_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....
pci: remove PCIDeviceInfo::header_type
replace PCIDeviceInfo::header_type with is_bridgeas suggested by Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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: 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>...
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
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Clarify error message when a PCI slot is already in use (v2)
When mistakenly configuring two devices in the same PCI slot,QEMU gives a not entirely obvious message about a 'devfn' beingin use:
$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3...
qdev: Revert the hack to let -net nic and pci_add set qdev ID
Setting the ID in pci_nic_init() is a blatant violation of theDeviceState abstraction. Which even carries a comment advisingagainst this:
/* This structure should not be accessed directly. We declare it here...
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
pci-hotplug: make them aware of pci domain.
add helper function which converts root bus to pci domain.make them aware of pci domain.
pci: clean up of pci_set_default_subsystem_id().
Use pci accessor function.don't return value because it always return 0 andthe caller doesn't check the return value.
pci hotplug: add argument to pci hot plug callback.
Add argument, DeviceState*, to pci hot plug callback.The argument will be used later to remove global variable.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Acked-by: Gerd Hoffmann <kraxel@redhat.com>...
pci: irq_state vmstate breakage
Code for saving irq_state got vm_statemacros wrong, passing in the wrong parameter.As a result, we both saved a wrong valueand restored it to a wrong offset.
This leads to device and bus irq counts gettingout of sync, which in turn leads to interrupts getting lost or...
pci: cleanly backout of pci_qdev_init()
If the init function of a device fails, as might happen with deviceassignment, we never undo the work done by do_pci_register_device().This not only causes a bit of a memory leak, but also leaves a boguspointer in the bus devices array that can cause a segfault or...
pci: fix pci_find_bus().
When looking down child bus, it should look parent bridge'sbus number, not child bus's.Optimized tail recursion and style fix.
Cc: Blue Swirl <blauwirbel@gmail.com>Cc: "Michael S. Tsirkin" <mst@redhat.com>Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
pci: add API to add capability at a known offset
Unlike virtio, device emulations need to add pci capabilitiesat known offsets to match real hardware. Make this possibleby adding an appropriate API.
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...
pci: fix info pci with host bridge.
This patch fixes 525e05147d5a3bdc08caa422d108c1ef71b584b5.pci host bridge doesn't have header type of bridge.The check should be by header type, instead of pci class device.
Cc: Blue Swirl <blauwirbel@gmail.com>Cc: "Michael S. Tsirkin" <mst@redhat.com>...
pci: fix pci_find_bus()
typo in c021f8e65f5009a5ab5711d9d5326fcab553ef1c.comparison fix.
Cc: Blue Swirl <blauwirbel@gmail.com>Cc: "Michael S. Tsirkin" <mst@redhat.com>Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
PCI: show also host bridge data in "info pci" output
PCI: fix multiple bridge problems
When several PCI bridges were in use, monitor command "info pci" wouldenter into infinite loop. Buses behind the bridge were not discoverablebecause secondary and subordinate bus numbers were not used properly.Other buses were not found because bus search terminated on first miss....
PCI: fix bridge configuration
PCI bridges' qdev info structures must indicate bridge header type,otherwise critical bridge registers (esp. PCI_PRIMARY_BUS,PCI_SECONDARY_BUS, PCI_SUBORDINATE_BUS) will not be writable.
PCI: Convert pci_info() to QObject
The returned QObject is a QList of all buses. Each bus isrepresented by a QDict, which has a key with a QList of allPCI devices attached to it. Each device is represented bya QDict.
As has happended to other complex conversions, it's hard to...
PCI: do_pci_info(): PCI bridge devices support
This commit completes the do_pci_info() conversion toQObject by adding support to PCI bridge devices.
This is done by recursively adding devices in the"pci_bridge" key.
IMPORTANT: This code is being added separately because I could...
pci: allow loading roms via fw_cfg.
This patch adds a pci bus property 'rombar' which specifies wheneverthe pci rom should be loaded via pci rom bar (default) or via fw_cfg.The later can be used for compatibility with older qemu versions whereno pci rom bar is present....
PCI: Fix bus address conversion
Pass physical addresses to map functions instead of PCI bus addresses.
PCI: partially revert 2e01c8cf4b076b05013c87723e3fc710b50a0a7a
Bus address conversion was not correct.
PCI: make pci_mem_base private
Make pci_mem_base private to PCIBus. Add a function to set it.
pci: remove PCIBus::config_reg.
PCIBus::config_reg isn't used anymore, so remove it.
pci: s/PCI_SUBVENDOR_ID/PCI_SUBSYSTEM_VENDOR_ID/g
To match Linux PCI register definition,rename PCI_SUBVENDOR_ID to PCI_SUBSYSTEM_VENDOR_ID.
Revert "Revert "pci: interrupt disable bit support""
This reverts commit d587e0787153f0224a6140c5015609963ceaabfb.
Support PCI based option rom loading
Currently, we preload option roms into the option rom space in memory. Thisprevents DDIM from functioning correctly which severely limits the numberof roms we can support.
This patch introduces a pci_add_option_rom() which registers the...
pci romfiles: add property, add default to PCIDeviceInfo
This patch adds a romfile property to the pci bus. It allows to specifya romfile to load into the rom bar of the pci device. The default valuecomes from a new field in PCIDeviceInfo. The property allows to change...
Revert "pci: interrupt disable bit support"
This reverts commit 0ea5709a32085f7d14901a09d12bd35f9b267607.
Per discussion with Michael Tsirkin, this is too risky for 0.12
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: don't hw_error() when no slot is available.
Current PCI code will simply hw_error() and thus abort in case no freePCI slot is available or the requested PCI slot is already in use byanother device. For the hotplug case this behavior is not acceptable....
pci: prepare irq code for interrupt state
This rearranges code in preparation for interrupt stateimplementation.Changes: - split up bus walk away from interrupt handling into a subroutine - change irq_state from an array to bitmask - verify that irq_state values are 0 or 1 on load...
pci: interrupt status bit implementation
interrupt status is a mandatory feature in PCI spec,so devices must implement it to be spec compliant.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
pci: interrupt disable bit support
Interrupt disable bit is mandatory in PCI spec.Implement it to make devices spec compliant.
pci: vmstate_register() already assign consecutive numbers starting at 0
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: move apb specific stuff to apb_pci.c
pci code had a TODO to move apb specificpci bridge initialization to apb_pci.Implement this and remove the TODO.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: convert goto into scope in bridge_filter
goto into scope is evil. rearrange pci_bridge_filterso that we always go to end of function on error.
pci: pci bridge related clean up.
- fix bridge prefetchable memory accesser to check 64bit or not.- use pcibus_t consistently instead mixing pcibus_t and uint64_t.
pci: fix pci_config_get_io_base().
fix typo in pci_config_get_io_base().
pci: remove magic number, 256 in pci.c
This patch replaces magic number, 256, with ARRAY_SIZE().
pci: split up up pci_update mappings
Split bar address math into a separate function.In particular, this gets rid of an ugly forward gotointo scope that we have there.
pci: clean up of pci_update_mappings()
This patch converts r->size == 0 to !r_size.
pci: clean up of pci_init_wmask().
This patch replaces for loop by memset in pci_init_wmask().
pci: kill unnecessary included in pci.c
including pci_host.h isn't needed by pci.c.This patch kills it.
pci: s/pci_find_host_bus/pci_find_root_bus/g
This patch renames pci_find_host_bus() to pci_find_root_bus()as suggested by "Michael S. Tsirkin" <mst@redhat.com>.
pci: remove pci_sub_bus() by open coding.
Because pci_sub_bus() is used only once so eliminate itby open coding as suggested by "Michael S. Tsirkin" <mst@redhat.com>.
pci: fix pci_info_device().
It printed wrong limit value of bridge.This patch fixes it.