arm/acpi: simplify aml code and enable SHPC
v5 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.
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 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v5 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.
--- hw/arm/virt-acpi-build.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
hw/arm/virt-acpi-build.c +8 -8
@@ -265,17 +265,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" )));
@@ -283,8 +283,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);
Signature · 1 line
1.8.3.1
PATCH v5 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.
--- hw/arm/virt-acpi-build.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +6 -1
@@ -265,7 +265,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 ))));
Signature · 1 line
1.8.3.1
Quoted 10 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.
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]>
Quoted 11 lines
Heyi Guo (2):
hw/arm/acpi: simplify AML bit and/or statement
hw/arm/acpi: enable SHPC native hot plughw/arm/virt-acpi-build.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)Signature · 1 line
1.8.3.1
Quoted 3 lines · On Sat, 9 Mar 2019 10:30:47 +0800 Heyi Guo <[email protected]> wrote:
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.
Peter,
could you queue it via your tree?
Quoted 24 lines
Igor also spotted the store operation outside of bit and/or is not necessary, so simply the code at first.
v5:
- Refine commit message of patch 1/2v4:
- 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]>Heyi Guo (2):
hw/arm/acpi: simplify AML bit and/or statement
hw/arm/acpi: enable SHPC native hot plughw/arm/virt-acpi-build.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
Hi Peter, Igor,
I couldn't find these 2 patches in the latest tree. Could you help to merge them?
Thanks,
HG
Quoted 35 lines · Igor Mammedov
Quoted 3 lines · On Sat, 9 Mar 2019 10:30:47 +0800 Heyi Guo <[email protected]> wrote:
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.
Peter,
could you queue it via your tree?Quoted 16 lines
Igor also spotted the store operation outside of bit and/or is not necessary, so simply the code at first.
v5:
- Refine commit message of patch 1/2v4:
- 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 7 lines
Heyi Guo (2):
hw/arm/acpi: simplify AML bit and/or statement
hw/arm/acpi: enable SHPC native hot plughw/arm/virt-acpi-build.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-).
Quoted 5 lines · Guoheyi
Hi Peter, Igor,
I couldn't find these 2 patches in the latest tree. Could you help to merge them?
In future I recommend pinging unapplied patches with a shorter delay than nine months :-) In QEMU's process, unless somebody has specifically said they've picked up the patch, it still "belongs" to the submitter to chase if it hasn't been applied. In this case I simply didn't see Igor's request that I take it -- the chances of me actually reading any particular list email even if it's cc'd to me are not good.
I tried applying them to target-arm.next but unfortunately they break 'make check':
TEST check-qtest-aarch64: tests/bios-tables-test
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-4IELC0], Expected [aml:tests/data/acpi/virt/DSDT].
acpi-test: Warning! DSDT mismatch. Actual [asl:/tmp/asl-AOELC0.dsl, aml:/tmp/aml-4IELC0], Expected [asl:/tmp/asl-XL7KC0.dsl, aml:tests/data/acpi/virt/DSDT].
** ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/tests/bios-tables-test.c:477:test_acpi_asl:
assertion failed: (all_tables_match)
ERROR - Bail out! ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/tests/bios-tables-test.c:477:test_acpi_asl:
assertion failed: (all_tables_match)
Aborted (core dumped) /home/petmay01/linaro/qemu-from-laptop/qemu/tests/Makefile.include:918:
recipe for target 'check-qtest-aarch64' failed
Could you fix and resubmit, please?
thanks
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 4 lines · Guoheyi
Hi Peter, Igor,
I couldn't find these 2 patches in the latest tree. Could you help to merge them?
In future I recommend pinging unapplied patches with a shorter delay than nine months :-)
Tha's really a long time...
Quoted 6 lines
In QEMU's process, unless somebody
has specifically said they've picked up the patch, it still "belongs" to the submitter to chase if it hasn't been applied. In this case I simply didn't see Igor's request that I take it -- the chances of me actually reading any particular list email even if it's cc'd to me are not good.
One of the reasons that I didn't check it earlier is that we don't really use PCI SHPC in our production version, for Linux ITS driver can only allocate a fixed range of MSI interrupts for a PCI-bridge during initialization, so a later plugged-in PCI device may not be able to get enough MSI interrupts and then fall back to legacy INTx. However, I think it is still better to let guest OS make the decision.
Quoted 20 lines
I tried applying them to target-arm.next but unfortunately they break 'make check':
TEST check-qtest-aarch64: tests/bios-tables-test
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-4IELC0], Expected [aml:tests/data/acpi/virt/DSDT].
acpi-test: Warning! DSDT mismatch. Actual [asl:/tmp/asl-AOELC0.dsl, aml:/tmp/aml-4IELC0], Expected [asl:/tmp/asl-XL7KC0.dsl, aml:tests/data/acpi/virt/DSDT].
** ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/tests/bios-tables-test.c:477:test_acpi_asl:
assertion failed: (all_tables_match)
ERROR - Bail out! ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/tests/bios-tables-test.c:477:test_acpi_asl:
assertion failed: (all_tables_match)
Aborted (core dumped)/home/petmay01/linaro/qemu-from-laptop/qemu/tests/Makefile.include:918:
recipe for target 'check-qtest-aarch64' failed
Quoted 1 line
Could you fix and resubmit, please?
Sure.
Thanks,
Heyi
Quoted 5 lines
thanks
-- PMM.