[PATCH 2/3] hw/i386/acpi-build: return a non-var package from _PRT()

Ricardo Ribalda posted 3 patches 1 month ago
There is a newer version of this series
[PATCH 2/3] hw/i386/acpi-build: return a non-var package from _PRT()
Posted by Ricardo Ribalda 1 month ago
Windows XP seems to have issues when _PRT() returns a variable package.
We know in advance the size, so we can return a fixed package instead.

https://lore.kernel.org/qemu-devel/c82d9331-a8ce-4bb0-b51f-2ee789e27c86@ilande.co.uk/T/#m541190c942676bccf7a7f7fbcb450d94a4e2da53
Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 99cb2c6c7b ("hw/i386/acpi-build: Return a pre-computed _PRT table")
Closes: https://lore.kernel.org/all/eb11c984-ebe4-4a09-9d71-1e9db7fe7e6f@ilande.co.uk/
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4967aa7459..e7db51afba 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -741,7 +741,7 @@ static Aml *build_prt(bool is_pci0_prt)
     int pin;
 
     method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
-    rt_pkg = aml_varpackage(nroutes);
+    rt_pkg = aml_package(nroutes);
 
     for (pin = 0; pin < nroutes; pin++) {
         Aml *pkg = aml_package(4);
-- 
2.46.0.792.g87dc391469-goog
Re: [PATCH 2/3] hw/i386/acpi-build: return a non-var package from _PRT()
Posted by Igor Mammedov 4 weeks ago
On Sun, 22 Sep 2024 14:31:10 +0000
Ricardo Ribalda <ribalda@chromium.org> wrote:

> Windows XP seems to have issues when _PRT() returns a variable package.
> We know in advance the size, so we can return a fixed package instead.

XP doesn't support VarPackage, if you attach with wingdb to guest,
you'll likely will see ACPI related error 
 
> https://lore.kernel.org/qemu-devel/c82d9331-a8ce-4bb0-b51f-2ee789e27c86@ilande.co.uk/T/#m541190c942676bccf7a7f7fbcb450d94a4e2da53
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Fixes: 99cb2c6c7b ("hw/i386/acpi-build: Return a pre-computed _PRT table")
> Closes: https://lore.kernel.org/all/eb11c984-ebe4-4a09-9d71-1e9db7fe7e6f@ilande.co.uk/
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  hw/i386/acpi-build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 4967aa7459..e7db51afba 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -741,7 +741,7 @@ static Aml *build_prt(bool is_pci0_prt)
>      int pin;
>  
>      method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> -    rt_pkg = aml_varpackage(nroutes);

I'd add an assert here, to make sure that nroutes < 256

> +    rt_pkg = aml_package(nroutes);

Given that nroutes is 128, older Package should be able to
handle it.

>  
>      for (pin = 0; pin < nroutes; pin++) {
>          Aml *pkg = aml_package(4);

With assert added,
Reviewed-by: Igor Mammedov <imammedo@redhat.com>