From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F8C232AAD6 for ; Tue, 30 Jun 2026 22:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782859826; cv=none; b=u7tYvMVAnh1J6Jfag2JYSsRdOBdF6UkFcNtY8Hi85HO5Wg1OlCQ5jYAxQDIpYYP7feYP+x5wVme6H4P1dR7gMsHEnIpJ3jmdSi4D00ib/lqQqW/iqLwwXjyvp9od1Z3AFPhAUPZ6z+RwS9zDHA4Kpx8pay29IWdBgQmADdG0AcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782859826; c=relaxed/simple; bh=h0nEkFK5iCINNRXs0tKxBk8KKC+Staf8nUhpt5lNdKw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=oTebVlMXuF9hVRAbiKgMWFPxWZEpbouHQyIfSFmNvnVo7H9SdNFN7aVPRaPZXU66Cs51fuR0m15Re/9x5jAItQ2/S0t0lgW3VHMxJX3FLrcicB4+yo3zwEfC5+coARaWdZeuqhIvxOK/6Hx/r3q7a9yT3++LasPdFuDsvf+o8aQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L/7CJw2f; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L/7CJw2f" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-493b966dd74so33075e9.3 for ; Tue, 30 Jun 2026 15:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782859824; x=1783464624; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1MCTcDd/YFCbUyBVWxYxg2TqJHV+16IIRIXuz+3T4+4=; b=L/7CJw2f07dJw6Hzr/oDiupaYSd8Y7hR/FVYulMU6DuuVBMzueLTIaugZjS+vjgWnI pBpawlivoQ8V9sLg8qobAPlQEC/xyCfwAfevJv+v4F6ZR3S+VwSuYNUHJMX+m8D+WyNr 3jrS0koCcrdL691UiL8DlIs4+vXlsIw5NyydzdOEia9bzDOINmBlewVEvllBU6z2dvya 8R+sVUWywv1DpjSAPBG3bQoNFDnURIPKBJRuJDk3BUKRzboakpvK+HnzHpud+EFgmohq Vg1SZQ3FNAeyo7A4q6S2ZBuTCVnyW+AQASr1c/A+D+TFWhFzOCtRvUAi4vH+OB5+Tvv9 B5fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782859824; x=1783464624; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1MCTcDd/YFCbUyBVWxYxg2TqJHV+16IIRIXuz+3T4+4=; b=DtmYKaJHMmeKQdA+1iSeC3hUCTp2d8mFHiB3q0WYg8qDenhyBoXCSJFRapKqHVsL+q nkM3hwQUA5O8q8z0ZPJZ3S5OXNvTapq1cdZFkDS+RkNaGacJldXThtYFuMa2sCtcsMcW CiDV9LMM5hrRX8rTWu2pIeW9Pq63u5VMSLUjwbaJWofk8vIgR6fAsi9yoiMOLTzayXQx PB7jaS88YZO6DDNOAO4TG7qgjlju39tEuqZ5QjTHE0Am/1ODOAJAYsh+CylxDPCtfy5r XAF4X9oNX5FqMnG++R6T2XIL23H16tdsykrxvwUXi1fwlHrNFuBzIZSXJtdu1hZXU2TN pRFQ== X-Forwarded-Encrypted: i=1; AFNElJ9fwbl74mvcjBgoOiuv8godbsUERvPoEHIJLgXkGL3+eR70hkfA/Lg87i7TjzUdeXuKyJOdeim4PGSOUO4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6PBv2IwnFFnS3MkRZdz4Tt8FREZX0Rxp+8+/fbryC3vhVYAvJ Sy2C4GdidmWm58EW/u7go8rY5hs/WPQmmfdsmsQ2itM08rvpz+pigfal X-Gm-Gg: AfdE7cmRzOgsFKb7lGs/Xcdiw1HcCbjaySwHjrDPcWrk4ncBL7bI1BfCaTsVEi6oPib Ej1CNUg5LPMjUX3/bQuoKwFH6/mqhH/3yOtxNXtT/Rw8OwbFoKJYmmmNlZA3iuohx9vKgSJoCkO qqgbXJxgXTJlCs3TgTRs/g/cR3qbdcpbEb45nMHV8A4vECoWXfPkLRdlD55cnzhiGkqM4ZMVg3G 2SlEb0mI3YhJlpyj1rS9FVAXUbcuULrWbfOyEgCoLGTnkQ0Xpl+Cg7YVMNnWu2rAHVWpAYCyBDv uZW12V1lpwa5AudjZx6TrTMBSjaBUg+js4ht2DaZRLwfnSmaflJQPDp/oisfaWB2slTKt6vVuEp EHgZ/gavmE9GOI9OHKoEwlxdEeoUFS3/NwruOpA5X2FtemTmz5ChOLz6PtpqO9pk6t088dd87BB 6IDy2dcVQ= X-Received: by 2002:a05:600c:4e8f:b0:492:67df:3dfa with SMTP id 5b1f17b1804b1-493bda87dffmr35891265e9.34.1782859823475; Tue, 30 Jun 2026 15:50:23 -0700 (PDT) Received: from localhost ([2603:c027:c000:3cde::f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493be81fca5sm31793945e9.14.2026.06.30.15.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 15:50:22 -0700 (PDT) From: Louis Sautier To: Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Ranjan Kumar , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Guenter Roeck , MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Damien Le Moal Subject: [PATCH v5 0/2] scsi: mpt3sas: add hwmon support Date: Wed, 1 Jul 2026 00:49:20 +0200 Message-ID: <20260630224922.2543096-1-sautier.louis@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose the IOC and board temperature sensors of LSI / Broadcom / Avago SAS HBAs that bind to mpt3sas through the hwmon interface. The data lives in MPI IO Unit Page 7. The same fields are exposed by Broadcom's userspace tooling through the /dev/mpt[23]ctl ioctl path (typically root-only): IOCTemperature and BoardTemperature in lsiutil; ROC and Controller in storcli. With this driver, sensors(1) shows them unprivileged: $ sensors mpt3sas-pci-0200 mpt3sas-pci-0200 Adapter: PCI adapter IOC: +42.0°C v4 -> v5: v4: https://lore.kernel.org/r/20260613023833.3163507-1-sautier.louis@gmail.com * In mpt3sas_hwmon_register(), read IO Unit Page 7 and test sensor presence before allocating, so the no-sensor and error paths no longer allocate and free (Damien Le Moal). * Added Damien Le Moal's Reviewed-by to patch 2. v3 -> v4: v3: https://lore.kernel.org/r/20260524210545.1333637-1-sautier.louis@gmail.com v3 (resend): https://lore.kernel.org/r/20260609164423.2829699-1-sautier.louis@gmail.com * Dropped the SCSI_MPT3SAS_HWMON Kconfig option as suggested by Damien Le Moal; the hwmon code is now built whenever CONFIG_HWMON is enabled. Used IS_REACHABLE() rather than IS_ENABLED() so SCSI_MPT3SAS=y with HWMON=m still builds, same pattern as i915/xe. * No line breaks after function return types; aligned multi-line call arguments to the opening parenthesis (Damien Le Moal). * Dropped unused #include from mpt3sas_hwmon.c. * Added Damien Le Moal's Reviewed-by to patch 1. v2 -> v3: v2: https://lore.kernel.org/r/20260518184109.770185-1-sautier.louis@gmail.com * Removed stale Documentation/hwmon/mpt3sas.rst reference from Kconfig help text. v1 -> v2: v1: https://lore.kernel.org/r/20260512214703.655633-1-sautier.louis@gmail.com * Dropped misleading Documentation/hwmon/mpt3sas.rst. * Dropped inaccurate concurrency-wait figure from Testing; corrected empirical data is in the on-list discussion. Testing ------- Build-tested all four SCSI_MPT3SAS x HWMON combinations (=y and =m each), including the SCSI_MPT3SAS=y with HWMON=m case that requires IS_REACHABLE(). Validated across three Broadcom SAS chip generations. None of the cards had a board sensor present, so the testing only covers the IOC channel: * LSI 9500-8i / SAS3816, SAS-3: - hwmon device registers as "mpt3sas" with only temp1 (IOC) exposed - IOC reading matches `storcli /c0 show temperature` and `lsiutil -p1 -a 25,2,0,0` - rmmod / modprobe cycle goes through the explicit unregister/register paths cleanly * LSI 9305-24i / SAS3224, SAS-3: same behaviour. * LSI 9211-4i / SAS2004, SAS-2: firmware reports both *TemperatureUnits = NOT_PRESENT, no hwmon device registered (graceful-skip path). Not verified (no available hardware): * Path with both IOC and board sensors present. * Fahrenheit-units conversion. * Sub-zero readings (signed-cast path). Louis Sautier (2): scsi: mpt3sas: add IO Unit Page 7 config accessor scsi: mpt3sas: add hwmon support drivers/scsi/mpt3sas/Makefile | 2 + drivers/scsi/mpt3sas/mpt3sas_base.h | 20 +++ drivers/scsi/mpt3sas/mpt3sas_config.c | 36 +++++ drivers/scsi/mpt3sas/mpt3sas_hwmon.c | 191 ++++++++++++++++++++++++++ drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 + 5 files changed, 255 insertions(+) create mode 100644 drivers/scsi/mpt3sas/mpt3sas_hwmon.c base-commit: 5d6919055dec134de3c40167a490f33c74c12581 -- 2.54.0