[PATCH v2 0/6] Some fixes for amd-pmc handling of the STB

Mario Limonciello <[email protected]>
Newsgroups org.kernel.vger.platform-driver-x86,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Not all platforms support STB, and by activating it on a platform without
support a few bugs were exposed.

This series cleans them up and also cleans up some existing cleanup path
errors.

Cc: Francis De Brabandere <[email protected]>

v1->v2:
  Addresses review feedback from Ilpo Järvinen and the Sashiko automated
  review (https://sashiko.dev/).

  - Split the v1 "Fix error handling in amd_stb_s2d_init()" patch into two,
    per Ilpo's request to land the msg_port restoration first and the SMU
    error handling on top:
      * "Restore msg_port on amd_stb_s2d_init() error paths" (msg_port only)
      * "Propagate SMU errors and validate S2D address"      (error handling)

  - Folded the v1 "Validate S2D physical address before ioremap" patch into
    "Propagate SMU errors and validate S2D address" - checking the SMU
    return values and rejecting a zero address are one logical fix.

  - New patch "Fix msg_port restoration in amd_stb_debugfs_open_v2()":
    the same stuck-on-MSG_PORT_S2D bug exists in the debugfs read path
    (Ilpo noted another site needs the same fix; also flagged by Sashiko).

  - New patch "Only expose stb_read after telemetry buffer is mapped":
    fixes a NULL dev->stb_virt_addr dereference on read (Sashiko, HIGH).
    Ordered before "Do not fail probe" so that making STB init non-fatal
    never leaves a readable stb_read node backed by an unmapped buffer.

  - Reordered the series so every patch is correct on its own:
    the msg_port/SMU fixes first, the stb_read hardening before the
    behavioural "Do not fail probe" change, and the LPS0/debugfs leak fix
    kept as a standalone stable backport (its now-unreachable unwind is
    removed by "Do not fail probe", as noted in that patch).

  - No functional change to the v1 "Fix LPS0 and debugfs leaks" and
    "Do not fail probe" patches; only their position in the series.

v1->v2 patch mapping:
  v1 1/4 Fix LPS0 and debugfs leaks          -> v2 5/6 (unchanged)
  v1 2/4 Fix error handling                  -> v2 1/6 + 3/6 (split)
  v1 3/4 Do not fail probe                    -> v2 6/6 (unchanged)
  v1 4/4 Validate S2D physical address        -> v2 3/6 (merged)
  (new)                                       -> v2 2/6 msg_port in debugfs_open_v2
  (new)                                       -> v2 4/6 expose stb_read after map

Mario Limonciello (6):
  platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init() error
    paths
  platform/x86/amd/pmc: Fix msg_port restoration in
    amd_stb_debugfs_open_v2()
  platform/x86/amd/pmc: Propagate SMU errors and validate S2D address
  platform/x86/amd/pmc: Only expose stb_read after telemetry buffer is
    mapped
  platform/x86/amd/pmc: Fix LPS0 and debugfs leaks when STB init fails
  platform/x86/amd/pmc: Do not fail probe when STB init fails

 drivers/platform/x86/amd/pmc/mp1_stb.c | 83 +++++++++++++++++---------
 drivers/platform/x86/amd/pmc/pmc.c     |  9 ++-
 2 files changed, 63 insertions(+), 29 deletions(-)

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.