1. 06 Apr, 2012 1 commit
    • Jan Beulich's avatar
      xen/pciback: fix XEN_PCI_OP_enable_msix result · 0ee46eca
      Jan Beulich authored
      Prior to 2.6.19 and as of 2.6.31, pci_enable_msix() can return a
      positive value to indicate the number of vectors (less than the amount
      requested) that can be set up for a given device. Returning this as an
      operation value (secondary result) is fine, but (primary) operation
      results are expected to be negative (error) or zero (success) according
      to the protocol. With the frontend fixed to match the XenoLinux
      behavior, the backend can now validly return zero (success) here,
      passing the upper limit on the number of vectors in op->value.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  2. 21 Sep, 2011 1 commit
    • Jan Beulich's avatar
      xen/pciback: miscellaneous adjustments · 402c5e15
      Jan Beulich authored
      This is a minor bugfix and a set of small cleanups; as it is not clear
      whether this needs splitting into pieces (and if so, at what
      granularity), it is a single combined patch.
      - add a missing return statement to an error path in
      - use pci_is_enabled() rather than raw atomic_read()
      - remove a bogus attempt to zero-terminate an already zero-terminated
      - #define DRV_NAME once uniformly in the shared local header
      - make DRIVER_ATTR() variables static
      - eliminate a pointless use of list_for_each_entry_safe()
      - add MODULE_ALIAS()
      - a little bit of constification
      - adjust a few messages
      - remove stray semicolons from inline function definitions
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      [v1: Dropped the resource_size fix, altered the description]
      [v2: Fixed cleanpatch.pl comments]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  3. 20 Jul, 2011 5 commits
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Drop two backends, squash and cleanup some code. · a92336a1
      Konrad Rzeszutek Wilk authored
       - Remove the slot and controller controller backend as they
         are not used.
       - Document the find pciback_[read|write]_config_[byte|word|dword]
         to make it easier to find.
       - Collapse the code from conf_space_capability_msi into pciback_ops.c
       - Collapse conf_space_capability_[pm|vpd].c in conf_space_capability.c
         [and remove the conf_space_capability.h file]
       - Rename all visible functions from pciback to xen_pcibk.
       - Rename all the printk/pr_info, etc that use the "pciback" to say
       - Convert functions that are not referenced outside the code to be
         static to save on name space.
       - Do the same thing for structures that are internal to the driver.
       - Run checkpatch.pl after the renames and fixup its warnings and
         fix any compile errors caused by the variable rename
       - Cleanup any structs that checkpath.pl commented about or just
         look odd.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Don't setup an fake IRQ handler for SR-IOV devices. · e17ab35f
      Konrad Rzeszutek Wilk authored
      If we try to setup an fake IRQ handler for legacy interrupts
      for devices that only have MSI-X (most if not all SR-IOV cards),
      we will fail with this:
      pciback[0000:01:10.0]: failed to install fake IRQ handler for IRQ 0! (rc:-38)
      Since those cards don't have anything in dev->irq.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Allocate IRQ handler for device that is shared with guest. · 0513fe9e
      Konrad Rzeszutek Wilk authored
      If the device that is to be shared with a guest is a level device and
      the IRQ is shared with the initial domain we need to take actions.
      Mainly we install a dummy IRQ handler that will ACK on the interrupt
      line so as to not have the initial domain disable the interrupt line.
      This dummy IRQ handler is not enabled when the device MSI/MSI-X lines
      are set, nor for edge interrupts. And also not for level interrupts
      that are not shared amongst devices. Lastly, if the user passes
      to the guest all of the PCI devices on the shared line the we won't
      install the dummy handler either.
      There is also SysFS instrumentation to check its state and turn
      IRQ ACKing on/off if necessary.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: Disable MSI/MSI-X when reseting a device · a2be65fd
      Konrad Rzeszutek Wilk authored
      In cases where the guest is abruptly killed and has not disabled
      MSI/MSI-X interrupts we want to do it for it.
      Otherwise when the guest is started up and enables MSI, we would
      get a WARN() that the device already had been enabled.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    • Konrad Rzeszutek Wilk's avatar
      xen/pciback: xen pci backend driver. · 30edc14b
      Konrad Rzeszutek Wilk authored
      This is the host side counterpart to the frontend driver in
      drivers/pci/xen-pcifront.c. The PV protocol is also implemented by
      frontend drivers in other OSes too, such as the BSDs.
      The PV protocol is rather simple. There is page shared with the guest,
      which has the 'struct xen_pci_sharedinfo' embossed in it. The backend
      has a thread that is kicked every-time the structure is changed and
      based on the operation field it performs specific tasks:
         Read/Write 0xCF8/0xCFC filtered data. (conf_space*.c)
         Based on which field is probed, we either enable/disable the PCI
         device, change power state, read VPD, etc. The major goal of this
         call is to provide a Physical IRQ (PIRQ) to the guest.
         The PIRQ is Xen hypervisor global IRQ value irrespective of the IRQ
         is tied in to the IO-APIC, or is a vector. For GSI type
         interrupts, the PIRQ==GSI holds. For MSI/MSI-X the
         PIRQ value != Linux IRQ number (thought PIRQ==vector).
         Please note, that with Xen, all interrupts (except those level shared ones)
         are injected directly to the guest - there is no host interaction.
       XEN_PCI_OP_[enable|disable]_msi[|x] (pciback_ops.c)
         Enables/disables the MSI/MSI-X capability of the device. These operations
         setup the MSI/MSI-X vectors for the guest and pass them to the frontend.
         When the device is activated, the interrupts are directly injected in the
         guest without involving the host.
       XEN_PCI_OP_aer_[detected|resume|mmio|slotreset]: In case of failure,
        perform the appropriate AER commands on the guest. Right now that is
        a cop-out - we just kill the guest.
      Besides implementing those commands, it can also
       - hide a PCI device from the host. When booting up, the user can specify
         xen-pciback.hide=(1:0:0)(BDF..) so that host does not try to use the
      The driver was lifted from linux-2.6.18.hg tree and fixed up
      so that it could compile under v3.0. Per suggestion from Jesse Barnes
      moved the driver to drivers/xen/xen-pciback.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>