History | View | Annotate | Download (59.8 kB)
Merge commit 'ff71f2e8cacefae99179993204172bc65e4303df' into staging
pci: fix double free of romfile property
The qdev property release function frees any string properties. This wasresulting in a double free during hot unplug.
It manifests in network devices because block devices have a NULL romfileproperty by default....
pci: set memory type for memory behind the bridge
As we make upper bits in IO and prefetcheable memoryregisters writeable, we should declare supportfor 64 bit prefetcheable memory and 32 bit ioin the bridge.
This changes the default for apb, dec, but I'm guessing...
pci: fix bridge IO/BASE
commit 5caef97a16010f818ea8b950e2ee24ba876643ad introduceda regression: we do not make IO base/limit upper 16bit registers writeable, so we should report a 16 bitIO range type, not a 32 bit one.Note that PCI_PREF_RANGE_TYPE_32 is 0x0, but PCI_IO_RANGE_TYPE_32 is 0x1....
pci: Do not check if a bus exist in pci_parse_devaddr.
Actually, pci_parse_devaddr checks if the dom/bus of the PCI address exist. Butthis should be the jobs of a caller. In fact, the two callers of this functionwill try to retrieve the PCIBus related to the devaddr and return an error if...
pci: don't export an internal function
Make an internal function, pci_parse_devaddr,static.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: make another unused extern function static
Make pci_find_bus static and rename to pci_find_bus_nr to matchfunctionality.
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
qom: move properties from qdev to object
This is mostly code movement although not entirely. This makes properties partof the Object base class which means that we can now start using Object in ameaningful way outside of qdev.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and thenrebased it into a single step which avoids repeatedly touching every file inthe tree.
The first step was a sed-based addition of the parent type to the subclass...
qdev: kill off DeviceInfo
It is no longer used in the tree since everything is done natively throughQEMU Object Model.
qdev: remove info from class
Now DeviceInfo is no longer used after object construction. All of therelevant members have been moved to DeviceClass.
qdev: make DeviceInfo private
Introduce accessors and remove any code that directly accesses DeviceInfomembers.
pci: convert to QEMU Object Model
qdev: don't access name through info
We already have a QOM interface for this so let's use it.
qdev: move qdev->info to class
Right now, DeviceInfo acts as the class for qdev. In order to switch to aproper ObjectClass derivative, we need to ween all of the callers off ofinteracting directly with the info pointer.
pci: call reset unconditionally
Because now all PCI devices are converted to qdev.
vga: improve VGA logic
Improve VGA selection logic, push check for device availabilty to vl.c.Create the devices at board level unconditionally.
Remove now unused pci_try_create*() functions.
Make PCI VGA devices optional.
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>...
vmstate, memory: decouple vmstate from memory API
Currently creating a memory region automatically registers it forlive migration. This differs from other state (which is enumeratedin a VMStateDescription structure) and ties the live migration codeinto the memory core....
qapi: Convert query-pci
This also fixes a bug with the old version: QMP would invert device idand vendor id. This would look ok on HMP because it was printing"device:vendor" instead of "vendor:device".
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
pci: simplify memory region registration
The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) areidentical. Unify them.
Signed-off-by: Avi Kivity <avi@redhat.com>
pci: add pci_address_space_io()
Returns the I/O address space. Useful for implementingPCI-ISA bridge devices.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>
pci: implement bridge filtering
Support bridge filtering on top of the memoryAPI as suggested by Avi Kivity:
Create a memory region for the bridge's address space. This region isnot directly added to system_memory or its descendants. Devices underthe bridge see this region as its pci_address_space(). The region is...
pci: Remove unused pci_reserve_capability
eepro100 was the last user. Now pci_add_capability is powerful enough.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
PCI: delete unused mem_base and pci_to_cpu_addr
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
pci: Error on PCI capability collisions
Nothing good can happen when we overlap capabilities. This may happenwhen plugging in assigned devices or when devices models contain bugs.Detect the overlap and report it.
Based on qemu-kvm commit by Alex Williamson....
pci: add pci_address_space()
Returns the PCI address space. Useful for bridges that can obscurepart of the PCI address space.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
pci: remove support for pre memory API BARs
Not used anymore.
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: remove pci_register_bar_simple()
Superceded by pci_register_bar_region().
pci: convert pci rom to memory API
pci: remove pci_register_bar()
Superceded by pci_register_bar_region(). The implementationsare folded together.
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>...
pci: fold BAR mapping function into its caller
There is only one function, so no need for a function pointer.
pci: rename pci_register_bar_region() to pci_register_bar()
pci: pass I/O address space to new PCI bus
This lets us register BARs in the I/O address space.
pci: allow I/O BARs to be registered with pci_register_bar_region()
pci: add API to get a BAR's mapped address
Some (hacky) devices that have a back-channel to read thisaddress back outside the normal configuration mechanisms, suchas VMware svga.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>...
Merge remote-tracking branch 'mst/for_anthony' into staging
pci: pass address space to pci bus when created
This is now done sloppily, via get_system_memory(). Eventually callerswill be converted to stop using that.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: add MemoryRegion based BAR management API
Allow registering a BAR using a MemoryRegion. Once all users are converted,pci_register_bar() and pci_register_bar_simple() will be removed.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>...
pci: Common overflow prevention
Introduce pci_config_read/write_common helpers to prevent passingaccesses down the callback chain that go beyond the config space limits.Adjust length assertions as they are no longer correct (cutting maygenerate valid 3 byte accesses)....
pci: don't call qdev pci init method
As pci id initialization is moved to common layer,some initialization function can be empty.So don't call init method if NULL.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Merge remote-tracking branch 'origin/master' into pci
Conflicts: hw/virtio-pci.c
pci: move ids of config space into PCIDeviceInfo
vender id/device id... in configuration space are read-only registerswhich are commonly defined for all pci devices.So move those initialization into common place.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Conflicts: cpu-all.h
pci: Use of qemu_put_ram_ptr in pci_add_option_rom.
Prevent a deadlock caused by leaving a map cache bucket locked by thepreceding qemu_get_ram_ptr() call.
Signed-off-By: John Baboval <john.baboval@virtualcomputer.com>Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>...
Fix typo in code and comments
Replace writeable -> writable
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
pci: Add class 0x403 as 'audio controller'
Used by HD audio controllers like our intel-hda.
pci: add pci_register_bar_simple() API
This is similar to pci_register_bar(), but automatically registers a singlememory region spanning the entire BAR.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: add accessor function to get irq levels
Introduce accessor function to know INTx levels.It will be used later by q35.Although piix_pci tracks the intx line levels, it can be eliminatedby this helper function.
Cc: Michael S. Tsirkin <mst@redhat.com>...
pci: use devfn for pci_find_device() instead of (slot, fn) pair
(slot, fn) pair is somewhat confusing because of ARI.So use devfn for pci_find_device() instead of (slot, fn).
pci: use PCI_DEVFN in pci_get_bus_devfn()
Replace hardcoded logic by a common macro.
pci: use uint8_t for devfn_min
use uint8_t for devfn_min instead of int.
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
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.
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.
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.
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>