On Wed, 5 Jun 2024 17:08:45 +0100
Jonathan Cameron <[email protected]> wrote:

> On Wed, 5 Jun 2024 09:01:37 -0700
> Richard Henderson <[email protected]> wrote:
> 
> > On 6/5/24 10:27, Jonathan Cameron wrote:  
> > >> This fails testing:
> > >>
> > >> https://gitlab.com/qemu-project/qemu/-/jobs/7021105504
> > >>
> > >> acpi-test: Warning! SRAT binary file mismatch. Actual 
> > >> [aml:/tmp/aml-GHR6O2], Expected
> > >> [aml:tests/data/acpi/q35/SRAT.acpihmat-generic-x].
> > >> See source file tests/qtest/bios-tables-test.c for instructions on how 
> > >> to update expected
> > >> files.
> > >> to see ASL diff between mismatched files install IASL, rebuild QEMU from 
> > >> scratch and
> > >> re-run tests with V=1 environment variable set**
> > >> ERROR:../alt/tests/qtest/bios-tables-test.c:550:test_acpi_asl: assertion 
> > >> failed:
> > >> (all_tables_match)
> > >> Bail out! ERROR:../alt/tests/qtest/bios-tables-test.c:550:test_acpi_asl: 
> > >> assertion failed:
> > >> (all_tables_match)
> > >> Aborted (core dumped)
> > >>    
> > > 
> > > s390 and passes on an x86 host, so I guess an endian bug - any chance of 
> > > a table dump
> > > from someone with access to an s390 host?    
> > 
> > Sure.  By what incantation do I produce a dump?  
> 
> If you still have the /mnt/aml-GHR602 above then either upload that somewhere 
> or
> iasl -d /mnt/aml-GHR602
> should generate you a suitable text file.  However generic ports are fairly 
> recent
> so you may need a newer iasl from acpica-tools to decode.
> It will moan if it doesn't understand the content.
> 
make check-qtest-x86_64 is how I get the test to run in the first place.

Alternatively, this 'might' be sufficient if my guess for the problem
is correct. Thanks!

From 956df037f024783f19b6b00e5e280484380227a0 Mon Sep 17 00:00:00 2001
From: Jonathan Cameron <[email protected]>
Date: Wed, 5 Jun 2024 17:01:36 +0100
Subject: [PATCH] hw/acpi: Fix big endian host creation of Generic Port
 Affinity Structures

Treating the HID as an integer caused it to get bit reversed
on big endian hosts running little endian guests.  Treat it
as a character array instead.

Fixes hw/acpi: Generic Port Affinity Structure Support
Signed-off-by: Jonathan Cameron <[email protected]>

---
Maybe this is the only problem?  I don't have a setup to test
so any help would be appreciated.
---
 include/hw/acpi/acpi_generic_initiator.h | 2 +-
 hw/acpi/acpi_generic_initiator.c         | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/hw/acpi/acpi_generic_initiator.h 
b/include/hw/acpi/acpi_generic_initiator.h
index 1a899af30f..5baefda33a 100644
--- a/include/hw/acpi/acpi_generic_initiator.h
+++ b/include/hw/acpi/acpi_generic_initiator.h
@@ -61,7 +61,7 @@ typedef struct PCIDeviceHandle {
             uint16_t bdf;
         };
         struct {
-            uint64_t hid;
+            char hid[8];
             uint32_t uid;
         };
     };
diff --git a/hw/acpi/acpi_generic_initiator.c b/hw/acpi/acpi_generic_initiator.c
index 78b80dcf08..c2fb5ab2ef 100644
--- a/hw/acpi/acpi_generic_initiator.c
+++ b/hw/acpi/acpi_generic_initiator.c
@@ -150,8 +150,12 @@ build_srat_generic_node_affinity(GArray *table_data, int 
node,
         build_append_int_noprefix(table_data, handle->bdf, 2);
         build_append_int_noprefix(table_data, 0, 12);
     } else {
+        int i;
+
         /* Device Handle - ACPI */
-        build_append_int_noprefix(table_data, handle->hid, 8);
+        for (i = 0; i < sizeof(handle->hid); i++) {
+            build_append_int_noprefix(table_data, handle->hid[i], 1);
+        }
         build_append_int_noprefix(table_data, handle->uid, 4);
         build_append_int_noprefix(table_data, 0, 4);
     }
-- 
2.39.2


> Jonathan
> 
> > 
> > 
> > r~  
> 


Reply via email to