1. Jan 04, 2023
    • Niklas Cassel's avatar
      ata: libata: respect successfully completed commands during errors · 7affcded
      Niklas Cassel authored
      
      
      In AHCI specification 1.3.1:
      "5.5.3 Processing Completed Commands"
      
      "For each port that has an interrupt pending:
      
      1. Software determines the cause of the interrupt by reading the PxIS
         register. It is possible for multiple bits to be set.
      2. Software clears appropriate bits in the PxIS register corresponding
         to the cause of the interrupt.
      3. Software clears the interrupt bit in IS.IPS corresponding to the port.
      4. If executing non-queued commands, software reads the PxCI register,
         and compares the current value to the list of commands previously
         issued by software that are still outstanding. If executing native
         queued commands, software reads the PxSACT register and compares the
         current value to the list of commands previously issued by software.
         Software completes with success any outstanding command whose
         corresponding bit has been cleared in the respective register. PxCI
         and PxSACT are volatile registers; software should only use their
         values to determine commands that have completed, not to determine
         which commands have previously been issued.
      5. If there were errors, noted in the PxIS register, software performs
         error recovery actions (see section 6.2.2)."
      
      The documentation for the PxSACT shadow register in AHCI:
      "The device clears bits in this field by sending a Set Device Bits FIS
      to the host. The HBA clears bits in this field that are set to ‘1’ in
      the SActive field of the Set Device Bits FIS. The HBA only clears bits
      that correspond to native queued commands that have completed
      successfully."
      
      Additionally, in SATA specification 3.5a:
      "11.15 FPDMA QUEUED command protocol"
      
      "DFPDMAQ11: ERROR
      Halt command processing and transmit Set Device Bits FIS to host
      with the ERR bit in Status field set to one, Interrupt bit set to one,
      ATA error code set to one in the ERROR field, bits in ACT field cleared
      to zero for any outstanding queued commands, and bits set to one
      for any successfully completed queued commands that completion
      notification not yet delivered."
      
      I.e. even when the HBA triggers an error interrupt, the HBA will still
      clear successfully completed commands in PxSACT. Commands that did not
      complete successfully will still have its bit set in PxSACT.
      (Which means the command that caused the NCQ error and queued commands
      that had not yet finished at the time when the NCQ error occurred.)
      
      Additionally, for a HBA that does not have the libata flag
      AHCI_HFLAG_MULTI_MSI set, all ap->locks will point to host->lock, which
      means that IRQs will be disabled for one port while another port's IRQ
      handler is running. The HBA will still receive FISes from the device,
      even if IRQs on the HBA itself are disabled. What can thus e.g. receive
      a FIS that completes several commands successfully, followed by a FIS
      that does (or does not) complete additional commands with the error bit
      set, to indicate that at least one command was aborted.
      
      Therefore, modify ahci_handle_port_interrupt() using the new helper
      ahci_qc_complete() to complete the commands that have already been
      signaled as successfully through a regular completion SDB FIS, as not
      doing so would simply cause successfully completed commands to be
      retried for no good reason.
      
      Co-developed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      7affcded
    • Niklas Cassel's avatar
      ata: libata: read the shared status for successful NCQ commands once · 93c4aa44
      Niklas Cassel authored
      
      
      Currently, the status is being read for each QC, inside
      ata_qc_complete(), which means that QCs being completed by
      ata_qc_complete_multiple() (i.e. multiple QCs completed during a single
      interrupt), can have different status and error bits set. This is
      because the FIS Receive Area will get updated as soon as the HBA
      receives a new FIS from the device in the NCQ case.
      
      Here is an example of the problem:
      ata14.00: ata_qc_complete_multiple: done_mask: 0x180000
      qc tag: 19 cmd: 0x61 flags: 0x11b err_mask: 0x0 tf->status: 0x40
      qc tag: 20 cmd: 0x61 flags: 0x11b err_mask: 0x0 tf->status: 0x43
      
      A print in ata_qc_complete_multiple(), shows that done_mask is: 0x180000
      which means that tag 19 and 20 were completed. Another print in
      ata_qc_complete(), after the call to fill_result_tf(), shows that tag 19
      and 20 have different status values, even though they were completed in
      the same ata_qc_complete_multiple() call.
      
      If PMP is not enabled, simply read the status and error once, before
      calling ata_qc_complete() for each QC. Without PMP, we know that all QCs
      must share the same status and error values.
      
      If PMP is enabled, we also read the status before calling
      ata_qc_complete(), however, we still read the status for each QC, since
      the QCs can belong to different PMP links (which means that the QCs
      does not necessarily share the same status and error values).
      
      Do all this by introducing the new port operation .qc_ncq_fill_rtf. If
      set, this operation is called in ata_qc_complete_multiple() to set the
      result tf for all completed QCs signaled by the last SDB FIS received.
      
      QCs that have their result tf filled are marked with the new flag
      ATA_QCFLAG_RTF_FILLED so that any later execution of the qc_fill_rtf
      port operation does nothing (e.g. when called from ata_qc_complete()).
      
      Co-developed-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      93c4aa44
    • Damien Le Moal's avatar
      ata: libata: simplify qc_fill_rtf port operation interface · 931139af
      Damien Le Moal authored
      
      
      The boolean return value of the qc_fill_rtf operation is used nowhere.
      Simplify this operation interface by making it a void function. All
      drivers defining this operation are also updated.
      
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      931139af
    • Niklas Cassel's avatar
      ata: scsi: rename flag ATA_QCFLAG_FAILED to ATA_QCFLAG_EH · 87629312
      Niklas Cassel authored
      
      
      The name ATA_QCFLAG_FAILED is misleading since it does not mean that a
      QC completed in error, or that it didn't complete at all. It means that
      libata decided to schedule EH for the QC, so the QC is now owned by the
      libata error handler (EH).
      
      The normal execution path is responsible for not accessing a QC owned
      by EH. libata core enforces the rule by returning NULL from
      ata_qc_from_tag() for QCs owned by EH.
      
      It is quite easy to mistake that a QC marked with ATA_QCFLAG_FAILED was
      an error. However, a QC that was actually an error is instead indicated
      by having qc->err_mask set. E.g. when we have a NCQ error, we abort all
      QCs, which currently will mark all QCs as ATA_QCFLAG_FAILED. However, it
      will only be a single QC that is an error (i.e. has qc->err_mask set).
      
      Rename ATA_QCFLAG_FAILED to ATA_QCFLAG_EH to more clearly highlight that
      this flag simply means that a QC is now owned by EH. This new name will
      not mislead to think that the QC was an error (which is instead
      indicated by having qc->err_mask set).
      
      This also makes it more obvious that the EH code skips all QCs that do
      not have ATA_QCFLAG_EH set (rather than ATA_QCFLAG_FAILED), since the EH
      code should simply only care about QCs that are owned by EH itself.
      
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      87629312
    • Wenchao Hao's avatar
      ata: libata-eh: Cleanup ata_scsi_cmd_error_handler() · b83ad9ee
      Wenchao Hao authored
      
      
      If ap->ops->error_handler is NULL just return. This patch also
      fixes some comment style issue.
      
      Signed-off-by: default avatarWenchao Hao <haowenchao@huawei.com>
      Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      b83ad9ee
  2. Jan 03, 2023
  3. Jan 02, 2023
  4. Jan 01, 2023
  5. Dec 31, 2022
    • Linus Torvalds's avatar
      Merge tag 'acpi-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · c8451c14
      Linus Torvalds authored
      Pull ACPI fixes from Rafael Wysocki:
       "These are new ACPI IRQ override quirks, low-power S0 idle (S0ix)
        support adjustments and ACPI backlight handling fixes, mostly for
        platforms using AMD chips.
      
        Specifics:
      
         - Add ACPI IRQ override quirks for Asus ExpertBook B2502, Lenovo
           14ALC7, and XMG Core 15 (Hans de Goede, Adrian Freund, Erik
           Schumacher).
      
         - Adjust ACPI video detection fallback path to prevent
           non-operational ACPI backlight devices from being created on
           systems where the native driver does not detect a suitable panel
           (Mario Limonciello).
      
         - Fix Apple GMUX backlight detection (Hans de Goede).
      
         - Add a low-power S0 idle (S0ix) handling quirk for HP Elitebook 865
           and stop using AMD-specific low-power S0 idle code path for systems
           with Rembrandt chips and newer (Mario Limonciello)"
      
      * tag 'acpi-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: x86: s2idle: Stop using AMD specific codepath for Rembrandt+
        ACPI: x86: s2idle: Force AMD GUID/_REV 2 on HP Elitebook 865
        ACPI: video: Fix Apple GMUX backlight detection
        ACPI: resource: Add Asus ExpertBook B2502 to Asus quirks
        ACPI: resource: do IRQ override on Lenovo 14ALC7
        ACPI: resource: do IRQ override on XMG Core 15
        ACPI: video: Don't enable fallback path for creating ACPI backlight by default
        drm/amd/display: Report to ACPI video if no panels were found
        ACPI: video: Allow GPU drivers to report no panels
      c8451c14
    • Linus Torvalds's avatar
      Merge tag 'sound-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 262eef26
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Just a few small fixes:
      
         - A regression fix for HDMI audio on HD-audio AMD codecs
      
         - Fixes for LINE6 MIDI handling
      
         - HD-audio quirk for Dell laptops"
      
      * tag 'sound-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda/hdmi: Static PCM mapping again with AMD HDMI codecs
        ALSA: hda/realtek: Apply dual codec fixup for Dell Latitude laptops
        ALSA: line6: fix stack overflow in line6_midi_transmit
        ALSA: line6: correct midi status byte when receiving data from podxt
      262eef26
  6. Dec 30, 2022
  7. Dec 29, 2022