All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices
@ 2016-09-02 21:46 Wei Huang
  2016-09-05  1:40 ` Shannon Zhao
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wei Huang @ 2016-09-02 21:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, peter.maydell, zhaoshenglong, eric.auger

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.

Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/arm/virt-acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 28fc59c..295ec86 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices
  2016-09-02 21:46 [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices Wei Huang
@ 2016-09-05  1:40 ` Shannon Zhao
  2016-09-05  7:52 ` Auger Eric
  2016-09-05 13:55 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Shannon Zhao @ 2016-09-05  1:40 UTC (permalink / raw)
  To: Wei Huang, qemu-devel; +Cc: qemu-arm, peter.maydell, eric.auger



On 2016/9/3 5:46, Wei Huang wrote:
> 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.
> 
> Reported-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  hw/arm/virt-acpi-build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 28fc59c..295ec86 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -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);
> 
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

Thanks,
-- 
Shannon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices
  2016-09-02 21:46 [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices Wei Huang
  2016-09-05  1:40 ` Shannon Zhao
@ 2016-09-05  7:52 ` Auger Eric
  2016-09-05 13:55 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Auger Eric @ 2016-09-05  7:52 UTC (permalink / raw)
  To: Wei Huang, qemu-devel; +Cc: peter.maydell, qemu-arm, zhaoshenglong

Hi Wei,

On 02/09/2016 23:46, Wei Huang wrote:
> 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.
> 
> Reported-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  hw/arm/virt-acpi-build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 28fc59c..295ec86 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -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);
> 
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>

Tested on Cavium ThunderX.

Many thanks!

Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices
  2016-09-02 21:46 [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices Wei Huang
  2016-09-05  1:40 ` Shannon Zhao
  2016-09-05  7:52 ` Auger Eric
@ 2016-09-05 13:55 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-09-05 13:55 UTC (permalink / raw)
  To: Wei Huang; +Cc: QEMU Developers, qemu-arm, Shannon Zhao, Eric Auger

On 2 September 2016 at 22:46, Wei Huang <wei@redhat.com> wrote:
> 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.
>
> Reported-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  hw/arm/virt-acpi-build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 28fc59c..295ec86 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-05 13:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02 21:46 [Qemu-devel] [PATCH 1/1] ARM: ACPI: fix the AML ID format for CPU devices Wei Huang
2016-09-05  1:40 ` Shannon Zhao
2016-09-05  7:52 ` Auger Eric
2016-09-05 13:55 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.