diff mbox series

acpi: Fix table length for QEMU

Message ID 20250403053444.2551339-1-ilias.apalodimas@linaro.org
State Accepted
Commit 37a33d326e104ad725bcf127d3ffc59a5f9d58e6
Headers show
Series acpi: Fix table length for QEMU | expand

Commit Message

Ilias Apalodimas April 3, 2025, 5:34 a.m. UTC
The end of the ACPI table is set to 'addr' instead of 'end'. The ACPI
code for QEMU relies on those values to mark memory as 'ACPI Reclaim'
and as a result the ACPI RSDP ends up in Boot services Data.

Reported-by: bjorn@kernel.org
Fixes: commit 638cc363484b ("acpi: enable writing ACPI tables on QEMU")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 drivers/misc/qfw_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.49.0

Comments

Ilias Apalodimas April 3, 2025, 5:53 a.m. UTC | #1
On Thu, 3 Apr 2025 at 08:34, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> The end of the ACPI table is set to 'addr' instead of 'end'. The ACPI
> code for QEMU relies on those values to mark memory as 'ACPI Reclaim'
> and as a result the ACPI RSDP ends up in Boot services Data.
>
> Reported-by: bjorn@kernel.org

I obviously messed up my reported-by...

> Fixes: commit 638cc363484b ("acpi: enable writing ACPI tables on QEMU")
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  drivers/misc/qfw_acpi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/qfw_acpi.c b/drivers/misc/qfw_acpi.c
> index 0d0cf7646890..77cebae5e3fd 100644
> --- a/drivers/misc/qfw_acpi.c
> +++ b/drivers/misc/qfw_acpi.c
> @@ -305,7 +305,7 @@ static int evt_write_acpi_tables(void)
>         /* Generate ACPI tables */
>         end = write_acpi_tables(addr);
>         gd->arch.table_start = addr;
> -       gd->arch.table_end = addr;
> +       gd->arch.table_end = end;
>
>         return 0;
>  }
> --
> 2.49.0
>
Heinrich Schuchardt April 3, 2025, 6:57 a.m. UTC | #2
On 4/3/25 07:53, Ilias Apalodimas wrote:
> On Thu, 3 Apr 2025 at 08:34, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
>>
>> The end of the ACPI table is set to 'addr' instead of 'end'. The ACPI
>> code for QEMU relies on those values to mark memory as 'ACPI Reclaim'
>> and as a result the ACPI RSDP ends up in Boot services Data.
>>
>> Reported-by: bjorn@kernel.org
>
> I obviously messed up my reported-by...

Reported-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>
>> Fixes: commit 638cc363484b ("acpi: enable writing ACPI tables on QEMU")
>> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>> ---
>>   drivers/misc/qfw_acpi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/qfw_acpi.c b/drivers/misc/qfw_acpi.c
>> index 0d0cf7646890..77cebae5e3fd 100644
>> --- a/drivers/misc/qfw_acpi.c
>> +++ b/drivers/misc/qfw_acpi.c
>> @@ -305,7 +305,7 @@ static int evt_write_acpi_tables(void)
>>          /* Generate ACPI tables */
>>          end = write_acpi_tables(addr);
>>          gd->arch.table_start = addr;
>> -       gd->arch.table_end = addr;
>> +       gd->arch.table_end = end;
>>
>>          return 0;
>>   }
>> --
>> 2.49.0
>>
Ilias Apalodimas April 3, 2025, 7:01 a.m. UTC | #3
On Thu, 3 Apr 2025 at 09:57, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 4/3/25 07:53, Ilias Apalodimas wrote:
> > On Thu, 3 Apr 2025 at 08:34, Ilias Apalodimas
> > <ilias.apalodimas@linaro.org> wrote:
> >>
> >> The end of the ACPI table is set to 'addr' instead of 'end'. The ACPI
> >> code for QEMU relies on those values to mark memory as 'ACPI Reclaim'
> >> and as a result the ACPI RSDP ends up in Boot services Data.
> >>
> >> Reported-by: bjorn@kernel.org
> >
> > I obviously messed up my reported-by...
>
> Reported-by: Björn Töpel <bjorn@kernel.org>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Thanks Heinrich!

Cheers
/Ilias
>
> >
> >> Fixes: commit 638cc363484b ("acpi: enable writing ACPI tables on QEMU")
> >> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> >> ---
> >>   drivers/misc/qfw_acpi.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/misc/qfw_acpi.c b/drivers/misc/qfw_acpi.c
> >> index 0d0cf7646890..77cebae5e3fd 100644
> >> --- a/drivers/misc/qfw_acpi.c
> >> +++ b/drivers/misc/qfw_acpi.c
> >> @@ -305,7 +305,7 @@ static int evt_write_acpi_tables(void)
> >>          /* Generate ACPI tables */
> >>          end = write_acpi_tables(addr);
> >>          gd->arch.table_start = addr;
> >> -       gd->arch.table_end = addr;
> >> +       gd->arch.table_end = end;
> >>
> >>          return 0;
> >>   }
> >> --
> >> 2.49.0
> >>
>
Björn Töpel April 3, 2025, 8:59 a.m. UTC | #4
On Thu, 3 Apr 2025 at 09:02, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> On Thu, 3 Apr 2025 at 09:57, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > On 4/3/25 07:53, Ilias Apalodimas wrote:
> > > On Thu, 3 Apr 2025 at 08:34, Ilias Apalodimas
> > > <ilias.apalodimas@linaro.org> wrote:
> > >>
> > >> The end of the ACPI table is set to 'addr' instead of 'end'. The ACPI
> > >> code for QEMU relies on those values to mark memory as 'ACPI Reclaim'
> > >> and as a result the ACPI RSDP ends up in Boot services Data.
> > >>
> > >> Reported-by: bjorn@kernel.org
> > >
> > > I obviously messed up my reported-by...
> >
> > Reported-by: Björn Töpel <bjorn@kernel.org>
> > Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

With this patch applied to 2025.04-rc5:

  | ...
  | efi:   0x00047eed1000-0x00047eed1fff [ACPI Reclaim|   |  |  |  |
|  |  |  |  |  |   |WB|  |  |  ]
  | ...
  | ACPI: RSDP 0x000000047EED1000 000024 (v02 BOCHS )
  | ...

...and I can successfully kexec. ;-) Thank you!

Tested-by: Björn Töpel <bjorn@rivosinc.com>
diff mbox series

Patch

diff --git a/drivers/misc/qfw_acpi.c b/drivers/misc/qfw_acpi.c
index 0d0cf7646890..77cebae5e3fd 100644
--- a/drivers/misc/qfw_acpi.c
+++ b/drivers/misc/qfw_acpi.c
@@ -305,7 +305,7 @@  static int evt_write_acpi_tables(void)
 	/* Generate ACPI tables */
 	end = write_acpi_tables(addr);
 	gd->arch.table_start = addr;
-	gd->arch.table_end = addr;
+	gd->arch.table_end = end;

 	return 0;
 }