diff mbox series

acpi/fadt: reject 5.0 tables with ARM specific attributes set

Message ID 20190220115934.15517-1-ard.biesheuvel@linaro.org
State Accepted
Headers show
Series acpi/fadt: reject 5.0 tables with ARM specific attributes set | expand

Commit Message

Ard Biesheuvel Feb. 20, 2019, 11:59 a.m. UTC
In ACPI 5.1, two reserved FADT fields were put to use, and renamed
to minor_version and arm_boot_flags, respectively. So compliant FADT
tables should either have a zero value in both fields, or have a
minor_version of at least 1 if the arm_boot_flags field is non-zero.

Since ACPI 5.1 is the lowest version of the spec that actually reasons
about ARM systems at all, the Linux arm64 ACPI layer rejects 5.0 or
earlier implementations of the FADT. However, FADT implementations have
been observed in the wild that do define all the ARM specific pieces
that did not exist in ACPI 5.0, but still keep the minor_version field
at zero. So let's flag these implementations by only permitting a
non-zero value of arm_boot_flags if the minor_version is >=1.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 src/acpi/fadt/fadt.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Alex Hung Feb. 20, 2019, 12:39 p.m. UTC | #1
On 2019-02-20 12:59 p.m., Ard Biesheuvel wrote:
> In ACPI 5.1, two reserved FADT fields were put to use, and renamed
> to minor_version and arm_boot_flags, respectively. So compliant FADT
> tables should either have a zero value in both fields, or have a
> minor_version of at least 1 if the arm_boot_flags field is non-zero.
> 
> Since ACPI 5.1 is the lowest version of the spec that actually reasons
> about ARM systems at all, the Linux arm64 ACPI layer rejects 5.0 or
> earlier implementations of the FADT. However, FADT implementations have
> been observed in the wild that do define all the ARM specific pieces
> that did not exist in ACPI 5.0, but still keep the minor_version field
> at zero. So let's flag these implementations by only permitting a
> non-zero value of arm_boot_flags if the minor_version is >=1.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  src/acpi/fadt/fadt.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
> index 14db51acda51..d7d6e3b862d1 100644
> --- a/src/acpi/fadt/fadt.c
> +++ b/src/acpi/fadt/fadt.c
> @@ -412,6 +412,13 @@ static void acpi_table_check_fadt_reserved(fwts_framework *fw)
>  		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTReservedZero",
>  			    "FADT second reserved field is not zero: 0x%02x",
>  			    fadt->reserved1);
> +
> +	if (fadt->header.revision == 5 &&
> +	    fadt->minor_version == 0 &&
> +	    fadt->arm_boot_flags != 0)
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTReservedZero",
> +			    "FADT 5.0 reserved field 'arm_boot_flags' is not zero: 0x%04x",
> +			    fadt->arm_boot_flags);
>  }
>  
>  static void acpi_table_check_fadt_pm_profile(fwts_framework *fw)
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King Feb. 20, 2019, 12:51 p.m. UTC | #2
On 20/02/2019 11:59, Ard Biesheuvel wrote:
> In ACPI 5.1, two reserved FADT fields were put to use, and renamed
> to minor_version and arm_boot_flags, respectively. So compliant FADT
> tables should either have a zero value in both fields, or have a
> minor_version of at least 1 if the arm_boot_flags field is non-zero.
> 
> Since ACPI 5.1 is the lowest version of the spec that actually reasons
> about ARM systems at all, the Linux arm64 ACPI layer rejects 5.0 or
> earlier implementations of the FADT. However, FADT implementations have
> been observed in the wild that do define all the ARM specific pieces
> that did not exist in ACPI 5.0, but still keep the minor_version field
> at zero. So let's flag these implementations by only permitting a
> non-zero value of arm_boot_flags if the minor_version is >=1.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  src/acpi/fadt/fadt.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
> index 14db51acda51..d7d6e3b862d1 100644
> --- a/src/acpi/fadt/fadt.c
> +++ b/src/acpi/fadt/fadt.c
> @@ -412,6 +412,13 @@ static void acpi_table_check_fadt_reserved(fwts_framework *fw)
>  		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTReservedZero",
>  			    "FADT second reserved field is not zero: 0x%02x",
>  			    fadt->reserved1);
> +
> +	if (fadt->header.revision == 5 &&
> +	    fadt->minor_version == 0 &&
> +	    fadt->arm_boot_flags != 0)
> +		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTReservedZero",
> +			    "FADT 5.0 reserved field 'arm_boot_flags' is not zero: 0x%04x",
> +			    fadt->arm_boot_flags);
>  }
>  
>  static void acpi_table_check_fadt_pm_profile(fwts_framework *fw)
> 

Thanks for this fix.

Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
index 14db51acda51..d7d6e3b862d1 100644
--- a/src/acpi/fadt/fadt.c
+++ b/src/acpi/fadt/fadt.c
@@ -412,6 +412,13 @@  static void acpi_table_check_fadt_reserved(fwts_framework *fw)
 		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTReservedZero",
 			    "FADT second reserved field is not zero: 0x%02x",
 			    fadt->reserved1);
+
+	if (fadt->header.revision == 5 &&
+	    fadt->minor_version == 0 &&
+	    fadt->arm_boot_flags != 0)
+		fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTReservedZero",
+			    "FADT 5.0 reserved field 'arm_boot_flags' is not zero: 0x%04x",
+			    fadt->arm_boot_flags);
 }
 
 static void acpi_table_check_fadt_pm_profile(fwts_framework *fw)