1. 05 2月, 2008 2 次提交
    • J
      IB/mthca: Don't read reserved fields in mthca_QUERY_ADAPTER() · 6ccef1de
      Jack Morgenstein 提交于
      For memfree devices, the firmware QUERY_ADAPTER command does not
      return vendor_id, device_id, and revision_id; do not return these
      fields in the QUERY_ADAPTER function for memfree devices.
      
      Instead, for memfree devices, initialize the rev_id field of the mthca
      device via init_node_data (MAD IFC query), as is done in the
      query_device verb implementation.
      Signed-off-by: NJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      6ccef1de
    • R
      IB/mthca: Fix and simplify page size calculation in mthca_reg_phys_mr() · 0d89fe2c
      Roland Dreier 提交于
          
      In mthca_reg_phys_mr(), we calculate the page size for the HCA
      hardware to use to map the buffer list passed in by the consumer.
      For example, if the consumer passes in
      
          [0] addr 0x1000, size 0x1000
          [1] addr 0x2000, size 0x1000
      
      then the algorithm would come up with a page size of 0x2000 and a list
      of two pages, at 0x0000 and 0x2000.  Usually, this would work fine
      since the memory region would start at an offset of 0x1000 and have a
      length of 0x2000.
      
      However, the old code did not take into account the alignment of the
      IO virtual address passed in.  For example, if the consumer passed in
      a virtual address of 0x6000 for the above, then the offset of 0x1000
      would not be used correctly because the page mask of 0x1fff would
      result in an offset of 0.
      
      We can fix this quite neatly by making sure that the page shift we use
      is no bigger than the first bit where the start of the first buffer
      and the IO virtual address differ.  Also, we can further simplify the
      code by removing the special case for a single buffer by noticing that
      it doesn't matter if we use a page size that is too big.  This allows
      the loop to compute the page shift to be replaced with __ffs().
      
      Thanks to Bryan S Rosenburg <rosnbrg@us.ibm.com> for pointing out the
      original bug and suggesting several ways to improve this patch.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      0d89fe2c
  2. 26 1月, 2008 2 次提交
  3. 24 10月, 2007 1 次提交
  4. 23 10月, 2007 1 次提交
  5. 16 10月, 2007 1 次提交
    • R
      IB/mthca: Avoid alignment traps when writing doorbells · ab8403c4
      Roland Dreier 提交于
      Architectures such as ia64 see alignment traps when doing a 64-bit 
      read from __be32 doorbell[2] arrays to do doorbell writes in 
      mthca_write64().  Fix this by just passing the two halves of the 
      doorbell value into mthca_write64().  This actually improves the 
      generated code by allowing the compiler to see what's going on better.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      ab8403c4
  6. 11 10月, 2007 1 次提交
  7. 10 10月, 2007 4 次提交
  8. 21 7月, 2007 1 次提交
  9. 19 7月, 2007 4 次提交
    • R
      IB/mthca: Simplify use of size0 in work request posting · 43509d1f
      Roland Dreier 提交于
          
      Current code sets size0 to 0 at the start of work request posting
      functions and then handles size0 == 0 specially within the loop over
      work requests.  Change this so size0 is set along with f0 the first
      time through the loop (when nreq == 0).  This makes the code easier to
      understand by making it clearer that f0 and size0 are always
      initialized if nreq != 0 without having to know that size0 == 0
      implies nreq == 0.
      
      Also annotate size0 with uninitialized_var() so that this doesn't
      introduce a new compiler warning.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      43509d1f
    • R
      IB/mthca: Factor out setting WQE UD segment entries · e535c699
      Roland Dreier 提交于
          
      Factor code to set UD entries out of the work request posting
      functions into inline functions set_tavor_ud_seg() and
      set_arbel_ud_seg().  This doesn't change the generated code in any
      significant way, and makes the source easier on the eyes.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      e535c699
    • R
      IB/mthca: Factor out setting WQE remote address and atomic segment entries · 400ddc11
      Roland Dreier 提交于
          
      Factor code to set remote address and atomic segment entries out of the
      work request posting functions into inline functions set_raddr_seg()
      and set_atomic_seg().  This doesn't change the generated code in any
      significant way, and makes the source easier on the eyes.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      400ddc11
    • R
      IB/mthca: Factor out setting WQE data segment entries · 80885456
      Roland Dreier 提交于
      Factor code to set data segment entries out of the work request
      posting functions into inline functions mthca_set_data_seg() and
      mthca_set_data_seg_inval().  This makes the code more readable and
      also allows the compiler to do a better job -- on x86_64:
      
      add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-69 (-69)
      function                                     old     new   delta
      mthca_arbel_post_srq_recv                    373     369      -4
      mthca_arbel_post_receive                     570     562      -8
      mthca_tavor_post_srq_recv                    520     508     -12
      mthca_tavor_post_send                       1344    1330     -14
      mthca_arbel_post_send                       1481    1467     -14
      mthca_tavor_post_receive                     792     775     -17
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      80885456
  10. 18 7月, 2007 4 次提交
    • R
      IB/mthca: Use uninitialized_var() for f0 · 6d7d080e
      Roland Dreier 提交于
      Commit 9db48926 ("drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd
      var warning") added "= 0" to the declarations of f0 to shut up gcc
      warnings.  However, there's no point in making the code bigger by
      initializing f0 to a random value just to get rid of a warning;
      setting f0 to 0 is no safer than just using uninitialized_var(), which
      documents the situation better and gives smaller code too.  For example, 
      on x86_64:
      
      add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16 (-16)
      function                                     old     new   delta
      mthca_tavor_post_send                       1352    1344      -8
      mthca_arbel_post_send                       1489    1481      -8
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      6d7d080e
    • R
      IB/mthca: Fix printk format used for firmware version in warning · e4daf738
      Roland Dreier 提交于
      When warning about out-of-date firmware, current mthca code messes up
      the formatting of the version if the subminor doesn't have three
      digits.  It doesn't fill the field with 0s so we end up with:
      
          ib_mthca 0000:0b:00.0: HCA FW version 1.1.  0 is old (1.2.  0 is current).
      
      Change the format from "%3d" to "%03d" to get the right thing printed.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      e4daf738
    • R
      IB/mthca: Schedule MSI support for removal · f6be6fbe
      Roland Dreier 提交于
      The mthca driver supports both MSI and MSI-X.  However, MSI-X works with
      all hardware that the driver handles, and provides a superset of what
      MSI does, so there's no point in having code for both.  Schedule MSI
      support for removal in 2008 to give anyone who actually needs MSI and
      who can't use MSI time to speak up.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      f6be6fbe
    • J
      drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd var warning · 9db48926
      Jeff Garzik 提交于
      drivers/infiniband/hw/mthca/mthca_qp.c: In function
        ‘mthca_tavor_post_send’:
      drivers/infiniband/hw/mthca/mthca_qp.c:1594: warning: ‘f0’ may be used
        uninitialized in this function
      drivers/infiniband/hw/mthca/mthca_qp.c: In function
        ‘mthca_arbel_post_send’:
      drivers/infiniband/hw/mthca/mthca_qp.c:1949: warning: ‘f0’ may be used
        uninitialized in this function
      
      Initializing 'f0' is not strictly necessary in either case, AFAICS.
      
      I was considering use of uninitialized_var(), but looking at the
      complex flow of control in each function, I feel it is wiser and
      safer to simply zero the var and be certain of ourselves.
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9db48926
  11. 11 7月, 2007 1 次提交
  12. 10 7月, 2007 1 次提交
  13. 08 6月, 2007 1 次提交
  14. 30 5月, 2007 1 次提交
  15. 22 5月, 2007 1 次提交
    • A
      Detach sched.h from mm.h · e8edc6e0
      Alexey Dobriyan 提交于
      First thing mm.h does is including sched.h solely for can_do_mlock() inline
      function which has "current" dereference inside. By dealing with can_do_mlock()
      mm.h can be detached from sched.h which is good. See below, why.
      
      This patch
      a) removes unconditional inclusion of sched.h from mm.h
      b) makes can_do_mlock() normal function in mm/mlock.c
      c) exports can_do_mlock() to not break compilation
      d) adds sched.h inclusions back to files that were getting it indirectly.
      e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
         getting them indirectly
      
      Net result is:
      a) mm.h users would get less code to open, read, preprocess, parse, ... if
         they don't need sched.h
      b) sched.h stops being dependency for significant number of files:
         on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
         after patch it's only 3744 (-8.3%).
      
      Cross-compile tested on
      
      	all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
      	alpha alpha-up
      	arm
      	i386 i386-up i386-defconfig i386-allnoconfig
      	ia64 ia64-up
      	m68k
      	mips
      	parisc parisc-up
      	powerpc powerpc-up
      	s390 s390-up
      	sparc sparc-up
      	sparc64 sparc64-up
      	um-x86_64
      	x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e8edc6e0
  16. 19 5月, 2007 3 次提交
  17. 15 5月, 2007 2 次提交
  18. 09 5月, 2007 1 次提交
    • R
      IB/uverbs: Export ib_umem_get()/ib_umem_release() to modules · f7c6a7b5
      Roland Dreier 提交于
      Export ib_umem_get()/ib_umem_release() and put low-level drivers in
      control of when to call ib_umem_get() to pin and DMA map userspace,
      rather than always calling it in ib_uverbs_reg_mr() before calling the
      low-level driver's reg_user_mr method.
      
      Also move these functions to be in the ib_core module instead of
      ib_uverbs, so that driver modules using them do not depend on
      ib_uverbs.
      
      This has a number of advantages:
       - It is better design from the standpoint of making generic code a
         library that can be used or overridden by device-specific code as
         the details of specific devices dictate.
       - Drivers that do not need to pin userspace memory regions do not
         need to take the performance hit of calling ib_mem_get().  For
         example, although I have not tried to implement it in this patch,
         the ipath driver should be able to avoid pinning memory and just
         use copy_{to,from}_user() to access userspace memory regions.
       - Buffers that need special mapping treatment can be identified by
         the low-level driver.  For example, it may be possible to solve
         some Altix-specific memory ordering issues with mthca CQs in
         userspace by mapping CQ buffers with extra flags.
       - Drivers that need to pin and DMA map userspace memory for things
         other than memory regions can use ib_umem_get() directly, instead
         of hacks using extra parameters to their reg_phys_mr method.  For
         example, the mlx4 driver that is pending being merged needs to pin
         and DMA map QP and CQ buffers, but it does not need to create a
         memory key for these buffers.  So the cleanest solution is for mlx4
         to call ib_umem_get() in the create_qp and create_cq methods.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      f7c6a7b5
  19. 07 5月, 2007 2 次提交
    • R
      IB: Return "maybe missed event" hint from ib_req_notify_cq() · ed23a727
      Roland Dreier 提交于
      The semantics defined by the InfiniBand specification say that
      completion events are only generated when a completions is added to a
      completion queue (CQ) after completion notification is requested.  In
      other words, this means that the following race is possible:
      
      	while (CQ is not empty)
      		ib_poll_cq(CQ);
      	// new completion is added after while loop is exited
      	ib_req_notify_cq(CQ);
      	// no event is generated for the existing completion
      
      To close this race, the IB spec recommends doing another poll of the
      CQ after requesting notification.
      
      However, it is not always possible to arrange code this way (for
      example, we have found that NAPI for IPoIB cannot poll after
      requesting notification).  Also, some hardware (eg Mellanox HCAs)
      actually will generate an event for completions added before the call
      to ib_req_notify_cq() -- which is allowed by the spec, since there's
      no way for any upper-layer consumer to know exactly when a completion
      was really added -- so the extra poll of the CQ is just a waste.
      
      Motivated by this, we add a new flag "IB_CQ_REPORT_MISSED_EVENTS" for
      ib_req_notify_cq() so that it can return a hint about whether the a
      completion may have been added before the request for notification.
      The return value of ib_req_notify_cq() is extended so:
      
      	 < 0	means an error occurred while requesting notification
      	== 0	means notification was requested successfully, and if
      		IB_CQ_REPORT_MISSED_EVENTS was passed in, then no
      		events were missed and it is safe to wait for another
      		event.
      	 > 0	is only returned if IB_CQ_REPORT_MISSED_EVENTS was
      		passed in.  It means that the consumer must poll the
      		CQ again to make sure it is empty to avoid the race
      		described above.
      
      We add a flag to enable this behavior rather than turning it on
      unconditionally, because checking for missed events may incur
      significant overhead for some low-level drivers, and consumers that
      don't care about the results of this test shouldn't be forced to pay
      for the test.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      ed23a727
    • M
      IB: Add CQ comp_vector support · f4fd0b22
      Michael S. Tsirkin 提交于
      Add a num_comp_vectors member to struct ib_device and extend
      ib_create_cq() to pass in a comp_vector parameter -- this parallels
      the userspace libibverbs API.  Update all hardware drivers to set
      num_comp_vectors to 1 and have all ULPs pass 0 for the comp_vector
      value.  Pass the value of num_comp_vectors to userspace rather than
      hard-coding a value of 1.
      
      We want multiple CQ event vector support (via MSI-X or similar for
      adapters that can generate multiple interrupts), but it's not clear
      how many vectors we want, or how we want to deal with policy issues
      such as how to decide which vector to use or how to set up interrupt
      affinity.  This patch is useful for experimenting, since no core
      changes will be necessary when updating a driver to support multiple
      vectors, and we know that we want to make at least these changes
      anyway.
      Signed-off-by: NMichael S. Tsirkin <mst@dev.mellanox.co.il>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      f4fd0b22
  20. 03 5月, 2007 1 次提交
    • J
      PCI: Cleanup the includes of <linux/pci.h> · 6473d160
      Jean Delvare 提交于
      I noticed that many source files include <linux/pci.h> while they do
      not appear to need it. Here is an attempt to clean it all up.
      
      In order to find all possibly affected files, I searched for all
      files including <linux/pci.h> but without any other occurence of "pci"
      or "PCI". I removed the include statement from all of these, then I
      compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
      false positives manually.
      
      My tests covered 66% of the affected files, so there could be false
      positives remaining. Untested files are:
      
      arch/alpha/kernel/err_common.c
      arch/alpha/kernel/err_ev6.c
      arch/alpha/kernel/err_ev7.c
      arch/ia64/sn/kernel/huberror.c
      arch/ia64/sn/kernel/xpnet.c
      arch/m68knommu/kernel/dma.c
      arch/mips/lib/iomap.c
      arch/powerpc/platforms/pseries/ras.c
      arch/ppc/8260_io/enet.c
      arch/ppc/8260_io/fcc_enet.c
      arch/ppc/8xx_io/enet.c
      arch/ppc/syslib/ppc4xx_sgdma.c
      arch/sh64/mach-cayman/iomap.c
      arch/xtensa/kernel/xtensa_ksyms.c
      arch/xtensa/platform-iss/setup.c
      drivers/i2c/busses/i2c-at91.c
      drivers/i2c/busses/i2c-mpc.c
      drivers/media/video/saa711x.c
      drivers/misc/hdpuftrs/hdpu_cpustate.c
      drivers/misc/hdpuftrs/hdpu_nexus.c
      drivers/net/au1000_eth.c
      drivers/net/fec_8xx/fec_main.c
      drivers/net/fec_8xx/fec_mii.c
      drivers/net/fs_enet/fs_enet-main.c
      drivers/net/fs_enet/mac-fcc.c
      drivers/net/fs_enet/mac-fec.c
      drivers/net/fs_enet/mac-scc.c
      drivers/net/fs_enet/mii-bitbang.c
      drivers/net/fs_enet/mii-fec.c
      drivers/net/ibm_emac/ibm_emac_core.c
      drivers/net/lasi_82596.c
      drivers/parisc/hppb.c
      drivers/sbus/sbus.c
      drivers/video/g364fb.c
      drivers/video/platinumfb.c
      drivers/video/stifb.c
      drivers/video/valkyriefb.c
      include/asm-arm/arch-ixp4xx/dma.h
      sound/oss/au1550_ac97.c
      
      I would welcome test reports for these files. I am fine with removing
      the untested files from the patch if the general opinion is that these
      changes aren't safe. The tested part would still be nice to have.
      
      Note that this patch depends on another header fixup patch I submitted
      to LKML yesterday:
        [PATCH] scatterlist.h needs types.h
        http://lkml.org/lkml/2007/3/01/141Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Cc: Badari Pulavarty <pbadari@us.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6473d160
  21. 01 5月, 2007 1 次提交
  22. 25 4月, 2007 3 次提交
    • J
      IB: Set class_dev->dev in core for nice device symlink · 1912ffbb
      Joachim Fenkes 提交于
      All RDMA drivers except ehca set class_dev->dev to their dma_device
      value (ehca leaves this unset).  dma_device is the only value that
      makes any sense, so move this assignment to core/sysfs.c.  This reduce
      the duplicated code in the rest of the drivers and gives ehca a nice
      /sys/class/infiniband/ehcaX/device symlink.
      Signed-off-by: NJoachim Fenkes <fenkes@de.ibm.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      1912ffbb
    • R
      IB/mthca: Simplify CQ cleaning in mthca_free_qp() · 30c00986
      Roland Dreier 提交于
      mthca_free_qp() already has local variables to hold the QP's send_cq
      and recv_cq, so we can slightly clean up the calls to mthca_cq_clean()
      by using those local variables instead of expressions like
      to_mcq(qp->ibqp.send_cq).
      
      Also, by cleaning the recv_cq first, we can avoid worrying about
      whether the QP is attached to an SRQ for the second call, because we
      would only clean send_cq if send_cq is not equal to recv_cq, and that
      means send_cq cannot have any receive completions from the QP being
      destroyed.
      
      All this work even improves the generated code a bit:
      
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5)
      function                                     old     new   delta
      mthca_free_qp                                510     505      -5
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      30c00986
    • R
      IB/mthca: Fix mthca_write_mtt() on HCAs with hidden memory · 532c3b58
      Roland Dreier 提交于
      Commit b2875d4c ("IB/mthca: Always fill MTTs from CPU") causes a crash
      in mthca_write_mtt() with non-memfree HCAs that have their memory
      hidden (that is, have only two PCI BARs instead of having a third BAR
      that allows access to the RAM attached to the HCA) on 64-bit
      architectures.  This is because the commit just before, c20e20ab
      ("IB/mthca: Merge MR and FMR space on 64-bit systems") makes
      dev->mr_table.fmr_mtt_buddy equal to &dev->mr_table.mtt_buddy and
      hence mthca_write_mtt() tries to write directly into the HCA's MTT
      table.  However, since that table is in the HCA's memory, this is
      impossible without the PCI BAR that gives access to that memory.
      
      This causes a crash because mthca_tavor_write_mtt_seg() basically
      tries to dereference some offset of a NULL pointer.  Fix this by
      adding a test of MTHCA_FLAG_FMR in mthca_write_mtt() so that we always
      use the WRITE_MTT firmware command rather than writing directly if
      FMRs are not enabled.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      532c3b58
  23. 19 4月, 2007 1 次提交