1. 07 2月, 2021 1 次提交
  2. 03 2月, 2021 2 次提交
  3. 29 1月, 2021 4 次提交
    • A
      net: ipa: signal when tag transfer completes · 51c48ce2
      Alex Elder 提交于
      There are times, such as when the modem crashes, when we issue
      commands to clear the IPA hardware pipeline.  These commands include
      a data transfer command that delivers a small packet directly to the
      default (AP<-LAN RX) endpoint.
      
      The places that do this wait for the transactions that contain these
      commands to complete, but the pipeline can't be assumed clear until
      the sent packet has been *received*.
      
      The small transfer will be delivered with a status structure, and
      that status will indicate its tag is valid.  This is the only place
      we send a tagged packet, so we use the tag to determine when the
      pipeline clear packet has arrived.
      
      Add a completion to the IPA structure to to be used to signal
      the receipt of a pipeline clear packet.  Create a new function
      ipa_cmd_pipeline_clear_wait() that will wait for that completion.
      
      Reinitialize the completion whenever pipeline clear commands are
      added to a transaction.  Extend ipa_endpoint_status_tag() to check
      whether a packet whose status contains a valid tag was sent from the
      AP->command TX endpoint, and if so, signal the new IPA completion.
      
      Have all callers of ipa_cmd_pipeline_clear_add() wait for the
      pipeline clear indication after the transaction that clears the
      pipeline has completed.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      51c48ce2
    • A
      net: ipa: drop packet if status has valid tag · f6aba7b5
      Alex Elder 提交于
      Introduce ipa_endpoint_status_tag(), which returns true if received
      status indicates its tag field is valid.  The endpoint parameter is
      not yet used.
      
      Call this from ipa_status_drop_packet(), and drop the packet if the
      status indicates the tag was valid.  Pass the endpoint pointer to
      ipa_status_drop_packet(), and rename it ipa_endpoint_status_drop().
      The endpoint will be used in the next patch.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      f6aba7b5
    • A
      net: ipa: minor update to handling of packet with status · 162fbc6f
      Alex Elder 提交于
      Rearrange some comments and assignments made when handling a packet
      that is received with status, aiming to improve understandability.
      
      Use DIV_ROUND_CLOSEST() to get a better per-packet true size estimate.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      162fbc6f
    • A
      net: ipa: rename "tag status" symbols · aa56e3e5
      Alex Elder 提交于
      There is a set of functions and symbols related to performing
      "tag_process" immediate commands to clear the IPA pipeline.  The
      name is related to one of the commands issued when doing this, but
      it doesn't really convey the overall purpose of taking this action.
      
      The purpose is to take some steps to "clear out" the hardware
      pipeline, and to wait until that process completes, to ensure the
      IPA hardware is in a well-defined state.
      
      Rename these symbols to use "pipeline_clear" in their names instead.
      Add some comments to explain a bit more about what's going on.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Acked-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      aa56e3e5
  4. 15 1月, 2021 1 次提交
  5. 02 12月, 2020 3 次提交
    • A
      net: ipa: use Qtime for IPA v4.5 head-of-line time limit · 63e5afc8
      Alex Elder 提交于
      Extend ipa_reg_init_hol_block_timer_val() so it properly calculates
      the head-of-line block timeout to use for IPA v4.5.
      
      Introduce hol_block_timer_qtime_val() to compute the value to use
      for IPA v4.5, where Qtime is used as the basis of the timer.  Call
      that function from hol_block_timer_val() for IPA v4.5.
      
      Both of these are private functions, so shorten their names a bit so
      they don't take up so much space on the line.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      63e5afc8
    • A
      net: ipa: use Qtime for IPA v4.5 aggregation time limit · 19547041
      Alex Elder 提交于
      Change aggr_time_limit_encoded() to properly calculate the
      aggregation time limit to use for IPA v4.5.
      
      Older IPA versions program the AGGR_GRANULARITY field of the
      of the COUNTER_CFG register to set the granularity of the
      aggregation timer, which we configure to be 500 microseconds.
      
      Instead, IPA v4.5 selects between two possible granularity values
      derived from the 19.2 MHz Qtime clock.  These granularities are
      100 microseconds or 1 millisecond per tick.  We use the smaller
      granularity if possible, unless the desired period is too large
      to be specified that way.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      19547041
    • A
      net: ipa: update IPA aggregation registers for IPA v4.5 · 6bf754c7
      Alex Elder 提交于
      IPA v4.5 significantly changes the format of the configuration
      register used for endpoint aggregation.  The AGGR_BYTE_LIMIT field
      is now larger, and the positions of other fields are shifted.  This
      complicates the way we have to access this register because functions
      like u32_encode_bits() require their field mask argument to be constant.
      
      A further complication is that we want to know the maximum value
      representable by at least one of these fields, and that too requires
      a constant field mask.
      
      This patch adds support for IPA v4.5 endpoint aggregation registers
      in a way that continues to support "legacy" IPA hardware.  It does
      so in a way that keeps field masks constant.
      
      First, for each variable field mask, we define an inline function
      whose return value is either the legacy value or the IPA v4.5 value.
      
      Second, we define functions for these fields that encode a value
      to use in each field based on the IPA version (this approach is
      already used elsewhere).  The field mask provided is supplied by
      the function mentioned above.
      
      Finally, for the aggregation byte limit fields where we want to
      know the maximum representable value, we define a function that
      returns that maximum, computed from the appropriate field mask.
      
      We can no longer verify at build time that our buffer size is
      in the range that can be represented by the aggregation byte
      limit field.  So remove the test done by a BUILD_BUG_ON() call
      in ipa_endpoint_validate_build(), and implement a comparable check
      at the top of ipa_endpoint_data_valid().
      
      Doing that makes ipa_endpoint_validate_build() contain a single
      line BUILD_BUG_ON() call, so just remove that function and move
      the remaining line into ipa_endpoint_data_valid().
      
      One final note:  the aggregation time limit value for IPA v4.5 needs
      to be computed differently.  That is handled in an upcoming patch.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      6bf754c7
  6. 29 11月, 2020 2 次提交
    • A
      net: ipa: add support to code for IPA v4.5 · 8bfc4e21
      Alex Elder 提交于
      Update the IPA code to make use of the updated IPA v4.5 register
      definitions.  Generally what this patch does is, if IPA v4.5
      hardware is in use:
        - Ensure new registers or fields in IPA v4.5 are updated where
          required
        - Ensure registers or fields not supported in IPA v4.5 are not
          examined when read, or are set to 0 when written
      It does this while preserving the existing functionality for IPA
      versions lower than v4.5.
      
      The values to program for QSB_MAX_READS and QSB_MAX_WRITES and the
      source and destination resource counts are updated to be correct for
      all versions through v4.5 as well.
      
      Note that IPA_RESOURCE_GROUP_SRC_MAX and IPA_RESOURCE_GROUP_DST_MAX
      already reflect that 5 is an acceptable number of resources (which
      IPA v4.5 implements).
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      8bfc4e21
    • A
      net: ipa: add new most-significant bits to registers · 1af15c2a
      Alex Elder 提交于
      IPA v4.5 adds a few fields to the endpoint header and extended
      header configuration registers that represent new high-order bits
      for certain offsets and sizes.  Add code to incorporate these upper
      bits into the registers for IPA v4.5.
      
      This includes creating ipa_header_size_encoded(), which handles
      encoding the metadata offset field for use in the ENDP_INIT_HDR
      register in a way appropriate for the hardware version.  This and
      ipa_metadata_offset_encoded() ensure the mask argument passed to
      u32_encode_bits() is constant.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      1af15c2a
  7. 19 11月, 2020 2 次提交
    • A
      net: ipa: a few last IPA register cleanups · 716a115b
      Alex Elder 提交于
      Some last cleanups for the existing IPA register definitions:
        - Remove the definition of IPA_REG_ENABLED_PIPES_OFFSET, because
          it is not used.
        - Use "IPA_" instead of "BAM_" as the prefix on fields associated
          with the FLAVOR_0 register.  We use GSI (not BAM), but the
          fields apply to both GSI and BAM.
        - Get rid of the definition of IPA_CS_RSVD; it is never used.
        - Add two missing field mask definitions for the INIT_DEAGGR
          endpoint register.
        - Eliminate a few of the defined sequencer types, because they
          are unused.  We can add them back when needed.
        - Add a field mask to indicate which bit causes an interrupt on
          the microcontroller.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      716a115b
    • A
      net: ipa: support more versions for HOLB timer · 6833a096
      Alex Elder 提交于
      IPA version 3.5.1 represents the timer used in avoiding head-of-line
      blocking with a simple tick count.  IPA v4.2 changes that, instead
      splitting the timer field into two parts (base and scale) to
      represent the ticks in the timer period.
      
      IPA v4.0 and IPA v4.1 use the same method as IPA v3.5.1.  Change the
      test in ipa_reg_init_hol_block_timer_val() so the result is correct
      for those versions as well.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      6833a096
  8. 05 11月, 2020 1 次提交
    • A
      net: ipa: use version in gsi_channel_program() · ce54993d
      Alex Elder 提交于
      Use the IPA version in gsi_channel_program() to determine whether
      we should enable the GSI doorbell engine when requested.  This way,
      callers only say whether or not it should be enabled if needed,
      regardless of hardware version.
      
      Rename the "legacy" argument to gsi_channel_reset(), and have
      it indicate whether the doorbell engine should be enabled when
      reprogramming following the reset.
      
      Change all callers of gsi_channel_reset() to indicate whether to
      enable the doorbell engine after reset, independent of hardware
      version.
      
      Rework a little logic in ipa_endpoint_reset() to get rid of the
      "legacy" variable previously passed to gsi_channel_reset().
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      ce54993d
  9. 04 11月, 2020 1 次提交
  10. 31 10月, 2020 1 次提交
    • A
      net: ipa: assign endpoint to a resource group · 2d265342
      Alex Elder 提交于
      The IPA hardware manages various resources (e.g. descriptors)
      internally to perform its functions.  The resources are grouped,
      allowing different endpoints to use separate resource pools.  This
      way one group of endpoints can be configured to operate unaffected
      by the resource use of endpoints in a different group.
      
      Endpoints should be assigned to a resource group, but we currently
      don't do that.
      
      Define a new resource_group field in the endpoint configuration
      data, and use it to assign the proper resource group to use for
      each AP endpoint.
      Tested-by: NSujit Kautkar <sujitka@chromium.org>
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      2d265342
  11. 10 10月, 2020 1 次提交
    • A
      net: ipa: skip suspend/resume activities if not set up · d1704382
      Alex Elder 提交于
      When processing a system suspend request we suspend modem endpoints
      if they are enabled, and call ipa_cmd_tag_process() (which issues
      IPA commands) to ensure the IPA pipeline is cleared.  It is an error
      to attempt to issue an IPA command before setup is complete, so this
      is clearly a bug.  But we also shouldn't suspend or resume any
      endpoints that have not been set up.
      
      Have ipa_endpoint_suspend() and ipa_endpoint_resume() immediately
      return if setup hasn't completed, to avoid any attempt to configure
      endpoints or issue IPA commands in that case.
      
      Fixes: 84f9bd12 ("soc: qcom: ipa: IPA endpoints")
      Tested-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      d1704382
  12. 29 9月, 2020 3 次提交
  13. 14 7月, 2020 1 次提交
    • A
      net: ipa: fix kerneldoc comments · e3eea08e
      Alex Elder 提交于
      This commit affects comments (and in one case, whitespace) only.
      
      Throughout the IPA code, return statements are documented using
      "@Return:", whereas they should use "Return:" instead.  Fix these
      mistakes.
      
      In function definitions, some parameters are missing their comment
      to describe them.  And in structure definitions, some fields are
      missing their comment to describe them.  Add these missing
      descriptions.
      
      Some arguments changed name and type along the way, but their
      descriptions were not updated (an endpoint pointer is now used in
      many places that previously used an endpoint ID).  Fix these
      incorrect parameter descriptions.
      
      In the description for the ipa_clock structure, one field had a
      semicolon instead of a colon in its description.  Fix this.
      
      Add a missing function description for ipa_gsi_endpoint_data_empty().
      
      All of these issues were identified when building with "W=1".
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e3eea08e
  14. 04 7月, 2020 1 次提交
    • A
      net: ipa: fix HOLB timer calculation · f13a8c31
      Alex Elder 提交于
      For IPA v4.2, the exact interpretation of the register that defines
      the timeout for avoiding head-of-line blocking was a little unclear.
      We're only assigning a 0 timeout to it right now, so that wasn't
      very important.  But now that I know how it's supposed to work, I'm
      fixing it.
      
      The register represents a tick counter, where each tick is equal to
      128 IPA core clock cycles.  For IPA v3.5.1, the register contains
      a simple counter value.  But for IPA v4.2, the register contains two
      fields, base and scale, which approximate the tick counter as:
          ticks = base << scale
      The base and scale values to use for a given tick count are computed
      using clever bit operations, and measures are taken to make the
      resulting time period as close as possible to that requested.
      
      There's no need for ipa_endpoint_init_hol_block_timer() to return
      an error, so change its return type to void.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f13a8c31
  15. 03 7月, 2020 4 次提交
  16. 02 7月, 2020 6 次提交
  17. 01 7月, 2020 1 次提交
  18. 12 6月, 2020 3 次提交
    • A
      net: ipa: header pad field only valid for AP->modem endpoint · f330fda3
      Alex Elder 提交于
      Only QMAP endpoints should be configured to find a pad size field
      within packet headers.  They are found in the first byte of the QMAP
      header (and the hardware fills only the 6 bits in that byte that
      constitute the pad_len field).
      
      The RMNet driver assumes the pad_len field is valid for received
      packets, so we want to ensure the pad_len field is filled in that
      case.  That driver also assumes the length in the QMAP header
      includes the pad bytes.
      
      The RMNet driver does *not* pad the packets it sends, so the pad_len
      field can be ignored.
      
      Fix ipa_endpoint_init_hdr_ext() so it only marks the pad field
      offset valid for QMAP RX endpoints, and in that case indicates
      that the length field in the header includes the pad bytes.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f330fda3
    • A
      net: ipa: program upper nibbles of sequencer type · 636edeaa
      Alex Elder 提交于
      The upper two nibbles of the sequencer type were not used for
      SDM845, and were assumed to be 0.  But for SC7180 they are used, and
      so they must be programmed by ipa_endpoint_init_seq().  Fix this bug.
      
      IPA_SEQ_PKT_PROCESS_NO_DEC_NO_UCP_DMAP doesn't have a descriptive
      comment, so add one.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      636edeaa
    • A
      net: ipa: program metadata mask differently · 8730f45d
      Alex Elder 提交于
      The way the mask value is programmed for QMAP RX endpoints was based
      on some wrong assumptions about the way metadata containing the QMAP
      mux_id value is formatted.  The metadata value supplied by the
      modem is *not* in QMAP format, and in fact contains the mux_id we
      want in its (big endian) low-order byte.  That byte must be written
      by the IPA into offset 1 of the QMAP header it inserts before the
      received packet.
      
      QMAP TX endpoints *do* use a QMAP header as the metadata sent with
      each packet.  The modem assumes this, and based on that assumes the
      mux_id is in the second byte.  To match those assumptions we must
      program the modem TX (QMAP) endpoint HDR register to indicate the
      metadata will be found at offset 0 in the message header.
      
      The previous configuration managed to work, but it was not working
      correctly.  This patch fixes a bug whose symptom was receipt of
      messages containing the wrong QMAP mux_id.
      
      In fixing this, get rid of ipa_rmnet_mux_id_metadata_mask(), which
      was more or less defined so there was a separate place to explain
      what was happening as we generated the mask value.  Instead, put a
      longer description of how this works above ipa_endpoint_init_hdr(),
      and define the metadata mask to use as a simple constant.
      Signed-off-by: NAlex Elder <elder@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8730f45d
  19. 28 5月, 2020 1 次提交
  20. 09 5月, 2020 1 次提交
    • N
      net: ipa: Remove ipa_endpoint_stop{,_rx_dma} again · b5c3babb
      Nathan Chancellor 提交于
      When building arm64 allyesconfig:
      
      drivers/net/ipa/ipa_endpoint.c: In function 'ipa_endpoint_stop_rx_dma':
      drivers/net/ipa/ipa_endpoint.c:1274:13: error: 'IPA_ENDPOINT_STOP_RX_SIZE' undeclared (first use in this function)
      drivers/net/ipa/ipa_endpoint.c:1274:13: note: each undeclared identifier is reported only once for each function it appears in
      drivers/net/ipa/ipa_endpoint.c:1289:2: error: implicit declaration of function 'ipa_cmd_dma_task_32b_addr_add' [-Werror=implicit-function-declaration]
      drivers/net/ipa/ipa_endpoint.c:1291:45: error: 'ENDPOINT_STOP_DMA_TIMEOUT' undeclared (first use in this function)
      drivers/net/ipa/ipa_endpoint.c: In function 'ipa_endpoint_stop':
      drivers/net/ipa/ipa_endpoint.c:1309:16: error: 'IPA_ENDPOINT_STOP_RX_RETRIES' undeclared (first use in this function)
      
      These functions were removed in a series, merged in as
      commit 33395f4a ("Merge branch 'net-ipa-kill-endpoint-stop-workaround'").
      
      Remove them again so that the build works properly.
      
      Fixes: 3793faad ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      b5c3babb