x86: acpi: Fix calculation of DSDT length
PATCH 1/2 x86: acpi: Fix calculation of DSDT length
Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized.
This is because the DSDT length is calculated after a call to acpi_inc_align(). Split this up into the following sequence:
* acpi_inc()
* Calculate DSDT length
* acpi_align()
---
arch/x86/lib/acpi_table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/lib/acpi_table.c +3 -1
@@ -427,7 +427,7 @@ ulong write_acpi_tables(ulong start_addr) (char *)&AmlCode +sizeof (struct acpi_table_header ), dsdt->length - sizeof(struct acpi_table_header)); -acpi_inc_align (ctx, dsdt->length -sizeof (struct acpi_table_header )); +acpi_inc (ctx, dsdt->length -sizeof (struct acpi_table_header ));/* Pack GNVS into the ACPI table area */ for (i =0 ; i < dsdt->length; i++) {
@@ -450,6 +450,8 @@ ulong write_acpi_tables(ulong start_addr) dsdt->checksum =0 ; dsdt->checksum =table_compute_checksum ((void *)dsdt, dsdt->length); +acpi_align (ctx); +/* * Fill in platform-specific global NVS variables. If this fails we * cannot return the error but this should only happen while debugging.
Signature · 1 line
2.28.0
PATCH 2/2 x86: acpi: Add memset to initialize SPCR table
Add a missing memset to acpi_create_spcr().
The other acpi_create_xxxx() functions perform a memset on their structures, acpi_create_spcr() does not and as a result the contents of this table are partly uninitialized (and thus random after every reset).
---
arch/x86/lib/acpi_table.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/lib/acpi_table.c +3 -0
@@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)int space_id;int ret = -ENODEV ; +memset ((void *)spcr,0 ,sizeof (struct acpi_spcr )); +/* Fill out header fields */ acpi_fill_header (header,"SPCR" ); header->length =sizeof (struct acpi_spcr );
@@ -359,6 +361,7 @@ static void acpi_create_spcr(struct acpi_spcr *spcr) spcr->baud_rate =0 ;/* Fix checksum */ + header->checksum =table_compute_checksum ((void *)spcr, header->length); }
Signature · 1 line
2.28.0
PATCH 2/2 x86: acpi: Add memset to initialize SPCR table
Quoted 5 lines · Wolfgang Wallner
Add a missing memset to
acpi_create_spcr().The other
acpi_create_xxxx()functions perform a memset on their structures,acpi_create_spcr()does not and as a result the contents of this table are partly uninitialized (and thus random after every reset).
Fixes: tag?
In any case, after addressing below,
Quoted 21 lines
Signed-off-by Wolfgang Wallner <[email protected]>---
arch/x86/lib/acpi_table.c | 3 +++ 1 file changed, 3 insertions(+)arch/x86/lib/acpi_table.c +2
-0@@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)int space_id;int ret = -ENODEV ; +memset ((void *)spcr,0 ,sizeof (struct acpi_spcr )); +/* Fill out header fields */ acpi_fill_header (header,"SPCR" ); header->length =sizeof (struct acpi_spcr );
arch/x86/lib/acpi_table.c static void acpi_create_spcr(struct acpi_spcr *spcr) · line 366
Quoted 6 lines
arch/x86/lib/acpi_table.c +1
-0@@ -359,6 +361,7 @@ static void acpi_create_spcr(struct acpi_spcr *spcr) spcr->baud_rate =0 ;/* Fix checksum */ + header->checksum =table_compute_checksum ((void *)spcr, header->length); }
Unrelated change.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 2/2 x86: acpi: Add memset to initialize SPCR table
In reply to Wolfgang WallnerQuoted 7 lines · Wolfgang Wallner
Add a missing memset to
acpi_create_spcr().The other
acpi_create_xxxx()functions perform a memset on their structures,acpi_create_spcr()does not and as a result the contents of this table are partly uninitialized (and thus random after every reset).
Quoted 5 lines
Signed-off-by Wolfgang Wallner <[email protected]>---
arch/x86/lib/acpi_table.c | 3 +++ 1 file changed, 3 insertions(+)
For further thought, I do wonder if acpi_fill_header() should do the memset, if sizeof() could be passed as a parameter?
PATCH 1/2 x86: acpi: Fix calculation of DSDT length
In reply to Wolfgang WallnerQuoted 9 lines · Wolfgang Wallner
Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized.
This is because the DSDT length is calculated after a call to
acpi_inc_align(). Split this up into the following sequence:*
acpi_inc()
* Calculate DSDT length
*acpi_align()
Perhaps Fixes: tag?
In any case,
Quoted 33 lines
Signed-off-by Wolfgang Wallner <[email protected]>---
arch/x86/lib/acpi_table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/x86/lib/acpi_table.c +3
-1@@ -427,7 +427,7 @@ ulong write_acpi_tables(ulong start_addr) (char *)&AmlCode +sizeof (struct acpi_table_header ), dsdt->length - sizeof(struct acpi_table_header)); -acpi_inc_align (ctx, dsdt->length -sizeof (struct acpi_table_header )); +acpi_inc (ctx, dsdt->length -sizeof (struct acpi_table_header ));/* Pack GNVS into the ACPI table area */ for (i =0 ; i < dsdt->length; i++) {@@ -450,6 +450,8 @@ ulong write_acpi_tables(ulong start_addr) dsdt->checksum =0 ; dsdt->checksum =table_compute_checksum ((void *)dsdt, dsdt->length); +acpi_align (ctx); +/* * Fill in platform-specific global NVS variables. If this fails we * cannot return the error but this should only happen while debugging. Signature · 1 line
2.28.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/2 x86: acpi: Fix calculation of DSDT length
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Wolfgang Wallner
Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized.
Quoted 8 lines
Quoted 6 lines
This is because the DSDT length is calculated after a call to
acpi_inc_align(). Split this up into the following sequence:*
acpi_inc()
* Calculate DSDT length
*acpi_align()Perhaps Fixes: tag?
Ah, it is against series not yet applied?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/2 x86: acpi: Fix calculation of DSDT length
Hi Andy,
-----"Andy Shevchenko" <[email protected]> schrieb: -----
Quoted 10 lines
Betreff: Re: [PATCH 1/2] x86: acpi: Fix calculation of DSDT length
Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Wolfgang Wallner
Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized.
This is because the DSDT length is calculated after a call to
acpi_inc_align(). Split this up into the following sequence:
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
*
acpi_inc()
* Calculate DSDT length
*acpi_align()Perhaps Fixes: tag?
Ah, it is against series not yet applied?
No, the patch is against master.
But I could not point to a specific commit that is fixed, the code in question is a result of multiple commits.
Because of this I have also sent V2 without a Fixes tags.
regards, Wolfgang
PATCH 1/2 x86: acpi: Fix calculation of DSDT length
Quoted 17 lines · Wolfgang Wallner
-----"Andy Shevchenko" <[email protected]> schrieb: -----
Quoted 16 lines
Betreff: Re: [PATCH 1/2] x86: acpi: Fix calculation of DSDT length
Quoted 12 lines · Andy Shevchenko
Quoted 9 lines · Wolfgang Wallner
Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized.
This is because the DSDT length is calculated after a call to
acpi_inc_align(). Split this up into the following sequence:*
acpi_inc()
* Calculate DSDT length
*acpi_align()Perhaps Fixes: tag?
Quoted 7 lines
Quoted 1 line
Ah, it is against series not yet applied?
No, the patch is against master.
But I could not point to a specific commit that is fixed, the code in question is a result of multiple commits.Because of this I have also sent V2 without a Fixes tags.
Hmm... Usually in kernel we put a chain of Fixes in such cases.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/2 x86: acpi: Fix calculation of DSDT length
In reply to Wolfgang WallnerQuoted 11 lines · Wolfgang Wallner
Currently, the calculation for the length of the DSDT table includes any bytes that are added for alignment, but those bytes are not initialized.
This is because the DSDT length is calculated after a call to
acpi_inc_align(). Split this up into the following sequence:*
acpi_inc()
* Calculate DSDT length
*acpi_align()
Quoted 6 lines
Signed-off-by Wolfgang Wallner <[email protected]>---
arch/x86/lib/acpi_table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)