Commit 545daf90 authored by Naoya Tezuka's avatar Naoya Tezuka Committed by Tzung-Bi Shih
Browse files

platform/chrome: chromeos_pstore: Add ecc_size module parameter



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 a 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: default avatarNaoya Tezuka <naoyatezuka@chromium.org>
Link: https://lore.kernel.org/r/20250620062822.1018798-1-naoyatezuka@chromium.org
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
parent 8866f4e5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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();