vpci: add header handlers
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 22 Mar 2018 14:00:00 +0000 (15:00 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Mar 2018 09:22:07 +0000 (10:22 +0100)
commit9c244fdef7e7c214316dab1bbd91cd388781cb10
treec104d9a04832be3cfb1b1d41efffbbdffef32932
parentccd12ff6489a02954dd4f76d67543e2b18d6acd0
vpci: add header handlers

Introduce a set of handlers that trap accesses to the PCI BARs and the
command register, in order to snoop BAR sizing and BAR relocation.

The command handler is used to detect changes to bit 2 (response to
memory space accesses), and maps/unmaps the BARs of the device into
the guest p2m. A rangeset is used in order to figure out which memory
to map/unmap. This makes it easier to keep track of the possible
overlaps with other BARs, and will also simplify MSI-X support, where
certain regions of a BAR might be used for the MSI-X table or PBA.

The BAR register handlers are used to detect attempts by the guest to
size or relocate the BARs.

Note that the long running BAR mapping and unmapping operations are
deferred to be performed by hvm_io_pending, so that they can be safely
preempted.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
[IO]
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
tools/tests/vpci/emul.h
xen/arch/x86/hvm/ioreq.c
xen/drivers/vpci/Makefile
xen/drivers/vpci/header.c [new file with mode: 0644]
xen/drivers/vpci/vpci.c
xen/include/xen/sched.h
xen/include/xen/vpci.h