summaryrefslogtreecommitdiffstats
path: root/hw/pci.c
Commit message (Collapse)AuthorAgeFilesLines
* qdev: register all types natively through QEMU Object ModelAnthony Liguori2012-02-031-11/+10
| | | | | | | | | | | | | | | | | | | | | This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: remove info from classAnthony Liguori2012-02-031-1/+3
| | | | | | | Now DeviceInfo is no longer used after object construction. All of the relevant members have been moved to DeviceClass. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: make DeviceInfo privateAnthony Liguori2012-02-031-5/+8
| | | | | | | Introduce accessors and remove any code that directly accesses DeviceInfo members. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: convert to QEMU Object ModelAnthony Liguori2012-01-271-69/+54
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: don't access name through infoAnthony Liguori2012-01-271-3/+3
| | | | | | We already have a QOM interface for this so let's use it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: move qdev->info to classAnthony Liguori2012-01-271-7/+9
| | | | | | | | Right now, DeviceInfo acts as the class for qdev. In order to switch to a proper ObjectClass derivative, we need to ween all of the callers off of interacting directly with the info pointer. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: call reset unconditionallyAnthony Liguori2012-01-271-5/+2
| | | | | | Because now all PCI devices are converted to qdev. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vga: improve VGA logicBlue Swirl2012-01-221-20/+0
| | | | | | | | | | | | 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> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* vmstate, memory: decouple vmstate from memory APIAvi Kivity2012-01-041-1/+3
| | | | | | | | | | | | | | Currently creating a memory region automatically registers it for live migration. This differs from other state (which is enumerated in a VMStateDescription structure) and ties the live migration code into the memory core. Decouple the two by introducing a separate API, vmstate_register_ram(), for registering a RAM block for migration. Currently the same implementation is reused, but later it can be moved into a separate list, and registrations can be moved to VMStateDescription blocks. Signed-off-by: Avi Kivity <avi@redhat.com>
* qapi: Convert query-pciLuiz Capitulino2011-10-271-202/+120
| | | | | | | | | This also fixes a bug with the old version: QMP would invert device id and 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> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* pci: simplify memory region registrationAvi Kivity2011-10-171-11/+2
| | | | | | | The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are identical. Unify them. Signed-off-by: Avi Kivity <avi@redhat.com>
* pci: add pci_address_space_io()Richard Henderson2011-09-251-0/+5
| | | | | | | | Returns the I/O address space. Useful for implementing PCI-ISA bridge devices. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
* pci: implement bridge filteringMichael S. Tsirkin2011-09-191-68/+2
| | | | | | | | | | | | | | | | | Support bridge filtering on top of the memory API as suggested by Avi Kivity: Create a memory region for the bridge's address space. This region is not directly added to system_memory or its descendants. Devices under the bridge see this region as its pci_address_space(). The region is as large as the entire address space - it does not take into account any windows. For each of the three windows (pref, non-pref, vga), create an alias with the appropriate start and size. Map the alias into the bridge's parent's pci_address_space(), as subregions. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: Remove unused pci_reserve_capabilityJan Kiszka2011-09-191-6/+0
| | | | | | | 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_addrBlue Swirl2011-09-101-13/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pci: Error on PCI capability collisionsJan Kiszka2011-08-241-0/+38
| | | | | | | | | | | | Nothing good can happen when we overlap capabilities. This may happen when plugging in assigned devices or when devices models contain bugs. Detect the overlap and report it. Based on qemu-kvm commit by Alex Williamson. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Don Dutile <ddutile@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: add pci_address_space()Avi Kivity2011-08-221-0/+5
| | | | | | | | Returns the PCI address space. Useful for bridges that can obscure part 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 functionsAnthony Liguori2011-08-201-23/+23
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: remove support for pre memory API BARsAvi Kivity2011-08-081-31/+2
| | | | | | | | | 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: rename pci_register_bar_region() to pci_register_bar()Avi Kivity2011-08-081-3/+3
| | | | | | | 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: fold BAR mapping function into its callerAvi Kivity2011-08-081-16/+9
| | | | | | | | | There is only one function, so no need for a function pointer. 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()Avi Kivity2011-08-081-25/+17
| | | | | | | | | | Superceded by pci_register_bar_region(). The implementations are 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: convert pci rom to memory APIAvi Kivity2011-08-081-13/+7
| | | | | | | 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()Avi Kivity2011-08-081-17/+0
| | | | | | | | | Superceded by pci_register_bar_region(). 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: allow I/O BARs to be registered with pci_register_bar_region()Avi Kivity2011-08-081-20/+23
| | | | | | | 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: pass I/O address space to new PCI busAvi Kivity2011-08-081-6/+12
| | | | | | | | | This lets us register BARs in the I/O address space. 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: add API to get a BAR's mapped addressAvi Kivity2011-08-081-0/+5
| | | | | | | | | | Some (hacky) devices that have a back-channel to read this address back outside the normal configuration mechanisms, such as VMware svga. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'mst/for_anthony' into stagingAnthony Liguori2011-08-041-4/+2
|\
| * pci: Common overflow preventionJan Kiszka2011-07-271-4/+2
| | | | | | | | | | | | | | | | | | | | Introduce pci_config_read/write_common helpers to prevent passing accesses down the callback chain that go beyond the config space limits. Adjust length assertions as they are no longer correct (cutting may generate valid 3 byte accesses). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | pci: add MemoryRegion based BAR management APIAvi Kivity2011-07-291-8/+39
| | | | | | | | | | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* | pci: pass address space to pci bus when createdAvi Kivity2011-07-291-5/+11
|/ | | | | | | | | This is now done sloppily, via get_system_memory(). Eventually callers will 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: don't call qdev pci init methodIsaku Yamahata2011-06-151-4/+6
| | | | | | | | | 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 pciMichael S. Tsirkin2011-06-151-3/+5
|\ | | | | | | | | Conflicts: hw/virtio-pci.c
| * Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori2011-05-121-3/+3
| |\ | | | | | | | | | | | | Conflicts: cpu-all.h
| | * Fix typo in code and commentsStefan Weil2011-05-061-3/+3
| | | | | | | | | | | | | | | | | | | | | Replace writeable -> writable Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
| * | pci: Use of qemu_put_ram_ptr in pci_add_option_rom.John Baboval2011-05-081-0/+2
| |/ | | | | | | | | | | | | | | | | Prevent a deadlock caused by leaving a map cache bucket locked by the preceding qemu_get_ram_ptr() call. Signed-off-By: John Baboval <john.baboval@virtualcomputer.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | pci: move ids of config space into PCIDeviceInfoIsaku Yamahata2011-06-121-14/+32
|/ | | | | | | | | vender id/device id... in configuration space are read-only registers which are commonly defined for all pci devices. So move those initialization into common place. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: Add class 0x403 as 'audio controller'Jan Kiszka2011-05-051-0/+1
| | | | | | | Used by HD audio controllers like our intel-hda. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: add pci_register_bar_simple() APIAvi Kivity2011-04-071-0/+17
| | | | | | | | This is similar to pci_register_bar(), but automatically registers a single memory 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 levelsIsaku Yamahata2011-04-011-0/+7
| | | | | | | | | | | 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 eliminated by this helper function. 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: use uint8_t for devfn_minIsaku Yamahata2011-03-281-3/+3
| | | | | | | use uint8_t for devfn_min instead of int. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: use PCI_DEVFN in pci_get_bus_devfn()Isaku Yamahata2011-03-281-1/+1
| | | | | | | Replace hardcoded logic by a common macro. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: use devfn for pci_find_device() instead of (slot, fn) pairIsaku Yamahata2011-03-281-2/+2
| | | | | | | | (slot, fn) pair is somewhat confusing because of ARI. So use devfn for pci_find_device() instead of (slot, fn). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: Fix memory leakStefan Weil2011-02-201-0/+1
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* pci: add creation functions that may failBlue Swirl2011-02-121-0/+20
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* pci: typo in pcibus_get_dev_path()Isaku Yamahata2011-01-271-1/+1
| | | | | | | | 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 fixupMichael S. Tsirkin2011-01-271-1/+0
| | | | | | | | | | 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> Reported-by: Isaku Yamahata <yamahata@valinux.co.jp> Tested-by: Isaku Yamahata <yamahata@valinux.co.jp>
* pci: memory leak of PCIDevice::rom_fileIsaku Yamahata2011-01-241-0/+1
| | | | | | | | | PCIDevice::rom_file is leaked. PCIDevice::rom_file is allocated in pci_qdev_init(), but not freed anywhere. free it in qemu_unregister_device(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: use qemu_malloc() in pcibus_get_dev_path()Isaku Yamahata2011-01-201-1/+1
| | | | | | | use qemu_malloc() instead of direct use of malloc(). Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* pci: deassert intx on reset.Isaku Yamahata2011-01-201-0/+9
| | | | | | | | | | | | 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 that all irq is are deasserted. But now pci bus reset/flr is supported, and in that case irq needs to be disabled explicitly. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
OpenPOWER on IntegriCloud