1. 08 1月, 2012 1 次提交
  2. 05 1月, 2012 1 次提交
    • J
      Xen: consolidate and simplify struct xenbus_driver instantiation · 73db144b
      Jan Beulich 提交于
      The 'name', 'owner', and 'mod_name' members are redundant with the
      identically named fields in the 'driver' sub-structure. Rather than
      switching each instance to specify these fields explicitly, introduce
      a macro to simplify this.
      
      Eliminate further redundancy by allowing the drvname argument to
      DEFINE_XENBUS_DRIVER() to be blank (in which case the first entry from
      the ID table will be used for .driver.name).
      
      Also eliminate the questionable xenbus_register_{back,front}end()
      wrappers - their sole remaining purpose was the checking of the
      'owner' field, proper setting of which shouldn't be an issue anymore
      when the macro gets used.
      
      v2: Restore DRV_NAME for the driver name in xen-pciback.
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      73db144b
  3. 27 9月, 2011 1 次提交
  4. 22 9月, 2011 2 次提交
    • K
      xen/pciback: Use mutexes when working with Xenbus state transitions. · b1766b62
      Konrad Rzeszutek Wilk 提交于
      The caller that orchestrates the state changes is xenwatch_thread
      and it takes a mutex. In our processing of Xenbus states we can take
      the luxery of going to sleep on a mutex, so lets do that and
      also fix this bug:
      
      BUG: sleeping function called from invalid context at /linux/kernel/mutex.c:271
      in_atomic(): 1, irqs_disabled(): 0, pid: 32, name: xenwatch
      2 locks held by xenwatch/32:
       #0:  (xenwatch_mutex){......}, at: [<ffffffff813856ab>] xenwatch_thread+0x4b/0x180
       #1:  (&(&pdev->dev_lock)->rlock){......}, at: [<ffffffff8138f05b>] xen_pcibk_disconnect+0x1b/0x80
      Pid: 32, comm: xenwatch Not tainted 3.1.0-rc6-00015-g3ce340d #2
      Call Trace:
       [<ffffffff810892b2>] __might_sleep+0x102/0x130
       [<ffffffff8163b90f>] mutex_lock_nested+0x2f/0x50
       [<ffffffff81382c1c>] unbind_from_irq+0x2c/0x1b0
       [<ffffffff8110da66>] ? free_irq+0x56/0xb0
       [<ffffffff81382dbc>] unbind_from_irqhandler+0x1c/0x30
       [<ffffffff8138f06b>] xen_pcibk_disconnect+0x2b/0x80
       [<ffffffff81390348>] xen_pcibk_frontend_changed+0xe8/0x140
       [<ffffffff81387ac2>] xenbus_otherend_changed+0xd2/0x150
       [<ffffffff810895c1>] ? get_parent_ip+0x11/0x50
       [<ffffffff81387de0>] frontend_changed+0x10/0x20
       [<ffffffff81385712>] xenwatch_thread+0xb2/0x180
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      b1766b62
    • J
      xen/pciback: miscellaneous adjustments · 402c5e15
      Jan Beulich 提交于
      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
        kill_domain_by_device()
      - use pci_is_enabled() rather than raw atomic_read()
      - remove a bogus attempt to zero-terminate an already zero-terminated
        string
      - #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: NJan Beulich <jbeulich@suse.com>
      [v1: Dropped the resource_size fix, altered the description]
      [v2: Fixed cleanpatch.pl comments]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      402c5e15
  5. 04 8月, 2011 1 次提交
  6. 27 7月, 2011 1 次提交
  7. 20 7月, 2011 6 次提交
    • K
      xen/pciback: Have 'passthrough' option instead of XEN_PCIDEV_BACKEND_PASS and... · 2ebdc426
      Konrad Rzeszutek Wilk 提交于
      xen/pciback: Have 'passthrough' option instead of XEN_PCIDEV_BACKEND_PASS and XEN_PCIDEV_BACKEND_VPCI
      
      .. compile options. This way the user can decide during runtime whether they
      want the default 'vpci' (virtual pci passthrough) or where the PCI devices
      are passed in without any BDF renumbering. The option 'passthrough' allows
      the user to toggle the it from 0 (vpci) to 1 (passthrough).
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      2ebdc426
    • K
      xen/pciback: Drop two backends, squash and cleanup some code. · a92336a1
      Konrad Rzeszutek Wilk 提交于
       - 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
         "xen-pciback".
       - 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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      a92336a1
    • K
      xen/pciback: Fine-grain the spinlocks and fix BUG: scheduling while atomic cases. · 494ef20d
      Konrad Rzeszutek Wilk 提交于
      We were using coarse spinlocks that could end up with a deadlock.
      This patch fixes that and makes the spinlocks much more fine-grained.
      
      We also drop be->watchding state spinlocks as they are already
      guarded by the xenwatch_thread against multiple customers. Without
      that we would trigger the BUG: scheduling while atomic.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      494ef20d
    • K
      xen/pciback: Register the owner (domain) of the PCI device. · 6221a9b2
      Konrad Rzeszutek Wilk 提交于
      When the front-end and back-end start negotiating we register
      the domain that will use the PCI device. Furthermore during shutdown
      of guest or unbinding of the PCI device (and unloading of module)
      from pciback we unregister the domain owner.
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      6221a9b2
    • K
      xen/pciback: Cleanup the driver based on checkpatch warnings and errors. · 8bfd4e02
      Konrad Rzeszutek Wilk 提交于
      Checkpatch found some extra warnings and errors. This mega
      patch fixes them all in one big swoop. We also spruce
      up the pcistub_ids to use DEFINE_PCI_DEVICE_TABLE macro
      (suggested by Jan Beulich).
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      8bfd4e02
    • K
      xen/pciback: xen pci backend driver. · 30edc14b
      Konrad Rzeszutek Wilk 提交于
      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:
      
       XEN_PCI_OP_conf_[read|write]:
         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
         device.
      
      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: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      30edc14b