qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/acpi: Set memory regions to native endian as a work aroun


From: BALATON Zoltan
Subject: Re: [PATCH] hw/acpi: Set memory regions to native endian as a work around
Date: Mon, 8 Nov 2021 16:22:17 +0100 (CET)

On Mon, 8 Nov 2021, Michael S. Tsirkin wrote:
On Mon, Nov 08, 2021 at 02:05:42PM +0100, BALATON Zoltan wrote:
When using ACPI on big endian machine (such as ppc/pegasos2 which has
a VT8231 south bridge with ACPI) writes to ACPI registers come out
byte swapped. This may be caused by a bug in memory subsystem but
until that is fixed setting the ACPI memory regions to native endian
makes it usable for big endian machines. This fixes ACPI shutdown with
pegasos2 when using the board firmware for now.
This could be reverted when the memory layer is fixed.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>


Paolo, could you weight in on whether we can fix it properly
in the memory core? I suspect it's not a good idea to switch
to native without adding a bunch of byteswaps all
over the place ...

In fact I think switching to native is less likely to break anything else than fixing it in the memory core because AFAIK NATIVE_ENDIAN means no byte swap at all while LITTLE_ENDIAN means byte swap if vcpu is big endian so this would only change the pegasos2 case as other ACPI users are little endian machines where this change has no effect. You may want to consider this when trying a last minute fix but I'm OK with whatever solution that fixes the original problem.

Regards,
BALATON Zoltan

---
 hw/acpi/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 1e004d0078..543e4a7875 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -461,7 +461,7 @@ static const MemoryRegionOps acpi_pm_evt_ops = {
     .impl.min_access_size = 2,
     .valid.min_access_size = 1,
     .valid.max_access_size = 2,
-    .endianness = DEVICE_LITTLE_ENDIAN,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };

 void acpi_pm1_evt_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
@@ -531,7 +531,7 @@ static const MemoryRegionOps acpi_pm_tmr_ops = {
     .impl.min_access_size = 4,
     .valid.min_access_size = 1,
     .valid.max_access_size = 4,
-    .endianness = DEVICE_LITTLE_ENDIAN,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };

 void acpi_pm_tmr_init(ACPIREGS *ar, acpi_update_sci_fn update_sci,
@@ -608,7 +608,7 @@ static const MemoryRegionOps acpi_pm_cnt_ops = {
     .impl.min_access_size = 2,
     .valid.min_access_size = 1,
     .valid.max_access_size = 2,
-    .endianness = DEVICE_LITTLE_ENDIAN,
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };

 void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent,
--
2.30.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]