1. 07 Sep, 2024 8 commits
    • Damien Le Moal's avatar
      ata: libata: Introduce ata_dev_free_resources · 5f8319c4
      Damien Le Moal authored
      Introduce the function ata_dev_free_resources() to free the resources
      allocated to support a device features. For now, this function is
      reduced to calling zpodd_exit() for devices that have this feature
      enabled.
      
      ata_dev_free_resources() is called from ata_eh_dev_disable() as this
      function is always called for all devices attached to a port that is
      being detached and for devices that are being disabled due to being
      removed (detached) from the system or due to errors.
      
      With this change, the call to zpodd_exit() done in ata_port_detach()
      and ata_scsi_handle_link_detach() are removed as these functions
      remove all devices attached to the link or port using libata EH, thus
      resulting in ata_eh_dev_disable() being called and the zpodd_exit()
      function being executed.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      5f8319c4
    • Damien Le Moal's avatar
      ata: libata: Move sector_buf from struct ata_port to struct ata_device · da65bbdd
      Damien Le Moal authored
      The 512B buffer sector_buf field of struct ata_port is used for scanning
      devices as well as during error recovery with ata EH. This buffer is
      thus useless if a port does not have a device connected to it.
      And also given that commands using this buffer are issued to devices,
      and not to ports, move this buffer definition from struct ata_port to
      struct ata_device.
      
      This change slightly increases system memory usage for systems using a
      port-multiplier as in that case we do not need a per-device buffer for
      scanning devices (PMP does not allow parallel scanning) nor for EH (as
      when entering EH we are guaranteed that all commands to all devices
      connected to the PMP have completed or have been aborted). However,
      this change reduces memory usage on systems that have many ports with
      only few devices rives connected, which is a much more common use case
      than the PMP use case.
      Suggested-by: default avatarNiklas Cassel <cassel@kernel.org>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      da65bbdd
    • Damien Le Moal's avatar
      ata: libata: Rename ata_eh_read_sense_success_ncq_log() · 10e80763
      Damien Le Moal authored
      The function ata_eh_read_sense_success_ncq_log() does more that just
      reading the sense data for successful NCQ commands log page as it also
      sets the sense data for all commands listed in the log page.
      
      Rename this function to ata_eh_get_ncq_success_sense() to better
      describe what the function does. Furthermore, since this function is
      only called from ata_eh_get_success_sense() in libata-eh.c, there is no
      need to export it and its declaration can be moved to
      drivers/ata/libata.h.
      
      To be consistent with this change, the function
      ata_eh_read_sense_success_non_ncq() is also renamed to
      ata_eh_get_non_ncq_success_sense().
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      10e80763
    • Damien Le Moal's avatar
      ata: libata: Move sata_std_hardreset() definition to libata-sata.c · 78f76b09
      Damien Le Moal authored
      Unlike ata_std_prereset() and ata_std_postreset(), the function
      sata_std_hardreset() applies only to SATA devices, as its name implies.
      So move its definition to libata-sata.c.
      
      Together with this, also move the definition of sata_port_ops to
      libata-sata.c, where it belongs.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      78f76b09
    • Damien Le Moal's avatar
      ata: libata: Move sata_down_spd_limit() to libata-sata.c · b642212d
      Damien Le Moal authored
      Move the definition of the function sata_down_spd_limit() to
      libata-sata.c where it belongs, together with sata_set_spd().
      The helper function ata_sstatus_online() is also changed to be an
      inline function defined in drivers/ata/libata.h.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      b642212d
    • Damien Le Moal's avatar
      ata: libata: Improve __ata_qc_complete() · 5bb52d92
      Damien Le Moal authored
      The function __ata_qc_complete() is always called with a qc that already
      has been dereferenced and so is guaranteed to be non-NULL (as otherwise
      the kernel would have crashed). So remove the warning for a NULL qc as
      it is useless.
      
      Furthermore, the qc passed to __ata_qc_complete() must always be marked
      as active with the ATA_QCFLAG_ACTIVE flag. If that is not the case, in
      addition to the existing warning, return early so that we do not attempt
      to complete an invalid qc.
      
      Finally, fix the comment related to clearing the qc active flag as that
      operation applies to all devices, not just ATAPI ones.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      5bb52d92
    • Damien Le Moal's avatar
      ata: libata-scsi: Improve ata_scsi_handle_link_detach() · a1695151
      Damien Le Moal authored
      A struct ata_device flags should always be set and cleared with the
      device port locked. Testing for a flag should thus also be done while
      holding the device port lock. In accordance to this principle, modify
      ata_scsi_handle_link_detach() to test and clear the ATA_DFLAG_DETACHED
      flag while holding the device port lock.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      a1695151
    • Damien Le Moal's avatar
      ata: libata: Cleanup libata-transport · c494708d
      Damien Le Moal authored
      Move the ATA link transport device related functions after the ATA
      transport device related functions to avoid the need for forward
      declaring ata_tdev_add() and ata_tdev_delete().
      
      And while at it, do the following:
      1) Change ata_is_ata_dev() and ata_is_link() to return a boolean
      2) Fix a pointer declaration style in ata_is_ata_dev()
      3) Improve the kdoc comments for ata_tdev_free(), ata_tdev_delete(),
         ata_tdev_add(), ata_tlink_delete() and ata_tlink_add()
      
      No functional changes are introduced by this cleanup.
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      c494708d
  2. 01 Sep, 2024 3 commits
  3. 29 Aug, 2024 1 commit
    • Niklas Cassel's avatar
      ata: libata: Add helper ata_eh_decide_disposition() · 9526dec2
      Niklas Cassel authored
      Every time I see libata code calling scsi_check_sense(), I get confused
      why the code path that is working fine for SCSI code, is not sufficient
      for libata code.
      
      The reason is that SCSI usually gets the sense data as part of the
      completion, and will thus automatically call scsi_check_sense(), which
      will set the SCSI ML byte (if any).
      
      However, for libata queued commands, we always need to fetch the sense
      data via SCSI EH, and thus do not get the luxury of having
      scsi_check_sense() called automatically.
      
      Add a new helper, ata_eh_decide_disposition(), that has a ata_eh_ prefix
      to more clearly highlight that this is only needed for code called by EH,
      while also having a similar name to scsi_decide_disposition(), such that
      it is easier to compare the libata code with the equivalent SCSI code.
      
      Also add a big kdoc comment explaining why this helper is called/needed in
      the first place.
      Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      9526dec2
  4. 28 Aug, 2024 1 commit
  5. 26 Aug, 2024 1 commit
  6. 15 Aug, 2024 2 commits
  7. 12 Aug, 2024 5 commits
  8. 02 Aug, 2024 2 commits
  9. 29 Jul, 2024 13 commits
  10. 28 Jul, 2024 4 commits
    • Linus Torvalds's avatar
      Linux 6.11-rc1 · 8400291e
      Linus Torvalds authored
      8400291e
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v6.11' of... · a0c04bd5
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Fix RPM package build error caused by an incorrect locale setup
      
       - Mark modules.weakdep as ghost in RPM package
      
       - Fix the odd combination of -S and -c in stack protector scripts,
         which is an error with the latest Clang
      
      * tag 'kbuild-fixes-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: Fix '-S -c' in x86 stack protector scripts
        kbuild: rpm-pkg: ghost modules.weakdep file
        kbuild: rpm-pkg: Fix C locale setup
      a0c04bd5
    • Linus Torvalds's avatar
      minmax: simplify and clarify min_t()/max_t() implementation · 017fa3e8
      Linus Torvalds authored
      This simplifies the min_t() and max_t() macros by no longer making them
      work in the context of a C constant expression.
      
      That means that you can no longer use them for static initializers or
      for array sizes in type definitions, but there were only a couple of
      such uses, and all of them were converted (famous last words) to use
      MIN_T/MAX_T instead.
      
      Cc: David Laight <David.Laight@aculab.com>
      Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      017fa3e8
    • Linus Torvalds's avatar
      minmax: add a few more MIN_T/MAX_T users · 4477b39c
      Linus Torvalds authored
      Commit 3a7e02c0 ("minmax: avoid overly complicated constant
      expressions in VM code") added the simpler MIN_T/MAX_T macros in order
      to avoid some excessive expansion from the rather complicated regular
      min/max macros.
      
      The complexity of those macros stems from two issues:
      
       (a) trying to use them in situations that require a C constant
           expression (in static initializers and for array sizes)
      
       (b) the type sanity checking
      
      and MIN_T/MAX_T avoids both of these issues.
      
      Now, in the whole (long) discussion about all this, it was pointed out
      that the whole type sanity checking is entirely unnecessary for
      min_t/max_t which get a fixed type that the comparison is done in.
      
      But that still leaves min_t/max_t unnecessarily complicated due to
      worries about the C constant expression case.
      
      However, it turns out that there really aren't very many cases that use
      min_t/max_t for this, and we can just force-convert those.
      
      This does exactly that.
      
      Which in turn will then allow for much simpler implementations of
      min_t()/max_t().  All the usual "macros in all upper case will evaluate
      the arguments multiple times" rules apply.
      
      We should do all the same things for the regular min/max() vs MIN/MAX()
      cases, but that has the added complexity of various drivers defining
      their own local versions of MIN/MAX, so that needs another level of
      fixes first.
      
      Link: https://lore.kernel.org/all/b47fad1d0cf8449886ad148f8c013dae@AcuMS.aculab.com/
      Cc: David Laight <David.Laight@aculab.com>
      Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4477b39c