mbox series

[SRU,J:linux-bluefield,0/1] UBUNTU: SAUCE: mlxbf-bootctl supports RTC battery status read and clear

Message ID 20240905233002.29281-1-xiangrongl@nvidia.com
Headers show
Series UBUNTU: SAUCE: mlxbf-bootctl supports RTC battery status read and clear | expand

Message

Ron Li Sept. 5, 2024, 11:30 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2078881

SRU Justification:

[Impact]

The RTC battery status is not directly accessible from the kernel user space. The recent Nvidia UEFI added SMC to report the RTC battery status and clear the status bit if needed.

[Fix]

* Added an rtc_battery entry in the bootctl driver.
* Read the rtc_battery entry will trigger an SMC call to read the RTC battery status.

[Test Case]

* Check if the bootctl driver is loaded.
* Check the rtc_battery entry:
cat /sys/bus/platform/drivers/mlxbf-bootctl/rtc_battery
A value of 0x0 means RTC battery voltage is good.
A value of 0x80 means RTC battery voltage is low. The status bit is also cleared after the read.
An error code will be return if this feature is missing from UEFI.

[Other]
* This code is likely to change depending on feedback we received from maintainers.


Ron Li (1):
  UBUNTU: SAUCE: mlxbf-bootctl supports RTC battery status read and
    clear

 drivers/platform/mellanox/mlxbf-bootctl.c | 20 ++++++++++++++++++++
 drivers/platform/mellanox/mlxbf-bootctl.h |  5 +++++
 2 files changed, 25 insertions(+)

Comments

Bartlomiej Zolnierkiewicz Sept. 11, 2024, 7:44 a.m. UTC | #1
On Fri, Sep 6, 2024 at 1:31 AM Ron Li <xiangrongl@nvidia.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2078881
>
> SRU Justification:
>
> [Impact]
>
> The RTC battery status is not directly accessible from the kernel user space. The recent Nvidia UEFI added SMC to report the RTC battery status and clear the status bit if needed.
>
> [Fix]
>
> * Added an rtc_battery entry in the bootctl driver.
> * Read the rtc_battery entry will trigger an SMC call to read the RTC battery status.
>
> [Test Case]
>
> * Check if the bootctl driver is loaded.
> * Check the rtc_battery entry:
> cat /sys/bus/platform/drivers/mlxbf-bootctl/rtc_battery
> A value of 0x0 means RTC battery voltage is good.
> A value of 0x80 means RTC battery voltage is low. The status bit is also cleared after the read.
> An error code will be return if this feature is missing from UEFI.
>
> [Other]
> * This code is likely to change depending on feedback we received from maintainers.
>
>
> Ron Li (1):
>   UBUNTU: SAUCE: mlxbf-bootctl supports RTC battery status read and
>     clear
>
>  drivers/platform/mellanox/mlxbf-bootctl.c | 20 ++++++++++++++++++++
>  drivers/platform/mellanox/mlxbf-bootctl.h |  5 +++++
>  2 files changed, 25 insertions(+)
>

Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>

--
Best regards,
Bartlomiej
Andrei Gherzan Sept. 11, 2024, 10:58 a.m. UTC | #2
On 24/09/05 07:30pm, Ron Li wrote:
> BugLink: https://bugs.launchpad.net/bugs/2078881
> 
> SRU Justification:
> 
> [Impact]
> 
> The RTC battery status is not directly accessible from the kernel user space. The recent Nvidia UEFI added SMC to report the RTC battery status and clear the status bit if needed.
> 
> [Fix]
> 
> * Added an rtc_battery entry in the bootctl driver.
> * Read the rtc_battery entry will trigger an SMC call to read the RTC battery status.
> 
> [Test Case]
> 
> * Check if the bootctl driver is loaded.
> * Check the rtc_battery entry:
> cat /sys/bus/platform/drivers/mlxbf-bootctl/rtc_battery
> A value of 0x0 means RTC battery voltage is good.
> A value of 0x80 means RTC battery voltage is low. The status bit is also cleared after the read.
> An error code will be return if this feature is missing from UEFI.
> 
> [Other]
> * This code is likely to change depending on feedback we received from maintainers.
> 
> 
> Ron Li (1):
>   UBUNTU: SAUCE: mlxbf-bootctl supports RTC battery status read and
>     clear
> 
>  drivers/platform/mellanox/mlxbf-bootctl.c | 20 ++++++++++++++++++++
>  drivers/platform/mellanox/mlxbf-bootctl.h |  5 +++++

Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
Bartlomiej Zolnierkiewicz Sept. 23, 2024, 1:44 p.m. UTC | #3
Applied to jammy:linux-bluefield/master-next. Thanks.

--
Best regards,
Bartlomiej

On Fri, Sep 6, 2024 at 1:31 AM Ron Li <xiangrongl@nvidia.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2078881
>
> SRU Justification:
>
> [Impact]
>
> The RTC battery status is not directly accessible from the kernel user space. The recent Nvidia UEFI added SMC to report the RTC battery status and clear the status bit if needed.
>
> [Fix]
>
> * Added an rtc_battery entry in the bootctl driver.
> * Read the rtc_battery entry will trigger an SMC call to read the RTC battery status.
>
> [Test Case]
>
> * Check if the bootctl driver is loaded.
> * Check the rtc_battery entry:
> cat /sys/bus/platform/drivers/mlxbf-bootctl/rtc_battery
> A value of 0x0 means RTC battery voltage is good.
> A value of 0x80 means RTC battery voltage is low. The status bit is also cleared after the read.
> An error code will be return if this feature is missing from UEFI.
>
> [Other]
> * This code is likely to change depending on feedback we received from maintainers.
>
>
> Ron Li (1):
>   UBUNTU: SAUCE: mlxbf-bootctl supports RTC battery status read and
>     clear
>
>  drivers/platform/mellanox/mlxbf-bootctl.c | 20 ++++++++++++++++++++
>  drivers/platform/mellanox/mlxbf-bootctl.h |  5 +++++
>  2 files changed, 25 insertions(+)
>