Skip to contentSkip to conversation

acpi: fix bios linker loadder COMMAND_ALLOCATE on bigendian host

PATCH In review Igor Mammedov 3 participants 4 messages Apr 29, 2016 – May 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi: fix bios linker loadder COMMAND_ALLOCATE on bigendian host

'make check' fails with:

ERROR:tests/bios-tables-test.c:493:load_expected_aml:
assertion failed: (g_file_test(aml_file, G_FILE_TEST_EXISTS))

since commit:
caf50c7166a6ed96c462ab5db4b495e1234e4cc6
tests: pc: acpi: drop not needed 'expected SSDT' blobs

Assert happens because qemu-system-x86_64 generates SSDT table and test looks for a corresponding expected table to compare with.

However there is no expected SSDT blob anymore, since QEMU souldn't generate one. As it happens BIOS is not able to read ACPI tables from QEMU and fallbacks to embeded legacy ACPI codepath, which generates SSDT. That happens due to wrongly sized endiannes conversion which makes
uint8_t BiosLinkerLoaderEntry.alloc.zone
end up with 0 due to truncation of 32 bit integer which on host is 1 or 2.

Fix it by dropping invalid cpu_to_le32() as uint8_t doesn't require any conversion.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1330174

---
 hw/acpi/bios-linker-loader.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
hw/acpi/bios-linker-loader.c +2 -3
index ace9abb..5153ab1 100644
@@ -135,9 +135,8 @@ void bios_linker_loader_alloc(GArray *linker,
     strncpy(entry.alloc.file, file, sizeof entry.alloc.file - 1);
     entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ALLOCATE);
     entry.alloc.align = cpu_to_le32(alloc_align);
-    entry.alloc.zone = cpu_to_le32(alloc_fseg ?
-                                    BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG :
-                                    BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH);
+    entry.alloc.zone = alloc_fseg ? BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG :
+                                    BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH;
 
     /* Alloc entries must come first, so prepend them */
     g_array_prepend_vals(linker, &entry, sizeof entry);
Signature · 1 line
1.8.3.1
Tested-by on v1 1/1
#1 lore raw
Quoted 23 lines · Igor Mammedov

'make check' fails with:

ERROR:tests/bios-tables-test.c:493:load_expected_aml:
assertion failed: (g_file_test(aml_file, G_FILE_TEST_EXISTS))

since commit:
caf50c7166a6ed96c462ab5db4b495e1234e4cc6
tests: pc: acpi: drop not needed 'expected SSDT' blobs

Assert happens because qemu-system-x86_64 generates SSDT table and test looks for a corresponding expected table to compare with.

However there is no expected SSDT blob anymore, since QEMU souldn't generate one. As it happens BIOS is not able to read ACPI tables from QEMU and fallbacks to embeded legacy ACPI codepath, which generates SSDT. That happens due to wrongly sized endiannes conversion which makes
uint8_t BiosLinkerLoaderEntry.alloc.zone
end up with 0 due to truncation of 32 bit integer which on host is 1 or 2.

Quoted 6 lines

Fix it by dropping invalid cpu_to_le32() as uint8_t doesn't require any conversion.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1330174

Fix the problem.

We have always some warnings but they were already here in the previous releases.

Laurent

#2 lore raw
Quoted 29 lines · On Fri, 29 Apr 2016 15:16:07 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 28 lines · Igor Mammedov

'make check' fails with:

ERROR:tests/bios-tables-test.c:493:load_expected_aml:
assertion failed: (g_file_test(aml_file, G_FILE_TEST_EXISTS))

since commit:
caf50c7166a6ed96c462ab5db4b495e1234e4cc6
tests: pc: acpi: drop not needed 'expected SSDT' blobs

Assert happens because qemu-system-x86_64 generates SSDT table and test looks for a corresponding expected table to compare with.

However there is no expected SSDT blob anymore, since QEMU souldn't generate one. As it happens BIOS is not able to read ACPI tables from QEMU and fallbacks to embeded legacy ACPI codepath, which generates SSDT. That happens due to wrongly sized endiannes conversion which makes
uint8_t BiosLinkerLoaderEntry.alloc.zone
end up with 0 due to truncation of 32 bit integer which on host is 1 or 2.

Fix it by dropping invalid cpu_to_le32() as uint8_t doesn't require any conversion.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1330174

Quoted 8 lines
Quoted 1 line

Fix the problem.

We have always some warnings but they were already here in the previous releases.

That warnings are due to broken endianess handling in iasl, it looks at table header size and says it's too big because it doesn't take into account that all integers in ACPI are little-endian.

Quoted 3 lines

Laurent

Reviewed-by on v1 1/1
#3 lore raw
In reply to Igor Mammedov
Quoted 40 lines · Igor Mammedov

'make check' fails with:

ERROR:tests/bios-tables-test.c:493:load_expected_aml:
assertion failed: (g_file_test(aml_file, G_FILE_TEST_EXISTS))

since commit:
caf50c7166a6ed96c462ab5db4b495e1234e4cc6
tests: pc: acpi: drop not needed 'expected SSDT' blobs

Assert happens because qemu-system-x86_64 generates SSDT table and test looks for a corresponding expected table to compare with.

However there is no expected SSDT blob anymore, since QEMU souldn't generate one. As it happens BIOS is not able to read ACPI tables from QEMU and fallbacks to embeded legacy ACPI codepath, which generates SSDT. That happens due to wrongly sized endiannes conversion which makes
uint8_t BiosLinkerLoaderEntry.alloc.zone
end up with 0 due to truncation of 32 bit integer which on host is 1 or 2.

Fix it by dropping invalid cpu_to_le32() as uint8_t doesn't require any conversion.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1330174

---
  hw/acpi/bios-linker-loader.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
hw/acpi/bios-linker-loader.c +0 -0
index ace9abb..5153ab1 100644
@@ -135,9 +135,8 @@ void bios_linker_loader_alloc(GArray *linker,
      strncpy(entry.alloc.file, file, sizeof entry.alloc.file - 1);

hw/acpi/bios-linker-loader.c void bios_linker_loader_alloc(GArray *linker, · line 142

Quoted 10 lines
hw/acpi/bios-linker-loader.c +2 -3
      entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ALLOCATE);
      entry.alloc.align = cpu_to_le32(alloc_align);
-    entry.alloc.zone = cpu_to_le32(alloc_fseg ?
-                                    BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG :
-                                    BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH);
+    entry.alloc.zone = alloc_fseg ? BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG :
+                                    BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH;
 
      /* Alloc entries must come first, so prepend them */
      g_array_prepend_vals(linker, &entry, sizeof entry);

Thanks,
Marcel