pc: acpi: force FADT rev1 for 440fx based machine types
PATCH v2 1/1 pc: acpi: force FADT rev1 for 440fx based machine types
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit 77af8a2b hw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)
Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>
PS:
Only compile tested.
--- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
hw/i386/acpi-build.c +18 -4
@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;
@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =
@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;
@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,
@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); -bios_linker_loader_add_pointer (linker, -ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), -ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register); + }else { +bios_linker_loader_add_pointer (linker, +ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), +ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); + }build_header (linker, table_data, - (void *)fadt,"FACP" ,sizeof (*fadt),3 , oem_id, oem_table_id); + (void *)fadt,"FACP" , fadt_size, rev, oem_id, oem_table_id); } void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
Signature · 1 line
2.7.4
Quoted 99 lines · Igor Mammedov
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit77af8a2bhw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
Signed-off-by Igor Mammedov <[email protected]>---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>PS:
Only compile tested.CC Programmingkid <[email protected]>CC Phil Dennis-Jordan <[email protected]>CC "Michael S. Tsirkin" <[email protected]>---
hw/i386/acpi-build.c| 22 ++++++++++++++++++----1 file changed, 18 insertions(+), 4 deletions(-)hw/i386/acpi-build.c +18
-4@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); -bios_linker_loader_add_pointer (linker, -ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), -ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register); + }else { +bios_linker_loader_add_pointer (linker, +ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), +ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); + }build_header (linker, table_data, - (void *)fadt,"FACP" ,sizeof (*fadt),3 , oem_id, oem_table_id); + (void *)fadt,"FACP" , fadt_size, rev, oem_id, oem_table_id); } void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,Signature · 1 line
2.7.4
Just booted up Windows 2000 with your patch. Thank you.
Quoted 72 lines · Igor Mammedov
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit77af8a2bhw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
Signed-off-by Igor Mammedov <[email protected]>---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>PS:
Only compile tested.CC Programmingkid <[email protected]>CC Phil Dennis-Jordan <[email protected]>CC "Michael S. Tsirkin" <[email protected]>--- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)hw/i386/acpi-build.c +9
-0@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,
hw/i386/acpi-build.c build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, · line 367
Quoted 9 lines
hw/i386/acpi-build.c +3
-3@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); -bios_linker_loader_add_pointer (linker, -ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), -ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register);
I don't really like it that we are using structs to format fields - I would prefer build_append_int_noprefix based APIs - but since we do, let's add a proper structure for FADT rev 1 instead of this hack.
While we are at it, maybe we should replace macro hacks like ACPI_FADT_COMMON_DEF with simple sub-structures (unless you see a reason not to).
Quoted 14 lines
hw/i386/acpi-build.c +6
-1+ }else { +bios_linker_loader_add_pointer (linker, +ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), +ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); + }build_header (linker, table_data, - (void *)fadt,"FACP" ,sizeof (*fadt),3 , oem_id, oem_table_id); + (void *)fadt,"FACP" , fadt_size, rev, oem_id, oem_table_id); } void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,Signature · 1 line
2.7.4
Quoted 70 lines · On Tue, 25 Jul 2017 16:36:06 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 69 lines · Igor Mammedov
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit77af8a2bhw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
Signed-off-by Igor Mammedov <[email protected]>---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>PS:
Only compile tested.CC Programmingkid <[email protected]>CC Phil Dennis-Jordan <[email protected]>CC "Michael S. Tsirkin" <[email protected]>--- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)hw/i386/acpi-build.c +9
-0@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;
Quoted 16 lines
hw/i386/acpi-build.c build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, · line 367
Quoted 12 lines
hw/i386/acpi-build.c +3
-3/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); -bios_linker_loader_add_pointer (linker, -ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), -ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register);I don't really like it that we are using structs to format fields - I would prefer
build_append_int_noprefixbased APIs - but since we do, let's add a proper structure for FADT rev 1 instead of this hack.
I'll do it.
Quoted 4 lines
While we are at it, maybe we should replace macro hacks like
ACPI_FADT_COMMON_DEFwith simple sub-structures (unless you see a reason not to).
that would be rewriting every user that touches fields,
I'd ratter slowly /one table at time/ switch to build_append_int_noprefix() API instead of amending legacy approach.
Quoted 17 lines
Quoted 16 lines
hw/i386/acpi-build.c +6
-1+ }else { +bios_linker_loader_add_pointer (linker, +ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), +ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); + }build_header (linker, table_data, - (void *)fadt,"FACP" ,sizeof (*fadt),3 , oem_id, oem_table_id); + (void *)fadt,"FACP" , fadt_size, rev, oem_id, oem_table_id); } void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,Signature · 1 line
2.7.4
Quoted 92 lines · Igor Mammedov
Quoted 70 lines · On Tue, 25 Jul 2017 16:36:06 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 69 lines · Igor Mammedov
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit77af8a2bhw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
Signed-off-by Igor Mammedov <[email protected]>---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>PS:
Only compile tested.CC Programmingkid <[email protected]>CC Phil Dennis-Jordan <[email protected]>CC "Michael S. Tsirkin" <[email protected]>--- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)hw/i386/acpi-build.c +9
-0@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;Quoted 16 lines
hw/i386/acpi-build.c build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, · line 367
Quoted 12 lines
hw/i386/acpi-build.c +3
-3/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); -bios_linker_loader_add_pointer (linker, -ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), -ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register);I don't really like it that we are using structs to format fields - I would prefer
build_append_int_noprefixbased APIs - but since we do, let's add a proper structure for FADT rev 1 instead of this hack.I'll do it.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
While we are at it, maybe we should replace macro hacks like
ACPI_FADT_COMMON_DEFwith simple sub-structures (unless you see a reason not to).that would be rewriting every user that touches fields,
I'd ratter slowly /one table at time/ switch tobuild_append_int_noprefix()API instead of amending legacy approach.
Fine with me.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
hw/i386/acpi-build.c +6
-1+ }else { +bios_linker_loader_add_pointer (linker, +ACPI_BUILD_TABLE_FILE , xdsdt_entry_offset,sizeof (fadt->x_dsdt), +ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); + }build_header (linker, table_data, - (void *)fadt,"FACP" ,sizeof (*fadt),3 , oem_id, oem_table_id); + (void *)fadt,"FACP" , fadt_size, rev, oem_id, oem_table_id); } void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,Signature · 1 line
2.7.4
Quoted 74 lines · On Wed, 26 Jul 2017 23:18:01 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 73 lines · Igor Mammedov
Quoted 70 lines · On Tue, 25 Jul 2017 16:36:06 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 69 lines · Igor Mammedov
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit77af8a2bhw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
Signed-off-by Igor Mammedov <[email protected]>---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>PS:
Only compile tested.CC Programmingkid <[email protected]>CC Phil Dennis-Jordan <[email protected]>CC "Michael S. Tsirkin" <[email protected]>--- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)hw/i386/acpi-build.c +9
-0@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
hw/i386/acpi-build.c +0
-2/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_TABLE_FILE, xdsdt_entry_offset, sizeof(fadt->x_dsdt),Quoted 8 lines
Quoted 8 lines
hw/i386/acpi-build.c build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, · line 367
Quoted 4 lines
hw/i386/acpi-build.c +3
-1- ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register);I don't really like it that we are using structs to format fields - I would prefer
build_append_int_noprefixbased APIs - but since we do, let's add a proper structure for FADT rev 1 instead of this hack.
Michael,
I've tried to switch FADT to build_append_int_noprefix APIs, but it turned out into quite a bit of re-factoring including clean-ups and adding new APIs to pack all the stuff in FADT.
It's too much for hard freeze, lets not rush it and go with this patch for 2.10 to put out fire.
When 2.11 merge window is open I'll rebase/post FADTv1/3 conversion to build_append_int_noprefix API.
Quoted 100 lines · Igor Mammedov
Quoted 74 lines · On Wed, 26 Jul 2017 23:18:01 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 73 lines · Igor Mammedov
Quoted 70 lines · On Tue, 25 Jul 2017 16:36:06 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 69 lines · Igor Mammedov
w2k used to boot on QEMU until revision of FADT has
been bumped to rev3
(commit77af8a2bhw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support.)Keep PC machine at rev1 to remain compatible and Q35 at rev3 where w2k isn't supported anyway so OSX could run as well.
Signed-off-by Igor Mammedov <[email protected]>---
v2:
- make pc rev1 and q35 rev3.
"Michael S. Tsirkin" <[email protected]>PS:
Only compile tested.CC Programmingkid <[email protected]>CC Phil Dennis-Jordan <[email protected]>CC "Michael S. Tsirkin" <[email protected]>--- hw/i386/acpi-build.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)hw/i386/acpi-build.c +9
-0@@ -90,6 +90,7 @@ typedef struct AcpiMcfgInfo { } AcpiMcfgInfo; typedef struct AcpiPmInfo { + bool force_rev1_fadt; bool s3_disabled; bool s4_disabled; bool pcihp_bridge_en;@@ -129,10 +130,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)Object *obj =NULL ;QObject *o; + pm->force_rev1_fadt = false; pm->cpu_hp_io_base =0 ; pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ;if (piix) { +/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ + pm->force_rev1_fadt = true; obj = piix; pm->cpu_hp_io_base =PIIX4_CPU_HOTPLUG_IO_BASE ; pm->pcihp_io_base =@@ -304,6 +308,9 @@ static void fadt_setup(AcpiFadtDescriptorRev3 *fadt, AcpiPmInfo *pm) fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL ); } fadt->century =RTC_CENTURY ; +if (pm->force_rev1_fadt) { +return ; + } fadt->flags |=cpu_to_le32 (1 <<ACPI_FADT_F_RESET_REG_SUP ); fadt->reset_value =0xf ;@@ -342,6 +349,8 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; +int fadt_size =sizeof (*fadt); +int rev =3 ;Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
hw/i386/acpi-build.c +0
-2/* FACS address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker,@@ -353,12 +362,17 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,bios_linker_loader_add_pointer (linker,ACPI_BUILD_TABLE_FILE , dsdt_entry_offset,sizeof (fadt->dsdt),ACPI_BUILD_TABLE_FILE , dsdt_tbl_offset); - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_TABLE_FILE, xdsdt_entry_offset, sizeof(fadt->x_dsdt),Quoted 8 lines
Quoted 8 lines
hw/i386/acpi-build.c build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, · line 367
Quoted 4 lines
hw/i386/acpi-build.c +3
-1- ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); +if (pm->force_rev1_fadt) { + rev =1 ; + fadt_size = offsetof(typeof(*fadt), reset_register);I don't really like it that we are using structs to format fields - I would prefer
build_append_int_noprefixbased APIs - but since we do, let's add a proper structure for FADT rev 1 instead of this hack.Michael,
I've tried to switch FADT to
build_append_int_noprefixAPIs, but it turned out into quite a bit of re-factoring including clean-ups and adding new APIs to pack all the stuff in FADT.
Quoted 5 lines
It's too much for hard freeze, lets not rush it and go with this patch for 2.10 to put out fire.
When 2.11 merge window is open I'll rebase/post FADTv1/3 conversion to
build_append_int_noprefixAPI.
Makes sense.