vfio-pci: Manage user power state transitions
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 18 Feb 2013 17:10:33 +0000 (10:10 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 18 Feb 2013 17:10:33 +0000 (10:10 -0700)
commit2dd1194833de133960f286903ce704cb10fa7eb0
treea892a48ff846ed92dd49aa50b53a221b503876be
parent2b489a45f63102205cece37057c21f6fa66f6ce4
vfio-pci: Manage user power state transitions

We give the user access to change the power state of the device but
certain transitions result in an uninitialized state which the user
cannot resolve.  To fix this we need to mark the PowerState field of
the PMCSR register read-only and effect the requested change on behalf
of the user.  This has the added benefit that pdev->current_state
remains accurate while controlled by the user.

The primary example of this bug is a QEMU guest doing a reboot where
the device it put into D3 on shutdown and becomes unusable on the next
boot because the device did a soft reset on D3->D0 (NoSoftRst-).

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_config.c