public inbox for chrome-platform@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v3] platform/chrome: chromeos_pstore: Add ecc_size module parameter
@ 2025-06-20  6:28 Naoya Tezuka
  2025-06-23  2:41 ` Tzung-Bi Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Naoya Tezuka @ 2025-06-20  6:28 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih, Kees Cook, Tony Luck,
	Guilherme G . Piccoli
  Cc: chrome-platform, linux-kernel, linux-hardening, Naoya Tezuka

On ChromiumOS devices, the `ecc_size` is set to 0 (check dmesg | grep ecc 
to see `ecc: 0`): this disables ECC for ramoops region, even when 
`ramoops.ecc=1` is given to kernel command line parameter.

Introduce `ecc_size` module parameter to provide an method to turn on ECC
for ramoops and set different values of ecc_size per devices.

A large `ecc_size` value can cause a kernel panic due to a constraint in
Reed-Solomon code library. The validation for this constraint should 
belong to the common pstore RAM layer, not in each individual driver. So
this check is handled by a separate patch [1].

[1] https://lore.kernel.org/lkml/20250620054757.1006729-1-naoyatezuka@chromium.org

Signed-off-by: Naoya Tezuka <naoyatezuka@chromium.org>
---
Changes in v3:
- Update commit message to use imperative mood as suggested.
- Change module parameter permissions for `ecc_size` to 0400 as suggested.
- State in commit message that the `ecc_size` upper bound issue is 
  addressed in a separte patch instead of validating in this driver.

- Link to v2: https://lore.kernel.org/lkml/20250610050458.4014083-1-naoyatezuka@chromium.org

Changes in v2:
- Remove an unnecessary blank line

- Link to v1: https://lore.kernel.org/lkml/20250610025152.3844404-1-naoyatezuka@chromium.org
---
 drivers/platform/chrome/chromeos_pstore.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c
index f37c0ef4af1f..a6eed99507d4 100644
--- a/drivers/platform/chrome/chromeos_pstore.c
+++ b/drivers/platform/chrome/chromeos_pstore.c
@@ -9,6 +9,10 @@
 #include <linux/platform_device.h>
 #include <linux/pstore_ram.h>
 
+static int ecc_size;
+module_param(ecc_size, int, 0400);
+MODULE_PARM_DESC(ecc_size, "ECC parity data size in bytes. A positive value enables ECC for the ramoops region.");
+
 static const struct dmi_system_id chromeos_pstore_dmi_table[] __initconst = {
 	{
 		/*
@@ -117,6 +121,9 @@ static int __init chromeos_pstore_init(void)
 {
 	bool acpi_dev_found;
 
+	if (ecc_size > 0)
+		chromeos_ramoops_data.ecc_info.ecc_size = ecc_size;
+
 	/* First check ACPI for non-hardcoded values from firmware. */
 	acpi_dev_found = chromeos_check_acpi();
 
-- 
2.50.0.rc2.701.gf1e915cc24-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-23  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20  6:28 [PATCH v3] platform/chrome: chromeos_pstore: Add ecc_size module parameter Naoya Tezuka
2025-06-23  2:41 ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox