Skip to contentSkip to conversation

ARM: ACPI: fix the AML ID format for CPU devices

PATCH In review Wei Huang 4 participants 4 messages Sep 2, 2016 – Sep 5, 2016

lore
Share & tools
lore

Wei Huang

author
#0 lore raw

PATCH 1/1 ARM: ACPI: fix the AML ID format for CPU devices

Current QEMU will stall guest VM booting under ACPI mode when vcpu count is >= 12. Analyzing the booting log, it turns out that DSDT table can't be loaded correctly due to "Invalid character(s) in name (0x62303043),
repaired: [C00*]". This is because existing QEMU uses a lower case AML ID for CPU devices (e.g. C000, C001, ..., C00a, C00b). The ACPI code inside guest VM detects this lower case character as an invalid character (see acpi_ut_valid_acpi_char() in drivers/acpi/acpica/utstring.c file) and converts it to "*". This causes duplicated IDs (i.e. "C00a" ==>"C00*" and "C00b" ==> "C00*"). So ACPI refuses to load the table.

This patch fixes the problem by changing the format with a upper case character. It matches the CPU ID formats used in other parts of QEMU code.

---
 hw/arm/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +1 -1
index 28fc59c..295ec86 100644
@@ -53,7 +53,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
     uint16_t i;
 
     for (i = 0; i < smp_cpus; i++) {
-        Aml *dev = aml_device("C%03x", i);
+        Aml *dev = aml_device("C%.03X", i);
         aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
         aml_append(dev, aml_name_decl("_UID", aml_int(i)));
         aml_append(scope, dev);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Wei Huang

Current QEMU will stall guest VM booting under ACPI mode when vcpu count is >= 12. Analyzing the booting log, it turns out that DSDT table can't be loaded correctly due to "Invalid character(s) in name (0x62303043),
repaired: [C00*]". This is because existing QEMU uses a lower case AML ID for CPU devices (e.g. C000, C001, ..., C00a, C00b). The ACPI code inside guest VM detects this lower case character as an invalid character (see acpi_ut_valid_acpi_char() in drivers/acpi/acpica/utstring.c file) and converts it to "*". This causes duplicated IDs (i.e. "C00a" ==>"C00*" and "C00b" ==> "C00*"). So ACPI refuses to load the table.

This patch fixes the problem by changing the format with a upper case character. It matches the CPU ID formats used in other parts of QEMU code.

---
 hw/arm/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +0 -0
index 28fc59c..295ec86 100644

hw/arm/virt-acpi-build.c static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) · line 59

Quoted 8 lines
hw/arm/virt-acpi-build.c +1 -1
@@ -53,7 +53,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
     uint16_t i;
 
     for (i = 0; i < smp_cpus; i++) {
-        Aml *dev = aml_device("C%03x", i);
+        Aml *dev = aml_device("C%.03X", i);
         aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
         aml_append(dev, aml_name_decl("_UID", aml_int(i)));
         aml_append(scope, dev);

Thanks,

Signature · 1 line
Shannon
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Wei Huang

Hi Wei,

Quoted 26 lines · Wei Huang

Current QEMU will stall guest VM booting under ACPI mode when vcpu count is >= 12. Analyzing the booting log, it turns out that DSDT table can't be loaded correctly due to "Invalid character(s) in name (0x62303043),
repaired: [C00*]". This is because existing QEMU uses a lower case AML ID for CPU devices (e.g. C000, C001, ..., C00a, C00b). The ACPI code inside guest VM detects this lower case character as an invalid character (see acpi_ut_valid_acpi_char() in drivers/acpi/acpica/utstring.c file) and converts it to "*". This causes duplicated IDs (i.e. "C00a" ==>"C00*" and "C00b" ==> "C00*"). So ACPI refuses to load the table.

This patch fixes the problem by changing the format with a upper case character. It matches the CPU ID formats used in other parts of QEMU code.

---
 hw/arm/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +0 -0
index 28fc59c..295ec86 100644

hw/arm/virt-acpi-build.c static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) · line 59

Quoted 8 lines
hw/arm/virt-acpi-build.c +1 -1
@@ -53,7 +53,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
     uint16_t i;
 
     for (i = 0; i < smp_cpus; i++) {
-        Aml *dev = aml_device("C%03x", i);
+        Aml *dev = aml_device("C%.03X", i);
         aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
         aml_append(dev, aml_name_decl("_UID", aml_int(i)));
         aml_append(scope, dev);

Tested on Cavium ThunderX.

Many thanks!

Eric

#3 lore raw
In reply to Wei Huang
Quoted 25 lines · Wei Huang

Current QEMU will stall guest VM booting under ACPI mode when vcpu count is >= 12. Analyzing the booting log, it turns out that DSDT table can't be loaded correctly due to "Invalid character(s) in name (0x62303043),
repaired: [C00*]". This is because existing QEMU uses a lower case AML ID for CPU devices (e.g. C000, C001, ..., C00a, C00b). The ACPI code inside guest VM detects this lower case character as an invalid character (see acpi_ut_valid_acpi_char() in drivers/acpi/acpica/utstring.c file) and converts it to "*". This causes duplicated IDs (i.e. "C00a" ==>"C00*" and "C00b" ==> "C00*"). So ACPI refuses to load the table.

This patch fixes the problem by changing the format with a upper case character. It matches the CPU ID formats used in other parts of QEMU code.

---
 hw/arm/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +0 -0
index 28fc59c..295ec86 100644

hw/arm/virt-acpi-build.c static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) · line 59

Quoted 8 lines
hw/arm/virt-acpi-build.c +1 -1
@@ -53,7 +53,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
     uint16_t i;
 
     for (i = 0; i < smp_cpus; i++) {
-        Aml *dev = aml_device("C%03x", i);
+        Aml *dev = aml_device("C%.03X", i);
         aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
         aml_append(dev, aml_name_decl("_UID", aml_int(i)));
         aml_append(scope, dev);

I see this is the format we use in hw/acpi/cpu.c, but why do we say "%.03X" rather than "%.3X" ? The two mean the same thing but one has a pointless extra 0 in the precision-specifier, as far as I can see...

Anyway, applied to target-arm.next.

thanks
-- PMM