Comments

msix_init has very little configurability as to how it lays out
MSI/X for a device. It claims to resize BARs, but doesn't
actually do this anymore. This patch allows MSI/X to be fully
specified, which is necessary both for emulated devices trying
to match the physical layout of a hardware device as well as for
any kind of device assignment.
The original intent of msix_init seems to have been to allow
completely virtual devices so enable MSI/X without knowing
anything about it. A sort of "here's a BAR and a device, add
MSI/X to it". We've already dropped the resize support with
the memory API, and I think it makes sense to tune the interface
to something that still makes it easy for virtual devices to use,
but allows the full specification for realistically creating
emulated devices using MSI/X.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
This needs more testing, but I wanted to send it out in case someone
else is working on something similar. In order to not modify the
generic capability adding code VFIO needs to tell qemu about ever
capability for a device. The main roadblock to doing that is that
msix_init does not provide sufficient specification of the MSI/X area
to match a physical device. This solves that.
hw/ivshmem.c | 5 +
hw/msix.c | 204 ++++++++++++++++++++++++++++++++++++-------------------
hw/msix.h | 12 ++-
hw/pci.h | 14 +++-
hw/virtio-pci.c | 7 +-
5 files changed, 161 insertions(+), 81 deletions(-)

On 2012-06-10 19:02, Alex Williamson wrote:
> msix_init has very little configurability as to how it lays out> MSI/X for a device. It claims to resize BARs, but doesn't> actually do this anymore. This patch allows MSI/X to be fully> specified, which is necessary both for emulated devices trying> to match the physical layout of a hardware device as well as for> any kind of device assignment.> > The original intent of msix_init seems to have been to allow> completely virtual devices so enable MSI/X without knowing> anything about it. A sort of "here's a BAR and a device, add> MSI/X to it". We've already dropped the resize support with> the memory API, and I think it makes sense to tune the interface> to something that still makes it easy for virtual devices to use,> but allows the full specification for realistically creating> emulated devices using MSI/X.> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>> ---> > This needs more testing, but I wanted to send it out in case someone> else is working on something similar. In order to not modify the> generic capability adding code VFIO needs to tell qemu about ever> capability for a device. The main roadblock to doing that is that> msix_init does not provide sufficient specification of the MSI/X area> to match a physical device. This solves that.
Reminds me that you asked for my version:
http://git.kiszka.org/?p=qemu.git;a=shortlog;h=refs/heads/queues/msi
specifically the top two commits. WIP, just picked the old commits,
result untested.
Still need to look into your version.
Jan