Skip to contentSkip to conversation

hw/arm/acpi: enable SHPC native hot plug

PATCH In review Heyi Guo 2 participants 3 messages Mar 4, 2019 – Mar 5, 2019

lore
Share & tools
lore

Heyi Guo

author
#0 lore raw

PATCH v2 1/1 hw/arm/acpi: enable SHPC native hot plug

After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, so just enalbe SHPC native hot plug.

Cc Shannon Zhao <[email protected]>
Cc Peter Maydell <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
---
 hw/arm/virt-acpi-build.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +6 -1
index 04b62c7..7849ec5 100644
@@ -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_store(aml_and(aml_name("CTRL"), aml_int(0x1D), NULL),
+
+    /*
+     * Allow OS control for all 5 features:
+     * PCIeHotplug SHPCHotplug PME AER PCIeCapability.
+     */
+    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1F), NULL),
                                 aml_name("CTRL")));
 
     ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1))));
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 20 lines · On Mon, 4 Mar 2019 21:25:34 +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, so just enalbe SHPC native hot plug.

Cc Shannon Zhao <[email protected]>
Cc Peter Maydell <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
---
 hw/arm/virt-acpi-build.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +0 -0
index 04b62c7..7849ec5 100644
@@ -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"));

hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 274

Quoted 10 lines
hw/arm/virt-acpi-build.c +6 -1
     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),
+
+    /*
+     * Allow OS control for all 5 features:
+     * PCIeHotplug SHPCHotplug PME AER PCIeCapability.
+     */
+    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1F), NULL),
                                 aml_name("CTRL")));

aml_store here is excessive, you can use shorter variant that x86 uses

aml_and(a_ctrl, aml_int(0x1F), a_ctrl));

the last argument of aml_and() is the target var where to store computation result

Quoted 2 lines
hw/arm/virt-acpi-build.c +0 -0
     ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1))));
author
#2 lore raw
Quoted 35 lines · Igor Mammedov
Quoted 20 lines · On Mon, 4 Mar 2019 21:25:34 +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, so just enalbe SHPC native hot plug.

Cc Shannon Zhao <[email protected]>
Cc Peter Maydell <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
---
  hw/arm/virt-acpi-build.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +0 -0
index 04b62c7..7849ec5 100644
@@ -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"));

hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 274

Quoted 10 lines
hw/arm/virt-acpi-build.c +6 -1
      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),
+
+    /*
+     * Allow OS control for all 5 features:
+     * PCIeHotplug SHPCHotplug PME AER PCIeCapability.
+     */
+    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1F), NULL),
                                  aml_name("CTRL")));

aml_store here is excessive, you can use shorter variant that x86 uses

Quoted 3 lines
  aml_and(a_ctrl, aml_int(0x1F), a_ctrl));

the last argument of aml_and() is the target var where to store computation result

Indeed. I'm going to generate a separate patch to fix this first and then apply SHPC patch.

Thanks,
Heyi

Quoted 6 lines

hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 276

Quoted 3 lines
hw/arm/virt-acpi-build.c +0 -0
      ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1))));

.