1. 05 6月, 2009 4 次提交
    • S
      firewire: rename source files · e71d31da
      Stefan Richter 提交于
      The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
       "drivers/firewire/fw-*.c"
      are renamed to
       "drivers/firewire/core-*.c",
       "drivers/firewire/ohci.c",
       "drivers/firewire/sbp2.c".
      
      The old fw- prefix was redundant to the directory name.  The new core-
      prefix distinguishes the files according to which driver they belong to.
      
      This change comes a little late, but still before further firewire
      drivers are added as anticipated RSN.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e71d31da
    • S
      firewire: reorganize header files · 77c9a5da
      Stefan Richter 提交于
      The three header files of firewire-core, i.e.
       "drivers/firewire/fw-device.h",
       "drivers/firewire/fw-topology.h",
       "drivers/firewire/fw-transaction.h",
      are replaced by
       "drivers/firewire/core.h",
       "include/linux/firewire.h".
      
      The latter includes everything which a firewire high-level driver (like
      firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
      contains the rest which is needed by firewire-core itself and by low-
      level drivers (card drivers) like firewire-ohci.
      
      High-level drivers can now also reside outside of drivers/firewire
      without having to add drivers/firewire to the header file search path in
      makefiles.  At least the firedtv driver will be such a driver.
      
      I also considered to spread the contents of core.h over several files,
      one for each .c file where the respective implementation resides.  But
      it turned out that most core .c files will end up including most of the
      core .h files.  Also, the combined core.h isn't unreasonably big, and it
      will lose more of its contents to linux/firewire.h anyway soon when more
      firewire drivers are added.  (IP-over-1394, firedtv, and there are plans
      for one or two more.)
      
      Furthermore, fw-ohci.h is renamed to ohci.h.  The name of core.h and
      ohci.h is chosen with regard to name changes of the .c files in a
      follow-up change.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      77c9a5da
    • S
      firewire: clean up includes · e8ca9702
      Stefan Richter 提交于
      Include required headers which were only indirectly included.
      Remove unused includes and an unused constant.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e8ca9702
    • S
      firewire: share device ID table type with ieee1394 · b3b29888
      Stefan Richter 提交于
      That way, the new firedtv driver will be able to use a single ID table
      in builds against ieee1394 core and/or against firewire core.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b3b29888
  2. 25 3月, 2009 1 次提交
  3. 30 1月, 2009 1 次提交
  4. 29 1月, 2009 3 次提交
  5. 05 1月, 2009 1 次提交
  6. 26 11月, 2008 1 次提交
  7. 31 10月, 2008 1 次提交
  8. 26 10月, 2008 2 次提交
    • J
      firewire: fw-sbp2: fix races · cd1f70fd
      Jay Fenlason 提交于
      1: There is a small race between queue_delayed_work() and its
         corresponding kref_get().  Do the kref_get first, and _put it again
         if the queue_delayed_work() failed, so there is no chance of the
         kref going to zero while the work is scheduled.
      2: An SBP2_LOGOUT_REQUEST could be sent out with a login_id full of
         garbage.  Initialize it to an invalid value so we can tell if we
         ever got a valid login_id.
      3: The node ID and generation may have changed but the new values may
         not yet have been recorded in lu and tgt when the final logout is
         attempted.  Use the latest values from the device in
         sbp2_release_target().
      Signed-off-by: NJay Fenlason <fenlason@redhat.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      cd1f70fd
    • S
      firewire: fw-sbp2: delay first login to avoid retries · 0dcfeb7e
      Stefan Richter 提交于
      This optimizes firewire-sbp2's device probe for the case that the local
      node and the SBP-2 node were discovered at the same time.  In this case,
      fw-core's bus management work and fw-sbp2's login and SCSI probe work
      are scheduled in parallel (in the globally shared workqueue and in
      fw-sbp2's workqueue, respectively).  The bus reset from fw-core may then
      disturb and extremely delay the login and SCSI probe because the latter
      fails with several command timeouts and retries and has to be retried
      from scratch.
      
      We avoid this particular situation of sbp2_login() and fw_card_bm_work()
      running in parallel by delaying the first sbp2_login() a little bit.
      
      This is meant to be a short-term fix for
      https://bugzilla.redhat.com/show_bug.cgi?id=466679.  In the long run,
      the SCSI probe, i.e. fw-sbp2's call of __scsi_add_device(), should be
      parallelized with sbp2_reconnect().
      
      Problem reported and fix tested and confirmed by Alex Kanavin.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0dcfeb7e
  9. 16 10月, 2008 3 次提交
    • S
      firewire: fw-sbp2: fix another small generation access bug · 4bbc1bdd
      Stefan Richter 提交于
      queuecommand() looked at the remote and local node IDs before it read
      the bus generation.  The corresponding race with sbp2_reconnect updating
      these data was probably impossible to happen though because the current
      code blocks the SCSI layer during reconnection.  However, better safe
      than sorry, especially if someone later improves the code to not block
      the SCSI layer.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4bbc1bdd
    • S
      firewire: fw-sbp2: enforce s/g segment size limit · 09b12dd4
      Stefan Richter 提交于
      1. We don't need to round the SBP-2 segment size limit down to a
         multiple of 4 kB (0xffff -> 0xf000).  It is only necessary to
         ensure quadlet alignment (0xffff -> 0xfffc).
      
      2. Use dma_set_max_seg_size() to tell the DMA mapping infrastructure
         and the block IO layer about the restriction.  This way we can
         remove the size checks and segment splitting in the queuecommand
         path.
      
         This assumes that no other code in the firewire stack uses
         dma_map_sg() with conflicting requirements.  It furthermore assumes
         that the controller device's platform actually allows us to set the
         segment size to our liking.  Assert the latter with a BUG_ON().
      
      3. Also use blk_queue_max_segment_size() to tell the block IO layer
         about it.  It cannot know it because our scsi_add_host() does not
         point to the FireWire controller's device.
      
      Thanks to Grant Grundler and FUJITA Tomonori for advice.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      09b12dd4
    • J
      firewire: fw_send_request_sync() · 1e119fa9
      Jay Fenlason 提交于
      Share code between fw_send_request + wait_for_completion callers.
      Signed-off-by: NJay Fenlason <fenlason@redhat.com>
      
      Addendum:
      Removes an unnecessary struct and an ununsed retry loop.
      Calls it fw_run_transaction() instead of fw_send_request_sync().
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NKristian Høgsberg <krh@redhat.com>
      1e119fa9
  10. 27 7月, 2008 1 次提交
    • F
      dma-mapping: add the device argument to dma_mapping_error() · 8d8bb39b
      FUJITA Tomonori 提交于
      Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
      architecture does:
      
      This enables us to cleanly fix the Calgary IOMMU issue that some devices
      are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).
      
      I think that per-device dma_mapping_ops support would be also helpful for
      KVM people to support PCI passthrough but Andi thinks that this makes it
      difficult to support the PCI passthrough (see the above thread).  So I
      CC'ed this to KVM camp.  Comments are appreciated.
      
      A pointer to dma_mapping_ops to struct dev_archdata is added.  If the
      pointer is non NULL, DMA operations in asm/dma-mapping.h use it.  If it's
      NULL, the system-wide dma_ops pointer is used as before.
      
      If it's useful for KVM people, I plan to implement a mechanism to register
      a hook called when a new pci (or dma capable) device is created (it works
      with hot plugging).  It enables IOMMUs to set up an appropriate
      dma_mapping_ops per device.
      
      The major obstacle is that dma_mapping_error doesn't take a pointer to the
      device unlike other DMA operations.  So x86 can't have dma_mapping_ops per
      device.  Note all the POWER IOMMUs use the same dma_mapping_error function
      so this is not a problem for POWER but x86 IOMMUs use different
      dma_mapping_error functions.
      
      The first patch adds the device argument to dma_mapping_error.  The patch
      is trivial but large since it touches lots of drivers and dma-mapping.h in
      all the architecture.
      
      This patch:
      
      dma_mapping_error() doesn't take a pointer to the device unlike other DMA
      operations.  So we can't have dma_mapping_ops per device.
      
      Note that POWER already has dma_mapping_ops per device but all the POWER
      IOMMUs use the same dma_mapping_error function.  x86 IOMMUs use device
      argument.
      
      [akpm@linux-foundation.org: fix sge]
      [akpm@linux-foundation.org: fix svc_rdma]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix bnx2x]
      [akpm@linux-foundation.org: fix s2io]
      [akpm@linux-foundation.org: fix pasemi_mac]
      [akpm@linux-foundation.org: fix sdhci]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix sparc]
      [akpm@linux-foundation.org: fix ibmvscsi]
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Muli Ben-Yehuda <muli@il.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Avi Kivity <avi@qumranet.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8d8bb39b
  11. 14 7月, 2008 2 次提交
  12. 28 6月, 2008 1 次提交
  13. 02 5月, 2008 2 次提交
    • B
      [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer · 64a87b24
      Boaz Harrosh 提交于
       - struct scsi_cmnd had a 16 bytes command buffer of its own.
         This is an unnecessary duplication and copy of request's
         cmd. It is probably left overs from the time that scsi_cmnd
         could function without a request attached. So clean that up.
      
       - Once above is done, few places, apart from scsi-ml, needed
         adjustments due to changing the data type of scsi_cmnd->cmnd.
      
       - Lots of drivers still use MAX_COMMAND_SIZE. So I have left
         that #define but equate it to BLK_MAX_CDB. The way I see it
         and is reflected in the patch below is.
         MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB
                            as per the SCSI standard and is not related
                            to the implementation.
         BLK_MAX_CDB.     - The allocated space at the request level
      
       - I have audit all ISA drivers and made sure none use ->cmnd in a DMA
         Operation. Same audit was done by Andi Kleen.
      
      (*)fixed-length here means commands that their size can be determined
         by their opcode and the CDB does not carry a length specifier, (unlike
         the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
         true and the SCSI standard also defines extended commands and
         vendor specific commands that can be bigger than 16 bytes. The kernel
         will support these using the same infrastructure used for VARLEN CDB's.
         So in effect MAX_COMMAND_SIZE means the maximum size command
         scsi-ml supports without specifying a cmd_len by ULD's
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      64a87b24
    • S
      firewire: fw-sbp2: log scsi_target ID at release · f32ddadd
      Stefan Richter 提交于
      Makes the good-by message more informative.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      f32ddadd
  14. 18 4月, 2008 9 次提交
  15. 14 3月, 2008 2 次提交
    • S
      firewire: fw-sbp2: fix for SYM13FW500 bridge (Datafab disk) · 2aa9ff7f
      Stefan Richter 提交于
      Fix I/O errors due to SYM13FW500's inability to handle larger request
      sizes.  Reported by Piergiorgio Sartor <piergiorgio.sartor@nexgo.de> in
      https://bugzilla.redhat.com/show_bug.cgi?id=436879Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      2aa9ff7f
    • J
      firewire: fw-sbp2: set single-phase retry_limit · 51f9dbef
      Jarod Wilson 提交于
      Per the SBP-2 specification, all SBP-2 target devices must have a BUSY_TIMEOUT
      register. Per the 1394-1995 specification, the retry_limt portion of the
      register should be set to 0x0 initially, and set on the target by a logged in
      initiator (i.e., a Linux host w/firewire controller(s)).
      
      Well, as it turns out, lots of devices these days have actually moved on to
      starting to implement SBP-3 compliance, which says that retry_limit should
      default to 0xf instead (yes, SBP-3 stomps directly on 1394-1995, oops).
      
      Prior to this change, the firewire driver stack didn't touch retry_limit, and
      any SBP-3 compliant device worked fine, while SBP-2 compliant ones were unable
      to retransmit when the host returned an ack_busy_X, which resulted in stalled
      out I/O, eventually causing the SCSI layer to give up and offline the device.
      
      The simple fix is for us to set retry_limit to 0xf in the register for all
      devices (which actually matches what the old ieee1394 stack did).
      
      Prior to this change, a hard disk behind an SBP-2 Prolific PL-3507 bridge chip
      would routinely encounter buffer I/O errors and wind up offlined by the SCSI
      layer. With this change, I've encountered zero I/O failures moving tens of GB
      of data around.
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      51f9dbef
  16. 02 3月, 2008 2 次提交
    • S
      firewire: fix crash in automatic module unloading · 855c603d
      Stefan Richter 提交于
      "modprobe firewire-ohci; sleep .1; modprobe -r firewire-ohci" used to
      result in crashes like this:
      
          BUG: unable to handle kernel paging request at ffffffff8807b455
          IP: [<ffffffff8807b455>]
          PGD 203067 PUD 207063 PMD 7c170067 PTE 0
          Oops: 0010 [1] PREEMPT SMP
          CPU 0
          Modules linked in: i915 drm cpufreq_ondemand acpi_cpufreq freq_table applesmc input_polldev led_class coretemp hwmon eeprom snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss button thermal processor sg snd_hda_intel snd_pcm snd_timer snd snd_page_alloc sky2 i2c_i801 rtc [last unloaded: crc_itu_t]
          Pid: 9, comm: events/0 Not tainted 2.6.25-rc2 #3
          RIP: 0010:[<ffffffff8807b455>]  [<ffffffff8807b455>]
          RSP: 0018:ffff81007dcdde88  EFLAGS: 00010246
          RAX: ffff81007dc95040 RBX: ffff81007dee5390 RCX: 0000000000005e13
          RDX: 0000000000008c8b RSI: 0000000000000001 RDI: ffff81007dee5388
          RBP: ffff81007dc5eb40 R08: 0000000000000002 R09: ffffffff8022d05c
          R10: ffffffff8023b34c R11: ffffffff8041a353 R12: ffff81007dee5388
          R13: ffffffff8807b455 R14: ffffffff80593bc0 R15: 0000000000000000
          FS:  0000000000000000(0000) GS:ffffffff8055a000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
          CR2: ffffffff8807b455 CR3: 0000000000201000 CR4: 00000000000006e0
          DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
          DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
          Process events/0 (pid: 9, threadinfo ffff81007dcdc000, task ffff81007dc95040)
          Stack:  ffffffff8023b396 ffffffff88082524 0000000000000000 ffffffff8807d9ae
          ffff81007dc5eb40 ffff81007dc9dce0 ffff81007dc5eb40 ffff81007dc5eb80
          ffff81007dc9dce0 ffffffffffffffff ffffffff8023be87 0000000000000000
          Call Trace:
          [<ffffffff8023b396>] ? run_workqueue+0xdf/0x1df
          [<ffffffff8023be87>] ? worker_thread+0xd8/0xe3
          [<ffffffff8023e917>] ? autoremove_wake_function+0x0/0x2e
          [<ffffffff8023bdaf>] ? worker_thread+0x0/0xe3
          [<ffffffff8023e813>] ? kthread+0x47/0x74
          [<ffffffff804198e0>] ? trace_hardirqs_on_thunk+0x35/0x3a
          [<ffffffff8020c008>] ? child_rip+0xa/0x12
          [<ffffffff8020b6e3>] ? restore_args+0x0/0x3d
          [<ffffffff8023e68a>] ? kthreadd+0x14c/0x171
          [<ffffffff8023e68a>] ? kthreadd+0x14c/0x171
          [<ffffffff8023e7cc>] ? kthread+0x0/0x74
          [<ffffffff8020bffe>] ? child_rip+0x0/0x12
      
          Code:  Bad RIP value.
          RIP  [<ffffffff8807b455>]
          RSP <ffff81007dcdde88>
          CR2: ffffffff8807b455
          ---[ end trace c7366c6657fe5bed ]---
      
      Note that this crash happened _after_ firewire-core was unloaded.  The
      shared workqueue tried to run firewire-core's device initialization jobs
      or similar jobs.
      
      The fix makes sure that firewire-ohci and hence firewire-core is not
      unloaded before all device shutdown jobs have been completed.  This is
      determined by the count of device initializations minus device releases.
      
      Also skip useless retries in the node initialization job if the node is
      to be shut down.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: NJarod Wilson <jwilson@redhat.com>
      855c603d
    • S
      firewire: fw-sbp2: better fix for NULL pointer dereference in scsi_remove_device · f8436158
      Stefan Richter 提交于
      Patch "firewire: fw-sbp2: fix NULL pointer deref. in scsi_remove_device"
      had the unintended effect that firewire-sbp2 could not be unloaded
      anymore until all SBP-2 devices were unplugged.
      
      We now fix the NULL pointer bug by reacquiring a reference to the sdev
      instead of holding a reference to the sdev (and to the module) all the
      time.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Tested-by: NJarod Wilson <jwilson@redhat.com>
      f8436158
  17. 20 2月, 2008 3 次提交
    • S
      firewire: fw-sbp2: fix NULL pointer deref. in scsi_remove_device · 33f1c6c3
      Stefan Richter 提交于
      Fix a kernel bug when unplugging an SBP-2 device after having its
      scsi_device already removed via the "delete" sysfs attribute.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      33f1c6c3
    • S
      firewire: fw-sbp2: fix NULL pointer deref. in slave_alloc · 5513c5f6
      Stefan Richter 提交于
      Fix a kernel bug when running rescan-scsi-bus while a FireWire disk is
      connected:  http://bugzilla.kernel.org/show_bug.cgi?id=10008Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      5513c5f6
    • S
      firewire: fw-sbp2: (try to) avoid I/O errors during reconnect · 2e2705bd
      Stefan Richter 提交于
      While fw-sbp2 takes the necessary time to reconnect to a logical unit
      after bus reset, the SCSI core keeps sending new commands.  They are all
      immediately completed with host busy status, and application clients or
      filesystems will break quickly.  The SCSI device might even be taken
      offline:  http://bugzilla.kernel.org/show_bug.cgi?id=9734
      
      The only remedy seems to be to block the SCSI device until reconnect.
      Alas the SCSI core has no useful API to block only one logical unit i.e.
      the scsi_device, therefore we block the entire Scsi_Host.  This
      currently corresponds to an SBP-2 target.  In case of targets with
      multiple logical units, we need to satisfy the dependencies between
      logical units by carefully tracking the blocking state of the target and
      its units.  We block all logical units of a target as soon as one of
      them needs to be blocked, and keep them blocked until all of them are
      ready to be unblocked.
      
      Furthermore, as the history of the old sbp2 driver has shown, the
      scsi_block_requests() API is a minefield with high potential of
      deadlocks.  We therefore take extra measures to keep logical units
      unblocked during __scsi_add_device() and during shutdown.
      
      This avoids I/O errors during reconnect in many but alas not in all
      cases.  There may still be errors after a re-login had to be performed.
      Also, some bridges have been seen to cease fetching management ORBs if
      I/O went on up until a bus reset.  In these cases, all management ORBs
      time out after mgt_orb_timeout.  The old sbp2 driver is less vulnerable
      or maybe not vulnerable to this, for as yet unknown reasons.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      2e2705bd
  18. 16 2月, 2008 1 次提交
    • S
      firewire: fw-sbp2: enforce a retry of __scsi_add_device if bus generation changed · e80de370
      Stefan Richter 提交于
      fw-sbp2 is unable to reconnect while performing __scsi_add_device
      because there is only a single workqueue thread context available for
      both at the moment.  This should be fixed eventually.
      
      An actual failure of __scsi_add_device is easy to handle, but an
      incomplete execution of __scsi_add_device with an sdev returned would
      remain undetected and leave the SBP-2 target unusable.
      
      Therefore we use a workaround:  If there was a bus reset during
      __scsi_add_device (i.e. during the SCSI probe), we remove the new sdev
      immediately, log out, and attempt login and SCSI probe again.
      
      Tested-by: Jarod Wilson <jwilson@redhat.com> (earlier version)
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e80de370