RFC [PATCH] piix4: don't reserve hw resources when hotplug is off
This is a RFC patch. This patch attempts to disable all acpi hotplug related hardware initialization and amls when hotplug for both pci root port and pci bridges are disabled on i440fx machines.
Thanks for looking at it and please provide comments. I will add unit tests when the final patch is ready and accepted.
--Ani
PATCH 1/1 piix4: don't reserve hw resources when hotplug is off globally
When acpi hotplug is turned off for both root pci bus as well as for pci bridges, we should not generate the related amls for DSDT table or initialize related hw ports or reserve hw resources. This change makes sure all those operations are turned off in the case acpi pci hotplug is off globally.
--- hw/acpi/piix4.c | 6 ++++-- hw/i386/acpi-build.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
hw/acpi/piix4.c +4 -2
@@ -596,8 +596,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, "acpi-gpe0", GPE_LEN);memory_region_add_subregion (parent,GPE_BASE , &s->io_gpe); -acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge); +if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { +acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, + s->use_acpi_hotplug_bridge); + } s->cpu_hotplug_legacy = true; object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",
hw/i386/acpi-build.c +8 -2
@@ -95,6 +95,7 @@ typedef struct AcpiPmInfo {bool s3_disabled;bool s4_disabled;bool pcihp_bridge_en; +bool pcihp_root_en;uint8_t s4_val;AcpiFadtData fadt;uint16_t cpu_hp_io_base;
@@ -245,6 +246,9 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->pcihp_bridge_en =object_property_get_bool (obj,"acpi-pci-hotplug-with-bridge-support" ,NULL ); + pm->pcihp_root_en = +object_property_get_bool (obj,"acpi-root-pci-hotplug" , +NULL ); }static void acpi_get_misc_info (AcpiMiscInfo *info)
@@ -1504,7 +1508,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,build_hpet_aml (dsdt);build_piix4_isa_bridge (dsdt);build_isa_devices_aml (dsdt); -build_piix4_pci_hotplug (dsdt); +if (pm->pcihp_bridge_en || pm->pcihp_root_en) { +build_piix4_pci_hotplug (dsdt); + }build_piix4_pci0_int (dsdt); }else { sb_scope =aml_scope ("_SB" );
@@ -1698,7 +1704,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,crs_range_set_free (&crs_range_set);/* reserve PCIHP resources */ -if (pm->pcihp_io_len) { +if (pm->pcihp_io_len && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { dev =aml_device ("PHPR" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0A06" ))); aml_append(dev,
Signature · 1 line
2.17.1
Re: [PATCH] piix4: don't reserve hw resources when hotplug is off globally
Please provide comments for this patch.
Quoted 73 lines · On Sep 1, 2020, 15:20 +0530, Ani Sinha <[email protected]>, wrote:
When acpi hotplug is turned off for both root pci bus as well as for pci bridges, we should not generate the related amls for DSDT table or initialize related hw ports or reserve hw resources. This change makes sure all those operations are turned off in the case acpi pci hotplug is off globally.
Signed-off-by Ani Sinha <[email protected]>---
hw/acpi/piix4.c| 6 ++++--hw/i386/acpi-build.c| 10 ++++++++--2 files changed, 12 insertions(+), 4 deletions(-)hw/acpi/piix4.c +4
-2@@ -596,8 +596,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, "acpi-gpe0", GPE_LEN);memory_region_add_subregion (parent,GPE_BASE , &s->io_gpe); -acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge); +if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { +acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, + s->use_acpi_hotplug_bridge); + } s->cpu_hotplug_legacy = true; object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",hw/i386/acpi-build.c +1
-0@@ -95,6 +95,7 @@ typedef struct AcpiPmInfo {bool s3_disabled;bool s4_disabled;bool pcihp_bridge_en; +bool pcihp_root_en;uint8_t s4_val;AcpiFadtData fadt;uint16_t cpu_hp_io_base;@@ -245,6 +246,9 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
pm->pcihp_bridge_en=object_property_get_bool(obj, "acpi-pci-hotplug-with-bridge-support", NULL);
+pm->pcihp_root_en=
+ object_property_get_bool(obj, "acpi-root-pci-hotplug",
+ NULL);
}static void
acpi_get_misc_info(AcpiMiscInfo *info)hw/i386/acpi-build.c +4
-3@@ -1504,7 +1508,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,build_hpet_aml (dsdt);build_piix4_isa_bridge (dsdt);build_isa_devices_aml (dsdt); -build_piix4_pci_hotplug (dsdt); +if (pm->pcihp_bridge_en || pm->pcihp_root_en) { +build_piix4_pci_hotplug (dsdt); + }build_piix4_pci0_int (dsdt); }else { sb_scope =aml_scope ("_SB" );@@ -1698,7 +1704,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,crs_range_set_free (&crs_range_set);/* reserve PCIHP resources */ -if (pm->pcihp_io_len) { +if (pm->pcihp_io_len && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { dev =aml_device ("PHPR" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0A06" ))); aml_append(dev, --2.17.1
Michael S. Tsirkin
AppliedRe: [PATCH] piix4: don't reserve hw resources when hotplug is off globally
In reply to Ani SinhaQuoted 6 lines · Ani Sinha
When acpi hotplug is turned off for both root pci bus as well as for pci bridges, we should not generate the related amls for DSDT table or initialize related hw ports or reserve hw resources. This change makes sure all those operations are turned off in the case acpi pci hotplug is off globally.
Signed-off-by Ani Sinha <[email protected]>
Queued. in the future pls do not reply to patch with a new version.
Thanks!
Quoted 66 lines
--- hw/acpi/piix4.c | 6 ++++-- hw/i386/acpi-build.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)hw/acpi/piix4.c +4
-2@@ -596,8 +596,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, "acpi-gpe0", GPE_LEN);memory_region_add_subregion (parent,GPE_BASE , &s->io_gpe); -acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge); +if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { +acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, + s->use_acpi_hotplug_bridge); + } s->cpu_hotplug_legacy = true; object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",hw/i386/acpi-build.c +8
-2@@ -95,6 +95,7 @@ typedef struct AcpiPmInfo {bool s3_disabled;bool s4_disabled;bool pcihp_bridge_en; +bool pcihp_root_en;uint8_t s4_val;AcpiFadtData fadt;uint16_t cpu_hp_io_base;@@ -245,6 +246,9 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->pcihp_bridge_en =object_property_get_bool (obj,"acpi-pci-hotplug-with-bridge-support" ,NULL ); + pm->pcihp_root_en = +object_property_get_bool (obj,"acpi-root-pci-hotplug" , +NULL ); }static void acpi_get_misc_info (AcpiMiscInfo *info)@@ -1504,7 +1508,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,build_hpet_aml (dsdt);build_piix4_isa_bridge (dsdt);build_isa_devices_aml (dsdt); -build_piix4_pci_hotplug (dsdt); +if (pm->pcihp_bridge_en || pm->pcihp_root_en) { +build_piix4_pci_hotplug (dsdt); + }build_piix4_pci0_int (dsdt); }else { sb_scope =aml_scope ("_SB" );@@ -1698,7 +1704,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,crs_range_set_free (&crs_range_set);/* reserve PCIHP resources */ -if (pm->pcihp_io_len) { +if (pm->pcihp_io_len && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { dev =aml_device ("PHPR" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0A06" ))); aml_append(dev,Signature · 1 line
2.17.1
Re: [PATCH] piix4: don't reserve hw resources when hotplug is off globally
Quoted 9 lines · On Sep 8, 2020, 19:35 +0530, Michael S. Tsirkin <[email protected]>, wrote:
Quoted 6 lines · Ani Sinha
When acpi hotplug is turned off for both root pci bus as well as for pci bridges, we should not generate the related amls for DSDT table or initialize related hw ports or reserve hw resources. This change makes sure all those operations are turned off in the case acpi pci hotplug is off globally.
Signed-off-by Ani Sinha <[email protected]>Queued. in the future pls do not reply to patch with a new version.
What new version? This is the only version for this patch.
You must be getting confused with some other patch I sent. I sent quite a few.
Quoted 70 lines
Thanks!
Quoted 66 lines
---
hw/acpi/piix4.c| 6 ++++--hw/i386/acpi-build.c| 10 ++++++++--2 files changed, 12 insertions(+), 4 deletions(-)hw/acpi/piix4.c +4
-2@@ -596,8 +596,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, "acpi-gpe0", GPE_LEN);memory_region_add_subregion (parent,GPE_BASE , &s->io_gpe); -acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge); +if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { +acpi_pcihp_init (OBJECT (s), &s->acpi_pci_hotplug, bus, parent, + s->use_acpi_hotplug_bridge); + } s->cpu_hotplug_legacy = true; object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",hw/i386/acpi-build.c +1
-0@@ -95,6 +95,7 @@ typedef struct AcpiPmInfo {bool s3_disabled;bool s4_disabled;bool pcihp_bridge_en; +bool pcihp_root_en;uint8_t s4_val;AcpiFadtData fadt;uint16_t cpu_hp_io_base;@@ -245,6 +246,9 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
pm->pcihp_bridge_en=object_property_get_bool(obj, "acpi-pci-hotplug-with-bridge-support", NULL);
+pm->pcihp_root_en=
+ object_property_get_bool(obj, "acpi-root-pci-hotplug",
+ NULL);
}static void
acpi_get_misc_info(AcpiMiscInfo *info)hw/i386/acpi-build.c +4
-3@@ -1504,7 +1508,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,build_hpet_aml (dsdt);build_piix4_isa_bridge (dsdt);build_isa_devices_aml (dsdt); -build_piix4_pci_hotplug (dsdt); +if (pm->pcihp_bridge_en || pm->pcihp_root_en) { +build_piix4_pci_hotplug (dsdt); + }build_piix4_pci0_int (dsdt); }else { sb_scope =aml_scope ("_SB" );@@ -1698,7 +1704,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,crs_range_set_free (&crs_range_set);/* reserve PCIHP resources */ -if (pm->pcihp_io_len) { +if (pm->pcihp_io_len && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { dev =aml_device ("PHPR" );aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0A06" ))); aml_append(dev, --2.17.1