Skip to contentSkip to conversation

hw/pxb-pcie: fix PCI Express hotplug support

PATCH Superseded Marcel Apfelbaum 2 participants 4 messages Feb 2, 2017

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pxb-pcie: fix PCI Express hotplug support

Add the missing osc method for pxb-pcie devices

---

Note: The patch is based on the fact that Q35's osc method is quite generic.

Thanks,
Marcel

 hw/i386/acpi-build.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/i386/acpi-build.c +5 -0
index 1c928ab..555aab3 100644
@@ -1964,6 +1964,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
             aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
             aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
+            if (pci_bus_is_express(bus)) {
+                aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
+                aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
+                aml_append(dev, build_q35_osc_method());
+            }
 
             if (numa_node != NUMA_NODE_UNASSIGNED) {
                 aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
Signature · 1 line
2.5.5
#1 lore raw
Quoted 18 lines · Marcel Apfelbaum

Add the missing osc method for pxb-pcie devices

---

Note: The patch is based on the fact that Q35's osc method is quite generic.

Thanks,
Marcel

 hw/i386/acpi-build.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/i386/acpi-build.c +0 -0
index 1c928ab..555aab3 100644

hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1971

Quoted 8 lines
hw/i386/acpi-build.c +5 -0
@@ -1964,6 +1964,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
             aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
             aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
+            if (pci_bus_is_express(bus)) {
+                aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
+                aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
+                aml_append(dev, build_q35_osc_method());
+            }

I think we want to move this stuff into build_q35_osc_method:
"SUPP" seems to be 0, CTRL should be a variable passed in.

hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1974

Quoted 2 lines
hw/i386/acpi-build.c +0 -0
             if (numa_node != NUMA_NODE_UNASSIGNED) {
                 aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));

In fact build_q35_osc_method needs to be cleaned up. It stores result in "CTRL" which should be documented.

"SUPP" seems to be unused.

A bunch of comments missing.

More importantly, its an unserialized method but it creates a bunch of fields so attempts to run two of these in parallel will crash. I see the same in ACPI spec which probably means it should be revisited with a critical eye.

Quoted 2 lines
Signature · 1 line
2.5.5
#2 lore raw
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Marcel Apfelbaum

Add the missing osc method for pxb-pcie devices

---

Note: The patch is based on the fact that Q35's osc method is quite generic.

Thanks,
Marcel

 hw/i386/acpi-build.c | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 14 lines

hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1971

Quoted 13 lines
hw/i386/acpi-build.c +5 -0
index 1c928ab..555aab3 100644
@@ -1964,6 +1964,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
             aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
             aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
+            if (pci_bus_is_express(bus)) {
+                aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
+                aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
+                aml_append(dev, build_q35_osc_method());
+            }

Hi Michael,
Thanks for the review.

Quoted 3 lines

I think we want to move this stuff into build_q35_osc_method:
"SUPP" seems to be 0, CTRL should be a variable passed in.

Sure

Quoted 8 lines

hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1974

Quoted 3 lines
hw/i386/acpi-build.c +0 -0
             if (numa_node != NUMA_NODE_UNASSIGNED) {
                 aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));

In fact build_q35_osc_method needs to be cleaned up. It stores result in "CTRL" which should be documented.

Quoted 6 lines

"SUPP" seems to be unused.

A bunch of comments missing.

More importantly, its an unserialized method but it creates a bunch of fields so attempts to run two of these in parallel will crash.

I don't see how this code will run in parallel. (the code that calls the _OSC method)

Quoted 3 lines

I see the same in ACPI spec which probably means it should be revisited with a critical eye.

I am in PTO next week, then I'll revisit the build_q35_osc_method and (try to) clean it up.

Thanks,
Marcel

Quoted 3 lines
Quoted 3 lines
hw/i386/acpi-build.c +0 -1
--

2.5.5

#3 lore raw
Quoted 47 lines · Marcel Apfelbaum
Quoted 14 lines · Michael S. Tsirkin
Quoted 13 lines · Marcel Apfelbaum

Add the missing osc method for pxb-pcie devices

---

Note: The patch is based on the fact that Q35's osc method is quite generic.

Thanks,
Marcel

 hw/i386/acpi-build.c | 5 +++++
 1 file changed, 5 insertions(+)
Quoted 14 lines

hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1971

Quoted 13 lines
hw/i386/acpi-build.c +5 -0
index 1c928ab..555aab3 100644
@@ -1964,6 +1964,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
             aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
             aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
+            if (pci_bus_is_express(bus)) {
+                aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
+                aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
+                aml_append(dev, build_q35_osc_method());
+            }

Hi Michael,
Thanks for the review.

Quoted 3 lines

I think we want to move this stuff into build_q35_osc_method:
"SUPP" seems to be 0, CTRL should be a variable passed in.

Sure

Quoted 8 lines

hw/i386/acpi-build.c build_dsdt(GArray *table_data, BIOSLinker *linker, · line 1974

Quoted 3 lines
hw/i386/acpi-build.c +0 -0
             if (numa_node != NUMA_NODE_UNASSIGNED) {
                 aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));

In fact build_q35_osc_method needs to be cleaned up. It stores result in "CTRL" which should be documented.

Quoted 8 lines
Quoted 6 lines

"SUPP" seems to be unused.

A bunch of comments missing.

More importantly, its an unserialized method but it creates a bunch of fields so attempts to run two of these in parallel will crash.

I don't see how this code will run in parallel. (the code that calls the _OSC method)

If the method is not serialized, it should be callable in parallel. I'm guessing OSPMs do not do it for _OSC.

Quoted 12 lines
Quoted 3 lines

I see the same in ACPI spec which probably means it should be revisited with a critical eye.

I am in PTO next week, then I'll revisit the build_q35_osc_method and (try to) clean it up.

Thanks,
Marcel

Quoted 3 lines
Quoted 3 lines
hw/i386/acpi-build.c +0 -1
--

2.5.5