aboutsummaryrefslogtreecommitdiffstats
path: root/hw/pci.c
AgeCommit message (Collapse)AuthorFilesLines
2009-09-04low_set_irq is not used anywhereJuan Quintela1-2/+0
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27Add pci_ne2000_{save/load} functions, then remove pci_dev NE2000State fieldJuan Quintela1-2/+2
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27qdev: add return value to init() callbacks.Gerd Hoffmann1-2/+2
Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27Port PCIDevice state to VMStateJuan Quintela1-22/+43
This uses a variant of buffer, with extra checks. Also uses the new support for cheking that a read value is less or equal than a field. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27Add version_id to PCIDevice.Juan Quintela1-1/+2
It is needed for VMState Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-27Port PCI Bus to VMState designJuan Quintela1-30/+11
This uses VARRAY and INT32_EQUAL values Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-10qdev/prop: convert pci.c to helper macros.Gerd Hoffmann1-7/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-07-27qdev/pci: use qdev_prop_pci_devfnGerd Hoffmann1-4/+4
Put the new property into use. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-21Sparc64: convert APB to qdevBlue Swirl1-3/+5
Thanks to Igor Kovalenko for a bugfix. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-16qdev: print device id in "info pci".Gerd Hoffmann1-0/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16qdev: add id= support for pci nics.Gerd Hoffmann1-0/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16qdev: rework device properties.Gerd Hoffmann1-4/+13
This patch is a major overhaul of the device properties. The properties are saved directly in the device state struct now, the linked list of property values is gone. Advantages: * We don't have to maintain the list with the property values. * The value in the property list and the value actually used by the device can't go out of sync any more (used to happen for the pci.devfn == -1 case) because there is only one place where the value is stored. * A record describing the property is required now, you can't set random properties any more. There are bus-specific and device-specific properties. The former should be used for properties common to all bus drivers. Typical use case is bus addressing, i.e. pci.devfn and i2c.address. Properties have a PropertyInfo struct attached with name, size and function pointers to parse and print properties. A few common property types have PropertyInfos defined in qdev-properties.c. Drivers are free to implement their own very special property parsers if needed. Properties can have default values. If unset they are zero-filled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16pci.c: remove unnecessary #ifdef DEBUG_PCI.Isaku Yamahata1-14/+15
remove unnecessary #ifdef DEBUG_PCI. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-11Fix PCI IRQ breakagePaul Brook1-1/+1
Zero initialize the PCI bus irq count. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-07-11Fix APB by reverting 16eaedf2668e9b347a59d73346fcc4c764c58348 partiallyBlue Swirl1-1/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-07-09qdev/pci: misc fixes.Gerd Hoffmann1-2/+3
* fix secondary bus setup. * use base->name instead of "FIXME" for device name. Yes, the device name is redundant. Only for drivers converted to qdev already though. Once all drivers are converted we can and should kill it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-07-09qdev: replace bus_type enum with bus_info struct.Gerd Hoffmann1-5/+48
BusInfo is filled with name and size (pretty much like I did for DeviceInfo as well). There is also a function pointer to print bus-specific device information to the monitor. sysbus is hooked up there, I've also added a print function for PCI. Device creation is slightly modified as well: The device type search loop now also checks the bus type while scanning the list instead of complaining thereafter in case of a mismatch. This effectively gives each bus a private namespace for device names. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-07-09qdev: update pci device registration.Gerd Hoffmann1-14/+10
Makes pci_qdev_register take a PCIDeviceInfo struct instead of a bunch of parameters. Also adds config_read and config_write callbacks to PCIDeviceInfo, so drivers needing these can be converted to the qdev device API too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-29Revert "Introduce reset notifier order"Jan Kiszka1-1/+1
This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and updates later added users of qemu_register_reset), we solved the problem it originally addressed less invasively. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29monitor: Drop pci_addr prefix from hotplug commandsJan Kiszka1-6/+10
The "pci_addr=" prefix currently required by pci_add/remove and drive_add has no practical use. Drop it, but still silently accept it for backward compatibility. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: check constant registers on loadMichael S. Tsirkin1-1/+25
Add "cmask" table of constant register masks: if a bit is not writeable and is set in cmask table, this bit is checked on load. An attempt to load an image that would change such a register causes load to fail. Use this table to make sure that load does not modify registers that guest can not change (directly or indirectly). Note: we can't just assume that read-only registers never change, because the guest could change a register indirectly. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: add routines to manage PCI capabilitiesMichael S. Tsirkin1-1/+73
Add routines to manage PCI capability list. First user will be MSI-X. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-24qemu/pci: make default_write_config use mask tableMichael S. Tsirkin1-116/+29
Change much of hw/pci to use symbolic constants and a table-driven design: add a mask table with writable bits set and readonly bits unset. Detect change by comparing original and new registers. This makes it easy to support capabilities where read-only/writeable bit layout differs between devices, depending on capabilities present. As a result, writing a single byte in BAR registers now works as it should. Writing to upper limit registers in the bridge also works as it should. Code is also shorter. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Make first argument of monitor command pci_add workMarkus Armbruster1-18/+1
Simply pass the PCI address through qemu_pci_hot_add_nic() to pci_nic_init() and through qemu_pci_hot_add_storage() to pci_create(). Before, pci_device_hot_add() passed along the PCI bus to use, and ignored any user-specified slot. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Support addr=... in option argument of -net nicMarkus Armbruster1-5/+43
Make net_client_init() accept addr=, put the value into struct NICinfo. Use it in pci_nic_init(), and remove arguments bus and devfn. Don't support addr= in third argument of monitor command pci_add, because that clashes with its first argument. Admittedly unelegant. Machines "malta" and "r2d" have a default NIC with a well-known PCI address. Deal with that the same way as the NIC model: make pci_nic_init() take an optional default to be used when the user doesn't specify one. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Fix do_pci_register_device() to reject devfn already in useMarkus Armbruster1-0/+2
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-22Add pci_bus_reset() function.Gleb Natapov1-0/+16
To reset internal irq handling data structures. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Yaniv Kamay <ykamay@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-16Rename pci_register_io_region() to pci_register_bar()Avi Kivity1-1/+1
This function is used to manage a PCI BAR, so make the more generic pci_register_io_region() available to other uses. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-11qdev: move name+size into DeviceInfo (v2)Gerd Hoffmann1-1/+3
Rationale: move device information from code to data structures. v2: Adapt the drivers missed in the first version. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-09Remove unused and misnamed field and variableBlue Swirl1-6/+0
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-05-23Add common BusStatePaul Brook1-11/+26
Implement and use a common device bus state. The main side-effect is that creating a bus and attaching it to a parent device are no longer separate operations. For legacy code we allow a NULL parent, but that should go away eventually. Also tweak creation code to veriry theat a device in on the right bus. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-18Separate virtio PCI codePaul Brook1-1/+1
Split the PCI host bindings from the VRing transport implementation. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14Virtio-net qdev conversionPaul Brook1-1/+0
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14PCI network qdev conversionPaul Brook1-17/+18
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-14PCI qdev supportPaul Brook1-7/+48
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-03minor fix of pci_register_bus()Isaku Yamahata1-0/+1
keep first_bus linked list correct. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-05-03use PCI_HEADER_TYPE.Isaku Yamahata1-1/+2
use symbolic value instead of 0x0e and related value. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2009-04-10Make PCI config status register read-onlyaliguori1-0/+4
From the documentation I can find, this register is supposed to be read-only. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7070 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-05monitor: Rework API (Jan Kiszka)aliguori1-15/+17
Refactor the monitor API and prepare it for decoupled terminals: term_print functions are renamed to monitor_* and all monitor services gain a new parameter (mon) that will once refer to the monitor instance the output is supposed to appear on. However, the argument remains unused for now. All monitor command callbacks are also extended by a mon parameter so that command handlers are able to pass an appropriate reference to monitor output services. For the case that monitor outputs so far happen without clearly identifiable context, the global variable cur_mon is introduced that shall once provide a pointer either to the current active monitor (while processing commands) or to the default one. On the mid or long term, those use case will be obsoleted so that this variable can be removed again. Due to the broad usage of the monitor interface, this patch mostly deals with converting users of the monitor API. A few of them are already extended to pass 'mon' from the command handler further down to internal functions that invoke monitor_printf. At this chance, monitor-related prototypes are moved from console.h to a new monitor.h. The same is done for the readline API. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11Parse full PCI device addresses (Markus Armbruster)aliguori1-0/+77
This code parses full PCI device addresses. It then rejects domains other than zero, because these are not supported in QEMU. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6609 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11qemu: warn if PCI region is not power of two (Marcelo Tosatti)aliguori1-0/+7
Otherwise the PCI size for such regions can be calculated erroneously. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6604 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11qemu: add pci_unregister_device (Marcelo Tosatti)aliguori1-5/+42
Unregister the pci device, unassign its IO and memory regions, and free associated data. Add a callback so drivers can free device state. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6603 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti)aliguori1-4/+11
Change the PCI network drivers init functions to return the PCIDev, to inform which slot has been hot-plugged. Also record PCIDevice structure on NICInfo to locate for release on hot-removal. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6593 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-11qemu: add pci helper functions (Marcelo Tosatti)aliguori1-0/+20
Add pci_find_bus/pci_find_device to be used by PCI hotplug. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6592 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-05hw: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori1-2/+0
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6529 c046a42c-6fe2-441c-8c8c-71466251a162
2009-02-01Add and use #defines for PCI device classesblueswir11-2/+1
This patch adds and uses #defines for PCI device classes and subclases, using a new pci_config_set_class() function, similar to the recently added pci_config_set_vendor_id() and pci_config_set_device_id(). Change since v1: fixed compilation of hw/sun4u.c Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6491 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-27Add Simba device IDblueswir11-5/+5
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6465 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-13Make pci_nic_init() use qemu_setup_nic_model() (Mark McLoughlin)aliguori1-25/+35
Add a table of PCI NIC models to pass to qemu_setup_nic_model(). While we're at it, also add a corresponding table of NIC init functions. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6287 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-18PCI: Mask writes to RO bits in the command reg of PCI config spaceaurel321-0/+3
The Command register in the PCI config space has some read-only bits. Any writes to those bits should be masked out. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6092 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-18PCI: Mask writes to RO bits in the status reg of PCI config spaceaurel321-0/+11
The Status register in the PCI config space has some read-only bits. Any writes to those bits should be masked out. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6091 c046a42c-6fe2-441c-8c8c-71466251a162