Statistics
| Branch: | Revision:

root / hw / msix.c @ c9159fe9

History | View | Annotate | Download (15.8 kB)

# Date Author Comment
3cac001e 08/30/2012 01:46 am Michael S. Tsirkin

msix: make [un]use vectors on reset/load optional

The facility to use/unuse vectors dynamically is helpful
for virtio but little else: everyone just seems to use
vectors in their init function.

Avoid clearing msix vector use info on reset and load.
For virtio, clear it explicitly....

5f893b4e 08/18/2012 11:49 am Gerd Hoffmann

Avoid asprintf() which is not available on mingw

Use g_strdup_printf() instead.

Signed-off-by: Gerd Hoffmann <>
Reviewed-by: Stefan Weil <>
Signed-off-by: Blue Swirl <>

932d4a42 07/19/2012 05:56 pm Alexey Kardashevskiy

msi/msix: added API to set MSI message address and data

Added (msi|msix)_set_message() function for whoever might
want to use them.

Currently msi_notify()/msix_notify() write to these vectors to
signal the guest about an interrupt so the correct values have to...

572992ee 06/18/2012 10:21 am Alex Williamson

msix: Switch msix_uninit to return void

It can't fail.

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

eebcb0a7 06/18/2012 10:21 am Alex Williamson

msix: Move msix_mmio_read

What's this doing so far from msix_mmio_ops?

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

2cf62ad7 06/18/2012 10:21 am Alex Williamson

msix: Note endian TODO item

MSIX, like PCI, is little endian. Specifying native is wrong here,
but we need to check the rest of the file to determine if it's
as simple as flipping this macro.

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

d35e428c 06/18/2012 10:21 am Alex Williamson

msix: Split PBA into it's own MemoryRegion

These don't have to be contiguous. Size them to only what
they need and use separate MemoryRegions for the vector
table and PBA.

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

5a2c2029 06/18/2012 10:21 am Alex Williamson

msix: Allow full specification of MSIX layout

Finally, complete the fully specified interface. msix_add_config()
gets folded into msix_init() because we now have quite a few parameters
to pass and rolling it in let's us error earlier, avoiding the ugly
unwind exit path. msix_mmio_setup() also gets rolled in, just because...

53f94925 06/18/2012 10:21 am Alex Williamson

msix: Add simple BAR allocation MSIX setup functions

msi_init() takes over a BAR without really specifying or allowing
specification of how it does so. Instead, let's split it into
two interfaces, one fully specified, and one trivially easy. This
implements the latter. msix_init_exclusive_bar() takes over...

393a9892 06/18/2012 10:21 am Jan Kiszka

msix: drop unused msix_bar_size, require valid bar_size

No user in sight for msix_bar_size.
bar_size for all users is aligned, let's simply
require this instead of trying to fix up invalid input.

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

44701ab7 06/07/2012 05:19 pm Jan Kiszka

msi: Use msi/msix_present more consistently

Replace some open-coded msi/msix_present checks.

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

7c9958b0 06/07/2012 05:19 pm Jan Kiszka

msi: Guard msi/msix_write_config with msi_present

Terminate msi/msix_write_config early if support is not enabled. This
allows to remove checks at the caller site if MSI is optional.

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

cb697aaa 05/21/2012 07:22 pm Jan Kiszka

msix: Add msix_nr_vectors_allocated

Analogously to msi_nr_vectors_allocated, add a service for MSI-X. Will
be used by the virtio-pci layer.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

bc4caf49 05/21/2012 07:22 pm Jan Kiszka

msix: Factor out msix_get_message

This helper will also be used by the upcoming config notifier.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Avi Kivity <>

5b5f1330 05/21/2012 07:22 pm Jan Kiszka

msix: Invoke msix_handle_mask_update on msix_mask_all

In preparation of firing vector notifiers on mask changes, call
msix_handle_mask_update also from msix_mask_all. So far, this will have
no real effect.

Signed-off-by: Jan Kiszka <>...

2cdfe53c 05/21/2012 07:22 pm Jan Kiszka

msix: Introduce vector notifiers

Vector notifiers shall be triggered by the MSI/MSI-X core whenever a
relevant configuration change is programmed by the guest. In case of
MSI-X, changes are reported when the effective mask (global &&
per-vector) alters its state. On unmask, the current vector...

60ba3cc2 01/19/2012 01:14 pm Jan Kiszka

msi: Generalize msix_supported to msi_supported

Rename msix_supported to msi_supported and control MSI and MSI-X
activation this way. That was likely to original intention for this
flag, but MSI support came after MSI-X.

Signed-off-by: Jan Kiszka <>

6b620ca3 01/13/2012 06:55 pm Paolo Bonzini

prepare for future GPLv2+ relicensing

All files under GPLv2 will get GPLv2+ changes starting tomorrow.
event_notifier.c and exec-obsolete.h were only ever touched by Red Hat
employees and can be relicensed now.

Signed-off-by: Paolo Bonzini <>...

50322249 11/21/2011 11:05 pm Michael S. Tsirkin

msix: track function masked in pci device state

Only go over the table when function is masked.
This is not really important for qemu.git but helps
fix a bug in qemu-kvm.git.

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

9a93b617 11/21/2011 11:05 pm Michael S. Tsirkin

msix: Prevent bogus mask updates on MMIO accesses

From: Jan Kiszka <>

Only accesses to the MSI-X table must trigger a call to
msix_handle_mask_update, otherwise the vector
value might be out of range.

Signed-off-by: Jan Kiszka <>...

ae392c41 11/21/2011 11:05 pm Michael S. Tsirkin

msix: avoid mask updates if mask is unchanged

Check pending bit only if vector mask status changed.
This is not really important for qemu.git but helps
fix a bug in qemu-kvm.git.

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

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

95524ae8 08/08/2011 06:22 pm Avi Kivity

msix: convert to memory API

The msix table is defined as a subregion, to allow for a BAR that
mixes device specific regions with the msix table.

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

ae5d3eb4 07/12/2011 11:00 pm Alexander Graf

msix: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <>
Signed-off-by: Blue Swirl <>

befeac45 06/15/2011 06:27 pm Michael S. Tsirkin

Merge remote-tracking branch 'origin/master' into pci

Conflicts:
hw/virtio-pci.c

01731cfb 06/12/2011 10:33 am Jan Kiszka

msix: Use replace local defines with pci_regs versions

This also cleans up an open-coded 64-bit message address readout.

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

ebabb67a 05/06/2011 10:19 am Stefan Weil

Fix typo in code and comments

Replace writeable -> writable

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

e407bf13 01/20/2011 03:33 pm Isaku Yamahata

msix: simplify write config

use pci_device_deassert_intx().

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

2507c12a 12/11/2010 05:24 pm Alexander Graf

Add endianness as io mem parameter

As stated before, devices can be little, big or native endian. The
target endianness is not of their concern, so we need to push things
down a level.

This patch adds a parameter to cpu_register_io_memory that allows a
device to choose its endianness. For now, all devices simply choose...

b907b69d 10/27/2010 08:07 pm Michael S. Tsirkin

Merge branch 'pci' into for_anthony

57c6db2e 09/20/2010 09:15 pm Isaku Yamahata

msix: clear not only INTA, but all INTx when MSI-X is enabled.

clear not only INTA, but all INTx when MSI-X is enabled.

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

bf1b0071 09/18/2010 08:53 am Blue Swirl

Introduce range.h

Extract range functions from pci.h. These will be used by later patches
by non-PCI devices. Adjust current users.

Signed-off-by: Blue Swirl <>

ca77089d 09/07/2010 08:10 pm Isaku Yamahata

pci: consolidate pci_add_capability_at_offset() into pci_add_capability().

By making pci_add_capability() the special case of
pci_add_capability_at_offset() of offset = 0,
consolidate pci_add_capability_at_offset() into pci_add_capability().

Cc: Stefan Weil <>...

ac7045cf 06/14/2010 06:58 pm Jes Sorensen

Remove unused DEBUG defines from hw/msix.c

Remove unused DEBUG defines from hw/msix.c to avoid having anything
define the word DEBUG without any additions such as MSIX_DEBUG.

Signed-off-by: Jes Sorensen <>
Signed-off-by: Anthony Liguori <>

1b4e8f73 05/31/2010 04:33 pm Isaku Yamahata

msix: remove duplicated defines.

remove defines which are already defined in pci_regs.h

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

98a3cb02 12/23/2009 04:35 pm Isaku Yamahata

msix: use range helper function.

use range helper function in msix_write_config().

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

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

msix: function mask support

Function mask is a mandatory feature in MSIX
spec so not implementing it is a spec violation.
Implement.

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

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

msix: macro rename for function mask support

rename ENABLE_OFFSET -> CONTROL_OFFSET, since
same byte includes function mask.
This is in preparation for function mask support.

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

98304c84 12/01/2009 06:00 pm Michael S. Tsirkin

msix: clear pending bit of an unused vector

PCI spec states:
if a masked vector has its Pending bit set, and the associated
underlying interrupt events are somehow satisfied (usually by software
though the exact manner is function-specific), the function must clear...

1f944c66 12/01/2009 06:00 pm Michael S. Tsirkin

msix: fix reset value for enable bit

On reset, we currently clear all bits in msix control register except
enable bit. This is wrong: the spec says we should clear writeable
bits: function mask and enable bit.
Correct this.

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

ae1be0bb 12/01/2009 05:59 pm Michael S. Tsirkin

msix: fix mask bit state after reset

PCI spec states that mask bit must be 1 after reset.
Make it so.

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

b5f28bca 12/01/2009 05:58 pm Michael S. Tsirkin

msix: add helper to unuse all msix entries

will be used by virtio on soft reset

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

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

76f5159d 10/30/2009 03:39 pm Michael S. Tsirkin

qemu/msix: fix table access issues

Fixes a couple of issues with msix table access:
- With misbehaving guests, misaligned 4 byte access could overflow
msix table and cause qemu to segfault. Since PCI spec requires
host to only issue dword-aligned accesses, as a fix,...

5a1fc5e8 10/05/2009 05:32 pm Michael S. Tsirkin

qemu: clean up target page usage in msix

Since cpu_register_phys_memory does not require size to be a multiple of
target page size, simply make msix page size 0x1000. Do this in msix,
reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no
longer have to pass target page around....

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

99a0949b 10/01/2009 09:45 pm malc

Get rid of _t suffix

Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <>

5e520a7d 09/20/2009 06:35 pm Blue Swirl

Compile msix only once

Get page size in device init.

Signed-off-by: Blue Swirl <>

d60efc6b 08/25/2009 09:29 pm Blue Swirl

Make CPURead/WriteFunc structure 'const'

Signed-off-by: Blue Swirl <>

3174ecd1 07/27/2009 10:09 pm Michael S. Tsirkin

qemu: msix nit: clear msix_entries_nr on error

I don't think it's critical to do this, but it's
best to keep uninit and error recovery consistent.

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

4bfd1712 07/10/2009 09:44 pm Michael S. Tsirkin

qemu/msi: clean used vectors state on load

Clean up msix vector usage state on load. Since guest might have control
over it through the device, the device will have to load this state from
file.

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

72755a70 07/10/2009 09:44 pm Michael S. Tsirkin

qemu/msi: missing braces

MSIX present bit is tested incorrectly, and only happens to work because
the bit we are testing is 0x1. Add braces to fix this.

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

9a3e12c8 07/10/2009 12:58 am Michael S. Tsirkin

fix segfault in msix_save

This fixes segfault reported by Kevin Wolf,
and simplifies the code in msix_save.

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

98846d73 07/05/2009 11:11 am Blue Swirl

Fix Sparse warning

Signed-off-by: Blue Swirl <>

02eb84d0 06/24/2009 05:09 pm Michael S. Tsirkin

qemu/pci: MSI-X support functions

Add functions implementing MSI-X support. First user will be virtio-pci.
Note that platform must set a flag to declare MSI supported: this
is a safety measure to avoid breaking platforms which should support
MSI-X but currently lack this in the interrupt controller emulation....