diff options
author | Jan Beulich <jbeulich@suse.com> | 2013-03-08 14:05:34 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-03-08 14:05:34 +0100 |
commit | 4245d331e0e75de8d1bddbbb518f3a8ce6d0bb7e (patch) | |
tree | d83744a83a32179dec1ce6e7c00e3a01e06d29c7 /xen/arch/x86/physdev.c | |
parent | 0f3b02d07e12b76c568ce82d7ec6bf80fdf3870f (diff) | |
download | xen-4245d331e0e75de8d1bddbbb518f3a8ce6d0bb7e.tar.gz xen-4245d331e0e75de8d1bddbbb518f3a8ce6d0bb7e.tar.bz2 xen-4245d331e0e75de8d1bddbbb518f3a8ce6d0bb7e.zip |
x86/MSI: add mechanism to fully protect MSI-X table from PV guest accesses
This adds two new physdev operations for Dom0 to invoke when resource
allocation for devices is known to be complete, so that the hypervisor
can arrange for the respective MMIO ranges to be marked read-only
before an eventual guest getting such a device assigned even gets
started, such that it won't be able to set up writable mappings for
these MMIO ranges before Xen has a chance to protect them.
This also addresses another issue with the code being modified here,
in that so far write protection for the address ranges in question got
set up only once during the lifetime of a device (i.e. until either
system shutdown or device hot removal), while teardown happened when
the last interrupt was disposed of by the guest (which at least allowed
the tables to be writable when the device got assigned to a second
guest [instance] after the first terminated).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/arch/x86/physdev.c')
-rw-r--r-- | xen/arch/x86/physdev.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index e8b4e7684a..876ac9d623 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -579,6 +579,18 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) break; } + case PHYSDEVOP_prepare_msix: + case PHYSDEVOP_release_msix: { + struct physdev_pci_device dev; + + if ( copy_from_guest(&dev, arg, 1) ) + ret = -EFAULT; + else + ret = pci_prepare_msix(dev.seg, dev.bus, dev.devfn, + cmd != PHYSDEVOP_prepare_msix); + break; + } + case PHYSDEVOP_pci_mmcfg_reserved: { struct physdev_pci_mmcfg_reserved info; |