1. 11 Aug, 2021 7 commits
    • Alex Elder's avatar
      net: ipa: kill IPA clock reference count · a71aeff3
      Alex Elder authored
      The runtime power management core code maintains a usage count.  This
      count mirrors the IPA clock reference count, and there's no need to
      maintain both.  So get rid of the IPA clock reference count and just
      rely on the runtime PM usage count to determine when the hardware
      should be suspended or resumed.
      
      Use pm_runtime_get_if_active() in ipa_clock_get_additional().  We
      care whether power is active, regardless of whether it's in use, so
      pass true for its ign_usage_count argument.
      
      The IPA clock mutex is just used to make enabling/disabling the
      clock and updating the reference count occur atomically.  Without
      the reference count, there's no need for the mutex, so get rid of
      that too.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a71aeff3
    • Alex Elder's avatar
      net: ipa: get rid of extra clock reference · a3d3e759
      Alex Elder authored
      Suspending the IPA hardware is now managed by the runtime PM core
      code.  The ->runtime_idle callback returns a non-zero value, so it
      will never suspend except when forced.  As a result, there's no need
      to take an extra "do not suspend" clock reference.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3d3e759
    • Alex Elder's avatar
      net: ipa: use runtime PM core · 63de79f0
      Alex Elder authored
      Use the runtime power management core to cause hardware suspend and
      resume to occur.  Enable it in ipa_clock_init() (without autosuspend),
      and disable it in ipa_clock_exit().
      
      Use ipa_runtime_suspend() as the ->runtime_suspend power operation,
      and arrange for it to be called by having ipa_clock_get() call
      pm_runtime_get_sync() when the first clock reference is taken.
      Similarly, use ipa_runtime_resume() as the ->runtime_resume power
      operation, and pm_runtime_put() when the last IPA clock reference
      is dropped.
      
      Introduce ipa_runtime_idle() as the ->runtime_idle power operation,
      and have it return a non-zero value; this way suspend will never
      occur except when forced.
      
      Use pm_runtime_force_suspend() and pm_runtime_force_resume() as the
      system suspend and resume callbacks, and remove ipa_suspend() and
      ipa_resume().
      
      Store a pointer to the device structure passed to ipa_clock_init(),
      so it can be used by ipa_clock_exit() to disable runtime power
      management.
      
      For now we preserve IPA clock reference counting.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63de79f0
    • Alex Elder's avatar
      net: ipa: resume in ipa_clock_get() · 2abb0c7f
      Alex Elder authored
      Introduce ipa_runtime_suspend() and ipa_runtime_resume(), which
      encapsulate the activities necessary for suspending and resuming
      the IPA hardware.  Call these functions from ipa_clock_get() and
      ipa_clock_put() when the first reference is taken or last one is
      dropped.
      
      When the very first clock reference is taken (for ipa_config()),
      setup isn't complete yet, so (as before) only the core clock gets
      enabled.
      
      When the last clock reference is dropped (after ipa_deconfig()),
      ipa_teardown() will have made the setup_complete flag false, so
      there too, the core clock will be stopped without affecting GSI
      or the endpoints.
      
      Otherwise these new functions will perform the desired suspend and
      resume actions once setup is complete.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2abb0c7f
    • Alex Elder's avatar
      net: ipa: disable clock in suspend · 1016c6b8
      Alex Elder authored
      Disable the IPA clock rather than dropping a reference to it in the
      system suspend callback.  This forces the suspend to occur without
      affecting existing references.
      
      Similarly, enable the clock rather than taking a reference in
      ipa_resume(), forcing a resume without changing the reference count.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1016c6b8
    • Alex Elder's avatar
      net: ipa: have ipa_clock_get() return a value · 7ebd168c
      Alex Elder authored
      We currently assume no errors occur when enabling or disabling the
      IPA core clock and interconnects.  And although this commit exposes
      errors that could occur, we generally assume this won't happen in
      practice.
      
      This commit changes ipa_clock_get() and ipa_clock_put() so each
      returns a value.  The values returned are meant to mimic what the
      runtime power management functions return, so we can set up error
      handling here before we make the switch.  Have ipa_clock_get()
      increment the reference count even if it returns an error, to match
      the behavior of pm_runtime_get().
      
      More details follow.
      
      When taking a reference in ipa_clock_get(), return 0 for the first
      reference, 1 for subsequent references, or a negative error code if
      an error occurs.  Note that if ipa_clock_get() returns an error, we
      must not touch hardware; in some cases such errors now cause entire
      blocks of code to be skipped.
      
      When dropping a reference in ipa_clock_put(), we return 0 or an
      error code.  The error would come from ipa_clock_disable(), which
      now returns what ipa_interconnect_disable() returns (either 0 or a
      negative error code).  For now, callers ignore the return value;
      if an error occurs, a message will have already been logged, and
      little more can actually be done to improve the situation.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7ebd168c
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next · 6f45933d
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter updates for net-next
      
      The following patchset contains Netfilter updates for net-next:
      
      1) Use nfnetlink_unicast() instead of netlink_unicast() in nft_compat.
      
      2) Remove call to nf_ct_l4proto_find() in flowtable offload timeout
         fixup.
      
      3) CLUSTERIP registers ARP hook on demand, from Florian.
      
      4) Use clusterip_net to store pernet warning, also from Florian.
      
      5) Remove struct netns_xt, from Florian Westphal.
      
      6) Enable ebtables hooks in initns on demand, from Florian.
      
      7) Allow to filter conntrack netlink dump per status bits,
         from Florian Westphal.
      
      8) Register x_tables hooks in initns on demand, from Florian.
      
      9) Remove queue_handler from per-netns structure, again from Florian.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f45933d
  2. 10 Aug, 2021 20 commits
  3. 09 Aug, 2021 13 commits