Files
xen/tools/libacpi
David Woodhouse 54102e428b libacpi: fix PCI hotplug AML
The emulated PIIX3 uses a nybble for the status of each PCI function,
so the status for e.g. slot 0 functions 0 and 1 respectively can be
read as (\_GPE.PH00 & 0x0F), and (\_GPE.PH00 >> 0x04).

The AML that Xen gives to a guest gets the operand order for the odd-
numbered functions the wrong way round, returning (0x04 >> \_GPE.PH00)
instead.

As far as I can tell, this was the wrong way round in Xen from the
moment that PCI hotplug was first introduced in commit 83d82e6f35:

+                    ShiftRight (0x4, \_GPE.PH00, Local1)
+                    Return (Local1) /* IN status as the _STA */

Or maybe there's bizarre AML operand ordering going on there, like
Intel's wrong-way-round assembler, and it only broke later when it was
changed to being generated?

Either way, it's definitely wrong now, and instrumenting a Linux guest
shows that it correctly sees _STA being 0x00 in function 0 of an empty
slot, but then the loop in acpiphp_glue.c::get_slot_status() goes on to
look at function 1 and sees that _STA evaluates to 0x04. Thus reporting
an adapter is present in every slot in /sys/bus/pci/slots/*

Quite why Linux wants to look for function 1 being physically present
when function 0 isn't... I don't want to think about right now.

Fixes: 83d82e6f35 ("hvmloader: pass-through: multi-function PCI hot-plug")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: b190af7d3e
master date: 2023-03-20 17:12:34 +0100
2023-03-21 13:53:25 +01:00
..
2020-11-05 16:48:55 +01:00
2023-03-21 13:53:25 +01:00
2016-09-28 14:32:05 +01:00

ACPI builder for domain firmware


BUILDING ACPI
-----------------
Users of ACPI builder are expected to provide an include file that makes available
the following:
* strncpy
* printf
* NULL
* test_bit
* offsetof

When compiling build.c, the name of this include file should be given to
compiler as -DLIBACPI_STDUTILS=\"<filename>\". See tools/firmware/hvmloader/Makefile
for an example.

Note on DSDT Table
------------------
DSDT table source code is acpi_dsdt.asl
It is already compiled and the output is acpi_dsdt.c
Usually, user is not expected to change the acpi_dsdt.asl.
In case that the acpi_dsdt.asl need to be updated, please 
Follow the instruction:

# make acpi_dsdt.c

Note:
DSDT compiler "iasl" is needed. By default, it will be downloaded 
using wget in Makefile. if it failed, please download manually from 
http://developer.intel.com/technology/iapc/acpi/downloads.htm. 
then compile and install iasl