03 May, 2013

1 commit

  • Pull vfio updates from Alex Williamson:
    "Changes include extension to support PCI AER notification to
    userspace, byte granularity of PCI config space and access to
    unarchitected PCI config space, better protection around IOMMU driver
    accesses, default file mode fix, and a few misc cleanups."

    * tag 'vfio-for-v3.10' of git://github.com/awilliam/linux-vfio:
    vfio: Set container device mode
    vfio: Use down_reads to protect iommu disconnects
    vfio: Convert container->group_lock to rwsem
    PCI/VFIO: use pcie_flags_reg instead of access PCI-E Capabilities Register
    vfio-pci: Enable raw access to unassigned config space
    vfio-pci: Use byte granularity in config map
    vfio: make local function vfio_pci_intx_unmask_handler() static
    VFIO-AER: Vfio-pci driver changes for supporting AER
    VFIO: Wrapper for getting reference to vfio_device

    Linus Torvalds
     

30 Apr, 2013

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for the v3.10 merge window:

    PCI device hotplug
    - Remove ACPI PCI subdrivers (Jiang Liu, Myron Stowe)
    - Make acpiphp builtin only, not modular (Jiang Liu)
    - Add acpiphp mutual exclusion (Jiang Liu)

    Power management
    - Skip "PME enabled/disabled" messages when not supported (Rafael
    Wysocki)
    - Fix fallback to PCI_D0 (Rafael Wysocki)

    Miscellaneous
    - Factor quirk_io_region (Yinghai Lu)
    - Cache MSI capability offsets & cleanup (Gavin Shan, Bjorn Helgaas)
    - Clean up EISA resource initialization and logging (Bjorn Helgaas)
    - Fix prototype warnings (Andy Shevchenko, Bjorn Helgaas)
    - MIPS: Initialize of_node before scanning bus (Gabor Juhos)
    - Fix pcibios_get_phb_of_node() declaration "weak" annotation (Gabor
    Juhos)
    - Add MSI INTX_DISABLE quirks for AR8161/AR8162/etc (Xiong Huang)
    - Fix aer_inject return values (Prarit Bhargava)
    - Remove PME/ACPI dependency (Andrew Murray)
    - Use shared PCI_BUS_NUM() and PCI_DEVID() (Shuah Khan)"

    * tag 'pci-v3.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (63 commits)
    vfio-pci: Use cached MSI/MSI-X capabilities
    vfio-pci: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK
    PCI: Remove "extern" from function declarations
    PCI: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK
    PCI: Drop msi_mask_reg() and remove drivers/pci/msi.h
    PCI: Use msix_table_size() directly, drop multi_msix_capable()
    PCI: Drop msix_table_offset_reg() and msix_pba_offset_reg() macros
    PCI: Drop is_64bit_address() and is_mask_bit_support() macros
    PCI: Drop msi_data_reg() macro
    PCI: Drop msi_lower_address_reg() and msi_upper_address_reg() macros
    PCI: Drop msi_control_reg() macro and use PCI_MSI_FLAGS directly
    PCI: Use cached MSI/MSI-X offsets from dev, not from msi_desc
    PCI: Clean up MSI/MSI-X capability #defines
    PCI: Use cached MSI-X cap while enabling MSI-X
    PCI: Use cached MSI cap while enabling MSI interrupts
    PCI: Remove MSI/MSI-X cap check in pci_msi_check_device()
    PCI: Cache MSI/MSI-X capability offsets in struct pci_dev
    PCI: Use u8, not int, for PM capability offset
    [SCSI] megaraid_sas: Use correct #define for MSI-X capability
    PCI: Remove "extern" from function declarations
    ...

    Linus Torvalds
     

25 Apr, 2013

2 commits


27 Mar, 2013

1 commit

  • The VFIO_DEVICE_SET_IRQS ioctl takes a start and count parameter, both
    of which are unsigned. We attempt to bounds check these, but fail to
    account for the case where start is a very large number, allowing
    start + count to wrap back into the valid range. Bounds check both
    start and start + count.

    Reported-by: Dan Carpenter
    Signed-off-by: Alex Williamson

    Alex Williamson
     

11 Mar, 2013

1 commit

  • - New VFIO_SET_IRQ ioctl option to pass the eventfd that is signaled when
    an error occurs in the vfio_pci_device

    - Register pci_error_handler for the vfio_pci driver

    - When the device encounters an error, the error handler registered by
    the vfio_pci driver gets invoked by the AER infrastructure

    - In the error handler, signal the eventfd registered for the device.

    - This results in the qemu eventfd handler getting invoked and
    appropriate action taken for the guest.

    Signed-off-by: Vijay Mohan Pandarathil
    Signed-off-by: Alex Williamson

    Vijay Mohan Pandarathil
     

19 Feb, 2013

1 commit

  • PCI defines display class VGA regions at I/O port address 0x3b0, 0x3c0
    and MMIO address 0xa0000. As these are non-overlapping, we can ignore
    the I/O port vs MMIO difference and expose them both in a single
    region. We make use of the VGA arbiter around each access to
    configure chipset access as necessary.

    Signed-off-by: Alex Williamson

    Alex Williamson
     

15 Feb, 2013

2 commits

  • We can actually handle MMIO and I/O port from the same access function
    since PCI already does abstraction of this. The ROM BAR only requires
    a minor difference, so it gets included too. vfio_pci_config_readwrite
    gets renamed for consistency.

    Signed-off-by: Alex Williamson

    Alex Williamson
     
  • The read and write functions are nearly identical, combine them
    and convert to a switch statement. This also makes it easy to
    narrow the scope of when we use the io/mem accessors in case new
    regions are added.

    Signed-off-by: Alex Williamson

    Alex Williamson
     

08 Dec, 2012

4 commits

  • Devices making use of PM reset are getting incorrectly identified as
    not supporting reset because pci_pm_reset() fails unless the device is
    in D0 power state. When first attached to vfio_pci devices are
    typically in an unknown power state. We can fix this by explicitly
    setting the power state or simply calling pci_enable_device() before
    attempting a pci_reset_function(). We need to enable the device
    anyway, so move this up in our vfio_pci_enable() function, which also
    simplifies the error path a bit.

    Note that pci_disable_device() does not explicitly set the power
    state, so there's no need to re-order vfio_pci_disable().

    Signed-off-by: Alex Williamson

    Alex Williamson
     
  • The two labels for error recovery in function vfio_pci_init() is out of
    order, so fix it.

    Signed-off-by: Jiang Liu
    Signed-off-by: Alex Williamson

    Jiang Liu
     
  • Move the device reset to the end of our disable path, the device
    should already be stopped from pci_disable_device(). This also allows
    us to manipulate the save/restore to avoid the save/reset/restore +
    save/restore that we had before.

    Signed-off-by: Alex Williamson

    Alex Williamson
     
  • Generated by: coccinelle/api/memdup_user.cocci

    Acked-by: Julia Lawall
    Reported-by: Fengguang Wu
    Signed-off-by: Alex Williamson

    Fengguang Wu
     

10 Oct, 2012

1 commit


09 Oct, 2012

1 commit

  • The VM_RESERVED flag was killed off in commit 314e51b9851b ("mm: kill
    vma flag VM_RESERVED and mm->reserved_vm counter"), and replaced by the
    proper semantic flags (eg "don't core-dump" etc). But there was a new
    use of VM_RESERVED that got missed by the merge.

    Fix the remaining use of VM_RESERVED in the vfio_pci driver, replacing
    the VM_RESERVED flag with VM_DONTEXPAND | VM_DONTDUMP.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

31 Jul, 2012

1 commit

  • Add PCI device support for VFIO. PCI devices expose regions
    for accessing config space, I/O port space, and MMIO areas
    of the device. PCI config access is virtualized in the kernel,
    allowing us to ensure the integrity of the system, by preventing
    various accesses while reducing duplicate support across various
    userspace drivers. I/O port supports read/write access while
    MMIO also supports mmap of sufficiently sized regions. Support
    for INTx, MSI, and MSI-X interrupts are provided using eventfds to
    userspace.

    Signed-off-by: Alex Williamson

    Alex Williamson