Statistics
| Branch: | Revision:

root / hw / vfio_pci.c @ 3bd88451

History | View | Annotate | Download (98.9 kB)

# Date Author Comment
6dcfdbad 04/01/2013 10:35 pm Alex Williamson

vfio: cleanup includes

Starting to get messy, put the back in alphabetical order.

Signed-off-by: Alex Williamson <>

c29029dd 04/01/2013 10:35 pm Alex Williamson

vfio: Add bootindex support

Signed-off-by: Alex Williamson <>

ba661818 04/01/2013 10:35 pm Alex Williamson

vfio-pci: Move devices to D0 on reset

Guests may leave devices in a low power state at reboot, but we expect
devices to be woken up for the next boot. Make this happen.

Signed-off-by: Alex Williamson <>

82ca8912 04/01/2013 10:34 pm Alex Williamson

vfio-pci: Add extra debugging

Often when debugging it's useful to be able to disable bypass paths
so no interactions with the device are missed. Add some extra debug
options to do this. Also add device info on read/write BAR accesses,
which is useful when debugging more than one assigned device. A...

7076eabc 04/01/2013 10:34 pm Alex Williamson

qemu vfio-pci: Graphics device quirks

Graphics cards have a number of different backdoors. Some of these
are alternative ways to get PCI BAR addresses, some of them are
complete mirrors of PCI config space available through MMIO and
I/O port access. These quirks cover a number of ATI Radeon and...

f15689c7 04/01/2013 10:33 pm Alex Williamson

qemu vfio-pci: Add support for VGA MMIO and I/O port access

Most VGA cards need some kind of quirk to fully operate since they
hide backdoors to get to other registers outside of PCI config space
within the registers, but this provides the base infrastructure. If...

4b5d5e87 04/01/2013 08:50 pm Alex Williamson

vfio-pci: Generalize PCI config mangling

Kernel-side vfio virtualizes all of config space, but some parts are
unique to Qemu. For instance we may or may not expose the ROM BAR,
Qemu manages MSI/MSIX, and Qemu manages the multi-function bit so that
single function devices can appear as multi-function and vica versa....

96adc5c7 04/01/2013 08:50 pm Alex Williamson

vfio-pci: Add PCIe capability mangling based on bus type

Windows seems to pay particular interest to the PCIe header type of
devices and will fail to load drivers if we attach Endpoint devices or
Legacy Endpoint devices to the Root Complex. We can use
pci_bus_is_express and pci_bus_is_root to determine the bus type and...

83c9f4ca 03/01/2013 04:01 pm Paolo Bonzini

hw: include hw header files with full paths

Done with this script:

cd hw
for i in `find . -name '*.h' | sed 's/^..//'`; do
echo '\,^#.*include.*["<]'$i'[">], s,'$i',hw/&,'
done | sed -i -f - `find . -type f`

This is so that paths remain valid as files are moved....

312fd5f2 02/11/2013 04:13 pm Markus Armbruster

error: Strip trailing '\n' from error string arguments (again)

Commit 6daf194d and be62a2eb got rid of a bunch, but they keep coming
back. Tracked down with this Coccinelle semantic patch:

r
expression err, eno, cls, fmt;
position p;
@@
(...
1a9522cc 02/11/2013 04:13 pm Markus Armbruster

error: Clean up abuse of error_report() for help

Use error_printf() instead, so the help gets presented more nicely.

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

6a659bbf 01/30/2013 01:31 am Alex Williamson

vfio-pci: Enable PCIe extended config space

We don't know pre-init time whether the device we're exposing is PCIe
or legacy PCI. We could ask for it to be specified via a device
option, but that seems like too much to ask of the user. Instead we
can assume everything will be PCIe, which makes PCI-core allocate...

8fc94e5a 01/08/2013 11:10 pm Alex Williamson

vfio-pci: Loosen sanity checks to allow future features

VFIO_PCI_NUM_REGIONS and VFIO_PCI_NUM_IRQS should never have been
used in this manner as it locks a specific kernel implementation.
Future features may introduce new regions or interrupt entries
(VGA may add legacy ranges, AER might add an IRQ for error...

b0223e29 01/08/2013 11:09 pm Alex Williamson

vfio-pci: Make host MSI-X enable track guest

Guests typically enable MSI-X with all of the vectors in the MSI-X
vector table masked. Only when the vector is enabled does the vector
get unmasked, resulting in a vector_use callback. These two points,
enable and unmask, correspond to pci_enable_msix() and request_irq()...

bbef882c 12/26/2012 11:49 am Michael S. Tsirkin

msi: add API to get notified about pending bit poll

Update all users.

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

9c17d615 12/19/2012 09:32 am Paolo Bonzini

softmmu: move include files to include/sysemu/

Signed-off-by: Paolo Bonzini <>

1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

022c62cb 12/19/2012 09:31 am Paolo Bonzini

exec: move include files to include/exec/

Signed-off-by: Paolo Bonzini <>

6f991980 12/17/2012 07:56 pm Paolo Bonzini

Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEAD

Signed-off-by: Paolo Bonzini <>

a2cb15b0 12/17/2012 01:02 pm Michael S. Tsirkin

pci: update all users to look in pci/

update all users so we can remove the makefile hack.

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

d281084d 12/10/2012 08:30 pm Alex Williamson

vfio-pci: Don't use kvm_irqchip_in_kernel

kvm_irqchip_in_kernel() has an architecture specific meaning, so
we shouldn't be using it to determine whether to enabled KVM INTx
bypass. kvm_irqfds_enabled() seems most appropriate. Also use this
to protect our other call to kvm_check_extension() as that explodes...

e1d1e586 11/13/2012 09:27 pm Alex Williamson

vfio-pci: Add KVM INTx acceleration

This makes use of the new level irqfd support enabling bypass of qemu
userspace both on INTx injection and unmask. This significantly
boosts the performance of devices making use of legacy interrupts (ex.
~60% better netperf TCP_RR scores for an e1000e assigned to a Linux...

a771c517 11/13/2012 09:27 pm Alex Williamson

vfio-pci: Use common msi_get_message

We can get rid of our local version now that a helper exists.

Signed-off-by: Alex Williamson <>

a8170e5e 10/23/2012 04:58 pm Avi Kivity

Rename target_phys_addr_t to hwaddr

target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are
reserved) and its purpose doesn't match the name (most target_phys_addr_t
addresses are not target specific). Replace it with a finger-friendly,...

248bbe74 10/22/2012 10:48 pm Anthony Liguori

Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-20121017.0' into staging

  • awilliam/tags/vfio-pci-for-qemu-20121017.0:
    vfio-pci: Mark non-migratable
    vfio-pci: Fix debug build
f6790af6 10/22/2012 03:50 pm Avi Kivity

memory: use AddressSpace for MemoryListener filtering

Using the AddressSpace type reduces confusion, as you can't accidentally
supply the MemoryRegion you're interested in.

Reviewed-by: Anthony Liguori <>
Signed-off-by: Avi Kivity <>

d9f0e638 10/17/2012 08:20 pm Alex Williamson

vfio-pci: Mark non-migratable

We haven't magically fixed this yet. Toss in a description too.

Signed-off-by: Alex Williamson <>

a011b10e 10/17/2012 08:20 pm Alex Williamson

vfio-pci: Fix debug build

Stray variable from before MSI-X rework

Signed-off-by: Alex Williamson <>

e71e602c 10/15/2012 12:43 pm Avi Kivity

vfio: drop no-op MemoryListener callbacks

Removes quite a bit of useless code.

Signed-off-by: Avi Kivity <>

1a403133 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Clang cleanup

Blue Swirl reports that Clang doesn't like the structure we define to
avoid dynamic allocation for a number of calls to VFIO_DEVICE_SET_IRQS.
Adding an element after a variable sized type is a GNU extension.
Switch back to dynamic allocation, which really isn't a problem since...

3a4f2816 10/08/2012 05:45 pm Jan Kiszka

vfio-pci: Fix BAR->VFIODevice translation in

DO_UPCAST is supposed to translate from the first member of a struct to
that struct, not from arbitrary ones. And it (usually) breaks the build
when neglecting this rule. Use container_of to fix the build breakage...

5c97e5eb 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Roll the header into the .c file

It's only ~100 lines and nobody else should be using this.
Suggested by Michael Tsirkin.

Signed-off-by: Alex Williamson <>

e43b9a5a 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Don't peak at msi_supported

Let the init function fail, just don't warn for -ENOTSUP.

Signed-off-by: Alex Williamson <>

5976cdd5 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Use uintptr_t for void* cast

We don't seem to run into any sign extension problems, but
unsigned looks more correct.

Signed-off-by: Alex williamson <>

9b1e45c8 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Remove setting of MSI qsize

This was a misinterpretation of the spec, hardware doesn't get to
specify how many were actually enabled through this field.

Signed-off-by: Alex Williamson <>

5834a83f 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Extend reset

Take what we've learned from pci-assign and apply it to vfio-pci.
On reset, disable previous interrupt config, perform a device
reset if available, re-enable INTx, and disable memory regions on
the device to prevent continuing DMA....

ce59af2d 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Cleanup on INTx setup failure

Missing some unwind code.

Signed-off-by: Alex Williamson <>

ea486926 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Update slow path INTx algorithm

We can't afford the overhead of switching out and back into mmap mode
around each interrupt, but we can do it lazily via a timer. On INTx
interrupt, disable the mmap'd memory regions and set a timer. On
every interrupt, push the timer out. If the timer expires and the...

af6bc27e 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Re-order map/unmap

This cleans up the next patch that calls unmap from map.

Signed-off-by: Alex Williamson <>

12af1344 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Unmap and retry DMA mapping

Occasionally we get regions added that overlap with existing mappings.
These always seems to be in the VGA ROM range. VFIO returns EBUSY
for these mapping attempts. We can try a little harder and assume
that the latest mapping is correct by removing any overlapping ranges...

fd704adc 10/08/2012 05:45 pm Alex Williamson

vfio-pci: Rework MSIX setup/teardown

We try to do lazy initialization of MSIX since we don't actually need
to setup anything until MSIX vectors start getting used. This leads
to problems if MSIX is enabled, but never used (we can end up trying
to re-enable INTx while it's still enabled). We also run into...

98cd5a5e 10/08/2012 05:45 pm Alex Williamson

vfio-pci: No spurious MSIs

FreeBSD doesn't like these spurious MSIs, remove them as they're
mostly paranoia anyway.

Signed-off-by: Alex Williamson <>

0f41dc18 10/01/2012 09:40 pm Anthony Liguori

vfio_pci: fix build on 32-bit systems

We cannot cast directly from pointer to uint64.

Cc: Alex Williamson <>
Cc: Alex Barcelo <>
Reported-by: Alex Barcelo <>
Signed-off-by: Anthony Liguori <>

65501a74 10/01/2012 04:04 pm Alex Williamson

vfio: vfio-pci device assignment driver

This adds the core of the QEMU VFIO-based PCI device assignment driver.
To make use of this driver, enable CONFIG_VFIO, CONFIG_VFIO_IOMMU_TYPE1,
and CONFIG_VFIO_PCI in your host Linux kernel config. Load the vfio-pci...