arm/acpi: simplify aml code and enable SHPC
v6 cover arm/acpi: simplify aml code and enable SHPC
After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, and we don't support ACPI hot plug, so just enable SHPC native hot plug.
Igor also spotted the store operation outside of bit and/or is not necessary, so simply the code at first.
v6:
- Fix "make check" errors by updating tests/data/acpi/virt/DSDT*.
v5:
- Refine commit message of patch 1/2
v4:
- Improve the code indention.
Heyi Guo (2):
hw/arm/acpi: simplify AML bit and/or statement
hw/arm/acpi: enable SHPC native hot plug
hw/arm/virt-acpi-build.c | 21 +++++++++++++-------- tests/data/acpi/virt/DSDT | Bin 18470 -> 18462 bytes tests/data/acpi/virt/DSDT.memhp | Bin 19807 -> 19799 bytes tests/data/acpi/virt/DSDT.numamem | Bin 18470 -> 18462 bytes 4 files changed, 13 insertions(+), 8 deletions(-)
Signature · 1 line
2.19.1
PATCH v6 1/2 hw/arm/acpi: simplify AML bit and/or statement
The last argument of AML bit and/or statement is the target variable, so we don't need to use a NULL target and then an additional store operation; using just aml_and() or aml_or() statement is enough.
Also update tests/data/acpi/virt/DSDT* to pass "make check".
--- hw/arm/virt-acpi-build.c | 16 ++++++++-------- tests/data/acpi/virt/DSDT | Bin 18470 -> 18462 bytes tests/data/acpi/virt/DSDT.memhp | Bin 19807 -> 19799 bytes tests/data/acpi/virt/DSDT.numamem | Bin 18470 -> 18462 bytes 4 files changed, 8 insertions(+), 8 deletions(-)
hw/arm/virt-acpi-build.c +8 -8
@@ -267,17 +267,17 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_store (aml_and (aml_name ("CTRL" ),aml_int (0x1D ),NULL ), -aml_name ("CTRL" ))); +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ), +aml_name ("CTRL" ))); ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x08 ),NULL ), -aml_name ("CDW1" ))); +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x08 ), +aml_name ("CDW1" )));aml_append (ifctx, ifctx1); ifctx1 =aml_if (aml_lnot (aml_equal (aml_name ("CDW3" ),aml_name ("CTRL" )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x10 ),NULL ), -aml_name ("CDW1" ))); +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x10 ), +aml_name ("CDW1" )));aml_append (ifctx, ifctx1);aml_append (ifctx,aml_store (aml_name ("CTRL" ),aml_name ("CDW3" )));
@@ -285,8 +285,8 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,aml_append (method, ifctx); elsectx =aml_else (); -aml_append (elsectx,aml_store (aml_or (aml_name ("CDW1" ),aml_int (4 ),NULL ), -aml_name ("CDW1" ))); +aml_append (elsectx,aml_or (aml_name ("CDW1" ),aml_int (4 ), +aml_name ("CDW1" )));aml_append (elsectx,aml_return (aml_arg (3 )));aml_append (method, elsectx);aml_append (dev, method);
tests/data/acpi/virt/DSDT binary +0 -0
tests/data/acpi/virt/DSDT.memhp binary +0 -0
tests/data/acpi/virt/DSDT.numamem binary +0 -0
Signature · 1 line
2.19.1
PATCH v6 2/2 hw/arm/acpi: enable SHPC native hot plug
In reply to Heyi GuoAfter the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, so just enable SHPC native hot plug.
Also update tests/data/acpi/virt/DSDT* to pass "make check".
--- hw/arm/virt-acpi-build.c | 7 ++++++- tests/data/acpi/virt/DSDT | Bin 18462 -> 18462 bytes tests/data/acpi/virt/DSDT.memhp | Bin 19799 -> 19799 bytes tests/data/acpi/virt/DSDT.numamem | Bin 18462 -> 18462 bytes 4 files changed, 6 insertions(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +6 -1
@@ -267,7 +267,12 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ), + +/* +* Allow OS control for all 5 features: +* PCIeHotplug SHPCHotplug PME AER PCIeCapability. +*/ +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1F ),aml_name ("CTRL" ))); ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 ))));
tests/data/acpi/virt/DSDT binary +0 -0
tests/data/acpi/virt/DSDT.memhp binary +0 -0
tests/data/acpi/virt/DSDT.numamem binary +0 -0
Signature · 1 line
2.19.1
Quoted 14 lines · Heyi Guo
After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, and we don't support ACPI hot plug, so just enable SHPC native hot plug.
Igor also spotted the store operation outside of bit and/or is not necessary, so simply the code at first.
v6:
- Fix "make check" errors by updating tests/data/acpi/virt/DSDT*.v5:
- Refine commit message of patch 1/2
Quoted 7 lines
v4:
- Improve the code indention.Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>
Thanks, applied to target-arm.next. (it's a bit awkward that acpi table updates require also updating a bunch of binary test files, but I suppose trying to make the golden-reference be some textual format would be not very feasible.)
thanks
-- PMM
Quoted 23 lines · On Mon, 9 Dec 2019 17:51:10 +0000 Peter Maydell <[email protected]>…
Quoted 14 lines · Heyi Guo
After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, and we don't support ACPI hot plug, so just enable SHPC native hot plug.
Igor also spotted the store operation outside of bit and/or is not necessary, so simply the code at first.
v6:
- Fix "make check" errors by updating tests/data/acpi/virt/DSDT*.v5:
- Refine commit message of patch 1/2Quoted 7 lines
v4:
- Improve the code indention.Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>
Quoted 4 lines
Thanks, applied to target-arm.next. (it's a bit awkward that acpi table updates require also updating a bunch of binary test files, but I suppose trying to make the golden-reference be some textual format would be not very feasible.)
Michael tried document it (commit 30c63d4fbd69) so that binary blobs would not be required (trusted).
Problem is usually in blobs being un-review-able and unresolvable merge conflicts, that's why Michael updates tables manually for all changes in pull req.
But in this case it touches only ARM tables and it's the first change to go in, so it could just work out.
Quoted 4 lines
thanks
-- PMM
Quoted 32 lines · Igor Mammedov
Quoted 23 lines · On Mon, 9 Dec 2019 17:51:10 +0000 Peter Maydell <[email protected]>…
Quoted 14 lines · Heyi Guo
After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, and we don't support ACPI hot plug, so just enable SHPC native hot plug.
Igor also spotted the store operation outside of bit and/or is not necessary, so simply the code at first.
v6:
- Fix "make check" errors by updating tests/data/acpi/virt/DSDT*.v5:
- Refine commit message of patch 1/2Quoted 7 lines
v4:
- Improve the code indention.Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Quoted 4 lines
Thanks, applied to target-arm.next. (it's a bit awkward that acpi table updates require also updating a bunch of binary test files, but I suppose trying to make the golden-reference be some textual format would be not very feasible.)
Quoted 6 lines
Michael tried document it (commit
30c63d4fbd69) so that binary blobs would not be required (trusted).Problem is usually in blobs being un-review-able and unresolvable merge conflicts, that's why Michael updates tables manually for all changes in pull req.
A workflow that requires me to do a blob update when I apply patches to target-arm.next isn't going to work for me. If Michael wants the blobs to be handled like that, then all patches which need to touch them will have to go via his tree.
thanks
-- PMM