1. 21 Nov, 2020 14 commits
    • Jakub Kicinski's avatar
      Merge branch 'net-ipa-add-a-driver-shutdown-callback' · c9003783
      Jakub Kicinski authored
      Alex Elder says:
      
      ====================
      net: ipa: add a driver shutdown callback
      
      The final patch in this series adds a driver shutdown callback for
      the IPA driver.  The patches leading up to that address some issues
      encountered while ensuring that callback worked as expected:
        - The first just reports a little more information when channels
          or event rings are in unexpected states
        - The second patch recognizes a condition where an as-yet-unused
          channel does not require a reset during teardown
        - The third patch explicitly ignores a certain error condition,
          because it can't be avoided, and is harmless if it occurs
        - The fourth properly handles requests to retry a channel HALT
          request
        - The fifth makes a second attempt to stop modem activity during
          shutdown if it's busy
      
      The shutdown callback is implemented by calling the existing remove
      callback function (reporting if that returns an error).
      ====================
      
      Link: https://lore.kernel.org/r/20201119224929.23819-1-elder@linaro.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c9003783
    • Alex Elder's avatar
      net: ipa: add driver shutdown callback · ae1d72f9
      Alex Elder authored
      A system shutdown can happen at essentially any time, and it's
      possible that the IPA driver is busy when a shutdown is underway.
      IPA hardware accesses IMEM and SMEM memory regions using an IOMMU,
      and at some point during shutdown, needed I/O mappings could become
      invalid.  This could be disastrous for any "in flight" IPA activity.
      
      Avoid this by defining a new driver shutdown callback that stops all
      IPA activity and cleanly shuts down the driver.  It merely calls the
      driver's existing remove callback, reporting the error if it returns
      one.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ae1d72f9
    • Alex Elder's avatar
      net: ipa: retry modem stop if busy · 7c80e838
      Alex Elder authored
      The IPA driver remove callback, ipa_remove(), calls ipa_modem_stop()
      if the setup stage of initialization is complete.  If a concurrent
      call to ipa_modem_start() or ipa_modem_stop() has begin but not
      completed, ipa_modem_stop() can return an error (-EBUSY).
      
      The next patch adds a driver shutdown callback, which will simply
      call ipa_remove().  We really want our shutdown callback to clean
      things up.  So add a single retry to the ipa_modem_stop() call in
      ipa_remove() after a short (millisecond) delay.  This offers no
      guarantee the shutdown will complete successfully, but we'll at
      least try a little harder before giving up.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7c80e838
    • Alex Elder's avatar
      net: ipa: support retries on generic GSI commands · 11361456
      Alex Elder authored
      When stopping an AP RX channel, there can be a transient period
      while the channel enters STOP_IN_PROC state before reaching the
      final STOPPED state.  In that case we make another attempt to stop
      the channel.
      
      Similarly, when stopping a modem channel (using a GSI generic
      command issued from the AP), it's possible that multiple attempts
      will be required before the channel reaches STOPPED state.
      
      Add a field to the GSI structure to record an errno representing the
      result code provided when a generic command completes.  If the
      result learned in gsi_isr_gp_int1() is RETRY, record -EAGAIN in the
      result code, otherwise record 0 for success, or -EIO for any other
      result.
      
      If we time out nf gsi_generic_command() waiting for the command to
      complete, return -ETIMEDOUT (as before).  Otherwise return the
      result stashed by gsi_isr_gp_int1().
      
      Add a loop in gsi_modem_channel_halt() to reissue the HALT command
      if the result code indicates -EAGAIN.  Limit this to 10 retries
      (after the initial attempt).
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      11361456
    • Alex Elder's avatar
      net: ipa: ignore CHANNEL_NOT_RUNNING errors · f849afcc
      Alex Elder authored
      IPA v4.2 has a hardware quirk that requires the AP to allocate GSI
      channels for the modem to use.  It is recommended that these modem
      channels get stopped (with a HALT generic command) by the AP when
      its IPA driver gets removed.
      
      The AP has no way of knowing the current state of a modem channel.
      So when the IPA driver issues a HALT command it's possible the
      channel is not running, and in that case we get an error indication.
      This error simply means we didn't need to stop the channel, so we
      can ignore it.
      
      This patch adds an explanation for this situation, and arranges for
      this condition to *not* report an error message.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f849afcc
    • Alex Elder's avatar
      net: ipa: don't reset an ALLOCATED channel · 5d28913d
      Alex Elder authored
      If the rmnet_ipa0 network device has not been opened at the time
      we remove or shut down the IPA driver, its underlying TX and RX
      GSI channels will not have been started, and they will still be
      in ALLOCATED state.
      
      The RESET command on a channel is meant to return a channel to
      ALLOCATED state after it's been stopped.  But if it was never
      started, its state will still be ALLOCATED, the RESET command
      is not required.
      
      Quietly skip doing the reset without printing an error message if a
      channel is already in ALLOCATED state when we request it be reset.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5d28913d
    • Alex Elder's avatar
      net: ipa: print channel/event ring number on error · f8d3bdd5
      Alex Elder authored
      When a GSI command is used to change the state of a channel or event
      ring we check the state before and after the command to ensure it is
      as expected.  If not, we print an error message, but it does not
      include the channel or event ring id, and it easily can.  Add the
      channel or event ring id to these error messages.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f8d3bdd5
    • Jakub Kicinski's avatar
      Merge branch 'net-ipa-platform-specific-clock-and-interconnect-rates' · 0ee6de26
      Jakub Kicinski authored
      Alex Elder says:
      
      ====================
      net: ipa: platform-specific clock and interconnect rates
      
      This series changes the way the IPA core clock rate and the
      bandwidth parameters for interconnects are specified.  Previously
      these were specified with hard-wired constants, with the same values
      used for the SDM845 and SC7180 platforms.  Now these parameters are
      recorded in platform-specific configuration data.
      
      For the SC7180 this means we use an all-new core clock rate and
      interconnect parameters.
      
      Additionally, while developing this I learned that the average
      bandwidth setting for two of the interconnects is ignored (on both
      platforms).  Zero is now used explicitly as that unused bandwidth
      value.  This means the SDM845 bandwidth settings are also changed
      by this series.
      ====================
      
      Link: https://lore.kernel.org/r/20201119224041.16066-1-elder@linaro.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0ee6de26
    • Alex Elder's avatar
      net: ipa: use config data for clocking · 91d02f95
      Alex Elder authored
      Stop assuming a fixed IPA core clock rate and interconnect
      bandwidths.  Use the configuration data defined for these
      things instead.  Get rid of the previously-used constants.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      91d02f95
    • Alex Elder's avatar
      net: ipa: populate clock and interconnect data · f08c9922
      Alex Elder authored
      Populate the core clock rate and interconnect average and peak
      bandwidth data for SDM845 and SC7180 in their configuration data
      files.  At this point we still don't *use* this data.
      
      Note that SC7180 actually defines a new core clock rate (100 MHz
      instead of 75 MHz) and new interconnect bandwidth values.  They
      will be activated in the next commit, which uses the configured
      values rather than the fixed constants.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f08c9922
    • Alex Elder's avatar
      net: ipa: define clock and interconnect data · dfccb8b1
      Alex Elder authored
      Define a new type of configuration data, used to initialize the
      IPA core clock and interconnects.  This is the first of three
      patches, and defines the data types and interface but doesn't
      yet use them.
      
      Switch the return value if there is no matching configuration data
      to ENODEV instead of ENOTSUPP (to avoid using the nonstandard errno).
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dfccb8b1
    • Grygorii Strashko's avatar
      mdio_bus: suppress err message for reset gpio EPROBE_DEFER · 0a12ad59
      Grygorii Strashko authored
      The mdio_bus may have dependencies from GPIO controller and so got
      deferred. Now it will print error message every time -EPROBE_DEFER is
      returned which from:
      __mdiobus_register()
       |-devm_gpiod_get_optional()
      without actually identifying error code.
      
      "mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO"
      
      Hence, suppress error message for devm_gpiod_get_optional() returning
      -EPROBE_DEFER case by using dev_err_probe().
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Link: https://lore.kernel.org/r/20201119203446.20857-1-grygorii.strashko@ti.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0a12ad59
    • Heiner Kallweit's avatar
      r8169: use dev_err_probe in rtl_get_ether_clk · bf7b0bf6
      Heiner Kallweit authored
      Tiny improvement, let dev_err_probe() deal with EPROBE_DEFER.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Link: https://lore.kernel.org/r/b0c4ebcf-2047-e933-b890-8a20e4bdb19f@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bf7b0bf6
    • Heiner Kallweit's avatar
      r8169: reduce number of workaround doorbell rings · 94d8a98e
      Heiner Kallweit authored
      Some chip versions have a hw bug resulting in lost door bell rings.
      To work around this the doorbell is also rung whenever we still have
      tx descriptors in flight after having cleaned up tx descriptors.
      These PCI(e) writes come at a cost, therefore let's reduce the number
      of extra doorbell rings.
      If skb is NULL then this means:
      - last cleaned-up descriptor belongs to a skb with at least one fragment
        and last fragment isn't marked as sent yet
      - hw is in progress sending the skb, therefore no extra doorbell ring
        is needed for this skb
      - once last fragment is marked as transmitted hw will trigger
        a tx done interrupt and we come here again (with skb != NULL)
        and ring the doorbell if needed
      Therefore skip the workaround doorbell ring if skb is NULL.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Link: https://lore.kernel.org/r/0a15a83c-aecf-ab51-8071-b29d9dcd529a@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      94d8a98e
  2. 20 Nov, 2020 26 commits