Statistics
| Branch: | Revision:

root / hw / pci.c @ cc9577cf

History | View | Annotate | Download (55 kB)

# Date Author Comment
3709c1b7 06/14/2010 11:46 pm Daniel P. Berrange

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' being
in use:

$ qemu -device rtl8139 -device virtio-balloon-pci,bus=pci.0,addr=0x3...

1bb65042 06/14/2010 11:46 pm Markus Armbruster

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 the
DeviceState abstraction. Which even carries a comment advising
against this:

/* This structure should not be accessed directly. We declare it here...

637503d1 06/01/2010 09:48 pm Luiz Capitulino

Monitor: Drop QMP documentation from code

Previous commit added QMP documentation to the qemu-monitor.hx
file, it's is a copy of this information.

While it's good to keep it near code, maintaining two copies of
the same information is too hard and has little benefit as we...

e075e788 05/31/2010 04:39 pm Isaku Yamahata

pci-hotplug: make them aware of pci domain.

add helper function which converts root bus to pci domain.
make them aware of pci domain.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

5e434f4e 05/31/2010 04:33 pm Isaku Yamahata

pci: clean up of pci_set_default_subsystem_id().

Use pci accessor function.
don't return value because it always return 0 and
the caller doesn't check the return value.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

f7ce7287 05/17/2010 08:41 pm Anthony Liguori

Merge remote branch 'mst/for_anthony' into staging

87c30546 05/15/2010 07:26 pm Isaku Yamahata

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 <>
Acked-by: Gerd Hoffmann <>...

c3f8f611 05/12/2010 02:02 am Michael S. Tsirkin

pci: irq_state vmstate breakage

Code for saving irq_state got vm_state
macros wrong, passing in the wrong parameter.
As a result, we both saved a wrong value
and restored it to a wrong offset.

This leads to device and bus irq counts getting
out of sync, which in turn leads to interrupts getting lost or...

925fe64a 05/12/2010 01:59 am Alex Williamson

pci: cleanly backout of pci_qdev_init()

If the init function of a device fails, as might happen with device
assignment, 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 bogus
pointer in the bus devices array that can cause a segfault or...

470e6363 04/20/2010 08:15 pm Isaku Yamahata

pci: fix pci_find_bus().

When looking down child bus, it should look parent bridge's
bus number, not child bus's.
Optimized tail recursion and style fix.

Cc: Blue Swirl <>
Cc: "Michael S. Tsirkin" <>
Signed-off-by: Isaku Yamahata <>...

1db5a3aa 04/11/2010 07:37 pm Michael S. Tsirkin

pci: add API to add capability at a known offset

Unlike virtio, device emulations need to add pci capabilities
at known offsets to match real hardware. Make this possible
by adding an appropriate API.

Signed-off-by: Michael S. Tsirkin <>

1ecda02b 03/16/2010 05:58 pm Markus Armbruster

error: Replace qemu_error() by error_report()

error_report() terminates the message with a newline. Strip it it
from its arguments.

This fixes a few error messages lacking a newline:
net_handle_fd_param()'s "No file descriptor named %s found", and
tap_open()'s "vnet_hdr=1 requested, but no kernel support for...

b5937f29 02/13/2010 09:37 am Isaku Yamahata

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 <>
Cc: "Michael S. Tsirkin" <>...

8fd5cf4b 02/08/2010 12:14 pm Isaku Yamahata

pci: fix pci_find_bus()

typo in c021f8e65f5009a5ab5711d9d5326fcab553ef1c.
comparison fix.

Cc: Blue Swirl <>
Cc: "Michael S. Tsirkin" <>
Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

525e0514 02/06/2010 04:57 pm Blue Swirl

PCI: show also host bridge data in "info pci" output

Signed-off-by: Blue Swirl <>

c021f8e6 02/06/2010 11:20 am Blue Swirl

PCI: fix multiple bridge problems

When several PCI bridges were in use, monitor command "info pci" would
enter into infinite loop. Buses behind the bridge were not discoverable
because secondary and subordinate bus numbers were not used properly.
Other buses were not found because bus search terminated on first miss....

776e1bbb 01/26/2010 11:59 pm Blue Swirl

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.

Signed-off-by: Blue Swirl <>

163c8a59 01/26/2010 11:42 pm Luiz Capitulino

PCI: Convert pci_info() to QObject

The returned QObject is a QList of all buses. Each bus is
represented by a QDict, which has a key with a QList of all
PCI devices attached to it. Each device is represented by
a QDict.

As has happended to other complex conversions, it's hard to...

d5e4acf7 01/26/2010 11:42 pm Luiz Capitulino

PCI: do_pci_info(): PCI bridge devices support

This commit completes the do_pci_info() conversion to
QObject 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...

88169ddf 01/11/2010 09:41 pm Gerd Hoffmann

pci: allow loading roms via fw_cfg.

This patch adds a pci bus property 'rombar' which specifies whenever
the 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 where
no pci rom bar is present....

ea3fdd5d 01/06/2010 03:16 pm Anthony Liguori

Merge remote branch 'mst/for_anthony' into staging

cf616802 12/27/2009 10:52 pm Blue Swirl

PCI: Fix bus address conversion

Pass physical addresses to map functions instead of PCI bus addresses.

Signed-off-by: Blue Swirl <>

c71b5b4a 12/25/2009 08:18 pm Blue Swirl

PCI: partially revert 2e01c8cf4b076b05013c87723e3fc710b50a0a7a

Bus address conversion was not correct.

Signed-off-by: Blue Swirl <>

2e01c8cf 12/25/2009 06:50 pm Blue Swirl

PCI: make pci_mem_base private

Make pci_mem_base private to PCIBus. Add a function to set it.

Signed-off-by: Blue Swirl <>

b8ba4176 12/23/2009 04:35 pm Isaku Yamahata

pci: remove PCIBus::config_reg.

PCIBus::config_reg isn't used anymore, so remove it.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

3d09c490 12/23/2009 04:35 pm Isaku Yamahata

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.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

a7b15a5c 12/23/2009 04:33 pm Michael S. Tsirkin

Revert "Revert "pci: interrupt disable bit support""

This reverts commit d587e0787153f0224a6140c5015609963ceaabfb.

c2039bd0 12/18/2009 07:26 pm Anthony Liguori

Support PCI based option rom loading

Currently, we preload option roms into the option rom space in memory. This
prevents DDIM from functioning correctly which severely limits the number
of roms we can support.

This patch introduces a pci_add_option_rom() which registers the...

8c52c8f3 12/18/2009 07:26 pm Gerd Hoffmann

pci romfiles: add property, add default to PCIDeviceInfo

This patch adds a romfile property to the pci bus. It allows to specify
a romfile to load into the rom bar of the pci device. The default value
comes from a new field in PCIDeviceInfo. The property allows to change...

d587e078 12/18/2009 07:26 pm Anthony Liguori

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 <>

09e3acc6 12/12/2009 03:59 pm Gerd Hoffmann

pci: don't hw_error() when no slot is available.

Current PCI code will simply hw_error() and thus abort in case no free
PCI slot is available or the requested PCI slot is already in use by
another device. For the hotplug case this behavior is not acceptable....

d036bb21 12/07/2009 09:50 pm Michael S. Tsirkin

pci: prepare irq code for interrupt state

This rearranges code in preparation for interrupt state
implementation.
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...

f9bf77dd 12/07/2009 09:50 pm Michael S. Tsirkin

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 <>
Acked-by: Isaku Yamahata <>

b6981cb5 12/07/2009 09:50 pm Michael S. Tsirkin

pci: interrupt disable bit support

Interrupt disable bit is mandatory in PCI spec.
Implement it to make devices spec compliant.

Signed-off-by: Michael S. Tsirkin <>
Acked-by: Isaku Yamahata <>

5084bca1 12/03/2009 06:04 pm Juan Quintela

pci: vmstate_register() already assign consecutive numbers starting at 0

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

d6318738 12/02/2009 04:57 pm Michael S. Tsirkin

pci: move apb specific stuff to apb_pci.c

pci code had a TODO to move apb specific
pci bridge initialization to apb_pci.
Implement this and remove the TODO.

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

88a95564 12/01/2009 05:52 pm Michael S. Tsirkin

pci: convert goto into scope in bridge_filter

goto into scope is evil. rearrange pci_bridge_filter
so that we always go to end of function on error.

Signed-off-by: Michael S. Tsirkin <>
Acked-by: Isaku Yamahata <>

d46636b8 12/01/2009 05:52 pm Isaku Yamahata

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.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

10c9c329 12/01/2009 05:52 pm Isaku Yamahata

pci: fix pci_config_get_io_base().

fix typo in pci_config_get_io_base().

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

b47b0706 12/01/2009 05:52 pm Isaku Yamahata

pci: remove magic number, 256 in pci.c

This patch replaces magic number, 256, with ARRAY_SIZE().

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

876a350d 12/01/2009 05:52 pm Michael S. Tsirkin

pci: split up up pci_update mappings

Split bar address math into a separate function.
In particular, this gets rid of an ugly forward goto
into scope that we have there.

Signed-off-by: Michael S. Tsirkin <>
Acked-by: Isaku Yamahata <>

ec503442 12/01/2009 05:52 pm Isaku Yamahata

pci: clean up of pci_update_mappings()

This patch converts r->size == 0 to !r_size.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

3e21ffc9 12/01/2009 05:52 pm Isaku Yamahata

pci: clean up of pci_init_wmask().

This patch replaces for loop by memset in pci_init_wmask().

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

c34369d4 12/01/2009 05:51 pm Isaku Yamahata

pci: kill unnecessary included in pci.c

including pci_host.h isn't needed by pci.c.
This patch kills it.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

c469e1dd 12/01/2009 05:51 pm Isaku Yamahata

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" <>.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

070297d2 12/01/2009 05:51 pm Isaku Yamahata

pci: remove pci_sub_bus() by open coding.

Because pci_sub_bus() is used only once so eliminate it
by open coding as suggested by "Michael S. Tsirkin" <>.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

f88d7509 12/01/2009 05:51 pm Isaku Yamahata

pci: fix pci_info_device().

It printed wrong limit value of bridge.
This patch fixes it.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Michael S. Tsirkin <>

c364c974 11/15/2009 04:30 pm Blue Swirl

PCI: make duplicate devfn allocation fatal

Only two callers of pci_create_simple/pci_register_device bothered
to check the return value. Other cases were prone to crashing with
spurious NULL pointer dereferences.

Make QEMU exit with an error message when devfn is attempted to...

91011d4f 11/14/2009 02:14 am Stefan Weil

pci: Fix function pci_default_write_config

Change 260c0cd3d985e51b15870ff47e17b7b930efbda1
(pci: use range helper functions) introduced a
bug which made pci cirrus vga on mips malta
(and maybe other pci devices) fail.

Don't change addr - its original value is needed...

dbe73d7f 11/12/2009 07:23 pm Juan Quintela

pci: fix the conversion of config field from array to pointer

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

260c0cd3 11/09/2009 04:43 pm Isaku Yamahata

pci: use range helper functions.

clean up pci_default_write_config() by the range helper functions.

Suggested by Michael S. Tsirkin <>
Cc: Michael S. Tsirkin <>
Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

edb00035 11/09/2009 04:43 pm Isaku Yamahata

pci: teach pci_default_config_write() ROM bar for normal/bridge device .

When updated ROM expantion address of header type 0, it missed
to update mappings.
Add PCI_ROM_ADDRESS check whether to call pci_update_mappings()
Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1....

fb231628 11/09/2009 04:43 pm Isaku Yamahata

pci: initialize pci config headers depending it pci header type.

- Only sets default subsystem id for header type 00.(normal header type)
because header type 01 doesn't have subsystem id, and uses the register
for other purpose. So setting default subsystem id doesn't make sense....

a9688570 11/09/2009 04:43 pm Isaku Yamahata

pci: cosmetic on pci_upadte_mappings()

Remove one indentation of pci_update_mappings.
Just for cosmetics, no logic change.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

1074df4f 11/09/2009 04:43 pm Isaku Yamahata

pci: factor out pci_for_each_device().

split out device iteration logic from pci_for_each_device().
factored out function, pci_for_each_device_under_bus() will be used later.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

a0c7a97e 11/09/2009 04:43 pm Isaku Yamahata

pci: implement pci bridge filtering.

This patch implements pci bridge filtering.

TODO: currently almost all the map funcions assumes
filtered_size size and addr & ~(size - 1) addr.
However with bridge filtering, they aren't always true.
Teach them such cases, such that filtered_size < size and...

b4dccd8d 11/09/2009 04:43 pm Isaku Yamahata

pci/monitor: print out bridge's filtering values and so on.

make pci_info_device() print out bridge's filtering value like
io base/limit, subbus and subordinate bus.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>...

14421258 11/09/2009 04:43 pm Isaku Yamahata

pci: 64bit bar support.

implemented pci 64bit bar support.
The tricky bit is pci_update_mapping().
An OS is allowed to set the BAR such that OS can't address the area
pointed by BAR. It doesn't make sense, though.
In that case, don't map the BAR.

Signed-off-by: Isaku Yamahata <>...

e94ff650 11/09/2009 04:43 pm Isaku Yamahata

pci: remove bus_num member from struct PCIBus.

Since It can be retrieved from pci configuration space,
the member is unnecessary.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

e822a52a 11/09/2009 04:43 pm Isaku Yamahata

pci: make pci configuration transaction more accurate.

This patch sorts out/enhances pci code to track pci bus topology
more accurately.
- Track host bus bridge with pci domain number. Although the
current qemu implementation supports only pci domian 0 yet....

74e32ac1 11/09/2009 04:43 pm Isaku Yamahata

pci: factor out the conversion logic from io port address into pci device.

factor out the logic which converts io port address into pci device
and offset in PCI configuration space.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

766347cc 11/09/2009 04:43 pm Isaku Yamahata

pci: move pci host stuff from pci.c to pci_host.c

Move pci host stuff from pci.c to pci_host.c.
And add some comments.
Later pcie host bridge functions will be defined in pcie_host.c
not to bloat pci.c.

Signed-off-by: Isaku Yamahata <>...

a9f49946 11/09/2009 04:43 pm Isaku Yamahata

pci: pcie host and mmcfg support.

This patch adds common routines for pcie host bridge and pcie mmcfg.
This will be used by q35 based chipset emulation.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

6e355d90 11/09/2009 04:43 pm Isaku Yamahata

pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t

This patch is preliminary for 64 bit BAR support.
Introduce dedicated type, pcibus_t, to represent pci bus address/size
instead of uint32_t.
Later this type will be changed to uint64_t....

89e8b13c 11/09/2009 04:43 pm Isaku Yamahata

pci: introduce FMT_PCIBUS for printf format for pcibus_t.

This patch is preliminary for 64bit BAR.
Later pcibus_t will be changed from uint32_t to uint64_t.
Introduce FMT_PCIBUS for printf format for pcibus_t.

Signed-off-by: Isaku Yamahata <>...

4f8589e1 11/09/2009 04:43 pm Isaku Yamahata

pci: typedef pcibus_t as uint64_t instead of uint32_t.

This patch is preliminary for 64bit bar.
For 64bit bar support, change pcibus_t which represents
pci bus addr/size from uint32_t to uint64_t.
And also change FMT_pcibus for printf.

In pci_update_mapping() checks 32bit overflow....

0392a017 11/09/2009 04:43 pm Isaku Yamahata

pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h

make constants for pci base address match pci_regs.h by
renaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>...

5029fe12 11/09/2009 04:43 pm Isaku Yamahata

pci: clean up of pci_default_read_config.

This patch cleans up pci_default_read_config() removing
ugly length and range check.

Suggested by "Michael S. Tsirkin" <>
Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>...

b3b11697 11/09/2009 04:43 pm Isaku Yamahata

pci: make pci_bar() aware of header type 1.

make pci_bar() aware of header type 1. When PCI_ROM_SLOT
it should return PCI_ROM_ADDRESS1 (!= PCI_ROM_ADDRESS)

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>...

b0ff8eb2 11/09/2009 04:43 pm Isaku Yamahata

pci: use helper functions to access pci config space.

use pci_[gs]et_{byte, word, long}() to access pci configuration
space.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

74c01823 11/09/2009 04:43 pm Isaku Yamahata

pci/bridge: clean up of pci_bridge_initfn()

- use symbolic constant
- use helper function pci_set_xxx()
- removed lines which initializes to 0.
It is unnecessary because it is already zeroed.
- add some comments on command registers.

Some initial values are suspicious because they seems to...

67a51b48 11/09/2009 04:43 pm Isaku Yamahata

pci: clean up pci_init_wmask()

use pci_set_word() for pci command register.

Signed-off-by: Isaku Yamahata <>
Signed-off-by: Anthony Liguori <>

2e49d64a 11/09/2009 04:43 pm Isaku Yamahata

pci: fix PCI_DPRINTF() wrt variadic macro.

add missing ## in PCI_DPRINTF() to compile.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

e369cad7 11/09/2009 04:43 pm Isaku Yamahata

pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.

introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
and use it.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>...

2217dcff 11/09/2009 04:43 pm Isaku Yamahata

pci: use PCI_SLOT() and PCI_FUNC().

use PCI_SLOT() and PCI_FUNC() where appropriate instead of
direct use of bit operation.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

182f9c8a 11/09/2009 04:43 pm Isaku Yamahata

pci: define a constant to represent a unmapped bar and use it.

define a constant to represent a unmapped bar instead of -1 and use it.

Signed-off-by: Isaku Yamahata <>
Acked-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

c7bde572 10/27/2009 07:28 pm Juan Quintela

vmstate: Unfold VMSTATE_INT32_VARRAY() only use and remove it

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

1cc33683 10/27/2009 07:28 pm Gerd Hoffmann

zap DeviceState->nd

No users left.
Also cleanup obsolete helper functions.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

dc7aff11 10/27/2009 07:28 pm Gerd Hoffmann

prepare pci nic init path for qdev property configuration.

Initialization path will work with both converted and not-converted
drivers, so we can convert drivers one by one.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

dea7b3b9 10/15/2009 05:32 pm Mark McLoughlin

net: remove id field from NICInfo

Just use the name field instead since we now use the id paramater as
the name, if supplied. Only implication with this change is that if
id is not supplied, the value of the name paramater is used as an
id.

Patchworks-ID: 35512...

33e66b86 10/07/2009 04:54 pm Markus Armbruster

Check return value of qdev_init()

But do so only where it may actually fail. Leave the rest for the
next commit.

Patchworks-ID: 35167
Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

e23a1b33 10/07/2009 04:54 pm Markus Armbruster

New qdev_init_nofail()

Like qdev_init(), but terminate program via hw_error() instead of
returning an error value.

Use it instead of qdev_init() where terminating the program on failure
is okay, either because it's during machine construction, or because...

05fcfada 10/06/2009 10:36 pm Michael S. Tsirkin

qemu/pci: clarify pci config load routine

PCI load routine has to be called with size equal to 256 (otherwise it
will crash in weird ways). So assert this, making code clearer.
Also avoid dynamically sized array on stack - good for portability.

Signed-off-by: Michael S. Tsirkin <>...

0f457d91 10/06/2009 10:36 pm Michael S. Tsirkin

qemu/pci: make pci not depend on msix

Making pci device cleanup msix automatically makes pci.c depend on
msix.c, which is IMO messy. Since devices do msix_init it's easy and
natural for them to also do msix_uninit.

Signed-off-by: Michael S. Tsirkin <>...

e52eb611 10/06/2009 10:36 pm Anthony Liguori

Revert "Fix exit on 'pci_add' Monitor command"

This reverts commit 0148fde54c2478ea8a47c8dbfe4c0fb8bda4d996.

As requested by Luiz.

Signed-off-by: Anthony Liguori <>

49bd1458 10/05/2009 05:32 pm Markus Armbruster

Fix pci_add storage not to exit on bad first argument

Monitor command "pci_add ADDR storage ..." does its work in
qemu_pci_hot_add_nic(). It called pci_create(..., ADDR) to create the
device. That's wrong, because pci_create() terminates the program
when ADDR is invalid....

9ee05825 10/05/2009 05:32 pm Markus Armbruster

Make it obvious that pci_nic_init() can't fail

Before this patch, pci_nic_init() returns NULL when it can't find the
model in pci_nic_models[]. Except this can't happen, because
qemu_check_nic_model_list() just searched for model in
pci_nic_models[], and terminated the program on failure....

07caea31 10/05/2009 05:32 pm Markus Armbruster

Fix pci_add nic not to exit on bad model

Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to
create the NIC. When MODEL is unknown or "?", this prints to stderr
and terminates the program.

Change pci_nic_init() not to treat "?" specially, and to return NULL...

3312958d 10/05/2009 05:32 pm Markus Armbruster

pci_create() is now unused, remove it

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

499cf102 10/05/2009 05:32 pm Markus Armbruster

Rename pci_create_noinit() to pci_create()

It's qdev_create() specialized for PCI, so name it accordingly.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

5330de09 10/05/2009 05:32 pm Michael S. Tsirkin

qemu/pci: refactor code/symbolic constants

refactor code slightly, adding symbolic constants and functions, and
using macros where possible. This will also make following reset
patches easier.

No functional changes.

Signed-off-by: Michael S. Tsirkin <>...

c0b1905b 10/05/2009 05:32 pm Michael S. Tsirkin

qemu/pci: reset device registers on bus reset

Reset BARs and a couple of other registers on bus reset, as per PCI
spec.

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

ee995ffb 10/05/2009 05:32 pm Gerd Hoffmann

pci: hotplug windup

Create qdev infrastructure for pci hotplug. PCI bus implementations
must register a handler for hotplug. Creating a new PCI device will
automagically hot-plug it in case the PCI bus in question supports this.

Signed-off-by: Gerd Hoffmann <>...

a36a344d 10/05/2009 05:32 pm Gerd Hoffmann

pci: use qdev for device destruction.

pci_unregister_device is static now and hooked into Devicestate->exit.
qdev_free(pci_device) works now.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

e3936fa5 10/05/2009 05:32 pm Gerd Hoffmann

pci: move unregister from PCIDevice to PCIDeviceInfo

One more cleanup while being at it ;)

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

21eea4b3 10/05/2009 05:32 pm Gerd Hoffmann

support inplace allocation for pci bus, split irq init.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

03587182 10/05/2009 05:32 pm Gerd Hoffmann

convert pci bridge to qdev

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

0148fde5 10/05/2009 05:32 pm Luiz Capitulino

Fix exit on 'pci_add' Monitor command

If the user issues one of the following commands to the Monitor:

pci_add pci_addr=auto nic model=None
pci_add pci_addr=auto nic model=?

QEMU will exit, because the function used to perform sanity
checks (qemu_check_nic_model_list()) exits on error....

84e2e3eb 10/05/2009 05:32 pm Juan Quintela

vmstate: remove const for put operations

In a later patch, we introduce pre_save() and post_save() functions.
The whole point of that operation is to change things in the state.
Without this patch, we have to remove the const qualifier in each
use with a cast...

c227f099 10/02/2009 12:12 am Anthony Liguori

Revert "Get rid of _t suffix"

In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem. Something
like this must be presented on the list first so people can provide input...